diff --git a/LICENSE b/LICENSE
index 05b42e7c3046d795e55bf38134e40ebbaa69a6bb..44a9a405fb51c1fa27438fdbf7ff1bf7be82df49 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,94 +1,200 @@
-                      OAI PUBLIC LICENSE V1.0
+				The OpenAirInterface Software Alliance (OSA)
+					OAI Public License (Version 1.1)
 
- Copyright (C) 2016 OpenAirInterface Software Alliance, Inc. <http://www.openairinterface.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
+LICENSE TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION OF OPENAIR 5G SOFTWARE.
 
-Definitions.
-“License” shall mean the terms and conditions for use, reproduction, and distribution set forth in this  document.
+1.	Definitions.
 
-“Licensor” shall mean the OpenAirInterface Software Alliance.
-
-“Legal Entity” shall mean the union, at the time an acting entity joins the Alliance, of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
-
-“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License.
-
-“Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
-
-“Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
-
-“OpenAirInterface Software Alliance” shall mean the endowment fund established at the initiative of Eurecom, an educational and research establishment located at Campus Sophia Tech, 450 Route des Chappes, 06410 Biot, France, which statutes were signed on 18 November 2014.
-
-“ “Work” shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
-
-“Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
-
-“Contribution” shall mean any work of authorship that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, , or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work “Contributor License Agreement” shall mean the agreement signed by any Contributor setting forth the terms and conditions applicable to its Contribution. “Contributor” shall mean any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+“License” shall mean the terms and conditions for use, reproduction, and distribution set forth 
+in this document.
 
-Grant of Copyright License.
-Subject to the terms and conditions of this License, Licensor and each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form
-
-3. Grant of Patent License.
-
-3.1 Grant of Patent License for non-commercial purposes:
-
-Subject to the terms and conditions of this License, Licensor and each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, import, and otherwise transfer the Work, for non-commercial purposes, where such license applies only to those patent claims licensable by such Contributor or Licensor that are necessarily infringed by the Work and/or their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted.
-
-3.2 Grant of Patent License for commercial purposes:
-
-For commercial purposes, and subject to the terms and conditions of this License, You commits to be prepared to negotiate a patent license with each Contributor and/or the Licensor on Fair, Reasonable and Non-Discriminatory (“FRAND”) terms and conditions for the Work or Contribution(s) incorporated within the Work.
+“Licensor” shall mean the OpenAirInterface Software Alliance.
 
-Licensor and/or each Contributor, by submitting a Contribution, will identify any patent it owns related to the Work and/or its Contribution.
+“Legal Entity” shall mean the union, at the time an acting entity joins the Alliance, of the 
+acting entity and all other entities that control, are controlled by, or are under common control 
+with that entity. For the purposes of this definition, “control” means (i) the power, direct or 
+indirect, to cause the direction or management of such entity, whether by contract or 
+otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) 
+beneficial ownership of such entity.
+
+“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by 
+this License.
+
+“Source” form shall mean the preferred form for making modifications, including but not 
+limited to software source code, documentation source, and configuration files.
+
+“Object” form shall mean any form resulting from mechanical transformation or translation of 
+a Source form, including but not limited to compiled object code, generated documentation, 
+and conversions to other media types.
+
+“OpenAirInterface Software Alliance” shall mean the endowment fund established at the 
+initiative of Eurecom, an educational and research establishment located at Campus Sophia 
+Tech, 450 Route des Chappes, 06410 Biot, France, which statutes were signed on 18 
+November 2014.
+
+“Work” shall mean the work of authorship, whether in Source or Object form, made available 
+under the License, as indicated by a copyright notice that is included in or attached to the 
+work (an example is provided in the Appendix below).
+
+“Derivative Works” shall mean any work, whether in Source or Object form, that is based on 
+(or derived from) the Work and for which the editorial revisions, annotations, elaborations, or 
+other modifications represent, as a whole, an original work of authorship. For the purposes of 
+this License, Derivative Works shall not include works that remain separable from, or merely 
+link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+“Contribution” shall mean any work of authorship that is intentionally submitted to Licensor 
+for inclusion in the Work by the copyright owner or by an individual or Legal Entity 
+authorized to submit on behalf of the copyright owner. For the purposes of this definition, 
+“submitted” means any form of electronic, , or written communication sent to the Licensor or 
+its representatives, including but not limited to communication on electronic mailing lists, 
+source code control systems, and issue tracking systems that are managed by, or on behalf of, 
+the Licensor for the purpose of discussing and improving the Work
+
+“Contributor License Agreement” shall mean the agreement signed by any Contributor setting 
+forth the terms and conditions applicable to its Contribution. 
+
+“Contributor” shall mean any individual or Legal Entity on behalf of whom a Contribution 
+has been received by Licensor and subsequently incorporated within the Work.
+
+2.	Grant of Copyright License.
+Subject to the terms and conditions of this License, Licensor and each Contributor hereby 
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable 
+copyright license to reproduce, prepare Derivative Works of, publicly display, publicly 
+perform, and distribute the Work and such Derivative Works in Source or Object form
+
+3. 	Grant of Patent License.
+
+3.1 Grant of Patent License for study, testing and research purposes:
+Subject to the terms and conditions of this License, Licensor and each Contributor hereby 
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable 
+(except as stated in this section) patent license to make, have made, use, and otherwise 
+transfer (excluding selling) the Work, solely for study, testing and research purposes, where 
+such license applies only to those patent claims licensable by Licensor or such Contributor 
+that are necessarily infringed respectively by the Work and/or the said Contributor 
+Contribution(s) alone or by combination of their Contribution(s) with the Work  to which 
+such Contribution(s) was submitted (“Essential Patents”).
+
+3.2 Grant of Patent License for purposes other than study and research:
+For purposes other than study, testing and research, and subject to the terms and conditions of 
+this License, You commit to be prepared to negotiate a non-exclusive, non-transferable, non-
+assignable license of Essential Patents with each Contributor and/or the Licensor on Fair, 
+Reasonable and Non-Discriminatory (“FRAND”) terms and conditions for the use of the 
+Work or Contribution(s) incorporated within the Work.
+Licensor and/or each Contributor, by submitting a Contribution, will identify any of its known 
+Essential Patent it owns related to the Work and/or its Contribution.
 
 3.3 Patent Litigation
-
-If You institute patent litigation against any entity making non-commercial use of the Work (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistibution
-
-Subject to terms and conditions set forth in articles 2 and 3, You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
-
-
-
-
-1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
-
-2. You must cause any modified files by You to carry prominent notices stating that You changed the files; and
-
-3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
-
-4. If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
-
-
-You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
-
-5. Submission of Contributions. Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement such as the Contributor License Agreement You may have executed with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall Licensor and any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor and/or the Licensor,and only if You agree to indemnify, defend, and hold each Contributor and/or the Licensor harmless for any liability incurred by, or claims asserted against, such Contributor and/or Licensor by reason of Your accepting any such warranty or additional liability.
-
-10. Applicable law. The present license shall be governed by the laws of France.
+If You institute patent litigation against any entity making use of the Work solely for study, 
+testing and research purposes (including a cross-claim or counterclaim in a lawsuit) alleging 
+that the Work or a Contribution incorporated within the Work constitutes direct or 
+contributory patent infringement, then the patent licenses granted to You under section 3.1 of 
+this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Sublicensing
+You may grant sublicenses under the licenses granted under sections 2 and 3.1 provided that 
+the sublicense is subject to and inclusive of all the terms of and rights under this License to 
+which the Work is or was distributed by the OpenAirInterface Software Alliance.
+
+5. Redistribution
+Subject to terms and conditions set forth in sections 2 and 3, You may reproduce and 
+distribute copies of the Work or Derivative Works thereof in any medium, with or without 
+modifications, and in Source or Object form, provided that You meet the following 
+conditions:  
+
+1. You must give any other recipients of the Work or Derivative Works a copy of this 
+License; and
+
+2. You must cause any modified files by You to carry prominent notices stating that You 
+changed the files; and
+
+3. You must retain, in the Source form of any Derivative Works that You distribute, all 
+copyright, patent, trademark, and attribution notices from the Source form of the Work, 
+excluding those notices that do not pertain to any part of the Derivative Works; and
+
+4. If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative 
+Works that You distribute must include a readable copy of the attribution notices contained 
+within such NOTICE file, excluding those notices that do not pertain to any part of the 
+Derivative Works, in at least one of the following places: within a NOTICE text file 
+distributed as part of the Derivative Works; within the Source form or documentation, if 
+provided along with the Derivative Works; or, within a display generated by the Derivative 
+Works, if and wherever such third-party notices normally appear. The contents of the 
+NOTICE file are for informational purposes only and do not modify the License. You may 
+add Your own attribution notices within Derivative Works that You distribute, alongside or as 
+an addendum to the NOTICE text from the Work, provided that such additional attribution 
+notices cannot be construed as modifying the License. 
+You may add Your own copyright statement to Your modifications and may provide 
+additional or different license terms and conditions for use, reproduction, or distribution of 
+Your modifications, or for any such Derivative Works as a whole, provided Your use, 
+reproduction, and distribution of the Work otherwise complies with the conditions stated in 
+this License.
+
+6. Submission of Contributions. 
+Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be 
+under the terms and conditions of this License, without any additional terms or conditions. 
+Notwithstanding the above, nothing herein shall supersede or modify the terms of any 
+separate license agreement such as the Contributor License Agreement You may have 
+executed with Licensor regarding such Contributions.
+
+7. Trademarks. 
+This License does not grant permission to use the trade names, trademarks, service marks, or 
+product names of the Licensor, except as required for reasonable and customary use in 
+describing the origin of the Work and reproducing the content of the NOTICE file.
+
+8. Disclaimer of Warranty. 
+Unless required by applicable law or agreed to in writing, Licensor provides the Work (and 
+each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT 
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, 
+without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, 
+MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely 
+responsible for determining the appropriateness of using or redistributing the Work and 
+assume any risks associated with your exercise of permissions under this License.
+
+9. Limitation of Liability. 
+In no event and under no legal theory, whether in tort (including negligence), contract, or 
+otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or 
+agreed to in writing, shall Licensor and any Contributor, as such, be liable to You for 
+damages, including any direct, indirect, special, incidental, or consequential damages of any 
+character arising as a result of this License or out of Your use or inability to use the Work 
+(including but not limited to damages for loss of goodwill, work stoppage, computer failure or 
+malfunction, or any and all other commercial damages or losses), even if such Contributor has 
+been advised of the possibility of such damages.
+
+10. Accepting Warranty or Additional Liability. 
+While redistributing the Work or Derivative Works thereof, You may choose to offer, and 
+charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations 
+and/or rights consistent with this License. However, in accepting such obligations, You may 
+act only on Your own behalf and on Your sole responsibility, not on behalf of any other 
+Contributor and/or the Licensor, and only if You agree to indemnify, defend, and hold each 
+Contributor and/or the Licensor harmless for any liability incurred by, or claims asserted 
+against, such Contributor and/or Licensor by reason of Your accepting any such warranty or 
+additional liability.
+
+11. Applicable law. 
+The present license shall be governed by the laws of France.
 
 END OF TERMS AND CONDITIONS
 
-APPENDIX: How to apply the PRESENT OPENAIR 5G License to your work
-To apply the present License to your work, attach the following boilerplate notice, with the fields enclosed by brackets “[]” replaced with your own identifying information. (Don’t include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives.
+1.	APPENDIX: How to apply the PRESENT OPENAIR 5G License to your work
+To apply the present License to your work, attach the following boilerplate notice, with the 
+fields enclosed by brackets “[]” replaced with your own identifying information. (Don’t 
+include the brackets!) The text should be enclosed in the appropriate comment syntax for the 
+file format. We also recommend that a file or class name and description of purpose be 
+included on the same “printed page” as the copyright notice for easier identification within 
+third-party archives.
 
 Copyright [yyyy] [name of copyright owner]
-Licensed under the License terms and conditions for use, reproduction, and distribution of OPENAIR 5G software (the “License”);
 
-you may not use this file except in compliance with the License.You may obtain a copy of the License at
-Unless required by applicable law or agreed to in writing, software
+Licensed under the License terms and conditions for use, reproduction, and distribution of 
+OPENAIR 5G software (the “License”);
+
+you may not use this file except in compliance with the License. You may obtain a copy of 
+the License at
 
-distributed under the License is distributed on an “AS IS” BASIS,
+Unless required by applicable law or agreed to in writing, software distributed under the 
+License is distributed on an “AS IS” BASIS,
 
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
-See the License for the specific language governing permissions and
+See the License for the specific language governing permissions and limitations under the 
+License.
 
-limitations under the License.
diff --git a/README.txt b/README.txt
index bff09c7a2a0cc911d21f9ef7309ccdcb50e98a43..edd233830fb125cb581eeaf5092311fee5cfed16 100644
--- a/README.txt
+++ b/README.txt
@@ -43,3 +43,4 @@ v0.5.2 -> Last version with old code for oaisim (abstraction mode works)
 v0.6 -> RRH functionality, UE greatly improved, better TDD support,
         a lot of bugs fixed. WARNING: oaisim in PHY abstraction mode does not
         work, you need to use v0.5.2 for that.
+v0.6.1 -> Mostly bugfixes. This is the last version without NFAPI.
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 723ad38d67f1cb3113dc3ac13bf6ae466d108ff2..1ad1caf1fd2d13c80f2879ca0cf56ec62a071075 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
@@ -27,8 +27,8 @@ cmake_minimum_required (VERSION 2.8)
 # Base directories, compatible with legacy OAI building
 ################################################
 set (OPENAIR_DIR     $ENV{OPENAIR_DIR})
-#set (NFAPI_DIR       $ENV{NFAPI_DIR})
-set (NFAPI_DIR       ${OPENAIR_DIR}/nfapi)
+set (NFAPI_DIR       ${OPENAIR_DIR}/nfapi/open-nFAPI)
+set (NFAPI_USER_DIR  ${OPENAIR_DIR}/nfapi/oai_integration)
 set (OPENAIR1_DIR    ${OPENAIR_DIR}/openair1)
 set (OPENAIR2_DIR    ${OPENAIR_DIR}/openair2)
 set (OPENAIR3_DIR    ${OPENAIR_DIR}/openair3)
@@ -241,6 +241,7 @@ add_boolean_option(UE_AUTOTEST_TRACE   False "Activate UE autotest specific logs
 add_boolean_option(UE_DEBUG_TRACE      False "Activate UE debug trace")
 add_boolean_option(UE_TIMING_TRACE     False "Activate UE timing trace")
 add_boolean_option(DISABLE_LOG_X       False "Deactivate all LOG_* macros")
+add_boolean_option(USRP_REC_PLAY       False "Enable USRP record playback mode")
 
 add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
 
@@ -261,9 +262,6 @@ if (${ENABLE_ITTI})
   set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
 endif (${ENABLE_ITTI})
 
-add_boolean_option(RTAI False "Use RTAI")
-
-
 #############################
 # ASN.1 grammar C code generation & dependancies
 ################################
@@ -291,7 +289,7 @@ elseif (${RRC_ASN1_VERSION} STREQUAL "CBA")
 elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10")
   set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
 else()
-  set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e10.asn)
+  set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
 endif  (${RRC_ASN1_VERSION} STREQUAL "Rel8")
 
 set (RRC_FULL_DIR ${asn1_generated_dir}/${RRC_ASN1_VERSION})
@@ -312,11 +310,12 @@ if (NOT ${ret} STREQUAL 0)
   message(FATAL_ERROR "${fix_asn1c_call}: error")
 endif (NOT ${ret} STREQUAL 0)
 file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
-set(rrc_source  ${rrc_source} ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c)
 file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
 set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h)
 set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
-add_library(RRC_LIB ${rrc_h} ${rrc_source})
+add_library(RRC_LIB ${rrc_h} ${rrc_source}
+    ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c
+    ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c)
 include_directories ("${RRC_FULL_DIR}")
 
 # add the command to generate the source code
@@ -484,7 +483,6 @@ include_directories ("${X2AP_DIR}")
 ###################################
 add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
 add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
-add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4")
 
 add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR")
 
@@ -586,15 +584,13 @@ Message("CPU_Affinity flag is ${CPU_AFFINITY}")
 add_boolean_option(ENABLE_SECURITY         True  "Enable LTE integrity and ciphering between RRC UE and eNB")
 add_boolean_option(ENABLE_USE_MME          True  "eNB connected to MME (INTERFACE S1-C), not standalone eNB")
 add_boolean_option(NO_RRM                  True  "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
-add_boolean_option(USER_MODE True "????")
 add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer")
 
 add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
-add_boolean_option(DISABLE_USE_NAS False "???")
 add_boolean_option(DEADLINE_SCHEDULER True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
 add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only valid without deadline scheduler). It is enabled only with >2 CPUs")
 add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver")
-add_boolean_option(NAS_NETLINK False "???? Must be True to compile nasmesh driver without rtai")
+add_boolean_option(NAS_NETLINK False "useless ??? Must be True to compile nasmesh driver without rtai ????")
 add_boolean_option(OAISIM False "specific to oaisim")
 add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
 
@@ -604,29 +600,17 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False         "For generating sequenc
 add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams")
 add_boolean_option(MESSAGE_CHART_GENERATOR_PHY     False "trace some PHY exchanges in sequence diagrams")
 
-add_boolean_option(FLEXRAN_AGENT_SB_IF             False         "enable FlexRAN agent to inteface with a SDN controller")
-
 ########################
 # Include order
 ##########################
 add_boolean_option(ENB_MODE True "Swap the include directories between openair2 and openair3" )
 
-##########################
-# Emulation options
-##########################
-add_boolean_option(ENABLE_PGM_TRANSPORT    False "specific to oaisim, emulation through ethernet, reliable multicast")
-add_boolean_option(ADDR_CONF               False "specific to oaisim, IP autoconf of user-plane IP interface")
-add_boolean_option(OPENAIR_EMU             False "specific to oaisim")
-add_boolean_option(OAI_EMU                 False "specific to oaisim")
-add_boolean_option(PHY_ABSTRACTION         False "specific to oaisim")
-
 ##########################
 # SCHEDULING/REAL-TIME/PERF options
 ##########################
 add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: disable it if perf issues")
 add_boolean_option(ENABLE_VCD              True  "always true now, time measurements of proc calls and var displays")
 add_boolean_option(ENABLE_VCD_FIFO         True  "time measurements of proc calls and var displays sent to FIFO (one more thread)")
-add_boolean_option(HARD_RT                 False "???")
 add_boolean_option(LINUX                   False "used in weird memcpy() in pdcp.c ???")
 add_boolean_option(LINUX_LIST              False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
 add_boolean_option(LOG_NO_THREAD           True  "Disable thread for log, seems always set to true")
@@ -636,24 +620,15 @@ add_boolean_option(OPENAIR_LTE             True "Seems legacy: keep it to true")
 # PHY options
 ##########################
 add_boolean_option(DRIVER2013              True "only relevant for EXMIMO")
-add_boolean_option(ENABLE_FXP              True "????")
 add_boolean_option(ENABLE_NEW_MULTICAST    False "specific to oaisim")
 add_boolean_option(EXMIMO_IOT              True "????")
 add_boolean_option(LARGE_SCALE             False "specific to oaisim: defines max eNB=2 and max UE=120")
 add_boolean_option(LOCALIZATION            False "???")
 add_integer_option(MAX_NUM_CCs             1     "????")
 add_boolean_option(MU_RECEIVER             False "????")
-add_boolean_option(NEW_FFT                 True "????")
-add_boolean_option(OPENAIR1                True "????")
-add_boolean_option(PBS_SIM                 False "????")
-add_boolean_option(PC_DSP                  True "????")
-add_boolean_option(PC_TARGET               True "????")
-add_boolean_option(PERFECT_CE              False "????")
 add_boolean_option(PHYSIM                  True  "for L1 simulators (dlsim, ulsim, ...)")
 add_boolean_option(PHY_CONTEXT             True "not clear: must remain False for dlsim")
 add_boolean_option(PHY_EMUL                False "not clear: must remain False for dlsim")
-add_boolean_option(PUCCH                   True "????")
-add_boolean_option(RANDOM_BF               False "????")
 add_boolean_option(SMBV                    False "Rohde&Schwarz SMBV100A vector signal generator")
 add_boolean_option(DEBUG_PHY               False "Enable PHY layer debugging options")
 add_boolean_option(DEBUG_PHY_PROC          False "Enable debugging of PHY layer procedures")
@@ -726,23 +701,7 @@ add_boolean_option(RRC_DEFAULT_RAB_IS_AM       False  "Otherwise it is UM, confi
 ##########################
 # none
 
-##########################
-# PROJECTS (IST, FRENCH COLL., etc)
-# SPECIFIC OPTIONS
-##########################
-add_boolean_option(SPECTRA False "???")
-add_boolean_option(MIH_C_MEDIEVAL_EXTENSIONS False "EXTENSIONS TO MIH 802.21 IN CONTEXT OF IST PROJECT CALLED MEDIEVAL")
-
-
-
-add_boolean_option(EMOS False "????")
-if(${EMOS})
-  add_definitions("-D_FILE_OFFSET_BITS=64")
-  set(EMOS_LIB gps)
-endif(${EMOS})
-
-
- # add the binary tree to the search path for include files
+# add the binary tree to the search path for include files
 #######################################################
 # We will find ConfigOAI.h after generation in target directory
 include_directories("${OPENAIR_BIN_DIR}")
@@ -768,9 +727,13 @@ else()
   include_directories("${OPENAIR2_DIR}/UTIL")
   include_directories("${OPENAIR2_DIR}/UTIL/LOG")
 endif()
-include_directories("${NFAPI_DIR}")
+include_directories("${NFAPI_DIR}/nfapi/public_inc")
+include_directories("${NFAPI_DIR}/common/public_inc")
+include_directories("${NFAPI_DIR}/pnf/public_inc")
+include_directories("${NFAPI_DIR}/nfapi/inc")
+include_directories("${NFAPI_DIR}/sim_common/inc")
+include_directories("${NFAPI_DIR}/pnf_sim/inc")
 include_directories("${OPENAIR1_DIR}")
-include_directories("${OPENAIR2_DIR}/NAS")
 include_directories("${OPENAIR2_DIR}")
 include_directories("${OPENAIR2_DIR}/LAYER2/RLC")
 include_directories("${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0")
@@ -802,6 +765,8 @@ include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/")
 include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS")
 include_directories("${OPENAIR2_DIR}/ENB_APP")
 include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC")
+include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC")
+include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP")
 include_directories("${OPENAIR2_DIR}/UTIL/OSA")
 include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc")
 include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc")
@@ -823,92 +788,94 @@ include_directories("${OPENAIR_DIR}")
 
 # Utilities Library
 ################
-if (FLEXRAN_AGENT_SB_IF)
-  # set the version of protobuf messages, V3 not supported yet
-  add_list1_option(FLPT_VERSION V2 "FLPT MSG  protobuf  grammar version" V2 V3)
-
-  if (${FLPT_VERSION} STREQUAL "V2")
-    set (FLPTDIR V2)
-  elseif (${FLPT_VERSION} STREQUAL "V3")
-    set (FLPTDIR V3)
-  endif(${FLPT_VERSION} STREQUAL "V2")
-
-  set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} )
-  set(FLPT_MSG_FILES
-    ${FLPT_MSG_DIR}/header.proto
-    ${FLPT_MSG_DIR}/flexran.proto
-    ${FLPT_MSG_DIR}/stats_common.proto
-    ${FLPT_MSG_DIR}/stats_messages.proto
-    ${FLPT_MSG_DIR}/time_common.proto
-    ${FLPT_MSG_DIR}/controller_commands.proto
-    ${FLPT_MSG_DIR}/mac_primitives.proto
-    ${FLPT_MSG_DIR}/config_messages.proto
-    ${FLPT_MSG_DIR}/config_common.proto
-    ${FLPT_MSG_DIR}/control_delegation.proto
-    )
+# set the version of protobuf messages, V3 not supported yet
+add_list1_option(FLPT_VERSION V2 "FLPT MSG  protobuf  grammar version" V2 V3)
+
+if (${FLPT_VERSION} STREQUAL "V2")
+  set (FLPTDIR V2)
+elseif (${FLPT_VERSION} STREQUAL "V3")
+  set (FLPTDIR V3)
+endif(${FLPT_VERSION} STREQUAL "V2")
+
+set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} )
+set(FLPT_MSG_FILES
+  ${FLPT_MSG_DIR}/header.proto
+  ${FLPT_MSG_DIR}/flexran.proto
+  ${FLPT_MSG_DIR}/stats_common.proto
+  ${FLPT_MSG_DIR}/stats_messages.proto
+  ${FLPT_MSG_DIR}/time_common.proto
+  ${FLPT_MSG_DIR}/controller_commands.proto
+  ${FLPT_MSG_DIR}/mac_primitives.proto
+  ${FLPT_MSG_DIR}/config_messages.proto
+  ${FLPT_MSG_DIR}/config_common.proto
+  ${FLPT_MSG_DIR}/control_delegation.proto
+  )
 
-  set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR})
-  #message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}")
-  execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES})
-  file(GLOB FLPT_source ${FLPT_C_DIR}/*.c)
-  set(FLPT_OAI_generated
-    ${FLPT_C_DIR}/header.pb-c.c
-    ${FLPT_C_DIR}/flexran.pb-c.c
-    ${FLPT_C_DIR}/stats_common.pb-c.c
-    ${FLPT_C_DIR}/stats_messages.pb-c.c
-    ${FLPT_C_DIR}/time_common.pb-c.c
-    ${FLPT_C_DIR}/controller_commands.pb-c.c
-    ${FLPT_C_DIR}/mac_primitives.pb-c.c
-    ${FLPT_C_DIR}/config_messages.pb-c.c
-    ${FLPT_C_DIR}/config_common.pb-c.c
-    ${FLPT_C_DIR}/control_delegation.pb-c.c
-    )
+set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR})
+#message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}")
+execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES})
+file(GLOB FLPT_source ${FLPT_C_DIR}/*.c)
+set(FLPT_OAI_generated
+  ${FLPT_C_DIR}/header.pb-c.c
+  ${FLPT_C_DIR}/flexran.pb-c.c
+  ${FLPT_C_DIR}/stats_common.pb-c.c
+  ${FLPT_C_DIR}/stats_messages.pb-c.c
+  ${FLPT_C_DIR}/time_common.pb-c.c
+  ${FLPT_C_DIR}/controller_commands.pb-c.c
+  ${FLPT_C_DIR}/mac_primitives.pb-c.c
+  ${FLPT_C_DIR}/config_messages.pb-c.c
+  ${FLPT_C_DIR}/config_common.pb-c.c
+  ${FLPT_C_DIR}/control_delegation.pb-c.c
+  )
 
-  file(GLOB flpt_h ${FLPT_C_DIR}/*.h)
-  set(flpt_h ${flpt_h} )
+file(GLOB flpt_h ${FLPT_C_DIR}/*.h)
+set(flpt_h ${flpt_h} )
 
-  add_library(FLPT_MSG
-    ${FLPT_OAI_generated}
-    ${FLPT_source}
-    )
-  set(FLPT_MSG_LIB FLPT_MSG)
-  #message("prpt c dir is : ${FLPT_C_DIR}")
-  include_directories (${FLPT_C_DIR})
-
-  add_library(ASYNC_IF
-    ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
-    ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
-    ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
-    ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c
-    )
-  set(ASYNC_IF_LIB ASYNC_IF)
-  include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
-
- add_library(FLEXRAN_AGENT
-    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c
-    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c
-    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c
-    ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
-    ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c
-    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c
-    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c
-    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c
-    ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
-    )
-  set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT)
-  #include_directories(${OPENAIR2_DIR}/ENB_APP)
+add_library(FLPT_MSG
+  ${FLPT_OAI_generated}
+  ${FLPT_source}
+  )
+set(FLPT_MSG_LIB FLPT_MSG)
+#message("prpt c dir is : ${FLPT_C_DIR}")
+include_directories (${FLPT_C_DIR})
+
+add_library(ASYNC_IF
+  ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
+  ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
+  ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
+  ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c
+  )
+set(ASYNC_IF_LIB ASYNC_IF)
+include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
+
+add_library(FLEXRAN_AGENT
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api.c
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent_timer.c
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c
+  ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
+  ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
+  ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c
+  ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c
+  ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
+  )
+set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT)
+#include_directories(${OPENAIR2_DIR}/ENB_APP)
 
-  set(PROTOBUF_LIB "protobuf-c")
+set(PROTOBUF_LIB "protobuf-c")
 
-  FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h)
-  FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml)
+FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h)
+FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml)
 
-  INCLUDE(FindPackageHandleStandardArgs)
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR)
-  MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES)
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR)
+MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES)
 
-  #set(PROTOBUF_LIB "protobuf") #for Cpp
-endif()
+#set(PROTOBUF_LIB "protobuf") #for Cpp
 
 
 add_library(HASHTABLE
@@ -1002,6 +969,7 @@ 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/prach_procedures.c
   ${OPENAIR1_DIR}/SCHED/ru_procedures.c
 #  ${OPENAIR1_DIR}/SCHED/phy_mac_stub.c
   ${OPENAIR1_DIR}/SCHED/pucch_pc.c
@@ -1010,8 +978,84 @@ set(SCHED_SRC
 )
 add_library(SCHED_LIB ${SCHED_SRC})
 
+set(SCHED_SRC_UE
+  ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c
+  ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c
+  ${OPENAIR1_DIR}/SCHED/ru_procedures.c
+  ${OPENAIR1_DIR}/SCHED/prach_procedures.c
+  ${OPENAIR1_DIR}/SCHED/pucch_pc.c
+  ${OPENAIR1_DIR}/SCHED/pusch_pc.c
+  ${OPENAIR1_DIR}/SCHED/srs_pc.c
+)
+add_library(SCHED_UE_LIB ${SCHED_SRC_UE})
+
+# nFAPI
+#################################
+set(NFAPI_COMMON_SRC
+  ${NFAPI_DIR}/common/src/debug.c
+)
+add_library(NFAPI_COMMON_LIB ${NFAPI_COMMON_SRC})
+
+include_directories(${NFAPI_DIR}/common/public_inc)
+
+set(NFAPI_SRC
+  ${NFAPI_DIR}/nfapi/src/nfapi.c
+  ${NFAPI_DIR}/nfapi/src/nfapi_p4.c
+  ${NFAPI_DIR}/nfapi/src/nfapi_p5.c
+  ${NFAPI_DIR}/nfapi/src/nfapi_p7.c
+)
+add_library(NFAPI_LIB ${NFAPI_SRC})
+
+include_directories(${NFAPI_DIR}/nfapi/public_inc)
+include_directories(${NFAPI_DIR}/nfapi/inc)
+
+set(NFAPI_PNF_SRC
+  ${NFAPI_DIR}/pnf/src/pnf.c
+  ${NFAPI_DIR}/pnf/src/pnf_interface.c
+  ${NFAPI_DIR}/pnf/src/pnf_p7.c
+  ${NFAPI_DIR}/pnf/src/pnf_p7_interface.c
+)
+add_library(NFAPI_PNF_LIB ${NFAPI_PNF_SRC})
+
+include_directories(${NFAPI_DIR}/pnf/public_inc)
+include_directories(${NFAPI_DIR}/pnf/inc)
+
+set(NFAPI_VNF_SRC
+  ${NFAPI_DIR}/vnf/src/vnf.c
+  ${NFAPI_DIR}/vnf/src/vnf_interface.c
+  ${NFAPI_DIR}/vnf/src/vnf_p7.c
+  ${NFAPI_DIR}/vnf/src/vnf_p7_interface.c
+)
+add_library(NFAPI_VNF_LIB ${NFAPI_VNF_SRC})
+
+include_directories(${NFAPI_DIR}/vnf/public_inc)
+include_directories(${NFAPI_DIR}/vnf/inc)
+
+# nFAPI user defined code
+#############################
+set(NFAPI_USER_SRC
+  ${NFAPI_USER_DIR}/nfapi.c
+  ${NFAPI_USER_DIR}/nfapi_pnf.c
+  ${NFAPI_USER_DIR}/nfapi_vnf.c
+)
+add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC})
+include_directories(${NFAPI_USER_DIR})
+
 # Layer 1
 #############################
+set(PHY_TURBOSRC
+  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
+  ${OPENAIR1_DIR}/PHY/CODING/3gpplte.c
+  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
+  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
+  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
+  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder.c
+)
+set(PHY_TURBOIF
+  ${OPENAIR1_DIR}/PHY/CODING/coding_load.c
+)
+
+add_library(coding MODULE ${PHY_TURBOSRC} )
 set(PHY_SRC
   # depend on code generation from asn1c
   ${RRC_FULL_DIR}/asn1_constants.h
@@ -1079,15 +1123,107 @@ set(PHY_SRC
   ${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c
   ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c
   ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
-  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
   ${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
-  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
-  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
-  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
+  ${PHY_TURBOIF}
   ${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
   ${OPENAIR1_DIR}/PHY/CODING/viterbi.c
   ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
   ${OPENAIR1_DIR}/PHY/INIT/lte_init.c
+  ${OPENAIR1_DIR}/PHY/INIT/lte_init_ru.c
+  ${OPENAIR1_DIR}/PHY/INIT/lte_init_ue.c
+  ${OPENAIR1_DIR}/PHY/INIT/init_top.c
+  ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
+  ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/cdot_prod.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/sqrt.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
+  ${OPENAIR1_DIR}/PHY/TOOLS/lut.c
+  )
+
+set(PHY_SRC_UE
+  # depend on code generation from asn1c
+  ${RRC_FULL_DIR}/asn1_constants.h
+  # actual source
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_decoding.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/edci.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pch.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/drs_modulation.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_modulation.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_coding.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c
+  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c
+  ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
+  ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
+  ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c
+  ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c
+  ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c
+  ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c
+  ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
+  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c
+  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c
+  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c
+  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
+  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold_mbsfn.c
+  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_mbsfn.c
+  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_ul_ref.c
+  ${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c
+  ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c
+  ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
+  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
+  ${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
+  ${PHY_TURBOIF}
+  ${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
+  ${OPENAIR1_DIR}/PHY/CODING/viterbi.c
+  ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
+  ${OPENAIR1_DIR}/PHY/INIT/lte_init_ru.c
+  ${OPENAIR1_DIR}/PHY/INIT/lte_init_ue.c
+  ${OPENAIR1_DIR}/PHY/INIT/init_top.c
   ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
   ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
   ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
@@ -1103,15 +1239,18 @@ set(PHY_SRC
   ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
   ${OPENAIR1_DIR}/PHY/TOOLS/lut.c
   )
+
 if (${SMBV})
   set(PHY_SRC "${PHY_SRC} ${OPENAIR1_DIR}/PHY/TOOLS/smbv.c")
 endif  (${SMBV})
 
 if (${COMPILATION_AVX2} STREQUAL "True")
   set(PHY_SRC ${PHY_SRC} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c)
+  set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c)
 endif ()
 
 add_library(PHY ${PHY_SRC})
+add_library(PHY_UE ${PHY_SRC_UE})
 
 #Layer 2 library
 #####################
@@ -1165,14 +1304,60 @@ set(L2_SRC
   ${RRC_DIR}/rrc_eNB_UE_context.c
   ${RRC_DIR}/rrc_common.c
   ${RRC_DIR}/L2_interface.c
+  ${RRC_DIR}/L2_interface_common.c
+  ${RRC_DIR}/L2_interface_ue.c
   )
+
+set(L2_SRC_UE
+  ${PDCP_DIR}/pdcp.c
+  ${PDCP_DIR}/pdcp_fifo.c
+  ${PDCP_DIR}/pdcp_sequence_manager.c
+  ${PDCP_DIR}/pdcp_primitives.c
+  ${PDCP_DIR}/pdcp_util.c
+  ${PDCP_DIR}/pdcp_security.c
+  ${PDCP_DIR}/pdcp_netlink.c
+  ${RLC_AM_DIR}/rlc_am.c
+  ${RLC_AM_DIR}/rlc_am_init.c
+  ${RLC_AM_DIR}/rlc_am_timer_poll_retransmit.c
+  ${RLC_AM_DIR}/rlc_am_timer_reordering.c
+  ${RLC_AM_DIR}/rlc_am_timer_status_prohibit.c
+  ${RLC_AM_DIR}/rlc_am_segment.c
+  ${RLC_AM_DIR}/rlc_am_segments_holes.c
+  ${RLC_AM_DIR}/rlc_am_in_sdu.c
+  ${RLC_AM_DIR}/rlc_am_receiver.c
+  ${RLC_AM_DIR}/rlc_am_retransmit.c
+  ${RLC_AM_DIR}/rlc_am_windows.c
+  ${RLC_AM_DIR}/rlc_am_rx_list.c
+  ${RLC_AM_DIR}/rlc_am_reassembly.c
+  ${RLC_AM_DIR}/rlc_am_status_report.c
+  ${RLC_TM_DIR}/rlc_tm.c
+  ${RLC_TM_DIR}/rlc_tm_init.c
+  ${RLC_UM_DIR}/rlc_um.c
+  ${RLC_UM_DIR}/rlc_um_fsm.c
+  ${RLC_UM_DIR}/rlc_um_control_primitives.c
+  ${RLC_UM_DIR}/rlc_um_segment.c
+  ${RLC_UM_DIR}/rlc_um_reassembly.c
+  ${RLC_UM_DIR}/rlc_um_receiver.c
+  ${RLC_UM_DIR}/rlc_um_dar.c
+  ${RLC_DIR}/rlc_mac.c
+  ${RLC_DIR}/rlc.c
+  ${RLC_DIR}/rlc_rrc.c
+  ${RLC_DIR}/rlc_mpls.c
+  ${RRC_DIR}/rrc_UE.c
+  ${RRC_DIR}/rrc_common.c
+  ${RRC_DIR}/L2_interface_common.c
+  ${RRC_DIR}/L2_interface_ue.c
+  )
+
 set (MAC_SRC
   ${PHY_INTERFACE_DIR}/IF_Module.c
   ${MAC_DIR}/main.c
+  ${MAC_DIR}/main_ue.c
   ${MAC_DIR}/ue_procedures.c
   ${MAC_DIR}/ra_procedures.c
   ${MAC_DIR}/l1_helpers.c
   ${MAC_DIR}/rar_tools.c
+  ${MAC_DIR}/rar_tools_ue.c
   ${MAC_DIR}/eNB_scheduler.c
   ${MAC_DIR}/eNB_scheduler_dlsch.c
   ${MAC_DIR}/eNB_scheduler_ulsch.c
@@ -1183,21 +1368,22 @@ set (MAC_SRC
   ${MAC_DIR}/eNB_scheduler_phytest.c
   ${MAC_DIR}/pre_processor.c
   ${MAC_DIR}/config.c
+  ${MAC_DIR}/config_ue.c
  )
 
-if (FLEXRAN_AGENT_SB_IF)
-
-set (MAC_SRC ${MAC_SRC}
-  ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c
-  ${MAC_DIR}/flexran_agent_scheduler_dataplane.c
-  ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c
-)
-
-endif()
+set (MAC_SRC_UE
+  ${MAC_DIR}/main_ue.c
+  ${MAC_DIR}/ue_procedures.c
+  ${MAC_DIR}/ra_procedures.c
+  ${MAC_DIR}/l1_helpers.c
+  ${MAC_DIR}/rar_tools_ue.c
+  ${MAC_DIR}/config_ue.c
+ )
 
 set (ENB_APP_SRC
   ${OPENAIR2_DIR}/ENB_APP/enb_app.c
   ${OPENAIR2_DIR}/ENB_APP/enb_config.c
+  ${OPENAIR2_DIR}/ENB_APP/RRC_config_tools.c
   )
 
 add_library(L2
@@ -1206,13 +1392,13 @@ add_library(L2
   ${ENB_APP_SRC})
 #  ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c)
 
-if (FLEXRAN_AGENT_SB_IF)
+add_library(L2_UE
+  ${L2_SRC_UE}
+  ${MAC_SRC_UE}
+)
 
-#Test for adding a shared library
-add_library(default_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c)
-add_library(remote_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c)
 
-endif()
+include_directories(${NFAPI_USER_DIR})
 
 # L3 Libs
 ##########################
@@ -1243,26 +1429,6 @@ if (${ENABLE_RAL})
   set(RAL_LIB RAL)
 endif()
 
-if(${MIH_C_MEDIEVAL_EXTENSIONS})
-  set(MIH_SRC
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_header_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_msg_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_primitive_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F1_basic_data_types_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F2_general_data_types_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F3_data_types_for_address_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F4_data_types_for_links_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F9_data_types_for_qos_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F13_data_types_for_information_elements_codec.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_L2_type_values_for_tlv_encoding.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_Medieval_extensions.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_bit_buffer.c
-    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C.c
-    )
-  add_library(MIH ${MIH_SRC})
-  set(MIH_LIB MIH)
-endif()
-
 # CN libs
 ##########################
 
@@ -1553,6 +1719,17 @@ if(NAS_UE)
 endif()
 
 
+# nbiot
+add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16")
+set (NBIOT_SOURCES
+    ${OPENAIR2_DIR}/ENB_APP/NB_IoT_config.c
+)
+add_library(NB_IoT MODULE ${NBIOT_SOURCES} )
+
+# shared library loader
+set (SHLIB_LOADER_SOURCES
+    ${OPENAIR_DIR}/common/utils/load_module_shlib.c
+)
 
 # Make lfds as a own source code (even if it is a outside library)
 # For better intergration with compilation flags & structure of cmake
@@ -1612,13 +1789,20 @@ ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
 ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
 ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
 #${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/emu_transport.c
-${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/pgm_link.c
 )
 
 add_library(OPENAIR0_LIB
   ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
 )
 
+include_directories("${NFAPI_DIR}/nfapi/public_inc")
+include_directories("${NFAPI_DIR}/common/public_inc")
+include_directories("${NFAPI_DIR}/pnf/public_inc")
+include_directories("${NFAPI_DIR}/nfapi/inc")
+include_directories("${NFAPI_DIR}/sim_common/inc")
+include_directories("${NFAPI_DIR}/pnf_sim/inc")
+
+
 # System packages that are required
 # We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
 # or cmake provide a generic interface to pkg-config that widely used
@@ -1701,6 +1885,16 @@ if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h")
   endif()
 
   list(APPEND ATLAS_LIBRARIES lapack)
+
+# for ubuntu 17.10, directories are different
+elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h")
+
+  include_directories("/usr/include/x86_64-linux-gnu")
+  LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
+  list(APPEND ATLAS_LIBRARIES cblas)
+  list(APPEND ATLAS_LIBRARIES atlas)
+  list(APPEND ATLAS_LIBRARIES lapack)
+
 else()
   message("No Blas/Atlas libs found, some targets will fail")
 endif()
@@ -1764,10 +1958,10 @@ add_executable(lte-softmodem
   ${s1ap_h}
   ${OPENAIR_BIN_DIR}/messages_xml.h
   ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
   ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
   ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
   ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
+  ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
   ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
   ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
   ${OPENAIR_TARGETS}/COMMON/create_tasks.c
@@ -1777,7 +1971,6 @@ add_executable(lte-softmodem
   ${OPENAIR_DIR}/common/utils/utils.c
   ${OPENAIR_DIR}/common/utils/system.c
   ${GTPU_need_ITTI}
-  ${RTAI_SOURCE}
   ${XFORMS_SOURCE}
   ${XFORMS_SOURCE_SOFTMODEM}
   ${T_SOURCE}
@@ -1785,10 +1978,12 @@ add_executable(lte-softmodem
   ${SHLIB_LOADER_SOURCES}
   )
 
-target_link_libraries (lte-softmodem -ldl 
+target_link_libraries (lte-softmodem
   -Wl,--start-group
-  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} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-  -Wl,--end-group )
+  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} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
+  NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
+  -Wl,--end-group z dl)
 
 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  ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}  ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
@@ -1802,10 +1997,10 @@ add_executable(lte-softmodem-nos1
   ${s1ap_h}
   ${OPENAIR_BIN_DIR}/messages_xml.h
   ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
   ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
   ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
   ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
+  ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
   ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
   ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
   ${OPENAIR_TARGETS}/COMMON/create_tasks.c
@@ -1814,7 +2009,6 @@ add_executable(lte-softmodem-nos1
   ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
   ${OPENAIR_DIR}/common/utils/system.c
-  ${RTAI_SOURCE}
   ${XFORMS_SOURCE}
   ${XFORMS_SOURCE_SOFTMODEM}
   ${T_SOURCE}
@@ -1823,34 +2017,85 @@ add_executable(lte-softmodem-nos1
   )
 target_link_libraries (lte-softmodem-nos1
   -Wl,--start-group
-  RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-  -Wl,--end-group )
+  RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} 
+  ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
+  NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
+  -Wl,--end-group z dl )
 
 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}   ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
+target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp  ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
 target_link_libraries (lte-softmodem-nos1  ${LIB_LMS_LIBRARIES})
 target_link_libraries (lte-softmodem-nos1 ${T_LIB})
 
-# rrh
-################################
-#Note: only one RF type (USRP) is currently supported for RRH
-add_executable(rrh_gw
-  ${OPENAIR_TARGETS}/RT/USER/rrh_gw.c
-  ${OPENAIR_TARGETS}/RT/USER/eNB_transport_IQ.c
-  ${OPENAIR_TARGETS}/RT/USER/UE_transport_IQ.c
+# lte-uesoftmodem is  UE implementation
+#######################################
+
+add_executable(lte-uesoftmodem
+  ${rrc_h}
+  ${s1ap_h}
+  ${OPENAIR_BIN_DIR}/messages_xml.h
+  ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
+  ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
+  ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
+  ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
+  ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
+  ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
+  ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
+  ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
+  ${OPENAIR_DIR}/common/utils/utils.c
+  ${OPENAIR_DIR}/common/utils/system.c
+  ${XFORMS_SOURCE}
+  ${XFORMS_SOURCE_SOFTMODEM}
+  ${T_SOURCE}
+  ${CONFIG_SOURCES}
+  ${SHLIB_LOADER_SOURCES}
+  )
+
+target_link_libraries (lte-uesoftmodem
+  -Wl,--start-group
+  RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2_UE 
+  ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
+  -Wl,--end-group z dl)
+
+target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES})
+target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp  ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}  ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
+target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES})
+target_link_libraries (lte-uesoftmodem ${T_LIB})
+
+# lte-softmodem-nos1 is both eNB and UE implementation
+###################################################
+add_executable(lte-uesoftmodem-nos1
+  ${rrc_h}
+  ${s1ap_h}
+  ${OPENAIR_BIN_DIR}/messages_xml.h
   ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
+  ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
+  ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
+  ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
+  ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
+  ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+  ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
+  ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
+  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
+  ${OPENAIR_DIR}/common/utils/system.c
+  ${XFORMS_SOURCE}
+  ${XFORMS_SOURCE_SOFTMODEM}
   ${T_SOURCE}
+  ${CONFIG_SOURCES}
+  ${SHLIB_LOADER_SOURCES}
   )
-target_include_directories(rrh_gw PRIVATE  ${OPENAIR_DIR}/common/utils/itti)
-target_link_libraries(rrh_gw
+target_link_libraries (lte-uesoftmodem-nos1
   -Wl,--start-group
-  UTIL LFDS -ldl
-  -Wl,--end-group )
-target_link_libraries (rrh_gw rt pthread m )
-target_link_libraries (rrh_gw ${LIB_LMS_LIBRARIES})
-target_link_libraries (rrh_gw ${T_LIB})
+  RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_UE_LIB PHY_UE LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} 
+  ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
+  -Wl,--end-group z dl )
 
+target_link_libraries (lte-uesoftmodem-nos1 ${LIBXML2_LIBRARIES})
+target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp  ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
+target_link_libraries (lte-uesoftmodem-nos1  ${LIB_LMS_LIBRARIES})
+target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
 
 # USIM process
 #################
@@ -1903,8 +2148,7 @@ add_executable(oaisim
   ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
   ${OPENAIR_DIR}/common/utils/utils.c
   ${OPENAIR_DIR}/common/utils/system.c
-  ${GTPU_need_ITTI}
-  ${OPENAIR_TARGETS}/COMMON/create_tasks.c
+  ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
   ${XFORMS_SOURCE}
   ${T_SOURCE}
   ${CONFIG_SOURCES}
@@ -1915,18 +2159,18 @@ add_executable(oaisim
 target_include_directories(oaisim PUBLIC  ${OPENAIR_TARGETS}/SIMU/USER)
 target_link_libraries (oaisim
   -Wl,-ldl,--start-group
-  RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB}  ${MIH_LIB}
-  -Wl,--end-group )
+  RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2_UE ${MSC_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB}  ${MIH_LIB}
+  ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
+  -Wl,--end-group z dl)
 
 target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
-target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES}  ${NETTLE_LIBRARIES} sctp 
-  ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES})
+target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES}  ${NETTLE_LIBRARIES} sctp z
+  ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
 #Force link with forms, regardless XFORMS option
 target_link_libraries (oaisim forms)
 target_link_libraries (oaisim ${T_LIB})
 
 
-
 # A all in one network simulator
 ################
 add_executable(oaisim_nos1
@@ -1935,7 +2179,7 @@ add_executable(oaisim_nos1
   ${x2ap_h}
   ${OPENAIR_BIN_DIR}/messages_xml.h
   ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
+  ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
   ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
   ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
   ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
@@ -1948,7 +2192,7 @@ add_executable(oaisim_nos1
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
   ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
   ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
-  ${OPENAIR_TARGETS}/COMMON/create_tasks.c
+  ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
   ${OPENAIR_DIR}/common/utils/system.c
   ${XFORMS_SOURCE}
   ${T_SOURCE}
@@ -1958,8 +2202,8 @@ add_executable(oaisim_nos1
 target_include_directories(oaisim_nos1 PUBLIC  ${OPENAIR_TARGETS}/SIMU/USER)
 target_link_libraries (oaisim_nos1
   -Wl,--start-group
-  RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SECU_OSA ${ITTI_LIB}  ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-  -Wl,--end-group )
+  RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_UE_LIB PHY_UE LFDS ${MSC_LIB} ${ITTI_LIB} SIMU L2_UE ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
+  -Wl,--end-group z dl )
 
 target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
 target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES}  ${NETTLE_LIBRARIES}  
@@ -1994,11 +2238,12 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
     ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
     ${XFORMS_SOURCE}
     ${T_SOURCE}
+    ${CONFIG_SOURCES}
     )
   target_link_libraries (${myExe}
 
     -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
-    pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB}
+    pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
     )
 endforeach(myExe)
 
@@ -2066,7 +2311,7 @@ endforeach(myExe)
 if (${T_TRACER})
   foreach(i
         #all "add_executable" definitions (except tests, rb_tool, updatefw)
-        lte-softmodem lte-softmodem-nos1 rrh_gw oaisim oaisim_nos1
+        lte-softmodem lte-softmodem-nos1 oaisim oaisim_nos1
         dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
         pdcchsim pucchsim prachsim syncsim
         #all "add_library" definitions
@@ -2074,7 +2319,7 @@ if (${T_TRACER})
         oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
         oai_eth_transpro
         FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
-        SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL MIH CN_UTILS
+        SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS
         GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB)
     if (TARGET ${i})
       add_dependencies(${i} generate_T)
@@ -2134,9 +2379,8 @@ add_custom_command (
 # retrieve the compiler options to send it to gccxml
 get_directory_property(DirDefs COMPILE_DEFINITIONS )
 foreach( d ${DirDefs} )
-  set(module_cc_opt_tmp "${module_cc_opt_tmp} -D${d}")
+  set(module_cc_opt "${module_cc_opt} -D${d}")
 endforeach()
-string(REPLACE "-DUSER_MODE" "" module_cc_opt ${module_cc_opt_tmp})
 get_directory_property( DirDefs INCLUDE_DIRECTORIES )
 foreach( d ${DirDefs} )
   set(module_cc_opt "${module_cc_opt} -I${d}")
@@ -2168,15 +2412,7 @@ endfunction(make_driver name dir src)
 # nashmesh module
 ################
 list(APPEND nasmesh_src device.c common.c ioctl.c classifier.c tool.c mesh.c)
-# Actually nasty stuff to be FIXED: the hereafter flag is for RTAI compilation in the driver,
-# but has different meaning in the other parts of the code
-# We should change the constant name to xxx_RTAI or likely
-if(NOT ${module_cc_opt} MATCHES "DRTAI")
-  set(module_cc_opt "${module_cc_opt} -DNAS_NETLINK")
-else()
-  string(REPLACE "-DNAS_NETLINK" "" tmp "${module_cc_opt}")
-  set(module_cc_opt ${tmp})
-endif()
+set(module_cc_opt "${module_cc_opt} -DNAS_NETLINK -DPDCP_USE_NETLINK")
 # legacy Makefile was using NAS_NETLINK flag, but other drivers the hereafter flag
 # so, this cmake use OAI_NW_DRIVER_USE_NETLINK everywhere
 if (OAI_NW_DRIVER_USE_NETLINK)
@@ -2253,3 +2489,8 @@ ADD_CUSTOM_TARGET(oarf
    DEPENDS ${OCT_FILES}
 )
 
+include (${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_CMakeLists.txt)
+
+
+
+
diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt
index db49a9181d6009523a8e596b18d54add9603da16..54f369f97772e7bdbf8214b191afdfb89e7cfce4 100755
--- a/cmake_targets/at_commands/CMakeLists.txt
+++ b/cmake_targets/at_commands/CMakeLists.txt
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/core.py b/cmake_targets/autotests/core.py
index 2665e57372a196c62c639f0c8b27956eb6f4712e..09785df1203c9bf8829a5e0a786fb755ea0033ef 100644
--- a/cmake_targets/autotests/core.py
+++ b/cmake_targets/autotests/core.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/log.py b/cmake_targets/autotests/log.py
index 25eb2b5ffb0254c1e5bfcd9c7019b1f64119225a..5a97b19cf23429b5a430a465d31e2dfcda8728a1 100644
--- a/cmake_targets/autotests/log.py
+++ b/cmake_targets/autotests/log.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/openair.py b/cmake_targets/autotests/openair.py
index 7ad118ef1bba19a1d9e6f186ecbd341dfb7d8f5f..beb12cd2a20821f123b281ec18bb4954d6c88daf 100644
--- a/cmake_targets/autotests/openair.py
+++ b/cmake_targets/autotests/openair.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/run_compilation_autotests.bash b/cmake_targets/autotests/run_compilation_autotests.bash
index a6a861cb60b4763acda8a479ec4ecdbc342d0d05..10e4caa04ba5417404a363f6804c516841afef9c 100755
--- a/cmake_targets/autotests/run_compilation_autotests.bash
+++ b/cmake_targets/autotests/run_compilation_autotests.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/run_exec_autotests.bash b/cmake_targets/autotests/run_exec_autotests.bash
index 5551ede44d01da3a763b3c74f4c39fee5ec79efc..ff38ae9d3c2431fba0c3e4792777d08c3b54f02e 100755
--- a/cmake_targets/autotests/run_exec_autotests.bash
+++ b/cmake_targets/autotests/run_exec_autotests.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py
index 9f08a00d1aa0f7ad0605145cb87b67e7ff071f25..65bcfd5af89be73c17fed0602dda18b206eddb63 100755
--- a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py
+++ b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py b/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
index f03facc7daaa11fe440c74f8b6e911632473e320..ee4f3f93bc0f058b64a41af7d23ee1b407e87c87 100755
--- a/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
+++ b/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py b/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py
index 52178a32a181a2500767fcb6c121b6243453fc3d..42e4b2ea9a68a85333ffadd5f0f93bdfa6f2edf1 100755
--- a/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py
+++ b/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py b/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py
index 42ed5fdeba77da2d62f59bffb6cba86ff8daedb1..8c2c1dd7f209eba509f22dbf75de900be680e4fb 100755
--- a/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py
+++ b/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/configure_usrpb210.py b/cmake_targets/autotests/tools/configure_usrpb210.py
index 860a717d721b23a5254139cd1030dc9aa5465f7f..588bde9d33f548c629384e3fbad8715f45f3341c 100755
--- a/cmake_targets/autotests/tools/configure_usrpb210.py
+++ b/cmake_targets/autotests/tools/configure_usrpb210.py
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/find_usb_path.bash b/cmake_targets/autotests/tools/find_usb_path.bash
index c115d7a9dca5e5bcf32c8f94324012e0815e084e..91156012b766636be052b5ae06ab0354ec57cfdb 100755
--- a/cmake_targets/autotests/tools/find_usb_path.bash
+++ b/cmake_targets/autotests/tools/find_usb_path.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/free_mem.bash b/cmake_targets/autotests/tools/free_mem.bash
index 8196bf342830ad25d4e4b85467c4b2a673513bd5..a5b2b00cb6ffac2a669a14cd4592c1e88f1f3887 100755
--- a/cmake_targets/autotests/tools/free_mem.bash
+++ b/cmake_targets/autotests/tools/free_mem.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/git-retry.sh b/cmake_targets/autotests/tools/git-retry.sh
index 9f4d96af8d01bf8cc082defc11323ced98b77ad8..f0366b2ae58deb439459318f1b74dd0b9392d6fe 100755
--- a/cmake_targets/autotests/tools/git-retry.sh
+++ b/cmake_targets/autotests/tools/git-retry.sh
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/iperf3_script b/cmake_targets/autotests/tools/iperf3_script
index bf506bbc65b8f59174349b47d7ebf9d91dc6ebab..93aa742bd346a942f671fac3e22a011a5ec487dc 100755
--- a/cmake_targets/autotests/tools/iperf3_script
+++ b/cmake_targets/autotests/tools/iperf3_script
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/iperf3_script_phone b/cmake_targets/autotests/tools/iperf3_script_phone
index e4ccc382371306f293b7132ff651fe1fcbeb2632..1d9e9322a17ef30107f6c68d90d48e4ae44557de 100755
--- a/cmake_targets/autotests/tools/iperf3_script_phone
+++ b/cmake_targets/autotests/tools/iperf3_script_phone
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/iperf_script b/cmake_targets/autotests/tools/iperf_script
index 28f239af09d2d1dde01cc0adc7a013865928c22f..d74462cbcc1af9c547ffc787e586460cb599ddb1 100755
--- a/cmake_targets/autotests/tools/iperf_script
+++ b/cmake_targets/autotests/tools/iperf_script
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/iperf_script_phone b/cmake_targets/autotests/tools/iperf_script_phone
index 0195ee9eb324e409fb772d187ea49a816a9357e4..29c670f82675f42dd2b91edb6e5f87aa4ff47341 100755
--- a/cmake_targets/autotests/tools/iperf_script_phone
+++ b/cmake_targets/autotests/tools/iperf_script_phone
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/lib_autotest.py b/cmake_targets/autotests/tools/lib_autotest.py
index 2e9a7df11f086dd6923ba157be3b1517aa29db6b..54be808e1dd9894de5c907e04ca39c1eff9abca5 100644
--- a/cmake_targets/autotests/tools/lib_autotest.py
+++ b/cmake_targets/autotests/tools/lib_autotest.py
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/run_gdb b/cmake_targets/autotests/tools/run_gdb
index 9dea2d350cd489ef274871fa9184f5edb08982b2..ace8e7a2965a85df7781a72643697addea4f7ff0 100755
--- a/cmake_targets/autotests/tools/run_gdb
+++ b/cmake_targets/autotests/tools/run_gdb
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/tools/search_repl.py b/cmake_targets/autotests/tools/search_repl.py
index c3e73ccde48127f6d5d1353858fc47bfefd41df9..f34533cfd0a9f895f32cdd62ef84f659b83cb8fa 100755
--- a/cmake_targets/autotests/tools/search_repl.py
+++ b/cmake_targets/autotests/tools/search_repl.py
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/autotests/v2/actions/3276.txt b/cmake_targets/autotests/v2/actions/3276.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1976ceb3f3571ff1cfb69eee5ffa3eb62d6bb80c
--- /dev/null
+++ b/cmake_targets/autotests/v2/actions/3276.txt
@@ -0,0 +1,13 @@
+When running lsusb, if you have:
+
+    Bus 001 Device 002: ID 12d1:14fe Huawei Technologies Co., Ltd. Modem (Mass Storage Mode)
+
+You need to run:
+
+    usb_modeswitch -v 12d1 -p 14fe -M '55534243123456780000000000000011062000000100000000000000000000'
+
+After what, running lsusb should give:
+
+    Bus 001 Device 004: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
+
+Values of 'Bus' and 'Device' may differ of course.
diff --git a/cmake_targets/autotests/v2/actions/bandrich.txt b/cmake_targets/autotests/v2/actions/bandrich.txt
index 8533750c5b1e2633ce8b0d41e7c22257ae596218..faa294465b8b3339b7ac67a6655c73a8543607f0 100644
--- a/cmake_targets/autotests/v2/actions/bandrich.txt
+++ b/cmake_targets/autotests/v2/actions/bandrich.txt
@@ -13,6 +13,16 @@ containing lines:
     SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}=="1a8d", ENV{ID_MODEL_ID}=="100d", ENV{ID_SERIAL_SHORT}=="357473040068155", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="bandrich.data", MODE="0666"
     SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}=="1a8d", ENV{ID_MODEL_ID}=="100d", ENV{ID_SERIAL_SHORT}=="357473040068155", ENV{ID_USB_INTERFACE_NUM}=="02", SYMLINK+="bandrich.control", MODE="0666"
 
+To avoid NetworkManager to play with the bandrich, add also the line:
+
+    ENV{ID_VENDOR_ID}=="1a8d", ENV{ID_MM_DEVICE_IGNORE}="1"
+
+Maybe also add; , ENV{ID_MM_DEVICE_IGNORE}="1"
+to the two other lines.
+
+Then run: udevadm control --reload-rules
+And:      service network-manager restart
+
 Change vendor_id/model_id/serial/interface num to match yours.
 Use lsusb -v to find values.
 
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
index e09e068c63fed4af59d20935eae3fb6f9b0f5155..0994acdf9de168ddf746784ad837f23dcda68001 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
index 1f992daba20cdee1a33e1939db2686bb6bf95e0a..5e8cd8007ea7550c2838aac43ae21aad78b18c0d 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
index bb7df8b72d654171fb088bc8ddfe95d6b9b64883..53eae1d531f80bd133b6ba5060262fa452c5145e 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
index ff97827b579a4d97fe5b0a593b14247eb349c0fb..d30a57041c1818b9fb1abd96a9f630abfc10bac0 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
index ebb9e417e7be717f810692a4a5ac42e564cbc58a..e90eb3fe518c751e471632f30400026d9a0ce1e3 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
index 4e8910276639267344316f765e9f9f20f50e1a0c..5dbecd3813f90eabcd4568d2dc3c2116c6726d5c 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
index beaf5ae0f1405da2c8647f8970c7971b3a99a2a2..1397184cc7994da3aa3d41c6d977aa3d53998a5d 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
index b0efe66e14189d82f486524396309de98bd4e9fe..caebb36eb27af79b81f4d5e97775e308673f2045 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
index 1b33c7b3c216e7ef2e8573806db0176461ffa93f..fe90cdb338f1796733f554999c79ff71497d357e 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
index dc64a69c00cbf028ccbefc73e30b45096ed28851..5d9027ce150c8926b8bdedaf833b87cddc5536cf 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
index c93ce24d0841f73f64b3cf5f0ebbbb28a98c9818..539f0bd744cf91222e11f0a3467eaa3f8f319f25 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
index 57f7ef83b92e484d13eb4234982dc807ffafeccc..58b088002fb37a396183cc6a51ef455d2aee6862 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
diff --git a/cmake_targets/autotests/v2/connection.py b/cmake_targets/autotests/v2/connection.py
index 1952b8b72f713ff2eb7cff44802b6b18fc138f63..3a254f89b8b0fe02dbbd43fecddbad5ea17ee087 100644
--- a/cmake_targets/autotests/v2/connection.py
+++ b/cmake_targets/autotests/v2/connection.py
@@ -13,7 +13,7 @@ class connection:
         try:
             (pid, fd) = os.forkpty()
         except BaseException, e:
-            log("ERROR: forkpty for '" + description + "': " + e)
+            log("ERROR: forkpty for '" + description + "': " + str(e))
             (pid, fd) = (-1, -1)
 
         if pid == -1:
@@ -26,7 +26,7 @@ class connection:
                 os.execvp('sshpass', ['sshpass', '-p', password,
                           'ssh', user + '@' + host])
             except BaseException, e:
-                log("ERROR: execvp for '" + description + "': " + e)
+                log("ERROR: execvp for '" + description + "': " + str(e))
             log("ERROR: execvp failed for '" + description + "'")
             os._exit(1)
 
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index d2610c4abc6af11eee864a74983660fdc7a0f3fd..f5be69d3fa2caea77f0bf0ac28960600e761f5bf 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
@@ -42,7 +42,6 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
 
 MSC_GEN="False"
 XFORMS="True"
-FLEXRAN_AGENT_SB_IF="True"
 PRINT_STATS="False"
 VCD_TIMING="False"
 DEADLINE_SCHEDULER_FLAG_USER="False"
@@ -66,6 +65,7 @@ UE_AUTOTEST_TRACE="False"
 UE_DEBUG_TRACE="False"
 UE_TIMING_TRACE="False"
 DISABLE_LOG_X="False"
+USRP_REC_PLAY="False"
 BUILD_ECLIPSE=0
 trap handle_ctrl_c INT
 
@@ -99,10 +99,6 @@ Options
    Specify conf_nvram_path (default \"$conf_nvram_path\")
 --UE-gen-nvram [output path]
    Specify gen_nvram_path (default \"$gen_nvram_path\")
---RRH
-   Makes the RRH
--a | --agent
-   Enables agent for software-defined control of the eNB
 -r | --3gpp-release
    default is Rel14,
    Rel8 limits the implementation to 3GPP Release 8 version
@@ -158,6 +154,8 @@ Options
    Disable all LOG_* macros
 --build-eclipse
    Build eclipse project files. Paths are auto corrected by fixprj.sh
+--usrp-recplay
+   Build for I/Q record-playback modes
 Usage (first build):
  oaisim (eNB + UE): ./build_oai -I  --oaisim -x --install-system-files
  Eurecom EXMIMO + COTS UE : ./build_oai -I  --eNB -x --install-system-files
@@ -196,15 +194,14 @@ function main() {
             GDB=1
             CMAKE_BUILD_TYPE="Debug"
             echo_info "Will Compile with gdb symbols and disable compiler optimization"
-            CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug"
+            CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug --trace-expand"
             shift;;
        --eNB)
             eNB=1
             echo_info "Will compile eNB"
             shift;;
        -a | --agent)
-	    FLEXRAN_AGENT=1
-	    echo_info "Will compile eNB with agent support"
+	    echo_info "FlexRAN support is always compiled into the eNB"
 	    shift;;
        --UE)
             UE=1
@@ -216,10 +213,6 @@ function main() {
         --UE-gen-nvram)
             gen_nvram_path=$(readlink -f $2)
             shift 2;;
-       --RRH)
-            RRH=1
-            echo_info "Will compile RRH"
-            shift;;
        -r | --3gpp-release)
             REL=$2
             echo_info "Setting release to: $REL"
@@ -350,6 +343,10 @@ function main() {
             BUILD_TELNETSRV=1
             echo_info "Build embedded telnet server"
             shift ;;			
+        --usrp-recplay)
+            USRP_REC_PLAY="True"
+            echo_info "Enabling USRP record playback mode"
+            shift 1;;
         -h | --help)
             print_help
             exit 1;;
@@ -362,9 +359,13 @@ function main() {
   
   CMAKE_CMD="$CMAKE_CMD .."
   echo_info "CMAKE_CMD=$CMAKE_CMD"
-  
+  if [ "$eNB" = "1" ] && [ "$UE" = "1" ]; then
+    echo_error "Cannot build UE and eNB on one build_oai execution"
+    echo_error "use 2 build_oai invocations"
+    exit
+  fi  
   #########################################################
-  # check validity of HW and TP parameters for RRH and eNB
+  # check validity of HW and TP parameters for eNB
   #########################################################
   # to be discussed
   
@@ -380,15 +381,6 @@ function main() {
       fi
   fi
   
-  if [ "$RRH" = "1" ] ; then
-      if [ "$TP" = "None" ] ; then
-	  echo_fatal "A transport protocol (e.g. -t ETHERNET) must be defined!"
-      fi
-      if [ "$HW" = "None" ] ; then
-	  echo_info "No radio head has been selected (HW set to $HW)"	
-      fi
-  fi
-
   echo_info "RF HW set to $HW" 
   #Now we set flags to enable deadline scheduler settings
   #By default: USRP: disable, 
@@ -473,11 +465,9 @@ function main() {
         flash_firmware_bladerf
       fi
     fi
-    if [ "$FLEXRAN_AGENT" == "1" ] ; then
-      echo_info "installing protobuf/protobuf-c for flexran agent support"
-      install_protobuf_from_source
-      install_protobuf_c_from_source
-    fi
+    echo_info "installing protobuf/protobuf-c for flexran agent support"
+    install_protobuf_from_source
+    install_protobuf_c_from_source
   fi
 
   if [ "$INSTALL_OPTIONAL" = "1" ] ; then
@@ -502,10 +492,20 @@ function main() {
   DIR=$OPENAIR_DIR/cmake_targets
   if [ "$NOS1" =  "1" ] ; then
       lte_build_dir=lte_noS1_build_oai
-      lte_exec=lte-softmodem-nos1
+      if [ "$eNB" = "1" ] ; then
+         lte_exec=lte-softmodem-nos1
+      fi
+      if [ "$UE" = "1" ] ; then
+         lte_exec=lte-uesoftmodem-nos1
+      fi
   else
       lte_build_dir=lte_build_oai
-      lte_exec=lte-softmodem
+      if [ "$eNB" = "1" ] ; then
+         lte_exec=lte-softmodem
+      fi
+      if [ "$UE" = "1" ] ; then
+         lte_exec=lte-uesoftmodem
+      fi
   fi
 
 # configuration module libraries, one currently available, using libconfig 
@@ -525,9 +525,6 @@ function main() {
     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
-    if [ "$FLEXRAN_AGENT" = "1" ] ; then
-	echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )"      >>  $cmake_file
-    fi
     echo "set ( RRC_ASN1_VERSION \"${REL}\")"      >>  $cmake_file
     echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )"     >>  $cmake_file
     echo "set ( RF_BOARD \"${HW}\")"               >>  $cmake_file
@@ -540,6 +537,7 @@ function main() {
     echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)"        >>  $cmake_file
     echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)"        >>  $cmake_file
     echo "set (DISABLE_LOG_X $DISABLE_LOG_X)"        >>  $cmake_file
+    echo "set (USRP_REC_PLAY $USRP_REC_PLAY)"        >>  $cmake_file
     if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then
      echo_info "Compiling UE S1 build : enabling Linux and NETLINK"
      echo "set (LINUX True )"              >>  $cmake_file
@@ -560,6 +558,9 @@ function main() {
     compilations \
 	  $lte_build_dir $config_libconfig_shlib \
 	  lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
+    compilations \
+          $lte_build_dir coding \
+          libcoding.so $dbin/libcoding.so
 	  
     if [ "$NOS1" = "1" ] ; then
 	compilations \
@@ -686,9 +687,6 @@ function main() {
     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
-    if [ "$FLEXRAN_AGENT" = "1" ] ; then
-	echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )"      >>  $cmake_file
-    fi
     echo "set ( PRINT_STATS $PRINT_STATS )" >>  $cmake_file
     echo "set ( RRC_ASN1_VERSION \"${REL}\")" >>  $cmake_file
     echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >>  $cmake_file
@@ -769,9 +767,6 @@ function main() {
     cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
     echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
     echo "set ( XFORMS $XFORMS )" >>  $cmake_file
-    if [ "$FLEXRAN_AGENT" = "1" ] ; then
-	echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )"      >>  $cmake_file
-    fi
     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
@@ -785,61 +780,20 @@ function main() {
 	#  oaisim_mme $dbin/oaisim_mme.$REL
   fi
 
-  # RRH compilation
-  #####################
-  if [ "$RRH" = "1" ] ; then
-
-     rrh_exec=rrh_gw
-     rrh_build_dir=rrh_gw
-     
-     echo_info "Compiling $rrh_exec ..."
-    
-     [ "$CLEAN" = "1" ] && rm -rf $DIR/rrh_gw/build 
-     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 ( 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
-     eval $CMAKE_CMD
-     compilations \
-	 rrh_gw rrh_gw \
-	 rrh_gw $dbin/rrh_gw
-
-  fi
   # Telnet server compilation
   #####################
   if [ "$BUILD_TELNETSRV" = "1" ] ; then
-
-     telnetsrv_build_dir=telnetsrv
-     mkdir -p $DIR/$telnetsrv_build_dir/build
-     cd $DIR/$telnetsrv_build_dir/build   
-     echo_info "Compiling telnet server library ..."
-    
-     [ "$CLEAN" = "1" ] && rm -rf $DIR/$telnetsrv_build_dir 
-     cmake_file=$OPENAIR_DIR/common/utils/$telnetsrv_build_dir/CMakeLists.txt   
-     cd $DIR/$telnetsrv_build_dir/build
-     eval  "$CMAKE_CMD $OPENAIR_DIR/common/utils/$telnetsrv_build_dir/"
-     make
+              build_dir=$lte_build_dir
+              compilations \
+                  $build_dir telnetsrv \
+                  libtelnetsrv.so $dbin/libtelnetsrv.so
 
   fi  
   # build RF device and transport protocol libraries
   #####################################
-  if [ "$eNB" = "1" -o "$UE" = "1" -o  "$RRH" = "1" ] ; then
+  if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
 
-      if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
-	  build_dir=$lte_build_dir	  
-      else
-	  build_dir=$rrh_build_dir	 
-      fi
+      build_dir=$lte_build_dir	  
 
       # build RF device libraries
       if [ "$HW" != "None" ] ; then
@@ -856,9 +810,9 @@ function main() {
 	      ln -sf $dbin/liboai_exmimodevif.so.$REL $dbin/liboai_device.so
 	      echo_info "liboai_device.so is linked to EXMIMO device library"       
 	  elif [ "$HW" == "OAI_USRP" ] ; then
-		  compilations \
-		      $build_dir oai_usrpdevif \
-		      liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
+              compilations \
+                  $build_dir oai_usrpdevif \
+                  liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
 
 	      ln -sf liboai_usrpdevif.so liboai_device.so
 	      ln -sf $dbin/liboai_usrpdevif.so.$REL $dbin/liboai_device.so
diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template
index 76defbc7d7f1318602aa6c9ecbc85be4169a94ff..e046bb75391a178a605ed390cbb13a91b05bcbd7 100644
--- a/cmake_targets/epc_test/CMakeLists.template
+++ b/cmake_targets/epc_test/CMakeLists.template
@@ -2,17 +2,13 @@ cmake_minimum_required(VERSION 2.8)
 
 set (  CMAKE_BUILD_TYPE "RelWithDebInfo" )
 set (  ASN_DEBUG False)
-set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 True )
-set (  EMOS False )
 set (  EMIT_ASN_DEBUG False )
-set (  ENABLE_FXP True )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING True )
 set (  ENABLE_NEW_MULTICAST True )
-set (  ENABLE_PGM_TRANSPORT True )
 set (  ENABLE_SECURITY True )
 set (  ENABLE_STANDALONE_EPC False)
 set (  ENABLE_USE_CPU_EXECUTION_TIME True )
@@ -21,7 +17,6 @@ set (  ENABLE_USE_RAW_SOCKET_FOR_SGI True)
 set (  ENABLE_VCD_FIFO False )
 set (  ENB_MODE True )
 set (  EXMIMO_IOT True )
-set (  HARD_RT False )
 set (  JUMBO_FRAME True )
 set (  LARGE_SCALE False )
 set (  LINK_ENB_PDCP_TO_GTPV1U True)
@@ -33,7 +28,6 @@ set (  DEADLINE_SCHEDULER False )
 set (  MAC_CONTEXT 1 )
 set (  MAX_NUM_CCs 1 )
 set (  MESSAGE_CHART_GENERATOR False)
-set (  MIH_C_MEDIEVAL_EXTENSIONS False )
 set (  MSG_PRINT False )
 set (  MU_RECEIVER False )
 set (  NAS_ADDRESS_FIX False )
@@ -42,38 +36,25 @@ set (  NAS_MME False )
 set (  NAS_UE True )
 set (  NB_ANTENNAS_RX "2" )
 set (  NB_ANTENNAS_TX "2" )
-set (  NB_ANTENNAS_TXRX "2" )
-set (  NEW_FFT True )
 set (  NO_RRM True )
-set (  OAI_EMU False )
 set (  OAISIM False )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK True )
-set (  OPENAIR1 True )
 set (  OPENAIR2 True )
 set (  OPENAIR_LTE True )
 set (  PACKAGE_NAME "epc_test" )
-set (  PBS_SIM False )
 set (  PDCP_USE_NETLINK True )
-set (  PC_DSP True )
-set (  PC_TARGET True )
 set (  PDCP_MSG_PRINT False )
-set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION True )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM True )
-set (  PUCCH True )
-set (  RANDOM_BF False )
 set (  RF_BOARD "False" )
 set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RRC_DEFAULT_RAB_IS_AM True)
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
 set (  TEST_OMG False )
 set (  USE_MME "R10" )
-set (  USER_MODE True )
 set (  XER_PRINT True )
diff --git a/cmake_targets/lte-simulators/CMakeLists.txt b/cmake_targets/lte-simulators/CMakeLists.txt
index ab718a8503d3a1339d0ba3996eae2e082458319d..ca754449d7f9c6bbea10e1dcf726160df18a9f97 100644
--- a/cmake_targets/lte-simulators/CMakeLists.txt
+++ b/cmake_targets/lte-simulators/CMakeLists.txt
@@ -6,9 +6,6 @@ set(XFORMS True)
 set(ENABLE_ITTI False)
 set(DEBUG_PHY False)
 set(MU_RECIEVER False)
-set(RANDOM_BF False)
-set(PBS_SIM False)
-set(PERFECT_CE True)
 set(NAS_UE False)
 set(MESSAGE_CHART_GENERATOR False)
 
diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template
index 0a05d68d10d5d6ce758e8aa17588c444632bf700..22faac75b5855fd33b2fb6630c5dde36e8fe83a4 100644
--- a/cmake_targets/oaisim_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_build_oai/CMakeLists.template
@@ -1,16 +1,12 @@
 cmake_minimum_required(VERSION 2.8)
 
 set (  CMAKE_BUILD_TYPE "RelWithDebInfo" )
-set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 True )
-set (  EMOS False )
-set (  ENABLE_FXP True )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING True )
 set (  ENABLE_NEW_MULTICAST True )
-set (  ENABLE_PGM_TRANSPORT True )
 set (  ENABLE_RAL False )
 set (  ENABLE_SECURITY True )
 set (  ENABLE_STANDALONE_EPC False)
@@ -20,7 +16,6 @@ set (  ENABLE_USE_RAW_SOCKET_FOR_SGI True)
 set (  ENABLE_VCD_FIFO False )
 set (  ENB_MODE True )
 set (  EXMIMO_IOT True )
-set (  HARD_RT False )
 set (  JUMBO_FRAME True )
 set (  LARGE_SCALE False )
 set (  LINK_ENB_PDCP_TO_GTPV1U True)
@@ -32,7 +27,6 @@ set (  DEADLINE_SCHEDULER False )
 set (  MAC_CONTEXT 1 )
 set (  MAX_NUM_CCs 1 )
 set (  MESSAGE_CHART_GENERATOR False)
-set (  MIH_C_MEDIEVAL_EXTENSIONS False )
 set (  MSG_PRINT False )
 set (  MU_RECEIVER False )
 set (  NAS_ADDRESS_FIX False )
@@ -41,40 +35,26 @@ set (  NAS_MME False )
 set (  NAS_UE True )
 set (  NB_ANTENNAS_RX "2" )
 set (  NB_ANTENNAS_TX "2" )
-set (  NB_ANTENNAS_TXRX "2" )
-set (  NEW_FFT True )
 set (  NO_RRM True )
-set (  OAI_EMU True )
 set (  OAISIM True )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK True )
-set (  OPENAIR1 True )
 set (  OPENAIR2 True )
 set (  OPENAIR_LTE True )
 set (  PACKAGE_NAME "oaisim" )
-set (  PBS_SIM False )
 set (  PDCP_USE_NETLINK True )
-set (  PC_DSP True )
-set (  PC_TARGET True )
 set (  PDCP_MSG_PRINT False )
-set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION True )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM True )
-set (  PUCCH True )
-set (  RANDOM_BF False )
 set (  RF_BOARD "False" )
 set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RRC_DEFAULT_RAB_IS_AM True)
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
-set (  SPECTRA False )
 set (  TEST_OMG False )
 set (  USE_3GPP_ADDR_AS_LINK_ADDR False )
 set (  USE_MME "R10" )
-set (  USER_MODE True )
 set (  XER_PRINT False )
diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
index 69fa209b16d266e5a5d846facba62904bd11143b..b18b23ee9abf72e93a74a9d70a9edede932a0b8c 100644
--- a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
@@ -1,16 +1,12 @@
 cmake_minimum_required(VERSION 2.8)
 
 set (  CMAKE_BUILD_TYPE "RelWithDebInfo" )
-set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 False )
-set (  EMOS False )
-set (  ENABLE_FXP False )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING False )
 set (  ENABLE_NEW_MULTICAST False )
-set (  ENABLE_PGM_TRANSPORT False )
 set (  ENABLE_RAL False )
 set (  ENABLE_SECURITY False )
 set (  ENABLE_STANDALONE_EPC False )
@@ -21,7 +17,6 @@ set (  ENABLE_VCD_FIFO False )
 set (  ENB_MODE False )
 set (  EPC_BUILD True )
 set (  EXMIMO_IOT False )
-set (  HARD_RT False )
 set (  JUMBO_FRAME False )
 set (  LARGE_SCALE False )
 set (  LINK_ENB_PDCP_TO_GTPV1U True)
@@ -32,7 +27,6 @@ set (  LOG_NO_THREAD False )
 set (  DEADLINE_SCHEDULER False )
 set (  MAC_CONTEXT 1 )
 set (  MAX_NUM_CCs 1 )
-set (  MIH_C_MEDIEVAL_EXTENSIONS False )
 set (  MSG_PRINT False )
 set (  MU_RECEIVER False )
 set (  NAS_ADDRESS_FIX False )
@@ -42,42 +36,27 @@ set (  NAS_NETLINK False )
 set (  NAS_UE False )
 set (  NB_ANTENNAS_RX "2" )
 set (  NB_ANTENNAS_TX "2" )
-set (  NB_ANTENNAS_TXRX "2" )
-set (  NEW_FFT False )
 set (  NO_RRM False )
-set (  OAI_EMU False )
 set (  OAISIM False )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK False )
-set (  OPENAIR1 False )
 set (  OPENAIR2 False )
-set (  OPENAIR_EMU False )
 set (  OPENAIR_LTE False )
 set (  PACKAGE_NAME "EPC" )
-set (  PBS_SIM False )
-set (  PC_DSP False )
-set (  PC_TARGET False )
 set (  PDCP_MSG_PRINT False )
-set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION False )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM False )
-set (  PUCCH False )
-set (  RANDOM_BF False )
 set (  RF_BOARD "False" )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
-set (  SPECTRA False )
 set (  TEST_OMG False )
 set (  UPDATE_RELEASE_9 True)
 set (  UPDATE_RELEASE_10 True)
 set (  USE_3GPP_ADDR_AS_LINK_ADDR False )
 set (  USE_MME "R10" )
-set (  USER_MODE True )
 set (  XER_PRINT False )
 set (  XFORMS False )
diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
index 8e1670ea43e9208190d895d1948467e580c602bc..bc416cff55fef58c4a19492585c07addd4f60115 100644
--- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
@@ -1,15 +1,11 @@
 cmake_minimum_required(VERSION 2.8)
 
-set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 True )
-set (  EMOS False )
-set (  ENABLE_FXP True )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING False )
 set (  ENABLE_NEW_MULTICAST True )
-set (  ENABLE_PGM_TRANSPORT True )
 set (  ENABLE_RAL False )
 set (  ENABLE_SECURITY False )
 set (  ENABLE_STANDALONE_EPC False)
@@ -19,7 +15,6 @@ set (  ENABLE_USE_RAW_SOCKET_FOR_SGI False)
 set (  ENABLE_VCD_FIFO False )
 set (  ENB_MODE True )
 set (  EXMIMO_IOT True )
-set (  HARD_RT False )
 set (  JUMBO_FRAME True )
 set (  LARGE_SCALE False )
 set (  LINK_ENB_PDCP_TO_GTPV1U False)
@@ -33,51 +28,35 @@ set (  MAX_NUM_CCs 1 )
 set (  MESSAGE_CHART_GENERATOR         False )
 set (  MESSAGE_CHART_GENERATOR_RLC_MAC False )
 set (  MESSAGE_CHART_GENERATOR_PHY     False )
-set (  MIH_C_MEDIEVAL_EXTENSIONS False )
 set (  MSG_PRINT False )
 set (  MU_RECEIVER False )
-set (  NAS_ADDRESS_FIX True )
+set (  NAS_ADDRESS_FIX False )
 set (  NAS_BUILT_IN_UE False)
 set (  NAS_MME False )
 set (  NAS_UE False )
 set (  NB_ANTENNAS_RX "2" )
 set (  NB_ANTENNAS_TX "2" )
-set (  NB_ANTENNAS_TXRX "2" )
-set (  NEW_FFT True )
 set (  NO_RRM True )
-set (  OAI_EMU True )
 set (  OAISIM True )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK True )
-set (  OPENAIR1 True )
 set (  OPENAIR2 True )
-set (  OPENAIR_EMU False )
 set (  OPENAIR_LTE True )
 set (  PACKAGE_NAME "oaisim" )
-set (  PBS_SIM False )
 set (  PDCP_USE_NETLINK True )
-set (  PC_DSP True )
-set (  PC_TARGET True )
 set (  PDCP_MSG_PRINT False )
-set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION True )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM True )
-set (  PUCCH True )
-set (  RANDOM_BF False )
 set (  RF_BOARD "False" )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
-set (  SPECTRA False )
 set (  TEST_OMG False )
 set (  USE_3GPP_ADDR_AS_LINK_ADDR False )
 set (  USE_MME "R10" )
-set (  USER_MODE True )
 set (  XER_PRINT False )
 set (  DEBUG_PHY False )
 set (  DEBUG_PHY_PROC False)
diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template
index 994edf835232401dbc9f41e70ae8b8e9e47e4740..9f1ff3e36015965cf5403c37472f259f32d29a25 100644
--- a/cmake_targets/s1c_mme_test/CMakeLists.template
+++ b/cmake_targets/s1c_mme_test/CMakeLists.template
@@ -1,17 +1,13 @@
 cmake_minimum_required(VERSION 2.8)
 
 set (  CMAKE_BUILD_TYPE "RelWithDebInfo" )
-set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 True )
-set (  EMOS False )
-set (  ENABLE_FXP True )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING True )
 set (  ENABLE_NEW_MULTICAST True )
 set (  ENABLE_PDCP_NETLINK_FIFO False )
-set (  ENABLE_PGM_TRANSPORT True )
 set (  ENABLE_RAL False )
 set (  ENABLE_SECURITY True )
 set (  ENABLE_STANDALONE_EPC False)
@@ -21,7 +17,6 @@ set (  ENABLE_USE_RAW_SOCKET_FOR_SGI True)
 set (  ENABLE_VCD_FIFO False )
 set (  ENB_MODE True )
 set (  EXMIMO_IOT True )
-set (  HARD_RT False )
 set (  JUMBO_FRAME True )
 set (  LARGE_SCALE False )
 set (  LINK_ENB_PDCP_TO_GTPV1U True)
@@ -33,7 +28,6 @@ set (  DEADLINE_SCHEDULER False )
 set (  MAC_CONTEXT 1 )
 set (  MAX_NUM_CCs 1 )
 set (  MESSAGE_CHART_GENERATOR False)
-set (  MIH_C_MEDIEVAL_EXTENSIONS False )
 set (  MSG_PRINT False )
 set (  MU_RECEIVER False )
 set (  NAS_ADDRESS_FIX False )
@@ -42,44 +36,30 @@ set (  NAS_MME False )
 set (  NAS_UE True )
 set (  NB_ANTENNAS_RX "2" )
 set (  NB_ANTENNAS_TX "2" )
-set (  NB_ANTENNAS_TXRX "2" )
-set (  NEW_FFT True )
 set (  NO_RRM True )
-set (  OAI_EMU True )
 set (  OAISIM True )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK True )
-set (  OPENAIR1 True )
 set (  OPENAIR2 True )
 set (  OPENAIR_LTE True )
 set (  PACKAGE_NAME "oaisim" )
-set (  PBS_SIM False )
 set (  PDCP_USE_NETLINK True )
-set (  PC_DSP True )
-set (  PC_TARGET True )
 set (  PDCP_MSG_PRINT False )
-set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION True )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM True )
-set (  PUCCH True )
-set (  RANDOM_BF False )
 set (  RF_BOARD "False" )
 set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RRC_DEFAULT_RAB_IS_AM True)
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
-set (  SPECTRA False )
 set (  TEST_OMG False )
 
 set (  TEST_S1C_MME True )
 
 set (  USE_3GPP_ADDR_AS_LINK_ADDR False )
 set (  USE_MME "R10" )
-set (  USER_MODE True )
 set (  XER_PRINT False )
 set (  XFORMS False )
diff --git a/cmake_targets/tools/asn1tostruct.py b/cmake_targets/tools/asn1tostruct.py
index e8ebb03d6d2c7dd87b9655278fd9c98460ec02f1..8c0f7e8a16a52ca7588a40cefb73428156a14f7d 100644
--- a/cmake_targets/tools/asn1tostruct.py
+++ b/cmake_targets/tools/asn1tostruct.py
@@ -38,7 +38,7 @@ def outputHeaderToFile(f, filename):
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index f6c51944d2a1be7b9c467e4f91fe63caeb6a47aa..706cd05fe9ff084d62bf818aebf5e126c6e183dc 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
@@ -95,6 +95,8 @@ get_distribution_release() {
 check_supported_distribution() {
     local distribution=$(get_distribution_release)
     case "$distribution" in
+        "ubuntu17.10") return 0 ;;
+        "ubuntu17.04") return 0 ;;
         "ubuntu16.04") return 0 ;;
         "ubuntu14.04") return 0 ;;
         "fedora24")    return 0 ;;
@@ -230,6 +232,7 @@ install_protobuf_c_from_source(){
     rm -rf /tmp/protobuf-c
     git clone https://github.com/protobuf-c/protobuf-c.git
     cd protobuf-c
+	git checkout 2a46af42784abf86804d536f6e0122d47cfeea45
     ./autogen.sh
     ./configure
     echo "Compiling protobuf-c"
@@ -246,14 +249,14 @@ install_usrp_uhd_driver_from_source(){
     cd /tmp
     echo "Downloading UHD driver"
     rm -rf /tmp/uhd
-    git clone git://github.com/EttusResearch/uhd.git
+    git clone https://github.com/EttusResearch/uhd.git
     cd uhd
     git checkout tags/release_003_010_001_001
     mkdir -p host/build
     cd host/build
     $CMAKE ../
     echo "Compiling UHD"
-    make
+    make -j`nproc`
     make test
     $SUDO make install
     $SUDO ldconfig
@@ -274,10 +277,11 @@ check_install_usrp_uhd_driver(){
         $SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host
     elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
         $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake
+        $SUDO pip install requests
         if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
             # until EPEL repo hasn't bumped UHD driver to >=3.10 in EPEL, build driver from source
             $SUDO $INSTALLER -y remove uhd uhd-devel uhd-firmware
-            install_ursp_uhd_driver_from_source
+            install_usrp_uhd_driver_from_source
         else
             $SUDO $INSTALLER -y install uhd uhd-devel uhd-firmware
         fi
@@ -479,16 +483,26 @@ check_install_oai_software() {
     fi
     $SUDO $INSTALLER update -y
   if [[ "$OS_DISTRO" == "ubuntu" ]]; then
+    local LAPACK_LIBNAME="liblapack.so"
+    local LAPACK_TARGET="/usr/lib/atlas-base/atlas/liblapack.so"
     $SUDO apt install -y software-properties-common
     case "$(get_distribution_release)" in
         "ubuntu14.04")
-            specific_packages="libtasn1-3-dev"
+            specific_packages="libtasn1-3-dev gccxml libgnutls-dev libatlas-dev"
             # For iperf3
             $SUDO add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports universe"
             $SUDO apt-get update
             ;;
         "ubuntu16.04")
-            specific_packages="libtasn1-6-dev"
+            specific_packages="libtasn1-6-dev gccxml libgnutls-dev libatlas-dev"
+            ;;
+        "ubuntu17.04")
+            specific_packages="libtasn1-6-dev castxml libgnutls28-dev libatlas-dev"
+            ;;
+        "ubuntu17.10")
+            specific_packages="libtasn1-6-dev castxml libgnutls28-dev"
+            LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
+            LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
             ;;
     esac
     $SUDO apt-get install -y \
@@ -504,7 +518,6 @@ check_install_oai_software() {
 	texlive-latex-base \
 	ethtool \
 	flex  \
-	gccxml \
 	gdb  \
 	git \
 	graphviz \
@@ -515,7 +528,6 @@ check_install_oai_software() {
 	iptables \
 	iptables-dev \
 	libatlas-base-dev \
-	libatlas-dev \
 	libblas-dev \
 	libconfig8-dev \
 	libffi-dev \
@@ -553,11 +565,9 @@ check_install_oai_software() {
 	wget \
 	libxpm-dev
 
-    $SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
-    
-    $SUDO apt-get install -y nettle-dev nettle-bin
+    $SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET"
 
-    $SUDO apt-get install -y libgnutls-dev
+    $SUDO apt-get install -y nettle-dev nettle-bin
   elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
     if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
       if rpm -q epel-release > /dev/null; then
@@ -635,7 +645,8 @@ check_install_oai_software() {
       lapack \
       lapack-devel \
       blas \
-      blas-devel
+      blas-devel \
+      libyaml-devel
   fi
 
     install_asn1c_from_source
diff --git a/cmake_targets/tools/build_test_epc_tools b/cmake_targets/tools/build_test_epc_tools
index f9d8057c93c96d4a1759dcc5639f2d3105442afe..dc2d01654593d1b4f2290cd6720143c3b0b7e679 100755
--- a/cmake_targets/tools/build_test_epc_tools
+++ b/cmake_targets/tools/build_test_epc_tools
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/example_enb_exmimo_mme_hss.txt b/cmake_targets/tools/example_enb_exmimo_mme_hss.txt
index 546ae1ba86d8d749dc363ee03600ea3c0504da35..238554f8e2a71ccb667c537d5086c0e99c40a442 100644
--- a/cmake_targets/tools/example_enb_exmimo_mme_hss.txt
+++ b/cmake_targets/tools/example_enb_exmimo_mme_hss.txt
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt b/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt
index baccdbc2881905dac922a6b035b78fd627d5e5c4..9996a53e1907cf3ddd75550187c984917d9158f7 100644
--- a/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt
+++ b/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1
index 805a4ce66a2a58bbc430f5ed439e3bd5217d07e8..fe819c27162df2174c27cc2cc93aa250b00c3bd1 100755
--- a/cmake_targets/tools/fix_asn1
+++ b/cmake_targets/tools/fix_asn1
@@ -4,7 +4,8 @@
 #   <file> <sha1sum of file (without line 4 which changes depending on the location of the files)> <patch to apply to file>
 
 RRC_Rel14=(
-  "SystemInformation-r8-IEs.h" 562e3c3aeb7c6d76d722f31bf24488a26e627f33 "fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff"
+  "SystemInformation-r8-IEs.h" 4df485c5ddf2540eca271876cdc512caa19b0890 "fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff"
+  "SystemInformation-NB-r13-IEs.h" 6d91332d5c39205819b06e5e36efe62ff8e5b33b "fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff"
 )
 
 RRC_Rel10=(
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff
new file mode 100644
index 0000000000000000000000000000000000000000..37ac4cd85855c7436de8d1ab89a25e7041b3c9c6
--- /dev/null
+++ b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff
@@ -0,0 +1,47 @@
+48a49,70
+> struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member {
+> 	SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR present;
+> 	union SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_u {
+> 		SystemInformationBlockType2_NB_r13_t	 sib2_r13;
+> 		SystemInformationBlockType3_NB_r13_t	 sib3_r13;
+> 		SystemInformationBlockType4_NB_r13_t	 sib4_r13;
+> 		SystemInformationBlockType5_NB_r13_t	 sib5_r13;
+> 		SystemInformationBlockType14_NB_r13_t	 sib14_r13;
+> 		SystemInformationBlockType16_NB_r13_t	 sib16_r13;
+> 		/*
+> 		 * This type is extensible,
+> 		 * possible extensions are below.
+> 		 */
+> 		SystemInformationBlockType15_NB_r14_t	 sib15_v1430;
+> 		SystemInformationBlockType20_NB_r14_t	 sib20_v1430;
+> 		SystemInformationBlockType22_NB_r14_t	 sib22_v1430;
+> 	} choice;
+> 	
+> 	/* Context for parsing across buffer boundaries */
+> 	asn_struct_ctx_t _asn_ctx;
+> };
+> 
+52,72c74
+< 		A_SEQUENCE_OF(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member {
+< 			SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR present;
+< 			union SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_u {
+< 				SystemInformationBlockType2_NB_r13_t	 sib2_r13;
+< 				SystemInformationBlockType3_NB_r13_t	 sib3_r13;
+< 				SystemInformationBlockType4_NB_r13_t	 sib4_r13;
+< 				SystemInformationBlockType5_NB_r13_t	 sib5_r13;
+< 				SystemInformationBlockType14_NB_r13_t	 sib14_r13;
+< 				SystemInformationBlockType16_NB_r13_t	 sib16_r13;
+< 				/*
+< 				 * This type is extensible,
+< 				 * possible extensions are below.
+< 				 */
+< 				SystemInformationBlockType15_NB_r14_t	 sib15_v1430;
+< 				SystemInformationBlockType20_NB_r14_t	 sib20_v1430;
+< 				SystemInformationBlockType22_NB_r14_t	 sib22_v1430;
+< 			} choice;
+< 			
+< 			/* Context for parsing across buffer boundaries */
+< 			asn_struct_ctx_t _asn_ctx;
+< 		} ) list;
+---
+> 		A_SEQUENCE_OF(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member) list;
diff --git a/cmake_targets/tools/indent_source_code b/cmake_targets/tools/indent_source_code
index 17a29fb073cfd5be34c32e5cba4f5ea8d4a97f37..a16914a91dde6e3f89ddf60ecc56e26a379adcad 100755
--- a/cmake_targets/tools/indent_source_code
+++ b/cmake_targets/tools/indent_source_code
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/init_exmimo2 b/cmake_targets/tools/init_exmimo2
index 1ed65cf0e05588016bf6f78e8f89922dbcb2eb01..8e902a8433d7fe760b72d28aa16165f10626b15e 100755
--- a/cmake_targets/tools/init_exmimo2
+++ b/cmake_targets/tools/init_exmimo2
@@ -5,7 +5,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/init_nas_nos1 b/cmake_targets/tools/init_nas_nos1
index 3aaf547823b344685244e5b62b144a03cd26ed50..f7347e55083c19c85e7a51f5b159a389808d2afa 100755
--- a/cmake_targets/tools/init_nas_nos1
+++ b/cmake_targets/tools/init_nas_nos1
@@ -5,7 +5,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
@@ -44,11 +44,11 @@ load_module $OPENAIR_DIR/targets/bin/nasmesh.ko
 if [ "$1" = "eNB" ]; then 
      echo "bring up oai0 interface for enb"
      sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
-     $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.9 -r 1
+     $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 1
 else
     if [ "$1" = "UE" ]; then 
        echo "bring up oai0 interface for UE"
        sudo ifconfig oai0 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255
-       $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.9 -t 10.0.1.1 -r 1
+       $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.2 -t 10.0.1.1 -r 1
     fi
 fi  
diff --git a/cmake_targets/tools/init_nas_s1 b/cmake_targets/tools/init_nas_s1
index 003a3ae600a12cfa225b6d627af6d0c6d93a2814..cab4ad047bf4d42d9a4ba1890c9cef9967ec2a00 100644
--- a/cmake_targets/tools/init_nas_s1
+++ b/cmake_targets/tools/init_nas_s1
@@ -8,7 +8,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/perf_oai.bash b/cmake_targets/tools/perf_oai.bash
index 44d9d1c74aa610be95a16123d9483dab9efcc76a..cd1ef5a40004d3588637d1d936122c4cfedbe314 100755
--- a/cmake_targets/tools/perf_oai.bash
+++ b/cmake_targets/tools/perf_oai.bash
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/run_enb_s1_exmimo b/cmake_targets/tools/run_enb_s1_exmimo
index 028b492341981a317bf6f5951efc6eaba1932a0b..1bb6ce44254e4bacfb7eae3440bf63cd5e299475 100755
--- a/cmake_targets/tools/run_enb_s1_exmimo
+++ b/cmake_targets/tools/run_enb_s1_exmimo
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp
index 3d49fe40bdbb7cddf555e6eefa592cee10250971..e11912668303a3c441e44350f4f50939e265d3cd 100755
--- a/cmake_targets/tools/run_enb_s1_usrp
+++ b/cmake_targets/tools/run_enb_s1_usrp
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/run_enb_ue_virt_noS1 b/cmake_targets/tools/run_enb_ue_virt_noS1
index a5139d4b44c250ab7e1c056d45ef014988f4798b..79d5bc35dc1586fbbde90762affd87a718f50c91 100755
--- a/cmake_targets/tools/run_enb_ue_virt_noS1
+++ b/cmake_targets/tools/run_enb_ue_virt_noS1
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/run_enb_ue_virt_s1 b/cmake_targets/tools/run_enb_ue_virt_s1
index 8e717f393a28b637771b9698e61b7f547bb3c444..50fc819ec869b243da177435bcc19ea6a571dd7d 100755
--- a/cmake_targets/tools/run_enb_ue_virt_s1
+++ b/cmake_targets/tools/run_enb_ue_virt_s1
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/cmake_targets/tools/stop_exmimo2 b/cmake_targets/tools/stop_exmimo2
index 85d9bec309743b9546041fc368e883598b8abf08..fdfe19425ddcaac7c04b8523b0fafce98de78b6b 100755
--- a/cmake_targets/tools/stop_exmimo2
+++ b/cmake_targets/tools/stop_exmimo2
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c
index 42ea7259c31963ff871c201b8215745086532223..040cd92fafaad3f799a9e2ac5baa212daf67e355 100644
--- a/common/config/config_cmdline.c
+++ b/common/config/config_cmdline.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -52,9 +52,12 @@ char defbool[2]="1";
      switch(cfgoptions->type)
        {
        	case TYPE_STRING:
-           config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
-           config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval+1));
-           sprintf(*(cfgoptions->strptr), "%s",tmpval);
+           if (cfgoptions->numelt == 0 ) {
+              config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1);
+              sprintf(*(cfgoptions->strptr), "%s",tmpval);
+            } else {
+              sprintf( (char *)(cfgoptions->strptr), "%s",tmpval);              
+           }
            printf_cmdl("[CONFIG] %s set to  %s from command line\n", cfgoptions->optname, tmpval);
 	   optisset=1;
         break;
diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c
index 8351d4d82c143bf05601638fcebe4e80e1f02039..7860742804ea72b9a0e1b5d387f3a15af485ed4f 100644
--- a/common/config/config_load_configmodule.c
+++ b/common/config/config_load_configmodule.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -129,20 +129,21 @@ int i;
 
 /* default */
   if (cfgparam == NULL) {
-     cfgparam = "libconfig:oaisoftmodem.conf";
+     tmpflags = tmpflags | CONFIG_NOOOPT;
+     cfgparam = DEFAULT_CFGMODE ":" DEFAULT_CFGFILENAME;
      }
 /* parse the config parameters to set the config source */
    i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams);
    if (i< 0) {
        fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source  %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno));
-       cfgmode=strdup("libconfig");
-       modeparams = strdup("oaisoftmodem.conf");
+       cfgmode=strdup(DEFAULT_CFGMODE);
+       modeparams = strdup(DEFAULT_CFGFILENAME);
    }
    else if ( i == 1 ) {
   /* -O argument doesn't contain ":" separator, assume -O <conf file> option, default cfgmode to libconfig
      with one parameter, the path to the configuration file */
        modeparams=cfgmode;
-       cfgmode=strdup("libconfig");
+       cfgmode=strdup(DEFAULT_CFGMODE);
    }
 
    cfgptr = malloc(sizeof(configmodule_interface_t));
@@ -196,25 +197,40 @@ int i;
    return cfgptr;
 }
 
-void end_configmodule()
+
+/* free memory allocated when reading parameters */
+/* config module could be initialized again after this call */
+void end_configmodule(void)
 { 
   if (cfgptr != NULL) {
       if (cfgptr->end != NULL) {
          printf ("[CONFIG] calling config module end function...\n"); 
          cfgptr->end();
       }
-      if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
-      printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);  
-      for (int i=0; i<cfgptr->num_cfgP; i++) {
-          if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
-          }
+
       printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);  
       for(int i=0; i<cfgptr->numptrs ; i++) {
           if (cfgptr->ptrs[i] != NULL) {
              free(cfgptr->ptrs[i]);
+             cfgptr->ptrs[i]=NULL;
           }
-          cfgptr->ptrs[i]=NULL;
       }
+      cfgptr->numptrs=0;
+  }
+}
+
+/* free all memory used by config module */
+/* should be called only at program exit */
+void free_configmodule(void)
+{ 
+  if (cfgptr != NULL) {
+      end_configmodule();
+      if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
+      printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);  
+      for (int i=0; i<cfgptr->num_cfgP; i++) {
+          if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
+          }
+
 
   free(cfgptr);
   cfgptr=NULL;
diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h
index 71c642f68054180bf521dfcd8a7e0f12bc39e57b..724cd1dbf528f5e38e865d05d94d1b050a006e84 100644
--- a/common/config/config_load_configmodule.h
+++ b/common/config/config_load_configmodule.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,14 +40,18 @@
 #define CONFIG_MAX_OOPT_PARAMS    10     // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
 #define CONFIG_MAX_ALLOCATEDPTRS  1024   // maximum number of parameters that can be dynamicaly allocated in the config module
 
-/* rtflags bit position definitions */
-#define CONFIG_PRINTPARAMS    1        // print parameters values while processing
-#define CONFIG_DEBUGPTR       2        // print memory allocation/free debug messages
-#define CONFIG_DEBUGCMDLINE   4        // print command line processing messages
-#define CONFIG_HELP           8        // print help message
-#define CONFIG_ABORT          16       // config failed,abort execution 
-
+/* default values for configuration module parameters */
+#define DEFAULT_CFGMODE           "libconfig"  // use libconfig file
+#define DEFAULT_CFGFILENAME       "oai.conf"   // default config file
 
+/* rtflags bit position definitions */
+#define CONFIG_PRINTPARAMS    1               // print parameters values while processing
+#define CONFIG_DEBUGPTR       1<<1            // print memory allocation/free debug messages
+#define CONFIG_DEBUGCMDLINE   1<<2            // print command line processing messages
+#define CONFIG_NOABORTONCHKF  1<<3            // disable abort execution when parameter checking function fails
+#define CONFIG_HELP           1<<20           // print help message
+#define CONFIG_ABORT          1<<21           // config failed,abort execution 
+#define CONFIG_NOOOPT         1<<22           // no -O option found when parsing command line
 typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
 typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
 typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
diff --git a/common/config/config_paramdesc.h b/common/config/config_paramdesc.h
index a7de5e3098ffabc47226eb8c04ab0381b3593af8..6f153535fb56c2cf0ef5c8cb7599899195604abc 100644
--- a/common/config/config_paramdesc.h
+++ b/common/config/config_paramdesc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -55,16 +55,61 @@
 #define PARAMFLAG_PARAMSET                (1 << 16)        // parameter has been explicitely set in get functions
 #define PARAMFLAG_PARAMSETDEF             (1 << 17)        // parameter has been set to default value in get functions
 
+
+/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
+#define CONFIG_MAX_NUMCHECKVAL            20
+typedef struct paramdef paramdef_t;
+typedef union checkedparam {
+        struct  { 
+               int  (*f1)(paramdef_t *param);   /* check an integer against a list of authorized values */
+               int okintval[CONFIG_MAX_NUMCHECKVAL];                        /* integer array, store possible values  */
+               int num_okintval;                                            /* number of valid values in the checkingval array */
+        } s1;
+        struct  { 
+               int  (*f1a)(paramdef_t *param);   /* check an integer against a list of authorized values and set param value */
+                                                 /* to the corresponding item in setintval array (mainly for RRC params)     */
+               int okintval[CONFIG_MAX_NUMCHECKVAL];                        /* integer array, store possible values in config file */
+               int setintval[CONFIG_MAX_NUMCHECKVAL];                        /* integer array, values set in the paramdef structure */
+               int num_okintval;                                            /* number of valid values in the checkingval array */
+        } s1a;
+        struct { 
+               int  (*f2)(paramdef_t *param);  /* check an integer against an authorized range, defined by its min and max value */
+               int okintrange[CONFIG_MAX_NUMCHECKVAL];  /* integer array, store  min and max values  */
+   
+        } s2;
+        struct {
+               int  (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
+               char *okstrval[CONFIG_MAX_NUMCHECKVAL];                      /* string array, store possible values  */
+               int  num_okstrval;                                           /* number of valid values in the checkingval array */
+        } s3;
+        struct {
+               int  (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
+                                                 /* to the corresponding item in setintval array (mainly for RRC params) */
+               char *okstrval[CONFIG_MAX_NUMCHECKVAL];                      /* string array, store possible values  */
+               int  setintval[CONFIG_MAX_NUMCHECKVAL];                      /* integer array, values set in the paramdef structure */
+               int  num_okstrval;                                           /* number of valid values in the checkingval array */
+        } s3a;
+        struct {
+               int  (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
+               
+        } s4;
+        struct { 
+                void (*checkfunc)(void) ; 
+        } s5;
+} checkedparam_t;
+
+/* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */
+/* config apis used to retrieve parameters values  */
 typedef struct paramdef
 {
-   char optname[MAX_OPTNAME_SIZE];        /* parameter name, can be used as long command line option */
-   char *helpstr;                         /* help string */
-   unsigned int paramflags;               /* value is a "ored" combination of above PARAMFLAG_XXXX values */
-   union {                                /* pointer to the parameter value, completed by the config module */
+   char         optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
+   char         *helpstr;                  /* help string */
+   unsigned int paramflags;                /* value is a "ored" combination of above PARAMFLAG_XXXX values */
+   union {                                 /* pointer to the parameter value, completed by the config module */
      char **strptr;
      char **strlistptr;
      uint8_t   *u8ptr;
-     char      *i8ptr;     
+     int8_t    *i8ptr;     
      uint16_t  *u16ptr;
      int16_t   *i16ptr;
      uint32_t  *uptr;
@@ -72,18 +117,21 @@ typedef struct paramdef
      uint64_t  *u64ptr;
      int64_t   *i64ptr;
      double    *dblptr;
+     void      *voidptr;
      } ;
    union {                                /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
-     char *defstrval;
-     char **defstrlistval;
-     uint32_t defuintval;
-     int defintval;
-     uint64_t defint64val;
-     int *defintarrayval;
-     double defdblval;
+     char      *defstrval;
+     char      **defstrlistval;
+     uint32_t  defuintval;
+     int       defintval;
+     uint64_t  defint64val;
+     int       *defintarrayval;
+     double    defdblval;
      } ;   
    char type;                              /* parameter value type, as listed below as TYPE_XXXX macro */
    int numelt;                             /* number of elements in a list or array parameters or max size of string value */ 
+   checkedparam_t   *chkPptr;              /* possible pointer to the structure containing the info used to check parameter values */
+   int *processedvalue;                    /* used to store integer values computed from string original value */
 } paramdef_t;
 
 #define TYPE_INT        TYPE_INT32
diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c
index ad2e355d528153d8591ba7f89065b7c6cdeae2a4..c1acc84384a0d91045c8b2e95f66ac98bd16ca68 100644
--- a/common/config/config_userapi.c
+++ b/common/config/config_userapi.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,6 +36,7 @@
 #include <errno.h>
 #include <dlfcn.h>
 #include "config_userapi.h"
+extern void exit_fun(const char* s);  // lte-softmodem clean exit function
 
 
 configmodule_interface_t *config_get_if(void)
@@ -50,12 +51,16 @@ configmodule_interface_t *config_get_if(void)
 char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) 
 {
 
-     printf_ptrs("-- %s 0x%08lx %i\n",cfgoptions->optname,(uintptr_t)(*ptr),length);
+     printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length);
+     if(cfgoptions->numelt > 0) { /* already allocated */
+          return *ptr;
+     }
+
      if (*ptr == NULL) {
         *ptr = malloc(length);
         if ( *ptr != NULL) {
              memset(*ptr,0,length);
-             if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) != 0) {
+             if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
                  config_get_if()->ptrs[config_get_if()->numptrs] = *ptr;
                  config_get_if()->numptrs++;
              }
@@ -107,7 +112,29 @@ int tmpval=val;
 	break;
   }
 }
+void config_assign_processedint(paramdef_t *cfgoption, int val) {
+        cfgoption->processedvalue = malloc(sizeof(int));
+        if (  cfgoption->processedvalue != NULL) {
+             *(cfgoption->processedvalue) = val;
+        } else {
+             fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
+             exit(-1);
+        }            
+}
 
+int config_get_processedint(paramdef_t *cfgoption) {
+   int ret;
+        if (  cfgoption->processedvalue != NULL) {
+             ret=*(cfgoption->processedvalue);
+             free( cfgoption->processedvalue);
+             cfgoption->processedvalue=NULL;
+             printf_params("[CONFIG] %s:  set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret);
+        } else {
+             fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
+             ret=0;
+        }
+return ret;            
+}
 void config_printhelp(paramdef_t *params,int numparams)
 {
    for (int i=0 ; i<numparams ; i++) {
@@ -120,6 +147,27 @@ void config_printhelp(paramdef_t *params,int numparams)
    }
 }
 
+int config_execcheck(paramdef_t *params,int numparams, char *prefix)
+{
+int st=0;
+
+   for (int i=0 ; i<numparams ; i++) {
+       if ( params[i].chkPptr == NULL) {
+           continue;
+       }
+       if (params[i].chkPptr->s4.f4 != NULL) {
+         st += params[i].chkPptr->s4.f4(&(params[i]));
+       }
+   }
+   if (st != 0) {
+      fprintf(stderr,"[CONFIG] config_execcheck: %i parameters with wrong value\n", -st); 
+      if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
+          exit_fun("exit because configuration failed\n");
+      }
+   }
+return st;
+}
+
 int config_get(paramdef_t *params,int numparams, char *prefix)
 {
 int ret= -1;
@@ -133,6 +181,7 @@ configmodule_interface_t *cfgif = config_get_if();
       ret = config_get_if()->get(params, numparams,prefix);
       if (ret >= 0) {
          config_process_cmdline(params,numparams,prefix);
+         config_execcheck(params,numparams,prefix);
      }
   return ret;
   }
@@ -147,3 +196,90 @@ int config_isparamset(paramdef_t *params,int paramidx)
       return 0;
   }
 }
+
+void print_intvalueerror(paramdef_t *param, char *fname, int *okval, int numokval) {
+    fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n       ",
+           fname,param->optname, (int)*(param->uptr));
+    for ( int i=0; i<numokval ; i++) {
+         fprintf(stderr, " %i",okval[i]);
+         }
+    fprintf(stderr, " \n");
+}
+ 
+int config_check_intval(paramdef_t *param)
+{
+    if ( param == NULL ){
+       fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n");
+       return -1;
+    }
+    for ( int i=0; i<param->chkPptr->s1.num_okintval ; i++) {
+         if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) {
+             return 0;
+         }
+    }
+    print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval);
+    return -1;
+}
+
+int config_check_modify_integer(paramdef_t *param)
+{
+   
+    for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) {
+    	if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
+            printf_params("[CONFIG] %s:  read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
+    	    *(param->uptr) = param->chkPptr->s1a.setintval [i];
+    	    return 0; 
+    	}
+   }
+    print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval);
+    return -1;
+}
+
+int config_check_intrange(paramdef_t *param)
+{
+   if( *(param->iptr) >= param->chkPptr->s2.okintrange[0]  && *(param->iptr) <= param->chkPptr->s2.okintrange[1]  ) {
+       return 0;
+   }
+   fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n",
+           param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]);
+   return -1;
+}
+
+void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numokval) {
+    fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n       ",
+           fname,param->optname, *(param->strptr));
+    for ( int i=0; i<numokval ; i++) {
+         fprintf(stderr, " %s",okval[i]);
+         }
+    fprintf(stderr, " \n");
+}
+ 
+int config_check_strval(paramdef_t *param)
+{
+    if ( param == NULL ){
+       fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n");
+       return -1;
+    }
+    for ( int i=0; i<param->chkPptr->s3.num_okstrval ; i++) {
+         if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) {
+             return 0;
+         }
+    }
+    print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval);
+    return -1;
+}
+
+int config_checkstr_assign_integer(paramdef_t *param)
+{
+
+
+    for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
+    	if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i]  ) == 0) {
+            config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
+    	    return 0; 
+    	}
+   }
+   print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval);
+
+    return -1;
+}
diff --git a/common/config/config_userapi.h b/common/config/config_userapi.h
index 6acaacf7166b3e3dcac77c46bff4bef5b7d4d807..923a690f51986fdd0772e10480440e6cb68892fe 100644
--- a/common/config/config_userapi.h
+++ b/common/config/config_userapi.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -42,16 +42,30 @@ extern "C"
 #define CONFIG_GETNUMP      ( (config_get_if()==NULL) ? 0    : config_get_if()->num_cfgP      )
 #define CONFIG_GETP(P)      ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P]       )
 #define CONFIG_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0    : !!(config_get_if()->rtflags & P))
-
+#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
+/* utility functions, to be used by configuration module and/or configuration libraries */
 extern configmodule_interface_t *config_get_if(void);
 extern char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
 extern void config_printhelp(paramdef_t *,int numparams);
 extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
-extern int config_get(paramdef_t *params,int numparams, char *prefix);
-extern int config_isparamset(paramdef_t *params,int paramidx);
+extern void config_assign_processedint(paramdef_t *cfgoption, int val);
 extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
-extern int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix);
+
+/* apis to get parameters, to be used by oai modules, at configuration time */
+extern int config_get(paramdef_t *params,int numparams, char *prefix);
 #define config_getlist config_get_if()->getlist
+
+/* apis to retrieve parameters info after calling get or getlist functions */
+extern int config_isparamset(paramdef_t *params,int paramidx);
+extern int config_get_processedint(paramdef_t *cfgoption);
+
+/* functions to be used in parameters definition, to check parameters values */
+extern int config_check_intval(paramdef_t *param);
+extern int config_check_modify_integer(paramdef_t *param);
+extern int config_check_intrange(paramdef_t *param);
+extern int config_check_strval(paramdef_t *param);
+extern int config_checkstr_assign_integer(paramdef_t *param);
+
 #define CONFIG_GETCONFFILE (config_get_if()->cfgP[0])
 
 #ifdef __cplusplus
diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c
index 35a70dfcc79d49fd560a5f8952f4441812c24bf9..a73a0737f25849fba1f59d820cc229f5547a063a 100644
--- a/common/config/libconfig/config_libconfig.c
+++ b/common/config/libconfig/config_libconfig.c
@@ -1,3 +1,33 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+/*! \file common/config/libconfig/config_libconfig.c
+ * \brief: implementation libconfig configuration library
+ * \author Francois TABURET
+ * \date 2017
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
 #define _GNU_SOURCE
 #include <libconfig.h>
 
@@ -21,21 +51,23 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
 {
 const char *str;
 int st;
+int numelt;
 
-   cfgoptions->numelt=config_setting_length(setting);
-   cfgoptions->strlistptr=malloc(sizeof(char *) * (cfgoptions->numelt));
+   numelt=config_setting_length(setting);
+   config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
    st=0;
-   for (int i=0; i< cfgoptions->numelt && cfgoptions->strlistptr != NULL; i++) {
+   for (int i=0; i< numelt ; i++) {
        str=config_setting_get_string_elem(setting,i);
        if (str==NULL) {
           printf("[LIBCONFIG] %s%i  not found in config file\n", cfgoptions->optname,i);
        } else {
-            cfgoptions->strlistptr[i]=malloc(strlen(str)+1);
+            config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1);
             sprintf(cfgoptions->strlistptr[i],"%s",str);
 	    st++;
             printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
        }
    }
+   cfgoptions->numelt=numelt;
    return st;
 }
 
@@ -104,17 +136,28 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
                            cfgpath,str,cfgoptions[i].numelt); 
                   str[strlen(str)-1] = 0;
               }
-              config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
-              config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
-              sprintf( *(cfgoptions[i].strptr) , "%s", str);
-              printf_params("[LIBCONFIG] %s: %s\n", cfgpath,*(cfgoptions[i].strptr) );
+              if (cfgoptions[i].numelt == 0 ) {
+                  config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
+                  config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
+                  sprintf( *(cfgoptions[i].strptr) , "%s", str);
+                  printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) );
+              } else {
+                 sprintf( (char *)(cfgoptions[i].strptr) , "%s", str);
+                 printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr );
+              }
            } else {
 	      if( cfgoptions[i].defstrval != NULL) {
                  defval=1;
-                 config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
-                 config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1);
-                 sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
-                 printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, *(cfgoptions[i].strptr));
+ 
+                 if (cfgoptions[i].numelt == 0 ) {
+                     config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
+                     config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1);
+                     sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
+                     printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, *(cfgoptions[i].strptr));
+                 } else {
+                    sprintf((char *)*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
+                    printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, (char *)*(cfgoptions[i].strptr));
+                 }
               } else {
 	         notfound=1;
               } 
@@ -183,7 +226,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
               read_intarray(&cfgoptions[i],setting,cfgpath);
            } else {
               if( cfgoptions[i].defintarrayval != NULL) {
-                config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t));
+                config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t*));
                 cfgoptions[i].iptr=cfgoptions[i].defintarrayval;
                 defval=1;
                 for (int j=0; j<cfgoptions[i].numelt ; j++) {
@@ -363,6 +406,7 @@ void config_libconfig_end(void )
   config_destroy(&(libconfig_privdata.cfg));
   if ( libconfig_privdata.configfile != NULL ) {
      free(libconfig_privdata.configfile);
+     libconfig_privdata.configfile=NULL;
   } 
   
 }
diff --git a/common/config/libconfig/config_libconfig.h b/common/config/libconfig/config_libconfig.h
index 8013d602cf6d1da96ee79ac6e66aede9958c2495..f541584185ec691e00b8f0ad734651152a69e6bc 100644
--- a/common/config/libconfig/config_libconfig.h
+++ b/common/config/libconfig/config_libconfig.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/config/libconfig/config_libconfig_private.h b/common/config/libconfig/config_libconfig_private.h
index 022e0e6330457aefce694cdc778107a87c8b1873..fb126ff7cb8c6c57c58ce4c42e45ded26a2d89b6 100644
--- a/common/config/libconfig/config_libconfig_private.h
+++ b/common/config/libconfig/config_libconfig_private.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/ran_context.h b/common/ran_context.h
index 4e25729c86a2377da0fd69b3a23093f8317e92f8..4380dc65f12f167a5b2dc99a6a0b98590e74a1de 100644
--- a/common/ran_context.h
+++ b/common/ran_context.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,6 +40,7 @@
 #include "PHY/impl_defs_top.h"
 #include "PHY/impl_defs_lte.h"
 #include "RRC/LITE/defs.h"
+#include "flexran_agent_defs.h"
 
 #include "gtpv1u.h"
 #include "NwGtpv1u.h"
@@ -47,6 +48,8 @@
 #include "NwGtpv1uPrivate.h"
 #include "gtpv1u_eNB_defs.h"
 
+#include "PHY/defs_L1_NB_IoT.h"
+#include "RRC/LITE/defs_NB_IoT.h"
 typedef struct {
   /// RAN context config file name
   char *config_file_name;
@@ -54,22 +57,36 @@ typedef struct {
   int nb_inst;
   /// Number of Component Carriers per instance in this node
   int *nb_CC;
+  /// Number of NB_IoT instances in this node
+  int nb_nb_iot_rrc_inst;
   /// Number of MACRLC instances in this node
   int nb_macrlc_inst;
+  /// Number of NB_IoT MACRLC instances in this node
+  int nb_nb_iot_macrlc_inst;
   /// Number of component carriers per instance in this node
   int *nb_mac_CC;
   /// Number of L1 instances in this node
   int nb_L1_inst;
+  /// Number of NB_IoT L1 instances in this node
+  int nb_nb_iot_L1_inst;
   /// Number of Component Carriers per instance in this node
   int *nb_L1_CC;
   /// Number of RU instances in this node
   int nb_RU;
+  /// FlexRAN context variables
+  flexran_agent_info_t **flexran;
   /// eNB context variables
   struct PHY_VARS_eNB_s ***eNB;
+  /// NB_IoT L1 context variables
+  struct PHY_VARS_eNB_NB_IoT_s **L1_NB_IoT;
   /// RRC context variables
   struct eNB_RRC_INST_s **rrc;
-  /// RRC context variables
+  /// NB_IoT RRC context variables
+  //struct eNB_RRC_INST_NB_IoT_s **nb_iot_rrc;
+  /// MAC context variables
   struct eNB_MAC_INST_s **mac;
+  /// NB_IoT MAC context variables
+  struct eNB_MAC_INST_NB_IoT_s **nb_iot_mac;
   /// GTPu descriptor 
   gtpv1u_data_t *gtpv1u_data_g;
   /// RU descriptors. These describe what each radio unit is supposed to do and contain the necessary functions for fronthaul interfaces
diff --git a/common/utils/T/.gitignore b/common/utils/T/.gitignore
index f5724e6ff8c25fd4bf1fc8701f7ca881de58194a..817780592428b38fd48b57f26be6b3a73868ae63 100644
--- a/common/utils/T/.gitignore
+++ b/common/utils/T/.gitignore
@@ -10,4 +10,9 @@ tracer/replay
 tracer/textlog
 tracer/vcd
 tracer/macpdu2wireshark
+tracer/ue
+tracer/to_vcd
+tracer/extract_input_subframe
+tracer/extract_output_subframe
+tracer/extract
 tracee/tracee
diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h
index 65f2430265574103ceaccd47970f84307f6bfaa6..6bdda0edacdb8f53ead52a6eea844037de309080 100644
--- a/common/utils/T/T_defs.h
+++ b/common/utils/T/T_defs.h
@@ -29,10 +29,10 @@ typedef struct {
 #define T_SHM_FILENAME "/T_shm_segment"
 
 /* number of VCD functions (to be kept up to date! see in T_messages.txt) */
-#define VCD_NUM_FUNCTIONS 172
+#define VCD_NUM_FUNCTIONS 187
 
 /* number of VCD variables (to be kept up to date! see in T_messages.txt) */
-#define VCD_NUM_VARIABLES 118
+#define VCD_NUM_VARIABLES 128
 
 /* first VCD function (to be kept up to date! see in T_messages.txt) */
 #define VCD_FIRST_FUNCTION    ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP)
diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt
index 0eef56505a1e8484f24134d8779f0cfe8c96d19a..8d531f9067708a301b395cb9ca4e2fb5d3bf1ec2 100644
--- a/common/utils/T/T_messages.txt
+++ b/common/utils/T/T_messages.txt
@@ -185,6 +185,10 @@ ID = ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST
     DESC = RRC connection reestablishment request
     GROUP = ALL:RRC:ENB
     FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti
+ID = ENB_RRC_CONNECTION_REESTABLISHMENT
+    DESC = RRC connection reestablishment
+    GROUP = ALL:RRC:ENB
+    FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti
 ID = ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE
     DESC = RRC connection reestablishment complete
     GROUP = ALL:RRC:ENB
@@ -958,6 +962,38 @@ ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX1_ENB
     DESC = VCD variable SUBFRAME_NUMBER_RX1_ENB
     GROUP = ALL:VCD:ENB:VCD_VARIABLE
     FORMAT = ulong,value
+ID = VCD_VARIABLE_FRAME_NUMBER_TX0_RU
+    DESC = VCD variable FRAME_NUMBER_TX0_RU
+    GROUP = ALL:VCD:ENB:VCD_VARIABLE
+    FORMAT = ulong,value
+ID = VCD_VARIABLE_FRAME_NUMBER_TX1_RU
+    DESC = VCD variable FRAME_NUMBER_TX1_RU
+    GROUP = ALL:VCD:ENB:VCD_VARIABLE
+    FORMAT = ulong,value
+ID = VCD_VARIABLE_FRAME_NUMBER_RX0_RU
+    DESC = VCD variable FRAME_NUMBER_RX0_RU
+    GROUP = ALL:VCD:ENB:VCD_VARIABLE
+    FORMAT = ulong,value
+ID = VCD_VARIABLE_FRAME_NUMBER_RX1_RU
+    DESC = VCD variable FRAME_NUMBER_RX1_RU
+    GROUP = ALL:VCD:ENB:VCD_VARIABLE
+    FORMAT = ulong,value
+ID = VCD_VARIABLE_SUBFRAME_NUMBER_TX0_RU
+    DESC = VCD variable SUBFRAME_NUMBER_TX0_RU
+    GROUP = ALL:VCD:ENB:VCD_VARIABLE
+    FORMAT = ulong,value
+ID = VCD_VARIABLE_SUBFRAME_NUMBER_TX1_RU
+    DESC = VCD variable SUBFRAME_NUMBER_TX1_RU
+    GROUP = ALL:VCD:ENB:VCD_VARIABLE
+    FORMAT = ulong,value
+ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX0_RU
+    DESC = VCD variable SUBFRAME_NUMBER_RX0_RU
+    GROUP = ALL:VCD:ENB:VCD_VARIABLE
+    FORMAT = ulong,value
+ID = VCD_VARIABLE_SUBFRAME_NUMBER_RX1_RU
+    DESC = VCD variable SUBFRAME_NUMBER_RX1_RU
+    GROUP = ALL:VCD:ENB:VCD_VARIABLE
+    FORMAT = ulong,value
 ID = VCD_VARIABLE_RUNTIME_TX_ENB
     DESC = VCD variable RUNTIME_TX_ENB
     GROUP = ALL:VCD:ENB:VCD_VARIABLE
@@ -1050,6 +1086,14 @@ ID = VCD_VARIABLE_TRX_TST
     DESC = VCD variable TRX_TST
     GROUP = ALL:VCD:ENB:VCD_VARIABLE
     FORMAT = ulong,value
+ID = VCD_VARIABLE_TRX_TS_UE
+    DESC = VCD variable TRX_TS_UE
+    GROUP = ALL:VCD:UE:VCD_VARIABLE
+    FORMAT = ulong,value
+ID = VCD_VARIABLE_TRX_TST_UE
+    DESC = VCD variable TRX_TST_UE
+    GROUP = ALL:VCD:UE:VCD_VARIABLE
+    FORMAT = ulong,value
 ID = VCD_VARIABLE_TRX_WRITE_FLAGS
     DESC = VCD variable TRX_WRITE_FLAGS
     GROUP = ALL:VCD:ENB:VCD_VARIABLE
@@ -1413,6 +1457,14 @@ ID = VCD_FUNCTION_TRX_WRITE
     DESC = VCD function TRX_WRITE
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
     FORMAT = int,value
+ID = VCD_FUNCTION_TRX_READ_UE
+    DESC = VCD function TRX_READ_UE
+    GROUP = ALL:VCD:UE:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_TRX_WRITE_UE
+    DESC = VCD function TRX_WRITE_UE
+    GROUP = ALL:VCD:UE:VCD_FUNCTION
+    FORMAT = int,value
 ID = VCD_FUNCTION_TRX_READ_IF
     DESC = VCD function TRX_READ_IF
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
@@ -1565,12 +1617,28 @@ ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_TX1
     DESC = VCD function PHY_PROCEDURES_ENB_TX1
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
     FORMAT = int,value
-ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_COMMON
-    DESC = VCD function PHY_PROCEDURES_ENB_RX_COMMON
+ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX
+    DESC = VCD function PHY_PROCEDURES_RU_FEPRX
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPRX1
+    DESC = VCD function PHY_PROCEDURES_RU_FEPRX1
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
     FORMAT = int,value
-ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_COMMON1
-    DESC = VCD function PHY_PROCEDURES_ENB_RX_COMMON1
+ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM
+    DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_OFDM1
+    DESC = VCD function PHY_PROCEDURES_RU_FEPTX_OFDM1
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC
+    DESC = VCD function PHY_PROCEDURES_RU_FEPTX_PREC
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_PHY_PROCEDURES_RU_FEPTX_PREC1
+    DESC = VCD function PHY_PROCEDURES_RU_FEPTX_PREC1
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
     FORMAT = int,value
 ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC
@@ -1581,10 +1649,6 @@ ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC1
     DESC = VCD function PHY_PROCEDURES_ENB_RX_UESPEC1
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
     FORMAT = int,value
-ID = VCD_FUNCTION_ENB_SLOT_FEP
-    DESC = VCD function ENB_SLOT_FEP
-    GROUP = ALL:VCD:ENB:VCD_FUNCTION
-    FORMAT = int,value
 ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX
     DESC = VCD function PHY_PROCEDURES_UE_TX
     GROUP = ALL:VCD:UE:VCD_FUNCTION
@@ -1781,6 +1845,10 @@ ID = VCD_FUNCTION_PHY_ENB_PRACH_RX
     DESC = VCD function PHY_ENB_PRACH_RX
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
     FORMAT = int,value
+ID = VCD_FUNCTION_PHY_RU_PRACH_RX
+    DESC = VCD function PHY_RU_PRACH_RX
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
 ID = VCD_FUNCTION_PHY_ENB_PDCCH_TX
     DESC = VCD function PHY_ENB_PDCCH_TX
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
@@ -2093,3 +2161,39 @@ ID = VCD_FUNCTION_TRX_DECOMPR_IF
     DESC = VCD function TRX_DECOMPR_IF
     GROUP = ALL:VCD:ENB:VCD_FUNCTION
     FORMAT = int,value
+ID = VCD_FUNCTION_NFAPI
+    DESC = VCD function NFAPI
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_GENERATE_PCFICH
+    DESC = VCD function GENERATE_PCFICH
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_GENERATE_DCI0
+    DESC = VCD function GENERATE_DCI0
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_GENERATE_DLSCH
+    DESC = VCD function GENERATE_DLSCH
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_GENERATE_PHICH
+    DESC = VCD function GENERATE_PHICH
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_PDCCH_SCRAMBLING
+    DESC = VCD function PDCCH_SCRAMBLING
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_PDCCH_MODULATION
+    DESC = VCD function PDCCH_MODULATION
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_PDCCH_INTERLEAVING
+    DESC = VCD function PDCCH_INTERLEAVING
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
+ID = VCD_FUNCTION_PDCCH_TX
+    DESC = VCD function PDCCH_TX
+    GROUP = ALL:VCD:ENB:VCD_FUNCTION
+    FORMAT = int,value
diff --git a/common/utils/T/tracer/Makefile b/common/utils/T/tracer/Makefile
index 6546345968637809eeed85e630e393035dcf0589..1c4a77587c3916c9140a9ef71465b08e8a9313aa 100644
--- a/common/utils/T/tracer/Makefile
+++ b/common/utils/T/tracer/Makefile
@@ -3,10 +3,11 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I.
 
 #CFLAGS += -O3 -ffast-math -fomit-frame-pointer
 
-LIBS=-lX11 -lm -lpng -lXft
+LIBS=-lm
+XLIBS=-lX11 -lpng -lXft
 
 all: record replay extract_config textlog enb ue vcd macpdu2wireshark \
-     extract_input_subframe
+     extract_input_subframe extract_output_subframe to_vcd extract
 
 record: utils.o record.o database.o config.o
 	$(CC) $(CFLAGS) -o record $^ $(LIBS)
@@ -21,25 +22,36 @@ extract_input_subframe: extract_input_subframe.o database.o event.o utils.o \
     config.o
 	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
 
+extract_output_subframe: extract_output_subframe.o database.o event.o utils.o \
+    config.o
+	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
+extract: extract.o database.o event.o utils.o config.o
+	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
 textlog: utils.o textlog.o database.o event.o handler.o config.o \
          event_selector.o view/view.a gui/gui.a logger/logger.a \
          filter/filter.a
-	$(CC) $(CFLAGS) -o textlog $^ $(LIBS)
+	$(CC) $(CFLAGS) -o textlog $^ $(LIBS) $(XLIBS)
 
 enb: utils.o enb.o database.o event.o handler.o config.o \
          event_selector.o view/view.a gui/gui.a logger/logger.a \
          filter/filter.a
-	$(CC) $(CFLAGS) -o enb $^ $(LIBS)
+	$(CC) $(CFLAGS) -o enb $^ $(LIBS) $(XLIBS)
 
 ue: utils.o ue.o database.o event.o handler.o config.o \
          event_selector.o view/view.a gui/gui.a logger/logger.a \
          filter/filter.a
-	$(CC) $(CFLAGS) -o ue $^ $(LIBS)
+	$(CC) $(CFLAGS) -o ue $^ $(LIBS) $(XLIBS)
 
 vcd: utils.o vcd.o database.o event.o handler.o config.o \
          event_selector.o view/view.a gui/gui.a logger/logger.a \
          filter/filter.a
-	$(CC) $(CFLAGS) -o vcd $^ $(LIBS)
+	$(CC) $(CFLAGS) -o vcd $^ $(LIBS) $(XLIBS)
+
+to_vcd: to_vcd.o database.o event.o handler.o utils.o config.o \
+         logger/logger.a filter/filter.a
+	$(CC) $(CFLAGS) -o to_vcd $^ $(LIBS)
 
 macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
                   config.o
@@ -65,6 +77,7 @@ filter/filter.a:
 clean:
 	rm -f *.o core tracer_remote textlog enb ue vcd record replay
 	rm -f extract_config macpdu2wireshark extract_input_subframe
+	rm -f extract_output_subframe to_vcd extract
 	cd gui && make clean
 	cd view && make clean
 	cd logger && make clean
diff --git a/common/utils/T/tracer/enb.c b/common/utils/T/tracer/enb.c
index 80093eb8486da51d5d1e9bddd628f090fa76beb0..f607743d1592f1473ad172ad9684a7ba17730104 100644
--- a/common/utils/T/tracer/enb.c
+++ b/common/utils/T/tracer/enb.c
@@ -31,7 +31,10 @@ void reset_ue_ids(void)
   int i;
   printf("resetting known UEs\n");
   for (i = 0; i < 65536; i++) ue_id[i] = -1;
-  next_ue_id = 0;
+  ue_id[65535] = 0;
+  ue_id[65534] = 1;     /* HACK: to be removed */
+  ue_id[2]     = 2;     /* this supposes RA RNTI = 2, very openair specific */
+  next_ue_id = 3;
 }
 
 int ue_id_from_rnti(void *_priv, int rnti)
@@ -94,6 +97,7 @@ typedef struct {
   enb_gui *e;
   int ue;                /* what UE is displayed in the UE specific views */
   void *database;
+  int nb_rb;
 } enb_data;
 
 void is_on_changed(void *_d)
@@ -121,27 +125,6 @@ connection_dies:
   if (pthread_mutex_unlock(&d->lock)) abort();
 }
 
-void usage(void)
-{
-  printf(
-"options:\n"
-"    -d <database file>        this option is mandatory\n"
-"    -on <GROUP or ID>         turn log ON for given GROUP or ID\n"
-"    -off <GROUP or ID>        turn log OFF for given GROUP or ID\n"
-"    -ON                       turn all logs ON\n"
-"    -OFF                      turn all logs OFF\n"
-"                              note: you may pass several -on/-off/-ON/-OFF,\n"
-"                                    they will be processed in order\n"
-"                                    by default, all is off\n"
-"    -ip <host>                connect to given IP address (default %s)\n"
-"    -p <port>                 connect to given port (default %d)\n"
-"    -debug-gui                activate GUI debug logs\n",
-  DEFAULT_REMOTE_IP,
-  DEFAULT_REMOTE_PORT
-  );
-  exit(1);
-}
-
 static void *gui_thread(void *_g)
 {
   gui *g = _g;
@@ -248,13 +231,15 @@ static void click(void *private, gui *g,
   enb_data *ed = private;
   enb_gui *e = ed->e;
   int ue = ed->ue;
+  int do_reset = 0;
 
   if (button != 1) return;
   if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; }
   if (w == e->next_ue_button) ue++;
-  if (w == e->current_ue_button) reset_ue_ids();
+  if (w == e->current_ue_button) do_reset = 1;
 
   if (pthread_mutex_lock(&ed->lock)) abort();
+  if (do_reset) reset_ue_ids();
   if (ue != ed->ue) {
     set_current_ue(g, ed, ue);
     ed->ue = ue;
@@ -314,14 +299,14 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database,
 
   input_signal_plot = new_xy_plot(g, 256, 55, "input signal", 20);
   widget_add_child(g, line, input_signal_plot, -1);
-  xy_plot_set_range(g, input_signal_plot, 0, 7680*10, 20, 70);
+  xy_plot_set_range(g, input_signal_plot, 0, 7680*10 * ed->nb_rb/25, 20, 70);
   input_signal_log = new_framelog(h, database,
       "ENB_PHY_INPUT_SIGNAL", "subframe", "rxdata");
   /* a skip value of 10 means to process 1 frame over 10, that is
    * more or less 10 frames per second
    */
   framelog_set_skip(input_signal_log, 10);
-  input_signal_view = new_view_xy(7680*10, 10,
+  input_signal_view = new_view_xy(7680*10 * ed->nb_rb/25, 10,
       g, input_signal_plot, new_color(g, "#0c0c72"), XY_LOOP_MODE);
   logger_add_view(input_signal_log, input_signal_view);
 
@@ -639,7 +624,7 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database,
   container_set_child_growable(g, top_container, text, 1);
   e->legacy = new_view_textlist(10000, 10, g, text);
 
-  set_current_ue(g, ed, 0);
+  set_current_ue(g, ed, ed->ue);
   register_notifier(g, "click", e->current_ue_button, click, ed);
   register_notifier(g, "click", e->prev_ue_button, click, ed);
   register_notifier(g, "click", e->next_ue_button, click, ed);
@@ -661,6 +646,28 @@ void view_add_log(view *v, char *log, event_handler *h, void *database,
   on_off(database, log, is_on, 1);
 }
 
+void usage(void)
+{
+  printf(
+"options:\n"
+"    -d   <database file>      this option is mandatory\n"
+"    -rb  <RBs>                setup for this number of RBs (default 25)\n"
+"    -on  <GROUP or ID>        turn log ON for given GROUP or ID\n"
+"    -off <GROUP or ID>        turn log OFF for given GROUP or ID\n"
+"    -ON                       turn all logs ON\n"
+"    -OFF                      turn all logs OFF\n"
+"                              note: you may pass several -on/-off/-ON/-OFF,\n"
+"                                    they will be processed in order\n"
+"                                    by default, all is off\n"
+"    -ip <host>                connect to given IP address (default %s)\n"
+"    -p  <port>                connect to given port (default %d)\n"
+"    -debug-gui                activate GUI debug logs\n",
+  DEFAULT_REMOTE_IP,
+  DEFAULT_REMOTE_PORT
+  );
+  exit(1);
+}
+
 int main(int n, char **v)
 {
   extern int volatile gui_logd;
@@ -681,6 +688,8 @@ int main(int n, char **v)
 
   reset_ue_ids();
 
+  enb_data.nb_rb = 25;
+
   /* write on a socket fails if the other end is closed and we get SIGPIPE */
   if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
 
@@ -691,6 +700,8 @@ int main(int n, char **v)
     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], "-rb"))
+      { if (i > n-2) usage(); enb_data.nb_rb = atoi(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; }
@@ -706,6 +717,11 @@ int main(int n, char **v)
     usage();
   }
 
+  switch (enb_data.nb_rb) {
+  case 25: case 50: case 100: break;
+  default: printf("ERROR, bad value for -rb (%d)\n", enb_data.nb_rb); exit(1);
+  }
+
   if (database_filename == NULL) {
     printf("ERROR: provide a database file (-d)\n");
     exit(1);
@@ -724,7 +740,7 @@ int main(int n, char **v)
   g = gui_init();
   new_thread(gui_thread, g);
 
-  enb_data.ue = 0;
+  enb_data.ue = 3;
   enb_data.e = &eg;
   enb_data.database = database;
 
diff --git a/common/utils/T/tracer/extract.c b/common/utils/T/tracer/extract.c
new file mode 100644
index 0000000000000000000000000000000000000000..b9fca959eddf6a8428aee25b5aabf37cd51419b5
--- /dev/null
+++ b/common/utils/T/tracer/extract.c
@@ -0,0 +1,124 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include "database.h"
+#include "event.h"
+#include "config.h"
+
+void usage(void)
+{
+  printf(
+"usage: [options] <file> <event> <buffer name>\n"
+"options:\n"
+"    -d <database file>        this option is mandatory\n"
+"    -o <output file>          this option is mandatory\n"
+"    -f <name> <value>         field 'name' of 'event' has to match 'value'\n"
+"                              type of 'name' must be int\n"
+"                              (you can use several -f options)\n"
+  );
+  exit(1);
+}
+
+int get_filter_arg(database_event_format *f, char *field, char *type)
+{
+  int i;
+  for (i = 0; i < f->count; i++)
+    if (!strcmp(f->name[i], field)) {
+      if (strcmp(f->type[i], type)) break;
+      return i;
+    }
+  printf("bad field %s, check that it exists and has type '%s'\n",field,type);
+  exit(1);
+}
+
+int main(int n, char **v)
+{
+  char *database_filename = NULL;
+  void *database;
+  int i;
+  int input_event_id;
+  database_event_format f;
+  char *file = NULL;
+  char *output_file = NULL;
+  FILE *out;
+  int fd;
+  char *event_name = NULL;
+  char *buffer_name = NULL;
+  char *filter[n];
+  int filter_arg[n];
+  int filter_value[n];
+  int filter_count = 0;
+  int buffer_arg;
+  int found;
+
+  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], "-o"))
+      { if (i > n-2) usage(); output_file = v[++i]; continue; }
+    if (!strcmp(v[i], "-f")) { if (i>n-3) usage();
+      filter[filter_count]         = v[++i];
+      filter_value[filter_count++] = atoi(v[++i]);
+      continue;
+    }
+    if (file == NULL) { file = v[i]; continue; }
+    if (event_name == NULL) { event_name = v[i]; continue; }
+    if (buffer_name == NULL) { buffer_name = v[i]; continue; }
+    usage();
+  }
+  if (file == NULL || event_name == NULL || buffer_name == NULL) usage();
+
+  if (database_filename == NULL) {
+    printf("ERROR: provide a database file (-d)\n");
+    exit(1);
+  }
+
+  if (output_file == NULL) {
+    printf("gimme -o <output file>, thanks\n");
+    exit(1);
+  }
+
+  out = fopen(output_file, "w"); if(out==NULL){perror(output_file);exit(1);}
+
+  database = parse_database(database_filename);
+
+  load_config_file(database_filename);
+
+  input_event_id = event_id_from_name(database, event_name);
+  f = get_format(database, input_event_id);
+
+  buffer_arg = get_filter_arg(&f, buffer_name, "buffer");
+
+  for (i = 0; i < filter_count; i++)
+    filter_arg[i] = get_filter_arg(&f, filter[i], "int");
+
+  fd = open(file, O_RDONLY);
+  if (fd == -1) { perror(file); exit(1); }
+
+  found = 0;
+
+  while (1) {
+    char v[T_BUFFER_MAX];
+    event e;
+    e = get_event(fd, v, database);
+    if (e.type == -1) break;
+    if (e.type != input_event_id) continue;
+    for (i = 0; i < filter_count; i++)
+      if (filter_value[i] != e.e[filter_arg[i]].i)
+        break;
+    if (i != filter_count)
+      continue;
+    if (fwrite(e.e[buffer_arg].b, e.e[buffer_arg].bsize, 1, out) != 1)
+      { perror(output_file); exit(1); }
+    found = 1;
+    break;
+  }
+
+  if (found == 0) printf("ERROR: event not found\n");
+
+  fclose(out);
+
+  return 0;
+}
diff --git a/common/utils/T/tracer/extract_output_subframe.c b/common/utils/T/tracer/extract_output_subframe.c
new file mode 100644
index 0000000000000000000000000000000000000000..b82ad0e7665d259358e08b27f7c1816659ca3b3b
--- /dev/null
+++ b/common/utils/T/tracer/extract_output_subframe.c
@@ -0,0 +1,158 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include "database.h"
+#include "event.h"
+#include "config.h"
+
+void usage(void)
+{
+  printf(
+"usage: [options] <file> <frame> <subframe> <number of subframes>\n"
+"    the program dumps 'number of subframes' subframes starting\n"
+"    at 'frame:suubframe'\n"
+"options:\n"
+"    -d <database file>        this option is mandatory\n"
+"    -o <output file>          output to file (default: stdout)\n"
+"    -v                        verbose\n"
+  );
+  exit(1);
+}
+
+int main(int n, char **v)
+{
+  char *database_filename = NULL;
+  void *database;
+  int i;
+  int output_event_id;
+  database_event_format f;
+  char *file = NULL;
+  int fd;
+  int frame = -1, subframe = -1;
+  int number_of_subframes = -1;
+  int frame_arg, subframe_arg, buffer_arg;
+  int verbose = 0;
+  char *out_filename = NULL;
+  FILE *out;
+
+  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], "-o"))
+      { if (i > n-2) usage(); out_filename = v[++i]; continue; }
+    if (!strcmp(v[i], "-v")) { verbose = 1; continue; }
+    if (file == NULL)              { file = v[i]; continue; }
+    if (frame == -1)               { frame = atoi(v[i]); continue; }
+    if (subframe == -1)            { subframe = atoi(v[i]); continue; }
+    if (number_of_subframes == -1) {number_of_subframes=atoi(v[i]);continue;}
+    usage();
+  }
+  if (file == NULL || frame == -1 || subframe == -1 ||
+      number_of_subframes == -1) usage();
+
+  if (database_filename == NULL) {
+    printf("ERROR: provide a database file (-d)\n");
+    exit(1);
+  }
+
+  if (out_filename == NULL) out = stdout;
+  else {
+    out = fopen(out_filename, "w");
+    if (out == NULL) { perror(out_filename); exit(1); }
+  }
+
+  database = parse_database(database_filename);
+
+  load_config_file(database_filename);
+
+  output_event_id = event_id_from_name(database, "ENB_PHY_OUTPUT_SIGNAL");
+  f = get_format(database, output_event_id);
+
+  frame_arg = subframe_arg = buffer_arg = -1;
+  for (i = 0; i < f.count; i++) {
+    if (!strcmp(f.name[i], "frame")) {
+      if (frame_arg != -1) goto err;
+      if (strcmp(f.type[i], "int")) goto err;
+      frame_arg = i;
+    }
+    if (!strcmp(f.name[i], "subframe")) {
+      if (subframe_arg != -1) goto err;
+      if (strcmp(f.type[i], "int")) goto err;
+      subframe_arg = i;
+    }
+    if (!strcmp(f.name[i], "txdata")) {
+      if (buffer_arg != -1) goto err;
+      if (strcmp(f.type[i], "buffer")) goto err;
+      buffer_arg = i;
+    }
+    continue;
+err:
+    printf("cannot deal with ENB_PHY_OUTPUT_SIGNAL from database file\n");
+    exit(1);
+  }
+  if (frame_arg == -1 || subframe_arg == -1 || buffer_arg == -1) goto err;
+
+  fd = open(file, O_RDONLY);
+  if (fd == -1) { perror(file); exit(1); }
+
+  int last_frame = -1;
+  int last_subframe = -1;
+  int subframe_written = 0;
+  while (1) {
+    char v[T_BUFFER_MAX];
+    event e;
+    e = get_event(fd, v, database);
+    if (e.type == -1) break;
+    if (e.type != output_event_id) continue;
+    if (verbose)
+      printf("found output frame %d subframe %d size %d\n",
+             e.e[frame_arg].i, e.e[subframe_arg].i, e.e[buffer_arg].bsize);
+    if (!(last_frame != -1 ||
+          (frame == e.e[frame_arg].i && subframe == e.e[subframe_arg].i)))
+      continue;
+    frame = e.e[frame_arg].i;
+    subframe = e.e[subframe_arg].i;
+    if (last_frame != -1) {
+      if (frame*10+subframe != (last_frame*10+last_subframe + 1) % 10240) {
+        printf("error: discontinuity, not what you want...\n");
+        exit(1);
+      }
+    }
+    last_frame = frame;
+    last_subframe = subframe;
+#if 0
+for (i = 0; i < e.e[buffer_arg].bsize/2; i++) {
+short *x = e.e[buffer_arg].b;
+x[i] *= 14;
+}
+#endif
+    if (verbose)
+      printf("save output frame %d subframe %d size %d\n",
+             e.e[frame_arg].i, e.e[subframe_arg].i, e.e[buffer_arg].bsize);
+    if (fwrite(e.e[buffer_arg].b, e.e[buffer_arg].bsize, 1, out) != 1) {
+      perror(out_filename);
+      exit(1);
+    }
+    subframe_written++;
+    if (subframe_written != number_of_subframes)
+      continue;
+
+    /* done */
+    fflush(out);
+    if (out_filename != NULL) {
+      if (fclose(out)) perror(out_filename);
+    }
+    if (verbose)
+      printf("%d subframes written\n", subframe_written);
+    return 0;
+  }
+
+  printf("error with input file, %d subframe written\n", subframe_written);
+  fflush(out);
+  if (out_filename != NULL) {
+    if (fclose(out)) perror(out_filename);
+  }
+  return 1;
+}
diff --git a/common/utils/T/tracer/to_vcd.c b/common/utils/T/tracer/to_vcd.c
new file mode 100644
index 0000000000000000000000000000000000000000..82cd3393d7e9e26e59305cb3928a209d879bfdc4
--- /dev/null
+++ b/common/utils/T/tracer/to_vcd.c
@@ -0,0 +1,302 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <signal.h>
+#include <unistd.h>
+#include "database.h"
+#include "utils.h"
+#include "handler.h"
+#include "config.h"
+#include "logger/logger.h"
+#include "view/view.h"
+
+typedef struct {
+  char *event;
+  char *arg;
+  char *vcd_name;
+  int boolean;
+} vcd_vars;
+
+/****************************************************************************/
+/* VCD file handling begin                                                  */
+/****************************************************************************/
+
+FILE *out;
+
+uint64_t start_time;
+int start_time_inited;
+
+void vcd_init(char *file)
+{
+  out = fopen(file, "w"); if (out == NULL) { perror(file); exit(1); }
+}
+
+void vcd_write_header(vcd_vars *v, int n)
+{
+  int i;
+
+  if (fprintf(out,
+"$date\n"
+"  January, 1, 1970.\n"
+"$end\n"
+"$version\n"
+"  to_vcd\n"
+"$end\n"
+"$timescale 1ns $end\n"
+"$scope module logic $end\n") <= 0) abort();
+
+  for (i = 0; i < n; i++)
+    if (fprintf(out, "$var wire %d %s %s $end\n",
+           v[i].boolean ? 1 : 64,
+           v[i].vcd_name, v[i].vcd_name) <= 0) abort();
+
+  if (fprintf(out,
+"$upscope $end\n"
+"$enddefinitions $end\n"
+"$dumpvars\n") <= 0) abort();
+
+  for (i = 0; i < n; i++)
+    if (v[i].boolean) {
+      if (fprintf(out, "0%s\n", v[i].vcd_name) <= 0) abort();
+    } else {
+      if (fprintf(out, "b0 %s\n", v[i].vcd_name) <= 0) abort();
+    }
+
+  if (fprintf(out,
+"$end\n") <= 0) abort();
+
+}
+
+void vcd_end(void)
+{
+  if (fclose(out)) { perror("error closing VCD file"); exit(1); }
+}
+
+char *b64(uint64_t val)
+{
+  static char v[65];
+  char *s = &v[64];
+  *s = 0;
+  if (val == 0) { s--; *s = '0'; return s; }
+  while (val) {
+    s--;
+    *s = val&1 ? '1' : '0';
+    val >>= 1;
+  }
+  return s;
+}
+
+void vcd_dump(char *v)
+{
+  uint64_t h, m, s, ns;
+  char t;
+  uint64_t val;
+  uint64_t time;
+  char var[256];
+  if (sscanf(v, "%"SCNu64":%"SCNu64":%"SCNu64".%"SCNu64": %c %"SCNu64" %s",
+      &h, &m, &s, &ns, &t, &val, var) != 7)
+    goto err;
+  time = h*60*60*1000000000 +
+            m*60*1000000000 +
+               s*1000000000 +
+                         ns;
+  if (!start_time_inited) {
+    start_time = time;
+    start_time_inited = 1;
+  }
+  if (fprintf(out, "#%"PRIu64"\n", time - start_time) <= 0) abort();
+  switch (t) {
+  case 'b': if (fprintf(out, "%d%s\n", val!=0, var) <= 0) abort(); break;
+  case 'l': if (fprintf(out, "b%s %s\n", b64(val), var) <= 0) abort(); break;
+  default: goto err;
+  }
+
+  return;
+
+err:
+  printf("bad vcd_dump line '%s'\n", v);
+  exit(1);
+}
+
+/****************************************************************************/
+/* VCD file handling end                                                    */
+/****************************************************************************/
+
+
+/****************************************************************************/
+/* vcd view start                                                           */
+/****************************************************************************/
+
+struct vcd_view {
+  view common;
+};
+
+static void vcd_view_clear(view *this)
+{
+  /* nothing */
+}
+
+static void vcd_view_append(view *_this, char *s)
+{
+  vcd_dump(s);
+}
+
+static view *new_view_vcd(void)
+{
+  struct vcd_view *ret = calloc(1, sizeof(struct vcd_view));
+  if (ret == NULL) abort();
+  ret->common.clear = vcd_view_clear;
+  ret->common.append = (void (*)(view *, ...))vcd_view_append;
+  return (view *)ret;
+}
+
+/****************************************************************************/
+/* vcd view end                                                             */
+/****************************************************************************/
+
+void activate_traces(int socket, int number_of_events, int *is_on)
+{
+  char t = 1;
+  if (socket_send(socket, &t, 1) == -1 ||
+      socket_send(socket, &number_of_events, sizeof(int)) == -1 ||
+      socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
+    abort();
+}
+
+void usage(void)
+{
+  printf(
+"options:\n"
+"    -d <database file>           this option is mandatory\n"
+"    -o <output file>             this option is mandatory\n"
+"    -ip <host>                   connect to given IP address (default %s)\n"
+"    -p <port>                    connect to given port (default %d)\n"
+"    -b <event> <arg> <vcd name>  trace as binary (0 off, anything else on)\n"
+"    -l <event> <arg> <vcd name>  trace as uint64_t\n",
+  DEFAULT_REMOTE_IP,
+  DEFAULT_REMOTE_PORT
+  );
+  exit(1);
+}
+
+int run = 1;
+static int socket = -1;
+
+void force_stop(int x)
+{
+  printf("\ngently quit...\n");
+  close(socket);
+  socket = -1;
+  run = 0;
+}
+
+int main(int n, char **v)
+{
+  char *output_filename = NULL;
+  char *database_filename = NULL;
+  void *database;
+  char *ip = DEFAULT_REMOTE_IP;
+  int port = DEFAULT_REMOTE_PORT;
+  int *is_on;
+  int number_of_events;
+  int i;
+  vcd_vars vars[n];
+  int nvars = 0;
+  view *vcd_view;
+  event_handler *h;
+  logger *textlog;
+
+  /* write on a socket fails if the other end is closed and we get SIGPIPE */
+  if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
+
+  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], "-o"))
+      { if (i > n-2) usage(); output_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; }
+    if (!strcmp(v[i], "-b")) { if(i>n-4)usage();
+      vars[nvars].event     = v[++i];
+      vars[nvars].arg       = v[++i];
+      vars[nvars].vcd_name  = v[++i];
+      vars[nvars++].boolean = 1;
+      continue;
+    }
+    if (!strcmp(v[i], "-l")) { if(i>n-4)usage();
+      vars[nvars].event     = v[++i];
+      vars[nvars].arg       = v[++i];
+      vars[nvars].vcd_name  = v[++i];
+      vars[nvars++].boolean = 0;
+      continue;
+    }
+    usage();
+  }
+
+  if (output_filename == NULL) {
+    printf("ERROR; provide an output file (-o)\n");
+    exit(1);
+  }
+
+  if (database_filename == NULL) {
+    printf("ERROR: provide a database file (-d)\n");
+    exit(1);
+  }
+
+  database = parse_database(database_filename);
+
+  load_config_file(database_filename);
+
+  number_of_events = number_of_ids(database);
+  is_on = calloc(number_of_events, sizeof(int));
+  if (is_on == NULL) abort();
+
+  h = new_handler(database);
+
+  /* create the view */
+  vcd_view = new_view_vcd();
+
+  /* setup traces */
+  for (i = 0; i < nvars; i++) {
+    char format[256];
+    if (strlen(vars[i].arg) > 256-3) abort();
+    if (strlen(vars[i].vcd_name) > 256-1) abort();
+    sprintf(format, "%c [%s] %s",
+        vars[i].boolean ? 'b' : 'l',
+        vars[i].arg,
+        vars[i].vcd_name);
+    textlog = new_textlog(h, database, vars[i].event, format);
+    logger_add_view(textlog, vcd_view);
+    on_off(database, vars[i].event, is_on, 1);
+  }
+
+  socket = connect_to(ip, port);
+
+  /* activate selected traces */
+  activate_traces(socket, number_of_events, is_on);
+
+  vcd_init(output_filename);
+  vcd_write_header(vars, nvars);
+
+  /* exit on ctrl+c and ctrl+z */
+  if (signal(SIGQUIT, force_stop) == SIG_ERR) abort();
+  if (signal(SIGINT, force_stop) == SIG_ERR) abort();
+  if (signal(SIGTSTP, force_stop) == SIG_ERR) abort();
+
+  /* read messages */
+  while (run) {
+    char v[T_BUFFER_MAX];
+    event e;
+    e = get_event(socket, v, database);
+    if (e.type == -1) { printf("disconnected? let's quit gently\n"); break; }
+    handle_event(h, e);
+  }
+
+  vcd_end();
+
+  return 0;
+}
diff --git a/common/utils/asn1_conversions.h b/common/utils/asn1_conversions.h
index 8eed4faaad5da20430ce39a27093c2e22ab04f6e..050c065d9d548bf5874c6d9fb58f4d80f2e09b66 100644
--- a/common/utils/asn1_conversions.h
+++ b/common/utils/asn1_conversions.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/assertions.h b/common/utils/assertions.h
index 18675fb8fb687ef6edb6ba801841ecd1240a14a7..f6728caf7bb5ee213b4f1c8b175c911d92a8962d 100644
--- a/common/utils/assertions.h
+++ b/common/utils/assertions.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/hashtable/hashtable.c b/common/utils/hashtable/hashtable.c
index b82affb4a3ed377727fa0b1ee535a09c87d9f4c7..6322b1dea634b7063f6057e339b8fbde2fe7b652 100644
--- a/common/utils/hashtable/hashtable.c
+++ b/common/utils/hashtable/hashtable.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under 
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.  
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/hashtable/hashtable.h b/common/utils/hashtable/hashtable.h
index 2fd08e6625da179fe9d866ba2cbba342fb29090e..62002fb60f89c738d8d2a941d9cd31fac9e268f5 100644
--- a/common/utils/hashtable/hashtable.h
+++ b/common/utils/hashtable/hashtable.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under 
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.  
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/hashtable/obj_hashtable.c b/common/utils/hashtable/obj_hashtable.c
index caae391ae2097d92f7606547b1f0d11b2b6f9297..7fb68d16817993c86e75f211e2b0b2c257039e19 100644
--- a/common/utils/hashtable/obj_hashtable.c
+++ b/common/utils/hashtable/obj_hashtable.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under 
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.  
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/hashtable/obj_hashtable.h b/common/utils/hashtable/obj_hashtable.h
index 45f97a6baab7d9eb8ffc2e76b89394d298702eef..a43d472a471377d602c0cdf002db7465ae7a413f 100644
--- a/common/utils/hashtable/obj_hashtable.h
+++ b/common/utils/hashtable/obj_hashtable.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under 
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.  
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/assertions.h b/common/utils/itti/assertions.h
index a411bd539728b93cb563ad39843f5eefbf5bd88e..bb6c27cbab358db0b8ed54478beb70d4110ce8ed 100644
--- a/common/utils/itti/assertions.h
+++ b/common/utils/itti/assertions.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/backtrace.c b/common/utils/itti/backtrace.c
index ed7849ab4d394054d370d6b8f7170a3d800d7838..889e0d84d148f3694ce363a2f74ac33065cbeb26 100644
--- a/common/utils/itti/backtrace.c
+++ b/common/utils/itti/backtrace.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/backtrace.h b/common/utils/itti/backtrace.h
index 701bc0ab0e171a24f251d063421530585eb333f0..9a77767cf4a11ede13185e9140b475e2f404adba 100644
--- a/common/utils/itti/backtrace.h
+++ b/common/utils/itti/backtrace.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c
index 5a6438ed3c70e8e45ee77ecb2753accd2f9944ec..a614967658c49e478b655f4a4adfbcee3c81c333 100644
--- a/common/utils/itti/intertask_interface.c
+++ b/common/utils/itti/intertask_interface.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -31,10 +31,6 @@
 #include <sys/epoll.h>
 #include <sys/eventfd.h>
 
-#ifdef RTAI
-# include <rtai_shm.h>
-#endif
-
 #if !defined(TRUE)
 #define TRUE 1
 #endif
@@ -45,11 +41,6 @@
 #include "intertask_interface.h"
 #include "intertask_interface_dump.h"
 
-#if defined(OAI_EMU) || defined(RTAI)
-# include "memory_pools.h"
-# include "vcd_signal_dumper.h"
-#endif
-
 #if T_TRACER
 #include "T.h"
 #endif
@@ -64,14 +55,6 @@
 #include "signals.h"
 #include "timer.h"
 
-#ifdef RTAI
-# include <rtai.h>
-# include <rtai_fifos.h>
-#    define FIFO_PRINTF_MAX_STRING_SIZE 1000
-#    define FIFO_PRINTF_NO              62
-#    define FIFO_PRINTF_SIZE            65536
-#endif
-
 /* ITTI DEBUG groups */
 #define ITTI_DEBUG_POLL             (1<<0)
 #define ITTI_DEBUG_SEND             (1<<1)
@@ -83,21 +66,12 @@
 
 const int itti_debug = (ITTI_DEBUG_ISSUES | ITTI_DEBUG_MP_STATISTICS);
 
-/* Don't flush if using RTAI */
-#ifdef RTAI
-# define ITTI_DEBUG(m, x, args...)  do { if ((m) & itti_debug) rt_log_debug (x, ##args); } while(0);
-#else
 # define ITTI_DEBUG(m, x, args...)  do { if ((m) & itti_debug) {fprintf(stdout, "[ITTI][D]"x, ##args); fflush (stdout);} } while(0);
-#endif
 #define ITTI_ERROR(x, args...)      do { fprintf(stdout, "[ITTI][E]"x, ##args); fflush (stdout); } while(0);
 
 /* Global message size */
 #define MESSAGE_SIZE(mESSAGEiD) (sizeof(MessageHeader) + itti_desc.messages_info[mESSAGEiD].size)
 
-#ifdef RTAI
-# define ITTI_MEM_PAGE_SIZE (1024)
-# define ITTI_MEM_SIZE      (16 * 1024 * 1024)
-#endif
 
 extern int emulate_rf;
 
@@ -139,13 +113,11 @@ typedef struct thread_desc_s {
 
   int epoll_nb_events;
 
-  //#ifdef RTAI
   /* Flag to mark real time thread */
   unsigned real_time;
 
-  /* Counter to indicate from RTAI threads that messages are pending for the thread */
+  /* Counter to indicate that messages are pending for the thread */
   unsigned messages_pending;
-  //#endif
 } thread_desc_t;
 
 typedef struct task_desc_s {
@@ -177,17 +149,6 @@ typedef struct itti_desc_s {
   volatile uint32_t created_tasks;
   volatile uint32_t ready_tasks;
   volatile int      wait_tasks;
-#ifdef RTAI
-  pthread_t rt_relay_thread;
-#endif
-
-#if defined(OAI_EMU) || defined(RTAI)
-  memory_pools_handle_t memory_pools_handle;
-
-  uint64_t vcd_poll_msg;
-  uint64_t vcd_receive_msg;
-  uint64_t vcd_send_msg;
-#endif
 } itti_desc_t;
 
 static itti_desc_t itti_desc;
@@ -196,20 +157,8 @@ void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize
 {
   void *ptr = NULL;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  ptr = memory_pools_allocate (itti_desc.memory_pools_handle, size, origin_task_id, destination_task_id);
-
-  if (ptr == NULL) {
-    char *statistics = memory_pools_statistics (itti_desc.memory_pools_handle);
-
-    ITTI_ERROR (" Memory pools statistics:\n%s", statistics);
-    free (statistics);
-  }
-
-#else
   ptr = malloc (size);
   if (ptr) memset(ptr,0,size);
-#endif
 
   AssertFatal (ptr != NULL, "Memory allocation of %d bytes failed (%d -> %d)!\n", (int) size, origin_task_id, destination_task_id);
 
@@ -221,13 +170,7 @@ int itti_free(task_id_t task_id, void *ptr)
   int result = EXIT_SUCCESS;
   AssertFatal (ptr != NULL, "Trying to free a NULL pointer (%d)!\n", task_id);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  result = memory_pools_free (itti_desc.memory_pools_handle, ptr, task_id);
-
-  AssertError (result == EXIT_SUCCESS, {}, "Failed to free memory at %p (%d)!\n", ptr, task_id);
-#else
   free (ptr);
-#endif
 
   return (result);
 }
@@ -283,27 +226,6 @@ static task_id_t itti_get_current_task_id(void)
   return TASK_UNKNOWN;
 }
 
-#ifdef RTAI
-static void rt_log_debug(char *format, ...)
-{
-  task_id_t   task_id;
-  va_list     args;
-  char        log_buffer[FIFO_PRINTF_MAX_STRING_SIZE];
-  int         len;
-
-  task_id = itti_get_current_task_id ();
-  len = snprintf(log_buffer, FIFO_PRINTF_MAX_STRING_SIZE-1, "[ITTI][D][%s]", itti_get_task_name(task_id));
-  va_start(args, format);
-  len += vsnprintf(&log_buffer[len], FIFO_PRINTF_MAX_STRING_SIZE-1-len, format, args);
-  va_end (args);
-
-  if (task_id != TASK_UNKNOWN)
-    fwrite(log_buffer, len, 1, stdout);
-  else
-    rtf_put (FIFO_PRINTF_NO, log_buffer, len);
-}
-#endif
-
 void itti_update_lte_time(uint32_t frame, uint8_t slot)
 {
   itti_desc.lte_time.frame = frame;
@@ -360,10 +282,6 @@ MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds m
 
   AssertFatal (message_id < itti_desc.messages_id_max, "Message id (%d) is out of range (%d)!\n", message_id, itti_desc.messages_id_max);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_ALLOC_MSG, size);
-#endif
-
   if (origin_task_id == TASK_UNKNOWN) {
     /* Try to identify real origin task ID */
     origin_task_id = itti_get_current_task_id();
@@ -375,10 +293,6 @@ MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds m
   temp->ittiMsgHeader.originTaskId = origin_task_id;
   temp->ittiMsgHeader.ittiMsgSize = size;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_ALLOC_MSG, 0);
-#endif
-
   return temp;
 }
 
@@ -396,11 +310,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
   message_number_t message_number;
   uint32_t message_id;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
-                                          __sync_or_and_fetch (&itti_desc.vcd_send_msg, 1L << destination_task_id));
-#endif
-
   AssertFatal (message != NULL, "Message is NULL!\n");
   AssertFatal (destination_task_id < itti_desc.task_max, "Destination task id (%d) is out of range (%d)\n", destination_task_id, itti_desc.task_max);
 
@@ -423,11 +332,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
                            sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
 
   if (destination_task_id != TASK_UNKNOWN) {
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE, VCD_FUNCTION_IN);
-
-    memory_pools_set_info (itti_desc.memory_pools_handle, message, 1, destination_task_id);
-#endif
 
     if (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_ENDED) {
       ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Message %s, number %lu with priority %d can not be sent from %s to queue (%u:%s), ended destination task!\n",
@@ -462,17 +366,103 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
         AssertFatal(0, "Error: lfds611_queue_enqueue returns 0, queue is full, exiting\n");
       }
 
-#if defined(OAI_EMU) || defined(RTAI)
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE, VCD_FUNCTION_OUT);
-#endif
+      {
+        /* Only use event fd for tasks, subtasks will pool the queue */
+        if (TASK_GET_PARENT_TASK_ID(destination_task_id) == TASK_UNKNOWN) {
+          ssize_t write_ret;
+          eventfd_t sem_counter = 1;
+
+          /* Call to write for an event fd must be of 8 bytes */
+          write_ret = write (itti_desc.threads[destination_thread_id].task_event_fd, &sem_counter, sizeof(sem_counter));
+          AssertFatal (write_ret == sizeof(sem_counter), "Write to task message FD (%d) failed (%d/%d)\n",
+                       destination_thread_id, (int) write_ret, (int) sizeof(sem_counter));
+        }
+      }
+
+      ITTI_DEBUG(ITTI_DEBUG_SEND, " Message %s, number %lu with priority %d successfully sent from %s to queue (%u:%s)\n",
+                 itti_desc.messages_info[message_id].name,
+                 message_number,
+                 priority,
+                 itti_get_task_name(origin_task_id),
+                 destination_task_id,
+                 itti_get_task_name(destination_task_id));
+    }
+  } else {
+    /* This is a debug message to TASK_UNKNOWN, we can release safely release it */
+    int result = itti_free(origin_task_id, message);
+    AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+  }
 
-#ifdef RTAI
+  return 0;
+}
+
+/* same as itti_send_msg_to_task but returns -1 in case of failure instead of crashing */
+/* TODO: this is a hack - the whole logic needs a proper rework. */
+/* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */
+int itti_try_send_msg_to_task(task_id_t destination_task_id, instance_t instance, MessageDef *message)
+{
+  thread_id_t destination_thread_id;
+  task_id_t origin_task_id;
+  message_list_t *new;
+  uint32_t priority;
+  message_number_t message_number;
+  uint32_t message_id;
+
+  AssertFatal (message != NULL, "Message is NULL!\n");
+  AssertFatal (destination_task_id < itti_desc.task_max, "Destination task id (%d) is out of range (%d)\n", destination_task_id, itti_desc.task_max);
+
+  destination_thread_id = TASK_GET_THREAD_ID(destination_task_id);
+  message->ittiMsgHeader.destinationTaskId = destination_task_id;
+  message->ittiMsgHeader.instance = instance;
+  message->ittiMsgHeader.lte_time.frame = itti_desc.lte_time.frame;
+  message->ittiMsgHeader.lte_time.slot = itti_desc.lte_time.slot;
+  message_id = message->ittiMsgHeader.messageId;
+  AssertFatal (message_id < itti_desc.messages_id_max, "Message id (%d) is out of range (%d)!\n", message_id, itti_desc.messages_id_max);
+
+  origin_task_id = ITTI_MSG_ORIGIN_ID(message);
+
+  priority = itti_get_message_priority (message_id);
+
+  /* Increment the global message number */
+  message_number = itti_increment_message_number ();
+
+  itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name,
+                           sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
+
+  if (destination_task_id != TASK_UNKNOWN) {
+
+    if (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_ENDED) {
+      ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Message %s, number %lu with priority %d can not be sent from %s to queue (%u:%s), ended destination task!\n",
+                 itti_desc.messages_info[message_id].name,
+                 message_number,
+                 priority,
+                 itti_get_task_name(origin_task_id),
+                 destination_task_id,
+                 itti_get_task_name(destination_task_id));
+    } else {
+      /* We cannot send a message if the task is not running */
+      AssertFatal (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_READY,
+                   "Task %s Cannot send message %s (%d) to thread %d, it is not in ready state (%d)!\n",
+                   itti_get_task_name(origin_task_id),
+                   itti_desc.messages_info[message_id].name,
+                   message_id,
+                   destination_thread_id,
+                   itti_desc.threads[destination_thread_id].task_state);
+
+      /* Allocate new list element */
+      new = (message_list_t *) itti_malloc (origin_task_id, destination_task_id, sizeof(struct message_list_s));
+
+      /* Fill in members */
+      new->msg = message;
+      new->message_number = message_number;
+      new->message_priority = priority;
+
+      /* Enqueue message in destination task queue */
+      if (lfds611_queue_enqueue(itti_desc.tasks[destination_task_id].message_queue, new) == 0) {
+        itti_free(origin_task_id, new);
+        return -1;
+      }
 
-      if (itti_desc.threads[TASK_GET_THREAD_ID(origin_task_id)].real_time) {
-        /* This is a RT task, increase destination task messages pending counter */
-        __sync_fetch_and_add (&itti_desc.threads[destination_thread_id].messages_pending, 1);
-      } else
-#endif
       {
         /* Only use event fd for tasks, subtasks will pool the queue */
         if (TASK_GET_PARENT_TASK_ID(destination_task_id) == TASK_UNKNOWN) {
@@ -500,11 +490,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
     AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
   }
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
-                                          __sync_and_and_fetch (&itti_desc.vcd_send_msg, ~(1L << destination_task_id)));
-#endif
-
   return 0;
 }
 
@@ -649,17 +634,9 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t
 
 void itti_receive_msg(task_id_t task_id, MessageDef **received_msg)
 {
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
-                                          __sync_and_and_fetch (&itti_desc.vcd_receive_msg, ~(1L << task_id)));
-#endif
 
   itti_receive_msg_internal_event_fd(task_id, 0, received_msg);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
-                                          __sync_or_and_fetch (&itti_desc.vcd_receive_msg, 1L << task_id));
-#endif
 }
 
 void itti_poll_msg(task_id_t task_id, MessageDef **received_msg)
@@ -668,11 +645,6 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg)
 
   *received_msg = NULL;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
-                                          __sync_or_and_fetch (&itti_desc.vcd_poll_msg, 1L << task_id));
-#endif
-
   {
     struct message_list_s *message;
 
@@ -689,10 +661,6 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg)
     ITTI_DEBUG(ITTI_DEBUG_POLL, " No message in queue[(%u:%s)]\n", task_id, itti_get_task_name(task_id));
   }
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
-                                          __sync_and_and_fetch (&itti_desc.vcd_poll_msg, ~(1L << task_id)));
-#endif
 }
 
 int itti_create_task(task_id_t task_id, void *(*start_routine)(void *), void *args_p)
@@ -724,7 +692,6 @@ int itti_create_task(task_id_t task_id, void *(*start_routine)(void *), void *ar
   return 0;
 }
 
-//#ifdef RTAI
 void itti_set_task_real_time(task_id_t task_id)
 {
   thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
@@ -733,7 +700,6 @@ void itti_set_task_real_time(task_id_t task_id)
 
   itti_desc.threads[thread_id].real_time = TRUE;
 }
-//#endif
 
 void itti_wait_ready(int wait_tasks)
 {
@@ -761,15 +727,6 @@ void itti_mark_task_ready(task_id_t task_id)
   /* Mark the thread as using LFDS queue */
   lfds611_queue_use(itti_desc.tasks[task_id].message_queue);
 
-#ifdef RTAI
-  /* Assign low priority to created threads */
-  {
-    struct sched_param sched_param;
-    sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
-    sched_setscheduler(0, SCHED_FIFO, &sched_param);
-  }
-#endif
-
   itti_desc.threads[thread_id].task_state = TASK_STATE_READY;
   itti_desc.ready_tasks ++;
 
@@ -782,15 +739,19 @@ void itti_mark_task_ready(task_id_t task_id)
 
 void itti_exit_task(void)
 {
-#if defined(OAI_EMU) || defined(RTAI)
   task_id_t task_id = itti_get_current_task_id();
+  thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
 
+#if defined(OAI_EMU) || defined(RTAI)
   if (task_id > TASK_UNKNOWN) {
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
                                             __sync_and_and_fetch (&itti_desc.vcd_receive_msg, ~(1L << task_id)));
   }
-
 #endif
+
+  itti_desc.threads[thread_id].task_state = TASK_STATE_NOT_CONFIGURED;
+  itti_desc.created_tasks--;
+  ITTI_DEBUG(ITTI_DEBUG_EXIT, "Thread for task %s (%d) exits\n", itti_get_task_name(task_id), task_id);
   pthread_exit (NULL);
 }
 
@@ -806,45 +767,6 @@ void itti_terminate_tasks(task_id_t task_id)
   pthread_exit (NULL);
 }
 
-#ifdef RTAI
-static void *itti_rt_relay_thread(void *arg)
-{
-  thread_id_t thread_id;
-  unsigned pending_messages;
-
-  while (itti_desc.running) {
-    usleep (200); // Poll for messages a little more than 2 time by slot to get a small latency between RT and other tasks
-
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_RELAY_THREAD, VCD_FUNCTION_IN);
-#endif
-
-    /* Checks for all non real time tasks if they have pending messages */
-    for (thread_id = THREAD_FIRST; thread_id < itti_desc.thread_max; thread_id++) {
-      if ((itti_desc.threads[thread_id].task_state == TASK_STATE_READY)
-          && (itti_desc.threads[thread_id].real_time == FALSE)) {
-        pending_messages = __sync_fetch_and_and (&itti_desc.threads[thread_id].messages_pending, 0);
-
-        if (pending_messages > 0) {
-          ssize_t write_ret;
-          eventfd_t sem_counter = pending_messages;
-
-          /* Call to write for an event fd must be of 8 bytes */
-          write_ret = write (itti_desc.threads[thread_id].task_event_fd, &sem_counter, sizeof(sem_counter));
-          DevCheck(write_ret == sizeof(sem_counter), write_ret, sem_counter, thread_id);
-        }
-      }
-    }
-
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_RELAY_THREAD, VCD_FUNCTION_OUT);
-#endif
-  }
-
-  return NULL;
-}
-#endif
-
 int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_id_max, const task_info_t *tasks_info,
               const message_info_t *messages_info, const char * const messages_definition_xml, const char * const dump_file_name)
 {
@@ -925,45 +847,12 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i
     ITTI_DEBUG(ITTI_DEBUG_EVEN_FD, " Successfully subscribed fd %d for thread %d\n",
                itti_desc.threads[thread_id].task_event_fd, thread_id);
 
-#ifdef RTAI
-    itti_desc.threads[thread_id].real_time = FALSE;
-    itti_desc.threads[thread_id].messages_pending = 0;
-#endif
   }
 
   itti_desc.running = 1;
   itti_desc.wait_tasks = 0;
   itti_desc.created_tasks = 0;
   itti_desc.ready_tasks = 0;
-#ifdef RTAI
-  /* Start RT relay thread */
-  DevAssert(pthread_create (&itti_desc.rt_relay_thread, NULL, itti_rt_relay_thread, NULL) >= 0);
-
-  rt_global_heap_open();
-#endif
-
-#if defined(OAI_EMU) || defined(RTAI)
-  itti_desc.memory_pools_handle = memory_pools_create (5);
-  memory_pools_add_pool (itti_desc.memory_pools_handle, 1000 + ITTI_QUEUE_MAX_ELEMENTS,       50);
-  memory_pools_add_pool (itti_desc.memory_pools_handle, 1000 + (2 * ITTI_QUEUE_MAX_ELEMENTS), 100);
-  memory_pools_add_pool (itti_desc.memory_pools_handle, 10000,                                1000);
-  memory_pools_add_pool (itti_desc.memory_pools_handle,  400,                                 20050);
-  memory_pools_add_pool (itti_desc.memory_pools_handle,  100,                                 30050);
-
-  {
-    char *statistics = memory_pools_statistics (itti_desc.memory_pools_handle);
-
-    ITTI_DEBUG(ITTI_DEBUG_MP_STATISTICS, " Memory pools statistics:\n%s", statistics);
-    free (statistics);
-  }
-#endif
-
-#if defined(OAI_EMU) || defined(RTAI)
-  itti_desc.vcd_poll_msg = 0;
-  itti_desc.vcd_receive_msg = 0;
-  itti_desc.vcd_send_msg = 0;
-#endif
-
   itti_dump_init (messages_definition_xml, dump_file_name);
 
   CHECK_INIT_RETURN(timer_init ());
@@ -1026,15 +915,6 @@ void itti_wait_tasks_end(void)
 
   itti_desc.running = 0;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  {
-    char *statistics = memory_pools_statistics (itti_desc.memory_pools_handle);
-
-    ITTI_DEBUG(ITTI_DEBUG_MP_STATISTICS, " Memory pools statistics:\n%s", statistics);
-    free (statistics);
-  }
-#endif
-
   if (ready_tasks > 0) {
     ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Some threads are still running, force exit\n");
     exit (0);
diff --git a/common/utils/itti/intertask_interface.h b/common/utils/itti/intertask_interface.h
index a2137c119d3ad0ead24589d40c51670e4eb9634d..ada34ce1b722a09722373cc5a650870364891b4e 100644
--- a/common/utils/itti/intertask_interface.h
+++ b/common/utils/itti/intertask_interface.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -27,10 +27,6 @@
 
 #include <sys/epoll.h>
 
-#ifdef RTAI
-# include <rtai_sem.h>
-#endif
-
 #ifndef INTERTASK_INTERFACE_H_
 #define INTERTASK_INTERFACE_H_
 
@@ -112,6 +108,18 @@ int itti_send_broadcast_message(MessageDef *message_p);
  **/
 int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message);
 
+/* TODO: this is a hack. Almost no caller of itti_send_msg_to_task checks
+ * the return value so it has been changed to crash the program in case
+ * of failure instead of returning -1 as the documentation above says.
+ * The RLC UM code may receive too much data when doing UDP at a higher
+ * throughput than the link allows and so for this specific case we need
+ * a version that actually returns -1 on failure.
+ *
+ * This needs to be cleaned at some point.
+ */
+/* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */
+int itti_try_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message);
+
 /** \brief Add a new fd to monitor.
  * NOTE: it is up to the user to read data associated with the fd
  *  \param task_id Task ID of the receiving task
@@ -155,12 +163,10 @@ int itti_create_task(task_id_t task_id,
                      void *(*start_routine) (void *),
                      void *args_p);
 
-//#ifdef RTAI
 /** \brief Mark the task as a real time task
  * \param task_id task to mark as real time
  **/
 void itti_set_task_real_time(task_id_t task_id);
-//#endif
 
 /** \brief Indicates to ITTI if newly created tasks should wait for all tasks to be ready
  * \param wait_tasks non 0 to make new created tasks to wait, 0 to let created tasks to run
diff --git a/common/utils/itti/intertask_interface_dump.c b/common/utils/itti/intertask_interface_dump.c
index 8f08475c6a06303f194dffd17789ad5b3cffcfcf..bb7750972664b8ef5ca48e71554277a10fdbf0a9 100644
--- a/common/utils/itti/intertask_interface_dump.c
+++ b/common/utils/itti/intertask_interface_dump.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -51,23 +51,14 @@
 #include "intertask_interface.h"
 #include "intertask_interface_dump.h"
 
-#if defined(OAI_EMU) || defined(RTAI)
-#include "vcd_signal_dumper.h"
-#endif
-
 #if T_TRACER
 #include "T.h"
 #endif
 
 static const int itti_dump_debug = 0; // 0x8 | 0x4 | 0x2;
 
-#ifdef RTAI
-# define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) rt_printk("[ITTI_DUMP][D]"x, ##args); } \
-    while(0)
-#else
 # define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) fprintf(stdout, "[ITTI_DUMP][D]"x, ##args); } \
     while(0)
-#endif
 #define ITTI_DUMP_ERROR(x, args...) do { fprintf(stdout, "[ITTI_DUMP][E]"x, ##args); } \
     while(0)
 
@@ -99,13 +90,8 @@ typedef struct itti_desc_s {
 
   int nb_connected;
 
-#ifndef RTAI
   /* Event fd used to notify new messages (semaphore) */
   int event_fd;
-#else
-  unsigned long messages_in_queue __attribute__((aligned(8)));
-#endif
-
   int itti_listen_socket;
 
   itti_client_desc_t itti_clients[ITTI_DUMP_MAX_CON];
@@ -194,9 +180,7 @@ static int itti_dump_fwrite_message(itti_dump_queue_item_t *message)
     fwrite (&new_message_header, sizeof(itti_dump_message_t), 1, dump_file);
     fwrite (message->data, message->data_size, 1, dump_file);
     fwrite (&itti_dump_message_type_end, sizeof(itti_message_types_t), 1, dump_file);
-    // #if !defined(RTAI)
     fflush (dump_file);
-    // #endif
     return (1);
   }
 
@@ -280,10 +264,6 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
   int overwrite_flag;
   AssertFatal (new != NULL, "Message to queue is NULL!\n");
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE, VCD_FUNCTION_IN);
-#endif
-
   new->message_type = message_type;
   new->message_size = message_size;
 
@@ -303,9 +283,6 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
   lfds611_ringbuffer_put_write_element(itti_dump_queue.itti_message_queue, new_queue_element);
 
   if (overwrite_flag == 0) {
-#ifdef RTAI
-    __sync_fetch_and_add (&itti_dump_queue.messages_in_queue, 1);
-#else
     {
       ssize_t   write_ret;
       eventfd_t sem_counter = 1;
@@ -314,25 +291,18 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
       write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
       AssertFatal (write_ret == sizeof(sem_counter), "Write to dump event failed (%d/%d)!\n", (int) write_ret, (int) sizeof(sem_counter));
     }
-#endif
     // add one to pending_messages, atomically
     __sync_fetch_and_add (&pending_messages, 1);
   }
 
   ITTI_DUMP_DEBUG (0x2, " Added element to queue %p %p, pending %u, type %u\n", new_queue_element, new, pending_messages, message_type);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE, VCD_FUNCTION_OUT);
-#endif
-
   return 0;
 }
 
 static void itti_dump_socket_exit(void)
 {
-#ifndef RTAI
   close(itti_dump_queue.event_fd);
-#endif
   close(itti_dump_queue.itti_listen_socket);
 
   /* Leave the thread as we detected end signal */
@@ -346,10 +316,6 @@ static int itti_dump_flush_ring_buffer(int flush_all)
   int     j;
   int     consumer;
 
-#ifdef RTAI
-  unsigned long number_of_messages;
-#endif
-
   /* Check if there is a least one consumer */
   consumer = 0;
 
@@ -365,18 +331,6 @@ static int itti_dump_flush_ring_buffer(int flush_all)
   }
 
   if (consumer > 0) {
-#ifdef RTAI
-    number_of_messages = itti_dump_queue.messages_in_queue;
-
-    ITTI_DUMP_DEBUG(0x4, "%lu elements in queue\n", number_of_messages);
-
-    if (number_of_messages == 0) {
-      return (consumer);
-    }
-
-    __sync_sub_and_fetch(&itti_dump_queue.messages_in_queue, number_of_messages);
-#endif
-
     do {
       /* Acquire the ring element */
       lfds611_ringbuffer_get_read_element(itti_dump_queue.itti_message_queue, &element);
@@ -419,9 +373,6 @@ static int itti_dump_flush_ring_buffer(int flush_all)
         lfds611_ringbuffer_put_read_element(itti_dump_queue.itti_message_queue, element);
       }
     } while(flush_all
-#ifdef RTAI
-            && --number_of_messages
-#endif
            );
   }
 
@@ -478,9 +429,6 @@ static void *itti_dump_socket(void *arg_p)
   struct sockaddr_in servaddr; /* socket address structure */
 
   struct timeval *timeout_p = NULL;
-#ifdef RTAI
-  struct timeval  timeout;
-#endif
 
   ITTI_DUMP_DEBUG(0x2, " Creating TCP dump socket on port %u\n", ITTI_PORT);
 
@@ -536,15 +484,11 @@ static void *itti_dump_socket(void *arg_p)
   /* Add the listener */
   FD_SET(itti_listen_socket, &read_set);
 
-#ifndef RTAI
   /* Add the event fd */
   FD_SET(itti_dump_queue.event_fd, &read_set);
 
   /* Max of both sd */
   max_sd = itti_listen_socket > itti_dump_queue.event_fd ? itti_listen_socket : itti_dump_queue.event_fd;
-#else
-  max_sd = itti_listen_socket;
-#endif
 
   itti_dump_queue.itti_listen_socket = itti_listen_socket;
 
@@ -557,14 +501,7 @@ static void *itti_dump_socket(void *arg_p)
     int i;
 
     memcpy(&working_set, &read_set, sizeof(read_set));
-#ifdef RTAI
-    timeout.tv_sec  = 0;
-    timeout.tv_usec = 100000;
-
-    timeout_p = &timeout;
-#else
     timeout_p = NULL;
-#endif
 
     /* No timeout: select blocks till a new event has to be handled
      * on sd's.
@@ -592,8 +529,6 @@ static void *itti_dump_socket(void *arg_p)
       if (FD_ISSET(i, &working_set)) {
         desc_ready -= 1;
 
-#ifndef RTAI
-
         if (i == itti_dump_queue.event_fd) {
           /* Notification of new element to dump from other tasks */
           eventfd_t sem_counter;
@@ -613,7 +548,6 @@ static void *itti_dump_socket(void *arg_p)
             if (itti_dump_running) {
               ITTI_DUMP_DEBUG (0x4, " No messages consumers, waiting ...\n");
               usleep(100 * 1000);
-#ifndef RTAI
               {
                 ssize_t   write_ret;
 
@@ -622,7 +556,6 @@ static void *itti_dump_socket(void *arg_p)
                 write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
                 AssertFatal (write_ret == sizeof(sem_counter), "Failed to write to dump event FD (%d/%d)!\n", (int) write_ret, (int) sem_counter);
               }
-#endif
             } else {
               itti_dump_socket_exit();
             }
@@ -630,7 +563,6 @@ static void *itti_dump_socket(void *arg_p)
             ITTI_DUMP_DEBUG(0x1, " Write element to file\n");
           }
         } else
-#endif
           if (i == itti_listen_socket) {
             do {
               client_socket = accept(itti_listen_socket, NULL, NULL);
@@ -719,21 +651,9 @@ int itti_dump_queue_message(task_id_t sender_task,
     AssertFatal (message_name != NULL, "Message name is NULL!\n");
     AssertFatal (message_p != NULL, "Message is NULL!\n");
 
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_IN);
-#endif
     new = itti_malloc(sender_task, TASK_MAX, sizeof(itti_dump_queue_item_t));
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_OUT);
-#endif
 
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_IN);
-#endif
     new->data = itti_malloc(sender_task, TASK_MAX, message_size);
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_OUT);
-#endif
 
     memcpy(new->data, message_p, message_size);
     new->data_size       = message_size;
@@ -791,9 +711,6 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons
     AssertFatal (0, " Failed to create ring buffer!\n");
   }
 
-#ifdef RTAI
-  itti_dump_queue.messages_in_queue = 0;
-#else
   itti_dump_queue.event_fd = eventfd(0, EFD_SEMAPHORE);
 
   if (itti_dump_queue.event_fd == -1) {
@@ -801,8 +718,6 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons
     AssertFatal (0, "eventfd failed: %s!\n", strerror(errno));
   }
 
-#endif
-
   itti_dump_queue.nb_connected = 0;
 
   for(i = 0; i < ITTI_DUMP_MAX_CON; i++) {
diff --git a/common/utils/itti/intertask_interface_dump.h b/common/utils/itti/intertask_interface_dump.h
index 14b3b4dbb6bcccfb683efba1e73ed64d2167b4b6..a34dcecbf67d806346e4cb7dd4ff508e81ac2de3 100644
--- a/common/utils/itti/intertask_interface_dump.h
+++ b/common/utils/itti/intertask_interface_dump.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/intertask_interface_init.h b/common/utils/itti/intertask_interface_init.h
index df87202955b6e6766dc14f8c29affe77e33d3cc2..333b0653d72169d24218c2bc5675d533283c5b15 100644
--- a/common/utils/itti/intertask_interface_init.h
+++ b/common/utils/itti/intertask_interface_init.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/intertask_interface_types.h b/common/utils/itti/intertask_interface_types.h
index d7386b0b73b5d8ef0d19ed4a495a0496f1f89b34..af1b4e9aa98931b52de2cea454f720e13748171a 100644
--- a/common/utils/itti/intertask_interface_types.h
+++ b/common/utils/itti/intertask_interface_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/intertask_messages_def.h b/common/utils/itti/intertask_messages_def.h
index d75f927a92476e4e4e723e1a63c1c8f865def4cf..57c344c8132b5b4f216ab4c5e05f25c48c8ea73e 100644
--- a/common/utils/itti/intertask_messages_def.h
+++ b/common/utils/itti/intertask_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/intertask_messages_types.h b/common/utils/itti/intertask_messages_types.h
index 2aa8545ee0ceb23e687e149a548e5638e235f2d3..145f57648ffcd62288d501ac49182652465ea72d 100644
--- a/common/utils/itti/intertask_messages_types.h
+++ b/common/utils/itti/intertask_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/itti_types.h b/common/utils/itti/itti_types.h
index e5bbf448308cbaba0976c63bb819c81f38882274..2607c003b130f1d261923c6ebae21cec657d42b0 100644
--- a/common/utils/itti/itti_types.h
+++ b/common/utils/itti/itti_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -27,10 +27,17 @@
 #ifndef _ITTI_TYPES_H_
 #define _ITTI_TYPES_H_
 
-#ifdef USER_MODE
-#include <stdint.h>
+/* The current file is included in the ue_ip.ko compilation.
+ * For it to work we need to include linux/types.h and
+ * not stdint.h.
+ * A solution to this problem is to use #ifndef __KERNEL__.
+ * Maybe a better solution would be to clean things up
+ * so that ue_ip.ko does not include the current file.
+ */
+#ifndef __KERNEL__
+#  include <stdint.h>
 #else
-#include <linux/types.h>
+#  include <linux/types.h>
 #endif
 
 #define CHARS_TO_UINT32(c1, c2, c3, c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1))
diff --git a/common/utils/itti/memory_pools.c b/common/utils/itti/memory_pools.c
index 955e29440ac24f96dcf37dc24c3b981a985762ca..78b6923dc863f982683d57a126c539651ef3817d 100644
--- a/common/utils/itti/memory_pools.c
+++ b/common/utils/itti/memory_pools.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,15 +19,8 @@
  *      contact@openairinterface.org
  */
 
-#ifdef RTAI
-# include <rtai_shm.h>
-#endif
-
 #include "assertions.h"
 #include "memory_pools.h"
-#if defined(OAI_EMU) || defined(RTAI)
-# include "vcd_signal_dumper.h"
-#endif
 
 #if T_TRACER
 #include <string.h>
@@ -37,18 +30,8 @@
 /*------------------------------------------------------------------------------*/
 const static int mp_debug = 0;
 
-#ifdef RTAI
-# define MP_DEBUG(x, args...) do { if (mp_debug) rt_printk("[MP][D]"x, ##args); } \
-    while(0)
-#else
 # define MP_DEBUG(x, args...) do { if (mp_debug) fprintf(stdout, "[MP][D]"x, ##args); fflush (stdout); } \
     while(0)
-#endif
-
-#if defined(OAI_EMU) || defined(RTAI)
-uint64_t vcd_mp_alloc;
-uint64_t vcd_mp_free;
-#endif
 
 /*------------------------------------------------------------------------------*/
 #ifndef CHARS_TO_UINT32
@@ -414,11 +397,6 @@ memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_po
   pool_id_t                   pool;
   items_group_index_t         item_index = ITEMS_GROUP_INDEX_INVALID;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_MP_ALLOC,
-                                          __sync_or_and_fetch (&vcd_mp_alloc, 1L << info_0));
-#endif
-
   /* Recover memory_pools */
   memory_pools = memory_pools_from_handler (memory_pools_handle);
   AssertError (memory_pools != NULL, {}, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
@@ -464,11 +442,6 @@ memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_po
     MP_DEBUG(" Alloc [--][------]{------}, %3u %3u, %6u, failed!\n", info_0, info_1, item_size);
   }
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_MP_ALLOC,
-                                          __sync_and_and_fetch (&vcd_mp_alloc, ~(1L << info_0)));
-#endif
-
   return memory_pool_item_handle;
 }
 
@@ -493,11 +466,6 @@ int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_it
 
   info_1 = memory_pool_item->start.info[1];
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_MP_FREE,
-                                          __sync_or_and_fetch (&vcd_mp_free, 1L << info_1));
-#endif
-
   /* Recover pool index */
   pool = memory_pool_item->start.pool_id;
   AssertFatal (pool < memory_pools->pools_defined, "Pool index is invalid (%u/%u)!\n", pool, memory_pools->pools_defined);
@@ -531,11 +499,6 @@ int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_it
 
   AssertError (result == EXIT_SUCCESS, {}, "Failed to free memory pool item (pool %u, item %d)!\n", pool, item_index);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_MP_FREE,
-                                          __sync_and_and_fetch (&vcd_mp_free, ~(1L << info_1)));
-#endif
-
   return (result);
 }
 
diff --git a/common/utils/itti/memory_pools.h b/common/utils/itti/memory_pools.h
index 6c6e5a5d80cc28b974b8734fc91c457929849022..1c1997f7f22590308d0b6d53dbe7c1005b5c2fb4 100644
--- a/common/utils/itti/memory_pools.h
+++ b/common/utils/itti/memory_pools.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/messages_def.h b/common/utils/itti/messages_def.h
index 0366cf8f509643ac96d5796b9208163b0c9af506..f312669848120a2ea022a4ac50ad172471e51ce4 100644
--- a/common/utils/itti/messages_def.h
+++ b/common/utils/itti/messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/messages_types.h b/common/utils/itti/messages_types.h
index 0fbdf29ecc1ffa5b3bf407a5f08a2a1924906b4d..d390bf0159c18ab58767e44f467fe2b4019c667b 100644
--- a/common/utils/itti/messages_types.h
+++ b/common/utils/itti/messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/signals.c b/common/utils/itti/signals.c
index e495e301f86c571608df6fc457510104a9a60809..9767ba3f67b01a29166c07ce86bae598317905e0 100644
--- a/common/utils/itti/signals.c
+++ b/common/utils/itti/signals.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/signals.h b/common/utils/itti/signals.h
index efb25f34d8b7c25cddf1681ab954e4b3b387eea9..5277e216a3d4a19230991d2f8eafdb86abfd2d16 100644
--- a/common/utils/itti/signals.h
+++ b/common/utils/itti/signals.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/tasks_def.h b/common/utils/itti/tasks_def.h
index 18ac6ac5c9046f1a4928ab66b51e731739bec74f..d54d09a26aee84822bb4714ab0857869682f1da5 100644
--- a/common/utils/itti/tasks_def.h
+++ b/common/utils/itti/tasks_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c
index c180cfcda40d8fea03c785061530ab0d7eabc983..6327aeacfb675140bda39f76feed86ddc2541c18 100644
--- a/common/utils/itti/timer.c
+++ b/common/utils/itti/timer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/timer.h b/common/utils/itti/timer.h
index 22d1d75d4672fe80f6bb4ceb6267870ec9108c85..4f568a348c5755802f7fadb018d8b2790935b608 100644
--- a/common/utils/itti/timer.h
+++ b/common/utils/itti/timer.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/timer_messages_def.h b/common/utils/itti/timer_messages_def.h
index 4cef672c13bb1244bdf257b6187d53888ca4beb1..761034730d236136692f3d879aa44f252acc205c 100644
--- a/common/utils/itti/timer_messages_def.h
+++ b/common/utils/itti/timer_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti/timer_messages_types.h b/common/utils/itti/timer_messages_types.h
index 4abf34605d0da23e09c2f4a4280338bce2301f59..0d06e3eebfd15c33e9fe9555b0ba7fb5c6253fb0 100644
--- a/common/utils/itti/timer_messages_types.h
+++ b/common/utils/itti/timer_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/common/itti_types.h b/common/utils/itti_analyzer/common/itti_types.h
index a4234583497d438ba1d32e49f0525feb2c223308..d405e48cbdc3bf90bc4d5a4d8e1dfb7b9e1f8ad4 100644
--- a/common/utils/itti_analyzer/common/itti_types.h
+++ b/common/utils/itti_analyzer/common/itti_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/common/logs.h b/common/utils/itti_analyzer/common/logs.h
index 8d5c4876ff245d983026a147f630841381295d24..bd901cc3949b36e9bf20e4c20228b92636550522 100644
--- a/common/utils/itti_analyzer/common/logs.h
+++ b/common/utils/itti_analyzer/common/logs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/common/rc.h b/common/utils/itti_analyzer/common/rc.h
index 9643d712ebc388c75f8c27702ea7ce74a0d16ce4..50786f460fdbb93533801ce423cf574bcbfd4e38 100644
--- a/common/utils/itti_analyzer/common/rc.h
+++ b/common/utils/itti_analyzer/common/rc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/itti_analyzer.c b/common/utils/itti_analyzer/itti_analyzer.c
index e19b3757986eb8218c8a69a097beced890018472..d87deb46e2f5a1dcad5c58e0133cdf57927e59a1 100644
--- a/common/utils/itti_analyzer/itti_analyzer.c
+++ b/common/utils/itti_analyzer/itti_analyzer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libbuffers/buffers.c b/common/utils/itti_analyzer/libbuffers/buffers.c
index a2d526d584bfc1ea6abf886d335b702d9285a84e..870c9cd40aac19e3aa0b7f5f9ddf3dd22bb98d61 100644
--- a/common/utils/itti_analyzer/libbuffers/buffers.c
+++ b/common/utils/itti_analyzer/libbuffers/buffers.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libbuffers/buffers.h b/common/utils/itti_analyzer/libbuffers/buffers.h
index 7dd59b8067c53084d251f4dec1722d72ec5776e5..34ecb355ab351529ec59702c2d011a7dfe3d5e54 100644
--- a/common/utils/itti_analyzer/libbuffers/buffers.h
+++ b/common/utils/itti_analyzer/libbuffers/buffers.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libbuffers/file.c b/common/utils/itti_analyzer/libbuffers/file.c
index ea429a66d14070401c05b94e5d90d5d8f06968cd..291bf2d2163f432894a60b8b5ddcb7e610ef5704 100644
--- a/common/utils/itti_analyzer/libbuffers/file.c
+++ b/common/utils/itti_analyzer/libbuffers/file.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libbuffers/file.h b/common/utils/itti_analyzer/libbuffers/file.h
index 36912a69ba7e4a00bc5e0186e90506560a1d2c4d..be0fa6ba2d07e6616be2c32321c32cbef1411b1f 100644
--- a/common/utils/itti_analyzer/libbuffers/file.h
+++ b/common/utils/itti_analyzer/libbuffers/file.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libbuffers/socket.c b/common/utils/itti_analyzer/libbuffers/socket.c
index 0e1ad49e49982910dd30a700298f6024366ea06d..f732af70ec532ca65a5aa3d68da258e652c3edf8 100644
--- a/common/utils/itti_analyzer/libbuffers/socket.c
+++ b/common/utils/itti_analyzer/libbuffers/socket.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libbuffers/socket.h b/common/utils/itti_analyzer/libbuffers/socket.h
index d64fd46b91ff20ba6bdce003576fcc8eae978c44..8c2be2243e228d9c7ea56003cf59a9e382e601cb 100644
--- a/common/utils/itti_analyzer/libbuffers/socket.h
+++ b/common/utils/itti_analyzer/libbuffers/socket.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/array_type.c b/common/utils/itti_analyzer/libparser/array_type.c
index 028835e9d29612b5129628c4c326d30d37ab92c9..1d9f7412815605ade54315e98269908324500ce9 100644
--- a/common/utils/itti_analyzer/libparser/array_type.c
+++ b/common/utils/itti_analyzer/libparser/array_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/array_type.h b/common/utils/itti_analyzer/libparser/array_type.h
index 9e13dec282d3ee02f03232b2ef5cfe21b5eb9b22..b336934dbb94978b78be2440f57c1e446d0ab5d8 100644
--- a/common/utils/itti_analyzer/libparser/array_type.h
+++ b/common/utils/itti_analyzer/libparser/array_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/enum_type.c b/common/utils/itti_analyzer/libparser/enum_type.c
index a00f6545564de48bcacf3e17b3bbdc728e9d32b7..dbc99095bcd9a84ba3206fa05957ad4e0ec3d28d 100644
--- a/common/utils/itti_analyzer/libparser/enum_type.c
+++ b/common/utils/itti_analyzer/libparser/enum_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/enum_type.h b/common/utils/itti_analyzer/libparser/enum_type.h
index 9faa21b79a8ccf6c111b2cc56d9aa7c40842a819..4538829e78366bad075231ae19617555e6563e8c 100644
--- a/common/utils/itti_analyzer/libparser/enum_type.h
+++ b/common/utils/itti_analyzer/libparser/enum_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/enum_value_type.c b/common/utils/itti_analyzer/libparser/enum_value_type.c
index 8035acb257f9d11c48f8601bab3f8f73b7f01a2d..801317daafcba2d6d990e6007f188bef4361ed84 100644
--- a/common/utils/itti_analyzer/libparser/enum_value_type.c
+++ b/common/utils/itti_analyzer/libparser/enum_value_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/enum_value_type.h b/common/utils/itti_analyzer/libparser/enum_value_type.h
index d30e3a67069a28f802b6a018cfafb56bf4610569..997e6cc3fe91f9b124d53d32dae17c0cd2f650a8 100644
--- a/common/utils/itti_analyzer/libparser/enum_value_type.h
+++ b/common/utils/itti_analyzer/libparser/enum_value_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/field_type.c b/common/utils/itti_analyzer/libparser/field_type.c
index 9415ad0effe9909f99e63c97d2ab49fbfba8cc02..b64d3bd0c17397422a8b6616ab7ecfc8e41fb41c 100644
--- a/common/utils/itti_analyzer/libparser/field_type.c
+++ b/common/utils/itti_analyzer/libparser/field_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/field_type.h b/common/utils/itti_analyzer/libparser/field_type.h
index f9bdd78cb768ed3facf107b298348bdda98e8360..329e90c3be7a92f0df5fe2a5e77eb1013db7fbca 100644
--- a/common/utils/itti_analyzer/libparser/field_type.h
+++ b/common/utils/itti_analyzer/libparser/field_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/file_type.c b/common/utils/itti_analyzer/libparser/file_type.c
index 3e9bf697a6161b82c2dc67ef5c9aa8da32ce4cd9..04d66b7a0869fcd894bd7110f30e1fc2361cb948 100644
--- a/common/utils/itti_analyzer/libparser/file_type.c
+++ b/common/utils/itti_analyzer/libparser/file_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/file_type.h b/common/utils/itti_analyzer/libparser/file_type.h
index 7142f30d518f0dec247c72f304c7ea3f4dbd167f..34ebea6745e226d167946cd57427bd32922f21e5 100644
--- a/common/utils/itti_analyzer/libparser/file_type.h
+++ b/common/utils/itti_analyzer/libparser/file_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/fundamental_type.c b/common/utils/itti_analyzer/libparser/fundamental_type.c
index 9383431c84ff9bfb3ecaa3a037e3047b9d0178ac..92dd1c75cb9b1ffef3a3777c890dbf794a2c89d1 100644
--- a/common/utils/itti_analyzer/libparser/fundamental_type.c
+++ b/common/utils/itti_analyzer/libparser/fundamental_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/fundamental_type.h b/common/utils/itti_analyzer/libparser/fundamental_type.h
index 94e939e117870dd2fc62cfbfd133cba17a6839c1..07ceb3b9ed3cdfad9191c307fd0221a12bb9cd1a 100644
--- a/common/utils/itti_analyzer/libparser/fundamental_type.h
+++ b/common/utils/itti_analyzer/libparser/fundamental_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/intertask_contexts.h b/common/utils/itti_analyzer/libparser/intertask_contexts.h
index a490064612730a6d0876fee5b6c5fbe150c6b8b0..cfe8f59402b8015ac4d12b980fcdbff92010b29d 100644
--- a/common/utils/itti_analyzer/libparser/intertask_contexts.h
+++ b/common/utils/itti_analyzer/libparser/intertask_contexts.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/pointer_type.c b/common/utils/itti_analyzer/libparser/pointer_type.c
index 8b263f64a9e38ac90143340813c83ccb2e92a75b..e4571f9f48048f87f41838f39e64facbd369358a 100644
--- a/common/utils/itti_analyzer/libparser/pointer_type.c
+++ b/common/utils/itti_analyzer/libparser/pointer_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/pointer_type.h b/common/utils/itti_analyzer/libparser/pointer_type.h
index 6f4f644e735f2c46680ec7163ba48565e1195d4c..be2b6cc33cc48d4552f7d8bf0328cd4ed295b333 100644
--- a/common/utils/itti_analyzer/libparser/pointer_type.h
+++ b/common/utils/itti_analyzer/libparser/pointer_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/reference_type.c b/common/utils/itti_analyzer/libparser/reference_type.c
index 7cd3b0a5095a6307230b455e3cc4800df2a6847b..8d0fec4e614381ff13159cfa11e7cc557228b111 100644
--- a/common/utils/itti_analyzer/libparser/reference_type.c
+++ b/common/utils/itti_analyzer/libparser/reference_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/reference_type.h b/common/utils/itti_analyzer/libparser/reference_type.h
index 5f9d0a0b889c5eccea69eaa780e8d9338a73c1b0..da56e9f942d5ed48ea5121644c96190fa9996f8c 100644
--- a/common/utils/itti_analyzer/libparser/reference_type.h
+++ b/common/utils/itti_analyzer/libparser/reference_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/struct_type.c b/common/utils/itti_analyzer/libparser/struct_type.c
index 758851269d3012384944de54d3f538fba93848d0..09d5280ea55c16df171ed183b842b7ac7b461904 100644
--- a/common/utils/itti_analyzer/libparser/struct_type.c
+++ b/common/utils/itti_analyzer/libparser/struct_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/struct_type.h b/common/utils/itti_analyzer/libparser/struct_type.h
index 1efa4ef3245f64e82a6ef12e6728a0025c9fd4b6..29d4113b6f07b3782a48bea7f6ba587e19ddf012 100644
--- a/common/utils/itti_analyzer/libparser/struct_type.h
+++ b/common/utils/itti_analyzer/libparser/struct_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/typedef_type.c b/common/utils/itti_analyzer/libparser/typedef_type.c
index 6c7246b47c89bdf1dc843bce7c099b94d9d92916..e5cee1a1cfdac32fd094b23c38f5830c2de86177 100644
--- a/common/utils/itti_analyzer/libparser/typedef_type.c
+++ b/common/utils/itti_analyzer/libparser/typedef_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/typedef_type.h b/common/utils/itti_analyzer/libparser/typedef_type.h
index cad3436a636f4d0ffd044dea704beb71e16b988f..b5710dbfcba3c28f48e77b79a87c2bfe14dd6fd2 100644
--- a/common/utils/itti_analyzer/libparser/typedef_type.h
+++ b/common/utils/itti_analyzer/libparser/typedef_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/types.c b/common/utils/itti_analyzer/libparser/types.c
index 6f36089a7b19830e6d7afecbb9fc635b0329a143..406db5249cd536c757089771867ab67530e04d43 100644
--- a/common/utils/itti_analyzer/libparser/types.c
+++ b/common/utils/itti_analyzer/libparser/types.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/types.h b/common/utils/itti_analyzer/libparser/types.h
index 0f7812b84b84d1fd291c18ff7d568cca418e9e14..c449c445fd505d86bf60b7a7a75a7aed9fe9a7b1 100644
--- a/common/utils/itti_analyzer/libparser/types.h
+++ b/common/utils/itti_analyzer/libparser/types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/union_type.c b/common/utils/itti_analyzer/libparser/union_type.c
index f2518685c61a2cfe46ca09c0968735e84c953dc2..f38b7a1ccca60ac4af40fd21feaa49cddd954c28 100644
--- a/common/utils/itti_analyzer/libparser/union_type.c
+++ b/common/utils/itti_analyzer/libparser/union_type.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/union_type.h b/common/utils/itti_analyzer/libparser/union_type.h
index e4552bf7701dcd16f8a3c3439f2b4edce69f8d77..ed2dca73ba9bbae5e95e5e5e5010a2b4be809190 100644
--- a/common/utils/itti_analyzer/libparser/union_type.h
+++ b/common/utils/itti_analyzer/libparser/union_type.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/xml_parse.c b/common/utils/itti_analyzer/libparser/xml_parse.c
index 651fcde2f7157bca40b5a71ed0c54fb47b867689..352b10d6161fdb91606b3963d75119d2bbdc6d0d 100644
--- a/common/utils/itti_analyzer/libparser/xml_parse.c
+++ b/common/utils/itti_analyzer/libparser/xml_parse.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libparser/xml_parse.h b/common/utils/itti_analyzer/libparser/xml_parse.h
index 968fb96b68d50a3ceef98a69c33436b5a6cde1e5..f9624bc06b69cb2d91f43d01751d53c76cbafd96 100644
--- a/common/utils/itti_analyzer/libparser/xml_parse.h
+++ b/common/utils/itti_analyzer/libparser/xml_parse.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libresolver/locate_root.c b/common/utils/itti_analyzer/libresolver/locate_root.c
index f78674108c25805414e0a465cdabe2188762d93a..dffd489944ca817e571b88489725b422e9fa9967 100644
--- a/common/utils/itti_analyzer/libresolver/locate_root.c
+++ b/common/utils/itti_analyzer/libresolver/locate_root.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libresolver/locate_root.h b/common/utils/itti_analyzer/libresolver/locate_root.h
index 0e952d8f599fd3a28a28dee86bcc2004a3caaf40..5cb2eb258872bd66bef980ca0218480dd7c849cb 100644
--- a/common/utils/itti_analyzer/libresolver/locate_root.h
+++ b/common/utils/itti_analyzer/libresolver/locate_root.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libresolver/resolvers.c b/common/utils/itti_analyzer/libresolver/resolvers.c
index 856a2123964eeb6cc995e476153e928d96ba0ba4..8702c08942704599c809ac1d34742aea855eaa4f 100644
--- a/common/utils/itti_analyzer/libresolver/resolvers.c
+++ b/common/utils/itti_analyzer/libresolver/resolvers.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libresolver/resolvers.h b/common/utils/itti_analyzer/libresolver/resolvers.h
index 4d8a5c08d1556ba41af5de7f1d2ebc4d331da38a..17e16462b4ae32aa24641ea549b65d17dd7a5a58 100644
--- a/common/utils/itti_analyzer/libresolver/resolvers.h
+++ b/common/utils/itti_analyzer/libresolver/resolvers.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.c b/common/utils/itti_analyzer/libui/ui_callbacks.c
index 3dd4218abc95cabb1cf546691a76f2a27b2d6223..6fc480e33387508531dc522470ca57c68fbb8309 100644
--- a/common/utils/itti_analyzer/libui/ui_callbacks.c
+++ b/common/utils/itti_analyzer/libui/ui_callbacks.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.h b/common/utils/itti_analyzer/libui/ui_callbacks.h
index e09abdbc7e6756ff9ffa5e78156daa6090d403b0..b3d4b31c601ec4dce136b26dbeec7628d6cf58fc 100644
--- a/common/utils/itti_analyzer/libui/ui_callbacks.h
+++ b/common/utils/itti_analyzer/libui/ui_callbacks.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_filters.c b/common/utils/itti_analyzer/libui/ui_filters.c
index 38ab6ac909d47de97c39240cbb5f1c9e4c378fae..8a6321a538d12a5c4d34d0d1ab667428500da56f 100644
--- a/common/utils/itti_analyzer/libui/ui_filters.c
+++ b/common/utils/itti_analyzer/libui/ui_filters.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_filters.h b/common/utils/itti_analyzer/libui/ui_filters.h
index 575a46b80822f72c2fb00e8108d7b6285b5eaba1..16bb38834b10fc29f1d9aa10479242e918bac43d 100644
--- a/common/utils/itti_analyzer/libui/ui_filters.h
+++ b/common/utils/itti_analyzer/libui/ui_filters.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_interface.c b/common/utils/itti_analyzer/libui/ui_interface.c
index 4b8582ef97a4f5e3dab45d8df84ba23dd9c1719f..56139a8c6ba4bda1f6cbc2d56d1b891aad837fa9 100644
--- a/common/utils/itti_analyzer/libui/ui_interface.c
+++ b/common/utils/itti_analyzer/libui/ui_interface.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_interface.h b/common/utils/itti_analyzer/libui/ui_interface.h
index 7f219b68f7a13d2ebae26f4e78b58d4746bcb511..f77ec144d1b5f573ff0c2b4b50457c35de5b0320 100644
--- a/common/utils/itti_analyzer/libui/ui_interface.h
+++ b/common/utils/itti_analyzer/libui/ui_interface.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_main_screen.c b/common/utils/itti_analyzer/libui/ui_main_screen.c
index 7ae2485cb79bb2ec57579963368ebae4dee35fbf..3d6ea266be1ce485a356adc85207a77ebb0e22cd 100644
--- a/common/utils/itti_analyzer/libui/ui_main_screen.c
+++ b/common/utils/itti_analyzer/libui/ui_main_screen.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_main_screen.h b/common/utils/itti_analyzer/libui/ui_main_screen.h
index 98a38ebbde38b1ad5338882821c3a17760ccf2f0..0411d687bead751fc58baa998f66ec33357f06e2 100644
--- a/common/utils/itti_analyzer/libui/ui_main_screen.h
+++ b/common/utils/itti_analyzer/libui/ui_main_screen.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_menu_bar.c b/common/utils/itti_analyzer/libui/ui_menu_bar.c
index da6b133a296eaf9c69fe6669bab76c3dd0ea918e..62b51b3b9f5ccfeee55ce9b3c06f001f7b5d8e21 100644
--- a/common/utils/itti_analyzer/libui/ui_menu_bar.c
+++ b/common/utils/itti_analyzer/libui/ui_menu_bar.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_menu_bar.h b/common/utils/itti_analyzer/libui/ui_menu_bar.h
index b66d4bf95a20a8e85bbc732fb0b5ceba2b3442ae..037dc5edca4445b380158f8322534a7c4d0347de 100644
--- a/common/utils/itti_analyzer/libui/ui_menu_bar.h
+++ b/common/utils/itti_analyzer/libui/ui_menu_bar.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_notebook.c b/common/utils/itti_analyzer/libui/ui_notebook.c
index f04cbb77aba830b14b28e077b33d3e3603d57bc9..93a439335f22cd08a5b5562ad56c4d48d7991bc4 100644
--- a/common/utils/itti_analyzer/libui/ui_notebook.c
+++ b/common/utils/itti_analyzer/libui/ui_notebook.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_notebook.h b/common/utils/itti_analyzer/libui/ui_notebook.h
index 2b17be16a733b4c970ef353344d11f983c19270b..6f87856e8470381c75e2bda0a7b17730217319de 100644
--- a/common/utils/itti_analyzer/libui/ui_notebook.h
+++ b/common/utils/itti_analyzer/libui/ui_notebook.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_notif_dlg.c b/common/utils/itti_analyzer/libui/ui_notif_dlg.c
index cf1f1b5eecf20325bc3b1953b1a093583a614e14..4be4aa52cf847d41b000aa15d0d6c329f643572e 100644
--- a/common/utils/itti_analyzer/libui/ui_notif_dlg.c
+++ b/common/utils/itti_analyzer/libui/ui_notif_dlg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_notif_dlg.h b/common/utils/itti_analyzer/libui/ui_notif_dlg.h
index 51856e0487e5782e3ceb9da320e36b147b785c40..361ec818506edf7b32cd45c023b8055cce07b643 100644
--- a/common/utils/itti_analyzer/libui/ui_notif_dlg.h
+++ b/common/utils/itti_analyzer/libui/ui_notif_dlg.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_notifications.c b/common/utils/itti_analyzer/libui/ui_notifications.c
index 99d6b8bc1cbcd37f58fcfad29058f8b04b9ca05a..6e7897c85081f766b454fbd0c7f82ef3604163ba 100644
--- a/common/utils/itti_analyzer/libui/ui_notifications.c
+++ b/common/utils/itti_analyzer/libui/ui_notifications.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_notifications.h b/common/utils/itti_analyzer/libui/ui_notifications.h
index 90f4c5909de570c4012533467ef57b4884920363..33ef0ff5c0918ec4d3f97b38260311f2efae4233 100644
--- a/common/utils/itti_analyzer/libui/ui_notifications.h
+++ b/common/utils/itti_analyzer/libui/ui_notifications.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c b/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c
index dcf2acd8b2157de1914c738df5ed9754108efeff..859eb66b03ced23cd54731362bd0150cee21945e 100644
--- a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c
+++ b/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.h b/common/utils/itti_analyzer/libui/ui_signal_dissect_view.h
index 936d3ee27d1aa970def4127dc2fa21eb935a4be9..a5ccf6a9eb46b879c3a93dfd52cbe72c0e6906c5 100644
--- a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.h
+++ b/common/utils/itti_analyzer/libui/ui_signal_dissect_view.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_tree_view.c b/common/utils/itti_analyzer/libui/ui_tree_view.c
index 0de6bde945c8a5f3396dead76895a2055833cb51..0396e248191af2cb6137fd6851e033e7b69a97c6 100644
--- a/common/utils/itti_analyzer/libui/ui_tree_view.c
+++ b/common/utils/itti_analyzer/libui/ui_tree_view.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/itti_analyzer/libui/ui_tree_view.h b/common/utils/itti_analyzer/libui/ui_tree_view.h
index d1eac10c6078d78b5a869e07a4897cebddae0c1f..88ab2fce71ba799613ba62ae6463569d77744e2d 100644
--- a/common/utils/itti_analyzer/libui/ui_tree_view.h
+++ b/common/utils/itti_analyzer/libui/ui_tree_view.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/load_module_shlib.c b/common/utils/load_module_shlib.c
index b21f39e69dff7b05ba44b23f1d097852681dcd2f..fecdc2a58c624139f24bb44189b220dbf1f0d1d5 100644
--- a/common/utils/load_module_shlib.c
+++ b/common/utils/load_module_shlib.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -34,6 +34,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#include <errno.h>
 #include <sys/ioctl.h>
 #include <dlfcn.h>
 #include "openair1/PHY/defs.h"
@@ -44,68 +45,162 @@
 void loader_init(void) {
   paramdef_t LoaderParams[] = LOADER_PARAMS_DESC;
 
-
+  loader_data.mainexec_buildversion =  PACKAGE_VERSION;
   int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),LOADER_CONFIG_PREFIX);
   if (ret <0) {
-       fprintf(stderr,"[LOADER] configuration couldn't be performed");
+       printf("[LOADER]  configuration couldn't be performed via config module, parameters set to default values\n");
        if (loader_data.shlibpath == NULL) {
          loader_data.shlibpath=DEFAULT_PATH;
         }
-       return;
-  }   
+       loader_data.maxshlibs = DEFAULT_MAXSHLIBS;
+  }
+  loader_data.shlibs = malloc(loader_data.maxshlibs * sizeof(loader_shlibdesc_t));
+  if(loader_data.shlibs == NULL) {
+     fprintf(stderr,"[LOADER]  %s %d memory allocation error %s\n",__FILE__, __LINE__,strerror(errno));
+     exit_fun("[LOADER] unrecoverable error");
+  }
+  memset(loader_data.shlibs,0,loader_data.maxshlibs * sizeof(loader_shlibdesc_t));
+}
+
+/* build the full shared lib name from the module name */
+char *loader_format_shlibpath(char *modname)
+{
+
+char *tmpstr;
+char *shlibpath   =NULL;
+char *shlibversion=NULL;
+char *cfgprefix;
+paramdef_t LoaderParams[] ={{"shlibpath", NULL, 0, strptr:&shlibpath, defstrval:NULL, TYPE_STRING, 0},
+                            {"shlibversion", NULL, 0, strptr:&shlibversion, defstrval:"", TYPE_STRING, 0}};
+
+int ret;
+
+
+
+
+/* looks for specific path for this module in the config file */
+/* specific value for a module path and version is located in a modname subsection of the loader section */
+/* shared lib name is formatted as lib<module name><module version>.so */
+  cfgprefix = malloc(sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16);
+  if (cfgprefix == NULL) {
+      fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
+      exit_fun("[LOADER] unrecoverable error");
+  } else {
+      sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
+      int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),cfgprefix);
+      if (ret <0) {
+          fprintf(stderr,"[LOADER]  %s %d couldn't retrieve config from section %s\n",__FILE__, __LINE__,cfgprefix);
+      }
+   }
+/* no specific path, use loader default shared lib path */
+   if (shlibpath == NULL) {
+       shlibpath =  loader_data.shlibpath ;
+   } 
+/* no specific shared lib version */
+   if (shlibversion == NULL) {
+       shlibversion = "" ;
+   } 
+/* alloc memory for full module shared lib file name */
+   tmpstr = malloc(strlen(shlibpath)+strlen(modname)+strlen(shlibversion)+16);
+   if (tmpstr == NULL) {
+      fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
+      exit_fun("[LOADER] unrecoverable error");
+   }
+   if(shlibpath[0] != 0) {
+       ret=sprintf(tmpstr,"%s/",shlibpath);
+   } else {
+       ret = 0;
+   }
+
+   sprintf(tmpstr+ret,"lib%s%s.so",modname,shlibversion);
+   
+  
+   return tmpstr; 
 }
 
 int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
 {
    void *lib_handle;
    initfunc_t fpi;
-   char *tmpstr;
+   checkverfunc_t fpc;
+   getfarrayfunc_t fpg;
+   char *shlib_path;
+   char *afname=NULL;
    int ret=0;
 
    if (loader_data.shlibpath  == NULL) {
       loader_init();
    }
-   tmpstr = malloc(strlen(loader_data.shlibpath)+strlen(modname)+16);
-   if (tmpstr == NULL) {
-      fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
-      return -1; 
-   }
 
-   if(loader_data.shlibpath[0] != 0) {
-       ret=sprintf(tmpstr,"%s/",loader_data.shlibpath);
-   }
-   if(strstr(modname,".so") == NULL) {
-      sprintf(tmpstr+ret,"lib%s.so",modname);
-   } else {
-      sprintf(tmpstr+ret,"%s",modname);   
-   } 
+   shlib_path = loader_format_shlibpath(modname);
+
    ret = 0;
-   lib_handle = dlopen(tmpstr, RTLD_LAZY|RTLD_NODELETE|RTLD_GLOBAL);
+   lib_handle = dlopen(shlib_path, RTLD_LAZY|RTLD_NODELETE|RTLD_GLOBAL);
    if (!lib_handle) {
-      fprintf(stderr,"[LOADER] library %s is not loaded: %s\n", tmpstr,dlerror());
+      fprintf(stderr,"[LOADER] library %s is not loaded: %s\n", shlib_path,dlerror());
       ret = -1;
    } else {
-      printf("[LOADER] library %s uccessfully loaded loaded\n", tmpstr);
-      sprintf(tmpstr,"%s_autoinit",modname);
-      fpi = dlsym(lib_handle,tmpstr);
+      printf("[LOADER] library %s successfully loaded\n", shlib_path);
+      afname=malloc(strlen(modname)+15);
+      sprintf(afname,"%s_checkbuildver",modname);
+      fpc = dlsym(lib_handle,afname);
+      if (fpc != NULL ){
+	 int chkver_ret = fpc(loader_data.mainexec_buildversion, &(loader_data.shlibs[loader_data.numshlibs].shlib_buildversion));
+         if (chkver_ret < 0) {
+              fprintf(stderr,"[LOADER]  %s %d lib %s, version mismatch",__FILE__, __LINE__, modname);
+              exit_fun("[LOADER] unrecoverable error");
+         }
+      }
+      sprintf(afname,"%s_autoinit",modname);
+      fpi = dlsym(lib_handle,afname);
 
-      if (fpi != NULL )
-         {
+      if (fpi != NULL ) {
 	 fpi();
-	 }
+      }
 
       if (farray != NULL) {
+          loader_data.shlibs[loader_data.numshlibs].funcarray=malloc(numf*sizeof(loader_shlibfunc_t));
+          loader_data.shlibs[loader_data.numshlibs].numfunc=0;
           for (int i=0; i<numf; i++) {
 	      farray[i].fptr = dlsym(lib_handle,farray[i].fname);
 	      if (farray[i].fptr == NULL ) {
 	          fprintf(stderr,"[LOADER] %s %d %s function not found %s\n",__FILE__, __LINE__, dlerror(),farray[i].fname);
-               ret= -1;
-	      }
+                  ret= -1;
+	      } else { /* farray[i].fptr == NULL */
+                  loader_data.shlibs[loader_data.numshlibs].funcarray[i].fname=strdup(farray[i].fname); 
+                  loader_data.shlibs[loader_data.numshlibs].funcarray[i].fptr = farray[i].fptr;
+                  loader_data.shlibs[loader_data.numshlibs].numfunc++;                 
+              }/* farray[i].fptr != NULL */
 	  } /* for int i... */
-      }	 /* farray ! NULL */
-    } 
+      }	else {  /* farray ! NULL */
+          sprintf(afname,"%s_getfarray",modname);
+          fpg = dlsym(lib_handle,afname);
+          if (fpg != NULL ) {
+	      loader_data.shlibs[loader_data.numshlibs].numfunc = fpg(&(loader_data.shlibs[loader_data.numshlibs].funcarray));
+          }            
+      } /* farray ! NULL */
+    loader_data.shlibs[loader_data.numshlibs].name=strdup(modname);
+    loader_data.shlibs[loader_data.numshlibs].thisshlib_path=strdup(shlib_path); 
+
+    (loader_data.numshlibs)++;
+    } /* lib_handle != NULL */ 
 	  	 
-   if (tmpstr != NULL) free(tmpstr);
+   if ( shlib_path!= NULL) free(shlib_path);
+   if ( afname!= NULL) free(afname);
    if (lib_handle != NULL) dlclose(lib_handle); 
    return ret;	       
 }
+
+void * get_shlibmodule_fptr(char *modname, char *fname)
+{
+    for (int i=0; i<loader_data.numshlibs && loader_data.shlibs[i].name != NULL; i++) {
+        if ( strcmp(loader_data.shlibs[i].name, modname) == 0) {
+            for (int j =0; j<loader_data.shlibs[i].numfunc ; j++) {
+                 if (strcmp(loader_data.shlibs[i].funcarray[j].fname, fname) == 0) {
+                     return loader_data.shlibs[i].funcarray[j].fptr;
+                 }
+            } /* for j loop on module functions*/
+        }
+    } /* for i loop on modules */
+    return NULL;
+}
diff --git a/common/utils/load_module_shlib.h b/common/utils/load_module_shlib.h
index 1f991dddd2ca96c7215b4227cedf0bbb9fc8d0e4..ffbad665708ef0ffe1f890d14e6f04039b5afb80 100644
--- a/common/utils/load_module_shlib.h
+++ b/common/utils/load_module_shlib.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,33 +33,60 @@
 #define LOAD_SHLIB_H
 
 
-typedef int(*initfunc_t)(void);
 
-typedef struct {
-   char *shlibpath;
-}loader_data_t;
 
 typedef struct {
    char *fname;
    int (*fptr)(void);
 }loader_shlibfunc_t;
+
+typedef struct {
+   char               *name;
+   char               *shlib_version;    // 
+   char               *shlib_buildversion;
+   char               *thisshlib_path;
+   uint32_t           numfunc;
+   loader_shlibfunc_t *funcarray;
+}loader_shlibdesc_t;
+
+typedef struct {
+   char               *mainexec_buildversion;
+   char               *shlibpath;
+   uint32_t           maxshlibs;
+   uint32_t           numshlibs;
+   loader_shlibdesc_t *shlibs;
+}loader_data_t;
+
+/* function type of functions which may be implemented by a module */
+/* 1: init function, called when loading, if found in the shared lib */
+typedef int(*initfunc_t)(void);
+/* 2: version checking function, called when loading, if it returns -1, trigger main exec abort  */
+typedef int(*checkverfunc_t)(char * mainexec_version, char ** shlib_version);
+/* 3: get function array function, called when loading when a module doesn't provide */
+/* the function array when calling load_module_shlib (farray param NULL)             */
+typedef int(*getfarrayfunc_t)(loader_shlibfunc_t **funcarray);
+
 #ifdef LOAD_MODULE_SHLIB_MAIN
 #define LOADER_CONFIG_PREFIX  "loader"
-#define DEFAULT_PATH ""
+#define DEFAULT_PATH      ""
+#define DEFAULT_MAXSHLIBS 10
 loader_data_t loader_data;
 
-/*--------------------------------------------------------------------------------------------------------------------------------------*/
-/*                                       LOADER parameters                                                                              */
-/*   optname               helpstr   paramflags    XXXptr	                           defXXXval	            type       numelt   */
-/*--------------------------------------------------------------------------------------------------------------------------------------*/
+/*------------------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                       LOADER parameters                                                                                        */
+/*   optname               helpstr   paramflags           XXXptr	                           defXXXval	              type       numelt   */
+/*------------------------------------------------------------------------------------------------------------------------------------------------*/
 #define LOADER_PARAMS_DESC { \
-{"shlibpath",                NULL,    0,          strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0} \
+{"shlibpath",                NULL,    PARAMFLAG_NOFREE, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH,      TYPE_STRING, 0}, \
+{"maxshlibs",                NULL,    0,                uptr:&(loader_data.maxshlibs),            defintval:DEFAULT_MAXSHLIBS, TYPE_UINT32, 0}, \
 }
 
 /*-------------------------------------------------------------------------------------------------------------*/
-#else
+#else  /* LOAD_MODULE_SHLIB_MAIN */
 extern int load_module_shlib(char *modname, loader_shlibfunc_t *farray, int numf);
-#endif
+extern void * get_shlibmodule_fptr(char *modname, char *fname);
+extern loader_data_t loader_data;
+#endif /* LOAD_MODULE_SHLIB_MAIN */
 
 #endif
 
diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c
index 7de2a47f981f97aa12cefc7da5eb67e1c175c4d1..bb88b9b4b6a4441eba3b65ee40b31198efb8b5b0 100644
--- a/common/utils/msc/msc.c
+++ b/common/utils/msc/msc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -99,6 +99,7 @@ void *msc_task(void *args_p)
         break;
 
         case TERMINATE_MESSAGE: {
+          fprintf(stderr, " *** Exiting MSC thread\n");
           timer_remove(timer_id);
     	  msc_end();
           itti_exit_task();
diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h
index eccff7951814943ec86e8b3f31231d27835d3da1..4493a5239a40f2c41aa79461443c8bb51b9737d9 100644
--- a/common/utils/msc/msc.h
+++ b/common/utils/msc/msc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/system.c b/common/utils/system.c
index 52fb950e37f2179c9c4de895c1ab9dd456f93230..dcec681e2dcf2596b78352560672439e7bba58ee 100644
--- a/common/utils/system.c
+++ b/common/utils/system.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/system.h b/common/utils/system.h
index 784c15fc9a045d6b83e5136fe00122a65c7789b6..658c17adc1a476ce68c03d1510623c87c382ab29 100644
--- a/common/utils/system.h
+++ b/common/utils/system.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/common/utils/telnetsrv/CMakeLists.txt b/common/utils/telnetsrv/CMakeLists.txt
deleted file mode 100644
index 51284ad2e835377e9eb6f8d682578594bd2bec16..0000000000000000000000000000000000000000
--- a/common/utils/telnetsrv/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
-IF(DEFINED ENV{OPENAIR_DIR})
-  message("...using oai source files in $ENV{OPENAIR_DIR}")
-ELSE()
-  message("OPENAIR_DIR is not defined.  You must run \"source oaienv\" from the oai root dir")
-  # exit early 
-  return()
-ENDIF()
-
-
-
-set(OPENAIR_DIR $ENV{OPENAIR_DIR})
-set(APPROOT ${OPENAIR_DIR}/common/utils/telnetsrv )
-set(OPENAIR_BUILD_DIR $ENV{OPENAIR_DIR}/cmake_targets)
-set(OPENAIR1_DIR $ENV{OPENAIR1_DIR})
-set(OPENAIR2_DIR $ENV{OPENAIR2_DIR})
-set(OPENAIR3_DIR $ENV{OPENAIR3_DIR})
-set(OPENAIR_PHY_DIR $ENV{OPENAIR1_DIR}/PHY)
-set(OPENAIR_TARGET_DIR $ENV{OPENAIR_DIR}/targets)
-set(OPENAIR_COMMONUTILS_DIR $ENV{OPENAIR_DIR}/common/utils)
-set(OPENAIR2_COMMON_DIR $ENV{OPENAIR_DIR}/openair2/COMMON)
-set(OPENAIR_ASN1INC  ${OPENAIR_BUILD_DIR}/lte_build_oai/build/CMakeFiles/Rel14)
-set(OPENAIR_NFAPIINC $ENV{NFAPI_DIR} )
-
-set(CMAKE_INSTALL_PREFIX $ENV{OPENAIR_TARGETS})
-
-add_definitions (-DRel14  -DCMAKER -DENABLE_FXP -DENABLE_ITTI -DENABLE_NAS_UE_LOGGING -DENABLE_SECURITY  -DENABLE_USE_CPU_EXECUTION_TIME  -DENABLE_USE_MME -DENABLE_VCD -DENB_AGENT -DENB_MODE -DETHERNET=1  -DEXMIMO_IOT -DJUMBO_FRAME  -DLINK_ENB_PDCP_TO_GTPV1U -DLOG_NO_THREAD -DMAC_CONTEXT -DMAX_NUM_CCs=1  -DNAS_BUILT_IN_UE -DNAS_UE  -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DNB_ANTENNAS_TXRX=2 -DNEW_FFT -DNO_RRM -DNone=1 -DOAI_NW_DRIVER_USE_NETLINK  -DOPENAIR1 -DOPENAIR2  -DOPENAIR_LTE -DPC_DSP -DPC_TARGET -DPHYSIM  -DPHY_CONTEXT -DPUCCH -DRel10=1  -DS1AP_VERSION=R10   -DTRACE_RLC_MUTEX -DUSER_MODE -DX2AP_VERSION=R11 -DXFORMS -mavx2 -msse4.1 -mssse3)
-add_compile_options( -fPIC -march=native -Ofast)
-
-include_directories( ./ ${OPENAIR_COMMON_DIR} ${OPENAIR_DIR} ${OPENAIR1_DIR} ${OPENAIR2_DIR} ${OPENAIR2_COMMON_DIR} ${OPENAIR2_DIR}/UTIL/LOG 
-                    ${OPENAIR_COMMONUTILS_DIR}/msc ${OPENAIR_COMMONUTILS_DIR}/itti ${OPENAIR_COMMONUTILS_DIR}/hashtable ${OPENAIR_COMMONUTILS_DIR} ${OPENAIR_ASN1INC}
-		    ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0  ${OPENAIR_COMMONUTILS_DIR}/msc ${OPENAIR_COMMONUTILS_DIR}/itti ${OPENAIR_COMMONUTILS_DIR}/hashtable ${OPENAIR_COMMONUTILS_DIR} ${OPENAIR_ASN1INC}
-		    ${OPENAIR2_DIR}/LAYER2/RLC  ${OPENAIR2_DIR}/UTIL/LISTS   ${OPENAIR2_DIR}/UTIL/MEM  ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0 
-		    ${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0 ${OPENAIR2_DIR}/RRC/LITE ${OPENAIR_TARGET_DIR}/COMMON  ${OPENAIR_TARGET_DIR}/ARCH/COMMON
-		    ${OPENAIR3_DIR}/NAS/COMMON/API/NETWORK ${OPENAIR3_DIR}/NAS/COMMON/EMM/MSG/ ${OPENAIR3_DIR}/NAS/COMMON/IES/ ${OPENAIR3_DIR}/NAS/COMMON/UTIL 
-		    ${OPENAIR3_DIR}/NAS/COMMON/ESM/MSG/  ${OPENAIR3_DIR}/GTPV1-U  ${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared ${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include
-		    ${OPENAIR3_DIR}/UTILS ${OPENAIR_NFAPIINC})
-
-set(TELNETSRV_SOURCE
-    ${APPROOT}/telnetsrv.c
-    ${APPROOT}/telnetsrv_phycmd.c
-    ${APPROOT}/telnetsrv_proccmd.c
-    )
-
-#set(TELNETSRV_ETHDEVCMD_SOURCE
-#    ${APPROOT}/telnetsrv/telnetsrv_ethdevcmd.c
-#    )
-
-
-
-add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
-#add_library(telnetsrv_ethdevcmd MODULE ${TELNETSRV_ETHDEVCMD_SOURCE} )
-
-
-install(TARGETS telnetsrv DESTINATION bin)
-
-if (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
-     install(TARGETS telnetsrv DESTINATION ${OPENAIR_BUILD_DIR}/lte_build_oai/build)
-endif (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c
index f99a83f3218c78226a052a2dd65bf5d910e6860a..a49311d0994a16420abf3edf10bf92dac36f35ba 100644
--- a/common/utils/telnetsrv/telnetsrv.c
+++ b/common/utils/telnetsrv/telnetsrv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -43,7 +43,7 @@
 #include <string.h>
 #include <signal.h>
 #include <pthread.h>
-#include <telnetsrv.h>
+#include "telnetsrv.h"
 #include <string.h>
 #include <stdarg.h>
 #include <unistd.h>
@@ -51,20 +51,27 @@
 #include <dlfcn.h>
 #include <sys/time.h>
 #include <sys/resource.h>
-
+#include "common/utils/load_module_shlib.h" 
 #include "common/config/config_userapi.h"
+#include <readline/history.h>
 
 
 #include "telnetsrv_phycmd.h"
 #include "telnetsrv_proccmd.h"	
-static char* telnet_defstatmod[] = {"softmodem","phy"}; 
+static char* telnet_defstatmod[] = {"softmodem","phy","loader"}; 
 static telnetsrv_params_t telnetparams;
 #define TELNETSRV_LISTENADDR 0
 #define TELNETSRV_LISTENPORT 1
 #define TELNETSRV_PRIORITY   2
 #define TELNETSRV_DEBUG      3
-#define TELNETSRV_STATICMOD  7
-#define TELNETSRV_SHRMOD     8
+#define TELNETSRV_LOOPC      4
+#define TELNETSRV_LOOPD      5
+#define TELNETSRV_HISFILE    6  
+#define TELNETSRV_HISSIZE    7 
+#define TELNETSRV_PHYBSIZE   8  
+#define TELNETSRV_STATICMOD  9
+#define TELNETSRV_SHRMOD     10
+
 paramdef_t telnetoptions[] = {
 /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 /*                                            configuration parameters for telnet utility                                                                             */
@@ -72,19 +79,22 @@ paramdef_t telnetoptions[] = {
 /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 	{"listenaddr",    "<listen ip address>",         0,                 uptr:&telnetparams.listenaddr,        defstrval:"0.0.0.0",            TYPE_IPV4ADDR,  0 },
 	{"listenport",    "<local port>",                0,                 uptr:&(telnetparams.listenport),      defuintval:9090,                TYPE_UINT,      0 },
-        {"priority",      "<scheduling policy (0-99)",   0,                 uptr:&telnetparams.priority,          defuintval:0,                   TYPE_INT,       0 }, 
+        {"priority",      "<scheduling policy (0-99)",   0,                 iptr:&telnetparams.priority,          defuintval:0,                   TYPE_INT,       0 }, 
 	{"debug",         "<debug level>",               0,                 uptr:NULL,                            defuintval:0,                   TYPE_UINT,      0 },
 	{"loopcount",     "<loop command iterations>",   0,                 uptr:&(telnetparams.loopcount),       defuintval:10,                  TYPE_UINT,      0 },
 	{"loopdelay",     "<loop command delay (ms)>",   0,                 uptr:&(telnetparams.loopdelay),       defuintval:5000,                TYPE_UINT,      0 },
+	{"histfile",      "<history file name>",         PARAMFLAG_NOFREE,  strptr:&(telnetparams.histfile),      defstrval:"oaitelnet.history",  TYPE_STRING,    0 },
+	{"histsize",      "<history sizes>",             0,                 iptr:&(telnetparams.histsize),        defuintval:50,                  TYPE_INT,       0 },
 	{"phypbsize",     "<phy dump buff size (bytes)>",0,                 uptr:&(telnetparams.phyprntbuff_size),defuintval:65000,               TYPE_UINT,      0 },
-        {"staticmod",     "<static modules selection>",  0,                 NULL,                                 defstrlistval:telnet_defstatmod,TYPE_STRINGLIST,1},
-        {"shrmod",        "<static modules selection>",  0,                 NULL,                                 NULL,TYPE_STRINGLIST,0 },
+        {"staticmod",     "<static modules selection>",  0,                 strlistptr:NULL,                      defstrlistval:telnet_defstatmod,TYPE_STRINGLIST,(sizeof(telnet_defstatmod)/sizeof(char *))},
+        {"shrmod",        "<dynamic modules selection>", 0,                 strlistptr:NULL,                      defstrlistval:NULL,TYPE_STRINGLIST,0 }
 };
 
-int get_phybsize() {return telnetparams.phyprntbuff_size; };
+int get_phybsize(void) {return telnetparams.phyprntbuff_size; };
 int add_telnetcmd(char *modulename,telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd );
 int setoutput(char *buff, int debug, telnet_printfunc_t prnt);
 int setparam(char *buff, int debug, telnet_printfunc_t prnt);
+int history_cmd(char *buff, int debug, telnet_printfunc_t prnt);
 
 telnetshell_vardef_t telnet_vardef[] = {
 {"debug",TELNET_VARTYPE_INT32,&telnetparams.telnetdbg},
@@ -92,12 +102,15 @@ telnetshell_vardef_t telnet_vardef[] = {
 {"loopc",TELNET_VARTYPE_INT32,&telnetparams.loopcount},
 {"loopd",TELNET_VARTYPE_INT32,&telnetparams.loopdelay},
 {"phypb",TELNET_VARTYPE_INT32,&telnetparams.phyprntbuff_size},
+{"hsize",TELNET_VARTYPE_INT32,&telnetparams.histsize},
+{"hfile",TELNET_VARTYPE_STRING,&telnetparams.histfile},
 {"",0,NULL}
 };
 
 telnetshell_cmddef_t  telnet_cmdarray[] = {
    {"redirlog","[here,file,off]",setoutput},
    {"param","[prio]",setparam},
+   {"history","[list,reset]",history_cmd},
    {"","",NULL},
 };
 
@@ -131,41 +144,54 @@ char strpolicy[10];
 
 
 //sched_get_priority_max(SCHED_FIFO)
-if (priority < NICE_MIN)
-   {
+if (priority < NICE_MIN) {
    policy=SCHED_FIFO;
    sprintf(strpolicy,"%s","fifo");
-   schedp.sched_priority= NICE_MIN - priority ;   
+   schedp.sched_priority= NICE_MIN - priority ;
+   if (   (schedp.sched_priority < sched_get_priority_min(SCHED_FIFO)) ||
+          (schedp.sched_priority > sched_get_priority_max(SCHED_FIFO)) ) {
+        client_printf("Error: %i invalid prio, should be %i to %i, \n",
+                       priority, NICE_MIN -sched_get_priority_min(SCHED_FIFO),
+                       NICE_MIN - sched_get_priority_max(SCHED_FIFO) );        
    }
-else if (priority > NICE_MAX)
-   {
+} else if (priority > NICE_MAX) {
    policy=SCHED_IDLE;
    sprintf(strpolicy,"%s","idle");
    schedp.sched_priority=0;   
-   } 
-else 
-   {
+} else {
    policy=SCHED_OTHER;
    sprintf(strpolicy,"%s","other");
    schedp.sched_priority=0;   
-   } 
-if( tid != 0)
-  {  
+}
+ 
+if( tid != 0) {  
   rt = pthread_setschedparam(tid, policy, &schedp);
-  }
-else if(pid > 0)
-  {
+} else if(pid > 0)  {
   rt = sched_setscheduler( pid, policy,&schedp);
-  }
-if (rt != 0)
-    {
+} else {
+  rt= -1;
+  client_printf("Error: no pid or tid specified\n");
+}
+
+if (rt != 0) {
     client_printf("Error %i: %s modifying sched param to %s:%i, \n",
                   errno,strerror(errno),strpolicy,schedp.sched_priority); 
-    }
-else
-    {
+} else  {
     client_printf("policy set to %s, priority %i\n",strpolicy,schedp.sched_priority);
+    if ( policy==SCHED_OTHER) {
+        rt = getpriority(PRIO_PROCESS,tid);
+        if (rt != -1) {
+           rt = setpriority(PRIO_PROCESS,tid,priority);  
+           if (rt < 0) {
+               client_printf("Error %i: %s trying to set nice value of thread %u to %i\n",
+                             errno,strerror(errno),tid,priority); 
+           }
+        } else {
+               client_printf("Error %i: %s trying to get nice value of thread %u \n",
+                              errno,strerror(errno),tid); 
+        }
     }
+}
 
 
 
@@ -198,14 +224,13 @@ int rt;
 
   CPU_ZERO(&cpuset);
   CPU_SET(coreid, &cpuset);
-  if (tid > 0)
-     {
+  if (tid > 0) {
      rt = pthread_setaffinity_np((pthread_t)tid, sizeof(cpu_set_t), &cpuset);
-     }
-  else if (pid > 0)
-     {
+  } else if (pid > 0){
      rt = sched_setaffinity((pid_t)pid, sizeof(cpu_set_t), &cpuset);
-     }
+  } else {
+     rt= -1;
+  }
   if (rt != 0)
       {
       client_printf("Error %i: %s calling , xxx_setaffinity...\n",errno,strerror(errno)); 
@@ -284,7 +309,6 @@ memset(cmds,0,sizeof(cmds));
 sscanf(buff,"%9s %9s %9s %9s %9s", cmds[0],cmds[1],cmds[2],cmds[3],cmds[4]  );
 if (strncasecmp(cmds[0],"prio",4) == 0)
    {
-   pthread_attr_t attr;
    int prio;
    prio=(int)strtol(cmds[1],NULL,0);
    if (errno == ERANGE)
@@ -305,6 +329,35 @@ if (strncasecmp(cmds[0],"aff",3) == 0)
 
 return CMDSTATUS_NOTFOUND;   
 } /* setparam */
+
+int history_cmd(char *buff, int debug, telnet_printfunc_t prnt)
+{
+char cmds[TELNET_MAX_MSGLENGTH/TELNET_CMD_MAXSIZE][TELNET_CMD_MAXSIZE];
+
+
+memset(cmds,0,sizeof(cmds));
+sscanf(buff,"%9s %9s %9s %9s %9s", cmds[0],cmds[1],cmds[2],cmds[3],cmds[4]  );
+if (cmds[0] == NULL)
+    return CMDSTATUS_VARNOTFOUND;
+if (strncasecmp(cmds[0],"list",4) == 0)
+   {
+   HIST_ENTRY **hist = history_list();
+   if (hist) {
+      for (int i = 0; hist[i]; i++) {
+          prnt ("%d: %s\n", i + history_base, hist[i]->line);
+      }
+   }
+   return CMDSTATUS_FOUND; 
+   }
+if (strncasecmp(cmds[0],"reset",5) == 0)
+   {
+   clear_history();
+   write_history(telnetparams.histfile);
+   return CMDSTATUS_FOUND; 
+   }
+
+return CMDSTATUS_NOTFOUND; 
+} /* history_cmd */
 /*-------------------------------------------------------------------------------------------------------*/
 /*
 generic commands available for all modules loaded by the server
@@ -314,11 +367,11 @@ int setgetvar(int moduleindex,char getorset,char *params)
 {
 int n,i;
 char varname[TELNET_CMD_MAXSIZE];
-char varval[TELNET_CMD_MAXSIZE];
+char *varval=NULL;
 
    memset(varname,0,sizeof(varname));
-   memset(varval,0,sizeof(varval));
-   n = sscanf(params,"%s %s",varname,varval);
+
+   n = sscanf(params,"%s %ms",varname,&varval);
    for ( i=0 ; telnetparams.CmdParsers[moduleindex].var[i].varvalptr != NULL ; i++)
       {
       if ( strncasecmp(telnetparams.CmdParsers[moduleindex].var[i].varname,varname,strlen(telnetparams.CmdParsers[moduleindex].var[i].varname)) == 0)
@@ -330,7 +383,10 @@ char varval[TELNET_CMD_MAXSIZE];
 	    switch(telnetparams.CmdParsers[moduleindex].var[i].vartype)
 	        {
 		case TELNET_VARTYPE_INT32:
-	             client_printf("%i\n",*(int *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
+	             client_printf("%i\n",*(int32_t *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
+		break;
+		case TELNET_VARTYPE_INT64:
+	             client_printf("%lli\n",*(int64_t *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
 		break;
 		case TELNET_VARTYPE_INT16:
 	             client_printf("%hi\n",*(short *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
@@ -338,8 +394,8 @@ char varval[TELNET_CMD_MAXSIZE];
 		case TELNET_VARTYPE_DOUBLE:
 	             client_printf("%g\n",*(double *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
 		break;
-		case TELNET_VARTYPE_PTR:
-	             client_printf("0x%08x\n",*((unsigned int *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr)));						
+		case TELNET_VARTYPE_STRING:
+	             client_printf("\"%s\"\n",*(char **)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));						
                 break;
 		default:
 		     client_printf("unknown type\n");
@@ -364,6 +420,10 @@ char varval[TELNET_CMD_MAXSIZE];
 		case TELNET_VARTYPE_DOUBLE:
 		     *(double *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr) = strtod(varval,NULL);
 	             client_printf("%g\n",*(double *)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
+		break;	
+		case TELNET_VARTYPE_STRING:
+		     sprintf(*(char **)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr),"%s", varval);
+	             client_printf("\"%s\"\n",*(char **)(telnetparams.CmdParsers[moduleindex].var[i].varvalptr));
 		break;				
 		default:
 		     client_printf("unknown type\n");
@@ -372,6 +432,9 @@ char varval[TELNET_CMD_MAXSIZE];
 	    }		   
 	 }
       } 
+if (n>1 && varval != NULL) {
+   free(varval);
+}
 return CMDSTATUS_VARNOTFOUND;
 }
 /*----------------------------------------------------------------------------------------------------*/
@@ -515,13 +578,14 @@ if(listen(sock, 1) == -1)
      fprintf(stderr,"[TELNETSRV] Error %s on listen call\n",strerror(errno));
 
 
+using_history();
 
 printf("\nInitializing telnet server...\n");
 while( (telnetparams.new_socket = accept(sock, &cli_addr, &cli_len)) )
      {
      printf("[TELNETSRV] Telnet client connected....\n");
-
-
+    read_history(telnetparams.histfile);
+    stifle_history(telnetparams.histsize);
     if(telnetparams.new_socket < 0)
        fprintf(stderr,"[TELNETSRV] Error %s on accept call\n",strerror(errno));
 
@@ -548,31 +612,43 @@ while( (telnetparams.new_socket = accept(sock, &cli_addr, &cli_len)) )
            break;
            }
          if (telnetparams.telnetdbg > 0)
-	    printf("[TELNETSRV] Command received: readc %i filled %i %s\n", readc, filled ,buf);
-	 if (strlen(buf) >= 2 )
+	    printf("[TELNETSRV] Command received: readc %i filled %i \"%s\"\n", readc, filled ,buf);
+         if (buf[0] == '!') {
+             if (buf[1] == '!') {
+         	 sprintf(buf,"%s","telnet history list");
+             } else {
+         	 HIST_ENTRY *hisentry = history_get(strtol(buf+1,NULL,0)); 
+         	 if (hisentry) {
+                     char msg[TELNET_MAX_MSGLENGTH + sizeof(TELNET_PROMPT) +10];
+         	     sprintf(buf,"%s",hisentry->line);
+        	     sprintf(msg,"%s %s\n",TELNET_PROMPT, hisentry->line);
+                     send(telnetparams.new_socket, msg, strlen(msg), MSG_NOSIGNAL);
+         	 }
+             }  	 
+         }
+	 if (strlen(buf) > 2 )
 	    {
             status=process_command(buf);
 	    }
 	 else
 	    status=CMDSTATUS_NOCMD;
 	    
-         if (status != CMDSTATUS_EXIT)
-	    {
-	    if (status == CMDSTATUS_NOTFOUND)
-	       {
+         if (status != CMDSTATUS_EXIT) {
+	    if (status == CMDSTATUS_NOTFOUND) {
 	       char msg[TELNET_MAX_MSGLENGTH + 50];
 	       sprintf(msg,"Error: \n      %s\n is not a softmodem command\n",buf);
 	       send(telnetparams.new_socket, msg, strlen(msg), MSG_NOSIGNAL);
-	       }
+	    } else if (status == CMDSTATUS_FOUND) {
+               add_history(buf);
+            }
             send(telnetparams.new_socket, TELNET_PROMPT, sizeof(TELNET_PROMPT), MSG_NOSIGNAL);
-	    }
-	 else
-	    {
+	} else {
 	    printf ("[TELNETSRV] Closing telnet connection...\n");
 	    break;
-	    }
+	}
     }
-
+    write_history(telnetparams.histfile);
+    clear_history();
     close(telnetparams.new_socket);
     printf ("[TELNETSRV] Telnet server waitting for connection...\n");
     }
@@ -588,7 +664,7 @@ return;
 */
 void exec_moduleinit(char *modname)
 {
-void (*fptr)();
+void (*fptr)(void);
 char initfunc[TELNET_CMD_MAXSIZE+9];
 
        if (strlen(modname) > TELNET_CMD_MAXSIZE)
@@ -609,23 +685,26 @@ char initfunc[TELNET_CMD_MAXSIZE+9];
           }
 }
 
-int add_embeddedmodules()
+int add_embeddedmodules(void)
 {
-
+int ret=0;
 
 
 
     for(int i=0; i<telnetoptions[TELNETSRV_STATICMOD].numelt;i++)
        {
+       ret++;
        exec_moduleinit(telnetoptions[TELNETSRV_STATICMOD].strlistptr[i]);
        }
+return ret;
+
 }
 
-int add_sharedmodules()
+int add_sharedmodules(void)
 {
 char initfunc[TELNET_CMD_MAXSIZE+9];
-void (*fptr)();
-
+void (*fptr)(void);
+int ret=0;
 
     for(int i=0; i<telnetoptions[TELNETSRV_SHRMOD].numelt;i++)
        {
@@ -634,22 +713,23 @@ void (*fptr)();
        if ( fptr != NULL)
           {
           fptr();
+          ret++;
           }
        else
           {
           fprintf(stderr,"[TELNETSRV] couldn't find %s for module %s \n",initfunc,telnetoptions[TELNETSRV_STATICMOD].strlistptr[i]);
           }
        }
+    return ret;
 }
 
-int init_telnetsrv(char *cfgfile)
+int telnetsrv_autoinit(void)
  {
-  void *lib_handle;
-  char** moduleslist; 
+
 
    memset(&telnetparams,0,sizeof(telnetparams));
 
-   config_get( telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t),NULL); 
+   config_get( telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t),"telnetsrv"); 
 
  
    if(pthread_create(&telnetparams.telnet_pthread,NULL, (void *(*)(void *))run_telnetsrv, NULL) != 0)
@@ -691,6 +771,26 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
  }
 
 
+/* function which will be called by the shared lib loader, to check shared lib version
+   against main exec version. version mismatch no considered as fatal (interfaces not supposed to change)
+*/ 
+int  telnetsrv_checkbuildver(char * mainexec_buildversion, char ** shlib_buildversion)
+{
+#ifndef PACKAGE_VERSION
+#define PACKAGE_VERSION "standalone built: " __DATE__ __TIME__
+#endif
+    *shlib_buildversion = PACKAGE_VERSION;
+    if (strcmp(mainexec_buildversion, *shlib_buildversion) != 0) {
+          fprintf(stderr,"[TELNETSRV] shared lib version %s, doesn't match main version %s, compatibility should be checked\n",
+                mainexec_buildversion,*shlib_buildversion);
+    }
+    return 0;
+}
 
-
-
+int telnetsrv_getfarray(loader_shlibfunc_t  **farray)
+ {
+  *farray=malloc(sizeof(loader_shlibfunc_t));
+  (*farray)[0].fname=TELNET_ADDCMD_FNAME;
+  (*farray)[0].fptr=(int (*)(void) )add_telnetcmd;
+  return 1;
+ }
diff --git a/common/utils/telnetsrv/telnetsrv.h b/common/utils/telnetsrv/telnetsrv.h
index c8cad58784df9381f1040b0200d3597b838df3df..2d3ef531aee8494ad080f00f42c9b42c1934eb50 100644
--- a/common/utils/telnetsrv/telnetsrv.h
+++ b/common/utils/telnetsrv/telnetsrv.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -18,7 +18,6 @@
  * For more information about the OpenAirInterface (OAI) Software Alliance:
  *      contact@openairinterface.org
  */
-
 /*! \file common/utils/telnetsrv/telnetsrv.h
  * \brief: include file for telnet server implementation
  * \author Francois TABURET
@@ -38,7 +37,7 @@
 #define TELNET_MAX_MSGLENGTH      2048
 #define TELNET_PROMPT             "softmodem> "
 #define TELNET_MAXCMD             20
-#define TELNET_CMD_MAXSIZE        10
+#define TELNET_CMD_MAXSIZE        20
 #define TELNET_HELPSTR_SIZE       80
 
 /* status return by the command parser after it analysed user input */
@@ -70,7 +69,7 @@ typedef struct cmddef {
 #define TELNET_VARTYPE_INT64  3
 #define TELNET_VARTYPE_STRING 4
 #define TELNET_VARTYPE_DOUBLE 5
-#define TELNET_VARTYPE_PTR    6
+//#define TELNET_VARTYPE_PTR    6
 typedef struct variabledef {
     char varname[TELNET_CMD_MAXSIZE];
     char vartype;
@@ -96,6 +95,8 @@ typedef struct {
      pthread_t telnet_pthread;       // thread id of the telnet server
      int telnetdbg;                  // debug level of the server
      int priority;                   // server running priority
+     char *histfile;                 // command history
+     int histsize;                   // command history length
      int new_socket;                 // socket of the client connection
      int logfilefd;                  // file id of the log file when log output is redirected to a file
      int  saved_stdout;              // file id of the previous stdout, used to be able to restore original stdout 
@@ -130,10 +131,12 @@ VT escape sequence definition, for smarter display....
 #define STDFMT   "\x1b[0m"
 
 /*---------------------------------------------------------------------------------------------*/
+#define TELNET_ADDCMD_FNAME "add_telnetcmd"
+typedef int(*add_telnetcmd_func_t)(char *, telnetshell_vardef_t *, telnetshell_cmddef_t *);
 #ifdef TELNETSERVERCODE
 int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd);
 void set_sched(pthread_t tid, int pid,int priority);
 void set_affinity(pthread_t tid, int pid, int coreid);
-extern int get_phybsize(); 
+extern int get_phybsize(void); 
 #endif
 #endif
diff --git a/common/utils/telnetsrv/telnetsrv_CMakeLists.txt b/common/utils/telnetsrv/telnetsrv_CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..5dee7db4c41fef1d5c3f96b18eb770d64e044054
--- /dev/null
+++ b/common/utils/telnetsrv/telnetsrv_CMakeLists.txt
@@ -0,0 +1,28 @@
+
+
+set(TELNETROOT ${OPENAIR_DIR}/common/utils/telnetsrv )
+
+
+
+set(TELNETSRV_SOURCE
+    ${TELNETROOT}/telnetsrv.c
+    ${TELNETROOT}/telnetsrv_phycmd.c
+    ${TELNETROOT}/telnetsrv_proccmd.c
+    ${TELNETROOT}/telnetsrv_loader.c
+    )
+
+#set(TELNETSRV_ETHDEVCMD_SOURCE
+#    ${APPROOT}/telnetsrv/telnetsrv_ethdevcmd.c
+#    )
+
+
+
+add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
+#add_library(telnetsrv_ethdevcmd MODULE ${TELNETSRV_ETHDEVCMD_SOURCE} )
+target_link_libraries(telnetsrv PRIVATE history)
+
+install(TARGETS telnetsrv DESTINATION bin)
+
+if (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
+     install(TARGETS telnetsrv DESTINATION ${OPENAIR_BUILD_DIR}/lte_build_oai/build)
+endif (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
diff --git a/common/utils/telnetsrv/telnetsrv_loader.c b/common/utils/telnetsrv/telnetsrv_loader.c
new file mode 100644
index 0000000000000000000000000000000000000000..a23e25eb835fbd3a728424a7afb4a8991a179caa
--- /dev/null
+++ b/common/utils/telnetsrv/telnetsrv_loader.c
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file common/utils/telnetsrv/telnetsrv_loader.c
+ * \brief: implementation of telnet commands related to softmodem linux process
+ * \author Francois TABURET
+ * \date 2018
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+#define _GNU_SOURCE 
+#include <string.h>
+#include <pthread.h>
+
+
+#define TELNETSERVERCODE
+#include "telnetsrv.h"
+#define TELNETSRV_LOADER_MAIN
+#include "telnetsrv_loader.h"
+
+
+int loader_show_cmd(char *buff, int debug, telnet_printfunc_t prnt);
+telnetshell_cmddef_t loader_cmdarray[] = {
+   {"show","[params,modules]",loader_show_cmd},
+   {"","",NULL},
+};
+
+
+/*-------------------------------------------------------------------------------------*/
+int loader_show_cmd(char *buff, int debug, telnet_printfunc_t prnt)
+{
+   if (debug > 0)
+       prnt( "loader_show_cmd received %s\n",buff);
+
+      if (strcasestr(buff,"params") != NULL) {
+          prnt( "loader parameters:\n");
+          prnt( "   Main executable build version: \"%s\"\n", loader_data.mainexec_buildversion);
+          prnt( "   Default shared lib path: \"%s\"\n", loader_data.shlibpath);
+          prnt( "   Max number of shared lib : %i\n", loader_data.maxshlibs);
+      }
+      else if (strcasestr(buff,"modules") != NULL) {
+          prnt( "%i shared lib have been dynamicaly loaded by the oai loader\n", loader_data.numshlibs);
+          for (int i=0 ; i<loader_data.numshlibs ; i++) {
+              prnt( "   Module %i: %s\n", i,loader_data.shlibs[i].name);
+              prnt( "       Shared library build version: \"%s\"\n",((loader_data.shlibs[i].shlib_buildversion == NULL )?"":loader_data.shlibs[i].shlib_buildversion));
+              prnt( "       Shared library path: \"%s\"\n", loader_data.shlibs[i].thisshlib_path);
+              prnt( "       %i function pointers registered:\n", loader_data.shlibs[i].numfunc);
+              for(int j=0 ; j<loader_data.shlibs[i].numfunc;j++) {
+                     prnt( "          function %i %s at %p\n",j,
+                           loader_data.shlibs[i].funcarray[j].fname, loader_data.shlibs[i].funcarray[j].fptr);
+              }
+          }
+      } else {
+          prnt("%s: wrong loader command...\n",buff);
+      }
+   return 0;
+}
+
+void add_loader_cmds(void)
+{
+
+   add_telnetcmd("loader", loader_globalvardef, loader_cmdarray);
+}
diff --git a/targets/RT/USER/rrh_gw_externs.h b/common/utils/telnetsrv/telnetsrv_loader.h
similarity index 52%
rename from targets/RT/USER/rrh_gw_externs.h
rename to common/utils/telnetsrv/telnetsrv_loader.h
index b85f0ae7a2254b43d0a38d6ecceaadb46ce33fa8..404aabfc7019b2ccf82f718e145696bb63584ca3 100644
--- a/targets/RT/USER/rrh_gw_externs.h
+++ b/common/utils/telnetsrv/telnetsrv_loader.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,30 +19,37 @@
  *      contact@openairinterface.org
  */
 
-/*! \file rrh_gw_extern.h
- * \brief rrh gatewy external vars
- * \author Navid Nikaein,  Katerina Trilyraki, Raymond Knopp
- * \date 2015
+/*! \file common/utils/telnetsrv_proccmd.h
+ * \brief: Include file defining telnet commands related to softmodem linux process
+ * \author Francois TABURET
+ * \date 2018
  * \version 0.1
- * \company Eurecom
- * \maintainer:  navid.nikaein@eurecom.fr
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
  * \note
- * \warning very experimental 
+ * \warning
  */
 
-#ifndef RRH_GW_EXTERNS_H_
-#define RRH_GW_EXTERNS_H_
-extern char   rf_config_file[1024];
+#ifdef TELNETSRV_LOADER_MAIN
 
-extern openair0_timestamp 	timestamp_UE_tx[4] ,timestamp_UE_rx[4] ,timestamp_eNB_rx[4],timestamp_eNB_tx[4];
-extern openair0_vtimestamp 	hw_counter;
-extern int32_t			UE_tx_started,UE_rx_started,eNB_rx_started ,eNB_tx_started;
-extern int32_t			nsamps_UE[4],nsamps_eNB[4];
-extern int32_t			overflow_rx_buffer_eNB[4],overflow_rx_buffer_UE[4];
-extern uint8_t			rrh_exit;
-extern int32_t			**rx_buffer_eNB, **rx_buffer_UE;
-extern unsigned int	        rt_period;
-extern pthread_mutex_t          timer_mutex;
+#include "UTIL/LOG/log.h"
 
 
-#endif 
+#include "common/utils/load_module_shlib.h"
+
+
+telnetshell_vardef_t loader_globalvardef[] = {
+{"mainversion",TELNET_VARTYPE_STRING,&(loader_data.mainexec_buildversion)},
+{"defpath",TELNET_VARTYPE_STRING,&(loader_data.shlibpath)},
+{"maxshlibs",TELNET_VARTYPE_INT32,&(loader_data.maxshlibs)},
+{"numshlibs",TELNET_VARTYPE_INT32,&(loader_data.numshlibs)},
+{"",0,NULL}
+};
+telnetshell_vardef_t *loader_modulesvardef;
+
+extern void add_loader_cmds(void);
+
+#endif
+
+/*-------------------------------------------------------------------------------------*/
+
diff --git a/common/utils/telnetsrv/telnetsrv_phycmd.c b/common/utils/telnetsrv/telnetsrv_phycmd.c
index 6867d5deeef8fde9baa5880ca5f3bc28f043525c..c60126f1c741e4d9d93323e761862d0f7458e561 100644
--- a/common/utils/telnetsrv/telnetsrv_phycmd.c
+++ b/common/utils/telnetsrv/telnetsrv_phycmd.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -41,7 +41,7 @@
 char *prnbuff;
 extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length);
 
-void init_phytelnet()
+void init_phytelnet(void)
 {
 prnbuff=malloc(get_phybsize() );
 if (prnbuff == NULL)
@@ -134,7 +134,7 @@ telnetshell_cmddef_t phy_cmdarray[] = {
 
 
 /*-------------------------------------------------------------------------------------*/
-void add_phy_cmds()
+void add_phy_cmds(void)
 {
 
    init_phytelnet();
diff --git a/common/utils/telnetsrv/telnetsrv_phycmd.h b/common/utils/telnetsrv/telnetsrv_phycmd.h
index 3922bda727c0e140d3e4529c81dd167cbb21df29..6e2b0ecacff74813b6635436dfea3fc6078995e9 100644
--- a/common/utils/telnetsrv/telnetsrv_phycmd.h
+++ b/common/utils/telnetsrv/telnetsrv_phycmd.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -42,8 +42,6 @@
 #define TELNETVAR_PHYCC1    1
 
 telnetshell_vardef_t phy_vardef[] = {
-{"phycc1",TELNET_VARTYPE_PTR,NULL},
-{"phycc2",TELNET_VARTYPE_PTR,NULL},
 //{"iqmax",TELNET_VARTYPE_INT16,NULL},
 //{"iqmin",TELNET_VARTYPE_INT16,NULL},
 //{"loglvl",TELNET_VARTYPE_INT32,NULL},
@@ -57,7 +55,7 @@ telnetshell_vardef_t phy_vardef[] = {
 
 #else
 
-extern void add_phy_cmds();
+extern void add_phy_cmds(void);
 
 #endif
 
diff --git a/common/utils/telnetsrv/telnetsrv_proccmd.c b/common/utils/telnetsrv/telnetsrv_proccmd.c
index 82c4549faeab7b7eaf79ec00f5a145fdfb7717d7..91f0e9c93a591f04bb85ddd991c8cf9d2e1142cd 100644
--- a/common/utils/telnetsrv/telnetsrv_proccmd.c
+++ b/common/utils/telnetsrv/telnetsrv_proccmd.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -54,6 +54,8 @@
 #define TELNETSRV_PROCCMD_MAIN
 #include "log.h"
 #include "log_extern.h"
+#include "common/config/config_userapi.h"
+#include "openair1/PHY/extern.h"
 #include "telnetsrv_proccmd.h"
 
 void decode_procstat(char *record, int debug, telnet_printfunc_t prnt)
@@ -70,14 +72,13 @@ char toksep[2];
   lptr= prntline;
 /*http://man7.org/linux/man-pages/man5/proc.5.html gives the structure of the stat file */
  
-  while( 	procfile_fiels != NULL && fieldcnt < 42)
-    {
+  while( 	procfile_fiels != NULL && fieldcnt < 42) {
+    long int policy;
     if (strlen(procfile_fiels) == 0)
        continue;
     fieldcnt++;
     sprintf(toksep," ");
-    switch(fieldcnt)
-       {
+    switch(fieldcnt) {
        case 1: /* id */
            lptr+=sprintf(lptr,"%9.9s ",procfile_fiels);
            sprintf(toksep,")");
@@ -104,12 +105,36 @@ char toksep[2];
        break;
        case 41:   //policy	       
            lptr+=sprintf(lptr,"%3.3s ",procfile_fiels);
+           policy=strtol(procfile_fiels,NULL,0);
+           switch(policy) {
+              case SCHED_FIFO:
+                   lptr+=sprintf(lptr,"%s ","rt: fifo");
+              break;
+              case SCHED_OTHER:
+                   lptr+=sprintf(lptr,"%s ","other");
+              break;
+              case SCHED_IDLE:
+                   lptr+=sprintf(lptr,"%s ","idle");
+              break;
+              case SCHED_BATCH:
+                   lptr+=sprintf(lptr,"%s ","batch");
+              break;
+              case SCHED_RR:
+                   lptr+=sprintf(lptr,"%s ","rt: rr");
+              break;
+              case SCHED_DEADLINE:
+                   lptr+=sprintf(lptr,"%s ","rt: deadline");
+              break;
+              default:
+                   lptr+=sprintf(lptr,"%s ","????");
+              break;
+           }
        break;
        default:
        break;	       	       	       	       	       
-       }/* switch on fieldcnr */  
+    }/* switch on fieldcnr */  
     procfile_fiels =strtok_r(NULL,toksep,&strtokptr); 
-    } /* while on proc_fields != NULL */
+  } /* while on proc_fields != NULL */
   prnt("%s\n",prntline); 
 } /*decode_procstat */
 
@@ -141,7 +166,7 @@ char aname[256];
 DIR *proc_dir;
 struct dirent *entry;
 
-int rt;
+
 
     prnt("  id          name            state   USRmod    KRNmod  prio nice   vsize   proc pol \n\n");
     snprintf(aname, sizeof(aname), "/proc/%d/stat", getpid());
@@ -172,14 +197,51 @@ extern log_t *g_log;
    
    if (debug > 0)
        prnt(" proccmd_show received %s\n",buf);
-   if (strcasestr(buf,"thread") != NULL)
-       {
+   if (strcasestr(buf,"thread") != NULL) {
        print_threads(buf,debug,prnt);
-       }
+   }
    if (strcasestr(buf,"loglvl") != NULL) {
-       for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++){
-            prnt("\t%s:\t%s\t%s\n",g_log->log_component[i].name, map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
-	        map_int_to_str(log_level_names,g_log->log_component[i].level));
+       prnt("component                 verbosity  level  enabled\n");
+       for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
+            prnt("%02i %17.17s:%10.10s%10.10s  %s\n",i ,g_log->log_component[i].name, 
+                  map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
+	          map_int_to_str(log_level_names,g_log->log_component[i].level),
+                  ((g_log->log_component[i].interval>0)?"Y":"N") );
+       }
+   }
+   if (strcasestr(buf,"config") != NULL) {
+       prnt("Command line arguments:\n");
+       for (int i=0; i < config_get_if()->argc; i++) {
+            prnt("    %02i %s\n",i ,config_get_if()->argv[i]);
+       }
+       prnt("Config module flags ( -O <cfg source>:<xxx>:dbgl<flags>): 0x%08x\n", config_get_if()->rtflags); 
+
+       prnt("    Print config debug msg, params values (flag %u): %s\n",CONFIG_PRINTPARAMS,
+            ((config_get_if()->rtflags & CONFIG_PRINTPARAMS) ? "Y" : "N") ); 
+       prnt("    Print config debug msg, memory management(flag %u): %s\n",CONFIG_DEBUGPTR,
+            ((config_get_if()->rtflags & CONFIG_DEBUGPTR) ? "Y" : "N") ); 
+       prnt("    Print config debug msg, command line processing (flag %u): %s\n",CONFIG_DEBUGCMDLINE,
+            ((config_get_if()->rtflags & CONFIG_DEBUGCMDLINE) ? "Y" : "N") );        
+       prnt("    Don't exit if param check fails (flag %u): %s\n",CONFIG_NOABORTONCHKF,
+            ((config_get_if()->rtflags & CONFIG_NOABORTONCHKF) ? "Y" : "N") );      
+       prnt("Config source: %s,  parameters:\n",CONFIG_GETSOURCE );
+       for (int i=0; i < config_get_if()->num_cfgP; i++) {
+            prnt("    %02i %s\n",i ,config_get_if()->cfgP[i]);
+       }
+       prnt("Softmodem components:\n");
+       prnt("   %02i Ru(s)\n", RC.nb_RU);
+       prnt("   %02i lte RRc(s),     %02i NbIoT RRC(s)\n",    RC.nb_inst, RC.nb_nb_iot_rrc_inst);
+       prnt("   %02i lte MACRLC(s),  %02i NbIoT MACRLC(s)\n", RC.nb_macrlc_inst, RC.nb_nb_iot_macrlc_inst);
+       prnt("   %02i lte L1,	    %02i NbIoT L1\n",	     RC.nb_L1_inst, RC.nb_nb_iot_L1_inst);
+
+       for(int i=0; i<RC.nb_inst; i++) {
+           prnt("    lte RRC %i:     %02i CC(s) \n",i,((RC.nb_CC == NULL)?0:RC.nb_CC[i]));
+       }
+       for(int i=0; i<RC.nb_L1_inst; i++) {
+           prnt("    lte L1 %i:      %02i CC(s)\n",i,((RC.nb_L1_CC == NULL)?0:RC.nb_L1_CC[i]));
+       }
+       for(int i=0; i<RC.nb_macrlc_inst; i++) {
+           prnt("    lte macrlc %i:  %02i CC(s)\n",i,((RC.nb_mac_CC == NULL)?0:RC.nb_mac_CC[i]));
        }
    }
    return 0;
@@ -190,12 +252,16 @@ int proccmd_thread(char *buf, int debug, telnet_printfunc_t prnt)
 int bv1,bv2;   
 int res;
 char sv1[64]; 
-char tname[32];  
+ 
    bv1=0;
    bv2=0;
    sv1[0]=0;
    if (debug > 0)
        prnt("proccmd_thread received %s\n",buf);
+   if (strcasestr(buf,"help") != NULL) {
+          prnt(PROCCMD_THREAD_HELP_STRING);
+          return 0;
+   } 
    res=sscanf(buf,"%i %9s %i",&bv1,sv1,&bv2);
    if (debug > 0)
        prnt(" proccmd_thread: %i params = %i,%s,%i\n",res,bv1,sv1,bv2);   
@@ -231,32 +297,95 @@ extern void exit_fun(const char* s);
    return 0;
 }
  
+
 int proccmd_log(char *buf, int debug, telnet_printfunc_t prnt)
 {
 int idx1=0;
 int idx2=NUM_LOG_LEVEL-1;
-int s = sscanf(buf,"%*s %i-%i",&idx1,&idx2);   
+char *logsubcmd=NULL;
+
+int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);   
    
    if (debug > 0)
-       prnt("process module received %s\n",buf);
+       prnt( "proccmd_log received %s\n   s=%i sub command %s\n",buf,s,((logsubcmd==NULL)?"":logsubcmd));
+
+   if (s == 1 && logsubcmd != NULL) {
+      if (strcasestr(logsubcmd,"online") != NULL) {
+          if (strcasestr(buf,"noonline") != NULL) {
+   	      set_glog_onlinelog(0);
+              prnt("online logging disabled\n",buf);
+          } else {
+   	      set_glog_onlinelog(1);
+              prnt("online logging enabled\n",buf);
+          }
+      }
+      else if (strcasestr(logsubcmd,"show") != NULL) {
+          prnt("Available log levels: \n   ");
+          for (int i=0; log_level_names[i].name != NULL; i++)
+             prnt("%s ",log_level_names[i].name);
+          prnt("\nAvailable verbosity: \n   ");
+          for (int i=0; log_verbosity_names[i].name != NULL; i++)
+             prnt("%s ",log_verbosity_names[i].name);
+          prnt("\n");
+   	  proccmd_show("loglvl",debug,prnt);
+      }
+      else if (strcasestr(logsubcmd,"help") != NULL) {
+          prnt(PROCCMD_LOG_HELP_STRING);
+      } else {
+          prnt("%s: wrong log command...\n",logsubcmd);
+      }
+   } else if ( s == 3 && logsubcmd != NULL) {
+      int level, verbosity, interval;
+      char *tmpstr=NULL;
+      char *logparam=NULL;
+      int l;
+
+      level = verbosity = interval = -1;
+      l=sscanf(logsubcmd,"%m[^'_']_%m[^'_']",&logparam,&tmpstr);
+      if (debug > 0)
+          prnt("l=%i, %s %s\n",l,((logparam==NULL)?"\"\"":logparam), ((tmpstr==NULL)?"\"\"":tmpstr));
+      if (l ==2 ) {
+         if (strcmp(logparam,"level") == 0) {
+             level=map_str_to_int(log_level_names,tmpstr);
+             if (level < 0)  prnt("level %s unknown\n",tmpstr);
+         } else if (strcmp(logparam,"verbos") == 0) {
+             verbosity=map_str_to_int(log_verbosity_names,tmpstr);
+             if (verbosity < 0)  prnt("verbosity %s unknown\n",tmpstr);
+         } else {
+             prnt("%s%s unknown log sub command \n",logparam, tmpstr);
+         }
+      } else if (l ==1 ) {
+         if (strcmp(logparam,"enable") == 0) {
+              interval = 1;
+         } else if (strcmp(logparam,"disable") == 0) {
+              interval = 0;
+         } else {
+             prnt("%s%s unknown log sub command \n",logparam, tmpstr);
+         }
+      } else {
+          prnt("%s unknown log sub command \n",logsubcmd); 
+      }
+      if (logparam != NULL) free(logparam);
+      if (tmpstr != NULL)   free(tmpstr);
+      for (int i=idx1; i<=idx2 ; i++) {
+          set_comp_log(i, level, verbosity, interval);
+          prnt("log level/verbosity  comp %i %s set to %s / %s (%s)\n",
+                i,((g_log->log_component[i].name==NULL)?"":g_log->log_component[i].name),
+                map_int_to_str(log_level_names,g_log->log_component[i].level),
+                map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
+                ((g_log->log_component[i].interval>0)?"enabled":"disabled"));
+
+        
+      }     
+   } else {
+       prnt("%s: wrong log command...\n",buf);
+   }
 
-   if (strcasestr(buf,"enable") != NULL)
-       {
-       set_glog_onlinelog(1);
-       }
-   if (strcasestr(buf,"disable") != NULL)
-       {
-       set_glog_onlinelog(0);
-       }
-    if (strcasestr(buf,"show") != NULL)
-       {
-       proccmd_show("loglvl",debug,prnt);
-       }      
    return 0;
 } 
 /*-------------------------------------------------------------------------------------*/
 
-void add_softmodem_cmds()
+void add_softmodem_cmds(void)
 {
    add_telnetcmd("softmodem",proc_vardef,proc_cmdarray);
 }
diff --git a/common/utils/telnetsrv/telnetsrv_proccmd.h b/common/utils/telnetsrv/telnetsrv_proccmd.h
index d7fd0a6e2497df81bca617989ad142e5356997bd..b2c05315d8a46e2e1a989beefe775d5c53d8b21d 100644
--- a/common/utils/telnetsrv/telnetsrv_proccmd.h
+++ b/common/utils/telnetsrv/telnetsrv_proccmd.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,6 +19,7 @@
  *      contact@openairinterface.org
  */
 
+
 /*! \file common/utils/telnetsrv/telnetsrv_proccmd.h
  * \brief: Include file defining telnet commands related to this linux process
  * \author Francois TABURET
@@ -43,15 +44,33 @@ extern int proccmd_log(char *buf, int debug, telnet_printfunc_t prnt);
 telnetshell_vardef_t proc_vardef[] = {
 {"",0,NULL}
 };
+#define PROCCMD_LOG_HELP_STRING " log sub commands: \n\
+ show:  		     display current log configuration \n\
+ online, noonline:	     enable or disable console logs \n\
+ enable, disable id1-id2:    enable or disable logs for components index id1 to id2 \n\
+ level_<level> id1-id2:      set log level to <level> for components index id1 to id2 \n\
+ level_<verbosity> id1-id2:  set log verbosity to <verbosity> for components index id1 to id2 \n\
+use the show command to get the values for <level>, <verbosity> and the list of component indexes \
+that can be used for id1 and id2 \n"    
+
+#define PROCCMD_THREAD_HELP_STRING " thread sub commands: \n\
+ <thread id> aff <core>  :    set affinity of thread <thread id> to core <core> \n\
+ <thread id> prio <prio> :    set scheduling parameters for thread <thread id>  \n\
+                   if prio < -20: linux scheduling policy set to FIFO, \n\
+                                  with priority = -20 - prio \n\
+                   if prio > 19: linux scheduling policy set to OTHER, \n\
+                                  with priority (nice value) =  prio \n\
+  use \"softmodem show thread\" to get <thread id> \n"
+ 
 
 telnetshell_cmddef_t proc_cmdarray[] = {
-   {"show","loglvl|thread", proccmd_show},
-   {"log","[enable,disable]", proccmd_log},
-   {"thread","<id> aff|prio <aff|prio>", proccmd_thread},
+   {"show","loglvl|thread|config", proccmd_show},
+   {"log","(enter help for details)", proccmd_log},
+   {"thread","(enter help for details)", proccmd_thread},
    {"exit","", proccmd_exit},
    {"","",NULL},
 };
 #else
-extern void add_proccmd_cmds();
+extern void add_proccmd_cmds(void);
 #endif  /* TELNETSRV_PROCCMD_MAIN */
 
diff --git a/nfapi/README b/nfapi/README
new file mode 100644
index 0000000000000000000000000000000000000000..b2e132153244fbef1c5eab14f653c623817e1fc6
--- /dev/null
+++ b/nfapi/README
@@ -0,0 +1,15 @@
+This directory contains the NFAPI code.
+
+It comes in two parts:
+
+1 - open-nFAPI
+
+    This is a clone of the github repository
+    (https://github.com/cisco/open-nFAPI,
+     commit b3bc579b1697eab829d5d8a2de59c93a61b88fa4).
+    The patch open-nfapi.oai.patch has then been applied.
+
+2 - oai_integration
+
+    This is code written by David Price from Cisco to integrate
+    open-nFAPI into OpenAirInterface.
diff --git a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.h b/nfapi/oai_integration/nfapi.c
similarity index 56%
rename from openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.h
rename to nfapi/oai_integration/nfapi.c
index ee4efd8c7599b4450115386ed5a9a1ab8c7f3220..5a3bc804c1b7685ad1292413d71d3965a03339a1 100644
--- a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.h
+++ b/nfapi/oai_integration/nfapi.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,31 +19,33 @@
  *      contact@openairinterface.org
  */
 
-#ifndef _IOCTL_H
-#define _IOCTL_H
-
-#include <sys/ioctl.h>
-#include <string.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <net/if.h>
-#include <linux/ipv6.h>
-#include <linux/in.h>
-#include <linux/in6.h>
-//#include <linux/netdevice.h>
+#include <pthread.h>
+
+void set_thread_priority(int priority)
+{
+  //printf("%s(priority:%d)\n", __FUNCTION__, priority);
+
+  pthread_attr_t ptAttr;
 
-//#include <graal_constant.h>
-//#define GRAAL_STATE_IDLE      0
-//#define GRAAL_STATE_CONNECTED     1
-//#define GRAAL_STATE_ESTABLISHMENT_REQUEST 2
-//#define GRAAL_STATE_ESTABLISHMENT_FAILURE 3
-//#define GRAAL_STATE_RELEASE_FAILURE   4
+  struct sched_param schedParam;
+  schedParam.__sched_priority = priority; //79;
+  if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0)
+  {
+    printf("Failed to set scheduler to SCHED_RR\n");
+  }
 
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
+  if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0)
+  {
+    printf("Failed to set pthread sched policy SCHED_RR\n");
+  }
 
-extern int inet_pton(int af, const char *src, void *dst);
-extern char *inet_ntop(int af, const void *src, char *dst, size_t sise);
+  pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
 
-#endif //_IOCTL_H
+  struct sched_param thread_params;
+  thread_params.sched_priority = 20;
+  if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0)
+  {
+    printf("failed to set sched param\n");
+  }
+}
diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c
new file mode 100644
index 0000000000000000000000000000000000000000..c63d504e43d569f2cf9c3045aa2dca1c3b7056d8
--- /dev/null
+++ b/nfapi/oai_integration/nfapi_pnf.c
@@ -0,0 +1,1625 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "debug.h"
+#include "nfapi_pnf_interface.h"
+#include "nfapi.h"
+#include "nfapi_pnf.h"
+#include "common/ran_context.h"
+//#include "openair1/PHY/vars.h"
+extern RAN_CONTEXT_t RC;
+
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <assert.h>
+#include <arpa/inet.h>
+#include <pthread.h>
+#include <errno.h>
+
+#include <vendor_ext.h>
+#include "fapi_stub.h"
+//#include "fapi_l1.h"
+#include "UTIL/LOG/log.h"
+#include "openair2/LAYER2/MAC/proto.h"
+
+#define NUM_P5_PHY 2
+
+#define _GNU_SOURCE
+
+extern void phy_init_RU(RU_t*);
+extern int config_sync_var;
+
+extern pthread_cond_t nfapi_sync_cond;
+extern pthread_mutex_t nfapi_sync_mutex;
+extern int nfapi_sync_var;
+
+extern int sync_var;
+
+extern void init_eNB_afterRU(void);
+extern void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB, int frame, int subframe, eNB_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu);
+extern void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, nfapi_ul_config_request_pdu_t *ul_config_pdu, uint16_t frame,uint8_t subframe,uint8_t srs_present);
+extern void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame, int subframe, eNB_rxtx_proc_t *proc,  nfapi_dl_config_request_pdu_t *dl_config_pdu, uint8_t codeword_index, uint8_t *sdu);
+extern void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,int frame, int subframe, eNB_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu);
+extern void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,int frame, int subframe, eNB_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu);
+extern void handle_nfapi_bch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu, uint8_t *sdu);
+
+extern uint8_t  nfapi_mode;
+
+nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; // [frame][subframe][max_num_pdus]
+
+uint8_t tx_pdus[32][8][4096];
+
+
+uint16_t phy_antenna_capability_values[] = { 1, 2, 4, 8, 16 };
+
+nfapi_pnf_param_response_t g_pnf_param_resp;
+
+
+nfapi_pnf_p7_config_t *p7_config_g = NULL;
+
+void* pnf_allocate(size_t size) {
+  return malloc(size);
+}
+
+void pnf_deallocate(void* ptr) {
+  free(ptr);
+}
+
+
+typedef struct {
+  //public:
+  uint8_t enabled;
+  uint32_t rx_port;
+  uint32_t tx_port;
+  //std::string tx_addr;
+  char tx_addr[80];
+} udp_data;
+
+typedef struct {
+    uint16_t index;
+    uint16_t id;
+    uint8_t rfs[2];
+    uint8_t excluded_rfs[2];
+
+    udp_data udp;
+
+    char local_addr[80];
+    int local_port;
+
+    char* remote_addr;
+    int remote_port;
+
+    uint8_t duplex_mode;
+    uint16_t dl_channel_bw_support;
+    uint16_t ul_channel_bw_support;
+    uint8_t num_dl_layers_supported;
+    uint8_t num_ul_layers_supported;
+    uint16_t release_supported;
+    uint8_t nmm_modes_supported;
+
+    uint8_t dl_ues_per_subframe;
+    uint8_t ul_ues_per_subframe;
+
+    uint8_t first_subframe_ind;
+
+    // timing information recevied from the vnf
+    uint8_t timing_window;
+    uint8_t timing_info_mode;
+    uint8_t timing_info_period;
+
+} phy_info;
+
+typedef struct {
+  //public:
+  uint16_t index;
+  uint16_t band;
+  int16_t max_transmit_power;
+  int16_t min_transmit_power;
+  uint8_t num_antennas_supported;
+  uint32_t min_downlink_frequency;
+  uint32_t max_downlink_frequency;
+  uint32_t max_uplink_frequency;
+  uint32_t min_uplink_frequency;
+} rf_info;
+
+
+typedef struct {
+
+    int release;
+    phy_info phys[2];
+    rf_info rfs[2];
+
+    uint8_t sync_mode;
+    uint8_t location_mode;
+    uint8_t location_coordinates[6];
+    uint32_t dl_config_timing;
+    uint32_t ul_config_timing;
+    uint32_t tx_timing;
+    uint32_t hi_dci0_timing;
+
+    uint16_t max_phys;
+    uint16_t max_total_bw;
+    uint16_t max_total_dl_layers;
+    uint16_t max_total_ul_layers;
+    uint8_t shared_bands;
+    uint8_t shared_pa;
+    int16_t max_total_power;
+    uint8_t oui;
+
+    uint8_t wireshark_test_mode;
+
+} pnf_info;
+
+typedef struct {
+  uint16_t phy_id;
+  nfapi_pnf_config_t* config;
+  phy_info* phy;
+  nfapi_pnf_p7_config_t* p7_config;
+} pnf_phy_user_data_t;
+
+static pnf_info pnf;
+static pthread_t pnf_start_pthread;
+
+extern void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args);
+
+void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
+  va_list args;
+  int oai_level;
+
+  if (nfapi_level==NFAPI_TRACE_ERROR) {
+    oai_level = LOG_ERR;
+  } else if (nfapi_level==NFAPI_TRACE_WARN) {
+    oai_level = LOG_WARNING;
+  } else if (nfapi_level==NFAPI_TRACE_NOTE) {
+    oai_level = LOG_INFO;
+  } else if (nfapi_level==NFAPI_TRACE_INFO) {
+    oai_level = LOG_DEBUG;
+  } else {
+    oai_level = LOG_ERR;
+  }
+
+  va_start(args, message);
+  nfapi_log("FILE>", "FUNC", 999, PHY, oai_level, message, args);
+  va_end(args);
+}
+
+void pnf_set_thread_priority(int priority) {
+
+  pthread_attr_t ptAttr;
+
+  struct sched_param schedParam;
+  schedParam.__sched_priority = priority;
+  if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
+    printf("failed to set SCHED_RR\n");
+  }
+
+  if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
+    printf("failed to set pthread SCHED_RR %d\n", errno);
+  }
+
+  pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
+
+  struct sched_param thread_params;
+  thread_params.sched_priority = 20;
+  if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0) {
+    printf("failed to set sched param\n");
+  }
+}
+
+void* pnf_p7_thread_start(void* ptr) {
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P7 THREAD %s\n", __FUNCTION__);
+
+  pnf_set_thread_priority(79);
+
+  nfapi_pnf_p7_config_t* config = (nfapi_pnf_p7_config_t*)ptr;
+  nfapi_pnf_p7_start(config);
+
+  return 0;
+}
+
+int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req) {
+
+  printf("[PNF] pnf param request\n");
+
+  nfapi_pnf_param_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
+  resp.error_code = NFAPI_MSG_OK;
+
+  pnf_info* pnf = (pnf_info*)(config->user_data);
+
+  resp.pnf_param_general.tl.tag = NFAPI_PNF_PARAM_GENERAL_TAG;
+  resp.pnf_param_general.nfapi_sync_mode = pnf->sync_mode;
+  resp.pnf_param_general.location_mode = pnf->location_mode;
+  resp.pnf_param_general.dl_config_timing = pnf->dl_config_timing;
+  resp.pnf_param_general.tx_timing = pnf->tx_timing;
+  resp.pnf_param_general.ul_config_timing = pnf->ul_config_timing;
+  resp.pnf_param_general.hi_dci0_timing = pnf->hi_dci0_timing;
+  resp.pnf_param_general.maximum_number_phys = pnf->max_phys;
+  resp.pnf_param_general.maximum_total_bandwidth = pnf->max_total_bw;
+  resp.pnf_param_general.maximum_total_number_dl_layers = pnf->max_total_dl_layers;
+  resp.pnf_param_general.maximum_total_number_ul_layers = pnf->max_total_ul_layers;
+  resp.pnf_param_general.shared_bands = pnf->shared_bands;
+  resp.pnf_param_general.shared_pa = pnf->shared_pa;
+  resp.pnf_param_general.maximum_total_power = pnf->max_total_power;
+
+  resp.pnf_phy.tl.tag = NFAPI_PNF_PHY_TAG;
+  resp.pnf_phy.number_of_phys = 1;
+
+  for(int i = 0; i < 1; ++i) {
+    resp.pnf_phy.phy[i].phy_config_index = pnf->phys[i].index; 
+    resp.pnf_phy.phy[i].downlink_channel_bandwidth_supported = pnf->phys[i].dl_channel_bw_support;
+    resp.pnf_phy.phy[i].uplink_channel_bandwidth_supported = pnf->phys[i].ul_channel_bw_support;
+    resp.pnf_phy.phy[i].number_of_dl_layers_supported = pnf->phys[i].num_dl_layers_supported;
+    resp.pnf_phy.phy[i].number_of_ul_layers_supported = pnf->phys[i].num_ul_layers_supported;
+    resp.pnf_phy.phy[i].maximum_3gpp_release_supported = pnf->phys[i].release_supported;
+    resp.pnf_phy.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
+
+    resp.pnf_phy.phy[i].number_of_rfs = 2;
+    for(int j = 0; j < 1; ++j) {
+      resp.pnf_phy.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
+    }
+
+    resp.pnf_phy.phy[i].number_of_rf_exclusions = 0;
+    for(int j = 0; j < 0; ++j) {
+      resp.pnf_phy.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
+    }
+  }
+
+  resp.pnf_rf.tl.tag = NFAPI_PNF_RF_TAG;
+  resp.pnf_rf.number_of_rfs = 2;
+
+  for(int i = 0; i < 2; ++i) {
+    resp.pnf_rf.rf[i].rf_config_index = pnf->rfs[i].index; 
+    resp.pnf_rf.rf[i].band = pnf->rfs[i].band;
+    resp.pnf_rf.rf[i].maximum_transmit_power = pnf->rfs[i].max_transmit_power; 
+    resp.pnf_rf.rf[i].minimum_transmit_power = pnf->rfs[i].min_transmit_power;
+    resp.pnf_rf.rf[i].number_of_antennas_suppported = pnf->rfs[i].num_antennas_supported;
+    resp.pnf_rf.rf[i].minimum_downlink_frequency = pnf->rfs[i].min_downlink_frequency;
+    resp.pnf_rf.rf[i].maximum_downlink_frequency = pnf->rfs[i].max_downlink_frequency;
+    resp.pnf_rf.rf[i].minimum_uplink_frequency = pnf->rfs[i].min_uplink_frequency;
+    resp.pnf_rf.rf[i].maximum_uplink_frequency = pnf->rfs[i].max_uplink_frequency;
+  }
+
+  if(pnf->release >= 10) {
+    resp.pnf_phy_rel10.tl.tag = NFAPI_PNF_PHY_REL10_TAG;
+    resp.pnf_phy_rel10.number_of_phys = 1;
+
+    for(int i = 0; i < 1; ++i)
+    {
+      resp.pnf_phy_rel10.phy[i].phy_config_index = pnf->phys[i].index; 
+      resp.pnf_phy_rel10.phy[i].transmission_mode_7_supported = 0;
+      resp.pnf_phy_rel10.phy[i].transmission_mode_8_supported = 1;
+      resp.pnf_phy_rel10.phy[i].two_antenna_ports_for_pucch = 0;
+      resp.pnf_phy_rel10.phy[i].transmission_mode_9_supported = 1;
+      resp.pnf_phy_rel10.phy[i].simultaneous_pucch_pusch = 0;
+      resp.pnf_phy_rel10.phy[i].four_layer_tx_with_tm3_and_tm4 = 1;
+    }
+  }
+
+  if(pnf->release >= 11) {
+    resp.pnf_phy_rel11.tl.tag = NFAPI_PNF_PHY_REL11_TAG;
+    resp.pnf_phy_rel11.number_of_phys = 1;
+
+    for(int i = 0; i < 1; ++i) {
+      resp.pnf_phy_rel11.phy[i].phy_config_index = pnf->phys[i].index; 
+      resp.pnf_phy_rel11.phy[i].edpcch_supported = 0;
+      resp.pnf_phy_rel11.phy[i].multi_ack_csi_reporting = 1;
+      resp.pnf_phy_rel11.phy[i].pucch_tx_diversity = 0;
+      resp.pnf_phy_rel11.phy[i].ul_comp_supported = 1;
+      resp.pnf_phy_rel11.phy[i].transmission_mode_5_supported = 0;
+    }
+  }
+
+  if(pnf->release >= 12) {
+    resp.pnf_phy_rel12.tl.tag = NFAPI_PNF_PHY_REL12_TAG;
+    resp.pnf_phy_rel12.number_of_phys = 1;
+
+    for(int i = 0; i < 1; ++i) {
+      resp.pnf_phy_rel12.phy[i].phy_config_index = pnf->phys[i].index; 
+      resp.pnf_phy_rel12.phy[i].csi_subframe_set = 0;
+      resp.pnf_phy_rel12.phy[i].enhanced_4tx_codebook = 2;
+      resp.pnf_phy_rel12.phy[i].drs_supported = 0;
+      resp.pnf_phy_rel12.phy[i].ul_64qam_supported = 1;
+      resp.pnf_phy_rel12.phy[i].transmission_mode_10_supported = 0;
+      resp.pnf_phy_rel12.phy[i].alternative_bts_indices = 1;
+    }
+  }
+
+  if(pnf->release >= 13) {
+    resp.pnf_phy_rel13.tl.tag = NFAPI_PNF_PHY_REL13_TAG;
+    resp.pnf_phy_rel13.number_of_phys = 1;
+
+    for(int i = 0; i < 1; ++i) {
+      resp.pnf_phy_rel13.phy[i].phy_config_index = pnf->phys[i].index; 
+      resp.pnf_phy_rel13.phy[i].pucch_format4_supported = 0;
+      resp.pnf_phy_rel13.phy[i].pucch_format5_supported = 1;
+      resp.pnf_phy_rel13.phy[i].more_than_5_ca_support = 0;
+      resp.pnf_phy_rel13.phy[i].laa_supported = 1;
+      resp.pnf_phy_rel13.phy[i].laa_ending_in_dwpts_supported = 0;
+      resp.pnf_phy_rel13.phy[i].laa_starting_in_second_slot_supported = 1;
+      resp.pnf_phy_rel13.phy[i].beamforming_supported = 0;
+      resp.pnf_phy_rel13.phy[i].csi_rs_enhancement_supported = 1;
+      resp.pnf_phy_rel13.phy[i].drms_enhancement_supported = 0;
+      resp.pnf_phy_rel13.phy[i].srs_enhancement_supported = 1;
+    }
+
+    resp.pnf_phy_rel13_nb_iot.tl.tag = NFAPI_PNF_PHY_REL13_NB_IOT_TAG;
+    resp.pnf_phy_rel13_nb_iot.number_of_phys = 1;
+
+    for(int i = 0; i < 1; ++i) {
+      resp.pnf_phy_rel13_nb_iot.phy[i].phy_config_index = pnf->phys[i].index; 
+
+      resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rfs = 1;
+      for(int j = 0; j < 1; ++j) {
+        resp.pnf_phy_rel13_nb_iot.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
+      }
+
+      resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rf_exclusions = 1;
+      for(int j = 0; j < 1; ++j) {
+        resp.pnf_phy_rel13_nb_iot.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
+      }
+
+      resp.pnf_phy_rel13_nb_iot.phy[i].number_of_dl_layers_supported = pnf->phys[i].num_dl_layers_supported;
+      resp.pnf_phy_rel13_nb_iot.phy[i].number_of_ul_layers_supported = pnf->phys[i].num_ul_layers_supported;
+      resp.pnf_phy_rel13_nb_iot.phy[i].maximum_3gpp_release_supported = pnf->phys[i].release_supported;
+      resp.pnf_phy_rel13_nb_iot.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
+    }
+  }
+
+  nfapi_pnf_pnf_param_resp(config, &resp);
+
+  return 0;
+}
+
+int pnf_config_request(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req) {
+
+  printf("[PNF] pnf config request\n");
+
+  pnf_info* pnf = (pnf_info*)(config->user_data);
+
+  phy_info *phy = pnf->phys;
+  phy->id = req->pnf_phy_rf_config.phy_rf_config[0].phy_id;
+  printf("[PNF] pnf config request assigned phy_id %d to phy_config_index %d\n", phy->id, req->pnf_phy_rf_config.phy_rf_config[0].phy_config_index);
+
+  nfapi_pnf_config_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
+  resp.error_code = NFAPI_MSG_OK;
+  nfapi_pnf_pnf_config_resp(config, &resp);
+  printf("[PNF] Sent pnf_config_resp\n");
+
+  return 0;
+}
+
+void nfapi_send_pnf_start_resp(nfapi_pnf_config_t* config, uint16_t phy_id) {
+
+  printf("Sending NFAPI_START_RESPONSE config:%p phy_id:%d\n", config, phy_id);
+
+  nfapi_start_response_t start_resp;
+  memset(&start_resp, 0, sizeof(start_resp));
+  start_resp.header.message_id = NFAPI_START_RESPONSE;
+  start_resp.header.phy_id = phy_id;
+  start_resp.error_code = NFAPI_MSG_OK;
+
+  nfapi_pnf_start_resp(config, &start_resp);
+}
+
+int pnf_start_request(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req) {
+
+  printf("Received NFAPI_PNF_START_REQUEST\n");
+
+  pnf_info* pnf = (pnf_info*)(config->user_data);
+
+  // start all phys that have been configured
+  phy_info* phy = pnf->phys;
+
+  if(phy->id != 0) {
+    nfapi_pnf_start_response_t resp;
+    memset(&resp, 0, sizeof(resp));
+    resp.header.message_id = NFAPI_PNF_START_RESPONSE;
+    resp.error_code = NFAPI_MSG_OK;
+    nfapi_pnf_pnf_start_resp(config, &resp);
+    printf("[PNF] Sent NFAPI_PNF_START_RESP\n");
+  }
+  return 0;
+}
+
+int pnf_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_stop_request_t* req) {
+
+  printf("[PNF] Received NFAPI_PNF_STOP_REQ\n");
+
+  nfapi_pnf_stop_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_PNF_STOP_RESPONSE;
+  resp.error_code = NFAPI_MSG_OK;
+  nfapi_pnf_pnf_stop_resp(config, &resp);
+  printf("[PNF] Sent NFAPI_PNF_STOP_REQ\n");
+
+  return 0;
+}
+
+int param_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req) {
+
+  printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id);
+
+  //pnf_info* pnf = (pnf_info*)(config->user_data);
+
+  nfapi_param_response_t nfapi_resp;
+
+  pnf_info* pnf = (pnf_info*)(config->user_data);
+
+  memset(&nfapi_resp, 0, sizeof(nfapi_resp));
+  nfapi_resp.header.message_id = NFAPI_PARAM_RESPONSE;
+  nfapi_resp.header.phy_id = req->header.phy_id;
+  nfapi_resp.error_code = 0; // DJP - what value???
+
+  struct sockaddr_in pnf_p7_sockaddr;
+
+  pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
+  nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
+  memcpy(nfapi_resp.nfapi_config.p7_pnf_address_ipv4.address, &pnf_p7_sockaddr.sin_addr.s_addr, 4);
+  nfapi_resp.num_tlv++;
+
+  // P7 PNF Port
+  nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
+  nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; // DJP - hard code alert!!!! FIXME TODO
+  nfapi_resp.num_tlv++;
+
+  nfapi_pnf_param_resp(config, &nfapi_resp);
+
+  printf("[PNF] Sent NFAPI_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv);
+
+  printf("[PNF] param request .. exit\n");
+
+  return 0;
+}
+
+int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req) {
+
+  printf("[PNF] Received NFAPI_CONFIG_REQ phy_id:%d\n", req->header.phy_id);
+
+  pnf_info* pnf = (pnf_info*)(config->user_data);
+  uint8_t num_tlv = 0;
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+  LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
+
+  phy_info* phy_info = pnf->phys;
+
+  if(req->nfapi_config.timing_window.tl.tag == NFAPI_NFAPI_TIMING_WINDOW_TAG) {
+    phy_info->timing_window = req->nfapi_config.timing_window.value;
+    printf("Phy_info:Timing window:%u NFAPI_CONFIG:timing_window:%u\n", phy_info->timing_window, req->nfapi_config.timing_window.value);
+    num_tlv++;
+  }
+
+  if(req->nfapi_config.timing_info_mode.tl.tag == NFAPI_NFAPI_TIMING_INFO_MODE_TAG) {
+    printf("timing info mode:%d\n", req->nfapi_config.timing_info_mode.value);
+    phy_info->timing_info_mode = req->nfapi_config.timing_info_mode.value;
+    num_tlv++;
+  } else {
+    phy_info->timing_info_mode = 0;
+    printf("NO timing info mode provided\n");
+  }
+
+  if(req->nfapi_config.timing_info_period.tl.tag == NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG) {
+    printf("timing info period provided value:%d\n", req->nfapi_config.timing_info_period.value);
+    phy_info->timing_info_period = req->nfapi_config.timing_info_period.value;
+    num_tlv++;
+  } else {
+    phy_info->timing_info_period = 0;
+  }
+
+  if(req->rf_config.dl_channel_bandwidth.tl.tag == NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG) {
+    phy_info->dl_channel_bw_support = req->rf_config.dl_channel_bandwidth.value;
+    fp->N_RB_DL = req->rf_config.dl_channel_bandwidth.value;
+    num_tlv++;
+    NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG N_RB_DL:%u\n", __FUNCTION__, fp->N_RB_DL);
+  } else {
+    NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Missing NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG\n", __FUNCTION__);
+  }
+
+  if(req->rf_config.ul_channel_bandwidth.tl.tag == NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG) {
+    phy_info->ul_channel_bw_support = req->rf_config.ul_channel_bandwidth.value;
+    fp->N_RB_UL = req->rf_config.ul_channel_bandwidth.value;
+    num_tlv++;
+  }
+
+  if(req->nfapi_config.rf_bands.tl.tag == NFAPI_NFAPI_RF_BANDS_TAG) {
+    pnf->rfs[0].band = req->nfapi_config.rf_bands.rf_band[0];
+    fp->eutra_band = req->nfapi_config.rf_bands.rf_band[0];
+    num_tlv++;
+  }
+
+  if(req->nfapi_config.earfcn.tl.tag == NFAPI_NFAPI_EARFCN_TAG) {
+    fp->dl_CarrierFreq = from_earfcn(fp->eutra_band, req->nfapi_config.earfcn.value);
+    fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(fp->eutra_band) * 1e5);
+    num_tlv++;
+
+    NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() earfcn:%u dl_carrierFreq:%u ul_CarrierFreq:%u band:%u N_RB_DL:%u\n", 
+        __FUNCTION__, req->nfapi_config.earfcn.value, fp->dl_CarrierFreq, fp->ul_CarrierFreq, pnf->rfs[0].band, fp->N_RB_DL);
+  }
+
+  if (req->subframe_config.duplex_mode.tl.tag == NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG) {
+    fp->frame_type = req->subframe_config.duplex_mode.value==0 ? TDD : FDD;
+    num_tlv++;
+    NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() frame_type:%d\n", __FUNCTION__, fp->frame_type);
+  }
+
+  if (req->subframe_config.dl_cyclic_prefix_type.tl.tag == NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG) {
+    fp->Ncp = req->subframe_config.dl_cyclic_prefix_type.value;
+    num_tlv++;
+  }
+
+  if (req->subframe_config.ul_cyclic_prefix_type.tl.tag == NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG) {
+    fp->Ncp_UL = req->subframe_config.ul_cyclic_prefix_type.value;
+    num_tlv++;
+  }
+
+  fp->num_MBSFN_config = 0; // DJP - hard code alert
+
+  if (req->sch_config.physical_cell_id.tl.tag == NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG) {
+    fp->Nid_cell = req->sch_config.physical_cell_id.value;
+    fp->nushift = fp->Nid_cell%6;
+    num_tlv++;
+  }
+
+  if (req->rf_config.tx_antenna_ports.tl.tag == NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG) {
+    fp->nb_antennas_tx = req->rf_config.tx_antenna_ports.value;
+    fp->nb_antenna_ports_eNB = 1;
+    num_tlv++;
+  }
+
+  if (req->rf_config.rx_antenna_ports.tl.tag == NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG) {
+    fp->nb_antennas_rx = req->rf_config.rx_antenna_ports.value;
+    num_tlv++;
+  }
+
+  if (req->phich_config.phich_resource.tl.tag == NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG) {
+    fp->phich_config_common.phich_resource = req->phich_config.phich_resource.value;
+    num_tlv++;
+  }
+
+  if (req->phich_config.phich_duration.tl.tag == NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG) {
+    fp->phich_config_common.phich_duration = req->phich_config.phich_duration.value;
+    num_tlv++;
+  }
+
+  if (req->phich_config.phich_power_offset.tl.tag == NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG) {
+    LOG_E(PHY, "%s() NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG tag:%d not supported\n", __FUNCTION__, req->phich_config.phich_power_offset.tl.tag);
+    //fp->phich_config_common.phich_power_offset = req->phich_config.
+    num_tlv++;
+  }
+
+  // UL RS Config
+  if (req->uplink_reference_signal_config.cyclic_shift_1_for_drms.tl.tag == NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG) {
+    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = req->uplink_reference_signal_config.cyclic_shift_1_for_drms.value;
+    num_tlv++;
+  }
+
+  if (req->uplink_reference_signal_config.uplink_rs_hopping.tl.tag == NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG) {
+    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = req->uplink_reference_signal_config.uplink_rs_hopping.value;
+    num_tlv++;
+  }
+
+  if (req->uplink_reference_signal_config.group_assignment.tl.tag == NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG) {
+    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = req->uplink_reference_signal_config.group_assignment.value;
+    num_tlv++;
+  }
+
+  if (req->pusch_config.hopping_mode.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG) {
+  }  // DJP - not being handled?
+
+  if (req->pusch_config.hopping_offset.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG) {
+  }  // DJP - not being handled?
+
+  if (req->pusch_config.number_of_subbands.tl.tag == NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG) {
+  }  // DJP - not being handled?
+
+  if (req->prach_config.configuration_index.tl.tag == NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG) {
+    fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=req->prach_config.configuration_index.value;
+    num_tlv++;
+  }
+
+  if (req->prach_config.root_sequence_index.tl.tag == NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG) {
+    fp->prach_config_common.rootSequenceIndex=req->prach_config.root_sequence_index.value;
+    num_tlv++;
+  }
+
+  if (req->prach_config.zero_correlation_zone_configuration.tl.tag == NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG) {
+    fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=req->prach_config.zero_correlation_zone_configuration.value;
+    num_tlv++;
+  }
+
+  if (req->prach_config.high_speed_flag.tl.tag == NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG) {
+    fp->prach_config_common.prach_ConfigInfo.highSpeedFlag=req->prach_config.high_speed_flag.value;
+    num_tlv++;
+  }
+
+  if (req->prach_config.frequency_offset.tl.tag == NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG) {
+    fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset=req->prach_config.frequency_offset.value;
+    num_tlv++;
+  }
+
+  printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
+
+  printf("[PNF] Simulating PHY CONFIG - DJP\n");
+  PHY_Config_t phy_config;
+  phy_config.Mod_id = 0;
+  phy_config.CC_id=0;
+  phy_config.cfg = req;
+
+  phy_config_request(&phy_config);
+
+  dump_frame_parms(fp);
+
+  phy_info->remote_port = req->nfapi_config.p7_vnf_port.value;
+
+  struct sockaddr_in vnf_p7_sockaddr;
+  memcpy(&vnf_p7_sockaddr.sin_addr.s_addr, &(req->nfapi_config.p7_vnf_address_ipv4.address[0]), 4);
+  phy_info->remote_addr = inet_ntoa(vnf_p7_sockaddr.sin_addr);
+
+  printf("[PNF] %d vnf p7 %s:%d timing %d %d %d\n", phy_info->id, phy_info->remote_addr, phy_info->remote_port, 
+      phy_info->timing_window, phy_info->timing_info_mode, phy_info->timing_info_period);
+
+  nfapi_config_response_t nfapi_resp;
+  memset(&nfapi_resp, 0, sizeof(nfapi_resp));
+  nfapi_resp.header.message_id = NFAPI_CONFIG_RESPONSE;
+  nfapi_resp.header.phy_id = phy_info->id;
+  nfapi_resp.error_code = 0; // DJP - some value resp->error_code;
+  nfapi_pnf_config_resp(config, &nfapi_resp);
+  printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
+
+  return 0;
+}
+
+nfapi_p7_message_header_t* pnf_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size) {
+
+  if(message_id == P7_VENDOR_EXT_REQ) {
+    (*msg_size) = sizeof(vendor_ext_p7_req);
+    return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_req));
+  }
+
+  return 0;
+}
+
+void pnf_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header) {
+
+  free(header);
+}
+
+int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req) {
+
+  if (req->hi_dci0_request_body.number_of_dci == 0 && req->hi_dci0_request_body.number_of_hi == 0)
+    LOG_D(PHY,"[PNF] HI_DCI0_REQUEST SFN/SF:%05d dci:%d hi:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), req->hi_dci0_request_body.number_of_dci, req->hi_dci0_request_body.number_of_hi);
+
+  //phy_info* phy = (phy_info*)(pnf_p7->user_data);
+
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+  eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
+
+  for (int i=0; i<req->hi_dci0_request_body.number_of_dci + req->hi_dci0_request_body.number_of_hi; i++) {
+
+    //LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d]\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
+
+    if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) {
+
+      //LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_DCI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
+
+      nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu = &req->hi_dci0_request_body.hi_dci0_pdu_list[i];
+
+      handle_nfapi_hi_dci0_dci_pdu(eNB,NFAPI_SFNSF2SFN(req->sfn_sf),NFAPI_SFNSF2SF(req->sfn_sf),proc,hi_dci0_req_pdu);
+
+      eNB->pdcch_vars[NFAPI_SFNSF2SF(req->sfn_sf)&1].num_dci++;
+
+    } else if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type == NFAPI_HI_DCI0_HI_PDU_TYPE) {
+
+      LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_HI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
+
+      nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu = &req->hi_dci0_request_body.hi_dci0_pdu_list[i];
+
+      handle_nfapi_hi_dci0_hi_pdu(eNB, NFAPI_SFNSF2SFN(req->sfn_sf),NFAPI_SFNSF2SF(req->sfn_sf), proc, hi_dci0_req_pdu);
+
+    } else {
+
+      LOG_E(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - unknown pdu type:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), i, req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type);
+
+    }
+  }
+
+  return 0;
+}
+
+int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req) {
+
+  if (RC.ru == 0) {
+    return -1;
+  }
+
+  if (RC.eNB == 0) {
+    return -2;
+  }
+
+  if (RC.eNB[0][0] == 0) {
+    return -3;
+  }
+
+  if (sync_var != 0) { 
+    NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() Main system not up - is this a dummy subframe?\n", __FUNCTION__);
+    return -4;
+  }
+
+  int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
+  int sf = NFAPI_SFNSF2SF(req->sfn_sf);
+
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+  eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
+  nfapi_dl_config_request_pdu_t* dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list;
+  LTE_eNB_PDCCH *pdcch_vars = &eNB->pdcch_vars[sf&1];
+
+  pdcch_vars->num_pdcch_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols;
+  pdcch_vars->num_dci = 0;
+
+  if (req->dl_config_request_body.number_dci || 
+      req->dl_config_request_body.number_pdu ||
+      req->dl_config_request_body.number_pdsch_rnti)
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d sfn_sf:%d pdcch:%u dl_cfg[dci:%u pdus:%d pdsch_rnti:%d] pcfich:%u\n", 
+      __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, 
+      NFAPI_SFNSF2DEC(req->sfn_sf), 
+      req->dl_config_request_body.number_pdcch_ofdm_symbols, 
+      req->dl_config_request_body.number_dci, 
+      req->dl_config_request_body.number_pdu, 
+      req->dl_config_request_body.number_pdsch_rnti, 
+      req->dl_config_request_body.transmission_power_pcfich);
+
+  for (int i=0;i<req->dl_config_request_body.number_pdu;i++) {
+
+    NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d pdcch_vars->num_dci:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size,pdcch_vars->num_dci);
+
+    if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
+
+      handle_nfapi_dci_dl_pdu(eNB,NFAPI_SFNSF2SFN(req->sfn_sf),NFAPI_SFNSF2SF(req->sfn_sf),proc,&dl_config_pdu_list[i]);
+
+      pdcch_vars->num_dci++; // Is actually number of DCI PDUs
+
+      NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() pdcch_vars->num_dci:%d\n", __FUNCTION__, pdcch_vars->num_dci);
+
+    } else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
+
+      nfapi_dl_config_bch_pdu *bch_pdu = &dl_config_pdu_list[i].bch_pdu;
+      uint16_t pdu_index = bch_pdu->bch_pdu_rel8.pdu_index;
+
+      if (tx_request_pdu[sfn][sf][pdu_index] != NULL) {
+
+        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU:%d BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, i, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]);
+
+        handle_nfapi_bch_pdu(eNB, proc, &dl_config_pdu_list[i], tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_data);
+
+        eNB->pbch_configured=1;
+
+      } else {
+
+        NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() BCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pdu_index); 
+      }
+    } else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
+
+      nfapi_dl_config_dlsch_pdu *dlsch_pdu = &dl_config_pdu_list[i].dlsch_pdu;
+      nfapi_dl_config_dlsch_pdu_rel8_t *rel8_pdu = &dlsch_pdu->dlsch_pdu_rel8;
+      nfapi_tx_request_pdu_t *tx_pdu = tx_request_pdu[sfn][sf][rel8_pdu->pdu_index];
+
+      if (tx_pdu != NULL) {
+        int UE_id = find_dlsch(rel8_pdu->rnti,eNB,SEARCH_EXIST_OR_FREE);
+        AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
+        AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
+        LTE_eNB_DLSCH_t *dlsch0 = eNB->dlsch[UE_id][0];
+        //LTE_eNB_DLSCH_t *dlsch1 = eNB->dlsch[UE_id][1];
+        int harq_pid = dlsch0->harq_ids[sf];
+        uint8_t *dlsch_sdu = tx_pdus[UE_id][harq_pid];
+        
+        memcpy(dlsch_sdu, tx_pdu->segments[0].segment_data, tx_pdu->segments[0].segment_length);
+
+        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols);
+
+        handle_nfapi_dlsch_pdu( eNB, sfn,sf, &eNB->proc.proc_rxtx[0], &dl_config_pdu_list[i], rel8_pdu->transport_blocks-1, dlsch_sdu);
+
+      } else {
+
+        NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() DLSCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), rel8_pdu->pdu_index);
+      }
+
+    } else {
+      NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_config_pdu_list[i].pdu_type);
+    }
+  }
+
+  if(req->vendor_extension)
+    free(req->vendor_extension);
+
+  return 0;
+}
+
+int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) {
+
+  uint16_t sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
+  uint16_t sf = NFAPI_SFNSF2SF(req->sfn_sf);
+
+  if (req->tx_request_body.number_of_pdus==0)
+    LOG_D(PHY,"%s() SFN/SF:%d%d PDUs:%d\n", __FUNCTION__, sfn, sf, req->tx_request_body.number_of_pdus);
+
+  if (req->tx_request_body.tl.tag==NFAPI_TX_REQUEST_BODY_TAG) {
+    for (int i=0; i<req->tx_request_body.number_of_pdus; i++) {
+      LOG_D(PHY,"%s() SFN/SF:%d%d number_of_pdus:%d [PDU:%d] pdu_length:%d pdu_index:%d num_segments:%d\n",
+          __FUNCTION__,
+          sfn, sf,
+          req->tx_request_body.number_of_pdus,
+          i,
+          req->tx_request_body.tx_pdu_list[i].pdu_length,
+          req->tx_request_body.tx_pdu_list[i].pdu_index,
+          req->tx_request_body.tx_pdu_list[i].num_segments
+          );
+
+      tx_request_pdu[sfn][sf][i] = &req->tx_request_body.tx_pdu_list[i];
+    }
+  }
+
+  return 0;
+}
+
+int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req) {
+
+  if (0)LOG_D(PHY,"[PNF] UL_CONFIG_REQ %s() sfn_sf:%d pdu:%d rach_prach_frequency_resources:%d srs_present:%u\n", 
+      __FUNCTION__,
+      NFAPI_SFNSF2DEC(req->sfn_sf), 
+      req->ul_config_request_body.number_of_pdus,
+      req->ul_config_request_body.rach_prach_frequency_resources,
+      req->ul_config_request_body.srs_present
+      );
+
+  if (RC.ru == 0) {
+    return -1;
+  }
+
+  if (RC.eNB == 0) {
+    return -2;
+  }
+
+  if (RC.eNB[0][0] == 0) {
+    return -3;
+  }
+
+  if (sync_var != 0) { 
+    NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() Main system not up - is this a dummy subframe?\n", __FUNCTION__);
+    return -4;
+  }
+
+  uint16_t curr_sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
+  uint16_t curr_sf = NFAPI_SFNSF2SF(req->sfn_sf);
+
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+  eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
+  nfapi_ul_config_request_pdu_t* ul_config_pdu_list = req->ul_config_request_body.ul_config_pdu_list;
+
+  for (int i=0;i<req->ul_config_request_body.number_of_pdus;i++) {
+    //LOG_D(PHY, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, ul_config_pdu_list[i].pdu_size);
+
+    if (
+        ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE ||
+        ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE ||
+        ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE ||
+        ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE ||
+        ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE ||
+        ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE ||
+        ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE
+       ) {
+      //LOG_D(PHY, "%s() handle_nfapi_ul_pdu() for PDU:%d\n", __FUNCTION__, i);
+
+      handle_nfapi_ul_pdu(eNB,proc,&ul_config_pdu_list[i],curr_sfn,curr_sf,req->ul_config_request_body.srs_present);
+    } else {
+      NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() PDU:%i UNKNOWN type :%d\n", __FUNCTION__, i, ul_config_pdu_list[i].pdu_type);
+    }
+  }
+
+  return 0;
+}
+
+int pnf_phy_lbt_dl_config_req(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req) {
+  //printf("[PNF] lbt dl config request\n");
+  return 0;
+}
+
+int pnf_phy_vendor_ext(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg) {
+  if(msg->message_id == P7_VENDOR_EXT_REQ) {
+    //vendor_ext_p7_req* req = (vendor_ext_p7_req*)msg;
+    //printf("[PNF] vendor request (1:%d 2:%d)\n", req->dummy1, req->dummy2);
+  } else {
+    printf("[PNF] unknown vendor ext\n");
+  }
+  return 0;
+}
+
+int pnf_phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codex) {
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+  if(header->message_id == P7_VENDOR_EXT_IND) {
+    vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)(header);
+    if(!push16(ind->error_code, ppWritePackedMsg, end))
+      return 0;
+
+    return 1;
+  }
+  return -1;
+}
+
+int pnf_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* codec) {
+  if(header->message_id == P7_VENDOR_EXT_REQ) {
+    //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+    vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
+    if(!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
+          pull16(ppReadPackedMessage, &req->dummy2, end)))
+      return 0;
+    return 1;
+  }
+  return -1;
+}
+
+int pnf_phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t* end, void** ve, nfapi_p7_codec_config_t* config) {
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_phy_unpack_vendor_extension_tlv\n");
+
+  switch(tl->tag)
+  {
+    case VENDOR_EXT_TLV_1_TAG:
+      *ve = malloc(sizeof(vendor_ext_tlv_1));
+      if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_1*)(*ve))->dummy, end))
+	return 0;
+
+      return 1;
+      break;
+  }
+
+  return -1;
+}
+
+int pnf_phy_pack_vendor_extention_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p7_codec_config_t* config) {
+  //printf("%s\n", __FUNCTION__);
+  (void)ve;
+  (void)ppWritePackedMsg;
+  return -1;
+}
+
+int pnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* config) {
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_unpack_vendor_extension_tlv\n");
+
+  switch(tl->tag)
+  {
+    case VENDOR_EXT_TLV_2_TAG:
+      *ve = malloc(sizeof(vendor_ext_tlv_2));
+      if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_2*)(*ve))->dummy, end))
+	return 0;
+
+      return 1;
+      break;
+  }
+
+  return -1;
+}
+
+int pnf_sim_pack_vendor_extention_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config) {
+  //printf("%s\n", __FUNCTION__);
+  (void)ve;
+  (void)ppWritePackedMsg;
+  return -1;
+}
+
+nfapi_dl_config_request_t dummy_dl_config_req;
+nfapi_tx_request_t dummy_tx_req;
+
+nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
+
+int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req) {
+
+  printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
+
+  nfapi_set_trace_level(NFAPI_TRACE_INFO);
+
+  pnf_info* pnf = (pnf_info*)(config->user_data);
+
+  phy_info* phy_info = pnf->phys;
+
+  nfapi_pnf_p7_config_t* p7_config = nfapi_pnf_p7_config_create();
+
+  p7_config->phy_id = phy->phy_id;
+
+  p7_config->remote_p7_port = phy_info->remote_port;
+  p7_config->remote_p7_addr = phy_info->remote_addr;
+  p7_config->local_p7_port = 32123; // DJP - good grief cannot seem to get the right answer phy_info->local_port;
+  //DJP p7_config->local_p7_addr = (char*)phy_info->local_addr.c_str();
+  p7_config->local_p7_addr = phy_info->local_addr;
+
+  printf("[PNF] P7 remote:%s:%d local:%s:%d\n", p7_config->remote_p7_addr, p7_config->remote_p7_port, p7_config->local_p7_addr, p7_config->local_p7_port);
+
+  p7_config->user_data = phy_info;
+
+  p7_config->malloc = &pnf_allocate;
+  p7_config->free = &pnf_deallocate;
+  p7_config->codec_config.allocate = &pnf_allocate;
+  p7_config->codec_config.deallocate = &pnf_deallocate;
+
+  p7_config->trace = &pnf_nfapi_trace;
+
+  phy->user_data = p7_config;
+
+  p7_config->subframe_buffer_size = phy_info->timing_window;
+  printf("subframe_buffer_size configured using phy_info->timing_window:%d\n", phy_info->timing_window);
+  if(phy_info->timing_info_mode & 0x1) {
+    p7_config->timing_info_mode_periodic = 1;
+    p7_config->timing_info_period = phy_info->timing_info_period;
+  }
+
+  if(phy_info->timing_info_mode & 0x2) {
+    p7_config->timing_info_mode_aperiodic = 1;
+  }
+
+  p7_config->dl_config_req = &pnf_phy_dl_config_req;
+  p7_config->ul_config_req = &pnf_phy_ul_config_req;
+  p7_config->hi_dci0_req = &pnf_phy_hi_dci0_req;
+  p7_config->tx_req = &pnf_phy_tx_req;
+  p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
+
+  memset(&dummy_dl_config_req, 0, sizeof(dummy_dl_config_req));
+  dummy_dl_config_req.dl_config_request_body.tl.tag=NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+  dummy_dl_config_req.dl_config_request_body.number_pdcch_ofdm_symbols=1;
+  dummy_dl_config_req.dl_config_request_body.number_dci=0;
+  dummy_dl_config_req.dl_config_request_body.number_pdu=0;
+  dummy_dl_config_req.dl_config_request_body.number_pdsch_rnti=0;
+  dummy_dl_config_req.dl_config_request_body.transmission_power_pcfich=6000;
+  dummy_dl_config_req.dl_config_request_body.dl_config_pdu_list=0;
+
+  memset(&dummy_tx_req, 0, sizeof(dummy_tx_req));
+  dummy_tx_req.tx_request_body.number_of_pdus=0;
+  dummy_tx_req.tx_request_body.tl.tag=NFAPI_TX_REQUEST_BODY_TAG;
+
+  dummy_subframe.dl_config_req = &dummy_dl_config_req;
+  dummy_subframe.tx_req = 0;//&dummy_tx_req;
+
+  dummy_subframe.ul_config_req=0;
+  dummy_subframe.hi_dci0_req=0;
+  dummy_subframe.lbt_dl_config_req=0;
+
+  p7_config->dummy_subframe = dummy_subframe;
+
+  p7_config->vendor_ext = &pnf_phy_vendor_ext;
+
+  p7_config->allocate_p7_vendor_ext = &pnf_phy_allocate_p7_vendor_ext;
+  p7_config->deallocate_p7_vendor_ext = &pnf_phy_deallocate_p7_vendor_ext;
+
+  p7_config->codec_config.unpack_p7_vendor_extension = &pnf_phy_unpack_p7_vendor_extension;
+  p7_config->codec_config.pack_p7_vendor_extension = &pnf_phy_pack_p7_vendor_extension;
+  p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_phy_unpack_vendor_extension_tlv;
+  p7_config->codec_config.pack_vendor_extension_tlv = &pnf_phy_pack_vendor_extention_tlv;
+
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
+  pthread_t p7_thread;
+  pthread_create(&p7_thread, NULL, &pnf_p7_thread_start, p7_config);
+
+  //((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
+
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
+  l1_north_init_eNB();
+
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
+  p7_config_g = p7_config;
+
+  // Need to wait for main thread to create RU structures
+  while(config_sync_var<0) {
+    usleep(5000000);
+    printf("[PNF] waiting for OAI to be configured (eNB/RU)\n");
+  }
+  printf("[PNF] OAI eNB/RU configured\n");
+
+  printf("[PNF] About to call init_eNB_afterRU()\n");
+  init_eNB_afterRU();
+
+  // Signal to main thread that it can carry on - otherwise RU will startup too quickly and it is not initialised
+  pthread_mutex_lock(&nfapi_sync_mutex);
+  nfapi_sync_var=0;
+  pthread_cond_broadcast(&nfapi_sync_cond);
+  pthread_mutex_unlock(&nfapi_sync_mutex);
+
+  while(sync_var<0) {
+    usleep(5000000);
+    printf("[PNF] waiting for OAI to be started\n");
+  }
+
+  printf("[PNF] Sending PNF_START_RESP\n");
+  nfapi_send_pnf_start_resp(config, p7_config->phy_id);
+
+  printf("[PNF] Sending first P7 subframe ind\n");
+  nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct???
+  printf("[PNF] Sent first P7 subframe ind\n");
+
+  return 0;
+}
+
+int measurement_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_measurement_request_t* req) {
+
+  nfapi_measurement_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_MEASUREMENT_RESPONSE;
+  resp.header.phy_id = req->header.phy_id;
+  resp.error_code = NFAPI_MSG_OK;
+  nfapi_pnf_measurement_resp(config, &resp);
+  return 0;
+}
+
+int rssi_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_rssi_request_t* req) {
+
+  nfapi_rssi_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_RSSI_RESPONSE;
+  resp.header.phy_id = req->header.phy_id;
+  resp.error_code = NFAPI_P4_MSG_OK;
+  nfapi_pnf_rssi_resp(config, &resp);
+
+  nfapi_rssi_indication_t ind;
+  memset(&ind, 0, sizeof(ind));
+  ind.header.message_id = NFAPI_RSSI_INDICATION;
+  ind.header.phy_id = req->header.phy_id;
+  ind.error_code = NFAPI_P4_MSG_OK;
+  ind.rssi_indication_body.tl.tag = NFAPI_RSSI_INDICATION_TAG;
+  ind.rssi_indication_body.number_of_rssi = 1;
+  ind.rssi_indication_body.rssi[0] = -42;
+  nfapi_pnf_rssi_ind(config, &ind);
+
+  return 0;
+}
+
+int cell_search_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_cell_search_request_t* req) {
+
+  nfapi_cell_search_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_CELL_SEARCH_RESPONSE;
+  resp.header.phy_id = req->header.phy_id;
+  resp.error_code = NFAPI_P4_MSG_OK;
+  nfapi_pnf_cell_search_resp(config, &resp);
+
+  nfapi_cell_search_indication_t ind;
+  memset(&ind, 0, sizeof(ind));
+  ind.header.message_id = NFAPI_CELL_SEARCH_INDICATION;
+  ind.header.phy_id = req->header.phy_id;
+  ind.error_code = NFAPI_P4_MSG_OK;
+
+  switch(req->rat_type) {
+    case NFAPI_RAT_TYPE_LTE:
+      ind.lte_cell_search_indication.tl.tag = NFAPI_LTE_CELL_SEARCH_INDICATION_TAG;
+      ind.lte_cell_search_indication.number_of_lte_cells_found = 1;
+      ind.lte_cell_search_indication.lte_found_cells[0].pci = 123;
+      ind.lte_cell_search_indication.lte_found_cells[0].rsrp = 123;
+      ind.lte_cell_search_indication.lte_found_cells[0].rsrq = 123;
+      ind.lte_cell_search_indication.lte_found_cells[0].frequency_offset = 123;
+      break;
+    case NFAPI_RAT_TYPE_UTRAN:
+      {
+        ind.utran_cell_search_indication.tl.tag = NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG;
+        ind.utran_cell_search_indication.number_of_utran_cells_found = 1;
+        ind.utran_cell_search_indication.utran_found_cells[0].psc = 89;
+        ind.utran_cell_search_indication.utran_found_cells[0].rscp = 89;
+        ind.utran_cell_search_indication.utran_found_cells[0].ecno = 89;
+        ind.utran_cell_search_indication.utran_found_cells[0].frequency_offset = -89;
+
+      }
+      break;
+    case NFAPI_RAT_TYPE_GERAN:
+      {
+        ind.geran_cell_search_indication.tl.tag = NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG;
+        ind.geran_cell_search_indication.number_of_gsm_cells_found = 1;
+        ind.geran_cell_search_indication.gsm_found_cells[0].bsic = 23;
+        ind.geran_cell_search_indication.gsm_found_cells[0].rxlev = 23;
+        ind.geran_cell_search_indication.gsm_found_cells[0].rxqual = 23;
+        ind.geran_cell_search_indication.gsm_found_cells[0].frequency_offset = -23;
+        ind.geran_cell_search_indication.gsm_found_cells[0].sfn_offset = 230;
+
+      }
+      break;
+  }
+
+  ind.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+  ind.pnf_cell_search_state.length = 3;
+
+  nfapi_pnf_cell_search_ind(config, &ind);	
+
+  return 0;
+}
+
+int broadcast_detect_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_broadcast_detect_request_t* req)
+{
+  nfapi_broadcast_detect_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_BROADCAST_DETECT_RESPONSE;
+  resp.header.phy_id = req->header.phy_id;
+  resp.error_code = NFAPI_P4_MSG_OK;
+  nfapi_pnf_broadcast_detect_resp(config, &resp);
+
+  nfapi_broadcast_detect_indication_t ind;
+  memset(&ind, 0, sizeof(ind));
+  ind.header.message_id = NFAPI_BROADCAST_DETECT_INDICATION;
+  ind.header.phy_id = req->header.phy_id;
+  ind.error_code = NFAPI_P4_MSG_OK;
+
+  switch(req->rat_type)
+  {
+    case NFAPI_RAT_TYPE_LTE:
+      {
+        ind.lte_broadcast_detect_indication.tl.tag = NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG;
+        ind.lte_broadcast_detect_indication.number_of_tx_antenna = 1;
+        ind.lte_broadcast_detect_indication.mib_length = 4;
+        //ind.lte_broadcast_detect_indication.mib...
+        ind.lte_broadcast_detect_indication.sfn_offset = 77;
+
+      }
+      break;
+    case NFAPI_RAT_TYPE_UTRAN:
+      {
+        ind.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG;
+        ind.utran_broadcast_detect_indication.mib_length = 4;
+        //ind.utran_broadcast_detect_indication.mib...
+        // ind.utran_broadcast_detect_indication.sfn_offset; DJP - nonsense line
+
+      }
+      break;
+  }
+
+  ind.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+  ind.pnf_cell_broadcast_state.length = 3;
+
+  nfapi_pnf_broadcast_detect_ind(config, &ind);	
+
+  return 0;
+}
+
+int system_information_schedule_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_schedule_request_t* req)
+{
+  nfapi_system_information_schedule_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE;
+  resp.header.phy_id = req->header.phy_id;
+  resp.error_code = NFAPI_P4_MSG_OK;
+  nfapi_pnf_system_information_schedule_resp(config, &resp);
+
+  nfapi_system_information_schedule_indication_t ind;
+  memset(&ind, 0, sizeof(ind));
+  ind.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION;
+  ind.header.phy_id = req->header.phy_id;
+  ind.error_code = NFAPI_P4_MSG_OK;
+
+  ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
+  ind.lte_system_information_indication.sib_type = 3;
+  ind.lte_system_information_indication.sib_length = 5;
+  //ind.lte_system_information_indication.sib...
+
+  nfapi_pnf_system_information_schedule_ind(config, &ind);		
+
+  return 0;
+}
+
+int system_information_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_request_t* req)
+{
+  nfapi_system_information_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_SYSTEM_INFORMATION_RESPONSE;
+  resp.header.phy_id = req->header.phy_id;
+  resp.error_code = NFAPI_P4_MSG_OK;
+  nfapi_pnf_system_information_resp(config, &resp);
+
+  nfapi_system_information_indication_t ind;
+  memset(&ind, 0, sizeof(ind));
+  ind.header.message_id = NFAPI_SYSTEM_INFORMATION_INDICATION;
+  ind.header.phy_id = req->header.phy_id;
+  ind.error_code = NFAPI_P4_MSG_OK;
+
+  switch(req->rat_type)
+  {
+    case NFAPI_RAT_TYPE_LTE:
+      {
+        ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
+        ind.lte_system_information_indication.sib_type = 1;
+        ind.lte_system_information_indication.sib_length = 3;
+        //ind.lte_system_information_indication.sib...
+      }
+      break;
+    case NFAPI_RAT_TYPE_UTRAN:
+      {
+        ind.utran_system_information_indication.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG;
+        ind.utran_system_information_indication.sib_length = 3;
+        //ind.utran_system_information_indication.sib...
+
+      }
+      break;
+    case NFAPI_RAT_TYPE_GERAN:
+      {
+        ind.geran_system_information_indication.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG;
+        ind.geran_system_information_indication.si_length = 3;
+        //ind.geran_system_information_indication.si...
+
+      }
+      break;
+  }
+
+  nfapi_pnf_system_information_ind(config, &ind);		
+
+  return 0;
+}
+
+int nmm_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nmm_stop_request_t* req)
+{
+  nfapi_nmm_stop_response_t resp;
+  memset(&resp, 0, sizeof(resp));
+  resp.header.message_id = NFAPI_NMM_STOP_RESPONSE;
+  resp.header.phy_id = req->header.phy_id;
+  resp.error_code = NFAPI_P4_MSG_OK;
+  nfapi_pnf_nmm_stop_resp(config, &resp);
+  return 0;
+}
+
+int vendor_ext(nfapi_pnf_config_t* config, nfapi_p4_p5_message_header_t* msg)
+{
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 %s %p\n", __FUNCTION__, msg);
+
+  switch(msg->message_id)
+  {
+    case P5_VENDOR_EXT_REQ:
+      {
+        vendor_ext_p5_req* req = (vendor_ext_p5_req*)msg;
+        NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 Vendor Ext Req (%d %d)\n", req->dummy1, req->dummy2);
+        // send back the P5_VENDOR_EXT_RSP
+        vendor_ext_p5_rsp rsp;
+        memset(&rsp, 0, sizeof(rsp));
+        rsp.header.message_id = P5_VENDOR_EXT_RSP;
+        rsp.error_code = NFAPI_MSG_OK;
+        nfapi_pnf_vendor_extension(config, &rsp.header, sizeof(vendor_ext_p5_rsp));
+      }
+      break;
+  }
+
+  return 0;
+}
+
+nfapi_p4_p5_message_header_t* pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size) {
+
+  if(message_id == P5_VENDOR_EXT_REQ) {
+    (*msg_size) = sizeof(vendor_ext_p5_req);
+    return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_req));
+  }
+
+  return 0;
+}
+
+void pnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header) {
+  free(header);
+}
+
+int pnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config) {
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+  if(header->message_id == P5_VENDOR_EXT_RSP) {
+    vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)(header);
+    return (!push16(rsp->error_code, ppWritePackedMsg, end));
+  }
+  return 0;
+}
+
+int pnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec) {
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+  if(header->message_id == P5_VENDOR_EXT_REQ) {
+    vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
+    return (!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
+          pull16(ppReadPackedMessage, &req->dummy2, end)));
+
+    //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s (%d %d)\n", __FUNCTION__, req->dummy1, req->dummy2);
+  }
+  return 0;
+}
+
+/*------------------------------------------------------------------------------*/
+
+void* pnf_start_thread(void* ptr) {
+
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__);
+
+  nfapi_pnf_config_t *config = (nfapi_pnf_config_t*)ptr;
+
+  struct sched_param sp;
+  sp.sched_priority = 20;
+  pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp);
+
+  nfapi_pnf_start(config);
+
+  return (void*)0;
+}
+
+void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
+
+  printf("%s() PNF\n\n\n\n\n\n", __FUNCTION__);
+
+  nfapi_mode = 1;  // PNF!
+
+  nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+
+  config->vnf_ip_addr = vnf_ip_addr;
+  config->vnf_p5_port = vnf_p5_port;
+
+  pnf.phys[0].udp.enabled = 1;
+  pnf.phys[0].udp.rx_port = pnf_p7_port;
+  pnf.phys[0].udp.tx_port = vnf_p7_port;
+  strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
+
+  strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
+
+  printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n", 
+      __FUNCTION__, 
+      config->vnf_ip_addr, config->vnf_p5_port, 
+      pnf.phys[0].local_addr,
+      pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
+      pnf.phys[0].udp.rx_port);
+
+  config->pnf_param_req = &pnf_param_request;
+  config->pnf_config_req = &pnf_config_request;
+  config->pnf_start_req = &pnf_start_request;
+  config->pnf_stop_req = &pnf_stop_request;
+  config->param_req = &param_request;
+  config->config_req = &config_request;
+  config->start_req = &start_request;
+
+  config->measurement_req = &measurement_request;
+  config->rssi_req = &rssi_request;
+  config->cell_search_req = &cell_search_request;
+  config->broadcast_detect_req = &broadcast_detect_request;
+  config->system_information_schedule_req = &system_information_schedule_request;
+  config->system_information_req = &system_information_request;
+  config->nmm_stop_req = &nmm_stop_request;
+
+  config->vendor_ext = &vendor_ext;
+
+  config->trace = &pnf_nfapi_trace;
+
+  config->user_data = &pnf;
+
+  // To allow custom vendor extentions to be added to nfapi
+  config->codec_config.unpack_vendor_extension_tlv = &pnf_sim_unpack_vendor_extension_tlv;
+  config->codec_config.pack_vendor_extension_tlv = &pnf_sim_pack_vendor_extention_tlv;
+
+  config->allocate_p4_p5_vendor_ext = &pnf_sim_allocate_p4_p5_vendor_ext;
+  config->deallocate_p4_p5_vendor_ext = &pnf_sim_deallocate_p4_p5_vendor_ext;
+
+  config->codec_config.unpack_p4_p5_vendor_extension = &pnf_sim_unpack_p4_p5_vendor_extension;
+  config->codec_config.pack_p4_p5_vendor_extension = &pnf_sim_pack_p4_p5_vendor_extension;
+
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating PNF NFAPI start thread %s\n", __FUNCTION__);
+  pthread_create(&pnf_start_pthread, NULL, &pnf_start_thread, config);
+
+  pthread_setname_np(pnf_start_pthread, "NFAPI_PNF");
+}
+
+void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
+
+  //LOG_D(PHY,"%s(sfn:%d, sf:%d)\n", __FUNCTION__, sfn, sf);
+
+  //TODO FIXME - HACK - DJP - using a global to bodge it in 
+
+  if (p7_config_g != NULL && sync_var==0) {
+
+    uint16_t sfn_sf_tx = sfn<<4 | sf;
+
+    if ((sfn % 100 == 0) && sf==0)
+    {
+      struct timespec ts;
+
+      clock_gettime(CLOCK_MONOTONIC, &ts);
+
+      NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s %d.%d (sfn:%u sf:%u) SFN/SF(TX):%u\n", __FUNCTION__, ts.tv_sec, ts.tv_nsec, sfn, sf, NFAPI_SFNSF2DEC(sfn_sf_tx));
+    }
+
+    int subframe_ret = nfapi_pnf_p7_subframe_ind(p7_config_g, p7_config_g->phy_id, sfn_sf_tx);
+
+    if (subframe_ret) {
+      NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s(frame:%u subframe:%u) SFN/SF(TX):%u - PROBLEM with pnf_p7_subframe_ind()\n", __FUNCTION__, sfn, sf, sfn_sf_tx, NFAPI_SFNSF2DEC(sfn_sf_tx));
+    } else {
+      //NFAPI_TRACE(NFAPI_TRACE_INFO, "***NFAPI subframe handler finished *** \n");
+    }
+  } else {
+  }
+}
+
+int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
+
+  rach_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+
+  LOG_D(PHY, "%s() sfn_sf:%d preambles:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(rach_ind->sfn_sf), rach_ind->rach_indication_body.number_of_preambles);
+
+  return nfapi_pnf_p7_rach_ind(p7_config_g, rach_ind);
+}
+
+int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) {
+
+  harq_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+  harq_ind->header.message_id = NFAPI_HARQ_INDICATION;
+
+  LOG_D(PHY, "%s() sfn_sf:%d number_of_harqs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(harq_ind->sfn_sf), harq_ind->harq_indication_body.number_of_harqs);
+
+  int retval = nfapi_pnf_p7_harq_ind(p7_config_g, harq_ind);
+
+  if (retval != 0)
+    LOG_E(PHY, "%s() sfn_sf:%d number_of_harqs:%d nfapi_pnf_p7_harq_ind()=%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(harq_ind->sfn_sf), harq_ind->harq_indication_body.number_of_harqs, retval);
+
+  return retval;
+}
+
+int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind) {
+
+  crc_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+  crc_ind->header.message_id = NFAPI_CRC_INDICATION;
+
+  //LOG_D(PHY, "%s() sfn_sf:%d number_of_crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(crc_ind->sfn_sf), crc_ind->crc_indication_body.number_of_crcs);
+
+  return nfapi_pnf_p7_crc_ind(p7_config_g, crc_ind);
+}
+
+int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *ind) {
+
+  ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+  ind->header.message_id = NFAPI_RX_CQI_INDICATION;
+
+  //LOG_D(PHY, "%s() sfn_sf:%d number_of_cqis:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
+
+  return nfapi_pnf_p7_cqi_ind(p7_config_g, ind);
+}
+
+int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind) {
+
+  ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+  ind->header.message_id = NFAPI_RX_ULSCH_INDICATION;
+
+  int retval = nfapi_pnf_p7_rx_ind(p7_config_g, ind);
+
+  //LOG_D(PHY,"%s() SFN/SF:%d pdus:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, retval);
+
+  //free(ind.rx_indication_body.rx_pdu_list);
+
+  return retval;
+}
+
+int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind) {
+
+  ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+
+  int retval = nfapi_pnf_p7_sr_ind(p7_config_g, ind);
+
+  //LOG_D(PHY,"%s() SFN/SF:%d srs:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs, retval);
+
+  //free(ind.rx_indication_body.rx_pdu_list);
+
+  return retval;
+}
diff --git a/nfapi/oai_integration/nfapi_pnf.h b/nfapi/oai_integration/nfapi_pnf.h
new file mode 100644
index 0000000000000000000000000000000000000000..e213d785f14ef1c94a41cb61a058d25e7982b6e4
--- /dev/null
+++ b/nfapi/oai_integration/nfapi_pnf.h
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#if !defined(NFAPI_PNF_H__)
+#define NFAPI_PNF_H__
+int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
+void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
+
+#endif
diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c
new file mode 100644
index 0000000000000000000000000000000000000000..e77aa2b3765abd743c7831b7f4fd5443f569677f
--- /dev/null
+++ b/nfapi/oai_integration/nfapi_vnf.c
@@ -0,0 +1,1221 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "nfapi_interface.h"
+#include "nfapi_vnf_interface.h"
+#include "nfapi.h"
+#include "vendor_ext.h"
+
+#include "nfapi_vnf.h"
+
+
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
+typedef struct {
+  uint8_t enabled;
+  uint32_t rx_port;
+  uint32_t tx_port;
+  char tx_addr[80];
+} udp_data;
+
+typedef struct {
+  uint16_t index;
+  uint16_t id;
+  uint8_t rfs[2];
+  uint8_t excluded_rfs[2];
+
+  udp_data udp;
+
+  char local_addr[80];
+  int local_port;
+
+  char* remote_addr;
+  int remote_port;
+
+  uint8_t duplex_mode;
+  uint16_t dl_channel_bw_support;
+  uint16_t ul_channel_bw_support;
+  uint8_t num_dl_layers_supported;
+  uint8_t num_ul_layers_supported;
+  uint16_t release_supported;
+  uint8_t nmm_modes_supported;
+
+  uint8_t dl_ues_per_subframe;
+  uint8_t ul_ues_per_subframe;
+
+  uint8_t first_subframe_ind;
+
+  // timing information recevied from the vnf
+  uint8_t timing_window;
+  uint8_t timing_info_mode;
+  uint8_t timing_info_period;
+
+} phy_info;
+
+typedef struct {
+  uint16_t index;
+  uint16_t band;
+  int16_t max_transmit_power;
+  int16_t min_transmit_power;
+  uint8_t num_antennas_supported;
+  uint32_t min_downlink_frequency;
+  uint32_t max_downlink_frequency;
+  uint32_t max_uplink_frequency;
+  uint32_t min_uplink_frequency;
+} rf_info;
+
+typedef struct {
+
+  int release;
+  phy_info phys[2];
+  rf_info rfs[2];
+
+  uint8_t sync_mode;
+  uint8_t location_mode;
+  uint8_t location_coordinates[6];
+  uint32_t dl_config_timing;
+  uint32_t ul_config_timing;
+  uint32_t tx_timing;
+  uint32_t hi_dci0_timing;
+
+  uint16_t max_phys;
+  uint16_t max_total_bw;
+  uint16_t max_total_dl_layers;
+  uint16_t max_total_ul_layers;
+  uint8_t shared_bands;
+  uint8_t shared_pa;
+  int16_t max_total_power;
+  uint8_t oui;
+
+  uint8_t wireshark_test_mode;
+
+} pnf_info;
+
+typedef struct mac mac_t;
+
+typedef struct mac {
+
+	void* user_data;
+
+	void (*dl_config_req)(mac_t* mac, nfapi_dl_config_request_t* req);
+	void (*ul_config_req)(mac_t* mac, nfapi_ul_config_request_t* req);
+	void (*hi_dci0_req)(mac_t* mac, nfapi_hi_dci0_request_t* req);
+	void (*tx_req)(mac_t* mac, nfapi_tx_request_t* req);
+} mac_t;
+
+typedef struct {
+
+  int local_port;
+  char local_addr[80];
+
+  unsigned timing_window;
+  unsigned periodic_timing_enabled;
+  unsigned aperiodic_timing_enabled;
+  unsigned periodic_timing_period;
+
+  // This is not really the right place if we have multiple PHY, 
+  // should be part of the phy struct
+  udp_data udp;
+
+  uint8_t thread_started;
+
+  nfapi_vnf_p7_config_t* config;
+
+  mac_t* mac;
+
+} vnf_p7_info;
+
+typedef struct {
+
+  uint8_t wireshark_test_mode;
+  pnf_info pnfs[2];
+  vnf_p7_info p7_vnfs[2];
+
+} vnf_info;
+
+int vnf_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec) {
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "vnf_pack_vendor_extension_tlv\n");
+  nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
+  switch(tlv->tag) {
+    case VENDOR_EXT_TLV_2_TAG:
+      {
+        //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_2\n");
+        vendor_ext_tlv_2* ve = (vendor_ext_tlv_2*)tlv;
+        if(!push32(ve->dummy, ppWritePackedMsg, end))
+          return 0;
+        return 1;
+      }
+      break;
+  }
+  return -1;
+}
+
+int vnf_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* codec) {
+  return -1;
+}
+
+void install_schedule_handlers(IF_Module_t *if_inst);
+extern int single_thread_flag;
+extern void init_eNB_afterRU(void);
+extern uint16_t sf_ahead;
+
+void oai_create_enb(void) {
+
+  int bodge_counter=0;
+  PHY_VARS_eNB *eNB = RC.eNB[0][0];
+
+  printf("[VNF] RC.eNB[0][0]. Mod_id:%d CC_id:%d nb_CC[0]:%d abstraction_flag:%d single_thread_flag:%d td:%p te:%p if_inst:%p\n", eNB->Mod_id, eNB->CC_id, RC.nb_CC[0], eNB->abstraction_flag, eNB->single_thread_flag, eNB->td, eNB->te, eNB->if_inst);
+
+  eNB->Mod_id  = bodge_counter;
+  eNB->CC_id   = bodge_counter;
+  eNB->abstraction_flag   = 0;
+  eNB->single_thread_flag = 0;//single_thread_flag;
+  eNB->td                   = ulsch_decoding_data_all;//(single_thread_flag==1) ? ulsch_decoding_data_2thread : ulsch_decoding_data;
+  eNB->te                   = dlsch_encoding_all;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding;
+
+  RC.nb_CC[bodge_counter] = 1;
+
+  if (eNB->if_inst==0) {
+    eNB->if_inst = IF_Module_init(bodge_counter);
+  }
+
+  // This will cause phy_config_request to be installed. That will result in RRC configuring the PHY
+  // that will result in eNB->configured being set to TRUE.
+  // See we need to wait for that to happen otherwise the NFAPI message exchanges won't contain the right parameter values
+  if (RC.eNB[0][0]->if_inst==0 || RC.eNB[0][0]->if_inst->PHY_config_req==0 || RC.eNB[0][0]->if_inst->schedule_response==0) {
+
+    printf("RC.eNB[0][0]->if_inst->PHY_config_req is not installed - install it\n");
+    install_schedule_handlers(RC.eNB[0][0]->if_inst);
+  }
+
+  do {
+    printf("%s() Waiting for eNB to become configured (by RRC/PHY) - need to wait otherwise NFAPI messages won't contain correct values\n", __FUNCTION__);
+    usleep(50000);
+  } while(eNB->configured != 1);
+
+  printf("%s() eNB is now configured\n", __FUNCTION__);
+}
+
+void oai_enb_init(void) {
+
+  printf("%s() About to call init_eNB_afterRU()\n", __FUNCTION__);
+  init_eNB_afterRU();
+}
+
+int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx) {
+
+  printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
+
+  oai_create_enb();
+
+  nfapi_pnf_param_request_t req;
+  memset(&req, 0, sizeof(req));
+  req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
+  nfapi_vnf_pnf_param_req(config, p5_idx, &req);
+  return 0;
+}
+
+int pnf_disconnection_indication_cb(nfapi_vnf_config_t* config, int p5_idx) {
+  printf("[VNF] pnf disconnection indication idx:%d\n", p5_idx);
+
+  vnf_info* vnf = (vnf_info*)(config->user_data);
+
+  pnf_info *pnf = vnf->pnfs;
+  phy_info *phy = pnf->phys;
+
+  vnf_p7_info* p7_vnf = vnf->p7_vnfs;
+  nfapi_vnf_p7_del_pnf((p7_vnf->config), phy->id);
+
+  return 0;
+}
+
+int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp) {
+
+  printf("[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
+
+  vnf_info* vnf = (vnf_info*)(config->user_data);
+
+  pnf_info *pnf = vnf->pnfs;
+
+  for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
+  {
+    phy_info phy;
+    phy.index = resp->pnf_phy.phy[i].phy_config_index;
+
+    printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
+
+    nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
+
+    for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j)
+    {
+      printf("[VNF] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
+      phy.rfs[0] = resp->pnf_phy.phy[i].rf_config[j].rf_config_index;
+    }
+
+    pnf->phys[0] = phy;
+  }
+
+  for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
+    rf_info rf;
+    rf.index = resp->pnf_rf.rf[i].rf_config_index;
+
+    printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
+
+    pnf->rfs[0] = rf;
+  }
+
+  nfapi_pnf_config_request_t req;
+  memset(&req, 0, sizeof(req));
+  req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
+
+  req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
+  req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // DJP pnf.phys.size();
+  printf("DJP:Hard coded num phy rf to 2\n");
+
+  for(unsigned i = 0; i < 2; ++i) {
+    req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf->phys[i].id;
+    req.pnf_phy_rf_config.phy_rf_config[i].phy_config_index = pnf->phys[i].index;
+    req.pnf_phy_rf_config.phy_rf_config[i].rf_config_index = pnf->phys[i].rfs[0];
+  }
+
+  nfapi_vnf_pnf_config_req(config, p5_idx, &req);
+
+  return 0;
+}
+
+int pnf_config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp) {
+
+  printf("[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n", p5_idx, resp->header.phy_id, resp->header.message_id, resp->header.message_length);
+
+  if(1) {
+      nfapi_pnf_start_request_t req;
+      memset(&req, 0, sizeof(req));
+      req.header.phy_id = resp->header.phy_id;
+      req.header.message_id = NFAPI_PNF_START_REQUEST;
+      nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+  } else {
+    // Rather than send the pnf_start_request we will demonstrate
+    // sending a vendor extention message. The start request will be
+    // send when the vendor extension response is received 
+
+    //vnf_info* vnf = (vnf_info*)(config->user_data);
+    vendor_ext_p5_req req;
+    memset(&req, 0, sizeof(req));
+    req.header.message_id = P5_VENDOR_EXT_REQ;
+    req.dummy1 = 45;
+    req.dummy2 = 1977;
+    nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
+  }
+  return 0;
+}
+
+int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
+
+  eNB_proc_t *proc=&eNB->proc;
+
+  eNB_rxtx_proc_t *proc_rxtx=&proc->proc_rxtx[sf&1];
+
+  LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
+
+  //printf("%s(eNB:%p, sfn:%d, sf:%d)\n", __FUNCTION__, eNB, sfn, sf);
+
+  //int i;
+  struct timespec wait;
+
+  wait.tv_sec=0;
+  wait.tv_nsec=5000000L;
+
+#if 0
+  /* accept some delay in processing - up to 5ms */
+  for (i = 0; i < 10 && proc_rxtx->instance_cnt_rxtx == 0; i++) {
+    LOG_W( PHY,"[eNB] sfn/sf:%d:%d proc_rxtx[%d]:TXsfn:%d/%d eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", sfn, sf, sf&1, proc_rxtx->frame_tx, proc_rxtx->subframe_tx, proc_rxtx->instance_cnt_rxtx);
+    usleep(500);
+  }
+  if (proc_rxtx->instance_cnt_rxtx == 0) {
+    exit_fun( "TX thread busy" );
+    return(-1);
+  }
+#endif
+
+  // wake up TX for subframe n+sf_ahead
+  // lock the TX mutex and make sure the thread is ready
+  if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) {
+    LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx );
+    exit_fun( "error locking mutex_rxtx" );
+    return(-1);
+  }
+
+  {
+    static uint16_t old_sf = 0;
+    static uint16_t old_sfn = 0;
+
+    proc->subframe_rx = old_sf;
+    proc->frame_rx = old_sfn;
+
+    // Try to be 1 frame back
+    old_sf = sf;
+    old_sfn = sfn;
+
+    if (old_sf == 0 && old_sfn % 100==0) LOG_W( PHY,"[eNB] sfn/sf:%d%d old_sfn/sf:%d%d proc[rx:%d%d]\n", sfn, sf, old_sfn, old_sf, proc->frame_rx, proc->subframe_rx);
+  }
+
+  ++proc_rxtx->instance_cnt_rxtx;
+
+  //LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d] proc_rxtx->instance_cnt_rxtx:%d \n", sfn, sf, proc->frame_rx, proc->subframe_rx, proc_rxtx->instance_cnt_rxtx);
+
+  // We have just received and processed the common part of a subframe, say n.
+  // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
+  // transmitted timestamp of the next TX slot (first).
+  // The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
+  // we want to generate subframe (n+N), so TS_tx = TX_rx+N*samples_per_tti,
+  // and proc->subframe_tx = proc->subframe_rx+sf_ahead
+  proc_rxtx->timestamp_tx = proc->timestamp_rx + (sf_ahead*fp->samples_per_tti);
+  proc_rxtx->frame_rx     = proc->frame_rx;
+  proc_rxtx->subframe_rx  = proc->subframe_rx;
+  proc_rxtx->frame_tx     = (proc_rxtx->subframe_rx > (9-sf_ahead)) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
+  proc_rxtx->subframe_tx  = (proc_rxtx->subframe_rx + sf_ahead)%10;
+
+  //LOG_D(PHY, "sfn/sf:%d%d proc[rx:%d%d] proc_rxtx[instance_cnt_rxtx:%d rx:%d%d] About to wake rxtx thread\n\n", sfn, sf, proc->frame_rx, proc->subframe_rx, proc_rxtx->instance_cnt_rxtx, proc_rxtx->frame_rx, proc_rxtx->subframe_rx);
+
+  // the thread can now be woken up
+  if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
+    LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
+    exit_fun( "ERROR pthread_cond_signal" );
+    return(-1);
+  }
+
+  //LOG_D(PHY,"%s() About to attempt pthread_mutex_unlock\n", __FUNCTION__);
+  pthread_mutex_unlock( &proc_rxtx->mutex_rxtx );
+  //LOG_D(PHY,"%s() UNLOCKED pthread_mutex_unlock\n", __FUNCTION__);
+
+  return(0);
+}
+
+extern pthread_cond_t nfapi_sync_cond;
+extern pthread_mutex_t nfapi_sync_mutex;
+extern int nfapi_sync_var;
+
+int phy_sync_indication(struct nfapi_vnf_p7_config* config, uint8_t sync) {
+
+  printf("[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
+  
+  if (sync==1 && nfapi_sync_var!=0) {
+
+    printf("[VNF] Signal to OAI main code that it can go\n");
+    pthread_mutex_lock(&nfapi_sync_mutex);
+    nfapi_sync_var=0;
+    pthread_cond_broadcast(&nfapi_sync_cond);
+    pthread_mutex_unlock(&nfapi_sync_mutex);
+  }
+
+  return(0);
+}
+
+int phy_subframe_indication(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf) {
+
+  static uint8_t first_time = 1;
+  if (first_time) {
+    printf("[VNF] subframe indication %d\n", NFAPI_SFNSF2DEC(sfn_sf));
+    first_time = 0;
+  }
+
+  if (RC.eNB && RC.eNB[0][0]->configured) {
+    uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
+    uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
+
+    //LOG_D(PHY,"[VNF] subframe indication sfn_sf:%d sfn:%d sf:%d\n", sfn_sf, sfn, sf);
+
+    wake_eNB_rxtx(RC.eNB[0][0], sfn, sf);
+  } else {
+    printf("[VNF] %s() RC.eNB:%p\n", __FUNCTION__, RC.eNB);
+    if (RC.eNB) printf("RC.eNB[0][0]->configured:%d\n", RC.eNB[0][0]->configured);
+  }
+
+  return 0;
+}
+
+int phy_rach_indication(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind) {
+
+  LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_preambles:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
+
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+
+  printf("[VNF] RACH_IND eNB:%p sfn_sf:%d number_of_preambles:%d\n", eNB, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
+
+  pthread_mutex_lock(&eNB->UL_INFO_mutex);
+
+  eNB->UL_INFO.rach_ind = *ind;
+  eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list = eNB->preamble_list;
+
+  for (int i=0;i<ind->rach_indication_body.number_of_preambles;i++) {
+    if (ind->rach_indication_body.preamble_list[i].preamble_rel8.tl.tag == NFAPI_PREAMBLE_REL8_TAG) {
+
+      printf("preamble[%d]: rnti:%02x preamble:%d timing_advance:%d\n", 
+          i,
+          ind->rach_indication_body.preamble_list[i].preamble_rel8.rnti,
+          ind->rach_indication_body.preamble_list[i].preamble_rel8.preamble,
+          ind->rach_indication_body.preamble_list[i].preamble_rel8.timing_advance
+          );
+    }
+
+    if(ind->rach_indication_body.preamble_list[i].preamble_rel13.tl.tag == NFAPI_PREAMBLE_REL13_TAG) {
+      printf("RACH PREAMBLE REL13 present\n");
+    }
+
+    eNB->preamble_list[i] = ind->rach_indication_body.preamble_list[i];
+  }
+  pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_rach_ind(p7_vnf->mac, ind);
+  return 1;
+}
+
+int phy_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind) {
+
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+
+  LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
+
+  pthread_mutex_lock(&eNB->UL_INFO_mutex);
+
+  eNB->UL_INFO.harq_ind = *ind;
+  eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list;
+
+  for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) {
+    memcpy(&eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i]));
+  }
+
+  pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_harq_ind(p7_vnf->mac, ind);
+
+  return 1;
+}
+
+int phy_crc_indication(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind) {
+
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+
+  pthread_mutex_lock(&eNB->UL_INFO_mutex);
+
+  eNB->UL_INFO.crc_ind = *ind;
+
+  nfapi_crc_indication_t *dest_ind = &eNB->UL_INFO.crc_ind;
+  nfapi_crc_indication_pdu_t *dest_pdu_list = eNB->crc_pdu_list;
+
+  *dest_ind = *ind;
+  dest_ind->crc_indication_body.crc_pdu_list = dest_pdu_list;
+
+  if (ind->crc_indication_body.number_of_crcs==0)
+    LOG_D(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
+
+  for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++) {
+    memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
+
+    LOG_D(MAC, "%s() NFAPI SFN/SF:%d CRC_IND:number_of_crcs:%u UL_INFO:crcs:%d PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n", 
+        __FUNCTION__,
+        NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs,
+        i, 
+        ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti, 
+        eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
+  }
+
+  pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_crc_ind(p7_vnf->mac, ind);
+
+  return 1;
+}
+
+int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind) {
+
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+
+  if (ind->rx_indication_body.number_of_pdus==0) {
+    LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_pdus:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus);
+  }
+
+  pthread_mutex_lock(&eNB->UL_INFO_mutex);
+
+  nfapi_rx_indication_t *dest_ind = &eNB->UL_INFO.rx_ind;
+  nfapi_rx_indication_pdu_t *dest_pdu_list = eNB->rx_pdu_list;
+
+  *dest_ind = *ind;
+  dest_ind->rx_indication_body.rx_pdu_list = dest_pdu_list;
+
+  for(int i=0; i<ind->rx_indication_body.number_of_pdus; i++) {
+    nfapi_rx_indication_pdu_t *dest_pdu = &dest_ind->rx_indication_body.rx_pdu_list[i];
+    nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i];
+
+    memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
+
+    // DJP - TODO FIXME - intentional memory leak
+    dest_pdu->data = malloc(dest_pdu->rx_indication_rel8.length);
+
+    memcpy(dest_pdu->data, src_pdu->data, dest_pdu->rx_indication_rel8.length);
+
+    LOG_D(PHY, "%s() NFAPI SFN/SF:%d PDUs:%d [PDU:%d] handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n",
+        __FUNCTION__,
+        NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, i,
+        dest_pdu->rx_ue_information.handle,
+        dest_pdu->rx_ue_information.rnti,
+        dest_pdu->rx_indication_rel8.length,
+        dest_pdu->rx_indication_rel8.offset,
+        dest_pdu->rx_indication_rel8.ul_cqi,
+        dest_pdu->rx_indication_rel8.timing_advance,
+        dest_pdu->data
+        );
+  }
+
+  pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_rx_ind(p7_vnf->mac, ind);
+  return 1;
+}
+int phy_srs_indication(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind) {
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_srs_ind(p7_vnf->mac, ind);
+  return 1;
+}
+
+int phy_sr_indication(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind) {
+
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+
+  LOG_D(MAC, "%s() NFAPI SFN/SF:%d srs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs);
+
+  pthread_mutex_lock(&eNB->UL_INFO_mutex);
+
+  nfapi_sr_indication_t *dest_ind = &eNB->UL_INFO.sr_ind;
+  nfapi_sr_indication_pdu_t *dest_pdu_list = eNB->sr_pdu_list;
+
+  *dest_ind = *ind;
+  dest_ind->sr_indication_body.sr_pdu_list = dest_pdu_list;
+
+  LOG_D(MAC,"%s() eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs);
+
+  for (int i=0;i<eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs;i++) {
+    nfapi_sr_indication_pdu_t *dest_pdu = &dest_ind->sr_indication_body.sr_pdu_list[i];
+    nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i];
+
+    LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti, src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
+
+    memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
+  }
+
+  pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_sr_ind(p7_vnf->mac, ind);
+
+  return 1;
+}
+
+int phy_cqi_indication(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind) {
+
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_cqi_ind(p7_vnf->mac, ind);
+  struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+
+  LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_cqis:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
+
+  pthread_mutex_lock(&eNB->UL_INFO_mutex);
+
+  eNB->UL_INFO.cqi_ind = ind->cqi_indication_body;
+
+  pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+
+  return 1;
+}
+
+int phy_lbt_dl_indication(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind) {
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_lbt_dl_ind(p7_vnf->mac, ind);
+  return 1;
+}
+
+int phy_nb_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind) {
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_nb_harq_ind(p7_vnf->mac, ind);
+  return 1;
+}
+
+int phy_nrach_indication(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind) {
+  // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+  //mac_nrach_ind(p7_vnf->mac, ind);
+  return 1;
+}
+
+void* vnf_allocate(size_t size) {
+  //return (void*)memory_pool::allocate(size);
+  return (void*)malloc(size);
+}
+
+void vnf_deallocate(void* ptr) {
+  //memory_pool::deallocate((uint8_t*)ptr);
+  free(ptr);
+}
+
+extern void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args);
+
+void vnf_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
+
+  va_list args;
+  int oai_level;
+
+  if (nfapi_level==NFAPI_TRACE_ERROR)
+  {
+    oai_level = LOG_ERR;
+  }
+  else if (nfapi_level==NFAPI_TRACE_WARN)
+  {
+    oai_level = LOG_WARNING;
+  }
+  else if (nfapi_level==NFAPI_TRACE_NOTE)
+  {
+    oai_level = LOG_INFO;
+  }
+  else if (nfapi_level==NFAPI_TRACE_INFO)
+  {
+    oai_level = LOG_INFO;
+  }
+  else
+  {
+    oai_level = LOG_INFO;
+  }
+
+  va_start(args, message);
+  nfapi_log("FILE>", "FUNC", 999, PHY, oai_level, message, args);
+  va_end(args);
+}
+
+int phy_vendor_ext(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg) {
+
+  if(msg->message_id == P7_VENDOR_EXT_IND)
+  {
+    //vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
+    //printf("[VNF] vendor_ext (error_code:%d)\n", ind->error_code);
+  }
+  else
+  {
+    printf("[VNF] unknown %02x\n", msg->message_id);
+  }
+  return 0;
+}
+
+nfapi_p7_message_header_t* phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size) {
+  if(message_id == P7_VENDOR_EXT_IND)
+  {
+    *msg_size = sizeof(vendor_ext_p7_ind);
+    return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_ind));
+  }
+  return 0;
+}
+
+void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header) {
+  free(header);
+}
+
+int phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p7_codec_config_t* codec) {
+
+  (void)tl;
+  (void)ppReadPackedMessage;
+  (void)ve;
+  return -1;
+}
+
+int phy_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codec) {
+
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
+
+  nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
+  switch(tlv->tag) {
+    case VENDOR_EXT_TLV_1_TAG:
+      {
+        //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
+        vendor_ext_tlv_1* ve = (vendor_ext_tlv_1*)tlv;
+        if(!push32(ve->dummy, ppWritePackedMsg, end))
+          return 0;
+        return 1;
+      }
+      break;
+    default:
+      return -1;
+      break;
+  }
+}
+
+int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* config) {
+
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+  if(header->message_id == P7_VENDOR_EXT_IND) {
+    vendor_ext_p7_ind* req = (vendor_ext_p7_ind*)(header);
+    if(!pull16(ppReadPackedMessage, &req->error_code, end))
+      return 0;
+  }
+
+  return 1;
+}
+
+int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) {
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+  if(header->message_id == P7_VENDOR_EXT_REQ) {
+    //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+    vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
+    if(!(push16(req->dummy1, ppWritePackedMsg, end) &&
+          push16(req->dummy2, ppWritePackedMsg, end)))
+      return 0;
+  }
+  return 1;
+}
+
+int vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec) {
+
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+  if(header->message_id == P5_VENDOR_EXT_REQ) {
+    vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
+    //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
+    return (!(push16(req->dummy1, ppWritePackedMsg, end) &&
+          push16(req->dummy2, ppWritePackedMsg, end)));
+  }
+  return 0;
+}
+
+static pthread_t vnf_start_pthread;
+static pthread_t vnf_p7_start_pthread;
+
+void* vnf_p7_start_thread(void *ptr) {
+
+  printf("%s()\n", __FUNCTION__);
+
+  pthread_setname_np(pthread_self(), "VNF_P7");
+
+  nfapi_vnf_p7_config_t* config = (nfapi_vnf_p7_config_t*)ptr;
+
+  nfapi_vnf_p7_start(config);
+
+  return config;
+}
+
+void set_thread_priority(int priority);
+
+void* vnf_p7_thread_start(void* ptr) {
+
+  set_thread_priority(79);
+
+  vnf_p7_info* p7_vnf = (vnf_p7_info*)ptr;
+
+  p7_vnf->config->port = p7_vnf->local_port;
+  p7_vnf->config->sync_indication = &phy_sync_indication;
+  p7_vnf->config->subframe_indication = &phy_subframe_indication;
+  p7_vnf->config->harq_indication = &phy_harq_indication;
+  p7_vnf->config->crc_indication = &phy_crc_indication;
+  p7_vnf->config->rx_indication = &phy_rx_indication;
+  p7_vnf->config->rach_indication = &phy_rach_indication;
+  p7_vnf->config->srs_indication = &phy_srs_indication;
+  p7_vnf->config->sr_indication = &phy_sr_indication;
+  p7_vnf->config->cqi_indication = &phy_cqi_indication;
+  p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
+  p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
+  p7_vnf->config->nrach_indication = &phy_nrach_indication;
+  p7_vnf->config->malloc = &vnf_allocate;
+  p7_vnf->config->free = &vnf_deallocate;
+
+  p7_vnf->config->trace = &vnf_trace;
+
+  p7_vnf->config->vendor_ext = &phy_vendor_ext;
+  p7_vnf->config->user_data = p7_vnf;
+
+  p7_vnf->mac->user_data = p7_vnf;
+
+  p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
+  p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
+  p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
+  p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
+  p7_vnf->config->codec_config.allocate = &vnf_allocate;
+  p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
+
+  p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
+  p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
+
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
+  pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config);
+
+  return 0;
+}
+
+int pnf_start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp) {
+
+  vnf_info* vnf = (vnf_info*)(config->user_data);
+  vnf_p7_info *p7_vnf = vnf->p7_vnfs;
+  pnf_info *pnf = vnf->pnfs;
+  nfapi_param_request_t req;
+
+  printf("[VNF] pnf start response idx:%d config:%p user_data:%p p7_vnf[config:%p thread_started:%d]\n", p5_idx, config, config->user_data, vnf->p7_vnfs[0].config, vnf->p7_vnfs[0].thread_started);
+
+  if(p7_vnf->thread_started == 0) {
+
+    pthread_t vnf_p7_thread;
+    pthread_create(&vnf_p7_thread, NULL, &vnf_p7_thread_start, p7_vnf);
+    p7_vnf->thread_started = 1;
+  }
+  else
+  {
+    // P7 thread already running. 
+  }
+
+  // start all the phys in the pnf.
+  printf("[VNF] Sending NFAPI_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
+
+  memset(&req, 0, sizeof(req));
+  req.header.message_id = NFAPI_PARAM_REQUEST;
+  req.header.phy_id = pnf->phys[0].id;
+
+  nfapi_vnf_param_req(config, p5_idx, &req);
+
+  return 0;
+}
+
+extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw);
+
+int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp) {
+
+  printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+
+  vnf_info* vnf = (vnf_info*)(config->user_data);
+  vnf_p7_info *p7_vnf = vnf->p7_vnfs;
+
+  pnf_info *pnf = vnf->pnfs;
+  phy_info *phy = pnf->phys;
+  struct sockaddr_in pnf_p7_sockaddr;
+  nfapi_config_request_t *req = &RC.mac[0]->config[0];
+
+  phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
+
+  memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
+
+  phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
+
+  // for now just 1
+
+  printf("[VNF] %d.%d pnf p7 %s:%d timing %d %d %d %d\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
+
+  req->header.message_id = NFAPI_CONFIG_REQUEST;
+  req->header.phy_id = phy->id;
+
+  printf("[VNF] Send NFAPI_CONFIG_REQUEST\n");
+
+  req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
+  req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
+  req->num_tlv++;
+
+  printf("[VNF] DJP local_port:%d\n", p7_vnf->local_port);
+
+  req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
+  struct sockaddr_in vnf_p7_sockaddr;
+  vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
+  memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
+  req->num_tlv++;
+  printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
+
+  req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
+  req->nfapi_config.timing_window.value = p7_vnf->timing_window;
+  printf("[VNF] Timing window:%d\n", p7_vnf->timing_window);
+  req->num_tlv++;
+
+  if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
+
+    req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG;
+    req->nfapi_config.timing_info_mode.value = (p7_vnf->aperiodic_timing_enabled << 1) | (p7_vnf->periodic_timing_enabled);
+    req->num_tlv++;
+
+    if(p7_vnf->periodic_timing_enabled) {
+
+      req->nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG;
+      req->nfapi_config.timing_info_period.value = p7_vnf->periodic_timing_period;
+      req->num_tlv++;
+    }
+  }
+
+  vendor_ext_tlv_2 ve2;
+  memset(&ve2, 0, sizeof(ve2));
+  ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
+  ve2.dummy = 2016;
+  req->vendor_extension = &ve2.tl;
+
+  nfapi_vnf_config_req(config, p5_idx, req);
+  printf("[VNF] Sent NFAPI_CONFIG_REQ num_tlv:%u\n",req->num_tlv);
+
+  return 0;
+}
+
+int config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp) {
+
+  nfapi_start_request_t req;
+
+  printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+
+  printf("[VNF] Calling oai_enb_init()\n");
+  oai_enb_init();
+
+  memset(&req, 0, sizeof(req));
+  req.header.message_id = NFAPI_START_REQUEST;
+  req.header.phy_id = resp->header.phy_id;
+  nfapi_vnf_start_req(config, p5_idx, &req);
+
+  printf("[VNF] Send NFAPI_START_REQUEST idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+
+  return 0;
+}
+
+int start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp) {
+
+  printf("[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+
+  vnf_info* vnf = (vnf_info*)(config->user_data);
+
+  pnf_info *pnf = vnf->pnfs;
+  phy_info *phy = pnf->phys;
+  vnf_p7_info *p7_vnf = vnf->p7_vnfs;
+  nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, phy->remote_port, phy->id);
+
+  return 0;
+}
+
+int vendor_ext_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg) {
+
+  printf("[VNF] %s\n", __FUNCTION__);
+
+  switch(msg->message_id) {
+    case P5_VENDOR_EXT_RSP:
+      {
+        vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)msg;
+        printf("[VNF] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
+
+        // send the start request
+
+        nfapi_pnf_start_request_t req;
+        memset(&req, 0, sizeof(req));
+        req.header.message_id = NFAPI_PNF_START_REQUEST;
+        nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+      }
+      break;
+  }
+
+  return 0;
+}
+
+int vnf_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec) {
+
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+  if(header->message_id == P5_VENDOR_EXT_RSP)
+  {
+    vendor_ext_p5_rsp* req = (vendor_ext_p5_rsp*)(header);
+    return(!pull16(ppReadPackedMessage, &req->error_code, end));
+  }
+  return 0;
+}
+
+nfapi_p4_p5_message_header_t* vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size) {
+
+  if(message_id == P5_VENDOR_EXT_RSP) {
+    *msg_size = sizeof(vendor_ext_p5_rsp);
+    return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_rsp));
+  }
+  return 0;
+}
+
+void vnf_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header) {
+  free(header);
+}
+
+nfapi_vnf_config_t *config = 0;
+
+void vnf_start_thread(void* ptr) {
+
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
+
+  pthread_setname_np(pthread_self(), "VNF");
+
+  config = (nfapi_vnf_config_t*)ptr;
+
+  nfapi_vnf_start(config);
+}
+
+static vnf_info vnf;
+extern uint8_t nfapi_mode;
+/*------------------------------------------------------------------------------*/
+void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port)
+{
+  nfapi_mode = 2;
+
+  memset(&vnf, 0, sizeof(vnf));
+
+  memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
+
+  vnf.p7_vnfs[0].timing_window = 32;
+  vnf.p7_vnfs[0].periodic_timing_enabled = 1;
+  vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
+  vnf.p7_vnfs[0].periodic_timing_period = 10;
+
+  vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
+
+  strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
+  vnf.p7_vnfs[0].local_port = 50001;
+  vnf.p7_vnfs[0].mac = (mac_t*)malloc(sizeof(mac_t));
+
+  nfapi_vnf_config_t* config = nfapi_vnf_config_create();
+
+  config->malloc = malloc;
+  config->free = free;
+  config->trace = &vnf_trace;
+
+  config->vnf_p5_port = vnf_p5_port;
+  config->vnf_ipv4 = 1;
+  config->vnf_ipv6 = 0;
+
+  config->pnf_list = 0;
+  config->phy_list = 0;
+
+  config->pnf_connection_indication = &pnf_connection_indication_cb;
+  config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
+  config->pnf_param_resp = &pnf_param_resp_cb;
+  config->pnf_config_resp = &pnf_config_resp_cb;
+  config->pnf_start_resp = &pnf_start_resp_cb;
+  config->param_resp = &param_resp_cb;
+  config->config_resp = &config_resp_cb;
+  config->start_resp = &start_resp_cb;
+  config->vendor_ext = &vendor_ext_cb;
+
+  config->user_data = &vnf;
+
+  // To allow custom vendor extentions to be added to nfapi
+  config->codec_config.unpack_vendor_extension_tlv = &vnf_unpack_vendor_extension_tlv;
+  config->codec_config.pack_vendor_extension_tlv = &vnf_pack_vendor_extension_tlv;
+
+  config->codec_config.unpack_p4_p5_vendor_extension = &vnf_unpack_p4_p5_vendor_extension;
+  config->codec_config.pack_p4_p5_vendor_extension = &vnf_pack_p4_p5_vendor_extension;
+  config->allocate_p4_p5_vendor_ext = &vnf_allocate_p4_p5_vendor_ext;
+  config->deallocate_p4_p5_vendor_ext = &vnf_deallocate_p4_p5_vendor_ext;
+  config->codec_config.allocate = &vnf_allocate;
+  config->codec_config.deallocate = &vnf_deallocate;
+
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
+  pthread_create(&vnf_start_pthread, NULL, (void*)&vnf_start_thread, config);
+  NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
+}
+
+int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req)
+{
+  nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
+
+  dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+
+  int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
+
+  dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols           = 1;
+  dl_config_req->dl_config_request_body.number_dci                          = 0;
+  dl_config_req->dl_config_request_body.number_pdu                          = 0;
+  dl_config_req->dl_config_request_body.number_pdsch_rnti                   = 0;
+
+  if (retval!=0) {
+    LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
+  }
+  return retval;
+}
+
+int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
+{
+  nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
+
+  tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+
+  //LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
+
+  int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
+
+
+  if (retval!=0) {
+    LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
+  } else {
+    tx_req->tx_request_body.number_of_pdus = 0;
+  }
+  return retval;
+}
+
+int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
+  nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
+
+  hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+
+  //LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
+
+  int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req);
+
+  if (retval!=0) {
+    LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
+  } else {
+    hi_dci0_req->hi_dci0_request_body.number_of_hi = 0;
+    hi_dci0_req->hi_dci0_request_body.number_of_dci = 0;
+  }
+  return retval;
+}
+
+int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
+
+  nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
+
+  ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+
+  //LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
+
+  //LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present);
+
+  int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req);
+
+  if (retval!=0) {
+    LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
+  } else {
+    // Reset number of PDUs so that it is not resent
+    ul_config_req->ul_config_request_body.number_of_pdus = 0;
+    ul_config_req->ul_config_request_body.rach_prach_frequency_resources = 0;
+    ul_config_req->ul_config_request_body.srs_present = 0;
+  }
+  return retval;
+}
diff --git a/openair2/COMMON/openair_types.h b/nfapi/oai_integration/nfapi_vnf.h
similarity index 57%
rename from openair2/COMMON/openair_types.h
rename to nfapi/oai_integration/nfapi_vnf.h
index 0971d7648f04452749f68cf5d11284b3c88769a9..4ea26eda12d1a8d3feb1d9013830eff9c72b7b44 100644
--- a/openair2/COMMON/openair_types.h
+++ b/nfapi/oai_integration/nfapi_vnf.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,21 +19,9 @@
  *      contact@openairinterface.org
  */
 
-#ifndef __openair_TYPES_H__
-#define __openair_TYPES_H__
+#if !defined(NFAPI_VNF_H__)
+#define NFAPI_VNF_H__
 
-//#ifdef USER_MODE
-//#include <stdint.h>
-//typedef int8_t      s8;     /* 8 bit  signed integer     */
-//typedef int16_t     s16;    /* 16 bit signed integer    */
-//typedef int32_t     s32;    /* 32 bit signed integer    */
-//typedef int64_t     s64;    /* 64 bit signed integer    */
+void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
 
-//typedef uint8_t     u8;    /* 8 bit  unsigned integer   */
-//typedef uint16_t    u16;   /* 16 bit unsigned integer  */
-//typedef uint32_t    u32;   /* 32 bit unsigned integer  */
-//typedef uint64_t    u64;   /* 64 bit unsigned integer  */
-//#else
-//#include <linux/types.h>
-//#endif
-#endif /*__openair_TYPES_H__ */
+#endif
diff --git a/nfapi/oai_integration/vendor_ext.h b/nfapi/oai_integration/vendor_ext.h
new file mode 100644
index 0000000000000000000000000000000000000000..0622432260060dc7ef3f4fc4d76f889a7e3860d8
--- /dev/null
+++ b/nfapi/oai_integration/vendor_ext.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _VENDOR_EXT_H_
+#define _VENDOR_EXT_H_
+
+#include "nfapi_interface.h"
+
+typedef enum {
+	P5_VENDOR_EXT_REQ = NFAPI_VENDOR_EXT_MSG_MIN,
+	P5_VENDOR_EXT_RSP,
+
+	P7_VENDOR_EXT_REQ,
+	P7_VENDOR_EXT_IND
+
+} vendor_ext_message_id_e;
+
+typedef struct {
+	nfapi_p4_p5_message_header_t header;
+	uint16_t dummy1;
+	uint16_t dummy2;
+} vendor_ext_p5_req;
+
+typedef struct {
+	nfapi_p4_p5_message_header_t header;
+	uint16_t error_code;
+} vendor_ext_p5_rsp;
+
+typedef struct {
+	nfapi_p7_message_header_t header;
+	uint16_t dummy1;
+	uint16_t dummy2;
+} vendor_ext_p7_req;
+
+typedef struct {
+	nfapi_p7_message_header_t header;
+	uint16_t error_code;
+} vendor_ext_p7_ind;
+
+typedef struct {
+	nfapi_tl_t tl;
+	uint32_t dummy;
+} vendor_ext_tlv_1;
+
+#define VENDOR_EXT_TLV_1_TAG 0xF001
+
+typedef struct {
+	nfapi_tl_t tl;
+	uint32_t dummy;
+} vendor_ext_tlv_2;
+
+#define VENDOR_EXT_TLV_2_TAG 0xF002
+
+#endif // _VENDOR_EXT_
diff --git a/nfapi/open-nFAPI/.travis.yml b/nfapi/open-nFAPI/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..ce2faea92371b6bb7c7748819cfbe69a926692b2
--- /dev/null
+++ b/nfapi/open-nFAPI/.travis.yml
@@ -0,0 +1,36 @@
+
+env:
+  global:
+    # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created 
+    #   via the "travis encrypt" command using the project repo's public key
+    - secure: "oNj8JhGBN/zjzrAU7y2Nn/wxSxA/MDp2Y8fVLLp6fhx+y2mWdlMZhgCjeKSpdbGtroUnxErX1P8t+8EPz2+mMoq+G809Q9t7eJjd1+6nkVhEEfDXN83BmJkvIylC0/IKJiT2wCa8LzbdhpQUFyZ1Gk1WKZozAW5HotfFjm6/NFi/GX4uA7S0tU5E4yC3r4yqH9cLZ+arWMOEY/X0lrx0n6tLjDe921kFwkZQGFzAzrbXN2fZXKQ3xFcpREWEgEWsY7H2n4T7oJI3nEPY4P/4kvCjeQMjnlATEwtcciBiUbHRew4WWSTndF54crRlqFlzFcEf/Ouz27U/d2xYHJWcWNi88l+/qsb+V0uobwhiGUJGbVhf9IkgEO3tr/zbwkPDFrXpa/1xuSoc6jDm8i61gKQkcBhQsRFXlciPvwLhiL07gzeAfZD1Yke3tE+0geHPbEA0czzwtHe35jorAKYWsFXOXmcoK9t9SpnvBRFz6JuEsHPooafze43sTJg3qkgBszkU+U38CneeAVwo/uTA3Zw1ZrtOQv56v0UvAHze/VAF5z3rFJPl1oJl60OI8V5UBg4yIa2bySKhO//zwd4MGmsBpcWwDuu2BHUVasfk0vaetVxVVtdXG/2BuBP+IXinpJtI48NSFs6PT82dHz4cDF/iLDs0hPC6sbV258PY8F0="
+
+language: cpp
+
+dist: trusty
+sudo: required
+
+compiler:
+  - g++
+
+before_install:
+  - sudo apt-get install doxygen 
+  - sudo apt-get install libcunit1-dev 
+  - sudo apt-get install libz-dev
+  - sudo apt-get install libsctp-dev
+  - sudo apt-get install libboost-all-dev
+  - autoreconf -i
+
+addons:
+  coverity_scan:
+    project:
+      name: cisco-open-nFAPI
+      version: 1.0
+      description: Build submitted via Travis CI
+    notification_email: xxx@cisco.com
+    build_command_prepend: ./configure
+    build_command: make
+    branch_pattern: coverity_scan
+
+script:
+  - ./configure && make && make check
diff --git a/nfapi/open-nFAPI/CHANGELOG.md b/nfapi/open-nFAPI/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/nfapi/open-nFAPI/LICENSE.md b/nfapi/open-nFAPI/LICENSE.md
new file mode 100644
index 0000000000000000000000000000000000000000..5e0fd33cbbdc8038b61e29ce0437688cc3bc1d00
--- /dev/null
+++ b/nfapi/open-nFAPI/LICENSE.md
@@ -0,0 +1,201 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all
+other entities that control, are controlled by, or are under common
+control with that entity. For the purposes of this definition,
+"control" means (i) the power, direct or indirect, to cause the
+direction or management of such entity, whether by contract or
+otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation
+source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or
+Object form, made available under the License, as indicated by a
+copyright notice that is included in or attached to the work
+(an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object
+form, that is based on (or derived from) the Work and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship. For the purposes
+of this License, Derivative Works shall not include works that remain
+separable from, or merely link (or bind by name) to the interfaces of,
+the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including
+the original version of the Work and any modifications or additions
+to that Work or Derivative Works thereof, that is intentionally
+submitted to Licensor for inclusion in the Work by the copyright owner
+or by an individual or Legal Entity authorized to submit on behalf of
+the copyright owner. For the purposes of this definition, "submitted"
+means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems,
+and issue tracking systems that are managed by, or on behalf of, the
+Licensor for the purpose of discussing and improving the Work, but
+excluding communication that is conspicuously marked or otherwise
+designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work,
+where such license applies only to those patent claims licensable
+by such Contributor that are necessarily infringed by their
+Contribution(s) alone or by combination of their Contribution(s)
+with the Work to which such Contribution(s) was submitted. If You
+institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work
+or a Contribution incorporated within the Work constitutes direct
+or contributory patent infringement, then any patent licenses
+granted to You under this License for that Work shall terminate
+as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof in any medium, with or without
+modifications, and in Source or Object form, provided that You
+meet the following conditions:
+
+(a) You must give any other recipients of the Work or
+Derivative Works a copy of this License; and
+
+(b) You must cause any modified files to carry prominent notices
+stating that You changed the files; and
+
+(c) You must retain, in the Source form of any Derivative Works
+that You distribute, all copyright, patent, trademark, and
+attribution notices from the Source form of the Work,
+excluding those notices that do not pertain to any part of
+the Derivative Works; and
+
+(d) If the Work includes a "NOTICE" text file as part of its
+distribution, then any Derivative Works that You distribute must
+include a readable copy of the attribution notices contained
+within such NOTICE file, excluding those notices that do not
+pertain to any part of the Derivative Works, in at least one
+of the following places: within a NOTICE text file distributed
+as part of the Derivative Works; within the Source form or
+documentation, if provided along with the Derivative Works; or,
+within a display generated by the Derivative Works, if and
+wherever such third-party notices normally appear. The contents
+of the NOTICE file are for informational purposes only and
+do not modify the License. You may add Your own attribution
+notices within Derivative Works that You distribute, alongside
+or as an addendum to the NOTICE text from the Work, provided
+that such additional attribution notices cannot be construed
+as modifying the License.
+
+You may add Your own copyright statement to Your modifications and
+may provide additional or different license terms and conditions
+for use, reproduction, or distribution of Your modifications, or
+for any such Derivative Works as a whole, provided Your use,
+reproduction, and distribution of the Work otherwise complies with
+the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+To apply the Apache License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "{}"
+replaced with your own identifying information. (Don't include
+the brackets!)  The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+Copyright {yyyy} {name of copyright owner}
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/nfapi/open-nFAPI/Makefile.am b/nfapi/open-nFAPI/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..900cf2bbcf5ad4740f544fe9af7132e4a37eba68
--- /dev/null
+++ b/nfapi/open-nFAPI/Makefile.am
@@ -0,0 +1,15 @@
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS =common/ \
+	 sim_common/ \
+	 nfapi/ \
+	 pnf/ \
+	 vnf/ \
+	 nfapi/tests \
+	 pnf/tests \
+	 vnf/tests \
+	 pnf_sim/ \
+	 vnf_sim/ \
+	 integration_tests/ \
+	 docs/ \
+	 $(NULL)
diff --git a/nfapi/open-nFAPI/README.md b/nfapi/open-nFAPI/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..f3132c78d6f088e3df6ef32f97262250f7989393
--- /dev/null
+++ b/nfapi/open-nFAPI/README.md
@@ -0,0 +1,138 @@
+[![Build Status](https://travis-ci.org/cisco/open-nFAPI.svg?branch=master)](https://travis-ci.org/cisco/open-nFAPI)
+[![Coverity Status](https://scan.coverity.com/projects/11791/badge.svg)](https://scan.coverity.com/projects/cisco-open-nfapi)
+
+# open-nFAPI
+ 
+Open-nFAPI is implementation of the Small Cell Forum's network functional API or nFAPI for short. 
+nFAPI defines a network protocol that is used to connect a Physical Network Function (PNF) 
+running LTE Layer 1 to a Virtual Network Function (VNF) running LTE layer 2 and above. The specification
+can be found at http://scf.io/documents/082.
+ 
+The aim of open-nFAPI is to provide an open interface between LTE layer 1 and layer 2 to allow for
+interoperability between the PNF and VNF & also to facilitate the sharing of PNF's between
+different VNF's
+
+Open-nFAPI implements the P4, P5 and P7 interfaces as defined by the nFAPI specification. 
+* The P5 interface allows the VNF to query and configure the 'resources' of the PNF; i.e slice it into
+ 1 or more PHY instances.
+* The P7 interface is used to send the subframe information between the PNF and VNF for a PHY instance
+* The P4 interface allows the VNF to request the PNF PHY instance to perform measurements of the surrounding network
+
+The remaining interfaces are currently outside of the scope of this project.
+
+Supports release 082.09.05 of the nFAPI specification
+
+**The Small Cell Forum cordially requests that any derivative work that looks to 
+extend the nFAPI libraries use the specified vendor extension techniques, 
+so ensuring the widest interoperability of the baseline nFAPI specification 
+in those derivative works.**
+
+## Awards
+
+The Open-nFAPI project has won the Small Cell Forum Judges Choice award 2017. (http://www.smallcellforum.org/awards-2/winners-2017/)
+
+## Licensing
+
+The open-nFAPI libraries are release by CISCO under an Apache 2 license. See `LICENSE.md` file for details
+
+## Downloading
+
+The open-nFAPI project can be pulled from git hub
+
+```
+git clone https://github.com/cisco/open-nFAPI.git nfapi
+```
+
+The following dependencies are required. These are based on a fresh ubuntu installation.
+
+```
+sudo apt-get install autoconf
+sudo apt-get install gcc
+sudo apt-get install g++
+sudo apt-get install libtool
+sudo apt-get install make
+sudo apt-get install doxygen
+sudo apt-get install libcunit1-dev
+sudo apt-get install libz-dev
+sudo apt-get install libsctp-dev
+sudo apt-get install libboost-all-dev
+```
+
+
+
+## Building
+
+To build the open-nFAPI project
+
+```
+autoreconf -i
+./configure
+make
+```
+
+To run the unit and integration tests
+
+```
+make check
+```
+
+You may notice in the console output of the final integration tests the following
+
+```
+*** Missing subframe 123 125
+```
+
+Out of the box the machine on which you are running has not be configured for real time operation as a result
+the vnf may not be scheduled at the correct times and hence it may risk 'missing' subframe opportunities. This
+warning indicates this has happened. 
+
+## Running the simulator
+
+The vnf and pnf simulator can be run using the following commands. The pnf and vnf simulator support sourcing and sinking
+data over udp. Review the xml configuration files for the details of the port and address to configure. Console logging will show
+which address:port is being used
+
+Note : Pinning the simulators to unused cores will produce more consistent behaviour.
+
+Note : You may have to run the processes with sudo to be able to set the real time scheduling and priority
+
+### vnf simulator
+
+To run the vnf simulator you need to specify the port the vnf will listen for p5 connection request upon and also the xml configuration file
+
+```
+vnfsim <port> <xml config file>
+```
+
+### pnf simulator
+
+To run the vnf simulator you need to specify the addrss & port the pnf will connect to the vnf on and also the xml configuration file
+
+```
+pnfsim <address> <port> <xml config file>
+```
+
+
+## Directory structure
+
+```
+docs                    doxgen documentation
+common                  common code used by the nfapi libraries
+nfapi                   the nfapi library including message definitions & encode/decode functions
+pnf                     the pnf library for p4, p5, & p7 interfaces
+vnf                     the vnf library for p4, p5, & p7 interfaces
+sim_common              common simulation for used by the vnf and pnf sim
+vnf_sim                 a vnf simulator including a stub mac implementation
+pnf_sim                 a pnf simualtor including a fapi interface defintion and stub implementation
+xml                     xml configuration files for the vnf and pnf simulator
+wireshark               code for a wireshark dissector for the nFAPI protocol
+```
+
+## Coverity
+
+Coverity runs on the coverity-scan branch. Changes must be merged to the coverity-scan branch to be checked.
+
+
+## eNB Integration - Open Air Interface
+
+The open-nFAPI implementation has been integrated with the Open Air Interface solution here (https://gitlab.eurecom.fr/oai/openairinterface5g) and is (at the time of writing) here (https://gitlab.eurecom.fr/daveprice/openairinterface5g/tree/nfapi-ru-rau-split). The open-nFAPI implementation is integrated with the source eNB implementation with any changes required applied as a patch on top of the baseline open-nFAPI library. Any extensions required must be implemented through the vendor extensions as specified by the Small Cell Forum documentation. Any integration wrapping of functionality must be done within the target environment as shown in the Open Air Interface implementation nfapi directory which is defined by the $NFAPI_DIR location at the top level.
diff --git a/nfapi/open-nFAPI/common/Makefile.am b/nfapi/open-nFAPI/common/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..3e3326ea2c9dea397e3b2bb47ea6f7e736a870ba
--- /dev/null
+++ b/nfapi/open-nFAPI/common/Makefile.am
@@ -0,0 +1,31 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+AM_CPPFLAGS = -I$(top_srcdir)/common/public_inc -g -Wall -Werror
+
+noinst_LIBRARIES =libnfapi_common.a
+
+libnfapi_common_a_SOURCES = src/debug.c 
+
+libnfapi_common_a_CFLAGS =$(AM_CFLAGS)
+
+lib_LTLIBRARIES =libnfapi_common.la
+
+libnfapi_common_la_SOURCES = src/debug.c
+
+
+
+
diff --git a/nfapi/open-nFAPI/common/public_inc/debug.h b/nfapi/open-nFAPI/common/public_inc/debug.h
new file mode 100644
index 0000000000000000000000000000000000000000..14f97a17f6f8fbe23bd2e3e414b51baaa90f4714
--- /dev/null
+++ b/nfapi/open-nFAPI/common/public_inc/debug.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef _DEBUG_H_
+#define _DEBUG_H_
+
+/*! The trace levels used by the nfapi libraries */
+typedef enum nfapi_trace_level
+{
+	NFAPI_TRACE_ERROR = 1,
+	NFAPI_TRACE_WARN,
+	NFAPI_TRACE_NOTE,
+	NFAPI_TRACE_INFO,
+
+	NFAPI_TRACE_LEVEL_MAX
+} nfapi_trace_level_t;
+
+/*! The trace function pointer */
+typedef void (*nfapi_trace_fn_t)(nfapi_trace_level_t level, const char* format, ...);
+
+/*! Global trace function */
+extern nfapi_trace_fn_t nfapi_trace_g;
+
+/*! Global trace level */
+extern nfapi_trace_level_t nfapi_trace_level_g;
+
+/*! NFAPI trace macro */
+//#define NFAPI_TRACE(level, format, ...) { if(nfapi_trace_g && ((nfapi_trace_level_t)level <= nfapi_trace_level_g)) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
+#define NFAPI_TRACE(level, format, ...) { if (nfapi_trace_g) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
+
+/*! Function to change the trace level 
+ * \param new_level The modified trace level
+ */
+
+void nfapi_set_trace_level(nfapi_trace_level_t new_level);
+
+#endif /* _DEBUG_H_ */
diff --git a/nfapi/open-nFAPI/common/src/debug.c b/nfapi/open-nFAPI/common/src/debug.c
new file mode 100644
index 0000000000000000000000000000000000000000..a45d41d7d7218f806869f6fda7dd9c628b893d9a
--- /dev/null
+++ b/nfapi/open-nFAPI/common/src/debug.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <syslog.h>
+
+#include <debug.h>
+
+#define MAX_MSG_LENGTH 			2096
+#define TRACE_HEADER_LENGTH		44
+
+void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
+
+// initialize the trace function to 0
+void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
+
+nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
+//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
+
+void nfapi_set_trace_level(nfapi_trace_level_t new_level)
+{
+	nfapi_trace_level_g = new_level;
+}
+
+void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
+{
+	char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
+	uint32_t num_chars;
+	va_list p_args;
+	struct timeval tv;
+	pthread_t tid = pthread_self();
+
+	(void)gettimeofday(&tv, NULL);
+
+	num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
+
+	if (num_chars > TRACE_HEADER_LENGTH)
+	{
+		printf("trace_dbg: Error, num_chars is too large: %d", num_chars);
+		return;
+	}
+
+	va_start(p_args, format);
+	if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
+	{
+		if (level <= NFAPI_TRACE_WARN)
+		{
+			printf("%s", trace_buff);
+		}
+		printf("%s", trace_buff);
+	}
+	va_end(p_args);
+}
diff --git a/nfapi/open-nFAPI/configure.ac b/nfapi/open-nFAPI/configure.ac
new file mode 100644
index 0000000000000000000000000000000000000000..fd3b387ee50d185af57efe1e27cb8f6777ebb28a
--- /dev/null
+++ b/nfapi/open-nFAPI/configure.ac
@@ -0,0 +1,45 @@
+AC_INIT([open-nFAPI], [1.0])
+
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign serial-tests])
+AM_PROG_AR
+
+LT_INIT([shared static])
+
+# Dependencies
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_AWK
+AC_CONFIG_HEADERS([config.h])
+
+AC_PROG_LIBTOOL
+
+AC_CHECK_FILE([/usr/include/CUnit/CUnit.h],
+	[CFLAGS_CUNIT=-I/usr/include/CUnit AC_SUBST(CFLAGS_CUNIT)],
+	[AC_MSG_NOTICE([Have cunit *************])])
+
+# Need doxygen
+AC_CHECK_PROGS([DOXYGEN], [doxygen])
+if test -z "$DOXYGEN";
+	then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
+fi
+AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/Doxyfile])])
+
+AC_REQUIRE_AUX_FILE([tap-driver.sh])
+
+AC_CONFIG_FILES([Makefile
+                 sim_common/Makefile
+                 common/Makefile
+                 nfapi/Makefile
+                 pnf/Makefile
+                 vnf/Makefile
+                 nfapi/tests/Makefile
+                 pnf/tests/Makefile
+                 vnf/tests/Makefile
+                 pnf_sim/Makefile
+                 vnf_sim/Makefile
+                 integration_tests/Makefile
+                 docs/Makefile
+])
+AC_OUTPUT
diff --git a/nfapi/open-nFAPI/docs/Doxyfile b/nfapi/open-nFAPI/docs/Doxyfile
new file mode 100644
index 0000000000000000000000000000000000000000..9491727d2b53802448d2bad3abd61e6009ee2210
--- /dev/null
+++ b/nfapi/open-nFAPI/docs/Doxyfile
@@ -0,0 +1,1720 @@
+# Doxyfile 1.7.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a hash (#) is considered a comment and will be ignored.
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = open-nFAPI
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1.0
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penalty.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  = ../nfapi/public_inc ../pnf/public_inc ../vnf/public_inc ../docs/doxygen.h
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS          =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header. Note that when using a custom header you are responsible
+# for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is adviced to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# If the HTML_TIMESTAMP tag is set to YES then the generated HTML documentation will contain the timesstamp.
+
+HTML_TIMESTAMP         = NO
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the
+# mathjax.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in all dot files that doxygen generates.
+# When you want a differently looking font you can specify the font name
+# using DOT_FONTNAME. You need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
diff --git a/nfapi/open-nFAPI/docs/Doxyfile.in b/nfapi/open-nFAPI/docs/Doxyfile.in
new file mode 100644
index 0000000000000000000000000000000000000000..74d405ad000e5b796d92948249e95018a1b4bb33
--- /dev/null
+++ b/nfapi/open-nFAPI/docs/Doxyfile.in
@@ -0,0 +1,1720 @@
+# Doxyfile 1.7.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a hash (#) is considered a comment and will be ignored.
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = @PACKAGE_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         = @PACKAGE_VERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penalty.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  = @top_srcdir@/nfapi/public_inc @top_srcdir@/pnf/public_inc @top_srcdir@/vnf/public_inc @top_srcdir@/docs/doxygen.h
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS          =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header. Note that when using a custom header you are responsible
+# for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is adviced to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# If the HTML_TIMESTAMP tag is set to YES then the generated HTML documentation will contain the timesstamp.
+
+HTML_TIMESTAMP         = NO
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the
+# mathjax.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in all dot files that doxygen generates.
+# When you want a differently looking font you can specify the font name
+# using DOT_FONTNAME. You need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
diff --git a/nfapi/open-nFAPI/docs/Makefile.am b/nfapi/open-nFAPI/docs/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..9530fa844d9d99e1a8df86f3c90dddcb46008826
--- /dev/null
+++ b/nfapi/open-nFAPI/docs/Makefile.am
@@ -0,0 +1,35 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+if HAVE_DOXYGEN
+directory = $(top_srcdir)/docs/man/man3/
+
+dist_man_MANS = $(directory)/man_page_1.3 $(directory)/man_page_2.3
+$(directory)/man_page_1.3: doxyfile.stamp
+$(directory)/man_page_2.3: doxyfile.stamp
+
+doxyfile.stamp:
+	$(DOXYGEN) Doxyfile
+	echo Timestamp > doxyfile.stamp
+
+CLEANFILES = doxyfile.stamp
+
+all-local: doxyfile.stamp
+clean-local:
+	rm -rf $(top_srcdir)/docs/man
+	rm -rf $(top_srcdir)/docs/html
+	rm -rf $(top_srcdir)/docs/latex
+endif
diff --git a/nfapi/open-nFAPI/docs/doxygen.h b/nfapi/open-nFAPI/docs/doxygen.h
new file mode 100644
index 0000000000000000000000000000000000000000..ae815e68d6feb2389a7978e182998a5300e0a1b8
--- /dev/null
+++ b/nfapi/open-nFAPI/docs/doxygen.h
@@ -0,0 +1,327 @@
+/*! \mainpage Open Network Function Application Platform Interface (Open-nFAPI)
+ *
+ * \section intro_sec Introduction
+ *
+ * Open-nFAPI is implementation of the Small Cell Forum's network femto API or nFAPI for short. 
+ * nFAPI defines a network protocol that is used to connect a Physical Network Function (PNF) 
+ * running LTE Layer 1 to a Virtual Network Function (VNF) running LTE Layer 2 and above. The specification
+ * can be found at http://scf.io/documents/082.
+ *
+ * The aim of Open-nFAPI is to provide an open interface between LTE Layer 1 and Layer 2 to allow for
+ * interoperability between the PNF and VNF & also to facilitate the sharing of PNF's between
+ * different VNF's
+ *
+ * Open-nFAPI implements the P4, P5 and P7 interfaces as defined by the nFAPI specification. 
+ * - The P5 interface allows the VNF to query and configure the 'resources' of the PNF; slicing it into
+ * 1 or more phy instances.  
+ * - The P7 interface is used to send the subframe information between the PNF and VNF for 1 or more phy instances
+ * - The P4 interface allows the VNF to request the PNF phy instances to perform measurements of the surrounding network
+ *
+ * The remaining interfaces are currently outside of the scope of this project.
+ *
+ * The best place to start is by reviewing the detailed nFAPI call flow which can be \ref nfapi_call_flow "here"
+ * 
+ * \section contrib Contibuting
+ *
+ * The Small Cell Forum cordially requests that any derivative work that looks to extend 
+ * the nFAPI libraries use the specified vendor extension techniques, so ensuring 
+ *the widest interoperability of the baseline nFAPI specification in those derivative works.
+ * 
+ * \section install_sec Installation
+ *
+ * \subsection step1 Step 1: Opening the box
+ *
+ * etc...
+ *
+ * \section dir_struct Directory Structure
+ * \code
+ 
+ *     nfapi
+ *     |- common                    Common functions for the nfapi project
+ *     |  |- src
+ *     |  |- public-inc
+ *     |- nfapi                     The NFAPI lib
+ *     |  |- inc
+ *     |  |- src
+ *     |  |- public-inc             Public interface for the nfapi library
+ *     |  |- tests                  Unit test for the nfapi lib
+ *     |- pnf                       The PNF lib
+ *     |  |- inc
+ *     |  |- src
+ *     |  |- public-inc             Public interface for the pnf library
+ *     |  |- tests                  Unit test for the pnf lib
+ *     |- vnf                       The VNF lib
+ *     |  |- inc
+ *     |  |- src
+ *     |  |- public-inc             Public interface for the vnf library
+ *     |  |- tests                  Unit test for the vnf lib
+ *     |- sim_common                Common functions for the nfapi simulators
+ *     |  |- inc
+ *     |  |- src
+ *     |- pnf_sim                   The PNF simulator
+ *     |  |- inc
+ *     |  |- src
+ *     |- vnf_sim                   The VNF simulator
+ *     |  |- inc
+ *     |  |- src
+ *     |- integration_tests         Integration tests that run both VNF & PNF simulators
+ *     |  |- inc
+ *     |  |- src
+ *     |- docs                      Documentation
+ *     |- xml                       Xml configuration for the simulator
+ 
+ * \endcode
+ * \section building Building
+ * To build the nfapi project and run the unit test you will need to 
+ * \code
+ *     autoreconf -i
+ *     ./configure
+ *     make
+ *     make check
+ * \endcode
+ * The following dependencies will be required
+ * - Boost. Need to build the simulators
+ * - STCP. Need to run the simulators
+ * - 
+ * \section simulators  Running the simulators
+ * Once you have build the nfapi project you can run the PNF/VNF simulators on either the same
+ * of seperate linux machines. 
+ * 
+ * To run the VNF from the vnf_sim directory.
+ * \code
+ *     ./vnfsim 4242 ../xml/vnf_A.xml
+ * [MAC] Rx Data from 8891
+ * [MAC] Tx Data to 10.231.16.80.8892
+ * Calling nfapi_vnf_start
+ * 2035.854438: 0x04:  773068608: nfapi_vnf_start()
+ * 2035.854450: 0x04:  773068608: Starting P5 VNF connection on port 4242
+ * 2035.854472: 0x04:  773068608: P5 socket created... 3
+ * 2035.854478: 0x03:  773068608: VNF Setting the SCTP_INITMSG
+ * 2035.854481: 0x04:  773068608: IPV4 binding to port 4242
+ * 2035.854485: 0x04:  773068608: bind succeeded..3.
+ * 2035.854497: 0x04:  773068608: listen succeeded...
+ * \endcode
+ *
+ * 
+ * To run the PNF from the pnf_sim directory
+ * \code
+ *     ./pnfsim 127.0.01 4242 ../xml/pnf_phy_1_A.xml
+ * nfapi_pnf_start
+ * Starting P5 PNF connection to VNF at 127.0.0.1:4242
+ * Host address info  0 Family:IPV4 Address:127.0.0.1
+ * PNF Setting the SCTP_INITMSG
+ * P5 socket created...
+ * Socket CONNECTED
+ * PNF_PARAM.request received
+ * [PNF_SIM] pnf param request
+ * PNF_CONFIG.request received
+ * [PNF_SIM] pnf config request
+ * .... and so on
+ * \endcode
+ * 
+ * You can Ctrl-C to exit the simulators. 
+ * 
+
+ */
+
+/*! \page nfapi_call_flow NFAPI Call Flow
+ *
+ * \section seq_diag Sequence diagram
+ *
+ * The follow sequence digram show how the nFAPI api will be used to bring up 
+ * the PNF and then the PNF PHY and initiate subframe message exchange
+ * The names of the CLIENT callbacks are placeholders for the functions that 
+ * the CLIENT will provide.
+ *
+ * \msc
+ *
+ *   width="1750";
+ *   FAPI, PNF_P7_CLIENT, PNF_P7_LIB, PNF_P5_CLIENT, PNF_P5_LIB, VNF_P5_LIB, VNF_P5_CLIENT, VNF_P7_LIB, VNF_P7_CLIENT, MAC;
+ *   VNF_P5_CLIENT=>VNF_P5_LIB		[label="nfapi_vnf_config_create", URL="\ref nfapi_vnf_config_create"];
+ *   VNF_P5_CLIENT=>VNF_P5_LIB		[label="nfapi_vnf_start", URL="\ref nfapi_vnf_start"];
+ *   VNF_P5_LIB note VNF_P5_LIB		[label="Listening for PNF connection"];
+ *   PNF_P5_CLIENT note PNF_P5_CLIENT		[label="P9 has provided the address of the VNF"];
+ *	 PNF_P5_CLIENT=>PNF_P5_LIB		[label="nfapi_pnf_config_create", URL="\ref nfapi_pnf_config_create"];
+ *	 PNF_P5_CLIENT=>PNF_P5_LIB		[label="nfapi_pnf_start", URL="\ref nfapi_pnf_start"];
+ *   PNF_P5_LIB note PNF_P5_LIB		[label="PNF STATE : PNF IDLE"];
+ *   PNF_P5_LIB->VNF_P5_LIB			[label="<connect>"];
+ *   VNF_P5_LIB=>VNF_P5_CLIENT		[label="pnf_connection_indication", URL="\ref nfapi_vnf_config::pnf_connection_indication"];
+ *
+ *   VNF_P5_LIB<=VNF_P5_CLIENT		[label="nfapi_vnf_pnf_param_req", URL="\ref nfapi_vnf_pnf_param_req"];
+ *   VNF_P5_LIB->PNF_P5_LIB			[label="PNF_PARAM.request"];
+ *   PNF_P5_LIB=>PNF_P5_CLIENT		[label="pnf_param_request", URL="\ref nfapi_pnf_config::pnf_param_req"];
+ *   PNF_P5_LIB<=PNF_P5_CLIENT		[label="nfapi_pnf_pnf_param_response", URL="\ref nfapi_pnf_pnf_param_resp"];
+ *   VNF_P5_LIB<-PNF_P5_LIB			[label="PNF_PARAM.response"];
+ *   VNF_P5_LIB=>VNF_P5_CLIENT		[label="pnf_param_response", URL="\ref nfapi_vnf_config::pnf_param_resp"];
+ *
+ *   VNF_P5_LIB<=VNF_P5_CLIENT		[label="nfapi_vnf_pnf_config_req", URL="\ref nfapi_vnf_pnf_config_req"];
+ *   VNF_P5_LIB->PNF_P5_LIB			[label="PNF_CONFIG.request"];
+ *   PNF_P5_LIB=>PNF_P5_CLIENT		[label="pnf_config_request", URL="\ref nfapi_pnf_config::pnf_config_req"];
+ *   PNF_P5_LIB<=PNF_P5_CLIENT		[label="nfapi_pnf_pnf_config_response", URL="\ref nfapi_pnf_pnf_config_resp"];
+ *   PNF_P5_LIB note PNF_P5_LIB		[label="PNF STATE : PNF CONFIGURED"];
+ *   VNF_P5_LIB<-PNF_P5_LIB			[label="PNF_CONFIG.response"];
+ *   VNF_P5_LIB=>VNF_P5_CLIENT		[label="pnf_config_response", URL="\ref nfapi_vnf_config::pnf_config_resp"];
+ *
+ *   VNF_P5_LIB<=VNF_P5_CLIENT		[label="nfapi_vnf_pnf_start_req", URL="\ref nfapi_vnf_pnf_start_req"];
+ *   VNF_P5_LIB->PNF_P5_LIB			[label="PNF_START.request"];
+ *   PNF_P5_LIB=>PNF_P5_CLIENT		[label="pnf_start_request", URL="\ref nfapi_pnf_config::pnf_start_req"];
+ *   PNF_P5_CLIENT=>FAPI			[label="<create>"];
+ *   FAPI note FAPI					[label="FAPI STATE : IDLE"];
+ *   PNF_P5_LIB<=PNF_P5_CLIENT		[label="nfapi_pnf_pnf_start_response", URL="\ref nfapi_pnf_pnf_start_resp"];
+ *   PNF_P5_LIB note PNF_P5_LIB		[label="PNF STATE : PNF RUNNING"];
+ *   VNF_P5_LIB<-PNF_P5_LIB			[label="PNF_START.response"];
+ *   VNF_P5_LIB=>VNF_P5_CLIENT		[label="pnf_start_response", URL="\ref nfapi_vnf_config::pnf_param_resp"];
+ *
+ *   --- [ label="If vnf p7 instance not already running"];
+ *   VNF_P5_CLIENT=>VNF_P5_LIB	    [label="nfapi_vnf_allocate_phy", URL="\ref nfapi_vnf_allocate_phy"];
+ *   VNF_P5_CLIENT=>VNF_P7_CLIENT	[label="<create>"];
+ *   VNF_P7_CLIENT=>VNF_P7_LIB		[label="nfapi_vnf_p7_config_create", URL="\ref nfapi_vnf_p7_config_create"];
+ *   VNF_P7_CLIENT=>VNF_P7_LIB		[label="nfapi_vnf_p7_start", URL="\ref nfapi_vnf_p7_start"];
+ *   ---;
+ *
+ *   VNF_P5_LIB<=VNF_P5_CLIENT		[label="nfapi_vnf_param_request", URL="\ref nfapi_vnf_param_req"];
+ *   VNF_P5_LIB->PNF_P5_LIB			[label="PARAM.request"];
+ *   PNF_P5_LIB=>PNF_P5_CLIENT		[label="param_request", URL="\ref nfapi_pnf_config::param_req"];
+ *   PNF_P5_CLIENT=>FAPI			[label="fapi_param_request"];
+ *   PNF_P5_CLIENT<=FAPI			[label="fapi_param_response"];
+ *   PNF_P5_CLIENT=>PNF_P7_CLIENT	[label="<create>"];
+ *   PNF_P7_CLIENT=>PNF_P7_LIB		[label="nfapi_pnf_p7_create", URL="\ref nfapi_pnf_p7_config_create"];
+ *   PNF_P7_CLIENT=>PNF_P7_LIB		[label="nfapi_pnf_p7_start", URL="\ref nfapi_pnf_p7_start"];
+ *   PNF_P5_LIB<=PNF_P5_CLIENT		[label="nfapi_pnf_param_response", URL="\ref nfapi_pnf_param_resp"];
+ *   VNF_P5_LIB<-PNF_P5_LIB			[label="PARAM.response"];
+ *   VNF_P5_LIB=>VNF_P5_CLIENT		[label="param_response", URL="\ref nfapi_vnf_config::param_resp"];
+ *
+ *   VNF_P5_LIB<=VNF_P5_CLIENT		[label="nfapi_vnf_config_request", URL="\ref nfapi_vnf_config_req"];
+ *   VNF_P5_LIB->PNF_P5_LIB			[label="CONFIG.request"];
+ *   PNF_P5_LIB=>PNF_P5_CLIENT		[label="config_request", URL="\ref nfapi_pnf_config::config_req"];
+ *   PNF_P5_CLIENT=>FAPI			[label="fapi_config_request"];
+ *   FAPI note FAPI					[label="FAPI STATE : CONFIGURED"];
+ *   PNF_P5_CLIENT<=FAPI			[label="fapi_config_response"];
+ *   PNF_P5_LIB<=PNF_P5_CLIENT		[label="nfapi_pnf_config_response", URL="\ref nfapi_pnf_param_resp"];
+ *   VNF_P5_LIB<-PNF_P5_LIB			[label="CONFIG.response"];
+ *   VNF_P5_LIB=>VNF_P5_CLIENT		[label="config_response", URL="\ref nfapi_vnf_config::config_resp"];
+ *
+ *   VNF_P5_LIB<=VNF_P5_CLIENT		[label="nfapi_vnf_start_request", URL="\ref nfapi_vnf_start_req"];
+ *   VNF_P5_LIB->PNF_P5_LIB			[label="START.request"];
+ *   PNF_P5_LIB=>PNF_P5_CLIENT		[label="start_request", URL="\ref nfapi_pnf_config::start_req"];
+ *   PNF_P5_CLIENT=>FAPI			[label="fapi_start_request"];
+ *   FAPI note FAPI					[label="FAPI STATE : RUNNING"];
+ *   FAPI note FAPI					[label="FAPI will start sending subframe indications"];
+ *
+ *   --- [ label="For each 'phy' subframe"];
+ *   FAPI=>PNF_P7_CLIENT			[label="fapi_subframe_indication"];
+ *   PNF_P7_CLIENT=>PNF_P7_LIB		[label="nfapi_pnf_p7_subframe_ind", URL="\ref nfapi_pnf_p7_subframe_ind"];
+ *   ---;
+ *   PNF_P7_CLIENT=>PNF_P5_CLIENT	[label="<start_response>"];
+ *
+ *   PNF_P5_LIB<=PNF_P5_CLIENT		[label="nfapi_pnf_start_response", URL="\ref nfapi_pnf_start_resp"];
+ *   VNF_P5_LIB<-PNF_P5_LIB			[label="START.response"];
+ *   VNF_P5_LIB=>VNF_P5_CLIENT		[label="start_response", URL="\ref nfapi_vnf_config::start_resp"];
+ *   VNF_P5_CLIENT=>VNF_P7_CLIENT	[label="<p7_add_pnf>"];
+ *   VNF_P7_CLIENT=>VNF_P7_LIB		[label="nfapi_vnf_p7_add_pnf", URL="\ref nfapi_vnf_p7_add_pnf"];
+ *
+ *   VNF_P7_LIB->PNF_P7_LIB			[label="DL_NODE_SYNC"];
+ *   VNF_P7_LIB<-PNF_P7_LIB			[label="UL_NODE_SYNC"];
+ *   VNF_P7_LIB<-PNF_P7_LIB			[label="TIMING_INFO"];
+ *   VNF_P7_LIB note VNF_P7_LIB		[label="When sync is achieved"];
+ *
+ *   VNF_P7_LIB=>VNF_P7_CLIENT		[label="sync_indication", URL="\ref nfapi_vnf_p7_config::sync_indication"];
+ *
+ *   --- [ label="For each 'vnf phy' subframe"];
+ *   VNF_P7_LIB=>VNF_P7_CLIENT		[label="subframe_indication(tti=x)", URL="\ref nfapi_vnf_p7_config::subframe_indication"];
+ *   VNF_P7_CLIENT=>MAC				[label="subframe_indication"];
+ *   VNF_P7_CLIENT<=MAC				[label="dl_config_req"];
+ *   VNF_P7_CLIENT=>VNF_P7_LIB		[label="nfapi_vnf_p7_dl_config_req", URL="\ref nfapi_vnf_p7_dl_config_req"];
+ *   VNF_P7_LIB->PNF_P7_LIB			[label="DL_CONFIG.request"];
+ *   PNF_P7_LIB note PNF_P7_LIB		[label="Store in subframe buffer for tti x"];
+ *   VNF_P7_CLIENT<=MAC				[label="ul_config_req"];
+ *   VNF_P7_CLIENT=>VNF_P7_LIB		[label="nfapi_vnf_p7_ul_config_req", URL="\ref nfapi_vnf_p7_ul_config_req"];
+ *   VNF_P7_LIB->PNF_P7_LIB			[label="UL_CONFIG.request"];
+ *   PNF_P7_LIB note PNF_P7_LIB		[label="Store in subframe buffer for tti x"];
+ *   VNF_P7_CLIENT<=MAC				[label="hi_dci0_req"];
+ *   VNF_P7_CLIENT=>VNF_P7_LIB		[label="nfapi_vnf_p7_hi_dci0_req", URL="\ref nfapi_vnf_p7_hi_dci0_req"];
+ *   VNF_P7_LIB->PNF_P7_LIB			[label="HI_DCI0.request"];
+ *   PNF_P7_LIB note PNF_P7_LIB		[label="Store in subframe buffer for tti x"];
+ *   VNF_P7_CLIENT<=MAC				[label="tx_req"];
+ *   VNF_P7_CLIENT=>VNF_P7_LIB		[label="nfapi_vnf_p7_tx_req", URL="\ref nfapi_vnf_p7_tx_req"];
+ *   VNF_P7_LIB->PNF_P7_LIB			[label="TX.request"];
+ *   PNF_P7_LIB note PNF_P7_LIB		[label="Store in subframe buffer for tti x"];
+ *   ---;
+ *
+ *
+ *   --- [ label="For each 'phy' subframe"];
+ *
+ *   FAPI=>PNF_P7_CLIENT			[label="harq_indication"];
+ *   PNF_P7_CLIENT=>PNF_P7_LIB		[label="nfapi_pnf_p7_harq_ind", URL="\ref nfapi_pnf_p7_harq_ind"];
+ *   PNF_P7_LIB->VNF_P7_LIB			[label="HARQ.ind"];
+ *   VNF_P7_LIB=>VNF_P7_CLIENT		[label="harq_ind", URL="\ref nfapi_vnf_p7_config::harq_indication"];
+ *   VNF_P7_CLIENT=>MAC				[label="harq_ind"];
+ *
+ *   FAPI=>PNF_P7_CLIENT			[label="subframe_indication(tti=x)"];
+ *   PNF_P7_CLIENT=>PNF_P7_LIB		[label="nfapi_pnf_p7_subframe_ind", URL="\ref nfapi_pnf_p7_subframe_ind"];
+ *   PNF_P7_LIB note PNF_P7_LIB		[label="Send data from subframe buffer for tti x"];
+ *   PNF_P7_LIB=>PNF_P7_CLIENT		[label="dl_config_req", URL="\ref nfapi_pnf_p7_config::dl_config_req"];
+ *   PNF_P7_CLIENT=>FAPI			[label="dl_config_req"];
+ *   PNF_P7_LIB=>PNF_P7_CLIENT		[label="ul_config_req", URL="\ref nfapi_pnf_p7_config::ul_config_req"];
+ *   PNF_P7_CLIENT=>FAPI			[label="ul_config_req"];
+ *   PNF_P7_LIB=>PNF_P7_CLIENT		[label="hi_dci0_req", URL="\ref nfapi_pnf_p7_config::hi_dci0_req"];
+ *   PNF_P7_CLIENT=>FAPI			[label="hi_dci0_req"];
+ *   PNF_P7_LIB=>PNF_P7_CLIENT		[label="tx_req", URL="\ref nfapi_pnf_p7_config::tx_req"];
+ *   PNF_P7_CLIENT=>FAPI			[label="tx_req"];
+ *   ---;
+ *
+ * \endmsc
+ *
+ * \section seq_diag_bca BCA
+ *
+ * -#	The VNF_P5_CLIENT is created. If it left to the VRAN partner to define how that is done. The client is responsiable to creation of the thread with the correct priorities within the wider system.
+ * -#	The VNF_P5_CLIENT creates and initializes the VNF_P5_LIB (nfapi_vnf_config_create & nfapi_vnf_start) providing the address that it should listen on for incoming SCTP connections. It is expected that this would be provided by some VNF management system. The VNF_P5_CLIENT also provides information on the callbacks that the VNF_P5_LIB will use to inform the VNF_P5_CLIENT of the received messages
+ * \code
+ * nfapi_vnf_config_t* vnf_config = nfapi_vnf_config_create();
+ * vnf_config->pnf_connection_indication = &pnf_connection_indication;
+ * vnf_config->pnf_param_resp = &pnf_param_resp;
+ * nfapi_vnf_start(vnf_config);
+ * \endcode
+ * -#	It is FFS how the address information of the VNF P5 is passed to the PNF over P9, but assuming that has been done
+ * -#	The PNF_P5_CLIENT is created and then creates the PNF_P5_LIB (nfapi_pnf_init & nfapi_pnf_start) passing the address of the VNF to connect to. The PNF_P5_CLIENT also provides information on the callbacks that the PNF_P5_LIB will use to inform the PNF_P5_CLIENT of the received messages
+ * \code
+ * nfapi_pnf_config_t* pnf_config = nfapi_pnf_config_create();
+ * pnf_config->pnf_param_req = &pnf_param_req;
+ * nfapi_pnf_start(pnf_config);
+ * \endcode
+ * -#	The PNF_P5_LIB attempts to establish connection to the VNF_P5 endpoint
+ * -#	The VNF_P5_LIB receives the STCP connection request and indicates this to the VNF_P5_CLIENT (pnf_connection_indication). The VNF_P5_CLIENT can decide to accept or reject the connection.
+  * \code
+ * int pnf_connection_indication(nfapi_vnf_config_t* config, int p5_idx) {
+ *   // send the PNF_PARAM.request
+ *   nfapi_pnf_param_request_t req;
+ *   memset(&req, 0, sizeof(req));
+ *   req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
+ *   nfapi_vnf_pnf_param_req(config, p5_idx, req);
+ *   return 0;
+ * }
+ * \endcode
+
+ * -#	The VNF and PNF then proceed to exchange the NFAPI PNF messages (PNF_PARAM, PNF_CONFIG and PNF_START). At each stage the LIB’s invoke callbacks on the CLIENT’s for them to handle message the return the appropriate response. 
+ * -#	Finally the VNF will send the PNF_START.req which will invoke the PNF_P5_CLIENT nfapi_pnf_start_request callback. This is the point at which it is expect that the PNF_CLIENT will create the FAPI module. The PNF_P5_CLIENT will need to perform the translation between NFAPI structures and vendor specific FAPI structures for messages sent between the PNF_P5_LIB and the FAPI interface.
+ * -#	The PNF_START.response will sent back to the VNF and at this point the VNF_P5_CLIENT will need to decide which VNF_P7 instance will handle the P7 connection. i.e. it needs to determine the IP address and port number of the P7 VNF instance. 
+ * -#	A new VNF_P7_CLIENT & VNF_P7_LIB should be configured and started if necessary.
+ * -#	The VNF_P5 will then send the PARAM.request to the PNF_P5 which will forward it onto the FAPI interface. This PARAM.request includes the VNF_P7 address. The PNF_P7_CLIENT must decide on the PNF P7 address. This information is used to create and initialize the PNF_P7_LIB. The PNF_P7 address is then returned by the PNF_P5 to the VNF_P5 in the PARAM.response.
+ * -#	The VNF_P5 will then exchange with the PNF_P5 the CONFIG.request/response which will be used to configure the PNF FAPI instance.
+ * -#	The VNF_P5 will then decide to start the PNF_P7 by sending the START.request.
+ * -#	The PNF_P5_CLIENT need to send the start request to the FAPI instance. The response which is the start of subframe indications from the FAPI. In receipt of the first subframe indication the PNF_P5_CLIENT will send the START.response to the VNF_P5 via the PNF_P5_LIB
+ * -#	The FAPI subframe indications should be forwarded to the PNF_P7_LIB by the PNF_P7_CLIENT. Until the VNF_P7 instance has sent the subframe configuration messages (dl_config, ul_config, etc) the PNF_P7_LIB will send ‘dummy’ subframe configuration messages. The contents of which are configurable by the PNF_P7_CLIENT.
+ * -#	When the VNF_P5_CLIENT receives the START.response it will need to ‘communicate’ with the VNF_P7_CLIENT to inform it that the PNF_P7 instance has started. The VNF_P7_CLIENT will call the nfapi_vnf_P7_add_pnf function passing the address details of the PNF_P7 instance.
+ * -#	The VNF_P7_LIB will then start the sync procedure to establish sub frame synchronization between the PNF_P7 and VNF_P7 instances. This involves sending the DL_NODE_SYNC and UL_NODE_SYNC to determine network latency and PNF processing latency to be able to request MAC generate sub frames in advance on when they are required by the FAPI interface.
+ * -#	When sync is achieved the VNF_P7_LIB will send the nfapi_sync_indication to the VNF_P7_CLIENT. 
+ * -#	The VNF_P7_LIB will then start issuing sub frame indications to the VNF_P7_CLIENT. The logical intent is that they indications are sent every millisecond. However due to the scheduling jitter that may be seen by the VNF these subframe indications may be less than or more than 1ms apart. How this is handled is one of the critical functions of the VNF_P7_LIB and may require specialization or requirements on the VNF environment i.e. CPU pinning.
+ * -#	The VNF_P7_LIB will send the subframe_indication to the VNF_P7_CLIENT for ‘x’ subframe’s inadvance of the current TTI at the PNF. The delta ‘x’ will be determined by the sync procedure and how far in advance the FAPI needs to receive messages before RF transmission. 
+ * -#	The VNF_P7_CLIENT is then responsible for communicating to the MAC layer to prepare the dl_config_request, ul_config_request, hi_dci0_request, tx_req in a timely manner and sending them to the VNF_P7_LIB
+ * -#	The VNF_P7_LIB will send them to the VNF_P7_LIB. 
+ * -#	The PNF_P7_LIB will store these messages in a subframe buffer or playout buffer in advance of when they are required by FAPI.
+ *  -#	The PNF_P7_LIB will monitor to see if these messages arrive too late and if they do trigger a TIMING_INFO response to the VNF_P7_LIB to reassess if the sync is still valid.
+ * -#	As some time in the future the FAPI will send a subframe indication for the TTI that the VNF_P7_LIB had previously requested.
+ * -#	The PNF_P7_LIB will then use the messages in the subframe buffer and send them too the FAPI interface for transmission. The PNF_P7_CLIENT will need to perform the translation between NFAPI structure and vendor specific FAPI structures
+ * -#	This subframe exchange will continue and allow high layer MAC and RRC function to bringup the cell and connect UE’s
+
+ */
diff --git a/nfapi/open-nFAPI/integration_tests/Makefile.am b/nfapi/open-nFAPI/integration_tests/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..2413590182596bea836252483d9ed1ccc4eb22af
--- /dev/null
+++ b/nfapi/open-nFAPI/integration_tests/Makefile.am
@@ -0,0 +1,29 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+#vnf unit test
+AM_CPPFLAGS = -I../nfapi/inc -I../nfapi/public_inc  -I../common/public_inc -I../vnf/public_inc $(CFLAGS_CUNIT) -Wall -Werror
+
+export LD_LIBRARY_PATH=/opt/gcc-4.7.3/lib
+check_PROGRAMS= nfapi_integration_tests
+nfapi_integration_tests_SOURCES = main.cpp ../common/src/debug.c   
+nfapi_integration_tests_LDADD= -L$(libdir) -lpthread -lrt  -lcunit
+
+
+
+LOG_DRIVER = $(top_srcdir)/tap-driver.sh
+TESTS=nfapi_integration_tests
+EXTRA_DIST=$(TESTS)
diff --git a/nfapi/open-nFAPI/integration_tests/main.cpp b/nfapi/open-nFAPI/integration_tests/main.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..83c48afec3d086374bd8221ba6918f1c1c27845f
--- /dev/null
+++ b/nfapi/open-nFAPI/integration_tests/main.cpp
@@ -0,0 +1,269 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CUnit.h"
+#include "Basic.h"
+#include "Automated.h"
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+int start_vnf_proc(int port)
+{
+	char port_str[10];
+	sprintf(port_str, "%d", port);
+
+	const char *argv[]  = {"vnfsim", port_str, "../xml/vnf_A.xml", NULL};
+	int pid = fork();
+
+	if(pid == 0)
+	{
+		int result = execv("../vnf_sim/vnfsim", (char* const*)argv); //, env_args);
+		if(result == -1)
+		{
+			printf("Failed to exec vnf process %d\n", errno);
+		}
+		exit(0);
+	}
+	else
+	{
+		return pid;
+	}
+}
+
+int start_pnf_proc(const char* addr, int port, const char* file)
+{
+	char port_str[10];
+	sprintf(port_str, "%d", port);
+
+	char filename[256];
+	sprintf(filename, "../xml/%s", file);
+
+	const char * argv[] = {"pnfsim", addr, port_str, filename, NULL};
+	int pid = fork();
+
+	if(pid == 0)
+	{
+		int result = execv("../pnf_sim/pnfsim", (char* const*)argv); //, env_args);
+		if(result == -1)
+		{
+			printf("Failed to exec pnf process %d\n", errno);
+		}
+		exit(0);
+	}
+	else
+	{
+		return pid;
+	}
+}
+
+int kill_proc(int pid)
+{
+	kill(pid, SIGKILL);
+
+	int status;
+	int waitpid_result = waitpid(pid, &status, 0);
+
+	return waitpid_result;
+}
+
+
+void test_1()
+{
+
+	int pnf_port = 5655;
+	const char* pnf_addr = "localhost";
+
+	printf("**** starting vnf *****\n");
+	int vnf_pid = start_vnf_proc(pnf_port);
+
+	printf("**** starting pnf *****\n");
+	int pnf1_pid = start_pnf_proc(pnf_addr, pnf_port, "pnf_phy_1_A.xml");
+
+
+	sleep(10);
+
+	printf ("*** Terminating ****\n");
+	kill_proc(vnf_pid);
+	kill_proc(pnf1_pid);
+}
+void test_1a()
+{
+
+	int pnf_port = 5655;
+	const char* pnf_addr = "localhost";
+
+	printf("**** starting vnf *****\n");
+	int vnf_pid = start_vnf_proc(pnf_port);
+
+	printf("**** starting pnf *****\n");
+	int pnf1_pid = start_pnf_proc(pnf_addr, pnf_port, "pnf_phy_2_A.xml");
+
+
+	sleep(10);
+
+	printf ("*** Terminating ****\n");
+	kill_proc(vnf_pid);
+	kill_proc(pnf1_pid);
+}
+
+
+void test_2()
+{
+	int pnf_port = 5655;
+	const char* pnf_addr = "127.0.0.1";
+
+	int vnf_pid = start_vnf_proc(pnf_port);
+	sleep(2);
+
+	int pnf1_pid = start_pnf_proc(pnf_addr, pnf_port, "pnf_phy_1_A.xml");	
+	int pnf2_pid = start_pnf_proc(pnf_addr, pnf_port, "pnf_phy_1_A.xml");	
+
+	sleep(2);
+
+	kill_proc(pnf2_pid);
+	kill_proc(pnf1_pid);
+	kill_proc(vnf_pid);
+}
+
+void test_32()
+{
+	int pnf_count = 32;
+	int pnf_pid[pnf_count];
+
+	int pnf_port = 5655;
+	const char* pnf_addr = "127.0.0.1";
+
+	int vnf_pid = start_vnf_proc(pnf_port);
+	sleep(2);
+
+	for(int i = 0; i < pnf_count; ++i)
+	{
+		pnf_pid[i] = start_pnf_proc(pnf_addr, pnf_port, "pnf_phy_1_A.xml");
+	}
+
+	sleep(5);
+
+	printf ("*** Terminating pnfs\n");
+
+	for(int i = 0; i < pnf_count; ++i)
+	{
+		kill_proc(pnf_pid[i]);
+	}
+	printf ("*** Terminating vnf\n");
+	kill_proc(vnf_pid);
+}
+
+
+int init_suite()
+{
+	return 0;
+}
+
+int clean_suite()
+{
+	return 0;
+}
+
+int main ( void )
+{
+   CU_pSuite pSuite = NULL;
+
+   /* initialize the CUnit test registry */
+   if ( CUE_SUCCESS != CU_initialize_registry() )
+      return CU_get_error();
+
+   /* add a suite to the registry */
+   pSuite = CU_add_suite( "integration_test_suite", init_suite, clean_suite );
+   if ( NULL == pSuite ) 
+   {
+      CU_cleanup_registry();
+      return CU_get_error();
+   }
+
+        //(NULL == CU_add_test(pSuite, "vnf_test_start_connect_2", vnf_test_start_connect_2)) 
+   /* add the tests to the suite */
+   if ( (NULL == CU_add_test(pSuite, "test_1a", test_1a))
+//        (NULL == CU_add_test(pSuite, "test_2", test_2)) ||
+//        (NULL == CU_add_test(pSuite, "test_32", test_32))
+      )
+   {
+      CU_cleanup_registry();
+      return CU_get_error();
+   }
+
+   // Run all tests using the basic interface
+   CU_basic_set_mode(CU_BRM_VERBOSE);
+   CU_set_output_filename("vnf_unit_test_results.xml");
+   CU_basic_run_tests();
+
+	CU_pSuite s = CU_get_registry()->pSuite;
+	int count = 0;
+	while(s)
+	{
+		CU_pTest t = s->pTest;
+		while(t)
+		{
+			count++;
+			t = t->pNext;
+		}
+		s = s->pNext;
+	}
+
+	printf("%d..%d\n", 1, count);
+
+
+
+	s = CU_get_registry()->pSuite;
+	count = 1;
+	while(s)
+	{
+		CU_pTest t = s->pTest;
+		while(t)
+		{
+			int pass = 1;
+			CU_FailureRecord* failures = CU_get_failure_list();
+			while(failures)
+			{
+				if(strcmp(failures->pSuite->pName, s->pName) == 0 &&
+				   strcmp(failures->pTest->pName, t->pName) == 0)
+				{
+					pass = 0;
+					failures = 0;
+				}
+				else
+				{
+					failures = failures->pNext;
+				}
+			}
+
+			if(pass)
+				printf("ok %d - %s:%s\n", count, s->pName, t->pName);
+			else 
+				printf("not ok %d - %s:%s\n", count, s->pName, t->pName);
+
+			count++;
+			t = t->pNext;
+		}
+		s = s->pNext;
+	}
+
+   CU_cleanup_registry();
+   return CU_get_error();
+
+}
diff --git a/nfapi/open-nFAPI/nfapi/Makefile.am b/nfapi/open-nFAPI/nfapi/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..853ee9ff80a35529fac8a3e4937c6707512f32c5
--- /dev/null
+++ b/nfapi/open-nFAPI/nfapi/Makefile.am
@@ -0,0 +1,30 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+AUTOMAKE_OPTIONS=subdir-objects
+AM_CPPFLAGS = -I$(top_srcdir)/nfapi/inc -I$(top_srcdir)/nfapi/public_inc  -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/pnf/public_inc  $(BOOST_CPPFLAGS) -Wall -Werror -g
+
+noinst_LIBRARIES = libnfapi.a
+
+libnfapi_a_SOURCES = src/nfapi.c  src/nfapi_p5.c  src/nfapi_p7.c src/nfapi_p4.c
+libnfapi_a_CFLAGS =$(AM_CFLAGS)
+
+lib_LTLIBRARIES = libnfapi.la
+libnfapi_la_SOURCES =  src/nfapi.c  src/nfapi_p5.c  src/nfapi_p7.c src/nfapi_p4.c
+
+
+LDADD= ../pnf/src/libnfapi_pnf.a ../vnf/src/libnfapi_vnf.a ../common/bin/libnfapi_common.a 
+
diff --git a/nfapi/open-nFAPI/nfapi/inc/nfapi.h b/nfapi/open-nFAPI/nfapi/inc/nfapi.h
new file mode 100644
index 0000000000000000000000000000000000000000..65ad4dd1609653c85b67dd777f2491859de4ab63
--- /dev/null
+++ b/nfapi/open-nFAPI/nfapi/inc/nfapi.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef _NFAPI_H_
+#define _NFAPI_H_
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+// todo : move to public_inc so can be used by vendor extensions
+
+#define MAX_BAD_TAG 3
+
+uint8_t push8(uint8_t in, uint8_t **out, uint8_t *end);
+uint8_t pushs8(int8_t in, uint8_t **out, uint8_t *end);
+uint8_t push16(uint16_t in, uint8_t **out, uint8_t *end);
+uint8_t pushs16(int16_t in, uint8_t **out, uint8_t *end);
+uint8_t push32(uint32_t in, uint8_t **out, uint8_t *end);
+uint8_t pushs32(int32_t in, uint8_t **out, uint8_t *end);
+
+uint8_t pull8(uint8_t **in, uint8_t *out, uint8_t *end);
+uint8_t pulls8(uint8_t **in, int8_t *out, uint8_t *end);
+uint8_t pull16(uint8_t **in, uint16_t *out, uint8_t *end);
+uint8_t pulls16(uint8_t **in, int16_t *out, uint8_t *end);
+uint8_t pull32(uint8_t **in, uint32_t *out, uint8_t *end);
+uint8_t pulls32(uint8_t **in, int32_t *out, uint8_t *end);
+
+
+uint32_t pullarray8(uint8_t **in, uint8_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
+uint32_t pullarray16(uint8_t **in, uint16_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
+uint32_t pullarrays16(uint8_t **in, int16_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
+
+uint32_t pusharray8(uint8_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
+uint32_t pusharray16(uint16_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
+uint32_t pusharrays16(int16_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
+
+typedef uint8_t (*pack_array_elem_fn)(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end);
+uint8_t packarray(void* array, uint16_t elem_size, uint16_t max_count, uint16_t count, uint8_t **ppWritePackedMsg, uint8_t *end, pack_array_elem_fn fn);
+
+typedef uint8_t (*unpack_array_elem_fn)(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end);
+uint8_t unpackarray(uint8_t **ppReadPackedMsg, void* array, uint16_t elem_size, uint16_t max_count, uint16_t count, uint8_t *end, unpack_array_elem_fn fn);
+
+uint8_t pack_tl(nfapi_tl_t *tl, uint8_t **ppWritePackedMsg, uint8_t *end);
+uint8_t unpack_tl(uint8_t **ppReadPackedMsg, nfapi_tl_t *tl, uint8_t *end);
+
+typedef uint8_t (*pack_tlv_fn)(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
+uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, pack_tlv_fn fn);
+
+uint32_t pack_vendor_extension_tlv(nfapi_tl_t* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config);
+int unpack_vendor_extension(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config, nfapi_tl_t** ve_tlv);
+
+typedef uint8_t (*unpack_tlv_fn)(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
+typedef struct
+{
+	uint16_t tag;
+	void* tlv;
+	unpack_tlv_fn unpack_func;
+} unpack_tlv_t;
+
+int unpack_tlv_list(unpack_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPackedMsg, uint8_t* packedMsgEnd, nfapi_p4_p5_codec_config_t* config, nfapi_tl_t** ve);
+
+uint32_t pack_p7_vendor_extension_tlv(nfapi_tl_t *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config);
+typedef uint8_t (*unpack_p7_tlv_fn)(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t*);
+typedef struct
+{
+	uint16_t tag;
+	void* tlv;
+	unpack_p7_tlv_fn unpack_func;
+} unpack_p7_tlv_t;
+int unpack_p7_tlv_list(unpack_p7_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPackedMsg, uint8_t* packedMsgEnd, nfapi_p7_codec_config_t* config, nfapi_tl_t** ve);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* _NFAPI_H_ */
diff --git a/nfapi/nfapi_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
similarity index 99%
rename from nfapi/nfapi_interface.h
rename to nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
index 45af99a50f3384725c167e93c064d7dc952fc2be..f665d11c8916f2ce82cea65080f3fad005284e4c 100644
--- a/nfapi/nfapi_interface.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
@@ -34,7 +34,7 @@
 #define NFAPI_MAX_NUM_ANTENNAS 8
 #define NFAPI_MAX_NUM_SUBBANDS 13
 #define NFAPI_MAX_BF_VECTORS 8
-#define NFAPI_MAX_CC 2
+#define NFAPI_MAX_CC 1
 #define NFAPI_MAX_NUM_PHYSICAL_ANTENNAS 8
 #define NFAPI_MAX_RSSI 8
 #define NFAPI_MAX_PSC_LIST 32
@@ -1689,7 +1689,7 @@ typedef struct {
 	uint16_t number_pdu;
 	uint8_t number_pdsch_rnti;
 	uint16_t transmission_power_pcfich;
-        nfapi_dl_config_request_pdu_t* dl_config_pdu_list;
+	nfapi_dl_config_request_pdu_t* dl_config_pdu_list;
 } nfapi_dl_config_request_body_t;
 #define NFAPI_DL_CONFIG_REQUEST_BODY_TAG 0x2000
 
@@ -1962,7 +1962,7 @@ typedef struct {
 } nfapi_ul_config_harq_information_rel8_fdd_t;
 #define NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG 0x2019
 
-typedef struct {  
+typedef struct { 
 	nfapi_tl_t tl;
 	uint8_t harq_size;
 	uint8_t ack_nack_mode;
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi.c b/nfapi/open-nFAPI/nfapi/src/nfapi.c
new file mode 100644
index 0000000000000000000000000000000000000000..3f017bc9a4a53b1fc40d939c308b78642cce2cca
--- /dev/null
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi.c
@@ -0,0 +1,860 @@
+/*
+ * Copyright (c) 2001-2016, Cisco Systems, Inc.
+ * All rights reserved.
+ *  
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 
+ * 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.
+ *  
+ * Neither the name of the Cisco Systems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE
+ * COPYRIGHT HOLDERS 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 <signal.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sched.h>
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+
+#include <nfapi_interface.h>
+#include <nfapi.h>
+#include <debug.h>
+
+
+// Fundamental routines
+
+uint8_t push8(uint8_t in, uint8_t **out, uint8_t *end)
+{
+	uint8_t *pOut = *out;
+
+	if((end - pOut) >= 1)
+	{
+		pOut[0] = in;
+
+		(*out)+=1;
+
+		return 1;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+
+}
+
+uint8_t pushs8(int8_t in, uint8_t **out, uint8_t *end)
+{
+	uint8_t *pOut = *out;
+
+	if((end - pOut) >= 1)
+	{
+		pOut[0] = in;
+
+		(*out)+=1;
+
+		return 1;
+	}
+	else 
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t push16(uint16_t in, uint8_t **out, uint8_t *end)
+{
+	uint8_t *pOut = *out;
+	
+	if((end - pOut) >= 2)
+	{
+		pOut[0] = (in & 0xFF00) >> 8;
+		pOut[1] = (in & 0xFF);
+
+		(*out)+=2;
+
+		return 2;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t pushs16(int16_t in, uint8_t **out, uint8_t *end)
+{
+	uint8_t *pOut = *out;
+
+	if((end - pOut) >= 2)
+	{
+		pOut[0] = (in & 0xFF00) >> 8;
+		pOut[1] = (in & 0xFF);
+
+		(*out)+=2;
+
+		return 2;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t push32(uint32_t in, uint8_t **out, uint8_t *end)
+{
+	uint8_t *pOut = *out;
+	if((end - pOut) >= 4)
+	{
+		pOut[0] = (in & 0xFF000000) >> 24;
+		pOut[1] = (in & 0xFF0000) >> 16;
+		pOut[2] = (in & 0xFF00) >> 8;
+		pOut[3] = (in & 0xFF);
+
+		(*out)+=4;
+
+		return 4;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t pushs32(int32_t in, uint8_t **out, uint8_t *end)
+{
+	uint8_t *pOut = *out;
+
+	if((end - pOut) >= 4)
+	{
+		pOut[0] = (in & 0xFF000000) >> 24;
+		pOut[1] = (in & 0xFF0000) >> 16;
+		pOut[2] = (in & 0xFF00) >> 8;
+		pOut[3] = (in & 0xFF);
+
+		(*out)+=4;
+
+		return 4;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t pull8(uint8_t **in, uint8_t *out, uint8_t *end)
+{
+	uint8_t *pIn = *in;
+
+	if((end - pIn) >= 1 )
+	{
+		*out = *pIn;
+
+		(*in)+=1;
+
+		return 1;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t pulls8(uint8_t **in, int8_t *out, uint8_t *end)
+{
+	uint8_t *pIn = *in;
+
+	if((end - pIn) >= 1 )
+	{
+		*out = *pIn;
+
+		(*in)+=1;
+
+		return 1;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t pull16(uint8_t **in, uint16_t *out, uint8_t *end)
+{
+	uint8_t *pIn = *in;
+
+	if((end - pIn) >=2 )
+	{
+		*out = ((pIn[0]) << 8) | pIn[1];
+		(*in)+=2;
+
+		return 2;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t pulls16(uint8_t **in, int16_t *out, uint8_t *end)
+{
+	uint8_t *pIn = *in;
+
+	if((end - pIn) >=2 )
+	{
+		*out = ((pIn[0]) << 8) | pIn[1];
+
+		(*in)+=2;
+
+		return 2;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t pull32(uint8_t **in, uint32_t *out, uint8_t *end)
+{
+	uint8_t *pIn = *in;
+
+	if((end - pIn) >=4 )
+	{
+		*out = (pIn[0] << 24) | (pIn[1] << 16) | (pIn[2] << 8) | pIn[3];
+
+		(*in)+=4;
+
+		return 4;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n",  __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t pulls32(uint8_t **in, int32_t *out, uint8_t *end)
+{
+	uint8_t *pIn = *in;
+
+	if((end - pIn) >=4 )
+	{
+		*out = (pIn[0] << 24) | (pIn[1] << 16) | (pIn[2] << 8) | pIn[3];
+
+		(*in)+=4;
+
+		return 4;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+/*
+inline void pusharray16(uint8_t **, uint16_t, uint32_t len)
+{
+}
+*/
+
+uint32_t pullarray16(uint8_t **in, uint16_t out[], uint32_t max_len, uint32_t len, uint8_t *end)
+{
+	if(len == 0)
+		return 1;
+
+	if(len > max_len)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s exceed array size (%d > %d)\n", __FUNCTION__, len, max_len);
+		return 0;
+	}
+
+	if((end - (*in)) >= sizeof(uint16_t) * len)
+	{
+		uint32_t idx;
+		for(idx = 0; idx < len; ++idx)
+		{
+			if(!pull16(in, &out[idx], end))
+				return 0;
+		}
+
+		return sizeof(uint16_t) * len;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint32_t pullarrays16(uint8_t **in, int16_t out[], uint32_t max_len, uint32_t len, uint8_t *end)
+{
+	if(len == 0)
+		return 1;
+
+	if(len > max_len)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s exceed array size (%d > %d)\n", __FUNCTION__, len, max_len);
+		return 0;
+	}
+
+	if((end - (*in)) >= sizeof(uint16_t) * len)
+	{
+		uint32_t idx;
+		for(idx = 0; idx < len; ++idx)
+		{
+			if(!pulls16(in, &out[idx], end))
+			return 0;
+		}
+
+		return sizeof(uint16_t) * len;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+uint32_t pusharray16(uint16_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end)
+{
+	if(len == 0)
+		return 1;
+
+	if(len > max_len)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s exceed array size (%d > %d)\n", __FUNCTION__, len, max_len);
+		return 0;
+	}
+
+	if((end - (*out)) >= sizeof(uint16_t) * len)
+	{
+		uint32_t idx;
+		for(idx = 0; idx < len; ++idx)
+		{
+			if(!push16(in[idx], out, end))
+				return 0;
+		}
+		return sizeof(uint16_t) * len;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+uint32_t pusharrays16(int16_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end)
+{
+	if(len == 0)
+		return 1;
+
+	if(len > max_len)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s exceed array size (%d > %d)\n", __FUNCTION__, len, max_len);
+		return 0;
+	}
+
+	if((end - (*out)) >= sizeof(uint16_t) * len)
+	{
+		uint32_t idx;
+		for(idx = 0; idx < len; ++idx)
+		{
+			pushs16(in[idx], out, end);
+		}
+		return sizeof(uint16_t) * len;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint32_t pullarray8(uint8_t **in, uint8_t out[], uint32_t max_len, uint32_t len, uint8_t *end)
+{
+	if(len == 0)
+		return 1;
+
+	if(len > max_len)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s exceed array size (%d > %d)\n", __FUNCTION__, len, max_len);
+		return 0;
+	}
+
+	if((end - out) >= sizeof(uint8_t) * len)
+	{
+		memcpy(out, (*in), len);
+		(*in)+=len;
+
+		return sizeof(uint8_t) * len;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint32_t pusharray8(uint8_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end)
+{
+	if(len == 0)
+		return 1;
+
+	if(len > max_len)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s exceed array size (%d > %d)\n", __FUNCTION__, len, max_len);
+		return 0;
+	}
+
+	if((end - (*out)) >= sizeof(uint8_t) * len)
+	{
+		memcpy((*out), in, len);
+		(*out)+=len;
+
+		return sizeof(uint8_t) * len;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s no space in buffer\n", __FUNCTION__);
+		return 0;
+	}
+}
+
+uint8_t packarray(void* array, uint16_t array_element_size, uint16_t max_count, uint16_t count, uint8_t **ppwritepackedmsg, uint8_t *end, pack_array_elem_fn fn)
+{
+	if(count > max_count)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s exceed array size (%d > %d)\n", __FUNCTION__, count, max_count);
+		return 0;
+	}
+
+	uint16_t i = 0;
+	for(i = 0; i < count; ++i)
+	{
+		if((fn)(array, ppwritepackedmsg, end) == 0)
+			return 0;
+
+		array += array_element_size;
+	}
+
+	return 1;
+}
+
+uint8_t unpackarray(uint8_t **ppReadPackedMsg, void* array, uint16_t array_element_size, uint16_t max_count, uint16_t count, uint8_t *end, unpack_array_elem_fn fn)
+{
+	if(count > max_count)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s exceed array size (%d > %d)\n", __FUNCTION__, count, max_count);
+		return 0;
+	}
+
+	uint16_t i = 0;
+	for(i = 0; i < count; ++i)
+	{
+		if((fn)(array, ppReadPackedMsg, end) == 0)
+			return 0;
+
+		array += array_element_size;
+	}
+
+	return 1;
+}
+
+
+uint32_t pack_vendor_extension_tlv(nfapi_tl_t* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	if(ve != 0 && config != 0)
+	{
+		if(config->pack_vendor_extension_tlv)
+		{
+
+			uint8_t* pStartOfTlv = *ppWritePackedMsg;
+			if(pack_tl(ve, ppWritePackedMsg, end) == 0)
+				return 0;
+
+			uint8_t* pStartOfValue = *ppWritePackedMsg;
+			if((config->pack_vendor_extension_tlv)(ve, ppWritePackedMsg, end, config) == 0)
+				return 0;
+
+			ve->length = (*ppWritePackedMsg) - pStartOfValue;
+
+			pack_tl(ve, &pStartOfTlv, end);
+
+			return 1;
+
+		}
+	}
+	return 1;
+}
+
+uint32_t unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config, nfapi_tl_t** ve_tlv)
+{
+	if(ve_tlv != 0 && config != 0)
+	{
+		if(config->unpack_vendor_extension_tlv)
+		{
+			return (config->unpack_vendor_extension_tlv)(tl, ppReadPackedMsg, end, (void**)ve_tlv, config);
+		}
+	}
+	return 1;
+}
+
+uint32_t pack_p7_vendor_extension_tlv(nfapi_tl_t *ve, uint8_t **ppWritePackedMsg, uint8_t *end ,nfapi_p7_codec_config_t* config)
+{
+	if(ve != 0 && config != 0)
+	{
+		if(config->pack_vendor_extension_tlv)
+		{
+			uint8_t* pStartOfTlv = *ppWritePackedMsg;
+			if(pack_tl(ve, ppWritePackedMsg, end) == 0)
+				return 0;
+
+			uint8_t* pStartOfValue = *ppWritePackedMsg;
+			if((config->pack_vendor_extension_tlv)(ve, ppWritePackedMsg, end, config) == 0)
+				return 0;
+
+			ve->length = (*ppWritePackedMsg) - pStartOfValue;
+
+			pack_tl(ve, &pStartOfTlv, end);
+
+			return 1;
+			
+		}
+	}
+	return 1;
+}
+
+int unpack_p7_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config, nfapi_tl_t** ve_tlv)
+{
+	if(ve_tlv != 0 && config != 0)
+	{
+		if(config->unpack_vendor_extension_tlv)
+		{
+			return (config->unpack_vendor_extension_tlv)(tl, ppReadPackedMsg, end, (void**)ve_tlv, config);
+		}
+	}
+	return 1;
+}
+
+
+uint8_t pack_tl(nfapi_tl_t *tl, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return (push16(tl->tag, ppWritePackedMsg, end) &&
+			push16(tl->length, ppWritePackedMsg, end));
+}
+
+uint8_t unpack_tl(uint8_t **ppReadPackedMsg, nfapi_tl_t *tl, uint8_t *end)
+{
+	return (pull16(ppReadPackedMsg, &tl->tag, end) &&
+			pull16(ppReadPackedMsg, &tl->length, end));
+}
+
+int unpack_tlv_list(unpack_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config, nfapi_tl_t** ve)
+{
+	nfapi_tl_t generic_tl;
+	uint8_t numBadTags = 0;
+	uint16_t idx = 0;
+
+	while ((uint8_t*)(*ppReadPackedMsg) < end)
+	{
+		// unpack the tl and process the values accordingly
+		if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+			return 0;
+
+		uint8_t tagMatch = 0;
+
+		uint8_t* pStartOfValue = *ppReadPackedMsg;
+
+		for(idx = 0; idx < size; ++idx)
+		{
+			if(unpack_fns[idx].tag == generic_tl.tag)
+			{
+				tagMatch = 1;
+				nfapi_tl_t* tl = (nfapi_tl_t*)(unpack_fns[idx].tlv);
+				tl->tag = generic_tl.tag;
+				tl->length = generic_tl.length;
+
+				int result = (*unpack_fns[idx].unpack_func)(tl, ppReadPackedMsg, end);
+
+				if(result == 0)
+				{
+					return 0;
+				}
+
+				// check if the length was right;
+				if(tl->length != (*ppReadPackedMsg - pStartOfValue))
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "Warning tlv tag 0x%x length %d not equal to unpack %d\n", tl->tag, tl->length, (*ppReadPackedMsg - pStartOfValue));
+				}
+			}
+		}
+
+		if(tagMatch == 0)
+		{
+
+			if(generic_tl.tag >= NFAPI_VENDOR_EXTENSION_MIN_TAG_VALUE && 
+			   generic_tl.tag <= NFAPI_VENDOR_EXTENSION_MAX_TAG_VALUE)
+			{
+				int result = unpack_vendor_extension_tlv(&generic_tl, ppReadPackedMsg, end, config, ve);
+				if(result == 0)
+				{
+					// got tot the end.
+					return 0;
+				}
+				else if(result < 0)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown VE TAG value: 0x%04x\n", generic_tl.tag);
+
+					if (++numBadTags > MAX_BAD_TAG)
+					{
+						NFAPI_TRACE(NFAPI_TRACE_ERROR, "Supplied message has had too many bad tags\n");
+						return 0;
+					}
+
+					if((end - *ppReadPackedMsg) >= generic_tl.length)
+					{
+						// Advance past the unknown TLV
+						(*ppReadPackedMsg) += generic_tl.length;
+					}
+					else
+					{
+						// go to the end
+						return 0;
+					}
+				}
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown TAG value: 0x%04x\n", generic_tl.tag);
+
+				if (++numBadTags > MAX_BAD_TAG)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "Supplied message has had too many bad tags\n");
+					return 0;
+				}
+
+				if((end - *ppReadPackedMsg) >= generic_tl.length)
+				{
+					// Advance past the unknown TLV
+					(*ppReadPackedMsg) += generic_tl.length;
+				}
+				else
+				{
+					// go to the end
+					return 0;
+				}
+			}
+
+		}
+	}
+
+	return 1;
+}
+int unpack_p7_tlv_list(unpack_p7_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPackedMsg, uint8_t* end, nfapi_p7_codec_config_t* config, nfapi_tl_t** ve)
+{
+	nfapi_tl_t generic_tl;
+	uint8_t numBadTags = 0;
+	uint16_t idx = 0;
+
+	while ((uint8_t*)(*ppReadPackedMsg) < end)
+	{
+		// unpack the tl and process the values accordingly
+		if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+			return 0;
+
+		uint8_t tagMatch = 0;
+
+		uint8_t* pStartOfValue = *ppReadPackedMsg;
+
+		for(idx = 0; idx < size; ++idx)
+		{
+			if(unpack_fns[idx].tag == generic_tl.tag)
+			{
+				tagMatch = 1;
+				nfapi_tl_t* tl = (nfapi_tl_t*)(unpack_fns[idx].tlv);
+				tl->tag = generic_tl.tag;
+				tl->length = generic_tl.length;
+
+				int result = (*unpack_fns[idx].unpack_func)(tl, ppReadPackedMsg, end , config);
+
+				if(result == 0)
+				{
+					return  0;
+				}
+
+				// check if the length was right;
+				if(tl->length != (*ppReadPackedMsg - pStartOfValue))
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "Warning tlv tag 0x%x length %d not equal to unpack %d\n", tl->tag, tl->length, (*ppReadPackedMsg - pStartOfValue));
+				}
+			}
+		}
+
+		if(tagMatch == 0)
+		{
+
+			if(generic_tl.tag >= NFAPI_VENDOR_EXTENSION_MIN_TAG_VALUE && 
+			   generic_tl.tag <= NFAPI_VENDOR_EXTENSION_MAX_TAG_VALUE)
+			{
+				int result = unpack_p7_vendor_extension_tlv(&generic_tl, ppReadPackedMsg, end, config, ve);
+				if(result == 0)
+				{
+					// got to end
+					return 0;
+				}
+				else if(result < 0)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown TAG value: 0x%04x\n", generic_tl.tag);
+
+					if (++numBadTags > MAX_BAD_TAG)
+					{
+						NFAPI_TRACE(NFAPI_TRACE_ERROR, "Supplied message has had too many bad tags\n");
+						return -1;
+					}
+
+					if((end - *ppReadPackedMsg) >= generic_tl.length)
+					{
+						// Advance past the unknown TLV
+						(*ppReadPackedMsg) += generic_tl.length;
+					}
+					else
+					{
+						// got ot the dn
+						return 0;
+					}
+				}
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown TAG value: 0x%04x\n", generic_tl.tag);
+
+				if (++numBadTags > MAX_BAD_TAG)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "Supplied message has had too many bad tags\n");
+					return -1;
+				}
+
+				if((end - *ppReadPackedMsg) >= generic_tl.length)
+				{
+					// Advance past the unknown TLV
+					(*ppReadPackedMsg) += generic_tl.length;
+				}
+				else
+				{
+					// got ot the dn
+					return 0;
+				}
+
+			}
+
+		}
+	}
+
+	return 1;
+}
+
+// This intermediate function deals with calculating the length of the value
+// and writing into the tlv header.
+uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, pack_tlv_fn fn)
+{
+	nfapi_tl_t* tl = (nfapi_tl_t*)tlv;
+
+	// If the tag is defined
+	if(tl->tag == tag)
+	{
+		uint8_t* pStartOfTlv = *ppWritePackedMsg;
+
+		// write a dumy tlv header
+		if(pack_tl(tl, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		// Record the start of the value
+		uint8_t* pStartOfValue = *ppWritePackedMsg;
+
+		// pack the tlv value
+		if(fn(tlv, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		// calculate the length of the value and rewrite the tl header
+		tl->length = (*ppWritePackedMsg) - pStartOfValue;
+
+		// rewrite the header with the correct length
+		pack_tl(tl, &pStartOfTlv, end);
+	}
+	else
+	{
+		if(tl->tag != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_WARN, "Warning pack_tlv tag 0x%x does not match expected 0x%x\n", tl->tag, tag);
+		}
+                else
+                {
+			//NFAPI_TRACE(NFAPI_TRACE_ERROR, "Warning pack_tlv tag 0x%x ZERO does not match expected 0x%x\n", tl->tag, tag);
+                }
+	}
+
+	return 1;
+}
+
+const char* nfapi_error_code_to_str(nfapi_error_code_e value)
+{
+	switch(value)
+	{
+		case NFAPI_MSG_OK:
+			return "NFAPI_MSG_OK";
+		case NFAPI_MSG_INVALID_STATE:
+			return "NFAPI_MSG_INVALID_STATE";
+		case NFAPI_MSG_INVALID_CONFIG:
+			return "NFAPI_MSG_INVALID_CONFIG";
+		case NFAPI_SFN_OUT_OF_SYNC:
+			return "NFAPI_SFN_OUT_OF_SYNC";
+		case NFAPI_MSG_SUBFRAME_ERR:
+			return "NFAPI_MSG_SUBFRAME_ERR";
+		case NFAPI_MSG_BCH_MISSING:
+			return "NFAPI_MSG_BCH_MISSING";
+		case NFAPI_MSG_INVALID_SFN:
+			return "NFAPI_MSG_INVALID_SFN";
+		case NFAPI_MSG_HI_ERR:
+			return "NFAPI_MSG_HI_ERR";
+		case NFAPI_MSG_TX_ERR:
+			return "NFAPI_MSG_TX_ERR";
+		default:
+			return "UNKNOWN";
+	}
+}
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p4.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p4.c
new file mode 100644
index 0000000000000000000000000000000000000000..b429e0a6ce586b1efd943e7f337464e7852e26a2
--- /dev/null
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p4.c
@@ -0,0 +1,2085 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <arpa/inet.h> // need for uintptr_t?
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdint.h>
+
+#include <nfapi_interface.h>
+#include <nfapi.h>
+#include <debug.h>
+
+static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd)
+{
+	if (msgEnd < msgHead)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %d, %d\n", msgHead, msgEnd);
+		return 0;
+	}
+
+	return (msgEnd - msgHead);
+}
+
+static uint8_t pack_opaque_data_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_opaqaue_data_t* value = (nfapi_opaqaue_data_t*)tlv;
+	return pusharray8(value->value, NFAPI_MAX_OPAQUE_DATA, value->length, ppWritePackedMsg, end);
+}
+
+static uint8_t unpack_opaque_data_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_opaqaue_data_t* value = (nfapi_opaqaue_data_t*)tlv;
+	value->length = value->tl.length;
+	if(value->length <= NFAPI_MAX_OPAQUE_DATA)
+	{
+		if(!pullarray8(ppReadPackedMsg, value->value, NFAPI_MAX_OPAQUE_DATA, value->length, end))
+			return 0;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Opaque date to long %d \n", value->length);
+		return 0;
+	}
+
+	return 1;
+
+}
+
+static uint8_t pack_lte_rssi_request_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lte_rssi_request_t* value = (nfapi_lte_rssi_request_t*)tlv;
+
+	return (push8(value->frequency_band_indicator, ppWritePackedMsg, end) &&
+			push16(value->measurement_period, ppWritePackedMsg, end) &&
+			push8(value->bandwidth, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end) &&
+			push8(value->number_of_earfcns, ppWritePackedMsg, end) &&
+			pusharray16(value->earfcn, NFAPI_MAX_CARRIER_LIST, value->number_of_earfcns, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_utran_rssi_request_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_utran_rssi_request_t* value = (nfapi_utran_rssi_request_t*)tlv;
+
+	return (push8(value->frequency_band_indicator, ppWritePackedMsg, end) &&
+			push16(value->measurement_period, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end) &&
+			push8(value->number_of_uarfcns, ppWritePackedMsg, end) &&
+			pusharray16(value->uarfcn, NFAPI_MAX_CARRIER_LIST, value->number_of_uarfcns, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_geran_rssi_request_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_geran_rssi_request_t* value = (nfapi_geran_rssi_request_t*)tlv;
+	uint16_t idx = 0;
+
+	if(!(push8(value->frequency_band_indicator, ppWritePackedMsg, end) &&
+		 push16(value->measurement_period, ppWritePackedMsg, end) &&
+		 push32(value->timeout, ppWritePackedMsg, end) &&
+		 push8(value->number_of_arfcns, ppWritePackedMsg, end)))
+		return 0;
+
+	for(;idx < value->number_of_arfcns; ++idx)
+	{
+		if(!(push16(value->arfcn[idx].arfcn, ppWritePackedMsg, end) &&
+			push8(value->arfcn[idx].direction, ppWritePackedMsg, end)))
+			return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t pack_nb_iot_rssi_request_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_rssi_request_t* value = (nfapi_nb_iot_rssi_request_t*)tlv;
+	uint16_t idx = 0;
+
+	if(!(push8(value->frequency_band_indicator, ppWritePackedMsg, end) &&
+		 push16(value->measurement_period, ppWritePackedMsg, end) &&
+		 push32(value->timeout, ppWritePackedMsg, end) &&
+		 push8(value->number_of_earfcns, ppWritePackedMsg, end)))
+		return 0;
+
+	for(;idx < value->number_of_earfcns; ++idx)
+	{
+		if(!(push16(value->earfcn[idx].earfcn, ppWritePackedMsg, end) &&
+			 push8(value->earfcn[idx].number_of_ro_dl, ppWritePackedMsg, end)))
+			return 0;
+			
+		uint8_t ro_dl_idx = 0;
+		for(ro_dl_idx = 0; ro_dl_idx < value->earfcn[idx].number_of_ro_dl; ++ro_dl_idx)
+		{
+			if(!push8(value->earfcn[idx].ro_dl[ro_dl_idx], ppWritePackedMsg, end))
+				return 0;
+		}
+	}
+
+	return 1;
+}
+
+
+
+static uint8_t pack_rssi_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_rssi_request_t *pNfapiMsg = (nfapi_rssi_request_t*)msg;
+
+	if(push8(pNfapiMsg->rat_type, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	switch(pNfapiMsg->rat_type)
+	{
+		case NFAPI_RAT_TYPE_LTE:
+			if(pack_tlv(NFAPI_LTE_RSSI_REQUEST_TAG, &pNfapiMsg->lte_rssi_request, ppWritePackedMsg, end, &pack_lte_rssi_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_UTRAN:
+			if(pack_tlv(NFAPI_UTRAN_RSSI_REQUEST_TAG, &pNfapiMsg->utran_rssi_request, ppWritePackedMsg, end, &pack_utran_rssi_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_GERAN:
+			if(pack_tlv(NFAPI_GERAN_RSSI_REQUEST_TAG, &pNfapiMsg->geran_rssi_request, ppWritePackedMsg, end, &pack_geran_rssi_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_NB_IOT:
+			if(pack_tlv(NFAPI_NB_IOT_RSSI_REQUEST_TAG, &pNfapiMsg->nb_iot_rssi_request, ppWritePackedMsg, end, &pack_nb_iot_rssi_request_value) == 0)
+				return 0;
+			break;
+	}
+
+	return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_rssi_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_rssi_response_t *pNfapiMsg = (nfapi_rssi_response_t*)msg;
+	
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_rssi_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_rssi_indication_body_t* value = (nfapi_rssi_indication_body_t*)tlv;
+
+	return (push16(value->number_of_rssi, ppWritePackedMsg, end) &&
+			pusharrays16(value->rssi, NFAPI_MAX_RSSI, value->number_of_rssi, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_rssi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_rssi_indication_t *pNfapiMsg = (nfapi_rssi_indication_t*)msg;
+
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_tlv(NFAPI_RSSI_INDICATION_TAG, &pNfapiMsg->rssi_indication_body, ppWritePackedMsg, end, &pack_rssi_indication_body_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+static uint8_t pack_lte_cell_search_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lte_cell_search_request_t* value = (nfapi_lte_cell_search_request_t*)msg;
+
+	return (push16(value->earfcn, ppWritePackedMsg, end) &&
+			push8(value->measurement_bandwidth,  ppWritePackedMsg, end) &&
+			push8(value->exhaustive_search, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end) &&
+			push8(value->number_of_pci, ppWritePackedMsg, end) &&
+			pusharray16(value->pci, NFAPI_MAX_PCI_LIST, value->number_of_pci, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_utran_cell_search_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_utran_cell_search_request_t* value = (nfapi_utran_cell_search_request_t*)msg;
+
+	return (push16(value->uarfcn, ppWritePackedMsg, end) &&
+			push8(value->exhaustive_search, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end) &&
+			push8(value->number_of_psc, ppWritePackedMsg, end) &&
+			pusharray16(value->psc, NFAPI_MAX_PSC_LIST, value->number_of_psc, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_geran_cell_search_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_geran_cell_search_request_t* value = (nfapi_geran_cell_search_request_t*)msg;
+
+	return (push32(value->timeout, ppWritePackedMsg, end) &&
+			push8(value->number_of_arfcn, ppWritePackedMsg, end) &&
+			pusharray16(value->arfcn, NFAPI_MAX_ARFCN_LIST, value->number_of_arfcn, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_nb_iot_cell_search_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_cell_search_request_t* value = (nfapi_nb_iot_cell_search_request_t*)msg;
+
+	return (push16(value->earfcn, ppWritePackedMsg, end) &&
+			push8(value->ro_dl, ppWritePackedMsg, end) &&
+			push8(value->exhaustive_search, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end) &&
+			push8(value->number_of_pci, ppWritePackedMsg, end) &&
+			pusharray16(value->pci, NFAPI_MAX_PCI_LIST, value->number_of_pci, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_cell_search_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_cell_search_request_t *pNfapiMsg = (nfapi_cell_search_request_t*)msg;
+
+	if(push8(pNfapiMsg->rat_type, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	switch(pNfapiMsg->rat_type)
+	{
+		case NFAPI_RAT_TYPE_LTE:
+			{
+				if(pack_tlv(NFAPI_LTE_CELL_SEARCH_REQUEST_TAG, &pNfapiMsg->lte_cell_search_request, ppWritePackedMsg, end, &pack_lte_cell_search_request_value) == 0)
+					return 0;
+			}
+			break;
+		case NFAPI_RAT_TYPE_UTRAN:
+			{
+				if(pack_tlv(NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG, &pNfapiMsg->utran_cell_search_request, ppWritePackedMsg, end, &pack_utran_cell_search_request_value) == 0)
+					return 0;
+			}
+			break;
+		case NFAPI_RAT_TYPE_GERAN:
+			{
+				if(pack_tlv(NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG, &pNfapiMsg->geran_cell_search_request, ppWritePackedMsg, end, &pack_geran_cell_search_request_value) == 0)
+					return 0;
+			}
+			break;
+		case NFAPI_RAT_TYPE_NB_IOT:
+			{
+				if(pack_tlv(NFAPI_NB_IOT_CELL_SEARCH_REQUEST_TAG, &pNfapiMsg->nb_iot_cell_search_request, ppWritePackedMsg, end, &pack_nb_iot_cell_search_request_value) == 0)
+					return 0;
+			}
+			break;
+	};
+	
+	return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_cell_search_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_cell_search_response_t *pNfapiMsg = (nfapi_cell_search_response_t*)msg;
+	
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_lte_cell_search_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lte_cell_search_indication_t* value = (nfapi_lte_cell_search_indication_t*)msg;
+	uint16_t idx = 0;
+
+	if(push16(value->number_of_lte_cells_found, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	for(idx = 0; idx < value->number_of_lte_cells_found; ++idx)
+	{
+		if(!(push16(value->lte_found_cells[idx].pci, ppWritePackedMsg, end) &&
+			 push8(value->lte_found_cells[idx].rsrp, ppWritePackedMsg, end) &&
+			 push8(value->lte_found_cells[idx].rsrq, ppWritePackedMsg, end) &&
+			 pushs16(value->lte_found_cells[idx].frequency_offset, ppWritePackedMsg, end)))
+			return 0;
+	}
+	return 1;
+}
+
+static uint8_t pack_utran_cell_search_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_utran_cell_search_indication_t* value = (nfapi_utran_cell_search_indication_t*)msg;
+	uint16_t idx = 0;
+
+	if(push16(value->number_of_utran_cells_found, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	for(idx = 0; idx < value->number_of_utran_cells_found; ++idx)
+	{
+		if(!(push16(value->utran_found_cells[idx].psc, ppWritePackedMsg, end) &&
+			 push8(value->utran_found_cells[idx].rscp, ppWritePackedMsg, end) &&
+			 push8(value->utran_found_cells[idx].ecno, ppWritePackedMsg, end) &&
+			 pushs16(value->utran_found_cells[idx].frequency_offset, ppWritePackedMsg, end)))
+			return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t pack_geran_cell_search_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_geran_cell_search_indication_t* value = (nfapi_geran_cell_search_indication_t*)msg;
+	uint16_t idx = 0;
+
+	if(push16(value->number_of_gsm_cells_found, ppWritePackedMsg, end) == 0)
+		return 0;
+ 
+	for(idx = 0; idx < value->number_of_gsm_cells_found; ++idx)
+	{
+		if(!(push16(value->gsm_found_cells[idx].arfcn, ppWritePackedMsg, end) &&
+			 push8(value->gsm_found_cells[idx].bsic, ppWritePackedMsg, end) &&
+			 push8(value->gsm_found_cells[idx].rxlev, ppWritePackedMsg, end) &&
+			 push8(value->gsm_found_cells[idx].rxqual, ppWritePackedMsg, end) &&
+			 pushs16(value->gsm_found_cells[idx].frequency_offset, ppWritePackedMsg, end) &&
+			 push32(value->gsm_found_cells[idx].sfn_offset, ppWritePackedMsg, end)))
+			return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t pack_nb_iot_cell_search_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_cell_search_indication_t* value = (nfapi_nb_iot_cell_search_indication_t*)msg;
+	uint16_t idx = 0;
+
+	if(push16(value->number_of_nb_iot_cells_found, ppWritePackedMsg, end) == 0)
+		return 0;
+ 
+	for(idx = 0; idx < value->number_of_nb_iot_cells_found; ++idx)
+	{
+		if(!(push16(value->nb_iot_found_cells[idx].pci, ppWritePackedMsg, end) &&
+			 push8(value->nb_iot_found_cells[idx].rsrp, ppWritePackedMsg, end) &&
+			 push8(value->nb_iot_found_cells[idx].rsrq, ppWritePackedMsg, end) &&
+			 pushs16(value->nb_iot_found_cells[idx].frequency_offset, ppWritePackedMsg, end)))
+			return 0;
+	}
+
+	return 1;
+}
+static uint8_t pack_cell_search_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_cell_search_indication_t *pNfapiMsg = (nfapi_cell_search_indication_t*)msg;
+
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_tlv(NFAPI_LTE_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->lte_cell_search_indication, ppWritePackedMsg, end, &pack_lte_cell_search_indication_value) &&
+			pack_tlv(NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->utran_cell_search_indication, ppWritePackedMsg, end, &pack_utran_cell_search_indication_value) &&
+			pack_tlv(NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->geran_cell_search_indication, ppWritePackedMsg, end, &pack_geran_cell_search_indication_value) &&
+			pack_tlv(NFAPI_PNF_CELL_SEARCH_STATE_TAG, &pNfapiMsg->pnf_cell_search_state, ppWritePackedMsg, end, &pack_opaque_data_value) &&
+			pack_tlv(NFAPI_NB_IOT_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->nb_iot_cell_search_indication, ppWritePackedMsg, end, &pack_nb_iot_cell_search_indication_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_lte_broadcast_detect_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lte_broadcast_detect_request_t* value = (nfapi_lte_broadcast_detect_request_t*)msg;
+
+	return (push16(value->earfcn, ppWritePackedMsg, end) &&
+			push16(value->pci, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_utran_broadcast_detect_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_utran_broadcast_detect_request_t* value = (nfapi_utran_broadcast_detect_request_t*)msg;
+
+	return (push16(value->uarfcn, ppWritePackedMsg, end) &&
+			push16(value->psc, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_nb_iot_broadcast_detect_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_broadcast_detect_request_t* value = (nfapi_nb_iot_broadcast_detect_request_t*)msg;
+
+	return (push16(value->earfcn, ppWritePackedMsg, end) &&
+			push8(value->ro_dl, ppWritePackedMsg, end) &&
+			push16(value->pci, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_broadcast_detect_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t * end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_broadcast_detect_request_t *pNfapiMsg = (nfapi_broadcast_detect_request_t*)msg;
+
+	if(push8(pNfapiMsg->rat_type, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	switch(pNfapiMsg->rat_type)
+	{
+		case NFAPI_RAT_TYPE_LTE:
+			if(pack_tlv(NFAPI_LTE_BROADCAST_DETECT_REQUEST_TAG, &pNfapiMsg->lte_broadcast_detect_request, ppWritePackedMsg, end ,&pack_lte_broadcast_detect_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_UTRAN:
+			if(pack_tlv(NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG, &pNfapiMsg->utran_broadcast_detect_request, ppWritePackedMsg, end, &pack_utran_broadcast_detect_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_NB_IOT:
+			if(pack_tlv(NFAPI_NB_IOT_BROADCAST_DETECT_REQUEST_TAG, &pNfapiMsg->nb_iot_broadcast_detect_request, ppWritePackedMsg, end, &pack_nb_iot_broadcast_detect_request_value) == 0)
+				return 0;
+			break;
+			
+	}
+
+	return (pack_tlv(NFAPI_PNF_CELL_SEARCH_STATE_TAG, &pNfapiMsg->pnf_cell_search_state, ppWritePackedMsg, end, &pack_opaque_data_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_broadcast_detect_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_broadcast_detect_response_t *pNfapiMsg = (nfapi_broadcast_detect_response_t*)msg;
+	
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_lte_broadcast_detect_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lte_broadcast_detect_indication_t* value = (nfapi_lte_broadcast_detect_indication_t*)msg;
+
+	return (push8(value->number_of_tx_antenna, ppWritePackedMsg, end) &&
+			push16(value->mib_length, ppWritePackedMsg, end) &&
+			pusharray8(value->mib, NFAPI_MAX_MIB_LENGTH, value->mib_length, ppWritePackedMsg, end) &&
+			push32(value->sfn_offset, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_utran_broadcast_detect_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_utran_broadcast_detect_indication_t* value = (nfapi_utran_broadcast_detect_indication_t*)msg;
+
+	return (push16(value->mib_length, ppWritePackedMsg, end) &&
+			pusharray8(value->mib, NFAPI_MAX_MIB_LENGTH, value->mib_length, ppWritePackedMsg, end) &&
+			push32(value->sfn_offset, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_nb_iot_broadcast_detect_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_broadcast_detect_indication_t* value = (nfapi_nb_iot_broadcast_detect_indication_t*)msg;
+
+	return (push8(value->number_of_tx_antenna, ppWritePackedMsg, end) &&
+			push16(value->mib_length, ppWritePackedMsg, end) &&
+			pusharray8(value->mib, NFAPI_MAX_MIB_LENGTH, value->mib_length, ppWritePackedMsg, end) &&
+			push32(value->sfn_offset, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_broadcast_detect_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_broadcast_detect_indication_t *pNfapiMsg = (nfapi_broadcast_detect_indication_t*)msg;
+
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_tlv(NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG, &pNfapiMsg->lte_broadcast_detect_indication, ppWritePackedMsg, end, &pack_lte_broadcast_detect_indication_value) &&
+			pack_tlv(NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG, &pNfapiMsg->utran_broadcast_detect_indication, ppWritePackedMsg, end, &pack_utran_broadcast_detect_indication_value) &&
+			pack_tlv(NFAPI_PNF_CELL_BROADCAST_STATE_TAG, &pNfapiMsg->pnf_cell_broadcast_state, ppWritePackedMsg, end, &pack_opaque_data_value) &&
+			pack_tlv(NFAPI_NB_IOT_BROADCAST_DETECT_INDICATION_TAG, &pNfapiMsg->nb_iot_broadcast_detect_indication, ppWritePackedMsg, end, &pack_nb_iot_broadcast_detect_indication_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_lte_system_information_schedule_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lte_system_information_schedule_request_t* value = (nfapi_lte_system_information_schedule_request_t*)msg;
+
+	return (push16(value->earfcn, ppWritePackedMsg, end) &&
+			push16(value->pci, ppWritePackedMsg, end) &&
+			push16(value->downlink_channel_bandwidth, ppWritePackedMsg, end) &&
+			push8(value->phich_configuration, ppWritePackedMsg, end) &&
+			push8(value->number_of_tx_antenna, ppWritePackedMsg, end) &&
+			push8(value->retry_count, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_nb_iot_system_information_schedule_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_system_information_schedule_request_t* value = (nfapi_nb_iot_system_information_schedule_request_t*)msg;
+
+	return (push16(value->earfcn, ppWritePackedMsg, end) &&
+			push8(value->ro_dl, ppWritePackedMsg, end) &&
+			push16(value->pci, ppWritePackedMsg, end) &&
+			push8(value->scheduling_info_sib1_nb, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_system_information_schedule_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_schedule_request_t *pNfapiMsg = (nfapi_system_information_schedule_request_t*)msg;
+
+	if(push8(pNfapiMsg->rat_type, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	switch(pNfapiMsg->rat_type)
+	{
+		case NFAPI_RAT_TYPE_LTE:
+			if(pack_tlv(NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG, &pNfapiMsg->lte_system_information_schedule_request, ppWritePackedMsg, end, &pack_lte_system_information_schedule_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_NB_IOT:
+			if(pack_tlv(NFAPI_NB_IOT_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG, &pNfapiMsg->nb_iot_system_information_schedule_request, ppWritePackedMsg, end, &pack_nb_iot_system_information_schedule_request_value) == 0)
+				return 0;
+			break;
+	}
+
+	return (pack_tlv(NFAPI_PNF_CELL_BROADCAST_STATE_TAG, &pNfapiMsg->pnf_cell_broadcast_state, ppWritePackedMsg, end, &pack_opaque_data_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_system_information_schedule_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_schedule_response_t *pNfapiMsg = (nfapi_system_information_schedule_response_t*)msg;
+	
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_lte_system_information_indication_value(void* msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lte_system_information_indication_t* value = (nfapi_lte_system_information_indication_t*)msg;
+
+	return (push8(value->sib_type, ppWritePackedMsg, end) &&
+			push16(value->sib_length, ppWritePackedMsg, end) &&
+			pusharray8(value->sib, NFAPI_MAX_SIB_LENGTH, value->sib_length, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_nb_iot_system_information_indication_value(void* msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_system_information_indication_t* value = (nfapi_nb_iot_system_information_indication_t*)msg;
+
+	return (push8(value->sib_type, ppWritePackedMsg, end) &&
+			push16(value->sib_length, ppWritePackedMsg, end) &&
+			pusharray8(value->sib, NFAPI_MAX_SIB_LENGTH, value->sib_length, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_system_information_schedule_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_schedule_indication_t *pNfapiMsg = (nfapi_system_information_schedule_indication_t*)msg;
+
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_tlv(NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->lte_system_information_indication, ppWritePackedMsg, end, &pack_lte_system_information_indication_value) &&
+			pack_tlv(NFAPI_NB_IOT_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->nb_iot_system_information_indication, ppWritePackedMsg, end, &pack_nb_iot_system_information_indication_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_lte_system_information_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lte_system_information_request_t* value = (nfapi_lte_system_information_request_t*)msg;
+	uint16_t idx = 0;
+
+	if(!(push16(value->earfcn, ppWritePackedMsg, end) &&
+		 push16(value->pci, ppWritePackedMsg, end) &&
+		 push16(value->downlink_channel_bandwidth, ppWritePackedMsg, end) &&
+		 push8(value->phich_configuration, ppWritePackedMsg, end) &&
+		 push8(value->number_of_tx_antenna, ppWritePackedMsg, end) &&
+		 push8(value->number_of_si_periodicity, ppWritePackedMsg, end)))
+		return 0;
+
+	for(idx = 0; idx < value->number_of_si_periodicity; ++idx)
+	{
+		if(!(push8(value->si_periodicity[idx].si_periodicity, ppWritePackedMsg, end) &&
+			 push8(value->si_periodicity[idx].si_index, ppWritePackedMsg, end)))
+			return 0;
+	}
+
+	return (push8(value->si_window_length, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+static uint8_t pack_utran_system_information_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_utran_system_information_request_t* value = (nfapi_utran_system_information_request_t*)msg;
+
+	return (push16(value->uarfcn, ppWritePackedMsg, end) &&
+			push16(value->psc, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+static uint8_t pack_geran_system_information_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_geran_system_information_request_t* value = (nfapi_geran_system_information_request_t*)msg;
+
+	return (push16(value->arfcn, ppWritePackedMsg, end) &&
+			push8(value->bsic, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+static uint8_t pack_nb_iot_system_information_request_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_system_information_request_t* value = (nfapi_nb_iot_system_information_request_t*)msg;
+	uint16_t idx = 0;
+
+	if(!(push16(value->earfcn, ppWritePackedMsg, end) &&
+		 push8(value->ro_dl, ppWritePackedMsg, end) &&
+		 push16(value->pci, ppWritePackedMsg, end) &&
+		 push8(value->number_of_si_periodicity, ppWritePackedMsg, end)))
+		return 0;
+
+	for(idx = 0; idx < value->number_of_si_periodicity; ++idx)
+	{
+		if(!(push8(value->si_periodicity[idx].si_periodicity, ppWritePackedMsg, end) &&
+			 push8(value->si_periodicity[idx].si_repetition_pattern, ppWritePackedMsg, end) &&
+			 push8(value->si_periodicity[idx].si_tb_size, ppWritePackedMsg, end) &&
+			 push8(value->si_periodicity[idx].number_of_si_index, ppWritePackedMsg, end)))
+			return 0;
+			
+		uint8_t si_idx;	
+		for(si_idx = 0; si_idx < value->si_periodicity[idx].number_of_si_index; ++si_idx)
+		{
+			if(!(push8(value->si_periodicity[idx].si_index[si_idx], ppWritePackedMsg, end)))
+				return 0;
+		}
+	}
+
+	return (push8(value->si_window_length, ppWritePackedMsg, end) &&
+			push32(value->timeout, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_system_information_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_request_t *pNfapiMsg = (nfapi_system_information_request_t*)msg;
+
+	if(push8(pNfapiMsg->rat_type, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	switch(pNfapiMsg->rat_type)
+	{
+		case NFAPI_RAT_TYPE_LTE:
+			if(pack_tlv(NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG, &pNfapiMsg->lte_system_information_request, ppWritePackedMsg, end, &pack_lte_system_information_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_UTRAN:
+			if(pack_tlv(NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG, &pNfapiMsg->utran_system_information_request, ppWritePackedMsg, end, &pack_utran_system_information_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_GERAN:
+			if(pack_tlv(NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG, &pNfapiMsg->geran_system_information_request, ppWritePackedMsg, end, &pack_geran_system_information_request_value) == 0)
+				return 0;
+			break;
+		case NFAPI_RAT_TYPE_NB_IOT:
+			if(pack_tlv(NFAPI_NB_IOT_SYSTEM_INFORMATION_REQUEST_TAG, &pNfapiMsg->nb_iot_system_information_request, ppWritePackedMsg, end, &pack_nb_iot_system_information_request_value) == 0)
+				return 0;
+			break;
+	}
+
+	return (pack_tlv(NFAPI_PNF_CELL_BROADCAST_STATE_TAG, &pNfapiMsg->pnf_cell_broadcast_state, ppWritePackedMsg, end, &pack_opaque_data_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_system_information_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end,  nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_response_t *pNfapiMsg = (nfapi_system_information_response_t*)msg;
+	
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_utran_system_information_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_utran_system_information_indication_t* value = (nfapi_utran_system_information_indication_t*)msg;
+	
+	return (push16(value->sib_length, ppWritePackedMsg, end) &&
+			pusharray8(value->sib, NFAPI_MAX_SIB_LENGTH, value->sib_length, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_geran_system_information_indication_value(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_geran_system_information_indication_t* value = (nfapi_geran_system_information_indication_t*)msg;
+
+	return (push16(value->si_length, ppWritePackedMsg, end) &&
+			pusharray8(value->si, NFAPI_MAX_SIB_LENGTH, value->si_length, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_system_information_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_indication_t *pNfapiMsg = (nfapi_system_information_indication_t*)msg;
+	
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_tlv(NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->lte_system_information_indication, ppWritePackedMsg, end, &pack_lte_system_information_indication_value) &&
+			pack_tlv(NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->utran_system_information_indication, ppWritePackedMsg, end, &pack_utran_system_information_indication_value) &&
+			pack_tlv(NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->geran_system_information_indication, ppWritePackedMsg, end, &pack_geran_system_information_indication_value) &&
+			pack_tlv(NFAPI_NB_IOT_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->nb_iot_system_information_indication, ppWritePackedMsg, end, &pack_nb_iot_system_information_indication_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+	
+static uint8_t pack_nmm_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_nmm_stop_request_t *pNfapiMsg = (nfapi_nmm_stop_request_t*)msg;
+
+	return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nmm_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_nmm_stop_response_t *pNfapiMsg = (nfapi_nmm_stop_response_t*)msg;
+	
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t unpack_lte_rssi_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	//int result = 0;
+	nfapi_lte_rssi_request_t* value = (nfapi_lte_rssi_request_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &value->frequency_band_indicator, end) &&
+		 pull16(ppReadPackedMsg, &value->measurement_period, end) &&
+		 pull8(ppReadPackedMsg, &value->bandwidth, end) &&
+		 pull32(ppReadPackedMsg, &value->timeout, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_earfcns, end)))
+		return 0;
+
+	if(value->number_of_earfcns <= NFAPI_MAX_CARRIER_LIST)
+	{
+		if(pullarray16(ppReadPackedMsg, value->earfcn, NFAPI_MAX_CARRIER_LIST, value->number_of_earfcns, end) == 0)
+			return 0;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More EARFCN's than we can decode %d \n", value->number_of_earfcns);
+		return 0;
+	}
+
+	return 1;
+
+}
+
+static uint8_t unpack_utran_rssi_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_utran_rssi_request_t* value = (nfapi_utran_rssi_request_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &value->frequency_band_indicator, end) &&
+		 pull16(ppReadPackedMsg, &value->measurement_period, end) &&
+		 pull32(ppReadPackedMsg, &value->timeout, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_uarfcns, end)))
+		return 0;
+
+	if(value->number_of_uarfcns <= NFAPI_MAX_CARRIER_LIST)
+	{
+		if(pullarray16(ppReadPackedMsg, value->uarfcn, NFAPI_MAX_CARRIER_LIST, value->number_of_uarfcns, end) == 0)
+			return 0;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More UARFCN's than we can decode %d \n", value->number_of_uarfcns);
+		return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_geran_rssi_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_geran_rssi_request_t* value = (nfapi_geran_rssi_request_t*)tlv;
+	uint16_t idx = 0;
+
+	if(!(pull8(ppReadPackedMsg, &value->frequency_band_indicator, end) &&
+	 	 pull16(ppReadPackedMsg, &value->measurement_period, end) &&
+		 pull32(ppReadPackedMsg, &value->timeout, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_arfcns, end)))
+		return 0;
+
+	if(value->number_of_arfcns <= NFAPI_MAX_CARRIER_LIST)
+	{
+		for(idx = 0; idx < value->number_of_arfcns; ++idx)
+		{
+			if(!(pull16(ppReadPackedMsg, &value->arfcn[idx].arfcn, end) &&
+			 	 pull8(ppReadPackedMsg, &value->arfcn[idx].direction, end)))
+				return 0;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More ARFCN's than we can decode %d \n", value->number_of_arfcns);
+		return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_nb_iot_rssi_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_rssi_request_t* value = (nfapi_nb_iot_rssi_request_t*)tlv;
+	uint16_t idx = 0;
+
+	if(!(pull8(ppReadPackedMsg, &value->frequency_band_indicator, end) &&
+	 	 pull16(ppReadPackedMsg, &value->measurement_period, end) &&
+		 pull32(ppReadPackedMsg, &value->timeout, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_earfcns, end)))
+		return 0;
+
+	if(value->number_of_earfcns <= NFAPI_MAX_CARRIER_LIST)
+	{
+		for(idx = 0; idx < value->number_of_earfcns; ++idx)
+		{
+			if(!(pull16(ppReadPackedMsg, &value->earfcn[idx].earfcn, end) &&
+			 	 pull8(ppReadPackedMsg, &value->earfcn[idx].number_of_ro_dl, end)))
+				return 0;
+				
+			if(value->earfcn[idx].number_of_ro_dl <= NFAPI_MAX_RO_DL)
+			{
+				uint8_t ro_dl_idx = 0;
+				for(ro_dl_idx = 0; ro_dl_idx < value->earfcn[idx].number_of_ro_dl; ++ro_dl_idx)
+				{
+					if(!pull8(ppReadPackedMsg, &value->earfcn[idx].ro_dl[ro_dl_idx], end))
+						return 0;
+				}
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "More ROdl's than we can decode %d \n", value->earfcn[idx].number_of_ro_dl);
+				return 0;
+			}
+			
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More EARFCN's than we can decode %d \n", value->number_of_earfcns);
+		return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_rssi_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_rssi_request_t *pNfapiMsg = (nfapi_rssi_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_RSSI_REQUEST_TAG, &pNfapiMsg->lte_rssi_request, &unpack_lte_rssi_request_value},
+		{ NFAPI_UTRAN_RSSI_REQUEST_TAG, &pNfapiMsg->utran_rssi_request, &unpack_utran_rssi_request_value},
+		{ NFAPI_GERAN_RSSI_REQUEST_TAG, &pNfapiMsg->geran_rssi_request, &unpack_geran_rssi_request_value},
+		{ NFAPI_NB_IOT_RSSI_REQUEST_TAG, &pNfapiMsg->nb_iot_rssi_request, &unpack_nb_iot_rssi_request_value},
+	};
+
+	int result = 0;
+
+	result = (pull8(ppReadPackedMsg, &pNfapiMsg->rat_type, end) &&
+			  unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+
+
+	// Verify that the rat type and the tlv match
+	if(result == 1 &&
+	   !((pNfapiMsg->rat_type == NFAPI_RAT_TYPE_LTE && pNfapiMsg->lte_rssi_request.tl.tag == NFAPI_LTE_RSSI_REQUEST_TAG) ||
+	    (pNfapiMsg->rat_type == NFAPI_RAT_TYPE_UTRAN && pNfapiMsg->utran_rssi_request.tl.tag == NFAPI_UTRAN_RSSI_REQUEST_TAG) ||
+	    (pNfapiMsg->rat_type == NFAPI_RAT_TYPE_GERAN && pNfapiMsg->geran_rssi_request.tl.tag == NFAPI_GERAN_RSSI_REQUEST_TAG) ||
+	    (pNfapiMsg->rat_type == NFAPI_RAT_TYPE_NB_IOT && pNfapiMsg->nb_iot_rssi_request.tl.tag == NFAPI_NB_IOT_RSSI_REQUEST_TAG)))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Mismatch RAT Type: %d and TAG value: 0x%04x \n", pNfapiMsg->rat_type, pNfapiMsg->lte_rssi_request.tl.tag);
+		result = 0;
+	}
+	
+	return result;
+}
+
+static uint8_t unpack_rssi_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_rssi_response_t *pNfapiMsg = (nfapi_rssi_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_rssi_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_rssi_indication_body_t* value = (nfapi_rssi_indication_body_t*)tlv;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_rssi, end) == 0)
+		return 0;
+
+	if(value->number_of_rssi <= NFAPI_MAX_RSSI)
+	{
+		if(pullarrays16(ppReadPackedMsg, value->rssi, NFAPI_MAX_RSSI, value->number_of_rssi, end) == 0)
+			return 0;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More RSSI's than we can decode %d \n", value->number_of_rssi);
+		return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_rssi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_rssi_indication_t *pNfapiMsg = (nfapi_rssi_indication_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_RSSI_INDICATION_TAG, &pNfapiMsg->rssi_indication_body, &unpack_rssi_indication_value},
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+		    unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lte_cell_search_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lte_cell_search_request_t* value = (nfapi_lte_cell_search_request_t*)tlv;
+
+	if(!(pull16(ppReadPackedMsg, &value->earfcn, end) &&
+		 pull8(ppReadPackedMsg, &value->measurement_bandwidth, end) &&
+		 pull8(ppReadPackedMsg, &value->exhaustive_search, end) &&
+		 pull32(ppReadPackedMsg, &value->timeout, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_pci, end)))
+		return 0;
+
+	if(value->number_of_pci <= NFAPI_MAX_PCI_LIST)
+	{
+		if(pullarray16(ppReadPackedMsg, value->pci, NFAPI_MAX_PCI_LIST, value->number_of_pci, end) == 0)
+			return 0;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More PCI's than we can decode %d \n", value->number_of_pci);
+		return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_utran_cell_search_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_utran_cell_search_request_t* value = (nfapi_utran_cell_search_request_t*)tlv;
+
+	if(!(pull16(ppReadPackedMsg, &value->uarfcn, end) &&
+		 pull8(ppReadPackedMsg, &value->exhaustive_search, end) &&
+		 pull32(ppReadPackedMsg, &value->timeout, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_psc, end)))
+		return 0;
+
+	if(value->number_of_psc <= NFAPI_MAX_PSC_LIST)
+	{
+		if(pullarray16(ppReadPackedMsg, value->psc, NFAPI_MAX_PSC_LIST, value->number_of_psc, end) == 0)
+			return 0;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More PSC's than we can decode %d \n", value->number_of_psc);
+		return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_geran_cell_search_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_geran_cell_search_request_t* value = (nfapi_geran_cell_search_request_t*)tlv;
+
+	if(!(pull32(ppReadPackedMsg, &value->timeout, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_arfcn, end)))
+		return 0;
+
+	if(value->number_of_arfcn <= NFAPI_MAX_ARFCN_LIST)
+	{
+		if(pullarray16(ppReadPackedMsg, value->arfcn, NFAPI_MAX_ARFCN_LIST, value->number_of_arfcn, end) == 0)
+			return 0;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More ARFCN's than we can decode %d \n", value->number_of_arfcn);
+		return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_nb_iot_cell_search_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_cell_search_request_t* value = (nfapi_nb_iot_cell_search_request_t*)tlv;
+
+	if(!(pull16(ppReadPackedMsg, &value->earfcn, end) &&
+		 pull8(ppReadPackedMsg, &value->ro_dl, end) &&
+		 pull8(ppReadPackedMsg, &value->exhaustive_search, end) &&
+		 pull32(ppReadPackedMsg, &value->timeout, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_pci, end)))
+		return 0;
+
+	if(value->number_of_pci <= NFAPI_MAX_PCI_LIST)
+	{
+		if(pullarray16(ppReadPackedMsg, value->pci, NFAPI_MAX_PCI_LIST, value->number_of_pci, end) == 0)
+			return 0;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More PCI's than we can decode %d \n", value->number_of_pci);
+		return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_cell_search_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_cell_search_request_t *pNfapiMsg = (nfapi_cell_search_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_CELL_SEARCH_REQUEST_TAG, &pNfapiMsg->lte_cell_search_request, &unpack_lte_cell_search_request_value},
+		{ NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG, &pNfapiMsg->utran_cell_search_request, &unpack_utran_cell_search_request_value},
+		{ NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG, &pNfapiMsg->geran_cell_search_request, &unpack_geran_cell_search_request_value},
+		{ NFAPI_NB_IOT_CELL_SEARCH_REQUEST_TAG, &pNfapiMsg->nb_iot_cell_search_request, &unpack_nb_iot_cell_search_request_value},
+	};
+
+	int result = (pull8(ppReadPackedMsg, &pNfapiMsg->rat_type, end) &&
+			  unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+	// Verify that the rat type and the tlv match
+	if(result == 1 &&
+	   !((pNfapiMsg->rat_type == NFAPI_RAT_TYPE_LTE && pNfapiMsg->lte_cell_search_request.tl.tag == NFAPI_LTE_CELL_SEARCH_REQUEST_TAG) ||
+	    (pNfapiMsg->rat_type == NFAPI_RAT_TYPE_UTRAN && pNfapiMsg->utran_cell_search_request.tl.tag == NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG) ||
+	    (pNfapiMsg->rat_type == NFAPI_RAT_TYPE_GERAN && pNfapiMsg->geran_cell_search_request.tl.tag == NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG) ||
+	    (pNfapiMsg->rat_type == NFAPI_RAT_TYPE_NB_IOT && pNfapiMsg->nb_iot_cell_search_request.tl.tag == NFAPI_NB_IOT_CELL_SEARCH_REQUEST_TAG)))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Mismatch RAT Type: %d and TAG value: 0x%04x \n", pNfapiMsg->rat_type, pNfapiMsg->lte_cell_search_request.tl.tag);
+		result = 0;
+	}
+	
+	return result;
+}
+
+static uint8_t unpack_cell_search_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_cell_search_response_t *pNfapiMsg = (nfapi_cell_search_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lte_cell_search_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lte_cell_search_indication_t* value = (nfapi_lte_cell_search_indication_t*)tlv;
+
+	uint16_t idx = 0;
+	if(pull16(ppReadPackedMsg, &value->number_of_lte_cells_found, end) == 0)
+		return 0;
+
+	if(value->number_of_lte_cells_found <= NFAPI_MAX_LTE_CELLS_FOUND)
+	{
+		for(idx = 0; idx < value->number_of_lte_cells_found; ++idx)
+		{
+			if(!(pull16(ppReadPackedMsg, &value->lte_found_cells[idx].pci, end) &&
+				 pull8(ppReadPackedMsg, &value->lte_found_cells[idx].rsrp, end) &&
+				 pull8(ppReadPackedMsg, &value->lte_found_cells[idx].rsrq, end) &&
+				 pulls16(ppReadPackedMsg, &value->lte_found_cells[idx].frequency_offset, end)))
+				return 0;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More found LTE cells than we can decode %d \n", value->number_of_lte_cells_found);
+		return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_utran_cell_search_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_utran_cell_search_indication_t* value = (nfapi_utran_cell_search_indication_t*)tlv;
+
+	uint16_t idx = 0;
+	if(pull16(ppReadPackedMsg, &value->number_of_utran_cells_found, end) == 0)
+		return 0;
+
+	if(value->number_of_utran_cells_found <= NFAPI_MAX_UTRAN_CELLS_FOUND)
+	{
+		for(idx = 0; idx < value->number_of_utran_cells_found; ++idx)
+		{
+			if(!(pull16(ppReadPackedMsg, &value->utran_found_cells[idx].psc, end) &&
+				 pull8(ppReadPackedMsg, &value->utran_found_cells[idx].rscp, end) &&
+				 pull8(ppReadPackedMsg, &value->utran_found_cells[idx].ecno, end) &&
+				 pulls16(ppReadPackedMsg, &value->utran_found_cells[idx].frequency_offset, end)))
+				return 0;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More found UTRAN cells than we can decode %d \n", value->number_of_utran_cells_found);
+		return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_geran_cell_search_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_geran_cell_search_indication_t* value = (nfapi_geran_cell_search_indication_t*)tlv;
+
+	uint16_t idx = 0;
+	if(pull16(ppReadPackedMsg, &value->number_of_gsm_cells_found, end) == 0)
+		return 0;
+
+	if(value->number_of_gsm_cells_found <= NFAPI_MAX_GSM_CELLS_FOUND)
+	{
+		for(idx = 0; idx < value->number_of_gsm_cells_found; ++idx)
+		{
+			if(!(pull16(ppReadPackedMsg, &value->gsm_found_cells[idx].arfcn, end) &&
+				 pull8(ppReadPackedMsg, &value->gsm_found_cells[idx].bsic, end) &&
+				 pull8(ppReadPackedMsg, &value->gsm_found_cells[idx].rxlev, end) &&
+				 pull8(ppReadPackedMsg, &value->gsm_found_cells[idx].rxqual, end) &&
+				 pulls16(ppReadPackedMsg, &value->gsm_found_cells[idx].frequency_offset, end) &&
+				 pull32(ppReadPackedMsg, &value->gsm_found_cells[idx].sfn_offset, end)))
+				return 0;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More found GSM cells than we can decode %d \n", value->number_of_gsm_cells_found);
+		return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_nb_iot_cell_search_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_cell_search_indication_t* value = (nfapi_nb_iot_cell_search_indication_t*)tlv;
+
+	uint16_t idx = 0;
+	if(pull16(ppReadPackedMsg, &value->number_of_nb_iot_cells_found, end) == 0)
+		return 0;
+
+	if(value->number_of_nb_iot_cells_found <= NFAPI_MAX_NB_IOT_CELLS_FOUND)
+	{
+		for(idx = 0; idx < value->number_of_nb_iot_cells_found; ++idx)
+		{
+			if(!(pull16(ppReadPackedMsg, &value->nb_iot_found_cells[idx].pci, end) &&
+				 pull8(ppReadPackedMsg, &value->nb_iot_found_cells[idx].rsrp, end) &&
+				 pull8(ppReadPackedMsg, &value->nb_iot_found_cells[idx].rsrq, end) &&
+				 pulls16(ppReadPackedMsg, &value->nb_iot_found_cells[idx].frequency_offset, end)))
+				return 0;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More found NB_IOT cells than we can decode %d \n", value->number_of_nb_iot_cells_found);
+		return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_cell_search_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_cell_search_indication_t *pNfapiMsg = (nfapi_cell_search_indication_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->lte_cell_search_indication, &unpack_lte_cell_search_indication_value},
+		{ NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->utran_cell_search_indication, &unpack_utran_cell_search_indication_value},
+		{ NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->geran_cell_search_indication, &unpack_geran_cell_search_indication_value},
+		{ NFAPI_PNF_CELL_SEARCH_STATE_TAG, &pNfapiMsg->pnf_cell_search_state, &unpack_opaque_data_value},
+		{ NFAPI_NB_IOT_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->nb_iot_cell_search_indication, &unpack_nb_iot_cell_search_indication_value},
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+		
+}
+
+static uint8_t unpack_lte_broadcast_detect_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lte_broadcast_detect_request_t* value = (nfapi_lte_broadcast_detect_request_t*)tlv;
+
+	return (pull16(ppReadPackedMsg, &value->earfcn, end) &&
+			pull16(ppReadPackedMsg, &value->pci, end) &&
+			pull32(ppReadPackedMsg, &value->timeout, end));
+}
+
+static uint8_t unpack_utran_broadcast_detect_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_utran_broadcast_detect_request_t* value = (nfapi_utran_broadcast_detect_request_t*)tlv;
+
+	return (pull16(ppReadPackedMsg, &value->uarfcn, end) &&
+			pull16(ppReadPackedMsg, &value->psc, end) &&
+			pull32(ppReadPackedMsg, &value->timeout, end));
+}
+
+static uint8_t unpack_nb_iot_broadcast_detect_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_broadcast_detect_request_t* value = (nfapi_nb_iot_broadcast_detect_request_t*)tlv;
+
+	return (pull16(ppReadPackedMsg, &value->earfcn, end) &&
+			pull8(ppReadPackedMsg, &value->ro_dl, end) &&
+			pull16(ppReadPackedMsg, &value->pci, end) &&
+			pull32(ppReadPackedMsg, &value->timeout, end));
+}
+
+static uint8_t unpack_broadcast_detect_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_broadcast_detect_request_t *pNfapiMsg = (nfapi_broadcast_detect_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_BROADCAST_DETECT_REQUEST_TAG, &pNfapiMsg->lte_broadcast_detect_request, &unpack_lte_broadcast_detect_request_value},
+		{ NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG, &pNfapiMsg->utran_broadcast_detect_request, &unpack_utran_broadcast_detect_request_value},
+		{ NFAPI_PNF_CELL_SEARCH_STATE_TAG, &pNfapiMsg->pnf_cell_search_state, &unpack_opaque_data_value},
+		{ NFAPI_NB_IOT_BROADCAST_DETECT_REQUEST_TAG, &pNfapiMsg->nb_iot_broadcast_detect_request, &unpack_nb_iot_broadcast_detect_request_value}
+	};
+
+	return (pull8(ppReadPackedMsg, &pNfapiMsg->rat_type, end) &&	
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_broadcast_detect_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_broadcast_detect_response_t *pNfapiMsg = (nfapi_broadcast_detect_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lte_broadcast_detect_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lte_broadcast_detect_indication_t* value = (nfapi_lte_broadcast_detect_indication_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &value->number_of_tx_antenna, end) &&
+	 	 pull16(ppReadPackedMsg, &value->mib_length, end)))
+		return 0;
+
+	if(value->mib_length > NFAPI_MAX_MIB_LENGTH)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "MIB too long %d \n", value->mib_length);
+		return 0;
+	}
+	
+	return (pullarray8(ppReadPackedMsg, value->mib, NFAPI_MAX_MIB_LENGTH, value->mib_length, end) &&
+			pull32(ppReadPackedMsg, &value->sfn_offset, end));
+}
+
+static uint8_t unpack_utran_broadcast_detect_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_utran_broadcast_detect_indication_t* value = (nfapi_utran_broadcast_detect_indication_t*)tlv;
+
+	if(pull16(ppReadPackedMsg, &value->mib_length, end) == 0)
+		return 0;
+
+	if(value->mib_length > NFAPI_MAX_MIB_LENGTH)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "MIB too long %d \n", value->mib_length);
+		return 0;
+	}
+
+	return (pullarray8(ppReadPackedMsg, value->mib, NFAPI_MAX_MIB_LENGTH, value->mib_length, end) &&
+			pull32(ppReadPackedMsg, &value->sfn_offset, end));
+}
+
+static uint8_t unpack_nb_iot_broadcast_detect_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_broadcast_detect_indication_t* value = (nfapi_nb_iot_broadcast_detect_indication_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &value->number_of_tx_antenna, end) && 
+		 pull16(ppReadPackedMsg, &value->mib_length, end)))
+		return 0;
+
+	if(value->mib_length > NFAPI_MAX_MIB_LENGTH)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "MIB too long %d \n", value->mib_length);
+		return 0;
+	}
+
+	return (pullarray8(ppReadPackedMsg, value->mib, NFAPI_MAX_MIB_LENGTH, value->mib_length, end) &&
+			pull32(ppReadPackedMsg, &value->sfn_offset, end));
+}
+
+static uint8_t unpack_broadcast_detect_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_broadcast_detect_indication_t *pNfapiMsg = (nfapi_broadcast_detect_indication_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG, &pNfapiMsg->lte_broadcast_detect_indication, &unpack_lte_broadcast_detect_indication_value},
+		{ NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG, &pNfapiMsg->utran_broadcast_detect_indication, &unpack_utran_broadcast_detect_indication_value},
+		{ NFAPI_NB_IOT_BROADCAST_DETECT_INDICATION_TAG, &pNfapiMsg->nb_iot_broadcast_detect_indication, &unpack_nb_iot_broadcast_detect_indication_value},
+		{ NFAPI_PNF_CELL_BROADCAST_STATE_TAG, &pNfapiMsg->pnf_cell_broadcast_state, &unpack_opaque_data_value}
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lte_system_information_schedule_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lte_system_information_schedule_request_t* value = (nfapi_lte_system_information_schedule_request_t*)tlv;
+
+	return (pull16(ppReadPackedMsg, &value->earfcn, end) &&
+			pull16(ppReadPackedMsg, &value->pci, end) &&
+			pull16(ppReadPackedMsg, &value->downlink_channel_bandwidth, end) &&
+			pull8(ppReadPackedMsg, &value->phich_configuration, end) &&
+			pull8(ppReadPackedMsg, &value->number_of_tx_antenna, end) &&
+			pull8(ppReadPackedMsg, &value->retry_count, end) &&
+			pull32(ppReadPackedMsg, &value->timeout, end));
+}
+
+static uint8_t unpack_nb_iot_system_information_schedule_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_system_information_schedule_request_t* value = (nfapi_nb_iot_system_information_schedule_request_t*)tlv;
+
+	return (pull16(ppReadPackedMsg, &value->earfcn, end) &&
+			pull8(ppReadPackedMsg, &value->ro_dl, end) &&	
+			pull16(ppReadPackedMsg, &value->pci, end) &&
+			pull8(ppReadPackedMsg, &value->scheduling_info_sib1_nb, end) &&
+			pull32(ppReadPackedMsg, &value->timeout, end));
+}
+
+static uint8_t unpack_system_information_schedule_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_schedule_request_t *pNfapiMsg = (nfapi_system_information_schedule_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG, &pNfapiMsg->lte_system_information_schedule_request, &unpack_lte_system_information_schedule_request_value},
+		{ NFAPI_NB_IOT_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG, &pNfapiMsg->nb_iot_system_information_schedule_request, &unpack_nb_iot_system_information_schedule_request_value},
+		{ NFAPI_PNF_CELL_BROADCAST_STATE_TAG, &pNfapiMsg->pnf_cell_broadcast_state, &unpack_opaque_data_value}
+	};
+
+	return (pull8(ppReadPackedMsg, &pNfapiMsg->rat_type, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_system_information_schedule_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_schedule_response_t *pNfapiMsg = (nfapi_system_information_schedule_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lte_system_information_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lte_system_information_indication_t* value = (nfapi_lte_system_information_indication_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &value->sib_type, end) &&
+		 pull16(ppReadPackedMsg, &value->sib_length, end)))
+		return 0;
+
+	if(value->sib_length > NFAPI_MAX_SIB_LENGTH)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "SIB too long %d \n", value->sib_length);
+		return 0;
+	}
+	
+	if(pullarray8(ppReadPackedMsg, value->sib, NFAPI_MAX_SIB_LENGTH,  value->sib_length, end) == 0)
+		return 0;
+
+	return 1;
+}
+
+static uint8_t unpack_nb_iot_system_information_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_system_information_indication_t* value = (nfapi_nb_iot_system_information_indication_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &value->sib_type, end) &&
+		 pull16(ppReadPackedMsg, &value->sib_length, end)))
+		return 0;
+
+	if(value->sib_length > NFAPI_MAX_SIB_LENGTH)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "SIB too long %d \n", value->sib_length);
+		return 0;
+	}
+	
+	if(pullarray8(ppReadPackedMsg, value->sib, NFAPI_MAX_SIB_LENGTH,  value->sib_length, end) == 0)
+		return 0;
+
+	return 1;
+}
+
+static uint8_t unpack_system_information_schedule_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_schedule_indication_t *pNfapiMsg = (nfapi_system_information_schedule_indication_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->lte_system_information_indication, &unpack_lte_system_information_indication_value},
+		{ NFAPI_NB_IOT_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->nb_iot_system_information_indication, &unpack_nb_iot_system_information_indication_value},
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lte_system_information_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lte_system_information_request_t* value = (nfapi_lte_system_information_request_t*)tlv;
+	uint16_t idx = 0;
+
+	if(!(pull16(ppReadPackedMsg, &value->earfcn, end) &&
+		 pull16(ppReadPackedMsg, &value->pci, end) &&
+		 pull16(ppReadPackedMsg, &value->downlink_channel_bandwidth, end) &&
+		 pull8(ppReadPackedMsg, &value->phich_configuration, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_tx_antenna, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_si_periodicity, end)))
+		return 0;
+
+	if(value->number_of_si_periodicity > NFAPI_MAX_SI_PERIODICITY)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More found SI periodicity than we can decode %d \n", value->number_of_si_periodicity);
+		return 0;
+	}
+
+	for(idx = 0; idx < value->number_of_si_periodicity; ++idx)
+	{
+		if(!(pull8(ppReadPackedMsg, &value->si_periodicity[idx].si_periodicity, end) &&
+			 pull8(ppReadPackedMsg, &value->si_periodicity[idx].si_index, end)))
+			return 0;
+	}
+
+	if(!(pull8(ppReadPackedMsg, &value->si_window_length, end) &&
+	 	 pull32(ppReadPackedMsg, &value->timeout, end)))
+		return 0;
+
+	return 1;
+}
+
+static uint8_t unpack_utran_system_information_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_utran_system_information_request_t* value = (nfapi_utran_system_information_request_t*)tlv;
+
+	return (pull16(ppReadPackedMsg, &value->uarfcn, end) &&
+			pull16(ppReadPackedMsg, &value->psc, end) &&
+			pull32(ppReadPackedMsg, &value->timeout, end));
+}
+
+static uint8_t unpack_geran_system_information_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_geran_system_information_request_t* value = (nfapi_geran_system_information_request_t*)tlv;
+
+	return (pull16(ppReadPackedMsg, &value->arfcn, end) &&
+			pull8(ppReadPackedMsg, &value->bsic, end) &&
+			pull32(ppReadPackedMsg, &value->timeout, end));
+}
+
+static uint8_t unpack_nb_iot_system_information_request_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_iot_system_information_request_t* value = (nfapi_nb_iot_system_information_request_t*)tlv;
+	uint16_t idx = 0;
+
+	if(!(pull16(ppReadPackedMsg, &value->earfcn, end) &&
+		 pull8(ppReadPackedMsg, &value->ro_dl, end) &&
+		 pull16(ppReadPackedMsg, &value->pci, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_si_periodicity, end)))
+		return 0;
+
+	if(value->number_of_si_periodicity > NFAPI_MAX_SI_PERIODICITY)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "More found SI periodicity than we can decode %d \n", value->number_of_si_periodicity);
+		return 0;
+	}
+
+	for(idx = 0; idx < value->number_of_si_periodicity; ++idx)
+	{
+		if(!(pull8(ppReadPackedMsg, &value->si_periodicity[idx].si_periodicity, end) &&
+			 pull8(ppReadPackedMsg, &value->si_periodicity[idx].si_repetition_pattern, end) &&
+			 pull8(ppReadPackedMsg, &value->si_periodicity[idx].si_tb_size, end) &&
+			 pull8(ppReadPackedMsg, &value->si_periodicity[idx].number_of_si_index, end)))
+			return 0;
+			
+		uint8_t si_idx;
+		for(si_idx = 0; si_idx < value->si_periodicity[idx].number_of_si_index; ++si_idx)
+		{
+			if(!(pull8(ppReadPackedMsg, &value->si_periodicity[idx].si_index[si_idx], end)))
+				return 0;
+			
+		}
+	}
+
+	if(!(pull8(ppReadPackedMsg, &value->si_window_length, end) &&
+	 	 pull32(ppReadPackedMsg, &value->timeout, end)))
+		return 0;
+
+	return 1;
+}
+
+static uint8_t unpack_system_information_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_request_t *pNfapiMsg = (nfapi_system_information_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG, &pNfapiMsg->lte_system_information_request, &unpack_lte_system_information_request_value},
+		{ NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG, &pNfapiMsg->utran_system_information_request, &unpack_utran_system_information_request_value},
+		{ NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG, &pNfapiMsg->geran_system_information_request, &unpack_geran_system_information_request_value},
+		{ NFAPI_NB_IOT_SYSTEM_INFORMATION_REQUEST_TAG, &pNfapiMsg->nb_iot_system_information_request, &unpack_nb_iot_system_information_request_value},
+		{ NFAPI_PNF_CELL_BROADCAST_STATE_TAG, &pNfapiMsg->pnf_cell_broadcast_state, &unpack_opaque_data_value}
+	};
+
+
+	int result = (pull8(ppReadPackedMsg, &pNfapiMsg->rat_type, end) &&
+				  unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+	// Verify that the rat type and the tlv match
+	if(result == 1 &&
+	   !((pNfapiMsg->rat_type == NFAPI_RAT_TYPE_LTE && pNfapiMsg->lte_system_information_request.tl.tag == NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG) ||
+	    (pNfapiMsg->rat_type == NFAPI_RAT_TYPE_UTRAN && pNfapiMsg->utran_system_information_request.tl.tag == NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG) ||
+	    (pNfapiMsg->rat_type == NFAPI_RAT_TYPE_GERAN && pNfapiMsg->geran_system_information_request.tl.tag == NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG)))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Mismatch RAT Type: %d and TAG value: 0x%04x \n", pNfapiMsg->rat_type, pNfapiMsg->lte_system_information_request.tl.tag);
+		result = 0;
+	}
+	
+	return result;
+}
+
+static uint8_t unpack_system_information_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_response_t *pNfapiMsg = (nfapi_system_information_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_utran_system_information_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_utran_system_information_indication_t* value = (nfapi_utran_system_information_indication_t*)tlv;
+
+	if(pull16(ppReadPackedMsg, &value->sib_length, end) == 0)
+		return 0;
+
+	if(value->sib_length > NFAPI_MAX_SIB_LENGTH)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "SIB too long %d \n", value->sib_length);
+		return 0;
+	}
+	
+	if(pullarray8(ppReadPackedMsg, value->sib, NFAPI_MAX_SIB_LENGTH, value->sib_length, end) == 0)
+		return 0;
+
+	return 1;
+}
+
+static uint8_t unpack_geran_system_information_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_geran_system_information_indication_t* value = (nfapi_geran_system_information_indication_t*)tlv;
+
+	if(pull16(ppReadPackedMsg, &value->si_length, end) == 0)
+		return 0;
+
+	if(value->si_length > NFAPI_MAX_SI_LENGTH)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "SIB too long %d \n", value->si_length);
+		return 0;
+	}
+
+	if(pullarray8(ppReadPackedMsg, value->si, NFAPI_MAX_SI_LENGTH, value->si_length, end) == 0)
+		return 0;
+
+	return 1;
+}
+
+static uint8_t unpack_system_information_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_system_information_indication_t *pNfapiMsg = (nfapi_system_information_indication_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->lte_system_information_indication, &unpack_lte_system_information_indication_value},
+		{ NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->utran_system_information_indication, &unpack_utran_system_information_indication_value},
+		{ NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->geran_system_information_indication, &unpack_geran_system_information_indication_value},
+		{ NFAPI_NB_IOT_SYSTEM_INFORMATION_INDICATION_TAG, &pNfapiMsg->nb_iot_system_information_indication, &unpack_nb_iot_system_information_indication_value},
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+}
+
+static uint8_t unpack_nmm_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_nmm_stop_request_t *pNfapiMsg = (nfapi_nmm_stop_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension);
+}
+
+static uint8_t unpack_nmm_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_nmm_stop_response_t *pNfapiMsg = (nfapi_nmm_stop_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
+{
+	int retLen = 0;
+
+	switch (msgId)
+	{
+		case NFAPI_RSSI_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_rssi_request_t))
+				retLen = sizeof(nfapi_rssi_request_t);
+			break;
+
+		case NFAPI_RSSI_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_rssi_response_t))
+				retLen = sizeof(nfapi_rssi_response_t);
+			break;
+
+		case NFAPI_RSSI_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_rssi_indication_t))
+				retLen = sizeof(nfapi_rssi_indication_t);
+			break;
+
+		case NFAPI_CELL_SEARCH_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_cell_search_request_t))
+				retLen = sizeof(nfapi_cell_search_request_t);
+			break;
+
+		case NFAPI_CELL_SEARCH_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_cell_search_response_t))
+				retLen = sizeof(nfapi_cell_search_response_t);
+			break;
+
+		case NFAPI_CELL_SEARCH_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_cell_search_indication_t))
+				retLen = sizeof(nfapi_cell_search_indication_t);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_broadcast_detect_request_t))
+				retLen = sizeof(nfapi_broadcast_detect_request_t);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_broadcast_detect_response_t))
+				retLen = sizeof(nfapi_broadcast_detect_response_t);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_broadcast_detect_indication_t))
+				retLen = sizeof(nfapi_broadcast_detect_indication_t);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_system_information_schedule_request_t))
+				retLen = sizeof(nfapi_system_information_schedule_request_t);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_system_information_schedule_response_t))
+				retLen = sizeof(nfapi_system_information_schedule_response_t);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_system_information_schedule_indication_t))
+				retLen = sizeof(nfapi_system_information_schedule_indication_t);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_system_information_request_t))
+				retLen = sizeof(nfapi_system_information_request_t);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_system_information_response_t))
+				retLen = sizeof(nfapi_system_information_response_t);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_system_information_indication_t))
+				retLen = sizeof(nfapi_system_information_indication_t);
+			break;
+
+		case NFAPI_NMM_STOP_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_nmm_stop_request_t))
+				retLen = sizeof(nfapi_nmm_stop_request_t);
+			break;
+
+		case NFAPI_NMM_STOP_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_nmm_stop_response_t))
+				retLen = sizeof(nfapi_nmm_stop_response_t);
+			break;
+
+		default:
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
+			break;
+	}
+
+	return retLen;
+}
+
+int nfapi_p4_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
+	uint8_t *end = pPackedBuf + packedBufLen;
+	uint8_t *pWritePackedMessage = pPackedBuf;
+	uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+	uint32_t packedMsgLen;
+	uint16_t packedMsgLen16;
+
+	if (pMessageBuf == NULL || pPackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P4 Pack supplied pointers are null\n");
+		return -1;
+	}
+
+	// process the header
+	if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
+		 push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
+		 push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
+		 push16(pMessageHeader->spare, &pWritePackedMessage, end)))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to pack p4 message header\n");
+		return -1;
+	}
+
+	// look for the specific message
+	uint8_t result = 0;
+	switch (pMessageHeader->message_id)
+	{
+		case NFAPI_RSSI_REQUEST:
+			result = pack_rssi_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_RSSI_RESPONSE:
+			result = pack_rssi_response(pMessageHeader, &pWritePackedMessage,  end,config);
+			break;
+
+		case NFAPI_RSSI_INDICATION:
+			result = pack_rssi_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_CELL_SEARCH_REQUEST:
+			result = pack_cell_search_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_CELL_SEARCH_RESPONSE:
+			result = pack_cell_search_response(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_CELL_SEARCH_INDICATION:
+			result = pack_cell_search_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_REQUEST:
+			result = pack_broadcast_detect_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_RESPONSE:
+			result = pack_broadcast_detect_response(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_INDICATION:
+			result = pack_broadcast_detect_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST:
+			result = pack_system_information_schedule_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE:
+			result = pack_system_information_schedule_response(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION:
+			result = pack_system_information_schedule_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_REQUEST:
+			result = pack_system_information_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_RESPONSE:
+			result = pack_system_information_response(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_INDICATION:
+			result = pack_system_information_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_NMM_STOP_REQUEST:
+			result = pack_nmm_stop_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_NMM_STOP_RESPONSE:
+			result = pack_nmm_stop_response(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		default:
+			{
+				if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+				   pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MIN)
+				{
+					if(config && config->pack_p4_p5_vendor_extension)
+					{
+						result =(config->pack_p4_p5_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
+					}
+					else
+					{
+						NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve encoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+					}
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+				}
+			}
+			break;
+	}	
+	
+	// return the packed length
+	if(result == 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Result is 0\n");
+		return -1;
+	}
+
+
+	// check for a valid message length
+	packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pWritePackedMessage);
+	if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
+		return -1;
+	}
+	else
+	{
+		packedMsgLen16 = (uint16_t)packedMsgLen;
+	}
+
+	// Update the message length in the header
+	if(push16(packedMsgLen16, &pPackedLengthField, end) == 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to pack p4 message header lengt\n");
+		return -1;
+	}
+
+	return (packedMsgLen);
+
+}
+
+// Main unpack functions - public
+
+int nfapi_p4_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
+	uint8_t *pReadPackedMessage = pMessageBuf;
+	uint8_t *end = pMessageBuf + messageBufLen;
+
+	if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P4 header unpack supplied pointers are null\n");
+		return -1;
+	}
+
+	if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+		return -1;
+	}
+
+	// process the headei
+	if (pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+		pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+		pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+		pull16(&pReadPackedMessage, &pMessageHeader->spare, end))
+		return -1;
+
+	return 0;
+}
+
+int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config)
+{
+	int result = 0;
+	nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
+	uint8_t *pReadPackedMessage = pMessageBuf;
+	uint8_t *end = pMessageBuf + messageBufLen;
+
+	if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P4 unpack supplied pointers are null\n");
+		return -1;
+	}
+
+	if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P4 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+		return -1;
+	}
+
+	// clean the supplied buffer for - tag value blanking
+	(void)memset(pUnpackedBuf, 0, unpackedBufLen);
+
+	// process the header
+	if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+	 	 pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+		 pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+		 pull16(&pReadPackedMessage, &pMessageHeader->spare, end)))
+		return -1;
+
+	// look for the specific message
+	switch (pMessageHeader->message_id)
+	{
+		case NFAPI_RSSI_REQUEST:
+			if (check_unpack_length(NFAPI_RSSI_REQUEST, unpackedBufLen))
+				result = unpack_rssi_request(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_RSSI_RESPONSE:
+			if (check_unpack_length(NFAPI_RSSI_RESPONSE, unpackedBufLen))
+				result = unpack_rssi_response(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_RSSI_INDICATION:
+			if (check_unpack_length(NFAPI_RSSI_INDICATION, unpackedBufLen))
+				result = unpack_rssi_indication(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_CELL_SEARCH_REQUEST:
+			if (check_unpack_length(NFAPI_CELL_SEARCH_REQUEST, unpackedBufLen))
+				result = unpack_cell_search_request(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_CELL_SEARCH_RESPONSE:
+			if (check_unpack_length(NFAPI_CELL_SEARCH_RESPONSE, unpackedBufLen))
+				result = unpack_cell_search_response(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_CELL_SEARCH_INDICATION:
+			if (check_unpack_length(NFAPI_CELL_SEARCH_INDICATION, unpackedBufLen))
+				result = unpack_cell_search_indication(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_BROADCAST_DETECT_REQUEST:
+			if (check_unpack_length(NFAPI_BROADCAST_DETECT_REQUEST, unpackedBufLen))
+				result = unpack_broadcast_detect_request(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_BROADCAST_DETECT_RESPONSE:
+			if (check_unpack_length(NFAPI_BROADCAST_DETECT_RESPONSE, unpackedBufLen))
+				result = unpack_broadcast_detect_response(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_BROADCAST_DETECT_INDICATION:
+			if (check_unpack_length(NFAPI_BROADCAST_DETECT_INDICATION, unpackedBufLen))
+				result = unpack_broadcast_detect_indication(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST:
+			if (check_unpack_length(NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST, unpackedBufLen))
+				result = unpack_system_information_schedule_request(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+			
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE:
+			if (check_unpack_length(NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE, unpackedBufLen))
+				result = unpack_system_information_schedule_response(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION:
+			if (check_unpack_length(NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION, unpackedBufLen))
+				result = unpack_system_information_schedule_indication(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_REQUEST:
+			if (check_unpack_length(NFAPI_SYSTEM_INFORMATION_REQUEST, unpackedBufLen))
+				result = unpack_system_information_request(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_RESPONSE:
+			if (check_unpack_length(NFAPI_SYSTEM_INFORMATION_RESPONSE, unpackedBufLen))
+				result = unpack_system_information_response(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result =  -1;
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_INDICATION:
+			if (check_unpack_length(NFAPI_SYSTEM_INFORMATION_INDICATION, unpackedBufLen))
+				result = unpack_system_information_indication(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result =  -1;
+			break;
+
+		case NFAPI_NMM_STOP_REQUEST:
+			if (check_unpack_length(NFAPI_NMM_STOP_REQUEST, unpackedBufLen))
+				result = unpack_nmm_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		case NFAPI_NMM_STOP_RESPONSE:
+			if (check_unpack_length(NFAPI_NMM_STOP_RESPONSE, unpackedBufLen))
+				result = unpack_nmm_stop_response(&pReadPackedMessage, end , pMessageHeader, config);
+			else
+				result = -1;
+			break;
+
+		default:
+			if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && 
+			   pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+			{
+				if(config && config->unpack_p4_p5_vendor_extension)
+				{
+					result = (config->unpack_p4_p5_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+				}
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown P4 message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+			}
+			break;
+	}
+
+	if(result == 0)
+		return -1;
+
+	return result;
+}
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c
new file mode 100644
index 0000000000000000000000000000000000000000..c78b8291358c2a611763649d024bb86acf2b9fba
--- /dev/null
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c
@@ -0,0 +1,1800 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sched.h>
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdint.h>
+
+#include <nfapi_interface.h>
+#include <nfapi.h>
+#include <debug.h>
+
+
+// Pack routines
+
+static uint8_t pack_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_param_request_t* request = (nfapi_pnf_param_request_t*)msg;
+	return pack_vendor_extension_tlv(request->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_pnf_param_general_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_param_general_t* value = (nfapi_pnf_param_general_t*)tlv;
+
+	return ( push8(value->nfapi_sync_mode, ppWritePackedMsg, end) &&
+			 push8(value->location_mode, ppWritePackedMsg, end) &&
+			 push16(value->location_coordinates_length, ppWritePackedMsg, end) &&
+			 pusharray8(value->location_coordinates, NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH, value->location_coordinates_length, ppWritePackedMsg, end) &&
+			 push32(value->dl_config_timing, ppWritePackedMsg, end) &&
+			 push32(value->tx_timing, ppWritePackedMsg, end) &&
+			 push32(value->ul_config_timing, ppWritePackedMsg, end) &&
+			 push32(value->hi_dci0_timing, ppWritePackedMsg, end) &&
+			 push16(value->maximum_number_phys, ppWritePackedMsg, end) &&
+			 push16(value->maximum_total_bandwidth, ppWritePackedMsg, end) &&
+			 push8(value->maximum_total_number_dl_layers, ppWritePackedMsg, end) &&
+			 push8(value->maximum_total_number_ul_layers, ppWritePackedMsg, end) &&
+			 push8(value->shared_bands, ppWritePackedMsg, end) &&
+			 push8(value->shared_pa, ppWritePackedMsg, end) &&
+			 pushs16(value->maximum_total_power, ppWritePackedMsg, end) &&
+			 pusharray8(value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_rf_config_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_rf_config_info_t* rf = (nfapi_rf_config_info_t*)elem;
+
+	return (push16(rf->rf_config_index, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_pnf_phy_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t* end)
+{
+	nfapi_pnf_phy_info_t* phy = (nfapi_pnf_phy_info_t*)elem;
+
+	return (  push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+			  push16(phy->number_of_rfs, ppWritePackedMsg, end) &&
+			  packarray(phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, ppWritePackedMsg, end, &pack_rf_config_info) &&
+			  push16(phy->number_of_rf_exclusions, ppWritePackedMsg, end) &&
+			  packarray(phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, ppWritePackedMsg, end, &pack_rf_config_info) &&
+			  push16(phy->downlink_channel_bandwidth_supported, ppWritePackedMsg, end) &&
+			  push16(phy->uplink_channel_bandwidth_supported, ppWritePackedMsg, end) &&
+			  push8(phy->number_of_dl_layers_supported, ppWritePackedMsg, end) &&
+			  push8(phy->number_of_ul_layers_supported, ppWritePackedMsg, end) &&
+			  push16(phy->maximum_3gpp_release_supported, ppWritePackedMsg, end) &&
+			  push8(phy->nmm_modes_supported, ppWritePackedMsg, end));
+
+
+}
+
+static uint8_t pack_pnf_phy_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_t* value = (nfapi_pnf_phy_t*)tlv;
+
+	return ( push16(value->number_of_phys, ppWritePackedMsg, end) &&
+			 packarray(value->phy, sizeof(nfapi_pnf_phy_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_info));
+}
+
+static uint8_t pack_pnf_rf_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_rf_t* value = (nfapi_pnf_rf_t*)tlv;
+	uint16_t rf_index = 0;
+
+	if(push16(value->number_of_rfs, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	for(; rf_index < value->number_of_rfs; ++rf_index)
+	{
+		if( !(push16(value->rf[rf_index].rf_config_index, ppWritePackedMsg, end) &&
+			  push16(value->rf[rf_index].band, ppWritePackedMsg, end) &&
+			  pushs16(value->rf[rf_index].maximum_transmit_power, ppWritePackedMsg, end) &&
+			  pushs16(value->rf[rf_index].minimum_transmit_power, ppWritePackedMsg, end) &&
+			  push8(value->rf[rf_index].number_of_antennas_suppported, ppWritePackedMsg, end) &&
+			  push32(value->rf[rf_index].minimum_downlink_frequency, ppWritePackedMsg, end) &&
+			  push32(value->rf[rf_index].maximum_downlink_frequency, ppWritePackedMsg, end) &&
+			  push32(value->rf[rf_index].minimum_uplink_frequency, ppWritePackedMsg, end) &&
+			  push32(value->rf[rf_index].maximum_uplink_frequency, ppWritePackedMsg, end)))
+			return 0;
+	}
+
+	return 1;
+}
+static uint8_t pack_pnf_phy_rel10_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel10_info_t* phy = (nfapi_pnf_phy_rel10_info_t*)elem;
+
+	return(push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+		   push16(phy->transmission_mode_7_supported, ppWritePackedMsg, end) &&
+		   push16(phy->transmission_mode_8_supported, ppWritePackedMsg, end) &&
+		   push16(phy->two_antenna_ports_for_pucch, ppWritePackedMsg, end) &&
+		   push16(phy->transmission_mode_9_supported, ppWritePackedMsg, end) &&
+		   push16(phy->simultaneous_pucch_pusch, ppWritePackedMsg, end) &&
+		   push16(phy->four_layer_tx_with_tm3_and_tm4, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_pnf_phy_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel10_t* value = (nfapi_pnf_phy_rel10_t*)tlv;
+
+	return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+			packarray(value->phy, sizeof(nfapi_pnf_phy_rel10_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel10_info));
+
+}
+
+static uint8_t pack_pnf_phy_rel11_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel11_info_t* phy = (nfapi_pnf_phy_rel11_info_t*)elem;
+		
+	return (push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+			push16(phy->edpcch_supported, ppWritePackedMsg, end) &&
+			push16(phy->multi_ack_csi_reporting, ppWritePackedMsg, end) &&
+			push16(phy->pucch_tx_diversity, ppWritePackedMsg, end) &&
+			push16(phy->ul_comp_supported, ppWritePackedMsg, end) &&
+			push16(phy->transmission_mode_5_supported, ppWritePackedMsg, end ));
+}
+static uint8_t pack_pnf_phy_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel11_t* value = (nfapi_pnf_phy_rel11_t*)tlv;
+
+	return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+			packarray(value->phy, sizeof(nfapi_pnf_phy_rel11_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel11_info));
+}
+static uint8_t pack_pnf_phy_rel12_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel12_info_t* phy = (nfapi_pnf_phy_rel12_info_t*)elem;
+
+	return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+			push16(phy->csi_subframe_set, ppWritePackedMsg, end) &&
+			push16(phy->enhanced_4tx_codebook, ppWritePackedMsg, end) &&
+			push16(phy->drs_supported, ppWritePackedMsg, end) &&
+			push16(phy->ul_64qam_supported, ppWritePackedMsg, end) &&
+			push16(phy->transmission_mode_10_supported, ppWritePackedMsg, end) &&
+			push16(phy->alternative_bts_indices, ppWritePackedMsg, end));
+}
+static uint8_t pack_pnf_phy_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel12_t* value = (nfapi_pnf_phy_rel12_t*)tlv;
+
+	return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+			packarray(value->phy, sizeof(nfapi_pnf_phy_rel12_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel12_info));
+
+}
+
+static uint8_t pack_pnf_phy_rel13_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel13_info_t* phy = (nfapi_pnf_phy_rel13_info_t*)elem;
+		
+	return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+			push16(phy->pucch_format4_supported, ppWritePackedMsg, end) &&
+			push16(phy->pucch_format5_supported, ppWritePackedMsg, end) &&
+			push16(phy->more_than_5_ca_support, ppWritePackedMsg, end) &&
+			push16(phy->laa_supported, ppWritePackedMsg, end) &&
+			push16(phy->laa_ending_in_dwpts_supported, ppWritePackedMsg, end) &&
+			push16(phy->laa_starting_in_second_slot_supported, ppWritePackedMsg, end) &&
+			push16(phy->beamforming_supported, ppWritePackedMsg, end) &&
+			push16(phy->csi_rs_enhancement_supported, ppWritePackedMsg, end) &&
+			push16(phy->drms_enhancement_supported, ppWritePackedMsg, end) &&
+			push16(phy->srs_enhancement_supported, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_pnf_phy_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel13_t* value = (nfapi_pnf_phy_rel13_t*)tlv;
+
+	return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+	        packarray(value->phy, sizeof(nfapi_pnf_phy_rel13_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel13_info));
+}
+
+static uint8_t pack_pnf_phy_rel13_nb_iot_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel13_nb_iot_info_t* phy = (nfapi_pnf_phy_rel13_nb_iot_info_t*)elem;
+		
+	return( push16(phy->phy_config_index, ppWritePackedMsg, end) &&
+			push16(phy->number_of_rfs, ppWritePackedMsg, end) &&
+			packarray(phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, ppWritePackedMsg, end, &pack_rf_config_info) &&
+			push16(phy->number_of_rf_exclusions, ppWritePackedMsg, end) &&
+			packarray(phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, ppWritePackedMsg, end, &pack_rf_config_info) &&
+			push8(phy->number_of_dl_layers_supported, ppWritePackedMsg, end) &&
+			push8(phy->number_of_ul_layers_supported, ppWritePackedMsg, end) &&
+			push16(phy->maximum_3gpp_release_supported, ppWritePackedMsg, end) &&
+			push8(phy->nmm_modes_supported, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_pnf_phy_rel13_nb_iot_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel13_nb_iot_t* value = (nfapi_pnf_phy_rel13_nb_iot_t*)tlv;
+
+	return (push16(value->number_of_phys, ppWritePackedMsg, end) &&
+	        packarray(value->phy, sizeof(nfapi_pnf_phy_rel13_nb_iot_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_info));
+}
+
+
+static uint8_t pack_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_param_response_t *pNfapiMsg = (nfapi_pnf_param_response_t*)msg;
+
+	return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) &&
+			pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) &&
+			pack_tlv(NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, ppWritePackedMsg, end, &pack_pnf_rf_value) &&
+			pack_tlv(NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, ppWritePackedMsg, end, &pack_pnf_phy_rel10_value) &&
+			pack_tlv(NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, ppWritePackedMsg, end, &pack_pnf_phy_rel11_value) &&
+			pack_tlv(NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, ppWritePackedMsg, end, &pack_pnf_phy_rel12_value) &&
+			pack_tlv(NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, ppWritePackedMsg, end, &pack_pnf_phy_rel13_value) &&
+			pack_tlv(NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_phy_rf_config_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_phy_rf_config_info_t* rf = (nfapi_phy_rf_config_info_t*)elem;
+		
+	return (push16(rf->phy_id, ppWritePackedMsg, end) &&
+			push16(rf->phy_config_index, ppWritePackedMsg, end) &&
+			push16(rf->rf_config_index, ppWritePackedMsg, end));
+}
+		
+
+static uint8_t pack_pnf_phy_rf_config_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rf_config_t *value = (nfapi_pnf_phy_rf_config_t*)tlv;
+
+	return(push16(value->number_phy_rf_config_info, ppWritePackedMsg, end) &&
+		   packarray(value->phy_rf_config, sizeof(nfapi_phy_rf_config_info_t), NFAPI_MAX_PHY_RF_INSTANCES, value->number_phy_rf_config_info, ppWritePackedMsg, end, &pack_phy_rf_config_info));
+
+}
+
+static uint8_t pack_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_config_request_t *pNfapiMsg = (nfapi_pnf_config_request_t*)msg;
+	return ( pack_tlv(NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, ppWritePackedMsg, end, &pack_pnf_phy_rf_config_value) && 
+			 pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end , config));
+}
+
+
+static uint8_t pack_pnf_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_config_response_t *pNfapiMsg = (nfapi_pnf_config_response_t*)msg;
+
+	return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			 pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_pnf_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_start_request_t *pNfapiMsg = (nfapi_pnf_start_request_t*)msg;
+	return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_pnf_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_start_response_t *pNfapiMsg = (nfapi_pnf_start_response_t*)msg;
+
+	return( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) && 
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_pnf_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_stop_request_t *pNfapiMsg = (nfapi_pnf_stop_request_t*)msg;
+	return ( pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_pnf_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_stop_response_t *pNfapiMsg = (nfapi_pnf_stop_response_t*)msg;
+
+	return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+		 	 pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_param_request_t *pNfapiMsg = (nfapi_param_request_t*)msg;
+	return (pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_uint16_tlv_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_uint16_tlv_t* value = (nfapi_uint16_tlv_t*)tlv;
+	return push16(value->value, ppWritePackedMsg, end);
+}
+
+static uint8_t unpack_uint16_tlv_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_uint16_tlv_t* value = (nfapi_uint16_tlv_t*)tlv;
+	return pull16(ppReadPackedMsg, &value->value, end);
+}
+static uint8_t pack_int16_tlv_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_int16_tlv_t* value = (nfapi_int16_tlv_t*)tlv;
+	return pushs16(value->value, ppWritePackedMsg, end);
+}
+
+static uint8_t unpack_int16_tlv_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_int16_tlv_t* value = (nfapi_int16_tlv_t*)tlv;
+	return pulls16(ppReadPackedMsg, &value->value, end);
+}
+
+static uint8_t pack_uint8_tlv_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_uint8_tlv_t* value = (nfapi_uint8_tlv_t*)tlv;
+	return push8(value->value, ppWritePackedMsg, end);
+}
+static uint8_t unpack_uint8_tlv_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_uint8_tlv_t* value = (nfapi_uint8_tlv_t*)tlv;
+	return pull8(ppReadPackedMsg, &value->value, end);
+}
+
+static uint8_t pack_ipv4_address_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ipv4_address_t* value = (nfapi_ipv4_address_t*)tlv;
+	return pusharray8(value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, ppWritePackedMsg, end);
+}
+static uint8_t unpack_ipv4_address_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ipv4_address_t* value = (nfapi_ipv4_address_t*)tlv;
+	return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV4_ADDRESS_LENGTH, NFAPI_IPV4_ADDRESS_LENGTH, end);
+}
+static uint8_t pack_ipv6_address_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ipv6_address_t* value = (nfapi_ipv6_address_t*)tlv;
+	return pusharray8(value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, ppWritePackedMsg, end);
+}
+static uint8_t unpack_ipv6_address_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ipv4_address_t* value = (nfapi_ipv4_address_t*)tlv;
+	return pullarray8(ppReadPackedMsg, value->address, NFAPI_IPV6_ADDRESS_LENGTH, NFAPI_IPV6_ADDRESS_LENGTH, end);
+}
+
+static uint8_t pack_rf_bands_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_rf_bands_t* value = (nfapi_rf_bands_t*)tlv;
+	
+	return ( push16(value->number_rf_bands, ppWritePackedMsg, end) &&
+			 pusharray16(value->rf_band, NFAPI_MAX_NUM_RF_BANDS, value->number_rf_bands, ppWritePackedMsg, end));
+}
+static uint8_t unpack_rf_bands_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t* end)
+{
+	nfapi_rf_bands_t* value = (nfapi_rf_bands_t*)tlv;
+
+	return ( pull16(ppReadPackedMsg, &value->number_rf_bands, end) &&
+			 pullarray16(ppReadPackedMsg, value->rf_band, NFAPI_MAX_NUM_RF_BANDS, value->number_rf_bands, end));
+}
+
+static uint8_t pack_nmm_frequency_bands_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nmm_frequency_bands_t* value = (nfapi_nmm_frequency_bands_t*)tlv;
+	
+	return( push16(value->number_of_rf_bands, ppWritePackedMsg, end) &&
+			pusharray16(value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, ppWritePackedMsg, end));
+}
+static uint8_t unpack_nmm_frequency_bands_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nmm_frequency_bands_t* value = (nfapi_nmm_frequency_bands_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &value->number_of_rf_bands, end) &&
+			 pullarray16(ppReadPackedMsg, value->bands, NFAPI_MAX_NMM_FREQUENCY_BANDS, value->number_of_rf_bands, end));
+}
+
+static uint8_t pack_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_param_response_t *pNfapiMsg = (nfapi_param_response_t*)msg;
+
+	return( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
+			pack_tlv(NFAPI_L1_STATUS_PHY_STATE_TAG,  &pNfapiMsg->l1_status.phy_state, ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			// Do we check the phy state and then just fill those sepecified, however
+			// we do not know the duplex mode, so just attempt to pack all and assumme
+			// that the callee has set the right tlvs
+
+			pack_tlv(NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.dl_bandwidth_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) && 
+			pack_tlv(NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.ul_bandwidth_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.dl_modulation_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) && 
+			pack_tlv(NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG, &(pNfapiMsg->phy_capabilities.ul_modulation_support), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.phy_antenna_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.release_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG, &(pNfapiMsg->phy_capabilities.mbsfn_capability), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			// laa capability
+
+			pack_tlv(NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &(pNfapiMsg->subframe_config.duplex_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &(pNfapiMsg->subframe_config.pcfich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value)&&
+			pack_tlv(NFAPI_SUBFRAME_CONFIG_PB_TAG, &(pNfapiMsg->subframe_config.pb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.dl_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.ul_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.dl_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.ul_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &(pNfapiMsg->rf_config.reference_signal_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) && 
+			pack_tlv(NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.tx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.rx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &(pNfapiMsg->phich_config.phich_resource), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &(pNfapiMsg->phich_config.phich_duration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &(pNfapiMsg->phich_config.phich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &(pNfapiMsg->sch_config.physical_cell_id), ppWritePackedMsg, end ,&pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->prach_config.configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->prach_config.zero_correlation_zone_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &(pNfapiMsg->prach_config.high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->prach_config.frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &(pNfapiMsg->pusch_config.hopping_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &(pNfapiMsg->pusch_config.hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &(pNfapiMsg->pusch_config.number_of_subbands), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &(pNfapiMsg->pucch_config.delta_pucch_shift), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &(pNfapiMsg->pucch_config.n_cqi_rb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &(pNfapiMsg->pucch_config.n_an_cs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &(pNfapiMsg->pucch_config.n1_pucch_an), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.bandwidth_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &(pNfapiMsg->srs_config.max_up_pts), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.srs_subframe_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &(pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &(pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &(pNfapiMsg->uplink_reference_signal_config.group_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &(pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &(pNfapiMsg->tdd_frame_structure_config.subframe_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &(pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &(pNfapiMsg->l23_config.data_report_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_L23_CONFIG_SFNSF_TAG, &(pNfapiMsg->l23_config.sfnsf), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+			pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+
+			pack_tlv(NFAPI_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+			pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+
+			pack_tlv(NFAPI_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			pack_tlv(NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+			pack_tlv(NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+			pack_tlv(NFAPI_NFAPI_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) &&
+
+			pack_tlv(NFAPI_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+			pack_tlv(NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+			pack_tlv(NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+			pack_tlv(NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_NFAPI_EARFCN_TAG, &(pNfapiMsg->nfapi_config.earfcn), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+
+			pack_tlv(NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+			pack_tlv(NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_umts_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+			pack_tlv(NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_lte_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+			pack_tlv(NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &(pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+
+}
+
+static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_config_request_t *pNfapiMsg = (nfapi_config_request_t*)msg;
+
+	return ( push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) &&
+
+			 // Do we check the phy state and then just fill those sepecified, however
+			 // we do not know the duplex mode, so just attempt to pack all and assumme
+			 // that the callee has set the right tlvs
+
+			 pack_tlv(NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &(pNfapiMsg->subframe_config.duplex_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &(pNfapiMsg->subframe_config.pcfich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SUBFRAME_CONFIG_PB_TAG, &(pNfapiMsg->subframe_config.pb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.dl_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &(pNfapiMsg->subframe_config.ul_cyclic_prefix_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.dl_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &(pNfapiMsg->rf_config.ul_channel_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &(pNfapiMsg->rf_config.reference_signal_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.tx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &(pNfapiMsg->rf_config.rx_antenna_ports), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &(pNfapiMsg->phich_config.phich_resource), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &(pNfapiMsg->phich_config.phich_duration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &(pNfapiMsg->phich_config.phich_power_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &(pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &(pNfapiMsg->sch_config.physical_cell_id), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->prach_config.configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->prach_config.zero_correlation_zone_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &(pNfapiMsg->prach_config.high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->prach_config.frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &(pNfapiMsg->pusch_config.hopping_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &(pNfapiMsg->pusch_config.hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &(pNfapiMsg->pusch_config.number_of_subbands), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &(pNfapiMsg->pucch_config.delta_pucch_shift), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &(pNfapiMsg->pucch_config.n_cqi_rb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &(pNfapiMsg->pucch_config.n_an_cs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &(pNfapiMsg->pucch_config.n1_pucch_an), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.bandwidth_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &(pNfapiMsg->srs_config.max_up_pts), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &(pNfapiMsg->srs_config.srs_subframe_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &(pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &(pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &(pNfapiMsg->uplink_reference_signal_config.group_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &(pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG, &(pNfapiMsg->laa_config.ed_threshold_lbt_pdsch), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG, &(pNfapiMsg->laa_config.ed_threshold_lbt_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG, &(pNfapiMsg->laa_config.pd_threshold), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG, &(pNfapiMsg->laa_config.multi_carrier_type), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG, &(pNfapiMsg->laa_config.multi_carrier_tx), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG, &(pNfapiMsg->laa_config.multi_carrier_freeze), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG, &(pNfapiMsg->laa_config.tx_antenna_ports_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG, &(pNfapiMsg->laa_config.tx_power_drs), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG, &(pNfapiMsg->emtc_config.pbch_repetitions_enable_r13), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_catm_root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &(pNfapiMsg->emtc_config.prach_catm_zero_correlation_zone_configuration), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG, &(pNfapiMsg->emtc_config.prach_catm_high_speed_flag), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_starting_subframe_periodicity), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_0_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_starting_subframe_periodicity), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_1_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_starting_subframe_periodicity), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_2_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_configuration_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_frequency_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_starting_subframe_periodicity), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_hopping_enable), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG, &(pNfapiMsg->emtc_config.prach_ce_level_3_hopping_offset), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG, &(pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG, &(pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &(pNfapiMsg->tdd_frame_structure_config.subframe_assignment), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &(pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+			 pack_tlv(NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &(pNfapiMsg->l23_config.data_report_mode), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_L23_CONFIG_SFNSF_TAG, &(pNfapiMsg->l23_config.sfnsf), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+
+			 pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+			 pack_tlv(NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+			 pack_tlv(NFAPI_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) &&
+			 pack_tlv(NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) &&
+			 pack_tlv(NFAPI_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+			 pack_tlv(NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+			 pack_tlv(NFAPI_PHY_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) &&
+
+			 pack_tlv(NFAPI_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+			 pack_tlv(NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+			 pack_tlv(NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+			 pack_tlv(NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			 pack_tlv(NFAPI_NFAPI_EARFCN_TAG, &(pNfapiMsg->nfapi_config.earfcn), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+
+
+			 pack_tlv(NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+			 pack_tlv(NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_umts_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+			 pack_tlv(NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_lte_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) &&
+			 pack_tlv(NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &(pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
+
+			 pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t*)msg;
+
+	return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			 pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_start_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_start_request_t *pNfapiMsg = (nfapi_start_request_t*)msg;
+	return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_start_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_start_response_t *pNfapiMsg = (nfapi_start_response_t*)msg;
+
+	return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end ) &&
+			 pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_stop_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_stop_request_t *pNfapiMsg = (nfapi_stop_request_t*)msg;
+	return pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+}
+
+static uint8_t pack_stop_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t*)msg;
+
+	return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			 pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) );
+}
+
+static uint8_t pack_measurement_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t*)msg;
+
+	return( pack_tlv(NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &(pNfapiMsg->dl_rs_tx_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, &(pNfapiMsg->received_interference_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_tlv(NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &(pNfapiMsg->thermal_noise_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_recevied_interference_power_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_received_interference_power_measurement_t* value = (nfapi_received_interference_power_measurement_t*)tlv;
+	
+	return  ( push16(value->number_of_resource_blocks, ppWritePackedMsg, end) &&
+			  pusharrays16(value->received_interference_power, NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS, value->number_of_resource_blocks, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_measurement_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_measurement_response_t *pNfapiMsg = (nfapi_measurement_response_t*)msg;
+
+	return( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) &&
+			pack_tlv(NFAPI_MEASUREMENT_RESPONSE_DL_RS_POWER_MEASUREMENT_TAG, &(pNfapiMsg->dl_rs_tx_power_measurement), ppWritePackedMsg, end, &pack_int16_tlv_value) &&
+			pack_tlv(NFAPI_MEASUREMENT_RESPONSE_RECEIVED_INTERFERENCE_POWER_MEASUREMENT_TAG, &(pNfapiMsg->received_interference_power_measurement), ppWritePackedMsg, end, &pack_recevied_interference_power_measurement_value) &&
+			pack_tlv(NFAPI_MEASUREMENT_RESPONSE_THERMAL_NOISE_MEASUREMENT_TAG, &(pNfapiMsg->thermal_noise_power_measurement), ppWritePackedMsg, end, &pack_uint16_tlv_value) && 
+			pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	uint8_t result = 0;
+	// look for the specific message
+	switch (header->message_id)
+	{
+		case NFAPI_PNF_PARAM_REQUEST:
+			result = pack_pnf_param_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PNF_PARAM_RESPONSE:
+			result = pack_pnf_param_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PNF_CONFIG_REQUEST:
+			result = pack_pnf_config_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PNF_CONFIG_RESPONSE:
+			result = pack_pnf_config_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PNF_START_REQUEST:
+			result = pack_pnf_start_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PNF_START_RESPONSE:
+			result = pack_pnf_start_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PNF_STOP_REQUEST:
+			result = pack_pnf_stop_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PNF_STOP_RESPONSE:
+			result = pack_pnf_stop_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PARAM_REQUEST:
+			result = pack_param_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_PARAM_RESPONSE:
+			result = pack_param_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_CONFIG_REQUEST:
+			result = pack_config_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_CONFIG_RESPONSE:
+			result = pack_config_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_START_REQUEST:
+			result = pack_start_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_START_RESPONSE:
+			result = pack_start_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_STOP_REQUEST:
+			result = pack_stop_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_STOP_RESPONSE:
+			result = pack_stop_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_MEASUREMENT_REQUEST:
+			result = pack_measurement_request(header, ppWritePackedMsg, end, config);
+			break;
+
+		case NFAPI_MEASUREMENT_RESPONSE:
+			result = pack_measurement_response(header, ppWritePackedMsg, end, config);
+			break;
+
+		default:
+			{
+				if(header->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+				   header->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+				{
+					if(config && config->pack_p4_p5_vendor_extension)
+					{
+						result = (config->pack_p4_p5_vendor_extension)(header, ppWritePackedMsg, end, config);
+					}
+					else
+					{
+						NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, header->message_id);
+					}
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, header->message_id);
+				}
+			}
+			break;
+	}
+
+	return result;
+}
+
+
+// helper function for message length calculation -
+// takes the pointers to the start of message to end of message
+
+static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd)
+{
+	if (msgEnd < msgHead)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %d, %d\n", msgHead, msgEnd);
+		return 0;
+	}
+
+	return (msgEnd - msgHead);
+}
+
+// Main pack function - public
+
+int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
+	uint8_t *pWritePackedMessage = pPackedBuf;
+	uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
+	uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+	uint32_t packedMsgLen;
+	uint16_t packedMsgLen16;
+
+	if (pMessageBuf == NULL || pPackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Pack supplied pointers are null\n");
+		return -1;
+	}
+
+	// pack the message
+	if(push16(pMessageHeader->phy_id, &pWritePackedMessage, pPackMessageEnd) &&
+	   push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd) &&
+	   push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, pPackMessageEnd) &&
+	   push16(pMessageHeader->spare, &pWritePackedMessage, pPackMessageEnd) &&
+	   pack_p5_message_body(pMessageHeader, &pWritePackedMessage, pPackMessageEnd, config))
+	{
+		// check for a valid message length
+		packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pWritePackedMessage);
+		if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
+			return -1;
+		}
+		else
+		{
+			packedMsgLen16 = (uint16_t)packedMsgLen;
+		}
+
+		// Update the message length in the header
+		if(!push16(packedMsgLen16, &pPackedLengthField, pPackMessageEnd))
+			return -1;
+
+		// return the packed length
+		return (packedMsgLen);
+	}
+	else
+	{
+		// Failed to pack the meassage
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 Failed to pack message\n");
+		return -1;
+    }
+
+}
+
+
+
+// Unpack routines
+static uint8_t  unpack_pnf_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_param_request_t *pNfapiMsg = (nfapi_pnf_param_request_t*)msg;
+	
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+	
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_pnf_param_general_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_param_general_t* value = (nfapi_pnf_param_general_t*)tlv;
+	
+	return( pull8(ppReadPackedMsg, &value->nfapi_sync_mode, end) &&
+			pull8(ppReadPackedMsg, &value->location_mode, end) &&
+			pull16(ppReadPackedMsg, &value->location_coordinates_length, end) &&
+			pullarray8(ppReadPackedMsg, value->location_coordinates, NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH, value->location_coordinates_length, end) &&
+			pull32(ppReadPackedMsg, &value->dl_config_timing, end) &&
+			pull32(ppReadPackedMsg, &value->tx_timing, end) &&
+			pull32(ppReadPackedMsg, &value->ul_config_timing, end) &&
+			pull32(ppReadPackedMsg, &value->hi_dci0_timing, end) &&
+			pull16(ppReadPackedMsg, &value->maximum_number_phys, end) &&
+			pull16(ppReadPackedMsg, &value->maximum_total_bandwidth, end) &&
+			pull8(ppReadPackedMsg, &value->maximum_total_number_dl_layers, end) &&
+			pull8(ppReadPackedMsg, &value->maximum_total_number_ul_layers, end) &&
+			pull8(ppReadPackedMsg, &value->shared_bands, end) &&
+			pull8(ppReadPackedMsg, &value->shared_pa, end) &&
+			pulls16(ppReadPackedMsg, &value->maximum_total_power, end) &&
+			pullarray8(ppReadPackedMsg, value->oui, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH, end));
+}
+
+static uint8_t unpack_rf_config_info(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_rf_config_info_t* info = (nfapi_rf_config_info_t*)elem;
+	return pull16(ppReadPackedMsg, &info->rf_config_index, end);
+}
+
+static uint8_t unpack_pnf_phy_info(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_info_t* phy = (nfapi_pnf_phy_info_t*)elem;
+
+	return ( pull16(ppReadPackedMsg, &phy->phy_config_index, end) && 
+			 pull16(ppReadPackedMsg, &phy->number_of_rfs, end) &&
+			 unpackarray(ppReadPackedMsg, phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, end, &unpack_rf_config_info) &&
+			 pull16(ppReadPackedMsg, &phy->number_of_rf_exclusions, end) &&
+			 unpackarray(ppReadPackedMsg, phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, end, &unpack_rf_config_info) &&
+			 pull16(ppReadPackedMsg, &phy->downlink_channel_bandwidth_supported, end) &&
+			 pull16(ppReadPackedMsg, &phy->uplink_channel_bandwidth_supported, end) &&
+			 pull8(ppReadPackedMsg, &phy->number_of_dl_layers_supported, end) &&
+			 pull8(ppReadPackedMsg, &phy->number_of_ul_layers_supported, end) &&
+			 pull16(ppReadPackedMsg, &phy->maximum_3gpp_release_supported, end) &&
+			 pull8(ppReadPackedMsg, &phy->nmm_modes_supported, end));
+}
+
+
+static uint8_t unpack_pnf_phy_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_t* value = (nfapi_pnf_phy_t*)tlv;
+	return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) && 
+			 unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_info));
+}
+
+static uint8_t unpack_pnf_rf_info(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_rf_info_t* rf = (nfapi_pnf_rf_info_t*)elem;
+		
+	return( pull16(ppReadPackedMsg, &rf->rf_config_index, end) &&
+			pull16(ppReadPackedMsg, &rf->band, end) &&
+			pulls16(ppReadPackedMsg, &rf->maximum_transmit_power, end) &&
+			pulls16(ppReadPackedMsg, &rf->minimum_transmit_power, end) &&
+			pull8(ppReadPackedMsg, &rf->number_of_antennas_suppported, end) &&
+			pull32(ppReadPackedMsg, &rf->minimum_downlink_frequency, end) &&
+			pull32(ppReadPackedMsg, &rf->maximum_downlink_frequency, end) &&
+			pull32(ppReadPackedMsg, &rf->minimum_uplink_frequency, end) &&
+			pull32(ppReadPackedMsg, &rf->maximum_uplink_frequency, end));
+
+}
+static uint8_t unpack_pnf_rf_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_rf_t* value = (nfapi_pnf_rf_t*)tlv;
+
+	return ( pull16(ppReadPackedMsg, &value->number_of_rfs, end) &&
+		     unpackarray(ppReadPackedMsg, value->rf, sizeof(nfapi_pnf_rf_info_t), NFAPI_MAX_PNF_RF, value->number_of_rfs, end, &unpack_pnf_rf_info));
+}
+
+static uint8_t unpack_pnf_phy_rel10_info(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel10_info_t* phy = (nfapi_pnf_phy_rel10_info_t*)elem;
+		
+	return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+			pull16(ppReadPackedMsg, &phy->transmission_mode_7_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->transmission_mode_8_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->two_antenna_ports_for_pucch, end) &&
+			pull16(ppReadPackedMsg, &phy->transmission_mode_9_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->simultaneous_pucch_pusch, end) &&
+			pull16(ppReadPackedMsg, &phy->four_layer_tx_with_tm3_and_tm4, end));
+
+
+}
+static uint8_t unpack_pnf_phy_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel10_t* value = (nfapi_pnf_phy_rel10_t*)tlv;
+
+	return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+			 unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel10_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel10_info));
+
+}
+
+
+static uint8_t unpack_pnf_phy_rel11_info(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel11_info_t* phy = (nfapi_pnf_phy_rel11_info_t*)elem;
+
+	return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+			pull16(ppReadPackedMsg, &phy->edpcch_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->multi_ack_csi_reporting, end ) &&
+			pull16(ppReadPackedMsg, &phy->pucch_tx_diversity, end) &&
+			pull16(ppReadPackedMsg, &phy->ul_comp_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->transmission_mode_5_supported, end));
+}
+
+static uint8_t unpack_pnf_phy_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel11_t* value = (nfapi_pnf_phy_rel11_t*)tlv;
+
+	return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+			 unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel11_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel11_info));
+
+}
+
+static uint8_t unpack_phy_phy_rel12_info(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel12_info_t* phy = (nfapi_pnf_phy_rel12_info_t*)elem;
+
+	return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+			pull16(ppReadPackedMsg, &phy->csi_subframe_set, end) &&
+			pull16(ppReadPackedMsg, &phy->enhanced_4tx_codebook, end) &&
+			pull16(ppReadPackedMsg, &phy->drs_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->ul_64qam_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->transmission_mode_10_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->alternative_bts_indices, end));
+}
+
+static uint8_t unpack_pnf_phy_rel12_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel12_t* value = (nfapi_pnf_phy_rel12_t*)tlv;
+
+	return (pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+			unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel12_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_phy_phy_rel12_info));
+
+}
+
+static uint8_t unpack_pnf_phy_rel13_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel13_info_t* phy = (nfapi_pnf_phy_rel13_info_t*)elem;
+
+	return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+			pull16(ppReadPackedMsg, &phy->pucch_format4_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->pucch_format5_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->more_than_5_ca_support, end) &&
+			pull16(ppReadPackedMsg, &phy->laa_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->laa_ending_in_dwpts_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->laa_starting_in_second_slot_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->beamforming_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->csi_rs_enhancement_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->drms_enhancement_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->srs_enhancement_supported, end));
+}
+
+static uint8_t unpack_pnf_phy_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel13_t* value = (nfapi_pnf_phy_rel13_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+			 unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel13_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel13_info));
+}
+
+static uint8_t unpack_pnf_phy_rel13_nb_info_info(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel13_nb_iot_info_t* phy = (nfapi_pnf_phy_rel13_nb_iot_info_t*)elem;
+
+	return( pull16(ppReadPackedMsg, &phy->phy_config_index, end) &&
+			pull16(ppReadPackedMsg, &phy->number_of_rfs, end) &&
+			unpackarray(ppReadPackedMsg, phy->rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rfs, end, &unpack_rf_config_info) &&
+			pull16(ppReadPackedMsg, &phy->number_of_rf_exclusions, end) &&
+			unpackarray(ppReadPackedMsg, phy->excluded_rf_config, sizeof(nfapi_rf_config_info_t), NFAPI_MAX_PNF_PHY_RF_CONFIG, phy->number_of_rf_exclusions, end, &unpack_rf_config_info) &&
+			pull8(ppReadPackedMsg, &phy->number_of_dl_layers_supported, end) &&
+			pull8(ppReadPackedMsg, &phy->number_of_ul_layers_supported, end) &&
+			pull16(ppReadPackedMsg, &phy->maximum_3gpp_release_supported, end) &&
+			pull8(ppReadPackedMsg, &phy->nmm_modes_supported, end));
+}
+
+static uint8_t unpack_pnf_phy_rel13_nb_iot_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rel13_nb_iot_t* value = (nfapi_pnf_phy_rel13_nb_iot_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &value->number_of_phys, end) &&
+			 unpackarray(ppReadPackedMsg, value->phy, sizeof(nfapi_pnf_phy_rel13_nb_iot_info_t), NFAPI_MAX_PNF_PHY, value->number_of_phys, end, &unpack_pnf_phy_rel13_nb_info_info));
+}
+
+
+
+static uint8_t unpack_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_param_response_t *pNfapiMsg = (nfapi_pnf_param_response_t*)msg;
+	
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, &unpack_pnf_param_general_value},
+		{ NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, &unpack_pnf_phy_value},
+		{ NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, &unpack_pnf_rf_value},
+		{ NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, &unpack_pnf_phy_rel10_value},
+		{ NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, &unpack_pnf_phy_rel11_value},
+		{ NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, &unpack_pnf_phy_rel12_value},
+		{ NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, &unpack_pnf_phy_rel13_value},
+		{ NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, &unpack_pnf_phy_rel13_nb_iot_value},
+	};
+
+	return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_phy_rf_config_info(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_phy_rf_config_info_t* rf = (nfapi_phy_rf_config_info_t*)elem;
+		
+	return( pull16(ppReadPackedMsg, &rf->phy_id, end) &&
+			pull16(ppReadPackedMsg, &rf->phy_config_index, end) &&
+			pull16(ppReadPackedMsg, &rf->rf_config_index, end));
+
+}
+
+static uint8_t unpack_pnf_phy_rf_config_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_pnf_phy_rf_config_t* value = (nfapi_pnf_phy_rf_config_t*)tlv;
+
+	return ( pull16(ppReadPackedMsg, &value->number_phy_rf_config_info, end) &&
+			 unpackarray(ppReadPackedMsg, value->phy_rf_config, sizeof(nfapi_phy_rf_config_info_t), NFAPI_MAX_PHY_RF_INSTANCES, value->number_phy_rf_config_info, end, &unpack_phy_rf_config_info));
+}
+
+static uint8_t unpack_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_config_request_t *pNfapiMsg = (nfapi_pnf_config_request_t*)msg;
+	
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, &unpack_pnf_phy_rf_config_value},
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension);
+}
+
+static uint8_t unpack_pnf_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_config_response_t *pNfapiMsg = (nfapi_pnf_config_response_t*)msg;
+	
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+
+}
+
+static uint8_t unpack_pnf_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_start_request_t *pNfapiMsg = (nfapi_pnf_start_request_t*)msg;
+	
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_pnf_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_start_response_t *pNfapiMsg = (nfapi_pnf_start_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end ) &&
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_pnf_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_stop_request_t *pNfapiMsg = (nfapi_pnf_stop_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_pnf_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_pnf_stop_response_t *pNfapiMsg = (nfapi_pnf_stop_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+
+}
+
+static uint8_t unpack_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_param_request_t *pNfapiMsg = (nfapi_param_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_param_response_t *pNfapiMsg = (nfapi_param_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_L1_STATUS_PHY_STATE_TAG, &pNfapiMsg->l1_status.phy_state, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.dl_bandwidth_support, &unpack_uint16_tlv_value},
+		{ NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.ul_bandwidth_support, &unpack_uint16_tlv_value},
+		{ NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.dl_modulation_support, &unpack_uint16_tlv_value},
+		{ NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG, &pNfapiMsg->phy_capabilities.ul_modulation_support, &unpack_uint16_tlv_value},
+		{ NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.phy_antenna_capability, &unpack_uint16_tlv_value},
+		{ NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.release_capability, &unpack_uint16_tlv_value},
+		{ NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG, &pNfapiMsg->phy_capabilities.mbsfn_capability, &unpack_uint16_tlv_value},
+
+		{ NFAPI_LAA_CAPABILITY_LAA_SUPPORT_TAG, &pNfapiMsg->laa_capability.laa_support, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CAPABILITY_PD_SENSING_LBT_SUPPORT_TAG, &pNfapiMsg->laa_capability.pd_sensing_lbt_support, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CAPABILITY_MULTI_CARRIER_LBT_SUPPORT_TAG, &pNfapiMsg->laa_capability.multi_carrier_lbt_support, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CAPABILITY_PARTIAL_SF_SUPPORT_TAG, &pNfapiMsg->laa_capability.partial_sf_support, &unpack_uint16_tlv_value},
+
+		{ NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &pNfapiMsg->subframe_config.duplex_mode, &unpack_uint16_tlv_value},
+		{ NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &pNfapiMsg->subframe_config.pcfich_power_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_SUBFRAME_CONFIG_PB_TAG, &pNfapiMsg->subframe_config.pb, &unpack_uint16_tlv_value},
+		{ NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.dl_cyclic_prefix_type, &unpack_uint16_tlv_value},
+		{ NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.ul_cyclic_prefix_type, &unpack_uint16_tlv_value},
+
+		{ NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.dl_channel_bandwidth, &unpack_uint16_tlv_value},
+		{ NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.ul_channel_bandwidth, &unpack_uint16_tlv_value},
+		{ NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &pNfapiMsg->rf_config.reference_signal_power, &unpack_uint16_tlv_value},
+		{ NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.tx_antenna_ports, &unpack_uint16_tlv_value},
+		{ NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.rx_antenna_ports, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &pNfapiMsg->phich_config.phich_resource, &unpack_uint16_tlv_value},
+		{ NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &pNfapiMsg->phich_config.phich_duration, &unpack_uint16_tlv_value},
+		{ NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &pNfapiMsg->phich_config.phich_power_offset, &unpack_uint16_tlv_value},
+
+		{ NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
+		{ NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
+		{ NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &pNfapiMsg->sch_config.physical_cell_id, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &pNfapiMsg->prach_config.configuration_index, &unpack_uint16_tlv_value},
+		{ NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->prach_config.root_sequence_index, &unpack_uint16_tlv_value},
+		{ NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->prach_config.zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
+		{ NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &pNfapiMsg->prach_config.high_speed_flag, &unpack_uint16_tlv_value},
+		{ NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &pNfapiMsg->prach_config.frequency_offset, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &pNfapiMsg->pusch_config.hopping_mode, &unpack_uint16_tlv_value},
+		{ NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &pNfapiMsg->pusch_config.hopping_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &pNfapiMsg->pusch_config.number_of_subbands, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &pNfapiMsg->pucch_config.delta_pucch_shift, &unpack_uint16_tlv_value},
+		{ NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &pNfapiMsg->pucch_config.n_cqi_rb, &unpack_uint16_tlv_value},
+		{ NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &pNfapiMsg->pucch_config.n_an_cs, &unpack_uint16_tlv_value},
+		{ NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &pNfapiMsg->pucch_config.n1_pucch_an, &unpack_uint16_tlv_value},
+
+		{ NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &pNfapiMsg->srs_config.bandwidth_configuration, &unpack_uint16_tlv_value},
+		{ NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &pNfapiMsg->srs_config.max_up_pts, &unpack_uint16_tlv_value},
+		{ NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &pNfapiMsg->srs_config.srs_subframe_configuration, &unpack_uint16_tlv_value},
+		{ NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission, &unpack_uint16_tlv_value},
+
+		{ NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping, &unpack_uint16_tlv_value},
+		{ NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &pNfapiMsg->uplink_reference_signal_config.group_assignment, &unpack_uint16_tlv_value},
+		{ NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms, &unpack_uint16_tlv_value},
+
+		{ NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &pNfapiMsg->tdd_frame_structure_config.subframe_assignment, &unpack_uint16_tlv_value},
+		{ NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns, &unpack_uint16_tlv_value},
+
+		{ NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &pNfapiMsg->l23_config.data_report_mode, &unpack_uint16_tlv_value},
+		{ NFAPI_L23_CONFIG_SFNSF_TAG, &pNfapiMsg->l23_config.sfnsf, &unpack_uint16_tlv_value},
+
+		{ NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value},
+		{ NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value},
+		{ NFAPI_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value},
+		{ NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value},
+		{ NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value},
+		{ NFAPI_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value},
+		{ NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.dl_ue_per_sf, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.ul_ue_per_sf, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_RF_BANDS_TAG, &pNfapiMsg->nfapi_config.rf_bands, &unpack_rf_bands_value},
+		{ NFAPI_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &pNfapiMsg->nfapi_config.max_transmit_power, &unpack_uint16_tlv_value},
+		{ NFAPI_NFAPI_EARFCN_TAG, &pNfapiMsg->nfapi_config.earfcn, &unpack_uint16_tlv_value},
+		{ NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands, &unpack_nmm_frequency_bands_value},
+		{ NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_umts_frequency_bands, &unpack_nmm_frequency_bands_value},
+		{ NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_lte_frequency_bands, &unpack_nmm_frequency_bands_value},
+		{ NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported, &unpack_uint8_tlv_value},
+
+	};
+
+	return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			 pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+}
+
+static uint8_t unpack_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_config_request_t *pNfapiMsg = (nfapi_config_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, &pNfapiMsg->subframe_config.duplex_mode, &unpack_uint16_tlv_value},
+		{ NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, &pNfapiMsg->subframe_config.pcfich_power_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_SUBFRAME_CONFIG_PB_TAG, &pNfapiMsg->subframe_config.pb, &unpack_uint16_tlv_value},
+		{ NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.dl_cyclic_prefix_type, &unpack_uint16_tlv_value},
+		{ NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, &pNfapiMsg->subframe_config.ul_cyclic_prefix_type, &unpack_uint16_tlv_value},
+
+		{ NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.dl_channel_bandwidth, &unpack_uint16_tlv_value},
+		{ NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, &pNfapiMsg->rf_config.ul_channel_bandwidth, &unpack_uint16_tlv_value},
+		{ NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, &pNfapiMsg->rf_config.reference_signal_power, &unpack_uint16_tlv_value},
+		{ NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.tx_antenna_ports, &unpack_uint16_tlv_value},
+		{ NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, &pNfapiMsg->rf_config.rx_antenna_ports, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, &pNfapiMsg->phich_config.phich_resource, &unpack_uint16_tlv_value},
+		{ NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, &pNfapiMsg->phich_config.phich_duration, &unpack_uint16_tlv_value},
+		{ NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, &pNfapiMsg->phich_config.phich_power_offset, &unpack_uint16_tlv_value},
+
+		{ NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.primary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
+		{ NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, &pNfapiMsg->sch_config.secondary_synchronization_signal_epre_eprers, &unpack_uint16_tlv_value},
+		{ NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, &pNfapiMsg->sch_config.physical_cell_id, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, &pNfapiMsg->prach_config.configuration_index, &unpack_uint16_tlv_value},
+		{ NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->prach_config.root_sequence_index, &unpack_uint16_tlv_value},
+		{ NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->prach_config.zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
+		{ NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, &pNfapiMsg->prach_config.high_speed_flag, &unpack_uint16_tlv_value},
+		{ NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, &pNfapiMsg->prach_config.frequency_offset, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, &pNfapiMsg->pusch_config.hopping_mode, &unpack_uint16_tlv_value},
+		{ NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, &pNfapiMsg->pusch_config.hopping_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, &pNfapiMsg->pusch_config.number_of_subbands, &unpack_uint16_tlv_value},
+
+		{ NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, &pNfapiMsg->pucch_config.delta_pucch_shift, &unpack_uint16_tlv_value},
+		{ NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, &pNfapiMsg->pucch_config.n_cqi_rb, &unpack_uint16_tlv_value},
+		{ NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, &pNfapiMsg->pucch_config.n_an_cs, &unpack_uint16_tlv_value},
+		{ NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, &pNfapiMsg->pucch_config.n1_pucch_an, &unpack_uint16_tlv_value},
+
+		{ NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, &pNfapiMsg->srs_config.bandwidth_configuration, &unpack_uint16_tlv_value},
+		{ NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, &pNfapiMsg->srs_config.max_up_pts, &unpack_uint16_tlv_value},
+		{ NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, &pNfapiMsg->srs_config.srs_subframe_configuration, &unpack_uint16_tlv_value},
+		{ NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, &pNfapiMsg->srs_config.srs_acknack_srs_simultaneous_transmission, &unpack_uint16_tlv_value},
+
+		{ NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, &pNfapiMsg->uplink_reference_signal_config.uplink_rs_hopping, &unpack_uint16_tlv_value},
+		{ NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, &pNfapiMsg->uplink_reference_signal_config.group_assignment, &unpack_uint16_tlv_value},
+		{ NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, &pNfapiMsg->uplink_reference_signal_config.cyclic_shift_1_for_drms, &unpack_uint16_tlv_value},
+
+
+		{ NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG, &pNfapiMsg->laa_config.ed_threshold_lbt_pdsch, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG, &pNfapiMsg->laa_config.ed_threshold_lbt_drs, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG, &pNfapiMsg->laa_config.pd_threshold, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG, &pNfapiMsg->laa_config.multi_carrier_type, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG, &pNfapiMsg->laa_config.multi_carrier_tx, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG, &pNfapiMsg->laa_config.multi_carrier_freeze, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG, &pNfapiMsg->laa_config.tx_antenna_ports_drs, &unpack_uint16_tlv_value},
+		{ NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG, &pNfapiMsg->laa_config.tx_power_drs, &unpack_uint16_tlv_value},
+
+		{ NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG, &pNfapiMsg->emtc_config.pbch_repetitions_enable_r13, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG, &pNfapiMsg->emtc_config.prach_catm_root_sequence_index, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, &pNfapiMsg->emtc_config.prach_catm_zero_correlation_zone_configuration, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG, &pNfapiMsg->emtc_config.prach_catm_high_speed_flag, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_enable, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_configuration_index, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_frequency_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_starting_subframe_periodicity, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_hopping_enable, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_0_hopping_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_enable, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_configuration_index, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_frequency_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_starting_subframe_periodicity, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_hopping_enable, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_1_hopping_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_enable, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_configuration_index, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_frequency_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_starting_subframe_periodicity, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_hopping_enable, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_2_hopping_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_enable, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_configuration_index, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_frequency_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_starting_subframe_periodicity, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_hopping_enable, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG, &pNfapiMsg->emtc_config.prach_ce_level_3_hopping_offset, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG, &pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea, &unpack_uint16_tlv_value},
+		{ NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG, &pNfapiMsg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb, &unpack_uint16_tlv_value},
+
+		{ NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, &pNfapiMsg->tdd_frame_structure_config.subframe_assignment, &unpack_uint16_tlv_value},
+		{ NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, &pNfapiMsg->tdd_frame_structure_config.special_subframe_patterns, &unpack_uint16_tlv_value},
+
+		{ NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, &pNfapiMsg->l23_config.data_report_mode, &unpack_uint16_tlv_value},
+		{ NFAPI_L23_CONFIG_SFNSF_TAG, &pNfapiMsg->l23_config.sfnsf, &unpack_uint16_tlv_value},
+
+		{ NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value},
+		{ NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value},
+		{ NFAPI_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value},
+		{ NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value},
+		{ NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value},
+		{ NFAPI_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value},
+		{ NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.dl_ue_per_sf, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &pNfapiMsg->nfapi_config.ul_ue_per_sf, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_RF_BANDS_TAG, &pNfapiMsg->nfapi_config.rf_bands, &unpack_rf_bands_value},
+		{ NFAPI_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value},
+		{ NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &pNfapiMsg->nfapi_config.max_transmit_power, &unpack_uint16_tlv_value},
+		{ NFAPI_NFAPI_EARFCN_TAG, &pNfapiMsg->nfapi_config.earfcn, &unpack_uint16_tlv_value},
+		{ NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands, &unpack_nmm_frequency_bands_value},
+		{ NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_umts_frequency_bands, &unpack_nmm_frequency_bands_value},
+		{ NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &pNfapiMsg->nfapi_config.nmm_lte_frequency_bands, &unpack_nmm_frequency_bands_value},
+		{ NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported, &unpack_uint8_tlv_value},
+
+	};
+
+	return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
+		     unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+}
+
+static uint8_t unpack_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) && 
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+}
+
+static uint8_t unpack_start_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_start_request_t *pNfapiMsg = (nfapi_start_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_start_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_start_response_t *pNfapiMsg = (nfapi_start_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+
+}
+
+static uint8_t unpack_stop_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_stop_request_t *pNfapiMsg = (nfapi_stop_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_stop_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_stop_response_t *pNfapiMsg = (nfapi_stop_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+	};
+
+	return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
+
+}
+static uint8_t unpack_measurement_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_measurement_request_t *pNfapiMsg = (nfapi_measurement_request_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, &pNfapiMsg->dl_rs_tx_power, &unpack_uint16_tlv_value},
+		{ NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, &pNfapiMsg->received_interference_power, &unpack_uint16_tlv_value},
+		{ NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, &pNfapiMsg->thermal_noise_power, &unpack_uint16_tlv_value},
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
+
+}
+
+static uint8_t unpack_received_interference_power_measurement_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_received_interference_power_measurement_t* value = (nfapi_received_interference_power_measurement_t*)tlv;
+
+	return ( pull16(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
+			 pullarrays16(ppReadPackedMsg, value->received_interference_power,  NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS, value->number_of_resource_blocks, end)); 
+}
+
+
+static uint8_t unpack_measurement_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_measurement_response_t *pNfapiMsg = (nfapi_measurement_response_t*)msg;
+
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_MEASUREMENT_RESPONSE_DL_RS_POWER_MEASUREMENT_TAG, &pNfapiMsg->dl_rs_tx_power_measurement, &unpack_int16_tlv_value},
+		{ NFAPI_MEASUREMENT_RESPONSE_RECEIVED_INTERFERENCE_POWER_MEASUREMENT_TAG, &pNfapiMsg->received_interference_power_measurement, &unpack_received_interference_power_measurement_value},
+		{ NFAPI_MEASUREMENT_RESPONSE_THERMAL_NOISE_MEASUREMENT_TAG, &pNfapiMsg->thermal_noise_power_measurement, &unpack_int16_tlv_value},
+	};
+
+	return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
+			 unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+}
+
+// unpack length check
+
+static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
+{
+	int retLen = 0;
+
+	switch (msgId)
+	{
+		case NFAPI_PNF_PARAM_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_pnf_param_request_t))
+				retLen = sizeof(nfapi_pnf_param_request_t);
+			break;
+
+		case NFAPI_PNF_PARAM_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_pnf_param_response_t))
+				retLen = sizeof(nfapi_pnf_param_response_t);
+			break;
+
+		case NFAPI_PNF_CONFIG_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_pnf_config_request_t))
+				retLen = sizeof(nfapi_pnf_config_request_t);
+			break;
+
+		case NFAPI_PNF_CONFIG_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_pnf_config_response_t))
+				retLen = sizeof(nfapi_pnf_config_response_t);
+			break;
+
+		case NFAPI_PNF_START_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_pnf_start_request_t))
+				retLen = sizeof(nfapi_pnf_start_request_t);
+			break;
+
+		case NFAPI_PNF_START_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_pnf_start_response_t))
+				retLen = sizeof(nfapi_pnf_start_response_t);
+			break;
+
+		case NFAPI_PNF_STOP_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_pnf_stop_request_t))
+				retLen = sizeof(nfapi_pnf_stop_request_t);
+			break;
+
+		case NFAPI_PNF_STOP_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_pnf_stop_response_t))
+				retLen = sizeof(nfapi_pnf_stop_response_t);
+			break;
+
+		case NFAPI_PARAM_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_param_request_t))
+				retLen = sizeof(nfapi_param_request_t);
+			break;
+
+		case NFAPI_PARAM_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_param_response_t))
+				retLen = sizeof(nfapi_param_response_t);
+			break;
+
+		case NFAPI_CONFIG_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_config_request_t))
+				retLen = sizeof(nfapi_config_request_t);
+			break;
+
+		case NFAPI_CONFIG_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_config_response_t))
+				retLen = sizeof(nfapi_config_response_t);
+			break;
+
+		case NFAPI_START_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_start_request_t))
+				retLen = sizeof(nfapi_start_request_t);
+			break;
+
+		case NFAPI_START_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_start_response_t))
+				retLen = sizeof(nfapi_start_response_t);
+			break;
+
+		case NFAPI_STOP_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_stop_request_t))
+				retLen = sizeof(nfapi_stop_request_t);
+			break;
+
+		case NFAPI_STOP_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_stop_response_t))
+				retLen = sizeof(nfapi_stop_response_t);
+			break;
+
+		case NFAPI_MEASUREMENT_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_measurement_request_t))
+				retLen = sizeof(nfapi_measurement_request_t);
+			break;
+
+		case NFAPI_MEASUREMENT_RESPONSE:
+			if (unpackedBufLen >= sizeof(nfapi_measurement_response_t))
+				retLen = sizeof(nfapi_measurement_response_t);
+			break;
+
+		default:
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s Unknown message ID %d\n", __FUNCTION__, msgId);
+			break;
+	}
+
+	return retLen;
+}
+
+
+// Main unpack functions - public
+
+int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
+	uint8_t *pReadPackedMessage = pMessageBuf;
+	uint8_t *end = pMessageBuf + messageBufLen;
+
+	if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied pointers are null\n");
+		return -1;
+	}
+
+	if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+		return -1;
+	}
+
+	// process the header
+	return ( pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+			 pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+			 pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+			 pull16(&pReadPackedMessage, &pMessageHeader->spare, end) );
+
+}
+
+int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config)
+{
+	nfapi_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
+	uint8_t *pReadPackedMessage = pMessageBuf;
+	uint8_t *end = pMessageBuf + messageBufLen;
+
+	if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied pointers are null\n");
+		return -1;
+	}
+
+	if (messageBufLen < NFAPI_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p4_p5_message_header_t))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+		return -1;
+	}
+
+	// clean the supplied buffer for - tag value blanking
+	(void)memset(pUnpackedBuf, 0, unpackedBufLen);
+
+	// process the header
+	if( !(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end ) && 
+		  pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+		  pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+		  pull16(&pReadPackedMessage, &pMessageHeader->spare, end)))
+	{
+		// failed to read the header
+		return -1;
+	}
+
+	int result = -1;
+
+
+	if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
+	{
+		// the unpack buffer is not big enough for the struct 
+		return -1;
+	}
+
+	// look for the specific message
+	switch (pMessageHeader->message_id)
+	{
+		case NFAPI_PNF_PARAM_REQUEST:
+			result = unpack_pnf_param_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PNF_PARAM_RESPONSE:
+			result = unpack_pnf_param_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PNF_CONFIG_REQUEST:
+			result = unpack_pnf_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PNF_CONFIG_RESPONSE:
+			result = unpack_pnf_config_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PNF_START_REQUEST:
+			result = unpack_pnf_start_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PNF_START_RESPONSE:
+			result = unpack_pnf_start_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PNF_STOP_REQUEST:
+			result = unpack_pnf_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PNF_STOP_RESPONSE:
+			result = unpack_pnf_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PARAM_REQUEST:
+			result = unpack_param_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_PARAM_RESPONSE:
+			result = unpack_param_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_CONFIG_REQUEST:
+			result = unpack_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_CONFIG_RESPONSE:
+			result = unpack_config_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_START_REQUEST:
+			result = unpack_start_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_START_RESPONSE:
+			result = unpack_start_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_STOP_REQUEST:
+			result = unpack_stop_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_STOP_RESPONSE:
+			result = unpack_stop_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_MEASUREMENT_REQUEST:
+			result = unpack_measurement_request(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		case NFAPI_MEASUREMENT_RESPONSE:
+			result = unpack_measurement_response(&pReadPackedMessage, end, pMessageHeader, config);
+			break;
+
+		default:
+			if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && 
+			   pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+			{
+				if(config && config->unpack_p4_p5_vendor_extension)
+				{
+					result = (config->unpack_p4_p5_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+				}
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown P5 message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+			}
+			break;
+	}
+
+	return result;
+}
+
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
new file mode 100644
index 0000000000000000000000000000000000000000..3754fe379fef576b75d2ea026f1a4c35007bd807
--- /dev/null
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
@@ -0,0 +1,6185 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <assert.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <zlib.h>
+#include <sched.h>
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdint.h>
+
+#include <nfapi_interface.h>
+#include <nfapi.h>
+#include <debug.h>
+
+extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
+extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
+
+uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len)
+{
+	uint32_t chksum = 0;
+	// calcaulte upto the checksum
+	chksum = crc32(chksum, buffer, 8);
+	
+	// skip the checksum
+	uint8_t zeros[4] = {0, 0, 0, 0};
+	chksum = crc32(chksum, zeros, 4);
+	
+	// continu with the rest of the mesage
+	chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH);
+	
+	// return the inverse
+	return ~(chksum);
+}
+
+int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len)
+{
+	uint32_t checksum = nfapi_calculate_checksum(buffer, len);
+
+	uint8_t* p_write = &buffer[8];
+	return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1);
+}
+
+int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp)
+{
+	uint8_t* p_write = &buffer[12];
+	return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1);
+}
+
+uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len)
+{
+	return nfapi_calculate_checksum(buffer, len);
+}
+
+void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
+{
+	if(size == 0)
+		return 0;
+
+	if(config && config->allocate)
+	{
+		return (config->allocate)(size);
+	}
+	else
+	{
+		return calloc(1, size);
+	}
+}
+
+void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config)
+{
+	if(ptr == NULL)
+		return;
+
+	if(config && config->deallocate)
+	{
+		return (config->deallocate)(ptr);
+	}
+	else
+	{
+		return free(ptr);
+	}
+}
+// Pack routines
+
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
+	
+        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format);
+
+	return ( push8(value->dci_format, ppWritePackedMsg, end) &&
+			 push8(value->cce_idx, ppWritePackedMsg, end) &&
+			 push8(value->aggregation_level, ppWritePackedMsg, end) &&
+			 push16(value->rnti, ppWritePackedMsg, end) &&
+			 push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+			 push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+			 push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+			 push8(value->mcs_1, ppWritePackedMsg, end) &&
+			 push8(value->redundancy_version_1, ppWritePackedMsg, end) &&
+			 push8(value->new_data_indicator_1, ppWritePackedMsg, end) &&
+			 push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+			 push8(value->mcs_2, ppWritePackedMsg, end) &&
+			 push8(value->redundancy_version_2, ppWritePackedMsg, end) &&
+			 push8(value->new_data_indicator_2, ppWritePackedMsg, end) &&
+			 push8(value->harq_process, ppWritePackedMsg, end) &&
+			 push8(value->tpmi, ppWritePackedMsg, end) &&
+			 push8(value->pmi, ppWritePackedMsg, end) &&
+			 push8(value->precoding_information, ppWritePackedMsg, end) &&
+			 push8(value->tpc, ppWritePackedMsg, end) &&
+			 push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
+			 push8(value->ngap, ppWritePackedMsg, end) &&
+			 push8(value->transport_block_size_index, ppWritePackedMsg, end) &&
+			 push8(value->downlink_power_offset, ppWritePackedMsg, end) &&
+			 push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
+			 push8(value->preamble_index, ppWritePackedMsg, end) &&
+			 push8(value->prach_mask_index, ppWritePackedMsg, end) &&
+			 push8(value->rnti_type, ppWritePackedMsg, end) &&
+			 push16(value->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
+
+	return( push8(value->mcch_flag, ppWritePackedMsg, end) &&
+			push8(value->mcch_change_notification, ppWritePackedMsg, end) &&
+			push8(value->scrambling_identity, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
+	
+	return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
+			 push8(value->carrier_indicator, ppWritePackedMsg, end) &&
+			 push8(value->srs_flag, ppWritePackedMsg, end) &&
+			 push8(value->srs_request, ppWritePackedMsg, end) &&
+			 push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) &&
+			 push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && 
+			 push8(value->n_dl_rb, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
+	
+	return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) &&
+		 	 push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
+	
+	return ( push8(value->primary_cell_type, ppWritePackedMsg, end) &&
+			 push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) &&
+			 push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) &&
+			 pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
+	       push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+	       push8(value->num_antennas, ppWritePackedMsg, end)))
+		return 0;
+	
+	uint8_t idx = 0;
+	for(idx = 0; idx < value->number_of_subbands; ++idx)
+	{
+		nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
+		
+		if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) &&
+			 push8(subband_info->scheduled_ues, ppWritePackedMsg, end)))
+			return 0;	
+		
+
+		uint8_t antenna_idx = 0;
+		uint8_t scheduled_ue_idx = 0;
+		
+		for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
+		{
+			for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
+			{
+				if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end))
+					return 0;
+			}
+		}
+
+	}
+	
+	
+	return 1;			
+	
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
+
+	return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) &&
+			push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) &&
+			push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
+			push8(value->codebook_size_determination, ppWritePackedMsg, end) &&
+			push8(value->drms_table_flag, ppWritePackedMsg, end) &&
+			push8(value->tpm_struct_flag, ppWritePackedMsg, end) &&
+			(value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1));
+}
+
+static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
+	
+        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__);
+
+	return( push16(value->length, ppWritePackedMsg, end) &&
+			push16(value->pdu_index, ppWritePackedMsg, end) &&
+			push16(value->transmission_power, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
+
+	return ( push16(value->length, ppWritePackedMsg, end) &&
+			 push16(value->pdu_index, ppWritePackedMsg, end) &&
+			 push16(value->rnti, ppWritePackedMsg, end) &&
+			 push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+			 push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+			 push8(value->modulation, ppWritePackedMsg, end) &&
+			 push16(value->transmission_power, ppWritePackedMsg, end) &&
+			 push16(value->mbsfn_area_id, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem;
+
+	return ( push8(bf->subband_index, ppWritePackedMsg, end) &&
+			 push8(bf->num_antennas, ppWritePackedMsg, end) &&
+			 pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end));
+
+	
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
+
+	return ( push16(value->length, ppWritePackedMsg, end) && 
+			 push16(value->pdu_index, ppWritePackedMsg, end) &&
+			 push16(value->rnti, ppWritePackedMsg, end) &&
+			 push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+			 push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+			 push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+			 push8(value->modulation, ppWritePackedMsg, end) &&
+			 push8(value->redundancy_version, ppWritePackedMsg, end) &&
+			 push8(value->transport_blocks, ppWritePackedMsg, end) &&
+			 push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+			 push8(value->transmission_scheme, ppWritePackedMsg, end) &&
+			 push8(value->number_of_layers, ppWritePackedMsg, end) &&
+			 push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+			 pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) &&
+			 push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
+			 push8(value->pa, ppWritePackedMsg, end) &&
+			 push8(value->delta_power_offset_index, ppWritePackedMsg, end) &&
+			 push8(value->ngap, ppWritePackedMsg, end) &&
+			 push8(value->nprb, ppWritePackedMsg, end) &&
+			 push8(value->transmission_mode, ppWritePackedMsg, end) &&
+			 push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) &&
+			 push8(value->num_bf_vector, ppWritePackedMsg, end) &&
+			 packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info));
+
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
+	return ( push8(value->nscid, ppWritePackedMsg, end) );
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
+	
+	return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) &&
+			 push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
+			 push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
+			 push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
+			 pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
+			 push8(value->pdsch_start, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
+	
+	return( push8(value->drms_config_flag, ppWritePackedMsg, end) &&
+			push16(value->drms_scrambling, ppWritePackedMsg, end) &&
+			push8(value->csi_config_flag, ppWritePackedMsg, end) &&
+			push16(value->csi_scrambling, ppWritePackedMsg, end) &&
+			push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) &&
+			push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) &&
+			push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
+
+	return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) &&
+			push8(value->maxlayers, ppWritePackedMsg, end) &&
+			push8(value->n_dl_harq, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
+	
+	return( push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
+			push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
+			push8(value->ue_type, ppWritePackedMsg, end) &&
+			push8(value->pdsch_payload_type, ppWritePackedMsg, end) &&
+			push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+			push8(value->drms_table_flag, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
+	
+	return( push16(value->length, ppWritePackedMsg, end) &&
+			push16(value->pdu_index, ppWritePackedMsg, end) &&
+			push16(value->p_rnti, ppWritePackedMsg, end) &&
+			push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+			push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+			push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+			push8(value->mcs, ppWritePackedMsg, end) &&
+			push8(value->redundancy_version, ppWritePackedMsg, end) &&
+			push8(value->number_of_transport_blocks, ppWritePackedMsg, end) &&
+			push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+			push8(value->transmission_scheme, ppWritePackedMsg, end) &&
+			push8(value->number_of_layers, ppWritePackedMsg, end) &&
+			push8(value->codebook_index, ppWritePackedMsg, end) &&
+			push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
+			push8(value->pa, ppWritePackedMsg, end) &&
+			push16(value->transmission_power, ppWritePackedMsg, end) &&
+			push8(value->nprb, ppWritePackedMsg, end) &&
+			push8(value->ngap, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
+
+	return ( push8(value->ue_mode, ppWritePackedMsg, end) &&
+		 	 push16(value->initial_transmission_sf_io, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
+
+	return( push16(value->transmission_power, ppWritePackedMsg, end) &&
+			push8(value->prs_bandwidth, ppWritePackedMsg, end) &&
+			push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) &&
+			push8(value->prs_muting, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
+
+	return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) &&
+			push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
+			push16(value->transmission_power, ppWritePackedMsg, end) &&
+			push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
+			push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) &&
+			pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
+
+	if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) &&
+		 	 push8(value->cdm_type, ppWritePackedMsg, end) &&
+		 	 push8(value->num_bf_vector, ppWritePackedMsg, end)))
+	{
+		return 0;
+	}
+
+	uint16_t i; 
+	for(i = 0; i < value->num_bf_vector; ++i)
+	{
+		if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) &&
+		     pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end)))
+			return 0;
+	}
+
+	return 1;
+}
+static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( push8(vector->subband_index, ppWritePackedMsg, end) &&
+			 push8(vector->num_antennas, ppWritePackedMsg, end) &&
+		 	 pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
+
+	return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) &&
+			push16(value->epdcch_id, ppWritePackedMsg, end) &&
+			push8(value->epdcch_start_symbol, ppWritePackedMsg, end) &&
+			push8(value->epdcch_num_prb, ppWritePackedMsg, end) &&
+			pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) &&
+			pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
+	
+	return (push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
+		 	push8(value->initial_lbt_sf, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
+	
+	return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) &&
+			 push8(value->number_of_prb_pairs, ppWritePackedMsg, end) &&
+			 push8(value->resource_block_assignment, ppWritePackedMsg, end) &&
+			 push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) &&
+			 push8(value->start_symbol, ppWritePackedMsg, end) &&
+			 push8(value->ecce_index, ppWritePackedMsg, end) &&
+			 push8(value->aggregation_level, ppWritePackedMsg, end) &&
+			 push8(value->rnti_type, ppWritePackedMsg, end) &&
+			 push16(value->rnti, ppWritePackedMsg, end) &&
+			 push8(value->ce_mode, ppWritePackedMsg, end) &&
+			 push16(value->drms_scrambling_init, ppWritePackedMsg, end) &&
+			 push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+			 push16(value->transmission_power, ppWritePackedMsg, end) &&
+			 push8(value->dci_format, ppWritePackedMsg, end) &&
+			 push16(value->resource_block_coding, ppWritePackedMsg, end) &&
+			 push8(value->mcs, ppWritePackedMsg, end) &&
+			 push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) &&
+			 push8(value->redundancy_version, ppWritePackedMsg, end) &&
+			 push8(value->new_data_indicator, ppWritePackedMsg, end) &&
+			 push8(value->harq_process, ppWritePackedMsg, end) &&
+			 push8(value->tpmi_length, ppWritePackedMsg, end) &&
+			 push8(value->tpmi, ppWritePackedMsg, end) &&
+			 push8(value->pmi_flag, ppWritePackedMsg, end) &&
+			 push8(value->pmi, ppWritePackedMsg, end) &&
+			 push8(value->harq_resource_offset, ppWritePackedMsg, end) &&
+			 push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+			 push8(value->tpc, ppWritePackedMsg, end) &&
+			 push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) &&
+			 push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
+			 push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
+			 push8(value->preamble_index, ppWritePackedMsg, end) &&
+			 push8(value->prach_mask_index, ppWritePackedMsg, end) &&
+			 push8(value->starting_ce_level, ppWritePackedMsg, end) &&
+			 push8(value->srs_request, ppWritePackedMsg, end) &&
+			 push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) &&
+			 push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) &&
+			 push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+			 push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) &&
+			 push8(value->direct_indication, ppWritePackedMsg, end) &&
+			 push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
+			 push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
+			 pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
+	
+	return (push16(value->length, ppWritePackedMsg, end) &&
+		 	push16(value->pdu_index, ppWritePackedMsg, end) &&
+		 	push16(value->transmission_power, ppWritePackedMsg, end) &&
+		 	push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
+	
+	return (push16(value->length, ppWritePackedMsg, end) &&
+			push16(value->pdu_index, ppWritePackedMsg, end) &&
+			push8(value->ncce_index, ppWritePackedMsg, end) &&
+			push8(value->aggregation_level, ppWritePackedMsg, end) &&
+			push8(value->start_symbol, ppWritePackedMsg, end) &&
+			push8(value->rnti_type, ppWritePackedMsg, end) &&
+			push16(value->rnti, ppWritePackedMsg, end) &&
+			push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
+			push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
+			push8(value->dci_format, ppWritePackedMsg, end) &&
+			push8(value->scheduling_delay, ppWritePackedMsg, end) &&
+			push8(value->resource_assignment, ppWritePackedMsg, end) &&
+			push8(value->repetition_number, ppWritePackedMsg, end) &&
+			push8(value->mcs, ppWritePackedMsg, end) &&
+			push8(value->new_data_indicator, ppWritePackedMsg, end) &&
+			push8(value->harq_ack_resource, ppWritePackedMsg, end) &&
+			push8(value->npdcch_order_indication, ppWritePackedMsg, end) &&
+			push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) &&
+			push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) &&
+			push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) &&
+			push8(value->direct_indication, ppWritePackedMsg, end) &&
+			push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+			push8(value->total_dci_length_including_padding, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
+	
+	return (push16(value->length, ppWritePackedMsg, end) &&
+			push16(value->pdu_index, ppWritePackedMsg, end) &&
+			push8(value->start_symbol, ppWritePackedMsg, end) &&
+			push8(value->rnti_type, ppWritePackedMsg, end) &&
+			push16(value->rnti, ppWritePackedMsg, end) &&
+			push16(value->resource_assignment, ppWritePackedMsg, end) &&
+			push16(value->repetition_number, ppWritePackedMsg, end) &&
+			push8(value->modulation, ppWritePackedMsg, end) &&
+			push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) &&
+			push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
+			push16(value->sf_idx, ppWritePackedMsg, end) &&
+			push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
+
+        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich);
+
+	if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) &&
+		 push8(value->number_dci, ppWritePackedMsg, end) &&
+		 push16(value->number_pdu, ppWritePackedMsg, end) &&
+		 push8(value->number_pdsch_rnti, ppWritePackedMsg, end) &&
+		 push16(value->transmission_power_pcfich, ppWritePackedMsg, end)))
+	{
+		return 0;
+	}
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_pdu;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
+
+		if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		// Put a 0 size in and then determine the size after the pdu 
+		// has been writen and write the calculated size
+		uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+		pdu->pdu_size = 0;
+		if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
+				{
+                                  //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__);
+
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value)))
+					{
+						return 0;
+					}
+				}
+				break;
+			case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
+				{
+                                  //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__);
+
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) &&
+					pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end,  &pack_dl_config_csi_rs_pdu_rel10_value) &&
+						 pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end,  &pack_dl_config_csi_rs_pdu_rel13_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
+						 pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
+						 pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
+						 pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
+						 pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
+						 pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) &&
+						 pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) &
+						 pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value)))
+						return 0;
+				}
+				break;
+			default:
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+				}
+				break;
+		};
+
+		// add 1 for the pdu_type. The delta will include the pdu_size
+		pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+		push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+	}
+
+	return 1;
+}
+
+static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
+	
+	//return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
+			 //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+        { 
+          uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+          uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value);
+          uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+          if (!x || !y || !z)
+          {
+            NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z);
+          }
+
+          return x && y && z;
+        }
+}
+
+static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end)
+{
+	nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
+	
+	return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) &&
+			push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) &&
+			push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
+	
+	return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
+			push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
+	
+	return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
+			push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) &&
+			push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
+
+	return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) &&
+			push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
+			push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+			push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+			push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) &&
+			pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) &&
+			pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) &&
+			pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
+
+	return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) &&
+			 push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) &&
+			 push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) &&
+			 push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) &&
+			 push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
+
+	if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) &&
+		 push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) &&
+		 push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end)))
+	{
+		return 0;
+	}
+
+	switch(cqi_ri_info_rel9->report_type)
+	{
+		case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+			{
+				if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) &&
+					 push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end)))
+				{
+					return 0;
+				}
+			}
+			break;
+		case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+			{
+				if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0)
+					return 0;
+
+				uint8_t i;
+				for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
+				{
+					if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0)
+						return 0;
+
+                                        uint8_t j;
+                                        for(j = 0; j < 8; ++j)
+					{
+                                              if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0)
+							return 0;
+					}
+				}
+			}
+			break;
+		default:
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
+			}
+			break;
+	};
+
+	return 1;
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
+
+	switch(cqi_ri_info_rel13->report_type)
+	{
+		case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+			{
+				if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0)
+					return 0;
+			}
+			break;
+		case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+			{
+				// No parameters
+			}
+			break;
+		default:
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type );
+			}
+			break;
+	};
+
+	return 1;
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) &&
+			pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) &&
+			pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
+	
+	return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) &&
+		 	push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value);
+}
+
+static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
+	
+	return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) &&
+			push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) &&
+			push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
+	
+	return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
+		 	push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) &&
+			 pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
+	
+	return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) &&
+		 	 push16(ue_info_rel8->rnti, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
+
+	return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
+		 	 push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
+
+	return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) &&
+			 push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) &&
+			 push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
+			 push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) &&
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) &&
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
+
+	return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) &&
+			push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) &&
+			push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
+			push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+			push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) &&
+			push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) &&
+			push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
+
+	return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+			push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
+	
+	return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) &&
+			push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) &&
+			push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
+			push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+			push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) &&
+			push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) &&
+			push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
+	
+	return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) &&
+			push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) &&
+			push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) &&
+			push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) &&
+			push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
+	
+	return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
+			push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) &&
+			push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) &&
+			push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) &&
+			push8(harq_info_rel13->n_srs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) &&
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) &&
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) &&
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) &&
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
+
+	return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) &&
+			 push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
+	
+	return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) &&
+			 push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
+	
+	return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) &&
+			push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) &&
+			push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) &&
+			push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) &&
+			push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) &&
+			push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) && 
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) &&
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
+	return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end);
+}
+static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
+
+	return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) &&
+		 	 push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) &&
+	pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value));
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
+	
+	return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) &&
+			push16(srs_pdu_rel8->size, ppWritePackedMsg, end) &&
+			push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+			push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) &&
+			push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) &&
+			push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) &&
+			push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) &&
+			push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) &&
+			push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
+	return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end);
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
+	
+	return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
+	
+	return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
+	
+	return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) &&
+		    push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) &&
+		    push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) &&
+		    push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+		    push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
+		    push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
+		    push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+		    push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
+		    push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+		    push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
+		    push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) &&
+		    push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
+		    push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) && 
+		    pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) &&
+		    pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value));
+}
+static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
+	
+	return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) &&
+			 push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) &&
+			 push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end));
+	
+}
+
+static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
+
+	if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) &&
+	 	 push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) &&
+		 push8(value->srs_present, ppWritePackedMsg, end)))
+		return 0;
+
+	uint16_t i = 0;
+	for(i = 0; i < value->number_of_pdus; ++i)
+	{
+		nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
+
+		if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		// Put a 0 size in and then determine the size after the pdu 
+		// has been writen and write the calculated size
+		uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+		pdu->pdu_size = 0;
+		if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
+				{
+					if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+	 					 pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) &&
+						 pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) &&
+						 pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
+				{
+					if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) &&
+						 pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value)))	
+						return 0;
+				}
+				break;
+			case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value)))
+						return 0;
+				}
+				break;				
+			default:
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+				}
+				break;
+		};
+
+		// add 1 for the pdu_type. The delta will include the pdu_size
+		pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+		push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+		
+	}
+	return 1;
+}
+
+static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ;
+}
+
+static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
+	
+	return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+			 push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+			 push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) &&
+			 push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) &&
+			 push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
+	
+	return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) &&
+			 push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
+	
+	return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) &&
+			 push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) &&
+			 push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) &&
+			 push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
+	
+	return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
+			 push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
+	
+	return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) &&
+			 push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
+	
+	return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) &&
+			 push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) &&
+			 push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) &&
+			 push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+			 push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+			 push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) &&
+			 push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
+			 pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end));
+	
+}
+
+static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
+	
+	return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
+			 push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) &&
+			 push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
+
+	if(!(push16(value->sfnsf, ppWritePackedMsg, end) &&
+		 push8(value->number_of_dci, ppWritePackedMsg, end) &&
+		 push8(value->number_of_hi, ppWritePackedMsg, end)))
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi;
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
+
+		if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		// Put a 0 size in and then determine the size after the pdu 
+		// has been writen and write the calculated size
+		uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+		pdu->pdu_size = 0;
+		if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_HI_DCI0_HI_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) &&
+						 pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_HI_DCI0_DCI_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
+						 pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
+						 pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
+						 pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
+						 pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value)))
+						return 0;
+				}
+				break;
+			case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
+				{
+					if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value)))
+						return 0;
+				}
+				break;				
+			default:
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+				}
+				break;
+		};
+
+		// add 1 for the pdu_type. The delta will include the pdu_size
+		pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+		push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+		
+	}
+
+	return 1;
+}
+
+static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv;
+	
+	if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_pdus;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]);
+				
+		if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) &&
+			 push16(pdu->pdu_index, ppWritePackedMsg, end)))
+			return 0;
+
+		uint8_t j;
+		for(j = 0; j < pdu->num_segments; ++j)
+		{
+			// Use -1 as it is unbounded 
+			// DJP - does not handle -1
+                        // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
+			int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
+                        
+                        if (0 && pdu->segments[j].segment_length == 3)
+                        {
+                          NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, 
+                          pdu->segments[j].segment_data[0], 
+                          pdu->segments[j].segment_data[1], 
+                          pdu->segments[j].segment_data[2]
+                          );
+                        }
+                        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret);
+
+                        if (push_ret == 0)
+			{
+				return 0;
+			}
+		}
+	}
+
+	return 1;
+}
+
+static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
+	
+	int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+        int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value);
+        int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z);
+
+        return x && y && z;
+}
+
+static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
+	
+	return ( push32(value->handle, ppWritePackedMsg, end) &&
+			 push16(value->rnti, ppWritePackedMsg, end) );
+}
+
+static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
+	
+	return ( pull32(ppReadPackedMsg, &value->handle, end) &&
+			 pull16(ppReadPackedMsg, &value->rnti, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( push8(data->value_0, ppWritePackedMsg, end) &&
+			 push8(data->value_1, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( push8(data->value_0, ppWritePackedMsg, end) &&
+			 push8(data->value_1, ppWritePackedMsg, end) &&
+			 push8(data->value_2, ppWritePackedMsg, end) &&
+			 push8(data->value_3, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( push8(data->value_0, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	return ( push8(data->value_0, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv;
+	
+	if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) &&
+		 push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end)))
+			return 0;
+
+	uint8_t result = 0;
+	switch(harq_indication_tdd_rel8->mode)
+	{
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+			result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end);
+			break;
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+			result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end);
+			break;
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+			result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end);
+			break;
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+			result = 1;
+			break;			
+		default:
+			// err....
+			break;
+	}
+
+	return result;
+	
+}
+
+static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv;
+	
+	if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) &&
+		 push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)))
+		return 0;
+
+	uint8_t idx; 
+	for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx)
+	{
+		uint8_t result = 0;
+
+		switch(harq_indication_tdd_rel9->mode)
+		{
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+				result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+				result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end);
+				break;
+			default:
+				// err....
+				break;
+		}
+
+		if(result == 0)
+			return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv;
+	
+	if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) &&
+		 push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)))
+		return 0;
+
+	uint8_t idx; 
+	for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx)
+	{
+		uint8_t result = 0;
+		switch(harq_indication_tdd_rel13->mode)
+		{
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+				result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
+				result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end);
+				break;
+			default:
+				// err....
+				break;
+		}
+
+		if(result == 0)
+			return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv;
+	
+	return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) &&
+			 push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv;
+	
+	return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) &&
+			 push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) &&
+			 pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv;
+	
+	return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) &&
+			 push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) &&
+			 pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
+	
+	return ( push8(value->ul_cqi, ppWritePackedMsg, end) &&
+			 push8(value->channel, ppWritePackedMsg, end));
+
+}
+
+static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
+	
+	if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_harqs;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
+
+		uint8_t* instance_length_p = *ppWritePackedMsg;
+		if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+			return 0;
+
+		if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+			 pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) &&
+			 pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) &&
+			 pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) &&
+			 pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) &&
+			 pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) &&
+			 pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) &&
+			 pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+			return 0;
+
+		// calculate the instance length subtracting the size of the instance
+		// length feild
+		uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+		push16(instance_length, &instance_length_p, end);
+	}
+
+	return 1;
+}
+
+static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
+	
+	return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
+	
+	if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_crcs;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
+		
+		uint8_t* instance_length_p = *ppWritePackedMsg;
+		if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+			return 0;
+		
+		if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+			 pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body)))
+			return 0;
+
+		// calculate the instance length subtracting the size of the instance
+		// length feild
+		uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+		push16(instance_length, &instance_length_p, end);
+	}
+	return 1;
+}
+
+static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
+	
+	return ( push16(value->length, ppWritePackedMsg, end) &&
+			 push16(value->offset, ppWritePackedMsg, end) &&
+			 push8(value->ul_cqi, ppWritePackedMsg, end) &&
+			 push16(value->timing_advance, ppWritePackedMsg, end));
+}
+static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
+	
+	return ( push16(value->timing_advance_r9, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
+
+        //printf("RX ULSCH BODY\n");
+
+	if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	// need to calculate the data offset's. 
+	uint16_t i = 0;
+	uint16_t offset = 2; // taking into account the number_of_pdus
+	uint16_t total_number_of_pdus = value->number_of_pdus;
+        //printf("ULSCH:pdus:%d\n", total_number_of_pdus);
+
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+		if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
+		{
+                  //printf("NFAPI_RX_UE_INFORMATION_TAG\n");
+			offset += 4 + 6; 
+		}
+				
+		if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+		{
+                  //printf("NFAPI_RX_INDICATION_REL8_TAG\n");
+			offset += 4 + 7;
+		}
+
+		if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG)
+		{
+                  //printf("NFAPI_RX_INDICATION_REL9_TAG\n");
+			offset += 4 + 2;
+		}
+	}
+
+	// Now update the structure to include the offset
+	for(i =0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+				
+		if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+		{
+			if(pdu->rx_indication_rel8.offset == 1)
+			{
+				pdu->rx_indication_rel8.offset = offset;
+				offset += pdu->rx_indication_rel8.length;
+			}
+		}
+	}
+	
+	// Write out the pdu
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+		if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+			 pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) &&
+			 pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value)))
+			return 0;
+	}
+
+	// Write out the pdu data
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		uint16_t length = 0;
+		nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+
+		if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+		{
+			length = pdu->rx_indication_rel8.length;
+		}
+
+		if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0)
+			return 0;
+	}
+	return 1;
+}
+
+
+static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
+	
+	return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) &&
+			 push8(preamble_rel8->preamble, ppWritePackedMsg, end) &&
+			 push16(preamble_rel8->timing_advance, ppWritePackedMsg, end));
+}
+static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
+	
+	return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) );
+}
+static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
+	
+	return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
+	
+	if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_preambles;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
+		
+		uint8_t* instance_length_p = *ppWritePackedMsg;
+		if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+			return 0;
+		
+		if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) &&
+			 pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) &&
+			 pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value)))
+			return 0;
+
+		// calculate the instance length subtracting the size of the instance
+		// length feild
+		uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+		push16(instance_length, &instance_length_p, end);
+	}
+
+	return 1;
+}
+
+static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
+	
+	return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) &&
+			 push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) &&
+			 push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
+			 push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) &&
+			 pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
+	
+	return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
+	
+	return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) );
+	
+}
+
+static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
+	
+	return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ;
+}
+
+static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
+
+	if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
+		 push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+		 push8(value->num_atennas, ppWritePackedMsg, end)))
+		return 0;
+
+	uint8_t idx = 0;
+	for(idx = 0; idx < value->number_of_subbands; ++idx)
+	{
+		if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) &&
+			 pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end)))
+			return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg,  uint8_t *end)
+{
+	nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv;
+
+	if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_ues;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
+		
+		uint8_t* instance_length_p = *ppWritePackedMsg;
+		if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+			return 0;
+		
+		if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) &&
+			 pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) &&
+			 pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) &&
+			 pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) &&
+			 pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) &&
+			 pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value)))
+			return 0;
+
+		// calculate the instance length subtracting the size of the instance
+		// length feild
+		uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+		push16(instance_length, &instance_length_p, end);
+	}
+
+	return 1;
+}
+
+static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
+
+	if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_srs;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
+
+		uint8_t* instance_length_p = *ppWritePackedMsg;
+		if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+			return 0;
+
+		if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+			 pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+			return 0;
+
+		// calculate the instance length subtracting the size of the instance
+		// length feild
+		uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+		push16(instance_length, &instance_length_p, end);
+	}
+	return 1;
+}
+
+static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
+	
+	return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) &&
+			 push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) &&
+			 push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) &&
+			 push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) &&
+			 push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
+	
+	return  ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) &&
+			  push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) &&
+			  push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) &&
+			  push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
+			  pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
+			  push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) &&
+			  push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
+
+	if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	// need to calculate the data offset's. This very bittle due the hardcoding
+	// of the sizes. can not use the sizeof as we have an array for the Rel9
+	// info
+	uint16_t i = 0;
+	uint16_t offset = 2; // taking into account the number_of_cqis
+	uint16_t total_number_of_pdus = value->number_of_cqis;
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+		
+		offset += 2; // for the instance length
+		
+		if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
+		{
+			offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t)
+		}
+				
+		if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+		{
+			offset += 4 + 8;
+		}
+
+		if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+		{
+			offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported;
+		}
+
+		if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG)
+		{
+			offset += 4 + 2;
+		}
+	}
+
+	// Now update the structure to include the offset
+	for(i =0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+				
+		if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+		{
+			if(pdu->cqi_indication_rel8.data_offset == 1)
+			{
+				pdu->cqi_indication_rel8.data_offset = offset;
+				offset += pdu->cqi_indication_rel8.length;
+			}
+		}
+
+		if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+		{
+			if(pdu->cqi_indication_rel9.data_offset == 1)
+			{
+				pdu->cqi_indication_rel9.data_offset = offset;
+				offset += pdu->cqi_indication_rel9.length;
+			}
+		}
+
+	}
+	
+	// Write out the cqi information
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+		uint8_t* instance_length_p = *ppWritePackedMsg;
+		if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+			return 0;
+		
+		if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) &&
+			 pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) &&
+			 pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) &&
+			 pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+			return 0;
+
+		// calculate the instance length subtracting the size of the instance
+		// length feild
+		uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+		push16(instance_length, &instance_length_p, end);
+		
+	}
+
+	// Write out the cqi raw data
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		uint16_t length = 0;
+		nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+		if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+		{
+			length = pdu->cqi_indication_rel8.length;
+		}
+
+		if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+		{
+			length = pdu->cqi_indication_rel9.length;
+		}
+
+		if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0)
+			return 0;
+	}
+
+	return 1; 
+}
+
+static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
+	
+	return ( push32(value->handle, ppWritePackedMsg, end) &&
+			 push32(value->mp_cca, ppWritePackedMsg, end) &&
+			 push32(value->n_cca, ppWritePackedMsg, end) &&
+			 push32(value->offset, ppWritePackedMsg, end) &&
+			 push32(value->lte_txop_sf, ppWritePackedMsg, end) &&
+			 push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) &&
+			 push32(value->lbt_mode, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
+	
+	return ( push32(value->handle, ppWritePackedMsg, end) &&
+			 push32(value->offset, ppWritePackedMsg, end) &&
+			 push16(value->sfn_sf_end, ppWritePackedMsg, end) &&
+			 push32(value->lbt_mode, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
+	
+	if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_pdus;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
+		
+		if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		// Put a 0 size in and then determine the size after the pdu 
+		// has been writen and write the calculated size
+		uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+		pdu->pdu_size = 0;
+		if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
+				{
+					if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0)
+						return 0;
+				}
+				break;
+			case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
+				{
+					if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0)
+						return 0;
+				}
+				break;
+			default:
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type );
+				}
+				break;
+		};
+
+		// add 1 for the pdu_type. The delta will include the pdu_size
+		pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+		push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+	}
+
+	return 1;
+}
+
+static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
+	
+	return ( push32(value->handle, ppWritePackedMsg, end) &&
+			 push32(value->result, ppWritePackedMsg, end) &&
+			 push32(value->lte_txop_symbols, ppWritePackedMsg, end) &&
+			 push32(value->initial_partial_sf, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
+	
+	return ( push32(value->handle, ppWritePackedMsg, end) &&
+			 push32(value->result, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
+	
+	if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_pdus = value->number_of_pdus;
+	for(; i < total_number_of_pdus; ++i)
+	{
+		nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
+		
+		if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		// Put a 0 size in and then determine the size after the pdu 
+		// has been writen and write the calculated size
+		uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+		pdu->pdu_size = 0;
+		
+		if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+			return 0;
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
+				{
+					if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0)
+						return 0;
+				}
+				break;
+			case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
+				{
+					if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0)
+						return 0;
+				}
+				break;
+			default:
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type );
+				}
+				break;
+		};
+
+		// add 1 for the pdu_type. The delta will include the pdu_size
+		pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+		push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+	}
+
+	return 1;
+}
+
+static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
+	
+	return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
+	
+	if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_harqs = value->number_of_harqs;
+	for(; i < total_number_of_harqs; ++i)
+	{
+		nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
+		
+		uint8_t* instance_length_p = *ppWritePackedMsg;
+		if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+			return 0;
+
+		if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+			 pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) &&
+			 pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+			return 0;
+			
+		// calculate the instance length subtracting the size of the instance
+		// length feild
+		uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+		push16(instance_length, &instance_length_p, end);
+	}
+
+	return 1;
+}
+
+
+static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
+	
+	return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) &&
+			 push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) &&
+			 push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) &&
+			 push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+	nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
+	
+	if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0)
+		return 0;
+
+	uint16_t i = 0;
+	uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected;
+	for(; i < total_number_of_initial_scs_detected; ++i)
+	{
+		nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
+		
+		//uint8_t* instance_length_p = *ppWritePackedMsg;
+		//if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+		//	return 0;
+
+		if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value)))
+			return 0;
+			
+		// calculate the instance length subtracting the size of the instance
+		// length feild
+		//uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+		//push16(instance_length, &instance_length_p, end);
+	}
+
+	return 1;
+}
+
+static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
+	
+	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+			 pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
+
+	return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+			 pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) &&
+			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
+
+	return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+			push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
+			push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
+			pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
+
+	return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) &&
+			push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
+			push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) &&
+			push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) &&
+			push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) &&
+			push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) &&
+			pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) &&
+			pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) &&
+			pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) &&
+			pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) &&
+			pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) &&
+			pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) &&
+			pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) &&
+			pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) &&
+			pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+// Main pack function - public
+
+int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
+{
+	nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
+	uint8_t *pWritePackedMessage = pPackedBuf;
+	uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+	uint8_t *end = pPackedBuf + packedBufLen;
+
+	if (pMessageBuf == NULL || pPackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
+		return -1;
+	}
+
+	// process the header
+	if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
+		 push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
+		 push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
+		 push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
+		 push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
+		 push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
+		return -1;
+	}
+
+        if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
+        {
+          //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
+        }
+	// look for the specific message
+	uint8_t result = 0;
+	switch (pMessageHeader->message_id)
+	{
+		case NFAPI_DL_CONFIG_REQUEST:
+                  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__);
+			result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_UL_CONFIG_REQUEST:
+			result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_HI_DCI0_REQUEST:
+			result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_TX_REQUEST:
+                        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
+			result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_HARQ_INDICATION:
+			result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_CRC_INDICATION:
+			result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_RX_ULSCH_INDICATION:
+                        //printf("RX ULSCH\n");
+			result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_RACH_INDICATION:
+			result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_SRS_INDICATION:
+			result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_RX_SR_INDICATION:
+			result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_RX_CQI_INDICATION:
+			result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_LBT_DL_CONFIG_REQUEST:
+			result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_LBT_DL_INDICATION:
+			result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_NB_HARQ_INDICATION:
+			result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_NRACH_INDICATION:
+			result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_DL_NODE_SYNC:
+			result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_UL_NODE_SYNC:
+			result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		case NFAPI_TIMING_INFO:
+			result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
+			break;
+
+		default:
+			{
+				if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+				   pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+				{
+					if(config && config->pack_p7_vendor_extension)
+					{
+						result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
+					}
+					else
+					{
+						NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+					}
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+				}
+			}
+			break;
+	}
+
+	if(result == 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
+		return -1;
+	}
+
+	// check for a valid message length
+	uintptr_t msgHead = (uintptr_t)pPackedBuf;
+	uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
+	uint32_t packedMsgLen = msgEnd - msgHead;
+	uint16_t packedMsgLen16;
+	if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
+		return -1;
+	}
+	else
+	{
+		packedMsgLen16 = (uint16_t)packedMsgLen;
+	}
+
+	// Update the message length in the header
+	pMessageHeader->message_length = packedMsgLen16;
+	
+	if(!push16(packedMsgLen16, &pPackedLengthField, end))
+		return -1;
+		
+	if(1)
+	{
+		//quick test
+		if(pMessageHeader->message_length != packedMsgLen)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
+		}
+	}
+
+	return (packedMsgLen);
+}
+
+
+
+// Unpack routines
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; 
+
+	return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) &&
+			pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+			pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) &&
+			pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end));
+
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) &&
+			 pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) &&
+			 pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
+
+	return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) && 
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) &&
+			pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end));
+}
+
+static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end)
+{
+	if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && 
+		 pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
+		 pull8(ppReadPackedMsg, &value->num_antennas, end)))
+		return 0;
+	
+	
+	uint8_t idx = 0;
+	for(idx = 0; idx < value->number_of_subbands; ++idx)
+	{
+		nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
+		
+		if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) &&
+			 pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end)))
+			return 0;
+			
+		uint8_t antenna_idx = 0;
+		uint8_t scheduled_ue_idx = 0;
+		
+		for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
+		{
+			for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
+			{
+				if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end))
+					return 0;
+			}
+		}
+
+	}
+	
+	
+	return 1;
+			
+}
+
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
+	
+	// If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been 
+	// added
+	uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5;
+	dci_dl_pdu_rel13->tpm_struct_flag = 0;
+	
+	return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) &&
+			pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) && 
+			( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) &&
+			( (tpm_struct_flag_present == 1 &&  dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1));
+			
+}
+
+static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) &&
+			 pull16(ppReadPackedMsg, &bch_pdu_rel8->pdu_index, end) &&
+			 pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
+	
+	return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) &&
+			pull16(ppReadPackedMsg, &mch_pdu_rel8->pdu_index, end) &&
+			pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) &&
+			pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) &&
+			pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) &&
+			pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) &&
+			pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) &&
+			pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end));
+}
+
+static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
+	
+	if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) &&
+		  pull16(ppReadPackedMsg, &dlsch_pdu_rel8->pdu_index, end) &&
+		  pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+		  pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) &&
+		  pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) &&
+		  pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end)))
+		return 0;
+
+	uint16_t j = 0;
+	for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j)
+	{								
+		if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) &&
+			 pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end)))
+			return 0;
+	}
+	return 1;
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
+	return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) );
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) &&
+			 pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
+			 pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ;
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) &&
+			 pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) &&
+			 pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end));
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end));
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) &&
+			 pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) &&
+			 pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end));
+}
+
+static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) &&
+			 pull16(ppReadPackedMsg, &pch_pdu_rel8->pdu_index, end) &&
+			 pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+			 pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) &&
+			 pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) &&
+			 pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end));
+}
+static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) &&
+			 pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end));
+}
+
+static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) &&
+			 pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) &&
+			 pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) &&
+			 pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end));
+}
+
+static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) &&
+			 pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) &&
+			 pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) &&
+			 pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
+			 pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) &&
+			 pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end));
+}
+
+static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
+	
+	if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) &&
+		  pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) &&
+		  pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end)))
+		return 0;
+
+	
+	uint16_t idx =0;
+	for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx)
+	{
+		if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end)))
+			return 0;
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n");
+		//pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??);
+	}
+	return 1;
+}
+
+static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) &&
+			pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) &&
+			pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) &&
+			pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) &&
+			pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) &&
+			pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) &&
+			pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) &&
+			pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end));
+}
+
+static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) &&
+			 pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end));
+}
+
+static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
+	
+	
+	return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) &&
+			 pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) &&
+			 pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) &&
+			 pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) &&
+			 pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) &&
+			 pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) &&
+			 pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) &&
+			 pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end));
+}
+
+
+static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) &&
+			 pull16(ppReadPackedMsg, &nbch_params_rel13->pdu_index, end) &&
+			 pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) &&
+			 pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end));
+}
+
+static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) &&
+			 pull16(ppReadPackedMsg, &npdcch_params_rel13->pdu_index, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) &&
+			 pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) &&
+			 pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end));
+}
+
+static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) &&
+			 pull16(ppReadPackedMsg, &ndlsch_params_rel13->pdu_index, end) &&
+			 pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) &&
+			 pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) &&
+			 pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) &&
+			 pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) &&
+			 pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) &&
+			 pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) &&
+			 pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) &&
+			 pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) &&
+			 pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) &&
+			 pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end));
+} 
+
+
+static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) &&
+		 pull8(ppReadPackedMsg, &value->number_dci, end) &&
+		 pull16(ppReadPackedMsg, &value->number_pdu, end) &&
+		 pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) &&
+		 pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end)))
+		return 0;
+
+	if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_pdu)
+	{
+		value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config);
+		if(value->dl_config_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu);
+			return 0;
+		}
+	}
+	else
+	{
+		value->dl_config_pdu_list = 0;
+	}
+
+	uint16_t i;
+	uint16_t total_number_of_pdus = value->number_pdu;
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
+		
+		if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+			 pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+			return 0;
+					
+		uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+		if(packedPduEnd > end)
+		{
+			// pdu end of beyond buffer end
+			return 0;
+		}
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value},
+						{ NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value},
+						{ NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value},
+						{ NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
+						{ NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
+						{ NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
+						{ NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
+						{ NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
+						{ NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
+						{ NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value},
+						{ NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				
+				}
+				break;
+			case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				
+				}
+				break;
+			default:
+				// Need to log an error
+				break;
+		}
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value},
+	};
+
+	return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			 unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
+	
+	return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) &&
+			pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) &&
+			pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end ));
+}
+static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; 
+	
+	return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) &&
+			pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) &
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) &&
+			pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end));
+}
+static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg,	&ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) &&
+			 pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) &&
+			 pull8(ppReadPackedMsg,	&ulsch_pdu_rel11->dmrs_config_flag, end) &&
+			 pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end));
+}
+static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg,  &ulsch_pdu_rel13->ue_type, end) &&
+			pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) &&
+			pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) &&
+			pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) &&
+			pull8(ppReadPackedMsg,  &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end));
+}
+static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) &&
+			pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) &&
+			pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) &&
+			pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) &&
+			pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end));
+}
+
+static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
+	
+	if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) &&
+		 pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) &&
+		 pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end)))
+		return 0;
+
+	switch(cqi_ri_info_rel9->report_type)
+	{
+		case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+			{
+				if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) &&
+					 pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end)))
+					return 0;
+			}
+			break;
+		case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+			{
+				if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0)
+					return 0;
+					
+				uint8_t i;
+				for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
+				{
+					if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0)
+						return 0;
+
+                                        uint8_t j;
+                                        for(j = 0; j < 8; ++j)
+					{
+						if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0)
+							return 0;
+					}
+				}
+			}
+			break;
+		default:
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
+				return 0;
+			}
+			break;
+	};
+	return 1;
+}
+
+// NOTE : This function is a little unconventional as we uese the side to
+// determine the report type
+static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
+	if(cqi_ri_info_rel13->tl.length == 0)
+	{
+		cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC;
+	}
+	else
+	{
+		cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC;
+		if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0)
+			return 0;
+	}
+	return 1;
+}
+static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) &&
+			pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end));
+}
+static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) &&
+			pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) &&
+			pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end));
+}
+
+static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
+	
+	return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
+			pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end));
+}
+
+static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
+	
+	return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) &&
+			pull16(ppReadPackedMsg, &ue_info_rel8->rnti, end));
+}
+static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) &&
+			pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end));
+}
+static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) &&
+			pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) &&
+			pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) &&
+			pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end));
+}
+
+static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) &&
+			 pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end));
+}
+static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) &&
+			pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end));
+}
+static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) &&
+			pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) &&
+			pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) &&
+			pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) &&
+			pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) &&
+			pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end));
+}
+		
+static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
+	
+	return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end));
+}
+
+static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) &&
+			pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) &&
+			pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) &&
+			pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) &&
+			pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) &&
+			pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) &&
+			pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) &&
+			pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
+	
+	return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) &&
+			pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) &&
+			pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) &&
+			pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) &&
+			pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) &&
+			pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) &&
+			pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) &&
+			pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) &&
+			pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) &&
+			pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) &&
+			pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) &&
+			pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
+	
+	return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
+			pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) &&
+			pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) &&
+			pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) &&
+			pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end));
+}
+
+
+static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
+	
+	return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) &&
+			pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) &&
+			pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) &&
+			pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) &&
+			pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) &&
+			pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) &&
+			pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) &&
+			pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) &&
+			pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end));
+}
+
+static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
+	return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end);
+}
+
+static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
+
+	return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end));
+}
+
+static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
+
+	return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end));
+}
+
+static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) && 
+		 pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) && 
+		 pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) && 
+		 pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) && 
+		 pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) && 
+		 pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) && 
+		 pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) && 
+		 pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) && 
+		 pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) && 
+		 pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) && 
+		 pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) && 
+		 pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) && 
+		 pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end)))
+		return 0;
+		
+	unpack_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value},
+		{ NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value},
+		{ NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
+		{ NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value},
+	};
+
+	return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0);		
+}
+
+static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
+
+	return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) &&
+			pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) &&
+			pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end));
+}
+
+
+static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	#define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value}, 
+
+	#define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value},
+
+	#define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\
+		{ NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value},
+
+	#define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value},
+
+	#define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
+
+	#define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value},
+						
+	#define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value},
+
+	#define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value},
+
+	#define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \
+		{ NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value},
+		
+	#define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value},		
+
+	#define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \
+		{ NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value},		
+
+
+	nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
+
+	if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) &&
+		 pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) &&
+		 pull8(ppReadPackedMsg, &value->srs_present, end)))
+		return 0;
+
+	if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_of_pdus > 0)
+	{
+		value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config);
+
+		if(value->ul_config_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+			return 0;
+		}
+	}
+	else
+	{
+		value->ul_config_pdu_list = 0;
+	}
+
+
+	uint16_t i;
+	uint16_t total_number_of_pdus = value->number_of_pdus;
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
+		
+		if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+			 pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+			return 0;
+					
+		uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+		if(packedPduEnd > end)
+		{
+			// pdu end is past buffer end
+			return 0;
+		}
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+
+			case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu)
+						UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information)
+						UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu)
+						UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information)
+						UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu)
+						UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information)
+						UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information)
+						UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information)
+						UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information)
+						UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information)
+						UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information)
+						UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information)
+						UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information)
+						UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information)
+						UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information)
+						UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information)
+						UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information)
+						UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information)
+						UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information)
+						UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu)
+						UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu)
+						UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu)
+						UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information)
+						UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;	
+			case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu)
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;						
+		}
+	}
+	return 1;
+}
+
+
+static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
+	
+	return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) &&
+			pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+			pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) &&
+			pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) &&
+			pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) &&
+			pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) &&
+			pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) &&
+			pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) &&
+			pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) &&
+			pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) &&
+			pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
+	
+	return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) &&
+			 pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end));
+}
+
+static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) &&
+			pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) &&
+			pull8(ppReadPackedMsg, &value->resource_block_assignment, end) &&
+			pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) &&
+			pull8(ppReadPackedMsg, &value->start_symbol, end) &&
+			pull8(ppReadPackedMsg, &value->ecce_index, end) &&
+			pull8(ppReadPackedMsg, &value->aggreagation_level, end) &&
+			pull8(ppReadPackedMsg, &value->rnti_type, end) &&
+			pull16(ppReadPackedMsg, &value->rnti, end) &&
+			pull8(ppReadPackedMsg, &value->ce_mode, end) &&
+			pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) &&
+			pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) &&
+			pull16(ppReadPackedMsg, &value->transmission_power, end) &&
+			pull8(ppReadPackedMsg, &value->dci_format, end) &&
+			pull8(ppReadPackedMsg, &value->resource_block_start, end) &&
+			pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
+			pull8(ppReadPackedMsg, &value->mcs, end) &&
+			pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) &&
+			pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) &&
+			pull8(ppReadPackedMsg, &value->new_data_indication, end) &&
+			pull8(ppReadPackedMsg, &value->harq_process, end) &&
+			pull8(ppReadPackedMsg, &value->redudency_version, end) &&
+			pull8(ppReadPackedMsg, &value->tpc, end) &&
+			pull8(ppReadPackedMsg, &value->csi_request, end) &&
+			pull8(ppReadPackedMsg, &value->ul_inex, end) &&
+			pull8(ppReadPackedMsg, &value->dai_presence_flag, end) &&
+			pull8(ppReadPackedMsg, &value->dl_assignment_index, end) &&
+			pull8(ppReadPackedMsg, &value->srs_request, end) &&
+			pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) &&
+			pull32(ppReadPackedMsg, &value->tcp_bitmap, end) &&
+			pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) &&
+			pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) &&
+			pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end));
+}
+
+static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &value->ncce_index, end) &&
+			pull8(ppReadPackedMsg, &value->aggregation_level, end) &&
+			pull8(ppReadPackedMsg, &value->start_symbol, end) &&
+			pull16(ppReadPackedMsg, &value->rnti, end) &&
+			pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) &&
+			pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) &&
+			pull8(ppReadPackedMsg, &value->subcarrier_indication, end) &&
+			pull8(ppReadPackedMsg, &value->resource_assignment, end) &&
+			pull8(ppReadPackedMsg, &value->scheduling_delay, end) &&
+			pull8(ppReadPackedMsg, &value->mcs, end) &&
+			pull8(ppReadPackedMsg, &value->redudancy_version, end) &&
+			pull8(ppReadPackedMsg, &value->repetition_number, end) &&
+			pull8(ppReadPackedMsg, &value->new_data_indicator, end) &&
+			pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end));
+}
+
+static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
+
+	if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_dci, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_hi, end)))
+		return 0;
+
+	uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci;
+
+	if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU);
+		return 0;		
+	}
+
+	if(totalNumPdus > 0)
+	{
+		value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config);
+		if(value->hi_dci0_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus);
+			return 0;
+		}
+	}
+	else
+	{
+		value->hi_dci0_pdu_list = 0;
+	}
+
+	uint8_t i;
+	for(i = 0; i < totalNumPdus; ++i)
+	{
+		nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
+
+		if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+			 pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+			return 0;
+
+		uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+		if(packedPduEnd > end)
+		{
+			// pdu end if past buffer end
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %d %d\n", __FUNCTION__, packedPduEnd, end);
+			return 0;
+		}
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_HI_DCI0_HI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value},
+						{ NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_HI_DCI0_DCI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
+						{ NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
+						{ NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
+						{ NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
+						{ NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			default:
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+				}
+				break;
+		};
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+}
+
+static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	uint8_t proceed = 1;
+	nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
+
+	if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
+		return 0;
+
+	while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
+	{
+		nfapi_tl_t generic_tl;
+		if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+			return 0;
+
+		switch(generic_tl.tag)
+		{
+			case NFAPI_TX_REQUEST_BODY_TAG:
+			{
+				pNfapiMsg->tx_request_body.tl = generic_tl;
+
+				if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0)
+					return 0;
+
+				if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU);
+					return 0;		
+				}
+
+				if(pNfapiMsg->tx_request_body.number_of_pdus > 0)
+				{
+					pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config);
+					if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL)
+					{
+						NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx  pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus);
+						return 0;
+					}
+				}
+				else
+				{
+					pNfapiMsg->tx_request_body.tx_pdu_list = 0;
+				}
+
+
+				uint16_t i;
+				uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus;
+				for(i = 0; i < totalNumPdus; ++i)
+				{
+					nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
+					
+					uint16_t length = 0;
+					uint16_t index = 0;
+					
+					if(!(pull16(ppReadPackedMsg, &length, end) &&
+						 pull16(ppReadPackedMsg, &index, end)))
+						return 0;
+
+					pdu->pdu_length = length;
+					pdu->pdu_index = index;
+					
+
+					// TODO : May need to rethink this bit
+					pdu->num_segments = 1;
+					pdu->segments[0].segment_length = pdu->pdu_length;
+					pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
+
+					if(pdu->segments[0].segment_data)
+					{
+						if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
+							return 0;
+                                                if (0 && pdu->segments[0].segment_length == 3)
+                                                {
+                                                  NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, 
+                                                      pdu->segments[0].segment_data[0], 
+                                                      pdu->segments[0].segment_data[1], 
+                                                      pdu->segments[0].segment_data[2]
+                                                      );
+                                                }
+					}
+					else
+					{
+						NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
+					}
+				}
+			}
+			break;
+			default:
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag );
+			}
+			break;
+		};
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &value->value_0, end) &&
+			pull8(ppReadPackedMsg, &value->value_1, end));
+}
+
+static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &value->value_0, end) &&
+			pull8(ppReadPackedMsg, &value->value_1, end) &&
+			pull8(ppReadPackedMsg, &value->value_2, end) &&
+			pull8(ppReadPackedMsg, &value->value_3, end));
+}
+static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv;
+	return ( pull8(ppReadPackedMsg, &value->value_0, end));
+}
+static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv;
+	return  (pull8(ppReadPackedMsg, &value->value_0, end));
+}
+
+static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv;
+	
+	if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+		return 0;
+
+	uint8_t result = 0;
+	switch(value->mode)
+	{
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+			result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end);
+			break;
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+			result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end);
+			break;
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+			result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end);
+			break;
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+		case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+			result = 1;
+			break;
+		default:
+			// TODO add error message
+			return 0;
+			break;
+	}
+	return result;
+}
+
+static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv;
+	
+	if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+		return 0;
+
+	if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
+	{
+		// TODO : add error message
+		return 0;
+	}
+
+	uint16_t idx = 0;
+	for(idx = 0; idx < value->number_of_ack_nack; ++idx)
+	{
+		uint8_t result = 0;
+		switch(value->mode)
+		{
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+				result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
+				break;
+			default:
+				// TODO add error message
+				return 0;
+				break;
+		}
+
+		if(result == 0)
+			return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv;
+	
+	if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+		 pull16(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+		return 0;
+
+	if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
+	{
+		// TODO : add error message
+		return 0;
+	}
+
+	uint16_t idx = 0;
+	for(idx = 0; idx < value->number_of_ack_nack; ++idx)
+	{
+		uint8_t result = 0;
+		switch(value->mode)
+		{
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+				result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end);
+				break;
+			case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
+				result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end);
+				break;
+			default:
+				// TODO add error message
+				return 0;
+				break;
+		}
+
+		if(result == 0)
+			return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv;
+	return (pull8(ppReadPackedMsg, &value->harq_tb1, end) &&
+			pull8(ppReadPackedMsg, &value->harq_tb2, end));
+}
+
+static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &value->mode, end) &&
+			pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
+			pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end));
+}
+
+static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &value->mode, end) &&
+			pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
+			pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end));
+}
+
+static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
+	
+	return (pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+			pull8(ppReadPackedMsg, &value->channel, end));
+}
+
+
+
+static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
+	uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+	if(harqBodyEnd > end)
+		return 0;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
+		return 0;
+
+	if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
+		return 0;		
+	}
+
+	value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config);
+	if(value->harq_pdu_list == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
+		return 0;
+	}
+	
+	uint8_t i = 0;
+	for(i = 0; i < value->number_of_harqs; ++i)
+	{
+		nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
+		if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+			return 0;
+
+		uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+		unpack_tlv_t unpack_fns[] =
+		{
+			{ NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+			{ NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value},
+			{ NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value},
+			{ NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value},
+			{ NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value},
+			{ NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value},
+			{ NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value},
+			{ NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
+		};
+
+		if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
+			return 0;
+	
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
+	return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) );
+}
+
+static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end,  nfapi_p7_codec_config_t* config)
+{
+	nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
+	uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+	if(crcBodyEnd > end)
+		return 0;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0)
+		return 0;
+
+	if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_of_crcs > 0)
+	{
+		value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config);
+		if(value->crc_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs);
+			return 0;
+		}
+	}
+	else
+	{
+		value->crc_pdu_list = 0;
+	}
+
+	
+	uint8_t i = 0;
+	for(i = 0; i < value->number_of_crcs; ++i)
+	{
+		nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
+
+		if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+			return 0;
+
+		uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+		unpack_tlv_t unpack_fns[] =
+		{
+			{ NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+			{ NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value },
+		};
+
+		if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0)
+			return 0;
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
+	
+	return (pull16(ppReadPackedMsg, &value->length, end) &&
+			pull16(ppReadPackedMsg, &value->offset, end) &&
+			pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+			pull16(ppReadPackedMsg, &value->timing_advance, end));
+}
+static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
+	return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
+}
+
+static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
+
+	// the rxBodyEnd points to the end of the cqi PDU's
+	uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length;
+	uint8_t* rxPduEnd = rxBodyEnd;
+
+	uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
+
+	if(rxBodyEnd > end)
+	{
+		// pdu end is past buffer end
+		return 0;
+	}
+
+	if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+		return 0;
+
+	if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_of_pdus > 0)
+	{
+		value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
+		if(value->rx_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+			return 0;
+		}
+	}
+	else
+	{
+		value->rx_pdu_list = 0;
+	}
+	
+	uint8_t i = 0;
+	nfapi_rx_indication_pdu_t* pdu = 0;
+	while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd)
+	{
+		nfapi_tl_t generic_tl;
+		if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+			return 0;
+
+		switch(generic_tl.tag)
+		{
+			case NFAPI_RX_UE_INFORMATION_TAG:
+				{
+					pdu = &(value->rx_pdu_list[i++]);
+					pdu->rx_ue_information.tl = generic_tl;
+					if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
+						return 0;
+				}
+				break;
+			case NFAPI_RX_INDICATION_REL8_TAG:
+				{
+					if(pdu != 0)
+					{
+						pdu->rx_indication_rel8.tl = generic_tl;
+						if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
+							return 0;
+		
+						if(pdu->rx_indication_rel8.offset > 0)
+						{
+							// Need to check that the data is within the tlv
+							if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd)
+							{
+								// If this the first pdu set the rxPduEnd
+								if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd)
+								{
+									rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset;
+		
+									if(rxPduEnd > end)
+									{
+										// pdu end is past buffer end
+										return 0;
+									}
+								}
+							}
+							else
+							{
+								NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n");
+							}
+						}
+					}
+				}
+				break;
+			case NFAPI_RX_INDICATION_REL9_TAG:
+				{
+					if(pdu != 0)
+					{
+						pdu->rx_indication_rel9.tl = generic_tl;
+						if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
+							return 0;
+					}
+				}
+				break;
+			default:
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag );
+				}
+				break;
+		}
+	}
+	
+	uint8_t idx = 0;
+	for(idx = 0; idx < value->number_of_pdus; ++idx)
+	{
+		if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+		{
+			uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length;
+			value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config);
+			if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0)
+			{
+				return 0;
+			}
+		}
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
+	
+	return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) &&
+			pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) &&
+			pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end));
+}
+
+static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
+	return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end);
+}
+
+static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
+	return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end);
+}
+
+static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
+	uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+	if(rachBodyEnd > end)
+		return 0;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0)
+		return 0;
+
+	if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_of_preambles > 0)
+	{
+		value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config);
+		if(value->preamble_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles);
+			return 0;
+		}
+	}
+	else
+	{
+		value->preamble_list = 0;
+	}
+
+	
+	uint8_t i = 0;
+	for(i = 0; i < value->number_of_preambles; ++i)
+	{
+		nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
+
+		if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+			return 0;
+
+		uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+		unpack_tlv_t unpack_fns[] =
+		{
+			{ NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value },
+			{ NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value },
+			{ NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value },
+		};
+
+		if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0)
+			return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
+	
+	if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) &&
+		 pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) &&
+		 pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) &&
+		 pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) &&
+		 pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end)))
+		return 0;
+	return 1;
+}
+
+static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
+	return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end));
+}
+
+static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
+	return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end));
+}
+
+static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
+	return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end));
+}
+
+static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
+	
+	if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
+		 pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
+		 pull8(ppReadPackedMsg, &value->num_atennas, end)))
+		return 0;
+
+	if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS)
+	{
+		// todo : add error
+		return 0;
+	}
+
+	if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS)
+	{
+		// todo : add error
+		return 0;
+	}
+
+	uint8_t idx = 0;
+	for(idx = 0; idx < value->number_of_subbands; ++idx)
+	{
+		if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) &&
+			 pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end)))
+			return 0;
+	}
+
+	return 1;
+}
+
+
+static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv;
+	uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length;
+	
+	if(srsBodyEnd > end)
+		return 0;
+
+	if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0)
+		return 0;
+
+	if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_of_ues > 0)
+	{
+		value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config);
+		if(value->srs_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues);
+			return 0;
+		}
+	}
+	else
+	{
+		value->srs_pdu_list = 0;
+	}
+
+
+	
+	uint8_t i = 0;
+	for(i = 0; i < value->number_of_ues; ++i)
+	{
+		nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
+
+		
+		if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+			return 0;
+
+		uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+		unpack_tlv_t unpack_fns[] =
+		{
+			{ NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+			{ NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value},
+			{ NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value},
+			{ NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value},
+			{ NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value},
+			{ NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value},
+		};
+
+		if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0)
+			return 0;
+	}
+	return 1;
+}
+
+static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
+	uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+	if(srBodyEnd > end)
+		return 0;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0)
+		return 0;
+
+	if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_of_srs > 0)
+	{
+		value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * value->number_of_srs, config);
+		if(value->sr_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs);
+			return 0;
+		}
+	}
+	else
+	{
+		value->sr_pdu_list = 0;
+	}
+	
+	uint8_t i = 0;
+	for(i = 0; i < value->number_of_srs; ++i)
+	{
+		nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
+
+		if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+			return 0;
+
+		uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+		unpack_tlv_t unpack_fns[] =
+		{
+			{ NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+			{ NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value },
+		};
+
+		if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0)
+			return 0;
+	}
+
+	return 1;
+
+}
+
+static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
+	
+	return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) &&
+			pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) &&
+			pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) &&
+			pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) &&
+			pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end));
+
+}
+
+static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
+	
+	if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) &&
+		 pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) &&
+		 pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) &&
+		 pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end)))
+		return 0;
+
+	if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n");
+		return 0;
+	}
+	
+	if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) &&
+		 pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) &&
+		 pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end)))
+		return 0;
+
+	return 1;
+}
+
+static uint8_t  unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end,  nfapi_p7_codec_config_t* config)
+{
+	nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
+
+	// the cqiBodyEnd points to the end of the cqi PDU's
+	uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+	//uint8_t* cqiPduEnd = cqiBodyEnd;
+	//uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
+
+	if(cqiBodyEnd > end)
+		return 0;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0)
+		return 0;
+
+	if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU);
+		return -1;		
+	}
+
+	if(value->number_of_cqis > 0)
+	{
+		value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * value->number_of_cqis, config);
+		if(value->cqi_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
+			return 0;
+		}
+	}
+	else
+	{
+		value->cqi_pdu_list = 0;
+	}
+
+	if(value->number_of_cqis > 0)
+	{
+		value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * value->number_of_cqis, config);
+		if(value->cqi_raw_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
+			return 0;
+		}
+	}
+	else
+	{
+		value->cqi_raw_pdu_list = 0;
+	}
+
+	uint8_t i = 0;
+	for(i = 0; i < value->number_of_cqis; ++i)
+	{
+		nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+		memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t));
+
+		if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+			return 0;
+
+		uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+		while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd)
+		{
+			nfapi_tl_t generic_tl;
+			if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+				return 0;
+
+			switch(generic_tl.tag)
+			{
+				case NFAPI_RX_UE_INFORMATION_TAG:
+					pdu->rx_ue_information.tl = generic_tl;
+					if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
+						return 0;
+					break;
+				case NFAPI_CQI_INDICATION_REL8_TAG:
+					pdu->cqi_indication_rel8.tl = generic_tl;
+					if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0)
+						return 0;
+
+					break;
+				case NFAPI_CQI_INDICATION_REL9_TAG:
+					pdu->cqi_indication_rel9.tl = generic_tl;
+					if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0)
+						return 0;
+
+					break;
+				case NFAPI_UL_CQI_INFORMATION_TAG:
+					pdu->ul_cqi_information.tl = generic_tl;
+					if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0)
+						return 0;
+					break;
+				default:
+					{
+						NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag );
+					}
+					break;
+
+			};
+		}
+	}
+
+	uint8_t idx = 0;
+	for(idx = 0; idx < value->number_of_cqis; ++idx)
+	{
+		if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+		{
+			if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0)
+				return 0;
+		}
+		else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+		{
+			if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0)
+				return 0;
+		}
+	}
+
+
+	return 1;
+
+}
+
+static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
+
+	return (pull32(ppReadPackedMsg, &value->handle, end) &&
+			pull32(ppReadPackedMsg, &value->mp_cca, end) &&
+			pull32(ppReadPackedMsg, &value->n_cca, end) &&
+			pull32(ppReadPackedMsg, &value->offset, end) &&
+			pull32(ppReadPackedMsg, &value->lte_txop_sf, end) &&
+			pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) &&
+			pull32(ppReadPackedMsg, &value->lbt_mode, end));
+}
+
+static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
+
+	return (pull32(ppReadPackedMsg, &value->handle, end) &&
+			pull32(ppReadPackedMsg, &value->offset, end) &&
+			pull16(ppReadPackedMsg, &value->sfn_sf_end, end) &&
+			pull32(ppReadPackedMsg, &value->lbt_mode, end));
+}
+
+
+static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+		return 0;
+
+	if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_of_pdus)
+	{
+		value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config);
+		if(value->lbt_dl_config_req_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+			return 0;
+		}
+	}
+	else
+	{
+		value->lbt_dl_config_req_pdu_list = 0;
+	}
+
+
+	uint16_t i;
+	uint16_t total_number_of_pdus = value->number_of_pdus;
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
+
+		if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+			 pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+			return 0;
+			
+		uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+		if(packedPduEnd > end)
+			return 0;
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			default:
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type);
+				return 0;
+		}
+	}
+
+	return 1;
+}
+static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value},
+	};
+	
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
+	
+	return (pull32(ppReadPackedMsg, &value->handle, end) &&
+			pull32(ppReadPackedMsg, &value->result, end) &&
+			pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) &&
+			pull32(ppReadPackedMsg, &value->initial_partial_sf, end));
+	
+}
+static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
+	
+	return (pull32(ppReadPackedMsg, &value->handle, end) &&
+			pull32(ppReadPackedMsg, &value->result, end));
+}
+
+static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+		return 0;
+
+	if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU);
+		return 0;		
+	}
+
+	if(value->number_of_pdus > 0)
+	{
+		value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config);
+		if(value->lbt_indication_pdu_list == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+			return 0;
+		}
+	}
+	else
+	{
+		value->lbt_indication_pdu_list = 0;
+	}
+
+	uint16_t i;
+	uint16_t total_number_of_pdus = value->number_of_pdus;
+	for(i = 0; i < total_number_of_pdus; ++i)
+	{
+		nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
+
+		if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+			 pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+			return 0;
+			
+		uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+		if(packedPduEnd > end)
+			return 0;
+
+		switch(pdu->pdu_type)
+		{
+			case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
+				{
+					unpack_tlv_t unpack_fns[] =
+					{
+						{ NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value},
+					};
+
+					unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+				}
+				break;
+			default:
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type);
+				return 0;
+		}
+	}
+
+	return 1;
+}
+static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
+	return (pull8(ppReadPackedMsg, &value->harq_tb1, end));
+}
+
+
+static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
+	uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+	if(nbharqBodyEnd > end)
+		return 0;
+
+	if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
+		return 0;
+
+	if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
+		return 0;		
+	}
+
+	value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config);
+	if(value->nb_harq_pdu_list == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
+		return 0;
+	}
+	
+	uint8_t i = 0;
+	for(i = 0; i < value->number_of_harqs; ++i)
+	{
+		nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
+		if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+			return 0;
+
+		uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+		unpack_tlv_t unpack_fns[] =
+		{
+			{ NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+			{ NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value},
+			{ NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
+		};
+
+		if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
+			return 0;
+	
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+	nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
+	
+	return (pull16(ppReadPackedMsg, &value->rnti, end) && 
+			pull8(ppReadPackedMsg, &value->initial_sc, end) &&
+			pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+			pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
+}
+
+
+static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
+	uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+	if(nrachBodyEnd > end)
+		return 0;
+
+	if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0)
+		return 0;
+
+	if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU);
+		return 0;		
+	}
+
+	value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config);
+	if(value->nrach_pdu_list == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected);
+		return 0;
+	}
+	
+	uint8_t i = 0;
+	for(i = 0; i < value->number_of_initial_scs_detected; ++i)
+	{
+		nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
+
+		uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6;
+
+		unpack_tlv_t unpack_fns[] =
+		{
+			{ NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value},
+		};
+
+		if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0)
+			return 0;
+	
+	}
+
+	return 1;
+}
+
+static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+		{ NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value},
+	};
+
+	return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && 
+			pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+			pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
+			pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+	nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
+
+	unpack_p7_tlv_t unpack_fns[] =
+	{
+	};
+
+	return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) &&
+			pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
+			pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) &&
+			pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) &&
+			pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) &&
+			pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) &&
+			pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) &&
+			pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) &&
+			pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) &&
+			pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) &&
+			pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) &&
+			pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) &&
+			pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) &&
+			pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) &&
+			unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+// unpack length check
+
+static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
+{
+	int retLen = 0;
+
+	switch (msgId)
+	{
+		case NFAPI_DL_CONFIG_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t))
+				retLen = sizeof(nfapi_dl_config_request_t);
+			break;
+
+		case NFAPI_UL_CONFIG_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t))
+				retLen = sizeof(nfapi_ul_config_request_t);
+			break;
+
+		case NFAPI_SUBFRAME_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
+				retLen = sizeof(nfapi_subframe_indication_t);
+			break;
+
+		case NFAPI_HI_DCI0_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t))
+				retLen = sizeof(nfapi_hi_dci0_request_t);
+			break;
+
+		case NFAPI_TX_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_tx_request_t))
+				retLen = sizeof(nfapi_tx_request_t);
+			break;
+
+		case NFAPI_HARQ_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_harq_indication_t))
+				retLen = sizeof(nfapi_harq_indication_t);
+			break;
+
+		case NFAPI_CRC_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_crc_indication_t))
+				retLen = sizeof(nfapi_crc_indication_t);
+			break;
+
+		case NFAPI_RX_ULSCH_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_rx_indication_t))
+				retLen = sizeof(nfapi_rx_indication_t);
+			break;
+
+		case NFAPI_RACH_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_rach_indication_t))
+				retLen = sizeof(nfapi_rach_indication_t);
+			break;
+
+		case NFAPI_SRS_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_srs_indication_t))
+				retLen = sizeof(nfapi_srs_indication_t);
+			break;
+
+		case NFAPI_RX_SR_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_sr_indication_t))
+				retLen = sizeof(nfapi_sr_indication_t);
+			break;
+
+		case NFAPI_RX_CQI_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t))
+				retLen = sizeof(nfapi_cqi_indication_t);
+			break;
+
+		case NFAPI_LBT_DL_CONFIG_REQUEST:
+			if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t))
+				retLen = sizeof(nfapi_lbt_dl_config_request_t);
+			break;
+
+		case NFAPI_LBT_DL_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t))
+				retLen = sizeof(nfapi_lbt_dl_indication_t);
+			break;
+	
+		case NFAPI_NB_HARQ_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t))
+				retLen = sizeof(nfapi_nb_harq_indication_t);
+			break;
+			
+		case NFAPI_NRACH_INDICATION:
+			if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t))
+				retLen = sizeof(nfapi_nrach_indication_t);
+			break;			
+			
+		case NFAPI_DL_NODE_SYNC:
+			if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t))
+				retLen = sizeof(nfapi_dl_node_sync_t);
+			break;
+
+		case NFAPI_UL_NODE_SYNC:
+			if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t))
+				retLen = sizeof(nfapi_ul_node_sync_t);
+			break;
+
+		case NFAPI_TIMING_INFO:
+			if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
+				retLen = sizeof(nfapi_timing_info_t);
+			break;
+
+		default:
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
+			break;
+	}
+
+	return retLen;
+}
+
+
+// Main unpack functions - public
+
+int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
+{
+	nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf;
+	uint8_t *pReadPackedMessage = pMessageBuf;
+	uint8_t *end = pMessageBuf + messageBufLen;
+
+	if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n");
+		return -1;
+	}
+
+	if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+		return -1;
+	}
+
+	// process the header
+	if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+		 pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+		 pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+		 pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
+		 pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
+		 pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
+		return -1;
+
+	return 0;
+}
+
+int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
+{
+	int result = 0;
+	nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
+	uint8_t *pReadPackedMessage = pMessageBuf;
+	uint8_t *end = pMessageBuf + messageBufLen;
+
+	if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
+		return -1;
+	}
+
+	if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+		return -1;
+	}
+
+	// clean the supplied buffer for - tag value blanking
+	(void)memset(pUnpackedBuf, 0, unpackedBufLen);
+
+	// process the header
+	if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+		 pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+		 pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+		 pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
+		 pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
+		 pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
+		return -1;
+	}
+
+	if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
+		return -1;
+	}
+
+	/*
+	if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
+		return -1;
+	}
+	*/
+
+	// look for the specific message
+	switch (pMessageHeader->message_id)
+	{
+		case NFAPI_DL_CONFIG_REQUEST:
+			if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen))
+				result = unpack_dl_config_request(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_UL_CONFIG_REQUEST:
+			if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen))
+				result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_HI_DCI0_REQUEST:
+			if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen))
+				result = unpack_hi_dci0_request(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_TX_REQUEST:
+			if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen))
+				result = unpack_tx_request(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_HARQ_INDICATION:
+			if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
+				result = unpack_harq_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_CRC_INDICATION:
+			if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
+				result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_RX_ULSCH_INDICATION:
+			if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
+				result = unpack_rx_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_RACH_INDICATION:
+			if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
+				result = unpack_rach_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_SRS_INDICATION:
+			if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen))
+				result = unpack_srs_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_RX_SR_INDICATION:
+			if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen))
+				result = unpack_sr_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_RX_CQI_INDICATION:
+			if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen))
+				result = unpack_cqi_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_LBT_DL_CONFIG_REQUEST:
+			if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen))
+				result = unpack_lbt_dl_config_request(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_LBT_DL_INDICATION:
+			if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
+				result = unpack_lbt_dl_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+			
+		case NFAPI_NB_HARQ_INDICATION:
+			if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
+				result = unpack_nb_harq_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;	
+			
+		case NFAPI_NRACH_INDICATION:
+			if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
+				result = unpack_nrach_indication(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+			
+		case NFAPI_DL_NODE_SYNC:
+			if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen))
+				result = unpack_dl_node_sync(&pReadPackedMessage,  end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_UL_NODE_SYNC:
+			if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen))
+				result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		case NFAPI_TIMING_INFO:
+			if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
+				result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
+			else
+				return -1;
+			break;
+
+		default:
+
+			if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && 
+			   pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+			{
+				if(config && config->unpack_p7_vendor_extension)
+				{
+					result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+				}
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+			}
+			break;
+	}
+
+	if(result == 0)
+		return -1;
+	else 
+		return 0;
+}
+
diff --git a/nfapi/open-nFAPI/nfapi/tests/Makefile.am b/nfapi/open-nFAPI/nfapi/tests/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..46785869b02d4e026b22b49416d782dc5bd4f2a6
--- /dev/null
+++ b/nfapi/open-nFAPI/nfapi/tests/Makefile.am
@@ -0,0 +1,36 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+#nfapi unit test
+AUTOMAKE_OPTIONS=subdir-objects
+
+AM_CPPFLAGS = -I$(top_srcdir)/nfapi/inc -I$(top_srcdir)/nfapi/public_inc  -I$(top_srcdir)/common/public_inc -I$(top_srcdir)pnf/public_inc $(CFLAGS_CUNIT) -Wall -Werror
+AM_CFLAGS = -I$(top_srcdir)/nfapi/inc -I$(top_srcdir)/nfapi/public_inc  -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/pnf/public_inc $(CFLAGS_CUNIT) -Wall -Werror
+
+check_PROGRAMS= test_nfapi
+test_nfapi_SOURCES = nfapi_cunit_main.c ../src/nfapi.c ../src/nfapi_p7.c ../../common/src/debug.c ../src/nfapi_p5.c  ../src/nfapi_p4.c 
+test_nfapi_LDADD=$(top_builddir)/pnf/libnfapi_pnf.a  -L$(libdir) -lpthread -lrt -lsctp -lz -lcunit
+
+
+#jTEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh --ingore-exit
+#TEST_ENVIRONMENT = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
+
+#AM_TESTS_ENVIRONMENT = env AM_TAP_AWK='$(AWK)' $(SHELL);
+LOG_DRIVER = $(top_srcdir)/tap-driver.sh
+#AM_LOG_FLAGS = -- test_nfapi
+
+TESTS=$(check_PROGRAMS)
+EXTRA_DIST = $(TESTS)
diff --git a/nfapi/open-nFAPI/nfapi/tests/nfapi_cunit_main.c b/nfapi/open-nFAPI/nfapi/tests/nfapi_cunit_main.c
new file mode 100644
index 0000000000000000000000000000000000000000..daaf65a3ffebb3a0f889cacc02727cff1e2bd659
--- /dev/null
+++ b/nfapi/open-nFAPI/nfapi/tests/nfapi_cunit_main.c
@@ -0,0 +1,5511 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CUnit.h"
+#include "Basic.h"
+#include "Automated.h"
+//#include "CUnit/Console.h"
+
+#include "nfapi_interface.h"
+#include "nfapi.h"
+#include <stdio.h>  // for printf
+#include <stdlib.h>
+#include "debug.h"
+#include "nfapi_interface.h"
+/* Test Suite setup and cleanup functions: */
+
+int init_suite(void) { return 0; }
+int clean_suite(void) { return 0; }
+
+#define MAX_PACKED_MESSAGE_SIZE	8192
+
+#define IN_OUT_ASSERT(_V) { CU_ASSERT_EQUAL(in._V, out._V); }
+
+typedef struct 
+{
+	nfapi_tl_t tl;
+	uint16_t value1;
+	uint32_t value2;
+} my_vendor_extention;
+
+extern void* nfapi_allocate_pdu(size_t size)
+{
+	return malloc(size);
+}
+
+extern int nfapi_test_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* config)
+{
+	printf("nfapi_unpack_vendor_extension_tlv\n");
+
+	if(tl->tag == NFAPI_VENDOR_EXTENSION_MIN_TAG_VALUE)
+	{
+		my_vendor_extention* mve = (my_vendor_extention*)malloc(sizeof(my_vendor_extention));
+		mve->tl.tag = NFAPI_VENDOR_EXTENSION_MIN_TAG_VALUE;
+		
+		if(!(pull16(ppReadPackedMsg, &mve->value1, end) &&
+		     pull32(ppReadPackedMsg, &mve->value2, end)))
+		{
+			free(mve);
+			return 0;
+		}
+
+		(*ve) = mve;
+
+	}
+
+	return 1;
+}
+
+int nfapi_pack_vendor_extension_tlv_called = 0;
+extern int nfapi_test_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	printf("nfapi_pack_vendor_extension_tlv\n");
+	nfapi_pack_vendor_extension_tlv_called++;
+
+	my_vendor_extention* mve = (my_vendor_extention*)ve;
+	
+	return (push16(mve->value1, ppWritePackedMsg, end) &&
+			push32(mve->value2, ppWritePackedMsg, end));
+
+}
+
+uint8_t gTestNfapiMessageTx[MAX_PACKED_MESSAGE_SIZE];
+
+
+uint8_t rand8(uint8_t min, uint8_t max)
+{
+	return ((rand() % (max + 1 - min)) + min);
+}
+
+/************* Test case functions ****************/
+
+void test_case_sample(void)
+{
+	/*Sample assert function, use as per your test case scenario.*/
+	CU_ASSERT(CU_TRUE);
+	CU_ASSERT_NOT_EQUAL(2, -1);
+	CU_ASSERT_STRING_EQUAL("string #1", "string #1");
+	CU_ASSERT_STRING_NOT_EQUAL("string #1", "string #2");
+
+	CU_ASSERT(CU_FALSE);
+	CU_ASSERT_EQUAL(2, 3);
+	CU_ASSERT_STRING_NOT_EQUAL("string #1", "string #1");
+	CU_ASSERT_STRING_EQUAL("string #1", "string #2");
+}
+
+
+int nfapi_test_verify_configreq_params(nfapi_pnf_config_request_t pnfConfigRequest_in, nfapi_pnf_config_request_t pnfConfigRequest_out)
+{
+	int i=0;
+	if(memcmp(&pnfConfigRequest_in, &pnfConfigRequest_out, sizeof(nfapi_pnf_config_request_t)) == 0)
+	{	
+		/*packed and unpacked phy config request are matched.*/
+
+		printf("Success: packed and unpacked phy config request are matched\n");
+		return 1;
+	}
+	else
+	{
+		if (pnfConfigRequest_in.header.message_id != pnfConfigRequest_out.header.message_id)
+		{
+			printf("Mismatch: packed message id %d, unpacked message id %d\n",
+					pnfConfigRequest_in.header.message_id, pnfConfigRequest_out.header.message_id);
+		}
+		if (pnfConfigRequest_in.header.message_length != pnfConfigRequest_out.header.message_length)
+		{
+			printf("Mismatch: packed message_length %d, unpacked message_length %d\n",
+					pnfConfigRequest_in.header.message_length, pnfConfigRequest_out.header.message_length);
+		}
+		if (pnfConfigRequest_in.header.phy_id != pnfConfigRequest_out.header.phy_id)
+		{
+			printf("Mismatch: packed phy_id %d, unpacked phy_id %d\n",
+					pnfConfigRequest_in.header.phy_id, pnfConfigRequest_out.header.phy_id);
+		}
+		if (pnfConfigRequest_in.pnf_phy_rf_config.number_phy_rf_config_info != pnfConfigRequest_out.pnf_phy_rf_config.number_phy_rf_config_info)			
+		{
+			printf("Mismatch: packed number_phy_rf_config_info %d, unpacked number_phy_rf_config_info %d\n",
+					pnfConfigRequest_in.pnf_phy_rf_config.number_phy_rf_config_info, pnfConfigRequest_out.pnf_phy_rf_config.number_phy_rf_config_info);
+		}
+
+		for (i=0; i < NFAPI_MAX_PHY_RF_INSTANCES; i++) 
+		{
+			if (pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[i].phy_id != pnfConfigRequest_out.pnf_phy_rf_config.phy_rf_config[i].phy_id)			
+			{
+				printf("Mismatch: rf idx %d, packed phy id %d, unpacked phy id %d\n",
+						i, pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[i].phy_id, pnfConfigRequest_out.pnf_phy_rf_config.phy_rf_config[i].phy_id);
+			}
+			if (pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[i].phy_config_index!= pnfConfigRequest_out.pnf_phy_rf_config.phy_rf_config[i].phy_config_index)			
+			{
+				printf("Mismatch: rf idx %d, packed phy_config_index %d, unpacked phy_config_index %d\n",
+						i, pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[i].phy_config_index, pnfConfigRequest_out.pnf_phy_rf_config.phy_rf_config[i].phy_config_index);
+			}
+			if (pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[i].rf_config_index != pnfConfigRequest_out.pnf_phy_rf_config.phy_rf_config[i].rf_config_index)			
+			{
+				printf("Mismatch: rf idx %d, packed rf_config_index %d, unpacked rf_config_index %d\n",
+						i, pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[i].rf_config_index, pnfConfigRequest_out.pnf_phy_rf_config.phy_rf_config[i].rf_config_index);
+			}
+		}
+		return 0;
+	}
+
+}
+
+
+void nfapi_test_pnf_config_req(void) 
+{
+
+	nfapi_pnf_config_request_t pnfConfigRequest_out;
+	nfapi_pnf_config_request_t pnfConfigRequest_in;
+	int packedMessageLength =0;
+
+	printf(" nfapi_test_pnf_config_req run \n");
+
+	/* Build phy config req */
+	pnfConfigRequest_in.header.phy_id = NFAPI_PHY_ID_NA;
+	pnfConfigRequest_in.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
+	pnfConfigRequest_in.header.message_length = 22;
+	pnfConfigRequest_in.header.spare = 0;
+
+	pnfConfigRequest_in.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
+	pnfConfigRequest_in.pnf_phy_rf_config.tl.length = 0;
+	pnfConfigRequest_in.pnf_phy_rf_config.number_phy_rf_config_info = 2;
+	pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[0].phy_id = 4;
+	pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[0].phy_config_index = 1;
+	pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[0].rf_config_index = 1;
+	pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[1].phy_id = 5;
+	pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[1].phy_config_index = 2;
+	pnfConfigRequest_in.pnf_phy_rf_config.phy_rf_config[1].rf_config_index = 2;
+
+	/*Pack pnf config req*/
+	packedMessageLength = nfapi_p5_message_pack(&pnfConfigRequest_in, sizeof(nfapi_pnf_config_request_t), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	/*Unpack pnf config request*/
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &pnfConfigRequest_out, sizeof(nfapi_pnf_config_request_t), 0);
+
+	/*Verify unpacked message*/
+	CU_ASSERT_EQUAL(nfapi_test_verify_configreq_params(pnfConfigRequest_in, pnfConfigRequest_out), 1);  
+
+}
+
+void nfapi_test_2(void) {
+	/*Sample test function*/
+	CU_ASSERT_EQUAL( 0, 0);
+}
+
+void nfapi_test_rssi_request_lte()
+{
+	uint16_t idx;
+	nfapi_rssi_request_t in;
+	nfapi_rssi_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RSSI_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_LTE;
+
+	in.lte_rssi_request.tl.tag = NFAPI_LTE_RSSI_REQUEST_TAG;
+	in.lte_rssi_request.frequency_band_indicator = 0;
+	in.lte_rssi_request.bandwidth = 0;
+	in.lte_rssi_request.timeout = 0;
+	in.lte_rssi_request.number_of_earfcns = 4;
+	in.lte_rssi_request.earfcn[0] = 42;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	int upack_result = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, -1);
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, 0);
+	CU_ASSERT_NOT_EQUAL(upack_result, 0);
+	CU_ASSERT_NOT_EQUAL(upack_result, -1);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.lte_rssi_request.frequency_band_indicator, out.lte_rssi_request.frequency_band_indicator);
+	CU_ASSERT_EQUAL(in.lte_rssi_request.bandwidth, out.lte_rssi_request.bandwidth);
+	CU_ASSERT_EQUAL(in.lte_rssi_request.timeout, out.lte_rssi_request.timeout);
+	CU_ASSERT_EQUAL(in.lte_rssi_request.number_of_earfcns, out.lte_rssi_request.number_of_earfcns);
+
+	for(idx = 0; idx < out.lte_rssi_request.number_of_earfcns; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.lte_rssi_request.earfcn[idx], out.lte_rssi_request.earfcn[idx]);
+	}
+}
+
+void nfapi_test_rssi_request_lte2()
+{
+	uint16_t idx;
+	nfapi_rssi_request_t in;
+	nfapi_rssi_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RSSI_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_LTE;
+
+	in.lte_rssi_request.tl.tag = NFAPI_LTE_RSSI_REQUEST_TAG;
+	in.lte_rssi_request.frequency_band_indicator = 0;
+	in.lte_rssi_request.bandwidth = 0;
+	in.lte_rssi_request.timeout = 0;
+	in.lte_rssi_request.number_of_earfcns = 4;
+	in.lte_rssi_request.earfcn[0] = 42;
+
+	// try and pak with a buffer that is too small
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, NFAPI_HEADER_LENGTH + 4, 0);
+	CU_ASSERT_EQUAL(packedMessageLength, -1);
+
+	// pack correctly
+	packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	// unpack with a small bufer
+	int upack_result = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength - 1, &out, sizeof(out), 0);
+
+	upack_result = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, -1);
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, 0);
+	CU_ASSERT_NOT_EQUAL(upack_result, 0);
+	CU_ASSERT_NOT_EQUAL(upack_result, -1);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.lte_rssi_request.frequency_band_indicator, out.lte_rssi_request.frequency_band_indicator);
+	CU_ASSERT_EQUAL(in.lte_rssi_request.bandwidth, out.lte_rssi_request.bandwidth);
+	CU_ASSERT_EQUAL(in.lte_rssi_request.timeout, out.lte_rssi_request.timeout);
+	CU_ASSERT_EQUAL(in.lte_rssi_request.number_of_earfcns, out.lte_rssi_request.number_of_earfcns);
+
+	for(idx = 0; idx < out.lte_rssi_request.number_of_earfcns; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.lte_rssi_request.earfcn[idx], out.lte_rssi_request.earfcn[idx]);
+	}
+}
+
+
+
+// Test decoding of message which has a large number if earfcn which could
+// cause a buffer over run if not handled
+void nfapi_test_rssi_request_lte_overrun()
+{
+	nfapi_rssi_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t* end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_RSSI_REQUEST, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push8(NFAPI_RAT_TYPE_LTE, &p, end);
+	push16(NFAPI_LTE_RSSI_REQUEST_TAG, &p, end);
+	push16(11, &p, end);
+
+	push8(0, &p, end);
+	push16(0, &p, end);
+	push8(0, &p, end);
+	push32(0, &p, end);
+	push8(123, &p, end); // to many EARFCN's
+	push16(16, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, sizeof(buffer), &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+
+void nfapi_test_rssi_request_lte_rat_type_mismatch()
+{
+	nfapi_rssi_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_RSSI_REQUEST, &p, end);
+	push16(16, &p, end);
+	push16(0, &p, end);
+
+	push8(NFAPI_RAT_TYPE_GERAN, &p, end);
+
+	push16(NFAPI_LTE_RSSI_REQUEST_TAG, &p, end);
+	push16(11, &p, end);
+
+	push8(0, &p, end);
+	push16(0, &p, end);
+	push8(0, &p, end);
+	push32(0, &p, end);
+	push8(1, &p, end);
+	push16(16, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, sizeof(buffer), &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+
+void nfapi_test_rssi_request_utran()
+{
+	uint16_t idx;
+	nfapi_rssi_request_t in;
+	nfapi_rssi_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RSSI_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_UTRAN;
+
+
+	in.utran_rssi_request.tl.tag = NFAPI_UTRAN_RSSI_REQUEST_TAG;
+	in.utran_rssi_request.frequency_band_indicator = 0;
+	in.utran_rssi_request.measurement_period = 0;
+	in.utran_rssi_request.timeout = 0;
+	in.utran_rssi_request.number_of_uarfcns = 3;
+	in.utran_rssi_request.uarfcn[0] = 42;
+	in.utran_rssi_request.uarfcn[1] = 42;
+	in.utran_rssi_request.uarfcn[2] = 42;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.utran_rssi_request.frequency_band_indicator, out.utran_rssi_request.frequency_band_indicator);
+	CU_ASSERT_EQUAL(in.utran_rssi_request.measurement_period, out.utran_rssi_request.measurement_period);
+	CU_ASSERT_EQUAL(in.utran_rssi_request.timeout, out.utran_rssi_request.timeout);
+	CU_ASSERT_EQUAL(in.utran_rssi_request.number_of_uarfcns, out.utran_rssi_request.number_of_uarfcns);
+
+	for(idx = 0; idx < out.utran_rssi_request.number_of_uarfcns; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.utran_rssi_request.uarfcn[idx], out.utran_rssi_request.uarfcn[idx]);
+	}
+
+}
+
+void nfapi_test_rssi_request_geran()
+{
+	uint16_t idx;
+	nfapi_rssi_request_t in;
+	nfapi_rssi_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RSSI_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_GERAN;
+
+	in.geran_rssi_request.tl.tag = NFAPI_GERAN_RSSI_REQUEST_TAG;
+	in.geran_rssi_request.frequency_band_indicator = 0;
+	in.geran_rssi_request.measurement_period = 0;
+	in.geran_rssi_request.timeout = 0;
+	in.geran_rssi_request.number_of_arfcns = 3;
+	in.geran_rssi_request.arfcn[0].arfcn = 42;
+	in.geran_rssi_request.arfcn[0].direction = 0;
+	in.geran_rssi_request.arfcn[1].arfcn = 42;
+	in.geran_rssi_request.arfcn[1].direction = 1;
+	in.geran_rssi_request.arfcn[2].arfcn = 42;
+	in.geran_rssi_request.arfcn[2].direction = 1;
+
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.geran_rssi_request.frequency_band_indicator, out.geran_rssi_request.frequency_band_indicator);
+	CU_ASSERT_EQUAL(in.geran_rssi_request.measurement_period, out.geran_rssi_request.measurement_period);
+	CU_ASSERT_EQUAL(in.geran_rssi_request.timeout, out.geran_rssi_request.timeout);
+	CU_ASSERT_EQUAL(in.geran_rssi_request.number_of_arfcns, out.geran_rssi_request.number_of_arfcns);
+
+	for(idx = 0; idx < out.geran_rssi_request.number_of_arfcns; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.geran_rssi_request.arfcn[idx].arfcn, out.geran_rssi_request.arfcn[idx].arfcn);
+		CU_ASSERT_EQUAL(in.geran_rssi_request.arfcn[idx].direction, out.geran_rssi_request.arfcn[idx].direction);
+	}
+}
+
+void nfapi_test_rssi_request_nb_iot()
+{
+	uint16_t idx, idx2;
+	nfapi_rssi_request_t in;
+	nfapi_rssi_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RSSI_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_NB_IOT;
+
+	in.nb_iot_rssi_request.tl.tag = NFAPI_NB_IOT_RSSI_REQUEST_TAG;
+	in.nb_iot_rssi_request.frequency_band_indicator = 34;
+	in.nb_iot_rssi_request.measurement_period = 900;
+	in.nb_iot_rssi_request.timeout = 4321;
+	in.nb_iot_rssi_request.number_of_earfcns = 3;
+	in.nb_iot_rssi_request.earfcn[0].earfcn = 42;
+	in.nb_iot_rssi_request.earfcn[0].number_of_ro_dl = 1;
+	in.nb_iot_rssi_request.earfcn[0].ro_dl[0] = 2;
+	in.nb_iot_rssi_request.earfcn[1].earfcn = 43;
+	in.nb_iot_rssi_request.earfcn[1].number_of_ro_dl = 0;
+	in.nb_iot_rssi_request.earfcn[2].earfcn = 44;
+	in.nb_iot_rssi_request.earfcn[2].number_of_ro_dl = 2;
+	in.nb_iot_rssi_request.earfcn[2].ro_dl[0] = 0;
+	in.nb_iot_rssi_request.earfcn[2].ro_dl[1] = 4;
+
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	IN_OUT_ASSERT(header.message_id);
+	IN_OUT_ASSERT(rat_type);
+	IN_OUT_ASSERT(nb_iot_rssi_request.frequency_band_indicator);
+	IN_OUT_ASSERT(nb_iot_rssi_request.measurement_period);
+	IN_OUT_ASSERT(nb_iot_rssi_request.timeout);
+	IN_OUT_ASSERT(nb_iot_rssi_request.number_of_earfcns);
+
+	for(idx = 0; idx < out.nb_iot_rssi_request.number_of_earfcns; ++idx)
+	{
+		IN_OUT_ASSERT(nb_iot_rssi_request.earfcn[idx].earfcn);
+		IN_OUT_ASSERT(nb_iot_rssi_request.earfcn[idx].number_of_ro_dl);
+		
+		for(idx2 = 0; idx2 < out.nb_iot_rssi_request.earfcn[idx].number_of_ro_dl; ++idx2)
+			IN_OUT_ASSERT(nb_iot_rssi_request.earfcn[idx].ro_dl[idx2]);
+	}
+}
+
+
+void nfapi_test_rssi_response()
+{
+	nfapi_rssi_response_t in;
+	nfapi_rssi_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RSSI_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+
+}
+
+void nfapi_test_rssi_indication()
+{
+	uint16_t idx = 0;
+	nfapi_rssi_indication_t in;
+	nfapi_rssi_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RSSI_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_OK;
+	in.rssi_indication_body.tl.tag = NFAPI_RSSI_INDICATION_TAG;
+	in.rssi_indication_body.tl.length = 0;
+	in.rssi_indication_body.number_of_rssi = 4;
+	in.rssi_indication_body.rssi[0] = 2;
+	in.rssi_indication_body.rssi[1] = 0;
+	in.rssi_indication_body.rssi[2] = -23;
+	in.rssi_indication_body.rssi[3] = -18000;
+
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.rssi_indication_body.tl.tag, out.rssi_indication_body.tl.tag);
+	CU_ASSERT_EQUAL(in.rssi_indication_body.number_of_rssi, out.rssi_indication_body.number_of_rssi);
+
+	for(idx = 0; idx < out.rssi_indication_body.number_of_rssi; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.rssi_indication_body.rssi[idx], out.rssi_indication_body.rssi[idx]);
+	}
+
+}
+void nfapi_test_rssi_indication_overrun()
+{
+	nfapi_rssi_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_RSSI_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error code
+
+	push16(NFAPI_RSSI_INDICATION_TAG, &p, end);
+	push16(11, &p, end);
+
+	push16(NFAPI_MAX_RSSI + 23, &p, end); // to many EARFCN's
+	push16(16, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, sizeof(buffer), &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+
+void nfapi_test_cell_search_request_lte()
+{
+	uint16_t idx;
+	nfapi_cell_search_request_t in;
+	nfapi_cell_search_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_LTE;
+
+	in.lte_cell_search_request.tl.tag = NFAPI_LTE_CELL_SEARCH_REQUEST_TAG;
+	in.lte_cell_search_request.earfcn = 213;
+	in.lte_cell_search_request.measurement_bandwidth = 1;
+	in.lte_cell_search_request.exhaustive_search = 0;
+	in.lte_cell_search_request.timeout = 123;
+	in.lte_cell_search_request.number_of_pci = 3;
+	in.lte_cell_search_request.pci[0] = 3;
+	in.lte_cell_search_request.pci[1] = 6;
+	in.lte_cell_search_request.pci[2] = 9;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.lte_cell_search_request.earfcn, out.lte_cell_search_request.earfcn);
+	CU_ASSERT_EQUAL(in.lte_cell_search_request.measurement_bandwidth, out.lte_cell_search_request.measurement_bandwidth);
+	CU_ASSERT_EQUAL(in.lte_cell_search_request.exhaustive_search, out.lte_cell_search_request.exhaustive_search);
+	CU_ASSERT_EQUAL(in.lte_cell_search_request.timeout, out.lte_cell_search_request.timeout);
+	CU_ASSERT_EQUAL(in.lte_cell_search_request.number_of_pci, out.lte_cell_search_request.number_of_pci);
+
+	for(idx = 0; idx < out.lte_cell_search_request.number_of_pci; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.lte_cell_search_request.pci[idx], out.lte_cell_search_request.pci[idx]);
+	}
+}
+
+void nfapi_test_cell_search_request_utran()
+{
+	uint16_t idx;
+	nfapi_cell_search_request_t in;
+	nfapi_cell_search_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_UTRAN;
+
+	in.utran_cell_search_request.tl.tag = NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG;
+	in.utran_cell_search_request.uarfcn = 213;
+	in.utran_cell_search_request.exhaustive_search = 0;
+	in.utran_cell_search_request.timeout = 123;
+	in.utran_cell_search_request.number_of_psc = 3;
+	in.utran_cell_search_request.psc[0] = 3;
+	in.utran_cell_search_request.psc[1] = 6;
+	in.utran_cell_search_request.psc[2] = 9;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	int unpackResult = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_NOT_EQUAL(unpackResult, -1);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.utran_cell_search_request.uarfcn, out.utran_cell_search_request.uarfcn);
+	CU_ASSERT_EQUAL(in.utran_cell_search_request.exhaustive_search, out.utran_cell_search_request.exhaustive_search);
+	CU_ASSERT_EQUAL(in.utran_cell_search_request.timeout, out.utran_cell_search_request.timeout);
+	CU_ASSERT_EQUAL(in.utran_cell_search_request.number_of_psc, out.utran_cell_search_request.number_of_psc);
+
+	for(idx = 0; idx < out.utran_cell_search_request.number_of_psc; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.utran_cell_search_request.psc[idx], out.utran_cell_search_request.psc[idx]);
+	}
+}
+
+void nfapi_test_cell_search_request_geran()
+{
+	uint16_t idx;
+	nfapi_cell_search_request_t in;
+	nfapi_cell_search_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_GERAN;
+
+	in.geran_cell_search_request.tl.tag = NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG;
+	in.geran_cell_search_request.timeout = 123;
+	in.geran_cell_search_request.number_of_arfcn = 3;
+	in.geran_cell_search_request.arfcn[0] = 3;
+	in.geran_cell_search_request.arfcn[1] = 6;
+	in.geran_cell_search_request.arfcn[2] = 9;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	int unpackResult = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_NOT_EQUAL(unpackResult, -1);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.geran_cell_search_request.timeout, out.geran_cell_search_request.timeout);
+	CU_ASSERT_EQUAL(in.geran_cell_search_request.number_of_arfcn, out.geran_cell_search_request.number_of_arfcn);
+
+	for(idx = 0; idx < out.geran_cell_search_request.number_of_arfcn; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.geran_cell_search_request.arfcn[idx], out.geran_cell_search_request.arfcn[idx]);
+	}
+}
+
+void nfapi_test_cell_search_request_nb_iot()
+{
+	uint16_t idx;
+	nfapi_cell_search_request_t in;
+	nfapi_cell_search_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_NB_IOT;
+
+	in.nb_iot_cell_search_request.tl.tag = NFAPI_NB_IOT_CELL_SEARCH_REQUEST_TAG;
+	in.nb_iot_cell_search_request.earfcn = 54;
+	in.nb_iot_cell_search_request.ro_dl = 3;
+	in.nb_iot_cell_search_request.exhaustive_search = 1;
+	in.nb_iot_cell_search_request.timeout = 123;
+	in.nb_iot_cell_search_request.number_of_pci = 3;
+	in.nb_iot_cell_search_request.pci[0] = 3;
+	in.nb_iot_cell_search_request.pci[1] = 6;
+	in.nb_iot_cell_search_request.pci[2] = 9;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	int unpackResult = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_NOT_EQUAL(unpackResult, -1);
+
+	IN_OUT_ASSERT(header.message_id);
+	IN_OUT_ASSERT(rat_type);
+	IN_OUT_ASSERT(nb_iot_cell_search_request.earfcn);
+	IN_OUT_ASSERT(nb_iot_cell_search_request.ro_dl);
+	IN_OUT_ASSERT(nb_iot_cell_search_request.exhaustive_search);
+	IN_OUT_ASSERT(nb_iot_cell_search_request.timeout);
+	IN_OUT_ASSERT(nb_iot_cell_search_request.number_of_pci);
+
+	for(idx = 0; idx < out.nb_iot_cell_search_request.number_of_pci; ++idx)
+	{
+		IN_OUT_ASSERT(nb_iot_cell_search_request.pci[idx]);
+	}
+}
+
+void nfapi_test_cell_search_response()
+{
+	nfapi_cell_search_response_t in;
+	nfapi_cell_search_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+
+void nfapi_test_cell_search_indication_lte()
+{
+	uint16_t idx = 0;
+	nfapi_cell_search_indication_t in;
+	nfapi_cell_search_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_OK;
+	in.lte_cell_search_indication.tl.tag = NFAPI_LTE_CELL_SEARCH_INDICATION_TAG;
+	in.lte_cell_search_indication.number_of_lte_cells_found = 2;
+	in.lte_cell_search_indication.lte_found_cells[0].pci = 0;
+	in.lte_cell_search_indication.lte_found_cells[0].rsrp = 42;
+	in.lte_cell_search_indication.lte_found_cells[0].rsrq= 11;
+	in.lte_cell_search_indication.lte_found_cells[0].frequency_offset = -100;
+
+	in.lte_cell_search_indication.lte_found_cells[1].pci = 123;
+	in.lte_cell_search_indication.lte_found_cells[1].rsrp = 2;
+	in.lte_cell_search_indication.lte_found_cells[1].rsrq= 17;
+	in.lte_cell_search_indication.lte_found_cells[1].frequency_offset = 123;
+
+	in.utran_cell_search_indication.tl.tag = 0;
+	in.geran_cell_search_indication.tl.tag = 0;
+	in.nb_iot_cell_search_indication.tl.tag = 0;
+	in.pnf_cell_search_state.tl.tag = 0;
+
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_cell_search_indication.tl.tag, out.lte_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.lte_cell_search_indication.number_of_lte_cells_found, out.lte_cell_search_indication.number_of_lte_cells_found);
+
+	for(idx = 0; idx < out.lte_cell_search_indication.number_of_lte_cells_found; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.lte_cell_search_indication.lte_found_cells[idx].pci, out.lte_cell_search_indication.lte_found_cells[idx].pci);
+		CU_ASSERT_EQUAL(in.lte_cell_search_indication.lte_found_cells[idx].rsrp, out.lte_cell_search_indication.lte_found_cells[idx].rsrp);
+		CU_ASSERT_EQUAL(in.lte_cell_search_indication.lte_found_cells[idx].rsrq, out.lte_cell_search_indication.lte_found_cells[idx].rsrq);
+		CU_ASSERT_EQUAL(in.lte_cell_search_indication.lte_found_cells[idx].frequency_offset, out.lte_cell_search_indication.lte_found_cells[idx].frequency_offset);
+	}
+
+
+	CU_ASSERT_EQUAL(in.utran_cell_search_indication.tl.tag, out.utran_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.geran_cell_search_indication.tl.tag, out.geran_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_search_state.tl.tag, out.pnf_cell_search_state.tl.tag);
+}
+void nfapi_test_cell_search_indication_utran()
+{
+	uint16_t idx = 0;
+	nfapi_cell_search_indication_t in;
+	nfapi_cell_search_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_OK;
+	in.utran_cell_search_indication.tl.tag = NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG;
+	in.utran_cell_search_indication.number_of_utran_cells_found = 1;
+	in.utran_cell_search_indication.utran_found_cells[0].psc = 123;
+	in.utran_cell_search_indication.utran_found_cells[0].rscp = 2;
+	in.utran_cell_search_indication.utran_found_cells[0].ecno = 89;
+	in.utran_cell_search_indication.utran_found_cells[0].frequency_offset = -1000;
+
+	in.lte_cell_search_indication.tl.tag = 0;
+	in.geran_cell_search_indication.tl.tag = 0;
+	in.nb_iot_cell_search_indication.tl.tag = 0;
+	in.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+	in.pnf_cell_search_state.length = 12;
+	in.pnf_cell_search_state.value[0] = 34;
+	in.pnf_cell_search_state.value[1] = 35;
+	in.pnf_cell_search_state.value[2] = 36;
+	in.pnf_cell_search_state.value[3] = 37;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.utran_cell_search_indication.tl.tag, out.utran_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_cell_search_indication.number_of_utran_cells_found, out.utran_cell_search_indication.number_of_utran_cells_found);
+
+	for(idx = 0; idx < out.utran_cell_search_indication.number_of_utran_cells_found; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.utran_cell_search_indication.utran_found_cells[idx].psc, out.utran_cell_search_indication.utran_found_cells[idx].psc);
+		CU_ASSERT_EQUAL(in.utran_cell_search_indication.utran_found_cells[idx].rscp, out.utran_cell_search_indication.utran_found_cells[idx].rscp);
+		CU_ASSERT_EQUAL(in.utran_cell_search_indication.utran_found_cells[idx].ecno, out.utran_cell_search_indication.utran_found_cells[idx].ecno);
+		CU_ASSERT_EQUAL(in.utran_cell_search_indication.utran_found_cells[idx].frequency_offset, out.utran_cell_search_indication.utran_found_cells[idx].frequency_offset);
+	}
+
+	CU_ASSERT_EQUAL(in.lte_cell_search_indication.tl.tag, out.lte_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.geran_cell_search_indication.tl.tag, out.geran_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_search_state.tl.tag, out.pnf_cell_search_state.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_search_state.length, out.pnf_cell_search_state.length);
+
+	for(idx = 0; idx < out.pnf_cell_search_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_search_state.value[idx], out.pnf_cell_search_state.value[idx]);
+	}
+}
+void nfapi_test_cell_search_indication_geran()
+{
+	uint16_t idx = 0;
+	nfapi_cell_search_indication_t in;
+	nfapi_cell_search_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_OK;
+	in.geran_cell_search_indication.tl.tag = NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG;
+	in.geran_cell_search_indication.number_of_gsm_cells_found = 1;
+	in.geran_cell_search_indication.gsm_found_cells[0].arfcn = 123;
+	in.geran_cell_search_indication.gsm_found_cells[0].bsic = 2;
+	in.geran_cell_search_indication.gsm_found_cells[0].rxlev = 89;
+	in.geran_cell_search_indication.gsm_found_cells[0].rxqual = 12;
+	in.geran_cell_search_indication.gsm_found_cells[0].frequency_offset = 2389;
+	in.geran_cell_search_indication.gsm_found_cells[0].sfn_offset = 23;
+
+	in.lte_cell_search_indication.tl.tag = 0;
+	in.utran_cell_search_indication.tl.tag = 0;
+	in.nb_iot_cell_search_indication.tl.tag = 0;
+	in.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+	in.pnf_cell_search_state.length = 63;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.geran_cell_search_indication.tl.tag, out.geran_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.geran_cell_search_indication.number_of_gsm_cells_found, out.geran_cell_search_indication.number_of_gsm_cells_found);
+
+	for(idx = 0; idx < out.geran_cell_search_indication.number_of_gsm_cells_found; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.geran_cell_search_indication.gsm_found_cells[idx].arfcn, out.geran_cell_search_indication.gsm_found_cells[idx].arfcn);
+		CU_ASSERT_EQUAL(in.geran_cell_search_indication.gsm_found_cells[idx].bsic, out.geran_cell_search_indication.gsm_found_cells[idx].bsic);
+		CU_ASSERT_EQUAL(in.geran_cell_search_indication.gsm_found_cells[idx].rxlev, out.geran_cell_search_indication.gsm_found_cells[idx].rxlev);
+		CU_ASSERT_EQUAL(in.geran_cell_search_indication.gsm_found_cells[idx].rxqual, out.geran_cell_search_indication.gsm_found_cells[idx].rxqual);
+		CU_ASSERT_EQUAL(in.geran_cell_search_indication.gsm_found_cells[idx].frequency_offset, out.geran_cell_search_indication.gsm_found_cells[idx].frequency_offset);
+		CU_ASSERT_EQUAL(in.geran_cell_search_indication.gsm_found_cells[idx].sfn_offset, out.geran_cell_search_indication.gsm_found_cells[idx].sfn_offset);
+	}
+
+	CU_ASSERT_EQUAL(in.lte_cell_search_indication.tl.tag, out.lte_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_cell_search_indication.tl.tag, out.utran_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.nb_iot_cell_search_indication.tl.tag, out.nb_iot_cell_search_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_search_state.tl.tag, out.pnf_cell_search_state.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_search_state.length, out.pnf_cell_search_state.length);
+
+	for(idx = 0; idx < out.pnf_cell_search_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_search_state.value[idx], out.pnf_cell_search_state.value[idx]);
+	}
+}
+
+void nfapi_test_cell_search_indication_nb_iot()
+{
+	uint16_t idx = 0;
+	nfapi_cell_search_indication_t in;
+	nfapi_cell_search_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CELL_SEARCH_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_OK;
+	in.nb_iot_cell_search_indication.tl.tag = NFAPI_NB_IOT_CELL_SEARCH_INDICATION_TAG;
+	in.nb_iot_cell_search_indication.number_of_nb_iot_cells_found = 1;
+	in.nb_iot_cell_search_indication.nb_iot_found_cells[0].pci = 123;
+	in.nb_iot_cell_search_indication.nb_iot_found_cells[0].rsrp = 2;
+	in.nb_iot_cell_search_indication.nb_iot_found_cells[0].rsrq = 89;
+	in.nb_iot_cell_search_indication.nb_iot_found_cells[0].frequency_offset = 2389;
+
+	in.lte_cell_search_indication.tl.tag = 0;
+	in.utran_cell_search_indication.tl.tag = 0;
+	in.geran_cell_search_indication.tl.tag = 0;
+	
+	in.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+	in.pnf_cell_search_state.length = 63;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	IN_OUT_ASSERT(header.message_id);
+	IN_OUT_ASSERT(error_code);
+	IN_OUT_ASSERT(nb_iot_cell_search_indication.tl.tag);
+	IN_OUT_ASSERT(nb_iot_cell_search_indication.number_of_nb_iot_cells_found);
+
+	for(idx = 0; idx < out.nb_iot_cell_search_indication.number_of_nb_iot_cells_found; ++idx)
+	{
+		IN_OUT_ASSERT(nb_iot_cell_search_indication.nb_iot_found_cells[idx].pci);
+		IN_OUT_ASSERT(nb_iot_cell_search_indication.nb_iot_found_cells[idx].rsrp);
+		IN_OUT_ASSERT(nb_iot_cell_search_indication.nb_iot_found_cells[idx].rsrq);
+		IN_OUT_ASSERT(nb_iot_cell_search_indication.nb_iot_found_cells[idx].frequency_offset);
+	}
+
+	IN_OUT_ASSERT(lte_cell_search_indication.tl.tag);
+	IN_OUT_ASSERT(utran_cell_search_indication.tl.tag);
+	IN_OUT_ASSERT(geran_cell_search_indication.tl.tag);
+	IN_OUT_ASSERT(pnf_cell_search_state.tl.tag);
+	IN_OUT_ASSERT(pnf_cell_search_state.length);
+	
+	for(idx = 0; idx < out.pnf_cell_search_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_search_state.value[idx], out.pnf_cell_search_state.value[idx]);
+	}
+}
+
+void nfapi_test_cell_search_request_lte_overrun()
+{
+	nfapi_cell_search_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_CELL_SEARCH_REQUEST, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push8(0, &p, end); // rat_type
+
+	push16(NFAPI_LTE_CELL_SEARCH_REQUEST_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(11, &p, end);
+	push8(11, &p, end);
+	push8(11, &p, end);
+	push32(11, &p, end);
+	push8(NFAPI_MAX_PCI_LIST + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+
+}
+void nfapi_test_cell_search_request_utran_overrun()
+{
+	nfapi_cell_search_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_CELL_SEARCH_REQUEST, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push8(NFAPI_RAT_TYPE_UTRAN, &p, end); // rat_type
+
+	push16(NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(11, &p, end);
+	push8(11, &p, end);
+	push32(11, &p, end);
+	push8(NFAPI_MAX_PSC_LIST + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_cell_search_request_geran_overrun()
+{
+	nfapi_cell_search_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_CELL_SEARCH_REQUEST, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push8(NFAPI_RAT_TYPE_GERAN, &p, end); // rat_type
+
+	push16(NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG, &p, end);
+	push16(8, &p, end);
+
+	push32(11, &p, end);
+	push8(NFAPI_MAX_ARFCN_LIST + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_cell_search_indication_lte_overrun()
+{
+	nfapi_cell_search_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_CELL_SEARCH_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error_code
+
+	push16(NFAPI_LTE_CELL_SEARCH_INDICATION_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(NFAPI_MAX_LTE_CELLS_FOUND + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_cell_search_indication_utran_overrun()
+{
+	nfapi_cell_search_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_CELL_SEARCH_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error_code
+
+	push16(NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(NFAPI_MAX_UTRAN_CELLS_FOUND + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_cell_search_indication_geran_overrun()
+{
+	nfapi_cell_search_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_CELL_SEARCH_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error_code
+
+	push16(NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(NFAPI_MAX_GSM_CELLS_FOUND + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_cell_search_indication_state_overrun()
+{
+	nfapi_cell_search_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_CELL_SEARCH_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error_code
+
+	push16(NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG, &p, end);
+	push16(13, &p, end);
+
+	push16(1, &p, end);
+	if(1)
+	{
+		push16(42, &p, end);
+		push8(42, &p, end);
+		push8(42, &p, end);
+		push8(42, &p, end);
+		pushs16(42, &p, end);
+		push32(42, &p, end);
+	}
+
+	push16(NFAPI_PNF_CELL_SEARCH_STATE_TAG, &p, end);
+	push16(NFAPI_MAX_OPAQUE_DATA + 12, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_broadcast_detect_request_lte()
+{
+	nfapi_broadcast_detect_request_t in;
+	nfapi_broadcast_detect_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_LTE;
+
+	in.lte_broadcast_detect_request.tl.tag = NFAPI_LTE_BROADCAST_DETECT_REQUEST_TAG;
+	in.lte_broadcast_detect_request.earfcn = 123;
+	in.lte_broadcast_detect_request.pci = 12;
+	in.lte_broadcast_detect_request.timeout = 1246;
+
+	in.pnf_cell_search_state.tl.tag = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	int unpackResult = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_NOT_EQUAL(unpackResult, -1);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_request.earfcn, out.lte_broadcast_detect_request.earfcn);
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_request.pci, out.lte_broadcast_detect_request.pci);
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_request.timeout, out.lte_broadcast_detect_request.timeout);
+
+}
+void nfapi_test_broadcast_detect_request_utran()
+{
+	uint16_t idx;
+	nfapi_broadcast_detect_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_broadcast_detect_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_UTRAN;
+
+	in.utran_broadcast_detect_request.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG;
+	in.utran_broadcast_detect_request.uarfcn = 123;
+	in.utran_broadcast_detect_request.psc = 12;
+	in.utran_broadcast_detect_request.timeout = 1246;
+
+	in.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+	in.pnf_cell_search_state.length = 60;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, 0);
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, -1);
+
+	int unpackResult = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_NOT_EQUAL(unpackResult, 0);
+	CU_ASSERT_NOT_EQUAL(unpackResult, -1);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.utran_broadcast_detect_request.uarfcn, out.utran_broadcast_detect_request.uarfcn);
+	CU_ASSERT_EQUAL(in.utran_broadcast_detect_request.psc, out.utran_broadcast_detect_request.psc);
+	CU_ASSERT_EQUAL(in.utran_broadcast_detect_request.timeout, out.utran_broadcast_detect_request.timeout);
+
+	CU_ASSERT_EQUAL(in.pnf_cell_search_state.length, out.pnf_cell_search_state.length);
+
+	for(idx = 0; idx < out.pnf_cell_search_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_search_state.value[idx], out.pnf_cell_search_state.value[idx]);
+	}
+
+}
+
+void nfapi_test_broadcast_detect_request_nb_iot()
+{
+	uint16_t idx;
+	nfapi_broadcast_detect_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_broadcast_detect_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_NB_IOT;
+
+	in.nb_iot_broadcast_detect_request.tl.tag = NFAPI_NB_IOT_BROADCAST_DETECT_REQUEST_TAG;
+	in.nb_iot_broadcast_detect_request.earfcn = 123;
+	in.nb_iot_broadcast_detect_request.ro_dl = 12;
+	in.nb_iot_broadcast_detect_request.pci = 12;
+	in.nb_iot_broadcast_detect_request.timeout = 1246;
+
+	in.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+	in.pnf_cell_search_state.length = 60;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, 0);
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, -1);
+
+	int unpackResult = nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_NOT_EQUAL(unpackResult, 0);
+	CU_ASSERT_NOT_EQUAL(unpackResult, -1);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_request.earfcn, out.nb_iot_broadcast_detect_request.earfcn);
+	CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_request.ro_dl, out.nb_iot_broadcast_detect_request.ro_dl);
+	CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_request.pci, out.nb_iot_broadcast_detect_request.pci);
+	CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_request.timeout, out.nb_iot_broadcast_detect_request.timeout);
+
+	CU_ASSERT_EQUAL(in.pnf_cell_search_state.length, out.pnf_cell_search_state.length);
+
+	for(idx = 0; idx < out.pnf_cell_search_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_search_state.value[idx], out.pnf_cell_search_state.value[idx]);
+	}
+
+}
+
+
+void nfapi_test_broadcast_detect_request_state_overrun()
+{
+	nfapi_broadcast_detect_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_BROADCAST_DETECT_REQUEST, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push8(NFAPI_RAT_TYPE_UTRAN, &p, end); // error_code
+
+	push16(NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(42, &p, end);
+	push16(42, &p, end);
+	push32(42, &p, end);
+
+	push16(NFAPI_PNF_CELL_SEARCH_STATE_TAG, &p, end);
+	push16(NFAPI_MAX_OPAQUE_DATA + 12, &p, end);
+
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+
+void nfapi_test_broadcast_detect_response()
+{
+	nfapi_broadcast_detect_response_t in;
+	nfapi_broadcast_detect_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_BROADCAST_DETECT_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+
+}
+void nfapi_test_broadcast_detect_indication_lte()
+{
+	uint16_t idx;
+	nfapi_broadcast_detect_indication_t in;
+	nfapi_broadcast_detect_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_BROADCAST_DETECT_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+	in.lte_broadcast_detect_indication.tl.tag = NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG;
+	in.lte_broadcast_detect_indication.number_of_tx_antenna = 1;
+	in.lte_broadcast_detect_indication.mib_length = 8;
+	in.lte_broadcast_detect_indication.sfn_offset = 4;
+	in.utran_broadcast_detect_indication.tl.tag = 0;
+	in.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+	in.pnf_cell_broadcast_state.length = 23;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_indication.tl.tag, out.lte_broadcast_detect_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_indication.number_of_tx_antenna, out.lte_broadcast_detect_indication.number_of_tx_antenna);
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_indication.mib_length, out.lte_broadcast_detect_indication.mib_length);
+	for(idx = 0; idx < out.lte_broadcast_detect_indication.mib_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.lte_broadcast_detect_indication.mib[idx], out.lte_broadcast_detect_indication.mib[idx]);
+	}
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_indication.sfn_offset, out.lte_broadcast_detect_indication.sfn_offset);
+
+
+	CU_ASSERT_EQUAL(in.utran_broadcast_detect_indication.tl.tag, out.utran_broadcast_detect_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+	for(idx = 0; idx < out.pnf_cell_broadcast_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.value[idx], out.pnf_cell_broadcast_state.value[idx]);
+	}
+}
+void nfapi_test_broadcast_detect_indication_lte_overrun()
+{
+	nfapi_broadcast_detect_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_BROADCAST_DETECT_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error_code
+
+	push16(NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG, &p, end);
+	push16(8, &p, end);
+
+	push8(1, &p, end);
+	push16(NFAPI_MAX_MIB_LENGTH + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out) ,0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_broadcast_detect_indication_utran()
+{
+	uint16_t idx;
+	nfapi_broadcast_detect_indication_t in;
+	nfapi_broadcast_detect_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_BROADCAST_DETECT_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+	in.lte_broadcast_detect_indication.tl.tag = 0;
+	in.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG;
+	in.utran_broadcast_detect_indication.mib_length = 16;
+	in.utran_broadcast_detect_indication.sfn_offset = 4;
+	in.pnf_cell_broadcast_state.tl.tag = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_indication.tl.tag, out.lte_broadcast_detect_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_broadcast_detect_indication.tl.tag, out.utran_broadcast_detect_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_broadcast_detect_indication.mib_length, out.utran_broadcast_detect_indication.mib_length);
+	for(idx = 0; idx < out.utran_broadcast_detect_indication.mib_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.utran_broadcast_detect_indication.mib[idx], out.utran_broadcast_detect_indication.mib[idx]);
+	}
+	CU_ASSERT_EQUAL(in.utran_broadcast_detect_indication.sfn_offset, out.utran_broadcast_detect_indication.sfn_offset);
+
+
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+}
+void nfapi_test_broadcast_detect_indication_nb_iot()
+{
+	uint16_t idx;
+	nfapi_broadcast_detect_indication_t in;
+	nfapi_broadcast_detect_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_BROADCAST_DETECT_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+	in.lte_broadcast_detect_indication.tl.tag = 0;
+	in.utran_broadcast_detect_indication.tl.tag = 0;
+	in.nb_iot_broadcast_detect_indication.tl.tag = NFAPI_NB_IOT_BROADCAST_DETECT_INDICATION_TAG;
+	in.nb_iot_broadcast_detect_indication.number_of_tx_antenna = 2;
+	in.nb_iot_broadcast_detect_indication.mib_length = 16;
+	in.nb_iot_broadcast_detect_indication.sfn_offset = 4;
+	in.pnf_cell_broadcast_state.tl.tag = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_broadcast_detect_indication.tl.tag, out.lte_broadcast_detect_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_broadcast_detect_indication.tl.tag, out.utran_broadcast_detect_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_indication.tl.tag, out.nb_iot_broadcast_detect_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_indication.number_of_tx_antenna, out.nb_iot_broadcast_detect_indication.number_of_tx_antenna);
+	CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_indication.mib_length, out.nb_iot_broadcast_detect_indication.mib_length);
+	for(idx = 0; idx < out.nb_iot_broadcast_detect_indication.mib_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_indication.mib[idx], out.nb_iot_broadcast_detect_indication.mib[idx]);
+	}
+	CU_ASSERT_EQUAL(in.nb_iot_broadcast_detect_indication.sfn_offset, out.nb_iot_broadcast_detect_indication.sfn_offset);
+
+
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+}
+void nfapi_test_broadcast_detect_indication_utran_overrun()
+{
+	nfapi_broadcast_detect_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_BROADCAST_DETECT_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error_code
+
+	push16(NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(NFAPI_MAX_MIB_LENGTH + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_broadcast_detect_indication_state_overrun()
+{
+}
+void nfapi_test_system_information_schedule_request_lte()
+{
+	uint16_t idx;
+	nfapi_system_information_schedule_request_t in;
+	nfapi_system_information_schedule_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_LTE;
+
+	in.nb_iot_system_information_schedule_request.tl.tag = 0;
+
+	in.lte_system_information_schedule_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG;
+	in.lte_system_information_schedule_request.earfcn = 16;
+	in.lte_system_information_schedule_request.pci = 4;
+	in.lte_system_information_schedule_request.downlink_channel_bandwidth = 20;
+	in.lte_system_information_schedule_request.phich_configuration = 1;
+	in.lte_system_information_schedule_request.number_of_tx_antenna = 2;
+	in.lte_system_information_schedule_request.retry_count = 4;
+	in.lte_system_information_schedule_request.timeout = 0;
+	in.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+	in.pnf_cell_broadcast_state.length = 7;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.tl.tag, out.lte_system_information_schedule_request.tl.tag);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.earfcn, out.lte_system_information_schedule_request.earfcn);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.pci, out.lte_system_information_schedule_request.pci);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.downlink_channel_bandwidth, out.lte_system_information_schedule_request.downlink_channel_bandwidth);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.downlink_channel_bandwidth, out.lte_system_information_schedule_request.downlink_channel_bandwidth);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.number_of_tx_antenna, out.lte_system_information_schedule_request.number_of_tx_antenna);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.retry_count, out.lte_system_information_schedule_request.retry_count);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.timeout, out.lte_system_information_schedule_request.timeout);
+
+
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.length, out.pnf_cell_broadcast_state.length);
+	for(idx = 0; idx < out.pnf_cell_broadcast_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.value[idx], out.pnf_cell_broadcast_state.value[idx]);
+	}
+}
+
+void nfapi_test_system_information_schedule_request_nb_iot()
+{
+	uint16_t idx;
+	nfapi_system_information_schedule_request_t in;
+	nfapi_system_information_schedule_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_NB_IOT;
+
+	in.lte_system_information_schedule_request.tl.tag = 0;
+	in.nb_iot_system_information_schedule_request.tl.tag = NFAPI_NB_IOT_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG;
+	in.nb_iot_system_information_schedule_request.earfcn = 16;
+	in.nb_iot_system_information_schedule_request.ro_dl = 4;
+	in.nb_iot_system_information_schedule_request.pci = 4;
+	in.nb_iot_system_information_schedule_request.scheduling_info_sib1_nb = 4;
+	in.nb_iot_system_information_schedule_request.timeout = 0;
+	in.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+	in.pnf_cell_broadcast_state.length = 7;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.lte_system_information_schedule_request.tl.tag, out.lte_system_information_schedule_request.tl.tag);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_schedule_request.tl.tag, out.nb_iot_system_information_schedule_request.tl.tag);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_schedule_request.earfcn, out.nb_iot_system_information_schedule_request.earfcn);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_schedule_request.ro_dl, out.nb_iot_system_information_schedule_request.ro_dl);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_schedule_request.pci, out.nb_iot_system_information_schedule_request.pci);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_schedule_request.scheduling_info_sib1_nb, out.nb_iot_system_information_schedule_request.scheduling_info_sib1_nb);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_schedule_request.timeout, out.nb_iot_system_information_schedule_request.timeout);
+
+
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.length, out.pnf_cell_broadcast_state.length);
+	for(idx = 0; idx < out.pnf_cell_broadcast_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.value[idx], out.pnf_cell_broadcast_state.value[idx]);
+	}
+}
+
+void nfapi_test_system_information_schedule_request_state_overrun()
+{
+	nfapi_system_information_schedule_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push8(0, &p, end); // rat type
+
+	push16(NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG, &p, end);
+	push16(13, &p, end);
+
+	push16(1, &p, end);
+	push16(1, &p, end);
+	push16(1, &p, end);
+	push8(142, &p, end);
+	push8(142, &p, end);
+	push8(142, &p, end);
+	push32(42, &p, end);
+
+	push16(NFAPI_PNF_CELL_BROADCAST_STATE_TAG, &p, end);
+	push16(NFAPI_MAX_OPAQUE_DATA + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+
+}
+void nfapi_test_system_information_schedule_response()
+{
+	nfapi_system_information_schedule_response_t in;
+	nfapi_system_information_schedule_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+void nfapi_test_system_information_schedule_indication_lte()
+{
+	uint16_t idx;
+	nfapi_system_information_schedule_indication_t in;
+	nfapi_system_information_schedule_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = 0;
+
+	in.nb_iot_system_information_indication.tl.tag = 0;
+	in.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
+	in.lte_system_information_indication.sib_type = 16;
+	in.lte_system_information_indication.sib_length = 4;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.tl.tag, out.lte_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.sib_type, out.lte_system_information_indication.sib_type);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.sib_length, out.lte_system_information_indication.sib_length);
+
+	for(idx = 0; idx < out.lte_system_information_indication.sib_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.lte_system_information_indication.sib[idx], out.lte_system_information_indication.sib[idx]);
+	}
+}
+void nfapi_test_system_information_schedule_indication_nb_iot()
+{
+	uint16_t idx;
+	nfapi_system_information_schedule_indication_t in;
+	nfapi_system_information_schedule_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = 0;
+
+	in.lte_system_information_indication.tl.tag = 0;
+	in.nb_iot_system_information_indication.tl.tag = NFAPI_NB_IOT_SYSTEM_INFORMATION_INDICATION_TAG;
+	in.nb_iot_system_information_indication.sib_type = 16;
+	in.nb_iot_system_information_indication.sib_length = 4;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.tl.tag, out.lte_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_indication.tl.tag, out.nb_iot_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_indication.sib_type, out.nb_iot_system_information_indication.sib_type);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_indication.sib_length, out.nb_iot_system_information_indication.sib_length);
+
+	for(idx = 0; idx < out.nb_iot_system_information_indication.sib_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nb_iot_system_information_indication.sib[idx], out.nb_iot_system_information_indication.sib[idx]);
+	}
+}
+void nfapi_test_system_information_request_lte()
+{
+	uint16_t idx;
+	nfapi_system_information_request_t in;
+	nfapi_system_information_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_LTE;
+
+	in.lte_system_information_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG;
+	in.lte_system_information_request.earfcn = 16;
+	in.lte_system_information_request.pci = 4;
+	in.lte_system_information_request.downlink_channel_bandwidth = 20;
+	in.lte_system_information_request.phich_configuration = 1;
+	in.lte_system_information_request.number_of_tx_antenna = 2;
+	in.lte_system_information_request.number_of_si_periodicity = 1;
+	in.lte_system_information_request.si_periodicity[0].si_periodicity = 3;
+	in.lte_system_information_request.si_periodicity[0].si_index = 0;
+	in.lte_system_information_request.si_window_length = 0;
+	in.lte_system_information_request.timeout = 2000;
+
+	in.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+	in.pnf_cell_broadcast_state.length = 7;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.lte_system_information_request.tl.tag, out.lte_system_information_request.tl.tag);
+	CU_ASSERT_EQUAL(in.lte_system_information_request.earfcn, out.lte_system_information_request.earfcn);
+	CU_ASSERT_EQUAL(in.lte_system_information_request.pci, out.lte_system_information_request.pci);
+	CU_ASSERT_EQUAL(in.lte_system_information_request.downlink_channel_bandwidth, out.lte_system_information_request.downlink_channel_bandwidth);
+	CU_ASSERT_EQUAL(in.lte_system_information_request.downlink_channel_bandwidth, out.lte_system_information_request.downlink_channel_bandwidth);
+	CU_ASSERT_EQUAL(in.lte_system_information_request.number_of_tx_antenna, out.lte_system_information_request.number_of_tx_antenna);
+	CU_ASSERT_EQUAL(in.lte_system_information_request.number_of_si_periodicity, out.lte_system_information_request.number_of_si_periodicity);
+	for(idx = 0; idx < in.lte_system_information_request.number_of_si_periodicity; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.lte_system_information_request.si_periodicity[idx].si_periodicity, out.lte_system_information_request.si_periodicity[idx].si_periodicity);
+		CU_ASSERT_EQUAL(in.lte_system_information_request.si_periodicity[idx].si_index, out.lte_system_information_request.si_periodicity[idx].si_index);
+	}
+
+	CU_ASSERT_EQUAL(in.lte_system_information_request.si_window_length, out.lte_system_information_request.si_window_length);
+	CU_ASSERT_EQUAL(in.lte_system_information_request.timeout, out.lte_system_information_request.timeout);
+
+
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.length, out.pnf_cell_broadcast_state.length);
+	for(idx = 0; idx < out.pnf_cell_broadcast_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.value[idx], out.pnf_cell_broadcast_state.value[idx]);
+	}
+}
+void nfapi_test_system_information_request_lte_overrun()
+{
+	nfapi_system_information_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_SYSTEM_INFORMATION_REQUEST, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push8(NFAPI_RAT_TYPE_LTE, &p, end); 
+
+	push16(NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(8, &p, end);
+	push16(8, &p, end);
+	push16(8, &p, end);
+	push8(8, &p, end);
+	push8(8, &p, end);
+	push8(NFAPI_MAX_SI_PERIODICITY + 1, &p, end);
+
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_system_information_request_utran()
+{
+	nfapi_system_information_request_t in;
+	nfapi_system_information_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_UTRAN;
+
+	in.utran_system_information_request.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG;
+	in.utran_system_information_request.uarfcn = 16;
+	in.utran_system_information_request.psc = 4;
+	in.utran_system_information_request.timeout = 2000;
+
+	in.pnf_cell_broadcast_state.tl.tag = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.utran_system_information_request.tl.tag, out.utran_system_information_request.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_system_information_request.uarfcn, out.utran_system_information_request.uarfcn);
+	CU_ASSERT_EQUAL(in.utran_system_information_request.psc, out.utran_system_information_request.psc);
+	CU_ASSERT_EQUAL(in.utran_system_information_request.timeout, out.utran_system_information_request.timeout);
+
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+}
+void nfapi_test_system_information_request_geran()
+{
+	nfapi_system_information_request_t in;
+	nfapi_system_information_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_GERAN;
+
+	in.geran_system_information_request.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG;
+	in.geran_system_information_request.arfcn = 16;
+	in.geran_system_information_request.bsic = 4;
+	in.geran_system_information_request.timeout = 2000;
+
+	in.pnf_cell_broadcast_state.tl.tag = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rat_type, out.rat_type);
+	CU_ASSERT_EQUAL(in.geran_system_information_request.tl.tag, out.geran_system_information_request.tl.tag);
+	CU_ASSERT_EQUAL(in.geran_system_information_request.arfcn, out.geran_system_information_request.arfcn);
+	CU_ASSERT_EQUAL(in.geran_system_information_request.bsic, out.geran_system_information_request.bsic);
+	CU_ASSERT_EQUAL(in.geran_system_information_request.timeout, out.geran_system_information_request.timeout);
+
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+}
+void nfapi_test_system_information_request_state_overrun()
+{
+	nfapi_system_information_request_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_SYSTEM_INFORMATION_REQUEST, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push8(NFAPI_RAT_TYPE_LTE, &p, end); 
+
+	push16(NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG, &p, end);
+	push16(16, &p, end);
+
+	push16(8, &p, end);
+	push16(8, &p, end);
+	push16(8, &p, end);
+	push8(8, &p, end);
+	push8(8, &p, end);
+	push8(1, &p, end);
+	{
+		push8(1, &p, end);
+		push8(1, &p, end);
+	}
+	push8(1, &p, end);
+	push32(1, &p, end);
+
+	push16(NFAPI_PNF_CELL_BROADCAST_STATE_TAG, &p, end);
+	push16(NFAPI_MAX_OPAQUE_DATA + 1, &p, end);
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+
+void nfapi_test_system_information_request_nb_iot()
+{
+	uint16_t idx, idx2;
+	nfapi_system_information_request_t in;
+	nfapi_system_information_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.rat_type = NFAPI_RAT_TYPE_NB_IOT;
+
+	in.nb_iot_system_information_request.tl.tag = NFAPI_NB_IOT_SYSTEM_INFORMATION_REQUEST_TAG;
+	in.nb_iot_system_information_request.earfcn = 16;
+	in.nb_iot_system_information_request.ro_dl = 1;
+	in.nb_iot_system_information_request.pci = 4;
+	in.nb_iot_system_information_request.number_of_si_periodicity = 1;
+	in.nb_iot_system_information_request.si_periodicity[0].si_periodicity = 3;
+	in.nb_iot_system_information_request.si_periodicity[0].si_repetition_pattern = 0;
+	in.nb_iot_system_information_request.si_periodicity[0].si_tb_size = 0;
+	in.nb_iot_system_information_request.si_periodicity[0].number_of_si_index = 2;
+	in.nb_iot_system_information_request.si_periodicity[0].si_index[0] = 2;
+	in.nb_iot_system_information_request.si_periodicity[0].si_index[1] = 20;
+	in.nb_iot_system_information_request.si_window_length = 0;
+	in.nb_iot_system_information_request.timeout = 2000;
+
+	in.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+	in.pnf_cell_broadcast_state.length = 7;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	IN_OUT_ASSERT(header.message_id);
+	IN_OUT_ASSERT(rat_type);
+	IN_OUT_ASSERT(nb_iot_system_information_request.tl.tag);
+	IN_OUT_ASSERT(nb_iot_system_information_request.earfcn);
+	IN_OUT_ASSERT(nb_iot_system_information_request.ro_dl);
+	IN_OUT_ASSERT(nb_iot_system_information_request.pci);
+	IN_OUT_ASSERT(nb_iot_system_information_request.number_of_si_periodicity);
+	
+	for(idx = 0; idx < in.nb_iot_system_information_request.number_of_si_periodicity; ++idx)
+	{
+		IN_OUT_ASSERT(nb_iot_system_information_request.si_periodicity[idx].si_periodicity);
+		IN_OUT_ASSERT(nb_iot_system_information_request.si_periodicity[idx].si_repetition_pattern);
+		IN_OUT_ASSERT(nb_iot_system_information_request.si_periodicity[idx].si_tb_size);
+		IN_OUT_ASSERT(nb_iot_system_information_request.si_periodicity[idx].number_of_si_index);
+		
+		for(idx2 = 0; idx2 < in.nb_iot_system_information_request.si_periodicity[idx].number_of_si_index; ++idx2)
+			IN_OUT_ASSERT(nb_iot_system_information_request.si_periodicity[idx].si_index[idx2]);
+	}
+
+	IN_OUT_ASSERT(nb_iot_system_information_request.si_window_length);
+	IN_OUT_ASSERT(nb_iot_system_information_request.timeout);
+
+
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.tl.tag, out.pnf_cell_broadcast_state.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.length, out.pnf_cell_broadcast_state.length);
+	for(idx = 0; idx < out.pnf_cell_broadcast_state.length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_cell_broadcast_state.value[idx], out.pnf_cell_broadcast_state.value[idx]);
+	}
+}
+
+
+void nfapi_test_system_information_response()
+{
+	nfapi_system_information_response_t in;
+	nfapi_system_information_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+void nfapi_test_system_information_indication_lte()
+{
+	uint16_t idx;
+	nfapi_system_information_indication_t in;
+	nfapi_system_information_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+	in.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
+	in.lte_system_information_indication.sib_type = 2;
+	in.lte_system_information_indication.sib_length = 15;
+
+	in.utran_system_information_indication.tl.tag = 0;
+	in.geran_system_information_indication.tl.tag = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.tl.tag, out.lte_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.sib_type, out.lte_system_information_indication.sib_type);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.sib_length, out.lte_system_information_indication.sib_length);
+
+	for(idx = 0; idx < out.lte_system_information_indication.sib_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.lte_system_information_indication.sib[idx], out.lte_system_information_indication.sib[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.utran_system_information_indication.tl.tag, out.utran_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.geran_system_information_indication.tl.tag, out.geran_system_information_indication.tl.tag);
+
+}
+void nfapi_test_system_information_indication_lte_overrun()
+{
+	nfapi_system_information_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_SYSTEM_INFORMATION_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error code
+
+	push16(NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG, &p, end);
+	push16(8, &p, end);
+
+	push8(1, &p, end);
+	push16(NFAPI_MAX_SIB_LENGTH + 1, &p, end);
+
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_system_information_indication_utran()
+{
+	uint16_t idx;
+	nfapi_system_information_indication_t in;
+	nfapi_system_information_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+	in.lte_system_information_indication.tl.tag = 0;
+
+	in.utran_system_information_indication.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG;
+	in.utran_system_information_indication.sib_length = 25;
+
+	in.geran_system_information_indication.tl.tag = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.tl.tag, out.lte_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_system_information_indication.tl.tag, out.utran_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_system_information_indication.sib_length, out.utran_system_information_indication.sib_length);
+
+	for(idx = 0; idx < out.utran_system_information_indication.sib_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.utran_system_information_indication.sib[idx], out.utran_system_information_indication.sib[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.geran_system_information_indication.tl.tag, out.geran_system_information_indication.tl.tag);
+
+}
+void nfapi_test_system_information_indication_utran_overrun()
+{
+	nfapi_system_information_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_SYSTEM_INFORMATION_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error code
+
+	push16(NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(NFAPI_MAX_SIB_LENGTH + 1, &p, end);
+
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+void nfapi_test_system_information_indication_geran()
+{
+	uint16_t idx;
+	nfapi_system_information_indication_t in;
+	nfapi_system_information_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+	in.lte_system_information_indication.tl.tag = 0;
+	in.utran_system_information_indication.tl.tag = 0;
+
+	in.geran_system_information_indication.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG;
+	in.geran_system_information_indication.si_length = 25;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.tl.tag, out.lte_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_system_information_indication.tl.tag, out.utran_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.geran_system_information_indication.tl.tag, out.geran_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.geran_system_information_indication.si_length, out.geran_system_information_indication.si_length);
+
+	for(idx = 0; idx < out.geran_system_information_indication.si_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.geran_system_information_indication.si[idx], out.geran_system_information_indication.si[idx]);
+	}
+
+}
+void nfapi_test_system_information_indication_geran_overrun()
+{
+	nfapi_system_information_indication_t out;
+
+	uint8_t buffer[1024];
+	uint8_t* p = &buffer[0];
+	uint8_t *end = p + 1024;
+	push16(0, &p, end);
+	push16(NFAPI_SYSTEM_INFORMATION_INDICATION, &p, end);
+	push16(64, &p, end);
+	push16(0, &p, end);
+
+	push32(0, &p, end); // error code
+
+	push16(NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG, &p, end);
+	push16(8, &p, end);
+
+	push16(NFAPI_MAX_SI_LENGTH + 1, &p, end);
+
+
+	int result = nfapi_p4_message_unpack(buffer, 34, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+
+void nfapi_test_system_information_indication_nb_iot()
+{
+	uint16_t idx;
+	nfapi_system_information_indication_t in;
+	nfapi_system_information_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SYSTEM_INFORMATION_INDICATION;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+	in.nb_iot_system_information_indication.tl.tag = NFAPI_NB_IOT_SYSTEM_INFORMATION_INDICATION_TAG;
+	in.nb_iot_system_information_indication.sib_type = 2;
+	in.nb_iot_system_information_indication.sib_length = 15;
+
+	in.lte_system_information_indication.tl.tag = 0;
+	in.utran_system_information_indication.tl.tag = 0;
+	in.geran_system_information_indication.tl.tag = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_indication.tl.tag, out.nb_iot_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_indication.sib_type, out.nb_iot_system_information_indication.sib_type);
+	CU_ASSERT_EQUAL(in.nb_iot_system_information_indication.sib_length, out.nb_iot_system_information_indication.sib_length);
+
+	for(idx = 0; idx < out.nb_iot_system_information_indication.sib_length; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nb_iot_system_information_indication.sib[idx], out.nb_iot_system_information_indication.sib[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.lte_system_information_indication.tl.tag, out.lte_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.utran_system_information_indication.tl.tag, out.utran_system_information_indication.tl.tag);
+	CU_ASSERT_EQUAL(in.geran_system_information_indication.tl.tag, out.geran_system_information_indication.tl.tag);
+
+}
+
+void nfapi_test_nmm_stop_request()
+{
+	nfapi_nmm_stop_request_t in;
+	nfapi_nmm_stop_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_NMM_STOP_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+}
+void nfapi_test_nmm_stop_response()
+{
+	nfapi_nmm_stop_response_t in;
+	nfapi_nmm_stop_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_NMM_STOP_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_P4_MSG_RAT_NOT_SUPPORTED;
+
+	int packedMessageLength = nfapi_p4_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p4_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+
+
+void nfapi_test_pnf_param_request()
+{
+	nfapi_pnf_param_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_pnf_param_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_PARAM_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+}
+void nfapi_test_pnf_param_request_ve()
+{
+	nfapi_pnf_param_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_pnf_param_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_PARAM_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	my_vendor_extention ve;
+	ve.tl.tag = NFAPI_VENDOR_EXTENSION_MIN_TAG_VALUE;
+	ve.value1 = 56;
+	ve.value2 = 1234;
+	in.vendor_extension = (void*)&ve;
+
+	nfapi_p4_p5_codec_config_t codec;
+	memset(&codec, 0, sizeof(codec));
+	codec.unpack_vendor_extension_tlv = &nfapi_test_unpack_vendor_extension_tlv; 
+	codec.pack_vendor_extension_tlv = &nfapi_test_pack_vendor_extension_tlv;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, &codec);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), &codec);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+
+	CU_ASSERT_NOT_EQUAL(in.vendor_extension, 0);
+	CU_ASSERT_EQUAL(((my_vendor_extention*)(out.vendor_extension))->tl.tag, ve.tl.tag);
+	CU_ASSERT_EQUAL(((my_vendor_extention*)(out.vendor_extension))->value1, ve.value1);
+	CU_ASSERT_EQUAL(((my_vendor_extention*)(out.vendor_extension))->value2, ve.value2);
+
+	free(out.vendor_extension);
+}
+void nfapi_test_pnf_param_response()
+{
+	uint16_t idx = 0;
+	uint16_t idx2 = 0;
+	nfapi_pnf_param_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_pnf_param_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = 0;
+	in.pnf_param_general.tl.tag = NFAPI_PNF_PARAM_GENERAL_TAG;
+	in.pnf_param_general.nfapi_sync_mode = 2;
+	in.pnf_param_general.location_mode = 1;
+	in.pnf_param_general.location_coordinates_length = 1;
+	in.pnf_param_general.location_coordinates[0] = 123;
+	in.pnf_param_general.dl_config_timing = 12;
+	in.pnf_param_general.tx_timing = 12;
+	in.pnf_param_general.ul_config_timing = 12;
+	in.pnf_param_general.hi_dci0_timing = 12;
+	in.pnf_param_general.maximum_number_phys = 2;
+	in.pnf_param_general.maximum_total_bandwidth = 100;
+	in.pnf_param_general.maximum_total_number_dl_layers = 2;
+	in.pnf_param_general.maximum_total_number_ul_layers = 2;
+	in.pnf_param_general.shared_bands = 0;
+	in.pnf_param_general.shared_pa = 0;
+	in.pnf_param_general.maximum_total_power = -190;
+	in.pnf_param_general.oui[0] = 88;
+
+	in.pnf_phy.tl.tag = NFAPI_PNF_PHY_TAG;
+	in.pnf_phy.number_of_phys = 2;
+	in.pnf_phy.phy[0].phy_config_index = 0;
+	in.pnf_phy.phy[0].number_of_rfs = 2;
+	in.pnf_phy.phy[0].rf_config[0].rf_config_index = 0;
+	in.pnf_phy.phy[0].number_of_rf_exclusions = 1;
+	in.pnf_phy.phy[0].rf_config[0].rf_config_index = 1;
+	in.pnf_phy.phy[0].downlink_channel_bandwidth_supported = 20;
+	in.pnf_phy.phy[0].uplink_channel_bandwidth_supported = 20;
+	in.pnf_phy.phy[0].number_of_dl_layers_supported = 2;
+	in.pnf_phy.phy[0].number_of_ul_layers_supported = 1;
+	in.pnf_phy.phy[0].maximum_3gpp_release_supported = 3;
+	in.pnf_phy.phy[0].nmm_modes_supported = 2;
+
+	in.pnf_rf.tl.tag = NFAPI_PNF_RF_TAG;
+	in.pnf_rf.number_of_rfs = 2;
+	in.pnf_rf.rf[0].rf_config_index = 0;
+	in.pnf_rf.rf[0].band = 1;
+	in.pnf_rf.rf[0].maximum_transmit_power = -100; 
+	in.pnf_rf.rf[0].minimum_transmit_power = -90; 
+	in.pnf_rf.rf[0].number_of_antennas_suppported = 4;
+	in.pnf_rf.rf[0].minimum_downlink_frequency = 100;
+	in.pnf_rf.rf[0].maximum_downlink_frequency = 2132;
+	in.pnf_rf.rf[0].minimum_uplink_frequency = 1231;
+	in.pnf_rf.rf[0].maximum_uplink_frequency = 123;
+
+
+	in.pnf_phy_rel10.tl.tag = NFAPI_PNF_PHY_REL10_TAG;
+	in.pnf_phy_rel10.number_of_phys = 2;
+	in.pnf_phy_rel10.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel10.phy[0].transmission_mode_7_supported = 1;
+	in.pnf_phy_rel10.phy[0].transmission_mode_8_supported = 2;
+	in.pnf_phy_rel10.phy[0].two_antenna_ports_for_pucch = 3;
+	in.pnf_phy_rel10.phy[0].transmission_mode_9_supported = 4;
+	in.pnf_phy_rel10.phy[0].simultaneous_pucch_pusch = 5;
+	in.pnf_phy_rel10.phy[0].four_layer_tx_with_tm3_and_tm4 = 6;
+
+	in.pnf_phy_rel11.tl.tag = NFAPI_PNF_PHY_REL11_TAG;
+	in.pnf_phy_rel11.number_of_phys = 2;
+	in.pnf_phy_rel11.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel11.phy[0].edpcch_supported = 1;
+	in.pnf_phy_rel11.phy[0].multi_ack_csi_reporting = 2;
+	in.pnf_phy_rel11.phy[0].pucch_tx_diversity = 3;
+	in.pnf_phy_rel11.phy[0].ul_comp_supported = 4;
+	in.pnf_phy_rel11.phy[0].transmission_mode_5_supported = 5;
+
+	in.pnf_phy_rel12.tl.tag = NFAPI_PNF_PHY_REL12_TAG;
+	in.pnf_phy_rel12.number_of_phys = 2;
+	in.pnf_phy_rel12.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel12.phy[0].csi_subframe_set = 1;
+	in.pnf_phy_rel12.phy[0].enhanced_4tx_codebook = 2;
+	in.pnf_phy_rel12.phy[0].drs_supported = 3;
+	in.pnf_phy_rel12.phy[0].ul_64qam_supported = 4;
+	in.pnf_phy_rel12.phy[0].transmission_mode_10_supported = 5;
+	in.pnf_phy_rel12.phy[0].alternative_bts_indices = 6;
+
+	in.pnf_phy_rel13.tl.tag = NFAPI_PNF_PHY_REL13_TAG;
+	in.pnf_phy_rel13.number_of_phys = 2;
+	in.pnf_phy_rel13.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel13.phy[0].pucch_format4_supported = 1;
+	in.pnf_phy_rel13.phy[0].pucch_format5_supported = 2;
+	in.pnf_phy_rel13.phy[0].more_than_5_ca_support = 3;
+	in.pnf_phy_rel13.phy[0].laa_supported = 4;
+	in.pnf_phy_rel13.phy[0].laa_ending_in_dwpts_supported = 5;
+	in.pnf_phy_rel13.phy[0].laa_starting_in_second_slot_supported = 6;
+	in.pnf_phy_rel13.phy[0].beamforming_supported = 7;
+	in.pnf_phy_rel13.phy[0].csi_rs_enhancement_supported = 8;
+	in.pnf_phy_rel13.phy[0].drms_enhancement_supported = 9;
+	in.pnf_phy_rel13.phy[0].srs_enhancement_supported = 10;
+	
+	in.pnf_phy_rel13_nb_iot.tl.tag = NFAPI_PNF_PHY_REL13_NB_IOT_TAG;
+	in.pnf_phy_rel13_nb_iot.number_of_phys = 2;
+	in.pnf_phy_rel13_nb_iot.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel13_nb_iot.phy[0].number_of_rfs = 2;
+	in.pnf_phy_rel13_nb_iot.phy[0].rf_config[0].rf_config_index = 0;
+	in.pnf_phy_rel13_nb_iot.phy[0].number_of_rf_exclusions = 1;
+	in.pnf_phy_rel13_nb_iot.phy[0].rf_config[0].rf_config_index = 1;
+	in.pnf_phy_rel13_nb_iot.phy[0].number_of_dl_layers_supported = 2;
+	in.pnf_phy_rel13_nb_iot.phy[0].number_of_ul_layers_supported = 1;
+	in.pnf_phy_rel13_nb_iot.phy[0].maximum_3gpp_release_supported = 3;
+	in.pnf_phy_rel13_nb_iot.phy[0].nmm_modes_supported = 2;
+
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	int unpack_result = nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(unpack_result, 1);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.pnf_param_general.tl.tag, out.pnf_param_general.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_param_general.nfapi_sync_mode, out.pnf_param_general.nfapi_sync_mode);
+	CU_ASSERT_EQUAL(in.pnf_param_general.location_mode, out.pnf_param_general.location_mode);
+
+	for(idx = 0; idx < NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH; ++idx)
+		CU_ASSERT_EQUAL(in.pnf_param_general.location_coordinates[idx], out.pnf_param_general.location_coordinates[idx]);
+
+	CU_ASSERT_EQUAL(in.pnf_param_general.dl_config_timing, out.pnf_param_general.dl_config_timing);
+	CU_ASSERT_EQUAL(in.pnf_param_general.tx_timing, out.pnf_param_general.tx_timing);
+	CU_ASSERT_EQUAL(in.pnf_param_general.ul_config_timing, out.pnf_param_general.ul_config_timing);
+	CU_ASSERT_EQUAL(in.pnf_param_general.hi_dci0_timing, out.pnf_param_general.hi_dci0_timing);
+	CU_ASSERT_EQUAL(in.pnf_param_general.maximum_number_phys, out.pnf_param_general.maximum_number_phys);
+	CU_ASSERT_EQUAL(in.pnf_param_general.maximum_total_bandwidth, out.pnf_param_general.maximum_total_bandwidth);
+	CU_ASSERT_EQUAL(in.pnf_param_general.maximum_total_number_dl_layers, out.pnf_param_general.maximum_total_number_dl_layers);
+	CU_ASSERT_EQUAL(in.pnf_param_general.maximum_total_number_ul_layers, out.pnf_param_general.maximum_total_number_ul_layers);
+	CU_ASSERT_EQUAL(in.pnf_param_general.shared_bands, out.pnf_param_general.shared_bands);
+	CU_ASSERT_EQUAL(in.pnf_param_general.shared_pa, out.pnf_param_general.shared_pa);
+	CU_ASSERT_EQUAL(in.pnf_param_general.maximum_total_power, out.pnf_param_general.maximum_total_power);
+	for(idx = 0; idx < NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH; ++idx)
+		CU_ASSERT_EQUAL(in.pnf_param_general.oui[idx], out.pnf_param_general.oui[idx]);
+
+	CU_ASSERT_EQUAL(in.pnf_phy.tl.tag, out.pnf_phy.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_phy.number_of_phys, out.pnf_phy.number_of_phys);
+	
+	for(idx = 0; idx < out.pnf_phy.number_of_phys; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].phy_config_index, out.pnf_phy.phy[idx].phy_config_index);
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].number_of_rfs, out.pnf_phy.phy[idx].number_of_rfs);
+
+	
+		for(idx2 = 0; idx2 < out.pnf_phy.phy[idx].number_of_rfs; ++idx2)
+		{
+			CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].rf_config[idx2].rf_config_index, out.pnf_phy.phy[idx].rf_config[idx2].rf_config_index);
+		}
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].number_of_rf_exclusions, out.pnf_phy.phy[idx].number_of_rf_exclusions);
+
+		for(idx2 = 0; idx2 < out.pnf_phy.phy[idx].number_of_rf_exclusions; ++idx2)
+		{
+			CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].excluded_rf_config[idx2].rf_config_index, out.pnf_phy.phy[idx].excluded_rf_config[idx2].rf_config_index);
+		}
+
+
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].downlink_channel_bandwidth_supported, out.pnf_phy.phy[idx].downlink_channel_bandwidth_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].uplink_channel_bandwidth_supported, out.pnf_phy.phy[idx].uplink_channel_bandwidth_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].number_of_dl_layers_supported, out.pnf_phy.phy[idx].number_of_dl_layers_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].number_of_ul_layers_supported, out.pnf_phy.phy[idx].number_of_ul_layers_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].maximum_3gpp_release_supported, out.pnf_phy.phy[idx].maximum_3gpp_release_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy.phy[idx].nmm_modes_supported, out.pnf_phy.phy[idx].nmm_modes_supported);
+	}
+
+	CU_ASSERT_EQUAL(in.pnf_rf.tl.tag, out.pnf_rf.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_rf.number_of_rfs, out.pnf_rf.number_of_rfs);
+	for(idx = 0; idx < out.pnf_rf.number_of_rfs; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].rf_config_index, out.pnf_rf.rf[idx].rf_config_index);
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].band, out.pnf_rf.rf[idx].band);
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].maximum_transmit_power, out.pnf_rf.rf[idx].maximum_transmit_power);
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].minimum_transmit_power, out.pnf_rf.rf[idx].minimum_transmit_power);
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].number_of_antennas_suppported, out.pnf_rf.rf[idx].number_of_antennas_suppported);
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].minimum_downlink_frequency, out.pnf_rf.rf[idx].minimum_downlink_frequency);
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].maximum_downlink_frequency, out.pnf_rf.rf[idx].maximum_downlink_frequency);
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].minimum_uplink_frequency, out.pnf_rf.rf[idx].minimum_uplink_frequency);
+		CU_ASSERT_EQUAL(in.pnf_rf.rf[idx].maximum_uplink_frequency, out.pnf_rf.rf[idx].maximum_uplink_frequency);
+	}
+
+
+	CU_ASSERT_EQUAL(in.pnf_phy_rel10.tl.tag, out.pnf_phy_rel10.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_phy_rel10.number_of_phys, out.pnf_phy_rel10.number_of_phys);
+	for(idx = 0; idx < out.pnf_phy_rel10.number_of_phys; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_phy_rel10.phy[idx].phy_config_index, out.pnf_phy_rel10.phy[idx].phy_config_index);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel10.phy[idx].transmission_mode_7_supported, out.pnf_phy_rel10.phy[idx].transmission_mode_7_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel10.phy[idx].transmission_mode_8_supported, out.pnf_phy_rel10.phy[idx].transmission_mode_8_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel10.phy[idx].two_antenna_ports_for_pucch, out.pnf_phy_rel10.phy[idx].two_antenna_ports_for_pucch);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel10.phy[idx].transmission_mode_9_supported, out.pnf_phy_rel10.phy[idx].transmission_mode_9_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel10.phy[idx].simultaneous_pucch_pusch, out.pnf_phy_rel10.phy[idx].simultaneous_pucch_pusch);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel10.phy[idx].four_layer_tx_with_tm3_and_tm4, out.pnf_phy_rel10.phy[idx].four_layer_tx_with_tm3_and_tm4);
+	}
+
+	CU_ASSERT_EQUAL(in.pnf_phy_rel11.tl.tag, out.pnf_phy_rel11.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_phy_rel11.number_of_phys, out.pnf_phy_rel11.number_of_phys);
+	for(idx = 0; idx < out.pnf_phy_rel11.number_of_phys; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_phy_rel11.phy[idx].phy_config_index, out.pnf_phy_rel11.phy[idx].phy_config_index);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel11.phy[idx].edpcch_supported, out.pnf_phy_rel11.phy[idx].edpcch_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel11.phy[idx].multi_ack_csi_reporting, out.pnf_phy_rel11.phy[idx].multi_ack_csi_reporting);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel11.phy[idx].pucch_tx_diversity, out.pnf_phy_rel11.phy[idx].pucch_tx_diversity);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel11.phy[idx].ul_comp_supported, out.pnf_phy_rel11.phy[idx].ul_comp_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel11.phy[idx].transmission_mode_5_supported, out.pnf_phy_rel11.phy[idx].transmission_mode_5_supported);
+	}
+
+	CU_ASSERT_EQUAL(in.pnf_phy_rel12.tl.tag, out.pnf_phy_rel12.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_phy_rel12.number_of_phys, out.pnf_phy_rel12.number_of_phys);
+	for(idx = 0; idx < out.pnf_phy_rel12.number_of_phys; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_phy_rel12.phy[idx].phy_config_index, out.pnf_phy_rel12.phy[idx].phy_config_index);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel12.phy[idx].csi_subframe_set, out.pnf_phy_rel12.phy[idx].csi_subframe_set);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel12.phy[idx].enhanced_4tx_codebook, out.pnf_phy_rel12.phy[idx].enhanced_4tx_codebook);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel12.phy[idx].drs_supported, out.pnf_phy_rel12.phy[idx].drs_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel12.phy[idx].ul_64qam_supported, out.pnf_phy_rel12.phy[idx].ul_64qam_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel12.phy[idx].transmission_mode_10_supported, out.pnf_phy_rel12.phy[idx].transmission_mode_10_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel12.phy[idx].alternative_bts_indices, out.pnf_phy_rel12.phy[idx].alternative_bts_indices);
+	}
+
+	CU_ASSERT_EQUAL(in.pnf_phy_rel13.tl.tag, out.pnf_phy_rel13.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_phy_rel13.number_of_phys, out.pnf_phy_rel13.number_of_phys);
+	for(idx = 0; idx < out.pnf_phy_rel13.number_of_phys; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].phy_config_index, out.pnf_phy_rel13.phy[idx].phy_config_index);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].pucch_format4_supported, out.pnf_phy_rel13.phy[idx].pucch_format4_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].pucch_format5_supported, out.pnf_phy_rel13.phy[idx].pucch_format5_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].more_than_5_ca_support, out.pnf_phy_rel13.phy[idx].more_than_5_ca_support);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].laa_supported, out.pnf_phy_rel13.phy[idx].laa_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].laa_ending_in_dwpts_supported, out.pnf_phy_rel13.phy[idx].laa_ending_in_dwpts_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].laa_starting_in_second_slot_supported, out.pnf_phy_rel13.phy[idx].laa_starting_in_second_slot_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].beamforming_supported, out.pnf_phy_rel13.phy[idx].beamforming_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].csi_rs_enhancement_supported, out.pnf_phy_rel13.phy[idx].csi_rs_enhancement_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].drms_enhancement_supported, out.pnf_phy_rel13.phy[idx].drms_enhancement_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13.phy[idx].srs_enhancement_supported, out.pnf_phy_rel13.phy[idx].srs_enhancement_supported);
+	}
+
+	CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.tl.tag, out.pnf_phy_rel13_nb_iot.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.number_of_phys, out.pnf_phy_rel13_nb_iot.number_of_phys);
+	
+	for(idx = 0; idx < out.pnf_phy_rel13_nb_iot.number_of_phys; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].phy_config_index, out.pnf_phy_rel13_nb_iot.phy[idx].phy_config_index);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].number_of_rfs, out.pnf_phy_rel13_nb_iot.phy[idx].number_of_rfs);
+
+	
+		for(idx2 = 0; idx2 < out.pnf_phy_rel13_nb_iot.phy[idx].number_of_rfs; ++idx2)
+		{
+			CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].rf_config[idx2].rf_config_index, out.pnf_phy_rel13_nb_iot.phy[idx].rf_config[idx2].rf_config_index);
+		}
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].number_of_rf_exclusions, out.pnf_phy_rel13_nb_iot.phy[idx].number_of_rf_exclusions);
+
+		for(idx2 = 0; idx2 < out.pnf_phy_rel13_nb_iot.phy[idx].number_of_rf_exclusions; ++idx2)
+		{
+			CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].excluded_rf_config[idx2].rf_config_index, out.pnf_phy_rel13_nb_iot.phy[idx].excluded_rf_config[idx2].rf_config_index);
+		}
+
+
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].number_of_dl_layers_supported, out.pnf_phy_rel13_nb_iot.phy[idx].number_of_dl_layers_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].number_of_ul_layers_supported, out.pnf_phy_rel13_nb_iot.phy[idx].number_of_ul_layers_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].maximum_3gpp_release_supported, out.pnf_phy_rel13_nb_iot.phy[idx].maximum_3gpp_release_supported);
+		CU_ASSERT_EQUAL(in.pnf_phy_rel13_nb_iot.phy[idx].nmm_modes_supported, out.pnf_phy_rel13_nb_iot.phy[idx].nmm_modes_supported);
+	}
+
+
+}
+
+void nfapi_test_pnf_config_request()
+{
+	uint16_t idx;
+	nfapi_pnf_config_request_t in;
+	nfapi_pnf_config_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
+	in.pnf_phy_rf_config.number_phy_rf_config_info = 2;
+	in.pnf_phy_rf_config.phy_rf_config[0].phy_id = 0;
+	in.pnf_phy_rf_config.phy_rf_config[0].phy_config_index = 0;
+	in.pnf_phy_rf_config.phy_rf_config[0].rf_config_index = 0;
+
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	int unpack_result = nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(unpack_result, 1);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	//CU_ASSERT_EQUAL(in.error_code, out.error_code);
+
+	CU_ASSERT_EQUAL(in.pnf_phy_rf_config.tl.tag, out.pnf_phy_rf_config.tl.tag);
+	CU_ASSERT_EQUAL(in.pnf_phy_rf_config.number_phy_rf_config_info, out.pnf_phy_rf_config.number_phy_rf_config_info);
+
+	for(idx = 0; idx < out.pnf_phy_rf_config.number_phy_rf_config_info; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.pnf_phy_rf_config.phy_rf_config[idx].phy_id, out.pnf_phy_rf_config.phy_rf_config[idx].phy_id);
+		CU_ASSERT_EQUAL(in.pnf_phy_rf_config.phy_rf_config[idx].phy_config_index, out.pnf_phy_rf_config.phy_rf_config[idx].phy_config_index);
+		CU_ASSERT_EQUAL(in.pnf_phy_rf_config.phy_rf_config[idx].rf_config_index, out.pnf_phy_rf_config.phy_rf_config[idx].rf_config_index);
+	}
+}
+
+
+
+void nfapi_test_pnf_config_response()
+{
+	nfapi_pnf_config_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_pnf_config_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+void nfapi_test_pnf_config_response1()
+{
+	uint8_t buffer[NFAPI_HEADER_LENGTH  + 1];
+
+	nfapi_pnf_config_response_t in;
+	memset(&in, 0, sizeof(in));
+	//nfapi_pnf_config_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), buffer, sizeof(buffer), 0);
+	CU_ASSERT_EQUAL(packedMessageLength, -1);
+
+	//nfapi_p5_message_unpack(buffer, sizeof(buffer), &out, sizeof(out), 0);
+	//CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	//CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+void nfapi_test_pnf_start_request()
+{
+	nfapi_pnf_start_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_pnf_start_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_START_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+}
+
+void nfapi_test_pnf_start_response()
+{
+	nfapi_pnf_start_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_pnf_start_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_START_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+void nfapi_test_pnf_stop_request()
+{
+	nfapi_pnf_stop_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_pnf_stop_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_STOP_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+}
+void nfapi_test_pnf_stop_response()
+{
+	nfapi_pnf_stop_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_pnf_stop_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PNF_STOP_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+
+void nfapi_test_param_request()
+{
+	nfapi_param_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_param_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PARAM_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+}
+void nfapi_test_param_response()
+{
+	#define SET_TLV(_TLV, _TAG, _VALUE) { _TLV.tl.tag = _TAG; _TLV.value = _VALUE; num_tlv++;	}
+	#define ASSERT_TLV(IN_TLV, OUT_TLV) { CU_ASSERT_EQUAL(IN_TLV.tl.tag, OUT_TLV.tl.tag); CU_ASSERT_EQUAL(IN_TLV.value, OUT_TLV.value);}
+
+	nfapi_param_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_param_response_t out;
+	memset(&out, 0, sizeof(out));
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_PARAM_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	uint16_t idx = 0;
+	uint16_t num_tlv = 0; // Bit of a hack, it is incremented in the SET_UINT16_TLV macro
+
+	SET_TLV(in.l1_status.phy_state, NFAPI_L1_STATUS_PHY_STATE_TAG, 1);
+	SET_TLV(in.phy_capabilities.dl_bandwidth_support, NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, 63);
+	SET_TLV(in.phy_capabilities.ul_bandwidth_support, NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, 63);
+	SET_TLV(in.phy_capabilities.dl_modulation_support, NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG, 3);
+	SET_TLV(in.phy_capabilities.ul_modulation_support, NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG, 3);
+	SET_TLV(in.phy_capabilities.phy_antenna_capability, NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG, 8);
+	SET_TLV(in.phy_capabilities.release_capability, NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG, 63);
+	SET_TLV(in.phy_capabilities.mbsfn_capability, NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG, 0);
+	
+	SET_TLV(in.laa_capability.laa_support, NFAPI_LAA_CAPABILITY_LAA_SUPPORT_TAG, 1);
+	SET_TLV(in.laa_capability.pd_sensing_lbt_support, NFAPI_LAA_CAPABILITY_PD_SENSING_LBT_SUPPORT_TAG, 0);
+	SET_TLV(in.laa_capability.multi_carrier_lbt_support, NFAPI_LAA_CAPABILITY_MULTI_CARRIER_LBT_SUPPORT_TAG, 3);
+	SET_TLV(in.laa_capability.partial_sf_support, NFAPI_LAA_CAPABILITY_PARTIAL_SF_SUPPORT_TAG, 2);
+
+	SET_TLV(in.subframe_config.duplex_mode, NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, 1);
+	SET_TLV(in.subframe_config.pcfich_power_offset, NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, 1000);
+	SET_TLV(in.subframe_config.pb, NFAPI_SUBFRAME_CONFIG_PB_TAG, 1);
+	SET_TLV(in.subframe_config.dl_cyclic_prefix_type, NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, 0);
+	SET_TLV(in.subframe_config.ul_cyclic_prefix_type, NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, 0);
+
+	SET_TLV(in.rf_config.dl_channel_bandwidth, NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, 50);
+	SET_TLV(in.rf_config.ul_channel_bandwidth, NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, 50);
+	SET_TLV(in.rf_config.reference_signal_power, NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, 120);
+	SET_TLV(in.rf_config.tx_antenna_ports, NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, 2);
+	SET_TLV(in.rf_config.rx_antenna_ports, NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, 2);
+
+	SET_TLV(in.phich_config.phich_resource, NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, 3);
+	SET_TLV(in.phich_config.phich_duration, NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, 0);
+	SET_TLV(in.phich_config.phich_power_offset, NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, 500);
+
+	SET_TLV(in.sch_config.primary_synchronization_signal_epre_eprers, NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, 1000);
+	SET_TLV(in.sch_config.secondary_synchronization_signal_epre_eprers, NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, 2000);
+	SET_TLV(in.sch_config.physical_cell_id, NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, 12344);
+
+
+	SET_TLV(in.prach_config.configuration_index, NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, 63);
+	SET_TLV(in.prach_config.root_sequence_index, NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, 800);
+	SET_TLV(in.prach_config.zero_correlation_zone_configuration, NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, 14);
+	SET_TLV(in.prach_config.high_speed_flag, NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, 0);
+	SET_TLV(in.prach_config.frequency_offset, NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, 23);
+
+	SET_TLV(in.pusch_config.hopping_mode, NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, 0);
+	SET_TLV(in.pusch_config.hopping_offset, NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, 55);
+	SET_TLV(in.pusch_config.number_of_subbands, NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, 1);
+
+	SET_TLV(in.pucch_config.delta_pucch_shift, NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, 2);
+	SET_TLV(in.pucch_config.n_cqi_rb, NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, 88);
+	SET_TLV(in.pucch_config.n_an_cs, NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, 3);
+	SET_TLV(in.pucch_config.n1_pucch_an, NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, 2015);
+
+	SET_TLV(in.srs_config.bandwidth_configuration, NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, 3);
+	SET_TLV(in.srs_config.max_up_pts, NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, 0);
+	SET_TLV(in.srs_config.srs_subframe_configuration, NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, 11);
+	SET_TLV(in.srs_config.srs_acknack_srs_simultaneous_transmission, NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, 1);
+
+	SET_TLV(in.uplink_reference_signal_config.uplink_rs_hopping, NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, 2);
+	SET_TLV(in.uplink_reference_signal_config.group_assignment, NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, 22);
+	SET_TLV(in.uplink_reference_signal_config.cyclic_shift_1_for_drms, NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, 2);
+
+	SET_TLV(in.tdd_frame_structure_config.subframe_assignment, NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, 5);
+	SET_TLV(in.tdd_frame_structure_config.special_subframe_patterns, NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, 3);
+
+	SET_TLV(in.l23_config.data_report_mode, NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, 1);
+	SET_TLV(in.l23_config.sfnsf, NFAPI_L23_CONFIG_SFNSF_TAG, 12354);
+
+	in.nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
+	num_tlv++;
+
+	in.nfapi_config.p7_vnf_address_ipv6.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG;
+	num_tlv++;
+
+	SET_TLV(in.nfapi_config.p7_vnf_port, NFAPI_NFAPI_P7_VNF_PORT_TAG, 1111);
+	
+	in.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
+	num_tlv++;
+
+	in.nfapi_config.p7_pnf_address_ipv6.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG;
+	num_tlv++;
+
+	SET_TLV(in.nfapi_config.p7_pnf_port, NFAPI_NFAPI_P7_PNF_PORT_TAG, 9999);
+	SET_TLV(in.nfapi_config.dl_ue_per_sf, NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, 4);
+	SET_TLV(in.nfapi_config.ul_ue_per_sf, NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, 4);
+
+	in.nfapi_config.rf_bands.tl.tag = NFAPI_PHY_RF_BANDS_TAG;
+	in.nfapi_config.rf_bands.number_rf_bands = 2;
+	in.nfapi_config.rf_bands.rf_band[0] = 783;
+	num_tlv++;
+
+	SET_TLV(in.nfapi_config.timing_window, NFAPI_NFAPI_TIMING_WINDOW_TAG, 29);
+	SET_TLV(in.nfapi_config.timing_info_mode, NFAPI_NFAPI_TIMING_INFO_MODE_TAG, 2);
+	SET_TLV(in.nfapi_config.timing_info_period, NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, 23);
+	SET_TLV(in.nfapi_config.max_transmit_power, NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, 123);
+	SET_TLV(in.nfapi_config.earfcn, NFAPI_NFAPI_EARFCN_TAG, 1800);
+
+	in.nfapi_config.nmm_gsm_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG;
+	in.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands = 2;
+	num_tlv++;
+
+	in.nfapi_config.nmm_umts_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG;
+	in.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands = 3;
+	num_tlv++;
+
+	in.nfapi_config.nmm_lte_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG;
+	in.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands = 1;
+	num_tlv++;
+
+	SET_TLV(in.nfapi_config.nmm_uplink_rssi_supported, NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, 1);
+
+
+	in.num_tlv = num_tlv;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+	CU_ASSERT_EQUAL(in.num_tlv, out.num_tlv);
+
+	ASSERT_TLV(in.l1_status.phy_state, out.l1_status.phy_state);
+	ASSERT_TLV(in.phy_capabilities.dl_bandwidth_support, out.phy_capabilities.dl_bandwidth_support);
+	ASSERT_TLV(in.phy_capabilities.ul_bandwidth_support, out.phy_capabilities.ul_bandwidth_support);
+	ASSERT_TLV(in.phy_capabilities.dl_modulation_support, out.phy_capabilities.dl_modulation_support);
+	ASSERT_TLV(in.phy_capabilities.ul_modulation_support, out.phy_capabilities.ul_modulation_support);
+	ASSERT_TLV(in.phy_capabilities.phy_antenna_capability, out.phy_capabilities.phy_antenna_capability);
+	ASSERT_TLV(in.phy_capabilities.release_capability, out.phy_capabilities.release_capability);
+	ASSERT_TLV(in.phy_capabilities.mbsfn_capability, out.phy_capabilities.mbsfn_capability);
+
+	ASSERT_TLV(in.laa_capability.laa_support, in.laa_capability.laa_support);
+	ASSERT_TLV(in.laa_capability.pd_sensing_lbt_support, in.laa_capability.pd_sensing_lbt_support);
+	ASSERT_TLV(in.laa_capability.multi_carrier_lbt_support, in.laa_capability.multi_carrier_lbt_support);
+	ASSERT_TLV(in.laa_capability.partial_sf_support, in.laa_capability.partial_sf_support);
+
+	ASSERT_TLV(in.subframe_config.duplex_mode, out.subframe_config.duplex_mode);
+	ASSERT_TLV(in.subframe_config.pcfich_power_offset, out.subframe_config.pcfich_power_offset);
+	ASSERT_TLV(in.subframe_config.pb, out.subframe_config.pb);
+	ASSERT_TLV(in.subframe_config.dl_cyclic_prefix_type, out.subframe_config.dl_cyclic_prefix_type);
+	ASSERT_TLV(in.subframe_config.ul_cyclic_prefix_type, out.subframe_config.ul_cyclic_prefix_type);
+
+	ASSERT_TLV(in.rf_config.dl_channel_bandwidth, out.rf_config.dl_channel_bandwidth);
+	ASSERT_TLV(in.rf_config.ul_channel_bandwidth, out.rf_config.ul_channel_bandwidth);
+	ASSERT_TLV(in.rf_config.reference_signal_power, out.rf_config.reference_signal_power);
+	ASSERT_TLV(in.rf_config.tx_antenna_ports, out.rf_config.tx_antenna_ports);
+	ASSERT_TLV(in.rf_config.rx_antenna_ports, out.rf_config.rx_antenna_ports);
+
+	ASSERT_TLV(in.phich_config.phich_resource, out.phich_config.phich_resource);
+	ASSERT_TLV(in.phich_config.phich_duration, out.phich_config.phich_duration);
+	ASSERT_TLV(in.phich_config.phich_power_offset, out.phich_config.phich_power_offset);
+
+	ASSERT_TLV(in.sch_config.primary_synchronization_signal_epre_eprers, out.sch_config.primary_synchronization_signal_epre_eprers);
+	ASSERT_TLV(in.sch_config.secondary_synchronization_signal_epre_eprers, out.sch_config.secondary_synchronization_signal_epre_eprers);
+	ASSERT_TLV(in.sch_config.physical_cell_id, out.sch_config.physical_cell_id);
+
+
+	ASSERT_TLV(in.prach_config.configuration_index, out.prach_config.configuration_index);
+	ASSERT_TLV(in.prach_config.root_sequence_index, out.prach_config.root_sequence_index);
+	ASSERT_TLV(in.prach_config.zero_correlation_zone_configuration, out.prach_config.zero_correlation_zone_configuration);
+	ASSERT_TLV(in.prach_config.high_speed_flag, out.prach_config.high_speed_flag);
+	ASSERT_TLV(in.prach_config.frequency_offset, out.prach_config.frequency_offset);
+	
+	ASSERT_TLV(in.pusch_config.hopping_mode, in.pusch_config.hopping_mode);
+	ASSERT_TLV(in.pusch_config.hopping_offset, in.pusch_config.hopping_offset);
+	ASSERT_TLV(in.pusch_config.number_of_subbands, in.pusch_config.number_of_subbands);
+
+	ASSERT_TLV(in.pucch_config.delta_pucch_shift, out.pucch_config.delta_pucch_shift);
+	ASSERT_TLV(in.pucch_config.n_cqi_rb, out.pucch_config.n_cqi_rb);
+	ASSERT_TLV(in.pucch_config.n_an_cs, out.pucch_config.n_an_cs);
+	ASSERT_TLV(in.pucch_config.n1_pucch_an, out.pucch_config.n1_pucch_an);
+
+	ASSERT_TLV(in.srs_config.bandwidth_configuration, out.srs_config.bandwidth_configuration);
+	ASSERT_TLV(in.srs_config.max_up_pts, out.srs_config.max_up_pts);
+	ASSERT_TLV(in.srs_config.srs_subframe_configuration, out.srs_config.srs_subframe_configuration);
+	ASSERT_TLV(in.srs_config.srs_acknack_srs_simultaneous_transmission, out.srs_config.srs_acknack_srs_simultaneous_transmission);
+
+	ASSERT_TLV(in.uplink_reference_signal_config.uplink_rs_hopping, out.uplink_reference_signal_config.uplink_rs_hopping);
+	ASSERT_TLV(in.uplink_reference_signal_config.group_assignment, out.uplink_reference_signal_config.group_assignment);
+	ASSERT_TLV(in.uplink_reference_signal_config.cyclic_shift_1_for_drms, out.uplink_reference_signal_config.cyclic_shift_1_for_drms);
+
+	ASSERT_TLV(in.tdd_frame_structure_config.subframe_assignment, out.tdd_frame_structure_config.subframe_assignment);
+	ASSERT_TLV(in.tdd_frame_structure_config.special_subframe_patterns, out.tdd_frame_structure_config.special_subframe_patterns);
+
+	ASSERT_TLV(in.l23_config.data_report_mode, out.l23_config.data_report_mode);
+	ASSERT_TLV(in.l23_config.sfnsf, out.l23_config.sfnsf);
+
+	CU_ASSERT_EQUAL(in.nfapi_config.p7_vnf_address_ipv4.tl.tag, out.nfapi_config.p7_vnf_address_ipv4.tl.tag);
+	for(idx = 0; idx < NFAPI_IPV4_ADDRESS_LENGTH; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.p7_vnf_address_ipv4.address[idx], out.nfapi_config.p7_vnf_address_ipv4.address[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.nfapi_config.p7_vnf_address_ipv6.tl.tag, out.nfapi_config.p7_vnf_address_ipv6.tl.tag);
+	for(idx = 0; idx < NFAPI_IPV6_ADDRESS_LENGTH; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.p7_vnf_address_ipv6.address[idx], out.nfapi_config.p7_vnf_address_ipv6.address[idx]);
+	}
+
+	ASSERT_TLV(in.nfapi_config.p7_vnf_port, out.nfapi_config.p7_vnf_port);
+	
+	CU_ASSERT_EQUAL(in.nfapi_config.p7_pnf_address_ipv4.tl.tag, out.nfapi_config.p7_pnf_address_ipv4.tl.tag);
+	for(idx = 0; idx < NFAPI_IPV4_ADDRESS_LENGTH; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.p7_pnf_address_ipv4.address[idx], out.nfapi_config.p7_pnf_address_ipv4.address[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.nfapi_config.p7_pnf_address_ipv6.tl.tag, out.nfapi_config.p7_pnf_address_ipv6.tl.tag);
+	for(idx = 0; idx < NFAPI_IPV6_ADDRESS_LENGTH; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.p7_pnf_address_ipv6.address[idx], out.nfapi_config.p7_pnf_address_ipv6.address[idx]);
+	}
+
+	ASSERT_TLV(in.nfapi_config.p7_pnf_port, out.nfapi_config.p7_pnf_port);
+	ASSERT_TLV(in.nfapi_config.dl_ue_per_sf, out.nfapi_config.dl_ue_per_sf);
+	ASSERT_TLV(in.nfapi_config.ul_ue_per_sf, out.nfapi_config.ul_ue_per_sf);
+
+	CU_ASSERT_EQUAL(in.nfapi_config.rf_bands.tl.tag, out.nfapi_config.rf_bands.tl.tag);
+	CU_ASSERT_EQUAL(in.nfapi_config.rf_bands.number_rf_bands, out.nfapi_config.rf_bands.number_rf_bands);
+	for(idx = 0; idx < out.nfapi_config.rf_bands.number_rf_bands; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.rf_bands.rf_band[idx], out.nfapi_config.rf_bands.rf_band[idx]);
+	}
+
+	ASSERT_TLV(in.nfapi_config.timing_window, out.nfapi_config.timing_window);
+	ASSERT_TLV(in.nfapi_config.timing_info_mode, out.nfapi_config.timing_info_mode);
+	ASSERT_TLV(in.nfapi_config.timing_info_period, out.nfapi_config.timing_info_period);
+	ASSERT_TLV(in.nfapi_config.max_transmit_power, out.nfapi_config.max_transmit_power);
+	ASSERT_TLV(in.nfapi_config.earfcn, out.nfapi_config.earfcn); 
+
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_gsm_frequency_bands.tl.tag, out.nfapi_config.nmm_gsm_frequency_bands.tl.tag);
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands, out.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands);
+	for(idx = 0; idx < out.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.nmm_gsm_frequency_bands.bands[idx], out.nfapi_config.nmm_gsm_frequency_bands.bands[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_umts_frequency_bands.tl.tag, out.nfapi_config.nmm_umts_frequency_bands.tl.tag);
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands, out.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands);
+	for(idx = 0; idx < out.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.nmm_umts_frequency_bands.bands[idx], out.nfapi_config.nmm_umts_frequency_bands.bands[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_lte_frequency_bands.tl.tag, out.nfapi_config.nmm_lte_frequency_bands.tl.tag);
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands, out.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands);
+	for(idx = 0; idx < out.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.nmm_lte_frequency_bands.bands[idx], out.nfapi_config.nmm_lte_frequency_bands.bands[idx]);
+	}
+
+	ASSERT_TLV(in.nfapi_config.nmm_uplink_rssi_supported, out.nfapi_config.nmm_uplink_rssi_supported); 
+}
+void nfapi_test_config_request()
+{
+	#define SET_TLV(_TLV, _TAG, _VALUE) { _TLV.tl.tag = _TAG; _TLV.value = _VALUE; num_tlv++;	}
+	#define ASSERT_TLV(IN_TLV, OUT_TLV) { CU_ASSERT_EQUAL(IN_TLV.tl.tag, OUT_TLV.tl.tag); CU_ASSERT_EQUAL(IN_TLV.value, OUT_TLV.value);}
+
+	nfapi_config_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_config_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CONFIG_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+
+	uint16_t idx = 0;
+	uint16_t num_tlv = 0; // Bit of a hack, it is incremented in the SET_UINT16_TLV macro
+
+	SET_TLV(in.subframe_config.duplex_mode, NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG, 1);
+	SET_TLV(in.subframe_config.pcfich_power_offset, NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG, 1000);
+	SET_TLV(in.subframe_config.pb, NFAPI_SUBFRAME_CONFIG_PB_TAG, 1);
+	SET_TLV(in.subframe_config.dl_cyclic_prefix_type, NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG, 0);
+	SET_TLV(in.subframe_config.ul_cyclic_prefix_type, NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG, 0);
+
+	SET_TLV(in.rf_config.dl_channel_bandwidth, NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG, 50);
+	SET_TLV(in.rf_config.ul_channel_bandwidth, NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG, 50);
+	SET_TLV(in.rf_config.reference_signal_power, NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG, 120);
+	SET_TLV(in.rf_config.tx_antenna_ports, NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG, 2);
+	SET_TLV(in.rf_config.rx_antenna_ports, NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG, 2);
+
+	SET_TLV(in.phich_config.phich_resource, NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG, 3);
+	SET_TLV(in.phich_config.phich_duration, NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG, 0);
+	SET_TLV(in.phich_config.phich_power_offset, NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG, 500);
+
+	SET_TLV(in.sch_config.primary_synchronization_signal_epre_eprers, NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, 1000);
+	SET_TLV(in.sch_config.secondary_synchronization_signal_epre_eprers, NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG, 2000);
+	SET_TLV(in.sch_config.physical_cell_id, NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG, 12344);
+
+
+	SET_TLV(in.prach_config.configuration_index, NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG, 63);
+	SET_TLV(in.prach_config.root_sequence_index, NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG, 800);
+	SET_TLV(in.prach_config.zero_correlation_zone_configuration, NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, 14);
+	SET_TLV(in.prach_config.high_speed_flag, NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG, 0);
+	SET_TLV(in.prach_config.frequency_offset, NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG, 23);
+
+	SET_TLV(in.pusch_config.hopping_mode, NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG, 0);
+	SET_TLV(in.pusch_config.hopping_offset, NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG, 55);
+	SET_TLV(in.pusch_config.number_of_subbands, NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG, 1);
+
+	SET_TLV(in.pucch_config.delta_pucch_shift, NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG, 2);
+	SET_TLV(in.pucch_config.n_cqi_rb, NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG, 88);
+	SET_TLV(in.pucch_config.n_an_cs, NFAPI_PUCCH_CONFIG_N_AN_CS_TAG, 3);
+	SET_TLV(in.pucch_config.n1_pucch_an, NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG, 2015);
+
+	SET_TLV(in.srs_config.bandwidth_configuration, NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG, 3);
+	SET_TLV(in.srs_config.max_up_pts, NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG, 0);
+	SET_TLV(in.srs_config.srs_subframe_configuration, NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG, 11);
+	SET_TLV(in.srs_config.srs_acknack_srs_simultaneous_transmission, NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG, 1);
+
+	SET_TLV(in.uplink_reference_signal_config.uplink_rs_hopping, NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG, 2);
+	SET_TLV(in.uplink_reference_signal_config.group_assignment, NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG, 22);
+	SET_TLV(in.uplink_reference_signal_config.cyclic_shift_1_for_drms, NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG, 2);
+
+
+	// laa config
+	SET_TLV(in.laa_config.ed_threshold_lbt_pdsch, NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG, 45);
+	SET_TLV(in.laa_config.ed_threshold_lbt_drs, NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG, 69);
+	SET_TLV(in.laa_config.pd_threshold, NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG, 65535);
+	SET_TLV(in.laa_config.multi_carrier_type, NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG, 3);
+	SET_TLV(in.laa_config.multi_carrier_tx, NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG, 1);
+	SET_TLV(in.laa_config.multi_carrier_freeze, NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG, 0);
+	SET_TLV(in.laa_config.tx_antenna_ports_drs, NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG, 4);
+	SET_TLV(in.laa_config.tx_power_drs, NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG, 10000);
+	//
+	// emtc config
+	SET_TLV(in.emtc_config.pbch_repetitions_enable_r13, NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG, 1);
+	SET_TLV(in.emtc_config.prach_catm_root_sequence_index, NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG, 837); 
+	SET_TLV(in.emtc_config.prach_catm_zero_correlation_zone_configuration, NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG, 15); 
+	SET_TLV(in.emtc_config.prach_catm_high_speed_flag, NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG, 15); 
+	SET_TLV(in.emtc_config.prach_ce_level_0_enable, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG, 1); 
+	SET_TLV(in.emtc_config.prach_ce_level_0_configuration_index, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG, 60);
+	SET_TLV(in.emtc_config.prach_ce_level_0_frequency_offset, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG, 90);
+	SET_TLV(in.emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, 128);
+	SET_TLV(in.emtc_config.prach_ce_level_0_starting_subframe_periodicity, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG, 256);
+	SET_TLV(in.emtc_config.prach_ce_level_0_hopping_enable, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG, 1);
+	SET_TLV(in.emtc_config.prach_ce_level_0_hopping_offset, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG, 0);
+	SET_TLV(in.emtc_config.prach_ce_level_1_enable, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG, 1);
+	SET_TLV(in.emtc_config.prach_ce_level_1_configuration_index, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG, 45);
+	SET_TLV(in.emtc_config.prach_ce_level_1_frequency_offset, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG, 88);
+	SET_TLV(in.emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, 64);
+	SET_TLV(in.emtc_config.prach_ce_level_1_starting_subframe_periodicity, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG, 0xFFFF);
+	SET_TLV(in.emtc_config.prach_ce_level_1_hopping_enable, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG, 1);
+	SET_TLV(in.emtc_config.prach_ce_level_1_hopping_offset, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG, 22);
+	SET_TLV(in.emtc_config.prach_ce_level_2_enable, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG, 1);
+	SET_TLV(in.emtc_config.prach_ce_level_2_configuration_index, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG, 63);
+	SET_TLV(in.emtc_config.prach_ce_level_2_frequency_offset, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG, 22);
+	SET_TLV(in.emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, 8);
+	SET_TLV(in.emtc_config.prach_ce_level_2_starting_subframe_periodicity, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG, 64)
+	SET_TLV(in.emtc_config.prach_ce_level_2_hopping_enable, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG, 1);
+	SET_TLV(in.emtc_config.prach_ce_level_2_hopping_offset, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG, 45);
+	SET_TLV(in.emtc_config.prach_ce_level_3_enable, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG, 0);
+	SET_TLV(in.emtc_config.prach_ce_level_3_configuration_index, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG, 45);
+	SET_TLV(in.emtc_config.prach_ce_level_3_frequency_offset, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG, 22);
+	SET_TLV(in.emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG, 4); 
+	SET_TLV(in.emtc_config.prach_ce_level_3_starting_subframe_periodicity, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG, 4);
+	SET_TLV(in.emtc_config.prach_ce_level_3_hopping_enable, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG, 0); 
+	SET_TLV(in.emtc_config.prach_ce_level_3_hopping_offset, NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG, 0);
+	SET_TLV(in.emtc_config.pucch_interval_ulhoppingconfigcommonmodea, NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG, 8);
+	SET_TLV(in.emtc_config.pucch_interval_ulhoppingconfigcommonmodeb, NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG, 8);
+
+
+	SET_TLV(in.tdd_frame_structure_config.subframe_assignment, NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG, 5);
+	SET_TLV(in.tdd_frame_structure_config.special_subframe_patterns, NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG, 3);
+
+	SET_TLV(in.l23_config.data_report_mode, NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG, 1);
+	SET_TLV(in.l23_config.sfnsf, NFAPI_L23_CONFIG_SFNSF_TAG, 12354);
+
+	in.nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
+	num_tlv++;
+
+	in.nfapi_config.p7_vnf_address_ipv6.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG;
+	num_tlv++;
+
+	SET_TLV(in.nfapi_config.p7_vnf_port, NFAPI_NFAPI_P7_VNF_PORT_TAG, 1111);
+	
+	in.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
+	num_tlv++;
+
+	in.nfapi_config.p7_pnf_address_ipv6.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG;
+	for(idx = 0; idx < NFAPI_IPV6_ADDRESS_LENGTH; ++idx)
+	{
+		in.nfapi_config.p7_pnf_address_ipv6.address[idx] = idx;
+	}
+	num_tlv++;
+
+	SET_TLV(in.nfapi_config.p7_pnf_port, NFAPI_NFAPI_P7_PNF_PORT_TAG, 9999);
+	SET_TLV(in.nfapi_config.dl_ue_per_sf, NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, 4);
+	SET_TLV(in.nfapi_config.ul_ue_per_sf, NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, 4);
+
+	in.nfapi_config.rf_bands.tl.tag = NFAPI_PHY_RF_BANDS_TAG;
+	in.nfapi_config.rf_bands.number_rf_bands = 2;
+	in.nfapi_config.rf_bands.rf_band[0] = 783;
+	num_tlv++;
+
+	SET_TLV(in.nfapi_config.timing_window, NFAPI_NFAPI_TIMING_WINDOW_TAG, 29);
+	SET_TLV(in.nfapi_config.timing_info_mode, NFAPI_NFAPI_TIMING_INFO_MODE_TAG, 2);
+	SET_TLV(in.nfapi_config.timing_info_period, NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG, 23);
+	SET_TLV(in.nfapi_config.max_transmit_power, NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, 123);
+	SET_TLV(in.nfapi_config.earfcn, NFAPI_NFAPI_EARFCN_TAG, 1800);
+
+	in.nfapi_config.nmm_gsm_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG;
+	in.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands = 2;
+	num_tlv++;
+
+	in.nfapi_config.nmm_umts_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG;
+	in.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands = 3;
+	num_tlv++;
+
+	in.nfapi_config.nmm_lte_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG;
+	in.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands = 1;
+	num_tlv++;
+
+	SET_TLV(in.nfapi_config.nmm_uplink_rssi_supported, NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, 1);
+
+
+	in.num_tlv = num_tlv;
+
+	in.vendor_extension = 0;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.num_tlv, out.num_tlv);
+
+	ASSERT_TLV(in.subframe_config.duplex_mode, out.subframe_config.duplex_mode);
+	ASSERT_TLV(in.subframe_config.pcfich_power_offset, out.subframe_config.pcfich_power_offset);
+	ASSERT_TLV(in.subframe_config.pb, out.subframe_config.pb);
+	ASSERT_TLV(in.subframe_config.dl_cyclic_prefix_type, out.subframe_config.dl_cyclic_prefix_type);
+	ASSERT_TLV(in.subframe_config.ul_cyclic_prefix_type, out.subframe_config.ul_cyclic_prefix_type);
+
+	ASSERT_TLV(in.rf_config.dl_channel_bandwidth, out.rf_config.dl_channel_bandwidth);
+	ASSERT_TLV(in.rf_config.ul_channel_bandwidth, out.rf_config.ul_channel_bandwidth);
+	ASSERT_TLV(in.rf_config.reference_signal_power, out.rf_config.reference_signal_power);
+	ASSERT_TLV(in.rf_config.tx_antenna_ports, out.rf_config.tx_antenna_ports);
+	ASSERT_TLV(in.rf_config.rx_antenna_ports, out.rf_config.rx_antenna_ports);
+
+	ASSERT_TLV(in.phich_config.phich_resource, out.phich_config.phich_resource);
+	ASSERT_TLV(in.phich_config.phich_duration, out.phich_config.phich_duration);
+	ASSERT_TLV(in.phich_config.phich_power_offset, out.phich_config.phich_power_offset);
+
+	ASSERT_TLV(in.sch_config.primary_synchronization_signal_epre_eprers, out.sch_config.primary_synchronization_signal_epre_eprers);
+	ASSERT_TLV(in.sch_config.secondary_synchronization_signal_epre_eprers, out.sch_config.secondary_synchronization_signal_epre_eprers);
+	ASSERT_TLV(in.sch_config.physical_cell_id, out.sch_config.physical_cell_id);
+
+
+	ASSERT_TLV(in.prach_config.configuration_index, out.prach_config.configuration_index);
+	ASSERT_TLV(in.prach_config.root_sequence_index, out.prach_config.root_sequence_index);
+	ASSERT_TLV(in.prach_config.zero_correlation_zone_configuration, out.prach_config.zero_correlation_zone_configuration);
+	ASSERT_TLV(in.prach_config.high_speed_flag, out.prach_config.high_speed_flag);
+	ASSERT_TLV(in.prach_config.frequency_offset, out.prach_config.frequency_offset);
+	
+	ASSERT_TLV(in.pusch_config.hopping_mode, in.pusch_config.hopping_mode);
+	ASSERT_TLV(in.pusch_config.hopping_offset, in.pusch_config.hopping_offset);
+	ASSERT_TLV(in.pusch_config.number_of_subbands, in.pusch_config.number_of_subbands);
+
+	ASSERT_TLV(in.pucch_config.delta_pucch_shift, out.pucch_config.delta_pucch_shift);
+	ASSERT_TLV(in.pucch_config.n_cqi_rb, out.pucch_config.n_cqi_rb);
+	ASSERT_TLV(in.pucch_config.n_an_cs, out.pucch_config.n_an_cs);
+	ASSERT_TLV(in.pucch_config.n1_pucch_an, out.pucch_config.n1_pucch_an);
+
+	ASSERT_TLV(in.srs_config.bandwidth_configuration, out.srs_config.bandwidth_configuration);
+	ASSERT_TLV(in.srs_config.max_up_pts, out.srs_config.max_up_pts);
+	ASSERT_TLV(in.srs_config.srs_subframe_configuration, out.srs_config.srs_subframe_configuration);
+	ASSERT_TLV(in.srs_config.srs_acknack_srs_simultaneous_transmission, out.srs_config.srs_acknack_srs_simultaneous_transmission);
+
+	ASSERT_TLV(in.uplink_reference_signal_config.uplink_rs_hopping, out.uplink_reference_signal_config.uplink_rs_hopping);
+	ASSERT_TLV(in.uplink_reference_signal_config.group_assignment, out.uplink_reference_signal_config.group_assignment);
+	ASSERT_TLV(in.uplink_reference_signal_config.cyclic_shift_1_for_drms, out.uplink_reference_signal_config.cyclic_shift_1_for_drms);
+
+	ASSERT_TLV(in.tdd_frame_structure_config.subframe_assignment, out.tdd_frame_structure_config.subframe_assignment);
+	ASSERT_TLV(in.tdd_frame_structure_config.special_subframe_patterns, out.tdd_frame_structure_config.special_subframe_patterns);
+
+	// laa config
+	ASSERT_TLV(in.laa_config.ed_threshold_lbt_pdsch, out.laa_config.ed_threshold_lbt_pdsch);
+	ASSERT_TLV(in.laa_config.ed_threshold_lbt_drs, out.laa_config.ed_threshold_lbt_drs);
+	ASSERT_TLV(in.laa_config.pd_threshold, out.laa_config.pd_threshold);
+	ASSERT_TLV(in.laa_config.multi_carrier_type, out.laa_config.multi_carrier_type);
+	ASSERT_TLV(in.laa_config.multi_carrier_tx, out.laa_config.multi_carrier_tx);
+	ASSERT_TLV(in.laa_config.multi_carrier_freeze, out.laa_config.multi_carrier_freeze);
+	ASSERT_TLV(in.laa_config.tx_antenna_ports_drs, out.laa_config.tx_antenna_ports_drs);
+	ASSERT_TLV(in.laa_config.tx_power_drs, out.laa_config.tx_power_drs);
+	// emtc config
+	ASSERT_TLV(in.emtc_config.pbch_repetitions_enable_r13, out.emtc_config.pbch_repetitions_enable_r13);
+	ASSERT_TLV(in.emtc_config.prach_catm_root_sequence_index, out.emtc_config.prach_catm_root_sequence_index);
+	ASSERT_TLV(in.emtc_config.prach_catm_zero_correlation_zone_configuration, out.emtc_config.prach_catm_zero_correlation_zone_configuration);
+	ASSERT_TLV(in.emtc_config.prach_catm_high_speed_flag, out.emtc_config.prach_catm_high_speed_flag);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_0_enable, out.emtc_config.prach_ce_level_0_enable);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_0_configuration_index, out.emtc_config.prach_ce_level_0_configuration_index);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_0_frequency_offset, out.emtc_config.prach_ce_level_0_frequency_offset);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt, out.emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_0_starting_subframe_periodicity, out.emtc_config.prach_ce_level_0_starting_subframe_periodicity);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_0_hopping_enable, out.emtc_config.prach_ce_level_0_hopping_enable);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_0_hopping_offset, out.emtc_config.prach_ce_level_0_hopping_offset);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_1_enable, out.emtc_config.prach_ce_level_1_enable);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_1_configuration_index, out.emtc_config.prach_ce_level_1_configuration_index);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_1_frequency_offset, out.emtc_config.prach_ce_level_1_frequency_offset);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt, out.emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_1_starting_subframe_periodicity, out.emtc_config.prach_ce_level_1_starting_subframe_periodicity);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_1_hopping_enable, out.emtc_config.prach_ce_level_1_hopping_enable);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_1_hopping_offset, out.emtc_config.prach_ce_level_1_hopping_offset);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_2_enable, out.emtc_config.prach_ce_level_2_enable);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_2_configuration_index, out.emtc_config.prach_ce_level_2_configuration_index);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_2_frequency_offset, out.emtc_config.prach_ce_level_2_frequency_offset);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt, out.emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_2_starting_subframe_periodicity, out.emtc_config.prach_ce_level_2_starting_subframe_periodicity);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_2_hopping_enable, out.emtc_config.prach_ce_level_2_hopping_enable);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_2_hopping_offset, out.emtc_config.prach_ce_level_2_hopping_offset);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_3_enable, out.emtc_config.prach_ce_level_3_enable);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_3_configuration_index, out.emtc_config.prach_ce_level_3_configuration_index);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_3_frequency_offset, out.emtc_config.prach_ce_level_3_frequency_offset);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt, out.emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_3_starting_subframe_periodicity, out.emtc_config.prach_ce_level_3_starting_subframe_periodicity);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_3_hopping_enable, out.emtc_config.prach_ce_level_3_hopping_enable);
+	ASSERT_TLV(in.emtc_config.prach_ce_level_3_hopping_offset, out.emtc_config.prach_ce_level_3_hopping_offset);
+	ASSERT_TLV(in.emtc_config.pucch_interval_ulhoppingconfigcommonmodea, out.emtc_config.pucch_interval_ulhoppingconfigcommonmodea);
+	ASSERT_TLV(in.emtc_config.pucch_interval_ulhoppingconfigcommonmodeb, out.emtc_config.pucch_interval_ulhoppingconfigcommonmodeb);
+
+	ASSERT_TLV(in.l23_config.data_report_mode, out.l23_config.data_report_mode);
+	ASSERT_TLV(in.l23_config.sfnsf, out.l23_config.sfnsf);
+
+	CU_ASSERT_EQUAL(in.nfapi_config.p7_vnf_address_ipv4.tl.tag, out.nfapi_config.p7_vnf_address_ipv4.tl.tag);
+	for(idx = 0; idx < NFAPI_IPV4_ADDRESS_LENGTH; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.p7_vnf_address_ipv4.address[idx], out.nfapi_config.p7_vnf_address_ipv4.address[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.nfapi_config.p7_vnf_address_ipv6.tl.tag, out.nfapi_config.p7_vnf_address_ipv6.tl.tag);
+	for(idx = 0; idx < NFAPI_IPV6_ADDRESS_LENGTH; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.p7_vnf_address_ipv6.address[idx], out.nfapi_config.p7_vnf_address_ipv6.address[idx]);
+	}
+
+	ASSERT_TLV(in.nfapi_config.p7_vnf_port, out.nfapi_config.p7_vnf_port);
+	
+	CU_ASSERT_EQUAL(in.nfapi_config.p7_pnf_address_ipv4.tl.tag, out.nfapi_config.p7_pnf_address_ipv4.tl.tag);
+	for(idx = 0; idx < NFAPI_IPV4_ADDRESS_LENGTH; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.p7_pnf_address_ipv4.address[idx], out.nfapi_config.p7_pnf_address_ipv4.address[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.nfapi_config.p7_pnf_address_ipv6.tl.tag, out.nfapi_config.p7_pnf_address_ipv6.tl.tag);
+	for(idx = 0; idx < NFAPI_IPV6_ADDRESS_LENGTH; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.p7_pnf_address_ipv6.address[idx], out.nfapi_config.p7_pnf_address_ipv6.address[idx]);
+	}
+
+	ASSERT_TLV(in.nfapi_config.p7_pnf_port, out.nfapi_config.p7_pnf_port);
+	ASSERT_TLV(in.nfapi_config.dl_ue_per_sf, out.nfapi_config.dl_ue_per_sf);
+	ASSERT_TLV(in.nfapi_config.ul_ue_per_sf, out.nfapi_config.ul_ue_per_sf);
+
+	CU_ASSERT_EQUAL(in.nfapi_config.rf_bands.tl.tag, out.nfapi_config.rf_bands.tl.tag);
+	CU_ASSERT_EQUAL(in.nfapi_config.rf_bands.number_rf_bands, out.nfapi_config.rf_bands.number_rf_bands);
+	for(idx = 0; idx < out.nfapi_config.rf_bands.number_rf_bands; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.rf_bands.rf_band[idx], out.nfapi_config.rf_bands.rf_band[idx]);
+	}
+
+	ASSERT_TLV(in.nfapi_config.timing_window, out.nfapi_config.timing_window);
+	ASSERT_TLV(in.nfapi_config.timing_info_mode, out.nfapi_config.timing_info_mode);
+	ASSERT_TLV(in.nfapi_config.timing_info_period, out.nfapi_config.timing_info_period);
+	ASSERT_TLV(in.nfapi_config.max_transmit_power, out.nfapi_config.max_transmit_power);
+	ASSERT_TLV(in.nfapi_config.earfcn, out.nfapi_config.earfcn); 
+
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_gsm_frequency_bands.tl.tag, out.nfapi_config.nmm_gsm_frequency_bands.tl.tag);
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands, out.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands);
+	for(idx = 0; idx < out.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.nmm_gsm_frequency_bands.bands[idx], out.nfapi_config.nmm_gsm_frequency_bands.bands[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_umts_frequency_bands.tl.tag, out.nfapi_config.nmm_umts_frequency_bands.tl.tag);
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands, out.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands);
+	for(idx = 0; idx < out.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.nmm_umts_frequency_bands.bands[idx], out.nfapi_config.nmm_umts_frequency_bands.bands[idx]);
+	}
+
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_lte_frequency_bands.tl.tag, out.nfapi_config.nmm_lte_frequency_bands.tl.tag);
+	CU_ASSERT_EQUAL(in.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands, out.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands);
+	for(idx = 0; idx < out.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands; ++idx)
+	{
+		CU_ASSERT_EQUAL(in.nfapi_config.nmm_lte_frequency_bands.bands[idx], out.nfapi_config.nmm_lte_frequency_bands.bands[idx]);
+	}
+
+	ASSERT_TLV(in.nfapi_config.nmm_uplink_rssi_supported, out.nfapi_config.nmm_uplink_rssi_supported); 
+}
+void nfapi_test_config_response()
+{
+	nfapi_config_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_config_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CONFIG_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+void nfapi_test_start_request()
+{
+	nfapi_start_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_start_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_START_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+}
+void nfapi_test_start_response()
+{
+	nfapi_start_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_start_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_START_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+void nfapi_test_stop_request()
+{
+	nfapi_stop_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_stop_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_STOP_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+
+}
+void nfapi_test_stop_response()
+{
+	nfapi_stop_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_stop_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_STOP_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+}
+void nfapi_test_measurement_request()
+{
+//	#define SET_TLV(_TLV, _TAG, _VALUE) { _TLV.tl.tag = _TAG; _TLV.value = _VALUE; }
+//	#define ASSERT_TLV(IN_TLV, OUT_TLV) { CU_ASSERT_EQUAL(IN_TLV.tl.tag, OUT_TLV.tl.tag); CU_ASSERT_EQUAL(IN_TLV.value, OUT_TLV.value);}
+	uint16_t num_tlv = 0;
+	nfapi_measurement_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_measurement_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_MEASUREMENT_REQUEST;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	SET_TLV(in.dl_rs_tx_power, NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG, 1);
+	SET_TLV(in.received_interference_power, NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG, 123);
+	SET_TLV(in.thermal_noise_power, NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG, 255);
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+
+
+	ASSERT_TLV(in.dl_rs_tx_power, out.dl_rs_tx_power);
+	ASSERT_TLV(in.received_interference_power, out.received_interference_power);
+	ASSERT_TLV(in.thermal_noise_power, out.thermal_noise_power);
+}
+void nfapi_test_measurement_response()
+{
+	uint16_t num_tlv = 0;
+	nfapi_measurement_response_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_measurement_response_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_MEASUREMENT_RESPONSE;
+	in.header.message_length = 0;
+	in.header.spare = 0;
+
+	in.error_code = NFAPI_MSG_OK;
+
+	SET_TLV(in.dl_rs_tx_power_measurement, NFAPI_MEASUREMENT_RESPONSE_DL_RS_POWER_MEASUREMENT_TAG, -400);
+
+	in.received_interference_power_measurement.tl.tag = NFAPI_MEASUREMENT_RESPONSE_RECEIVED_INTERFERENCE_POWER_MEASUREMENT_TAG;
+	in.received_interference_power_measurement.number_of_resource_blocks = 100;
+	in.received_interference_power_measurement.received_interference_power[0] = -8767;
+
+	SET_TLV(in.thermal_noise_power_measurement, NFAPI_MEASUREMENT_RESPONSE_THERMAL_NOISE_MEASUREMENT_TAG, -8900);
+
+	int packedMessageLength = nfapi_p5_message_pack(&in, sizeof(in), gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p5_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.error_code, out.error_code);
+
+	ASSERT_TLV(in.dl_rs_tx_power_measurement, out.dl_rs_tx_power_measurement);
+	CU_ASSERT_EQUAL(in.received_interference_power_measurement.tl.tag, out.received_interference_power_measurement.tl.tag);
+	CU_ASSERT_EQUAL(in.received_interference_power_measurement.number_of_resource_blocks, out.received_interference_power_measurement.number_of_resource_blocks);
+	// check array
+	ASSERT_TLV(in.thermal_noise_power_measurement, out.thermal_noise_power_measurement);
+}
+
+void nfapi_test_dl_config_request()
+{
+
+
+	uint16_t idx = 0;
+	nfapi_dl_config_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_dl_config_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_DL_CONFIG_REQUEST;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 0x3FFF;
+
+	in.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+	in.dl_config_request_body.number_pdcch_ofdm_symbols = 4;
+	in.dl_config_request_body.number_dci = 255;
+	in.dl_config_request_body.number_pdu = 0;
+	in.dl_config_request_body.number_pdsch_rnti = 0;
+	in.dl_config_request_body.transmission_power_pcfich = 10000;
+
+	in.dl_config_request_body.dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)(malloc(sizeof(nfapi_dl_config_request_pdu_t) * 12));
+	
+	in.dl_config_request_body.dl_config_pdu_list[0].pdu_type = 0;
+	in.dl_config_request_body.dl_config_pdu_list[0].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.primary_cell_type = rand8(0, 2);
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_flag = rand8(0, 1);
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.number_ul_dl_configurations = rand8(0, 5);
+	for(idx = 0; idx <in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.number_ul_dl_configurations; ++idx)
+	{
+		in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_indication[idx] = rand8(1, 5);
+	}
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag = 1; //rand8(0, 1);
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_prb_per_subband = 3;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands = 2;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas = 2;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[0].subband_index = 1;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[0].scheduled_ues = 2;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[0].precoding_value[0][0] = 0x321;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[0].precoding_value[0][1] = 0x321;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[0].precoding_value[1][0] = 0x321;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[0].precoding_value[1][1] = 0x321;
+	
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[1].subband_index = 2;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[1].scheduled_ues = 1;	
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[1].precoding_value[0][0] = 0x32A;
+	in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[1].precoding_value[1][0] = 0x32A;
+
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[1].pdu_type = 1;
+	in.dl_config_request_body.dl_config_pdu_list[1].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[1].bch_pdu.bch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[2].pdu_type = 2;
+	in.dl_config_request_body.dl_config_pdu_list[2].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[2].mch_pdu.mch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG;
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[3].pdu_type = 3;
+	in.dl_config_request_body.dl_config_pdu_list[3].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[4].pdu_type = 4;
+	in.dl_config_request_body.dl_config_pdu_list[4].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[4].pch_pdu.pch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[4].pch_pdu.pch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG;
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[5].pdu_type = 5;
+	in.dl_config_request_body.dl_config_pdu_list[5].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[5].prs_pdu.prs_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG;
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[6].pdu_type = 6;
+	in.dl_config_request_body.dl_config_pdu_list[6].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[6].csi_rs_pdu.csi_rs_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[6].csi_rs_pdu.csi_rs_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG;
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[7].pdu_type = 7;
+	in.dl_config_request_body.dl_config_pdu_list[7].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_params_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG;
+	in.dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_params_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG;
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[8].pdu_type = 8;
+	in.dl_config_request_body.dl_config_pdu_list[8].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[8].mpdcch_pdu.mpdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG;
+	in.dl_config_request_body.number_pdu++;
+
+	in.dl_config_request_body.dl_config_pdu_list[9].pdu_type = 9;
+	in.dl_config_request_body.dl_config_pdu_list[9].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[9].nbch_pdu.nbch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG;
+	in.dl_config_request_body.number_pdu++;
+	
+	in.dl_config_request_body.dl_config_pdu_list[10].pdu_type = 10;
+	in.dl_config_request_body.dl_config_pdu_list[10].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG;
+	in.dl_config_request_body.number_pdu++;
+	
+	in.dl_config_request_body.dl_config_pdu_list[11].pdu_type = 11;
+	in.dl_config_request_body.dl_config_pdu_list[11].pdu_size = 123;
+	in.dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG;
+	in.dl_config_request_body.number_pdu++;
+	
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, 0);
+	CU_ASSERT_NOT_EQUAL(packedMessageLength, -1);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+	CU_ASSERT_EQUAL(in.dl_config_request_body.tl.tag, out.dl_config_request_body.tl.tag);
+	CU_ASSERT_EQUAL(in.dl_config_request_body.number_pdcch_ofdm_symbols, out.dl_config_request_body.number_pdcch_ofdm_symbols);
+	CU_ASSERT_EQUAL(in.dl_config_request_body.number_dci, out.dl_config_request_body.number_dci);
+	CU_ASSERT_EQUAL(in.dl_config_request_body.number_pdu, out.dl_config_request_body.number_pdu);
+	CU_ASSERT_EQUAL(in.dl_config_request_body.number_pdsch_rnti, out.dl_config_request_body.number_pdsch_rnti);
+	CU_ASSERT_EQUAL(in.dl_config_request_body.transmission_power_pcfich, out.dl_config_request_body.transmission_power_pcfich);
+
+
+	CU_ASSERT_EQUAL(in.dl_config_request_body.dl_config_pdu_list[0].pdu_type, out.dl_config_request_body.dl_config_pdu_list[0].pdu_type);
+	CU_ASSERT_EQUAL(in.dl_config_request_body.dl_config_pdu_list[0].pdu_size, out.dl_config_request_body.dl_config_pdu_list[0].pdu_size);
+	CU_ASSERT_EQUAL(in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.tl.tag, out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.dci_format);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.rnti);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.mcs_1);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.transport_block_to_codeword_swap_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.mcs_2);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_2);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.harq_process);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.tpmi);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.pmi);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.precoding_information);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.tpc);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.ngap);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.transport_block_size_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.downlink_power_offset);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.allocate_prach_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.preamble_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.prach_mask_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel8.transmission_power);
+
+	CU_ASSERT_EQUAL(in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel9.tl.tag, out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel9.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel9.mcch_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel9.mcch_change_notification);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel9.scrambling_identity);
+
+	CU_ASSERT_EQUAL(in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.tl.tag, out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.cross_carrier_scheduling_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.carrier_indicator);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.srs_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.srs_request);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.antenna_ports_scrambling_and_layers);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.total_dci_length_including_padding);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel10.n_dl_rb);
+
+	CU_ASSERT_EQUAL(in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel11.tl.tag, out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel11.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel11.harq_ack_resource_offset);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel11.pdsch_re_mapping_quasi_co_location_indicator);
+
+	CU_ASSERT_EQUAL(in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.tl.tag, out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.primary_cell_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.number_ul_dl_configurations);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_indication[NFAPI_MAX_UL_DL_CONFIGURATIONS -1]);
+
+	CU_ASSERT_EQUAL(in.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tl.tag, out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.laa_end_partial_sf_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.laa_end_partial_sf_configuration);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.initial_lbt_sf);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.codebook_size_determination);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.drms_table_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag);
+	if(out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag)
+	{
+		
+		IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_prb_per_subband);
+		IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands);
+		IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas);
+		
+		uint8_t sb_idx;
+		for(sb_idx = 0; sb_idx < out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands; ++sb_idx)
+		{
+			IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[sb_idx].subband_index);
+			IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[sb_idx].scheduled_ues);
+			
+			uint8_t a_idx;
+			uint8_t su_idx;
+			
+			for(a_idx = 0; a_idx < out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas ; ++a_idx)
+			{
+				for(su_idx = 0; su_idx < out.dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[sb_idx].scheduled_ues; ++su_idx)
+				{
+					IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[0].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[sb_idx].precoding_value[a_idx][su_idx]);
+				}
+			}
+		}
+	}
+
+
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[1].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[1].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[1].bch_pdu.bch_pdu_rel8.tl.tag);
+
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[2].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[2].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[2].mch_pdu.mch_pdu_rel8.tl.tag);
+
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[3].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[3].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel8.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel9.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel10.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel11.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel12.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[3].dlsch_pdu.dlsch_pdu_rel13.tl.tag);
+
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[4].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[4].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[4].pch_pdu.pch_pdu_rel8.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[4].pch_pdu.pch_pdu_rel13.tl.tag);
+
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[5].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[5].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[5].prs_pdu.prs_pdu_rel9.tl.tag);
+
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[6].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[6].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[6].csi_rs_pdu.csi_rs_pdu_rel10.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[6].csi_rs_pdu.csi_rs_pdu_rel13.tl.tag);
+
+	
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel8.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel9.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel10.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel11.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel12.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_pdu_rel13.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_params_rel11.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[7].epdcch_pdu.epdcch_params_rel13.tl.tag);
+
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[8].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[8].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[8].mpdcch_pdu.mpdcch_pdu_rel13.tl.tag);
+	
+	//in.dl_config_request_body.dl_config_pdu_list[8].mpdcch_pdu;
+	//
+	
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[9].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[9].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[9].nbch_pdu.nbch_pdu_rel13.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[9].nbch_pdu.nbch_pdu_rel13.length);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[9].nbch_pdu.nbch_pdu_rel13.pdu_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[9].nbch_pdu.nbch_pdu_rel13.transmission_power);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[9].nbch_pdu.nbch_pdu_rel13.hyper_sfn_2_lsbs);
+	
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.length);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.pdu_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.ncce_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.aggregation_level);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.start_symbol);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.rnti_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.rnti);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.scrambling_reinitialization_batch_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.dci_format);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.scheduling_delay);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.resource_assignment);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.repetition_number);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.mcs);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.new_data_indicator);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.starting_number_of_nprach_repetitions);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.subcarrier_indication_of_nprach);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.paging_direct_indication_differentation_flag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.direct_indication);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[10].npdcch_pdu.npdcch_pdu_rel13.total_dci_length_including_padding);
+	
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].pdu_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].pdu_size);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.tl.tag);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.length);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.pdu_index);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.start_symbol);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.rnti_type);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.rnti);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.repetition_number);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.modulation);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.scrambling_sequence_initialization_cinit);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.sf_idx);
+	IN_OUT_ASSERT(dl_config_request_body.dl_config_pdu_list[11].ndlsch_pdu.ndlsch_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue);
+	
+	
+	free(in.dl_config_request_body.dl_config_pdu_list);
+	free(out.dl_config_request_body.dl_config_pdu_list);
+}
+void nfapi_test_ul_config_request()
+{
+	nfapi_ul_config_request_t in;
+	//memset(&in, 0, sizeof(in));
+	nfapi_ul_config_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_UL_CONFIG_REQUEST;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 0x3FFF;
+
+	in.ul_config_request_body.tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+	in.ul_config_request_body.number_of_pdus = 0;
+	in.ul_config_request_body.rach_prach_frequency_resources = 34;
+	in.ul_config_request_body.srs_present = 1;
+	
+	nfapi_ul_config_request_pdu_t ul_config_pdu_list[24];
+	memset(&ul_config_pdu_list[0], 0, sizeof(ul_config_pdu_list));
+	in.ul_config_request_body.ul_config_pdu_list = &ul_config_pdu_list[0];
+	
+	in.ul_config_request_body.ul_config_pdu_list[0].pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[0].ulsch_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[1].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[1].ulsch_cqi_ri_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[2].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[2].ulsch_harq_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[3].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[3].ulsch_cqi_harq_ri_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[4].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[4].uci_cqi_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+
+	in.ul_config_request_body.ul_config_pdu_list[5].pdu_type = NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[5].uci_sr_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[6].pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[6].uci_harq_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[7].pdu_type = NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[7].uci_sr_harq_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[8].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[8].uci_cqi_harq_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[9].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[9].uci_cqi_sr_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[10].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[10].uci_cqi_sr_harq_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[11].pdu_type = NFAPI_UL_CONFIG_SRS_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[11].srs_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[12].pdu_type = NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[12].harq_buffer_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[13].pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[13].ulsch_uci_csi_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[14].pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[14].ulsch_uci_harq_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[15].pdu_type = NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE;
+	//in.ul_config_request_body.ul_config_pdu_list[15].ulsch_csi_uci_harq_pdu;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[16].pdu_type = NFAPI_UL_CONFIG_NULSCH_PDU_TYPE;
+	in.ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG;
+	in.ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+	in.ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG;
+	in.ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
+	in.ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG;
+	in.ul_config_request_body.number_of_pdus++;
+	
+	in.ul_config_request_body.ul_config_pdu_list[17].pdu_type = NFAPI_UL_CONFIG_NRACH_PDU_TYPE;
+	in.ul_config_request_body.ul_config_pdu_list[17].nrach_pdu.nrach_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG;
+	in.ul_config_request_body.number_of_pdus++;
+	
+
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	IN_OUT_ASSERT(header.message_id);
+	IN_OUT_ASSERT(sfn_sf);
+	IN_OUT_ASSERT(ul_config_request_body.rach_prach_frequency_resources);
+	IN_OUT_ASSERT(ul_config_request_body.srs_present);
+	IN_OUT_ASSERT(ul_config_request_body.number_of_pdus);
+	
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[0].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[1].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[2].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[3].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[4].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[5].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[6].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[7].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[8].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[9].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[10].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[11].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[12].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[13].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[14].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[15].pdu_type);
+	
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].pdu_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.tl.tag);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.nulsch_format);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.handle);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.size);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.rnti);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.subcarrier_indication);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.resource_assignment);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.mcs);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.redudancy_version);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.repetition_number);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.new_data_indication);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.n_srs);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.scrambling_sequence_initialization_cinit);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.sf_idx);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.tl.tag);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.handle);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.rnti);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.tl.tag);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.virtual_cell_id_enabled_flag);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.npusch_identity);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.tl.tag);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.ue_type);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.empty_symbols);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.total_number_of_repetitions);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.repetition_number);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.tl.tag);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.harq_ack_resource);
+	
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[17].nrach_pdu.nrach_pdu_rel13.tl.tag);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[17].nrach_pdu.nrach_pdu_rel13.nprach_config_0);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[17].nrach_pdu.nrach_pdu_rel13.nprach_config_1);
+	IN_OUT_ASSERT(ul_config_request_body.ul_config_pdu_list[17].nrach_pdu.nrach_pdu_rel13.nprach_config_2);
+	
+
+	free(out.ul_config_request_body.ul_config_pdu_list);
+	
+}
+void nfapi_test_hi_dci0_request()
+{
+	nfapi_hi_dci0_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_hi_dci0_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_HI_DCI0_REQUEST;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 9999;
+	in.hi_dci0_request_body.tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
+	in.hi_dci0_request_body.sfnsf = 123;
+	in.hi_dci0_request_body.number_of_dci = 0;
+	in.hi_dci0_request_body.number_of_hi = 0;
+
+	in.hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)malloc(sizeof(nfapi_hi_dci0_request_pdu_t) * 8);
+
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel8.resource_block_start = 2;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = 23;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel8.hi_value = 0;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel8.i_phich = 2;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel8.transmission_power = 12312;;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel10.flag_tb2 = 1;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel10.hi_value_2 = 2;
+
+	in.hi_dci0_request_body.number_of_hi++;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG;
+	/*
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.dci_format;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.cce_index;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.aggregation_level;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.rnti;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.resource_block_start;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.number_of_resource_block;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.mcs_1;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.frequency_hopping_bits;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.new_data_indication_1;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.ue_tx_antenna_seleciton;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.tpc;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.cqi_csi_request;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.ul_index;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.dl_assignment_index;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.tpc_bitmap;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.transmission_power;
+	*/
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG;
+	/*
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.cross_carrier_scheduling_flag;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.carrier_indicator;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.size_of_cqi_csi_feild;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.srs_flag;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.srs_request;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.resource_allocation_flag;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.resource_allocation_type;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.resource_block_coding;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.mcs_2;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.new_data_indication_2;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.number_of_antenna_ports;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.tpmi;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.total_dci_length_including_padding;
+	*/
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel12.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG;
+	/*
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel12.pscch_resource;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel12.time_resource_pattern;
+	*/
+
+	in.hi_dci0_request_body.number_of_dci++;
+
+	in.hi_dci0_request_body.hi_dci0_pdu_list[2].pdu_type = NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[2].epdcch_dci_pdu.epdcch_parameters_rel11.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG;
+	/*
+	in.hi_dci0_request_body.hi_dci0_pdu_list[2].edpcch_dci_pdu.edpcch_dci_pdu_rel8;
+	uint8_t dci_format;
+	uint8_t cce_index;
+	uint8_t aggregation_level;
+	uint16_t rnti;
+	uint8_t resource_block_start;
+	uint8_t number_of_resource_block;
+	uint8_t mcs_1;
+	uint8_t cyclic_shift_2_for_drms;
+	uint8_t frequency_hopping_enabled_flag;
+	uint8_t frequency_hopping_bits;
+	uint8_t new_data_indication_1;
+	uint8_t ue_tx_antenna_seleciton;
+	uint8_t tpc;
+	uint8_t cqi_csi_request;
+	uint8_t ul_index;
+	uint8_t dl_assignment_index;
+	uint32_t tpc_bitmap;
+	uint16_t transmission_power;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[2].edpcch_dci_pdu.edpcch_dci_pdu_rel10.cross_carrier_scheduling_flag;
+	uint8_t carrier_indicator;
+	uint8_t size_of_cqi_csi_feild;
+	uint8_t srs_flag;
+	uint8_t srs_request;
+	uint8_t resource_allocation_flag;
+	uint8_t resource_allocation_type;
+	uint32_t resource_block_coding;
+	uint8_t mcs_2;
+	uint8_t new_data_indication_2;
+	uint8_t number_of_antenna_ports;
+	uint8_t tpmi;
+	uint8_t total_dci_length_including_padding;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[2].edpcch_dci_pdu.edpcch_parameters_rel11.edpcch_resource_assigenment_flag;
+	uint16_t edpcch_id;
+	uint8_t epdcch_start_symbol;
+	uint8_t epdcch_num_prb;
+	uint8_t epdcch_prb_index[NFAPI_MAX_EPDCCH_PRB];
+	nfapi_bf_vector_t bf_vector;
+	*/
+	in.hi_dci0_request_body.number_of_dci++;
+	
+	in.hi_dci0_request_body.hi_dci0_pdu_list[3].pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[3].mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tl.tag = NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG;
+	/*
+	in.hi_dci0_request_body.hi_dci0_pdu_list[3].mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband;
+	uint8_t number_of_prb_pairs;
+	uint8_t resource_block_assignment;
+	uint8_t mpdcch_transmission_type;
+	uint8_t start_symbol;
+	uint8_t ecce_index;
+	uint8_t aggreagation_level;
+	uint8_t rnti_type;
+	uint16_t rnti;
+	uint8_t ce_mode;
+	uint16_t drms_scrambling_init;
+	uint16_t initial_transmission_sf_io;
+	uint16_t transmission_power;
+	uint8_t dci_format;
+	uint8_t resource_block_start;
+	uint8_t number_of_resource_blocks;
+	uint8_t mcs;
+	uint8_t pusch_repetition_levels;
+	uint8_t frequency_hopping_flag;
+	uint8_t new_data_indication;
+	uint8_t harq_process;
+	uint8_t redudency_version;
+	uint8_t tpc;
+	uint8_t csi_request;
+	uint8_t ul_inex;
+	uint8_t dai_presence_flag;
+	uint8_t dl_assignment_index;
+	uint8_t srs_request;
+	uint8_t dci_subframe_repetition_number;
+	uint32_t tcp_bitmap;
+	uint8_t total_dci_length_include_padding;
+	uint8_t number_of_tx_antenna_ports;
+	uint16_t precoding_value[NFAPI_MAX_ANTENNA_PORT_COUNT];
+	*/
+	in.hi_dci0_request_body.number_of_dci++;
+
+	in.hi_dci0_request_body.hi_dci0_pdu_list[4].pdu_type = NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE;
+	in.hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.tl.tag = NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG;
+	in.hi_dci0_request_body.number_of_dci++;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.tl.tag, out.hi_dci0_request_body.tl.tag);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.sfnsf, out.hi_dci0_request_body.sfnsf);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.number_of_dci, out.hi_dci0_request_body.number_of_dci);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.number_of_hi, out.hi_dci0_request_body.number_of_hi);
+
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[0].pdu_type, out.hi_dci0_request_body.hi_dci0_pdu_list[0].pdu_type);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel8.tl.tag, out.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel10.tl.tag, out.hi_dci0_request_body.hi_dci0_pdu_list[0].hi_pdu.hi_pdu_rel10.tl.tag);
+
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[1].pdu_type, out.hi_dci0_request_body.hi_dci0_pdu_list[1].pdu_type);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.tl.tag, out.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.tl.tag, out.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel10.tl.tag);
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel12.tl.tag, out.hi_dci0_request_body.hi_dci0_pdu_list[1].dci_pdu.dci_pdu_rel12.tl.tag);
+
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[2].pdu_type, out.hi_dci0_request_body.hi_dci0_pdu_list[2].pdu_type);
+
+	CU_ASSERT_EQUAL(in.hi_dci0_request_body.hi_dci0_pdu_list[3].pdu_type, out.hi_dci0_request_body.hi_dci0_pdu_list[3].pdu_type);
+	
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].pdu_type);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.tl.tag);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.ncce_index);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.start_symbol);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scrambling_reinitialization_batch_index);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.subcarrier_indication);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.resource_assignment);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scheduling_delay);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.mcs);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.redudancy_version);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.repetition_number);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.new_data_indicator);
+	IN_OUT_ASSERT(hi_dci0_request_body.hi_dci0_pdu_list[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number);
+
+	free(in.hi_dci0_request_body.hi_dci0_pdu_list);
+	free(out.hi_dci0_request_body.hi_dci0_pdu_list);
+}
+void nfapi_test_tx_request()
+{
+	nfapi_tx_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_tx_request_t out;
+
+	nfapi_p7_codec_config_t config;
+	config.allocate = &nfapi_allocate_pdu;
+	//config.deallocate = &nfapi_deallocate_pdu;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_TX_REQUEST;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	uint8_t pdu1_seg1[16];
+	uint8_t pdu1_seg2[16];
+	uint8_t pdu2[8];
+
+	in.sfn_sf = 10230;
+	in.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+	in.tx_request_body.number_of_pdus = 2;
+
+	in.tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)(malloc(sizeof(nfapi_tx_request_pdu_t) * in.tx_request_body.number_of_pdus));
+
+	in.tx_request_body.tx_pdu_list[0].pdu_length = sizeof(pdu1_seg1) + sizeof(pdu1_seg2);
+	in.tx_request_body.tx_pdu_list[0].pdu_index = 0;
+	in.tx_request_body.tx_pdu_list[0].num_segments = 2;
+	in.tx_request_body.tx_pdu_list[0].segments[0].segment_length = sizeof(pdu1_seg1);
+	in.tx_request_body.tx_pdu_list[0].segments[0].segment_data = pdu1_seg1;
+	in.tx_request_body.tx_pdu_list[0].segments[1].segment_length = sizeof(pdu1_seg2);
+	in.tx_request_body.tx_pdu_list[0].segments[1].segment_data = pdu1_seg2;
+
+	in.tx_request_body.tx_pdu_list[1].pdu_length = sizeof(pdu2);
+	in.tx_request_body.tx_pdu_list[1].pdu_index = 0;
+	in.tx_request_body.tx_pdu_list[1].num_segments = 1;
+	in.tx_request_body.tx_pdu_list[1].segments[0].segment_length = sizeof(pdu2);
+	in.tx_request_body.tx_pdu_list[1].segments[0].segment_data = pdu2;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, &config);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), &config);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+	CU_ASSERT_EQUAL(in.tx_request_body.tl.tag, out.tx_request_body.tl.tag);
+	CU_ASSERT_EQUAL(in.tx_request_body.number_of_pdus, out.tx_request_body.number_of_pdus);
+	CU_ASSERT_EQUAL(in.tx_request_body.tx_pdu_list[0].pdu_length, out.tx_request_body.tx_pdu_list[0].pdu_length);
+	CU_ASSERT_EQUAL(1, out.tx_request_body.tx_pdu_list[0].num_segments);
+
+	CU_ASSERT_EQUAL(in.tx_request_body.tx_pdu_list[1].pdu_length, out.tx_request_body.tx_pdu_list[1].pdu_length);
+	CU_ASSERT_EQUAL(1, out.tx_request_body.tx_pdu_list[1].num_segments);
+
+	CU_ASSERT_EQUAL(0, memcmp(pdu2, out.tx_request_body.tx_pdu_list[1].segments[0].segment_data, sizeof(pdu2)));
+
+	free(out.tx_request_body.tx_pdu_list[0].segments[0].segment_data);
+	free(out.tx_request_body.tx_pdu_list[1].segments[0].segment_data);
+
+	free(in.tx_request_body.tx_pdu_list);
+	free(out.tx_request_body.tx_pdu_list);
+}
+void nfapi_test_harq_indication()
+{
+	nfapi_harq_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_harq_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_HARQ_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 10230;
+	in.harq_indication_body.tl.tag = NFAPI_HARQ_INDICATION_BODY_TAG;
+	in.harq_indication_body.number_of_harqs = 6;
+
+	in.harq_indication_body.harq_pdu_list = (nfapi_harq_indication_pdu_t*)(calloc(1, sizeof(nfapi_harq_indication_pdu_t) * in.harq_indication_body.number_of_harqs));
+
+	in.harq_indication_body.harq_pdu_list[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.harq_indication_body.harq_pdu_list[0].harq_indication_tdd_rel8.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL8_TAG;
+	in.harq_indication_body.harq_pdu_list[0].harq_indication_tdd_rel8.mode = 0;
+	in.harq_indication_body.harq_pdu_list[0].harq_indication_tdd_rel8.number_of_ack_nack = 2;
+	in.harq_indication_body.harq_pdu_list[0].harq_indication_tdd_rel8.harq_data.bundling.value_0 = 6;
+	in.harq_indication_body.harq_pdu_list[0].harq_indication_tdd_rel8.harq_data.bundling.value_1 = 6;
+
+	in.harq_indication_body.harq_pdu_list[1].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.harq_indication_body.harq_pdu_list[1].harq_indication_tdd_rel9.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL9_TAG;
+	in.harq_indication_body.harq_pdu_list[1].harq_indication_tdd_rel9.mode = 0;
+	in.harq_indication_body.harq_pdu_list[1].harq_indication_tdd_rel9.number_of_ack_nack = 2;
+	in.harq_indication_body.harq_pdu_list[1].harq_indication_tdd_rel9.harq_data[0].bundling.value_0 = 2;
+
+	in.harq_indication_body.harq_pdu_list[2].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.harq_indication_body.harq_pdu_list[2].harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
+	in.harq_indication_body.harq_pdu_list[2].harq_indication_tdd_rel13.mode = 2;
+	in.harq_indication_body.harq_pdu_list[2].harq_indication_tdd_rel13.number_of_ack_nack = 2;
+	in.harq_indication_body.harq_pdu_list[2].harq_indication_tdd_rel13.harq_data[0].special_bundling.value_0 = 2;
+
+	in.harq_indication_body.harq_pdu_list[3].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.harq_indication_body.harq_pdu_list[3].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+	in.harq_indication_body.harq_pdu_list[3].ul_cqi_information.ul_cqi = 9;
+	in.harq_indication_body.harq_pdu_list[3].ul_cqi_information.channel = 3;
+	in.harq_indication_body.harq_pdu_list[3].harq_indication_fdd_rel8.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL8_TAG;
+	in.harq_indication_body.harq_pdu_list[3].harq_indication_fdd_rel8.harq_tb1 = 1;
+	in.harq_indication_body.harq_pdu_list[3].harq_indication_fdd_rel8.harq_tb2 = 2;
+
+
+	in.harq_indication_body.harq_pdu_list[4].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.harq_indication_body.harq_pdu_list[4].harq_indication_fdd_rel9.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL9_TAG;
+	in.harq_indication_body.harq_pdu_list[4].harq_indication_fdd_rel9.mode = 0;
+	in.harq_indication_body.harq_pdu_list[4].harq_indication_fdd_rel9.number_of_ack_nack = 3;
+	in.harq_indication_body.harq_pdu_list[4].harq_indication_fdd_rel9.harq_tb_n[0] = 45;
+
+	in.harq_indication_body.harq_pdu_list[5].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.harq_indication_body.harq_pdu_list[5].harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
+	in.harq_indication_body.harq_pdu_list[5].harq_indication_fdd_rel13.mode = 1;
+	in.harq_indication_body.harq_pdu_list[5].harq_indication_fdd_rel13.number_of_ack_nack = 22;
+	in.harq_indication_body.harq_pdu_list[5].harq_indication_fdd_rel13.harq_tb_n[0] = 123;
+
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+
+	CU_ASSERT_EQUAL(in.harq_indication_body.tl.tag,out.harq_indication_body.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.number_of_harqs,out.harq_indication_body.number_of_harqs);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[0].rx_ue_information.tl.tag,out.harq_indication_body.harq_pdu_list[0].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[0].harq_indication_tdd_rel8.tl.tag,out.harq_indication_body.harq_pdu_list[0].harq_indication_tdd_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[1].rx_ue_information.tl.tag,out.harq_indication_body.harq_pdu_list[1].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[1].harq_indication_tdd_rel9.tl.tag,out.harq_indication_body.harq_pdu_list[1].harq_indication_tdd_rel9.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[2].rx_ue_information.tl.tag,out.harq_indication_body.harq_pdu_list[2].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[2].harq_indication_tdd_rel13.tl.tag,out.harq_indication_body.harq_pdu_list[2].harq_indication_tdd_rel13.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[3].rx_ue_information.tl.tag,out.harq_indication_body.harq_pdu_list[3].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[3].ul_cqi_information.tl.tag,out.harq_indication_body.harq_pdu_list[3].ul_cqi_information.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[3].harq_indication_fdd_rel8.tl.tag,out.harq_indication_body.harq_pdu_list[3].harq_indication_fdd_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[4].rx_ue_information.tl.tag,out.harq_indication_body.harq_pdu_list[4].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[4].harq_indication_fdd_rel9.tl.tag,out.harq_indication_body.harq_pdu_list[4].harq_indication_fdd_rel9.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[5].rx_ue_information.tl.tag,out.harq_indication_body.harq_pdu_list[5].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.harq_indication_body.harq_pdu_list[5].harq_indication_fdd_rel13.tl.tag,out.harq_indication_body.harq_pdu_list[5].harq_indication_fdd_rel13.tl.tag);
+
+	free(in.harq_indication_body.harq_pdu_list);
+	free(out.harq_indication_body.harq_pdu_list);
+}
+void nfapi_test_crc_indication()
+{
+	nfapi_crc_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_crc_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_CRC_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 10230;
+	in.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
+	in.crc_indication_body.number_of_crcs = 2;
+	in.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t*)malloc(sizeof(nfapi_crc_indication_pdu_t) * in.crc_indication_body.number_of_crcs);
+	in.crc_indication_body.crc_pdu_list[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.crc_indication_body.crc_pdu_list[0].rx_ue_information.handle = 0x4567;
+	in.crc_indication_body.crc_pdu_list[0].rx_ue_information.rnti = 42;
+	in.crc_indication_body.crc_pdu_list[0].crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
+	in.crc_indication_body.crc_pdu_list[0].crc_indication_rel8.crc_flag = 0;
+
+
+	in.crc_indication_body.crc_pdu_list[1].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.crc_indication_body.crc_pdu_list[1].rx_ue_information.handle = 0x4568;
+	in.crc_indication_body.crc_pdu_list[1].rx_ue_information.rnti = 43;
+	in.crc_indication_body.crc_pdu_list[1].crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
+	in.crc_indication_body.crc_pdu_list[1].crc_indication_rel8.crc_flag = 1;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.crc_indication_body.tl.tag, out.crc_indication_body.tl.tag);
+	CU_ASSERT_EQUAL(in.crc_indication_body.number_of_crcs, out.crc_indication_body.number_of_crcs);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[0].rx_ue_information.tl.tag, out.crc_indication_body.crc_pdu_list[0].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[0].rx_ue_information.handle, out.crc_indication_body.crc_pdu_list[0].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[0].rx_ue_information.rnti, out.crc_indication_body.crc_pdu_list[0].rx_ue_information.rnti);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[0].crc_indication_rel8.tl.tag, out.crc_indication_body.crc_pdu_list[0].crc_indication_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[0].crc_indication_rel8.crc_flag, out.crc_indication_body.crc_pdu_list[0].crc_indication_rel8.crc_flag);
+
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[1].rx_ue_information.tl.tag, out.crc_indication_body.crc_pdu_list[1].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[1].rx_ue_information.handle, out.crc_indication_body.crc_pdu_list[1].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[1].rx_ue_information.rnti, out.crc_indication_body.crc_pdu_list[1].rx_ue_information.rnti);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[1].crc_indication_rel8.tl.tag, out.crc_indication_body.crc_pdu_list[1].crc_indication_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.crc_indication_body.crc_pdu_list[1].crc_indication_rel8.crc_flag, out.crc_indication_body.crc_pdu_list[1].crc_indication_rel8.crc_flag);
+
+	free(in.crc_indication_body.crc_pdu_list);
+	free(out.crc_indication_body.crc_pdu_list);
+}
+void nfapi_test_rx_ulsch_indication()
+{
+	nfapi_rx_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_rx_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RX_ULSCH_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	uint8_t pdu1[32];
+	uint8_t pdu2[8];
+
+	in.sfn_sf = 12354;
+	in.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
+	in.rx_indication_body.number_of_pdus = 3;
+
+	in.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t*)(calloc(1, sizeof(nfapi_rx_indication_pdu_t) * in.rx_indication_body.number_of_pdus));
+	
+	in.rx_indication_body.rx_pdu_list[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.rx_indication_body.rx_pdu_list[0].rx_ue_information.handle = 0xFEDC;
+	in.rx_indication_body.rx_pdu_list[0].rx_ue_information.rnti = 42;
+	in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
+	in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.length = sizeof(pdu1);
+	in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.offset = 1;
+	in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.ul_cqi = 1;
+	in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.timing_advance = 23;
+	in.rx_indication_body.rx_pdu_list[0].rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
+	in.rx_indication_body.rx_pdu_list[0].rx_indication_rel9.timing_advance_r9 = 1;
+	in.rx_indication_body.rx_pdu_list[0].data = pdu1;
+
+	in.rx_indication_body.rx_pdu_list[1].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.rx_indication_body.rx_pdu_list[1].rx_ue_information.handle = 0xFEDC;
+	in.rx_indication_body.rx_pdu_list[1].rx_ue_information.rnti = 43;
+	in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
+	in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.length = 0;
+	in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.offset = 1;
+	in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.ul_cqi = 1;
+	in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.timing_advance = 23;
+	in.rx_indication_body.rx_pdu_list[1].data = 0;
+
+	in.rx_indication_body.rx_pdu_list[2].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.rx_indication_body.rx_pdu_list[2].rx_ue_information.handle = 0xFEDC;
+	in.rx_indication_body.rx_pdu_list[2].rx_ue_information.rnti = 43;
+	in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
+	in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.length = sizeof(pdu2);
+	in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.offset = 1;
+	in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.ul_cqi = 1;
+	in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.timing_advance = 23;
+	in.rx_indication_body.rx_pdu_list[2].rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
+	in.rx_indication_body.rx_pdu_list[2].rx_indication_rel9.timing_advance_r9 = 34;
+	in.rx_indication_body.rx_pdu_list[2].data = pdu2;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+	CU_ASSERT_EQUAL(in.rx_indication_body.tl.tag, out.rx_indication_body.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.number_of_pdus, out.rx_indication_body.number_of_pdus);
+	
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_ue_information.tl.tag, out.rx_indication_body.rx_pdu_list[0].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_ue_information.handle, out.rx_indication_body.rx_pdu_list[0].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_ue_information.rnti, out.rx_indication_body.rx_pdu_list[0].rx_ue_information.rnti);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.tl.tag, out.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.length, out.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.length);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.offset, out.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.offset);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.ul_cqi, out.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.ul_cqi);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.timing_advance, out.rx_indication_body.rx_pdu_list[0].rx_indication_rel8.timing_advance);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_indication_rel9.tl.tag, out.rx_indication_body.rx_pdu_list[0].rx_indication_rel9.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[0].rx_indication_rel9.timing_advance_r9, out.rx_indication_body.rx_pdu_list[0].rx_indication_rel9.timing_advance_r9);
+	CU_ASSERT_EQUAL(0, memcmp(in.rx_indication_body.rx_pdu_list[0].data, out.rx_indication_body.rx_pdu_list[0].data, sizeof(pdu1)));
+
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].rx_ue_information.tl.tag, out.rx_indication_body.rx_pdu_list[1].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].rx_ue_information.handle, out.rx_indication_body.rx_pdu_list[1].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].rx_ue_information.rnti, out.rx_indication_body.rx_pdu_list[1].rx_ue_information.rnti);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.tl.tag, out.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.length, out.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.length);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.offset, out.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.offset);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.ul_cqi, out.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.ul_cqi);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.timing_advance, out.rx_indication_body.rx_pdu_list[1].rx_indication_rel8.timing_advance);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[1].data, 0);
+
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_ue_information.tl.tag, out.rx_indication_body.rx_pdu_list[2].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_ue_information.handle, out.rx_indication_body.rx_pdu_list[2].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_ue_information.rnti, out.rx_indication_body.rx_pdu_list[2].rx_ue_information.rnti);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.tl.tag, out.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.length, out.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.length);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.offset, out.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.offset);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.ul_cqi, in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.ul_cqi);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.timing_advance, out.rx_indication_body.rx_pdu_list[2].rx_indication_rel8.timing_advance);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_indication_rel9.tl.tag, out.rx_indication_body.rx_pdu_list[2].rx_indication_rel9.tl.tag);
+	CU_ASSERT_EQUAL(in.rx_indication_body.rx_pdu_list[2].rx_indication_rel9.timing_advance_r9, out.rx_indication_body.rx_pdu_list[2].rx_indication_rel9.timing_advance_r9);
+	CU_ASSERT_EQUAL(0, memcmp(in.rx_indication_body.rx_pdu_list[2].data, out.rx_indication_body.rx_pdu_list[2].data, sizeof(pdu2)));
+
+	free(in.rx_indication_body.rx_pdu_list);
+	free(out.rx_indication_body.rx_pdu_list);
+
+}
+void nfapi_test_rach_indication()
+{
+	nfapi_rach_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_rach_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RACH_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 10230;
+	in.rach_indication_body.tl.tag = NFAPI_RACH_INDICATION_BODY_TAG;
+	in.rach_indication_body.number_of_preambles = 2;
+	in.rach_indication_body.preamble_list = (nfapi_preamble_pdu_t*)(malloc(sizeof(nfapi_preamble_pdu_t)*in.rach_indication_body.number_of_preambles));
+	in.rach_indication_body.preamble_list[0].preamble_rel8.tl.tag = NFAPI_PREAMBLE_REL8_TAG;
+	in.rach_indication_body.preamble_list[0].preamble_rel9.tl.tag = NFAPI_PREAMBLE_REL9_TAG;
+	in.rach_indication_body.preamble_list[0].preamble_rel13.tl.tag = NFAPI_PREAMBLE_REL13_TAG;
+
+	in.rach_indication_body.preamble_list[1].preamble_rel8.tl.tag = NFAPI_PREAMBLE_REL8_TAG;
+	in.rach_indication_body.preamble_list[1].preamble_rel9.tl.tag = NFAPI_PREAMBLE_REL9_TAG;
+	in.rach_indication_body.preamble_list[1].preamble_rel13.tl.tag = NFAPI_PREAMBLE_REL13_TAG;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.rach_indication_body.tl.tag, out.rach_indication_body.tl.tag);
+	CU_ASSERT_EQUAL(in.rach_indication_body.number_of_preambles, out.rach_indication_body.number_of_preambles);
+	CU_ASSERT_EQUAL(in.rach_indication_body.preamble_list[0].preamble_rel8.tl.tag, out.rach_indication_body.preamble_list[0].preamble_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.rach_indication_body.preamble_list[0].preamble_rel9.tl.tag, out.rach_indication_body.preamble_list[0].preamble_rel9.tl.tag);
+	CU_ASSERT_EQUAL(in.rach_indication_body.preamble_list[0].preamble_rel13.tl.tag, out.rach_indication_body.preamble_list[0].preamble_rel13.tl.tag);
+	CU_ASSERT_EQUAL(in.rach_indication_body.preamble_list[1].preamble_rel8.tl.tag, out.rach_indication_body.preamble_list[1].preamble_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.rach_indication_body.preamble_list[1].preamble_rel9.tl.tag, out.rach_indication_body.preamble_list[1].preamble_rel9.tl.tag);
+	CU_ASSERT_EQUAL(in.rach_indication_body.preamble_list[1].preamble_rel13.tl.tag, out.rach_indication_body.preamble_list[1].preamble_rel13.tl.tag);
+
+	free(in.rach_indication_body.preamble_list);
+	free(out.rach_indication_body.preamble_list);
+}
+void nfapi_test_srs_indication()
+{
+	nfapi_srs_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_srs_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_SRS_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 10230;
+	in.srs_indication_body.tl.tag = NFAPI_SRS_INDICATION_BODY_TAG;
+	in.srs_indication_body.number_of_ues = 2;
+	in.srs_indication_body.srs_pdu_list = (nfapi_srs_indication_pdu_t*)(malloc(sizeof(nfapi_srs_indication_pdu_t) * in.srs_indication_body.number_of_ues));
+	in.srs_indication_body.srs_pdu_list[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.srs_indication_body.srs_pdu_list[0].rx_ue_information.handle = 0x4567;
+	in.srs_indication_body.srs_pdu_list[0].rx_ue_information.rnti = 42;
+
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.tl.tag = NFAPI_SRS_INDICATION_FDD_REL8_TAG;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.doppler_estimation = 244;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.timing_advance = 45;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.number_of_resource_blocks = 100;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.rb_start = 0;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.snr[0] = 255;
+	//...
+	
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel9.tl.tag = NFAPI_SRS_INDICATION_FDD_REL9_TAG;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel9.timing_advance_r9 = 7690;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_tdd_rel10.tl.tag = NFAPI_SRS_INDICATION_TDD_REL10_TAG;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_tdd_rel10.uppts_symbol = 1;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel11.tl.tag = NFAPI_SRS_INDICATION_FDD_REL11_TAG;
+	in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel11.ul_rtoa = 4800;
+
+	in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.tl.tag = NFAPI_TDD_CHANNEL_MEASUREMENT_TAG;
+	in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.num_prb_per_subband = 4;
+	in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.number_of_subbands = 2;
+	in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.num_atennas = 2;
+	in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[0].subband_index = 4;
+	in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[0].channel[0] = 0xEEEE;
+	in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[1].subband_index = 6;
+	in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[1].channel[0] = 0xAAAA;
+
+	in.srs_indication_body.srs_pdu_list[1].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.srs_indication_body.srs_pdu_list[1].rx_ue_information.handle = 0x4567;
+	in.srs_indication_body.srs_pdu_list[1].rx_ue_information.rnti = 42;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+
+	CU_ASSERT_EQUAL(in.srs_indication_body.tl.tag, out.srs_indication_body.tl.tag);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].rx_ue_information.tl.tag, out.srs_indication_body.srs_pdu_list[0].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].rx_ue_information.handle, out.srs_indication_body.srs_pdu_list[0].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].rx_ue_information.rnti, out.srs_indication_body.srs_pdu_list[0].rx_ue_information.rnti);
+
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.tl.tag, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.doppler_estimation, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.doppler_estimation);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.timing_advance, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.timing_advance);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.number_of_resource_blocks, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.number_of_resource_blocks);
+	CU_ASSERT_EQUAL(memcmp(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.snr, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.snr, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.number_of_resource_blocks), 0);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.rb_start, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel8.rb_start);
+
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel9.tl.tag, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel9.tl.tag);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel9.timing_advance_r9, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel9.timing_advance_r9);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_tdd_rel10.tl.tag, out.srs_indication_body.srs_pdu_list[0].srs_indication_tdd_rel10.tl.tag);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_tdd_rel10.uppts_symbol, out.srs_indication_body.srs_pdu_list[0].srs_indication_tdd_rel10.uppts_symbol);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel11.tl.tag, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel11.tl.tag);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel11.ul_rtoa, out.srs_indication_body.srs_pdu_list[0].srs_indication_fdd_rel11.ul_rtoa);
+
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.tl.tag, out.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.tl.tag);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.num_prb_per_subband, out.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.num_prb_per_subband);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.number_of_subbands, out.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.number_of_subbands);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.num_atennas, out.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.num_atennas);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[0].subband_index, out.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[0].subband_index) 
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[0].channel[0], out.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[0].channel[0]);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[1].subband_index, out.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[1].subband_index);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[1].channel[0], out.srs_indication_body.srs_pdu_list[0].tdd_channel_measurement.subands[1].channel[0]);
+
+
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[1].rx_ue_information.tl.tag, out.srs_indication_body.srs_pdu_list[1].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[1].rx_ue_information.handle, out.srs_indication_body.srs_pdu_list[1].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.srs_indication_body.srs_pdu_list[1].rx_ue_information.rnti, out.srs_indication_body.srs_pdu_list[1].rx_ue_information.rnti);
+
+	free(in.srs_indication_body.srs_pdu_list);
+	free(out.srs_indication_body.srs_pdu_list);
+}
+void nfapi_test_rx_sr_indication()
+{
+	nfapi_sr_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_sr_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RX_SR_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 10230;
+	in.sr_indication_body.tl.tag = NFAPI_SR_INDICATION_BODY_TAG;
+	in.sr_indication_body.number_of_srs = 2;
+	in.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)(malloc(sizeof(nfapi_sr_indication_pdu_t) * in.sr_indication_body.number_of_srs));
+	in.sr_indication_body.sr_pdu_list[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.sr_indication_body.sr_pdu_list[0].rx_ue_information.handle = 0x4567;
+	in.sr_indication_body.sr_pdu_list[0].rx_ue_information.rnti = 42;
+
+	in.sr_indication_body.sr_pdu_list[0].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+	in.sr_indication_body.sr_pdu_list[0].ul_cqi_information.ul_cqi = 34;
+	in.sr_indication_body.sr_pdu_list[0].ul_cqi_information.channel = 38;
+
+	in.sr_indication_body.sr_pdu_list[1].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.sr_indication_body.sr_pdu_list[1].rx_ue_information.handle = 0x9876;
+	in.sr_indication_body.sr_pdu_list[1].rx_ue_information.rnti = 24;
+
+	in.sr_indication_body.sr_pdu_list[1].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+	in.sr_indication_body.sr_pdu_list[1].ul_cqi_information.ul_cqi = 24;
+	in.sr_indication_body.sr_pdu_list[1].ul_cqi_information.channel = 28;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+
+	CU_ASSERT_EQUAL(in.sr_indication_body.tl.tag, out.sr_indication_body.tl.tag);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[0].rx_ue_information.tl.tag, out.sr_indication_body.sr_pdu_list[0].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[0].rx_ue_information.handle, out.sr_indication_body.sr_pdu_list[0].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[0].rx_ue_information.rnti, out.sr_indication_body.sr_pdu_list[0].rx_ue_information.rnti);
+
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[0].ul_cqi_information.tl.tag, out.sr_indication_body.sr_pdu_list[0].ul_cqi_information.tl.tag);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[0].ul_cqi_information.ul_cqi, out.sr_indication_body.sr_pdu_list[0].ul_cqi_information.ul_cqi);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[0].ul_cqi_information.channel, out.sr_indication_body.sr_pdu_list[0].ul_cqi_information.channel);
+
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[1].rx_ue_information.tl.tag, out.sr_indication_body.sr_pdu_list[1].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[1].rx_ue_information.handle, out.sr_indication_body.sr_pdu_list[1].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[1].rx_ue_information.rnti, out.sr_indication_body.sr_pdu_list[1].rx_ue_information.rnti);
+
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[1].ul_cqi_information.tl.tag, out.sr_indication_body.sr_pdu_list[1].ul_cqi_information.tl.tag);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[1].ul_cqi_information.ul_cqi, out.sr_indication_body.sr_pdu_list[1].ul_cqi_information.ul_cqi);
+	CU_ASSERT_EQUAL(in.sr_indication_body.sr_pdu_list[1].ul_cqi_information.channel, out.sr_indication_body.sr_pdu_list[1].ul_cqi_information.channel);
+
+	free(in.sr_indication_body.sr_pdu_list);
+	free(out.sr_indication_body.sr_pdu_list);
+
+}
+void nfapi_test_rx_cqi_indication()
+{
+	uint8_t cqi_1[] = { 0, 2, 4, 8, 10};
+	uint8_t cqi_2[] = { 100, 101, 102, 103, 104, 105, 106};
+
+	nfapi_cqi_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_cqi_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_RX_CQI_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 10240;
+	in.cqi_indication_body.tl.tag = NFAPI_CQI_INDICATION_BODY_TAG;
+	in.cqi_indication_body.number_of_cqis = 3;
+
+	in.cqi_indication_body.cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)(calloc(1, sizeof(nfapi_cqi_indication_pdu_t)*in.cqi_indication_body.number_of_cqis));
+	in.cqi_indication_body.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)(calloc(1, sizeof(nfapi_cqi_indication_raw_pdu_t)*in.cqi_indication_body.number_of_cqis));
+
+	in.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.handle = 0x4567;
+	in.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.rnti = 42;
+	in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.tl.tag = NFAPI_CQI_INDICATION_REL8_TAG;
+	in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.length = sizeof(cqi_1);
+	in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.data_offset = 1;
+	in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.ul_cqi = 4;
+	in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.ri = 4;
+	in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.timing_advance = 63;
+	in.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+	in.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.ul_cqi = 34;
+	in.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.channel = 38;
+
+	in.cqi_indication_body.cqi_pdu_list[1].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.cqi_indication_body.cqi_pdu_list[1].rx_ue_information.handle = 0x4567;
+	in.cqi_indication_body.cqi_pdu_list[1].rx_ue_information.rnti = 42;
+	in.cqi_indication_body.cqi_pdu_list[1].cqi_indication_rel8.tl.tag = NFAPI_CQI_INDICATION_REL8_TAG;
+	in.cqi_indication_body.cqi_pdu_list[1].cqi_indication_rel8.length = 0;
+	in.cqi_indication_body.cqi_pdu_list[1].cqi_indication_rel8.data_offset = 0;
+	in.cqi_indication_body.cqi_pdu_list[1].cqi_indication_rel8.ul_cqi = 0;
+	in.cqi_indication_body.cqi_pdu_list[1].cqi_indication_rel8.ri = 0;
+	in.cqi_indication_body.cqi_pdu_list[1].cqi_indication_rel8.timing_advance = 0;
+
+
+	in.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.handle = 0x4567;
+	in.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.rnti = 42;
+	
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.tl.tag = NFAPI_CQI_INDICATION_REL9_TAG;
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.length = sizeof(cqi_2);
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.data_offset = 1;
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ul_cqi = 4;
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.number_of_cc_reported = 4;
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[0] = 6;
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[1] = 7;
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[2] = 8;
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[3] = 1;
+	in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.timing_advance = 63;
+	in.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+	in.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.ul_cqi = 44;
+	in.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.channel = 48;
+
+
+	memcpy(in.cqi_indication_body.cqi_raw_pdu_list[0].pdu, cqi_1, sizeof(cqi_1));
+	memcpy(in.cqi_indication_body.cqi_raw_pdu_list[1].pdu, cqi_2, sizeof(cqi_2));
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.tl.tag, out.cqi_indication_body.tl.tag);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.tl.tag, out.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.handle, out.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.rnti, out.cqi_indication_body.cqi_pdu_list[0].rx_ue_information.rnti);
+
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.tl.tag, out.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.tl.tag);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.length, out.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.length);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.data_offset, out.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.data_offset);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.ul_cqi, out.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.ul_cqi);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.ri, out.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.ri);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.timing_advance, out.cqi_indication_body.cqi_pdu_list[0].cqi_indication_rel8.timing_advance);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.tl.tag, out.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.tl.tag);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.ul_cqi, out.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.ul_cqi);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.channel, out.cqi_indication_body.cqi_pdu_list[0].ul_cqi_information.channel);
+
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.tl.tag, out.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.tl.tag);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.handle, out.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.handle);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.rnti, out.cqi_indication_body.cqi_pdu_list[2].rx_ue_information.rnti);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.tl.tag, out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.tl.tag);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.length, out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.length);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.data_offset, out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.data_offset);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ul_cqi, out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ul_cqi);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.number_of_cc_reported, out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.number_of_cc_reported);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[0], out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[0]);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[1], out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[1]);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[2], out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[2]);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[3], out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.ri[3]);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.timing_advance, out.cqi_indication_body.cqi_pdu_list[2].cqi_indication_rel9.timing_advance);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.tl.tag, out.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.tl.tag);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.ul_cqi, out.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.ul_cqi);
+	CU_ASSERT_EQUAL(in.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.channel, out.cqi_indication_body.cqi_pdu_list[2].ul_cqi_information.channel);
+
+
+	CU_ASSERT_EQUAL(memcmp(in.cqi_indication_body.cqi_raw_pdu_list[0].pdu, out.cqi_indication_body.cqi_raw_pdu_list[0].pdu, sizeof(cqi_1)), 0);
+	CU_ASSERT_EQUAL(memcmp(in.cqi_indication_body.cqi_raw_pdu_list[2].pdu, out.cqi_indication_body.cqi_raw_pdu_list[2].pdu, sizeof(cqi_2)), 0);
+
+	free(in.cqi_indication_body.cqi_pdu_list);
+	free(in.cqi_indication_body.cqi_raw_pdu_list);
+	free(out.cqi_indication_body.cqi_pdu_list);
+	free(out.cqi_indication_body.cqi_raw_pdu_list);
+}
+
+void nfapi_test_lbt_dl_config_request()
+{
+	nfapi_lbt_dl_config_request_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_lbt_dl_config_request_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_LBT_DL_CONFIG_REQUEST;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	//in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 1234;
+	in.lbt_dl_config_request_body.tl.tag = NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG;
+	in.lbt_dl_config_request_body.number_of_pdus = 2;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)(malloc(sizeof(nfapi_lbt_dl_config_request_pdu_t) * in.lbt_dl_config_request_body.number_of_pdus));
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].pdu_type = NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].pdu_size = 32;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.tl.tag = NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.handle = 0x1234;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.mp_cca = 22;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.n_cca = 23;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.offset = 24;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.lte_txop_sf = 25;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.txop_sfn_sf_end = 26;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.lbt_mode = 27;
+
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].pdu_type = NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].pdu_size = 32;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.tl.tag = NFAPI_LBT_DRS_REQ_PDU_REL13_TAG;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.handle = 0x4567;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.offset = 1;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.sfn_sf_end = 2;
+	in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.lbt_mode = 3;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.phy_id, out.header.phy_id);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.header.message_length, out.header.message_length);
+	CU_ASSERT_EQUAL(in.header.m_segment_sequence, out.header.m_segment_sequence);
+	CU_ASSERT_EQUAL(in.header.checksum, out.header.checksum);
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.number_of_pdus, out.lbt_dl_config_request_body.number_of_pdus);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].pdu_type, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].pdu_type);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].pdu_size, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].pdu_size);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.tl.tag, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.tl.tag);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.handle, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.handle);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.mp_cca, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.mp_cca);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.n_cca, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.n_cca);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.offset, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.offset);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.lte_txop_sf, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.lte_txop_sf);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.txop_sfn_sf_end, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.txop_sfn_sf_end);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.lbt_mode, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[0].lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13.lbt_mode);
+
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].pdu_type, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].pdu_type);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].pdu_size, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].pdu_size);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.tl.tag, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.tl.tag);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.handle, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.handle);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.offset, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.offset);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.sfn_sf_end, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.sfn_sf_end);
+	CU_ASSERT_EQUAL(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.lbt_mode, out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list[1].lbt_drs_req_pdu.lbt_drs_req_pdu_rel13.lbt_mode);
+
+	free(in.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list);
+	free(out.lbt_dl_config_request_body.lbt_dl_config_req_pdu_list);
+}
+
+void nfapi_test_lbt_dl_indication()
+{
+	nfapi_lbt_dl_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_lbt_dl_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_LBT_DL_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	//in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 1234;
+	in.lbt_dl_indication_body.tl.tag = NFAPI_LBT_DL_INDICATION_BODY_TAG;
+	in.lbt_dl_indication_body.number_of_pdus = 2;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)(malloc(sizeof(nfapi_lbt_dl_indication_pdu_t) * in.lbt_dl_indication_body.number_of_pdus));
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].pdu_type = NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].pdu_size = 32;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.tl.tag = NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.handle = 0x1234;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.result = 22;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.lte_txop_symbols = 23;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.initial_partial_sf = 24;
+
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[1].pdu_type = NFAPI_LBT_DL_RSP_DRS_PDU_TYPE;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[1].pdu_size = 32;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.tl.tag = NFAPI_LBT_DRS_RSP_PDU_REL13_TAG;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.handle = 0x4567;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.result = 1;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.phy_id, out.header.phy_id);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.header.message_length, out.header.message_length);
+	CU_ASSERT_EQUAL(in.header.m_segment_sequence, out.header.m_segment_sequence);
+	CU_ASSERT_EQUAL(in.header.checksum, out.header.checksum);
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.number_of_pdus, out.lbt_dl_indication_body.number_of_pdus);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[0].pdu_type, out.lbt_dl_indication_body.lbt_indication_pdu_list[0].pdu_type);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[0].pdu_size, out.lbt_dl_indication_body.lbt_indication_pdu_list[0].pdu_size);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.tl.tag, out.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.tl.tag);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.handle, out.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.handle);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.result, out.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.result);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.lte_txop_symbols, out.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.lte_txop_symbols);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.initial_partial_sf, out.lbt_dl_indication_body.lbt_indication_pdu_list[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.initial_partial_sf);
+
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[1].pdu_type, out.lbt_dl_indication_body.lbt_indication_pdu_list[1].pdu_type);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[1].pdu_size, out.lbt_dl_indication_body.lbt_indication_pdu_list[1].pdu_size);
+
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.tl.tag, out.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.tl.tag);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.handle, out.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.handle);
+	CU_ASSERT_EQUAL(in.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.result, out.lbt_dl_indication_body.lbt_indication_pdu_list[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.result);
+
+	free(in.lbt_dl_indication_body.lbt_indication_pdu_list);
+	free(out.lbt_dl_indication_body.lbt_indication_pdu_list);
+
+}
+void nfapi_test_lbt_dl_indication_invalid_pdu_type()
+{
+	nfapi_lbt_dl_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_lbt_dl_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_LBT_DL_INDICATION;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	//in.header.checksum = 0xEEEEEEEE;
+
+	in.sfn_sf = 1234;
+	in.lbt_dl_indication_body.tl.tag = NFAPI_LBT_DL_INDICATION_BODY_TAG;
+	in.lbt_dl_indication_body.number_of_pdus = 1;
+	in.lbt_dl_indication_body.lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)(malloc(sizeof(nfapi_lbt_dl_indication_pdu_t) * in.lbt_dl_indication_body.number_of_pdus));
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].pdu_type = 44; // Invalid pdu type
+	in.lbt_dl_indication_body.lbt_indication_pdu_list[0].pdu_size = 32;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	int unpack_result = nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(unpack_result, -1);
+	CU_ASSERT_EQUAL(in.header.phy_id, out.header.phy_id);
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.header.message_length, out.header.message_length);
+	CU_ASSERT_EQUAL(in.header.m_segment_sequence, out.header.m_segment_sequence);
+	CU_ASSERT_EQUAL(in.header.checksum, out.header.checksum);
+	CU_ASSERT_EQUAL(in.sfn_sf, out.sfn_sf);
+	free(in.lbt_dl_indication_body.lbt_indication_pdu_list);
+	free(out.lbt_dl_indication_body.lbt_indication_pdu_list);
+}
+
+void nfapi_test_nb_harq_indication()
+{
+	nfapi_nb_harq_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_nb_harq_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_NB_HARQ_INDICATION;
+	in.header.message_length = 0;
+
+	in.sfn_sf = 1234;
+	in.nb_harq_indication_body.tl.tag = NFAPI_NB_HARQ_INDICATION_BODY_TAG;
+	in.nb_harq_indication_body.number_of_harqs = 1;
+	
+	nfapi_nb_harq_indication_pdu_t nb_harq_pdu[1];
+	in.nb_harq_indication_body.nb_harq_pdu_list = &nb_harq_pdu[0];
+	in.nb_harq_indication_body.nb_harq_pdu_list[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+	in.nb_harq_indication_body.nb_harq_pdu_list[0].nb_harq_indication_fdd_rel13.tl.tag = NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG;
+	in.nb_harq_indication_body.nb_harq_pdu_list[0].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+	
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	IN_OUT_ASSERT(sfn_sf);
+	IN_OUT_ASSERT(nb_harq_indication_body.tl.tag);
+	IN_OUT_ASSERT(nb_harq_indication_body.number_of_harqs);
+	
+	IN_OUT_ASSERT(nb_harq_indication_body.nb_harq_pdu_list[0].rx_ue_information.tl.tag);
+	IN_OUT_ASSERT(nb_harq_indication_body.nb_harq_pdu_list[0].nb_harq_indication_fdd_rel13.tl.tag);
+	IN_OUT_ASSERT(nb_harq_indication_body.nb_harq_pdu_list[0].ul_cqi_information.tl.tag);
+	
+}
+
+void nfapi_test_nrach_indication()
+{
+	nfapi_nrach_indication_t in;
+	memset(&in, 0, sizeof(in));
+	nfapi_nrach_indication_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_NRACH_INDICATION;
+	in.header.message_length = 0;
+
+	in.sfn_sf = 1234;
+	
+	in.nrach_indication_body.tl.tag = NFAPI_NRACH_INDICATION_BODY_TAG;
+	in.nrach_indication_body.number_of_initial_scs_detected = 1;
+	
+	nfapi_nrach_indication_pdu_t nrach_pdu[1];
+	in.nrach_indication_body.nrach_pdu_list = &nrach_pdu[0];
+	
+	in.nrach_indication_body.nrach_pdu_list[0].nrach_indication_rel13.tl.tag = NFAPI_NRACH_INDICATION_REL13_TAG;
+	
+	
+
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+	
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	IN_OUT_ASSERT(sfn_sf);
+	IN_OUT_ASSERT(nrach_indication_body.tl.tag);
+	IN_OUT_ASSERT(nrach_indication_body.number_of_initial_scs_detected);
+	IN_OUT_ASSERT(nrach_indication_body.nrach_pdu_list[0].nrach_indication_rel13.tl.tag);
+	IN_OUT_ASSERT(nrach_indication_body.nrach_pdu_list[0].nrach_indication_rel13.rnti);
+	IN_OUT_ASSERT(nrach_indication_body.nrach_pdu_list[0].nrach_indication_rel13.initial_sc);
+	IN_OUT_ASSERT(nrach_indication_body.nrach_pdu_list[0].nrach_indication_rel13.timing_advance);
+	IN_OUT_ASSERT(nrach_indication_body.nrach_pdu_list[0].nrach_indication_rel13.nrach_ce_level);	
+	
+}
+
+void nfapi_test_dl_node_sync()
+{
+	nfapi_dl_node_sync_t in;
+	nfapi_dl_node_sync_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_DL_NODE_SYNC;
+	in.header.message_length = 0;
+
+	in.t1 = 10239999;
+	in.delta_sfn_sf = -987;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.t1, out.t1);
+	CU_ASSERT_EQUAL(in.delta_sfn_sf, out.delta_sfn_sf);
+}
+void nfapi_test_ul_node_sync()
+{
+	nfapi_ul_node_sync_t in;
+	nfapi_ul_node_sync_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_UL_NODE_SYNC;
+	in.header.message_length = 0;
+
+	in.t1 = 10239999;
+	in.t2 = 10239999;
+	in.t2 = 10239999;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+	
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.t1, out.t1);
+	CU_ASSERT_EQUAL(in.t2, out.t2);
+	CU_ASSERT_EQUAL(in.t3, out.t3);
+}
+void nfapi_test_timing_info()
+{
+	nfapi_timing_info_t in;
+	nfapi_timing_info_t out;
+
+	in.header.phy_id = NFAPI_PHY_ID_NA;
+	in.header.message_id = NFAPI_TIMING_INFO;
+	in.header.message_length = 0;
+	in.header.m_segment_sequence = 0xDDDD;
+	in.header.checksum = 0xEEEEEEEE;
+
+	in.last_sfn_sf = 0xDEAD; //10239999;
+	in.time_since_last_timing_info = 4294967295u;
+	in.dl_config_jitter = 4294967295u;
+	in.tx_request_jitter = 4294967295u;
+	in.ul_config_jitter = 4294967295u;
+	in.hi_dci0_jitter = 4294967295u;
+	in.dl_config_latest_delay = 0; //-2147483648L;
+	in.tx_request_latest_delay = 2147483647u;
+	in.ul_config_latest_delay = 0; //-2147483648L ;
+	in.hi_dci0_latest_delay =  0; //2147483647u;
+	in.dl_config_earliest_arrival = 0; //-2147483648L;
+	in.tx_request_earliest_arrival = 0; //2147483647u;
+	in.ul_config_earliest_arrival = 0; //2147483648L;
+	in.hi_dci0_earliest_arrival = -0; //2147483647u;
+
+	int packedMessageLength = nfapi_p7_message_pack(&in, gTestNfapiMessageTx, MAX_PACKED_MESSAGE_SIZE, 0);
+
+	nfapi_p7_message_unpack(gTestNfapiMessageTx, packedMessageLength, &out, sizeof(out), 0);
+
+	CU_ASSERT_EQUAL(in.header.message_id, out.header.message_id);
+	CU_ASSERT_EQUAL(in.last_sfn_sf, out.last_sfn_sf);
+	CU_ASSERT_EQUAL(in.time_since_last_timing_info, out.time_since_last_timing_info);
+	CU_ASSERT_EQUAL(in.dl_config_jitter, out.dl_config_jitter);
+	CU_ASSERT_EQUAL(in.tx_request_jitter, out.tx_request_jitter);
+	CU_ASSERT_EQUAL(in.ul_config_jitter, out.ul_config_jitter);
+	CU_ASSERT_EQUAL(in.hi_dci0_jitter, out.hi_dci0_jitter);
+	CU_ASSERT_EQUAL(in.dl_config_latest_delay, out.dl_config_latest_delay);
+	CU_ASSERT_EQUAL(in.tx_request_latest_delay, out.tx_request_latest_delay);
+	CU_ASSERT_EQUAL(in.ul_config_latest_delay, out.ul_config_latest_delay);
+	CU_ASSERT_EQUAL(in.hi_dci0_latest_delay, out.hi_dci0_latest_delay);
+	CU_ASSERT_EQUAL(in.dl_config_earliest_arrival, out.dl_config_earliest_arrival);
+	CU_ASSERT_EQUAL(in.tx_request_earliest_arrival, out.tx_request_earliest_arrival);
+	CU_ASSERT_EQUAL(in.ul_config_earliest_arrival, out.ul_config_earliest_arrival);
+	CU_ASSERT_EQUAL(in.hi_dci0_earliest_arrival, out.hi_dci0_earliest_arrival);
+}
+
+void nfapi_struct_sizes()
+{
+
+	
+	printf("P5\n");
+	printf("nfapi_pnf_param_request %zu\n", sizeof(nfapi_pnf_param_request_t));
+	printf("nfapi_pnf_param_response %zu\n", sizeof(nfapi_pnf_param_response_t));
+	printf("nfapi_pnf_config_request %zu\n", sizeof(nfapi_pnf_config_request_t));
+	printf("nfapi_pnf_config_response %zu\n", sizeof(nfapi_pnf_config_response_t));
+	printf("nfapi_pnf_start_request %zu\n", sizeof(nfapi_pnf_start_request_t));
+	printf("nfapi_pnf_start_response %zu\n", sizeof(nfapi_pnf_start_response_t));
+	printf("nfapi_pnf_stop_request %zu\n", sizeof(nfapi_pnf_stop_request_t));
+	printf("nfapi_pnf_stop_request %zu\n", sizeof(nfapi_pnf_stop_response_t));
+	printf("nfapi_param_request %zu\n", sizeof(nfapi_param_request_t));
+	printf("nfapi_param_response %zu\n", sizeof(nfapi_param_response_t));
+	printf("nfapi_config_request %zu\n", sizeof(nfapi_config_request_t));
+	printf("nfapi_config_response %zu\n", sizeof(nfapi_config_response_t));
+	printf("nfapi_start_request %zu\n", sizeof(nfapi_start_request_t));
+	printf("nfapi_start_response %zu\n", sizeof(nfapi_start_response_t));
+	printf("nfapi_stop_request %zu\n", sizeof(nfapi_stop_request_t));
+	printf("nfapi_stop_response %zu\n", sizeof(nfapi_stop_response_t));
+	printf("nfapi_measurement_request %zu\n", sizeof(nfapi_measurement_request_t));
+	printf("nfapi_measurement_response %zu\n", sizeof(nfapi_measurement_response_t));
+
+	printf("P7\n");
+	printf("nfapi_timing_info_t %zu\n", sizeof(nfapi_timing_info_t));
+	printf("nfapi_dl_config_request_t %zu\n", sizeof(nfapi_dl_config_request_t));
+	printf("nfapi_ul_config_request_t %zu\n", sizeof(nfapi_ul_config_request_t));
+	printf("nfapi_hi_dci0_request_t %zu\n", sizeof(nfapi_hi_dci0_request_t));
+	printf("nfapi_tx_request_t %zu\n", sizeof(nfapi_tx_request_t));
+	printf("nfapi_crc_indication_t %zu\n", sizeof(nfapi_crc_indication_t));
+	printf("nfapi_sr_indication_t %zu\n", sizeof(nfapi_sr_indication_t));
+	printf("nfapi_srs_indication_t %zu\n", sizeof(nfapi_srs_indication_t));
+	printf("nfapi_harq_indication_t %zu\n", sizeof(nfapi_harq_indication_t));
+	printf("nfapi_rx_indication_t %zu\n", sizeof(nfapi_rx_indication_t));
+	printf("nfapi_rach_indication_t %zu\n", sizeof(nfapi_rach_indication_t));
+	printf("nfapi_cqi_indication_t %zu\n", sizeof(nfapi_cqi_indication_t));
+	printf("nfapi_nb_harq_indication_t %zu\n", sizeof(nfapi_nb_harq_indication_t));
+	printf("nfapi_nrach_indication_t %zu\n", sizeof(nfapi_nrach_indication_t));
+	printf("nfapi_lbt_dl_config_request_t %zu\n", sizeof(nfapi_lbt_dl_config_request_t));
+	printf("nfapi_lbt_dl_indication_t %zu\n", sizeof(nfapi_lbt_dl_indication_t));
+
+	printf("P4\n");
+	printf("nfapi_lte_rssi_request_t %zu\n", sizeof(nfapi_lte_rssi_request_t));
+	printf("nfapi_utran_rssi_request_t %zu\n", sizeof(nfapi_utran_rssi_request_t));
+	printf("nfapi_geran_rssi_request_t %zu\n", sizeof(nfapi_geran_rssi_request_t));
+	printf("nfapi_lte_cell_search_request_t %zu\n", sizeof(nfapi_lte_cell_search_request_t));
+	printf("nfapi_utran_cell_search_request_t %zu\n", sizeof(nfapi_utran_cell_search_request_t));
+	printf("nfapi_geran_cell_search_request_t %zu\n", sizeof(nfapi_geran_cell_search_request_t));
+	printf("nfapi_lte_cell_search_indication_t %zu\n", sizeof(nfapi_lte_cell_search_indication_t));
+	printf("nfapi_utran_cell_search_indication_t %zu\n", sizeof(nfapi_utran_cell_search_indication_t));
+	printf("nfapi_geran_cell_search_indication_t %zu\n", sizeof(nfapi_geran_cell_search_indication_t));
+	printf("nfapi_lte_broadcast_detect_request_t %zu\n", sizeof(nfapi_lte_broadcast_detect_request_t));
+	printf("nfapi_utran_broadcast_detect_request_t %zu\n", sizeof(nfapi_utran_broadcast_detect_request_t));
+	printf("nfapi_lte_broadcast_detect_indication_t %zu\n", sizeof(nfapi_lte_broadcast_detect_indication_t));
+	printf("nfapi_utran_broadcast_detect_indication_t %zu\n", sizeof(nfapi_utran_broadcast_detect_indication_t));
+	printf("nfapi_lte_system_information_schedule_request_t %zu\n", sizeof(nfapi_lte_system_information_schedule_request_t));
+	printf("nfapi_lte_system_information_request_t %zu\n", sizeof(nfapi_lte_system_information_request_t));
+	printf("nfapi_utran_system_information_request_t %zu\n", sizeof(nfapi_utran_system_information_request_t));
+	printf("nfapi_geran_system_information_request_t %zu\n", sizeof(nfapi_geran_system_information_request_t));
+	printf("nfapi_lte_system_information_indication_t %zu\n", sizeof(nfapi_lte_system_information_indication_t));
+	printf("nfapi_utran_system_information_indication_t %zu\n", sizeof(nfapi_utran_system_information_indication_t));
+	printf("nfapi_geran_system_information_indication_t %zu\n", sizeof(nfapi_geran_system_information_indication_t));
+}
+
+/************* Test Runner Code goes here **************/
+
+
+int main ( int argc, char** argv)
+{
+
+/*
+        printf("1..3\n");
+        printf("ok 1 - run good\n");	
+        printf("ok 2 - mojojojo\n");	
+        printf("not ok 3 - not implemented\n");	
+	return 0;
+	*/
+
+
+	int i;
+	printf("%d \n", argc);
+	for(i = 0; i < argc; ++i)
+	{
+		if(argv[i] != 0)
+			printf("%s \n", argv[i]);
+	}
+
+	CU_pSuite pSuite = NULL;
+
+	/* initialize the CUnit test registry */
+	if ( CUE_SUCCESS != CU_initialize_registry() )
+		return CU_get_error();
+
+	/* add a suite to the registry */
+	pSuite = CU_add_suite( "nfapi_test_suite", init_suite, clean_suite );
+	if ( NULL == pSuite ) {
+		CU_cleanup_registry();
+		return CU_get_error();
+	}
+
+	/* add the tests to the suite */
+	//if ( (NULL == CU_add_test(pSuite, "nfapi_test_pnf_config_req", nfapi_test_pnf_config_req)) ||
+	//     (NULL == CU_add_test(pSuite, "nfapi_test_2", nfapi_test_2)) 
+	//   )
+	// {
+	//   CU_cleanup_registry();
+	//   return CU_get_error();
+	//}
+
+
+	CU_pSuite pSuiteP4 = CU_add_suite( "nfapi_p4_pack_unpack_test_suite", init_suite, clean_suite );
+	if(pSuiteP4)
+	{
+		if((NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_request_lte", nfapi_test_rssi_request_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_request_lte2", nfapi_test_rssi_request_lte2)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_request_lte_overrun", nfapi_test_rssi_request_lte_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_request_lte_rat_type_mismatch", nfapi_test_rssi_request_lte_rat_type_mismatch)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_request_utran", nfapi_test_rssi_request_utran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_request_geran", nfapi_test_rssi_request_geran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_request_nb_iot", nfapi_test_rssi_request_nb_iot)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_response", nfapi_test_rssi_response)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_indication", nfapi_test_rssi_indication)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_rssi_indication_overrun", nfapi_test_rssi_indication_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_request_lte", nfapi_test_cell_search_request_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_request_lte_overrun", nfapi_test_cell_search_request_lte_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_request_utran", nfapi_test_cell_search_request_utran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_request_utran_overrun", nfapi_test_cell_search_request_utran_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_request_geran", nfapi_test_cell_search_request_geran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_request_geran_overrun", nfapi_test_cell_search_request_geran_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_request_nb_iot", nfapi_test_cell_search_request_nb_iot)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_response", nfapi_test_cell_search_response)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_indication_lte", nfapi_test_cell_search_indication_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_indication_lte_overrun", nfapi_test_cell_search_indication_lte_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_indication_utran", nfapi_test_cell_search_indication_utran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_indication_utran_overrun", nfapi_test_cell_search_indication_utran_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_indication_geran", nfapi_test_cell_search_indication_geran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_indication_geran_overrun", nfapi_test_cell_search_indication_geran_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_indication_state_overrun", nfapi_test_cell_search_indication_state_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_cell_search_indication_nb_iot", nfapi_test_cell_search_indication_nb_iot)) ||				
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_request_lte", nfapi_test_broadcast_detect_request_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_request_utran", nfapi_test_broadcast_detect_request_utran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_request_nb_iot", nfapi_test_broadcast_detect_request_nb_iot)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_request_state_overrun", nfapi_test_broadcast_detect_request_state_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_response", nfapi_test_broadcast_detect_response)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_indication_lte", nfapi_test_broadcast_detect_indication_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_indication_lte_overrun", nfapi_test_broadcast_detect_indication_lte_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_indication_utran", nfapi_test_broadcast_detect_indication_utran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_indication_utran_overrun", nfapi_test_broadcast_detect_indication_utran_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_indication_state_overrun", nfapi_test_broadcast_detect_indication_state_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_broadcast_detect_indication_nb_iot", nfapi_test_broadcast_detect_indication_nb_iot)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_schedule_request_lte", nfapi_test_system_information_schedule_request_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_schedule_request_state_overrun", nfapi_test_system_information_schedule_request_state_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_schedule_request_nb_iot", nfapi_test_system_information_schedule_request_nb_iot)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_schedule_response", nfapi_test_system_information_schedule_response)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_schedule_indication_lte", nfapi_test_system_information_schedule_indication_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_schedule_indication_nb_iot", nfapi_test_system_information_schedule_indication_nb_iot)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_request_lte", nfapi_test_system_information_request_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_request_lte_overrun", nfapi_test_system_information_request_lte_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_request_utran", nfapi_test_system_information_request_utran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_request_geran", nfapi_test_system_information_request_geran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_request_state_overrun", nfapi_test_system_information_request_state_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_request_nb_iot", nfapi_test_system_information_request_nb_iot)) ||				
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_response", nfapi_test_system_information_response)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_indication_lte", nfapi_test_system_information_indication_lte)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_indication_lte_overrun", nfapi_test_system_information_indication_lte_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_indication_utran", nfapi_test_system_information_indication_utran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_indication_utran_overrun", nfapi_test_system_information_indication_utran_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_indication_geran", nfapi_test_system_information_indication_geran)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_indication_geran_overrun", nfapi_test_system_information_indication_geran_overrun)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_system_information_indication_nb_iot", nfapi_test_system_information_indication_nb_iot)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_nmm_stop_request", nfapi_test_nmm_stop_request)) ||
+				(NULL == CU_add_test(pSuiteP4, "nfapi_test_nmm_stop_response", nfapi_test_nmm_stop_response))
+				) 
+				{
+					CU_cleanup_registry();
+					return CU_get_error();
+				}
+	}
+	else
+	{
+		CU_cleanup_registry();
+		return CU_get_error();
+	}
+
+	CU_pSuite pSuiteP5 = CU_add_suite( "nfapi_p5_pack_unpack_test_suite", init_suite, clean_suite );
+	if(pSuiteP5)
+	{
+		if((NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_param_request", nfapi_test_pnf_param_request)) ||
+		    (NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_param_request_ve", nfapi_test_pnf_param_request_ve)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_param_response", nfapi_test_pnf_param_response)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_config_request", nfapi_test_pnf_config_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_config_response", nfapi_test_pnf_config_response)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_config_response1", nfapi_test_pnf_config_response1)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_start_request", nfapi_test_pnf_start_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_start_response", nfapi_test_pnf_start_response)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_stop_request", nfapi_test_pnf_stop_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_pnf_stop_request", nfapi_test_pnf_stop_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_param_request", nfapi_test_param_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_param_response", nfapi_test_param_response)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_config_request", nfapi_test_config_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_config_response", nfapi_test_config_response)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_start_request", nfapi_test_start_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_start_response", nfapi_test_start_response)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_stop_request", nfapi_test_stop_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_stop_response", nfapi_test_stop_response)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_measurement_request", nfapi_test_measurement_request)) ||
+			(NULL == CU_add_test(pSuiteP5, "nfapi_test_measurement_response", nfapi_test_measurement_response))
+		  )
+		{
+			CU_cleanup_registry();
+			return CU_get_error();
+		}
+
+	}
+	else
+	{
+		CU_cleanup_registry();
+		return CU_get_error();
+	}
+
+	CU_pSuite pSuiteP7 = CU_add_suite( "nfapi_p7_pack_unpack_test_suite", init_suite, clean_suite );
+	if(pSuiteP7)
+	{
+		if((NULL == CU_add_test(pSuiteP7, "nfapi_test_dl_config_request", nfapi_test_dl_config_request)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_ul_config_request", nfapi_test_ul_config_request)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_hi_dci0_request", nfapi_test_hi_dci0_request)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_tx_request", nfapi_test_tx_request)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_harq_indication", nfapi_test_harq_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_crc_indication", nfapi_test_crc_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_rx_ulsch_indication", nfapi_test_rx_ulsch_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_rach_indication", nfapi_test_rach_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_srs_indication", nfapi_test_srs_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_rx_sr_indication", nfapi_test_rx_sr_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_rx_cqi_indication", nfapi_test_rx_cqi_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_lbt_dl_config_request", nfapi_test_lbt_dl_config_request)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_lbt_dl_indication", nfapi_test_lbt_dl_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_lbt_dl_indication_invalid_pdu_type", nfapi_test_lbt_dl_indication_invalid_pdu_type)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_nb_harq_indication", nfapi_test_nb_harq_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_nrach_indication", nfapi_test_nrach_indication)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_dl_node_sync", nfapi_test_dl_node_sync)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_ul_node_sync", nfapi_test_ul_node_sync)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_test_timing_info", nfapi_test_timing_info)) ||
+			(NULL == CU_add_test(pSuiteP7, "nfapi_struct_sizes", nfapi_struct_sizes))
+		  )
+		{
+			CU_cleanup_registry();
+			return CU_get_error();
+		}
+
+	}
+	else
+	{
+		CU_cleanup_registry();
+		return CU_get_error();
+	}
+
+
+	// Run all tests using the basic interface
+	CU_basic_set_mode(CU_BRM_VERBOSE);
+	//printf(" CU_basic_set_mode set \n");
+	CU_set_output_filename("nfapi_unit_test_results.xml");
+
+	CU_basic_run_tests();
+	//CU_automated_run_tests();
+
+	//CU_set_test_complete_handler(automated_test_complete_message_handler);
+	//CU_run_all_tests();
+
+	
+	CU_pSuite s = CU_get_registry()->pSuite;
+	int count = 0;
+	while(s)
+	{
+		CU_pTest t = s->pTest;
+		while(t)
+		{
+			count++;
+			t = t->pNext;
+		}
+		s = s->pNext;
+	}
+
+	printf("%d..%d\n", 1, count);
+
+
+
+	s = CU_get_registry()->pSuite;
+	count = 1;
+	while(s)
+	{
+		CU_pTest t = s->pTest;
+		while(t)
+		{
+			int pass = 1;
+			CU_FailureRecord* failures = CU_get_failure_list();
+			while(failures)
+			{
+				if(strcmp(failures->pSuite->pName, s->pName) == 0 &&
+				   strcmp(failures->pTest->pName, t->pName) == 0)
+				{
+					pass = 0;
+					failures = 0;
+				}
+				else
+				{
+					failures = failures->pNext;
+				}
+			}
+
+			if(pass)
+				printf("ok %d - %s:%s\n", count, s->pName, t->pName);
+			else 
+				printf("not ok %d - %s:%s\n", count, s->pName, t->pName);
+
+			count++;
+			t = t->pNext;
+		}
+		s = s->pNext;
+	}
+
+	/*
+	s = CU_get_registry()->pSuite;
+	while(s)
+	{
+	   printf("Suite %s\n", s->pName);
+	   CU_pTest t = s->pTest;
+	   while(t)
+	   {
+		   printf(" Test %s\n", t->pName);
+			i//CU_ErrorCode e = CU_basic_run_test(s, t);
+
+		   t = t->pNext;
+	   }
+	   s = s->pNext;
+	}
+	*/
+
+
+
+	//printf("CU_basic_run_tests completed \n");
+	//CU_basic_show_failures(CU_get_failure_list());
+	//printf("CU_basic_show_failures completed\n\n");
+	/*
+	// Run all tests using the automated interface
+	CU_automated_run_tests();
+	CU_list_tests_to_file();
+
+	// Run all tests using the console interface
+	CU_console_run_tests();
+	*/
+	/* Clean up registry and return */
+
+
+	CU_cleanup_registry();
+	return CU_get_error();
+
+}
diff --git a/nfapi/open-nFAPI/pnf/Makefile.am b/nfapi/open-nFAPI/pnf/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..663d96b6dddeba94a730abf6a82f7c9fe6ddd6a5
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/Makefile.am
@@ -0,0 +1,32 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+AUTOMAKE_OPTIONS=subdir-objects
+
+AM_CPPFLAGS = -I$(top_srcdir)/pnf/inc -I$(top_srcdir)/pnf/public_inc -I$(top_srcdir)/nfapi/public_inc -I$(top_srcdir)/common/public_inc -g -Wall -Werror
+
+
+noinst_LIBRARIES = libnfapi_pnf.a
+
+libnfapi_pnf_a_SOURCES = src/pnf.c\
+						 src/pnf_interface.c\
+						 src/pnf_p7.c\
+						 src/pnf_p7_interface.c
+
+LDADD = -lsctp
+
+
+
diff --git a/nfapi/open-nFAPI/pnf/inc/pnf.h b/nfapi/open-nFAPI/pnf/inc/pnf.h
new file mode 100644
index 0000000000000000000000000000000000000000..ab38c66e090f1f2ed6d010988465155e25fa8ca8
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/inc/pnf.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef _PNF_H_
+#define _PNF_H_
+
+#include "nfapi_pnf_interface.h"
+
+#define NFAPI_MAX_PACKED_MESSAGE_SIZE 8192
+
+typedef struct {
+
+	nfapi_pnf_config_t _public;
+
+	int p5_sock;
+	uint8_t tx_message_buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
+
+	uint8_t sctp;
+
+	uint8_t terminate;
+
+} pnf_t;
+
+
+int pnf_connect(pnf_t *pnf);
+int pnf_message_pump(pnf_t *pnf);
+
+int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
+int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
+int pnf_send_message(pnf_t* pnf, uint8_t* msg, uint32_t msg_len, uint16_t stream_id);
+
+nfapi_pnf_phy_config_t* nfapi_pnf_phy_config_find(nfapi_pnf_config_t* config, uint16_t phy_id);
+
+#endif // _PNF_H_
+
diff --git a/nfapi/open-nFAPI/pnf/inc/pnf_p7.h b/nfapi/open-nFAPI/pnf/inc/pnf_p7.h
new file mode 100644
index 0000000000000000000000000000000000000000..3f08d85e6b678aff5c15c733b3361c65ab81961c
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/inc/pnf_p7.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef _PNF_P7_H_
+#define _PNF_P7_H_
+
+#define TIMEHR_SEC(_time_hr) ((uint32_t)(_time_hr) >> 20)
+#define TIMEHR_USEC(_time_hr) ((uint32_t)(_time_hr) & 0xFFFFF)
+#define TIME2TIMEHR(_time) (((uint32_t)(_time.tv_sec) & 0xFFF) << 20 | ((uint32_t)(_time.tv_usec) & 0xFFFFF))
+
+#include "nfapi_pnf_interface.h"
+
+#define NFAPI_MAX_PACKED_MESSAGE_SIZE 8192
+
+typedef struct {
+	uint16_t dl_conf_ontime;
+	uint16_t dl_conf_late;
+	uint16_t ul_conf_ontime;
+	uint16_t ul_conf_late;
+	uint16_t hi_dci0_ontime;
+	uint16_t hi_dci0_late;
+	uint16_t tx_ontime;
+	uint16_t tx_late;
+} pnf_p7_stats_t;
+
+typedef struct {
+	uint8_t* buffer;
+	uint16_t length;
+} pnf_p7_rx_message_segment_t;
+
+typedef struct pnf_p7_rx_message pnf_p7_rx_message_t;
+
+typedef struct pnf_p7_rx_message {
+	uint8_t sequence_number;
+	uint8_t num_segments_received;
+	uint8_t num_segments_expected;
+
+	// the spec allows of upto 128 segments, this does seem excessive
+	pnf_p7_rx_message_segment_t segments[128];
+
+	uint32_t rx_hr_time;
+
+	pnf_p7_rx_message_t* next;
+} pnf_p7_rx_message_t;
+
+typedef struct {
+
+	pnf_p7_rx_message_t* msg_queue;
+
+} pnf_p7_rx_reassembly_queue_t;
+
+
+typedef struct {
+
+	nfapi_pnf_p7_config_t _public;
+
+	//private data
+	int p7_sock;
+
+	uint8_t terminate;
+
+	uint8_t tx_message_buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
+	uint8_t* rx_message_buffer;
+	uint16_t rx_message_buffer_size;
+
+	pthread_mutex_t mutex; // should we allow the client to specifiy
+	pthread_mutex_t pack_mutex; // should we allow the client to specifiy
+
+	nfapi_pnf_p7_subframe_buffer_t subframe_buffer[30/*NFAPI_MAX_TIMING_WINDOW_SIZE*/];
+
+	uint32_t sequence_number;
+	uint16_t max_num_segments;
+
+	pnf_p7_rx_reassembly_queue_t reassembly_queue;
+
+	uint8_t* reassemby_buffer;
+	uint32_t reassemby_buffer_size;
+
+	uint16_t sfn_sf;
+	uint32_t sf_start_time_hr;
+	int32_t sfn_sf_shift;
+
+	uint8_t timing_info_period_counter;
+	uint8_t timing_info_aperiodic_send; // 0:false 1:true
+
+	uint32_t timing_info_ms_counter; // number of ms since last timing info
+
+	uint32_t dl_config_jitter;
+	uint32_t ul_config_jitter;
+	uint32_t hi_dci0_jitter;
+	uint32_t tx_jitter;
+
+	uint32_t tick;
+	pnf_p7_stats_t stats;
+
+} pnf_p7_t;
+
+int pnf_p7_message_pump(pnf_p7_t* pnf_p7);
+
+int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* msg, uint32_t msg_len);
+int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t msg_len);
+
+
+int pnf_p7_subframe_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn_sf);
+
+pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len);
+void pnf_p7_rx_reassembly_queue_remove_msg(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, pnf_p7_rx_message_t* msg);
+void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint32_t delta);
+
+#endif /* _PNF_P7_H_ */
+
diff --git a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..b25caf28760ff6e06ef4607b2d49f7e1a46e1de5
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
@@ -0,0 +1,803 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef _NFAPI_PNF_INTERFACE_H_
+#define _NFAPI_PNF_INTERFACE_H_
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#include "nfapi_interface.h"
+#include "debug.h"
+
+#include <sys/types.h>
+
+/*! This enum is used to describe the states of the pnf 
+ */
+typedef enum
+{
+	NFAPI_PNF_IDLE = 0,
+	NFAPI_PNF_CONFIGURED,
+	NFAPI_PNF_RUNNING
+} nfapi_pnf_state_e;
+
+/*! This enum is used to describe the states of a phy instance of a pnf
+ */
+typedef enum
+{
+	NFAPI_PNF_PHY_IDLE = 0,
+	NFAPI_PNF_PHY_CONFIGURED = 1,
+	NFAPI_PNF_PHY_RUNNING = 2
+} nfapi_pnf_phy_state_e;
+
+typedef struct nfapi_pnf_phy_config nfapi_pnf_phy_config_t;
+
+/*! Configuration information for a pnf phy instance
+ */
+typedef struct nfapi_pnf_phy_config
+{
+	/*! The PHY id*/
+	uint16_t phy_id;
+
+	/*! The state of the PNF PHY instance*/
+	nfapi_pnf_phy_state_e state;
+
+	/*! Optional user defined data that will be passed back in the callbacks*/
+	void* user_data;
+
+	/*! Pointer for use in a linked list */
+	struct nfapi_pnf_phy_config* next;
+} nfapi_pnf_phy_config_t;
+
+typedef struct nfapi_pnf_config nfapi_pnf_config_t;
+
+/*! Configuration information for the pnf created by calling nfapi_pnf_create
+ */
+typedef struct nfapi_pnf_config
+{
+	/*! A user define callback to override the default memory allocation 
+	 * \param size The size of the data buffer to allocate
+	 * \return A pointer to a data buffer
+	 */
+	void* (*malloc)(size_t size);
+	
+	/*! A user define callback to override the default memory deallocation 
+	 * \param ptr Pointer to a data buffer to be deallocated
+	 */
+	void (*free)(void* ptr);
+
+	/*! A user define callback to handle trace from the pnf 
+	 * \param level The trace level 
+	 * \param message The trace string
+	 * 
+	 * This is a vardic function.
+	 */
+	void (*trace)(nfapi_trace_level_t  level, const char* message, ...);
+
+	/*! The ip address of the VNF 
+	 *
+	 */
+	char* vnf_ip_addr;
+
+	/*! The ip port of the VNF 
+	 */
+	int vnf_p5_port;
+
+	/*! The state of the PNF */
+	nfapi_pnf_state_e state;
+
+	/*! List of PHY instances configured for this PNF */
+	nfapi_pnf_phy_config_t* phys;
+	
+	/*! Configuation option of the p4 p5 encode decode functions */
+	nfapi_p4_p5_codec_config_t codec_config;
+	
+	/*! Optional user defined data that will be passed back in the callbacks*/
+	void* user_data;
+
+
+	/*! A callback for the PNF_PARAM.request 
+	 *  \param config A pointer to the pnf configuration
+	 *  \param req A data structure for the decoded PNF_PARAM.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the PNF_PARAM.response after receiving the
+	 *  PNF_PARAM.request. This can be done in the call back. 
+	 */
+	int (*pnf_param_req)(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req);
+	
+	/*! A callback for the PNF_CONFIG.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param req A data structure for the decoded PNF_CONFIG.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the PNF_CONFIG.response after receiving the
+	 *  PNF_CONFIG.request. This can be done in the call back. 
+	 */
+	int (*pnf_config_req)(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req);
+	
+	/*! A callback for the PNF_START.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param req A data structure for the decoded PNF_CONFIG.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the PNF_START.response after receiving the
+	 *  PNF_START.request. This can be done in the call back. 
+	 */
+	int (*pnf_start_req)(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req);
+	
+	/*! A callback for the PNF_STOP.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param req A data structure for the decoded PNF_STOP.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the PNF_STOP.response after receiving the
+	 *  PNF_STOP.request. This can be done in the call back. 
+	 */
+	int (*pnf_stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_stop_request_t* req);
+
+	/*! A callback for the PARAM.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded PARAM.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the PARAM.response after receiving the
+	 *  PARAM.request. This can be done in the call back. 
+	 */
+	int (*param_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req);
+	
+	/*! A callback for the CONFIG.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded CONFIG.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the CONFIG.response after receiving the
+	 *  CONFIG.request. This can be done in the call back. 
+	 */
+	int (*config_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req);
+	
+	/*! A callback for the START.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded START.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the START.response after the client has received the
+	 *  first subframe indication from FAPI.
+	 */
+	int (*start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req);
+	
+	/*! A callback for the STOP.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded STOP.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the STOP.response after receiving the
+	 *  STOP.request. This can be done in the call back. 
+	 */
+	int (*stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_stop_request_t* req);
+	
+	/*! A callback for the MEASUREMENT.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded MEASUREMENT.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the MEASUREMENT.response after receiving the
+	 *  MEASUREMENT.request. This can be done in the call back. 
+	 */
+	int (*measurement_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_measurement_request_t* req);
+	
+	/*! A callback for the RSSI.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded RSSI.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the RSSI.response after receiving the
+	 *  RSSI.request. This can be done in the call back. 
+	 */
+	int (*rssi_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_rssi_request_t* req);
+	
+	/*! A callback for the CELL_SEARCH.request
+	 *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded CELL_SEARCH.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the CELL_SEARCH.response after receiving the
+	 *  CELL_SEARCH.request. This can be done in the call back. 	
+	 */
+	int (*cell_search_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_cell_search_request_t* req);
+	
+	/*! A callback for the BROADCAST_DETECT.request
+     *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded BROADCAST_DETECT.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the BROADCAST_DETECT.response after receiving the
+	 *  BROADCAST_DETECT.request. This can be done in the call back. 	
+	 */
+	int (*broadcast_detect_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_broadcast_detect_request_t* req);
+	
+	/*! A callback for the SYSTEM_INFORMATION_SCHEDULE.request
+     *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded SYSTEM_INFORMATION_SCHEDULE.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the SYSTEM_INFORMATION_SCHEDULE.response after receiving the
+	 *  SYSTEM_INFORMATION_SCHEDULE.request. This can be done in the call back. 	
+	 */
+	int (*system_information_schedule_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_schedule_request_t* req);
+	
+	/*! A callback for the SYSTEM_INFORMATION.request
+     *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded SYSTEM_INFORMATION.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the SYSTEM_INFORMATION.response after receiving the
+	 *  SYSTEM_INFORMATION.request. This can be done in the call back. 	
+	 */
+	int (*system_information_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_request_t* req);
+	
+	/*! A callback for the NMM_STOP.request
+     *  \param config A pointer to the pnf configuration
+	 *  \param phy A pointer to the pnf phy configuration
+	 *  \param req A data structure for the decoded NMM_STOP.request. This will have
+	 *             been allocated on the stack
+	 *  \return not currently used
+	 * 
+	 * 	The client is expected to send the NMM_STOP.response after receiving the
+	 *  NMM_STOP.request. This can be done in the call back.
+	 */
+	int (*nmm_stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nmm_stop_request_t* req);
+	
+	/*! A callback for any vendor extension messages recevied
+	 *  \param config A pointer to the pnf configuration
+	 *  \param msg A pointer to the decode P4/P5 message
+	 *  \return not current used
+	 */
+	int (*vendor_ext)(nfapi_pnf_config_t* config, nfapi_p4_p5_message_header_t* msg);
+	
+	/*! A callback to allocate vendor extension message
+	 * \param message_id The message id from the decode P4/P5 message header
+	 * \param msg_size A pointer a the size of the allocated message structure. The callee should set this
+	 * \return A pointer to a allocated P4/P5 message structure
+	 */
+	nfapi_p4_p5_message_header_t* (*allocate_p4_p5_vendor_ext)(uint16_t message_id, uint16_t* msg_size);
+	
+	/*! A callback to deallocate vendor extension message 
+	 * \param header A pointer to an P4/P5 message structure
+	 */
+	void (*deallocate_p4_p5_vendor_ext)(nfapi_p4_p5_message_header_t* header);
+
+
+
+} nfapi_pnf_config_t;
+
+/*! Create a pnf configuration 
+ *  \return A pointer to a pnf configuration struture
+ * 
+ *  This function will create and initialize a pnf instance. It is expected that 
+ *  the client will set the callback and parameters need before calling nfapi_pnf_start
+ *
+ *  0 will be returned if it fails.
+ * 
+ * \code
+ * nfapi_pnf_config_t* config = nfapi_pnf_config_create(void);
+ * \endcode
+ */
+nfapi_pnf_config_t* nfapi_pnf_config_create(void);
+
+/*! Delete a pnf configuration 
+ * \param config A pointer to a pnf configuraiton
+ * \return 0 is success, -1 for failure
+ */
+int nfapi_pnf_config_destroy(nfapi_pnf_config_t* config);
+
+/*! Start the PNF library. 
+ * \param config A pointer to the pnf configuration
+ * \return 0 is success, -1 for failure
+ * 
+ * This function will not return until nfapi_pnf_stop is called
+ *
+ * \code
+ * // Create the pnf config
+ * nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+ *
+ * // Assumed that the vnf_address and vnf_port are provided over the P9 interface
+ * config->vnf_ip_addr = vnf_address;
+ * config->vnf_p5_port = vnf_port;
+ *
+ * // Set the required callbacks
+ * config->pnf_param_req = &pnf_param_request;
+ * ...
+ * 
+ * // Call start for the PNF to initiate a connection to the VNF
+ * nfai_pnf_start(config);
+ * 
+ * \endcode
+ */
+int nfapi_pnf_start(nfapi_pnf_config_t* config);
+
+/*! Stop the PNF library. 
+ * \param config A pointer to the pnf configuration
+ * \return 0 is success, -1 for failure
+ * 
+ * This function will cause the nfapi_pnf_start function to return
+ */
+int nfapi_pnf_stop(nfapi_pnf_config_t* config);
+
+/*! Send the PNF_PARAM.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp);
+
+/*! Send the PNF_CONFIG.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_response_t* resp);
+
+/*! Send the PNF_START.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp);
+
+/*! Send the PNF_STOP.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_t* resp);
+
+/*! Send the PARAM.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp);
+
+/*! Send the CONFIG.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp);
+
+/*! Send the START.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp);
+
+/*! Send the STOP.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_stop_response_t* resp);
+
+/*! Send the MEASUREMENT.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_measurement_resp(nfapi_pnf_config_t* config, nfapi_measurement_response_t* resp);
+
+/*! Send the RSSI.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_rssi_resp(nfapi_pnf_config_t* config, nfapi_rssi_response_t* resp);
+
+/*! Send the RSSI.indication
+ * \param config A pointer to a pnf configuraiton
+ * \param ind A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_rssi_ind(nfapi_pnf_config_t* config, nfapi_rssi_indication_t* ind);
+
+/*! Send the CELL_SEARCH.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_cell_search_resp(nfapi_pnf_config_t* config, nfapi_cell_search_response_t* resp);
+
+/*! Send the CELL_SEARCH.indication
+ * \param config A pointer to a pnf configuraiton
+ * \param ind A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_cell_search_ind(nfapi_pnf_config_t* config, nfapi_cell_search_indication_t* ind);
+
+/*! Send the BROADCAST_DETECT.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_broadcast_detect_resp(nfapi_pnf_config_t* config, nfapi_broadcast_detect_response_t* resp);
+
+/*! Send the BROADCAST_DETECT.indication
+ * \param config A pointer to a pnf configuraiton
+ * \param ind A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_broadcast_detect_ind(nfapi_pnf_config_t* config, nfapi_broadcast_detect_indication_t* ind);
+
+/*! Send the SYSTEM_INFORMATION_SCHEDULE.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_system_information_schedule_resp(nfapi_pnf_config_t* config, nfapi_system_information_schedule_response_t* resp);
+
+/*! Send the SYSTEM_INFORMATION_SCHEDULE.indication
+ * \param config A pointer to a pnf configuraiton
+ * \param ind A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_system_information_schedule_ind(nfapi_pnf_config_t* config, nfapi_system_information_schedule_indication_t* ind);
+
+/*! Send the SYSTEM_INFORMATION.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_system_information_resp(nfapi_pnf_config_t* config, nfapi_system_information_response_t* resp);
+
+/*! Send the SYSTEM_INFORMATION.indication
+ * \param config A pointer to a pnf configuraiton
+ * \param ind A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_system_information_ind(nfapi_pnf_config_t* config, nfapi_system_information_indication_t* ind);
+
+/*! Send the NMM_STOP.response
+ * \param config A pointer to a pnf configuraiton
+ * \param resp A pointer to the message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_nmm_stop_resp(nfapi_pnf_config_t* config, nfapi_nmm_stop_response_t* resp);
+
+/*! Send a vendor extension message
+ * \param config A pointer to a pnf configuraiton
+ * \param msg A pointer to the vendor extention message structure
+ * \param msg_len The size of the vendor extention message structure
+ * \return 0 for success, -1 for failure
+ * 
+ */
+int nfapi_pnf_vendor_extension(nfapi_pnf_config_t* config, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
+
+//--------------------------
+
+/*! A subframe buffer structure which can be used by the client to 
+ *  to configure the dummy information
+ */
+typedef struct 
+{
+	uint16_t sfn_sf;
+	
+	nfapi_dl_config_request_t* dl_config_req;
+	nfapi_ul_config_request_t* ul_config_req;
+	nfapi_hi_dci0_request_t* hi_dci0_req;
+	nfapi_tx_request_t* tx_req;
+	nfapi_lbt_dl_config_request_t* lbt_dl_config_req;
+
+} nfapi_pnf_p7_subframe_buffer_t;
+
+typedef struct nfapi_pnf_p7_config nfapi_pnf_p7_config_t;
+
+/*! The nfapi PNF PHY P7 configuration information created using the nfapi_pnf_p7_create function
+ */
+typedef struct nfapi_pnf_p7_config
+{
+	/*! A user define callback to override the default memory allocation 
+	 * \param size The size of the buffer to allocate
+	 * \return An allocated buffer. 0 in the case of failure
+	 * 
+	 * If not set malloc will be used
+	 */
+	void* (*malloc)(size_t size);
+	
+	/*! A user define callback to override the default memory deallocation 
+	 *  \param ptr Pointer to a buffer to dellocate
+	 *
+	 * If not set free will be used
+	 */
+	void (*free)(void* ptr);
+
+	/*! A user define callback to handle trace from the pnf
+	 * \param level The trace level
+	 * \param message The message string
+	 */
+	void (*trace)(nfapi_trace_level_t  level, const char* message, ...);
+
+	/*! The PHY id*/
+	uint16_t phy_id;
+
+	// remote
+	/*! The VNF P7 UDP port */
+	int remote_p7_port;
+	/*! The VNF P7 UDP address */
+	char* remote_p7_addr;
+
+	// local
+	/*! The PNF P7 UDP port */
+	int local_p7_port;
+	/*! The PNF P7 UDP address */
+	char* local_p7_addr;
+
+	/*! Flag to indicate of the pnf should use the P7 checksum */
+	uint8_t checksum_enabled;
+
+	/*! The maxium size of a P7 segement. If a message is large that this it
+	 * will be segemented */
+	uint16_t segment_size;
+
+	/*! The dummy subframe buffer structure that should be used in case there
+	 * are no 'valid' subframe messages */
+	nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
+	
+	/*! Configuration options for the p7 pack unpack functions*/
+	nfapi_p7_codec_config_t codec_config;
+	
+	/*! Optional userdata that will be passed back in the callbacks*/
+	void* user_data;
+
+	// tdb : if these should be public
+	uint16_t subframe_buffer_size;
+	uint8_t timing_info_mode_periodic; // 0:false 1:true
+	uint8_t timing_info_mode_aperiodic; // 0:false 1:true
+	uint8_t timing_info_period; // 1..225 in subframes
+
+	/*! A callback for the DL_CONFIG.request
+	 * \param config A poiner to the PNF P7 config
+	 * \param req A pointer to the dl config request message structure
+	 * \return not currently used
+	 */
+	int (*dl_config_req)(nfapi_pnf_p7_config_t* config, nfapi_dl_config_request_t* req);
+	
+	/*! A callback for the UL_CONFIG.request
+	 * \param config A poiner to the PNF P7 config
+	 * \param req A pointer to the ul config request message structure
+	 * \return not currently used	
+	 */
+	int (*ul_config_req)(nfapi_pnf_p7_config_t* config, nfapi_ul_config_request_t* req);
+	
+	/*! A callback for the HI_DCI0.request
+	 * \param config A poiner to the PNF P7 config
+	 * \param req A pointer to the hi dci0 request message structure
+	 * \return not currently used
+	 */
+	int (*hi_dci0_req)(nfapi_pnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
+	
+	/*! A callback for the TX_REQ.request
+	 * \param config A poiner to the PNF P7 config
+	 * \param req A pointer to the tx request message structure
+	 * \return not currently used
+	 * 
+	 * The TX request contains pointers to the downlink PDUs to be sent. In the case that the FAPI interface
+	 * will 'keep' the pointers until they are transmitted the callee should set the pointers in the req to 0
+	 * and then use the p7 codec config free function to release the pdu's when appropriate. 
+	 */
+	int (*tx_req)(nfapi_pnf_p7_config_t* config, nfapi_tx_request_t* req);
+	
+	/*! A callback for the LBT_DL_CONFIG.request
+	 * \param config A poiner to the PNF P7 config
+	 * \param req A pointer to the lbt dl request message structure
+	 * \return not currently used
+	 */
+	int (*lbt_dl_config_req)(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req);
+	
+	/*! A callback for vendor extension messages
+	 * \param config A poiner to the PNF P7 config
+	 * \param msg A pointer to a decode vendor extention message
+	 * \return not currently used
+	 */
+	int (*vendor_ext)(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg);
+
+	/*! A callback to allocate vendor extension message
+	 * \param message_id The vendor extention message id from the decode message header
+	 * \param msg_size A pointer to size of the allocate vendor extention message. Set by the callee
+	 * \return A pointer to an allocated vendor extention message structure. 0 if failed
+	 * 
+	 * 
+	 */
+	nfapi_p7_message_header_t* (*allocate_p7_vendor_ext)(uint16_t message_id, uint16_t* msg_size);
+	
+	/*! A callback to deallocate vendor extension message
+	 * \param header A pointer to a p7 vendor extention message
+	 */
+	void (*deallocate_p7_vendor_ext)(nfapi_p7_message_header_t* header);
+
+
+
+} nfapi_pnf_p7_config_t;
+
+/*! Create and initialise a nfapi_pnf_p7_config structure
+ * \return A pointer to a PNF P7 config structure
+ */
+nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create(void);
+
+/*! Delete an nfapi_pnf_p7_config structure
+ * \param config 
+ */
+int nfapi_pnf_p7_config_destroy(nfapi_pnf_p7_config_t* config);
+
+
+/*! Start the PNF P7 library. 
+ * \param config A pointer to a PNF P7 config
+ * \return 0 means success, -1 means failure
+ * 
+ * This function will not return until nfapi_pnf_p7_stop is called.
+ */
+int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config);
+
+/*! Stop the PNF P7 library. 
+ * \param config A pointer to a PNF P7 config
+ * \return  0 means success, -1 means failure
+ * 
+ * This function will cause the nfapi_pnf_p7_start to return
+ */
+int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config);
+
+/*! Subframe indication
+ * \param config A pointer to a PNF P7 config
+ * \param phy_id The phy_id for the phy instance
+ * \param sfn_sf The SFN and SF in the format of FAPI
+ * \return 0 means success, -1 means failure
+ * 
+ * The client should call the subframe indication every 1ms. The PNF will
+ * respond by invoking the pnf p7 subframe callbacks with the messages from the subframe buffer
+ *
+ * If messages are not in the subframe buffer, they dummy subframe messages will be sent
+ */
+int nfapi_pnf_p7_subframe_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn_sf);
+
+/*! Send the HARQ.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the harq indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_harq_ind(nfapi_pnf_p7_config_t* config, nfapi_harq_indication_t* ind);
+
+/*! Send the CRC.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the crc indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_crc_indication_t* ind);
+
+/*! Send the RX.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the rx indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_rx_ind(nfapi_pnf_p7_config_t* config, nfapi_rx_indication_t* ind);
+
+/*! Send the RACH.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the rach indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_rach_indication_t* ind);
+
+/*! Send the SRS.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the srs indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_srs_indication_t* ind);
+
+/*! Send the SR.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the sr indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_sr_ind(nfapi_pnf_p7_config_t* config, nfapi_sr_indication_t* ind);
+
+/*! Send the CQI.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the cqi indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_cqi_ind(nfapi_pnf_p7_config_t* config, nfapi_cqi_indication_t* ind);
+
+/*! Send the LBT_DL.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the lbt dl indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_lbt_dl_ind(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_indication_t* ind);
+
+/*! Send the NB_HARQ.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the lbt dl indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_nb_harq_ind(nfapi_pnf_p7_config_t* config, nfapi_nb_harq_indication_t* ind);
+
+/*! Send the NRACH.indication
+ * \param config A pointer to a PNF P7 config
+ * \param ind A pointer to the lbt dl indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_nrach_ind(nfapi_pnf_p7_config_t* config, nfapi_nrach_indication_t* ind);
+
+
+/*! Send a vendor exntesion message
+ * \param config A pointer to a PNF P7 config
+ * \param msg A pointer to the lbt dl indication message structure
+ * \return 0 means success, -1 means failure
+ */
+int nfapi_pnf_p7_vendor_extension(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // _NFAPI_PNF_INTERFACE_H_
diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c
new file mode 100644
index 0000000000000000000000000000000000000000..d0a7fa6fd12140dd38ab66c1f866ec8d9abe3d09
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/src/pnf.c
@@ -0,0 +1,1598 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "pnf.h"
+
+#define MAX_SCTP_STREAMS 16
+
+void nfapi_pnf_phy_config_delete_all(nfapi_pnf_config_t* config)
+{
+	nfapi_pnf_phy_config_t* curr = config->phys;
+	while(curr != 0)
+	{
+		nfapi_pnf_phy_config_t* to_delete = curr;
+		curr = curr->next;
+		free(to_delete);
+	}
+
+	config->phys = 0;
+}
+
+void nfapi_pnf_phy_config_add(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy)
+{
+	phy->next = config->phys;
+	config->phys = phy;
+}
+
+nfapi_pnf_phy_config_t* nfapi_pnf_phy_config_find(nfapi_pnf_config_t* config, uint16_t phy_id)
+{
+	nfapi_pnf_phy_config_t* curr = config->phys;
+	while(curr != 0)
+	{
+		if(curr->phy_id == phy_id)
+			return curr;
+
+		curr = curr->next;
+	}
+	return 0;
+}
+
+void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_pnf_param_request_t req;
+		
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n");
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_pnf_param_request_t), &pnf->_public.codec_config) >= 0)
+		{
+			if(pnf->_public.state == NFAPI_PNF_IDLE)
+			{
+				if(pnf->_public.pnf_param_req)
+				{
+					(pnf->_public.pnf_param_req)(&pnf->_public, &req);
+				}
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__);
+		
+				nfapi_pnf_param_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_pnf_param_resp(&pnf->_public, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+}
+
+void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+
+
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_pnf_config_request_t req;
+
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n");
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
+		{
+			// ensure correct state
+			if(pnf->_public.state != NFAPI_PNF_RUNNING)
+			{
+				// delete the phy records
+				nfapi_pnf_phy_config_delete_all(&pnf->_public);
+		
+				// create the phy records
+				if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
+				{
+					int i = 0;
+					for(i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i)
+					{
+						nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
+						memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
+		
+						phy->state = NFAPI_PNF_PHY_IDLE;
+						phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
+		
+						nfapi_pnf_phy_config_add(&(pnf->_public), phy);
+					}
+				}
+		
+				if(pnf->_public.pnf_config_req)
+				{
+					(pnf->_public.pnf_config_req)(&(pnf->_public), &req);
+				}
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state);
+		
+				nfapi_pnf_config_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_pnf_config_resp(&(pnf->_public), &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+}
+
+void pnf_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_pnf_start_request_t req;
+
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n");
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
+		{
+			if(pnf->_public.state == NFAPI_PNF_CONFIGURED)
+			{
+				if(pnf->_public.pnf_start_req)
+				{
+					(pnf->_public.pnf_start_req)(&(pnf->_public), &req);
+				}
+			}
+			else
+			{
+				nfapi_pnf_start_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_PNF_START_RESPONSE;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_pnf_start_resp(&(pnf->_public), &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+}
+
+void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_pnf_stop_request_t req;
+		
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_STOP.request Received\n");
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
+		{
+			if(pnf->_public.state == NFAPI_PNF_RUNNING)
+			{
+				if(pnf->_public.pnf_stop_req)
+				{
+					(pnf->_public.pnf_stop_req)(&(pnf->_public), &req);
+				}
+			}
+			else
+			{
+				nfapi_pnf_stop_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_PNF_STOP_RESPONSE;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_pnf_stop_resp(&(pnf->_public), &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+}
+
+void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_param_request_t req;
+		
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n");
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state == NFAPI_PNF_PHY_IDLE)
+					{
+						if(config->param_req)
+						{
+							(config->param_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_param_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_PARAM_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_param_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_param_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_PARAM_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_param_resp(config, &resp);
+				}
+		
+			}
+			else
+			{
+				nfapi_param_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_PARAM_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_param_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+
+	}
+}
+
+void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_config_request_t req;
+
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state != NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->config_req)
+						{
+							(config->config_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_config_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_CONFIG_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_config_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_config_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_CONFIG_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_config_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_config_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_CONFIG_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_config_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+}
+
+void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_start_request_t req;
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state != NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->start_req)
+						{
+							(config->start_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_start_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_START_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_start_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_start_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_START_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_start_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_start_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_START_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_start_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+
+	}
+}
+
+void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_stop_request_t req;
+
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state != NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->stop_req)
+						{
+							(config->stop_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_stop_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_STOP_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_stop_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_stop_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_STOP_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_stop_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_stop_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_STOP_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_stop_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+			
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	
+	}
+}
+
+void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_measurement_request_t req;
+
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "MEASUREMENT.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state != NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->measurement_req)
+						{
+							(config->measurement_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_measurement_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_MEASUREMENT_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_measurement_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_measurement_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_MEASUREMENT_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_measurement_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_measurement_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_MEASUREMENT_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_measurement_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+}
+
+void pnf_handle_rssi_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+
+
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{	
+		nfapi_rssi_request_t req;
+		
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "RSSI.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state == NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->rssi_req)
+						{
+							(config->rssi_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_rssi_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_RSSI_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_rssi_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_rssi_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_RSSI_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_rssi_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_rssi_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_RSSI_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_rssi_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	
+	}
+}
+
+void pnf_handle_cell_search_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_cell_search_request_t req;
+		
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "CELL_SEARCH.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state == NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->cell_search_req)
+						{
+							(config->cell_search_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_cell_search_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_CELL_SEARCH_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_cell_search_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_cell_search_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_CELL_SEARCH_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_cell_search_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_cell_search_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_CELL_SEARCH_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_cell_search_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+
+}
+
+void pnf_handle_broadcast_detect_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_broadcast_detect_request_t req;
+
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "BROADCAST_DETECT.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state == NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->broadcast_detect_req)
+						{
+							(config->broadcast_detect_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_broadcast_detect_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_BROADCAST_DETECT_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_broadcast_detect_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_broadcast_detect_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_BROADCAST_DETECT_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_broadcast_detect_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_broadcast_detect_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_BROADCAST_DETECT_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_broadcast_detect_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+
+	}
+}
+
+void pnf_handle_system_information_schedule_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_system_information_schedule_request_t req;
+	
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "SYSTEM_INFORMATION_SCHEDULE.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state == NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->system_information_schedule_req)
+						{
+							(config->system_information_schedule_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_system_information_schedule_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_system_information_schedule_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_system_information_schedule_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_system_information_schedule_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_system_information_schedule_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_system_information_schedule_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+}
+
+void pnf_handle_system_information_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_system_information_request_t req;
+
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "SYSTEM_INFORMATION.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state == NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->system_information_req)
+						{
+							(config->system_information_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_system_information_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_SYSTEM_INFORMATION_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_system_information_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_system_information_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_SYSTEM_INFORMATION_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_system_information_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_system_information_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_SYSTEM_INFORMATION_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_system_information_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+
+}
+
+void pnf_handle_nmm_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_nmm_stop_request_t req;
+		
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "NMM_STOP.request received\n");
+	
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+		{
+			if(config->state == NFAPI_PNF_RUNNING)
+			{
+				nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
+				if(phy)
+				{
+					if(phy->state != NFAPI_PNF_PHY_RUNNING)
+					{
+						if(config->nmm_stop_req)
+						{
+							(config->nmm_stop_req)(config, phy, &req);
+						}
+					}
+					else
+					{
+						nfapi_nmm_stop_response_t resp;
+						memset(&resp, 0, sizeof(resp));
+						resp.header.message_id = NFAPI_NMM_STOP_RESPONSE;
+						resp.header.phy_id = req.header.phy_id;
+						resp.error_code = NFAPI_MSG_INVALID_STATE;
+						nfapi_pnf_nmm_stop_resp(config, &resp);
+					}
+				}
+				else
+				{
+					nfapi_nmm_stop_response_t resp;
+					memset(&resp, 0, sizeof(resp));
+					resp.header.message_id = NFAPI_NMM_STOP_RESPONSE;
+					resp.header.phy_id = req.header.phy_id;
+					resp.error_code = NFAPI_MSG_INVALID_CONFIG;
+					nfapi_pnf_nmm_stop_resp(config, &resp);
+				}
+			}
+			else
+			{
+				nfapi_nmm_stop_response_t resp;
+				memset(&resp, 0, sizeof(resp));
+				resp.header.message_id = NFAPI_NMM_STOP_RESPONSE;
+				resp.header.phy_id = req.header.phy_id;
+				resp.error_code = NFAPI_MSG_INVALID_STATE;
+				nfapi_pnf_nmm_stop_resp(config, &resp);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		if(req.vendor_extension)
+			pnf->_public.codec_config.deallocate(req.vendor_extension);
+	}
+}
+
+
+void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uint16_t message_id)
+{
+	if (pRecvMsg == NULL || pnf == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_pnf_config_t* config = &(pnf->_public);
+	
+		if(config->allocate_p4_p5_vendor_ext)
+		{
+			uint16_t msg_size;
+			nfapi_p4_p5_message_header_t* msg = config->allocate_p4_p5_vendor_ext(message_id, &msg_size);
+	
+			if(msg == 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n");
+				return;
+			}
+	
+			
+			int unpack_result = nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &config->codec_config);
+	
+			if(unpack_result == 0)
+			{
+				if(config->vendor_ext)
+					config->vendor_ext(config, msg);
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+			}
+			
+			if(config->deallocate_p4_p5_vendor_ext)
+				config->deallocate_p4_p5_vendor_ext(msg);
+			
+		}
+	}
+}
+
+
+
+void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+{
+	nfapi_p4_p5_message_header_t messageHeader;
+
+	// validate the input params
+	if(pRecvMsg == NULL || recvMsgLen < NFAPI_HEADER_LENGTH)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return;
+	}
+
+	// unpack the message header
+	if (nfapi_p5_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p4_p5_message_header_t), &pnf->_public.codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
+		return;
+	}
+
+	switch (messageHeader.message_id)
+	{
+		case NFAPI_PNF_PARAM_REQUEST:
+			pnf_handle_pnf_param_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_PNF_CONFIG_REQUEST:
+			pnf_handle_pnf_config_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_PNF_START_REQUEST:
+			pnf_handle_pnf_start_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_PNF_STOP_REQUEST:
+			pnf_handle_pnf_stop_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_PARAM_REQUEST:
+			pnf_handle_param_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_CONFIG_REQUEST:
+			pnf_handle_config_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_START_REQUEST:
+			pnf_handle_start_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_STOP_REQUEST:
+			pnf_handle_stop_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_MEASUREMENT_REQUEST:
+			pnf_handle_measurement_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_RSSI_REQUEST:
+			pnf_handle_rssi_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_CELL_SEARCH_REQUEST:
+			pnf_handle_cell_search_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_REQUEST:
+			pnf_handle_broadcast_detect_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST:
+			pnf_handle_system_information_schedule_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_REQUEST:
+			pnf_handle_system_information_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		case NFAPI_NMM_STOP_REQUEST:
+			pnf_handle_nmm_stop_request(pnf, pRecvMsg, recvMsgLen);
+			break;
+
+		default:
+			{
+				if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+				   messageHeader.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+				{
+					pnf_handle_vendor_extension(pRecvMsg, recvMsgLen, pnf, messageHeader.message_id);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, messageHeader.message_id);
+				}
+			}
+			break;
+	}
+}
+
+int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
+{
+	int packed_len = nfapi_p5_message_pack(msg, msg_len,
+										   pnf->tx_message_buffer, 
+										   sizeof(pnf->tx_message_buffer), 
+										   &pnf->_public.codec_config);
+
+	if (packed_len < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p5_message_pack failed (%d)\n", packed_len);
+		return -1;
+	}
+
+	return pnf_send_message(pnf, pnf->tx_message_buffer, packed_len, 0/*msg->stream_id*/);
+}
+
+int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
+{
+	int packed_len = nfapi_p4_message_pack(msg, msg_len,
+										   pnf->tx_message_buffer, 
+										   sizeof(pnf->tx_message_buffer), 
+										   &pnf->_public.codec_config);
+
+	if (packed_len < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p4_message_pack failed (%d)\n", packed_len);
+		return -1;
+	}
+
+	return pnf_send_message(pnf, pnf->tx_message_buffer, packed_len, 0/*msg->stream_id*/);
+}
+
+
+
+int pnf_connect(pnf_t* pnf)
+{
+	struct sockaddr_in servaddr;
+	uint8_t socketConnected = 0;
+
+	if(pnf->_public.vnf_ip_addr == 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnfIpAddress is null\n");
+		return -1;
+	}
+
+
+	(void)memset(&servaddr, 0, sizeof(struct sockaddr_in));
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 PNF connection to VNF at %s:%u\n", pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port);
+
+	// todo split the vnf address list. currently only supporting 1
+	
+	struct addrinfo hints, *servinfo;
+	memset(&hints, 0, sizeof(hints));
+
+	hints.ai_socktype = SOCK_STREAM; // For SCTP we are only interested in SOCK_STREAM
+	// todo : allow the client to restrict IPV4 or IPV6
+		// todo : randomize which address to connect to?
+	
+	char port_str[8];
+	snprintf(port_str, sizeof(port_str), "%d", pnf->_public.vnf_p5_port);
+	if(getaddrinfo(pnf->_public.vnf_ip_addr, port_str,  &hints, &servinfo) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to get host (%s) addr info h_errno:%d \n", pnf->_public.vnf_ip_addr, h_errno);
+		return -1;
+	}
+
+	struct addrinfo *p = servinfo;
+	int i = 0;
+	int connected = 0;
+
+	while(p != NULL && connected == 0)
+	{
+		char* family = "Unknown";
+		char* address = "Unknown";
+		char _addr[128];
+		
+		if(p->ai_family == AF_INET6)
+		{
+			family = "IPV6";
+			struct sockaddr_in6* addr = (struct sockaddr_in6*)p->ai_addr;
+			inet_ntop(AF_INET6, &addr->sin6_addr, _addr, sizeof(_addr));
+			address = &_addr[0];
+		}
+		else if(p->ai_family == AF_INET)
+		{
+			family = "IPV4";
+			struct sockaddr_in* addr = (struct sockaddr_in*)p->ai_addr;
+			address = inet_ntoa(addr->sin_addr);
+		}
+
+		NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info  %d Family:%s Address:%s\n", i++, family, address);
+
+		if (pnf->sctp)
+		{
+			// open the SCTP socket
+			if ((pnf->p5_sock = socket(p->ai_family, SOCK_STREAM, IPPROTO_SCTP)) < 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
+				freeaddrinfo(servinfo);
+				return -1;
+			}
+			int noDelay;
+			struct sctp_initmsg initMsg;
+
+			(void)memset(&initMsg, 0, sizeof(struct sctp_initmsg));
+
+			// configure the socket options
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF Setting the SCTP_INITMSG\n");
+			initMsg.sinit_num_ostreams = 5; //MAX_SCTP_STREAMS;  // number of output streams can be greater
+			initMsg.sinit_max_instreams = 5; //MAX_SCTP_STREAMS;  // number of output streams can be greater
+			if (setsockopt(pnf->p5_sock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
+				freeaddrinfo(servinfo);
+				return -1;
+			}
+			noDelay = 1;
+			if (setsockopt(pnf->p5_sock, IPPROTO_SCTP, SCTP_NODELAY, &noDelay, sizeof(noDelay)) < 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
+				freeaddrinfo(servinfo);
+				return -1;
+
+			}
+
+			struct sctp_event_subscribe events;
+			memset( (void *)&events, 0, sizeof(events) );
+			events.sctp_data_io_event = 1;
+
+			if(setsockopt(pnf->p5_sock, SOL_SCTP, SCTP_EVENTS, (const void *)&events, sizeof(events)) < 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
+				freeaddrinfo(servinfo);
+				return -1;
+			}
+		}
+		else
+		{
+			// Create an IP socket point 
+			if ((pnf->p5_sock = socket(p->ai_family, SOCK_STREAM, IPPROTO_IP)) < 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
+				freeaddrinfo(servinfo);
+				return -1;
+			}
+		}
+	
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created...\n");
+	
+		if (connect(pnf->p5_sock, p->ai_addr, p->ai_addrlen ) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After connect (address:%s port:%d) errno: %d\n", 
+					pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port, errno);
+
+			if(errno == EINVAL)
+			{
+				freeaddrinfo(servinfo);
+				return -1;
+			}
+			else
+			{
+				if(pnf->terminate != 0)
+				{
+					freeaddrinfo(servinfo);
+					return 0;
+				}
+				else
+				{
+					close(pnf->p5_sock);
+					sleep(1);
+				}
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "connect succeeded...\n");
+
+			connected = 1;
+		}
+
+		p = p->ai_next;
+	}
+
+	freeaddrinfo(servinfo);
+
+	// If we have failed to connect return 0 and it is retry
+	if(connected == 0)
+		return 0;
+
+
+	NFAPI_TRACE(NFAPI_TRACE_NOTE, "After connect loop\n");
+	if (pnf->sctp)
+	{
+		socklen_t optLen;
+		struct sctp_status status;
+
+		(void)memset(&status, 0, sizeof(struct sctp_status));
+
+		// check the connection status
+		optLen = (socklen_t) sizeof(struct sctp_status);
+		if (getsockopt(pnf->p5_sock, IPPROTO_SCTP, SCTP_STATUS, &status, &optLen) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
+			return -1;
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "Association ID = %d\n", status.sstat_assoc_id);
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "Receiver window size = %d\n", status.sstat_rwnd);
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "In Streams = %d\n",  status.sstat_instrms);
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "Out Streams = %d\n", status.sstat_outstrms);
+
+			socketConnected = 1;
+		}
+	}
+
+	NFAPI_TRACE(NFAPI_TRACE_NOTE, "Socket %s\n", socketConnected ? "CONNECTED" : "NOT_CONNECTED");
+	return socketConnected;
+}
+
+int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
+{
+	if (pnf->sctp)
+	{
+		if (sctp_sendmsg(pnf->p5_sock, msg, len, NULL, 0, 42/*config->sctp_stream_number*/, 0, stream/*P5_STREAM_ID*/, 0, 0) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "sctp_sendmsg failed errno: %d\n", errno);
+			return -1;
+		}
+	}
+	else
+	{
+		if (write(pnf->p5_sock, msg, len) != len)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "read failed errno: %d\n", errno);
+			return -1;
+		}
+	}
+	return 0;
+}
+
+
+int pnf_read_dispatch_message(pnf_t* pnf)
+{
+	int socket_connected = 1;
+
+	// 1. Peek the message header
+	// 2. If the message is larger than the stack buffer then create a dynamic buffer
+	// 3. Read the buffer
+	// 4. Handle the p5 message
+
+	uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
+	uint8_t header_buffer[header_buffer_size];
+
+	uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
+	uint8_t stack_buffer[stack_buffer_size];
+
+	uint8_t* dynamic_buffer = 0;
+
+	uint8_t* read_buffer = &stack_buffer[0];
+	uint32_t message_size = 0;
+
+	struct sockaddr_in addr;
+	socklen_t addr_len = sizeof(addr);
+
+	struct sctp_sndrcvinfo sndrcvinfo;
+	(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
+
+	{
+		int flags = MSG_PEEK;
+		message_size = sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, /*(struct sockaddr*)&addr, &addr_len*/ 0, 0, &sndrcvinfo,  &flags);
+
+		if(message_size == -1)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to peek sctp message size errno:%d\n", errno);
+			return 0;
+		}
+
+		nfapi_p4_p5_message_header_t header;
+		int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
+		if(unpack_result < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to unpack p5 message header\n");
+			return 0;
+		}
+		message_size = header.message_length;
+
+		// now have the size of the mesage
+	}
+
+	if(message_size > stack_buffer_size)
+	{
+		dynamic_buffer = (uint8_t*)malloc(message_size);
+
+		if(dynamic_buffer == NULL)
+		{
+			// todo : add error mesage
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
+			return -1;
+		}
+
+		read_buffer = dynamic_buffer;
+	}
+
+	{
+		int flags = 0;
+		(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
+
+		int recvmsg_result = sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
+		if(recvmsg_result == -1)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
+		}
+		else
+		{
+			if (flags & MSG_NOTIFICATION)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
+
+				// todo - handle the events
+			}
+			else
+			{
+				/*
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
+						pnf->p5_sock,
+						inet_ntoa(addr.sin_addr),
+						ntohs(addr.sin_port),
+						sndrcvinfo.sinfo_assoc_id,
+						sndrcvinfo.sinfo_stream,
+						ntohl(sndrcvinfo.sinfo_ppid),
+						message_size,
+						flags);
+				*/
+
+				// handle now if complete message in one or more segments
+				if ((flags & 0x80) == 0x80)
+				{
+					pnf_handle_p5_message(pnf, read_buffer, message_size);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
+
+					// assume socket disconnected
+					NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
+					socket_connected =  0;
+				}
+
+
+			}
+		}
+	}
+
+	if(dynamic_buffer)
+	{
+		free(dynamic_buffer);
+	}
+
+	return socket_connected;
+
+
+}
+
+
+int pnf_message_pump(pnf_t* pnf)
+{
+	uint8_t socketConnected = 1;
+
+	while(socketConnected && pnf->terminate == 0)
+	{
+		fd_set rfds;
+		int selectRetval = 0;
+
+		// select on a timeout and then get the message
+		FD_ZERO(&rfds);
+		FD_SET(pnf->p5_sock, &rfds);
+
+		struct timeval timeout;
+		timeout.tv_sec = 1;
+		timeout.tv_usec = 0;
+
+		selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout);
+
+		if(selectRetval == 0)
+		{	
+			// timeout
+			continue;
+		}
+		else if (selectRetval == -1 && (errno == EINTR))
+		{
+			// interrupted by signal
+			NFAPI_TRACE(NFAPI_TRACE_WARN, "P5 Signal Interrupt %d\n", errno);
+			continue;
+		}
+		else if (selectRetval == -1)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_WARN, "P5 select() failed\n");
+			sleep(1);
+			continue;
+		}
+
+		if(FD_ISSET(pnf->p5_sock, &rfds))
+		{
+			socketConnected = pnf_read_dispatch_message(pnf);
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_WARN, "Why are we here\n");
+		}
+	}
+
+	// Drop back to idle if we have lost connection
+	pnf->_public.state = NFAPI_PNF_PHY_IDLE;
+
+
+	// close the connection and socket
+	if (close(pnf->p5_sock) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "close(sctpSock) failed errno: %d\n", errno);
+	}
+
+	return 0;
+
+}
+
diff --git a/nfapi/open-nFAPI/pnf/src/pnf_interface.c b/nfapi/open-nFAPI/pnf/src/pnf_interface.c
new file mode 100644
index 0000000000000000000000000000000000000000..7310fc0c66c57209bcedac7cc326ab4b19d4229a
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/src/pnf_interface.c
@@ -0,0 +1,432 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "pnf.h"
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+nfapi_pnf_config_t* nfapi_pnf_config_create()
+{
+	pnf_t* _this = (pnf_t*)malloc(sizeof(pnf_t));
+
+	if(_this == 0)
+		return 0;
+
+	memset(_this, 0, sizeof(pnf_t));
+
+	_this->sctp = 1;	// enable sctp
+	
+	_this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT;
+	
+	_this->_public.malloc = &malloc;
+	_this->_public.free = &free;	
+
+	_this->_public.codec_config.allocate = &malloc;
+	_this->_public.codec_config.deallocate = &free;
+
+	return &(_this->_public);
+}
+
+void nfapi_pnf_config_destory(nfapi_pnf_config_t* config)
+{
+	free(config);
+}
+
+int nfapi_pnf_start(nfapi_pnf_config_t* config)
+{
+	// Verify that config is not null
+	if(config == 0)
+		return -1;
+
+	// Make sure to set the defined trace function before using NFAPI_TRACE
+	if(config->trace)
+		nfapi_trace_g = config->trace;
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	while (_this->terminate == 0)
+	{
+		int connect_result = pnf_connect(_this);
+
+		if(connect_result > 0)
+		{
+			pnf_message_pump(_this);
+		}
+		else if(connect_result < 0)
+		{
+			return connect_result;
+		}
+
+		sleep(1);
+	}
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
+
+	return 0;
+}
+
+int nfapi_pnf_stop(nfapi_pnf_config_t* config)
+{
+	// Verify that config is not null
+	if(config == 0)
+		return -1;
+
+
+	pnf_t* _this = (pnf_t*)(config);
+	_this->terminate = 1;
+
+	// todo wait for the pnf to stop before returning
+
+	return 0;
+}
+
+int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp)
+{
+	// ensure it's valid
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_param_response_t));
+}
+
+int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_response_t* resp)
+{
+	// ensure it's valid
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	if(resp->error_code == NFAPI_MSG_OK)
+	{
+		config->state = NFAPI_PNF_CONFIGURED;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_config_response_t));
+}
+
+int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp)
+{
+	// ensure it's valid
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	if(resp->error_code == NFAPI_MSG_OK)
+	{
+		config->state = NFAPI_PNF_RUNNING;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_start_response_t));
+}
+
+int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_t* resp)
+{
+	// ensure it's valid
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	if(resp->error_code == NFAPI_MSG_OK)
+	{
+		config->state = NFAPI_PNF_CONFIGURED;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_stop_response_t));
+}
+
+int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+	
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t));
+}
+
+int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
+
+	if(phy)
+	{
+		if(resp->error_code == NFAPI_MSG_OK)
+		{
+			phy->state = NFAPI_PNF_PHY_CONFIGURED;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
+		return -1;
+	}
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_config_response_t));
+}
+
+int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
+	if(phy)
+	{
+		if(resp->error_code == NFAPI_MSG_OK)
+		{
+			phy->state = NFAPI_PNF_PHY_RUNNING;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknown phy id %d\n", __FUNCTION__, resp->header.phy_id);
+		return -1;
+	}
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_start_response_t));
+}
+
+int nfapi_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_stop_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
+	if(phy)
+	{
+		if(resp->error_code == NFAPI_MSG_OK)
+		{
+			phy->state = NFAPI_PNF_PHY_CONFIGURED;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
+		return -1;
+	}
+
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_stop_response_t));
+}
+
+int nfapi_pnf_measurement_resp(nfapi_pnf_config_t* config, nfapi_measurement_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_measurement_response_t));
+}
+
+
+int nfapi_pnf_rssi_resp(nfapi_pnf_config_t* config, nfapi_rssi_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_rssi_response_t));
+}
+
+int nfapi_pnf_rssi_ind(nfapi_pnf_config_t* config, nfapi_rssi_indication_t* ind)
+{
+	if (config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_rssi_indication_t));
+}
+int nfapi_pnf_cell_search_resp(nfapi_pnf_config_t* config, nfapi_cell_search_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "Send CELL_SEARCH.response\n");
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_cell_search_response_t));
+}
+int nfapi_pnf_cell_search_ind(nfapi_pnf_config_t* config, nfapi_cell_search_indication_t* ind)
+{
+	if (config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_cell_search_indication_t));
+}
+int nfapi_pnf_broadcast_detect_resp(nfapi_pnf_config_t* config, nfapi_broadcast_detect_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_broadcast_detect_response_t));
+}
+int nfapi_pnf_broadcast_detect_ind(nfapi_pnf_config_t* config, nfapi_broadcast_detect_indication_t* ind)
+{
+	if (config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_broadcast_detect_indication_t));
+}
+int nfapi_pnf_system_information_schedule_resp(nfapi_pnf_config_t* config, nfapi_system_information_schedule_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_system_information_schedule_response_t));
+}
+
+int nfapi_pnf_system_information_schedule_ind(nfapi_pnf_config_t* config, nfapi_system_information_schedule_indication_t* ind)
+{
+	if (config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_system_information_schedule_indication_t));
+}
+int nfapi_pnf_system_information_resp(nfapi_pnf_config_t* config, nfapi_system_information_response_t* resp)
+{
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_system_information_response_t));
+}
+
+int nfapi_pnf_system_information_ind(nfapi_pnf_config_t* config, nfapi_system_information_indication_t* ind)
+{
+	if (config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(ind->header), sizeof(nfapi_system_information_indication_t));
+}
+int nfapi_pnf_nmm_stop_resp(nfapi_pnf_config_t* config, nfapi_nmm_stop_response_t* resp)
+{
+	// ensure it's valid
+	if (config == NULL || resp == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p4_message(_this, &(resp->header), sizeof(nfapi_nmm_stop_request_t));
+}
+
+int nfapi_pnf_vendor_extension(nfapi_pnf_config_t* config, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
+{
+	// ensure it's valid
+	if (config == NULL || msg == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_t* _this = (pnf_t*)(config);
+
+	return pnf_pack_and_send_p5_message(_this, msg, msg_len);
+}
+
diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
new file mode 100644
index 0000000000000000000000000000000000000000..02b828d382bf1a9dfc39cea7fe48544e56ed2000
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
@@ -0,0 +1,1769 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+
+#include "pnf_p7.h"
+
+#define FAPI2_IP_DSCP	0
+
+extern uint16_t sf_ahead;
+//uint16_t sf_ahead=4;
+
+void add_sf(uint16_t *frameP, uint16_t *subframeP, int offset)
+{
+    *frameP    = *frameP + ((*subframeP + offset) / 10);
+
+    *subframeP = ((*subframeP + offset) % 10);
+}
+
+void subtract_sf(uint16_t *frameP, uint16_t *subframeP, int offset)
+{
+  if (*subframeP < offset)
+  {
+    *frameP = (*frameP+1024-1)%1024;
+  }
+  *subframeP = (*subframeP+10-offset)%10;
+}
+
+uint16_t sfnsf_add_sf(uint16_t sfnsf, int offset)
+{
+  uint16_t new_sfnsf;
+  uint16_t sfn = NFAPI_SFNSF2SFN(sfnsf);
+  uint16_t sf  = NFAPI_SFNSF2SF(sfnsf);
+
+  //printf("%s() sfn:%u sf:%u\n", __FUNCTION__, sfn, sf);
+  add_sf(&sfn, &sf, offset);
+
+  new_sfnsf = sfn<<4|sf;
+
+  //printf("%s() sfn:%u sf:%u offset:%d sfnsf:%d(DEC:%d) new:%d(DEC:%d)\n", __FUNCTION__, sfn, sf, offset, sfnsf, NFAPI_SFNSF2DEC(sfnsf), new_sfnsf, NFAPI_SFNSF2DEC(new_sfnsf));
+
+  return new_sfnsf;
+}
+
+uint16_t sfnsf_subtract_sf(uint16_t sfnsf, int offset)
+{
+  uint16_t new_sfnsf;
+  uint16_t sfn = NFAPI_SFNSF2SFN(sfnsf);
+  uint16_t sf  = NFAPI_SFNSF2SF(sfnsf);
+
+  //printf("%s() sfn:%u sf:%u\n", __FUNCTION__, sfn, sf);
+  subtract_sf(&sfn, &sf, offset);
+
+  new_sfnsf = sfn<<4|sf;
+
+  //printf("%s() offset:%d sfnsf:%d(DEC:%d) new:%d(DEC:%d)\n", __FUNCTION__, offset, sfnsf, NFAPI_SFNSF2DEC(sfnsf), new_sfnsf, NFAPI_SFNSF2DEC(new_sfnsf));
+
+  return new_sfnsf;
+}
+
+uint32_t pnf_get_current_time_hr(void)
+{
+	struct timeval now;
+	(void)gettimeofday(&now, NULL);
+	uint32_t time_hr = TIME2TIMEHR(now);
+	return time_hr;
+}
+
+void* pnf_p7_malloc(pnf_p7_t* pnf_p7, size_t size)
+{
+	if(pnf_p7->_public.malloc)
+	{
+		return (pnf_p7->_public.malloc)(size);
+	}
+	else
+	{
+		return calloc(1, size); 
+	}
+}
+void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr)
+{
+	if(pnf_p7->_public.free)
+	{
+		return (pnf_p7->_public.free)(ptr);
+	}
+	else
+	{
+		return free(ptr); 
+	}
+}
+
+// todo : for now these just malloc/free need to move to a memory cache
+nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7) 
+{ 
+	void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t));
+        //printf("%s() ptr:%p\n", __FUNCTION__, ptr);
+        return ptr;
+}
+
+void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t* pnf_p7) 
+{ 
+  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->dl_config_request_body.dl_config_pdu_list);
+	if(pnf_p7->_public.codec_config.deallocate)
+	{
+		(pnf_p7->_public.codec_config.deallocate)(req->dl_config_request_body.dl_config_pdu_list);
+	}
+	else
+	{
+		free(req->dl_config_request_body.dl_config_pdu_list);
+	}
+        req->dl_config_request_body.dl_config_pdu_list=0;
+
+	pnf_p7_free(pnf_p7, req);
+}
+
+nfapi_ul_config_request_t* allocate_nfapi_ul_config_request(pnf_p7_t* pnf_p7) 
+{ 
+	void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_ul_config_request_t));
+        //printf("%s() ptr:%p\n", __FUNCTION__, ptr);
+        return ptr;
+}
+
+void deallocate_nfapi_ul_config_request(nfapi_ul_config_request_t* req, pnf_p7_t* pnf_p7) 
+{ 
+  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->ul_config_request_body.ul_config_pdu_list);
+	if(pnf_p7->_public.codec_config.deallocate)
+	{
+		(pnf_p7->_public.codec_config.deallocate)(req->ul_config_request_body.ul_config_pdu_list);
+	}
+	else
+	{
+		free(req->ul_config_request_body.ul_config_pdu_list);
+	}
+        req->ul_config_request_body.ul_config_pdu_list=0;
+
+	pnf_p7_free(pnf_p7, req);
+}
+
+nfapi_hi_dci0_request_t* allocate_nfapi_hi_dci0_request(pnf_p7_t* pnf_p7) 
+{ 
+	return pnf_p7_malloc(pnf_p7, sizeof(nfapi_hi_dci0_request_t));
+}
+
+void deallocate_nfapi_hi_dci0_request(nfapi_hi_dci0_request_t* req, pnf_p7_t* pnf_p7) 
+{ 
+  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->hi_dci0_request_body.hi_dci0_pdu_list);
+	if(pnf_p7->_public.codec_config.deallocate)
+	{
+		(pnf_p7->_public.codec_config.deallocate)(req->hi_dci0_request_body.hi_dci0_pdu_list);
+	}
+	else
+	{
+		free(req->hi_dci0_request_body.hi_dci0_pdu_list);
+	}
+        req->hi_dci0_request_body.hi_dci0_pdu_list=0;
+
+	pnf_p7_free(pnf_p7, req);
+}
+
+nfapi_tx_request_t* allocate_nfapi_tx_request(pnf_p7_t* pnf_p7) 
+{ 
+	return pnf_p7_malloc(pnf_p7, sizeof(nfapi_tx_request_t));
+}
+
+void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7) 
+{ 
+	int i = 0;
+
+  //printf("%s() SFN/SF:%d %s req:%p pdu[0]:data:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->tx_request_body.tx_pdu_list[i].segments[0].segment_data);
+
+	for(i = 0; i < req->tx_request_body.number_of_pdus; ++i)
+	{
+		void* data = req->tx_request_body.tx_pdu_list[i].segments[0].segment_data;
+
+		if(pnf_p7->_public.codec_config.deallocate)
+		{
+			(pnf_p7->_public.codec_config.deallocate)(data);
+		}
+		else
+		{
+			free(data);
+		}
+                data=0;
+	}
+
+
+	if(pnf_p7->_public.codec_config.deallocate)
+	{
+		(pnf_p7->_public.codec_config.deallocate)(req->tx_request_body.tx_pdu_list);
+	}
+	else
+	{
+		free(req->tx_request_body.tx_pdu_list);
+	}
+        req->tx_request_body.tx_pdu_list=0;
+
+	pnf_p7_free(pnf_p7, req);
+}
+
+nfapi_lbt_dl_config_request_t* allocate_nfapi_lbt_dl_config_request(pnf_p7_t* pnf_p7) 
+{ 
+	return pnf_p7_malloc(pnf_p7, sizeof(nfapi_lbt_dl_config_request_t));
+}
+
+void deallocate_nfapi_lbt_dl_config_request(nfapi_lbt_dl_config_request_t* req, pnf_p7_t* pnf_p7) 
+{ 
+	if(pnf_p7->_public.codec_config.deallocate)
+	{
+		(pnf_p7->_public.codec_config.deallocate)(req->lbt_dl_config_request_body.lbt_dl_config_req_pdu_list);
+	}
+	else
+	{
+		free(req->lbt_dl_config_request_body.lbt_dl_config_req_pdu_list);
+	}
+        req->lbt_dl_config_request_body.lbt_dl_config_req_pdu_list=0;
+
+	pnf_p7_free(pnf_p7, req);
+}
+
+pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len)
+{
+	pnf_p7_rx_message_t* msg = 0;
+	// attempt to find a entry for this segment
+	pnf_p7_rx_message_t* iterator = queue->msg_queue;
+	while(iterator != 0)
+	{
+		if(iterator->sequence_number == sequence_number)
+		{
+			msg = iterator;
+			break;
+		}
+
+		iterator = iterator->next;
+	}
+	
+	// if found then copy data to message
+	if(msg != 0)
+	{
+	
+		msg->segments[segment_number].buffer = (uint8_t*)pnf_p7_malloc(pnf_p7, data_len);
+		memcpy(msg->segments[segment_number].buffer, data, data_len);
+		msg->segments[segment_number].length = data_len;
+
+		msg->num_segments_received++;
+
+		// set the segement number if we have the last segment
+		if(m == 0)
+			msg->num_segments_expected = segment_number + 1;
+	}
+	// else add new rx message entry
+	else
+	{
+		// create a new message
+		msg = (pnf_p7_rx_message_t*)(pnf_p7_malloc(pnf_p7, sizeof(pnf_p7_rx_message_t)));
+		memset(msg, 0, sizeof(pnf_p7_rx_message_t));
+
+		msg->sequence_number = sequence_number;
+		msg->num_segments_expected = m ? 255 : segment_number + 1;
+		msg->num_segments_received = 1;
+		msg->rx_hr_time = rx_hr_time;
+
+		msg->segments[segment_number].buffer = (uint8_t*)pnf_p7_malloc(pnf_p7, data_len);
+		memcpy(msg->segments[segment_number].buffer, data, data_len);
+		msg->segments[segment_number].length = data_len;
+
+		// place the message at the head of the queue
+		msg->next = queue->msg_queue;
+		queue->msg_queue = msg;
+	}
+
+	return msg;
+}
+
+void pnf_p7_rx_reassembly_queue_remove_msg(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, pnf_p7_rx_message_t* msg)
+{
+	// remove message if it has the same sequence number
+	pnf_p7_rx_message_t* iterator = queue->msg_queue;
+	pnf_p7_rx_message_t* previous = 0;
+
+	while(iterator != 0)
+	{
+		if(iterator->sequence_number == msg->sequence_number)
+		{
+			if(previous == 0)
+			{
+				queue->msg_queue = iterator->next;
+			}
+			else
+			{
+				previous->next = iterator->next;
+			}
+
+			//NFAPI_TRACE(NFAPI_TRACE_INFO, "Deleting reassembly message\n");
+			// delete the message
+			uint16_t i;
+			for(i = 0; i < 128; ++i)
+			{
+				if(iterator->segments[i].buffer)
+					pnf_p7_free(pnf_p7, iterator->segments[i].buffer);
+			}
+			pnf_p7_free(pnf_p7, iterator);
+
+			break;
+		}
+
+		previous = iterator;
+		iterator = iterator->next;
+	}
+}
+
+void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint32_t delta)
+{
+	// remove all messages that are too old
+	pnf_p7_rx_message_t* iterator = queue->msg_queue;
+	pnf_p7_rx_message_t* previous = 0;
+
+	while(iterator != 0)
+	{
+		if(rx_hr_time - iterator->rx_hr_time > delta)
+		{
+			if(previous == 0)
+			{
+				queue->msg_queue = iterator->next;
+			}
+			else
+			{
+				previous->next = iterator->next;
+			}
+			
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "Deleting stale reassembly message (%u %u %d)\n", iterator->rx_hr_time, rx_hr_time, delta);
+
+			pnf_p7_rx_message_t* to_delete = iterator;
+			iterator = iterator->next;
+
+			// delete the message
+			uint16_t i;
+			for(i = 0; i < 128; ++i)
+			{
+				if(to_delete->segments[i].buffer)
+					pnf_p7_free(pnf_p7, to_delete->segments[i].buffer);
+			}
+			pnf_p7_free(pnf_p7, to_delete);
+
+		}
+		else
+		{
+			previous = iterator;
+			iterator = iterator->next;
+		}
+	}
+}
+
+
+static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
+{
+	if(now_hr < sf_start_hr)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr);
+		return 0;
+	}
+	else
+	{
+		uint32_t now_us = TIMEHR_USEC(now_hr);
+		uint32_t sf_start_us = TIMEHR_USEC(sf_start_hr);
+
+		// if the us have wrapped adjust for it
+		if(now_hr < sf_start_us)
+		{
+			now_us += 1000000;
+		}
+
+		return now_us - sf_start_us;
+	}
+}
+
+int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t len)
+{
+	// todo : consider how to do this only once
+	struct sockaddr_in remote_addr;
+	memset((char*)&remote_addr, 0, sizeof(struct sockaddr_in));
+	remote_addr.sin_family = AF_INET;
+	remote_addr.sin_port = htons(pnf_p7->_public.remote_p7_port);
+	//remote_addr.sin_addr.s_addr = inet_addr(pnf_p7->_public.remote_p7_addr);
+	if(inet_aton(pnf_p7->_public.remote_p7_addr, &remote_addr.sin_addr) == -1)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "inet_aton failed %d\n", errno);
+		return -1;
+	}
+	
+	socklen_t remote_addr_len = sizeof(struct sockaddr_in);
+	
+	int sendto_result;
+	if ((sendto_result = sendto((int)pnf_p7->p7_sock, (const char*)msg, len, 0, (const struct sockaddr*)&remote_addr, remote_addr_len)) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s %s:%d sendto(%d, %p, %d) %d failed errno: %d\n", __FUNCTION__, pnf_p7->_public.remote_p7_addr, pnf_p7->_public.remote_p7_port, (int)pnf_p7->p7_sock, (const char*)msg, len, remote_addr_len,  errno);
+		return -1;
+	}
+
+	if(sendto_result != len)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s sendto failed to send the entire message %d %d\n", __FUNCTION__, sendto_result, len);
+	}
+	return 0;
+}
+
+int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* header, uint32_t msg_len)
+{
+	header->m_segment_sequence = NFAPI_P7_SET_MSS(0, 0, pnf_p7->sequence_number);
+
+	// Need to guard against different threads calling the encode function at the same time
+	if(pthread_mutex_lock(&(pnf_p7->pack_mutex)) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
+		return -1;
+	}
+
+	int len = nfapi_p7_message_pack(header, pnf_p7->tx_message_buffer, sizeof(pnf_p7->tx_message_buffer), &pnf_p7->_public.codec_config);
+
+	if (len < 0)
+	{
+		if(pthread_mutex_unlock(&(pnf_p7->pack_mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+			return -1;
+		}
+		
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p7_message_pack failed with return %d\n", len );
+		return -1;
+	}
+
+	if(len > pnf_p7->_public.segment_size)
+	{
+		int msg_body_len = len - NFAPI_P7_HEADER_LENGTH ; 
+		int seg_body_len = pnf_p7->_public.segment_size - NFAPI_P7_HEADER_LENGTH ; 
+		int segment_count = (msg_body_len / (seg_body_len)) + ((msg_body_len % seg_body_len) ? 1 : 0); 
+
+		int segment = 0;
+		int offset = NFAPI_P7_HEADER_LENGTH;
+		uint8_t buffer[pnf_p7->_public.segment_size];
+		for(segment = 0; segment < segment_count; ++segment)
+		{
+			uint8_t last = 0;
+			uint16_t size = pnf_p7->_public.segment_size - NFAPI_P7_HEADER_LENGTH;
+			if(segment + 1 == segment_count)
+			{
+				last = 1;
+				size = (msg_body_len) - (seg_body_len * segment);
+			}
+
+			uint16_t segment_size = size + NFAPI_P7_HEADER_LENGTH;
+
+			// Update the header with the m and segement 
+			memcpy(&buffer[0], pnf_p7->tx_message_buffer, NFAPI_P7_HEADER_LENGTH);
+
+			// set the segment length
+			buffer[4] = (segment_size & 0xFF00) >> 8;
+			buffer[5] = (segment_size & 0xFF);
+
+			// set the m & segment number
+			buffer[6] = ((!last) << 7) + segment;
+
+			memcpy(&buffer[NFAPI_P7_HEADER_LENGTH], pnf_p7->tx_message_buffer + offset, size);
+			offset += size;
+
+			if(pnf_p7->_public.checksum_enabled)
+			{
+				nfapi_p7_update_checksum(buffer, segment_size);
+			}
+
+
+			pnf_p7_send_message(pnf_p7, &buffer[0], segment_size);
+		}
+	}
+	else
+	{
+		if(pnf_p7->_public.checksum_enabled)
+		{
+			nfapi_p7_update_checksum(pnf_p7->tx_message_buffer, len);
+		}
+
+		// simple case that the message fits in a single segment
+		pnf_p7_send_message(pnf_p7, pnf_p7->tx_message_buffer, len);
+	}
+
+	pnf_p7->sequence_number++;
+	
+	if(pthread_mutex_unlock(&(pnf_p7->pack_mutex)) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+		return -1;
+	}
+
+	return 0;
+}
+
+void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7)
+{
+	nfapi_timing_info_t timing_info;
+	memset(&timing_info, 0, sizeof(timing_info));
+	timing_info.header.message_id = NFAPI_TIMING_INFO;
+	timing_info.header.phy_id = pnf_p7->_public.phy_id;
+
+	timing_info.last_sfn_sf = pnf_p7->sfn_sf;
+	timing_info.time_since_last_timing_info = pnf_p7->timing_info_ms_counter;
+
+	timing_info.dl_config_jitter = pnf_p7->dl_config_jitter;
+	timing_info.tx_request_jitter = pnf_p7->tx_jitter;
+	timing_info.ul_config_jitter = pnf_p7->ul_config_jitter;
+	timing_info.hi_dci0_jitter = pnf_p7->hi_dci0_jitter;
+
+	timing_info.dl_config_latest_delay = 0;
+	timing_info.tx_request_latest_delay = 0;
+	timing_info.ul_config_latest_delay = 0;
+	timing_info.hi_dci0_latest_delay = 0;
+
+	timing_info.dl_config_earliest_arrival = 0;
+	timing_info.tx_request_earliest_arrival = 0;
+	timing_info.ul_config_earliest_arrival = 0;
+	timing_info.hi_dci0_earliest_arrival = 0;
+
+
+	pnf_p7_pack_and_send_p7_message(pnf_p7, &(timing_info.header), sizeof(timing_info));
+
+	pnf_p7->timing_info_ms_counter = 0;
+}
+
+void send_dummy_subframe(pnf_p7_t* pnf_p7, uint16_t sfn_sf)
+{
+  struct timespec t;
+  clock_gettime( CLOCK_MONOTONIC, &t);
+
+  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(sfn_sf:%d) t:%ld.%09ld\n", __FUNCTION__, NFAPI_SFNSF2DEC(sfn_sf), t.tv_sec, t.tv_nsec);
+
+	if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
+	{
+		pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy tx_req - enter\n");
+		(pnf_p7->_public.tx_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.tx_req);
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy tx_req - exit\n");
+	}
+	if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
+	{
+		pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf;
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - enter\n");
+		(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - exit\n");
+	}
+	if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
+	{
+		pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy ul_config_req - enter\n");
+		(pnf_p7->_public.ul_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.ul_config_req);
+	}
+	if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req)
+	{
+		pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf;
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy hi_dci0 - enter\n");
+		(pnf_p7->_public.hi_dci0_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.hi_dci0_req);
+	}
+	if(pnf_p7->_public.lbt_dl_config_req && pnf_p7->_public.dummy_subframe.lbt_dl_config_req)
+	{
+		pnf_p7->_public.dummy_subframe.lbt_dl_config_req->sfn_sf = sfn_sf;
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy lbt - enter\n");
+		(pnf_p7->_public.lbt_dl_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.lbt_dl_config_req);
+	}
+}
+
+int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+{
+	// We could either send an event to the p7 thread have have it run the
+	// subframe or we could handle it here and lock access to the subframe
+	// buffers. If we do it on the p7 thread then we run the risk of blocking
+	// on the udp send. 
+	//
+	// todo : start a timer to give us more of the 1 ms tick before send back
+	// the frame
+	
+	// todo : consider a more efficent lock mechasium
+	if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
+		return -1;
+	}
+
+#if 1
+	// save the curren time and sfn_sf
+	pnf_p7->sf_start_time_hr = pnf_get_current_time_hr();
+	pnf_p7->sfn_sf = sfn_sf;
+
+        uint32_t sfn_sf_tx = sfnsf_add_sf(sfn_sf, sf_ahead);
+        uint32_t tx_sfn_sf_dec = NFAPI_SFNSF2DEC(sfn_sf_tx);
+
+	// If the subframe_buffer has been configured
+	if(pnf_p7->_public.subframe_buffer_size != 0)
+	{
+
+		// apply the shift to the incoming sfn_sf
+		if(pnf_p7->sfn_sf_shift != 0)
+		{
+			int32_t sfn_sf_dec = NFAPI_SFNSF2DEC(sfn_sf);
+
+			int32_t shifted_sfn_sf = sfn_sf_dec += pnf_p7->sfn_sf_shift;
+
+			// adjust for wrap-around
+			if(shifted_sfn_sf < 0)
+				shifted_sfn_sf += NFAPI_MAX_SFNSFDEC;
+			else if(shifted_sfn_sf > NFAPI_MAX_SFNSFDEC)
+				shifted_sfn_sf -= NFAPI_MAX_SFNSFDEC;
+
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "Applying shift %d to sfn/sf (%d -> %d)\n", pnf_p7->sfn_sf_shift, NFAPI_SFNSF2DEC(sfn_sf), shifted_sfn_sf);
+			sfn_sf = shifted_sfn_sf;
+
+                        //
+                        // DJP - why does the shift not apply to pnf_p7->sfn_sf???
+                        //
+
+			pnf_p7->sfn_sf_shift = 0;
+		}
+
+		uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(sfn_sf);
+		uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+
+		nfapi_pnf_p7_subframe_buffer_t* subframe_buffer = &(pnf_p7->subframe_buffer[buffer_index]);
+
+		uint8_t tx_buffer_index = tx_sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+		nfapi_pnf_p7_subframe_buffer_t* tx_subframe_buffer = &(pnf_p7->subframe_buffer[tx_buffer_index]);
+
+                //printf("sfn_sf_dec:%d tx_sfn_sf_dec:%d\n", sfn_sf_dec, tx_sfn_sf_dec);
+
+                if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d subframe_buffer->sfn_sf:%d tx_subframe_buffer->sfn_sf:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
+                    "TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n", 
+                    __FUNCTION__, 
+                    pnf_p7->sfn_sf_shift, 
+                    NFAPI_SFNSF2DEC(subframe_buffer->sfn_sf), 
+                    NFAPI_SFNSF2DEC(tx_subframe_buffer->sfn_sf), 
+                       sfn_sf_dec,    buffer_index,    subframe_buffer->dl_config_req,    subframe_buffer->tx_req, 
+                    tx_sfn_sf_dec, tx_buffer_index, tx_subframe_buffer->dl_config_req, tx_subframe_buffer->tx_req);
+
+		// if the subframe buffer sfn sf is set then we have atlease 1 message
+		// from the vnf. 
+		// todo : how to handle the messages we don't have, send dummies for
+		// now
+
+                //printf("tx_subframe_buffer->sfn_sf:%d sfn_sf_tx:%d\n", tx_subframe_buffer->sfn_sf, sfn_sf_tx);
+                //printf("subframe_buffer->sfn_sf:%d sfn_sf:%d\n", subframe_buffer->sfn_sf, sfn_sf);
+		if(tx_subframe_buffer->sfn_sf == sfn_sf_tx)
+		{
+			if(tx_subframe_buffer->tx_req != 0)
+			{
+				if(pnf_p7->_public.tx_req)
+					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), tx_subframe_buffer->tx_req);
+
+				//deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
+			}
+			else
+			{
+				// send dummy
+				if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
+				{
+					pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf_tx;
+					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.tx_req);
+				}
+			}
+
+			if(tx_subframe_buffer->dl_config_req != 0)
+			{
+				if(pnf_p7->_public.dl_config_req)
+					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), tx_subframe_buffer->dl_config_req);
+
+				//deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
+			}
+			else
+			{
+				// send dummy
+				if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
+				{
+					pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf_tx;
+					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
+				}
+			}
+
+			if(tx_subframe_buffer->hi_dci0_req != 0)
+			{
+				if(pnf_p7->_public.hi_dci0_req)
+					(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), tx_subframe_buffer->hi_dci0_req);
+
+				//deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
+			}
+			else
+			{
+				//send dummy
+				if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req)
+				{
+					pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf_tx;
+					(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.hi_dci0_req);
+				}
+			}
+
+                        if(tx_subframe_buffer->dl_config_req != 0)
+                        {
+                          deallocate_nfapi_dl_config_request(tx_subframe_buffer->dl_config_req, pnf_p7);
+                          tx_subframe_buffer->dl_config_req = 0;
+                        }
+			if(tx_subframe_buffer->tx_req != 0)
+                        {
+                          deallocate_nfapi_tx_request(tx_subframe_buffer->tx_req, pnf_p7);
+                          tx_subframe_buffer->tx_req = 0;
+                        }
+                        if(tx_subframe_buffer->hi_dci0_req != 0)
+                        {
+                          deallocate_nfapi_hi_dci0_request(tx_subframe_buffer->hi_dci0_req, pnf_p7);
+                          tx_subframe_buffer->hi_dci0_req = 0;
+                        }
+                }
+		else
+		{
+                  // If we ever need to "send" a dummy ul_config this won't work!!!
+                  send_dummy_subframe(pnf_p7, sfn_sf_tx);
+		}
+
+                if(subframe_buffer->sfn_sf == sfn_sf)
+		{
+
+			if(subframe_buffer->ul_config_req != 0)
+			{
+				if(pnf_p7->_public.ul_config_req)
+					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), subframe_buffer->ul_config_req);
+
+				//deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
+			}
+			else
+			{
+				// send dummy
+				if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
+				{
+					pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
+					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.ul_config_req);
+				}
+			}
+
+			if(subframe_buffer->lbt_dl_config_req != 0)
+			{
+				if(pnf_p7->_public.lbt_dl_config_req)
+					(pnf_p7->_public.lbt_dl_config_req)(&(pnf_p7->_public), subframe_buffer->lbt_dl_config_req);
+
+				//deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
+			}
+			else
+			{
+				// send dummy
+				if(pnf_p7->_public.lbt_dl_config_req && pnf_p7->_public.dummy_subframe.lbt_dl_config_req)
+				{
+					pnf_p7->_public.dummy_subframe.lbt_dl_config_req->sfn_sf = sfn_sf;
+					(pnf_p7->_public.lbt_dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.lbt_dl_config_req);
+				}
+
+			}
+
+                        //if(subframe_buffer->dl_config_req != 0)
+                          //deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
+			//if(subframe_buffer->tx_req != 0)
+                          //deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
+                        if(subframe_buffer->ul_config_req != 0)
+                        {
+                          deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
+                          subframe_buffer->ul_config_req = 0;
+
+                        }
+                        //if(subframe_buffer->hi_dci0_req != 0)
+                          //deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
+			if(subframe_buffer->lbt_dl_config_req != 0)
+                        {
+                          deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
+                          subframe_buffer->lbt_dl_config_req = 0;
+                        }
+                } // sfn_sf match
+
+                if (subframe_buffer->dl_config_req == 0 && subframe_buffer->tx_req == 0 && subframe_buffer->ul_config_req == 0 && subframe_buffer->lbt_dl_config_req == 0)
+                {
+                  memset(&(pnf_p7->subframe_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_subframe_buffer_t));
+                  pnf_p7->subframe_buffer[buffer_index].sfn_sf = -1;
+		}
+
+                //printf("pnf_p7->_public.timing_info_mode_periodic:%d pnf_p7->timing_info_period_counter:%d pnf_p7->_public.timing_info_period:%d\n", pnf_p7->_public.timing_info_mode_periodic, pnf_p7->timing_info_period_counter, pnf_p7->_public.timing_info_period);
+                //printf("pnf_p7->_public.timing_info_mode_aperiodic:%d pnf_p7->timing_info_aperiodic_send:%d\n", pnf_p7->_public.timing_info_mode_aperiodic, pnf_p7->timing_info_aperiodic_send);
+                //printf("pnf_p7->timing_info_ms_counter:%d\n", pnf_p7->timing_info_ms_counter);
+
+		// send the periodic timing info if configured
+		if(pnf_p7->_public.timing_info_mode_periodic && (pnf_p7->timing_info_period_counter++) == pnf_p7->_public.timing_info_period)
+		{
+			pnf_pack_and_send_timing_info(pnf_p7);
+
+			pnf_p7->timing_info_period_counter = 0;
+		}
+		else if(pnf_p7->_public.timing_info_mode_aperiodic && pnf_p7->timing_info_aperiodic_send)
+		{
+			pnf_pack_and_send_timing_info(pnf_p7);
+
+			pnf_p7->timing_info_aperiodic_send = 0;
+		}
+		else
+		{
+			pnf_p7->timing_info_ms_counter++;
+		}
+	}
+	else
+	{
+		//send_dummy_subframe(pnf_p7, sfn_sf_tx);
+	}
+
+
+        //printf("pnf_p7->tick:%d\n", pnf_p7->tick);
+	if(pnf_p7->tick == 1000)
+	{
+
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] (ONTIME/LATE) DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
+					pnf_p7->stats.dl_conf_ontime, pnf_p7->stats.dl_conf_late, 
+					pnf_p7->stats.ul_conf_ontime, pnf_p7->stats.ul_conf_late, 
+					pnf_p7->stats.hi_dci0_ontime, pnf_p7->stats.hi_dci0_late, 
+					pnf_p7->stats.tx_ontime, pnf_p7->stats.tx_late);
+		pnf_p7->tick = 0;
+		memset(&pnf_p7->stats, 0, sizeof(pnf_p7->stats));
+	}
+	pnf_p7->tick++;
+#endif
+
+	if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+		return -1;
+	}
+
+	return 0;
+}
+
+
+
+// return 1 if in window
+// return 0 if out of window
+uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
+{
+	uint32_t recv_sfn_sf_dec = NFAPI_SFNSF2DEC(sfnsf);
+	uint32_t current_sfn_sf_dec = NFAPI_SFNSF2DEC(phy->sfn_sf);
+
+	uint8_t in_window = 0;
+	uint8_t timing_window = phy->_public.subframe_buffer_size;
+
+	if(recv_sfn_sf_dec <= current_sfn_sf_dec)
+	{
+		// Need to check for wrap in window
+		if(((current_sfn_sf_dec + timing_window) % NFAPI_MAX_SFNSFDEC) < current_sfn_sf_dec)
+		{
+			if(recv_sfn_sf_dec > ((current_sfn_sf_dec + timing_window) % NFAPI_MAX_SFNSFDEC))
+			{
+				// out of window
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is late %d (with wrap)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
+			}
+			else
+			{
+				// ok
+				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d (with wrap)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
+				in_window = 1;
+			}
+		}
+		else
+		{
+			// too late
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in late %d (delta:%d)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (current_sfn_sf_dec - recv_sfn_sf_dec));
+		}
+
+	}
+	else
+	{
+		// Need to check it is in window
+		if((recv_sfn_sf_dec - current_sfn_sf_dec) <= timing_window)
+		{
+			// in window
+			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
+			in_window = 1;
+		}
+		else
+		{
+			// too far in the future
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", current_sfn_sf_dec, name, recv_sfn_sf_dec,  (recv_sfn_sf_dec - current_sfn_sf_dec), timing_window);
+		}
+
+	}
+
+	return in_window;
+}
+
+
+// P7 messages
+//
+void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req Received\n");
+
+	nfapi_dl_config_request_t* req  = allocate_nfapi_dl_config_request(pnf_p7);
+
+	if(req == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_dl_config_request structure\n");
+		return;
+	}
+
+	int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_dl_config_request_t), &(pnf_p7->_public.codec_config));
+
+	if(unpack_result == 0)
+	{
+		if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
+			return;
+		}
+
+                if (
+                    0 && 
+                    (NFAPI_SFNSF2DEC(req->sfn_sf) % 100 ==0 ||
+                     NFAPI_SFNSF2DEC(req->sfn_sf) % 105 ==0 
+                    )
+                )
+                  NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req sfn_sf:%d pdcch:%u dci:%u pdu:%u pdsch_rnti:%u pcfich:%u\n", 
+                      NFAPI_SFNSF2DEC(req->sfn_sf),
+                      req->dl_config_request_body.number_pdcch_ofdm_symbols,
+                      req->dl_config_request_body.number_dci,
+                      req->dl_config_request_body.number_pdu,
+                      req->dl_config_request_body.number_pdsch_rnti,
+                      req->dl_config_request_body.transmission_power_pcfich
+                      );
+
+                if(is_p7_request_in_window(req->sfn_sf, "dl_config_request", pnf_p7))
+                {
+                  uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+                  uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+
+                        struct timespec t;
+                        clock_gettime(CLOCK_MONOTONIC, &t);
+
+                  NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
+
+			// if there is already an dl_config_req make sure we free it.
+			if(pnf_p7->subframe_buffer[buffer_index].dl_config_req != 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_sf:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), buffer_index);
+				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing dl_config_req at index %d (%d/%d)", 
+				//			pMyPhyInfo->sfnSf, bufferIdx,
+				//			SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
+				deallocate_nfapi_dl_config_request(pnf_p7->subframe_buffer[buffer_index].dl_config_req, pnf_p7);
+			}
+
+			// saving dl_config_request in subframe buffer
+			pnf_p7->subframe_buffer[buffer_index].sfn_sf = req->sfn_sf;
+			pnf_p7->subframe_buffer[buffer_index].dl_config_req = req;
+
+			pnf_p7->stats.dl_conf_ontime++;
+			
+		}
+		else
+		{
+			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "NOT storing dl_config_req SFN/SF %d\n", req->sfn_sf);
+			deallocate_nfapi_dl_config_request(req, pnf_p7);
+
+			if(pnf_p7->_public.timing_info_mode_aperiodic)
+			{
+				pnf_p7->timing_info_aperiodic_send = 1;
+			}
+
+			pnf_p7->stats.dl_conf_late++;
+		}
+
+		if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+			return;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack dl_config_req");
+		deallocate_nfapi_dl_config_request(req, pnf_p7);
+	}
+}
+
+void pnf_handle_ul_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "UL_CONFIG.req Received\n");
+
+	nfapi_ul_config_request_t* req  = allocate_nfapi_ul_config_request(pnf_p7);
+
+	if(req == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_ul_config_request structure\n");
+		return;
+	}
+
+	int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_ul_config_request_t), &(pnf_p7->_public.codec_config));
+
+	if(unpack_result == 0)
+	{
+		if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
+			return;
+		}
+
+		if(is_p7_request_in_window(req->sfn_sf, "ul_config_request", pnf_p7))
+		{
+			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+
+                        struct timespec t;
+                        clock_gettime(CLOCK_MONOTONIC, &t);
+
+                        NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
+
+			if(pnf_p7->subframe_buffer[buffer_index].ul_config_req != 0)
+			{
+				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing ul_config_req at index %d (%d/%d)", 
+				//			pMyPhyInfo->sfnSf, bufferIdx,
+				//			SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
+
+				deallocate_nfapi_ul_config_request(pnf_p7->subframe_buffer[buffer_index].ul_config_req, pnf_p7);
+			}
+
+			pnf_p7->subframe_buffer[buffer_index].sfn_sf = req->sfn_sf;
+			pnf_p7->subframe_buffer[buffer_index].ul_config_req = req;
+			
+			pnf_p7->stats.ul_conf_ontime++;
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing ul_config_req OUTSIDE OF TRANSMIT BUFFER WINDOW SFN/SF %d\n", NFAPI_SFNSF2DEC(pnf_p7->sfn_sf), NFAPI_SFNSF2DEC(req->sfn_sf));
+			deallocate_nfapi_ul_config_request(req, pnf_p7);
+
+			if(pnf_p7->_public.timing_info_mode_aperiodic)
+			{
+				pnf_p7->timing_info_aperiodic_send = 1;
+			}
+
+			pnf_p7->stats.ul_conf_late++;
+		}
+
+		if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+			return;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack ul_config_req\n");
+		deallocate_nfapi_ul_config_request(req, pnf_p7);
+	}
+}
+
+void pnf_handle_hi_dci0_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "HI_DCI0.req Received\n");
+
+	nfapi_hi_dci0_request_t* req  = allocate_nfapi_hi_dci0_request(pnf_p7);
+
+	if(req == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_hi_dci0_request structure\n");
+		return;
+	}
+
+	int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_hi_dci0_request_t), &pnf_p7->_public.codec_config);
+
+	if(unpack_result == 0)
+	{
+		if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
+			return;
+		}
+
+		if(is_p7_request_in_window(req->sfn_sf, "hi_dci0_request", pnf_p7))
+		{
+			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+
+			if(pnf_p7->subframe_buffer[buffer_index].hi_dci0_req!= 0)
+			{
+				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing hi_dci0_req at index %d (%d/%d)", 
+				//			pMyPhyInfo->sfnSf, bufferIdx,
+				//			SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
+
+				deallocate_nfapi_hi_dci0_request(pnf_p7->subframe_buffer[buffer_index].hi_dci0_req, pnf_p7);
+			}
+
+			pnf_p7->subframe_buffer[buffer_index].sfn_sf = req->sfn_sf;
+			pnf_p7->subframe_buffer[buffer_index].hi_dci0_req = req;
+
+			pnf_p7->stats.hi_dci0_ontime++;
+			
+		}
+		else
+		{
+			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing hi_dci0_req SFN/SF %d/%d\n", pMyPhyInfo->sfnSf, SFNSF2SFN(req->sfn_sf), SFNSF2SF(req->sfn_sf));
+			deallocate_nfapi_hi_dci0_request(req, pnf_p7);
+
+			if(pnf_p7->_public.timing_info_mode_aperiodic)
+			{
+				pnf_p7->timing_info_aperiodic_send = 1;
+			}
+
+			pnf_p7->stats.hi_dci0_late++;
+		}
+
+		if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+			return;
+		}
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack hi_dci0_req\n");
+		deallocate_nfapi_hi_dci0_request(req, pnf_p7);
+	}
+}
+
+void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "TX.req Received\n");
+	
+	nfapi_tx_request_t* req = allocate_nfapi_tx_request(pnf_p7);
+
+	if(req == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_tx_request structure\n");
+		return;
+	}
+
+	int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_tx_request_t), &pnf_p7->_public.codec_config);
+	if(unpack_result == 0)
+	{
+		if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
+			return;
+		}
+
+		if(is_p7_request_in_window(req->sfn_sf, "tx_request", pnf_p7))
+		{
+			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+
+                        struct timespec t;
+                        clock_gettime(CLOCK_MONOTONIC, &t);
+
+                        NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE TX_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
+
+                        if (0 && NFAPI_SFNSF2DEC(req->sfn_sf)%100==0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX_REQ.req sfn_sf:%d pdus:%d - TX_REQ is within window\n",
+                            __FUNCTION__,
+                            NFAPI_SFNSF2DEC(req->sfn_sf),
+                            req->tx_request_body.number_of_pdus);
+
+			if(pnf_p7->subframe_buffer[buffer_index].tx_req != 0)
+			{
+				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing tx_req at index %d (%d/%d)", 
+				//			pMyPhyInfo->sfnSf, bufferIdx,
+				//			SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
+
+				deallocate_nfapi_tx_request(pnf_p7->subframe_buffer[buffer_index].tx_req, pnf_p7);
+			}
+
+			pnf_p7->subframe_buffer[buffer_index].sfn_sf = req->sfn_sf;
+			pnf_p7->subframe_buffer[buffer_index].tx_req = req;
+
+			pnf_p7->stats.tx_ontime++;
+		}
+		else
+		{
+                  NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() TX_REQUEST Request is outside of window REQ:SFN_SF:%d CURR:SFN_SF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), NFAPI_SFNSF2DEC(pnf_p7->sfn_sf));
+
+			deallocate_nfapi_tx_request(req, pnf_p7);
+
+			if(pnf_p7->_public.timing_info_mode_aperiodic)
+			{
+				pnf_p7->timing_info_aperiodic_send = 1;
+			}
+
+			pnf_p7->stats.tx_late++;
+		}
+
+		if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+			return;
+		}
+	}
+	else
+	{
+		deallocate_nfapi_tx_request(req, pnf_p7);
+	}
+}
+
+void pnf_handle_lbt_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+{
+	nfapi_lbt_dl_config_request_t* req = allocate_nfapi_lbt_dl_config_request(pnf_p7);
+
+	if(req == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_lbt_dl_config_request structure\n");
+		return;
+	}
+
+	int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_lbt_dl_config_request_t), &pnf_p7->_public.codec_config);
+
+	if(unpack_result == 0)
+	{
+		if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
+			return;
+		}
+
+		if(is_p7_request_in_window(req->sfn_sf, "lbt_dl_request", pnf_p7))
+		{
+			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+
+			if(pnf_p7->subframe_buffer[buffer_index].lbt_dl_config_req != 0)
+			{
+				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing tx_req at index %d (%d/%d)", 
+				//			pMyPhyInfo->sfnSf, bufferIdx,
+				//			SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
+
+				deallocate_nfapi_lbt_dl_config_request(pnf_p7->subframe_buffer[buffer_index].lbt_dl_config_req, pnf_p7);
+			}
+
+			pnf_p7->subframe_buffer[buffer_index].sfn_sf = req->sfn_sf;
+			pnf_p7->subframe_buffer[buffer_index].lbt_dl_config_req = req;
+		}
+		else
+		{
+			deallocate_nfapi_lbt_dl_config_request(req, pnf_p7);
+
+			if(pnf_p7->_public.timing_info_mode_aperiodic)
+			{
+				pnf_p7->timing_info_aperiodic_send = 1;
+			}
+		}
+
+		if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+			return;
+		}
+	}
+	else
+	{
+		deallocate_nfapi_lbt_dl_config_request(req, pnf_p7);
+	}
+
+}
+
+void pnf_handle_p7_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7, uint16_t message_id)
+{
+	if(pnf_p7->_public.allocate_p7_vendor_ext)
+	{
+		uint16_t msg_size;
+		nfapi_p7_message_header_t* msg = pnf_p7->_public.allocate_p7_vendor_ext(message_id, &msg_size);
+
+		if(msg == 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n");
+			return;
+		}
+
+		int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &pnf_p7->_public.codec_config);
+
+		if(unpack_result == 0)
+		{
+			if(pnf_p7->_public.vendor_ext)
+				pnf_p7->_public.vendor_ext(&(pnf_p7->_public), msg);
+		}
+		
+		if(pnf_p7->_public.deallocate_p7_vendor_ext)
+			pnf_p7->_public.deallocate_p7_vendor_ext(msg);
+		
+	}
+	
+}
+
+
+uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_time_hr)
+{
+	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+	uint32_t t2 = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us;
+
+        if (0)
+        {
+          static uint32_t prev_t2 = 0;
+
+          NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s(now_time_hr:%u sfn_sf:%d sf_start_time_Hr:%u) sf_time_us:%u t2:%u prev_t2:%u diff:%u\n",
+              __FUNCTION__,
+              now_time_hr, NFAPI_SFNSF2DEC(sfn_sf), sf_start_time_hr,
+              sf_time_us,
+              t2,
+              prev_t2,
+              t2-prev_t2);
+
+          prev_t2 = t2;
+        }
+
+	return t2;
+}
+
+uint32_t calculate_t3(uint16_t sfn_sf, uint32_t sf_start_time_hr)
+{
+	uint32_t now_time_hr = pnf_get_current_time_hr();
+
+	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+
+	uint32_t t3 = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us;
+
+	return t3;
+}
+
+void pnf_handle_dl_node_sync(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7, uint32_t rx_hr_time)
+{
+	nfapi_dl_node_sync_t dl_node_sync;
+
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_NODE_SYNC Received\n");
+
+	if (pRecvMsg == NULL || pnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+		return;
+	}
+
+	// unpack the message
+	if (nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &dl_node_sync, sizeof(dl_node_sync), &pnf_p7->_public.codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		return;
+	}
+
+	if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
+		return;
+	}
+
+
+	if (dl_node_sync.delta_sfn_sf != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Will shift SF timing by %d on next subframe\n", dl_node_sync.delta_sfn_sf);
+
+		pnf_p7->sfn_sf_shift = dl_node_sync.delta_sfn_sf;
+	}
+
+	nfapi_ul_node_sync_t ul_node_sync;
+	memset(&ul_node_sync, 0, sizeof(ul_node_sync));
+	ul_node_sync.header.message_id = NFAPI_UL_NODE_SYNC;
+	ul_node_sync.header.phy_id = dl_node_sync.header.phy_id;
+	ul_node_sync.t1 = dl_node_sync.t1;
+	ul_node_sync.t2 = calculate_t2(rx_hr_time, pnf_p7->sfn_sf, pnf_p7->sf_start_time_hr);
+	ul_node_sync.t3 = calculate_t3(pnf_p7->sfn_sf, pnf_p7->sf_start_time_hr);
+
+	if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
+		return;
+	}
+
+	pnf_p7_pack_and_send_p7_message(pnf_p7, &(ul_node_sync.header), sizeof(ul_node_sync));
+}
+
+void pnf_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7,  uint32_t rx_hr_time)
+{
+	nfapi_p7_message_header_t header;
+
+	// validate the input params
+	if(pRecvMsg == NULL || recvMsgLen < 4 || pnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return;
+	}
+
+	// unpack the message header
+	if (nfapi_p7_message_header_unpack(pRecvMsg, recvMsgLen, &header, sizeof(header), &pnf_p7->_public.codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
+		return;
+	}
+
+	// ensure the message is sensible
+	if (recvMsgLen < 8 || pRecvMsg == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_WARN, "Invalid message size: %d, ignoring\n", recvMsgLen);
+		return;
+	}
+
+	switch (header.message_id)
+	{
+		case NFAPI_DL_NODE_SYNC:
+			pnf_handle_dl_node_sync(pRecvMsg, recvMsgLen, pnf_p7, rx_hr_time);
+			break;
+
+		case NFAPI_DL_CONFIG_REQUEST:
+			pnf_handle_dl_config_request(pRecvMsg, recvMsgLen, pnf_p7);
+			break;
+
+		case NFAPI_UL_CONFIG_REQUEST:
+			pnf_handle_ul_config_request(pRecvMsg, recvMsgLen, pnf_p7);
+			break;
+
+		case NFAPI_HI_DCI0_REQUEST:
+			pnf_handle_hi_dci0_request(pRecvMsg, recvMsgLen, pnf_p7);
+			break;
+
+		case NFAPI_TX_REQUEST:
+			pnf_handle_tx_request(pRecvMsg, recvMsgLen, pnf_p7);
+			break;
+
+		case NFAPI_LBT_DL_CONFIG_REQUEST:
+			pnf_handle_lbt_dl_config_request(pRecvMsg, recvMsgLen, pnf_p7);
+			break;
+		
+		default:
+			{
+				if(header.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+				   header.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+				{
+					pnf_handle_p7_vendor_extension(pRecvMsg, recvMsgLen, pnf_p7, header.message_id);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P7 Unknown message ID %d\n", __FUNCTION__, header.message_id);
+				}
+			}
+			break;
+	}
+}
+
+void pnf_handle_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7,  uint32_t rx_hr_time)
+{
+	nfapi_p7_message_header_t messageHeader;
+
+	// validate the input params
+	if(pRecvMsg == NULL || recvMsgLen < 4 || pnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "pnf_handle_p7_message: invalid input params (%d %d %d)\n", pRecvMsg, recvMsgLen, pnf_p7);
+		return;
+	}
+
+	// unpack the message header
+	if (nfapi_p7_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p7_message_header_t), &pnf_p7->_public.codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
+		return;
+	}
+
+	uint8_t m = NFAPI_P7_GET_MORE(messageHeader.m_segment_sequence);
+	uint8_t sequence_num = NFAPI_P7_GET_SEQUENCE(messageHeader.m_segment_sequence);
+	uint8_t segment_num = NFAPI_P7_GET_SEGMENT(messageHeader.m_segment_sequence);
+
+	if(pnf_p7->_public.checksum_enabled)
+	{
+		uint32_t checksum = nfapi_p7_calculate_checksum(pRecvMsg, recvMsgLen);
+		if(checksum != messageHeader.checksum)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "Checksum verification failed %d %d\n", checksum, messageHeader.checksum);
+			return;
+		}
+	}
+
+	if(m == 0 && segment_num == 0)
+	{
+		// we have a complete message
+		// ensure the message is sensible
+		if (recvMsgLen < 8 || pRecvMsg == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_WARN, "Invalid message size: %d, ignoring\n", recvMsgLen);
+			return;
+		}
+
+		pnf_dispatch_p7_message(pRecvMsg, recvMsgLen, pnf_p7, rx_hr_time);
+	}
+	else
+	{
+		pnf_p7_rx_message_t* rx_msg = pnf_p7_rx_reassembly_queue_add_segment(pnf_p7, &(pnf_p7->reassembly_queue), rx_hr_time, sequence_num, segment_num, m, pRecvMsg, recvMsgLen);
+
+		if(rx_msg->num_segments_received == rx_msg->num_segments_expected)
+		{
+			// send the buffer on
+			uint16_t i = 0;
+			uint16_t length = 0;
+			for(i = 0; i < rx_msg->num_segments_expected; ++i)
+			{
+				length += rx_msg->segments[i].length - (i > 0 ? NFAPI_P7_HEADER_LENGTH : 0);
+			}
+			
+			if(pnf_p7->reassemby_buffer_size < length)
+			{
+				pnf_p7_free(pnf_p7, pnf_p7->reassemby_buffer);
+				pnf_p7->reassemby_buffer = 0;
+			}
+
+			if(pnf_p7->reassemby_buffer == 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "Resizing PNF_P7 Reassembly buffer %d->%d\n", pnf_p7->reassemby_buffer_size, length);
+				pnf_p7->reassemby_buffer = (uint8_t*)pnf_p7_malloc(pnf_p7, length);
+
+				if(pnf_p7->reassemby_buffer == 0)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_NOTE, "Failed to allocate PNF_P7 reassemby buffer len:%d\n", length);
+					return;
+				}
+
+				pnf_p7->reassemby_buffer_size = length;
+			}
+			
+			uint16_t offset = 0;
+			for(i = 0; i < rx_msg->num_segments_expected; ++i)
+			{
+				if(i == 0)
+				{
+					memcpy(pnf_p7->reassemby_buffer, rx_msg->segments[i].buffer, rx_msg->segments[i].length);
+					offset += rx_msg->segments[i].length;
+				}
+				else
+				{
+					memcpy(pnf_p7->reassemby_buffer + offset, rx_msg->segments[i].buffer + NFAPI_P7_HEADER_LENGTH, rx_msg->segments[i].length - NFAPI_P7_HEADER_LENGTH);
+					offset += rx_msg->segments[i].length - NFAPI_P7_HEADER_LENGTH;
+				}
+			}
+
+			
+			pnf_dispatch_p7_message(pnf_p7->reassemby_buffer, length, pnf_p7, rx_msg->rx_hr_time);
+
+
+			// delete the structure
+			pnf_p7_rx_reassembly_queue_remove_msg(pnf_p7, &(pnf_p7->reassembly_queue), rx_msg);
+		}
+	}
+
+	pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7, &(pnf_p7->reassembly_queue), rx_hr_time, 1000);
+	
+}
+void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
+{
+	int recvfrom_result = 0;
+	struct sockaddr_in remote_addr;
+	socklen_t remote_addr_size = sizeof(remote_addr);
+
+	do
+	{
+		// peek the header
+		uint8_t header_buffer[NFAPI_P7_HEADER_LENGTH];
+		recvfrom_result = recvfrom(pnf_p7->p7_sock, header_buffer, NFAPI_P7_HEADER_LENGTH, MSG_DONTWAIT | MSG_PEEK, (struct sockaddr*)&remote_addr, &remote_addr_size);
+
+		if(recvfrom_result > 0)
+		{
+			// get the segment size
+			nfapi_p7_message_header_t header;
+			nfapi_p7_message_header_unpack(header_buffer, NFAPI_P7_HEADER_LENGTH, &header, 34, 0);
+
+			// resize the buffer if we have a large segment
+			if(header.message_length > pnf_p7->rx_message_buffer_size)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "reallocing rx buffer %d\n", header.message_length); 
+				pnf_p7->rx_message_buffer = realloc(pnf_p7->rx_message_buffer, header.message_length);
+				pnf_p7->rx_message_buffer_size = header.message_length;
+			}
+
+			// read the segment
+			recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size);
+
+		now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp???
+
+			if(recvfrom_result > 0)
+			{
+				pnf_handle_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time);
+			}
+		}
+		else if(recvfrom_result == 0)
+		{
+			// recv zero length message
+			recvfrom_result = recvfrom(pnf_p7->p7_sock, header_buffer, 0, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size);
+		}
+
+		if(recvfrom_result == -1)
+		{
+			if(errno == EAGAIN || errno == EWOULDBLOCK)
+			{
+				// return to the select
+				//NFAPI_TRACE(NFAPI_TRACE_WARN, "%s recvfrom would block :%d\n", __FUNCTION__, errno);
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_WARN, "%s recvfrom failed errno:%d\n", __FUNCTION__, errno);
+			}
+		}
+
+		// need to update the time as we would only use the value from the
+		// select
+#if 0
+// DJP - why do this here and not on return from recv???
+		now_hr_time = pnf_get_current_time_hr();
+#endif
+	}
+	while(recvfrom_result > 0);
+}
+
+int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
+{
+
+	// initialize the mutex lock
+	if(pthread_mutex_init(&(pnf_p7->mutex), NULL) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 mutex init: %d\n", errno);
+		return -1;
+	}
+	
+	if(pthread_mutex_init(&(pnf_p7->pack_mutex), NULL) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 mutex init: %d\n", errno);
+		return -1;
+	}	
+
+	// create the pnf p7 socket
+	if ((pnf_p7->p7_sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 socket errno: %d\n", errno);
+		return -1;
+	}
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 socket created (%d)...\n", pnf_p7->p7_sock);
+
+	// configure the UDP socket options
+	int reuseaddr_enable = 1;
+	if (setsockopt(pnf_p7->p7_sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr_enable, sizeof(int)) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF P7 setsockopt (SOL_SOCKET, SO_REUSEADDR) failed  errno: %d\n", errno);
+		return -1;
+	}
+
+/*
+	int reuseport_enable = 1;
+	if (setsockopt(pnf_p7->p7_sock, SOL_SOCKET, SO_REUSEPORT, &reuseport_enable, sizeof(int)) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF P7 setsockopt (SOL_SOCKET, SO_REUSEPORT) failed  errno: %d\n", errno);
+		return -1;
+	}
+*/
+		
+	int iptos_value = FAPI2_IP_DSCP << 2;
+	if (setsockopt(pnf_p7->p7_sock, IPPROTO_IP, IP_TOS, &iptos_value, sizeof(iptos_value)) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF P7 setsockopt (IPPROTO_IP, IP_TOS) failed errno: %d\n", errno);
+		return -1;
+	}
+
+	struct sockaddr_in addr;
+	memset(&addr, 0, sizeof(addr));
+	addr.sin_family = AF_INET;
+	addr.sin_port = htons(pnf_p7->_public.local_p7_port);
+
+	if(pnf_p7->_public.local_p7_addr == 0)
+	{
+		addr.sin_addr.s_addr = INADDR_ANY;
+	}
+	else
+	{
+		//addr.sin_addr.s_addr = inet_addr(pnf_p7->_public.local_p7_addr);
+		if(inet_aton(pnf_p7->_public.local_p7_addr, &addr.sin_addr) == -1)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "inet_aton failed\n");
+		}
+	}
+
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 binding %d too %s:%d\n", pnf_p7->p7_sock, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
+	if (bind(pnf_p7->p7_sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF_P7 bind error fd:%d errno: %d\n", pnf_p7->p7_sock, errno);
+		return -1;
+	}
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 bind succeeded...\n");
+
+	while(pnf_p7->terminate == 0)
+	{
+		fd_set rfds;
+		int selectRetval = 0;
+
+		// select on a timeout and then get the message
+		FD_ZERO(&rfds);
+		FD_SET(pnf_p7->p7_sock, &rfds);
+
+		struct timeval timeout;
+		timeout.tv_sec = 1;
+		timeout.tv_usec = 0;
+
+		selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout);
+
+		uint32_t now_hr_time = pnf_get_current_time_hr();
+
+		if(selectRetval == 0)
+		{	
+			// timeout
+			continue;
+		}
+		else if (selectRetval == -1 && (errno == EINTR))
+		{
+			// interrupted by signal
+			NFAPI_TRACE(NFAPI_TRACE_WARN, "PNF P7 Signal Interrupt %d\n", errno);
+			continue;
+		}
+		else if (selectRetval == -1)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_WARN, "PNF P7 select() failed\n");
+			sleep(1);
+			continue;
+		}
+
+		if(FD_ISSET(pnf_p7->p7_sock, &rfds))
+		{
+			pnf_nfapi_p7_read_dispatch_message(pnf_p7, now_hr_time);
+		}
+	}
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF_P7 Terminating..\n");
+
+	// close the connection and socket
+	if (close(pnf_p7->p7_sock) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "close failed errno: %d\n", errno);
+	}
+
+	if(pthread_mutex_destroy(&(pnf_p7->pack_mutex)) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "mutex destroy failed errno: %d\n", errno);
+	}
+
+	if(pthread_mutex_destroy(&(pnf_p7->mutex)) != 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "mutex destroy failed errno: %d\n", errno);
+	}
+
+	return 0;
+}
diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c b/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
new file mode 100644
index 0000000000000000000000000000000000000000..74de5e5d785e5d251dfcc65133fd2154219b7641
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "pnf_p7.h"
+#include <stdlib.h>
+#include <string.h>
+
+nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create()
+{
+	pnf_p7_t* _this = (pnf_p7_t*)calloc(1, sizeof(pnf_p7_t));
+
+	if(_this == 0)
+		return 0;
+
+
+	// set the default parameters
+	_this->_public.segment_size = 1400;
+	_this->max_num_segments = 8;
+	
+	_this->_public.subframe_buffer_size = 8;
+	_this->_public.timing_info_mode_periodic = 1;
+	_this->_public.timing_info_period = 32;
+	_this->_public.timing_info_mode_aperiodic = 1;
+	
+	_this->_public.checksum_enabled = 1;
+	
+	_this->_public.malloc = &malloc;
+	_this->_public.free = &free;	
+
+	_this->_public.codec_config.allocate = &malloc;
+	_this->_public.codec_config.deallocate = &free;
+
+	return &(_this->_public);
+}
+
+void nfapi_pnf_p7_config_destory(nfapi_pnf_p7_config_t* config)
+{
+	if(config == 0)
+		return ;
+
+	free(config);
+}
+
+
+
+int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config)
+{
+	// Verify that config is not null
+	if(config == 0)
+		return -1;
+
+	// Make sure to set the defined trace function before using NFAPI_TRACE
+	if(config->trace)
+		nfapi_trace_g = config->trace;
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+
+	pnf_p7_message_pump(_this);
+
+	return 0;
+}
+
+int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config)
+{
+	// Verify that config is not null
+	if(config == 0)
+		return -1;
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	_this->terminate = 1;
+
+	return 0;
+}
+
+
+int nfapi_pnf_p7_subframe_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn_sf)
+{
+	// Verify that config is not null
+	if(config == 0)
+		return -1;
+	
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+
+	return pnf_p7_subframe_ind(_this, phy_id, sfn_sf);
+}
+
+int nfapi_pnf_p7_harq_ind(nfapi_pnf_p7_config_t* config, nfapi_harq_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_harq_indication_t));
+}
+int nfapi_pnf_p7_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_crc_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_crc_indication_t));
+}
+int nfapi_pnf_p7_rx_ind(nfapi_pnf_p7_config_t* config, nfapi_rx_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_rx_indication_t));
+}
+int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_rach_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_rach_indication_t));
+}
+int nfapi_pnf_p7_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_srs_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_srs_indication_t));
+}
+int nfapi_pnf_p7_sr_ind(nfapi_pnf_p7_config_t* config, nfapi_sr_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_sr_indication_t));
+}
+int nfapi_pnf_p7_cqi_ind(nfapi_pnf_p7_config_t* config, nfapi_cqi_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_cqi_indication_t));
+}
+int nfapi_pnf_p7_lbt_dl_ind(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_lbt_dl_indication_t));
+}
+int nfapi_pnf_p7_nb_harq_ind(nfapi_pnf_p7_config_t* config, nfapi_nb_harq_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nb_harq_indication_t));
+}
+int nfapi_pnf_p7_nrach_ind(nfapi_pnf_p7_config_t* config, nfapi_nrach_indication_t* ind)
+{
+	if(config == NULL || ind == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nrach_indication_t));
+}
+int nfapi_pnf_p7_vendor_extension(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg)
+{
+	if(config == NULL || msg == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return -1;
+	}
+
+	pnf_p7_t* _this = (pnf_p7_t*)(config);
+	return pnf_p7_pack_and_send_p7_message(_this, msg, 0);
+}
+
diff --git a/nfapi/open-nFAPI/pnf/tests/Makefile.am b/nfapi/open-nFAPI/pnf/tests/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..4dcdea0511f8997ad211b3d97ffb45af0904a4f7
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/tests/Makefile.am
@@ -0,0 +1,28 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+#nfapi unit test
+AUTOMAKE_OPTIONS=subdir-objects
+AM_CPPFLAGS = -I$(top_srcdir)/nfapi/inc -I$(top_srcdir)/nfapi/public_inc  -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/pnf/public_inc $(CFLAGS_CUNIT) -Wall -Werror
+
+check_PROGRAMS= test_pnf
+
+test_pnf_SOURCES = pnf_cunit_main.c ../../common/src/debug.c   
+test_pnf_LDADD=$(top_builddir)/pnf/libnfapi_pnf.a $(top_builddir)/nfapi/libnfapi.a -L$(libdir) -lpthread -lrt -lsctp -lz -lcunit
+
+LOG_DRIVER = $(top_srcdir)/tap-driver.sh
+TESTS=$(check_PROGRAMS)
+EXTRA_DIST = $(TESTS)
diff --git a/nfapi/open-nFAPI/pnf/tests/pnf_cunit_main.c b/nfapi/open-nFAPI/pnf/tests/pnf_cunit_main.c
new file mode 100644
index 0000000000000000000000000000000000000000..d2ab031ad4708000942e490df8a0cd0b64276bb8
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf/tests/pnf_cunit_main.c
@@ -0,0 +1,2365 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CUnit.h"
+
+#include "Basic.h"
+#include "Automated.h"
+//#include "CUnit/Console.h"
+
+#include "nfapi_interface.h"
+#include "nfapi_pnf_interface.h"
+#include "nfapi.h"
+#include <stdio.h>  // for printf
+#include <stdlib.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <unistd.h>
+#include "debug.h"
+
+/* Test Suite setup and cleanup functions: */
+
+int init_suite(void) { return 0; }
+int clean_suite(void) { return 0; }
+
+#define MAX_PACKED_MESSAGE_SIZE	8192
+
+typedef struct phy_info
+{
+	uint8_t enabled;
+	uint16_t phy_id;
+	uint16_t sfn_sf;
+
+	pthread_t thread;
+
+	int pnf_p7_port;
+	char* pnf_p7_addr;
+
+	int vnf_p7_port;
+	char* vnf_p7_addr;
+
+	nfapi_pnf_p7_config_t* config;
+
+} phy_info_t;
+
+typedef struct pnf_info
+{
+	uint8_t num_phys;
+	phy_info_t phys[8];
+
+} pnf_info_t;
+
+phy_info_t* find_phy_info(pnf_info_t* pnf, uint16_t phy_id)
+{
+	int i = 0;
+	for(i = 0; i < 8; ++i)
+	{
+		if(pnf->phys[i].enabled == 1 && pnf->phys[i].phy_id == phy_id)
+		{
+			return &(pnf->phys[i]);
+		}
+	}
+	return 0;
+}
+
+
+
+/************* Test case functions ****************/
+
+void pnf_test_start_no_config(void) 
+{
+	int result = nfapi_pnf_start(0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+
+void test_trace(nfapi_trace_level_t level, const char* message, ...)
+{
+	printf("%s", message);
+}
+
+
+void* pnf_test_start_thread(void* ptr)
+{
+	int result = nfapi_pnf_start((nfapi_pnf_config_t*)ptr);
+	return (void*)(intptr_t)result;
+}
+
+void* pnf_test_start_p7_thread(void* ptr)
+{
+	int result = nfapi_pnf_p7_start((nfapi_pnf_p7_config_t*)ptr);
+	return (void*)(intptr_t)result;
+}
+
+void pnf_test_start_no_connection(void) 
+{
+	char* vnf_addr = "127.127.0.1";
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	sleep(1);
+
+	nfapi_pnf_stop(config);
+
+	int* result;
+	pthread_join(thread, (void**)&result);
+	CU_ASSERT_EQUAL(result, 0);
+}
+
+void pnf_test_start_no_ip(void) 
+{
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	sleep(2);
+
+	nfapi_pnf_stop(config);
+
+	intptr_t result;
+	pthread_join(thread, (void**)&result);
+	CU_ASSERT_EQUAL((int)result, -1);
+}
+
+void pnf_test_start_invalid_ip(void) 
+{
+	char* vnf_addr = "not.an.ip.address";
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	sleep(2);
+
+	nfapi_pnf_stop(config);
+
+	intptr_t result;
+	pthread_join(thread, (void**)&result);
+	CU_ASSERT_EQUAL((int)result, -1);
+}
+
+int create_p5_listen_socket(char* ip, int port)
+{
+	int p5ListenSock = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
+	
+	struct sockaddr_in addr;
+	addr.sin_family = AF_INET;
+	addr.sin_port = htons(port);
+	addr.sin_addr.s_addr = INADDR_ANY;
+
+	// bind to the configured address and port
+	bind(p5ListenSock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
+
+	return p5ListenSock;
+}
+int create_p5_ipv6_listen_socket(char* ip, int port)
+{
+	struct addrinfo hints, *servinfo;
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_socktype = SOCK_STREAM; // For SCTP we are only interested in SOCK_STREAM
+	hints.ai_family= AF_INET6;
+
+	char port_str[8];
+	snprintf(port_str, sizeof(port_str), "%d", port);
+	getaddrinfo(ip, port_str,  &hints, &servinfo);
+
+
+	int p5ListenSock = socket(AF_INET6, SOCK_STREAM, IPPROTO_SCTP);
+	//printf("Socket result %d\n", p5ListenSock);
+	
+	// bind to the configured address and port
+	/*int bind_result = */
+	bind(p5ListenSock, servinfo->ai_addr, servinfo->ai_addrlen);
+	//printf("Bind result %d (errno:%d)\n", bind_result, errno);
+
+	freeaddrinfo(servinfo);
+
+	return p5ListenSock;
+}
+
+/*
+int wait_for_pnf_connection(int p5ListenSock)
+{
+	listen(p5ListenSock, 2);
+	socklen_t addrSize;
+	int	p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+
+	return p5Sock;
+}
+*/
+
+int test_param_request_called = 0;
+int test_pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req)
+{
+	printf("test_pnf_param_request called.... ;-)\n");
+	
+	nfapi_pnf_param_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
+
+	resp.pnf_param_general.tl.tag = NFAPI_PNF_PARAM_GENERAL_TAG;
+	resp.pnf_param_general.nfapi_sync_mode = 2;
+	resp.pnf_param_general.location_mode = 1;
+	resp.pnf_param_general.location_coordinates[0] = 123;
+	resp.pnf_param_general.dl_config_timing = 12;
+	resp.pnf_param_general.tx_timing = 12;
+	resp.pnf_param_general.ul_config_timing = 12;
+	resp.pnf_param_general.hi_dci0_timing = 12;
+	resp.pnf_param_general.maximum_number_phys = 2;
+	resp.pnf_param_general.maximum_total_bandwidth = 100;
+	resp.pnf_param_general.maximum_total_number_dl_layers = 2;
+	resp.pnf_param_general.maximum_total_number_ul_layers = 2;
+	resp.pnf_param_general.shared_bands = 0;
+	resp.pnf_param_general.shared_pa = 0;
+	resp.pnf_param_general.maximum_total_power = -190;
+	resp.pnf_param_general.oui[0] = 88;
+/*
+	in.pnf_phy.tl.tag = NFAPI_PNF_PHY_TAG;
+	in.pnf_phy.number_of_phys = 2;
+	in.pnf_phy.phy[0].phy_config_index = 0;
+	in.pnf_phy.phy[0].number_of_rfs = 2;
+	in.pnf_phy.phy[0].rf_config[0].rf_config_index = 0;
+	in.pnf_phy.phy[0].number_of_rf_exclusions = 1;
+	in.pnf_phy.phy[0].rf_config[0].rf_config_index = 1;
+	in.pnf_phy.phy[0].downlink_channel_bandwidth_supported = 20;
+	in.pnf_phy.phy[0].uplink_channel_bandwidth_supported = 20;
+	in.pnf_phy.phy[0].number_of_dl_layers_supported = 2;
+	in.pnf_phy.phy[0].number_of_ul_layers_supported = 1;
+	in.pnf_phy.phy[0].maximum_3gpp_release_supported = 3;
+	in.pnf_phy.phy[0].nmm_modes_supported = 2;
+
+	in.pnf_rf.tl.tag = NFAPI_PNF_RF_TAG;
+	in.pnf_rf.number_of_rfs = 2;
+	in.pnf_rf.rf[0].rf_config_index = 0;
+	in.pnf_rf.rf[0].band = 1;
+	in.pnf_rf.rf[0].maximum_transmit_power = -100; 
+	in.pnf_rf.rf[0].minimum_transmit_power = -90; 
+	in.pnf_rf.rf[0].number_of_antennas_suppported = 4;
+	in.pnf_rf.rf[0].minimum_downlink_frequency = 100;
+	in.pnf_rf.rf[0].maximum_downlink_frequency = 2132;
+	in.pnf_rf.rf[0].minimum_uplink_frequency = 1231;
+	in.pnf_rf.rf[0].maximum_uplink_frequency = 123;
+
+
+	in.pnf_phy_rel10.tl.tag = NFAPI_PNF_PHY_REL10_TAG;
+	in.pnf_phy_rel10.number_of_phys = 2;
+	in.pnf_phy_rel10.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel10.phy[0].transmission_mode_7_supported = 1;
+	in.pnf_phy_rel10.phy[0].transmission_mode_8_supported = 2;
+	in.pnf_phy_rel10.phy[0].two_antenna_ports_for_pucch = 3;
+	in.pnf_phy_rel10.phy[0].transmission_mode_9_supported = 4;
+	in.pnf_phy_rel10.phy[0].simultaneous_pucch_pusch = 5;
+	in.pnf_phy_rel10.phy[0].four_layer_tx_with_tm3_and_tm4 = 6;
+
+	in.pnf_phy_rel11.tl.tag = NFAPI_PNF_PHY_REL11_TAG;
+	in.pnf_phy_rel11.number_of_phys = 2;
+	in.pnf_phy_rel11.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel11.phy[0].edpcch_supported = 1;
+	in.pnf_phy_rel11.phy[0].multi_ack_csi_reporting = 2;
+	in.pnf_phy_rel11.phy[0].pucch_tx_diversity = 3;
+	in.pnf_phy_rel11.phy[0].ul_comp_supported = 4;
+	in.pnf_phy_rel11.phy[0].transmission_mode_5_supported = 5;
+
+	in.pnf_phy_rel12.tl.tag = NFAPI_PNF_PHY_REL12_TAG;
+	in.pnf_phy_rel12.number_of_phys = 2;
+	in.pnf_phy_rel12.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel12.phy[0].csi_subframe_set = 1;
+	in.pnf_phy_rel12.phy[0].enhanced_4tx_codebook = 2;
+	in.pnf_phy_rel12.phy[0].drs_supported = 3;
+	in.pnf_phy_rel12.phy[0].ul_64qam_supported = 4;
+	in.pnf_phy_rel12.phy[0].transmission_mode_10_supported = 5;
+	in.pnf_phy_rel12.phy[0].alternative_bts_indices = 6;
+
+	in.pnf_phy_rel13.tl.tag = NFAPI_PNF_PHY_REL13_TAG;
+	in.pnf_phy_rel13.number_of_phys = 2;
+	in.pnf_phy_rel13.phy[0].phy_config_index = 0;
+	in.pnf_phy_rel13.phy[0].pucch_format4_supported = 1;
+	in.pnf_phy_rel13.phy[0].pucch_format5_supported = 2;
+	in.pnf_phy_rel13.phy[0].more_than_5_ca_support = 3;
+	in.pnf_phy_rel13.phy[0].laa_supported = 4;
+	in.pnf_phy_rel13.phy[0].laa_ending_in_dwpts_supported = 5;
+	in.pnf_phy_rel13.phy[0].laa_starting_in_second_slot_supported = 6;
+	in.pnf_phy_rel13.phy[0].beamforming_supported = 7;
+	in.pnf_phy_rel13.phy[0].csi_rs_enhancement_supported = 8;
+	in.pnf_phy_rel13.phy[0].drms_enhancement_supported = 9;
+	in.pnf_phy_rel13.phy[0].srs_enhancement_supported = 10;
+*/
+	test_param_request_called++;
+
+	nfapi_pnf_pnf_param_resp(config, &resp);
+	return 0;
+}
+
+int test_config_request_called = 0;
+int test_pnf_config_request(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req)
+{
+	printf("test_pnf_config_request called.... ;-)\n");
+
+	CU_ASSERT_EQUAL(req->pnf_phy_rf_config.tl.tag, NFAPI_PNF_PHY_RF_TAG);
+
+	if(config->user_data != 0)
+	{
+		pnf_info_t* pnf = (pnf_info_t*)(config->user_data);	
+		int i = 0;
+		for(i = 0; i < req->pnf_phy_rf_config.number_phy_rf_config_info; ++i)
+		{
+			pnf->phys[i].enabled = 1;
+			pnf->phys[i].phy_id = req->pnf_phy_rf_config.phy_rf_config[i].phy_id;
+			printf("test_pnf_config_request creating phy %d\n", pnf->phys[i].phy_id);
+
+		}
+	}
+	
+	nfapi_pnf_config_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_pnf_config_resp(config, &resp);
+
+	test_config_request_called++;
+	return 0;
+}
+int test_pnf_start_request(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req)
+{
+	printf("test_pnf_start_request called.... ;-)\n");
+
+	nfapi_pnf_start_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_START_RESPONSE;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_pnf_start_resp(config, &resp);
+	return 0;
+}
+int test_pnf_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_stop_request_t* req)
+{
+	printf("test_pnf_stop_request called.... ;-)\n");
+
+	nfapi_pnf_stop_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_STOP_RESPONSE;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_pnf_stop_resp(config, &resp);
+	return 0;
+}
+int test_param_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req)
+{
+	printf("test_param_request called.... ;-)\n");
+
+	nfapi_param_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PARAM_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_MSG_OK;
+
+	if(config->user_data != 0)
+	{
+		phy_info_t* phy_info = find_phy_info((pnf_info_t*)(config->user_data), req->header.phy_id);	
+
+		resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
+		resp.nfapi_config.p7_pnf_port.value = phy_info->pnf_p7_port;
+		resp.num_tlv++;
+
+		resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
+		struct sockaddr_in pnf_p7_sockaddr;
+		pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(phy_info->pnf_p7_addr);
+		memcpy(&(resp.nfapi_config.p7_pnf_address_ipv4.address[0]), &pnf_p7_sockaddr.sin_addr.s_addr, 4);
+		resp.num_tlv++;
+	}
+
+
+
+
+	nfapi_pnf_param_resp(config, &resp);
+	return 0;
+}
+int test_config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req)
+{
+	printf("test_config_request called.... ;-)\n");
+
+	if(config->user_data != 0)
+	{
+		phy_info_t* phy_info = find_phy_info((pnf_info_t*)(config->user_data), req->header.phy_id);
+
+		if(req->nfapi_config.p7_vnf_port.tl.tag == NFAPI_NFAPI_P7_VNF_PORT_TAG)
+		{
+			phy_info->vnf_p7_port = req->nfapi_config.p7_vnf_port.value;
+			printf("vnf_p7_port %d\n", phy_info->vnf_p7_port);
+		}
+
+		if(req->nfapi_config.p7_vnf_address_ipv4.tl.tag == NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG)
+		{
+			struct sockaddr_in addr;
+			memcpy(&addr.sin_addr.s_addr, req->nfapi_config.p7_vnf_address_ipv4.address, 4);
+			char* ip = inet_ntoa(addr.sin_addr);
+			phy_info->vnf_p7_addr = ip;
+			printf("vnf_p7_addr %s\n", phy_info->vnf_p7_addr);
+		}
+
+			
+	}
+
+	nfapi_config_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_CONFIG_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_config_resp(config, &resp);
+	return 0;
+}
+int test_dl_config_req(nfapi_pnf_p7_config_t* config, nfapi_dl_config_request_t* req)
+{
+	printf("test_dl_config_req called.... ;-)\n");
+	return 0;
+}
+
+int test_ul_config_req(nfapi_pnf_p7_config_t* config, nfapi_ul_config_request_t* req)
+{
+	printf("test_ul_config_req called.... ;-)\n");
+	return 0;
+}
+int test_hi_dci0_req(nfapi_pnf_p7_config_t* config, nfapi_hi_dci0_request_t* req)
+{
+	printf("test_hi_dci0_req called.... ;-)\n");
+	return 0;
+}
+int test_tx_req(nfapi_pnf_p7_config_t* config, nfapi_tx_request_t* req)
+{
+	printf("test_tx_req called.... ;-)\n");
+	return 0;
+}
+int test_lbt_dl_config_req(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req)
+{
+	printf("test_lbt_dl_req called.... ;-)\n");
+	return 0;
+}
+int test_start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req)
+{
+	printf("test_start_request called.... ;-)\n");
+
+
+	if(config->user_data != 0)
+	{
+		phy_info_t* phy_info = find_phy_info((pnf_info_t*)(config->user_data), req->header.phy_id);
+
+		phy_info->config = nfapi_pnf_p7_config_create();
+		phy_info->config->local_p7_port = phy_info->pnf_p7_port;
+
+		phy_info->config->remote_p7_port = phy_info->vnf_p7_port;
+		phy_info->config->remote_p7_addr = phy_info->vnf_p7_addr;
+
+		phy_info->config->dl_config_req = &test_dl_config_req;
+		phy_info->config->ul_config_req = &test_ul_config_req;
+		phy_info->config->hi_dci0_req = &test_hi_dci0_req;
+		phy_info->config->tx_req = &test_tx_req;
+		phy_info->config->lbt_dl_config_req = &test_lbt_dl_config_req;
+
+		//phy_info->config->subframe_buffer_size = 8;
+		//phy_info->config->timing_info_mode_periodic = 1;
+		//phy_info->config->timing_info_period = 32;
+		//phy_info->config->timing_info_mode_aperiodic = 1;
+
+		phy_info->config->segment_size = 1400;
+		phy_info->config->checksum_enabled = 0;
+
+
+		pthread_create(&phy_info->thread, NULL, &pnf_test_start_p7_thread, phy_info->config);
+	}
+
+	nfapi_start_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_START_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_start_resp(config, &resp);
+	return 0;
+}
+int test_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_stop_request_t* req)
+{
+	printf("test_stop_request called.... ;-)\n");
+
+	nfapi_stop_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_STOP_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_stop_resp(config, &resp);
+	return 0;
+}
+
+int send_p5_message(int p5Sock, nfapi_p4_p5_message_header_t* msg, unsigned msg_size, struct sockaddr* addr, socklen_t addr_size)
+{
+	char buffer[256];
+	int encoded_size = nfapi_p5_message_pack(msg, msg_size, buffer, sizeof(buffer), 0);
+	int result  = sendto(p5Sock, buffer, encoded_size, 0, addr, addr_size);
+	return result;
+}
+
+int send_p7_message(int p7Sock, nfapi_p7_message_header_t* msg, unsigned msg_size, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	char buffer[256];
+	int encoded_size = nfapi_p7_message_pack(msg, buffer, sizeof(buffer), 0);
+	int result = sendto(p7Sock, buffer, encoded_size, 0, (struct sockaddr*)addr, addr_size);
+
+	printf("send_p7_message result %d\n", result);
+	return result;
+}
+int send_p7_segmented_message(int p7Sock, nfapi_p7_message_header_t* msg, unsigned msg_size, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	char buffer[1024 * 10];
+	int encoded_size = nfapi_p7_message_pack(msg, buffer, sizeof(buffer), 0);
+
+	uint16_t segment_size = 256;
+
+	if(encoded_size < segment_size)
+	{
+		int result = sendto(p7Sock, buffer, encoded_size, 0, (struct sockaddr*)addr, addr_size);
+		return result;
+	}
+	else
+	{
+	//	printf("Segmenting p7 message %d\n", encoded_size);
+
+		uint8_t segment_count = 0;
+		uint8_t buffer2[segment_size];
+		uint32_t offset = 0;
+		uint16_t msg_size;
+		//uint8_t m = 1;
+
+		do{
+
+			if(segment_count == 0)
+			{
+				msg_size = segment_size;
+				memcpy(&buffer2[0], &buffer[0], msg_size);
+				// M = 1
+				buffer2[6] = (1 << 7) | (segment_count & 0x7F);
+
+				offset = msg_size;
+			}
+			else
+			{
+				memcpy(&buffer2[0], &buffer[0], NFAPI_P7_HEADER_LENGTH);
+
+				if(encoded_size - offset > segment_size)
+				{
+					// M = 1
+					buffer2[6] = (1 << 7) | (segment_count & 0x7F);
+					msg_size = segment_size;
+				}
+				else
+				{
+					// M = 0
+					buffer2[6] = (0 << 7) | (segment_count & 0x7F);
+					msg_size = encoded_size - offset + NFAPI_P7_HEADER_LENGTH;
+				}
+
+
+				memcpy(&buffer2[NFAPI_P7_HEADER_LENGTH], &buffer[offset], msg_size - NFAPI_P7_HEADER_LENGTH);
+			
+				offset += msg_size - NFAPI_P7_HEADER_LENGTH;
+			}
+
+			uint8_t* p = &buffer2[4];
+			push16(msg_size, &p, &buffer2[segment_size]);
+
+		//printf("Segmenting p7 message %d %di %d\n", segment_count, msg_size, offset);
+			/*int result = */sendto(p7Sock, buffer2, msg_size, 0, (struct sockaddr*)addr, addr_size);
+
+			segment_count++;
+
+		}while(offset < encoded_size);
+
+	}
+
+	return 0;
+}
+int send_p7_segmented_message_outoforder(int p7Sock, nfapi_p7_message_header_t* msg, unsigned msg_size, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	char buffer[1024 * 10];
+	int encoded_size = nfapi_p7_message_pack(msg, buffer, sizeof(buffer), 0);
+
+	uint16_t segment_size = 256;
+
+	if(encoded_size < segment_size)
+	{
+		int result = sendto(p7Sock, buffer, encoded_size, 0, (struct sockaddr*)addr, addr_size);
+		return result;
+	}
+	else
+	{
+	//	printf("Segmenting p7 message %d\n", encoded_size);
+
+		uint8_t segment_count = 0;
+		uint8_t buffer2[128][segment_size];
+		uint32_t offset = 0;
+		uint16_t msg_size[128];
+		uint8_t i = 0;
+
+		do{
+
+			if(segment_count == 0)
+			{
+				msg_size[i] = segment_size;
+				memcpy(&buffer2[i][0], &buffer[0], msg_size[i]);
+				// M = 1
+				buffer2[i][6] = (1 << 7) | (segment_count & 0x7F);
+
+				offset = msg_size[i];
+			}
+			else
+			{
+				memcpy(&buffer2[i][0], &buffer[0], NFAPI_P7_HEADER_LENGTH);
+
+				if(encoded_size - offset > segment_size)
+				{
+					// M = 1
+					buffer2[i][6] = (1 << 7) | (segment_count & 0x7F);
+					msg_size[i] = segment_size;
+				}
+				else
+				{
+					// M = 0
+					buffer2[i][6] = (0 << 7) | (segment_count & 0x7F);
+					msg_size[i] = encoded_size - offset + NFAPI_P7_HEADER_LENGTH;
+				}
+
+
+				memcpy(&buffer2[i][NFAPI_P7_HEADER_LENGTH], &buffer[offset], msg_size[i] - NFAPI_P7_HEADER_LENGTH);
+			
+				offset += msg_size[i] - NFAPI_P7_HEADER_LENGTH;
+			}
+
+			uint8_t* p = &buffer2[i][4];
+			push16(msg_size[i], &p, &buffer2[i][segment_size]);
+
+
+			segment_count++;
+			i++;
+
+		}while(offset < encoded_size);
+
+		// send all odd then send event
+		uint8_t e = 0;
+		uint8_t o = 1;
+		while(o <= i)
+		{
+			sendto(p7Sock, &buffer2[o][0], msg_size[o], 0, (struct sockaddr*)addr, addr_size);
+			o += 2;
+		}
+		while(e <= i)
+		{
+			sendto(p7Sock, &buffer2[e][0], msg_size[e], 0, (struct sockaddr*)addr, addr_size);
+			e += 2;
+		}
+
+	}
+
+	return 0;
+}
+
+int get_p7_segmented_message(int p7Sock, nfapi_p7_message_header_t* msg, unsigned _msg_size, struct sockaddr_in* addr, socklen_t addr_size, uint8_t (buffer2)[][256], uint16_t msg_size[256], uint8_t i)
+{
+	char buffer[1024 * 10];
+	int encoded_size = nfapi_p7_message_pack(msg, buffer, sizeof(buffer), 0);
+
+	uint16_t segment_size = 256;
+
+	printf("get_p7_segmented_message size %d\n", encoded_size);
+
+	if(encoded_size < segment_size)
+	{
+		msg_size[i] = encoded_size;
+		memcpy(&buffer2[i][0], &buffer[0], msg_size[i]);
+		i++;
+	}
+	else
+	{
+		uint8_t segment_count = 0;
+		uint32_t offset = 0;
+
+		do{
+
+			if(segment_count == 0)
+			{
+				msg_size[i] = segment_size;
+				memcpy(&buffer2[i][0], &buffer[0], msg_size[i]);
+				// M = 1
+				(buffer2[i][6]) = (1 << 7) | (segment_count & 0x7F);
+
+				offset = msg_size[i];
+			}
+			else
+			{
+				memcpy(&buffer2[i][0], &buffer[0], NFAPI_P7_HEADER_LENGTH);
+
+				if(encoded_size - offset > segment_size)
+				{
+					// M = 1
+					(buffer2[i][6]) = (1 << 7) | (segment_count & 0x7F);
+					msg_size[i] = segment_size;
+				}
+				else
+				{
+					// M = 0
+					(buffer2[i][6]) = (0 << 7) | (segment_count & 0x7F);
+					msg_size[i] = encoded_size - offset + NFAPI_P7_HEADER_LENGTH;
+				}
+
+
+				memcpy(&buffer2[i][NFAPI_P7_HEADER_LENGTH], &buffer[offset], msg_size[i] - NFAPI_P7_HEADER_LENGTH);
+			
+				offset += msg_size[i] - NFAPI_P7_HEADER_LENGTH;
+			}
+
+			uint8_t* p = &buffer2[i][4];
+			push16(msg_size[i], &p, &buffer2[i][segment_size]);
+
+
+			segment_count++;
+			i++;
+
+		}while(offset < encoded_size);
+
+	}
+
+	return i;
+}
+
+
+int recv_p5_message(int p5Sock, nfapi_p4_p5_message_header_t* msg, unsigned msg_size)
+{
+	//struct sockaddr_in addr2;
+	//socklen_t addr2len;
+	char buffer2[1024];
+	int result2 = recv(p5Sock, buffer2, sizeof(buffer2), 0); //, (struct sockaddr*)&addr2, &addr2len); 
+
+	if(result2 == -1)
+	{
+		printf("%s recvfrom failed errno:%d\n", __FUNCTION__, errno);
+	}
+	else
+	{
+		/*int unpack_result =*/ nfapi_p5_message_unpack(buffer2, result2, msg, msg_size, 0); //, sizeof(resp));
+	}
+	return 0;
+}
+
+int recv_p7_message(int p7Sock, nfapi_p7_message_header_t* msg, unsigned msg_size)
+{
+	char buffer2[2560];
+	int result2 = recvfrom(p7Sock, buffer2, sizeof(buffer2), 0, 0, 0);
+
+	if(result2 == -1)
+	{
+		printf("%s recvfrom failed errno:%d\n", __FUNCTION__, errno);
+	}
+	else
+	{
+		/*int unpack_result =*/ nfapi_p7_message_unpack(buffer2, result2, msg, msg_size, 0); //, sizeof(resp));
+	}
+	return 0;
+}
+
+int send_pnf_param_request(int p5Sock, struct sockaddr* addr, socklen_t addr_size)
+{
+	printf("%s\n", __FUNCTION__);
+	nfapi_pnf_param_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
+	req.header.message_length = 0;
+
+	send_p5_message(p5Sock, &(req.header), sizeof(req), addr, addr_size);
+	return 0;
+}
+
+int receive_pnf_param_response(int p5Sock, uint8_t error_code)
+{
+	nfapi_pnf_param_response_t resp;
+	recv_p5_message(p5Sock, &(resp.header), sizeof(resp));
+
+		printf("0x%x\n", resp.header.message_id);
+	CU_ASSERT_EQUAL(resp.header.message_id, NFAPI_PNF_PARAM_RESPONSE);
+	if(resp.header.message_id == NFAPI_PNF_PARAM_RESPONSE)
+	{
+		printf("decoded nfapi_pnf_param_response\n");
+		CU_ASSERT_EQUAL(resp.error_code, error_code);
+		if(error_code == NFAPI_MSG_OK)
+		{
+			CU_ASSERT_EQUAL(resp.pnf_param_general.tl.tag, NFAPI_PNF_PARAM_GENERAL_TAG);
+			CU_ASSERT_EQUAL(resp.pnf_param_general.nfapi_sync_mode,  2);
+			CU_ASSERT_EQUAL(resp.pnf_param_general.location_mode, 1);
+		}
+	}
+	return 0;
+}
+
+int send_pnf_config_request(int p5Sock, struct sockaddr* addr, socklen_t addr_size)
+{
+	nfapi_pnf_config_request_t req;
+	req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
+	req.header.message_length = 0;
+
+	req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
+	req.pnf_phy_rf_config.number_phy_rf_config_info = 1;
+	req.pnf_phy_rf_config.phy_rf_config[0].phy_id = 0;
+
+	send_p5_message(p5Sock, &(req.header), sizeof(req), addr, addr_size);
+	return 0;
+}
+
+int receive_pnf_config_response(int p5Sock)
+{
+	nfapi_pnf_config_response_t resp;
+	recv_p5_message(p5Sock, &(resp.header), sizeof(resp));
+	
+	CU_ASSERT_EQUAL(resp.header.message_id, NFAPI_PNF_CONFIG_RESPONSE);
+	if(resp.header.message_id == NFAPI_PNF_CONFIG_RESPONSE)
+	{
+		printf("decoded nfapi_pnf_config_response\n");
+	}
+	return 0;
+}
+
+void send_pnf_start_request(int p5Sock,  struct sockaddr* addr, socklen_t addr_size)
+{
+	nfapi_pnf_start_request_t req;
+	req.header.message_id = NFAPI_PNF_START_REQUEST;
+	req.header.message_length = 0;
+
+	send_p5_message(p5Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+
+void receive_pnf_start_response(int p5Sock)
+{
+	nfapi_pnf_start_response_t resp;
+	recv_p5_message(p5Sock, &(resp.header), sizeof(resp));
+	
+	CU_ASSERT_EQUAL(resp.header.message_id, NFAPI_PNF_START_RESPONSE);
+	if(resp.header.message_id == NFAPI_PNF_START_RESPONSE)
+	{
+		printf("decoded nfapi_pnf_start_response\n");
+	}
+}
+
+void send_pnf_stop_request(int p5Sock,  struct sockaddr* addr, socklen_t addr_size)
+{
+	nfapi_pnf_stop_request_t req;
+	req.header.message_id = NFAPI_PNF_STOP_REQUEST;
+	req.header.message_length = 0;
+
+	send_p5_message(p5Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+
+void receive_pnf_stop_response(int p5Sock)
+{
+	nfapi_pnf_stop_response_t resp;
+	recv_p5_message(p5Sock, &(resp.header), sizeof(resp));
+	
+	CU_ASSERT_EQUAL(resp.header.message_id, NFAPI_PNF_STOP_RESPONSE);
+	if(resp.header.message_id == NFAPI_PNF_STOP_RESPONSE)
+	{
+		printf("decoded nfapi_pnf_stop_response\n");
+	}
+}
+
+void send_param_request(int p5Sock, int phy_id, struct sockaddr* addr, socklen_t addr_size)
+{
+	nfapi_param_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_PARAM_REQUEST;
+	req.header.phy_id = phy_id;
+
+	send_p5_message(p5Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+void receive_param_response(int p5Sock)
+{
+	nfapi_pnf_stop_response_t resp;
+	recv_p5_message(p5Sock, &(resp.header), sizeof(resp));
+	
+	CU_ASSERT_EQUAL(resp.header.message_id, NFAPI_PARAM_RESPONSE);
+	if(resp.header.message_id == NFAPI_PARAM_RESPONSE)
+	{
+		printf("decoded nfapi_param_response\n");
+	}
+}
+void send_config_request(int p5Sock, int phy_id, struct sockaddr* addr, socklen_t addr_size, pnf_info_t* pnf_info)
+{
+	nfapi_config_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_CONFIG_REQUEST;
+	req.header.phy_id = phy_id;
+
+	phy_info_t* phy_info = find_phy_info(pnf_info, phy_id);
+
+	req.nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
+	req.nfapi_config.p7_vnf_port.value = phy_info->vnf_p7_port;
+	req.num_tlv++;
+
+	//req.nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
+	//req.num_tlv++;
+
+	send_p5_message(p5Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+void receive_config_response(int p5Sock)
+{
+	nfapi_pnf_stop_response_t resp;
+	recv_p5_message(p5Sock, &(resp.header), sizeof(resp));
+	
+	CU_ASSERT_EQUAL(resp.header.message_id, NFAPI_CONFIG_RESPONSE);
+	if(resp.header.message_id == NFAPI_CONFIG_RESPONSE)
+	{
+		printf("decoded nfapi_config_response\n");
+	}
+}
+void send_start_request(int p5Sock, int phy_id, struct sockaddr* addr, socklen_t addr_size)
+{
+	nfapi_start_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_START_REQUEST;
+	req.header.phy_id = phy_id;
+
+	send_p5_message(p5Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+void receive_start_response(int p5Sock)
+{
+	nfapi_pnf_start_response_t resp;
+	recv_p5_message(p5Sock, &(resp.header), sizeof(resp));
+	
+	CU_ASSERT_EQUAL(resp.header.message_id, NFAPI_START_RESPONSE);
+	if(resp.header.message_id == NFAPI_START_RESPONSE)
+	{
+		printf("decoded nfapi_start_response\n");
+	}
+}
+void send_stop_request(int p5Sock, int phy_id, struct sockaddr* addr, socklen_t addr_size)
+{
+	nfapi_start_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_STOP_REQUEST;
+	req.header.phy_id = phy_id;
+
+	send_p5_message(p5Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+
+void receive_stop_response(int p5Sock)
+{
+	nfapi_pnf_stop_response_t resp;
+	recv_p5_message(p5Sock, &(resp.header), sizeof(resp));
+	
+	CU_ASSERT_EQUAL(resp.header.message_id, NFAPI_STOP_RESPONSE);
+	if(resp.header.message_id == NFAPI_STOP_RESPONSE)
+	{
+		printf("decoded nfapi_stop_response\n");
+	}
+}
+
+void send_dl_node_sync(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_dl_node_sync_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_DL_NODE_SYNC;
+	req.header.phy_id = phy_id;
+	req.t1 = 1977;
+	req.delta_sfn_sf = 5000;
+
+	send_p7_message(p7Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+void receive_ul_node_sync(int p7Sock)
+{
+	nfapi_ul_node_sync_t sync;
+	recv_p7_message(p7Sock, &(sync.header), sizeof(sync));
+	
+	CU_ASSERT_EQUAL(sync.header.message_id, NFAPI_UL_NODE_SYNC);
+	if(sync.header.message_id == NFAPI_UL_NODE_SYNC)
+	{
+		printf("decoded nfapi_ul_node_sync t1:%d t2:%d t3:%d\n",
+				sync.t1, sync.t2, sync.t3);
+	}
+}
+
+void receive_timing_info(int p7Sock)
+{
+	nfapi_timing_info_t timing_info;
+	recv_p7_message(p7Sock, &(timing_info.header), sizeof(timing_info));
+	
+	CU_ASSERT_EQUAL(timing_info.header.message_id, NFAPI_TIMING_INFO);
+	if(timing_info.header.message_id == NFAPI_TIMING_INFO)
+	{
+		printf("decoded nfapi_timing_info\n");
+	}
+	else
+	{
+		printf("decoded ?? 0x%x\n", timing_info.header.message_id);
+	}
+}
+void send_dl_config_req(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size, uint16_t sfn_sf)
+{
+	nfapi_dl_config_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
+	req.header.phy_id = phy_id;
+	req.sfn_sf = sfn_sf;
+
+	send_p7_message(p7Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+void send_ul_config_req(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size, uint16_t sfn_sf)
+{
+	nfapi_ul_config_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
+	req.header.phy_id = phy_id;
+	req.sfn_sf = sfn_sf;
+
+	send_p7_message(p7Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+void send_hi_dci0_req(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size, uint16_t sfn_sf)
+{
+	nfapi_hi_dci0_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_HI_DCI0_REQUEST;
+	req.header.phy_id = phy_id;
+	req.sfn_sf = sfn_sf;
+
+	send_p7_message(p7Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+void send_tx_req(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size, uint16_t sfn_sf)
+{
+	nfapi_tx_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_TX_REQUEST;
+	req.header.phy_id = phy_id;
+	req.sfn_sf = sfn_sf;
+	send_p7_message(p7Sock, &(req.header), sizeof(req), addr, addr_size);
+}
+
+void send_tx_req_1(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size, uint16_t sfn_sf)
+{
+	nfapi_tx_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_TX_REQUEST;
+	req.header.phy_id = phy_id;
+	req.sfn_sf = sfn_sf;
+	req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+	req.tx_request_body.number_of_pdus = 8;
+	req.tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)(malloc(sizeof(nfapi_tx_request_t) * 8));
+	uint8_t i = 0;
+	uint8_t test_pdu[1200];
+
+	for(i = 0; i < 8; i++)
+	{
+		req.tx_request_body.tx_pdu_list[i].pdu_length = sizeof(test_pdu);
+		req.tx_request_body.tx_pdu_list[i].pdu_index = i;
+		req.tx_request_body.tx_pdu_list[i].num_segments =1;
+		req.tx_request_body.tx_pdu_list[i].segments[0].segment_length = sizeof(test_pdu);
+		req.tx_request_body.tx_pdu_list[i].segments[0].segment_data  = (void*)&test_pdu;
+	}
+
+	send_p7_segmented_message(p7Sock, &(req.header), sizeof(req), addr, addr_size);
+
+	free(req.tx_request_body.tx_pdu_list);
+
+}
+
+void send_tx_req_2(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size, uint16_t sfn_sf)
+{
+	nfapi_tx_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_TX_REQUEST;
+	req.header.phy_id = phy_id;
+	req.sfn_sf = sfn_sf;
+	req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+	req.tx_request_body.number_of_pdus = 8;
+	req.tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)(malloc(sizeof(nfapi_tx_request_t) * 8));
+	uint8_t i = 0;
+	uint8_t test_pdu[1200];
+
+	for(i = 0; i < 8; i++)
+	{
+		req.tx_request_body.tx_pdu_list[i].pdu_length = sizeof(test_pdu);
+		req.tx_request_body.tx_pdu_list[i].pdu_index = i;
+		req.tx_request_body.tx_pdu_list[i].num_segments =1;
+		req.tx_request_body.tx_pdu_list[i].segments[0].segment_length = sizeof(test_pdu);
+		req.tx_request_body.tx_pdu_list[i].segments[0].segment_data  = (void*)&test_pdu;
+	}
+
+	send_p7_segmented_message_outoforder(p7Sock, &(req.header), sizeof(req), addr, addr_size);
+
+	free(req.tx_request_body.tx_pdu_list);
+
+}
+void send_dl_subframe_msgs_interleaved(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size, uint16_t sfn_sf)
+{
+
+	uint8_t buffer[256][256];
+	uint16_t msg_size[256];
+	uint16_t count = 0;
+
+	{
+		nfapi_dl_config_request_t req;
+		memset(&req, 0, sizeof(req));
+		req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
+		req.header.phy_id = phy_id;
+		req.header.m_segment_sequence = 34;
+		req.sfn_sf = sfn_sf;
+		req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+		req.dl_config_request_body.number_pdu = 8;
+		req.dl_config_request_body.dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)malloc(sizeof(nfapi_dl_config_request_pdu_t) * 8);
+
+		uint8_t i = 0;
+		for(i = 0; i < 8; i++)
+		{
+			nfapi_dl_config_request_pdu_t* pdu = &(req.dl_config_request_body.dl_config_pdu_list[i]);
+			pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+			pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+		}
+
+
+		count = get_p7_segmented_message(p7Sock, &(req.header), sizeof(req), addr, addr_size, buffer, msg_size, count);
+	}
+
+	{
+		nfapi_ul_config_request_t req;
+		memset(&req, 0, sizeof(req));
+		req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
+		req.header.phy_id = phy_id;
+		req.header.m_segment_sequence = 35;
+		req.sfn_sf = sfn_sf;
+
+		count = get_p7_segmented_message(p7Sock, &(req.header), sizeof(req), addr, addr_size, buffer, msg_size, count);
+	}
+
+	{
+		nfapi_hi_dci0_request_t req;
+		memset(&req, 0, sizeof(req));
+		req.header.message_id = NFAPI_HI_DCI0_REQUEST;
+		req.header.phy_id = phy_id;
+		req.header.m_segment_sequence = 36;
+		req.sfn_sf = sfn_sf;
+		count = get_p7_segmented_message(p7Sock, &(req.header), sizeof(req), addr, addr_size, buffer, msg_size, count);
+	}
+
+	{
+		nfapi_tx_request_t req;
+		memset(&req, 0, sizeof(req));
+		req.header.message_id = NFAPI_TX_REQUEST;
+		req.header.phy_id = phy_id;
+		req.header.m_segment_sequence = 37;
+		req.sfn_sf = sfn_sf;
+		req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+		req.tx_request_body.number_of_pdus = 8;
+		req.tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)(malloc(sizeof(nfapi_tx_request_t) * 8));
+		uint8_t i = 0;
+		uint8_t test_pdu[1200];
+
+		for(i = 0; i < 8; i++)
+		{
+			req.tx_request_body.tx_pdu_list[i].pdu_length = sizeof(test_pdu);
+			req.tx_request_body.tx_pdu_list[i].pdu_index = i;
+			req.tx_request_body.tx_pdu_list[i].num_segments =1;
+			req.tx_request_body.tx_pdu_list[i].segments[0].segment_length = sizeof(test_pdu);
+			req.tx_request_body.tx_pdu_list[i].segments[0].segment_data  = (void*)&test_pdu;
+		}
+
+		count = get_p7_segmented_message(p7Sock, &(req.header), sizeof(req), addr, addr_size, buffer, msg_size, count);
+	}
+
+	// send all odd then send event
+	uint8_t e = 0;
+	uint8_t o = 1;
+	while(o <= count)
+	{
+		if(msg_size[o] == 0)
+			printf("**** Sending a zero length msg %d\n", o);
+		sendto(p7Sock, &buffer[o][0], msg_size[o], 0, (struct sockaddr*)addr, addr_size);
+		o += 2;
+	}
+	while(e <= count)
+	{
+		if(msg_size[e] == 0)
+			printf("**** Sending a zero length msg %d\n", e);
+
+		sendto(p7Sock, &buffer[e][0], msg_size[e], 0, (struct sockaddr*)addr, addr_size);
+		e += 2;
+	}
+	//free(req.tx_request_body.tx_pdu_list);
+}
+
+void send_subframe_indication(phy_info_t* phy_info)
+{
+	nfapi_pnf_p7_subframe_ind(phy_info->config, phy_info->phy_id, phy_info->sfn_sf);
+}
+
+void send_harq_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_harq_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_HARQ_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_harq_ind((phy_info->config), &ind);
+}
+void recieve_harq_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_harq_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_HARQ_INDICATION);
+	if(ind.header.message_id == NFAPI_HARQ_INDICATION)
+	{
+		printf("decoded nfapi_harq_indication\n");
+	}
+	else
+	{
+		printf("decoded ?? 0x%x\n", ind.header.message_id);
+	}
+}
+
+void send_crc_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_crc_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_CRC_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_crc_ind((phy_info->config), &ind);
+
+}
+void recieve_crc_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_crc_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_CRC_INDICATION);
+	if(ind.header.message_id == NFAPI_CRC_INDICATION)
+	{
+		printf("decoded nfapi_crc_indication\n");
+	}
+}
+
+void send_rx_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_rx_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_RX_ULSCH_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_rx_ind((phy_info->config), &ind);
+}
+void recieve_rx_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_rx_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_RX_ULSCH_INDICATION);
+	if(ind.header.message_id == NFAPI_RX_ULSCH_INDICATION)
+	{
+		printf("decoded nfapi_rx_indication\n");
+	}
+}
+
+void send_rach_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_rach_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_RACH_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_rach_ind((phy_info->config), &ind);
+}
+void recieve_rach_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_rach_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_RACH_INDICATION);
+	if(ind.header.message_id == NFAPI_RACH_INDICATION)
+	{
+		printf("decoded nfapi_rach_indication\n");
+	}
+}
+
+void send_srs_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_srs_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_SRS_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_srs_ind((phy_info->config), &ind);
+}
+void recieve_srs_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_srs_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_SRS_INDICATION);
+	if(ind.header.message_id == NFAPI_SRS_INDICATION)
+	{
+		printf("decoded nfapi_srs_indication\n");
+	}
+}
+
+void send_sr_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_sr_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_RX_SR_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_sr_ind((phy_info->config), &ind);
+}
+void recieve_sr_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_sr_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_RX_SR_INDICATION);
+	if(ind.header.message_id == NFAPI_RX_SR_INDICATION)
+	{
+		printf("decoded nfapi_sr_indication\n");
+	}
+}
+
+void send_cqi_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_cqi_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_RX_CQI_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_cqi_ind((phy_info->config), &ind);
+}
+void recieve_cqi_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_cqi_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_RX_CQI_INDICATION);
+	if(ind.header.message_id == NFAPI_RX_CQI_INDICATION)
+	{
+		printf("decoded nfapi_cqi_indication\n");
+	}
+}
+
+void send_lbt_dl_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_lbt_dl_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_LBT_DL_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_lbt_dl_ind((phy_info->config), &ind);
+}
+void recieve_lbt_dl_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_lbt_dl_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_LBT_DL_INDICATION);
+	if(ind.header.message_id == NFAPI_LBT_DL_INDICATION)
+	{
+		printf("decoded nfapi_lbt_dl_indication\n");
+	}
+}
+
+void send_nb_harq_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_nb_harq_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_NB_HARQ_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_nb_harq_ind((phy_info->config), &ind);
+}
+void recieve_nb_harq_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_nb_harq_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_NB_HARQ_INDICATION);
+	if(ind.header.message_id == NFAPI_NB_HARQ_INDICATION)
+	{
+		printf("decoded nfapi_nb_harq_indication\n");
+	}
+}
+
+void send_nrach_ind(phy_info_t* phy_info, uint16_t sfn_sf)
+{
+	nfapi_nrach_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_NRACH_INDICATION;
+	ind.header.phy_id = phy_info->phy_id;
+	ind.sfn_sf = sfn_sf;
+
+	nfapi_pnf_p7_nrach_ind((phy_info->config), &ind);
+}
+void recieve_nrach_ind(int p7Sock, int phy_id, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_nrach_indication_t ind;
+	recv_p7_message(p7Sock, &(ind.header), sizeof(ind));
+	
+	CU_ASSERT_EQUAL(ind.header.message_id, NFAPI_NRACH_INDICATION);
+	if(ind.header.message_id == NFAPI_NRACH_INDICATION)
+	{
+		printf("decoded nfapi_nrach_indication\n");
+	}
+}
+
+void pnf_test_start_connect(void) 
+{
+	pnf_info_t pnf_info;
+	pnf_info.num_phys = 1;
+	pnf_info.phys[0].pnf_p7_port = 9345;
+	pnf_info.phys[0].pnf_p7_addr = "127.0.0.1";
+	pnf_info.phys[0].vnf_p7_port = 8875;
+	pnf_info.phys[0].vnf_p7_addr = "127.0.0.1";
+
+	char* vnf_addr = "127.0.0.1";
+	int vnf_port = 6699;
+	
+	int p5ListenSock = create_p5_listen_socket(vnf_addr, vnf_port);
+	printf("p5ListenSock %d %d\n", p5ListenSock, errno);
+	listen(p5ListenSock, 2);
+
+	test_param_request_called = 0;
+	test_config_request_called = 0;
+
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+	config->vnf_p5_port = vnf_port;
+	config->pnf_param_req = &test_pnf_param_request;
+	config->pnf_config_req = &test_pnf_config_request;
+	config->pnf_start_req = &test_pnf_start_request;
+	config->pnf_stop_req = &test_pnf_stop_request;
+	config->param_req = &test_param_request;
+	config->config_req = &test_config_request;
+	config->start_req = &test_start_request;
+	config->stop_req = &test_stop_request;
+
+	config->user_data = &pnf_info;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	struct sockaddr_in addr;
+	socklen_t addrSize = sizeof(addr);;
+	int	p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+	printf("p5 connection accepted %d %d\n", p5Sock, errno);
+
+	send_pnf_param_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_param_response(p5Sock, NFAPI_MSG_OK);
+
+	send_pnf_config_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_config_response(p5Sock);
+	
+	send_pnf_start_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_start_response(p5Sock);
+
+	send_param_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_param_response(p5Sock);
+	
+
+	send_config_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize, &pnf_info);
+	receive_config_response(p5Sock);
+
+	send_start_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_start_response(p5Sock);
+
+	sleep(2);
+
+	int p7Sock = socket(AF_INET, SOCK_DGRAM, 0);
+
+	{
+		struct sockaddr_in addr;
+		addr.sin_family = AF_INET;
+		addr.sin_port = htons(pnf_info.phys[0].vnf_p7_port);
+		addr.sin_addr.s_addr = INADDR_ANY;
+
+		bind(p7Sock, (struct sockaddr*)&addr, sizeof(addr));
+	}
+
+	printf("Sending p7 messages too %s:%d\n", pnf_info.phys[0].pnf_p7_addr, pnf_info.phys[0].pnf_p7_port);
+
+	struct sockaddr_in p7_addr;
+	p7_addr.sin_family = AF_INET;
+	p7_addr.sin_port = htons(pnf_info.phys[0].pnf_p7_port);
+	p7_addr.sin_addr.s_addr = inet_addr(pnf_info.phys[0].pnf_p7_addr);
+	socklen_t p7_addrSize = sizeof(p7_addr);
+
+	send_dl_node_sync(p7Sock, 0, &p7_addr, p7_addrSize);
+	receive_ul_node_sync(p7Sock);
+
+
+#define SFNSF(_sfn, _sf) ((_sfn << 4) + _sf)
+
+	uint16_t sfn_sf = SFNSF(500, 3); // sfn:500 sf:3
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+	send_subframe_indication(&(pnf_info.phys[0]));
+
+	// should generate dummy messages
+
+	usleep(500);
+
+	sfn_sf = SFNSF(500, 4); // sfn:500 sf:4
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+
+	send_dl_config_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_ul_config_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_hi_dci0_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_tx_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+
+
+	usleep(500);
+
+	send_subframe_indication(&(pnf_info.phys[0]));
+	// should send the cached messages
+
+	send_harq_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_harq_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_crc_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_crc_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_rx_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_rx_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_rach_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_rach_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_srs_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_srs_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_sr_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_sr_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_cqi_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_cqi_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_lbt_dl_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_lbt_dl_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_nb_harq_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_nb_harq_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_nrach_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_nrach_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+
+	// send out of window dl_config, should expect the timing info
+	send_dl_config_req(p7Sock, 0, &p7_addr, p7_addrSize, SFNSF(600, 0));
+
+	sfn_sf = SFNSF(500, 5); // sfn:500 sf:4
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+	usleep(500);
+
+	send_subframe_indication(&(pnf_info.phys[0]));
+	receive_timing_info(p7Sock);
+
+	send_stop_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_stop_response(p5Sock);
+
+
+
+	send_pnf_stop_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_stop_response(p5Sock);
+
+	nfapi_pnf_stop(config);
+
+	int* result;
+	pthread_join(thread, (void**)&result);
+	//CU_ASSERT_NOT_EQUAL(*result, -1);
+	CU_ASSERT_EQUAL(test_param_request_called, 1);
+	CU_ASSERT_EQUAL(test_config_request_called, 1);
+
+	close(p5Sock);
+	close(p5ListenSock);
+
+}
+void pnf_test_start_connect_ipv6(void) 
+{
+	pnf_info_t pnf_info;
+	pnf_info.num_phys = 1;
+	pnf_info.phys[0].pnf_p7_port = 9345;
+	pnf_info.phys[0].pnf_p7_addr = "::1";
+	pnf_info.phys[0].vnf_p7_port = 8875;
+	pnf_info.phys[0].vnf_p7_addr = "::1";
+
+	char* vnf_addr = "::1";
+	int vnf_port = 6698;
+	
+	int p5ListenSock = create_p5_ipv6_listen_socket(vnf_addr, vnf_port);
+	printf("p5ListenSock ipv6 %d %d\n", p5ListenSock, errno);
+	int listen_result = listen(p5ListenSock, 2);
+	printf("Listen result %d\n", listen_result);
+
+	test_param_request_called = 0;
+	test_config_request_called = 0;
+
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+	config->vnf_p5_port = vnf_port;
+	config->pnf_param_req = &test_pnf_param_request;
+	config->pnf_config_req = &test_pnf_config_request;
+	config->pnf_start_req = &test_pnf_start_request;
+	config->pnf_stop_req = &test_pnf_stop_request;
+	config->param_req = &test_param_request;
+	config->config_req = &test_config_request;
+	config->start_req = &test_start_request;
+	config->stop_req = &test_stop_request;
+
+	config->user_data = &pnf_info;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	struct sockaddr_in6 addr;
+	socklen_t addrSize = sizeof(addr);;
+	int	p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+	printf("p5 connection accepted %d %d\n", p5Sock, errno);
+	
+	send_pnf_param_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_param_response(p5Sock, NFAPI_MSG_OK);
+
+	send_pnf_config_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_config_response(p5Sock);
+	
+	send_pnf_start_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_start_response(p5Sock);
+
+	send_param_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_param_response(p5Sock);
+}
+        
+void pnf_test_state_pnf_config_invalid_state()
+{
+	char* vnf_addr = "127.0.0.1";
+	int vnf_port = 4546;
+	
+	int p5ListenSock = create_p5_listen_socket(vnf_addr, vnf_port);
+
+	test_param_request_called = 0;
+	test_config_request_called = 0;
+
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+	config->vnf_p5_port = vnf_port;
+	config->pnf_param_req = &test_pnf_param_request;
+	config->pnf_config_req = &test_pnf_config_request;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	listen(p5ListenSock, 2);
+	struct sockaddr_in addr;
+	socklen_t addrSize = sizeof(addr);
+	int	p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+	printf("%s p5Sock %d errno %d\n", __FUNCTION__, p5Sock, errno);
+
+	send_pnf_param_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_param_response(p5Sock, NFAPI_MSG_OK);
+
+	send_pnf_config_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_config_response(p5Sock);
+
+	send_pnf_param_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_param_response(p5Sock, NFAPI_MSG_INVALID_STATE);
+	
+	nfapi_pnf_stop(config);
+
+	int* result;
+	pthread_join(thread, (void**)&result);
+	CU_ASSERT_EQUAL(result, 0);
+	CU_ASSERT_EQUAL(test_param_request_called, 1);
+	CU_ASSERT_EQUAL(test_config_request_called, 1);
+
+	close(p5Sock);
+	close(p5ListenSock);
+
+}
+
+void pnf_test_state_pnf_param_invalid_state()
+{
+	pnf_info_t pnf_info;
+
+	char* vnf_addr = "127.0.0.1";
+	int vnf_port = 4547;
+	
+	int p5ListenSock = create_p5_listen_socket(vnf_addr, vnf_port);
+
+	test_param_request_called = 0;
+	test_config_request_called = 0;
+
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+	config->vnf_p5_port = vnf_port;
+	config->pnf_param_req = &test_pnf_param_request;
+	config->pnf_config_req = &test_pnf_config_request;
+
+	config->user_data = &pnf_info;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	listen(p5ListenSock, 2);
+	struct sockaddr_in addr;
+	socklen_t addrSize = sizeof(addr);
+	int	p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+
+	send_pnf_param_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_param_response(p5Sock, NFAPI_MSG_OK);
+
+	send_pnf_config_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_config_response(p5Sock);
+
+	send_pnf_config_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_config_response(p5Sock);
+	
+	nfapi_pnf_stop(config);
+
+	int* result;
+	pthread_join(thread, (void**)&result);
+	CU_ASSERT_EQUAL(result, 0);
+	CU_ASSERT_EQUAL(test_param_request_called, 1);
+	CU_ASSERT_EQUAL(test_config_request_called, 2);
+
+	close(p5Sock);
+	close(p5ListenSock);
+
+}
+void pnf_test_p7_segmentation_test_1(void) 
+{
+	pnf_info_t pnf_info;
+	pnf_info.num_phys = 1;
+	pnf_info.phys[0].pnf_p7_port = 9348;
+	pnf_info.phys[0].pnf_p7_addr = "127.0.0.1";
+	pnf_info.phys[0].vnf_p7_port = 8878;
+	pnf_info.phys[0].vnf_p7_addr = "127.0.0.1";
+
+	char* vnf_addr = "127.0.0.1";
+	int vnf_port = 6699;
+	
+	int p5ListenSock = create_p5_listen_socket(vnf_addr, vnf_port);
+	printf("p5ListenSock %d %d\n", p5ListenSock, errno);
+	listen(p5ListenSock, 2);
+
+	test_param_request_called = 0;
+	test_config_request_called = 0;
+
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+	config->vnf_p5_port = vnf_port;
+	config->pnf_param_req = &test_pnf_param_request;
+	config->pnf_config_req = &test_pnf_config_request;
+	config->pnf_start_req = &test_pnf_start_request;
+	config->pnf_stop_req = &test_pnf_stop_request;
+	config->param_req = &test_param_request;
+	config->config_req = &test_config_request;
+	config->start_req = &test_start_request;
+	config->stop_req = &test_stop_request;
+
+	config->user_data = &pnf_info;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	struct sockaddr_in addr;
+	socklen_t addrSize = sizeof(addr);;
+	int	p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+	printf("p5 connection accepted %d %d\n", p5Sock, errno);
+
+	send_pnf_param_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_param_response(p5Sock, NFAPI_MSG_OK);
+
+	send_pnf_config_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_config_response(p5Sock);
+	
+	send_pnf_start_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_start_response(p5Sock);
+
+	send_param_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_param_response(p5Sock);
+	
+
+	send_config_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize, &pnf_info);
+	receive_config_response(p5Sock);
+
+	send_start_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_start_response(p5Sock);
+
+	sleep(2);
+
+	int p7Sock = socket(AF_INET, SOCK_DGRAM, 0);
+
+	{
+		struct sockaddr_in addr;
+		addr.sin_family = AF_INET;
+		addr.sin_port = htons(pnf_info.phys[0].vnf_p7_port);
+		addr.sin_addr.s_addr = INADDR_ANY;
+
+		bind(p7Sock, (struct sockaddr*)&addr, sizeof(addr));
+	}
+
+	printf("Sending p7 messages too %s:%d\n", pnf_info.phys[0].pnf_p7_addr, pnf_info.phys[0].pnf_p7_port);
+
+	struct sockaddr_in p7_addr;
+	p7_addr.sin_family = AF_INET;
+	p7_addr.sin_port = htons(pnf_info.phys[0].pnf_p7_port);
+	p7_addr.sin_addr.s_addr = inet_addr(pnf_info.phys[0].pnf_p7_addr);
+	socklen_t p7_addrSize = sizeof(p7_addr);
+
+	send_dl_node_sync(p7Sock, 0, &p7_addr, p7_addrSize);
+	receive_ul_node_sync(p7Sock);
+
+
+#define SFNSF(_sfn, _sf) ((_sfn << 4) + _sf)
+
+	uint16_t sfn_sf = SFNSF(500, 3); // sfn:500 sf:3
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+	send_subframe_indication(&(pnf_info.phys[0]));
+
+	// should generate dummy messages
+
+	usleep(500);
+
+	sfn_sf = SFNSF(500, 4); // sfn:500 sf:4
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+
+	send_dl_config_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_ul_config_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_hi_dci0_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_tx_req_1(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+
+
+	usleep(500);
+
+	send_subframe_indication(&(pnf_info.phys[0]));
+	// should send the cached messages
+
+	send_harq_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_harq_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_crc_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_crc_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_rx_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_rx_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_rach_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_rach_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_srs_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_srs_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_sr_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_sr_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_cqi_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_cqi_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_lbt_dl_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_lbt_dl_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_nb_harq_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_nb_harq_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_nrach_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_nrach_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+
+	// send out of window dl_config, should expect the timing info
+	send_dl_config_req(p7Sock, 0, &p7_addr, p7_addrSize, SFNSF(600, 0));
+
+	sfn_sf = SFNSF(500, 5); // sfn:500 sf:4
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+	usleep(500);
+
+	send_subframe_indication(&(pnf_info.phys[0]));
+	receive_timing_info(p7Sock);
+
+	nfapi_pnf_p7_stop(pnf_info.phys[0].config);
+	int* result;
+	pthread_join(pnf_info.phys[0].thread, (void**)&result);
+	close(p7Sock);
+
+	send_stop_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_stop_response(p5Sock);
+
+	send_pnf_stop_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_stop_response(p5Sock);
+
+	nfapi_pnf_stop(config);
+
+	pthread_join(thread, (void**)&result);
+	//CU_ASSERT_NOT_EQUAL(*result, -1);
+	CU_ASSERT_EQUAL(test_param_request_called, 1);
+	CU_ASSERT_EQUAL(test_config_request_called, 1);
+
+	close(p5Sock);
+	close(p5ListenSock);
+
+}
+void pnf_test_p7_segmentation_test_2(void) 
+{
+	pnf_info_t pnf_info;
+	pnf_info.num_phys = 1;
+	pnf_info.phys[0].pnf_p7_port = 9348;
+	pnf_info.phys[0].pnf_p7_addr = "127.0.0.1";
+	pnf_info.phys[0].vnf_p7_port = 8878;
+	pnf_info.phys[0].vnf_p7_addr = "127.0.0.1";
+
+	char* vnf_addr = "127.0.0.1";
+	int vnf_port = 6699;
+	
+	int p5ListenSock = create_p5_listen_socket(vnf_addr, vnf_port);
+	printf("p5ListenSock %d %d\n", p5ListenSock, errno);
+	listen(p5ListenSock, 2);
+
+	test_param_request_called = 0;
+	test_config_request_called = 0;
+
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+	config->vnf_p5_port = vnf_port;
+	config->pnf_param_req = &test_pnf_param_request;
+	config->pnf_config_req = &test_pnf_config_request;
+	config->pnf_start_req = &test_pnf_start_request;
+	config->pnf_stop_req = &test_pnf_stop_request;
+	config->param_req = &test_param_request;
+	config->config_req = &test_config_request;
+	config->start_req = &test_start_request;
+	config->stop_req = &test_stop_request;
+
+	config->user_data = &pnf_info;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	struct sockaddr_in addr;
+	socklen_t addrSize = sizeof(addr);;
+	int	p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+	printf("p5 connection accepted %d %d\n", p5Sock, errno);
+
+	send_pnf_param_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_param_response(p5Sock, NFAPI_MSG_OK);
+
+	send_pnf_config_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_config_response(p5Sock);
+	
+	send_pnf_start_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_start_response(p5Sock);
+
+	send_param_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_param_response(p5Sock);
+	
+
+	send_config_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize, &pnf_info);
+	receive_config_response(p5Sock);
+
+	send_start_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_start_response(p5Sock);
+
+	sleep(2);
+
+	int p7Sock = socket(AF_INET, SOCK_DGRAM, 0);
+
+	{
+		struct sockaddr_in addr;
+		addr.sin_family = AF_INET;
+		addr.sin_port = htons(pnf_info.phys[0].vnf_p7_port);
+		addr.sin_addr.s_addr = INADDR_ANY;
+
+		bind(p7Sock, (struct sockaddr*)&addr, sizeof(addr));
+	}
+
+	printf("Sending p7 messages too %s:%d\n", pnf_info.phys[0].pnf_p7_addr, pnf_info.phys[0].pnf_p7_port);
+
+	struct sockaddr_in p7_addr;
+	p7_addr.sin_family = AF_INET;
+	p7_addr.sin_port = htons(pnf_info.phys[0].pnf_p7_port);
+	p7_addr.sin_addr.s_addr = inet_addr(pnf_info.phys[0].pnf_p7_addr);
+	socklen_t p7_addrSize = sizeof(p7_addr);
+
+	send_dl_node_sync(p7Sock, 0, &p7_addr, p7_addrSize);
+	receive_ul_node_sync(p7Sock);
+
+
+#define SFNSF(_sfn, _sf) ((_sfn << 4) + _sf)
+
+	uint16_t sfn_sf = SFNSF(500, 3); // sfn:500 sf:3
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+	send_subframe_indication(&(pnf_info.phys[0]));
+
+	// should generate dummy messages
+
+	usleep(500);
+
+	sfn_sf = SFNSF(500, 4); // sfn:500 sf:4
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+
+	send_dl_config_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_ul_config_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_hi_dci0_req(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+	send_tx_req_2(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+
+
+	usleep(500);
+
+	send_subframe_indication(&(pnf_info.phys[0]));
+	// should send the cached messages
+
+	send_harq_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_harq_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_crc_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_crc_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_rx_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_rx_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_rach_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_rach_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_srs_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_srs_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_sr_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_sr_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_cqi_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_cqi_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_lbt_dl_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_lbt_dl_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	// send out of window dl_config, should expect the timing info
+	send_dl_config_req(p7Sock, 0, &p7_addr, p7_addrSize, SFNSF(600, 0));
+
+	sfn_sf = SFNSF(500, 5); // sfn:500 sf:4
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+	usleep(500);
+
+	send_subframe_indication(&(pnf_info.phys[0]));
+	receive_timing_info(p7Sock);
+
+	send_stop_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_stop_response(p5Sock);
+
+	nfapi_pnf_p7_stop(pnf_info.phys[0].config);
+	int* result;
+	pthread_join(pnf_info.phys[0].thread, (void**)&result);
+	close(p7Sock);
+
+
+	send_pnf_stop_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_stop_response(p5Sock);
+
+	nfapi_pnf_stop(config);
+
+	pthread_join(thread, (void**)&result);
+	//CU_ASSERT_NOT_EQUAL(*result, -1);
+	CU_ASSERT_EQUAL(test_param_request_called, 1);
+	CU_ASSERT_EQUAL(test_config_request_called, 1);
+
+	close(p5Sock);
+	close(p5ListenSock);
+
+}
+void pnf_test_p7_segmentation_test_3(void) 
+{
+	pnf_info_t pnf_info;
+	pnf_info.num_phys = 1;
+	pnf_info.phys[0].pnf_p7_port = 9348;
+	pnf_info.phys[0].pnf_p7_addr = "127.0.0.1";
+	pnf_info.phys[0].vnf_p7_port = 8878;
+	pnf_info.phys[0].vnf_p7_addr = "127.0.0.1";
+
+	char* vnf_addr = "127.0.0.1";
+	int vnf_port = 6699;
+	
+	int p5ListenSock = create_p5_listen_socket(vnf_addr, vnf_port);
+	printf("p5ListenSock %d %d\n", p5ListenSock, errno);
+	listen(p5ListenSock, 2);
+
+	test_param_request_called = 0;
+	test_config_request_called = 0;
+
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+	config->vnf_ip_addr = vnf_addr;
+	config->vnf_p5_port = vnf_port;
+	config->pnf_param_req = &test_pnf_param_request;
+	config->pnf_config_req = &test_pnf_config_request;
+	config->pnf_start_req = &test_pnf_start_request;
+	config->pnf_stop_req = &test_pnf_stop_request;
+	config->param_req = &test_param_request;
+	config->config_req = &test_config_request;
+	config->start_req = &test_start_request;
+	config->stop_req = &test_stop_request;
+
+	config->user_data = &pnf_info;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &pnf_test_start_thread, config);
+
+	struct sockaddr_in addr;
+	socklen_t addrSize = sizeof(addr);;
+	int	p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+	printf("p5 connection accepted %d %d\n", p5Sock, errno);
+
+	send_pnf_param_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_param_response(p5Sock, NFAPI_MSG_OK);
+
+	send_pnf_config_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_config_response(p5Sock);
+	
+	send_pnf_start_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_start_response(p5Sock);
+
+	send_param_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_param_response(p5Sock);
+	
+
+	send_config_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize, &pnf_info);
+	receive_config_response(p5Sock);
+
+	send_start_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_start_response(p5Sock);
+
+	sleep(2);
+
+	int p7Sock = socket(AF_INET, SOCK_DGRAM, 0);
+
+	{
+		struct sockaddr_in addr;
+		addr.sin_family = AF_INET;
+		addr.sin_port = htons(pnf_info.phys[0].vnf_p7_port);
+		addr.sin_addr.s_addr = INADDR_ANY;
+
+		bind(p7Sock, (struct sockaddr*)&addr, sizeof(addr));
+	}
+
+	printf("Sending p7 messages too %s:%d\n", pnf_info.phys[0].pnf_p7_addr, pnf_info.phys[0].pnf_p7_port);
+
+	struct sockaddr_in p7_addr;
+	p7_addr.sin_family = AF_INET;
+	p7_addr.sin_port = htons(pnf_info.phys[0].pnf_p7_port);
+	p7_addr.sin_addr.s_addr = inet_addr(pnf_info.phys[0].pnf_p7_addr);
+	socklen_t p7_addrSize = sizeof(p7_addr);
+
+	send_dl_node_sync(p7Sock, 0, &p7_addr, p7_addrSize);
+	receive_ul_node_sync(p7Sock);
+
+
+#define SFNSF(_sfn, _sf) ((_sfn << 4) + _sf)
+
+	uint16_t sfn_sf = SFNSF(500, 3); // sfn:500 sf:3
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+	send_subframe_indication(&(pnf_info.phys[0]));
+
+	// should generate dummy messages
+
+	usleep(500);
+
+	sfn_sf = SFNSF(500, 4); // sfn:500 sf:4
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+
+
+	send_dl_subframe_msgs_interleaved(p7Sock, 0, &p7_addr, p7_addrSize, sfn_sf);
+
+
+	usleep(500);
+
+	send_subframe_indication(&(pnf_info.phys[0]));
+	// should send the cached messages
+
+	send_harq_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_harq_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_crc_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_crc_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_rx_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_rx_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_rach_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_rach_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_srs_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_srs_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_sr_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_sr_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	send_cqi_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_cqi_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+	
+	send_lbt_dl_ind(&pnf_info.phys[0], sfn_sf);
+	recieve_lbt_dl_ind(p7Sock, 0, &p7_addr, p7_addrSize);
+
+	// send out of window dl_config, should expect the timing info
+	printf("Sending late dl config req\n");
+	send_dl_config_req(p7Sock, 0, &p7_addr, p7_addrSize, SFNSF(600, 0));
+
+	sfn_sf = SFNSF(500, 5); // sfn:500 sf:4
+	pnf_info.phys[0].sfn_sf = sfn_sf;
+	sleep(2);
+
+	printf("Sending subframe indication\n");
+	send_subframe_indication(&(pnf_info.phys[0]));
+	printf("Waitning for timing info\n");
+	receive_timing_info(p7Sock);
+
+	printf("Sending stop request\n");
+	send_stop_request(p5Sock, 0, (struct sockaddr*)&addr, addrSize);
+	receive_stop_response(p5Sock);
+
+	printf("Waiting for P7 thread to stop\n");
+	nfapi_pnf_p7_stop(pnf_info.phys[0].config);
+	int* result;
+	pthread_join(pnf_info.phys[0].thread, (void**)&result);
+	close(p7Sock);
+
+
+	send_pnf_stop_request(p5Sock, (struct sockaddr*)&addr, addrSize);
+	receive_pnf_stop_response(p5Sock);
+
+	nfapi_pnf_stop(config);
+
+	pthread_join(thread, (void**)&result);
+	//CU_ASSERT_NOT_EQUAL(*result, -1);
+	CU_ASSERT_EQUAL(test_param_request_called, 1);
+	CU_ASSERT_EQUAL(test_config_request_called, 1);
+
+	close(p5Sock);
+	close(p5ListenSock);
+
+}
+
+/************* Test Runner Code goes here **************/
+
+int main ( void )
+{
+   CU_pSuite pSuite = NULL;
+
+   /* initialize the CUnit test registry */
+   if ( CUE_SUCCESS != CU_initialize_registry() )
+      return CU_get_error();
+
+   /* add a suite to the registry */
+   pSuite = CU_add_suite( "pnf_test_suite", init_suite, clean_suite );
+   if ( NULL == pSuite ) {
+      CU_cleanup_registry();
+      return CU_get_error();
+   }
+
+   /* add the tests to the suite */
+   if ( (NULL == CU_add_test(pSuite, "pnf_test_start_no_config", pnf_test_start_no_config)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_start_no_ip", pnf_test_start_no_ip)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_start_invalid_ip", pnf_test_start_invalid_ip)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_start_no_connection", pnf_test_start_no_connection)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_start_connect", pnf_test_start_connect)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_start_pnf_config_invalid_state", pnf_test_state_pnf_config_invalid_state)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_start_pnf_param_invalid_state", pnf_test_state_pnf_param_invalid_state)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_p7_segmentation_test_1", pnf_test_p7_segmentation_test_1)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_p7_segmentation_test_2", pnf_test_p7_segmentation_test_2)) ||
+        (NULL == CU_add_test(pSuite, "pnf_test_p7_segmentation_test_3", pnf_test_p7_segmentation_test_3))
+		)
+   {
+      CU_cleanup_registry();
+      return CU_get_error();
+   }
+
+   //(NULL == CU_add_test(pSuite, "pnf_test_start_connect_ipv6", pnf_test_start_connect_ipv6)) ||
+
+   // Run all tests using the basic interface
+   CU_basic_set_mode(CU_BRM_VERBOSE);
+   CU_set_output_filename("pnf_unit_test_results.xml");
+   CU_basic_run_tests();
+
+	CU_pSuite s = CU_get_registry()->pSuite;
+	int count = 0;
+	while(s)
+	{
+		CU_pTest t = s->pTest;
+		while(t)
+		{
+			count++;
+			t = t->pNext;
+		}
+		s = s->pNext;
+	}
+
+	printf("%d..%d\n", 1, count);
+
+
+
+	s = CU_get_registry()->pSuite;
+	count = 1;
+	while(s)
+	{
+		CU_pTest t = s->pTest;
+		while(t)
+		{
+			int pass = 1;
+			CU_FailureRecord* failures = CU_get_failure_list();
+			while(failures)
+			{
+				if(strcmp(failures->pSuite->pName, s->pName) == 0 &&
+				   strcmp(failures->pTest->pName, t->pName) == 0)
+				{
+					pass = 0;
+					failures = 0;
+				}
+				else
+				{
+					failures = failures->pNext;
+				}
+			}
+
+			if(pass)
+				printf("ok %d - %s:%s\n", count, s->pName, t->pName);
+			else 
+				printf("not ok %d - %s:%s\n", count, s->pName, t->pName);
+
+			count++;
+			t = t->pNext;
+		}
+		s = s->pNext;
+	}
+
+   // Clean up registry and return 
+   CU_cleanup_registry();
+   return CU_get_error();
+
+}
diff --git a/nfapi/open-nFAPI/pnf_sim/Makefile.am b/nfapi/open-nFAPI/pnf_sim/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..c8d9d8ddd462bb29eb1666c994fe68febbe566b2
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf_sim/Makefile.am
@@ -0,0 +1,22 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+AUTOMAKE_OPTIONS=subdir-objects
+AM_CPPFLAGS = -I$(top_srcdir)/pnf_sim/inc -I$(top_srcdir)/sim_common/inc -I$(top_srcdir)/pnf/public_inc  -I$(top_srcdir)/common/inc -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/nfapi/public_inc -I$(top_srcdir)/nfapi/inc $(XML_CFLAGS) -g
+AM_CXXFLAGS = -I$(top_srcdir)/pnf_sim/inc -I$(top_srcdir)/sim_common/inc -I$(top_srcdir)/pnf/public_inc  -I$(top_srcdir)/common/inc -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/nfapi/public_inc -I$(top_srcdir)/nfapi/inc $(XML_CFLAGS) -std=c++11 $(BOOST_CPPFLAGS) -g
+bin_PROGRAMS = pnfsim
+pnfsim_SOURCES = src/main.cpp src/fapi_stub.cpp
+LDADD= $(top_builddir)/pnf/libnfapi_pnf.a $(top_builddir)/common/libnfapi_common.a $(top_builddir)/nfapi/libnfapi.a $(top_builddir)/sim_common/libnfapi_sim_common.a -L$(libdir) -lpthread -lrt -lsctp  -lz 
diff --git a/nfapi/open-nFAPI/pnf_sim/inc/fapi_interface.h b/nfapi/open-nFAPI/pnf_sim/inc/fapi_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1d44eab8b0c714e5b764c8edff7819ae6dbc928
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf_sim/inc/fapi_interface.h
@@ -0,0 +1,1800 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef _FAPI_INTERFACE_H_
+#define _FAPI_INTERFACE_H_
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef signed char		int8_t;
+typedef unsigned char	uint8_t;
+typedef signed short	int16_t;
+typedef unsigned short	uint16_t;
+typedef signed int		int32_t;
+typedef unsigned int	uint32_t;
+
+#define FAPI_PARAM_REQUEST									0x00
+#define FAPI_PARAM_RESPONSE									0x01
+#define FAPI_CONFIG_REQUEST									0x02
+#define FAPI_CONFIG_RESPONSE								0x03
+#define FAPI_START_REQUEST									0x04
+#define FAPI_STOP_REQUEST									0x05
+#define FAPI_STOP_INDICATION								0x06
+#define FAPI_UE_CONFIG_REQUEST								0x07
+#define FAPI_UE_CONFIG_RESPONSE								0x08
+#define FAPI_ERROR_INDICATION								0x09
+#define FAPI_UE_RELEASE_REQUEST								0x0A
+#define FAPI_UE_RELEASE_RESPONSE							0x0B
+#define FAPI_DL_CONFIG_REQUEST								0x80
+#define FAPI_UL_CONFIG_REQUEST								0x81
+#define FAPI_SUBFRAME_INDICATION							0x82
+#define FAPI_HI_DCI0_REQUEST								0x83
+#define FAPI_TX_REQUEST										0x84
+#define FAPI_HARQ_INDICATION								0x85
+#define FAPI_CRC_INDICATION									0x86
+#define FAPI_RX_ULSCH_INDICATION							0x87
+#define FAPI_RACH_INDICATION								0x88
+#define FAPI_SRS_INDICATION									0x89
+#define FAPI_RX_SR_INDICATION								0x8A
+#define FAPI_RX_CQI_INDICATION								0x8B
+#define FAPI_LBT_DL_CONFIG_REQUEST							0x8C
+#define FAPI_LBT_DL_INDICATION								0x8D
+#define FAPI_NB_HARQ_INDICATION								0x8E
+#define FAPI_NRACH_INDICATION								0x8F
+
+
+
+
+#define FAPI_SUBFRAME_DUPLEX_MODE_TAG						0x01
+#define FAPI_SUBFRAME_PCFICH_POWER_OFFSET_TAG				0x02
+#define FAPI_SUBFRAME_PB_TAG								0x03
+#define FAPI_SUBFRAME_DL_CYCLIC_PREFIX_TYPE_TAG				0x04
+#define FAPI_SUBFRAME_UL_CYCLIC_PREFIX_TYPE_TAG				0x05
+#define FAPI_RF_DL_CHANNEL_BANDWIDTH_TAG					0x0A
+#define FAPI_RF_UL_CHANNEL_BANDWIDTH_TAG					0x0B
+#define FAPI_RF_REFERENCE_SIGNAL_POWER_TAG					0x0C
+#define FAPI_RF_TX_ANTENNA_PORTS_TAG						0x0D
+#define FAPI_RF_RX_ANTENNA_PORTS_TAG						0x0E
+#define FAPI_PHICH_RESOURCE_TAG								0x14
+#define FAPI_PHICH_DURATION_TAG								0x15
+#define FAPI_PHICH_POWER_OFFSET_TAG							0x16
+#define FAPI_SCH_PRIMARY_SYNC_SIGNAL_TAG					0x1E
+#define FAPI_SCH_SECONDARY_SYNC_SIGNAL_TAG					0x1F
+#define FAPI_SCH_PHYSICAL_CELL_ID_TAG						0x20
+#define FAPI_PRACH_CONFIGURATION_INDEX_TAG					0x28
+#define FAPI_PRACH_ROOT_SEQUENCE_INDEX_TAG					0x29
+#define FAPI_PRACH_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG	0x2A
+#define FAPI_PRACH_HIGH_SPEED_FLAG_TAG						0x2B
+#define FAPI_PRACH_FREQUENCY_OFFSET_TAG						0x2C
+#define FAPI_PUSCH_HOPPING_MODE_TAG							0x32
+#define FAPI_PUSCH_HOPPING_OFFSET_TAG						0x33
+#define FAPI_PUSCH_NUMBER_OF_SUBBANDS_TAG					0x34
+#define FAPI_PUCCH_DELTA_PUCCH_SHIFT_TAG					0x3C
+#define FAPI_PUCCH_N_CQI_RB_TAG								0x3D
+#define FAPI_PUCCH_N_AN_CS_TAG								0x3E
+#define FAPI_PUCCH_N1_PUCCH_AN_TAG							0x3F
+#define FAPI_SRS_BANDWIDTH_CONFIGURATION_TAG				0x46
+#define FAPI_SRS_MAX_UP_PTS_TAG								0x47
+#define FAPI_SRS_SUBFRAME_CONFIGURATION_TAG					0x48
+#define FAPI_SRS_ACK_NACK_SRS_SIMULTANEOUS_TX_TAG			0x49
+#define FAPI_UL_REF_SIG_UPLINK_RS_HOPPING_TAG				0x50
+#define FAPI_UL_REF_SIG_GROUP_ASSIGNMENT_TAG				0x51
+#define FAPI_UL_REF_SIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG			0x52
+#define FAPI_TDD_SUBFRAME_ASSIGNMENT_TAG					0x5A
+#define FAPI_TDD_SPECIAL_SUBFRAME_PATTERNS_TAG				0x5B
+
+#define FAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG	0x64
+#define FAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG	0x65
+#define FAPI_LAA_CONFIG_PD_THRESHOLD_TAG					0x66
+#define FAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG				0x67
+#define FAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG				0x68
+#define FAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG			0x69
+#define FAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG		0x6A
+#define FAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG		0x6B
+
+#define FAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLED_R13_TAG						0x78
+#define FAPI_EMTC_CONFIG_PRACH_CAT_M_ROOT_SEQUENCY_INDEX_TAG					0x79
+#define FAPI_EMTC_CONFIG_PRACH_CAT_M_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG	0x7A
+#define FAPI_EMTC_CONFIG_PRACH_CAT_M_HIGH_SPEED_FLAG_TAG						0x7B
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG							0x7C
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG				0x7D
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG					0x7E
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG	0x7F
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG		0x80
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG					0x81
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG					0x82
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG							0x83
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG				0x84
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG					0x85
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG	0x86
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG		0x87
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG					0x88
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG					0x89
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG							0x8A
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG				0x8B
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG					0x8C
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG	0x8D
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG		0x8E
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG					0x8F
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG					0x90
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG							0x91
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG				0x92
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG					0x93
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG	0x94
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG		0x95
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG					0x96
+#define FAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG					0x97
+#define FAPI_EMTC_CONFIG_PRACH_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG	0x98
+#define FAPI_EMTC_CONFIG_PRACH_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG	0x99
+
+#define FAPI_NB_IOT_OPERATING_MODE_TAG											0xA5
+#define FAPI_NB_IOT_ANCHOR_TAG													0xA6
+#define FAPI_NB_IOT_PRB_INDEX_TAG												0xA7
+#define FAPI_NB_IOT_CONTROL_REGION_SIZE_TAG										0xA8
+#define FAPI_NB_IOT_ASSUMED_CRS_APS_TAG											0xA9
+#define FAPI_NB_IOT_NPRACH_CONFIG_0_ENABLE_TAG									0xAA
+#define FAPI_NB_IOT_NPRACH_CONFIG_0_SF_PERIODCITY_TAG							0xAB
+#define FAPI_NB_IOT_NPRACH_CONFIG_0_START_TIME_TAG								0xAC
+#define FAPI_NB_IOT_NPRACH_CONFIG_0_SUBCARRIER_OFFSET_TAG						0xAD
+#define FAPI_NB_IOT_NPRACH_CONFIG_0_NUMBER_OF_SUBCARRIERS_TAG					0xAE
+#define FAPI_NB_IOT_NPRACH_CONFIG_0_CP_LENGTH_TAG								0xAD
+#define FAPI_NB_IOT_NPRACH_CONFIG_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG		0xB0
+#define FAPI_NB_IOT_NPRACH_CONFIG_1_ENABLE_TAG									0xB1
+#define FAPI_NB_IOT_NPRACH_CONFIG_1_SF_PERIODCITY_TAG							0xB2
+#define FAPI_NB_IOT_NPRACH_CONFIG_1_START_TIME_TAG								0xB3
+#define FAPI_NB_IOT_NPRACH_CONFIG_1_SUBCARRIER_OFFSET_TAG						0xB4
+#define FAPI_NB_IOT_NPRACH_CONFIG_1_NUMBER_OF_SUBCARRIERS_TAG					0xB5
+#define FAPI_NB_IOT_NPRACH_CONFIG_1_CP_LENGTH_TAG								0xB6
+#define FAPI_NB_IOT_NPRACH_CONFIG_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG		0xB7
+#define FAPI_NB_IOT_NPRACH_CONFIG_2_ENABLE_TAG									0xB8
+#define FAPI_NB_IOT_NPRACH_CONFIG_2_SF_PERIODCITY_TAG							0xB9
+#define FAPI_NB_IOT_NPRACH_CONFIG_2_START_TIME_TAG								0xBA
+#define FAPI_NB_IOT_NPRACH_CONFIG_2_SUBCARRIER_OFFSET_TAG						0xBB
+#define FAPI_NB_IOT_NPRACH_CONFIG_2_NUMBER_OF_SUBCARRIERS_TAG					0xBC
+#define FAPI_NB_IOT_NPRACH_CONFIG_2_CP_LENGTH_TAG								0xBD
+#define FAPI_NB_IOT_NPRACH_CONFIG_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG		0xBE
+
+#define FAPI_NB_IOT_THREE_TONE_BASE_SEQUENCE_TAG			0xBF
+#define FAPI_NB_IOT_SIX_TONE_BASE_SEQUENCE_TAG				0xC0
+#define FAPI_NB_IOT_TWELVE_TONE_BASE_SEQUENCE_TAG			0xC1
+#define FAPI_NB_IOT_THREE_TONE_CYCLIC_SHIFT_TAG				0xC2
+#define FAPI_NB_IOT_SIX_TONE_CYCLIC_SHIFT_TAG				0xC3
+#define FAPI_NB_IOT_DL_GAP_CONFIG_ENABLE_TAG				0xC4
+#define FAPI_NB_IOT_DL_GAP_THRESHOLD_TAG					0xC5
+#define FAPI_NB_IOT_DL_GAP_PERIODICITY_TAG					0xC6
+#define FAPI_NB_IOT_DL_GAP_DURATION_COEFFICIENT_TAG			0xC7
+
+//...
+#define FAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG		0xC8
+#define FAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG		0xC9
+#define FAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG		0xCA
+#define FAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG		0xCB
+#define FAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG	0xCC
+#define FAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG		0xCD
+#define FAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG			0xCE
+#define FAPI_PHY_CAPABILITIES_LAA_SUPPORT_TAG				0xD1
+#define FAPI_PHY_CAPABILITIES_LAA_PD_SENSING_LBT_SUPPORT_TAG 0xD2
+#define FAPI_PHY_CAPABILITIES_LAA_MULTI_CARRIER_LBT_SUPPORT_TAG	0xD3
+#define FAPI_PHY_CAPABILITIES_LAA_PARTIAL_SF_SUPPORT_TAG	0xD4
+#define FAPI_PHY_CAPABILITIES_NB_IOT_SUPPORT_TAG			0xD5
+#define FAPI_PHY_CAPABILITIES_NB_IOT_OPERATING_MODE_CAPABILITY_TAG 0xD6
+
+#define FAPI_PHY_CAPABILITIES_DATA_REPORT_MODE_TAG			0xF0
+#define FAPI_PHY_SFN_SF_TAG									0xF1
+#define FAPI_PHY_STATE_TAG									0xFA
+
+#define FAPI_MSG_OK											0x0
+#define FAPI_MSG_INVALID_STATE								0x1
+#define FAPI_MSG_INVALID_CONFIG								0x2
+#define FAPI_MSG_SFN_OUT_OF_SYNC							0x3
+#define FAPI_MSG_SUBFRAME_ERR								0x4
+#define FAPI_MSG_BCH_MISSING								0x5
+#define FAPI_MSG_INVALID_SFN								0x6
+#define FAPI_MSG_HI_ERR										0x7
+#define FAPI_MSG_TX_ERR										0x8
+
+#define FAPI_MSG_LBT_NO_PDU_IN_DL_REQ						0x9
+#define FAPI_MSG_LBT_NO_VALID_CONFIG_REQ_RECIEVED			0xA
+#define FAPI_MSG_FAPI_E_LBT_SF_SFN_PASSED_END_SF_SFN		0xB
+#define FAPI_MSG_FAPI_E_LBT_OVERLAP							0xC
+#define FAPI_MSG_BCH_PRESENT								0xD
+#define FAPI_MSG_NBIOT_UNEXPECTED_REQ						0xE
+
+
+// TODO : Work out what the correct maximums should be
+
+// Number of UL/DL configurations, I, as defined by 36.212 section 5.3.3.1.4
+// todo : work out what the max is
+#define FAPI_MAX_UL_DL_CONFIGURATIONS						4
+#define FAPI_MAX_NUM_PHYSICAL_ANTENNAS						4
+#define FAPI_MAX_NUM_SCHEDULED_UES							8
+#define FAPI_MAX_NUM_SUBBANDS								8
+#define FAPI_MAX_ANTENNA_PORT_COUNT							2
+	
+	
+typedef struct {
+	uint8_t message_id;
+	uint16_t length;
+} fapi_header_t;
+
+typedef struct {
+	uint8_t tag;
+	uint8_t length;
+	uint16_t value;
+} fapi_tlv_t;
+
+typedef struct {
+	fapi_header_t header;
+} fapi_param_req_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint8_t error_code;
+	uint8_t number_of_tlvs;
+	fapi_tlv_t tlvs[255];
+} fapi_param_resp_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint8_t number_of_tlvs;
+	fapi_tlv_t tlvs[255];
+} fapi_config_req_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint8_t error_code;
+	uint8_t number_of_invalid_tlvs;
+	uint8_t number_of_missing_tlvs;
+	fapi_tlv_t tlvs[255];
+} fapi_config_resp_t;
+
+typedef struct {
+	fapi_header_t header;
+} fapi_start_req_t;
+
+typedef struct {
+	fapi_header_t header;
+} fapi_stop_req_t;
+
+typedef struct {
+	fapi_header_t header;
+} fapi_stop_ind_t;
+
+typedef struct {
+	uint16_t received_sfn_sf;
+	uint16_t expected_sfn_sf;
+} fapi_sfn_out_of_sync_error_ind_t;
+
+typedef struct {
+	uint16_t received_sfn_sf;
+	uint16_t expected_sfn_sf;
+} fapi_invalid_sfn_error_ind_t;
+
+typedef struct {
+	uint8_t sub_error_code;
+	uint8_t direction;
+	uint16_t rnti;
+	uint8_t pdu_type;
+} fapi_pdu_error_ind_t;
+
+typedef struct {
+	uint8_t sub_error_code;
+	uint8_t phich_lowest_ul_rb_index;
+} fapi_hi_error_ind_t;
+
+typedef struct {
+	uint8_t sub_error_code;
+	uint8_t pdu_index;
+} fapi_tx_error_ind_t;	
+
+typedef struct {
+	fapi_header_t header;
+	uint8_t message_id;
+	uint8_t error_code;
+	union 
+	{
+		fapi_sfn_out_of_sync_error_ind_t	out_of_sync_err;
+		fapi_invalid_sfn_error_ind_t		invalid_sfn_err;
+		fapi_pdu_error_ind_t				pdu_err;
+		fapi_hi_error_ind_t					hi_err;
+		fapi_tx_error_ind_t					tx_err;	
+	};
+} fapi_error_ind_t;
+
+typedef struct {
+	uint32_t handle;
+	uint16_t rnti;
+} fapi_rx_ue_information_t;
+
+typedef struct {
+	uint8_t ul_cqi;
+	uint8_t channel;
+} fapi_ul_cqi_information_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+} fapi_subframe_ind_t;
+
+typedef struct { 
+	uint8_t value_0;
+	uint8_t value_1;
+} fapi_harq_ind_rel8_tdd_harq_data_bundling_t;
+
+typedef struct { 
+	uint8_t value_0;
+	uint8_t value_1;
+	uint8_t value_2;
+	uint8_t value_3;
+} fapi_harq_ind_rel8_tdd_harq_data_multiplexing_t;
+
+typedef struct { 
+	uint8_t value_0;
+} fapi_harq_ind_rel8_tdd_harq_data_special_bundling_t;
+
+typedef struct { 
+	uint8_t mode;
+	uint8_t number_of_ack_nack;
+	union{
+		fapi_harq_ind_rel8_tdd_harq_data_bundling_t			bundling;
+		fapi_harq_ind_rel8_tdd_harq_data_multiplexing_t		multiplex;
+		fapi_harq_ind_rel8_tdd_harq_data_special_bundling_t	special_bundling;
+	} harq_data;
+} fapi_harq_ind_rel8_tdd_pdu_t;
+
+typedef struct { 
+	uint8_t value_0;
+} fapi_harq_ind_rel8_tdd_harq_data_t;
+
+
+typedef struct {
+	uint8_t mode;
+	uint8_t number_of_ack_nack;
+	union{
+		fapi_harq_ind_rel8_tdd_harq_data_t	bundling;
+		fapi_harq_ind_rel8_tdd_harq_data_t	multiplex;
+		fapi_harq_ind_rel8_tdd_harq_data_special_bundling_t	special_bundling;
+		fapi_harq_ind_rel8_tdd_harq_data_t	channel_selection;
+		fapi_harq_ind_rel8_tdd_harq_data_t	format_3;
+	} harq_data[21];
+} fapi_harq_ind_rel9_tdd_pdu_t;
+
+typedef struct {
+	uint8_t mode;
+	uint16_t number_of_ack_nack;
+	union{
+		fapi_harq_ind_rel8_tdd_harq_data_t					bundling;
+		fapi_harq_ind_rel8_tdd_harq_data_t					multiplex;
+		fapi_harq_ind_rel8_tdd_harq_data_special_bundling_t	special_bundling;
+		fapi_harq_ind_rel8_tdd_harq_data_t					channel_selection;
+		fapi_harq_ind_rel8_tdd_harq_data_t			format_3;
+		fapi_harq_ind_rel8_tdd_harq_data_t			format_4;
+		fapi_harq_ind_rel8_tdd_harq_data_t			format_5;
+	} harq_data[22];
+} fapi_harq_ind_rel13_tdd_pdu_t;
+
+typedef struct {
+	uint8_t harq_tb_1;
+	uint8_t harq_tb_2;
+} fapi_harq_ind_rel8_fdd_pdu_t;
+
+typedef struct {
+	uint8_t mode;
+	uint8_t number_of_ack_nack;
+	uint8_t harq_tb_n[10];
+} fapi_harq_ind_rel9_fdd_pdu_t;
+
+typedef struct {
+	uint8_t mode;
+	uint16_t number_of_ack_nack;
+	uint8_t harq_tb_n[22];
+} fapi_harq_ind_rel13_fdd_pdu_t;
+
+typedef struct {
+	fapi_rx_ue_information_t rx_ue_info;
+	union {
+		fapi_harq_ind_rel8_tdd_pdu_t	rel8_tdd_pdu;
+		fapi_harq_ind_rel9_tdd_pdu_t	rel9_tdd_pdu;
+		fapi_harq_ind_rel13_tdd_pdu_t	rel13_tdd_pdu;
+		fapi_harq_ind_rel8_fdd_pdu_t	rel8_fdd_pdu;
+		fapi_harq_ind_rel9_fdd_pdu_t	rel9_fdd_pdu;
+		fapi_harq_ind_rel13_fdd_pdu_t	rel13_fdd_pdu;
+	};
+	fapi_ul_cqi_information_t ul_cqi_info;
+} fapi_harq_ind_pdu_t;
+
+typedef struct {
+	uint16_t number_of_harqs;
+	fapi_harq_ind_pdu_t pdus[32];
+} fapi_harq_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_harq_ind_body_t body;
+} fapi_harq_ind_t;
+
+typedef struct {
+	uint8_t crc_flag;
+} fapi_crc_ind_rel8_pdu_t;
+
+typedef struct {
+	fapi_rx_ue_information_t rx_ue_info;
+	fapi_crc_ind_rel8_pdu_t rel8_pdu;
+} fapi_crc_ind_pdu_t;
+
+typedef struct {
+	uint16_t number_of_crcs;
+	fapi_crc_ind_pdu_t pdus[32];
+} fapi_crc_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_crc_ind_body_t body;
+} fapi_crc_ind_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t data_offset;
+	uint8_t ul_cqi;
+	uint16_t timing_advance;
+} fapi_rx_ulsch_ind_rel8_pdu_t;
+
+typedef struct {
+	uint16_t timing_advance_r9;
+} fapi_rx_ulsch_ind_rel9_pdu_t;
+
+typedef struct {
+	fapi_rx_ue_information_t rx_ue_info;
+	fapi_rx_ulsch_ind_rel8_pdu_t rel8_pdu;
+	fapi_rx_ulsch_ind_rel9_pdu_t rel9_pdu;
+} fapi_rx_ulsch_ind_pdu_t;
+
+typedef struct {
+	uint16_t number_of_pdus;
+	fapi_rx_ulsch_ind_pdu_t pdus[32];
+	void* data[32];
+} fapi_rx_ulsch_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_rx_ulsch_ind_body_t body;
+} fapi_rx_ulsch_ind_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t data_offset;
+	uint8_t ul_cqi;
+	uint8_t ri;
+	uint16_t timing_advance;
+} fapi_rx_cqi_ind_rel8_pdu_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t data_offset;
+	uint8_t ul_cqi;
+	uint8_t number_of_cc_reported;
+	uint8_t ri[5];
+	uint16_t timing_advance;
+	uint16_t timing_advance_r9;
+} fapi_rx_cqi_ind_rel9_pdu_t;
+
+typedef struct {
+	fapi_rx_ue_information_t rx_ue_info;
+	fapi_rx_cqi_ind_rel8_pdu_t rel8_pdu;
+	fapi_rx_cqi_ind_rel9_pdu_t rel9_pdu;
+	fapi_ul_cqi_information_t ul_cqi_info;
+} fapi_rx_cqi_ind_pdu_t;
+
+typedef struct {
+	uint16_t number_of_pdus;
+	fapi_rx_cqi_ind_pdu_t pdus[32];
+	uint8_t* data[32];
+} fapi_rx_cqi_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_rx_cqi_ind_body_t body;
+} fapi_rx_cqi_ind_t;
+
+typedef struct {
+	fapi_rx_ue_information_t rx_ue_info;
+	fapi_ul_cqi_information_t ul_cqi_info;
+} fapi_rx_sr_ind_pdu_t;
+
+typedef struct {
+	uint16_t number_of_srs;
+	fapi_rx_sr_ind_pdu_t pdus[32];
+} fapi_rx_sr_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_rx_sr_ind_body_t body;
+} fapi_rx_sr_ind_t;
+
+typedef struct {
+	uint16_t rnti;
+	uint8_t preamble;
+	uint16_t timing_advance;
+} fapi_rach_ind_pdu_rel8_t;
+
+typedef struct {
+	uint16_t timing_advance_r9;
+} fapi_rach_ind_pdu_rel9_t;
+
+typedef struct {
+	uint8_t rach_resource_type;
+} fapi_rach_ind_pdu_rel13_t;
+
+typedef struct {
+	fapi_rach_ind_pdu_rel8_t rel8_pdu;
+	fapi_rach_ind_pdu_rel9_t rel9_pdu;
+	fapi_rach_ind_pdu_rel13_t rel13_pdu;
+} fapi_rach_ind_pdu_t;
+
+typedef struct {
+	uint8_t number_of_preambles;
+	fapi_rach_ind_pdu_t pdus[32];
+} fapi_rach_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_rach_ind_body_t body;
+} fapi_rach_ind_t;
+
+
+typedef struct {
+	uint16_t doppler_estimation;
+	uint16_t timing_advance;
+	uint8_t number_of_resource_blocks;
+	uint8_t rb_start;
+	uint8_t snr[100];
+} fapi_srs_ind_rel8_pdu_t;
+
+typedef struct { 
+	uint16_t timing_advance_r9;
+} fapi_srs_ind_rel9_pdu_t;
+
+typedef struct { 
+	uint8_t uppts_symbol;
+} fapi_srs_ind_rel10_tdd_pdu_t;
+
+typedef struct {
+	uint16_t ul_rtoa;
+} fapi_srs_ind_rel11_pdu_t;
+
+typedef struct {
+	uint8_t num_prb_per_subband;
+	uint8_t number_of_subbands;
+	uint8_t num_atennas;
+	struct {
+		uint8_t subband_index;
+		uint16_t channel[FAPI_MAX_NUM_PHYSICAL_ANTENNAS];
+	} subands[FAPI_MAX_NUM_SUBBANDS];
+} fapi_ttd_channel_measurement_t;
+
+typedef struct {
+	fapi_rx_ue_information_t		rx_ue_info;
+	fapi_srs_ind_rel8_pdu_t 		rel8_pdu;
+	fapi_srs_ind_rel9_pdu_t 		rel9_pdu;
+	fapi_srs_ind_rel10_tdd_pdu_t	rel10_tdd_pdu;
+	fapi_srs_ind_rel11_pdu_t		rel11_pdu;
+	fapi_ttd_channel_measurement_t tdd_channel_measurement;
+} fapi_srs_ind_pdu_t;
+
+typedef struct {
+	uint8_t number_of_ues;
+	fapi_srs_ind_pdu_t pdus[32];
+} fapi_srs_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_srs_ind_body_t body;
+} fapi_srs_ind_t;
+
+
+typedef struct {
+	uint32_t handle;
+	uint32_t result;
+	uint32_t lte_txop_symbols;
+	uint32_t initial_partial_sf;
+} fapi_lbt_dl_pdsch_rsp_rel13_pdu_t;
+
+typedef struct {
+	fapi_lbt_dl_pdsch_rsp_rel13_pdu_t	rel13_pdu;
+} fapi_lbt_dl_pdsch_rsp_pdu_t;
+
+typedef struct {
+	uint32_t handle;
+	uint32_t result;
+} fapi_lbt_dl_drs_rsp_rel13_pdu_t;
+
+typedef struct {
+	fapi_lbt_dl_drs_rsp_rel13_pdu_t 	rel13_pdu;
+} fapi_lbt_dl_drs_rsp_pdu_t;
+
+typedef struct {
+	uint8_t pdu_type;
+	uint8_t pdu_size;
+	union {
+		fapi_lbt_dl_pdsch_rsp_pdu_t		lbt_pdsch_rsp_pdu;
+		fapi_lbt_dl_drs_rsp_pdu_t		lbt_drs_rsp_pdu;
+	};
+} fapi_lbt_dl_ind_pdu_t;
+
+typedef struct {
+	uint16_t number_of_pdus;
+	fapi_lbt_dl_ind_pdu_t pdus[32];
+} fapi_lbt_dl_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_lbt_dl_ind_body_t body;
+} fapi_lbt_dl_ind_t;
+
+typedef struct {
+	uint8_t harq_tb1;
+} fapi_nb_harq_ind_rel13_pdu_t;
+
+typedef struct {
+	fapi_rx_ue_information_t rx_ue_info;
+	union {
+		fapi_nb_harq_ind_rel13_pdu_t	rel13_pdu;
+	};
+	fapi_ul_cqi_information_t ul_cqi_info;
+} fapi_nb_harq_ind_pdu_t;
+
+typedef struct {
+	uint16_t number_of_harqs;
+	fapi_nb_harq_ind_pdu_t pdus[32];
+} fapi_nb_harq_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_nb_harq_ind_body_t body;
+} fapi_nb_harq_ind_t;
+
+typedef struct {
+	uint16_t rnti;
+	uint8_t initial_sc;
+	uint16_t timing_advance;
+	uint8_t nrach_cs_level;
+} fapi_nrach_ind_rel13_pdu_t;
+
+typedef struct {
+	fapi_rx_ue_information_t rx_ue_info;
+	union {
+		fapi_nrach_ind_rel13_pdu_t	rel13_pdu;
+	};
+	fapi_ul_cqi_information_t ul_cqi_info;
+} fapi_nrach_ind_pdu_t;
+
+typedef struct {
+	uint16_t number_of_initial_scs_detected;
+	fapi_nrach_ind_pdu_t pdus[32];
+} fapi_nrach_ind_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_nrach_ind_body_t body;
+} fapi_nrach_ind_t;
+
+//------------------------------------------------------------------------------
+
+typedef struct {
+	uint8_t dci_format;
+	uint8_t cce_index;
+	uint8_t aggregation_level;
+	uint16_t rnti;
+	uint8_t resource_allocation_type;
+	uint8_t virtual_resource_block_assignment_flag;
+	uint32_t resource_block_coding;
+	uint8_t mcs_1;
+	uint8_t redundancy_version_1;
+	uint8_t new_data_indicator_1;
+	uint8_t transport_block_to_codeword_swap_flag;
+	uint8_t mcs_2;
+	uint8_t redundancy_version_2;
+	uint8_t new_data_indictor_2;
+	uint8_t harq_process;
+	uint8_t tpmi;
+	uint8_t pmi;
+	uint8_t precoding_information;
+	uint8_t tpc;
+	uint8_t downlink_assignment_index;
+	uint8_t n_gap;
+	uint8_t transport_block_size_index;
+	uint8_t downlink_power_offset;
+	uint8_t allocate_prach_flag;
+	uint8_t preamble_index;
+	uint8_t prach_mask_index;
+	uint8_t rnti_type;
+	uint16_t transmission_power;
+} fapi_dl_config_dci_rel8_pdu_t;
+
+typedef struct {
+	uint8_t mcch_flag;
+	uint8_t mcch_change_notification;
+	uint8_t scrambling_identity;
+} fapi_dl_config_dci_rel9_pdu_t;
+
+typedef struct {
+	uint8_t cross_carrier_scheduling_flag;
+	uint8_t carrier_indicator;
+	uint8_t srs_flag;
+	uint8_t srs_request;
+	uint8_t antenna_ports_scrambling_and_layers;
+	uint8_t total_dci_length_including_padding;
+	uint8_t n_dl_rb;
+} fapi_dl_config_dci_rel10_pdu_t;
+
+typedef struct {
+	uint8_t harq_ack_resource_offset;
+	uint8_t pdsch_re_mapping_quasi_co_location_indicator;
+} fapi_dl_config_dci_rel11_pdu_t;
+
+typedef struct {
+	uint8_t primary_cell_type;
+	uint8_t ul_dl_configuration_flag;
+	uint8_t number_ul_dl_configurations;
+	uint8_t ul_dl_configuration_indication[FAPI_MAX_UL_DL_CONFIGURATIONS];
+} fapi_dl_config_dci_rel12_pdu_t;
+
+
+typedef struct {
+	uint8_t subband_index;
+	uint8_t scheduled_ues;
+	uint16_t precoding_value[FAPI_MAX_NUM_PHYSICAL_ANTENNAS][FAPI_MAX_NUM_SCHEDULED_UES];
+} fapi_dl_config_dci_dl_tpm_subband_info_t;
+
+typedef struct {
+	uint8_t num_prb_per_subband;
+	uint8_t number_of_subbands;
+	uint8_t num_antennas;
+	fapi_dl_config_dci_dl_tpm_subband_info_t subband_info[FAPI_MAX_NUM_SUBBANDS];
+} fapi_dl_config_dci_dl_tpm_t;
+
+typedef struct {
+	uint8_t laa_end_partial_sf_flag;
+	uint8_t laa_end_partial_sf_configuration;
+	uint8_t initial_lbt_sf;
+	uint8_t codebook_size_determination;
+	uint8_t drms_table_flag;
+	uint8_t tpm_struct_flag;
+	fapi_dl_config_dci_dl_tpm_t tpm;
+} fapi_dl_config_dci_rel13_pdu_t;
+
+typedef struct {
+	fapi_dl_config_dci_rel8_pdu_t 	rel8_pdu;
+	fapi_dl_config_dci_rel9_pdu_t 	rel9_pdu;
+	fapi_dl_config_dci_rel10_pdu_t	rel10_pdu;
+	fapi_dl_config_dci_rel11_pdu_t	rel11_pdu;
+	fapi_dl_config_dci_rel12_pdu_t	rel12_pdu;
+	fapi_dl_config_dci_rel13_pdu_t	rel13_pdu;
+} fapi_dl_config_dci_pdu_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t pdu_index;
+	uint16_t transmission_power;
+} fapi_dl_config_bch_rel8_pdu_t;
+
+typedef struct {
+	fapi_dl_config_bch_rel8_pdu_t rel8_pdu;
+} fapi_dl_config_bch_pdu_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t pdu_index;
+	uint16_t rnti;
+	uint8_t resource_allocation_type;
+	uint32_t resource_block_coding;
+	uint8_t modulation;
+	uint16_t transmission_power;
+	uint16_t mbsfn_area_id;
+} fapi_dl_config_mch_rel8_pdu_t;
+
+typedef struct {
+	fapi_dl_config_mch_rel8_pdu_t rel8_pdu;
+} fapi_dl_config_mch_pdu_t;
+
+typedef struct {
+	uint8_t subband_index;
+	uint8_t num_atennas;
+	uint16_t bf_value[8];
+} fapi_dl_config_bf_vector_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t pdu_index;
+	uint16_t rnti;
+	uint8_t resource_allocation_type;
+	uint8_t virtual_resource_block_assignment_flag;
+	uint32_t resource_block_coding;
+	uint8_t modulation;
+	uint8_t redundacy_version;
+	uint8_t transport_blocks;
+	uint8_t transport_block_codeword_swap_flag;
+	uint8_t transmission_scheme;
+	uint8_t number_of_layers;
+	uint8_t nunber_of_subands;
+	uint8_t codebook_index[13];
+	uint8_t ue_category_capacity;
+	uint8_t p_a;
+	uint8_t delta_power_offset_index;
+	uint8_t n_gap;
+	uint8_t n_prb;
+	uint8_t transmission_mode;
+	uint8_t num_bf_prb_per_subband;
+	uint8_t num_bf_vecitor;
+	fapi_dl_config_bf_vector_t bf_vector[8];
+} fapi_dl_config_dlsch_rel8_pdu_t;
+
+typedef struct {
+	uint8_t nscid;
+} fapi_dl_config_dlsch_rel9_pdu_t;
+
+typedef struct {
+	uint8_t csi_rs_flag;
+	uint8_t csi_rs_resource_config_r10;
+	uint16_t csi_rs_zero_tx_power_resource_config_bitmap_r10;
+	uint8_t csi_rs_number_nzp_configuration;
+	uint8_t csi_rs_resource_config[4];
+	uint8_t pdsch_start;
+} fapi_dl_config_dlsch_rel10_pdu_t;
+
+typedef struct {
+	uint8_t drms_config_flag;
+	uint16_t drms_scrambling;
+	uint8_t csi_config_flag;
+	uint16_t csi_scrambling;
+	uint8_t pdsch_re_mapping_flag;
+	uint8_t pdsch_re_mapping_atenna_ports;
+	uint8_t pdsch_re_mapping_freq_shift;
+} fapi_dl_config_dlsch_rel11_pdu_t;
+
+typedef struct {
+	uint8_t altcqi_table_r12;
+	uint8_t maxlayers;
+	uint8_t n_dl_harq;
+} fapi_dl_config_dlsch_rel12_pdu_t;
+
+typedef struct {
+	uint8_t dwpts_symbols;
+	uint8_t initial_lbt_sf;
+	uint8_t ue_type;
+	uint8_t pdsch_payload_type;
+	uint16_t initial_transmission_sf_io;
+	uint8_t drms_table_flag;
+} fapi_dl_config_dlsch_rel13_pdu_t;
+
+typedef struct {
+	fapi_dl_config_dlsch_rel8_pdu_t rel8_pdu;
+	fapi_dl_config_dlsch_rel9_pdu_t rel9_pdu;
+	fapi_dl_config_dlsch_rel10_pdu_t rel10_pdu;
+	fapi_dl_config_dlsch_rel11_pdu_t rel11_pdu;
+	fapi_dl_config_dlsch_rel12_pdu_t rel12_pdu;
+	fapi_dl_config_dlsch_rel13_pdu_t rel13_pdu;
+} fapi_dl_config_dlsch_pdu_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t pdu_index;
+	uint16_t p_rnti;
+	uint8_t resource_allocation_type;
+	uint8_t virtual_resource_block_assignment_flag;
+	uint32_t resource_block_coding;
+	uint8_t mcs;
+	uint8_t redudancy_version;
+	uint8_t number_of_transport_blocks;
+	uint8_t transport_block_to_codeword_swap_flag;
+	uint8_t transmission_scheme;
+	uint8_t number_of_layers;
+	uint8_t codebook_index;
+	uint8_t ue_category_capacity;
+	uint8_t p_a;
+	uint16_t transmission_power;
+	uint8_t n_prb;
+	uint8_t n_gap;
+} fapi_dl_config_pch_rel8_pdu_t;
+
+typedef struct {
+	uint8_t ue_mode;
+	uint16_t initial_transmission_sf_io;
+} fapi_dl_config_pch_rel13_pdu_t;
+
+typedef struct {
+	fapi_dl_config_pch_rel8_pdu_t	rel8_pdu;
+	fapi_dl_config_pch_rel13_pdu_t	rel13_pdu;
+} fapi_dl_config_pch_pdu_t;
+
+typedef struct {
+	uint16_t transmission_power;
+	uint8_t prs_bandwidth;
+	uint8_t prs_cyclic_prefix_type;
+	uint8_t prs_muting;
+} fapi_dl_config_prs_rel9_pdu_t;
+
+typedef struct {
+	fapi_dl_config_prs_rel9_pdu_t	rel9_pdu;
+} fapi_dl_config_prs_pdu_t;
+
+typedef struct {
+	uint8_t csi_rs_antenna_port_count_r10;
+	uint8_t csi_rs_resource_config_r10;
+	uint16_t transmission_power;
+	uint16_t csi_rs_zero_tx_power_resource_config_bitmap_r10;
+	uint8_t csi_rs_number_of_nzp_configuration;
+	uint8_t csi_rs_resource_config[8];
+} fapi_dl_config_csi_rs_rel10_pdu_t;
+
+typedef struct {
+	uint8_t csi_rs_class;
+	uint8_t cdm_type;
+	uint8_t num_bf_vector;
+	struct {
+		uint8_t csi_rs_resource_index;
+		uint16_t bf_value[FAPI_MAX_ANTENNA_PORT_COUNT];
+	} bf_vector[8];
+}fapi_dl_config_csi_rs_rel13_pdu_t;
+
+typedef struct {
+	fapi_dl_config_csi_rs_rel10_pdu_t	rel10_pdu;
+	fapi_dl_config_csi_rs_rel13_pdu_t	rel13_pdu;
+} fapi_dl_config_csi_rs_pdu_t;
+
+typedef struct {
+	uint8_t edpcch_resource_assigenment_flag;
+	uint16_t edpcch_id;
+	uint8_t epdcch_start_symbol;
+	uint8_t epdcch_num_prb;
+	uint8_t epdcch_prb_index[8];
+	fapi_dl_config_bf_vector_t bf_vector;
+} fapi_dl_config_edpcch_rel11_params_t;
+
+typedef struct {
+	uint8_t dwpts_symbols;
+	uint8_t initial_lbt_sf;
+} fapi_dl_config_edpcch_rel13_params_t;
+
+typedef struct {
+	fapi_dl_config_dci_rel8_pdu_t			rel8_pdu;
+	fapi_dl_config_dci_rel9_pdu_t			rel9_pdu;
+	fapi_dl_config_dci_rel10_pdu_t			rel10_pdu;
+	fapi_dl_config_dci_rel11_pdu_t			rel11_pdu;
+	fapi_dl_config_dci_rel12_pdu_t			rel12_pdu;
+	fapi_dl_config_dci_rel13_pdu_t			rel13_pdu;
+	fapi_dl_config_edpcch_rel11_params_t	rel8_params;
+	fapi_dl_config_edpcch_rel13_params_t	rel13_params;
+} fapi_dl_config_edpcch_pdu_t;
+
+typedef struct {
+	uint8_t mpdcch_narrow_band;
+	uint8_t number_of_prb_pairs;
+	uint8_t resource_block_assignment;
+	uint8_t mpdcch_tansmission_type;
+	uint8_t start_symbol;
+	uint8_t ecce_index;
+	uint8_t aggregation_level;
+	uint8_t rnti_type;
+	uint16_t rnti;
+	uint8_t ce_mode;
+	uint16_t drms_scrambling_init;
+	uint16_t initial_transmission_sf_io;
+	uint16_t transmission_power;
+	uint8_t dci_format;
+	uint16_t resource_block_coding;
+	uint8_t mcs;
+	uint8_t pdsch_reptition_levels;
+	uint8_t redundancy_version;
+	uint8_t new_data_indicator;
+	uint8_t harq_process;
+	uint8_t tpmi_length;
+	uint8_t tpmi;
+	uint8_t pmi_flag;
+	uint8_t pmi;
+	uint8_t harq_resource_offset;
+	uint8_t dci_subframe_repetition_number;
+	uint8_t tpc;
+	uint8_t downlink_assignment_index_length;
+	uint8_t downlink_assignment_index;
+	uint8_t allocate_prach_flag;
+	uint8_t preamble_index;
+	uint8_t prach_mask_index;
+	uint8_t starting_ce_level;
+	uint8_t srs_request;
+	uint8_t antenna_ports_and_scrambling_identity_flag;
+	uint8_t antenna_ports_and_scrambling_identity;
+	uint8_t frequency_hopping_enabled_flag;
+	uint8_t paging_direct_indication_differentiation_flag;
+	uint8_t direct_indication;
+	uint8_t total_dci_length_including_padding;
+	uint8_t number_of_tx_antenna_ports;
+	uint16_t precoding_value[8];
+} fapi_dl_config_mdpcch_rel13_pdu_t;
+
+typedef struct {
+	fapi_dl_config_mdpcch_rel13_pdu_t	rel13_pdu;
+} fapi_dl_config_mdpcch_pdu_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t pdu_index;
+	uint16_t transmission_power;
+	uint16_t hyper_sfn_2_lsbs;
+} fapi_dl_config_nbch_rel13_pdu_t;
+
+typedef struct {
+	fapi_dl_config_nbch_rel13_pdu_t		rel13_pdu;
+} fapi_dl_config_nbch_pdu_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t pdu_index;
+	uint8_t ncce_index;
+	uint8_t aggregation_level;
+	uint8_t start_symbol;
+	uint8_t rnti_type;
+	uint16_t rnti;
+	uint8_t scrambling_reinitialization_batch_index;
+	uint8_t nrs_antenna_ports_assumed_by_the_ue;
+	uint8_t dci_format;
+	uint8_t scheduling_delay;
+	uint8_t resource_assignment;
+	uint8_t repetition_number;
+	uint8_t mcs;
+	uint8_t new_data_indicator;
+	uint8_t harq_ack_resource;
+	uint8_t npdcch_order_indication;
+	uint8_t starting_number_of_nprach_repetitions;
+	uint8_t subcarrier_indication_of_nprach;
+	uint8_t paging_direct_indication_differentation_flag;
+	uint8_t direct_indication;
+	uint8_t dci_subframe_repetition_number;
+	uint8_t total_dci_length_including_padding;
+} fapi_dl_config_npdcch_rel13_pdu_t;
+
+typedef struct {
+	fapi_dl_config_npdcch_rel13_pdu_t	rel13_pdu;
+} fapi_dl_config_npdcch_pdu_t;
+
+typedef struct {
+	uint16_t length;
+	uint16_t pdu_index;
+	uint8_t start_symbol;
+	uint8_t rnti_type;
+	uint16_t rnti;
+	uint16_t resource_assignment;
+	uint16_t repetition_number;
+	uint8_t modulation;
+	uint8_t number_of_subframes_for_resource_assignment;
+	uint8_t scrambling_sequence_initialization_cinit;
+	uint16_t sf_idx;
+	uint8_t nrs_antenna_ports_assumed_by_the_ue;
+} fapi_dl_config_ndlsch_rel13_pdu_t;
+
+typedef struct {
+	fapi_dl_config_ndlsch_rel13_pdu_t	rel13_pdu;
+} fapi_dl_config_ndlsch_pdu_t;
+
+typedef struct {
+	uint8_t pdu_type;
+	uint8_t pdu_size;
+	union
+	{
+		fapi_dl_config_dci_pdu_t	dci_dl_pdu;
+		fapi_dl_config_bch_pdu_t	bch_pdu;
+		fapi_dl_config_mch_pdu_t	mch_pdu;
+		fapi_dl_config_dlsch_pdu_t	dlsch_pdu;
+		fapi_dl_config_pch_pdu_t	pch_pdu;
+		fapi_dl_config_prs_pdu_t	prs_pdu;
+		fapi_dl_config_csi_rs_pdu_t	csirs_pdu;
+		fapi_dl_config_edpcch_pdu_t edpcch_pdu;
+		fapi_dl_config_mdpcch_pdu_t mdpcch_pdu;
+		fapi_dl_config_nbch_pdu_t   nbch_pdu;
+		fapi_dl_config_npdcch_pdu_t npdcch_pdu;
+		fapi_dl_config_ndlsch_pdu_t ndlsch_pdu;
+	};
+} fapi_dl_config_req_pdu_t;
+
+typedef struct {
+	uint8_t number_of_pdcch_ofdm_symbols;
+	uint8_t number_of_dcis;
+	uint16_t number_of_pdus;
+	uint8_t number_of_pdsch_rntis;
+	uint16_t transmission_power_for_pcfich;
+	fapi_dl_config_req_pdu_t pdus[32];
+} fapi_dl_config_req_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	uint16_t length;
+	fapi_dl_config_req_body_t body;
+} fapi_dl_config_req_t;
+
+typedef struct {
+	uint32_t handle;
+	uint16_t size;
+	uint16_t rnti;
+	uint8_t resource_block_start;
+	uint8_t number_of_resource_blocks;
+	uint8_t modulation_type;
+	uint8_t cyclic_shift_2_for_drms;
+	uint8_t frequency_hopping_enabled_flag;
+	uint8_t frequency_hopping_bits;
+	uint8_t new_data_indication;
+	uint8_t redundancy_version;
+	uint8_t harq_process_number;
+	uint8_t ul_tx_mode;
+	uint8_t current_tx_nb;
+	uint8_t n_srs;
+} fapi_ul_config_req_ulsch_rel8_pdu_t;
+
+typedef struct {
+	uint8_t resource_allocation_type;
+	uint32_t resource_block_coding;
+	uint8_t transport_blocks;
+	uint8_t transmission_scheme;
+	uint8_t number_of_layers;
+	uint8_t codebook_index;
+	uint8_t disable_sequence_hopping_flag;
+} fapi_ul_config_req_ulsch_rel10_pdu_t;
+
+typedef struct {
+	uint8_t virtual_cell_id_enabled_flag;
+	uint16_t npusch_identity;
+	uint8_t dmrs_config_flag;
+	uint16_t ndmrs_csh_identity;
+} fapi_ul_config_req_ulsch_rel11_pdu_t;
+
+typedef struct {
+	uint8_t  ue_type;
+	uint16_t total_number_of_repetitions;
+	uint16_t repetition_number;
+	uint16_t initial_transmission_sf_io;
+	uint8_t  empty_symbols_due_to_re_tunning;
+} fapi_ul_config_req_ulsch_rel13_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ulsch_rel8_pdu_t 	rel8_pdu;
+	fapi_ul_config_req_ulsch_rel10_pdu_t	rel10_pdu;
+	fapi_ul_config_req_ulsch_rel11_pdu_t	rel11_pdu;
+	fapi_ul_config_req_ulsch_rel13_pdu_t	rel13_pdu;
+} fapi_ul_config_req_ulsch_pdu_t;
+
+typedef struct { 
+	uint8_t dl_cqi_pmi_size_rank_1;
+	uint8_t dl_cqi_pmi_size_rank_greater_1;
+	uint8_t ri_size;
+	uint8_t delta_offset_cqi;
+	uint8_t delta_offset_ri;
+} fapi_ul_config_cqi_ri_rel8_information_t;
+
+typedef struct {
+	uint8_t dl_cqi_pmi_ri_size;
+	uint8_t control_type;
+} fapi_ul_config_periodic_cqi_pmi_ri_report_t;
+
+typedef struct {
+	uint8_t number_of_cc;
+	struct {
+		uint8_t ri_size;
+		uint8_t dl_cqi_pmi_size;
+	} cc[5];
+} fapi_ul_config_aperiodic_cqi_pmi_ri_report_t;
+
+typedef struct {
+	uint8_t report_type;
+	uint8_t delta_offset_cqi;
+	uint8_t delta_offset_ri;
+	union {
+		fapi_ul_config_periodic_cqi_pmi_ri_report_t periodic_cqi_pmi_ri_report;
+		fapi_ul_config_aperiodic_cqi_pmi_ri_report_t aperiodic_cqi_pmi_ri_report;
+	};
+} fapi_ul_config_cqi_ri_rel9_information_t;
+
+typedef struct {
+	uint16_t dl_cqi_pmi_ri_size_2;
+} fapi_ul_config_periodic_cqi_pmi_ri_report_re13_t;
+
+typedef struct {
+} fapi_ul_config_aperiodic_cqi_pmi_ri_report_re13_t;
+
+
+typedef struct {
+	union {
+		fapi_ul_config_periodic_cqi_pmi_ri_report_re13_t periodic_cqi_pmi_ri_report;
+		fapi_ul_config_aperiodic_cqi_pmi_ri_report_re13_t aperiodic_cqi_pmi_ri_report;
+	};
+} fapi_ul_config_cqi_ri_rel13_information_t;
+
+typedef struct {
+	fapi_ul_config_cqi_ri_rel8_information_t	rel8_info;
+	fapi_ul_config_cqi_ri_rel9_information_t	rel9_cqi_ri_info;
+	fapi_ul_config_cqi_ri_rel13_information_t	rel13_cqi_ri_info;
+} fapi_ul_config_cqi_ri_information_t;
+
+typedef struct { 
+	uint8_t n_srs_initial;
+	uint8_t initial_number_of_resource_blocks;
+} fapi_ul_config_init_tx_rel8_params_t;
+
+typedef struct {
+	fapi_ul_config_init_tx_rel8_params_t rel8_params;
+} fapi_ul_config_init_tx_params_t;
+
+typedef struct { 
+	uint8_t harq_size;
+	uint8_t delta_offset_harq;
+	uint8_t ack_nack_mode;
+} fapi_ul_config_harq_rel10_information_t;
+
+typedef struct {
+	uint16_t harq_size_2;
+	uint8_t delta_offset_harq_2;
+} fapi_ul_config_harq_rel13_information_t;
+
+typedef struct {
+	fapi_ul_config_harq_rel10_information_t rel10_info;
+	fapi_ul_config_harq_rel13_information_t rel13_info;
+} fapi_ul_config_harq_information_t;
+
+typedef struct { 
+	uint32_t handle;
+	uint16_t rnti;
+} fapi_ul_config_req_ue_rel8_info_t;
+
+typedef struct {
+	uint8_t virtual_cell_id_enabled_flag;
+	uint16_t npusch_identity;
+} fapi_ul_config_req_ue_rel11_info_t;
+
+typedef struct {
+	uint8_t  ue_type;
+	uint8_t  empty_symbols;
+	uint16_t total_number_of_repetitions;
+	uint16_t repetition_number;
+} fapi_ul_config_req_ue_rel13_info_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_rel8_info_t rel8_info;
+	fapi_ul_config_req_ue_rel11_info_t rel11_info;
+	fapi_ul_config_req_ue_rel13_info_t rel13_info;
+} fapi_ul_config_req_ue_info_t;
+
+typedef struct { 
+	uint16_t pucch_index;
+	uint8_t dl_cqi_pmi_size;
+} fapi_ul_config_req_cqi_rel8_info_t;
+
+typedef struct {
+	uint8_t number_of_pucch_resource;
+	uint16_t pucch_index_p1;
+} fapi_ul_config_req_cqi_rel10_info_t;
+
+typedef struct {
+	uint8_t csi_mode;
+	uint16_t dl_cqi_pmi_size_2;
+	uint8_t starting_prb;
+	uint8_t n_prb;
+	uint8_t cdm_index;
+	uint8_t n_srs;
+} fapi_ul_config_req_cqi_rel13_info_t;
+
+typedef struct {
+	fapi_ul_config_req_cqi_rel8_info_t rel8_info;
+	fapi_ul_config_req_cqi_rel10_info_t rel10_info;
+	fapi_ul_config_req_cqi_rel13_info_t rel13_info;
+} fapi_ul_config_req_cqi_info_t;
+
+typedef struct { 
+	uint16_t pucch_index;
+} fapi_ul_config_req_sr_rel8_info_t;
+
+typedef struct {
+	uint8_t number_of_pucch_resources;
+	uint16_t pucch_index_p1;
+} fapi_ul_config_req_sr_rel10_info_t;
+
+typedef struct {
+	fapi_ul_config_req_sr_rel8_info_t rel8_info;
+	fapi_ul_config_req_sr_rel10_info_t rel10_info;
+} fapi_ul_config_req_sr_info_t;
+
+typedef struct {
+	uint8_t harq_size;
+	uint8_t ack_nack_mode;
+	uint8_t number_of_pucch_resources;
+	uint16_t n_pucch_1_0;
+	uint16_t n_pucch_1_1;
+	uint16_t n_pucch_1_2;
+	uint16_t n_pucch_1_3;
+} fapi_ul_config_req_harq_rel10_tdd_info_t;
+
+typedef struct {
+	uint16_t n_pucch_1_0;
+	uint8_t harq_size;
+} fapi_ul_config_req_harq_rel8_fdd_info_t;
+
+typedef struct {
+	uint8_t harq_size;
+	uint8_t ack_nack_mode;
+	uint8_t number_of_pucch_resources;
+	uint16_t n_pucch_1_0;
+	uint16_t n_pucch_1_1;
+	uint16_t n_pucch_1_2;
+	uint16_t n_pucch_1_3;
+} fapi_ul_config_req_harq_rel9_fdd_info_t;
+
+typedef struct {
+	uint8_t  num_ant_ports;
+	uint16_t n_pucch_2_0;
+	uint16_t n_pucch_2_1;
+	uint16_t n_pucch_2_2;
+	uint16_t n_pucch_2_3;	
+} fapi_ul_config_req_harq_rel11_fdd_tdd_info_t;
+
+typedef struct {
+	uint16_t  harq_size_2;
+	uint8_t starting_prb;
+	uint8_t n_prb;
+	uint8_t cdm_index;
+	uint8_t n_srs;
+} fapi_ul_config_req_harq_rel13_fdd_tdd_info_t;
+
+typedef struct {
+	fapi_ul_config_req_harq_rel10_tdd_info_t		rel10_tdd_info;
+	fapi_ul_config_req_harq_rel8_fdd_info_t			rel8_fdd_info;
+	fapi_ul_config_req_harq_rel9_fdd_info_t			rel9_fdd_info;
+	fapi_ul_config_req_harq_rel11_fdd_tdd_info_t	rel11_fdd_tdd_info;
+	fapi_ul_config_req_harq_rel13_fdd_tdd_info_t	rel13_fdd_tdd_info;
+} fapi_ul_config_req_harq_info_t;
+
+typedef struct {
+	fapi_ul_config_req_ulsch_pdu_t		ulsch_pdu;
+	fapi_ul_config_cqi_ri_information_t cqi_ri_info;
+	fapi_ul_config_init_tx_params_t		init_tx_params;
+} fapi_ul_config_req_ulsch_cqi_ri_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ulsch_pdu_t		ulsch_pdu;
+	fapi_ul_config_harq_information_t	harq_info;
+	fapi_ul_config_init_tx_params_t		init_tx_params;
+} fapi_ul_config_req_ulsch_harq_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ulsch_pdu_t		ulsch_pdu;
+	fapi_ul_config_cqi_ri_information_t cqi_ri_info;
+	fapi_ul_config_harq_information_t	harq_info;
+	fapi_ul_config_init_tx_params_t		init_tx_params;
+} fapi_ul_config_req_ulsch_cqi_harq_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_info_t		ue_info;
+	fapi_ul_config_req_cqi_info_t		cqi_info;
+} fapi_ul_config_req_uci_cqi_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_info_t		ue_info;
+	fapi_ul_config_req_sr_info_t		sr_info;
+} fapi_ul_config_req_uci_sr_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_info_t		ue_info;
+	fapi_ul_config_req_harq_info_t		harq_info;
+} fapi_ul_config_req_uci_harq_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_info_t		ue_info;
+	fapi_ul_config_req_sr_info_t		sr_info;
+	fapi_ul_config_req_harq_info_t		harq_info;
+} fapi_ul_config_req_uci_sr_harq_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_info_t		ue_info;
+	fapi_ul_config_req_cqi_info_t		cqi_info;
+	fapi_ul_config_req_harq_info_t		harq_info;
+} fapi_ul_config_req_uci_cqi_harq_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_info_t		ue_info;
+	fapi_ul_config_req_cqi_info_t		cqi_info;
+	fapi_ul_config_req_sr_info_t		sr_info;
+} fapi_ul_config_req_uci_cqi_sr_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_info_t		ue_info;
+	fapi_ul_config_req_cqi_info_t		cqi_info;
+	fapi_ul_config_req_sr_info_t		sr_info;
+	fapi_ul_config_req_harq_info_t		harq_info;
+} fapi_ul_config_req_uci_cqi_sr_harq_pdu_t;
+
+typedef struct {
+	uint32_t handle;
+	uint16_t size;
+	uint16_t rnti;
+	uint8_t srs_bandwidth;
+	uint8_t frqeuency_domain_position;
+	uint8_t srs_hopping_bandwidth;
+	uint8_t transmission_comb;
+	uint16_t srs_config_index;
+	uint8_t sounding_reference_cyclic_shift;
+} fapi_ul_config_req_srs_rel8_pdu_t;
+
+typedef struct { 
+	uint8_t antenna_port;
+} fapi_ul_config_req_srs_rel10_pdu_t;
+
+typedef struct {
+	uint8_t number_of_combs;
+} fapi_ul_config_req_srs_rel13_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_srs_rel8_pdu_t rel8_pdu;
+	fapi_ul_config_req_srs_rel10_pdu_t rel10_pdu;
+	fapi_ul_config_req_srs_rel13_pdu_t rel13_pdu;
+} fapi_ul_config_req_srs_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ue_info_t		ue_info;
+} fapi_ul_config_req_harq_buffer_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ulsch_pdu_t		ulsch_pdu;
+	fapi_ul_config_req_cqi_info_t 	csi_information;
+} fapi_ul_config_req_ulsch_uci_csi_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ulsch_pdu_t		ulsch_pdu;
+	fapi_ul_config_req_harq_info_t		harq_information;
+} fapi_ul_config_req_ulsch_uci_harq_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_ulsch_pdu_t		ulsch_pdu;
+	fapi_ul_config_req_cqi_info_t 		csi_information;
+	fapi_ul_config_req_harq_info_t		harq_information;
+} fapi_ul_config_req_ulsch_csi_uci_harq_pdu_t;
+
+typedef struct {
+	uint8_t harq_ack_resource;
+} fapi_ul_config_req_nb_harq_rel13_info_t;
+
+typedef struct {
+	fapi_ul_config_req_nb_harq_rel13_info_t	nb_harq_pdu_rel13;
+} fapi_ul_config_req_nb_harq_info_t;
+
+typedef struct {
+	uint8_t nulsch_format;
+	uint32_t handle;
+	uint16_t size;
+	uint16_t rnti;
+	uint8_t subcarrier_indication;
+	uint8_t resource_assignment;
+	uint8_t mcs;
+	uint8_t redudancy_version;
+	uint8_t repetition_number;
+	uint8_t new_data_indication;
+	uint8_t n_srs;
+	uint16_t scrambling_sequence_initialization_cinit;
+	uint16_t sf_idx;
+	fapi_ul_config_req_ue_info_t ue_information;
+	fapi_ul_config_req_nb_harq_info_t nb_harq_information;
+} fapi_ul_config_req_nulsch_rel13_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_nulsch_rel13_pdu_t	nulsch_pdu_rel13;
+} fapi_ul_config_req_nulsch_pdu_t;
+
+typedef struct {
+	uint8_t nprach_config_0;
+	uint8_t nprach_config_1;
+	uint8_t nprach_config_2;
+} fapi_ul_config_req_nrach_rel13_pdu_t;
+
+typedef struct {
+	fapi_ul_config_req_nrach_rel13_pdu_t	nrach_pdu_rel13;
+} fapi_ul_config_req_nrach_pdu_t;
+
+typedef struct { 
+	uint8_t pdu_type;
+	uint8_t pdu_size;
+	union
+	{
+		fapi_ul_config_req_ulsch_pdu_t				ulsch_pdu;
+		fapi_ul_config_req_ulsch_cqi_ri_pdu_t		ulsch_cqi_ri_pdu;
+		fapi_ul_config_req_ulsch_harq_pdu_t			ulsch_harq_pdu;
+		fapi_ul_config_req_ulsch_cqi_harq_pdu_t		ulsch_cqi_harq_pdu;
+		fapi_ul_config_req_uci_cqi_pdu_t			uci_cqi_pdu;
+		fapi_ul_config_req_uci_sr_pdu_t				uci_sr_pdu;
+		fapi_ul_config_req_uci_harq_pdu_t			uci_harq_pdu;
+		fapi_ul_config_req_uci_sr_harq_pdu_t		uci_sr_harq_pdu;
+		fapi_ul_config_req_uci_cqi_harq_pdu_t		uci_cqi_harq_pdu;
+		fapi_ul_config_req_uci_cqi_sr_pdu_t			uci_cqi_sr_pdu;
+		fapi_ul_config_req_uci_cqi_sr_harq_pdu_t	uci_cqi_sr_harq_pdu;
+		fapi_ul_config_req_srs_pdu_t				srs_pdu;
+		fapi_ul_config_req_harq_buffer_pdu_t		harq_buffer_pdu;
+		fapi_ul_config_req_ulsch_uci_csi_pdu_t		ulsch_uci_csi_pdu;
+		fapi_ul_config_req_ulsch_uci_harq_pdu_t		ulsch_uci_harq_pdu;
+		fapi_ul_config_req_ulsch_csi_uci_harq_pdu_t	ulsch_csi_uci_harq_pdu;
+		fapi_ul_config_req_nulsch_pdu_t				nulsch_pdu;
+		fapi_ul_config_req_nrach_pdu_t				nrach_pdu;
+	};
+} fapi_ul_config_req_pdu_t;
+
+typedef struct {
+	uint8_t number_of_pdus;
+	uint8_t rach_prach_frequency_resources;
+	uint8_t srs_present;
+	fapi_ul_config_req_pdu_t* pdus;
+} fapi_ul_config_req_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	uint16_t length;
+	fapi_ul_config_req_body_t body;
+} fapi_ul_config_req_t;
+
+typedef struct { 
+	uint8_t dci_format;
+	uint8_t cce_index;
+	uint8_t aggregation_level;
+	uint8_t rnti;
+	uint8_t resource_block_start;
+	uint8_t number_of_resource_blocks;
+	uint8_t mcs_1;
+	uint8_t cyclic_shift_2_for_drms;
+	uint8_t frequency_hopping_enabled_flag;
+	uint8_t frequency_hopping_flags;
+	uint8_t new_data_indication_1;
+	uint8_t ue_tx_antenna_selection;
+	uint8_t tpc;
+	uint8_t cqi_csi_request;
+	uint8_t ul_index;
+	uint8_t dl_assignment_index;
+	uint32_t tpc_bitmap;
+	uint16_t transmission_power;
+} fapi_hi_dci0_req_dci0_rel8_pdu_t;
+
+typedef struct {
+	uint8_t cross_carrier_scheduling_flag;
+	uint8_t carrier_indicator;
+	uint8_t size_of_cqi_csi_feild;
+	uint8_t srs_flag;
+	uint8_t srs_request;
+	uint8_t resource_allocation_flag;
+	uint8_t resource_allocation_type;
+	uint32_t resource_block_coding;
+	uint8_t mcs_2;
+	uint8_t new_data_indication_2;
+	uint8_t number_of_antenna_ports;
+	uint8_t tpmi;
+	uint8_t total_dci_length_including_padding;
+	uint8_t n_ul_rb;
+} fapi_hi_dci0_req_dci0_rel10_pdu_t;
+
+typedef struct {
+	uint8_t pscch_resource;
+	uint8_t time_resource_pattern;
+} fapi_hi_dci0_req_dci0_rel12_pdu_t;
+
+typedef struct {
+	fapi_hi_dci0_req_dci0_rel8_pdu_t rel8_pdu;
+	fapi_hi_dci0_req_dci0_rel10_pdu_t rel10_pdu;
+	fapi_hi_dci0_req_dci0_rel12_pdu_t rel12_pdu;
+} fapi_hi_dci0_req_dci0_pdu_t;
+
+typedef struct {
+	uint8_t resource_block_start;
+	uint8_t cyclic_shift_2_for_drms;
+	uint8_t hi_value;
+	uint8_t i_phich;
+	uint16_t transmission_power;
+} fapi_hi_dci0_req_hi_rel8_pdu_t;
+
+typedef struct {
+	uint8_t flag_tb2;
+	uint8_t hi_value_2;
+} fapi_hi_dci0_req_hi_rel10_pdu_t;
+
+typedef struct {
+	fapi_hi_dci0_req_hi_rel8_pdu_t rel8_pdu;
+	fapi_hi_dci0_req_hi_rel10_pdu_t rel10_pdu;
+} fapi_hi_dci0_req_hi_pdu_t;
+
+typedef struct {
+	fapi_dl_config_dci_rel8_pdu_t			edpcch_dci_pdu_rel8;
+	fapi_dl_config_dci_rel10_pdu_t			edpcch_dci_pdu_rel10;
+	fapi_dl_config_edpcch_rel11_params_t	edpcch_parameters_rel11;
+} fapi_hi_dci0_req_epdcch_dci_ul_pdu_t;
+
+typedef struct {
+	uint8_t mpdcch_narrowband;
+	uint8_t number_of_prb_pairs;
+	uint8_t resource_block_assignment;
+	uint8_t mpdcch_transmission_type;
+	uint8_t start_symbol;
+	uint8_t ecce_index;
+	uint8_t aggreagation_level;
+	uint8_t rnti_type;
+	uint16_t rnti;
+	uint8_t ce_mode;
+	uint16_t drms_scrambling_init;
+	uint16_t initial_transmission_sf_io;
+	uint16_t transmission_power;
+	uint8_t dci_format;
+	uint8_t resource_block_start;
+	uint8_t number_of_resource_blocks;
+	uint8_t mcs;
+	uint8_t pusch_repetition_levels;
+	uint8_t frequency_hopping_flag;
+	uint8_t new_data_indication;
+	uint8_t harq_process;
+	uint8_t redudency_version;
+	uint8_t tpc;
+	uint8_t csi_request;
+	uint8_t ul_inex;
+	uint8_t dai_presence_flag;
+	uint8_t dl_assignment_index;
+	uint8_t srs_request;
+	uint8_t dci_subframe_repetition_number;
+	uint32_t tcp_bitmap;
+	uint8_t total_dci_length_include_padding;
+	uint8_t number_of_tx_antenna_ports;
+	uint16_t precoding_value[FAPI_MAX_ANTENNA_PORT_COUNT];
+} fapi_hi_dci0_req_mpdcch_dci_ul_rel13_pdu_t;
+
+typedef struct {
+	fapi_hi_dci0_req_mpdcch_dci_ul_rel13_pdu_t	mpdcch_dci_pdu_rel13;
+} fapi_hi_dci0_req_mpdcch_dci_ul_pdu_t;
+
+typedef struct {
+	uint8_t ncce_index;
+	uint8_t aggregation_level;
+	uint8_t start_symbol;
+	uint16_t rnti;
+	uint8_t scrambling_reinitialization_batch_index;
+	uint8_t nrs_antenna_ports_assumed_by_the_ue;
+	uint8_t subcarrier_indication;
+	uint8_t resource_assignment;
+	uint8_t scheduling_delay;
+	uint8_t mcs;
+	uint8_t redudancy_version;
+	uint8_t repetition_number;
+	uint8_t new_data_indicator;
+	uint8_t dci_subframe_repetition_number;
+} fapi_hi_dci0_req_npdcch_dci_ul_rel13_pdu_t;
+
+typedef struct {
+	fapi_hi_dci0_req_npdcch_dci_ul_rel13_pdu_t	npdcch_dci_pdu_rel13;
+} fapi_hi_dci0_req_npdcch_dci_ul_pdu_t;
+
+typedef struct {
+	uint8_t pdu_type;
+	uint8_t pdu_size;
+	union 
+	{
+		fapi_hi_dci0_req_hi_pdu_t				hi_pdu;
+		fapi_hi_dci0_req_dci0_pdu_t				dci0_pdu;
+		fapi_hi_dci0_req_epdcch_dci_ul_pdu_t	edpcch_dci_ul_pdu;
+		fapi_hi_dci0_req_mpdcch_dci_ul_pdu_t	mdpcch_dci_ul_pdu;
+		fapi_hi_dci0_req_npdcch_dci_ul_pdu_t	ndpcch_dci_ul_pdu;
+	};
+} fapi_hi_dci0_req_pdu_t;
+
+typedef struct {
+	uint16_t sfn_sf;
+	uint8_t number_of_dci;
+	uint8_t number_of_hi;
+	fapi_hi_dci0_req_pdu_t* pdus;
+} fapi_hi_dci0_req_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_hi_dci0_req_body_t body;
+} fapi_hi_dci0_req_t;
+
+typedef struct {
+	uint16_t tag;
+	uint16_t length;
+	uint32_t* value;
+} fapi_tx_req_pdu_tlv_t;
+
+typedef struct {
+	uint16_t pdu_length;
+	uint16_t pdu_index;
+	uint32_t num_tlv;
+	fapi_tx_req_pdu_tlv_t tlvs[32];
+} fapi_tx_req_pdu_t;
+
+typedef struct {
+	uint16_t number_of_pdus;
+	fapi_tx_req_pdu_t* pdus;
+} fapi_tx_req_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	fapi_tx_req_body_t body;
+} fapi_tx_req_t;
+
+typedef struct {
+	uint32_t handle;
+	uint32_t mp_cca;
+	uint32_t n_cca;
+	uint32_t offset;
+	uint32_t lte_txop_sf;
+	uint16_t txop_sfn_sf_end;
+	uint32_t lbt_mode;
+} fapi_lbt_pdsch_req_rel13_pdu_t;
+
+typedef struct {
+	fapi_lbt_pdsch_req_rel13_pdu_t	rel13_pdu;
+} fapi_lbt_pdsch_req_pdu_t;
+
+typedef struct {
+	uint32_t handle;
+	uint32_t offset;
+	uint16_t sfn_sf_end;
+	uint32_t lbt_mode;
+} fapi_lbt_drs_req_rel13_pdu_t;
+
+typedef struct {
+	fapi_lbt_drs_req_rel13_pdu_t	rel13_pdu;
+} fapi_lbt_drs_req_pdu_t;
+
+typedef struct {
+	uint8_t pdu_type;
+	uint8_t pdu_size;
+	union {
+		fapi_lbt_pdsch_req_pdu_t	lbt_pdsch_req_pdu;
+		fapi_lbt_drs_req_pdu_t		lbt_drs_req_pdu;
+	};
+} fapi_lbt_dl_config_req_pdu_t;
+
+typedef struct {
+	uint16_t number_of_pdus;
+	fapi_lbt_dl_config_req_pdu_t pdus[32];
+} fapi_lbt_dl_config_req_body_t;
+
+typedef struct {
+	fapi_header_t header;
+	uint16_t sfn_sf;
+	uint16_t length;
+	fapi_lbt_dl_config_req_body_t body;
+} fapi_lbt_dl_config_req_t;
+
+//------------------------------------------------------------------------------
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/nfapi/open-nFAPI/pnf_sim/inc/fapi_stub.h b/nfapi/open-nFAPI/pnf_sim/inc/fapi_stub.h
new file mode 100644
index 0000000000000000000000000000000000000000..10df46e7ab34ddb297e8200c25cc159eb1a7be19
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf_sim/inc/fapi_stub.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _FAPI_STUB_H_
+#define _FAPI_STUB_H_
+
+#include "fapi_interface.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef struct fapi fapi_t;
+
+typedef struct fapi {
+	void* user_data;
+} fapi_t;
+
+typedef struct {
+	int (*fapi_param_response)(fapi_t* fapi, fapi_param_resp_t* resp);
+	int (*fapi_config_response)(fapi_t* fapi, fapi_config_resp_t* resp);
+
+	int (*fapi_subframe_ind)(fapi_t* fapi, fapi_subframe_ind_t* ind);
+
+	int (*fapi_harq_ind)(fapi_t* fapi, fapi_harq_ind_t* ind);
+	int (*fapi_crc_ind)(fapi_t* fapi, fapi_crc_ind_t* ind);
+	int (*fapi_rx_ulsch_ind)(fapi_t* fapi, fapi_rx_ulsch_ind_t* ind);
+	int (*fapi_rx_cqi_ind)(fapi_t* fapi, fapi_rx_cqi_ind_t* ind);
+	int (*fapi_rx_sr_ind)(fapi_t* fapi, fapi_rx_sr_ind_t* ind);
+	int (*fapi_rach_ind)(fapi_t* fapi, fapi_rach_ind_t* ind);
+	int (*fapi_srs_ind)(fapi_t* fapi, fapi_srs_ind_t* ind);
+	
+	int (*fapi_lbt_dl_ind)(fapi_t* fapi, fapi_lbt_dl_ind_t* ind);
+	int (*fapi_nb_harq_ind)(fapi_t* fapi, fapi_nb_harq_ind_t* ind);
+	int (*fapi_nrach_ind)(fapi_t* fapi, fapi_nrach_ind_t* ind);
+
+} fapi_cb_t;
+
+typedef struct {
+
+	uint16_t duplex_mode;
+	uint16_t dl_channel_bw_support;
+	uint16_t ul_channel_bw_support;
+} fapi_config_t;
+
+fapi_t* fapi_create(fapi_cb_t* callbacks, fapi_config_t* config);
+
+void fapi_start_data(fapi_t* fapi, unsigned rx_port, const char* tx_address, unsigned tx_port);
+
+int fapi_param_request(fapi_t* fapi, fapi_param_req_t* req);
+int fapi_config_request(fapi_t* fapi, fapi_config_req_t* req);
+int fapi_start_request(fapi_t* fapi, fapi_start_req_t* req);
+
+int fapi_dl_config_request(fapi_t* fapi, fapi_dl_config_req_t* req);
+int fapi_ul_config_request(fapi_t* fapi, fapi_ul_config_req_t* req);
+int fapi_hi_dci0_request(fapi_t* fapi, fapi_hi_dci0_req_t* req);
+int fapi_tx_request(fapi_t* fapi, fapi_tx_req_t* req);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..df0ca12305f6ca954c9f02f1874e31c46637022e
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
@@ -0,0 +1,642 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fapi_stub.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <ifaddrs.h>
+#include <netdb.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include <mutex>
+#include <queue>
+#include <list>
+
+struct phy_pdu
+{
+	phy_pdu() : buffer_len(1500), buffer(0), len(0)
+	{
+		buffer = (char*) malloc(buffer_len);
+	}
+	
+	virtual ~phy_pdu()
+	{
+		free(buffer);
+	}
+
+
+	unsigned buffer_len;
+	char* buffer;
+	unsigned len;
+};
+
+class fapi_private 
+{
+		std::mutex mutex;
+		std::queue<phy_pdu*> rx_buffer;
+
+		std::queue<phy_pdu*> free_store;
+	public:
+
+		fapi_private()
+			: byte_count(0), tick(0), first_dl_config(false)
+		{
+		}
+
+		phy_pdu* allocate_phy_pdu()
+		{
+			phy_pdu* pdu = 0;
+			mutex.lock();
+			if(free_store.empty())
+			{
+				pdu = new phy_pdu();
+			}
+			else
+			{
+				pdu = free_store.front();
+				free_store.pop();
+			}
+			mutex.unlock();
+			return pdu;
+		}
+
+		void release_phy_pdu(phy_pdu* pdu)
+		{
+			mutex.lock();
+			free_store.push(pdu);
+			mutex.unlock();
+		}
+
+		bool rx_buffer_empty()
+		{
+			bool empty;
+			mutex.lock();
+			empty = rx_buffer.empty();
+			mutex.unlock();
+
+			return empty;
+		}
+		
+
+		void push_rx_buffer(phy_pdu* buff)
+		{
+			mutex.lock();
+			rx_buffer.push(buff);
+			mutex.unlock();
+		}
+
+		phy_pdu* pop_rx_buffer()
+		{
+			phy_pdu* buff = 0;
+			mutex.lock();
+			if(!rx_buffer.empty())
+			{
+				buff = rx_buffer.front();
+				rx_buffer.pop();
+			}
+			mutex.unlock();
+			return buff;
+		}
+
+		uint32_t byte_count;
+		uint32_t tick;
+		bool first_dl_config;
+
+};
+
+extern "C"
+{
+	typedef struct fapi_internal
+	{
+		fapi_t _public;
+
+		fapi_cb_t callbacks;
+
+		uint8_t state;
+		fapi_config_t config;
+
+		int rx_sock;
+		int tx_sock;
+		struct sockaddr_in tx_addr;
+
+		uint32_t tx_byte_count;
+		uint32_t tick;
+		
+		fapi_private* fapi;
+
+	} fapi_internal_t;
+}
+
+extern void set_thread_priority(int);
+/*
+{
+	pthread_attr_t ptAttr;
+	
+	struct sched_param schedParam;
+	schedParam.__sched_priority = 79;
+	sched_setscheduler(0, SCHED_RR, &schedParam);
+
+	pthread_attr_setschedpolicy(&ptAttr, SCHED_RR);
+
+	pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
+
+	struct sched_param thread_params;
+	thread_params.sched_priority = 20;
+	pthread_attr_setschedparam(&ptAttr, &thread_params);
+}
+*/
+
+void send_uplink_indications(fapi_internal_t* instance, uint16_t sfn_sf)
+{
+	fapi_harq_ind_t harq_ind;
+	(instance->callbacks.fapi_harq_ind)(&(instance->_public), &harq_ind);
+
+	fapi_crc_ind_t crc_ind;
+	crc_ind.header.message_id = FAPI_CRC_INDICATION;
+	crc_ind.header.length = 0; //??;
+	crc_ind.sfn_sf = sfn_sf;
+	crc_ind.body.number_of_crcs = 1;
+	crc_ind.body.pdus[0].rx_ue_info.handle = 0; //??
+	crc_ind.body.pdus[0].rx_ue_info.rnti = 0; //??
+	crc_ind.body.pdus[0].rel8_pdu.crc_flag = 1;
+
+	(instance->callbacks.fapi_crc_ind)(&(instance->_public), &crc_ind);
+
+	if(!instance->fapi->rx_buffer_empty())
+	{
+		fapi_rx_ulsch_ind_t rx_ind;
+		memset(&rx_ind, 0, sizeof(rx_ind));
+		rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION;
+		rx_ind.sfn_sf = sfn_sf;
+
+
+		phy_pdu* buff = 0;
+		int i = 0;
+		std::list<phy_pdu*> free_list;
+		do
+		{
+			buff = instance->fapi->pop_rx_buffer();
+			if(buff != 0)
+			{
+				if(buff->len == 0)
+				{
+					printf("[FAPI] Buffer length = 0\n");
+				}
+
+				rx_ind.body.pdus[i].rx_ue_info.handle = 0xDEADBEEF;
+				rx_ind.body.pdus[i].rx_ue_info.rnti = 0x4242;
+
+				rx_ind.body.pdus[i].rel8_pdu.length = buff->len;
+				//rx_ind.pdus[i].rel8_pdu.data_offset;
+				//rx_ind.pdus[i].rel8_pdu.ul_cqi;
+				//rx_ind.pdus[i].rel8_pdu.timing_advance;
+
+				rx_ind.body.data[i] = buff->buffer;
+
+				rx_ind.body.number_of_pdus++;
+				i++;
+
+				instance->fapi->byte_count += buff->len;
+
+				free_list.push_back(buff);
+			}
+		}while(buff != 0 && i < 8);
+
+		(instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind);
+
+		for(phy_pdu* pdu : free_list)
+		{
+			instance->fapi->release_phy_pdu(pdu);
+			//free(tx_req.tx_request_body.tx_pdu_list[j].segments[0].segment_data);
+		}
+	}
+	else
+	{
+		fapi_rx_ulsch_ind_t rx_ind;
+		memset(&rx_ind, 0, sizeof(rx_ind));
+		rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION;
+		rx_ind.sfn_sf = sfn_sf;
+		(instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind);
+	}
+
+	
+	fapi_rx_cqi_ind_t cqi_ind;
+	cqi_ind.sfn_sf = sfn_sf;
+	(instance->callbacks.fapi_rx_cqi_ind)(&(instance->_public), &cqi_ind);
+
+	fapi_rx_sr_ind_t sr_ind;
+	sr_ind.sfn_sf = sfn_sf;
+	(instance->callbacks.fapi_rx_sr_ind)(&(instance->_public), &sr_ind);
+
+	fapi_rach_ind_t rach_ind;
+	rach_ind.sfn_sf = sfn_sf;
+	(instance->callbacks.fapi_rach_ind)(&(instance->_public), &rach_ind);
+
+	fapi_srs_ind_t srs_ind;
+	srs_ind.sfn_sf = sfn_sf;
+	(instance->callbacks.fapi_srs_ind)(&(instance->_public), &srs_ind);
+	/*
+	nfapi_lbt_dl_indication_t lbt_ind;
+	memset(&lbt_ind, 0, sizeof(lbt_ind));
+	lbt_ind.header.message_id = NFAPI_LBT_DL_INDICATION;
+	lbt_ind.header.phy_id = config->phy_id;
+	lbt_ind.sfn_sf = sfn_sf;
+	nfapi_pnf_p7_lbt_dl_ind(config, &lbt_ind);
+
+	vendor_ext_p7_ind ve_p7_ind;
+	memset(&ve_p7_ind, 0, sizeof(ve_p7_ind));
+	ve_p7_ind.header.message_id = P7_VENDOR_EXT_IND;
+	ve_p7_ind.header.phy_id = config->phy_id;
+	ve_p7_ind.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_p7_vendor_extension(config, &(ve_p7_ind.header));
+	*/
+	
+	fapi_nb_harq_ind_t nb_harq_ind;
+	nb_harq_ind.sfn_sf = sfn_sf;
+	(instance->callbacks.fapi_nb_harq_ind)(&(instance->_public), &nb_harq_ind);
+
+	fapi_nrach_ind_t nrach_ind;
+	nrach_ind.sfn_sf = sfn_sf;
+	(instance->callbacks.fapi_nrach_ind)(&(instance->_public), &nrach_ind);
+
+}
+
+void* fapi_thread_start(void* ptr)
+{
+	set_thread_priority(81);
+
+	fapi_internal_t* instance = (fapi_internal_t*)ptr;
+	uint16_t sfn_sf_dec = 0;
+	uint32_t last_tv_usec = 0;
+	uint32_t last_tv_sec = 0;
+
+	uint32_t millisec;
+	uint32_t last_millisec = -1;
+	uint16_t catchup = 0;
+
+	while(1)
+	{
+		// get the time
+		struct timeval sf_start;
+		(void)gettimeofday(&sf_start, NULL);
+		
+		uint16_t sfn_sf = ((((sfn_sf_dec) / 10) << 4) | (((sfn_sf_dec) - (((sfn_sf_dec) / 10) * 10)) & 0xF));
+		// increment the sfn/sf - for the next subframe
+		sfn_sf_dec++;
+		if(sfn_sf_dec > 10239)
+			sfn_sf_dec = 0;
+
+	
+		fapi_subframe_ind_t ind;
+		ind.sfn_sf = sfn_sf;
+
+		if(instance->fapi->first_dl_config)
+			send_uplink_indications(instance, sfn_sf);
+
+		if(instance->tick == 1000)
+		{
+			if(instance->tx_byte_count > 0)
+			{
+				printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
+				instance->tx_byte_count = 0;
+			}
+			
+			instance->tick = 0;
+		}
+
+		instance->tick++;
+
+		(instance->callbacks.fapi_subframe_ind)(&(instance->_public), &ind);
+
+		{
+			phy_pdu* pdu = instance->fapi->allocate_phy_pdu();
+			int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, MSG_DONTWAIT, 0, 0);
+			if(len > 0)
+			{
+				pdu->len = len;
+				instance->fapi->push_rx_buffer(pdu);
+			}
+			else
+			{
+				instance->fapi->release_phy_pdu(pdu);
+			}
+		}
+		
+
+		if(catchup)
+		{
+			catchup--;
+		}
+		else
+		{
+			struct timespec now_ts;
+			struct timespec sleep_ts;
+			struct timespec sleep_rem_ts;
+
+			// get the current time
+			clock_gettime(CLOCK_MONOTONIC, &now_ts);
+
+
+			// determine how long to sleep before the start of the next 1ms
+			sleep_ts.tv_sec = 0;
+			sleep_ts.tv_nsec = 1e6 - (now_ts.tv_nsec % 1000000);
+
+			int nanosleep_result = nanosleep(&sleep_ts, &sleep_rem_ts);
+
+			if(nanosleep_result != 0)
+				printf("*** nanosleep failed or was interrupted\n");
+
+
+			clock_gettime(CLOCK_MONOTONIC, &now_ts);
+			millisec = now_ts.tv_nsec / 1e6;
+
+			if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec)
+			{
+				printf("*** missing millisec %d %d\n", last_millisec, millisec);
+				catchup = millisec - last_millisec - 1;
+			}
+
+			last_millisec = millisec;
+		}
+	}
+}
+
+extern "C"
+{
+	fapi_t* fapi_create(fapi_cb_t* callbacks, fapi_config_t* config)
+	{
+		fapi_internal_t* instance = (fapi_internal*)calloc(1, sizeof(fapi_internal_t));
+		instance->callbacks = *callbacks;
+		instance->config = *config;
+		instance->state = 0;
+
+		instance->fapi = new fapi_private();
+
+		return (fapi_t*)instance;
+	}
+	
+	void fapi_destroy(fapi_t* fapi)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+		
+		delete instance->fapi;
+		free(instance);
+	}
+
+	void* fapi_rx_thread_start(void* ptr)
+	{
+		set_thread_priority(60);
+
+		fapi_internal_t* instance = (fapi_internal_t*)ptr;
+
+		while(1)
+		{
+			phy_pdu* pdu = instance->fapi->allocate_phy_pdu();
+			int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, 0, 0, 0);
+			if(len > 0)
+			{
+				pdu->len = len;
+				instance->fapi->push_rx_buffer(pdu);
+			}
+			else
+			{
+				instance->fapi->release_phy_pdu(pdu);
+			}
+
+		}
+	}
+
+	void fapi_start_data(fapi_t* fapi, unsigned rx_port, const char* tx_address, unsigned tx_port)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+
+		printf("[FAPI] Rx Data from %d\n", rx_port);
+		printf("[FAPI] Tx Data to %s:%d\n", tx_address, tx_port);
+
+		instance->rx_sock = socket(AF_INET, SOCK_DGRAM, 0);
+		
+		if(instance->rx_sock < 0)
+		{
+			printf("[FAPI] Failed to create socket\n");
+			return;
+		}
+
+		struct sockaddr_in addr;
+		memset(&addr, 0, sizeof(addr));
+		addr.sin_family = AF_INET;
+		addr.sin_port = htons(rx_port);
+		addr.sin_addr.s_addr = INADDR_ANY;
+		
+		int bind_result = bind(instance->rx_sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
+		
+		if(bind_result == -1)
+		{
+			printf("[FAPI] Failed to bind to port %d\n", rx_port);
+			close(instance->rx_sock);
+			return ;
+		}
+
+		instance->tx_sock = socket(AF_INET, SOCK_DGRAM, 0);
+		instance->tx_addr.sin_family = AF_INET;
+		instance->tx_addr.sin_port = htons(tx_port);
+		instance->tx_addr.sin_addr.s_addr = inet_addr(tx_address);
+
+	}
+
+
+	void fill_tlv(fapi_tlv_t tlvs[], uint8_t count, uint8_t tag, uint8_t len, uint16_t value)
+	{
+		tlvs[count].tag = tag;
+		tlvs[count].value = value;
+		tlvs[count].length = len;
+		
+	}
+
+	int fapi_param_request(fapi_t* fapi, fapi_param_req_t* req)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+			
+		fapi_param_resp_t resp;
+		resp.header.message_id = FAPI_PARAM_RESPONSE;
+
+		resp.error_code = FAPI_MSG_OK;
+
+		resp.number_of_tlvs = 0;
+		fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_STATE_TAG, 2, instance->state);
+
+
+		if(instance->state == 0)
+		{
+			if(instance->config.duplex_mode == 0)
+			{
+				// -- TDD
+				// Downlink Bandwidth Support
+				// Uplink Bandwidth Support
+				// Downlink Modulation Support
+				// Uplink Modulation Support
+				// PHY Antenna Capability
+				// Release Capability
+				// MBSFN Capability
+			}
+			else if(instance->config.duplex_mode == 1)
+			{
+				// -- FDD
+				// Downlink Bandwidth Support
+				fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.dl_channel_bw_support);
+				// Uplink Bandwidth Support
+				fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.ul_channel_bw_support);
+				// Downlink Modulation Support
+				// Uplink Modulation Support
+				// PHY Antenna Capability
+				// Release Capability
+				// MBSFN Capability
+				// LAA Capability
+			}
+		}
+		else
+		{
+			if(instance->config.duplex_mode == 0)
+			{
+				// -- TDD
+				// Downlink Bandwidth Support
+				// Uplink Bandwidth Support
+				// Downlink Modulation Support
+				// Uplink Modulation Support
+				// PHY Antenna Capability
+				// Release Capability
+				// MBSFN Capability
+				// Duplexing Mode
+				// PCFICH Power Offset
+				// P-B
+				// DL Cyclic Prefix Type
+				// UL Cyclic Prefix Type
+				// RF Config
+				// PHICH Config
+				// SCH Config
+				// PRACH Config
+				// PUSCH Config
+				// PUCCH Config
+				// SRS Config
+				// Uplink Reference Signal Config
+				// TDD Frame Structure Config
+				// Data Report Mode
+			}
+			else if(instance->config.duplex_mode == 1)
+			{
+				// FDD
+				// Downlink Bandwidth Support
+				// Uplink Bandwidth Support
+				// Downlink Modulation Support
+				// Uplink Modulation Support
+				// PHY Antenna Capability
+				// Release Capability
+				// MBSFN Capability
+				// LAA Capability
+				// Duplexing Mode
+				// PCFICH Power Offset
+				// P-B
+				// DL Cyclic Prefix Type
+				// UL Cyclic Prefix Type
+				// RF Config
+				// PHICH Config
+				// SCH Config
+				// PRACH Config
+				// PUSCH Config
+				// PUCCH Config
+				// SRS Config
+				// Uplink Reference Signal Config
+				// Data Report Mode
+			}
+		}
+
+
+		//todo fill
+		(instance->callbacks.fapi_param_response)(fapi, &resp);
+
+		return 0;
+	}
+
+	int fapi_config_request(fapi_t* fapi, fapi_config_req_t* req)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+			
+		fapi_config_resp_t resp;
+		resp.header.message_id = FAPI_CONFIG_RESPONSE;
+		resp.error_code = FAPI_MSG_OK;
+
+		(instance->callbacks.fapi_config_response)(fapi, &resp);
+		return 0;
+	}
+
+	int fapi_start_request(fapi_t* fapi, fapi_start_req_t* req)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+			
+		pthread_t fapi_thread;
+		pthread_create(&fapi_thread, NULL, &fapi_thread_start, instance);
+		
+		return 0;
+	}
+
+	int fapi_dl_config_request(fapi_t* fapi, fapi_dl_config_req_t* req)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+		instance->fapi->first_dl_config = true;
+		return 0;
+	}
+	int fapi_ul_config_request(fapi_t* fapi, fapi_ul_config_req_t* req)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+		return 0;
+	}
+	int fapi_hi_dci0_request(fapi_t* fapi, fapi_hi_dci0_req_t* req)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+		return 0;
+	}
+	int fapi_tx_request(fapi_t* fapi, fapi_tx_req_t* req)
+	{
+		fapi_internal_t* instance = (fapi_internal_t*)fapi;
+
+		for(int i = 0; i < req->body.number_of_pdus; ++i)
+		{
+			uint16_t len = req->body.pdus[i].pdu_length;
+			uint32_t* data = req->body.pdus[i].tlvs[0].value;
+			//printf("[FAPI] sfnsf:%d len:%d\n", req->sfn_sf,len);
+			//
+			instance->tx_byte_count += len;
+
+			int sendto_result = sendto(instance->tx_sock, data, len, 0, (struct sockaddr*)&(instance->tx_addr), sizeof(instance->tx_addr));
+			
+			if(sendto_result == -1)
+			{
+				// error
+			}
+		}
+
+		return 0;
+	}
+}
+
diff --git a/nfapi/open-nFAPI/pnf_sim/src/main.cpp b/nfapi/open-nFAPI/pnf_sim/src/main.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e2622cf3c3636f1021633e1570c8949d31088f8c
--- /dev/null
+++ b/nfapi/open-nFAPI/pnf_sim/src/main.cpp
@@ -0,0 +1,2285 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+#include "debug.h"
+#include "nfapi_pnf_interface.h"
+#include "nfapi.h"
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <assert.h>
+#include <arpa/inet.h>
+
+#include <boost/foreach.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/exception/diagnostic_information.hpp> 
+#include <boost/exception_ptr.hpp> 
+
+
+#include <vendor_ext.h>
+
+#include "fapi_stub.h"
+#include "pool.h"
+
+
+#include <mutex>
+#include <list>
+#include <queue>
+#include <map>
+#include <vector>
+#include <algorithm>
+#include <stdlib.h>
+
+#define NUM_P5_PHY 2
+
+uint16_t phy_antenna_capability_values[] = { 1, 2, 4, 8, 16 };
+
+static uint32_t rand_range(uint32_t min, uint32_t max)
+{
+	return ((rand() % (max + 1 - min)) + min);
+}
+
+
+
+extern "C" nfapi_pnf_param_response_t g_pnf_param_resp;
+
+extern "C" {
+
+
+void* pnf_allocate(size_t size)
+{
+	return (void*)memory_pool::allocate(size);
+}
+
+void pnf_deallocate(void* ptr)
+{
+	memory_pool::deallocate((uint8_t*)ptr);
+}
+
+
+int read_xml(const char *xml_file);
+
+};
+
+class udp_data
+{
+	public:
+		bool enabled;
+		uint32_t rx_port;
+		uint32_t tx_port;
+		std::string tx_addr;
+};
+
+class phy_info
+{
+	public:
+
+		phy_info()
+			: first_subframe_ind(0), fapi(0),
+			  dl_ues_per_subframe(0), ul_ues_per_subframe(0), 
+			  timing_window(0), timing_info_mode(0), timing_info_period(0)
+		{
+			index = 0;
+			id = 0;
+
+			local_port = 0;
+			remote_addr = 0;
+			remote_port = 0;
+	
+			duplex_mode = 0;
+			dl_channel_bw_support = 0;
+			ul_channel_bw_support = 0;
+			num_dl_layers_supported = 0;
+			num_ul_layers_supported = 0;
+			release_supported = 0;
+			nmm_modes_supported = 0;
+		}
+
+		uint16_t index;
+		uint16_t id;
+		std::vector<uint8_t> rfs;
+		std::vector<uint8_t> excluded_rfs;
+
+		udp_data udp;
+
+		std::string local_addr;
+		int local_port;
+
+		char* remote_addr;
+		int remote_port;
+
+		uint8_t duplex_mode;
+		uint16_t dl_channel_bw_support;
+		uint16_t ul_channel_bw_support;
+		uint8_t num_dl_layers_supported;
+		uint8_t num_ul_layers_supported;
+		uint16_t release_supported;
+		uint8_t nmm_modes_supported;
+
+		uint8_t dl_ues_per_subframe;
+		uint8_t ul_ues_per_subframe;
+
+		uint8_t first_subframe_ind;
+
+		// timing information recevied from the vnf
+		uint8_t timing_window;
+		uint8_t timing_info_mode;
+		uint8_t timing_info_period;
+
+		fapi_t* fapi;
+
+};
+
+class rf_info
+{
+	public:
+		uint16_t index;
+		uint16_t band;
+		int16_t max_transmit_power;
+		int16_t min_transmit_power;
+		uint8_t num_antennas_supported;
+		uint32_t min_downlink_frequency;
+		uint32_t max_downlink_frequency;
+		uint32_t max_uplink_frequency;
+		uint32_t min_uplink_frequency;
+};
+
+
+class pnf_info
+{
+	public:
+
+		pnf_info() 
+		: release(13), wireshark_test_mode(0),
+		  max_total_power(0), oui(0)
+					
+		{
+			release = 0;
+	
+			sync_mode = 0;
+			location_mode = 0;
+			dl_config_timing = 0;
+			ul_config_timing = 0;
+			tx_timing = 0;
+			hi_dci0_timing = 0;
+	
+			max_phys = 0;
+			max_total_bw = 0;
+			max_total_dl_layers = 0;
+			max_total_ul_layers = 0;
+			shared_bands = 0;
+			shared_pa = 0;
+			
+		}
+
+		int release;
+		std::vector<phy_info> phys;
+		std::vector<rf_info> rfs;
+
+		uint8_t sync_mode;
+		uint8_t location_mode;
+		uint8_t location_coordinates[6];
+		uint32_t dl_config_timing;
+		uint32_t ul_config_timing;
+		uint32_t tx_timing;
+		uint32_t hi_dci0_timing;
+
+		uint16_t max_phys;
+		uint16_t max_total_bw;
+		uint16_t max_total_dl_layers;
+		uint16_t max_total_ul_layers;
+		uint8_t shared_bands;
+		uint8_t shared_pa;
+		int16_t max_total_power;
+		uint8_t oui;
+		
+		uint8_t wireshark_test_mode;
+
+};
+
+struct pnf_phy_user_data_t
+{
+	uint16_t phy_id;
+	nfapi_pnf_config_t* config;
+	phy_info* phy;
+	nfapi_pnf_p7_config_t* p7_config;
+};
+
+int read_pnf_xml(pnf_info& pnf, const char* xml_file)
+{
+	try
+	{
+		std::ifstream input(xml_file);
+	
+		using boost::property_tree::ptree;
+		ptree pt;
+	
+		read_xml(input, pt);
+		
+		pnf.wireshark_test_mode = pt.get<unsigned>("pnf.wireshark_test_mode", 0);
+	
+		
+		pnf.sync_mode = pt.get<unsigned>("pnf.sync_mode");
+		pnf.location_mode= pt.get<unsigned>("pnf.location_mode");
+		//pnf.sync_mode = pt.get<unsigned>("pnf.location_coordinates");
+	
+		pnf.dl_config_timing= pt.get<unsigned>("pnf.dl_config_timing");
+		pnf.ul_config_timing = pt.get<unsigned>("pnf.ul_config_timing");
+		pnf.tx_timing = pt.get<unsigned>("pnf.tx_timing");
+		pnf.hi_dci0_timing = pt.get<unsigned>("pnf.hi_dci0_timing");
+	
+		pnf.max_phys = pt.get<unsigned>("pnf.max_phys");
+		pnf.max_total_bw = pt.get<unsigned>("pnf.max_total_bandwidth");
+		pnf.max_total_dl_layers = pt.get<unsigned>("pnf.max_total_num_dl_layers");
+		pnf.max_total_ul_layers = pt.get<unsigned>("pnf.max_total_num_ul_layers");
+	
+		pnf.shared_bands = pt.get<unsigned>("pnf.shared_bands");
+		pnf.shared_pa = pt.get<unsigned>("pnf.shared_pas");
+	
+		pnf.max_total_power = pt.get<signed>("pnf.maximum_total_power");
+	
+		//"oui");
+	
+		for(const auto& v : pt.get_child("pnf.phys"))
+		{
+			if(v.first == "phy")
+			{
+				phy_info phy;
+				
+				
+					
+				phy.index = v.second.get<unsigned>("index");
+				phy.local_port = v.second.get<unsigned>("port");
+				phy.local_addr = v.second.get<std::string>("address");
+				phy.duplex_mode = v.second.get<unsigned>("duplex_mode");
+	
+				phy.dl_channel_bw_support = v.second.get<unsigned>("downlink_channel_bandwidth_support");
+				phy.ul_channel_bw_support = v.second.get<unsigned>("uplink_channel_bandwidth_support");
+				phy.num_dl_layers_supported = v.second.get<unsigned>("number_of_dl_layers");
+				phy.num_ul_layers_supported = v.second.get<unsigned>("number_of_ul_layers");
+				phy.release_supported = v.second.get<unsigned>("3gpp_release_supported");
+				phy.nmm_modes_supported = v.second.get<unsigned>("nmm_modes_supported");
+	
+				for(const auto& v2 : v.second.get_child("rfs"))
+				{
+					if(v2.first == "index")
+						phy.rfs.push_back(v2.second.get_value<unsigned>());
+				}
+				for(const auto& v2 : v.second.get_child("excluded_rfs"))
+				{
+					if(v2.first == "index")
+						phy.excluded_rfs.push_back(v2.second.get_value<unsigned>());
+				}
+	
+				boost::optional<const boost::property_tree::ptree&> d = v.second.get_child_optional("data.udp");
+				if(d.is_initialized())
+				{
+					phy.udp.enabled = true;
+					phy.udp.rx_port = d.get().get<unsigned>("rx_port");
+					phy.udp.tx_port = d.get().get<unsigned>("tx_port");
+					phy.udp.tx_addr = d.get().get<std::string>("tx_addr");
+				}
+				else
+				{
+					phy.udp.enabled = false;
+				}
+	
+				phy.dl_ues_per_subframe = v.second.get<unsigned>("dl_ues_per_subframe");
+				phy.ul_ues_per_subframe = v.second.get<unsigned>("ul_ues_per_subframe");
+	
+				pnf.phys.push_back(phy);
+			}
+		}	
+		for(const auto& v : pt.get_child("pnf.rfs"))
+		{
+			if(v.first == "rf")
+			{
+				rf_info rf;
+	
+				rf.index = v.second.get<unsigned>("index");
+				rf.band = v.second.get<unsigned>("band");
+				rf.max_transmit_power = v.second.get<signed>("max_transmit_power");
+				rf.min_transmit_power = v.second.get<signed>("min_transmit_power");
+				rf.num_antennas_supported = v.second.get<unsigned>("num_antennas_supported");
+				rf.min_downlink_frequency = v.second.get<unsigned>("min_downlink_frequency");
+				rf.max_downlink_frequency = v.second.get<unsigned>("max_downlink_frequency");
+				rf.min_uplink_frequency = v.second.get<unsigned>("max_uplink_frequency");
+				rf.max_uplink_frequency = v.second.get<unsigned>("min_uplink_frequency");
+	
+				pnf.rfs.push_back(rf);
+			}
+		}	
+	}
+	catch(std::exception& e)
+	{
+		printf("%s", e.what());
+		return -1;
+	}
+	catch(boost::exception& e)
+	{
+		printf("%s", boost::diagnostic_information(e).c_str());
+		return -1;
+	}
+	
+	return 0;
+}
+
+
+
+void pnf_sim_trace(nfapi_trace_level_t level, const char* message, ...)
+{
+	va_list args;
+	va_start(args, message);
+	vprintf(message, args);
+	va_end(args);
+}
+
+void set_thread_priority(int priority)
+{
+	//printf("%s(priority:%d)\n", __FUNCTION__, priority);
+
+	pthread_attr_t ptAttr;
+	
+	struct sched_param schedParam;
+	schedParam.__sched_priority = priority; //79;
+	if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0)
+	{
+		printf("failed to set SCHED_RR\n");
+	}
+
+	if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0)
+	{
+		printf("failed to set pthread SCHED_RR %d\n", errno);
+	}
+
+	pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
+
+	struct sched_param thread_params;
+	thread_params.sched_priority = 20;
+	if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0)
+	{
+		printf("failed to set sched param\n");
+	}
+}
+
+
+void* pnf_p7_thread_start(void* ptr)
+{
+	set_thread_priority(79);
+
+	nfapi_pnf_p7_config_t* config = (nfapi_pnf_p7_config_t*)ptr;
+	nfapi_pnf_p7_start(config);
+	
+	return 0;
+}
+
+
+
+int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req)
+{
+	printf("[PNF_SIM] pnf param request\n");
+
+	nfapi_pnf_param_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
+	resp.error_code = NFAPI_MSG_OK;
+
+	pnf_info* pnf = (pnf_info*)(config->user_data);
+	
+	resp.pnf_param_general.tl.tag = NFAPI_PNF_PARAM_GENERAL_TAG;
+	resp.pnf_param_general.nfapi_sync_mode = pnf->sync_mode;
+	resp.pnf_param_general.location_mode = pnf->location_mode;
+	//uint8_t location_coordinates[NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH];
+	resp.pnf_param_general.dl_config_timing = pnf->dl_config_timing;
+	resp.pnf_param_general.tx_timing = pnf->tx_timing;
+	resp.pnf_param_general.ul_config_timing = pnf->ul_config_timing;
+	resp.pnf_param_general.hi_dci0_timing = pnf->hi_dci0_timing;
+	resp.pnf_param_general.maximum_number_phys = pnf->max_phys;
+	resp.pnf_param_general.maximum_total_bandwidth = pnf->max_total_bw;
+	resp.pnf_param_general.maximum_total_number_dl_layers = pnf->max_total_dl_layers;
+	resp.pnf_param_general.maximum_total_number_ul_layers = pnf->max_total_ul_layers;
+	resp.pnf_param_general.shared_bands = pnf->shared_bands;
+	resp.pnf_param_general.shared_pa = pnf->shared_pa;
+	resp.pnf_param_general.maximum_total_power = pnf->max_total_power;
+	//uint8_t oui[NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH];
+
+	resp.pnf_phy.tl.tag = NFAPI_PNF_PHY_TAG;
+	resp.pnf_phy.number_of_phys = pnf->phys.size();
+	
+	for(int i = 0; i < pnf->phys.size(); ++i)
+	{
+		resp.pnf_phy.phy[i].phy_config_index = pnf->phys[i].index; 
+		resp.pnf_phy.phy[i].downlink_channel_bandwidth_supported = pnf->phys[i].dl_channel_bw_support;
+		resp.pnf_phy.phy[i].uplink_channel_bandwidth_supported = pnf->phys[i].ul_channel_bw_support;
+		resp.pnf_phy.phy[i].number_of_dl_layers_supported = pnf->phys[i].num_dl_layers_supported;
+		resp.pnf_phy.phy[i].number_of_ul_layers_supported = pnf->phys[i].num_ul_layers_supported;
+		resp.pnf_phy.phy[i].maximum_3gpp_release_supported = pnf->phys[i].release_supported;
+		resp.pnf_phy.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
+
+		resp.pnf_phy.phy[i].number_of_rfs = pnf->phys[i].rfs.size();
+		for(int j = 0; j < pnf->phys[i].rfs.size(); ++j)
+		{
+			resp.pnf_phy.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
+		}
+
+		resp.pnf_phy.phy[i].number_of_rf_exclusions = pnf->phys[i].excluded_rfs.size();
+		for(int j = 0; j < pnf->phys[i].excluded_rfs.size(); ++j)
+		{
+			resp.pnf_phy.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
+		}
+	}
+
+
+	resp.pnf_rf.tl.tag = NFAPI_PNF_RF_TAG;
+	resp.pnf_rf.number_of_rfs = pnf->rfs.size();
+
+	for(int i = 0; i < pnf->rfs.size(); ++i)
+	{
+		resp.pnf_rf.rf[i].rf_config_index = pnf->rfs[i].index; 
+		resp.pnf_rf.rf[i].band = pnf->rfs[i].band;
+		resp.pnf_rf.rf[i].maximum_transmit_power = pnf->rfs[i].max_transmit_power; 
+		resp.pnf_rf.rf[i].minimum_transmit_power = pnf->rfs[i].min_transmit_power;
+		resp.pnf_rf.rf[i].number_of_antennas_suppported = pnf->rfs[i].num_antennas_supported;
+		resp.pnf_rf.rf[i].minimum_downlink_frequency = pnf->rfs[i].min_downlink_frequency;
+		resp.pnf_rf.rf[i].maximum_downlink_frequency = pnf->rfs[i].max_downlink_frequency;
+		resp.pnf_rf.rf[i].minimum_uplink_frequency = pnf->rfs[i].min_uplink_frequency;
+		resp.pnf_rf.rf[i].maximum_uplink_frequency = pnf->rfs[i].max_uplink_frequency;
+	}
+
+	if(pnf->release >= 10)
+	{
+		resp.pnf_phy_rel10.tl.tag = NFAPI_PNF_PHY_REL10_TAG;
+		resp.pnf_phy_rel10.number_of_phys = pnf->phys.size();
+		
+		for(int i = 0; i < pnf->phys.size(); ++i)
+		{
+			resp.pnf_phy_rel10.phy[i].phy_config_index = pnf->phys[i].index; 
+			resp.pnf_phy_rel10.phy[i].transmission_mode_7_supported = 0;
+			resp.pnf_phy_rel10.phy[i].transmission_mode_8_supported = 1;
+			resp.pnf_phy_rel10.phy[i].two_antenna_ports_for_pucch = 0;
+			resp.pnf_phy_rel10.phy[i].transmission_mode_9_supported = 1;
+			resp.pnf_phy_rel10.phy[i].simultaneous_pucch_pusch = 0;
+			resp.pnf_phy_rel10.phy[i].four_layer_tx_with_tm3_and_tm4 = 1;
+
+		}
+	}
+
+	if(pnf->release >= 11)
+	{
+		resp.pnf_phy_rel11.tl.tag = NFAPI_PNF_PHY_REL11_TAG;
+		resp.pnf_phy_rel11.number_of_phys = pnf->phys.size();
+		
+		for(int i = 0; i < pnf->phys.size(); ++i)
+		{
+			resp.pnf_phy_rel11.phy[i].phy_config_index = pnf->phys[i].index; 
+			resp.pnf_phy_rel11.phy[i].edpcch_supported = 0;
+			resp.pnf_phy_rel11.phy[i].multi_ack_csi_reporting = 1;
+			resp.pnf_phy_rel11.phy[i].pucch_tx_diversity = 0;
+			resp.pnf_phy_rel11.phy[i].ul_comp_supported = 1;
+			resp.pnf_phy_rel11.phy[i].transmission_mode_5_supported = 0;
+		}
+	}
+
+	if(pnf->release >= 12)
+	{
+		resp.pnf_phy_rel12.tl.tag = NFAPI_PNF_PHY_REL12_TAG;
+		resp.pnf_phy_rel12.number_of_phys = pnf->phys.size();
+		
+		for(int i = 0; i < pnf->phys.size(); ++i)
+		{
+			resp.pnf_phy_rel12.phy[i].phy_config_index = pnf->phys[i].index; 
+			resp.pnf_phy_rel12.phy[i].csi_subframe_set = 0;
+			resp.pnf_phy_rel12.phy[i].enhanced_4tx_codebook = 2; // yes this is invalid
+			resp.pnf_phy_rel12.phy[i].drs_supported = 0;
+			resp.pnf_phy_rel12.phy[i].ul_64qam_supported = 1;
+			resp.pnf_phy_rel12.phy[i].transmission_mode_10_supported = 0;
+			resp.pnf_phy_rel12.phy[i].alternative_bts_indices = 1;
+		}
+	}
+
+	if(pnf->release >= 13)
+	{
+		resp.pnf_phy_rel13.tl.tag = NFAPI_PNF_PHY_REL13_TAG;
+		resp.pnf_phy_rel13.number_of_phys = pnf->phys.size();
+		
+		for(int i = 0; i < pnf->phys.size(); ++i)
+		{
+			resp.pnf_phy_rel13.phy[i].phy_config_index = pnf->phys[i].index; 
+			resp.pnf_phy_rel13.phy[i].pucch_format4_supported = 0;
+			resp.pnf_phy_rel13.phy[i].pucch_format5_supported = 1;
+			resp.pnf_phy_rel13.phy[i].more_than_5_ca_support = 0;
+			resp.pnf_phy_rel13.phy[i].laa_supported = 1;
+			resp.pnf_phy_rel13.phy[i].laa_ending_in_dwpts_supported = 0;
+			resp.pnf_phy_rel13.phy[i].laa_starting_in_second_slot_supported = 1;
+			resp.pnf_phy_rel13.phy[i].beamforming_supported = 0;
+			resp.pnf_phy_rel13.phy[i].csi_rs_enhancement_supported = 1;
+			resp.pnf_phy_rel13.phy[i].drms_enhancement_supported = 0;
+			resp.pnf_phy_rel13.phy[i].srs_enhancement_supported = 1;
+		}
+		
+		resp.pnf_phy_rel13_nb_iot.tl.tag = NFAPI_PNF_PHY_REL13_NB_IOT_TAG;
+		resp.pnf_phy_rel13_nb_iot.number_of_phys = pnf->phys.size();		
+		
+		for(int i = 0; i < pnf->phys.size(); ++i)
+		{
+			resp.pnf_phy_rel13_nb_iot.phy[i].phy_config_index = pnf->phys[i].index; 
+			
+			resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rfs = pnf->phys[i].rfs.size();
+			for(int j = 0; j < pnf->phys[i].rfs.size(); ++j)
+			{
+				resp.pnf_phy_rel13_nb_iot.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
+			}
+	
+			resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rf_exclusions = pnf->phys[i].excluded_rfs.size();
+			for(int j = 0; j < pnf->phys[i].excluded_rfs.size(); ++j)
+			{
+				resp.pnf_phy_rel13_nb_iot.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
+			}
+			
+			resp.pnf_phy_rel13_nb_iot.phy[i].number_of_dl_layers_supported = pnf->phys[i].num_dl_layers_supported;
+			resp.pnf_phy_rel13_nb_iot.phy[i].number_of_ul_layers_supported = pnf->phys[i].num_ul_layers_supported;
+			resp.pnf_phy_rel13_nb_iot.phy[i].maximum_3gpp_release_supported = pnf->phys[i].release_supported;
+			resp.pnf_phy_rel13_nb_iot.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
+
+		}
+	}
+
+
+	nfapi_pnf_pnf_param_resp(config, &resp);
+	
+	return 0;
+}
+
+int pnf_config_request(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req)
+{
+	printf("[PNF_SIM] pnf config request\n");
+
+	pnf_info* pnf = (pnf_info*)(config->user_data);
+
+	for(int i = 0; i < req->pnf_phy_rf_config.number_phy_rf_config_info; ++i)
+	{
+		auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
+								  { return item.index == req->pnf_phy_rf_config.phy_rf_config[i].phy_config_index; });
+
+		if(found != pnf->phys.end())
+		{
+			phy_info& phy = (*found);
+			phy.id = req->pnf_phy_rf_config.phy_rf_config[i].phy_id;
+			printf("[PNF_SIM] pnf config request assigned phy_id %d to phy_config_index %d\n", phy.id, req->pnf_phy_rf_config.phy_rf_config[i].phy_config_index);
+		}
+		else
+		{
+			// did not find the phy
+			printf("[PNF_SIM] pnf config request did not find phy_config_index %d\n", req->pnf_phy_rf_config.phy_rf_config[i].phy_config_index);
+		}
+
+	}
+
+	nfapi_pnf_config_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_pnf_config_resp(config, &resp);
+
+	return 0;
+}
+
+int fapi_param_response(fapi_t* fapi, fapi_param_resp_t* resp)
+{
+	printf("[PNF_SIM] fapi param response\n");
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_param_response_t nfapi_resp;
+
+	memset(&nfapi_resp, 0, sizeof(nfapi_resp));
+	nfapi_resp.header.message_id = NFAPI_PARAM_RESPONSE;
+	nfapi_resp.header.phy_id = data->phy_id;
+	nfapi_resp.error_code = resp->error_code;
+
+	for(int i = 0; i < resp->number_of_tlvs; ++i)
+	{
+		switch(resp->tlvs[i].tag)
+		{
+			case FAPI_PHY_STATE_TAG:
+				nfapi_resp.l1_status.phy_state.tl.tag = NFAPI_L1_STATUS_PHY_STATE_TAG;
+				nfapi_resp.l1_status.phy_state.value = resp->tlvs[i].value;
+				nfapi_resp.num_tlv++;
+				break;
+
+			case FAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG:
+				nfapi_resp.phy_capabilities.dl_bandwidth_support.tl.tag = NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG;
+				nfapi_resp.phy_capabilities.dl_bandwidth_support.value = resp->tlvs[i].value;
+				nfapi_resp.num_tlv++;
+				break;
+
+			case FAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG:
+				nfapi_resp.phy_capabilities.ul_bandwidth_support.tl.tag = NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG;
+				nfapi_resp.phy_capabilities.ul_bandwidth_support.value = resp->tlvs[i].value;
+				nfapi_resp.num_tlv++;
+				break;
+		}
+	}
+	
+	if(1)
+	{
+		// just code to populate all the tlv for testing with wireshark
+		// todo : these should be move up so that they are populated by fapi
+		
+		nfapi_resp.phy_capabilities.dl_modulation_support.tl.tag = NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG;
+		nfapi_resp.phy_capabilities.dl_modulation_support.value = rand_range(0, 0x0F);
+		nfapi_resp.num_tlv++;
+		nfapi_resp.phy_capabilities.ul_modulation_support.tl.tag = NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG;
+		nfapi_resp.phy_capabilities.ul_modulation_support.value = rand_range(0, 0x07);
+		nfapi_resp.num_tlv++;
+		nfapi_resp.phy_capabilities.phy_antenna_capability.tl.tag = NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG;
+		nfapi_resp.phy_capabilities.phy_antenna_capability.value = phy_antenna_capability_values[rand_range(0, 4)];
+		nfapi_resp.num_tlv++;
+		nfapi_resp.phy_capabilities.release_capability.tl.tag = NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG;
+		nfapi_resp.phy_capabilities.release_capability.value = rand_range(0, 0x3F);
+		nfapi_resp.num_tlv++;
+		nfapi_resp.phy_capabilities.mbsfn_capability.tl.tag = NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG;
+		nfapi_resp.phy_capabilities.mbsfn_capability.value = rand_range(0, 1);
+		nfapi_resp.num_tlv++;
+		
+		
+		nfapi_resp.laa_capability.laa_support.tl.tag = NFAPI_LAA_CAPABILITY_LAA_SUPPORT_TAG;
+		nfapi_resp.laa_capability.laa_support.value = rand_range(0, 1);
+		nfapi_resp.num_tlv++;
+		nfapi_resp.laa_capability.pd_sensing_lbt_support.tl.tag = NFAPI_LAA_CAPABILITY_PD_SENSING_LBT_SUPPORT_TAG;
+		nfapi_resp.laa_capability.pd_sensing_lbt_support.value = rand_range(0, 1);		
+		nfapi_resp.num_tlv++;
+		nfapi_resp.laa_capability.multi_carrier_lbt_support.tl.tag = NFAPI_LAA_CAPABILITY_MULTI_CARRIER_LBT_SUPPORT_TAG;
+		nfapi_resp.laa_capability.multi_carrier_lbt_support.value = rand_range(0, 0x0F);		
+		nfapi_resp.num_tlv++;
+		nfapi_resp.laa_capability.partial_sf_support.tl.tag = NFAPI_LAA_CAPABILITY_PARTIAL_SF_SUPPORT_TAG;
+		nfapi_resp.laa_capability.partial_sf_support.value = rand_range(0, 1);		
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.nb_iot_capability.nb_iot_support.tl.tag = NFAPI_LAA_CAPABILITY_NB_IOT_SUPPORT_TAG;
+		nfapi_resp.nb_iot_capability.nb_iot_support.value = rand_range(0, 2);		
+		nfapi_resp.num_tlv++;
+		nfapi_resp.nb_iot_capability.nb_iot_operating_mode_capability.tl.tag = NFAPI_LAA_CAPABILITY_NB_IOT_OPERATING_MODE_CAPABILITY_TAG;
+		nfapi_resp.nb_iot_capability.nb_iot_operating_mode_capability.value = rand_range(0, 1);		
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.subframe_config.pcfich_power_offset.tl.tag = NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.subframe_config.pb.tl.tag = NFAPI_SUBFRAME_CONFIG_PB_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.subframe_config.dl_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.subframe_config.ul_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG;
+		nfapi_resp.num_tlv++;		
+		
+		nfapi_resp.rf_config.dl_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.rf_config.ul_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.rf_config.reference_signal_power.tl.tag = NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.rf_config.tx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.rf_config.rx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.phich_config.phich_resource.tl.tag = NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.phich_config.phich_duration.tl.tag = NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.phich_config.phich_power_offset.tl.tag = NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.sch_config.primary_synchronization_signal_epre_eprers.tl.tag = NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.sch_config.secondary_synchronization_signal_epre_eprers.tl.tag = NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.sch_config.physical_cell_id.tl.tag = NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.prach_config.configuration_index.tl.tag = NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.prach_config.root_sequence_index.tl.tag = NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.prach_config.zero_correlation_zone_configuration.tl.tag = NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.prach_config.high_speed_flag.tl.tag = NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.prach_config.frequency_offset.tl.tag = NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.pusch_config.hopping_mode.tl.tag = NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.pusch_config.hopping_offset.tl.tag = NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.pusch_config.number_of_subbands.tl.tag = NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.pucch_config.delta_pucch_shift.tl.tag = NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.pucch_config.n_cqi_rb.tl.tag = NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.pucch_config.n_an_cs.tl.tag = NFAPI_PUCCH_CONFIG_N_AN_CS_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.pucch_config.n1_pucch_an.tl.tag = NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.srs_config.bandwidth_configuration.tl.tag = NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.srs_config.max_up_pts.tl.tag = NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.srs_config.srs_subframe_configuration.tl.tag = NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.srs_config.srs_acknack_srs_simultaneous_transmission.tl.tag = NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.uplink_reference_signal_config.uplink_rs_hopping.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.uplink_reference_signal_config.group_assignment.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.uplink_reference_signal_config.cyclic_shift_1_for_drms.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.tdd_frame_structure_config.subframe_assignment.tl.tag = NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.tdd_frame_structure_config.special_subframe_patterns.tl.tag = NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG;
+		nfapi_resp.num_tlv++;
+		
+		nfapi_resp.l23_config.data_report_mode.tl.tag = NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG;
+		nfapi_resp.num_tlv++;
+		nfapi_resp.l23_config.sfnsf.tl.tag = NFAPI_L23_CONFIG_SFNSF_TAG;
+		nfapi_resp.num_tlv++;
+	}
+		
+
+	{
+		//if(phy->state == NFAPI_PNF_PHY_IDLE)
+		//if(nfapi_resp.l1_status.phy_state.value == NFAPI_PNF_PHY_IDLE)
+		{
+			// -- NFAPI
+			// Downlink UEs per Subframe
+			nfapi_resp.nfapi_config.dl_ue_per_sf.tl.tag = NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG;
+			nfapi_resp.nfapi_config.dl_ue_per_sf.value = data->phy->dl_ues_per_subframe;
+			nfapi_resp.num_tlv++;
+			// Uplink UEs per Subframe
+			nfapi_resp.nfapi_config.ul_ue_per_sf.tl.tag = NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG;
+			nfapi_resp.nfapi_config.ul_ue_per_sf.value = data->phy->ul_ues_per_subframe;
+			nfapi_resp.num_tlv++;
+			// nFAPI RF Bands
+			nfapi_resp.nfapi_config.rf_bands.tl.tag = NFAPI_PHY_RF_BANDS_TAG;
+			nfapi_resp.nfapi_config.rf_bands.number_rf_bands = 2;
+			nfapi_resp.nfapi_config.rf_bands.rf_band[0] = 23;
+			nfapi_resp.nfapi_config.rf_bands.rf_band[1] = 7;
+			
+			// P7 PNF Address IPv4
+			nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
+			struct sockaddr_in pnf_p7_sockaddr;
+			pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(data->phy->local_addr.c_str());
+			memcpy(&(nfapi_resp.nfapi_config.p7_pnf_address_ipv4.address[0]), &pnf_p7_sockaddr.sin_addr.s_addr, 4);
+			nfapi_resp.num_tlv++;
+			// P7 PNF Address IPv6
+			// P7 PNF Port
+			nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
+			nfapi_resp.nfapi_config.p7_pnf_port.value = data->phy->local_port;
+			nfapi_resp.num_tlv++;
+			// NMM GSM Frequency Bands
+			nfapi_resp.nfapi_config.nmm_gsm_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG;
+			nfapi_resp.nfapi_config.nmm_gsm_frequency_bands.number_of_rf_bands = 1;
+			nfapi_resp.nfapi_config.nmm_gsm_frequency_bands.bands[0] = 23;
+			nfapi_resp.num_tlv++;
+			// NMM UMTS Frequency Bands
+			nfapi_resp.nfapi_config.nmm_umts_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG;
+			nfapi_resp.nfapi_config.nmm_umts_frequency_bands.number_of_rf_bands = 1;
+			nfapi_resp.nfapi_config.nmm_umts_frequency_bands.bands[0] = 23;
+			nfapi_resp.num_tlv++;
+			// NMM LTE Frequency Bands
+			nfapi_resp.nfapi_config.nmm_lte_frequency_bands.tl.tag = NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG;
+			nfapi_resp.nfapi_config.nmm_lte_frequency_bands.number_of_rf_bands = 1;
+			nfapi_resp.nfapi_config.nmm_lte_frequency_bands.bands[0] = 23;
+			nfapi_resp.num_tlv++;
+			// NMM Uplink RSSI supported
+			nfapi_resp.nfapi_config.nmm_uplink_rssi_supported.tl.tag = NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG;
+			nfapi_resp.nfapi_config.nmm_uplink_rssi_supported.value = 1;
+			nfapi_resp.num_tlv++;
+
+		}
+	}
+
+
+		
+	nfapi_pnf_param_resp(data->config, &nfapi_resp);
+
+	return 0;
+}
+
+int fapi_config_response(fapi_t* fapi, fapi_config_resp_t* resp)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_config_response_t nfapi_resp;
+	memset(&nfapi_resp, 0, sizeof(nfapi_resp));
+	nfapi_resp.header.message_id = NFAPI_CONFIG_RESPONSE;
+	nfapi_resp.header.phy_id = data->phy_id;
+	nfapi_resp.error_code = resp->error_code;
+	nfapi_pnf_config_resp(data->config, &nfapi_resp);
+
+	return 0;
+}
+
+int fapi_subframe_ind(fapi_t* fapi, fapi_subframe_ind_t* resp)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	if(data->phy->first_subframe_ind == 0)
+	{
+		printf("Sending nfapi_pnf_start_resp phy_id:%d\n", data->phy_id);
+		nfapi_start_response_t start_resp;
+		memset(&start_resp, 0, sizeof(start_resp));
+		start_resp.header.message_id = NFAPI_START_RESPONSE;
+		start_resp.header.phy_id = data->phy_id;
+		start_resp.error_code = NFAPI_MSG_OK;
+		nfapi_pnf_start_resp(data->config, &start_resp);
+		
+		data->phy->first_subframe_ind = 1;
+
+		if(data->phy->udp.enabled)
+		{
+			fapi_start_data(fapi, 
+							data->phy->udp.rx_port, 
+							data->phy->udp.tx_addr.c_str(), 
+							data->phy->udp.tx_port);
+		}
+	
+	}
+
+
+	nfapi_pnf_p7_subframe_ind(data->p7_config, data->phy_id, resp->sfn_sf);
+	
+	return 0;
+
+}
+
+int fapi_harq_ind(fapi_t* fapi, fapi_harq_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_harq_indication_t harq_ind;
+	memset(&harq_ind, 0, sizeof(harq_ind));
+	harq_ind.header.message_id = NFAPI_HARQ_INDICATION;
+	harq_ind.header.phy_id = data->p7_config->phy_id;
+	harq_ind.sfn_sf = ind->sfn_sf;
+
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		harq_ind.harq_indication_body.tl.tag = NFAPI_HARQ_INDICATION_BODY_TAG;
+		harq_ind.harq_indication_body.number_of_harqs = 1;
+	
+		nfapi_harq_indication_pdu_t pdus[harq_ind.harq_indication_body.number_of_harqs];
+		memset(&pdus, 0, sizeof(pdus));
+		
+		pdus[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+		pdus[0].rx_ue_information.handle = rand_range(0, 9999);
+		pdus[0].rx_ue_information.rnti = rand_range(1, 65535);
+		
+		
+		
+		pdus[0].harq_indication_tdd_rel8.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL8_TAG;
+		pdus[0].harq_indication_tdd_rel8.mode = rand_range(0, 4);
+		pdus[0].harq_indication_tdd_rel8.number_of_ack_nack = rand_range(1, 4);
+		
+		switch(pdus[0].harq_indication_tdd_rel8.mode)
+		{
+			case 0:
+			{
+				pdus[0].harq_indication_tdd_rel8.harq_data.bundling.value_0 = rand_range(1, 7);
+				pdus[0].harq_indication_tdd_rel8.harq_data.bundling.value_1 = rand_range(1, 7);
+			}
+			break;
+			case 1:
+			{
+				pdus[0].harq_indication_tdd_rel8.harq_data.multiplex.value_0 = rand_range(1, 7);
+				pdus[0].harq_indication_tdd_rel8.harq_data.multiplex.value_1 = rand_range(1, 7);
+				pdus[0].harq_indication_tdd_rel8.harq_data.multiplex.value_2 = rand_range(1, 7);
+				pdus[0].harq_indication_tdd_rel8.harq_data.multiplex.value_3 = rand_range(1, 7);
+			}
+			break;
+			case 2:
+			{
+				pdus[0].harq_indication_tdd_rel8.harq_data.special_bundling.value_0 = rand_range(1, 7);
+			}
+			break;
+		};
+		
+		
+		pdus[0].harq_indication_tdd_rel9.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL9_TAG;
+		pdus[0].harq_indication_tdd_rel9.mode = rand_range(0, 4);
+		pdus[0].harq_indication_tdd_rel9.number_of_ack_nack = 1;
+		
+		switch(pdus[0].harq_indication_tdd_rel9.mode)
+		{
+			case 0:
+			{		
+				pdus[0].harq_indication_tdd_rel9.harq_data[0].bundling.value_0 = rand_range(1, 7);
+			}
+			break;
+			case 1:
+			{
+				pdus[0].harq_indication_tdd_rel9.harq_data[0].multiplex.value_0 = rand_range(1, 7);
+			}
+			break;
+			case 2:
+			{
+				pdus[0].harq_indication_tdd_rel9.harq_data[0].special_bundling.value_0 = rand_range(1, 7);
+			}
+			break;
+			case 3:
+			{
+				pdus[0].harq_indication_tdd_rel9.harq_data[0].channel_selection.value_0 = rand_range(1, 7);
+			}
+			break;
+			case 4:
+			{
+				pdus[0].harq_indication_tdd_rel9.harq_data[0].format_3.value_0 = rand_range(1, 7);
+			}
+			break;
+		};
+
+	
+	
+		pdus[0].harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
+		pdus[0].harq_indication_tdd_rel13.mode = rand_range(0, 6);
+		pdus[0].harq_indication_tdd_rel13.number_of_ack_nack = 1;
+
+		switch(pdus[0].harq_indication_tdd_rel13.mode)
+		{
+			case 0:
+			{
+				pdus[0].harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = rand_range(1, 7);		
+			}
+			break;
+			case 1:
+			{
+				pdus[0].harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = rand_range(1, 7);
+			}
+			break;			
+			case 2:
+			{
+				pdus[0].harq_indication_tdd_rel13.harq_data[0].special_bundling.value_0 = rand_range(1, 7);
+			}
+			break;			
+			case 3:
+			{
+				pdus[0].harq_indication_tdd_rel13.harq_data[0].channel_selection.value_0 = rand_range(1, 7);
+			}
+			break;			
+			case 4:
+			{
+				pdus[0].harq_indication_tdd_rel13.harq_data[0].format_3.value_0 = rand_range(1, 7);
+			}
+			break;			
+			case 5:
+			{
+				pdus[0].harq_indication_tdd_rel13.harq_data[0].format_4.value_0 = rand_range(1, 7);
+			}
+			break;			
+			case 6:
+			{
+				pdus[0].harq_indication_tdd_rel13.harq_data[0].format_5.value_0 = rand_range(1, 7);
+			}
+			break;			
+		};
+	
+		pdus[0].harq_indication_fdd_rel8.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL8_TAG;
+		pdus[0].harq_indication_fdd_rel8.harq_tb1 = rand_range(1, 7);
+		pdus[0].harq_indication_fdd_rel8.harq_tb2 = rand_range(1, 7);
+		
+		pdus[0].harq_indication_fdd_rel9.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL9_TAG;
+		pdus[0].harq_indication_fdd_rel9.mode = rand_range(0, 2);
+		pdus[0].harq_indication_fdd_rel9.number_of_ack_nack = 2;
+		pdus[0].harq_indication_fdd_rel9.harq_tb_n[0] = rand_range(1, 7);
+		pdus[0].harq_indication_fdd_rel9.harq_tb_n[1] = rand_range(1, 7);
+	
+		pdus[0].harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
+		pdus[0].harq_indication_fdd_rel13.mode = rand_range(0, 2);
+		pdus[0].harq_indication_fdd_rel13.number_of_ack_nack = 2;
+		pdus[0].harq_indication_fdd_rel13.harq_tb_n[0] = rand_range(1, 7);
+		pdus[0].harq_indication_fdd_rel13.harq_tb_n[1] = rand_range(1, 7);
+	
+		pdus[0].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+		pdus[0].ul_cqi_information.ul_cqi = rand_range(0,255);
+		pdus[0].ul_cqi_information.channel	 = rand_range(0, 1);
+
+		harq_ind.harq_indication_body.harq_pdu_list = pdus;
+		
+		nfapi_pnf_p7_harq_ind(data->p7_config, &harq_ind);	
+	}
+	else
+	{
+
+		harq_ind.harq_indication_body.tl.tag = NFAPI_HARQ_INDICATION_BODY_TAG;
+		harq_ind.harq_indication_body.number_of_harqs = 8;
+	
+		nfapi_harq_indication_pdu_t pdus[8];
+		memset(&pdus, 0, sizeof(pdus));
+	
+		for(int i = 0; i < 8; ++i)
+		{
+			pdus[i].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+			pdus[i].rx_ue_information.handle = 0xFF;
+			pdus[i].rx_ue_information.rnti = i;
+	
+			pdus[i].harq_indication_fdd_rel8.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL8_TAG;
+			pdus[i].harq_indication_fdd_rel8.harq_tb1 = 1;
+			pdus[i].harq_indication_fdd_rel8.harq_tb2 = 2;
+		}
+	
+		harq_ind.harq_indication_body.harq_pdu_list = pdus;
+		
+		nfapi_pnf_p7_harq_ind(data->p7_config, &harq_ind);	
+	}
+	
+	return 0;	
+}
+
+int fapi_crc_ind(fapi_t* fapi, fapi_crc_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_crc_indication_t crc_ind;
+	memset(&crc_ind, 0, sizeof(crc_ind));
+	crc_ind.header.message_id = NFAPI_CRC_INDICATION;
+	crc_ind.header.phy_id = data->p7_config->phy_id;
+	crc_ind.sfn_sf = ind->sfn_sf;
+	
+	
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
+		crc_ind.crc_indication_body.number_of_crcs = 1;
+		
+		nfapi_crc_indication_pdu_t pdus[crc_ind.crc_indication_body.number_of_crcs];
+		memset(&pdus, 0, sizeof(pdus));
+		
+		pdus[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+		pdus[0].rx_ue_information.handle = rand_range(0, 9999);
+		pdus[0].rx_ue_information.rnti = rand_range(1, 65535);
+		
+		pdus[0].crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
+		pdus[0].crc_indication_rel8.crc_flag = rand_range(0, 1);
+		
+		crc_ind.crc_indication_body.crc_pdu_list = pdus;
+		nfapi_pnf_p7_crc_ind(data->p7_config, &crc_ind);
+	}
+	else
+	{
+		crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
+		crc_ind.crc_indication_body.number_of_crcs = ind->body.number_of_crcs;
+	
+		crc_ind.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t*)malloc(sizeof(nfapi_crc_indication_pdu_t) * ind->body.number_of_crcs);
+	
+		for(int i = 0; i < ind->body.number_of_crcs; ++i)
+		{
+			crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+			crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.handle = ind->body.pdus[i].rx_ue_info.handle;
+			crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti = ind->body.pdus[i].rx_ue_info.rnti;
+			crc_ind.crc_indication_body.crc_pdu_list[i].crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
+			crc_ind.crc_indication_body.crc_pdu_list[i].crc_indication_rel8.crc_flag = ind->body.pdus[i].rel8_pdu.crc_flag;
+		}
+	
+		nfapi_pnf_p7_crc_ind(data->p7_config, &crc_ind);
+	
+		free(crc_ind.crc_indication_body.crc_pdu_list);
+	}
+	
+	return 0;
+}
+int fapi_rx_ulsch_ind(fapi_t* fapi, fapi_rx_ulsch_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_rx_indication_t rx_ind;
+	memset(&rx_ind, 0, sizeof(rx_ind));
+	rx_ind.header.message_id = NFAPI_RX_ULSCH_INDICATION;
+	rx_ind.header.phy_id = data->p7_config->phy_id;
+	rx_ind.sfn_sf = ind->sfn_sf;
+	
+	if(1)//((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
+		rx_ind.rx_indication_body.number_of_pdus = 1;
+		
+		uint8_t rx_data[1024];
+		
+		nfapi_rx_indication_pdu_t pdus[rx_ind.rx_indication_body.number_of_pdus];
+		memset(&pdus, 0, sizeof(pdus));
+		
+                strcpy((char*)rx_data, (char*)"123456789");
+
+		for(int i = 0; i < rx_ind.rx_indication_body.number_of_pdus;++i)
+		{
+		
+			pdus[i].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+			pdus[i].rx_ue_information.handle = rand_range(0, 9999);
+			pdus[i].rx_ue_information.rnti = rand_range(1, 65535);
+			
+			pdus[i].rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
+			pdus[i].rx_indication_rel8.length = 10;//rand_range(0, 1024);
+			pdus[i].rx_indication_rel8.offset = 0;//djp - 1;
+			pdus[i].rx_indication_rel8.ul_cqi = rand_range(0, 255);
+			pdus[i].rx_indication_rel8.timing_advance = rand_range(0, 63);
+			
+			//pdus[i].rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
+			//pdus[i].rx_indication_rel9.timing_advance_r9 = rand_range(0, 7690);
+			
+			pdus[i].data = &rx_data[0];
+		}
+		
+		rx_ind.rx_indication_body.rx_pdu_list = pdus;
+		
+		nfapi_pnf_p7_rx_ind(data->p7_config, &rx_ind);
+	}
+	else
+	{
+
+		rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
+		rx_ind.rx_indication_body.number_of_pdus = ind->body.number_of_pdus;
+	
+		rx_ind.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t*)malloc(sizeof(nfapi_rx_indication_pdu_t) * ind->body.number_of_pdus);
+	
+		for(int i = 0; i < ind->body.number_of_pdus; ++i)
+		{
+			rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+			rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.handle = ind->body.pdus[i].rx_ue_info.handle;
+			rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
+			rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length = ind->body.pdus[i].rel8_pdu.length;
+			rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.offset = 1;
+			rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel9.tl.tag = 0;
+			rx_ind.rx_indication_body.rx_pdu_list[i].data = (uint8_t*)ind->body.data[i];
+	
+		}
+		
+		nfapi_pnf_p7_rx_ind(data->p7_config, &rx_ind);
+	
+		free(rx_ind.rx_indication_body.rx_pdu_list);
+	}
+	
+	return 0;
+
+}
+int fapi_rx_cqi_ind(fapi_t* fapi, fapi_rx_cqi_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_cqi_indication_t cqi_ind;
+	memset(&cqi_ind, 0, sizeof(cqi_ind));
+	cqi_ind.header.message_id = NFAPI_RX_CQI_INDICATION;
+	cqi_ind.header.phy_id = data->p7_config->phy_id;
+	cqi_ind.sfn_sf = ind->sfn_sf;
+	
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		cqi_ind.cqi_indication_body.tl.tag = NFAPI_CQI_INDICATION_BODY_TAG;
+		cqi_ind.cqi_indication_body.number_of_cqis = 3;
+		
+		nfapi_cqi_indication_pdu_t cqi_pdu_list[cqi_ind.cqi_indication_body.number_of_cqis];
+		memset(&cqi_pdu_list, 0, sizeof(cqi_pdu_list));
+		nfapi_cqi_indication_raw_pdu_t cqi_raw_pdu_list[cqi_ind.cqi_indication_body.number_of_cqis];
+		//memset(&cqi_raw_pdu_list, 0, sizeof(cqi_raw_pdu_list));
+		
+		
+		for(int i = 0; i < cqi_ind.cqi_indication_body.number_of_cqis; ++i)
+		{
+			cqi_pdu_list[i].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+			cqi_pdu_list[i].rx_ue_information.handle = rand_range(0, 9999);
+			cqi_pdu_list[i].rx_ue_information.rnti = rand_range(1, 65535);
+			
+			uint8_t rel8_or_9 = rand_range(0, 1);
+			
+			if(rel8_or_9)
+			{
+				cqi_pdu_list[i].cqi_indication_rel8.tl.tag = NFAPI_CQI_INDICATION_REL8_TAG;
+				cqi_pdu_list[i].cqi_indication_rel8.length = 8; //rand_range(1, 12);		
+				cqi_pdu_list[i].cqi_indication_rel8.data_offset = 1; //rand_range(0, 1);		
+				cqi_pdu_list[i].cqi_indication_rel8.ul_cqi = 0;
+				cqi_pdu_list[i].cqi_indication_rel8.ri = rand_range(0, 4);		
+				cqi_pdu_list[i].cqi_indication_rel8.timing_advance = rand_range(0, 63);		
+			}
+			else
+			{
+				cqi_pdu_list[i].cqi_indication_rel9.tl.tag = NFAPI_CQI_INDICATION_REL9_TAG;
+				cqi_pdu_list[i].cqi_indication_rel9.length = 8; //rand_range(1, 12);		
+				cqi_pdu_list[i].cqi_indication_rel9.data_offset = 1; //rand_range(0, 1);		
+				cqi_pdu_list[i].cqi_indication_rel9.ul_cqi = 0; //rand_range(0, 1);		
+				cqi_pdu_list[i].cqi_indication_rel9.number_of_cc_reported = 1;
+				cqi_pdu_list[i].cqi_indication_rel9.ri[0] = rand_range(0, 8);		
+				cqi_pdu_list[i].cqi_indication_rel9.timing_advance = rand_range(0, 63);		
+				cqi_pdu_list[i].cqi_indication_rel9.timing_advance_r9 = rand_range(0, 7690);
+			}
+			
+			cqi_pdu_list[i].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+			cqi_pdu_list[i].ul_cqi_information.ul_cqi = rand_range(0,255);
+			cqi_pdu_list[i].ul_cqi_information.channel = rand_range(0, 1);	
+		}
+		
+		cqi_ind.cqi_indication_body.cqi_pdu_list = cqi_pdu_list;
+		cqi_ind.cqi_indication_body.cqi_raw_pdu_list = cqi_raw_pdu_list;
+		
+		nfapi_pnf_p7_cqi_ind(data->p7_config, &cqi_ind);
+	}
+	else
+	{
+		nfapi_pnf_p7_cqi_ind(data->p7_config, &cqi_ind);
+	}
+	
+	return 0;
+}
+int fapi_rx_sr_ind(fapi_t* fapi, fapi_rx_sr_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_sr_indication_t sr_ind;
+	memset(&sr_ind, 0, sizeof(sr_ind));
+	sr_ind.header.message_id = NFAPI_RX_SR_INDICATION;
+	sr_ind.header.phy_id = data->p7_config->phy_id;
+	sr_ind.sfn_sf = ind->sfn_sf;
+	
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		sr_ind.sr_indication_body.tl.tag = NFAPI_SR_INDICATION_BODY_TAG;
+		sr_ind.sr_indication_body.number_of_srs = 1;
+		
+		nfapi_sr_indication_pdu_t pdus[sr_ind.sr_indication_body.number_of_srs];
+		memset(&pdus, 0, sizeof(pdus));
+		
+		pdus[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+		pdus[0].rx_ue_information.handle = rand_range(0, 9999);
+		pdus[0].rx_ue_information.rnti = rand_range(1, 65535);
+		
+		pdus[0].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+		pdus[0].ul_cqi_information.ul_cqi = rand_range(0,255);
+		pdus[0].ul_cqi_information.channel = rand_range(0, 1);			
+		
+		sr_ind.sr_indication_body.sr_pdu_list = pdus;
+		
+		nfapi_pnf_p7_sr_ind(data->p7_config, &sr_ind);
+	}
+	else
+	{
+		nfapi_pnf_p7_sr_ind(data->p7_config, &sr_ind);	
+	}
+	
+	return 0;
+}
+
+int fapi_rach_ind(fapi_t* fapi, fapi_rach_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_rach_indication_t rach_ind;
+	memset(&rach_ind, 0, sizeof(rach_ind));
+	rach_ind.header.message_id = NFAPI_RACH_INDICATION;
+	rach_ind.header.phy_id = data->p7_config->phy_id;
+	rach_ind.sfn_sf = ind->sfn_sf;
+	
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		rach_ind.rach_indication_body.tl.tag = NFAPI_RACH_INDICATION_BODY_TAG;
+		rach_ind.rach_indication_body.number_of_preambles = 1;
+	
+		nfapi_preamble_pdu_t pdus[rach_ind.rach_indication_body.number_of_preambles];
+		memset(&pdus, 0, sizeof(pdus));
+		
+		pdus[0].preamble_rel8.tl.tag = NFAPI_PREAMBLE_REL8_TAG;
+		pdus[0].preamble_rel8.rnti = rand_range(1, 65535);
+		pdus[0].preamble_rel8.preamble = rand_range(0, 63);
+		pdus[0].preamble_rel8.timing_advance = rand_range(0, 1282);
+		pdus[0].preamble_rel9.tl.tag = NFAPI_PREAMBLE_REL9_TAG;
+		pdus[0].preamble_rel9.timing_advance_r9 = rand_range(0, 7690);
+		pdus[0].preamble_rel13.tl.tag = NFAPI_PREAMBLE_REL13_TAG;
+		pdus[0].preamble_rel13.rach_resource_type = rand_range(0, 4);
+			
+		rach_ind.rach_indication_body.preamble_list = pdus;
+		nfapi_pnf_p7_rach_ind(data->p7_config, &rach_ind);
+	}
+	else
+	{
+		nfapi_pnf_p7_rach_ind(data->p7_config, &rach_ind);
+	}
+	
+	return 0;
+}
+
+int fapi_srs_ind(fapi_t* fapi, fapi_srs_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+
+	nfapi_srs_indication_t srs_ind;
+	memset(&srs_ind, 0, sizeof(srs_ind));
+	srs_ind.header.message_id = NFAPI_SRS_INDICATION;
+	srs_ind.header.phy_id = data->p7_config->phy_id;
+	srs_ind.sfn_sf = ind->sfn_sf;
+
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		srs_ind.srs_indication_body.tl.tag = NFAPI_SRS_INDICATION_BODY_TAG;
+		srs_ind.srs_indication_body.number_of_ues = 1;
+		
+		nfapi_srs_indication_pdu_t pdus[srs_ind.srs_indication_body.number_of_ues];
+		memset(&pdus, 0, sizeof(pdus));		
+		
+		pdus[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+		pdus[0].rx_ue_information.handle = rand_range(0, 9999);
+		pdus[0].rx_ue_information.rnti = rand_range(1, 65535);
+				
+		pdus[0].srs_indication_fdd_rel8.tl.tag = NFAPI_SRS_INDICATION_FDD_REL8_TAG;
+		pdus[0].srs_indication_fdd_rel8.doppler_estimation = rand_range(0, 255);
+		pdus[0].srs_indication_fdd_rel8.timing_advance = rand_range(0, 63);
+		pdus[0].srs_indication_fdd_rel8.number_of_resource_blocks = 2; //rand_range(0, 255);
+		pdus[0].srs_indication_fdd_rel8.rb_start = rand_range(0, 245);
+		pdus[0].srs_indication_fdd_rel8.snr[0] = rand_range(0, 255);
+		pdus[0].srs_indication_fdd_rel8.snr[1] = rand_range(0, 255);
+		
+		pdus[0].srs_indication_fdd_rel9.tl.tag = NFAPI_SRS_INDICATION_FDD_REL9_TAG;
+		pdus[0].srs_indication_fdd_rel9.timing_advance_r9 = rand_range(0, 7690);
+		
+		pdus[0].srs_indication_tdd_rel10.tl.tag = NFAPI_SRS_INDICATION_TDD_REL10_TAG;
+		pdus[0].srs_indication_tdd_rel10.uppts_symbol = rand_range(0, 1);
+		
+		pdus[0].srs_indication_fdd_rel11.tl.tag = NFAPI_SRS_INDICATION_FDD_REL11_TAG;
+		pdus[0].srs_indication_fdd_rel11.ul_rtoa;		
+		
+		pdus[0].tdd_channel_measurement.tl.tag = NFAPI_TDD_CHANNEL_MEASUREMENT_TAG;
+		pdus[0].tdd_channel_measurement.num_prb_per_subband = rand_range(0, 255);
+		pdus[0].tdd_channel_measurement.number_of_subbands = 1;
+		pdus[0].tdd_channel_measurement.num_atennas = 2;
+		pdus[0].tdd_channel_measurement.subands[0].subband_index = rand_range(0, 255);
+		pdus[0].tdd_channel_measurement.subands[0].channel[0] = rand_range(0, 9999);
+		pdus[0].tdd_channel_measurement.subands[0].channel[1] = rand_range(0, 9999);
+	
+		srs_ind.srs_indication_body.srs_pdu_list = pdus;
+		nfapi_pnf_p7_srs_ind(data->p7_config, &srs_ind);
+	}
+	else
+	{
+		nfapi_pnf_p7_srs_ind(data->p7_config, &srs_ind);
+	}
+	
+	return 0;
+}
+
+int fapi_lbt_dl_ind(fapi_t* fapi, fapi_lbt_dl_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+	
+	nfapi_lbt_dl_indication_t lbt_dl_ind;
+	memset(&lbt_dl_ind, 0, sizeof(lbt_dl_ind));
+	lbt_dl_ind.header.message_id = NFAPI_LBT_DL_INDICATION;
+	lbt_dl_ind.header.phy_id = data->p7_config->phy_id;
+	lbt_dl_ind.sfn_sf = ind->sfn_sf;
+
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		lbt_dl_ind.lbt_dl_indication_body.tl.tag = NFAPI_LBT_DL_INDICATION_BODY_TAG;
+		lbt_dl_ind.lbt_dl_indication_body.number_of_pdus = 2;
+		
+		nfapi_lbt_dl_indication_pdu_t pdus[lbt_dl_ind.lbt_dl_indication_body.number_of_pdus];
+		memset(&pdus, 0, sizeof(pdus));	
+		
+		pdus[0].pdu_type = 0; // LBT_PDSCH_RSP PDU
+		pdus[0].pdu_size = 0;
+		pdus[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.tl.tag = NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG;
+		pdus[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.handle = 0xABCD;
+		pdus[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.result = rand_range(0, 1);
+		pdus[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.lte_txop_symbols = rand_range(0, 0xFFFF);
+		pdus[0].lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13.initial_partial_sf = rand_range(0, 1);
+		
+		pdus[1].pdu_type = 1; // LBT_DRS_RSP PDU
+		pdus[1].pdu_size = 0;
+		pdus[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.tl.tag = NFAPI_LBT_DRS_RSP_PDU_REL13_TAG;
+		pdus[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.handle = 0xABCD;
+		pdus[1].lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13.result = rand_range(0, 1);
+
+		lbt_dl_ind.lbt_dl_indication_body.lbt_indication_pdu_list = pdus;
+		nfapi_pnf_p7_lbt_dl_ind(data->p7_config, &lbt_dl_ind);
+	}
+	else
+	{
+		nfapi_pnf_p7_lbt_dl_ind(data->p7_config, &lbt_dl_ind);
+	}
+	
+	return 0;
+}
+
+int fapi_nb_harq_ind(fapi_t* fapi, fapi_nb_harq_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+	
+	nfapi_nb_harq_indication_t nb_harq_ind;
+	memset(&nb_harq_ind, 0, sizeof(nb_harq_ind));
+	nb_harq_ind.header.message_id = NFAPI_NB_HARQ_INDICATION;
+	nb_harq_ind.header.phy_id = data->p7_config->phy_id;
+	nb_harq_ind.sfn_sf = ind->sfn_sf;
+
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		
+		nb_harq_ind.nb_harq_indication_body.tl.tag = NFAPI_NB_HARQ_INDICATION_BODY_TAG;
+		nb_harq_ind.nb_harq_indication_body.number_of_harqs = 1;
+		
+		nfapi_nb_harq_indication_pdu_t pdus[nb_harq_ind.nb_harq_indication_body.number_of_harqs];
+		memset(&pdus, 0, sizeof(pdus));	
+		
+		pdus[0].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+		pdus[0].rx_ue_information.handle = rand_range(0, 0xFFFF);
+		pdus[0].rx_ue_information.rnti = rand_range(0, 65535);
+		
+		pdus[0].nb_harq_indication_fdd_rel13.tl.tag = NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG;
+		pdus[0].nb_harq_indication_fdd_rel13.harq_tb1 = rand_range(1, 7);
+		
+		pdus[0].ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+		pdus[0].ul_cqi_information.ul_cqi = rand_range(0, 255);
+		pdus[0].ul_cqi_information.channel = rand_range(0, 1);
+		
+		nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list = pdus;
+		nfapi_pnf_p7_nb_harq_ind(data->p7_config, &nb_harq_ind);
+	}
+	else
+	{
+		nfapi_pnf_p7_nb_harq_ind(data->p7_config, &nb_harq_ind);
+	}
+	
+	return 0;
+}
+
+int fapi_nrach_ind(fapi_t* fapi, fapi_nrach_ind_t* ind)
+{
+	pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)(fapi->user_data);
+	
+	nfapi_nrach_indication_t nrach_ind;
+	memset(&nrach_ind, 0, sizeof(nrach_ind));
+	nrach_ind.header.message_id = NFAPI_NRACH_INDICATION;
+	nrach_ind.header.phy_id = data->p7_config->phy_id;
+	nrach_ind.sfn_sf = ind->sfn_sf;
+
+	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+	{
+		nrach_ind.nrach_indication_body.tl.tag = NFAPI_NRACH_INDICATION_BODY_TAG;
+		nrach_ind.nrach_indication_body.number_of_initial_scs_detected = 1;
+		
+		nfapi_nrach_indication_pdu_t pdus[nrach_ind.nrach_indication_body.number_of_initial_scs_detected];
+		memset(&pdus, 0, sizeof(pdus));	
+		
+		pdus[0].nrach_indication_rel13.tl.tag = NFAPI_NRACH_INDICATION_REL13_TAG;
+		pdus[0].nrach_indication_rel13.rnti = rand_range(1, 65535);
+		pdus[0].nrach_indication_rel13.initial_sc = rand_range(0, 47);
+		pdus[0].nrach_indication_rel13.timing_advance = rand_range(0, 3840);
+		pdus[0].nrach_indication_rel13.nrach_ce_level = rand_range(0, 2);
+		
+		nrach_ind.nrach_indication_body.nrach_pdu_list = pdus;
+		
+		nfapi_pnf_p7_nrach_ind(data->p7_config, &nrach_ind);
+	}
+	else
+	{
+		nfapi_pnf_p7_nrach_ind(data->p7_config, &nrach_ind);
+	}	
+	
+	return 0;
+}
+
+int pnf_start_request(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req)
+{
+
+	pnf_info* pnf = (pnf_info*)(config->user_data);
+
+	// start all phys that have been configured
+	for(phy_info& phy : pnf->phys)
+	{
+		if(phy.id != 0)
+		{
+	//auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
+	//		{ return item.id == req->header.phy_id; });
+//
+//	if(found != pnf->phys.end())
+//	{
+//		phy_info& phy = (*found);
+
+			fapi_cb_t cb;
+			cb.fapi_param_response = &fapi_param_response;
+			cb.fapi_config_response = &fapi_config_response;
+			cb.fapi_subframe_ind = &fapi_subframe_ind;
+			cb.fapi_harq_ind = fapi_harq_ind;
+			cb.fapi_crc_ind = fapi_crc_ind;
+			cb.fapi_rx_ulsch_ind = fapi_rx_ulsch_ind;
+			cb.fapi_rx_cqi_ind = fapi_rx_cqi_ind;
+			cb.fapi_rx_sr_ind = fapi_rx_sr_ind;
+			cb.fapi_rach_ind = fapi_rach_ind;
+			cb.fapi_srs_ind = fapi_srs_ind;
+			
+			cb.fapi_lbt_dl_ind = fapi_lbt_dl_ind;
+			cb.fapi_nb_harq_ind = fapi_nb_harq_ind;
+			cb.fapi_nrach_ind = fapi_nrach_ind;
+			
+			
+
+			fapi_config_t c;
+			c.duplex_mode = phy.duplex_mode;
+			c.dl_channel_bw_support = phy.dl_channel_bw_support;
+			c.ul_channel_bw_support = phy.ul_channel_bw_support;
+
+			phy.fapi = fapi_create(&cb, &c);
+			printf("[PNF_SIM] staring fapi %p phy_id:%d\n", phy.fapi, phy.id);
+
+			pnf_phy_user_data_t* data = (pnf_phy_user_data_t*)malloc(sizeof(pnf_phy_user_data_t));
+			data->phy_id = phy.id;
+			data->config = config;
+			data->phy = &phy;
+
+			phy.fapi->user_data = data; 
+		}
+
+	}
+
+	nfapi_pnf_start_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_START_RESPONSE;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_pnf_start_resp(config, &resp);
+
+	return 0;
+}
+
+int pnf_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_stop_request_t* req)
+{
+	printf("[PNF_SIM] pnf stop request\n");
+
+	nfapi_pnf_stop_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_STOP_RESPONSE;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_pnf_stop_resp(config, &resp);
+
+	return 0;
+}
+
+int param_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req)
+{
+	printf("[PNF_SIM] param request phy_id:%d\n", req->header.phy_id);
+
+	pnf_info* pnf = (pnf_info*)(config->user_data);
+
+	auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
+								  { return item.id == req->header.phy_id; });
+
+	if(found != pnf->phys.end())
+	{
+		phy_info& phy_info = (*found);
+
+		fapi_param_req_t fapi_req;
+		fapi_req.header.message_id = req->header.message_id;
+		fapi_req.header.length = 0;
+
+		// convert nfapi to fapi
+
+		fapi_param_request(phy_info.fapi, &fapi_req);
+
+	}
+	else
+	{
+		// did not find the phy
+	}
+
+
+	printf("[PNF_SIM] param request .. exit\n");
+
+
+	return 0;
+}
+
+int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req)
+{
+	printf("[PNF_SIM] config request phy_id:%d\n", req->header.phy_id);
+
+	pnf_info* pnf = (pnf_info*)(config->user_data);
+
+	auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
+								  { return item.id == req->header.phy_id; });
+
+	if(found != pnf->phys.end())
+	{
+		phy_info& phy_info = (*found);
+
+
+		if(req->nfapi_config.timing_window.tl.tag == NFAPI_NFAPI_TIMING_WINDOW_TAG)
+		{
+			phy_info.timing_window = req->nfapi_config.timing_window.value;
+		}
+
+		if(req->nfapi_config.timing_info_mode.tl.tag == NFAPI_NFAPI_TIMING_INFO_MODE_TAG)
+		{
+			printf("timing info mode provided\n");
+			phy_info.timing_info_mode = req->nfapi_config.timing_info_mode.value;
+		}
+		else 
+		{
+			phy_info.timing_info_mode = 0;
+			printf("NO timing info mode provided\n");
+		}
+
+		if(req->nfapi_config.timing_info_period.tl.tag == NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG)
+		{
+			printf("timing info period provided\n");
+			phy_info.timing_info_period = req->nfapi_config.timing_info_period.value;
+		}
+		else 
+		{
+			phy_info.timing_info_period = 0;
+		}
+
+		phy_info.remote_port = req->nfapi_config.p7_vnf_port.value;
+
+		struct sockaddr_in vnf_p7_sockaddr;
+		memcpy(&vnf_p7_sockaddr.sin_addr.s_addr, &(req->nfapi_config.p7_vnf_address_ipv4.address[0]), 4);
+		phy_info.remote_addr = inet_ntoa(vnf_p7_sockaddr.sin_addr);
+
+		printf("[PNF_SIM] %d vnf p7 %s:%d timing %d %d %d\n", phy_info.id, phy_info.remote_addr, phy_info.remote_port, 
+				phy_info.timing_window, phy_info.timing_info_mode, phy_info.timing_info_period);
+
+		fapi_config_req_t fapi_req;
+		fapi_config_request(phy_info.fapi, &fapi_req);
+	}
+
+	return 0;
+}
+
+nfapi_p7_message_header_t* phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size)
+{
+	if(message_id == P7_VENDOR_EXT_REQ)
+	{
+		(*msg_size) = sizeof(vendor_ext_p7_req);
+		return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_req));
+	}
+	
+	return 0;
+}
+
+void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header)
+{
+	free(header);
+}
+
+int phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req)
+{
+	//printf("[PNF_SIM] dl config request\n");
+
+	if(req->vendor_extension)
+		free(req->vendor_extension);
+
+	phy_info* phy = (phy_info*)(pnf_p7->user_data);
+
+	fapi_dl_config_req_t fapi_req;
+	// convert
+	fapi_dl_config_request(phy->fapi, &fapi_req);
+
+	return 0;
+}
+int phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req)
+{
+	//printf("[PNF_SIM] ul config request\n");
+	phy_info* phy = (phy_info*)(pnf_p7->user_data);
+
+	fapi_ul_config_req_t fapi_req;
+	// convert
+	fapi_ul_config_request(phy->fapi, &fapi_req);
+
+	return 0;
+}
+int phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req)
+{
+	//printf("[PNF_SIM] hi dci0 request\n");
+	phy_info* phy = (phy_info*)(pnf_p7->user_data);
+
+	fapi_hi_dci0_req_t fapi_req;
+	// convert
+	fapi_hi_dci0_request(phy->fapi, &fapi_req);
+	return 0;
+}
+int phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req)
+{
+	//printf("[PNF_SIM] tx request\n");
+	phy_info* phy = (phy_info*)(pnf_p7->user_data);
+
+	fapi_tx_req_t fapi_req;
+	fapi_req.header.message_id = FAPI_TX_REQUEST;
+	fapi_req.sfn_sf = req->sfn_sf;
+	fapi_req.body.number_of_pdus = req->tx_request_body.number_of_pdus;
+
+	fapi_tx_req_pdu_t pdus[8];
+	fapi_req.body.pdus = &pdus[0];
+
+	for(int i = 0; i < fapi_req.body.number_of_pdus; ++i)
+	{
+		fapi_req.body.pdus[i].pdu_length = req->tx_request_body.tx_pdu_list[i].pdu_length;
+		fapi_req.body.pdus[i].pdu_index = req->tx_request_body.tx_pdu_list[i].pdu_index;
+		fapi_req.body.pdus[i].num_tlv = 1;
+		fapi_req.body.pdus[i].tlvs[0].value = (uint32_t*)req->tx_request_body.tx_pdu_list[i].segments[0].segment_data;
+
+		//if the pnf wants to retain the pointer then req->tx_request_body.tx_pdu_list[i].segments[0].segment_data should be set to 0
+
+
+	}
+
+	fapi_tx_request(phy->fapi, &fapi_req);
+/*
+	if(fapi_req.body.number_of_pdus > 0)
+	{
+		for(int i = 0; i < fapi_req.body.number_of_pdus; ++i)
+		{
+			//printf("freeing tx pdu %p\n", fapi_req.body.pdus[i].tlvs[0].value);
+			if(0)
+			{
+				free(fapi_req.body.pdus[i].tlvs[0].value);
+			}
+			else
+			{
+				pnf_deallocate(fapi_req.body.pdus[i].tlvs[0].value);
+			}
+		}
+	}
+*/	
+
+	return 0;
+}
+int phy_lbt_dl_config_req(nfapi_pnf_p7_config_t*, nfapi_lbt_dl_config_request_t* req)
+{
+	//printf("[PNF_SIM] lbt dl config request\n");
+	return 0;
+}
+
+int phy_vendor_ext(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg)
+{
+	if(msg->message_id == P7_VENDOR_EXT_REQ)
+	{
+		vendor_ext_p7_req* req = (vendor_ext_p7_req*)msg;
+		//printf("[PNF_SIM] vendor request (1:%d 2:%d)\n", req->dummy1, req->dummy2);
+	}
+	else
+	{
+		printf("[PNF_SIM] unknown vendor ext\n");
+	}
+	return 0;
+}
+
+
+
+int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codex)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+	if(header->message_id == P7_VENDOR_EXT_IND)
+	{
+		vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)(header);
+		if(!push16(ind->error_code, ppWritePackedMsg, end))
+			return 0;
+		
+		return 1;
+	}
+	return -1;
+}
+
+int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* codec)
+{
+	if(header->message_id == P7_VENDOR_EXT_REQ)
+	{
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+		vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
+		if(!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
+			 pull16(ppReadPackedMessage, &req->dummy2, end)))
+			return 0;
+		return 1;
+	}
+	return -1;
+}
+
+int phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t* end, void** ve, nfapi_p7_codec_config_t* config)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_unpack_vendor_extension_tlv\n");
+
+	switch(tl->tag)
+	{
+		case VENDOR_EXT_TLV_1_TAG:
+			*ve = malloc(sizeof(vendor_ext_tlv_1));
+			if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_1*)(*ve))->dummy, end))
+				return 0;
+
+			return 1;
+			break;
+	}
+
+	return -1;
+}
+
+int phy_pack_vendor_extention_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p7_codec_config_t* config)
+{
+	//printf("%s\n", __FUNCTION__);
+	(void)ve;
+	(void)ppWritePackedMsg;
+	return -1;
+}
+
+int pnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* config)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_unpack_vendor_extension_tlv\n");
+
+	switch(tl->tag)
+	{
+		case VENDOR_EXT_TLV_2_TAG:
+			*ve = malloc(sizeof(vendor_ext_tlv_2));
+			if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_2*)(*ve))->dummy, end))
+				return 0;
+
+			return 1;
+			break;
+	}
+	
+	return -1;
+}
+
+int pnf_sim_pack_vendor_extention_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	//printf("%s\n", __FUNCTION__);
+	(void)ve;
+	(void)ppWritePackedMsg;
+	return -1;
+}
+int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req)
+{
+	printf("[PNF_SIM] start request phy_id:%d\n", req->header.phy_id);
+
+	pnf_info* pnf = (pnf_info*)(config->user_data);
+
+	auto found = std::find_if(pnf->phys.begin(), pnf->phys.end(), [&](phy_info& item)
+								  { return item.id == req->header.phy_id; });
+
+	if(found != pnf->phys.end())
+	{
+		phy_info& phy_info = (*found);
+
+
+		nfapi_pnf_p7_config_t* p7_config = nfapi_pnf_p7_config_create();
+
+		p7_config->phy_id = phy->phy_id;
+
+		p7_config->remote_p7_port = phy_info.remote_port;
+		p7_config->remote_p7_addr = phy_info.remote_addr;
+		p7_config->local_p7_port = phy_info.local_port;
+		p7_config->local_p7_addr = (char*)phy_info.local_addr.c_str();
+		p7_config->user_data = &phy_info;
+
+		p7_config->malloc = &pnf_allocate;
+		p7_config->free = &pnf_deallocate;
+		p7_config->codec_config.allocate = &pnf_allocate;
+		p7_config->codec_config.deallocate = &pnf_deallocate;
+		
+		p7_config->trace = &pnf_sim_trace;
+
+		phy->user_data = p7_config;
+
+		p7_config->subframe_buffer_size = phy_info.timing_window;
+		if(phy_info.timing_info_mode & 0x1)
+		{
+			p7_config->timing_info_mode_periodic = 1;
+			p7_config->timing_info_period = phy_info.timing_info_period;
+		}
+		
+		if(phy_info.timing_info_mode & 0x2)
+		{
+			p7_config->timing_info_mode_aperiodic = 1;
+		}
+
+		p7_config->dl_config_req = &phy_dl_config_req;
+		p7_config->ul_config_req = &phy_ul_config_req;
+		p7_config->hi_dci0_req = &phy_hi_dci0_req;
+		p7_config->tx_req = &phy_tx_req;
+		p7_config->lbt_dl_config_req = &phy_lbt_dl_config_req;
+
+		p7_config->vendor_ext = &phy_vendor_ext;
+
+		p7_config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
+		p7_config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
+
+		p7_config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
+		p7_config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
+		p7_config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
+		p7_config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extention_tlv;
+
+		pthread_t p7_thread;
+		pthread_create(&p7_thread, NULL, &pnf_p7_thread_start, p7_config);
+
+
+		((pnf_phy_user_data_t*)(phy_info.fapi->user_data))->p7_config = p7_config;
+
+		fapi_start_req_t fapi_req;
+		fapi_start_request(phy_info.fapi, &fapi_req);
+
+	}
+
+	return 0;
+}
+
+int measurement_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_measurement_request_t* req)
+{
+	nfapi_measurement_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_MEASUREMENT_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_MSG_OK;
+	nfapi_pnf_measurement_resp(config, &resp);
+	return 0;
+}
+int rssi_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_rssi_request_t* req)
+{
+	nfapi_rssi_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_RSSI_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_P4_MSG_OK;
+	nfapi_pnf_rssi_resp(config, &resp);
+	
+	nfapi_rssi_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_RSSI_INDICATION;
+	ind.header.phy_id = req->header.phy_id;
+	ind.error_code = NFAPI_P4_MSG_OK;
+	ind.rssi_indication_body.tl.tag = NFAPI_RSSI_INDICATION_TAG;
+	ind.rssi_indication_body.number_of_rssi = 1;
+	ind.rssi_indication_body.rssi[0] = -42;
+	nfapi_pnf_rssi_ind(config, &ind);
+	return 0;
+}
+int cell_search_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_cell_search_request_t* req)
+{
+	nfapi_cell_search_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_CELL_SEARCH_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_P4_MSG_OK;
+	nfapi_pnf_cell_search_resp(config, &resp);
+	
+	nfapi_cell_search_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_CELL_SEARCH_INDICATION;
+	ind.header.phy_id = req->header.phy_id;
+	ind.error_code = NFAPI_P4_MSG_OK;
+	
+	switch(req->rat_type)
+	{
+		case NFAPI_RAT_TYPE_LTE:
+		{
+			ind.lte_cell_search_indication.tl.tag = NFAPI_LTE_CELL_SEARCH_INDICATION_TAG;
+			ind.lte_cell_search_indication.number_of_lte_cells_found = 1;
+			ind.lte_cell_search_indication.lte_found_cells[0].pci = 123;
+			ind.lte_cell_search_indication.lte_found_cells[0].rsrp = 123;
+			ind.lte_cell_search_indication.lte_found_cells[0].rsrq = 123;
+			ind.lte_cell_search_indication.lte_found_cells[0].frequency_offset = 123;
+		}
+		break;
+		case NFAPI_RAT_TYPE_UTRAN:
+		{
+			ind.utran_cell_search_indication.tl.tag = NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG;
+			ind.utran_cell_search_indication.number_of_utran_cells_found = 1;
+			ind.utran_cell_search_indication.utran_found_cells[0].psc = 89;
+			ind.utran_cell_search_indication.utran_found_cells[0].rscp = 89;
+			ind.utran_cell_search_indication.utran_found_cells[0].ecno = 89;
+			ind.utran_cell_search_indication.utran_found_cells[0].frequency_offset = -89;
+			
+		}
+		break;
+		case NFAPI_RAT_TYPE_GERAN:
+		{
+			ind.geran_cell_search_indication.tl.tag = NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG;
+			ind.geran_cell_search_indication.number_of_gsm_cells_found = 1;
+			ind.geran_cell_search_indication.gsm_found_cells[0].bsic = 23;
+			ind.geran_cell_search_indication.gsm_found_cells[0].rxlev = 23;
+			ind.geran_cell_search_indication.gsm_found_cells[0].rxqual = 23;
+			ind.geran_cell_search_indication.gsm_found_cells[0].frequency_offset = -23;
+			ind.geran_cell_search_indication.gsm_found_cells[0].sfn_offset = 230;
+			
+		}
+		break;
+	}
+	
+	ind.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+	ind.pnf_cell_search_state.length = 3;
+	
+	nfapi_pnf_cell_search_ind(config, &ind);	
+	return 0;
+}
+int broadcast_detect_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_broadcast_detect_request_t* req)
+{
+	nfapi_broadcast_detect_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_BROADCAST_DETECT_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_P4_MSG_OK;
+	nfapi_pnf_broadcast_detect_resp(config, &resp);
+	
+	nfapi_broadcast_detect_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_BROADCAST_DETECT_INDICATION;
+	ind.header.phy_id = req->header.phy_id;
+	ind.error_code = NFAPI_P4_MSG_OK;
+	
+	switch(req->rat_type)
+	{
+		case NFAPI_RAT_TYPE_LTE:
+		{
+			ind.lte_broadcast_detect_indication.tl.tag = NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG;
+			ind.lte_broadcast_detect_indication.number_of_tx_antenna = 1;
+			ind.lte_broadcast_detect_indication.mib_length = 4;
+			//ind.lte_broadcast_detect_indication.mib...
+			ind.lte_broadcast_detect_indication.sfn_offset = 77;
+		
+		}
+		break;
+		case NFAPI_RAT_TYPE_UTRAN:
+		{
+			ind.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG;
+			ind.utran_broadcast_detect_indication.mib_length = 4;
+			//ind.utran_broadcast_detect_indication.mib...
+			ind.utran_broadcast_detect_indication.sfn_offset;
+			
+		}
+		break;
+	}
+	
+	ind.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+	ind.pnf_cell_broadcast_state.length = 3;
+	
+	nfapi_pnf_broadcast_detect_ind(config, &ind);	
+	return 0;
+}
+int system_information_schedule_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_schedule_request_t* req)
+{
+	nfapi_system_information_schedule_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_P4_MSG_OK;
+	nfapi_pnf_system_information_schedule_resp(config, &resp);
+	
+	nfapi_system_information_schedule_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION;
+	ind.header.phy_id = req->header.phy_id;
+	ind.error_code = NFAPI_P4_MSG_OK;
+	
+	ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
+	ind.lte_system_information_indication.sib_type = 3;
+	ind.lte_system_information_indication.sib_length = 5;
+	//ind.lte_system_information_indication.sib...
+	
+	nfapi_pnf_system_information_schedule_ind(config, &ind);		
+	return 0;
+}
+int system_information_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_request_t* req)
+{
+	nfapi_system_information_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_SYSTEM_INFORMATION_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_P4_MSG_OK;
+	nfapi_pnf_system_information_resp(config, &resp);
+	
+	nfapi_system_information_indication_t ind;
+	memset(&ind, 0, sizeof(ind));
+	ind.header.message_id = NFAPI_SYSTEM_INFORMATION_INDICATION;
+	ind.header.phy_id = req->header.phy_id;
+	ind.error_code = NFAPI_P4_MSG_OK;
+	
+	switch(req->rat_type)
+	{
+		case NFAPI_RAT_TYPE_LTE:
+		{
+			ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
+			ind.lte_system_information_indication.sib_type = 1;
+			ind.lte_system_information_indication.sib_length = 3;
+			//ind.lte_system_information_indication.sib...
+		}
+		break;
+		case NFAPI_RAT_TYPE_UTRAN:
+		{
+			ind.utran_system_information_indication.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG;
+			ind.utran_system_information_indication.sib_length = 3;
+			//ind.utran_system_information_indication.sib...
+			
+		}
+		break;
+		case NFAPI_RAT_TYPE_GERAN:
+		{
+			ind.geran_system_information_indication.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG;
+			ind.geran_system_information_indication.si_length = 3;
+			//ind.geran_system_information_indication.si...
+			
+		}
+		break;
+	}
+		
+	
+	nfapi_pnf_system_information_ind(config, &ind);		
+
+	return 0;
+}
+int nmm_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nmm_stop_request_t* req)
+{
+	nfapi_nmm_stop_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_NMM_STOP_RESPONSE;
+	resp.header.phy_id = req->header.phy_id;
+	resp.error_code = NFAPI_P4_MSG_OK;
+	nfapi_pnf_nmm_stop_resp(config, &resp);
+	return 0;
+}
+	
+int vendor_ext(nfapi_pnf_config_t* config, nfapi_p4_p5_message_header_t* msg)
+{
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF_SIM] P5 %s %p\n", __FUNCTION__, msg);
+
+	switch(msg->message_id)
+	{
+		case P5_VENDOR_EXT_REQ:
+			{
+				vendor_ext_p5_req* req = (vendor_ext_p5_req*)msg;
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF_SIM] P5 Vendor Ext Req (%d %d)\n", req->dummy1, req->dummy2);
+				// send back the P5_VENDOR_EXT_RSP
+				vendor_ext_p5_rsp rsp;
+				memset(&rsp, 0, sizeof(rsp));
+				rsp.header.message_id = P5_VENDOR_EXT_RSP;
+				rsp.error_code = NFAPI_MSG_OK;
+				nfapi_pnf_vendor_extension(config, &rsp.header, sizeof(vendor_ext_p5_rsp));
+			}
+			break;
+	}
+	
+	return 0;
+}
+
+nfapi_p4_p5_message_header_t* pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size)
+{
+	if(message_id == P5_VENDOR_EXT_REQ)
+	{
+		(*msg_size) = sizeof(vendor_ext_p5_req);
+		return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_req));
+	}
+	
+	return 0;
+}
+
+void pnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header)
+{
+	free(header);
+}
+
+
+int pnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+	if(header->message_id == P5_VENDOR_EXT_RSP)
+	{
+		vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)(header);
+		return (!push16(rsp->error_code, ppWritePackedMsg, end));
+	}
+	return 0;
+}
+
+int pnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+	if(header->message_id == P5_VENDOR_EXT_REQ)
+	{
+		vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
+		return (!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
+	  			  pull16(ppReadPackedMessage, &req->dummy2, end)));
+		 
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s (%d %d)\n", __FUNCTION__, req->dummy1, req->dummy2);
+	}
+	return 0;
+}
+int main(int argc, char *argv[])
+{
+	if (argc < 3)
+	{
+		printf("Use parameters: <IP Address of VNF P5> <P5 Port> <Config File>\n");
+		return 0;
+	}
+
+	set_thread_priority(50);
+
+	pnf_info pnf;
+	if(read_pnf_xml(pnf, argv[3]) < 0)
+	{
+		printf("Failed to read xml file>\n");
+		return 0;
+	}
+
+
+	nfapi_pnf_config_t* config = nfapi_pnf_config_create();
+
+	config->vnf_ip_addr = argv[1];
+	config->vnf_p5_port = atoi(argv[2]);
+
+	config->pnf_param_req = &pnf_param_request;
+	config->pnf_config_req = &pnf_config_request;
+	config->pnf_start_req = &pnf_start_request;
+	config->pnf_stop_req = &pnf_stop_request;
+	config->param_req = &param_request;
+	config->config_req = &config_request;
+	config->start_req = &start_request;
+	
+	config->measurement_req = &measurement_request;
+	config->rssi_req = &rssi_request;
+	config->cell_search_req = &cell_search_request;
+	config->broadcast_detect_req = &broadcast_detect_request;
+	config->system_information_schedule_req = &system_information_schedule_request;
+	config->system_information_req = &system_information_request;
+	config->nmm_stop_req = &nmm_stop_request;
+	
+	config->vendor_ext = &vendor_ext;
+
+	config->trace = &pnf_sim_trace;
+
+	config->user_data = &pnf;
+
+	// To allow custom vendor extentions to be added to nfapi
+	config->codec_config.unpack_vendor_extension_tlv = &pnf_sim_unpack_vendor_extension_tlv;
+	config->codec_config.pack_vendor_extension_tlv = &pnf_sim_pack_vendor_extention_tlv;
+	
+	config->allocate_p4_p5_vendor_ext = &pnf_sim_allocate_p4_p5_vendor_ext;
+	config->deallocate_p4_p5_vendor_ext = &pnf_sim_deallocate_p4_p5_vendor_ext;
+
+	config->codec_config.unpack_p4_p5_vendor_extension = &pnf_sim_unpack_p4_p5_vendor_extension;
+	config->codec_config.pack_p4_p5_vendor_extension = &pnf_sim_pack_p4_p5_vendor_extension;
+
+	return nfapi_pnf_start(config);
+	
+}
diff --git a/nfapi/open-nFAPI/sim_common/Makefile.am b/nfapi/open-nFAPI/sim_common/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..771b768a163feeb41bfc54cc8ca07f587fd1d948
--- /dev/null
+++ b/nfapi/open-nFAPI/sim_common/Makefile.am
@@ -0,0 +1,31 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+AUTOMAKE_OPTIONS=subdir-objects
+
+AM_CFLAGS = -I$(top_srcdir)/sim_common/public_inc -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/nfapi/public_inc -g -Wall -Werror
+
+AM_CXXFLAGS = -I$(top_srcdir)/sim_common/public_inc -I$(top_srcdir)/common/public_inc -std=c++11 -I$(top_srcdir)/nfapi/public_inc $(BOOST_CPPFLAGS) -g -Wall -Werror
+noinst_LIBRARIES =libnfapi_sim_common.a
+#libnfapi_sim_common_a_SOURCES = src/xml_property_tree.cpp src/pool.cpp
+libnfapi_sim_common_a_SOURCES = src/pool.cpp
+
+libnfapi_sim_common_a_CFLAGS =$(AM_CFLAGS)
+libnfapi_sim_common_a_CXXFLAGS =$(AM_CXXFLAGS)
+
+lib_LTLIBRARIES =libnfapi_sim_common.la
+#libnfapi_sim_common_la_SOURCES = src/xml_property_tree.cpp
+libnfapi_sim_common_la_SOURCES = src/pool.cpp
diff --git a/nfapi/open-nFAPI/sim_common/inc/pool.h b/nfapi/open-nFAPI/sim_common/inc/pool.h
new file mode 100644
index 0000000000000000000000000000000000000000..8591d939f969b422cf9c76743f5cb8fe79bc96e1
--- /dev/null
+++ b/nfapi/open-nFAPI/sim_common/inc/pool.h
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _POOL_H_
+#define _POOL_H_
+
+#include <mutex>
+#include <map>
+#include <queue>
+#include <cassert>
+
+
+class pool_config
+{
+    public:
+        
+        size_t size;
+        uint16_t initial_count;
+};
+
+class memory_pool
+{
+    std::mutex mutex;
+	std::map<size_t, std::queue<uint8_t*>> free_store;
+	std::map<size_t, uint16_t> allocated_store;
+	
+    void init(std::vector<pool_config> config)
+    {
+        printf("memory_pool::init\n");
+        		
+        for(pool_config c : config)
+        {
+            // todo : use the initial count to allocate initial pool memory
+            free_store.insert(std::pair<size_t, 
+                                        std::queue<uint8_t*>>
+                                            (c.size, std::queue<uint8_t*>()));
+			allocated_store.insert(std::pair<size_t, uint16_t>(c.size, 0));
+        }
+    }
+    
+    memory_pool()
+    {
+        std::vector<pool_config> config 
+        {
+            {8, 0}, {32, 0}, {64, 0}, {128, 0}, {256, 0}, 
+            {1024, 0}, {4096, 0}, {8912, 0}
+            
+        };
+        
+        init(config);
+    }
+    
+    
+    uint16_t determine_pool_size(size_t size)
+    {
+        for(auto pool : free_store)
+        {
+            if(pool.first >= size)
+                return pool.first;
+        }
+        
+        return 0;
+    }
+    
+    uint8_t* alloc(size_t size)
+    {
+        if(size == 0)
+            return 0;
+            
+        uint8_t* ptr = 0;
+        size_t psize = determine_pool_size(size + 4);
+        
+        if(psize == 0)
+        {
+            ptr =  (uint8_t*)malloc(size + 4);
+			memset(ptr, 0, size + 4);	
+        }
+        else
+        {
+            mutex.lock();
+            
+            auto it = free_store.find(psize);
+            
+            if(it == free_store.end())
+            {
+                // Unknown pool size
+   				ptr =  (uint8_t*)malloc(psize + 4);
+				memcpy(ptr, &psize, 4);
+            }
+            else
+            {
+                if(it->second.size() > 0)
+                {
+                    // Take from the pool
+                    ptr = (uint8_t*)(it->second.front());
+    				it->second.pop();
+                }
+                else
+                {
+                    // No memory left in pool
+                    ptr =  (uint8_t*)malloc(psize + 4);
+				    memcpy(ptr, &psize, 4);
+                }
+            }
+            
+            mutex.unlock();
+        }
+
+        return (ptr + 4);
+    }
+    
+    void dealloc(uint8_t* ptr)
+    {
+      	if(ptr == 0)
+			return;
+			
+		uint8_t* _ptr = (uint8_t*)ptr;
+
+        size_t psize;
+		memcpy(&psize, _ptr - 4, 4);
+		
+		if(psize == 0)
+		{
+		    free(_ptr - 4);
+		}
+		else
+		{
+		    mutex.lock();
+		    
+		    auto it = free_store.find(psize);
+			if(it == free_store.end())
+			{
+			    free(_ptr - 4);
+			}
+			else
+			{
+			    assert((_ptr - 4) != 0);    
+			    it->second.push(_ptr - 4);
+			}
+		    
+		    mutex.unlock();
+		}
+  
+    }
+    
+    public:
+    
+    memory_pool(memory_pool const&) = delete;
+    void operator=(memory_pool const&) = delete;
+    
+    /*! Get the memory_pool instance */
+    static memory_pool& instance()
+    {
+        static memory_pool instance;
+        return instance;
+    }    
+
+    /*! Allocate a buffer from the memory_pool is at least size */
+    static uint8_t* allocate(size_t size)
+    {
+        return instance().alloc(size);
+    }
+    
+    /*! Return the buffer to the memory_pool */
+    static void deallocate(uint8_t* ptr)
+    {
+        return instance().dealloc(ptr);
+    }
+        
+    
+};
+
+#endif // _POOL_H_
diff --git a/nfapi/open-nFAPI/sim_common/inc/vendor_ext.h b/nfapi/open-nFAPI/sim_common/inc/vendor_ext.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0fd57837d2eef4650700eb58399c0249eb68918
--- /dev/null
+++ b/nfapi/open-nFAPI/sim_common/inc/vendor_ext.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _VENDOR_EXT_H_
+#define _VENDOR_EXT_H_
+
+#include "nfapi_interface.h"
+
+typedef enum 
+{
+	P5_VENDOR_EXT_REQ = NFAPI_VENDOR_EXT_MSG_MIN,
+	P5_VENDOR_EXT_RSP,
+
+	P7_VENDOR_EXT_REQ,
+	P7_VENDOR_EXT_IND
+
+} vendor_ext_message_id_e;
+
+typedef struct {
+	nfapi_p4_p5_message_header_t header;
+	uint16_t dummy1;
+	uint16_t dummy2;
+} vendor_ext_p5_req;
+
+typedef struct {
+	nfapi_p4_p5_message_header_t header;
+	uint16_t error_code;
+} vendor_ext_p5_rsp;
+
+typedef struct {
+	nfapi_p7_message_header_t header;
+	uint16_t dummy1;
+	uint16_t dummy2;
+} vendor_ext_p7_req;
+
+typedef struct {
+	nfapi_p7_message_header_t header;
+	uint16_t error_code;
+} vendor_ext_p7_ind;
+
+typedef struct {
+	nfapi_tl_t tl;
+	uint32_t dummy;
+} vendor_ext_tlv_1;
+
+#define VENDOR_EXT_TLV_1_TAG 0xF001
+
+typedef struct {
+	nfapi_tl_t tl;
+	uint32_t dummy;
+} vendor_ext_tlv_2;
+
+#define VENDOR_EXT_TLV_2_TAG 0xF002
+
+
+
+
+#endif // _VENDOR_EXT_
diff --git a/nfapi/open-nFAPI/sim_common/src/pool.cpp b/nfapi/open-nFAPI/sim_common/src/pool.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..47d9cfa992ebd7fdd05ffa6d9963009226fed354
--- /dev/null
+++ b/nfapi/open-nFAPI/sim_common/src/pool.cpp
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
diff --git a/nfapi/open-nFAPI/vnf/Makefile.am b/nfapi/open-nFAPI/vnf/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..ae8d2bb3d67ed480faf29d94762438c250728d9b
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/Makefile.am
@@ -0,0 +1,43 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+
+AUTOMAKE_OPTIONS=subdir-objects
+
+AM_CPPFLAGS = -I$(top_srcdir)/vnf/inc\
+			  -I$(top_srcdir)/vnf/public_inc\
+			  -I$(top_srcdir)/nfapi/public_inc\
+			  -I$(top_srcdir)/common/public_inc\
+			  -Wall -Werror -g
+
+
+noinst_LIBRARIES = libnfapi_vnf.a
+
+libnfapi_vnf_a_SOURCES = src/vnf.c\
+						 src/vnf_p7.c\
+						 src/vnf_interface.c\
+						 src/vnf_p7_interface.c
+
+LDADD = -lsctp  ../common/bin/libnfapi_common.a
+
+libnfapi_vnf_a_CFLAGS =$(AM_CFLAGS)
+
+lib_LTLIBRARIES = libnfapi_vnf.la
+
+libnfapi_vnf_la_SOURCES =  src/vnf.c\
+						 src/vnf_p7.c\
+						 src/vnf_interface.c\
+						 src/vnf_p7_interface.c
diff --git a/nfapi/open-nFAPI/vnf/inc/vnf.h b/nfapi/open-nFAPI/vnf/inc/vnf.h
new file mode 100644
index 0000000000000000000000000000000000000000..4fd8d2b91d6e1ec63b08e8ffb3a4ba0786c30b53
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/inc/vnf.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef _VNF_H_
+#define _VNF_H_
+
+#include "nfapi_vnf_interface.h"
+
+typedef struct 
+{
+
+	nfapi_vnf_config_t _public;
+
+	uint8_t terminate;
+	uint8_t sctp;
+
+	uint8_t tx_message_buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
+	uint16_t next_phy_id;
+	
+} vnf_t;
+
+
+int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
+int vnf_pack_and_send_p4_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
+
+int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf);
+
+void nfapi_vnf_phy_info_list_add(nfapi_vnf_config_t* config, nfapi_vnf_phy_info_t* info);
+nfapi_vnf_phy_info_t* nfapi_vnf_phy_info_list_find(nfapi_vnf_config_t* config, uint16_t phy_id);
+void nfapi_vnf_pnf_list_add(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* node);
+nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5_idx);
+#endif // _VNF_H_
diff --git a/nfapi/open-nFAPI/vnf/inc/vnf_p7.h b/nfapi/open-nFAPI/vnf/inc/vnf_p7.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc2ab4e6b5382bd282d08d1a20290b98b0e65f88
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/inc/vnf_p7.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef _VNF_P7_H_
+#define _VNF_P7_H_
+
+#include "nfapi_vnf_interface.h"
+
+#define TIMEHR_SEC(_time_hr) ((uint32_t)(_time_hr) >> 20)
+#define TIMEHR_USEC(_time_hr) ((uint32_t)(_time_hr) & 0xFFFFF)
+#define TIME2TIMEHR(_time) (((uint32_t)(_time.tv_sec) & 0xFFF) << 20 | ((uint32_t)(_time.tv_usec) & 0xFFFFF))
+
+
+
+typedef struct {
+	uint8_t* buffer;
+	uint16_t length;
+} vnf_p7_rx_message_segment_t;
+
+typedef struct vnf_p7_rx_message vnf_p7_rx_message_t;
+
+typedef struct vnf_p7_rx_message {
+	uint8_t sequence_number;
+	uint8_t num_segments_received;
+	uint8_t num_segments_expected;
+
+	// the spec allows of upto 128 segments, this does seem excessive
+	vnf_p7_rx_message_segment_t segments[128];
+
+	uint32_t rx_hr_time;
+
+	vnf_p7_rx_message_t* next;
+} vnf_p7_rx_message_t;
+
+typedef struct {
+
+	vnf_p7_rx_message_t* msg_queue;
+
+} vnf_p7_rx_reassembly_queue_t;
+
+typedef struct nfapi_vnf_p7_connection_info {
+
+	/*! The PHY id */
+	int phy_id;
+
+
+	// this does not belong here...
+	uint8_t stream_id;
+
+	/*! Flag indicating the sync state of the P7 conenction */
+	uint8_t in_sync;
+
+	int dl_out_sync_offset; 
+	int dl_out_sync_period; // ms (as a pow2)
+
+	int dl_in_sync_offset; 
+	int dl_in_sync_period; // ms (as a pow2)
+
+	uint8_t filtered_adjust;
+	uint16_t min_sync_cycle_count;
+	uint32_t latency[8];
+	uint32_t average_latency;
+	int32_t sf_offset_filtered;
+	int32_t sf_offset_trend;
+	int32_t sf_offset;
+	uint16_t zero_count;
+	int32_t adjustment;
+	int32_t insync_minor_adjustment;
+	int32_t insync_minor_adjustment_duration;
+
+	uint32_t previous_t1;
+	uint32_t previous_t2;
+	int32_t previous_sf_offset_filtered;
+
+	int sfn_sf;
+
+	int socket;
+	struct sockaddr_in local_addr;
+	struct sockaddr_in remote_addr;
+	
+	vnf_p7_rx_reassembly_queue_t reassembly_queue;
+	uint8_t* reassembly_buffer;
+	uint32_t reassembly_buffer_size;
+
+	uint32_t sequence_number;
+
+	struct nfapi_vnf_p7_connection_info* next;
+
+} nfapi_vnf_p7_connection_info_t;
+
+typedef struct {
+
+	nfapi_vnf_p7_config_t _public;
+	
+	// private data
+	uint8_t terminate;
+	nfapi_vnf_p7_connection_info_t* p7_connections;
+	int socket;
+	uint32_t sf_start_time_hr;
+	uint8_t* rx_message_buffer; // would this be better put in the p7 conenction info?
+	uint16_t rx_message_buffer_size;
+	
+} vnf_p7_t;
+
+uint32_t vnf_get_current_time_hr(void);
+
+uint16_t increment_sfn_sf(uint16_t sfn_sf);
+int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
+int send_mac_subframe_indications(vnf_p7_t* config);
+int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7 );
+
+void vnf_p7_connection_info_list_add(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* node);
+nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_find(vnf_p7_t* vnf_p7, uint16_t phy_id);
+nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_delete(vnf_p7_t* vnf_p7, uint16_t phy_id);
+
+int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
+
+void vnf_p7_release_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
+void vnf_p7_release_pdu(vnf_p7_t* vnf_p7, void* pdu);
+
+
+#endif // _VNF_P7_H_
diff --git a/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h b/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..462901391a8cd63bfc9b25a239f8600870fdad52
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h
@@ -0,0 +1,995 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _NFAPI_VNF_INTERFACE_H_
+#define _NFAPI_VNF_INTERFACE_H_
+
+#include "nfapi_interface.h"
+#include "debug.h"
+
+#include "netinet/in.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#define NFAPI_MAX_PACKED_MESSAGE_SIZE 8192
+
+/*! The nfapi VNF phy configuration information
+ */
+typedef struct nfapi_vnf_phy_info
+{
+	/*! The P5 Index */
+	int p5_idx;	//which p5 connection
+	/*! The PHY ID */
+	int phy_id; //phy_id
+
+	/*! Timing window */
+	uint8_t timing_window;
+	/*! Timing info mode */
+	uint8_t timing_info_mode;
+	/*! Timing info period */
+	uint8_t timing_info_period;
+
+	/*! P7 UDP socket information for the pnf */
+	struct sockaddr_in p7_pnf_address;
+	/*! P7 UDP socket information for the vnf */
+	struct sockaddr_in p7_vnf_address;
+
+	struct nfapi_vnf_phy_info* next;
+} nfapi_vnf_phy_info_t;
+
+/*! The nfapi VNF pnf configuration information
+ */
+typedef struct nfapi_vnf_pnf_info
+{
+	/*! The P5 Index */
+	int p5_idx;
+	/*! The P5 socket */
+	int p5_sock;
+	/*! Flag indicating if the pnf is connected */
+	uint8_t connected;
+
+	/*! P5 SCTP socket information for the pnf */
+	struct sockaddr_in p5_pnf_sockaddr;
+
+	/*! Flag indicating if this pnf should be deleted */
+	uint8_t to_delete;
+
+	struct nfapi_vnf_pnf_info* next;
+
+} nfapi_vnf_pnf_info_t;
+
+typedef struct nfapi_vnf_config nfapi_vnf_config_t;
+
+/*! The nfapi VNF configuration information
+ */
+typedef struct nfapi_vnf_config
+{
+	/*! A user define callback to override the default memory allocation */
+	void* (*malloc)(size_t size);
+	/*! A user define callback to override the default memory deallocation */
+	void (*free)(void*);
+	/*! A user define callback to handle trace from the pnf */
+	void (*trace)(nfapi_trace_level_t level, const char* message, ...);
+
+	/*! The port the VNF P5 SCTP connection listens on
+	 *
+	 *  By default this will be set to 7701. However this can be changed if
+	 *  required.
+	 */
+	int vnf_p5_port;
+
+	// todo : for enabling ipv4/ipv6
+	int vnf_ipv4;
+	int vnf_ipv6;
+
+	/*! List of connected pnfs */
+	nfapi_vnf_pnf_info_t* pnf_list;
+
+	/*! List of configured phys */
+	nfapi_vnf_phy_info_t* phy_list;
+
+	/*! Configuration options for the p4 p5 pack unpack functions */
+	nfapi_p4_p5_codec_config_t codec_config;
+	
+	/*! Optional user defined data that will be avaliable in the callbacks*/
+	void* user_data;
+
+	/*! \brief Callback indicating that a pnf has established connection 
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 used to indicate this pnf p5 connection
+	 * 
+	 *  The client is expected to send the PNF_PARAM.request in response to 
+	 *  the connection indication
+	 * 
+	 *  \todo Do we need to send the address information of the PNF?
+	 */
+	int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
+	
+	/*! \brief Callback indicating that a pnf has lost connection 
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 used to indicate this pnf p5 connection
+	 *
+	 *  The p5_idx may be used for future new p5 connections
+	 *
+	 *  The client is responsiable for communicating to the p7 instance(s) that
+	 *  may be associated with this p5 that they should be deleted using the 
+	 *  nfapi_vnf_p7_del_pnf functon
+	 * 
+	 */
+	int (*pnf_disconnect_indication)(nfapi_vnf_config_t* config, int p5_idx);
+
+	// p5 interface functions
+	
+	/*! \brief A callback to handle the PNF_PARAM.resp
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded PNF_PARAM.response. This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The PNF_PARAM.resp contains the capability of the PNF identified by the
+	 *  p5_idx. 
+	 *  
+	 *  The client is expected to send the PNF_CONFIG.request after receiving the
+	 *  PNF_PARAM.resp. This can be done in the call back. 
+	 *
+	 *  It is expected that the client when building the PNF_CONFIG.request will
+	 *  used the nfapi_vnf_allocate_phy() to allocate unique phy id for each FAPI
+	 *  instance the client wishes to create.
+	 *  
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */
+	int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp);
+	
+	/*! A callback for the PNF_CONFIG.resp 
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded PNF_CONFIG.response. This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The PNF_CONFIG.resp contains the result of the PNF_CONFIG.request for the 
+	  * PNF identified by the p5_idx. 
+	 *  
+	 *  The client is expected to send the PNF_START.request after receiving the
+	 *  PNF_PARAM.resp. This can be done in the call back. 
+	 *  
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */
+	int (*pnf_config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp);
+	
+	/*! A callback for the PNF_START.resp
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded PNF_START.response. This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The PNF_START.resp contains the result of the PNF_START.request for the 
+	 *  PNF identified by the p5_idx. 
+	 *  
+	 *  The client is expected to send the PARAM.request for each FAPI instance 
+	 *  that has been created in the PNF. 
+	 *  
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */
+	int (*pnf_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp);
+	
+	/*! A callback for the PNF_STOP.resp
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded PNF_STOP.response. This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The PNF_STOP.response contains the result of the PNF_STOP.request for the 
+     *  PNF identified by the p5_idx. 
+	 *  
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */
+	int (*pnf_stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_response_t* resp);
+	
+	/*! A callback for the PARAM.resp
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded PARAM.resposne. This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The PARAM.request contains the capabilities of the FAPI instance identified
+	 *  by the phy_id
+	 *
+	 *  The client is expected to send the CONFIG.request after receiving the
+	 *  PARAM.response. This can be done in the call back. The PARAM.response 
+	 *  contains the PNF P7 address (ipv4 or ipv6) and port. This information 
+	 *  is used when calling the nfapi_vnf_p7_add_pnf()
+	 * 
+	 *  The client is responsible for identifing the VNF P7 ip address 
+	 *  (ipv4 or ipv6) and port for the VNF P7 entity which will be sent to the
+	 *  PNF P7 entity. That endpoint should be valid before send the 
+	 * CONFIG.request.
+	 * 
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */
+	int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp);
+	
+	/*! A callback for the CONFIG.response
+     *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded CONFIG.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The CONFIG.response contains the result of the CONFIG.request
+	 *
+	 * 
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */
+	int (*config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp);
+	
+	/*! A callback for the START.resp
+     *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded START.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The START.response contains the result of the START.request
+	 *
+	 * 
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */
+	int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp);
+	
+	/*! A callback for the STOP.resp
+     *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded STOP.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The STOP.response contains the result of the STOP.request
+	 *
+	 * 
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_response_t* resp);
+	 
+	/*! A callback for the MEASUREMENT.resp 
+     *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded MEASUREMENT.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 *  
+	 *  The MEASUREMENT.response contains the result of the MEASUREMENT.request
+	 * 
+	 *  The resp may contain pointers to dyanmically allocated sub structures  
+	 *  such as the vendor_extention. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*measurement_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_measurement_response_t* resp);
+
+	// p4 interface functions
+	/*! A callback for the RSSI.resp 
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded RSSI.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 */
+	int (*rssi_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_response_t* resp);
+	
+	/*! A callback for the RSSI.indication
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded RSSI.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 */
+	int (*rssi_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_indication_t* ind);
+	
+	/*! A callback for the CELL_SEARCH.response
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded CELL_SEARCH.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 */
+	int (*cell_search_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_response_t* resp);
+	
+	/*! A callback for the CELL_SEARCH.indication
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded CELL_SEARCH.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 */
+	int (*cell_search_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_indication_t* ind);
+	
+	/*! A callback for the BROADCAST_DETECT.response
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded BROADCAST_DETECT.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.	 */
+	int (*broadcast_detect_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_response_t* resp);
+	
+	/*! A callback for the BROADCAST_DETECT.indication
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded BROADCAST_DETECT.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.	 
+	 */
+	int (*broadcast_detect_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_indication_t* ind);
+	
+	/*! A callback for the SYSTEM_INFORMATION_SCHEUDLE.response
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.	 
+	 */
+	int (*system_information_schedule_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_response_t* resp);
+	
+	/*! A callback for the SYSTEM_INFORMATION_SCHEUDLE.indication
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.	
+	 */
+	int (*system_information_schedule_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_indication_t* ind);
+	
+	/*! A callback for the SYSTEM_INFORMATION.response
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded SYSTEM_INFORMATION.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.	
+	 */
+	int (*system_information_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_response_t* resp);
+	
+	/*! A callback for the SYSTEM_INFORMATION.indication
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded SYSTEM_INFORMATION.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.	
+	 */
+	int (*system_information_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_indication_t* ind);
+	
+	/*! A callback for the NMM_STOP.response
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded NMM_STOP.response This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.		
+	 */
+	int (*nmm_stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nmm_stop_response_t* resp);
+	
+
+	/*! A callback for any vendor extension message received
+	 *  \param config A pointer to the vnf configuration
+	 *  \param p5_idx The p5 index used to indicate a particular pnf p5 connection
+	 *  \param resp A data structure for the decoded vendor extention message 
+	 *  \return not currently used.	
+	 */
+	int (*vendor_ext)(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg);
+
+	/*! A callback to allocate vendor extension messages
+	 *  \param message_id The message is taken from the message header
+	 *  \param msg_size The is the vendor extention message that has been allocated. 
+	 *					The callee must set this value
+	 *	\return A pointer to an allocated vendor extention message
+	 */
+	nfapi_p4_p5_message_header_t* (*allocate_p4_p5_vendor_ext)(uint16_t message_id, uint16_t* msg_size);
+	
+	/*! A callback to deallocate vendor extension messages
+	 *  \param header A pointer to an allocated vendor extention message
+	 */
+	void (*deallocate_p4_p5_vendor_ext)(nfapi_p4_p5_message_header_t* header);
+
+
+
+
+	
+	
+} nfapi_vnf_config_t;
+
+/*! Creates and initialise the vnf config structure before use
+ * \return A pointer to a vnf config structure
+ */
+nfapi_vnf_config_t* nfapi_vnf_config_create(void);
+
+/*! Delete an vnf config
+ */
+void nfapi_vnf_config_destory(nfapi_vnf_config_t* config);
+
+
+/*! Start the VNF library. 
+ * \param config A pointer to a vnf config
+ * \return 0 means success, -1 failure
+ *
+ * The config should be initailize with port the vnf should listen on and
+ * the callback set to functions that will be called when a nFAPI message is 
+ * recevied before calling nfapi_vnf_start.
+ * 
+ * This function will not return untill nfapi_vnf_stop is called
+ */
+int nfapi_vnf_start(nfapi_vnf_config_t* config);
+
+/*! Stop the VNF library. 
+ * \param config A pointer to a vnf config
+ * \return 0 means success, -1 failure
+ * 
+ * This function will cause the nfapi_vnf_start function to return
+ */
+int nfapi_vnf_stop(nfapi_vnf_config_t* config);
+
+/*! Allocates a PHY ID for the PNF PHY instance managed by this VNF
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index return by the callbacks
+ * \param phy_id A pointer to a phy_id that will be set by this function
+ * \return  0 means success, -1 failure
+ * 
+ * Called before nfapi_vnf_config_req to allocate a vnf phy instance. This
+ * function will return unqiue phy_id to be used for this identify the phy
+ *
+ */
+int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy_id);
+
+// P5 Request functions
+//
+/*! Send the PNF_PARAM.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a PNF_PARAM.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req);
+
+/*! Send the PNF_CONFIG.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a PNF_CONFIG.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_config_request_t* req);
+
+/*! Send the PNF_START.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a PNF_START.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_start_request_t* req);
+
+/*! Send the PNF_STOP.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a PNF_STOP.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_stop_request_t* req);
+
+/*! Send the PARAM.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a PARAM.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req);
+
+/*! Send the CONFIG.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a CONFIG.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req);
+
+/*! Send the START.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a START.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req);
+
+/*! Send the STOP.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a STOP.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_request_t* req);
+
+/*! Send the MEASUREMENT.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a MEASUREMENT.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_measurement_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_measurement_request_t* req);
+
+// P4 Request functions
+/*! Send the RSSI.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a RSSI.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_rssi_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_request_t* req);
+
+/*! Send the CELL_SEARCH.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a CELL_SEARCH.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_cell_search_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_request_t* req);
+
+/*! Send the BROADCAST_DETECT.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a BROADCAST_DETECT.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_broadcast_detect_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_request_t* req);
+
+/*! Send the SYSTEM_INFORMATION_SCHEDULE.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a SYSTEM_INFORMATION_SCHEDULE.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_system_information_schedule_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_request_t* req);
+
+/*! Send the SYSTEM_INFORMATION.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a SYSTEM_INFORMATION.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_system_information_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_request_t* req);
+
+/*! Send the NMM_STOP.request
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param req A pointer to a NMM_STOP.request message structure
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_nmm_stop_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_nmm_stop_request_t* req);
+
+/*! Send a vendor extension message
+ * \param config A pointer to a vnf config
+ * \param p5_idx The P5 index
+ * \param msg A poiner to a vendor extention message
+ * \return  0 means success, -1 failure
+ */
+int nfapi_vnf_vendor_extension(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg);
+
+//-----------------------------------------------------------------------------
+
+/*! The nfapi VNF P7 connection information
+ */
+typedef struct nfapi_vnf_p7_config nfapi_vnf_p7_config_t;
+
+/*! The nfapi VNF P7 configuration information
+ */
+typedef struct nfapi_vnf_p7_config
+{
+	/*! A user define callback to override the default memory allocation
+	 * \param size Size of the memory block to allocate
+	 * \return a pointer to a memory block
+	 *
+	 * If not set the vnf p7 library will use malloc
+	 */
+	void* (*malloc)(size_t size);
+	
+	/*! A user define callback to override the default memory deallocation
+	 * \param ptr Pointer to a memory block to deallocate
+	 *
+	 * If not set the vnf p7 library will use free
+	 */
+	void (*free)(void*);
+	
+	/*! A user define callback to handle trace from the pnf
+	 * \param level The trace level 
+	 * \param message The trace string
+	 */
+	void (*trace)(nfapi_trace_level_t level, const char* message, ...);
+
+	/*! The port the vnf p7 will receive on */
+	int port;
+
+	/*! Flag to indicate of the pnf should use the P7 checksum */
+	uint8_t checksum_enabled;
+
+	/*! The maxium size of a P7 segement. If a message is large that this it
+	 * will be segemented */
+	uint16_t segment_size;
+	uint16_t max_num_segments;
+
+	/*! Configuration option for the p7 pack unpack functions*/
+	nfapi_p7_codec_config_t codec_config;
+
+	/* ! Call back to indicate the sync state with the PNF PHY
+	 * \param config A pointer to the vnf p7 configuration
+	 * \param sync Indicating if the pnf is in sync or not
+	 * \return not currently used
+	 *
+	 * sync = 0  : in sync
+	 * sync != 0 : out of sync
+	 */
+	int (*sync_indication)(struct nfapi_vnf_p7_config* config, uint8_t sync);
+
+	/*! A callback for the subframe indication
+	 * \param config A pointer to the vnf p7 configuration
+	 * \param phy_id The ID for the PNF PHY instance
+	 * \param sfn_sf The SFN SF number formated as per the FAPI specification
+	 * \return not currently used
+	 *
+	 * This callback is an indication for the VNF to generate the downlink subframe messages
+	 * for sfn/sf. This indicatoin is called every millisecond
+	 *
+	 * The VNF P7 Lib will adjust the subframe timing to 'catch-up' or 'slow-down' with the PNF PHY's
+	 *
+	 * \todo Need some way the tell the VNF how long it has
+	 */
+	
+	int (*subframe_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf);
+
+	/*! A callback for the HARQ.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded HARQ.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind);
+	
+	/*! A callback for the CRC.ind
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded CRC.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*crc_indication)(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind);
+	
+	/*! A callback for the RX_ULSCH.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded RX_ULSCH.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 *
+	 *  Note that the rx_indication may hold one or many uplink pdus in the 
+	 *  ind.rx_indication_body.rx_pdu_list
+	 */	
+	int (*rx_indication)(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind);
+	
+	/*! A callback for the RACH.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded RACH.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*rach_indication)(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind);
+	
+	/*! A callback for the SRS.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded SRS.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*srs_indication)(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind);
+	
+	/*! A callback for the RX_SR.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded RX_SR.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*sr_indication)(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind);
+	
+	/*! A callback for the RX_CQI.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded RX_CQI.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*cqi_indication)(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind);
+	
+	/*! A callback for the LBT_DL.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded LBT_DL.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*lbt_dl_indication)(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind);
+	
+	/*! A callback for the NB_HARQ.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded LBT_DL.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*nb_harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind);	
+	
+	/*! A callback for the NRACH.indication
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param ind A data structure for the decoded LBT_DL.indication This will 
+	 *              have been allocated on the stack. 
+	 *  \return not currently used.
+	 * 
+	 *  The ind may contain pointers to dyanmically allocated sub structures  
+	 *  such as the pdu. The dyanmically allocated structure will 
+	 *  be deallocated on return. If the client wishes to 'keep' the structures 
+	 *  then the substructure pointers should be set to 0 and then the client should
+	 *  use the codec_config.deallocate function to release it at a future point
+	 */	
+	int (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind);		
+	
+	/*! A callback for any vendor extension messages
+     *  \param config A pointer to the vnf p7 configuration
+	 *  \param msg A data structure for the decoded vendor extention message allocated
+	 *			   using the allocate_p7_vendor_ext callback
+	 *  \return not currently used.
+	 */	
+	int (*vendor_ext)(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg);
+
+	/*! Optional userdata that will be passed back in the callbacks*/
+	void* user_data;
+	
+	/*! A callback to allocate a memory for a vendor extension message
+	 *  \param message_id The message is taken from the p7 message header
+	 *  \param msg_size The is the vendor extention message that has been allocated. 
+	 *					The callee must set this value
+	 *	\return A pointer to an allocated vendor extention message
+	 */
+	nfapi_p7_message_header_t* (*allocate_p7_vendor_ext)(uint16_t message_id, uint16_t* msg_size);
+	
+	/*! A callback to deallocate a vendor extension message
+	 *  \param header A pointer to an allocated vendor extention message
+	 */
+	void (*deallocate_p7_vendor_ext)(nfapi_p7_message_header_t* header);
+
+
+} nfapi_vnf_p7_config_t;
+
+/*! Creates and initializes the nfapi_vnf_p7_config structure before use
+ *  \return A pointer to an allocated vnf p7 configuration
+ */
+nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create(void);
+
+/*! Cleanup and delete nfapi_vnf_p7_config structure
+ *  \param config A pointer to an vnf p7 configuration structure
+ *
+ *  The pointer to the config will not long be valid after this call
+ */
+ 
+void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config);
+
+/*! Start the VNF P7 library.
+ *  \param config A pointer to an vnf p7 configuration structure
+ *	\return A status value. 0 equal success, -1 indicates failure
+ *
+ * This function is blocking and will not return until the nfapi_vnf_p7_stop
+ * function is called. 
+ */
+ 
+int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config);
+
+/*! Stop the VNF P7 library. 
+ *  \param config A pointer to an vnf p7 configuration structure
+ *	\return A status value. 0 equal success, -1 indicates failure
+ * 
+ * This function will cause the nfapi_vnf_p7_start function to return
+ */
+int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config);
+
+/*! Release a P7 message back to the vnf_p7 library. This should be used if the
+ *  callback return 0 in the case where MAC wants to keep the message for
+ *  futher processing.
+ *  This function will release any pdu's is they are non-null. If the uplink
+ *  PDU need to be kept then they pdu pointer should be set to 0 in the message
+ *  and then the nfapi_vnf_p7_release_pdu message can be used to release the
+ *  pdu later.
+ */
+int nfapi_vnf_p7_release_msg(nfapi_vnf_p7_config_t* config, nfapi_p7_message_header_t*);
+
+/*! Release a P7 pdu's back to the vnf_p7 library.
+ */
+int nfapi_vnf_p7_release_pdu(nfapi_vnf_p7_config_t* config, void*);
+
+/*! Add a vnf p7 instance to the vnf p7 module
+ *  \param config A pointer to the vnf p7 configuration
+ *  \param pnf_p7_addr The udp address the pnf p7 entity has chosen 
+ *  \param pnf_p7_port The udp port the pnf p7 entity has chosen
+ *  \param phy_id The unique phy id for the pnf p7 entity
+ *  \return A status value. 0 equal success, -1 indicates failure
+ *
+ * This function should be used to each pnf p7 entity that is to be added to this
+ * vnf p7 entity. Once added the vnf p7 entity will start establish sync with the
+ * pnf p7 entity and that has been sucessfull will generate subframe indications for it
+ */
+int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, int pnf_p7_port, int phy_id);
+
+/*! Delete a vnf p7 instance to the vnf p7 module
+ *  \param config A pointer to the vnf p7 configuration
+ *  \param phy_id The unique phy id for the pnf p7 entity
+ *  \return A status value. 0 equal success, -1 indicates failure
+ *
+ * This function should be used to remove a pnf p7 entity from the vnf p7 entity
+ */
+int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id);
+
+/*! Send the DL_CONFIG.request
+ *  \param config A pointer to the vnf p7 configuration
+ *  \param req A data structure for the decoded DL_CONFIG.request.
+ *	\return A status value. 0 equal success, -1 indicates failure
+ * 
+ *  The caller is responsiable for memory management of any pointers set in the req, which
+ *  may be released after this function call has returned or at a later pointer
+ */
+int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_request_t* req);
+
+/*! Send the UL_CONFIG.request
+ *  \param config A pointer to the vnf p7 configuration
+ *  \param req A data structure for the decoded UL_CONFIG.request.
+ *	\return A status value. 0 equal success, -1 indicates failure
+ * 
+ *  The caller is responsiable for memory management of any pointers set in the req, which
+ *  may be released after this function call has returned or at a later pointer
+ */
+int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req);
+
+/*! Send the HI_DCI0.request
+ *  \param config A pointer to the vnf p7 configuration
+ *  \param req A data structure for the decoded HI_DCI0.request.
+ *	\return A status value. 0 equal success, -1 indicates failure
+ * 
+ *  The caller is responsiable for memory management of any pointers set in the req, which
+ *  may be released after this function call has returned or at a later pointer
+ */
+int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
+
+/*! Send the TX.req
+ *  \param config A pointer to the vnf p7 configuration
+ *  \param req A data structure for the decoded HI_DCI0.request.
+ *	\return A status value. 0 equal success, -1 indicates failure
+ * 
+ *  The caller is responsiable for memory management of any pointers set in the req, which
+ *  may be released after this function call has returned or at a later pointer
+ */
+int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req);
+
+/*! Send the LBT_DL_CONFIG.requst
+ *  \param config A pointer to the vnf p7 configuration
+ *  \param req A data structure for the decoded LBT_DL_CONFIG.request.
+ *	\return A status value. 0 equal success, -1 indicates failure
+ * 
+ *  The caller is responsiable for memory management of any pointers set in the req, which
+ *  may be released after this function call has returned or at a later pointer
+ */
+int nfapi_vnf_p7_lbt_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req);
+
+/*! Send a vendor extension message
+ *  \param config A pointer to the vnf p7 configuration
+ *  \param msg A data structure for the decoded vendor extention message
+ *	\return A status value. 0 equal success, -1 indicates failure
+ * 
+ *  The caller is responsiable for memory management of any pointers set in the req, which
+ *  may be released after this function call has returned or at a later pointer
+ */
+int nfapi_vnf_p7_vendor_extension(nfapi_vnf_p7_config_t* config, nfapi_p7_message_header_t* msg);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // _NFAPI_PNF_INTERFACE_H_
diff --git a/nfapi/open-nFAPI/vnf/src/vnf.c b/nfapi/open-nFAPI/vnf/src/vnf.c
new file mode 100644
index 0000000000000000000000000000000000000000..6800ee21d202cbae1c69ae5335ab7fbae3efd7a0
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/src/vnf.c
@@ -0,0 +1,1123 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include "vnf.h"
+
+
+void* vnf_malloc(nfapi_vnf_config_t* config, size_t size)
+{
+	if(config->malloc)
+	{
+		return (config->malloc)(size);
+	}
+	else
+	{
+		return calloc(1, size); 
+	}
+}
+void vnf_free(nfapi_vnf_config_t* config, void* ptr)
+{
+	if(config->free)
+	{
+		return (config->free)(ptr);
+	}
+	else
+	{
+		return free(ptr); 
+	}
+}
+
+void nfapi_vnf_phy_info_list_add(nfapi_vnf_config_t* config, nfapi_vnf_phy_info_t* info)
+{
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "Adding phy p5_idx:%d phy_id:%d\n", info->p5_idx, info->phy_id);
+	info->next = config->phy_list;
+	config->phy_list = info;
+}
+
+nfapi_vnf_phy_info_t* nfapi_vnf_phy_info_list_find(nfapi_vnf_config_t* config, uint16_t phy_id)
+{
+	nfapi_vnf_phy_info_t* curr = config->phy_list;
+	while(curr != 0)
+	{
+		if(curr->phy_id == phy_id)
+			return curr;
+
+		curr = curr->next;
+	}
+
+	return 0;
+}
+
+
+
+
+void nfapi_vnf_pnf_list_add(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* node)
+{
+	node->next = config->pnf_list;
+	config->pnf_list = node;
+}
+
+
+nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5_idx)
+{
+	NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : config->pnf_list:%p\n", __FUNCTION__, config->pnf_list);
+
+	nfapi_vnf_pnf_info_t* curr = config->pnf_list;
+	while(curr != 0)
+	{
+		if(curr->p5_idx == p5_idx)
+                {
+                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : curr->p5_idx:%d p5_idx:%d\n", __FUNCTION__, curr->p5_idx, p5_idx);
+			return curr;
+                        }
+
+                NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : curr->next:%p\n", __FUNCTION__, curr->next);
+
+		curr = curr->next;
+	}
+
+	return 0;
+}
+
+void vnf_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_PARAM.reponse\n");
+
+		nfapi_pnf_param_response_t msg;
+			
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			// Invoke the call back
+			if(config->pnf_param_resp)
+			{
+				(config->pnf_param_resp)(config, p5_idx, &msg);
+			}
+		}	
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_pnf_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_CONFIG_RESPONSE\n");
+		
+		nfapi_pnf_config_response_t msg;
+		
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			// Invoke the call back
+			if(config->pnf_config_resp)
+			{
+				(config->pnf_config_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_pnf_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_START_RESPONSE\n");
+	
+		nfapi_pnf_start_response_t msg;
+	
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->pnf_start_resp)
+			{
+				(config->pnf_start_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_pnf_stop_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_STOP_RESPONSE\n");
+	
+		nfapi_pnf_stop_response_t msg;
+
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->pnf_stop_resp)
+			{
+				(config->pnf_stop_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+
+	}
+}
+
+void vnf_handle_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PARAM_RESPONSE\n");
+		
+		nfapi_param_response_t msg;
+		
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			
+			if (msg.error_code == NFAPI_MSG_OK)
+			{
+				nfapi_vnf_phy_info_t* phy_info = nfapi_vnf_phy_info_list_find(config, msg.header.phy_id);
+		
+				if(msg.nfapi_config.p7_pnf_address_ipv4.tl.tag)
+				{
+					struct sockaddr_in sockAddr;
+		
+					(void)memcpy(&sockAddr.sin_addr.s_addr, msg.nfapi_config.p7_pnf_address_ipv4.address, NFAPI_IPV4_ADDRESS_LENGTH);
+					NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 IPv4 address: %s\n", inet_ntoa(sockAddr.sin_addr));
+		
+					// store address
+					phy_info->p7_pnf_address.sin_addr = sockAddr.sin_addr;
+				}
+		
+				if(msg.nfapi_config.p7_pnf_address_ipv6.tl.tag)
+				{
+					struct sockaddr_in6 sockAddr6;
+					char addr6[64];
+					(void)memcpy(&sockAddr6.sin6_addr, msg.nfapi_config.p7_pnf_address_ipv6.address, NFAPI_IPV6_ADDRESS_LENGTH);
+					NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 IPv6 address: %s\n", inet_ntop(AF_INET6, &sockAddr6.sin6_addr, addr6, sizeof(addr6)));
+				}
+				
+				if (msg.nfapi_config.p7_pnf_port.tl.tag)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 Port: %d\n", msg.nfapi_config.p7_pnf_port.value);
+		
+					// store port
+					phy_info->p7_pnf_address.sin_port = htons(msg.nfapi_config.p7_pnf_port.value);
+				}
+			}
+			
+			if(config->param_resp)
+			{
+				(config->param_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received CONFIG_RESPONSE\n");
+			
+		nfapi_config_response_t msg;
+		
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >=0 )
+		{
+			if(config->config_resp)
+			{
+				(config->config_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{	
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received START_RESPONSE\n");
+
+		nfapi_start_response_t msg;
+		
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->start_resp)
+			{
+				(config->start_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_stop_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received STOP.response\n");
+	
+		nfapi_stop_response_t msg;
+			
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->stop_resp)
+			{
+				(config->stop_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_measurement_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received MEASUREMENT.response\n");
+		
+		nfapi_measurement_response_t msg;
+		
+		// unpack the message
+		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->measurement_resp)
+			{
+				(config->measurement_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_rssi_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received RSSI.response\n");		
+
+		nfapi_rssi_response_t msg;
+		
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->rssi_resp)
+			{
+				(config->rssi_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_rssi_indication(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received RSSI.indication\n");	
+
+		nfapi_rssi_indication_t msg;
+		
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->rssi_ind)
+			{
+				(config->rssi_ind)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_cell_search_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received CELL_SEARCH.response\n");
+		
+		nfapi_cell_search_response_t msg;
+	
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->cell_search_resp)
+			{
+				(config->cell_search_resp)(config, p5_idx, &msg);
+			}	
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_cell_search_indication(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_cell_search_indication: NULL parameters\n");
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received CELL_SEARCH.indication\n");
+	
+		nfapi_cell_search_indication_t msg;
+		
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->cell_search_ind)
+			{
+				(config->cell_search_ind)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_cell_search_response: Unpack message failed, ignoring\n");
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_broadcast_detect_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received BROADCAST_DETECT.response\n");
+
+		nfapi_broadcast_detect_response_t msg;
+
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->broadcast_detect_resp)
+			{
+				(config->broadcast_detect_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_broadcast_detect_indication(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received BROADCAST_DETECT.indication\n");
+
+		nfapi_broadcast_detect_indication_t msg;
+
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->broadcast_detect_ind)
+			{
+				(config->broadcast_detect_ind)(config, p5_idx, &msg);
+			}	
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+			return;
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_system_information_schedule_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received SYSTEM_INFORMATION_SCHEDULE.response\n");
+	
+		nfapi_system_information_schedule_response_t msg;
+		
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->system_information_schedule_resp)
+			{
+				(config->system_information_schedule_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+			
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_system_information_schedule_indication(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received SYSTEM_INFORMATION_SCHEDULE.indication\n");
+
+		nfapi_system_information_schedule_indication_t msg;
+
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->system_information_schedule_ind)
+			{
+				(config->system_information_schedule_ind)(config, p5_idx, &msg);
+			}	
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_system_information_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received SYSTEM_INFORMATION.response\n");
+
+		nfapi_system_information_response_t msg;
+		
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
+		{
+			if(config->system_information_resp)
+			{
+				(config->system_information_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+	
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_system_information_indication(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received SYSTEM_INFORMATION.indication\n");
+		
+		nfapi_system_information_indication_t msg;
+		
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+			return;
+		}
+	
+		if(config->system_information_ind)
+		{
+			(config->system_information_ind)(config, p5_idx, &msg);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+}
+
+void vnf_handle_nmm_stop_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "Received NMM_STOP.response\n");	
+		
+		nfapi_nmm_stop_response_t msg;	
+		
+		// unpack the message
+		if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(nfapi_nmm_stop_response_t), &config->codec_config) >= 0)
+		{
+			if(config->nmm_stop_resp)
+			{
+				(config->nmm_stop_resp)(config, p5_idx, &msg);
+			}
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+		}
+		
+		// make sure to release any dyanmic part of the message
+		if(msg.vendor_extension)
+			config->codec_config.deallocate(msg.vendor_extension);
+	}
+	
+}
+
+void vnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx, uint16_t message_id)
+{
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+	
+	if(config->allocate_p4_p5_vendor_ext && config->deallocate_p4_p5_vendor_ext)
+	{
+		uint16_t msg_size;
+		
+		nfapi_p4_p5_message_header_t* msg = config->allocate_p4_p5_vendor_ext(message_id, &msg_size);
+
+		if(msg)
+		{
+			if(nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &config->codec_config) >= 0)
+			{
+				if(config->vendor_ext)
+					config->vendor_ext(config, p5_idx, msg);
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
+			}
+			
+			config->deallocate_p4_p5_vendor_ext(msg);
+		}
+		else
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n");
+		}
+	}
+}
+
+void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config)
+{
+	nfapi_p4_p5_message_header_t messageHeader;
+
+	// validate the input params
+	if(pRecvMsg == NULL || recvMsgLen < NFAPI_HEADER_LENGTH || config == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p4_p5_message: invalid input params\n");
+		return;
+	}
+
+	// unpack the message header
+	if (nfapi_p5_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p4_p5_message_header_t), &config->codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
+		return;
+	}
+
+	switch (messageHeader.message_id)
+	{
+		case NFAPI_PNF_PARAM_RESPONSE:
+			vnf_handle_pnf_param_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_PNF_CONFIG_RESPONSE:
+			vnf_handle_pnf_config_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_PNF_START_RESPONSE:
+			vnf_handle_pnf_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_PNF_STOP_RESPONSE:
+			vnf_handle_pnf_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_PARAM_RESPONSE:
+			vnf_handle_param_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_CONFIG_RESPONSE:
+			vnf_handle_config_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_START_RESPONSE:
+			vnf_handle_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_STOP_RESPONSE:
+			vnf_handle_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_MEASUREMENT_RESPONSE:
+			vnf_handle_measurement_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_RSSI_RESPONSE:
+			vnf_handle_rssi_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_RSSI_INDICATION:
+			vnf_handle_rssi_indication(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_CELL_SEARCH_RESPONSE:
+			vnf_handle_cell_search_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_CELL_SEARCH_INDICATION:
+			vnf_handle_cell_search_indication(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_RESPONSE:
+			vnf_handle_broadcast_detect_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_BROADCAST_DETECT_INDICATION:
+			vnf_handle_broadcast_detect_indication(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE:
+			vnf_handle_system_information_schedule_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION:
+			vnf_handle_system_information_schedule_indication(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_RESPONSE:
+			vnf_handle_system_information_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_SYSTEM_INFORMATION_INDICATION:
+			vnf_handle_system_information_indication(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		case NFAPI_NMM_STOP_RESPONSE:
+			vnf_handle_nmm_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
+			break;
+
+		default:
+			{
+				if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+				   messageHeader.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+				{
+					vnf_handle_vendor_extension(pRecvMsg, recvMsgLen, config, p5_idx, messageHeader.message_id);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, messageHeader.message_id);
+				}
+			}
+			break;
+	}
+}
+int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
+{
+	if(1)
+	{
+		int socket_connected = 1;
+
+		// 1. Peek the message header
+		// 2. If the message is larger than the stack buffer then create a dynamic buffer
+		// 3. Read the buffer
+		// 4. Handle the p5 message
+		
+		uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
+		uint8_t header_buffer[header_buffer_size];
+
+		uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
+		uint8_t stack_buffer[stack_buffer_size];
+
+		uint8_t* dynamic_buffer = 0;
+
+		uint8_t* read_buffer = &stack_buffer[0];
+		uint32_t message_size = 0;
+
+		struct sockaddr_in addr;
+		socklen_t addr_len = sizeof(addr);
+
+		struct sctp_sndrcvinfo sndrcvinfo;
+		(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
+
+		{
+			int flags = MSG_PEEK;
+			message_size = sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo,  &flags);
+
+			if(message_size == -1)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to peek sctp message size errno:%d\n", errno);
+				return 0;
+			}
+
+			nfapi_p4_p5_message_header_t header;
+			int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
+			if(unpack_result < 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to decode message header %d\n", unpack_result);
+				return 0;
+			}
+			message_size = header.message_length;
+
+			// now have the size of the mesage
+		}
+
+		if(message_size > stack_buffer_size)
+		{
+			dynamic_buffer = (uint8_t*)malloc(message_size);
+
+			if(dynamic_buffer == NULL)
+			{
+				// todo : add error mesage
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
+				return -1;
+			}
+
+			read_buffer = dynamic_buffer;
+		}
+
+		{
+			int flags = 0;
+			(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
+
+			int recvmsg_result = sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
+			if(recvmsg_result == -1)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
+			}
+			else
+			{
+				if (flags & MSG_NOTIFICATION)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
+
+					// todo - handle the events
+				}
+				else
+				{
+					/*
+					NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
+							pnf->p5_sock,
+							inet_ntoa(addr.sin_addr),
+							ntohs(addr.sin_port),
+							sndrcvinfo.sinfo_assoc_id,
+							sndrcvinfo.sinfo_stream,
+							ntohl(sndrcvinfo.sinfo_ppid),
+							message_size,
+							flags);
+					*/
+
+					// handle now if complete message in one or more segments
+					if ((flags & 0x80) == 0x80)
+					{
+						vnf_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
+					}
+					else
+					{
+						NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
+
+						// assume socket disconnected
+						NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
+						socket_connected =  0;
+					}
+
+
+				}
+			}
+		}
+
+		if(dynamic_buffer)
+		{
+			free(dynamic_buffer);
+		}
+
+		return socket_connected;
+	}
+}
+
+static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len, uint8_t stream)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s len:%d stream:%d\n", __FUNCTION__, len, stream);
+
+	int result = sctp_sendmsg(pnf->p5_sock, msg, len, (struct sockaddr*)&pnf->p5_pnf_sockaddr, sizeof(pnf->p5_pnf_sockaddr),1, 0, stream, 0, 4);
+
+	if(result != len)
+	{
+		if(result <  0)
+		{
+			// error
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "sctp sendto failed errno: %d\n", errno);
+		}
+		else
+		{
+			// did not send all the message
+		}
+	}
+
+	return 0;
+}
+
+
+int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
+{
+	nfapi_vnf_pnf_info_t* pnf = nfapi_vnf_pnf_list_find(&(vnf->_public), p5_idx);
+	
+	if(pnf)
+	{
+		// pack the message for transmission
+		int packedMessageLength = nfapi_p5_message_pack(msg, msg_len, vnf->tx_message_buffer, sizeof(vnf->tx_message_buffer), &vnf->_public.codec_config);
+
+		if (packedMessageLength < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p5_message_pack failed with return %d\n", packedMessageLength);
+			return -1;
+		}
+
+		return vnf_send_p5_msg(pnf, vnf->tx_message_buffer, packedMessageLength, 0/*msg->phy_id*/);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find pnf info for p5_idx:%d\n", __FUNCTION__, p5_idx);
+		return -1;
+	}
+}
+
+
+int vnf_pack_and_send_p4_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
+{
+	nfapi_vnf_pnf_info_t* pnf = nfapi_vnf_pnf_list_find(&(vnf->_public), p5_idx);
+	
+	if(pnf)
+	{
+		// pack the message for transmission
+		int packedMessageLength = nfapi_p4_message_pack(msg, msg_len, vnf->tx_message_buffer, sizeof(vnf->tx_message_buffer), &vnf->_public.codec_config);
+
+		if (packedMessageLength < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p4_message_pack failed with return %d\n", packedMessageLength);
+			return -1;
+		}
+
+		return vnf_send_p5_msg(pnf, vnf->tx_message_buffer, packedMessageLength, 0/*msg->phy_id*/);
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find pnf info for p5_idx:%d\n", __FUNCTION__, p5_idx);
+		return -1;
+	}
+}
+
diff --git a/nfapi/open-nFAPI/vnf/src/vnf_interface.c b/nfapi/open-nFAPI/vnf/src/vnf_interface.c
new file mode 100644
index 0000000000000000000000000000000000000000..0aba0a29f5e0c9a6d74ef1e361f7c135a875e31b
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/src/vnf_interface.c
@@ -0,0 +1,676 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <stdio.h>
+
+#include "vnf.h"
+
+
+
+nfapi_vnf_config_t* nfapi_vnf_config_create()
+{
+	vnf_t* _this = (vnf_t*)calloc(1, sizeof(vnf_t));
+
+	if(_this == 0)
+		return 0;
+
+	_this->sctp = 1;
+
+	_this->next_phy_id = 1;
+	
+	// Set the default P5 port
+	_this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT;
+	
+	// set the default memory allocation 
+	_this->_public.malloc = &malloc;
+	_this->_public.free = &free;
+	
+	// set the default memory allocation 
+	_this->_public.codec_config.allocate = &malloc;
+	_this->_public.codec_config.deallocate = &free;
+	
+
+	return &(_this->_public);
+}
+
+void nfapi_vnf_config_destory(nfapi_vnf_config_t* config)
+{
+	free(config);
+}
+
+int nfapi_vnf_start(nfapi_vnf_config_t* config)
+{
+	// Verify that config is not null
+	if(config == 0)
+		return -1;
+
+	// Make sure to set the defined trace function before using NFAPI_TRACE
+	if(config->trace)
+		nfapi_trace_g = (nfapi_trace_fn_t)config->trace;
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
+
+	int p5ListenSock, p5Sock; 
+
+	struct sockaddr_in addr;
+	socklen_t addrSize;
+
+	struct sockaddr_in6 addr6;
+
+	struct sctp_event_subscribe events;
+	struct sctp_initmsg initMsg;
+	int noDelay;
+
+	(void)memset(&addr, 0, sizeof(struct sockaddr_in));
+	(void)memset(&addr6, 0, sizeof(struct sockaddr_in6));
+	(void)memset(&events, 0, sizeof(struct sctp_event_subscribe));
+	(void)memset(&initMsg, 0, sizeof(struct sctp_initmsg));
+
+	vnf_t* vnf = (vnf_t*)(config);
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 VNF connection on port %u\n", config->vnf_p5_port);
+
+	/*
+	char * host = 0;
+	char * port = "4242";
+	struct addrinfo hints;
+	bzero(&hints, sizeof(struct addrinfo));
+	//hints.ai_flags=AI_PASSIVE;
+	//hints.ai_flags=AI_DEFAULT;
+	hints.ai_family=AF_UNSPEC;
+	//hints.ai_family=AF_INET6;
+	hints.ai_socktype=SOCK_STREAM;
+	//hints.ai_protocol=IPPROTO_SCTP
+
+	struct addrinfo *aiHead = 0;
+
+
+
+	int result = getaddrinfo(host, port, &hints, &aiHead);
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "getaddrinfo return %d %d\n", result, errno);
+
+	while(aiHead->ai_next != NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "addr info %d (IP %d UDP %d SCTP %d)\n %d (%d)\n", 
+				aiHead->ai_protocol, IPPROTO_IP, IPPROTO_UDP, IPPROTO_SCTP, 
+				aiHead->ai_flags, AI_PASSIVE);
+
+		char hostBfr[ NI_MAXHOST ];
+		char servBfr[ NI_MAXSERV ];
+
+		getnameinfo(aiHead->ai_addr,
+				aiHead->ai_addrlen,
+				hostBfr,
+				sizeof( hostBfr ),
+				servBfr,
+				sizeof( servBfr ),
+				NI_NUMERICHOST | NI_NUMERICSERV );
+
+		switch(aiHead->ai_family)
+		{
+			case PF_INET:
+				{
+				struct sockaddr_in *pSadrIn = (struct sockaddr_in*) aiHead->ai_addr;
+				printf(
+						"   ai_addr      = sin_family: %d (AF_INET = %d, "
+						"AF_INET6 = %d)\n"
+						"                  sin_addr:   %s\n"
+						"                  sin_port:   %s\n",
+						pSadrIn->sin_family,
+						AF_INET,
+						AF_INET6,
+						hostBfr,
+						servBfr );
+				}
+				break;
+			case PF_INET6:
+				{
+				struct sockaddr_in6 *pSadrIn6 = (struct sockaddr_in6*) aiHead->ai_addr;
+				fprintf( stderr,
+						"   ai_addr      = sin6_family:   %d (AF_INET = %d, "
+						"AF_INET6 = %d) \n"
+						"                  sin6_addr:     %s\n"
+						"                  sin6_port:     %s\n"
+						"                  sin6_flowinfo: %d\n"
+						"                  sin6_scope_id: %d\n",
+						pSadrIn6->sin6_family,
+						AF_INET,
+						AF_INET6,
+						hostBfr,
+						servBfr,
+						pSadrIn6->sin6_flowinfo,
+						pSadrIn6->sin6_scope_id);
+				}
+				break;
+			default:
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "Not ment to be here\n");
+				break;
+		}
+
+		aiHead = aiHead->ai_next;
+	}
+	*/
+
+	{
+		int protocol;
+		int domain;
+
+		if (vnf->sctp)
+			protocol = IPPROTO_SCTP;
+		else
+			protocol = IPPROTO_IP;
+
+		if(config->vnf_ipv6)
+		{
+			domain = PF_INET6;
+		}
+		else
+		{
+			domain = AF_INET;
+		}
+
+		// open the SCTP socket
+		if ((p5ListenSock = socket(domain, SOCK_STREAM, protocol)) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
+			return 0;
+		}
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created... %d\n", p5ListenSock);
+	}
+
+	if (vnf->sctp)
+	{
+		// configure for MSG_NOTIFICATION
+		if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(struct sctp_event_subscribe)) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_EVENTS) errno: %d\n", errno);
+			close(p5ListenSock);
+			return 0;
+		}
+		NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF Setting the SCTP_INITMSG\n");
+		// configure the SCTP socket options
+		initMsg.sinit_num_ostreams = 5; //MAX_SCTP_STREAMS;  // number of output streams can be greater
+		initMsg.sinit_max_instreams = 5; //MAX_SCTP_STREAMS;  // number of output streams can be greater
+		if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno)
+			close(p5ListenSock);
+			return 0;
+		}
+		noDelay = 1;
+		if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_NODELAY, &noDelay, sizeof(noDelay)) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (STCP_NODELAY) errno: %d\n", errno);
+			close(p5ListenSock);
+			return 0;
+		}
+		struct sctp_event_subscribe events;
+		memset( (void *)&events, 0, sizeof(events) );
+  	    events.sctp_data_io_event = 1;
+		
+		if(setsockopt(p5ListenSock, SOL_SCTP, SCTP_EVENTS, (const void *)&events, sizeof(events)) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
+			close(p5ListenSock);
+			return -1;
+		}
+
+	}
+
+
+	if(config->vnf_ipv6)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV6 binding to port %d %d\n", config->vnf_p5_port, p5ListenSock);
+		addr6.sin6_family = AF_INET6;
+		addr6.sin6_port = htons(config->vnf_p5_port);
+		addr6.sin6_addr = in6addr_any;
+
+		// bind to the configured address and port
+		if (bind(p5ListenSock, (struct sockaddr *)&addr6, sizeof(struct sockaddr_in6)) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
+			close(p5ListenSock);
+			return 0;
+		}
+	}
+	else if(config->vnf_ipv4)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV4 binding to port %d\n", config->vnf_p5_port);
+		addr.sin_family = AF_INET;
+		addr.sin_port = htons(config->vnf_p5_port);
+		addr.sin_addr.s_addr = INADDR_ANY;
+
+		// bind to the configured address and port
+		if (bind(p5ListenSock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
+		//if (sctp_bindx(p5ListenSock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), SCTP_BINDX_ADD_ADDR) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
+			close(p5ListenSock);
+			return 0;
+		}
+	}
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "bind succeeded..%d.\n", p5ListenSock);
+
+	// put the socket into listen mode
+	if (listen(p5ListenSock, 2) < 0) 
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "After listen errno: %d\n", errno);
+		close(p5ListenSock);
+		return 0;
+	}
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "listen succeeded...\n");
+
+	struct timeval tv;
+	fd_set read_fd_set;
+
+
+	int p5_idx = 0;
+	while(vnf->terminate == 0)
+	{
+		FD_ZERO(&read_fd_set);
+
+		FD_SET(p5ListenSock, &read_fd_set);
+		int max_fd = p5ListenSock;
+
+		tv.tv_sec = 5;
+		tv.tv_usec = 0;
+
+		nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
+		while(pnf != 0)
+		{
+			if(pnf->connected)
+			{
+				FD_SET(pnf->p5_sock, &read_fd_set);
+				if (pnf->p5_sock > max_fd)
+				{
+					max_fd = pnf->p5_sock;
+				}
+			}
+
+			pnf = pnf->next;
+		}
+
+		int select_result = select(max_fd + 1, &read_fd_set, 0, 0, &tv);
+
+		if(select_result == -1)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "select result %d errno %d\n", select_result, errno);
+			close(p5ListenSock);
+			return 0;
+		}
+		else if(select_result)
+		{
+			if(FD_ISSET(p5ListenSock, &read_fd_set))
+			{
+				addrSize = sizeof(struct sockaddr_in);
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "Accepting connection from PNF...\n");
+
+				p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
+
+				if (p5Sock < 0) 
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to accept PNF connection reason:%d\n", errno);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF connection (fd:%d) accepted from %s:%d \n", p5Sock,  inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
+					nfapi_vnf_pnf_info_t* pnf = (nfapi_vnf_pnf_info_t*)malloc(sizeof(nfapi_vnf_pnf_info_t));
+					NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
+					memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
+					pnf->p5_sock = p5Sock;
+					pnf->p5_idx = p5_idx++;
+					pnf->p5_pnf_sockaddr = addr;
+					pnf->connected = 1;
+
+					nfapi_vnf_pnf_list_add(config, pnf);
+
+					// Inform mac that a pnf connection has been established
+					// todo : allow mac to 'accept' the connection. i.e. to
+					// reject it.
+					if(config->pnf_connection_indication != 0)
+					{
+						(config->pnf_connection_indication)(config, pnf->p5_idx);
+					}
+
+					
+					// check the connection status
+					{
+						struct sctp_status status;
+						(void)memset(&status, 0, sizeof(struct sctp_status));
+						socklen_t optLen = (socklen_t) sizeof(struct sctp_status);
+						if (getsockopt(p5Sock, IPPROTO_SCTP, SCTP_STATUS, &status, &optLen) < 0)
+						{
+							NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
+							return -1;
+						}
+						else
+						{
+							NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Association ID = %d\n", status.sstat_assoc_id);
+							NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Receiver window size = %d\n", status.sstat_rwnd);
+							NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF In Streams = %d\n",  status.sstat_instrms);
+							NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Out Streams = %d\n", status.sstat_outstrms);
+
+						}
+					}
+				}
+			}
+			else
+			{
+				uint8_t delete_pnfs = 0;
+
+				nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
+				while(pnf != 0)
+				{
+					if(FD_ISSET(pnf->p5_sock, &read_fd_set))
+					{
+						if(vnf_read_dispatch_message(config, pnf) == 0)
+						{
+							if(config->pnf_disconnect_indication != 0)
+							{
+								(config->pnf_disconnect_indication)(config, pnf->p5_idx);
+							}
+
+							close(pnf->p5_sock);
+
+							pnf->to_delete = 1;
+							delete_pnfs = 1;
+						}
+					}
+			
+					pnf = pnf->next;
+				}
+
+				if(delete_pnfs)
+				{
+					nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
+					nfapi_vnf_pnf_info_t* prev = 0;
+					while(pnf != 0)
+					{
+						nfapi_vnf_pnf_info_t* curr = pnf;
+
+						if(pnf->to_delete == 1)
+						{
+							if(prev == 0)
+							{
+								config->pnf_list = pnf->next;
+							}
+							else
+							{
+								prev->next = pnf->next;
+							}
+
+							pnf = pnf->next;
+
+							free(curr);
+						}
+						else
+						{
+							prev = pnf;
+							pnf = pnf->next;
+						}
+
+					}
+					
+				}
+			}
+
+			continue;
+		}
+		else
+		{
+			// timeout
+			
+			// Should we test for socket closure here every second?
+
+			continue;
+		}
+	}
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Sock socket's\n");
+	{
+		nfapi_vnf_pnf_info_t* curr = config->pnf_list;
+		while(curr != NULL)
+		{
+			if(config->pnf_disconnect_indication)
+			{
+				(config->pnf_disconnect_indication)(config, curr->p5_idx);
+			}
+
+			close(curr->p5_sock);
+			curr = curr->next;
+		}
+	}
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Listen socket\n");
+	close(p5ListenSock);
+		
+	return 0;
+
+}
+
+int nfapi_vnf_stop(nfapi_vnf_config_t* config)
+{
+	// Verify that config is not null
+	if(config == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+	_this->terminate = 1;
+	return 0;
+}
+
+int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_param_request_t));
+}
+
+int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_config_request_t));
+}
+
+int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_start_request_t));
+}
+
+int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_stop_request_t));
+}
+
+int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_param_request_t));
+}
+int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	nfapi_vnf_phy_info_t* phy = nfapi_vnf_phy_info_list_find(config, req->header.phy_id);
+
+	if(phy == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_WARN, "%s failed to find phy inforation phy_id:%d\n", __FUNCTION__, req->header.phy_id);
+		return -1;
+	}
+
+	// set the timing parameters
+	req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
+	req->nfapi_config.timing_window.value = phy->timing_window;
+	req->num_tlv++;
+
+	req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG;
+	req->nfapi_config.timing_info_mode.value = phy->timing_info_mode;
+	req->num_tlv++;
+
+	req->nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG;
+	req->nfapi_config.timing_info_period.value = phy->timing_info_period;
+	req->num_tlv++;
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_config_request_t));
+}
+int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_start_request_t));
+}
+int nfapi_vnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_stop_request_t));
+}
+int nfapi_vnf_measurement_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_measurement_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_measurement_request_t));
+}
+int nfapi_vnf_rssi_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_rssi_request_t));
+}
+int nfapi_vnf_cell_search_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_cell_search_request_t));
+}
+int nfapi_vnf_broadcast_detect_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_broadcast_detect_request_t));
+}
+int nfapi_vnf_system_information_schedule_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_system_information_schedule_request_t));
+}
+int nfapi_vnf_system_information_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_system_information_request_t));
+}
+int nfapi_vnf_nmm_stop_request(nfapi_vnf_config_t* config, int p5_idx, nfapi_nmm_stop_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p4_message(_this, p5_idx, &req->header, sizeof(nfapi_nmm_stop_request_t));
+}
+int nfapi_vnf_vendor_extension(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg)
+{
+	if(config == 0 || msg == 0)
+		return -1;
+
+	vnf_t* _this = (vnf_t*)(config);
+
+	return vnf_pack_and_send_p5_message(_this, p5_idx, msg, sizeof(nfapi_p4_p5_message_header_t));
+}
+
+int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy_id)
+{
+	vnf_t* vnf = (vnf_t*)config;
+
+	nfapi_vnf_phy_info_t* info = (nfapi_vnf_phy_info_t*)calloc(1, sizeof(nfapi_vnf_phy_info_t));
+	info->p5_idx = p5_idx;
+	info->phy_id = vnf->next_phy_id++;
+
+	info->timing_window = 30;       // This seems to override what gets set by the user - why???
+	info->timing_info_mode = 0x03;
+	info->timing_info_period = 128;
+
+	nfapi_vnf_phy_info_list_add(config, info);
+
+	(*phy_id) = info->phy_id;
+
+	return 0;
+}
diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c
new file mode 100644
index 0000000000000000000000000000000000000000..13041767522935fb74a90cfe9748517d303588dd
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c
@@ -0,0 +1,1599 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <time.h>
+
+#include <sys/time.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "vnf_p7.h"
+
+#define SYNC_CYCLE_COUNT 2
+
+void* vnf_p7_malloc(vnf_p7_t* vnf_p7, size_t size)
+{
+	if(vnf_p7->_public.malloc)
+	{
+		return (vnf_p7->_public.malloc)(size);
+	}
+	else
+	{
+		return calloc(1, size); 
+	}
+}
+void vnf_p7_free(vnf_p7_t* vnf_p7, void* ptr)
+{
+	if(ptr == 0)
+		return;
+
+	if(vnf_p7->_public.free)
+	{
+		(vnf_p7->_public.free)(ptr);
+	}
+	else
+	{
+		free(ptr); 
+	}
+}
+
+void vnf_p7_codec_free(vnf_p7_t* vnf_p7, void* ptr)
+{
+	if(ptr == 0)
+		return;
+
+	if(vnf_p7->_public.codec_config.deallocate)
+	{
+		(vnf_p7->_public.codec_config.deallocate)(ptr);
+	}
+	else
+	{
+		free(ptr); 
+	}
+}
+
+void vnf_p7_connection_info_list_add(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* node)
+{
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
+	// todo : add mutex
+	node->next = vnf_p7->p7_connections; 
+	vnf_p7->p7_connections = node;
+}
+
+nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_find(vnf_p7_t* vnf_p7, uint16_t phy_id)
+{
+	nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
+	while(curr != 0)
+	{
+		if(curr->phy_id == phy_id)
+		{
+			return curr;
+		}
+		curr = curr->next;
+	}
+
+	return 0;
+}
+
+nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_delete(vnf_p7_t* vnf_p7, uint16_t phy_id)
+{
+	nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
+	nfapi_vnf_p7_connection_info_t* prev = 0;
+
+	while(curr != 0)
+	{
+		if(curr->phy_id == phy_id)
+		{
+			if(prev == 0)
+			{
+				vnf_p7->p7_connections = curr->next;
+			}
+			else
+			{
+				prev->next = curr->next;
+			}
+
+			return curr;
+		}
+		else
+		{
+			prev = curr;
+			curr = curr->next;
+		}
+	}
+
+	return 0;
+}
+
+vnf_p7_rx_message_t* vnf_p7_rx_reassembly_queue_add_segment(vnf_p7_t* vnf_p7, vnf_p7_rx_reassembly_queue_t* queue, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len)
+{
+	vnf_p7_rx_message_t* msg = 0;
+	// attempt to find a entry for this segment
+	vnf_p7_rx_message_t* iterator = queue->msg_queue;
+	while(iterator != 0)
+	{
+		if(iterator->sequence_number == sequence_number)
+		{
+			msg = iterator;
+			break;
+		}
+
+		iterator = iterator->next;
+	}
+	
+	// if found then copy data to message
+	if(msg != 0)
+	{
+	
+		msg->segments[segment_number].buffer = (uint8_t*)vnf_p7_malloc(vnf_p7, data_len);
+		memcpy(msg->segments[segment_number].buffer, data, data_len);
+		msg->segments[segment_number].length = data_len;
+
+		msg->num_segments_received++;
+
+		// set the segement number if we have the last segment
+		if(m == 0)
+			msg->num_segments_expected = segment_number + 1;
+	}
+	// else add new rx message entry
+	else
+	{
+		// create a new message
+		msg = (vnf_p7_rx_message_t*)(vnf_p7_malloc(vnf_p7, sizeof(vnf_p7_rx_message_t)));
+		memset(msg, 0, sizeof(vnf_p7_rx_message_t));
+
+		msg->sequence_number = sequence_number;
+		msg->num_segments_expected = m ? 255 : segment_number + 1;
+		msg->num_segments_received = 1;
+		msg->rx_hr_time = vnf_get_current_time_hr();
+
+		msg->segments[segment_number].buffer = (uint8_t*)vnf_p7_malloc(vnf_p7, data_len);
+		memcpy(msg->segments[segment_number].buffer, data, data_len);
+		msg->segments[segment_number].length = data_len;
+
+		// place the message at the head of the queue
+		msg->next = queue->msg_queue;
+		queue->msg_queue = msg;
+	}
+
+	return msg;
+}
+
+void vnf_p7_rx_reassembly_queue_remove_msg(vnf_p7_t* vnf_p7, vnf_p7_rx_reassembly_queue_t* queue, vnf_p7_rx_message_t* msg)
+{
+	// remove message if it has the same sequence number
+	vnf_p7_rx_message_t* iterator = queue->msg_queue;
+	vnf_p7_rx_message_t* previous = 0;
+
+	while(iterator != 0)
+	{
+		if(iterator->sequence_number == msg->sequence_number)
+		{
+			if(previous == 0)
+			{
+				queue->msg_queue = iterator->next;
+			}
+			else
+			{
+				previous->next = iterator->next;
+			}
+
+			//NFAPI_TRACE(NFAPI_TRACE_INFO, "Deleting reassembly message\n");
+			// delete the message
+			uint16_t i;
+			for(i = 0; i < 128; ++i)
+			{
+				if(iterator->segments[i].buffer)
+					vnf_p7_free(vnf_p7, iterator->segments[i].buffer);
+			}
+			vnf_p7_free(vnf_p7, iterator);
+
+			break;
+		}
+
+		previous = iterator;
+		iterator = iterator->next;
+	}
+}
+
+void vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7_t* vnf_p7, vnf_p7_rx_reassembly_queue_t* queue, uint32_t delta)
+{
+	// remove all messages that are too old
+	vnf_p7_rx_message_t* iterator = queue->msg_queue;
+	vnf_p7_rx_message_t* previous = 0;
+
+	uint32_t rx_hr_time = vnf_get_current_time_hr();
+
+	while(iterator != 0)
+	{
+		if(rx_hr_time - iterator->rx_hr_time > delta)
+		{
+			if(previous == 0)
+			{
+				queue->msg_queue = iterator->next;
+			}
+			else
+			{
+				previous->next = iterator->next;
+			}
+			
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "Deleting stale reassembly message (%u %u %d)\n", iterator->rx_hr_time, rx_hr_time, delta);
+
+			vnf_p7_rx_message_t* to_delete = iterator;
+			iterator = iterator->next;
+
+			// delete the message
+			uint16_t i;
+			for(i = 0; i < 128; ++i)
+			{
+				if(to_delete->segments[i].buffer)
+					vnf_p7_free(vnf_p7, to_delete->segments[i].buffer);
+			}
+			vnf_p7_free(vnf_p7, to_delete);
+
+		}
+		else
+		{
+			previous = iterator;
+			iterator = iterator->next;
+		}
+	}
+}
+
+uint32_t vnf_get_current_time_hr()
+{
+	struct timeval now;
+	(void)gettimeofday(&now, NULL);
+	uint32_t time_hr = TIME2TIMEHR(now);
+	return time_hr;
+}
+
+uint16_t increment_sfn_sf(uint16_t sfn_sf)
+{
+	if((sfn_sf & 0xF) == 9)
+	{
+		sfn_sf += 0x0010;
+		sfn_sf &= 0x3FF0;
+	}
+	else if((sfn_sf & 0xF) > 9)
+	{
+		// error should not happen
+	}
+	else
+	{
+		sfn_sf++;
+	}
+
+	return sfn_sf;
+}
+
+struct timespec timespec_delta(struct timespec start, struct timespec end)
+{
+	struct timespec temp;
+	if ((end.tv_nsec-start.tv_nsec)<0) 
+	{
+		temp.tv_sec = end.tv_sec-start.tv_sec-1;
+		temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
+	} 
+	else 
+	{
+		temp.tv_sec = end.tv_sec-start.tv_sec;
+		temp.tv_nsec = end.tv_nsec-start.tv_nsec;
+	}
+	return temp;
+}
+
+static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
+{
+	if(now_hr < sf_start_hr)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier that start of subframe\n");
+		return 0;
+	}
+	else
+	{
+		uint32_t now_us = TIMEHR_USEC(now_hr);
+		uint32_t sf_start_us = TIMEHR_USEC(sf_start_hr);
+
+		// if the us have wrapped adjust for it
+		if(now_hr < sf_start_us)
+		{
+			now_us += 1000000;
+		}
+
+		return now_us - sf_start_us;
+	}
+}
+
+uint32_t calculate_t1(uint16_t sfn_sf, uint32_t sf_start_time_hr)
+{
+	uint32_t now_time_hr = vnf_get_current_time_hr();
+
+	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+
+	uint32_t t1 = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us;
+
+	return t1;
+}
+
+
+uint32_t calculate_t4(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_time_hr)
+{
+	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+
+	uint32_t t4 = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us;
+
+	return t4;
+
+}
+
+
+uint32_t calculate_transmit_timestamp(uint16_t sfn_sf, uint32_t sf_start_time_hr)
+{
+	uint32_t now_time_hr = vnf_get_current_time_hr();
+
+	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+
+	uint32_t tt = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us;
+
+	return tt;
+}
+
+
+uint16_t increment_sfn_sf_by(uint16_t sfn_sf, uint8_t increment)
+{
+	while(increment > 0)
+	{
+		sfn_sf = increment_sfn_sf(sfn_sf);
+		--increment;
+	}
+
+	return sfn_sf;
+}
+
+
+int send_mac_subframe_indications(vnf_p7_t* vnf_p7)
+{
+	nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
+	while(curr != 0)
+	{
+		if(curr->in_sync == 1)
+		{
+			// ask for subframes in the future
+			uint16_t sfn_sf_adv = increment_sfn_sf_by(curr->sfn_sf, 2);
+
+			vnf_p7->_public.subframe_indication(&(vnf_p7->_public), curr->phy_id, sfn_sf_adv);
+		}
+
+		curr = curr->next;
+	}
+
+	return 0;
+}
+
+int vnf_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info, uint8_t* msg, const uint32_t len)
+{
+	int sendto_result = sendto(vnf_p7->socket, msg, len, 0, (struct sockaddr*)&(p7_info->remote_addr), sizeof(p7_info->remote_addr)); 
+
+	if(sendto_result != len)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sendto_result %d %d\n", __FUNCTION__, sendto_result, errno);
+	}
+
+	return 0;
+}
+
+int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header)
+{
+
+	nfapi_vnf_p7_connection_info_t* p7_connection = vnf_p7_connection_info_list_find(vnf_p7, header->phy_id);
+	if(p7_connection)
+	{
+		int send_result = 0;
+		uint8_t  buffer[1024 * 32];
+
+		header->m_segment_sequence = NFAPI_P7_SET_MSS(0, 0, p7_connection->sequence_number);
+		
+		int len = nfapi_p7_message_pack(header, buffer, sizeof(buffer), &vnf_p7->_public.codec_config);
+		
+                //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n", __FUNCTION__, header->phy_id, len, vnf_p7->_public.segment_size);
+
+		if(len < 0) 
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() failed to pack p7 message phy_id:%d\n", __FUNCTION__, header->phy_id);
+			return -1;
+		}
+
+		if(len > vnf_p7->_public.segment_size)
+		{
+			// todo : consider replacing with the sendmmsg call
+			// todo : worry about blocking writes?
+		
+			// segmenting the transmit
+			int msg_body_len = len - NFAPI_P7_HEADER_LENGTH ; 
+			int seg_body_len = vnf_p7->_public.segment_size - NFAPI_P7_HEADER_LENGTH ; 
+			int segment_count = (msg_body_len / (seg_body_len)) + ((msg_body_len % seg_body_len) ? 1 : 0); 
+				
+			int segment = 0;
+			int offset = NFAPI_P7_HEADER_LENGTH;
+			uint8_t tx_buffer[vnf_p7->_public.segment_size];
+                        NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() MORE THAN ONE SEGMENT phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n", __FUNCTION__, header->phy_id, len, vnf_p7->_public.segment_size);
+			for(segment = 0; segment < segment_count; ++segment)
+			{
+				uint8_t last = 0;
+				uint16_t size = vnf_p7->_public.segment_size - NFAPI_P7_HEADER_LENGTH;
+				if(segment + 1 == segment_count)
+				{
+					last = 1;
+					size = (msg_body_len) - (seg_body_len * segment);
+				}
+
+				uint16_t segment_size = size + NFAPI_P7_HEADER_LENGTH;
+
+				// Update the header with the m and segement 
+				memcpy(&tx_buffer[0], buffer, NFAPI_P7_HEADER_LENGTH);
+
+				// set the segment length
+				tx_buffer[4] = (segment_size & 0xFF00) >> 8;
+				tx_buffer[5] = (segment_size & 0xFF);
+
+				// set the m & segment number
+				tx_buffer[6] = ((!last) << 7) + segment;
+
+				memcpy(&tx_buffer[NFAPI_P7_HEADER_LENGTH], &buffer[0] + offset, size);
+				offset += size;
+
+				if(vnf_p7->_public.checksum_enabled)
+				{
+					nfapi_p7_update_checksum(tx_buffer, segment_size);
+				}
+			
+				nfapi_p7_update_transmit_timestamp(buffer, calculate_transmit_timestamp(p7_connection->sfn_sf, vnf_p7->sf_start_time_hr));	
+
+				send_result = vnf_send_p7_msg(vnf_p7, p7_connection,  &tx_buffer[0], segment_size);
+			}
+		}
+		else
+		{
+			if(vnf_p7->_public.checksum_enabled)
+			{
+				nfapi_p7_update_checksum(buffer, len);
+			}
+
+			nfapi_p7_update_transmit_timestamp(buffer, calculate_transmit_timestamp(p7_connection->sfn_sf, vnf_p7->sf_start_time_hr));	
+
+			// simple case that the message fits in a single segement
+			send_result = vnf_send_p7_msg(vnf_p7, p7_connection, &buffer[0], len);
+		}
+
+		p7_connection->sequence_number++;
+
+		return send_result;
+	}
+	else
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find p7 connection info for phy_id:%d\n", __FUNCTION__, header->phy_id);
+		return -1;
+	}
+}
+
+int vnf_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info)
+{
+	nfapi_dl_node_sync_t dl_node_sync;
+	memset(&dl_node_sync, 0, sizeof(dl_node_sync));
+
+	dl_node_sync.header.phy_id = p7_info->phy_id;
+	dl_node_sync.header.message_id = NFAPI_DL_NODE_SYNC;
+	dl_node_sync.t1 = calculate_t1(p7_info->sfn_sf, vnf_p7->sf_start_time_hr);
+	dl_node_sync.delta_sfn_sf = 0;
+
+	return vnf_p7_pack_and_send_p7_msg(vnf_p7, &dl_node_sync.header);	
+}
+
+int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info)
+{
+
+	if(p7_info->in_sync == 1)
+	{
+		uint16_t dl_sync_period_mask = p7_info->dl_in_sync_period-1;
+		uint16_t sfn_sf_dec = NFAPI_SFNSF2DEC(p7_info->sfn_sf);
+
+		if ((((sfn_sf_dec + p7_info->dl_in_sync_offset) % NFAPI_MAX_SFNSFDEC) & dl_sync_period_mask) == 0)
+		{
+			vnf_build_send_dl_node_sync(vnf_p7, p7_info);
+		}
+	}
+	else
+	{
+		uint16_t dl_sync_period_mask = p7_info->dl_out_sync_period-1;
+		uint16_t sfn_sf_dec = NFAPI_SFNSF2DEC(p7_info->sfn_sf);
+
+		if ((((sfn_sf_dec + p7_info->dl_out_sync_offset) % NFAPI_MAX_SFNSFDEC) & dl_sync_period_mask) == 0)
+		{
+			vnf_build_send_dl_node_sync(vnf_p7, p7_info);
+		}
+	}
+	return 0;
+}
+
+
+void vnf_handle_harq_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_harq_indication_t ind;
+	
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.harq_indication)
+			{
+				(vnf_p7->_public.harq_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.harq_indication_body.harq_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
+	}
+}
+
+void vnf_handle_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_crc_indication_t ind;
+	
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.crc_indication)
+			{
+				(vnf_p7->_public.crc_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.crc_indication_body.crc_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
+	}
+}
+
+void vnf_handle_rx_ulsch_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_rx_indication_t ind;
+	
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.rx_indication)
+			{
+				(vnf_p7->_public.rx_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+
+		uint16_t i = 0;
+		for(i = 0; i < ind.rx_indication_body.number_of_pdus; ++i)
+		{
+			vnf_p7_codec_free(vnf_p7, ind.rx_indication_body.rx_pdu_list[i].data);
+		}
+		vnf_p7_codec_free(vnf_p7, ind.rx_indication_body.rx_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
+	}
+
+}
+
+void vnf_handle_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_rach_indication_t ind;
+	
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.rach_indication)
+			{
+				(vnf_p7->_public.rach_indication)(&vnf_p7->_public, &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.rach_indication_body.preamble_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
+
+	}
+}
+
+void vnf_handle_srs_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_srs_indication_t ind;
+
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.srs_indication)
+			{
+				(vnf_p7->_public.srs_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.srs_indication_body.srs_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);	
+	}
+}
+
+void vnf_handle_rx_sr_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_sr_indication_t ind;
+	
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.sr_indication)
+			{
+				(vnf_p7->_public.sr_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.sr_indication_body.sr_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);	
+	}
+}
+void vnf_handle_rx_cqi_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_cqi_indication_t ind;
+	
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.cqi_indication)
+			{
+				(vnf_p7->_public.cqi_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.cqi_indication_body.cqi_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.cqi_indication_body.cqi_raw_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);	
+		
+	}
+
+}
+
+void vnf_handle_lbt_dl_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_lbt_dl_indication_t ind;
+
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.lbt_dl_indication)
+			{
+				(vnf_p7->_public.lbt_dl_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.lbt_dl_indication_body.lbt_indication_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
+	}
+}
+
+void vnf_handle_nb_harq_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_nb_harq_indication_t ind;
+	
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.nb_harq_indication)
+			{
+				(vnf_p7->_public.nb_harq_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.nb_harq_indication_body.nb_harq_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
+	}
+}
+
+void vnf_handle_nrach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	// ensure it's valid
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else
+	{
+		nfapi_nrach_indication_t ind;
+	
+		if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
+		}
+		else
+		{
+			if(vnf_p7->_public.nrach_indication)
+			{
+				(vnf_p7->_public.nrach_indication)(&(vnf_p7->_public), &ind);
+			}
+		}
+	
+		vnf_p7_codec_free(vnf_p7, ind.nrach_indication_body.nrach_pdu_list);
+		vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
+	}
+}
+
+void vnf_handle_p7_vendor_extension(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7, uint16_t message_id)
+{
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
+	}
+	else if(vnf_p7->_public.allocate_p7_vendor_ext)
+	{
+		uint16_t msg_size;
+		nfapi_p7_message_header_t* msg = vnf_p7->_public.allocate_p7_vendor_ext(message_id, &msg_size);
+
+		if(msg == 0)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n", __FUNCTION__);
+			return;
+		}
+
+		int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &vnf_p7->_public.codec_config);
+
+		if(unpack_result == 0)
+		{
+			if(vnf_p7->_public.vendor_ext)
+				vnf_p7->_public.vendor_ext(&(vnf_p7->_public), msg);
+		}
+		
+		if(vnf_p7->_public.deallocate_p7_vendor_ext)
+			vnf_p7->_public.deallocate_p7_vendor_ext(msg);
+		
+	}
+}
+
+
+void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	uint32_t now_time_hr = vnf_get_current_time_hr();
+
+	if (pRecvMsg == NULL || vnf_p7  == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_ul_node_sync: NULL parameters\n");
+		return;
+	}
+
+	nfapi_ul_node_sync_t ind;
+	if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(nfapi_ul_node_sync_t), &vnf_p7->_public.codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack ul_node_sync\n");
+		return;
+	}
+
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "Received UL_NODE_SYNC phy_id:%d t1:%d t2:%d t3:%d\n", ind.header.phy_id, ind.t1, ind.t2, ind.t3);
+
+	nfapi_vnf_p7_connection_info_t* phy = vnf_p7_connection_info_list_find(vnf_p7, ind.header.phy_id);
+	uint32_t t4 = calculate_t4(now_time_hr, phy->sfn_sf, vnf_p7->sf_start_time_hr);
+
+	uint32_t tx_2_rx = t4>ind.t1 ? t4 - ind.t1 : t4 + NFAPI_MAX_SFNSFDEC - ind.t1 ;
+	uint32_t pnf_proc_time = ind.t3 - ind.t2;
+
+	// divide by 2 using shift operator
+	uint32_t latency =  (tx_2_rx - pnf_proc_time) >> 1;
+
+	if(!(phy->filtered_adjust))
+	{
+		phy->latency[phy->min_sync_cycle_count] = latency;
+
+		NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) PNF to VNF !sync phy_id:%d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d\n",
+				NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id, ind.t1, ind.t2, ind.t3, t4, 
+				tx_2_rx, pnf_proc_time, latency);
+	}
+	else
+	{
+		phy->latency[phy->min_sync_cycle_count] = latency;
+
+		//if(phy->min_sync_cycle_count != SYNC_CYCLE_COUNT)
+		{
+			if (ind.t2 < phy->previous_t2 && ind.t1 > phy->previous_t1)
+			{
+				// Only t2 wrap has occurred!!!
+				phy->sf_offset = (NFAPI_MAX_SFNSFDEC + ind.t2) - ind.t1 - latency;
+			}
+			else if (ind.t2 > phy->previous_t2 && ind.t1 < phy->previous_t1)
+			{
+				// Only t1 wrap has occurred
+				phy->sf_offset = ind.t2 - ( ind.t1 + NFAPI_MAX_SFNSFDEC) - latency;
+			}
+			else
+			{
+				// Either no wrap or both have wrapped
+				phy->sf_offset = ind.t2 - ind.t1 - latency;
+			}
+
+			if (phy->sf_offset_filtered == 0)
+			{
+				phy->sf_offset_filtered = phy->sf_offset;
+			}
+			else
+			{
+				int32_t oldFilteredValueShifted = phy->sf_offset_filtered << 5;
+				int32_t newOffsetShifted = phy->sf_offset << 5;
+
+				// 1/8 of new and 7/8 of old
+				phy->sf_offset_filtered = ((newOffsetShifted >> 3) + ((oldFilteredValueShifted * 7) >> 3)) >> 5;
+			}
+		}
+
+		if(1)
+		{
+                  struct timespec ts;
+                  clock_gettime(CLOCK_MONOTONIC, &ts);
+
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n", 
+					NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
+					ind.t1, ind.t2, ind.t3, t4, 
+					tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->sf_offset, phy->sf_offset_filtered,
+					(ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
+		}
+
+	}
+
+        if (phy->filtered_adjust && (phy->sf_offset_filtered > 1e6 || phy->sf_offset_filtered < -1e6))
+        {
+          phy->filtered_adjust = 0;
+          phy->zero_count=0;
+          phy->min_sync_cycle_count = 2;
+          phy->in_sync = 0;
+          NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s - ADJUST TOO BAD - go out of filtered phy->sf_offset_filtered:%d\n", __FUNCTION__, phy->sf_offset_filtered);
+        }
+
+	if(phy->min_sync_cycle_count)
+		phy->min_sync_cycle_count--;
+
+	if(phy->min_sync_cycle_count == 0)
+	{
+		uint32_t curr_sfn_sf = phy->sfn_sf;
+		int32_t sfn_sf_dec = NFAPI_SFNSF2DEC(phy->sfn_sf);
+
+		if(!phy->filtered_adjust)
+		{
+			int i = 0;
+			//phy->average_latency = 0;
+			for(i = 0; i < SYNC_CYCLE_COUNT; ++i)
+			{
+				phy->average_latency += phy->latency[i];
+
+			}
+			phy->average_latency /= SYNC_CYCLE_COUNT;
+
+			phy->sf_offset = ind.t2 - (ind.t1 - phy->average_latency);
+
+			sfn_sf_dec += (phy->sf_offset / 1000);
+		}
+		else
+		{
+			sfn_sf_dec += ((phy->sf_offset_filtered + 500) / 1000);	//Round up go from microsecond to subframe(1ms)
+		}
+
+		if(sfn_sf_dec < 0)
+		{
+			sfn_sf_dec += NFAPI_MAX_SFNSFDEC;
+		}
+		else if( sfn_sf_dec >= NFAPI_MAX_SFNSFDEC)
+		{
+			sfn_sf_dec -= NFAPI_MAX_SFNSFDEC;
+		}
+
+		uint16_t new_sfn_sf = NFAPI_SFNSFDEC2SFNSF(sfn_sf_dec);
+
+
+		{
+			phy->adjustment = NFAPI_SFNSF2DEC(new_sfn_sf) - NFAPI_SFNSF2DEC(curr_sfn_sf);
+
+			NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d phy->previous_sf_offset_filtered:%d phy->previous_sf_offset_filtered:%d phy->sf_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_sf_offset_filtered, phy->previous_sf_offset_filtered, phy->sf_offset_trend);
+
+			phy->previous_t1 = 0;
+			phy->previous_t2 = 0;
+
+			if(phy->previous_sf_offset_filtered > 0)
+			{
+				if( phy->sf_offset_filtered > phy->previous_sf_offset_filtered)
+				{
+					// pnf is getting futher ahead of vnf
+					//phy->sf_offset_trend = phy->sf_offset_filtered - phy->previous_sf_offset_filtered;
+					phy->sf_offset_trend = (phy->sf_offset_filtered + phy->previous_sf_offset_filtered)/2;
+				}
+				else
+				{
+					// pnf is getting back in sync
+				}
+			}
+			else if(phy->previous_sf_offset_filtered < 0)
+			{
+				if(phy->sf_offset_filtered < phy->previous_sf_offset_filtered)
+				{
+					// vnf is getting future ahead of pnf
+					//phy->sf_offset_trend = -(phy->sf_offset_filtered - phy->previous_sf_offset_filtered);
+					phy->sf_offset_trend = (-(phy->sf_offset_filtered + phy->previous_sf_offset_filtered)) /2;
+				}
+				else
+				{
+					//  vnf is getting back in sync
+				}
+			}
+
+			
+			int insync_minor_adjustment_1 = phy->sf_offset_trend / 6;
+			int insync_minor_adjustment_2 = phy->sf_offset_trend / 2;
+
+
+			if(insync_minor_adjustment_1 == 0)
+				insync_minor_adjustment_1 = 2;
+
+			if(insync_minor_adjustment_2 == 0)
+				insync_minor_adjustment_2 = 10;
+
+			if(!phy->filtered_adjust)
+			{
+				if(phy->adjustment < 10)
+				{
+					phy->zero_count++;
+
+					if(phy->zero_count >= 10)
+					{
+						phy->filtered_adjust = 1;
+						phy->zero_count = 0;
+
+						NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF SFN/SF switching to filtered mode\n");
+					}
+				}
+				else
+				{
+					phy->zero_count = 0;
+				}
+			}
+			else
+			{
+				// Fine level of adjustment
+				if (phy->adjustment == 0)
+				{
+					if (phy->zero_count >= 10)
+					{
+						if(phy->in_sync == 0)
+						{
+							NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id); 
+
+							if(vnf_p7->_public.sync_indication)
+								(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1);
+						}
+
+						phy->in_sync = 1;
+					}
+					else
+					{
+						phy->zero_count++;
+					}
+
+					if(phy->in_sync)
+					{
+						// in sync
+						if(phy->sf_offset_filtered > 250)
+						{
+							// VNF is slow
+							phy->insync_minor_adjustment = insync_minor_adjustment_1; //25;
+							phy->insync_minor_adjustment_duration = ((phy->sf_offset_filtered) / insync_minor_adjustment_1);
+						}
+						else if(phy->sf_offset_filtered < -250)
+						{
+							// VNF is fast
+							phy->insync_minor_adjustment = -(insync_minor_adjustment_1); //25;
+							phy->insync_minor_adjustment_duration = (((phy->sf_offset_filtered) / -(insync_minor_adjustment_1)));
+						}
+						else
+						{
+							phy->insync_minor_adjustment = 0;
+						}
+
+						if(phy->insync_minor_adjustment != 0)
+						{
+							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (sf_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adjustment:%d\n", 
+										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
+										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, 
+                                                                                phy->sf_offset_filtered, 
+                                                                                insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend,
+                                                                                NFAPI_SFNSF2DEC(new_sfn_sf),
+                                                                                NFAPI_SFNSF2DEC(curr_sfn_sf),
+                                                                                phy->adjustment); 
+						}
+					}
+				}
+				else
+				{
+					if (phy->in_sync)
+					{
+						if(phy->adjustment == 0)
+						{
+						}
+						else if(phy->adjustment > 0)
+						{
+							// VNF is slow
+							//if(phy->adjustment == 1)
+							{
+								//
+								if(phy->sf_offset_filtered > 250)
+								{
+									// VNF is slow
+									phy->insync_minor_adjustment = insync_minor_adjustment_2;
+									phy->insync_minor_adjustment_duration = 2 * ((phy->sf_offset_filtered - 250) / insync_minor_adjustment_2);
+								}
+								else if(phy->sf_offset_filtered < -250)
+								{
+									// VNF is fast
+									phy->insync_minor_adjustment = -(insync_minor_adjustment_2);
+									phy->insync_minor_adjustment_duration = 2 * ((phy->sf_offset_filtered + 250) / -(insync_minor_adjustment_2));
+								}
+							
+							}
+							//else
+							{
+								// out of sync?
+							}
+							
+							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (adjustment:%d sf_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adj:%d\n", 
+										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
+										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->sf_offset_filtered,
+										insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend,
+                                                                                NFAPI_SFNSF2DEC(new_sfn_sf),
+                                                                                NFAPI_SFNSF2DEC(curr_sfn_sf),
+                                                                                phy->adjustment); 
+							
+						}
+						else if(phy->adjustment < 0)
+						{
+							// VNF is fast
+							//if(phy->adjustment == -1)
+							{
+								//
+								if(phy->sf_offset_filtered > 250)
+								{
+									// VNF is slow
+									phy->insync_minor_adjustment = insync_minor_adjustment_2;
+									phy->insync_minor_adjustment_duration = 2 * ((phy->sf_offset_filtered - 250) / insync_minor_adjustment_2);
+								}
+								else if(phy->sf_offset_filtered < -250)
+								{
+									// VNF is fast
+									phy->insync_minor_adjustment = -(insync_minor_adjustment_2);
+									phy->insync_minor_adjustment_duration = 2 * ((phy->sf_offset_filtered + 250) / -(insync_minor_adjustment_2));
+								}
+							}
+							//else
+							{
+								// out of sync?
+							}
+
+							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (adjustment:%d sf_offset_filtered:%d) %d %d %d\n", 
+										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
+										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->sf_offset_filtered,
+										insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend); 
+						}
+
+						/*
+						if (phy->adjustment > 10 || phy->adjustment < -10)
+						{
+							phy->zero_count++;		// Add one to the getting out of sync counter
+						}
+						else
+						{
+							phy->zero_count = 0;		// Small error - zero the out of sync counter
+						}
+
+						if (phy->zero_count >= 10)	// If we have had 10 consecutive large errors - drop out of sync
+						{
+							NFAPI_TRACE(NFAPI_TRACE_NOTE, "we have fallen out of sync...\n");
+							//pP7SockInfo->syncAchieved = 0;
+						}
+						*/
+					}
+				}
+			}
+
+
+			if(phy->in_sync == 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", 
+					ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"),
+					NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, 
+					phy->filtered_adjust ? "FILTERED" : "ABSOLUTE",
+					phy->zero_count,
+					phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");
+
+				phy->sfn_sf = new_sfn_sf;
+			}
+		}
+
+		// reset for next cycle
+		phy->previous_sf_offset_filtered = phy->sf_offset_filtered;
+		phy->min_sync_cycle_count = 2;
+		phy->sf_offset_filtered = 0;
+		phy->sf_offset = 0;
+	}
+	else
+	{
+		phy->previous_t1 = ind.t1;
+		phy->previous_t2 = ind.t2;
+	}
+}
+
+void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	if (pRecvMsg == NULL || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_timing_info: NULL parameters\n");
+		return;
+	}
+
+	nfapi_timing_info_t ind;
+	if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(nfapi_timing_info_t), &vnf_p7->_public.codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack timing_info\n");
+		return;
+	}
+
+        if (vnf_p7 && vnf_p7->p7_connections)
+        {
+          int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
+
+          //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
+          if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
+          {
+            NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf));
+          }
+        }
+}
+
+void vnf_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+{
+	nfapi_p7_message_header_t header;
+
+	// validate the input params
+	if(pRecvMsg == NULL || recvMsgLen < 4 || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
+		return;
+	}
+
+	// unpack the message header
+	if (nfapi_p7_message_header_unpack(pRecvMsg, recvMsgLen, &header, sizeof(header), &vnf_p7->_public.codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
+		return;
+	}
+
+	// ensure the message is sensible
+	if (recvMsgLen < 8 || pRecvMsg == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_WARN, "Invalid message size: %d, ignoring\n", recvMsgLen);
+		return;
+	}
+
+	switch (header.message_id)
+	{
+		case NFAPI_UL_NODE_SYNC:
+			vnf_handle_ul_node_sync(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+
+		case NFAPI_TIMING_INFO:
+			vnf_handle_timing_info(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+			
+		case NFAPI_HARQ_INDICATION:
+			vnf_handle_harq_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+	
+		case NFAPI_CRC_INDICATION:
+			vnf_handle_crc_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+	
+		case NFAPI_RX_ULSCH_INDICATION:
+			vnf_handle_rx_ulsch_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+	
+		case NFAPI_RACH_INDICATION:
+			vnf_handle_rach_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+	
+		case NFAPI_SRS_INDICATION:
+			vnf_handle_srs_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+
+		case NFAPI_RX_SR_INDICATION:
+			vnf_handle_rx_sr_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+
+		case NFAPI_RX_CQI_INDICATION:
+			vnf_handle_rx_cqi_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+			
+		case NFAPI_LBT_DL_INDICATION:
+			vnf_handle_lbt_dl_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+			
+		case NFAPI_NB_HARQ_INDICATION:
+			vnf_handle_nb_harq_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;
+			
+		case NFAPI_NRACH_INDICATION:
+			vnf_handle_nrach_indication(pRecvMsg, recvMsgLen, vnf_p7);
+			break;			
+
+		default:
+			{
+				if(header.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+				   header.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+				{
+					vnf_handle_p7_vendor_extension(pRecvMsg, recvMsgLen, vnf_p7, header.message_id);
+				}
+				else
+				{
+					NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Unknown message ID %d\n", header.message_id);
+				}
+			}
+			break;
+	}
+}
+
+void vnf_handle_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) 
+{
+	nfapi_p7_message_header_t messageHeader;
+
+	// validate the input params
+	if(pRecvMsg == NULL || recvMsgLen < 4 || vnf_p7 == NULL)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p7_message: invalid input params (%d %d %d)\n", pRecvMsg, recvMsgLen, vnf_p7);
+		return;
+	}
+
+	// unpack the message header
+	if (nfapi_p7_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p7_message_header_t), &vnf_p7->_public.codec_config) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
+		return;
+	}
+
+	if(vnf_p7->_public.checksum_enabled)
+	{
+		uint32_t checksum = nfapi_p7_calculate_checksum(pRecvMsg, recvMsgLen);
+		if(checksum != messageHeader.checksum)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_ERROR, "Checksum verification failed %d %d msg:%d len:%d\n", checksum, messageHeader.checksum, messageHeader.message_id, recvMsgLen);
+			return;
+		}
+	}
+
+	uint8_t m = NFAPI_P7_GET_MORE(messageHeader.m_segment_sequence);
+	uint8_t segment_num = NFAPI_P7_GET_SEGMENT(messageHeader.m_segment_sequence);
+	uint8_t sequence_num = NFAPI_P7_GET_SEQUENCE(messageHeader.m_segment_sequence);
+
+
+	if(m == 0 && segment_num == 0)
+	{
+		// we have a complete message
+		// ensure the message is sensible
+		if (recvMsgLen < 8 || pRecvMsg == NULL)
+		{
+			NFAPI_TRACE(NFAPI_TRACE_WARN, "Invalid message size: %d, ignoring\n", recvMsgLen);
+			return;
+		}
+
+		//vnf_dispatch_p7_message(&messageHeader, pRecvMsg, recvMsgLen, vnf_p7);
+		vnf_dispatch_p7_message(pRecvMsg, recvMsgLen, vnf_p7);
+	}
+	else
+	{
+		nfapi_vnf_p7_connection_info_t* phy = vnf_p7_connection_info_list_find(vnf_p7, messageHeader.phy_id);
+
+		if(phy)
+		{
+			vnf_p7_rx_message_t* rx_msg = vnf_p7_rx_reassembly_queue_add_segment(vnf_p7, &(phy->reassembly_queue), sequence_num, segment_num, m, pRecvMsg, recvMsgLen);
+
+			if(rx_msg->num_segments_received == rx_msg->num_segments_expected)
+			{
+				// send the buffer on
+				uint16_t i = 0;
+				uint16_t length = 0;
+				for(i = 0; i < rx_msg->num_segments_expected; ++i)
+				{
+					length += rx_msg->segments[i].length - (i > 0 ? NFAPI_P7_HEADER_LENGTH : 0);
+				}
+
+				if(phy->reassembly_buffer_size < length)
+				{
+					vnf_p7_free(vnf_p7, phy->reassembly_buffer);
+					phy->reassembly_buffer = 0;
+				}
+
+				if(phy->reassembly_buffer == 0)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_NOTE, "Resizing VNF_P7 Reassembly buffer %d->%d\n", phy->reassembly_buffer_size, length);
+					phy->reassembly_buffer = (uint8_t*)vnf_p7_malloc(vnf_p7, length);
+
+					if(phy->reassembly_buffer == 0)
+					{
+						NFAPI_TRACE(NFAPI_TRACE_NOTE, "Failed to allocate VNF_P7 reassemby buffer len:%d\n", length);
+						return;
+					}
+
+					phy->reassembly_buffer_size = length;
+				}
+
+				uint16_t offset = 0;
+				for(i = 0; i < rx_msg->num_segments_expected; ++i)
+				{
+					if(i == 0)
+					{
+						memcpy(phy->reassembly_buffer, rx_msg->segments[i].buffer, rx_msg->segments[i].length);
+						offset += rx_msg->segments[i].length;
+					}
+					else
+					{
+						memcpy(phy->reassembly_buffer + offset, rx_msg->segments[i].buffer + NFAPI_P7_HEADER_LENGTH, rx_msg->segments[i].length - NFAPI_P7_HEADER_LENGTH);
+						offset += rx_msg->segments[i].length - NFAPI_P7_HEADER_LENGTH;
+					}
+				}
+
+
+				//pnf_dispatch_p7_message(pnf_p7->reassemby_buffer, length, pnf_p7, rx_msg->rx_hr_time);
+				vnf_dispatch_p7_message(phy->reassembly_buffer, length , vnf_p7);
+
+
+				// delete the structure
+				vnf_p7_rx_reassembly_queue_remove_msg(vnf_p7, &(phy->reassembly_queue), rx_msg);
+			}
+
+			vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7, &(phy->reassembly_queue), 1000);
+		}
+		else
+		{
+
+			NFAPI_TRACE(NFAPI_TRACE_INFO, "Unknown phy id %d\n", messageHeader.phy_id);
+		}
+	}
+}
+
+int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7)
+{
+	int recvfrom_result = 0;
+	struct sockaddr_in remote_addr;
+	socklen_t remote_addr_size = sizeof(remote_addr);
+
+	do
+	{
+		// peek the header
+		uint8_t header_buffer[NFAPI_P7_HEADER_LENGTH];
+		recvfrom_result = recvfrom(vnf_p7->socket, header_buffer, NFAPI_P7_HEADER_LENGTH, MSG_DONTWAIT | MSG_PEEK, (struct sockaddr*)&remote_addr, &remote_addr_size);
+
+		if(recvfrom_result > 0)
+		{
+			// get the segment size
+			nfapi_p7_message_header_t header;
+			if(nfapi_p7_message_header_unpack(header_buffer, NFAPI_P7_HEADER_LENGTH, &header, sizeof(header), 0) < 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
+				return -1;
+			}
+
+			// resize the buffer if we have a large segment
+			if(header.message_length > vnf_p7->rx_message_buffer_size)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "reallocing rx buffer %d\n", header.message_length); 
+				vnf_p7->rx_message_buffer = realloc(vnf_p7->rx_message_buffer, header.message_length);
+				vnf_p7->rx_message_buffer_size = header.message_length;
+			}
+
+			// read the segment
+			recvfrom_result = recvfrom(vnf_p7->socket, vnf_p7->rx_message_buffer, header.message_length, MSG_WAITALL, (struct sockaddr*)&remote_addr, &remote_addr_size);
+
+			// todo : how to handle incomplete readfroms, need some sort of buffer/select
+
+			if(recvfrom_result == 0)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "recvfrom returned 0\n");
+			}
+			else if(recvfrom_result != header.message_length)
+			{
+				NFAPI_TRACE(NFAPI_TRACE_NOTE, "did not receive the entire message %d %d\n", recvfrom_result, header.message_length); 
+				
+				recvfrom_result += recvfrom(vnf_p7->socket, &vnf_p7->rx_message_buffer[recvfrom_result], header.message_length - recvfrom_result, MSG_WAITALL, (struct sockaddr*)&remote_addr, &remote_addr_size);
+	
+			}
+			
+			
+			if(recvfrom_result > 0)
+			{
+				vnf_handle_p7_message(vnf_p7->rx_message_buffer, recvfrom_result, vnf_p7);
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_ERROR, "recvfrom failed %d %d\n", recvfrom_result, errno);
+			}
+		}
+
+		if(recvfrom_result == -1)
+		{
+			if(errno == EAGAIN || errno == EWOULDBLOCK)
+			{
+				// return to the select
+				//NFAPI_TRACE(NFAPI_TRACE_WARN, "%s recvfrom would block :%d\n", __FUNCTION__, errno);
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_WARN, "%s recvfrom failed errno:%d\n", __FUNCTION__, errno);
+			}
+		}
+	}
+	while(recvfrom_result > 0);
+
+	return 0;
+}
+
+void vnf_p7_release_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header)
+{
+	switch(header->message_id)
+	{
+		case NFAPI_HARQ_INDICATION:
+			{
+				vnf_p7_codec_free(vnf_p7, ((nfapi_harq_indication_t*)(header))->harq_indication_body.harq_pdu_list);
+			}
+			break;
+		case NFAPI_CRC_INDICATION:
+			{
+				vnf_p7_codec_free(vnf_p7, ((nfapi_crc_indication_t*)(header))->crc_indication_body.crc_pdu_list);
+			}
+			break;
+		case NFAPI_RX_ULSCH_INDICATION:
+			{
+				nfapi_rx_indication_t* rx_ind = (nfapi_rx_indication_t*)(header);
+				uint16_t i = 0;
+				for(i = 0; i < rx_ind->rx_indication_body.number_of_pdus; ++i)
+				{
+					vnf_p7_codec_free(vnf_p7, rx_ind->rx_indication_body.rx_pdu_list[i].data);
+				}
+
+				vnf_p7_codec_free(vnf_p7, rx_ind->rx_indication_body.rx_pdu_list);
+			}
+			break;
+		case NFAPI_RACH_INDICATION:
+			{
+				vnf_p7_codec_free(vnf_p7, ((nfapi_rach_indication_t*)(header))->rach_indication_body.preamble_list);
+			}
+			break;
+		case NFAPI_SRS_INDICATION:
+			{
+				vnf_p7_codec_free(vnf_p7, ((nfapi_srs_indication_t*)(header))->srs_indication_body.srs_pdu_list);
+			}
+			break;
+		case NFAPI_RX_SR_INDICATION:
+			{
+				vnf_p7_codec_free(vnf_p7, ((nfapi_sr_indication_t*)(header))->sr_indication_body.sr_pdu_list);
+			}
+			break;
+		case NFAPI_RX_CQI_INDICATION:
+			{
+				vnf_p7_codec_free(vnf_p7, ((nfapi_cqi_indication_t*)(header))->cqi_indication_body.cqi_pdu_list);
+				vnf_p7_codec_free(vnf_p7, ((nfapi_cqi_indication_t*)(header))->cqi_indication_body.cqi_raw_pdu_list);
+			}
+			break;
+	}
+				
+	vnf_p7_free(vnf_p7, header);
+	
+}
+
+void vnf_p7_release_pdu(vnf_p7_t* vnf_p7, void* pdu)
+{
+	vnf_p7_free(vnf_p7, pdu);
+}
+
diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
new file mode 100644
index 0000000000000000000000000000000000000000..a35d8e3c1d1963a2927c981c58d9ac7cf0f486d8
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
@@ -0,0 +1,562 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <time.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "vnf_p7.h"
+
+#define FAPI2_IP_DSCP	0
+
+nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
+{
+	vnf_p7_t* _this = (vnf_p7_t*)calloc(1, sizeof(vnf_p7_t));
+
+	if(_this == 0)
+		return 0;
+
+	// todo : initialize
+	_this->_public.segment_size = 1400;
+	_this->_public.max_num_segments = 8;
+	_this->_public.checksum_enabled = 1;
+	
+	_this->_public.malloc = &malloc;
+	_this->_public.free = &free;	
+
+	_this->_public.codec_config.allocate = &malloc;
+	_this->_public.codec_config.deallocate = &free;
+	
+
+	return &(_this->_public);
+}
+
+void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config)
+{
+	free(config);
+}
+
+
+struct timespec timespec_add(struct timespec lhs, struct timespec rhs)
+{
+	struct timespec result;
+
+	result.tv_sec = lhs.tv_sec + rhs.tv_sec;
+	result.tv_nsec = lhs.tv_nsec + rhs.tv_nsec;
+
+	if(result.tv_nsec > 1e9)
+	{
+		result.tv_sec++;
+		result.tv_nsec-= 1e9;
+	}
+
+	return result;
+}
+
+struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
+{
+	struct timespec result;
+	if ((lhs.tv_nsec-rhs.tv_nsec)<0) 
+	{
+		result.tv_sec = lhs.tv_sec-rhs.tv_sec-1;
+		result.tv_nsec = 1000000000+lhs.tv_nsec-rhs.tv_nsec;
+	} 
+	else 
+	{
+		result.tv_sec = lhs.tv_sec-rhs.tv_sec;
+		result.tv_nsec = lhs.tv_nsec-rhs.tv_nsec;
+	}
+	return result;
+}
+
+// monitor the p7 endpoints and the timing loop and 
+// send indications to mac
+int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+{
+	if(config == 0)
+		return -1;
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+
+	// Create p7 receive udp port 
+	// todo : this needs updating for Ipv6
+	
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port);
+
+	// open the UDP socket
+	if ((vnf_p7->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 socket errno: %d\n", errno);
+		return -1;
+	}
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 socket created...\n");
+
+	// configure the UDP socket options
+	int iptos_value = FAPI2_IP_DSCP << 2;
+	if (setsockopt(vnf_p7->socket, IPPROTO_IP, IP_TOS, &iptos_value, sizeof(iptos_value)) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (IP_TOS) errno: %d\n", errno);
+		return -1;
+	}
+	
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 setsockopt succeeded...\n");
+
+	// Create the address structure
+	struct sockaddr_in addr;
+	memset(&addr, 0, sizeof(addr));
+	addr.sin_family = AF_INET;
+	addr.sin_port = htons(config->port);
+	addr.sin_addr.s_addr = INADDR_ANY;
+
+	// bind to the configured port
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 binding too %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
+	if (bind(vnf_p7->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
+	//if (sctp_bindx(config->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), 0) < 0)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
+		return -1;
+	}
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n");
+
+
+	//struct timespec original_pselect_timeout;
+	struct timespec pselect_timeout;
+	pselect_timeout.tv_sec = 0;
+	pselect_timeout.tv_nsec = 1000000; // ns in a 1 us
+
+
+	struct timespec pselect_start;
+	struct timespec pselect_stop;
+
+	//struct timespec sf_end;
+
+	long last_millisecond = -1;
+
+
+	struct timespec sf_duration;
+	sf_duration.tv_sec = 0;
+	sf_duration.tv_nsec = 1e6; // We want 1ms pause
+
+	struct timespec sf_start;
+	clock_gettime(CLOCK_MONOTONIC, &sf_start);
+	long millisecond = sf_start.tv_nsec / 1e6;
+	sf_start = timespec_add(sf_start, sf_duration);
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
+
+	while(vnf_p7->terminate == 0)
+	{
+		fd_set rfds;
+		int maxSock = 0;
+		FD_ZERO(&rfds);
+		int selectRetval = 0;
+
+		// Add the p7 socket
+		FD_SET(vnf_p7->socket, &rfds);
+		maxSock = vnf_p7->socket;
+		
+		clock_gettime(CLOCK_MONOTONIC, &pselect_start);
+		//long millisecond = pselect_start.tv_nsec / 1e6;
+
+		if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) )
+		{
+                  //NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
+
+
+			if((pselect_start.tv_sec > sf_start.tv_sec) || 
+			   ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
+			{
+				// overran the end of the subframe we do not want to wait
+				pselect_timeout.tv_sec = 0;
+				pselect_timeout.tv_nsec = 0;
+
+				//struct timespec overrun = timespec_sub(pselect_start, sf_start);
+				//NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec);
+			}
+			else
+			{
+				// still time before the end of the subframe wait
+				pselect_timeout = timespec_sub(sf_start, pselect_start);
+
+#if 0
+                                NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sf_start:%d.%ld pselect_start:%d.%ld pseclect_timeout:%d.%ld\n",
+                                    __FUNCTION__,
+                                    sf_start.tv_sec, sf_start.tv_nsec,
+                                    pselect_start.tv_sec, pselect_start.tv_nsec,
+                                    pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
+#endif
+			}
+
+//original_pselect_timeout = pselect_timeout;
+
+			// detemine how long to sleep in ns before the start of the next 1ms
+			//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
+
+			//uint8_t underrun_possible =0;
+			
+			// if we are not sleeping until the next milisecond due to the
+			// insycn minor adjment flag it so we don't consider it an error
+			//uint8_t underrun_possible =0;
+			/*
+			{
+				nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
+				if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0 && pselect_start.tv_nsec != 0)
+				{
+					NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %d (%d->%d)\n", phy->insync_minor_adjustment,
+							pselect_timeout.tv_nsec, pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000)) 
+					if(phy->insync_minor_adjustment > 0)
+					{
+						// todo check we don't go below 0
+						if((phy->insync_minor_adjustment * 1000) > pselect_timeout.tv_nsec)
+							pselect_timeout.tv_nsec = 0;
+						else
+							pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
+
+
+						//underrun_possible = 1;
+					}
+					else if(phy->insync_minor_adjustment < 0)
+					{
+						// todo check we don't go below 0
+						pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
+					}
+
+					//phy->insync_minor_adjustment = 0;
+					phy->insync_minor_adjustment_duration--;
+				}
+			}
+			*/
+			
+
+//long wraps = pselect_timeout.tv_nsec % 1e9;
+
+
+			selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
+
+			clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
+
+                        nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
+
+if (selectRetval==-1 && errno == 22)
+{
+  NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n", 
+  pselect_timeout.tv_sec, pselect_timeout.tv_nsec, 
+  phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment, 
+  sf_duration.tv_sec, sf_duration.tv_nsec);
+}
+#if 0
+                        if (selectRetval != 0 || phy->insync_minor_adjustment_duration != 0)
+                          NFAPI_TRACE(NFAPI_TRACE_NOTE, "pselect()=%d maxSock:%d vnf_p7->socket:%d pselect_timeout:%u.%u original_pselect_timeout:%u.%u\n", 
+                              selectRetval, maxSock, vnf_p7->socket, pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
+                              original_pselect_timeout.tv_sec, original_pselect_timeout.tv_nsec);
+#endif
+
+			if(selectRetval == 0)
+			{
+				// calculate the start of the next subframe
+				sf_start = timespec_add(sf_start, sf_duration);
+				//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
+
+				if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
+				{
+                                        long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
+
+                                        sf_start.tv_nsec -= insync_minor_adjustment_ns;
+
+#if 1
+                                        if (sf_start.tv_nsec > 1e9)
+                                        {
+                                          sf_start.tv_sec++;
+                                          sf_start.tv_nsec-=1e9;
+                                        }
+                                        else if (sf_start.tv_nsec < 0)
+                                        {
+                                          sf_start.tv_sec--;
+                                          sf_start.tv_nsec+=1e9;
+                                        }
+#else
+                                        //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
+					if(phy->insync_minor_adjustment > 0)
+					{
+						// decrease the subframe duration a little
+                                                if (sf_start.tv_nsec > insync_minor_adjustment_ns)
+                                                  sf_start.tv_nsec -= insync_minor_adjustment_ns;
+                                                else
+                                                {
+                                                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
+                                                  sf_start.tv_sec--;
+                                                  sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
+                                                }
+					}
+					else if(phy->insync_minor_adjustment < 0)
+					{
+						// todo check we don't go below 0
+						// increase the subframe duration a little
+						sf_start.tv_nsec += insync_minor_adjustment_ns;
+
+                                                if (sf_start.tv_nsec < 0)
+                                                {
+                                                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
+                                                  sf_start.tv_sec++;
+                                                  sf_start.tv_nsec += 1e9;
+                                                }
+					}
+#endif
+
+					//phy->insync_minor_adjustment = 0;
+                                        phy->insync_minor_adjustment_duration--;
+
+                                        NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n", 
+                                            phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
+
+                                        if (phy->insync_minor_adjustment_duration==0)
+                                        {
+                                          phy->insync_minor_adjustment = 0;
+                                        }
+				}
+				/*
+				long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
+				if(millisecond == pselect_stop_millisecond)
+				{
+					// we have woke up in the same subframe
+					if(underrun_possible == 0)
+						NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect underrun %ld (%d.%d)\n", millisecond, pselect_stop.tv_sec, pselect_stop.tv_nsec);
+				}
+				else if(((millisecond + 1) % 1000) != pselect_stop_millisecond)
+				{
+					// we have overrun the subframe
+					NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect overrun %ld %ld\n", millisecond, pselect_stop_millisecond);
+					NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe underrun %ld\n", millisecond);
+				}
+				last_millisecond = millisecond;
+				*/
+				
+				millisecond ++;
+			}
+		}
+		else
+		{
+			// we have overrun the subframe advance to go and collect $200
+			if((millisecond - last_millisecond) > 3)
+				NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1);
+
+			last_millisecond = ( last_millisecond + 1 ) % 1000;
+			selectRetval = 0;
+		}
+
+		if(selectRetval == 0)
+		{
+			vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
+
+			// pselect timed out
+			nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
+
+			while(curr != 0)
+			{
+				curr->sfn_sf = increment_sfn_sf(curr->sfn_sf);
+				
+				vnf_sync(vnf_p7, curr);
+
+				curr = curr->next;
+			}
+
+			send_mac_subframe_indications(vnf_p7);
+
+		}
+		else if(selectRetval > 0)
+		{
+			// have a p7 message
+			if(FD_ISSET(vnf_p7->socket, &rfds))
+			{
+				vnf_p7_read_dispatch_message(vnf_p7);
+			}
+		}
+		else
+		{
+			// pselect error
+			if(selectRetval == -1 && errno == EINTR)
+			{
+				// a sigal was received.
+			}
+			else
+			{
+				NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
+				// should we exit now?
+                                if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
+                                {
+                                  usleep(100000);
+                                }
+			}
+		}
+
+	}
+
+	
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
+	close(vnf_p7->socket);
+
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() returning\n", __FUNCTION__);
+
+	return 0;
+}
+
+int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config)
+{
+	if(config == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	vnf_p7->terminate =1;
+	return 0;
+}
+
+int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, int pnf_p7_port, int phy_id)
+{
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p phy_id:%d pnf_addr:%s pnf_p7_port:%d)\n", __FUNCTION__, config, phy_id,  pnf_p7_addr, pnf_p7_port);
+
+	if(config == 0)
+        {
+          return -1;
+        }
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+
+	nfapi_vnf_p7_connection_info_t* node = (nfapi_vnf_p7_connection_info_t*)malloc(sizeof(nfapi_vnf_p7_connection_info_t));
+
+	memset(node, 0, sizeof(nfapi_vnf_p7_connection_info_t));
+	node->phy_id = phy_id;
+	node->in_sync = 0;
+	node->dl_out_sync_offset = 30;
+	node->dl_out_sync_period = 10;
+	node->dl_in_sync_offset = 30;
+	node->dl_in_sync_period = 512;
+	node->sfn_sf = 0;
+
+	node->min_sync_cycle_count = 8;
+
+	// save the remote endpoint information
+	node->remote_addr.sin_family = AF_INET;
+	node->remote_addr.sin_port = htons(pnf_p7_port);
+	node->remote_addr.sin_addr.s_addr = inet_addr(pnf_p7_addr);
+
+	vnf_p7_connection_info_list_add(vnf_p7, node);
+
+	return 0;
+}
+
+int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id)
+{
+	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d)\n", __FUNCTION__, phy_id);
+
+	if(config == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+
+	nfapi_vnf_p7_connection_info_t* to_delete = vnf_p7_connection_info_list_delete(vnf_p7, phy_id);
+
+	if(to_delete)
+	{
+		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d) deleting connection info\n", __FUNCTION__, phy_id);
+		free(to_delete);
+	}
+
+	return 0;
+}
+int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_request_t* req)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req);
+
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
+}
+
+int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
+}
+int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
+}
+int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
+}
+int nfapi_vnf_p7_lbt_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req)
+{
+	if(config == 0 || req == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
+}
+int nfapi_vnf_p7_vendor_extension(nfapi_vnf_p7_config_t* config, nfapi_p7_message_header_t* header)
+{
+	if(config == 0 || header == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	return vnf_p7_pack_and_send_p7_msg(vnf_p7, header);
+}
+
+
+int nfapi_vnf_p7_release_msg(nfapi_vnf_p7_config_t* config, nfapi_p7_message_header_t* header)
+{
+	if(config == 0 || header == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	vnf_p7_release_msg(vnf_p7, header);
+
+	return 0;
+
+}
+
+int nfapi_vnf_p7_release_pdu(nfapi_vnf_p7_config_t* config, void* pdu)
+{
+	if(config == 0 || pdu == 0)
+		return -1;
+
+	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+	vnf_p7_release_pdu(vnf_p7, pdu);
+
+	return 0;
+}
diff --git a/nfapi/open-nFAPI/vnf/tests/Makefile.am b/nfapi/open-nFAPI/vnf/tests/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..0c8163102c61a1c196414d4aade3ea939bbde293
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/tests/Makefile.am
@@ -0,0 +1,30 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+#vnf unit test
+#AUTOMAKE_OPTIONS=subdir-objects
+
+AM_CPPFLAGS = -I$(top_srcdir)/nfapi/inc -I$(top_srcdir)/nfapi/public_inc  -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/vnf/public_inc $(CFLAGS_CUNIT) -Wall -Werror
+
+check_PROGRAMS= test_vnf
+
+test_vnf_SOURCES = vnf_cunit_main.c ../..//common/src/debug.c   
+test_vnf_LDADD=$(top_builddir)/vnf/libnfapi_vnf.a $(top_builddir)/nfapi/libnfapi.a  -L$(libdir) -lpthread -lrt -lsctp -lz -lcunit
+
+LOG_DRIVER = $(top_srcdir)/tap-driver.sh
+TESTS=test_vnf
+EXTRA_DIST = $(TESTS)
+
diff --git a/nfapi/open-nFAPI/vnf/tests/vnf_cunit_main.c b/nfapi/open-nFAPI/vnf/tests/vnf_cunit_main.c
new file mode 100644
index 0000000000000000000000000000000000000000..4df5da7c261d6398cce7aaaf6c3e4d13b8a14500
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf/tests/vnf_cunit_main.c
@@ -0,0 +1,1497 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "CUnit.h"
+#include "Basic.h"
+#include "Automated.h"
+//#include "CUnit/Console.h"
+
+#include "nfapi_interface.h"
+#include "nfapi_vnf_interface.h"
+#include "nfapi.h"
+#include <stdio.h>  // for printf
+#include <pthread.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+#include <arpa/inet.h>
+#include "debug.h"
+#include <unistd.h>
+#include <stdlib.h>
+
+/* Test Suite setup and cleanup functions: */
+
+int init_suite(void) { return 0; }
+int clean_suite(void) { return 0; }
+
+#define MAX_PACKED_MESSAGE_SIZE	8192
+
+#define SFNSF2SFN(_sfnsf) ((_sfnsf) >> 4)
+#define SFNSF2SF(_sfnsf) ((_sfnsf) & 0xF)
+
+typedef struct
+{
+	uint8_t enabled;
+	uint8_t started;
+	uint16_t phy_id;
+
+	int p7_rx_port;
+	char* p7_rx_addr;
+
+	struct sockaddr_in p7_rx_sockaddr;
+	int p7_rx_sock;
+
+	struct sockaddr_in p7_tx_sockaddr;
+	int p7_tx_sock;
+} pnf_test_config_phy_t;
+
+typedef struct
+{
+	uint8_t enabled;
+	
+	char* vnf_p5_addr;
+	int vnf_p5_port;
+
+	struct sockaddr_in p5_tx_sockaddr;
+	int p5_sock;
+
+	int p7_rx_port_base;
+
+	pnf_test_config_phy_t phys[4];
+
+} pnf_test_config_t;
+
+pnf_test_config_t pnf_test_config[5];
+
+typedef struct
+{
+	uint8_t enabled;
+	uint8_t state;
+	uint16_t p5_idx;
+	uint16_t phy_id;
+
+	uint8_t vnf_idx;
+	//struct sockaddr_in p7_rx_sockaddr;
+	struct sockaddr_in p7_tx_sockaddr;
+
+} vnf_test_config_phy_t;
+
+typedef struct 
+{
+	uint8_t enabled;
+	pthread_t thread;
+
+	char* vnf_p7_addr;
+	int vnf_p7_port;
+
+	struct sockaddr_in p7_rx_sockaddr;
+
+	nfapi_vnf_p7_config_t* config;
+
+	uint8_t max_phys;
+	uint8_t phy_count;
+	//uint8_t phy_ids[4];
+	
+} vnf_test_config_vnf_t;
+
+typedef struct  
+{
+	char* p5_addr;
+	int p5_port;
+
+	pthread_t thread;
+
+	vnf_test_config_vnf_t vnfs[2];
+
+	uint8_t phy_count;
+	vnf_test_config_phy_t phys[5];
+
+	nfapi_vnf_config_t* p5_vnf_config;
+
+} vnf_test_config_t;
+
+vnf_test_config_t vnf_test_config[5];
+
+void reset_test_configs()
+{
+	memset(&pnf_test_config, 0, sizeof(pnf_test_config));
+	memset(&vnf_test_config, 0, sizeof(vnf_test_config));
+}
+
+void pnf_create_p5_sock(pnf_test_config_t* config)
+{
+	config->p5_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
+	
+	config->p5_tx_sockaddr.sin_family = AF_INET;
+	config->p5_tx_sockaddr.sin_port = htons(config->vnf_p5_port);
+	config->p5_tx_sockaddr.sin_addr.s_addr = inet_addr(config->vnf_p5_addr);
+}
+
+void pnf_p5_connect(pnf_test_config_t* config)
+{
+	int connect_result = connect(config->p5_sock, (struct sockaddr *)&config->p5_tx_sockaddr, sizeof(config->p5_tx_sockaddr) );
+
+	printf("connect_result %d %d\n", connect_result, errno);
+}
+
+pnf_test_config_phy_t* find_pnf_phy_config(pnf_test_config_t* config, uint16_t phy_id)
+{
+	int i = 0;
+	for(i = 0; i < 4; ++i)
+	{
+		if(config->phys[i].phy_id == phy_id)
+			return &(config->phys[i]);
+	}
+
+	return 0;
+}
+
+vnf_test_config_phy_t* find_vnf_phy_config(vnf_test_config_t* config, uint16_t phy_id)
+{
+	int i = 0;
+	for(i = 0; i < 4; ++i)
+	{
+		if(config->phys[i].phy_id == phy_id)
+			return &(config->phys[i]);
+	}
+
+	return 0;
+}
+
+
+
+
+/************* Test case functions ****************/
+
+
+void vnf_test_start_no_config(void) 
+{
+	int result = nfapi_vnf_start(0);
+	CU_ASSERT_EQUAL(result, -1);
+}
+
+void* vnf_test_start_thread(void* ptr)
+{
+	int result = nfapi_vnf_start((nfapi_vnf_config_t*)ptr);
+	return (void*)(intptr_t)result;
+}
+
+int pnf_connection_indication_called = 0;
+int pnf_connection_indication(nfapi_vnf_config_t* config, int p5_idx)
+{
+	printf("[VNF] pnf_connection_indication p5_idx:%d\n", p5_idx);
+	pnf_connection_indication_called++;
+
+	nfapi_pnf_param_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
+	req.header.message_length = 0;
+
+	nfapi_vnf_pnf_param_req(config, p5_idx, &req);
+	
+	return 1;
+}
+
+int pnf_disconnect_indication(nfapi_vnf_config_t* config, int p5_idx)
+{
+	printf("[VNF] pnf_disconnect_indication p5_idx:%d\n", p5_idx);
+	pnf_connection_indication_called++;
+
+	vnf_test_config_t* test_config = (vnf_test_config_t*)(config->user_data);
+	printf("[VNF] pnf_disconnect_indication user_data %p\n", config->user_data);
+
+	int i = 0;
+	for(i = 0; i < test_config->phy_count; ++i)
+	{
+		vnf_test_config_phy_t* phy = &test_config->phys[i];
+		vnf_test_config_vnf_t* vnf = &test_config->vnfs[phy->p5_idx];
+
+		// need to send stop request/response
+
+		nfapi_vnf_p7_del_pnf((vnf->config), phy->phy_id);
+		vnf->phy_count--;
+	}
+
+
+	for(i = 0; i < 2; ++i)
+	{
+		vnf_test_config_vnf_t* vnf = &test_config->vnfs[i];
+	printf("[VNF] pnf_disconnect_indication phy_count:%d\n", vnf->phy_count);
+		if(vnf->enabled == 1)
+		{
+			nfapi_vnf_p7_stop(vnf->config);
+			//vnf->config->terminate = 1;
+
+			int* result;
+	printf("[VNF] waiting for vnf p7 thread to exit\n");
+			pthread_join((vnf->thread), (void**)&result);
+			CU_ASSERT_EQUAL(result, 0);
+
+			vnf->enabled = 0;
+		}
+	}
+	
+	return 1;
+}
+
+int send_p5_message(int p5Sock, nfapi_p4_p5_message_header_t* msg, unsigned msg_size, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	char buffer[256];
+	int encoded_size = nfapi_p5_message_pack(msg, msg_size, buffer, sizeof(buffer), 0);
+	int result = sendto(p5Sock, buffer, encoded_size, 0, (struct sockaddr*)addr, addr_size);
+	(void)result;
+	return 0;
+}
+
+int recv_p5_message(int p5Sock, nfapi_p4_p5_message_header_t* msg, unsigned msg_size)
+{
+	struct sockaddr_in addr2;
+	socklen_t addr2len;
+	char buffer2[256];
+	int result2 = recvfrom(p5Sock, buffer2, sizeof(buffer2), 0, (struct sockaddr*)&addr2, &addr2len); 
+		
+	int unpack_result = nfapi_p5_message_unpack(buffer2, result2, msg, msg_size, 0); //, sizeof(resp));
+	(void)unpack_result;
+	return 0;
+}
+
+int send_pnf_param_response(pnf_test_config_t* config) //int p5Sock, struct sockaddr_in* addr, socklen_t addr_size)
+{
+	nfapi_pnf_param_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
+
+	resp.header.message_length = 0;
+	resp.error_code = NFAPI_MSG_OK;
+
+	//send_p5_message(p5Sock, &resp, sizeof(resp), addr, addr_size);
+	send_p5_message(config->p5_sock, &resp.header, sizeof(resp), &(config->p5_tx_sockaddr), sizeof(config->p5_tx_sockaddr));
+	return 0;
+}
+
+int create_p7_rx_socket(const char* addr, int port)
+{
+	int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+
+	struct sockaddr_in sock_addr;
+	sock_addr.sin_family = AF_INET;
+	sock_addr.sin_port = htons(port);
+
+	if(addr == 0)
+		sock_addr.sin_addr.s_addr = INADDR_ANY;
+	else
+		sock_addr.sin_addr.s_addr = inet_addr(addr);
+
+	int bind_result = bind(fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr));
+	if(bind_result != 0)
+	{
+		printf("Failed to bind p7 rx socket %d(%d) to %s:%d\n", bind_result, errno, addr, port);
+	}
+
+	
+	return fd;
+}
+
+int create_p7_tx_socket()
+{
+	int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+	return fd;
+}
+
+int send_param_response(pnf_test_config_t* config, uint16_t phy_id)
+{
+	nfapi_param_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PARAM_RESPONSE;
+	resp.header.phy_id = phy_id;
+
+	pnf_test_config_phy_t* phy = find_pnf_phy_config(config, phy_id);
+
+	resp.error_code = NFAPI_MSG_OK;
+
+	resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
+	resp.nfapi_config.p7_pnf_port.value = phy->p7_rx_port;
+
+	struct sockaddr_in pnf_p7_sockaddr;
+	pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(phy->p7_rx_addr);
+
+	resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
+	memcpy(&resp.nfapi_config.p7_pnf_address_ipv4.address[0], &pnf_p7_sockaddr.sin_addr.s_addr, 4);
+
+	send_p5_message(config->p5_sock, &resp.header, sizeof(resp), &(config->p5_tx_sockaddr), sizeof(config->p5_tx_sockaddr));
+	return 0;
+}
+
+int receive_pnf_param_request(pnf_test_config_t* config)
+{
+	nfapi_pnf_param_request_t req;
+	recv_p5_message(config->p5_sock, &req.header, sizeof(req));
+
+	CU_ASSERT_EQUAL(req.header.message_id, NFAPI_PNF_PARAM_REQUEST);
+	if(req.header.message_id == NFAPI_PNF_PARAM_REQUEST)
+	{
+		printf("[PNF] nfapi_pnf_param_request\n");
+	}
+	return 0;
+}
+
+int receive_param_request(pnf_test_config_t* config)
+{
+	nfapi_param_request_t req;
+	recv_p5_message(config->p5_sock, &req.header, sizeof(req));
+
+	CU_ASSERT_EQUAL(req.header.message_id, NFAPI_PARAM_REQUEST);
+	if(req.header.message_id == NFAPI_PARAM_REQUEST)
+	{
+		printf("[PNF] nfapi_param_request phy_id:%d\n", req.header.phy_id);
+	}
+	else
+	{
+		printf("[PNF] ERROR, unexpected message %d phy_id:%d\n", req.header.message_id, req.header.phy_id);
+	}
+	return req.header.phy_id;
+}
+
+int send_pnf_config_response(pnf_test_config_t* config)
+{
+	nfapi_pnf_config_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
+	resp.header.message_length = 0;
+	resp.error_code = NFAPI_MSG_OK;
+
+	send_p5_message(config->p5_sock, &resp.header, sizeof(resp), &(config->p5_tx_sockaddr), sizeof(config->p5_tx_sockaddr));
+	return 0;
+}
+
+int send_config_response(pnf_test_config_t* config, uint16_t phy_id)
+{
+	nfapi_config_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_CONFIG_RESPONSE;
+	resp.header.message_length = 0;
+	resp.header.phy_id = phy_id;
+	resp.error_code = NFAPI_MSG_OK;
+
+	send_p5_message(config->p5_sock, &resp.header, sizeof(resp), &(config->p5_tx_sockaddr), sizeof(config->p5_tx_sockaddr));
+	return 0;
+}
+
+
+int receive_pnf_config_request(pnf_test_config_t* config)
+{
+	nfapi_pnf_config_request_t req;
+	recv_p5_message(config->p5_sock, &req.header, sizeof(req));
+
+	CU_ASSERT_EQUAL(req.header.message_id, NFAPI_PNF_CONFIG_REQUEST);
+	if(req.header.message_id == NFAPI_PNF_CONFIG_REQUEST)
+	{
+		printf("decoded nfapi_pnf_config_request\n");
+
+		int i = 0;
+		for(i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i)
+		{
+			nfapi_phy_rf_config_info_t* info = &(req.pnf_phy_rf_config.phy_rf_config[i]);
+			printf("adding pnf phy %d id %d\n",  i, info->phy_id);
+
+			config->phys[i].enabled = 1;
+			config->phys[i].phy_id = info->phy_id;
+		}
+	}
+	return 0;
+}
+
+int receive_config_request(pnf_test_config_t* config)
+{
+	nfapi_config_request_t req;
+	recv_p5_message(config->p5_sock, &req.header, sizeof(req));
+
+	CU_ASSERT_EQUAL(req.header.message_id, NFAPI_CONFIG_REQUEST);
+	if(req.header.message_id == NFAPI_CONFIG_REQUEST)
+	{
+		printf("[PNF] nfapi_config_request phy_id:%d\n", req.header.phy_id);
+
+		pnf_test_config_phy_t* phy = find_pnf_phy_config(config, req.header.phy_id);
+
+		// todo verify that this is the same as a vnf config?
+		phy->p7_tx_sockaddr.sin_family = AF_INET;
+		phy->p7_tx_sockaddr.sin_port = htons(req.nfapi_config.p7_vnf_port.value);
+		memcpy(&phy->p7_tx_sockaddr.sin_addr.s_addr, &req.nfapi_config.p7_vnf_address_ipv4.address, 4);
+		phy->p7_tx_sock = create_p7_tx_socket();
+
+
+		printf("[PNF] vnf p7 address %s:%d\n", inet_ntoa(phy->p7_tx_sockaddr.sin_addr), ntohs(phy->p7_tx_sockaddr.sin_port));
+
+		return req.header.phy_id;
+	}
+
+	return NFAPI_PHY_ID_NA;
+}
+
+int send_pnf_start_response(pnf_test_config_t* config)
+{
+	nfapi_pnf_start_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_START_RESPONSE;
+	resp.header.message_length = 0;
+	resp.error_code = NFAPI_MSG_OK;
+
+	send_p5_message(config->p5_sock, &resp.header, sizeof(resp), &(config->p5_tx_sockaddr), sizeof(config->p5_tx_sockaddr));
+	return 0;
+}
+
+int send_start_response(pnf_test_config_t* config, uint16_t phy_id)
+{
+	nfapi_start_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_START_RESPONSE;
+	resp.header.message_length = 0;
+	resp.header.phy_id  = phy_id;
+	resp.error_code = NFAPI_MSG_OK;
+
+	send_p5_message(config->p5_sock, &resp.header, sizeof(resp), &(config->p5_tx_sockaddr), sizeof(config->p5_tx_sockaddr));
+	return 0;
+}
+
+int receive_pnf_start_request(pnf_test_config_t* config)
+{
+	nfapi_pnf_start_request_t req;
+	recv_p5_message(config->p5_sock, &req.header, sizeof(req));
+
+	CU_ASSERT_EQUAL(req.header.message_id, NFAPI_PNF_START_REQUEST);
+	if(req.header.message_id == NFAPI_PNF_START_REQUEST)
+	{
+		printf("decoded nfapi_pnf_start_request\n");
+
+		int phy_idx = 0;
+		for(phy_idx = 0; phy_idx < 4; ++phy_idx)
+		{
+			if(config->phys[phy_idx].enabled)
+			{
+				pnf_test_config_phy_t* phy = &(config->phys[phy_idx]);
+				phy->p7_rx_port = config->p7_rx_port_base + phy_idx;
+				phy->p7_rx_addr = "127.0.0.1"; 
+			}
+		}
+	}
+	return 0;
+}
+
+int receive_start_request(pnf_test_config_t* config)
+{
+	nfapi_start_request_t req;
+	recv_p5_message(config->p5_sock, &req.header, sizeof(req));
+
+	CU_ASSERT_EQUAL(req.header.message_id, NFAPI_START_REQUEST);
+	if(req.header.message_id == NFAPI_START_REQUEST)
+	{
+		printf("[PNF] nfapi_start_request\n");
+
+		pnf_test_config_phy_t* phy = find_pnf_phy_config(config, req.header.phy_id);
+		printf("[PNF] creating p7 rx socket %s:%d\n", phy->p7_rx_addr, phy->p7_rx_port);
+		phy->p7_rx_sock = create_p7_rx_socket(phy->p7_rx_addr, phy->p7_rx_port);
+		phy->started = 1;
+
+	}
+
+	return req.header.phy_id;
+}
+
+int send_pnf_stop_response(pnf_test_config_t* config, uint16_t phy_id)
+{
+	printf("pnf_stop_response\n");
+	nfapi_pnf_stop_response_t resp;
+	memset(&resp, 0, sizeof(resp));
+	resp.header.message_id = NFAPI_PNF_STOP_RESPONSE;
+	resp.header.message_length = 0;
+	resp.error_code = NFAPI_MSG_OK;
+
+	send_p5_message(config->p5_sock, &resp.header, sizeof(resp), &(config->p5_tx_sockaddr), sizeof(config->p5_tx_sockaddr));
+	return 0;
+}
+
+int receive_pnf_stop_request(pnf_test_config_t* config)
+{
+	printf("pnf_stop_request\n");
+	nfapi_pnf_stop_request_t req;
+	recv_p5_message(config->p5_sock, &req.header, sizeof(req));
+
+	CU_ASSERT_EQUAL(req.header.message_id, NFAPI_PNF_STOP_REQUEST);
+	if(req.header.message_id == NFAPI_PNF_STOP_REQUEST)
+	{
+		printf("decoded nfapi_pnf_stop_request\n");
+	}
+	return 0;
+}
+int pnf_param_response(nfapi_vnf_config_t* config, int p5_idx,nfapi_pnf_param_response_t* response)
+{
+	printf("[VNF] pnf_param_response p5_idx:%d\n", p5_idx);
+	CU_ASSERT_EQUAL(response->error_code, NFAPI_MSG_OK);
+
+	uint16_t phy_id;
+	nfapi_vnf_allocate_phy(config, p5_idx, &phy_id);
+
+	nfapi_pnf_config_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
+	req.header.message_length = 0;
+	req.header.phy_id = NFAPI_PHY_ID_NA;
+
+	req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
+	req.pnf_phy_rf_config.number_phy_rf_config_info = 2;
+	nfapi_vnf_allocate_phy(config, p5_idx, &req.pnf_phy_rf_config.phy_rf_config[0].phy_id);
+	nfapi_vnf_allocate_phy(config, p5_idx, &req.pnf_phy_rf_config.phy_rf_config[1].phy_id);
+	
+	uint16_t i = vnf_test_config[0].phy_count;
+
+	vnf_test_config[0].phys[i].enabled = 1;
+	vnf_test_config[0].phys[i].p5_idx = p5_idx;
+	vnf_test_config[0].phys[i].phy_id = req.pnf_phy_rf_config.phy_rf_config[0].phy_id;
+
+	i++;
+
+	vnf_test_config[0].phys[i].enabled = 1;
+	vnf_test_config[0].phys[i].p5_idx = p5_idx;
+	vnf_test_config[0].phys[i].phy_id = req.pnf_phy_rf_config.phy_rf_config[1].phy_id;
+
+	i++;
+	
+	vnf_test_config[0].phy_count = i;
+
+	nfapi_vnf_pnf_config_req(config, p5_idx, &req);
+
+	return 0;
+}
+
+int pnf_config_response(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* response)
+{
+	printf("pnf_config_response\n");
+	CU_ASSERT_EQUAL(response->error_code, NFAPI_MSG_OK);
+
+	nfapi_pnf_start_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_PNF_START_REQUEST;
+	req.header.message_length = 0;
+	req.header.phy_id = response->header.phy_id;
+
+	nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+
+	return 0;
+}
+
+
+void* vnf_test_start_p7_thread(void* ptr)
+{
+	int result = nfapi_vnf_p7_start((nfapi_vnf_p7_config_t*)ptr);
+	(void)result;
+	return 0;
+}
+
+int test_subframe_indication(nfapi_vnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn_sf)
+{
+	//printf("[VNF:%d] (%d:%d) SUBFRAME_IND\n", phy_id, SFNSF2SFN(sfn_sf), SFNSF2SF(sfn_sf));
+
+	nfapi_dl_config_request_t dl_config_req;
+	memset(&dl_config_req, 0, sizeof(dl_config_req));
+	dl_config_req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
+	dl_config_req.header.phy_id = phy_id;
+	dl_config_req.sfn_sf = sfn_sf;
+	nfapi_vnf_p7_dl_config_req(config, &dl_config_req);
+	
+	nfapi_ul_config_request_t ul_config_req;
+	memset(&ul_config_req, 0, sizeof(ul_config_req));
+	ul_config_req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
+	ul_config_req.header.phy_id = phy_id;
+	ul_config_req.sfn_sf = sfn_sf;
+	nfapi_vnf_p7_ul_config_req(config, &ul_config_req);
+
+	nfapi_hi_dci0_request_t hi_dci0_req;
+	memset(&hi_dci0_req, 0, sizeof(hi_dci0_req));
+	hi_dci0_req.header.message_id = NFAPI_HI_DCI0_REQUEST;
+	hi_dci0_req.header.phy_id = phy_id;
+	hi_dci0_req.sfn_sf = sfn_sf;
+	nfapi_vnf_p7_hi_dci0_req(config, &hi_dci0_req);
+
+
+	nfapi_tx_request_t tx_req;
+	memset(&tx_req, 0, sizeof(tx_req));
+	tx_req.header.message_id = NFAPI_TX_REQUEST;
+	tx_req.header.phy_id = phy_id;
+	tx_req.sfn_sf = sfn_sf;
+	nfapi_vnf_p7_tx_req(config, &tx_req);
+	return 0;
+}
+
+int test_harq_indication(nfapi_vnf_p7_config_t* config, nfapi_harq_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) HARQ_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+
+int test_nb_harq_indication(nfapi_vnf_p7_config_t* config, nfapi_nb_harq_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) HARQ_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+
+
+int test_crc_indication(nfapi_vnf_p7_config_t* config, nfapi_crc_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) CRC_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+int test_rx_indication(nfapi_vnf_p7_config_t* config, nfapi_rx_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) RX_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+int test_rach_indication(nfapi_vnf_p7_config_t* config, nfapi_rach_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) RACH_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+int test_nrach_indication(nfapi_vnf_p7_config_t* config, nfapi_nrach_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) RACH_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+int test_srs_indication(nfapi_vnf_p7_config_t* config, nfapi_srs_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) SRS_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+int test_sr_indication(nfapi_vnf_p7_config_t* config, nfapi_sr_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) SR_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+int test_cqi_indication(nfapi_vnf_p7_config_t* config, nfapi_cqi_indication_t* ind)
+{
+	//printf("[VNF:%d] (%d:%d) CQI_IND\n", ind->header.phy_id, SFNSF2SFN(ind->sfn_sf), SFNSF2SF(ind->sfn_sf));
+	return 0;
+}
+
+int pnf_start_response(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* response)
+{
+	printf("[VNF] pnf_start_response p5_idx:%d\n", p5_idx);
+	CU_ASSERT_EQUAL(response->error_code, NFAPI_MSG_OK);
+
+	return 0;
+}
+
+int pnf_stop_response(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_response_t* response)
+{
+	printf("pnf_stop_response\n");
+	CU_ASSERT_EQUAL(response->error_code, NFAPI_MSG_OK);
+
+	nfapi_vnf_p7_stop(vnf_test_config[0].vnfs[0].config);
+	return 0;
+}
+
+int param_response(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* response)
+{
+	printf("[VNF] param_response p5_idx:%d phy_id:%d\n", p5_idx, response->header.phy_id);
+	CU_ASSERT_EQUAL(response->error_code, NFAPI_MSG_OK);
+
+	struct sockaddr_in addr;
+	memcpy(&addr.sin_addr.s_addr, &response->nfapi_config.p7_pnf_address_ipv4.address, 4);
+	printf("[VNF] param_response pnf p7 %s:%d\n", inet_ntoa(addr.sin_addr), response->nfapi_config.p7_pnf_port.value);
+
+	// find the vnf phy configuration
+	vnf_test_config_phy_t* phy = find_vnf_phy_config(&(vnf_test_config[0]), response->header.phy_id);
+	
+	// save the pnf p7 connection information
+	phy->p7_tx_sockaddr.sin_port = response->nfapi_config.p7_pnf_port.value;
+	memcpy(&phy->p7_tx_sockaddr.sin_addr.s_addr, &response->nfapi_config.p7_pnf_address_ipv4.address, 4);
+
+	nfapi_config_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_CONFIG_REQUEST;
+	req.header.phy_id = response->header.phy_id;
+
+	vnf_test_config_vnf_t* vnf = &(vnf_test_config[0].vnfs[phy->vnf_idx]);
+	req.nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
+	memcpy(&req.nfapi_config.p7_vnf_address_ipv4.address, &vnf->p7_rx_sockaddr.sin_addr.s_addr, 4);
+
+	req.nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
+	req.nfapi_config.p7_vnf_port.value = vnf->p7_rx_sockaddr.sin_port;
+
+	nfapi_vnf_config_req(config, p5_idx, &req);
+	return 0;
+}
+
+int config_response(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* response)
+{
+	printf("[VNF] config_response p5_idx:%d phy_id:%d\n", p5_idx, response->header.phy_id);
+	return 0;
+	CU_ASSERT_EQUAL(response->error_code, NFAPI_MSG_OK);
+
+}
+
+int send_vnf_start_req(vnf_test_config_t* config, vnf_test_config_phy_t* phy)
+{
+	nfapi_start_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_START_REQUEST;
+	req.header.phy_id = phy->phy_id;
+
+	nfapi_vnf_start_req(config->p5_vnf_config, phy->p5_idx, &req);
+	return 0;
+}
+
+int start_response(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* response)
+{
+	printf("[VNF] start_response p5_idx:%d phy_id:%d\n", p5_idx, response->header.phy_id);
+	CU_ASSERT_EQUAL(response->error_code, NFAPI_MSG_OK);
+
+	sleep(1);
+	
+	vnf_test_config_phy_t* phy = find_vnf_phy_config(&(vnf_test_config[0]), response->header.phy_id);
+
+	char* addr = inet_ntoa(phy->p7_tx_sockaddr.sin_addr);
+	int port = phy->p7_tx_sockaddr.sin_port;
+
+	vnf_test_config_vnf_t* vnf = &(vnf_test_config[0].vnfs[phy->vnf_idx]);
+
+	nfapi_vnf_p7_add_pnf(vnf->config, addr, port, response->header.phy_id);
+	return 0;
+}
+
+int stop_response(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_response_t* response)
+{
+	printf("stop_response p5_idx:%d phy_id:%d\n", p5_idx, response->header.phy_id);
+	CU_ASSERT_EQUAL(response->error_code, NFAPI_MSG_OK);
+	return 0;
+}
+
+void  start_vnf_p5(vnf_test_config_t* test_config)
+{
+	test_config->p5_vnf_config = nfapi_vnf_config_create();
+
+	test_config->p5_vnf_config->vnf_p5_port = test_config->p5_port;
+	test_config->p5_vnf_config->vnf_ipv4 = 1;
+	test_config->p5_vnf_config->pnf_connection_indication = &pnf_connection_indication;
+	test_config->p5_vnf_config->pnf_disconnect_indication = &pnf_disconnect_indication;
+	test_config->p5_vnf_config->pnf_param_resp = &pnf_param_response;
+	test_config->p5_vnf_config->pnf_config_resp = &pnf_config_response;
+	test_config->p5_vnf_config->pnf_start_resp = &pnf_start_response;
+	test_config->p5_vnf_config->pnf_stop_resp = &pnf_stop_response;
+	test_config->p5_vnf_config->param_resp = &param_response;
+	test_config->p5_vnf_config->config_resp = &config_response;
+	test_config->p5_vnf_config->start_resp = &start_response;
+	test_config->p5_vnf_config->stop_resp = &stop_response;
+
+	test_config->p5_vnf_config->user_data = test_config;
+
+	pthread_create(&test_config->thread, NULL, &vnf_test_start_thread, test_config->p5_vnf_config);
+
+	sleep(1);
+
+}
+
+void start_vnf_p7(vnf_test_config_vnf_t* vnf)
+{
+	
+	// todo : select which vnf to use for these phy's
+	vnf->enabled = 1;
+
+	vnf->p7_rx_sockaddr.sin_addr.s_addr = inet_addr(vnf->vnf_p7_addr);
+	vnf->p7_rx_sockaddr.sin_port = vnf->vnf_p7_port;
+
+
+	vnf->config = nfapi_vnf_p7_config_create();
+	vnf->config->checksum_enabled = 0;
+	vnf->config->port = vnf->vnf_p7_port;
+	vnf->config->subframe_indication = &test_subframe_indication;
+	vnf->config->harq_indication = &test_harq_indication;
+	vnf->config->crc_indication = &test_crc_indication;
+	vnf->config->rx_indication = &test_rx_indication;
+	vnf->config->rach_indication = &test_rach_indication;
+	vnf->config->srs_indication = &test_srs_indication;
+	vnf->config->sr_indication = &test_sr_indication;
+	vnf->config->cqi_indication = &test_cqi_indication;
+	
+	vnf->config->nb_harq_indication = &test_nb_harq_indication;
+	vnf->config->nrach_indication = &test_nrach_indication;
+	
+
+	vnf->config->segment_size = 1400;
+	vnf->config->max_num_segments = 6;
+
+	pthread_create(&(vnf->thread), NULL, &vnf_test_start_p7_thread, vnf->config);
+
+	vnf->enabled = 1;
+
+	//vnf->phy_count++;
+
+	sleep(1);
+}
+
+void send_p7_segmented_msg(int sock, char* msg, int len, int segment_size, struct sockaddr* addr,  socklen_t addr_len)
+{
+	static uint8_t sequence_num = 0;
+	if(len < segment_size)
+	{
+		msg[7] = sequence_num;
+		sendto(sock, msg, len, 0, addr, addr_len);
+	}
+	else
+	{
+		int msg_body_len = len - 12 ; 
+		int seg_body_len = segment_size - 12 ; 
+		int segments = (msg_body_len / (seg_body_len)) + ((msg_body_len % seg_body_len) ? 1 : 0); 
+
+		//printf("sending segmented message len:%d seg_size:%d count:%d\n", len, segment_size, segments);
+
+		int segment = 0;
+		int offset = 12;
+		for(segment = 0; segment < segments; ++segment)
+		{
+			uint8_t last = 0;
+			uint16_t size = segment_size - 12;
+			if(segment + 1 == segments)
+			{
+				last = 1;
+				size = (msg_body_len) - (seg_body_len * segment);
+			}
+
+			char buffer[segment_size];
+
+			memcpy(&buffer[0], msg, 12);
+			buffer[6] = ((!last) << 7) + segment;
+			buffer[7] = sequence_num;
+
+			// msg length
+			uint8_t* p = (uint8_t*)&buffer[4];
+			push16(size + 12, &p, (uint8_t*)&buffer[size + 12]);
+
+			memcpy(&buffer[12], msg + offset, size);
+			offset += size;
+		
+			sendto(sock, &buffer[0], size + 12, 0, addr, addr_len);
+
+		}
+
+
+	}
+
+	sequence_num++;
+}
+
+void start_phy(vnf_test_config_phy_t* phy)
+{
+
+	nfapi_param_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_PARAM_REQUEST;
+	req.header.phy_id = phy->phy_id;
+
+	nfapi_vnf_config_t* p5_vnf_config = (vnf_test_config[0].p5_vnf_config);
+	
+
+	nfapi_vnf_param_req(p5_vnf_config, phy->p5_idx, &req);
+
+}
+
+
+void vnf_test_start_connect(void)
+{
+	reset_test_configs();
+
+	int segment_size = 256;
+
+	vnf_test_config[0].p5_addr = "127.0.0.1";
+	vnf_test_config[0].p5_port = 4242;
+
+	vnf_test_config[0].vnfs[0].enabled = 0;
+	vnf_test_config[0].vnfs[0].vnf_p7_addr = "127.0.0.1";
+	vnf_test_config[0].vnfs[0].vnf_p7_port = 7878;
+	vnf_test_config[0].vnfs[0].max_phys = 1;
+
+	vnf_test_config[0].vnfs[1].enabled = 0;
+	vnf_test_config[0].vnfs[1].vnf_p7_addr = "127.0.0.1";
+	vnf_test_config[0].vnfs[1].vnf_p7_port = 7879;
+	vnf_test_config[0].vnfs[1].max_phys = 1;
+
+
+	// this is the action that p9 would take to set the vnf p5 address/port
+	pnf_test_config[0].enabled = 1;
+	pnf_test_config[0].vnf_p5_port = vnf_test_config[0].p5_port;
+	pnf_test_config[0].vnf_p5_addr = vnf_test_config[0].p5_addr;
+	pnf_test_config[0].p7_rx_port_base = 8000;
+
+	pnf_test_config[1].enabled = 1;
+	pnf_test_config[1].vnf_p5_port = vnf_test_config[0].p5_port;
+	pnf_test_config[1].vnf_p5_addr = vnf_test_config[0].p5_addr;
+	pnf_test_config[1].p7_rx_port_base = 8100;
+
+	pnf_connection_indication_called = 0;
+
+	start_vnf_p5(&vnf_test_config[0]);
+
+
+	pnf_create_p5_sock(&pnf_test_config[0]);
+	pnf_p5_connect(&pnf_test_config[0]);
+
+	receive_pnf_param_request(&pnf_test_config[0]);
+	send_pnf_param_response(&pnf_test_config[0]);
+
+	receive_pnf_config_request(&pnf_test_config[0]);
+	send_pnf_config_response(&pnf_test_config[0]);
+
+	receive_pnf_start_request(&pnf_test_config[0]);
+	send_pnf_start_response(&pnf_test_config[0]);
+
+	pnf_create_p5_sock(&pnf_test_config[1]);
+
+	pnf_p5_connect(&pnf_test_config[1]);
+
+	receive_pnf_param_request(&pnf_test_config[1]);
+	send_pnf_param_response(&pnf_test_config[1]);
+
+	receive_pnf_config_request(&pnf_test_config[1]);
+	send_pnf_config_response(&pnf_test_config[1]);
+
+	receive_pnf_start_request(&pnf_test_config[1]);
+	send_pnf_start_response(&pnf_test_config[1]);
+
+	// start the vnf_p7 thread and assign by phys to that instance
+
+	start_vnf_p7(&vnf_test_config[0].vnfs[0]);
+	//start_vnf_p7(&vnf_test_config[0].vnfs[1]);
+	
+	printf("---- configuring phy %d -----\n", vnf_test_config[0].phys[0].phy_id);
+	vnf_test_config[0].phys[0].vnf_idx = 0;
+	start_phy(&vnf_test_config[0].phys[0]);
+
+	int phy_id = receive_param_request(&pnf_test_config[0]);
+	send_param_response(&pnf_test_config[0], phy_id); 
+
+	phy_id = receive_config_request(&pnf_test_config[0]);
+	send_config_response(&pnf_test_config[0], phy_id);
+
+	printf("---- configuring phy %d -----\n", vnf_test_config[0].phys[2].phy_id);
+	vnf_test_config[0].phys[2].vnf_idx = 0; 
+	start_phy(&vnf_test_config[0].phys[2]);
+
+	phy_id = receive_param_request(&pnf_test_config[1]);
+	send_param_response(&pnf_test_config[1], phy_id); 
+
+	phy_id = receive_config_request(&pnf_test_config[1]);
+	send_config_response(&pnf_test_config[1], phy_id);
+
+	printf("---- configuring phy %d -----\n", vnf_test_config[0].phys[1].phy_id);
+
+	vnf_test_config[0].phys[1].vnf_idx = 0;
+	start_phy(&vnf_test_config[0].phys[1]);
+
+	phy_id = receive_param_request(&pnf_test_config[0]);
+	send_param_response(&pnf_test_config[0], phy_id); 
+
+	phy_id = receive_config_request(&pnf_test_config[0]);
+	send_config_response(&pnf_test_config[0], phy_id);
+
+	//-------------
+	printf("---- starting phy %d -----\n", vnf_test_config[0].phys[0].phy_id);
+
+	send_vnf_start_req(&vnf_test_config[0], &vnf_test_config[0].phys[0]);
+	phy_id = receive_start_request(&pnf_test_config[0]);
+	send_start_response(&pnf_test_config[0], phy_id);
+/*
+	printf("---- starting phy %d -----\n", vnf_test_config[0].phys[2].phy_id);
+
+	send_vnf_start_req(&vnf_test_config[0], &vnf_test_config[0].phys[2]);
+	phy_id = receive_start_request(&pnf_test_config[1]);
+	send_start_response(&pnf_test_config[1], phy_id);
+
+	printf("---- starting phy %d -----\n", vnf_test_config[0].phys[1].phy_id);
+
+	send_vnf_start_req(&vnf_test_config[0], &vnf_test_config[0].phys[1]);
+	phy_id = receive_start_request(&pnf_test_config[0]);
+	send_start_response(&pnf_test_config[0], phy_id);
+*/
+	//close(pnf_test_config[0].p5_sock);
+
+	char buffer[2048];
+	int buffer_size = sizeof(buffer);
+
+	
+	fd_set rdfs;
+	int exit = 0;
+	while(exit != 1)
+	{
+		int pnf_idx, phy_idx; 
+		int max_fd = 0;
+		FD_ZERO(&rdfs);
+
+		for(pnf_idx = 0; pnf_idx < 4; ++pnf_idx)
+		{
+			if(pnf_test_config[pnf_idx].enabled)
+			{
+				FD_SET(pnf_test_config[pnf_idx].p5_sock, &rdfs);
+				if(pnf_test_config[pnf_idx].p5_sock > max_fd)
+					max_fd = pnf_test_config[pnf_idx].p5_sock;
+			}
+
+			for(phy_idx = 0; phy_idx < 4; ++phy_idx)
+			{
+				pnf_test_config_phy_t* phy_info = &(pnf_test_config[pnf_idx].phys[phy_idx]);
+
+				if(phy_info->started == 1 && phy_info->enabled == 1)
+				{
+					//////////////////printf("adding %d/%d %d %d\n", pnf_idx, phy_idx, phy_info->phy_id, phy_info->p7_rx_sock);
+					FD_SET(phy_info->p7_rx_sock, &rdfs);
+					if(phy_info->p7_rx_sock > max_fd)
+						max_fd = phy_info->p7_rx_sock;
+				}
+			}
+		}
+
+		
+		// changed to select,
+		int select_result = select(max_fd + 1, &rdfs, NULL, NULL, NULL);
+		(void)select_result;
+
+		for(pnf_idx = 0; pnf_idx < 4; ++pnf_idx)
+		{
+			if(pnf_test_config[pnf_idx].enabled)
+			{
+				//pnf_test_config_t* pnf_config = &(pnf_test_config[pnf_idx]);
+			}
+
+			for(phy_idx = 0; phy_idx < 4; ++phy_idx)
+			{
+				pnf_test_config_phy_t* phy_info = &(pnf_test_config[pnf_idx].phys[phy_idx]);
+
+				if(phy_info->enabled)
+				{
+					if(FD_ISSET(phy_info->p7_rx_sock, &rdfs))
+					{
+						//struct sockaddr_in recv_addr;
+						//memset(&recv_addr, 0, sizeof(recv_addr));
+						//socklen_t recv_addr_size;
+						int len = recvfrom(phy_info->p7_rx_sock, &buffer[0], buffer_size, 0, 0, 0);// (struct sockaddr*)&recv_addr, &recv_addr_size);
+
+						if(len == -1)
+						{
+							printf("recvfrom %d failed %d\n", phy_info->p7_rx_sock, errno);
+							continue;
+						}
+
+						nfapi_p7_message_header_t header;
+						nfapi_p7_message_header_unpack(buffer, len, &header, sizeof(header), 0);
+
+						switch(header.message_id)
+						{
+							case NFAPI_DL_NODE_SYNC:
+								{
+									nfapi_dl_node_sync_t msg;
+									nfapi_p7_message_unpack(buffer, len, &msg, sizeof(msg), 0);
+									printf("[PNF:%d] NFAPI_DL_NODE_SYNC t1:%d\n", msg.header.phy_id, msg.t1);
+
+									nfapi_ul_node_sync_t resp;
+									memset(&resp, 0, sizeof(resp));
+									resp.header.message_id = NFAPI_UL_NODE_SYNC;
+									resp.header.phy_id = msg.header.phy_id;
+									resp.t1 = msg.t1;
+									usleep(50);
+									resp.t2 = msg.t1 + 50; // 50 us rx latency
+									resp.t3 = msg.t1 + 10; // 10 us pnf proc
+
+									usleep(50);
+
+									len = nfapi_p7_message_pack(&resp, buffer, buffer_size, 0);
+									// send ul node sycn
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+								}
+								break;
+							case NFAPI_DL_CONFIG_REQUEST:
+								{
+									nfapi_dl_config_request_t msg;
+									nfapi_p7_message_unpack(buffer, len, &msg, sizeof(msg), 0);
+									//printf("[PNF:%d] (%d/%d) NFAPI_DL_CONFIG_REQUEST\n", header.phy_id, SFNSF2SFN(msg.sfn_sf), SFNSF2SF(msg.sfn_sf));
+
+									if(SFNSF2SFN(msg.sfn_sf) == 500)
+										exit = 1;
+									// simulate the uplink messages
+									
+									nfapi_harq_indication_t harq_ind;
+									memset(&harq_ind, 0, sizeof(harq_ind));
+									harq_ind.header.message_id = NFAPI_HARQ_INDICATION;
+									harq_ind.header.phy_id = msg.header.phy_id;
+									harq_ind.sfn_sf = msg.sfn_sf;
+									harq_ind.harq_indication_body.tl.tag = NFAPI_HARQ_INDICATION_BODY_TAG;
+									harq_ind.harq_indication_body.number_of_harqs = 2;
+
+									harq_ind.harq_indication_body.harq_pdu_list = (nfapi_harq_indication_pdu_t*)(malloc(sizeof(nfapi_harq_indication_pdu_t) * harq_ind.harq_indication_body.number_of_harqs));
+
+									int i = 0;
+									for(i = 0; i < harq_ind.harq_indication_body.number_of_harqs; ++i)
+									{
+										harq_ind.harq_indication_body.harq_pdu_list[i].rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
+									}
+									len = nfapi_p7_message_pack(&harq_ind, buffer, buffer_size, 0);
+									//sendto(phy_info->p7_tx_sock, &buffer[0], len, 0, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+									
+
+
+									//sendto(phy_info->p7_tx_sock, &buffer[0], len, 0, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+									free(harq_ind.harq_indication_body.harq_pdu_list);
+
+									nfapi_crc_indication_t crc_ind;
+									memset(&crc_ind, 0, sizeof(crc_ind));
+									crc_ind.header.message_id = NFAPI_CRC_INDICATION;
+									crc_ind.header.phy_id = msg.header.phy_id;
+									crc_ind.sfn_sf = msg.sfn_sf;
+									len = nfapi_p7_message_pack(&crc_ind, buffer, buffer_size, 0);
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+									nfapi_sr_indication_t sr_ind;
+									memset(&sr_ind, 0, sizeof(sr_ind));
+									sr_ind.header.message_id = NFAPI_RX_SR_INDICATION;
+									sr_ind.header.phy_id = msg.header.phy_id;
+									sr_ind.sfn_sf = msg.sfn_sf;
+									len = nfapi_p7_message_pack(&sr_ind, buffer, buffer_size, 0);
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+									nfapi_cqi_indication_t cqi_ind;
+									memset(&cqi_ind, 0, sizeof(cqi_ind));
+									cqi_ind.header.message_id = NFAPI_RX_CQI_INDICATION;
+									cqi_ind.header.phy_id = msg.header.phy_id;
+									cqi_ind.sfn_sf = msg.sfn_sf;
+									len = nfapi_p7_message_pack(&cqi_ind, buffer, buffer_size, 0);
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+									nfapi_rach_indication_t rach_ind;
+									memset(&rach_ind, 0, sizeof(rach_ind));
+									rach_ind.header.message_id = NFAPI_RACH_INDICATION;
+									rach_ind.header.phy_id = msg.header.phy_id;
+									rach_ind.sfn_sf = msg.sfn_sf;
+									len = nfapi_p7_message_pack(&rach_ind, buffer, buffer_size, 0);
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+									nfapi_srs_indication_t srs_ind;
+									memset(&srs_ind, 0, sizeof(srs_ind));
+									srs_ind.header.message_id = NFAPI_SRS_INDICATION;
+									srs_ind.header.phy_id = msg.header.phy_id;
+									srs_ind.sfn_sf = msg.sfn_sf;
+									len = nfapi_p7_message_pack(&srs_ind, buffer, buffer_size, 0);
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+									nfapi_rx_indication_t rx_ind;
+									memset(&rx_ind, 0, sizeof(rx_ind));
+									rx_ind.header.message_id = NFAPI_RX_ULSCH_INDICATION;
+									rx_ind.header.phy_id = msg.header.phy_id;
+									rx_ind.sfn_sf = msg.sfn_sf;
+									len = nfapi_p7_message_pack(&rx_ind, buffer, buffer_size, 0);
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+									if(msg.sfn_sf % 5 == 0)
+									{
+										// periodically send the timing info
+										nfapi_timing_info_t timing_info;
+										memset(&timing_info, 0, sizeof(timing_info));
+										timing_info.header.message_id = NFAPI_TIMING_INFO;
+										timing_info.header.phy_id = msg.header.phy_id;
+										len = nfapi_p7_message_pack(&timing_info, buffer, buffer_size, 0);
+										send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+									}
+									
+									nfapi_nb_harq_indication_t nb_harq_ind;
+									memset(&nb_harq_ind, 0, sizeof(nb_harq_ind));
+									nb_harq_ind.header.message_id = NFAPI_NB_HARQ_INDICATION;
+									nb_harq_ind.header.phy_id = msg.header.phy_id;
+									nb_harq_ind.sfn_sf = msg.sfn_sf;
+									len = nfapi_p7_message_pack(&nb_harq_ind, buffer, buffer_size, 0);
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+									nfapi_nrach_indication_t nrach_ind;
+									memset(&nrach_ind, 0, sizeof(nrach_ind));
+									nrach_ind.header.message_id = NFAPI_NRACH_INDICATION;
+									nrach_ind.header.phy_id = msg.header.phy_id;
+									nrach_ind.sfn_sf = msg.sfn_sf;
+									len = nfapi_p7_message_pack(&nrach_ind, buffer, buffer_size, 0);
+									send_p7_segmented_msg(phy_info->p7_tx_sock, &buffer[0], len, segment_size, (struct sockaddr*)&phy_info->p7_tx_sockaddr, sizeof(phy_info->p7_tx_sockaddr));
+
+								}
+								break;
+							case NFAPI_UL_CONFIG_REQUEST:
+								{
+									nfapi_ul_config_request_t msg;
+									nfapi_p7_message_unpack(buffer, len, &msg, sizeof(msg), 0);
+									//printf("[PNF:%d] (%d/%d) NFAPI_UL_CONFIG_REQUEST\n", header.phy_id, SFNSF2SFN(msg.sfn_sf), SFNSF2SF(msg.sfn_sf));
+								}
+								break;
+							case NFAPI_HI_DCI0_REQUEST:
+								{
+									nfapi_hi_dci0_request_t msg;
+									nfapi_p7_message_unpack(buffer, len, &msg, sizeof(msg), 0);
+									//printf("[PNF:%d] (%d/%d) NFAPI_HI_DCI0_REQUEST\n", header.phy_id, SFNSF2SFN(msg.sfn_sf), SFNSF2SF(msg.sfn_sf));
+								}
+								break;
+							case NFAPI_TX_REQUEST:
+								{
+									nfapi_tx_request_t msg;
+									nfapi_p7_message_unpack(buffer, len, &msg, sizeof(msg), 0);
+									//printf("[PNF:%d] (%d/%d) NFAPI_TX_REQUEST\n", header.phy_id, SFNSF2SFN(msg.sfn_sf), SFNSF2SF(msg.sfn_sf));
+								}
+								break;
+						}
+					
+					}
+				}
+			}
+		}
+	}
+
+	printf("Triggering p5 shutdown\n");
+
+	// vnf p5 trigger shutdown
+	nfapi_pnf_stop_request_t stop_req;
+	memset(&stop_req, 0, sizeof(stop_req));
+	stop_req.header.message_id = NFAPI_PNF_STOP_REQUEST;
+	nfapi_vnf_pnf_stop_req(vnf_test_config[0].p5_vnf_config, 0, &stop_req);
+
+	phy_id = receive_pnf_stop_request(&pnf_test_config[0]);
+	send_pnf_stop_response(&pnf_test_config[0], phy_id);
+
+
+	nfapi_vnf_stop(vnf_test_config[0].p5_vnf_config);
+
+
+	
+	int* result;
+	pthread_join((vnf_test_config[0].thread), (void**)&result);
+	CU_ASSERT_EQUAL(result, 0);
+	//CU_ASSERT_EQUAL(pnf_connection_indication_called, 1);
+
+
+	close(pnf_test_config[0].p5_sock);
+}
+
+void vnf_test_start_connect_ipv6(void)
+{
+	char* vnf_addr = "::1";
+	int vnf_port = 4242;
+	pnf_connection_indication_called = 0;
+
+	nfapi_vnf_config_t* config = nfapi_vnf_config_create();
+	config->vnf_p5_port = vnf_port;
+	config->vnf_ipv4 = 0;
+	config->vnf_ipv6 = 1;
+	config->pnf_connection_indication = &pnf_connection_indication;
+	config->pnf_disconnect_indication = &pnf_disconnect_indication;
+	config->pnf_param_resp = &pnf_param_response;
+	config->pnf_config_resp = &pnf_config_response;
+	config->pnf_start_resp = &pnf_start_response;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &vnf_test_start_thread, config);
+
+	sleep(1);
+
+	
+	int p5Sock = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
+	
+	struct sockaddr_in6 addr;
+	addr.sin6_family = AF_INET6;
+	addr.sin6_port = htons(vnf_port);
+	//addr.sin6_addr = inet_addr(vnf_addr);
+	inet_pton(AF_INET6, vnf_addr, &addr.sin6_addr);
+
+
+	/*
+	int connect_result = connect(p5Sock, (struct sockaddr *)&addr, sizeof(addr) );
+
+	printf("connect_result %d %d\n", connect_result, errno);
+
+	receive_pnf_param_request(p5Sock);
+	send_pnf_param_response(p5Sock, &addr, sizeof(addr));
+
+	receive_pnf_config_request(p5Sock);
+	send_pnf_config_response(p5Sock, &addr, sizeof(addr));
+
+	receive_pnf_start_request(p5Sock);
+	send_pnf_start_response(p5Sock, &addr, sizeof(addr));
+	*/
+	sleep(4);
+	nfapi_vnf_stop(config);
+	
+	int* result;
+	pthread_join(thread, (void**)&result);
+	CU_ASSERT_EQUAL(result, 0);
+	CU_ASSERT_EQUAL(pnf_connection_indication_called, 1);
+
+
+	close(p5Sock);
+}
+void vnf_test_start_connect_2(void)
+{
+	char* vnf_addr = "127.0.0.1";
+	int vnf_port = 4242;
+	pnf_connection_indication_called = 0;
+
+	nfapi_vnf_config_t * config = nfapi_vnf_config_create();
+	config->vnf_p5_port = vnf_port;
+	config->pnf_connection_indication = &pnf_connection_indication;
+
+	pthread_t thread;
+	pthread_create(&thread, NULL, &vnf_test_start_thread, config);
+
+	sleep(1);
+
+	
+	
+	struct sockaddr_in addr;
+	addr.sin_family = AF_INET;
+	addr.sin_port = htons(vnf_port);
+	addr.sin_addr.s_addr = inet_addr(vnf_addr);
+
+	
+	int p5Sock1 = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
+
+	int connect_result_1 = connect(p5Sock1, (struct sockaddr *)&addr, sizeof(addr) );
+
+	printf("connect_result_1 %d %d\n", connect_result_1, errno);
+
+	int p5Sock2 = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
+
+	int connect_result_2 = connect(p5Sock2, (struct sockaddr *)&addr, sizeof(addr) );
+
+	printf("connect_result_2 %d %d\n", connect_result_2, errno);
+
+	sleep(1);
+
+	close(p5Sock1);
+
+	sleep(1);
+
+	close(p5Sock2);
+
+	sleep(1);
+
+	nfapi_vnf_stop(config);
+	
+	int* result;
+	pthread_join(thread, (void**)&result);
+	CU_ASSERT_EQUAL(result, 0);
+	CU_ASSERT_EQUAL(pnf_connection_indication_called, 2);
+
+
+	close(p5Sock1);
+	close(p5Sock2);
+}
+
+void vnf_test_p7_segmentation_test1(void)
+{
+
+}
+
+
+/************* Test Runner Code goes here **************/
+
+int main ( void )
+{
+   CU_pSuite pSuite = NULL;
+
+   /* initialize the CUnit test registry */
+   if ( CUE_SUCCESS != CU_initialize_registry() )
+      return CU_get_error();
+
+   /* add a suite to the registry */
+   pSuite = CU_add_suite( "vnf_test_suite", init_suite, clean_suite );
+   if ( NULL == pSuite ) 
+   {
+      CU_cleanup_registry();
+      return CU_get_error();
+   }
+
+        //(NULL == CU_add_test(pSuite, "vnf_test_start_connect_2", vnf_test_start_connect_2)) 
+   /* add the tests to the suite */
+   if ( (NULL == CU_add_test(pSuite, "vnf_test_start_no_config", vnf_test_start_no_config)) ||
+        (NULL == CU_add_test(pSuite, "vnf_test_start_connect", vnf_test_start_connect)) ||
+        (NULL == CU_add_test(pSuite, "vnf_test_p7_segmentation_test1", vnf_test_p7_segmentation_test1))
+      )
+   {
+      CU_cleanup_registry();
+      return CU_get_error();
+   }
+
+   // Run all tests using the basic interface
+   CU_basic_set_mode(CU_BRM_VERBOSE);
+   CU_set_output_filename("vnf_unit_test_results.xml");
+   CU_basic_run_tests();
+
+	CU_pSuite s = CU_get_registry()->pSuite;
+	int count = 0;
+	while(s)
+	{
+		CU_pTest t = s->pTest;
+		while(t)
+		{
+			count++;
+			t = t->pNext;
+		}
+		s = s->pNext;
+	}
+
+	printf("%d..%d\n", 1, count);
+
+
+
+	s = CU_get_registry()->pSuite;
+	count = 1;
+	while(s)
+	{
+		CU_pTest t = s->pTest;
+		while(t)
+		{
+			int pass = 1;
+			CU_FailureRecord* failures = CU_get_failure_list();
+			while(failures)
+			{
+				if(strcmp(failures->pSuite->pName, s->pName) == 0 &&
+				   strcmp(failures->pTest->pName, t->pName) == 0)
+				{
+					pass = 0;
+					failures = 0;
+				}
+				else
+				{
+					failures = failures->pNext;
+				}
+			}
+
+			if(pass)
+				printf("ok %d - %s:%s\n", count, s->pName, t->pName);
+			else 
+				printf("not ok %d - %s:%s\n", count, s->pName, t->pName);
+
+			count++;
+			t = t->pNext;
+		}
+		s = s->pNext;
+	}
+
+   CU_cleanup_registry();
+   return CU_get_error();
+
+}
diff --git a/nfapi/open-nFAPI/vnf_sim/Makefile.am b/nfapi/open-nFAPI/vnf_sim/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..c3e42cebf35fcb6d3744c5953a0c3f0daee0acb6
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf_sim/Makefile.am
@@ -0,0 +1,22 @@
+#
+# Copyright 2017 Cisco Systems, Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+
+AUTOMAKE_OPTIONS=subdir-objects
+AM_CPPFLAGS = -I$(top_srcdir)/vnf_sim/inc -I$(top_srcdir)/sim_common/inc -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/nfapi/inc -I$(top_srcdir)/nfapi/public_inc -I$(top_srcdir)/vnf/inc -I$(top_srcdir)/vnf/public_inc $(XML_CFLAGS) -Wall -Werror -g
+AM_CXXFLAGS = -I$(top_srcidr)/vnf_sim/inc -I$(top_srcdir)/sim_common/inc -I$(top_srcdir)/common/public_inc -I$(top_srcdir)/nfapi/inc -I$(top_srcdir)/nfapi/public_inc -I$(top_srcdir)/vnf/inc -I$(top_srcdir)/vnf/public_inc $(XML_CFLAGS) -std=c++11 $(BOOST_CPPFLAGS) -g
+bin_PROGRAMS = vnfsim
+vnfsim_SOURCES = src/main.cpp src/mac.cpp
+LDADD= $(top_builddir)/vnf/libnfapi_vnf.a $(top_builddir)/common/libnfapi_common.a $(top_builddir)/nfapi/libnfapi.a $(top_builddir)/sim_common/libnfapi_sim_common.a -L$(libdir) -lpthread -lrt -lsctp -lz
diff --git a/nfapi/open-nFAPI/vnf_sim/inc/mac.h b/nfapi/open-nFAPI/vnf_sim/inc/mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..eac5b3b2ac5a854d9afb72462c3ed2c86a52a1b9
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf_sim/inc/mac.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _MAC_H_
+#define _MAC_H_
+
+#include "nfapi_interface.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef struct mac mac_t;
+
+typedef struct mac
+{
+	void* user_data;
+
+	void (*dl_config_req)(mac_t* mac, nfapi_dl_config_request_t* req);
+	void (*ul_config_req)(mac_t* mac, nfapi_ul_config_request_t* req);
+	void (*hi_dci0_req)(mac_t* mac, nfapi_hi_dci0_request_t* req);
+	void (*tx_req)(mac_t* mac, nfapi_tx_request_t* req);
+} mac_t;
+
+mac_t* mac_create(uint8_t wireshark_test_mode);
+void mac_destroy(mac_t* mac);
+
+void mac_start_data(mac_t* mac, unsigned rx_port, const char* tx_addres, unsigned tx_port);
+
+void mac_subframe_ind(mac_t* mac, uint16_t phy_id, uint16_t sfn_sf);
+void mac_harq_ind(mac_t* mac, nfapi_harq_indication_t* ind);
+void mac_crc_ind(mac_t* mac, nfapi_crc_indication_t* ind);
+void mac_rx_ind(mac_t* mac, nfapi_rx_indication_t* ind);
+void mac_rach_ind(mac_t* mac, nfapi_rach_indication_t* ind);
+void mac_srs_ind(mac_t* mac, nfapi_srs_indication_t* ind);
+void mac_sr_ind(mac_t* mac, nfapi_sr_indication_t* ind);
+void mac_cqi_ind(mac_t* mac, nfapi_cqi_indication_t* ind);
+void mac_lbt_dl_ind(mac_t* mac, nfapi_lbt_dl_indication_t* ind);
+void mac_nb_harq_ind(mac_t* mac, nfapi_nb_harq_indication_t* ind);
+void mac_nrach_ind(mac_t* mac, nfapi_nrach_indication_t* ind);
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/nfapi/open-nFAPI/vnf_sim/src/mac.cpp b/nfapi/open-nFAPI/vnf_sim/src/mac.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fa6f487be8e2274d55ac10c69b238070abfea6f6
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf_sim/src/mac.cpp
@@ -0,0 +1,1327 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mac.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <vendor_ext.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <ifaddrs.h>
+#include <netdb.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include <mutex>
+#include <queue>
+#include <list>
+
+uint32_t rand_range(uint32_t min, uint32_t max)
+{
+	return ((rand() % (max + 1 - min)) + min);
+}
+
+struct mac_pdu
+{
+	mac_pdu() : buffer_len(1500), buffer(0), len(0)
+	{
+		buffer = (char*) malloc(buffer_len);
+	}
+	
+	virtual ~mac_pdu()
+	{
+		free(buffer);
+	}
+
+	unsigned buffer_len;
+	char* buffer;
+	unsigned len;
+};
+
+class mac_private
+{
+		std::mutex mutex;
+		std::queue<mac_pdu*> rx_buffer;
+
+		std::queue<mac_pdu*> free_store;
+	public:
+
+		mac_private(bool _wireshark_test_mode)
+			: byte_count(0), tick(0), wireshark_test_mode(_wireshark_test_mode)
+		{
+
+		}
+
+		mac_pdu* allocate_mac_pdu()
+		{
+			mac_pdu* pdu = 0;
+			mutex.lock();
+			if(free_store.empty())
+			{
+				pdu = new mac_pdu();
+			}
+			else
+			{
+				pdu = free_store.front();
+				free_store.pop();
+			}
+			mutex.unlock();
+			return pdu;
+		}
+
+		void release_mac_pdu(mac_pdu* pdu)
+		{
+			mutex.lock();
+			free_store.push(pdu);
+			mutex.unlock();
+		}
+
+		
+
+		void push_rx_buffer(mac_pdu* buff)
+		{
+			mutex.lock();
+			rx_buffer.push(buff);
+			mutex.unlock();
+		}
+
+		mac_pdu* pop_rx_buffer()
+		{
+			mac_pdu* buff = 0;
+			mutex.lock();
+			if(!rx_buffer.empty())
+			{
+				buff = rx_buffer.front();
+				rx_buffer.pop();
+			}
+			mutex.unlock();
+			return buff;
+		}
+
+		uint32_t byte_count;
+		uint32_t tick;
+		
+		bool wireshark_test_mode;
+
+};
+
+extern "C"
+{
+	typedef struct {
+		mac_t _public;
+
+		int rx_sock;
+		int tx_sock;
+		struct sockaddr_in tx_addr;
+
+		uint32_t tx_byte_count;
+
+		mac_private* mac;
+		
+	} mac_internal_t;
+
+	mac_t* mac_create(uint8_t wireshark_test_mode)
+	{
+		mac_internal_t* instance = (mac_internal_t*)malloc(sizeof(mac_internal_t));
+		instance->mac = new mac_private((wireshark_test_mode >= 1));
+		return (mac_t*)instance;
+	}
+	
+	void mac_destroy(mac_t* mac)
+	{
+		mac_internal_t* instance = (mac_internal_t*)mac;
+		delete instance->mac;
+		free(instance);
+	}
+	
+	void* mac_rx_thread_start(void* ptr)
+	{
+		mac_internal_t* instance = (mac_internal_t*)ptr;
+
+		while(1)
+		{
+			mac_pdu* pdu = instance->mac->allocate_mac_pdu();
+			int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, 0, 0, 0);
+			if(len > 0)
+			{
+				pdu->len = len;
+				instance->mac->push_rx_buffer(pdu);
+			}
+			else
+			{
+				instance->mac->release_mac_pdu(pdu);
+			}
+		}
+		return 0;
+	}
+
+	void mac_start_data(mac_t* mac, unsigned rx_port, const char* tx_address, unsigned tx_port)
+	{
+		mac_internal_t* instance = (mac_internal_t*)mac;
+
+		printf("[MAC] Rx Data from %d\n", rx_port);
+		printf("[MAC] Tx Data to %s.%d\n", tx_address, tx_port);
+
+		instance->rx_sock = socket(AF_INET, SOCK_DGRAM, 0);
+		
+		if(instance->rx_sock < 0)
+		{
+			printf("[MAC] Failed to create socket\n");
+			return;
+		}
+
+		struct sockaddr_in addr;
+		memset(&addr, 0, sizeof(0));
+		addr.sin_family = AF_INET;
+		addr.sin_port = htons(rx_port);
+		addr.sin_addr.s_addr = INADDR_ANY;
+		
+		if(bind(instance->rx_sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
+		{
+			printf("[MAC] Failed to bind to %d\n", rx_port);
+			close(instance->rx_sock);
+			return;
+		}
+
+		pthread_t mac_rx_thread;
+		pthread_create(&mac_rx_thread, NULL, &mac_rx_thread_start, instance);
+
+		instance->tx_sock = socket(AF_INET, SOCK_DGRAM, 0);
+		instance->tx_addr.sin_family = AF_INET;
+		instance->tx_addr.sin_port = htons(tx_port);
+		instance->tx_addr.sin_addr.s_addr = inet_addr(tx_address);
+	}
+
+
+	
+	void generate_test_subframe(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf)	
+	{
+		//mac_internal_t* instance = (mac_internal_t*)mac;
+		
+		uint8_t max_num_dl_pdus = 50;
+		nfapi_dl_config_request_pdu_t dl_config_pdus[max_num_dl_pdus];
+		memset(&dl_config_pdus, 0, sizeof(dl_config_pdus));
+		
+		nfapi_dl_config_request_t dl_config_req;
+		memset(&dl_config_req, 0, sizeof(dl_config_req));
+		dl_config_req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
+		dl_config_req.header.phy_id = phy_id;
+		dl_config_req.sfn_sf = sfn_sf;
+		dl_config_req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+		
+		dl_config_req.dl_config_request_body.number_pdu = rand_range(4, max_num_dl_pdus);
+		
+		uint16_t i = 0;
+		for(i = 0; i < dl_config_req.dl_config_request_body.number_pdu; ++i)
+		{
+			dl_config_pdus[i].pdu_type = rand_range(0, 11);
+			
+			switch(dl_config_pdus[i].pdu_type)
+			{
+				case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
+				{
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.dci_format = rand_range(0, 9);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = rand_range(0, 255);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level  = rand_range(0, 32);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti = rand_range(0, (uint16_t)-1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = rand_range(0, 320000);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = rand_range(0, 31);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = rand_range(0, 3);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = rand_range(0, 31);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = rand_range(0, 31);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_2 = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.harq_process = rand_range(0, 31);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tpmi = rand_range(0, 15);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.pmi = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.precoding_information = rand_range(0, 63);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tpc = rand_range(0, 3);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = rand_range(0, 15);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.ngap = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transport_block_size_index = rand_range(0, 31);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.downlink_power_offset = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.allocate_prach_flag = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.preamble_index = rand_range(0, 63);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.prach_mask_index = rand_range(0, 15);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = rand_range(0, 3);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = rand_range(0, 10000);		
+					
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG;
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.mcch_flag = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.mcch_change_notification = rand_range(0, 255);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.scrambling_identity = rand_range(0, 1);
+					
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG;
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.carrier_indicator = rand_range(0, 7);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.srs_flag = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.srs_request = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.antenna_ports_scrambling_and_layers = rand_range(0, 15);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.n_dl_rb = rand_range(0, 100);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG;
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.harq_ack_resource_offset = rand_range(0, 3);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.pdsch_re_mapping_quasi_co_location_indicator = rand_range(0, 3);
+					
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG;
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.primary_cell_type = rand_range(0, 2);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_flag = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.number_ul_dl_configurations = 2;
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_indication[0] = rand_range(1, 5);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_indication[1] = rand_range(1, 5);
+					
+					
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG;
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.laa_end_partial_sf_flag = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.laa_end_partial_sf_configuration = rand_range(0, 255);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.codebook_size_determination = rand_range(0, 1);
+					dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.drms_table_flag = rand_range(0, 1);
+					
+					// if the tpm extention is present of not.
+					if(rand_range(0, 1))
+					{
+						dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag = rand_range(0, 1);
+						dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_prb_per_subband = rand_range(0, 8);
+						dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands = rand_range(0, 13);
+						dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas = 1; // rand_range(0, 8);
+						
+						for(int j = 0; j < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands; ++j)
+						{
+							dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].subband_index = j;
+							dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].scheduled_ues = 1; //rand_range(1, 4);
+							
+							for(int k = 0; k < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas; ++k)
+								for(int l = 0; l < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].scheduled_ues; ++l)
+									dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].precoding_value[k][l] = rand_range(0, 65535);
+						}
+					}
+					else
+					{
+						dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag = 0;
+					}
+					
+				}
+				break;
+				
+				case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
+				{
+					dl_config_pdus[i].bch_pdu.bch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
+					dl_config_pdus[i].bch_pdu.bch_pdu_rel8.length = rand_range(0, 42);
+					dl_config_pdus[i].bch_pdu.bch_pdu_rel8.pdu_index = rand_range(0, 65535);
+					dl_config_pdus[i].bch_pdu.bch_pdu_rel8.transmission_power = rand_range(0, 10000);
+				}
+				break;
+				
+				case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
+				{
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG;
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.length = rand_range(0, 42);
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.pdu_index = rand_range(0, 65535);
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.rnti = 0xFFFD;
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.resource_allocation_type = 0;
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.resource_block_coding = 0;
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.modulation = rand_range(0, 8);
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.transmission_power = rand_range(0, 10000);
+					dl_config_pdus[i].mch_pdu.mch_pdu_rel8.mbsfn_area_id = rand_range(0, 255);
+				}
+				break;
+			
+				case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
+				{
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.length = rand_range(0, 42);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.pdu_index = rand_range(0, 65535);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.rnti = rand_range(1, 65535);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = rand_range(0, 5);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = rand_range(0, 32000);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.modulation = rand_range(2, 8);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rand_range(0, 3);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transport_blocks = rand_range(1, 2);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = rand_range(0, 13);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.number_of_layers = rand_range(1, 8);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 2; //rand_range(0, 13);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.codebook_index[0] = rand_range(0, 15);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.codebook_index[1] = rand_range(0, 15);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = rand_range(0, 14);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.pa = rand_range(0, 7);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.ngap = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.nprb = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transmission_mode = rand_range(1, 10);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 2; //rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 2; //rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].subband_index = rand_range(0, 4);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].num_antennas = 1;	
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].bf_value[0] = rand_range(0, 128);	
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].subband_index = rand_range(0, 4);	
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].num_antennas = 1;
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].bf_value[0] = rand_range(0, 128);	
+					
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG;
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel9.nscid = rand_range(0, 1);	
+					
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_flag = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_resource_config_r10 = 0;
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_zero_tx_power_resource_config_bitmap_r10 = rand_range(0, 65535);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_number_nzp_configuration = 1;
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_resource_config[0] = rand_range(0, 31);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.pdsch_start = rand_range(0, 4);		
+					
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG;
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.drms_config_flag = rand_range(0, 1);	
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.drms_scrambling = rand_range(0, 503);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.csi_config_flag = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.csi_scrambling = rand_range(0, 503);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_flag = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_atenna_ports = rand_range(1,4);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_freq_shift = rand_range(0, 5);
+					
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG;
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.altcqi_table_r12 = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.maxlayers = rand_range(1, 8);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.n_dl_harq = rand_range(0, 255);
+					
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.dwpts_symbols = rand_range(3, 14);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.ue_type = rand_range(0, 2);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = rand_range(0, 2);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
+					dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = rand_range(0, 1);
+				}
+				break;
+			
+				case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
+				{
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG;
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.length = rand_range(0, 42);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.pdu_index = rand_range(0, 65535);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.p_rnti = 0xFFFE;
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.resource_allocation_type = rand_range(2, 6);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.resource_block_coding = rand_range(0, 34000);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.mcs = 0;
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.redundancy_version = 0;
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.number_of_transport_blocks = 1;
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transmission_scheme = rand_range(1, 6);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.number_of_layers = rand_range(1, 4);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.codebook_index = 0;
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.ue_category_capacity = rand_range(0, 14);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.pa = rand_range(0, 7);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transmission_power = rand_range(0, 10000);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.nprb = rand_range(0, 1);
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel8.ngap = rand_range(0, 1);	
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG;
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel13.ue_mode = rand_range(0, 1);	
+					dl_config_pdus[i].pch_pdu.pch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
+				}
+				break;
+			
+				case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
+				{
+					dl_config_pdus[i].prs_pdu.prs_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG;
+					dl_config_pdus[i].prs_pdu.prs_pdu_rel9.transmission_power = rand_range(0, 10000);	
+					dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_bandwidth = rand_range(6, 100);
+					dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_cyclic_prefix_type = rand_range(0, 1);
+					dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_muting = rand_range(0, 1);
+				}
+				break;
+	
+				case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
+				{
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG;
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_antenna_port_count_r10 = rand_range(1, 16);
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config_r10 = 0;
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.transmission_power = rand_range(0, 10000);
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_zero_tx_power_resource_config_bitmap_r10 = rand_range(0, 8);
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_number_of_nzp_configuration = 2;
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config[0] = rand_range(0, 31);
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config[1] = rand_range(0, 31);
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG;
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.csi_rs_class = rand_range(0, 2);
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.cdm_type = rand_range(0, 1);
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.num_bf_vector = 0; // set to zero as not clear how to handle bf value array
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.bf_vector[0].csi_rs_resource_index = rand_range(0, 7);
+					dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.bf_vector[0].bf_value[0] = 42;
+				}
+				break;
+	
+				case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
+				{
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG;
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.dci_format = rand_range(0, 9);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.cce_idx = rand_range(0, 255);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.aggregation_level  = rand_range(0, 32);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.rnti = rand_range(0, (uint16_t)-1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.resource_allocation_type = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.resource_block_coding = rand_range(0, 320000);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.mcs_1 = rand_range(0, 31);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.redundancy_version_1 = rand_range(0, 3);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.new_data_indicator_1 = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.mcs_2 = rand_range(0, 31);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.redundancy_version_2 = rand_range(0, 31);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.new_data_indicator_2 = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.harq_process = rand_range(0, 31);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tpmi = rand_range(0, 15);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.pmi = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.precoding_information = rand_range(0, 63);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tpc = rand_range(0, 3);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.downlink_assignment_index = rand_range(0, 15);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.ngap = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transport_block_size_index = rand_range(0, 31);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.downlink_power_offset = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.allocate_prach_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.preamble_index = rand_range(0, 63);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.prach_mask_index = rand_range(0, 15);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.rnti_type = rand_range(0, 3);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transmission_power = rand_range(0, 10000);	
+					
+					
+					
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG;
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.mcch_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.mcch_change_notification = rand_range(0, 255);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.scrambling_identity = rand_range(0, 1);
+					
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG;
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.carrier_indicator = rand_range(0, 7);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.srs_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.srs_request = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.antenna_ports_scrambling_and_layers = rand_range(0, 15);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.n_dl_rb = rand_range(0, 100);
+					
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG;
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.harq_ack_resource_offset = rand_range(0, 3);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.pdsch_re_mapping_quasi_co_location_indicator = rand_range(0, 3);
+					
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG;
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.primary_cell_type = rand_range(0, 2);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.number_ul_dl_configurations = 2;
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_indication[0] = rand_range(1, 5);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_indication[1] = rand_range(1, 5);
+					
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG;
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.laa_end_partial_sf_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.laa_end_partial_sf_configuration = rand_range(0, 255);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.codebook_size_determination = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.drms_table_flag = rand_range(0, 1);
+
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG;
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_resource_assignment_flag = rand_range(0, 1);
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_id = rand_range(0, 503);
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_start_symbol = rand_range(1, 4);
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb = rand_range(2, 8);
+					for(int j = 0; j < dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb; ++j)
+						dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_prb_index[j] = rand_range(0, 99);
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.subband_index = rand_range(0, 25);	
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.num_antennas= rand_range(1, 4);
+					for(int j = 0; j < dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb; ++j)
+						dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.bf_value[j] = rand_range(0, 65535);
+					
+	
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG;
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.dwpts_symbols = rand_range(3, 14);
+					dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.initial_lbt_sf = rand_range(0, 1);
+				}
+				break;
+				
+				case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
+				{
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG;
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = rand_range(0, 15);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = rand_range(2, 6);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = rand_range(0, 14);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = rand_range(1, 4);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = rand_range(0, 22);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = rand_range(2, 24);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = rand_range(0, 4);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.rnti = rand_range(1, 65535);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = rand_range(1, 2);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = rand_range(0, 503);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = rand_range(0, 10000);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.dci_format = rand_range(10, 12);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = rand_range(0, 0xFFFF);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mcs = rand_range(0, 15);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = rand_range(1, 8);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = rand_range(0, 3);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.harq_process = rand_range(0, 15);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = rand_range(0, 4);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpmi = rand_range(0, 15);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pmi = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = rand_range(0, 3);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rand_range(1, 4);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpc = rand_range(0, 3);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = rand_range(0, 4);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = rand_range(0, 15);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = rand_range(0, 63);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = rand_range(0, 15);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = rand_range(0, 3);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.srs_request = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = rand_range(0, 3);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = rand_range(0, 255);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = rand_range(0, 1);
+					dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = rand_range(0, 8);
+					for(int j = 0 ; j < dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports; ++j)
+						dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.precoding_value[j] = rand_range(0, 65535);
+				}
+				break;
+				
+				case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
+				{
+					dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG;
+					dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.length = rand_range(0, 5555);
+					dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.pdu_index = rand_range(0, 65535);
+					dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.transmission_power = rand_range(0, 10000);
+					dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.hyper_sfn_2_lsbs = rand_range(0, 3);
+				}
+				break;
+				
+				case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
+				{
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG;
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.length = rand_range(0, 5555);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.pdu_index = rand_range(0, 65535);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.ncce_index = rand_range(0, 1);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.aggregation_level = rand_range(1, 2);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.start_symbol = rand_range(0, 4);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.rnti_type = rand_range(0, 3);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.rnti = rand_range(1, 65535);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.scrambling_reinitialization_batch_index = rand_range(1, 4);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.dci_format = rand_range(0, 1);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.scheduling_delay = rand_range(0, 7);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.resource_assignment = rand_range(0, 7);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.repetition_number = rand_range(0, 15); 
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.mcs = rand_range(0, 13);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.new_data_indicator = rand_range(0, 1);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = rand_range(0, 15);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = rand_range(0, 1);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.starting_number_of_nprach_repetitions = rand_range(0, 3);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.subcarrier_indication_of_nprach = rand_range(0, 63);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.paging_direct_indication_differentation_flag = rand_range(0, 1);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.direct_indication = rand_range(0, 255);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number  = rand_range(0, 7);
+					dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.total_dci_length_including_padding = rand_range(0, 255);
+				}
+				break;
+				
+				case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
+				{
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG;
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.length = rand_range(0, 5555);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.pdu_index = rand_range(0, 65535);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.start_symbol = rand_range(0, 4);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.rnti_type = rand_range(0, 1);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.rnti = rand_range(1, 65535);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment = rand_range(0, 7);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.repetition_number = rand_range(0, 15);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = rand_range(1, 10);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.scrambling_sequence_initialization_cinit = rand_range(0, 65535);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.sf_idx = rand_range(1, 10240);
+					dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
+				}
+				break;
+				
+			};
+		}
+
+
+		dl_config_req.dl_config_request_body.dl_config_pdu_list = dl_config_pdus;		
+		mac->dl_config_req(mac, &dl_config_req);
+		
+		uint8_t num_ul_pdus = 18;
+		nfapi_ul_config_request_pdu_t ul_config_pdus[num_ul_pdus];
+		memset(&ul_config_pdus, 0, sizeof(ul_config_pdus));
+		
+		nfapi_ul_config_request_t ul_config_req;
+		memset(&ul_config_req, 0, sizeof(ul_config_req));
+		ul_config_req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
+		ul_config_req.header.phy_id = phy_id;
+		ul_config_req.sfn_sf = sfn_sf;
+		ul_config_req.ul_config_request_body.tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+		ul_config_req.ul_config_request_body.number_of_pdus = num_ul_pdus;
+		ul_config_req.ul_config_request_body.rach_prach_frequency_resources = rand_range(0, 255);
+		ul_config_req.ul_config_request_body.srs_present = rand_range(0, 1);
+		
+		auto ul_config_ulsch_pdu_test_gen = [](nfapi_ul_config_ulsch_pdu& ulsch_pdu)
+		{
+			ulsch_pdu.ulsch_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
+			ulsch_pdu.ulsch_pdu_rel8.handle = rand_range(0, 50000);
+			ulsch_pdu.ulsch_pdu_rel8.size = rand_range(0, 32000);
+			ulsch_pdu.ulsch_pdu_rel8.rnti = rand_range(1, 65535);
+			ulsch_pdu.ulsch_pdu_rel8.resource_block_start = rand_range(0, 99);
+			ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks = rand_range(1, 100);
+			ulsch_pdu.ulsch_pdu_rel8.modulation_type = rand_range(2, 6);
+			ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
+			ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
+			ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
+			ulsch_pdu.ulsch_pdu_rel8.new_data_indication = rand_range(0, 1);
+			ulsch_pdu.ulsch_pdu_rel8.redundancy_version = rand_range(0, 3);
+			ulsch_pdu.ulsch_pdu_rel8.harq_process_number = rand_range(0, 15);
+			ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode = rand_range(0, 1);
+			ulsch_pdu.ulsch_pdu_rel8.current_tx_nb = rand_range(0, 5);
+			ulsch_pdu.ulsch_pdu_rel8.n_srs = rand_range(0, 1);
+			ulsch_pdu.ulsch_pdu_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG;
+			ulsch_pdu.ulsch_pdu_rel10.resource_allocation_type = rand_range(0, 1);
+			ulsch_pdu.ulsch_pdu_rel10.resource_block_coding = rand_range(0, 35000);
+			ulsch_pdu.ulsch_pdu_rel10.transport_blocks = rand_range(1, 2);
+			ulsch_pdu.ulsch_pdu_rel10.transmission_scheme = rand_range(0, 1);
+			ulsch_pdu.ulsch_pdu_rel10.number_of_layers = rand_range(1, 4);
+			ulsch_pdu.ulsch_pdu_rel10.codebook_index = rand_range(0, 23);
+			ulsch_pdu.ulsch_pdu_rel10.disable_sequence_hopping_flag = rand_range(0, 1);		
+			ulsch_pdu.ulsch_pdu_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG;
+			ulsch_pdu.ulsch_pdu_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
+			ulsch_pdu.ulsch_pdu_rel11.npusch_identity = rand_range(0, 509);
+			ulsch_pdu.ulsch_pdu_rel11.dmrs_config_flag = rand_range(0, 1);
+			ulsch_pdu.ulsch_pdu_rel11.ndmrs_csh_identity = rand_range(0, 509);
+			ulsch_pdu.ulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG;
+			ulsch_pdu.ulsch_pdu_rel13.ue_type = rand_range(0, 2);
+			ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = rand_range(1, 2048);
+			ulsch_pdu.ulsch_pdu_rel13.repetition_number = rand_range(1, 2048);
+			ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
+			ulsch_pdu.ulsch_pdu_rel13.empty_symbols_due_to_re_tunning = rand_range(0, 8);
+		};
+		
+		auto ul_config_cqi_ri_info_test_gen = [](nfapi_ul_config_cqi_ri_information& cqi_ri_information)
+		{
+			cqi_ri_information.cqi_ri_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG;
+			cqi_ri_information.cqi_ri_information_rel8.dl_cqi_pmi_size_rank_1 = rand_range(0, 255);
+			cqi_ri_information.cqi_ri_information_rel8.dl_cqi_pmi_size_rank_greater_1 = rand_range(0, 255);
+			cqi_ri_information.cqi_ri_information_rel8.ri_size = rand_range(0, 3);
+			cqi_ri_information.cqi_ri_information_rel8.delta_offset_cqi = rand_range(0, 15);
+			cqi_ri_information.cqi_ri_information_rel8.delta_offset_ri = rand_range(0, 15);
+
+			cqi_ri_information.cqi_ri_information_rel9.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG;
+			cqi_ri_information.cqi_ri_information_rel9.report_type = 1; // rand_range(0, 1);
+			cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi = rand_range(0, 15);
+			cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri = rand_range(0, 15);
+			
+			if(cqi_ri_information.cqi_ri_information_rel9.report_type == 0)
+			{
+				cqi_ri_information.cqi_ri_information_rel9.periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size = rand_range(0, 255);
+				cqi_ri_information.cqi_ri_information_rel9.periodic_cqi_pmi_ri_report.control_type = rand_range(0, 1);
+			}
+			else
+			{
+				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.number_of_cc = 1;
+				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = rand_range(0, 3);
+				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[0] = rand_range(0, 255);
+			}
+			
+			cqi_ri_information.cqi_ri_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG;
+			cqi_ri_information.cqi_ri_information_rel13.report_type = rand_range(0, 1);
+			
+			if(cqi_ri_information.cqi_ri_information_rel13.report_type == 0)
+			{
+				cqi_ri_information.cqi_ri_information_rel13.periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2 = rand_range(255, 10000);
+			}
+		};
+		
+		auto ul_config_init_tx_params_test_gen = [](nfapi_ul_config_initial_transmission_parameters& initial_transmission_parameters)
+		{
+			initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
+			initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = rand_range(0, 1);
+			initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rand_range(1, 100);
+		};
+		
+		auto ul_config_harqinfo_test_gen = [](nfapi_ul_config_ulsch_harq_information& harq_information)
+		{
+			harq_information.harq_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG;
+			harq_information.harq_information_rel10.harq_size = rand_range(0, 21);
+			harq_information.harq_information_rel10.delta_offset_harq = rand_range(0, 15);
+			harq_information.harq_information_rel10.ack_nack_mode = rand_range(0, 5);
+			harq_information.harq_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG;
+			harq_information.harq_information_rel13.harq_size_2 = rand_range(0, 21);
+			harq_information.harq_information_rel13.delta_offset_harq_2 = rand_range(0, 15);	
+		};
+
+		auto ul_config_sr_info_test_gen = [](nfapi_ul_config_sr_information& sr_info)
+		{
+			sr_info.sr_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG;
+			sr_info.sr_information_rel8.pucch_index = rand_range(0, 2047);
+			sr_info.sr_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG;
+			sr_info.sr_information_rel10.number_of_pucch_resources = rand_range(1, 2);
+			sr_info.sr_information_rel10.pucch_index_p1 = rand_range(0, 2047);
+		};
+		
+		auto ul_config_ue_info_test_gen = [](nfapi_ul_config_ue_information& ue_information)
+		{
+			ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+			ue_information.ue_information_rel8.handle = rand_range(0, 99999);
+			ue_information.ue_information_rel8.rnti = rand_range(1, 65535);
+			ue_information.ue_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG;
+			ue_information.ue_information_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
+			ue_information.ue_information_rel11.npusch_identity = rand_range(0, 503);
+			ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
+			ue_information.ue_information_rel13.ue_type = rand_range(0, 2);
+			ue_information.ue_information_rel13.empty_symbols = rand_range(0, 2);
+			ue_information.ue_information_rel13.total_number_of_repetitions = rand_range(1, 32);
+			ue_information.ue_information_rel13.repetition_number = rand_range(1, 32);
+		};
+		
+		auto ul_config_cqi_info_test_gen = [](nfapi_ul_config_cqi_information& cqi_information)
+		{
+			cqi_information.cqi_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG;
+			cqi_information.cqi_information_rel8.pucch_index = rand_range(0, 1184);
+			cqi_information.cqi_information_rel8.dl_cqi_pmi_size = rand_range(0, 255);
+			cqi_information.cqi_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG;
+			cqi_information.cqi_information_rel10.number_of_pucch_resource = rand_range(1, 2);
+			cqi_information.cqi_information_rel10.pucch_index_p1 = rand_range(0, 1184);
+			cqi_information.cqi_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG;
+			cqi_information.cqi_information_rel13.csi_mode = rand_range(0, 2);
+			cqi_information.cqi_information_rel13.dl_cqi_pmi_size_2 = rand_range(0, 999);
+			cqi_information.cqi_information_rel13.starting_prb = rand_range(0, 109);
+			cqi_information.cqi_information_rel13.n_prb = rand_range(0, 7);
+			cqi_information.cqi_information_rel13.cdm_index = rand_range(0, 1);
+			cqi_information.cqi_information_rel13.n_srs = rand_range(0, 1);
+		};
+		
+		auto ul_config_harq_info_test_gen = [](nfapi_ul_config_harq_information& harq_information)
+		{
+			harq_information.harq_information_rel10_tdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG;
+			harq_information.harq_information_rel10_tdd.harq_size = rand_range(0, 21);
+			harq_information.harq_information_rel10_tdd.ack_nack_mode = rand_range(0, 5);
+			harq_information.harq_information_rel10_tdd.number_of_pucch_resources = rand_range(0, 4);
+			harq_information.harq_information_rel10_tdd.n_pucch_1_0 = rand_range(0, 2047);
+			harq_information.harq_information_rel10_tdd.n_pucch_1_1 = rand_range(0, 2047);
+			harq_information.harq_information_rel10_tdd.n_pucch_1_2 = rand_range(0, 2047);
+			harq_information.harq_information_rel10_tdd.n_pucch_1_3 = rand_range(0, 2047);
+			harq_information.harq_information_rel8_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG;
+			harq_information.harq_information_rel8_fdd.n_pucch_1_0 = rand_range(0, 2047);
+			harq_information.harq_information_rel8_fdd.harq_size = rand_range(1, 2);
+			harq_information.harq_information_rel9_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG;
+			harq_information.harq_information_rel9_fdd.harq_size = rand_range(1, 10);
+			harq_information.harq_information_rel9_fdd.ack_nack_mode = rand_range(0, 4);
+			harq_information.harq_information_rel9_fdd.number_of_pucch_resources = rand_range(0, 4);
+			harq_information.harq_information_rel9_fdd.n_pucch_1_0 = rand_range(0, 2047);
+			harq_information.harq_information_rel9_fdd.n_pucch_1_1 = rand_range(0, 2047);
+			harq_information.harq_information_rel9_fdd.n_pucch_1_2 = rand_range(0, 2047);
+			harq_information.harq_information_rel9_fdd.n_pucch_1_3 = rand_range(0, 2047);
+			harq_information.harq_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG;
+			harq_information.harq_information_rel11.num_ant_ports = rand_range(1, 2);
+			harq_information.harq_information_rel11.n_pucch_2_0 = rand_range(0, 2047);
+			harq_information.harq_information_rel11.n_pucch_2_1 = rand_range(0, 2047);
+			harq_information.harq_information_rel11.n_pucch_2_2 = rand_range(0, 2047);
+			harq_information.harq_information_rel11.n_pucch_2_3 = rand_range(0, 2047);
+			harq_information.harq_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG;
+			harq_information.harq_information_rel13.harq_size_2 = rand_range(0, 999);
+			harq_information.harq_information_rel13.starting_prb = rand_range(0, 109);
+			harq_information.harq_information_rel13.n_prb = rand_range(0, 7);
+			harq_information.harq_information_rel13.cdm_index = rand_range(0, 1);
+			harq_information.harq_information_rel13.n_srs = rand_range(0, 1);
+		};		
+		
+		
+		ul_config_pdus[0].pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
+		ul_config_ulsch_pdu_test_gen(ul_config_pdus[0].ulsch_pdu);
+
+		ul_config_pdus[1].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE;
+		ul_config_ulsch_pdu_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.ulsch_pdu);
+		ul_config_cqi_ri_info_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.cqi_ri_information);
+		ul_config_init_tx_params_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.initial_transmission_parameters);	
+
+		ul_config_pdus[2].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
+		ul_config_ulsch_pdu_test_gen(ul_config_pdus[2].ulsch_harq_pdu.ulsch_pdu);
+		ul_config_harqinfo_test_gen(ul_config_pdus[2].ulsch_harq_pdu.harq_information);
+		ul_config_init_tx_params_test_gen(ul_config_pdus[2].ulsch_harq_pdu.initial_transmission_parameters);
+		
+		ul_config_pdus[3].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
+		ul_config_ulsch_pdu_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.ulsch_pdu);		
+		ul_config_cqi_ri_info_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.cqi_ri_information);	
+		ul_config_harqinfo_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.harq_information);
+		ul_config_init_tx_params_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters);
+		
+		
+		ul_config_pdus[4].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE;
+		ul_config_ue_info_test_gen(ul_config_pdus[4].uci_cqi_pdu.ue_information);
+		ul_config_cqi_info_test_gen(ul_config_pdus[4].uci_cqi_pdu.cqi_information);
+
+		ul_config_pdus[5].pdu_type = NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE;
+		ul_config_ue_info_test_gen(ul_config_pdus[5].uci_sr_pdu.ue_information);
+		ul_config_sr_info_test_gen(ul_config_pdus[5].uci_sr_pdu.sr_information);
+
+		
+		ul_config_pdus[6].pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
+		ul_config_ue_info_test_gen(ul_config_pdus[6].uci_harq_pdu.ue_information);
+		ul_config_harq_info_test_gen(ul_config_pdus[6].uci_harq_pdu.harq_information);
+		
+		
+		ul_config_pdus[7].pdu_type = NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE;
+		ul_config_ue_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.ue_information);
+		ul_config_sr_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.sr_information);
+		ul_config_harq_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.harq_information);
+		
+		ul_config_pdus[8].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE;
+		ul_config_ue_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.ue_information);
+		ul_config_cqi_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.cqi_information);
+		ul_config_harq_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.harq_information);
+		
+		ul_config_pdus[9].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE;
+		ul_config_ue_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.ue_information);
+		ul_config_cqi_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.cqi_information);
+		ul_config_sr_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.sr_information);
+		
+		ul_config_pdus[10].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE;
+		ul_config_ue_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.ue_information);
+		ul_config_cqi_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.cqi_information);
+		ul_config_sr_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.sr_information);
+		ul_config_harq_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.harq_information);
+		
+		ul_config_pdus[11].pdu_type = NFAPI_UL_CONFIG_SRS_PDU_TYPE;
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG;
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.handle = rand_range(0, 9999);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.size = rand_range(1, 999);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.rnti = rand_range(1, 65535);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.srs_bandwidth = rand_range(0, 3);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.frequency_domain_position = rand_range(0, 23);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.srs_hopping_bandwidth = rand_range(0, 3);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.transmission_comb = rand_range(0, 3);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.i_srs = rand_range(0, 1023);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel8.sounding_reference_cyclic_shift = rand_range(0, 11);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG;
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel10.antenna_port = rand_range(0, 2);
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG;
+		ul_config_pdus[11].srs_pdu.srs_pdu_rel13.number_of_combs = rand_range(0, 1);
+		
+		ul_config_pdus[12].pdu_type = NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE;
+		ul_config_ue_info_test_gen(ul_config_pdus[12].harq_buffer_pdu.ue_information);		
+		
+		ul_config_pdus[13].pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE;
+		ul_config_ulsch_pdu_test_gen(ul_config_pdus[13].ulsch_uci_csi_pdu.ulsch_pdu);
+		ul_config_cqi_info_test_gen(ul_config_pdus[13].ulsch_uci_csi_pdu.csi_information);
+		
+		ul_config_pdus[14].pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE;
+		ul_config_ulsch_pdu_test_gen(ul_config_pdus[14].ulsch_uci_harq_pdu.ulsch_pdu);
+		ul_config_harq_info_test_gen(ul_config_pdus[14].ulsch_uci_harq_pdu.harq_information);
+		
+		ul_config_pdus[15].pdu_type = NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE;
+		ul_config_ulsch_pdu_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.ulsch_pdu);
+		ul_config_cqi_info_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.csi_information);
+		ul_config_harq_info_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.harq_information);
+		
+		ul_config_pdus[16].pdu_type = NFAPI_UL_CONFIG_NULSCH_PDU_TYPE;
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG;
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nulsch_format = rand_range(0, 1);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.handle = rand_range(0, 0xFFFF);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.size = rand_range(0, 65535);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.rnti = rand_range(1, 65535);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.subcarrier_indication = rand_range(0, 47);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.resource_assignment = rand_range(0, 7);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.mcs = rand_range(0, 12);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.redudancy_version = rand_range(0, 1);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.repetition_number = rand_range(0, 7);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.new_data_indication = rand_range(0, 1);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.n_srs = rand_range(0, 1);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.scrambling_sequence_initialization_cinit = rand_range(0, 65535);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.sf_idx = rand_range(0, 40960);
+		
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.handle = rand_range(0, 0xFF);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.rnti = rand_range(1, 65535);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG;
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.npusch_identity = rand_range(0, 503);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.ue_type = rand_range(0, 2);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.empty_symbols = rand_range(0, 0x3);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.total_number_of_repetitions = rand_range(1, 32);
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.repetition_number = rand_range(1, 32);
+		
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG;
+		ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.harq_ack_resource = rand_range(0, 15);
+		
+		ul_config_pdus[17].pdu_type = NFAPI_UL_CONFIG_NRACH_PDU_TYPE;
+		ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG;
+		ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_0 = rand_range(0, 1);
+		ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_1 = rand_range(0, 1);
+		ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_2 = rand_range(0, 1);
+		
+		ul_config_req.ul_config_request_body.ul_config_pdu_list = ul_config_pdus;	
+		mac->ul_config_req(mac, &ul_config_req);
+		
+		
+		uint8_t num_dci_pdus = 4;
+		uint8_t num_hi_pdus = 1;
+		nfapi_hi_dci0_request_pdu_t hi_dci0_pdus[num_dci_pdus + num_hi_pdus];
+		memset(&hi_dci0_pdus, 0, sizeof(hi_dci0_pdus));
+		
+		nfapi_hi_dci0_request_t hi_dci0_req;
+		memset(&hi_dci0_req, 0, sizeof(hi_dci0_req));
+		hi_dci0_req.header.message_id = NFAPI_HI_DCI0_REQUEST;
+		hi_dci0_req.header.phy_id = phy_id;
+		hi_dci0_req.sfn_sf = sfn_sf;
+		
+		hi_dci0_req.hi_dci0_request_body.tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
+		hi_dci0_req.hi_dci0_request_body.sfnsf = sfn_sf;
+		hi_dci0_req.hi_dci0_request_body.number_of_dci = num_dci_pdus;
+		hi_dci0_req.hi_dci0_request_body.number_of_hi = num_hi_pdus;
+		
+		hi_dci0_pdus[0].pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.resource_block_start = rand_range(0, 100);
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.hi_value = rand_range(0, 1);
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.i_phich = rand_range(0, 1);
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.transmission_power = rand_range(0, 10000);
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG;	
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.flag_tb2 = rand_range(0, 1);
+		hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.hi_value_2 = rand_range(0, 1);
+		
+		hi_dci0_pdus[1].pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG;
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.dci_format = rand_range(0, 4);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cce_index = rand_range(0, 88);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.aggregation_level = rand_range(1, 8);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.rnti = rand_range(1, 65535);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.resource_block_start = rand_range(0, 100);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.number_of_resource_block = rand_range(0, 100);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.mcs_1 = rand_range(0, 31);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.new_data_indication_1 = rand_range(0, 1);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.ue_tx_antenna_seleciton = rand_range(0, 2);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tpc = rand_range(0, 3);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cqi_csi_request = rand_range(0, 7);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.ul_index = rand_range(0, 3);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.dl_assignment_index = rand_range(1, 4);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tpc_bitmap = rand_range(0, 9999);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.transmission_power = rand_range(0, 10000);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG;
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.carrier_indicator = rand_range(0, 7);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.size_of_cqi_csi_feild = rand_range(0, 2);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.srs_flag = rand_range(0, 1);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.srs_request = rand_range(0, 1);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_allocation_flag = rand_range(0, 1);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_allocation_type = rand_range(0, 1);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_block_coding = rand_range(0, 9999);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.mcs_2 = rand_range(0, 31);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.new_data_indication_2 = rand_range(0, 1);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.number_of_antenna_ports = rand_range(0, 2);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.tpmi = rand_range(0, 63);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.n_ul_rb = rand_range(6, 100);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG;
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.pscch_resource = rand_range(0, 16);
+		hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.time_resource_pattern = rand_range(0, 32);
+		
+		
+		hi_dci0_pdus[2].pdu_type = NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE;
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG;
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.dci_format = rand_range(0, 4);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cce_index = rand_range(0, 88);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.aggregation_level = rand_range(1, 8);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.rnti = rand_range(1, 65535);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.resource_block_start = rand_range(0, 100);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.number_of_resource_block = rand_range(0, 100);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.mcs_1 = rand_range(0, 31);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.new_data_indication_1 = rand_range(0, 1);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.ue_tx_antenna_seleciton = rand_range(0, 2);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tpc = rand_range(0, 3);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cqi_csi_request = rand_range(0, 7);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.ul_index = rand_range(0, 3);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.dl_assignment_index = rand_range(1, 4);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tpc_bitmap = rand_range(0, 9999);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.transmission_power = rand_range(0, 10000);		
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG;
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.carrier_indicator = rand_range(0, 7);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.size_of_cqi_csi_feild = rand_range(0, 2);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.srs_flag = rand_range(0, 1);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.srs_request = rand_range(0, 1);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_allocation_flag = rand_range(0, 1);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_allocation_type = rand_range(0, 1);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_block_coding = rand_range(0, 9999);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.mcs_2 = rand_range(0, 31);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.new_data_indication_2 = rand_range(0, 1);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.number_of_antenna_ports = rand_range(0, 2);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.tpmi = rand_range(0, 63);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.n_ul_rb = rand_range(6, 100);			
+		hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_parameters_rel11.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG;
+		
+		hi_dci0_pdus[3].pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
+		hi_dci0_pdus[3].mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tl.tag = NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG;
+
+		hi_dci0_pdus[4].pdu_type = NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE;
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.tl.tag = NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG;
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.ncce_index = rand_range(0, 1);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level = rand_range(1, 2);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.start_symbol = rand_range(0, 4);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti = rand_range(1, 65535);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scrambling_reinitialization_batch_index = rand_range(1, 4);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.subcarrier_indication = rand_range(0, 63);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.resource_assignment = rand_range(0, 7);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scheduling_delay = rand_range(0, 3);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.mcs = rand_range(0, 12);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.redudancy_version = rand_range(0, 1);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.repetition_number = rand_range(0, 7);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.new_data_indicator = rand_range(0, 1);
+		hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number = rand_range(0, 3);
+		
+		hi_dci0_req.hi_dci0_request_body.hi_dci0_pdu_list = hi_dci0_pdus;
+		mac->hi_dci0_req(mac, &hi_dci0_req);
+
+		uint8_t num_tx_pdus = 2;
+		nfapi_tx_request_pdu_t tx_pdus[num_tx_pdus];
+		memset(&tx_pdus, 0, sizeof(tx_pdus));
+		
+		nfapi_tx_request_t tx_req;
+		memset(&tx_req, 0, sizeof(tx_req));
+		tx_req.header.message_id = NFAPI_TX_REQUEST;
+		tx_req.header.phy_id = phy_id;
+		tx_req.sfn_sf = sfn_sf;
+		
+		tx_req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+		tx_req.tx_request_body.number_of_pdus = num_tx_pdus;
+		
+		uint32_t data[2];
+		data[0] = 0x11223344;
+		data[1] = 0x55667788;
+		
+		tx_pdus[0].pdu_length = 8;
+		tx_pdus[0].pdu_index = 1;
+		tx_pdus[0].num_segments = 2;
+		tx_pdus[0].segments[0].segment_length = 4;
+		tx_pdus[0].segments[0].segment_data = (uint8_t*)&data[0];
+		tx_pdus[0].segments[1].segment_length = 4;
+		tx_pdus[0].segments[1].segment_data = (uint8_t*)&data[1];
+		
+		tx_pdus[1].pdu_length = 8;
+		tx_pdus[1].pdu_index = 2;
+		tx_pdus[1].num_segments = 2;
+		tx_pdus[1].segments[0].segment_length = 4;
+		tx_pdus[1].segments[0].segment_data = (uint8_t*)&data[0];
+		tx_pdus[1].segments[1].segment_length = 4;
+		tx_pdus[1].segments[1].segment_data = (uint8_t*)&data[1];		
+		
+		
+		tx_req.tx_request_body.tx_pdu_list = tx_pdus;
+		mac->tx_req(mac, &tx_req);
+	}
+	
+	void generate_subframe(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf)
+	{
+		mac_internal_t* instance = (mac_internal_t*)mac;
+				
+		nfapi_dl_config_request_t dl_config_req;
+		memset(&dl_config_req, 0, sizeof(dl_config_req));
+		dl_config_req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
+		dl_config_req.header.phy_id = phy_id;
+		dl_config_req.sfn_sf = sfn_sf;
+
+		dl_config_req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+		dl_config_req.dl_config_request_body.number_pdu = 8;
+
+		nfapi_dl_config_request_pdu_t pdus[8];
+		memset(&pdus, 0, sizeof(pdus));
+		for(int i = 0; i < 8; i++)
+		{
+			pdus[i].pdu_type = NFAPI_DL_CONFIG_BCH_PDU_TYPE;
+
+			pdus[i].bch_pdu.bch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
+			pdus[i].bch_pdu.bch_pdu_rel8.length = 42;
+			pdus[i].bch_pdu.bch_pdu_rel8.pdu_index = i;
+			pdus[i].bch_pdu.bch_pdu_rel8.transmission_power = 56;
+
+		}
+
+		dl_config_req.dl_config_request_body.dl_config_pdu_list = pdus;
+
+		/*
+		vendor_ext_tlv_1 ve;
+		ve.tl.tag = VENDOR_EXT_TLV_1_TAG;
+		ve.dummy = 999;
+		dl_config_req.vendor_extension = &ve.tl;
+		*/
+
+		mac->dl_config_req(mac, &dl_config_req);	
+
+
+		nfapi_ul_config_request_t ul_config_req;
+		memset(&ul_config_req, 0, sizeof(ul_config_req));
+		ul_config_req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
+		ul_config_req.header.phy_id = phy_id;
+		ul_config_req.sfn_sf = sfn_sf;
+		mac->ul_config_req(mac, &ul_config_req);
+
+		nfapi_hi_dci0_request_t hi_dci0_req;
+		memset(&hi_dci0_req, 0, sizeof(hi_dci0_req));
+		hi_dci0_req.header.message_id = NFAPI_HI_DCI0_REQUEST;
+		hi_dci0_req.header.phy_id = phy_id;
+		hi_dci0_req.sfn_sf = sfn_sf;
+		mac->hi_dci0_req(mac, &hi_dci0_req);
+
+
+
+		nfapi_tx_request_t tx_req;
+		memset(&tx_req, 0, sizeof(tx_req));
+		tx_req.header.message_id = NFAPI_TX_REQUEST;
+		tx_req.header.phy_id = phy_id;
+		tx_req.sfn_sf = sfn_sf;
+
+		nfapi_tx_request_pdu_t tx_pdus[8];
+
+		tx_req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+		tx_req.tx_request_body.number_of_pdus = 0;
+		tx_req.tx_request_body.tx_pdu_list = &tx_pdus[0];
+
+		mac_pdu* buff = 0;
+		int i = 0;
+		std::list<mac_pdu*> free_list;
+		do
+		{
+			buff = instance->mac->pop_rx_buffer();
+			if(buff != 0)
+			{
+				if(buff->len == 0)
+				{
+					printf("[MAC] Buffer length = 0\n");
+				}
+
+				tx_req.tx_request_body.tx_pdu_list[i].pdu_length = buff->len;
+				tx_req.tx_request_body.tx_pdu_list[i].pdu_index = i;
+				tx_req.tx_request_body.tx_pdu_list[i].num_segments = 1;
+				tx_req.tx_request_body.tx_pdu_list[i].segments[0].segment_length = buff->len;
+				tx_req.tx_request_body.tx_pdu_list[i].segments[0].segment_data = (uint8_t*)buff->buffer;
+
+				tx_req.tx_request_body.number_of_pdus++;
+				i++;
+
+				instance->mac->byte_count += buff->len;
+
+				free_list.push_back(buff);
+			}
+		}while(buff != 0 && i < 8);
+
+		mac->tx_req(mac, &tx_req);
+
+		//for(int j = 0; j < tx_req.tx_request_body.number_of_pdus; ++j)
+		for(mac_pdu* pdu : free_list)
+		{
+			instance->mac->release_mac_pdu(pdu);
+			//free(tx_req.tx_request_body.tx_pdu_list[j].segments[0].segment_data);
+		}
+	}
+	
+	void mac_subframe_ind(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf)
+	{
+
+		
+		//printf("[MAC] subframe indication phyid:%d sfnsf:%d\n", phy_id, sfn_sf);
+		mac_internal_t* instance = (mac_internal_t*)mac;
+
+		if(instance->mac->tick == 1000)
+		{
+			if(instance->mac->byte_count > 0)
+			{
+				printf("[MAC] Rx rate %d bytes/sec\n", instance->mac->byte_count);
+				instance->mac->byte_count = 0;
+			}
+			instance->mac->tick = 0;
+		}
+		instance->mac->tick++;
+		
+		if(instance->mac->wireshark_test_mode)
+		{
+			generate_test_subframe(mac, phy_id, sfn_sf);
+		}
+		else
+		{
+			generate_subframe(mac, phy_id, sfn_sf);
+		}
+	}	
+	
+	void mac_harq_ind(mac_t* mac, nfapi_harq_indication_t* ind)
+	{
+	}
+	void mac_crc_ind(mac_t* mac, nfapi_crc_indication_t* ind)
+	{
+	}
+	void mac_rx_ind(mac_t* mac, nfapi_rx_indication_t* ind)
+	{
+		mac_internal_t* instance = (mac_internal_t*)mac;
+
+		for(int i = 0; i < ind->rx_indication_body.number_of_pdus; ++i)
+		{
+			uint16_t len = ind->rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length;
+			uint8_t* data = ind->rx_indication_body.rx_pdu_list[i].data;
+			//printf("[MAC] sfnsf:%d len:%d\n", ind->sfn_sf,len);
+			//
+			instance->tx_byte_count += len;
+
+			int sendto_result = sendto(instance->tx_sock, data, len, 0, (struct sockaddr*)&(instance->tx_addr), sizeof(instance->tx_addr));
+			
+			if(sendto_result < 0)
+			{
+				// error
+			}
+		}
+
+	}
+	void mac_rach_ind(mac_t* mac, nfapi_rach_indication_t* ind)
+	{
+	}
+	void mac_srs_ind(mac_t* mac, nfapi_srs_indication_t* ind)
+	{
+	}
+	void mac_sr_ind(mac_t* mac, nfapi_sr_indication_t* ind)
+	{
+	}
+	void mac_cqi_ind(mac_t* mac, nfapi_cqi_indication_t* ind)
+	{
+	}
+	void mac_lbt_dl_ind(mac_t* mac, nfapi_lbt_dl_indication_t* ind)
+	{
+	}
+	void mac_nb_harq_ind(mac_t* mac, nfapi_nb_harq_indication_t* ind)
+	{
+	}
+	void mac_nrach_ind(mac_t* mac, nfapi_nrach_indication_t* ind)
+	{
+	}
+}
+
diff --git a/nfapi/open-nFAPI/vnf_sim/src/main.cpp b/nfapi/open-nFAPI/vnf_sim/src/main.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5dc7161157defe8b5c6e3b8d5b10c445cf79a25d
--- /dev/null
+++ b/nfapi/open-nFAPI/vnf_sim/src/main.cpp
@@ -0,0 +1,1525 @@
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include <string.h>
+#include "debug.h"
+#include <map>
+#include <vector>
+#include <list>
+#include <string>
+#include <algorithm>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <ifaddrs.h>
+#include <netdb.h>
+
+#include "pool.h"
+
+#include <boost/foreach.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/exception/diagnostic_information.hpp> 
+#include <boost/exception_ptr.hpp> 
+
+extern "C" {
+#include <nfapi_vnf_interface.h>
+#include <nfapi.h>
+#include "mac.h"
+
+#include <vendor_ext.h>
+
+//int vnf_main(int iPortP5, int, int);
+int start_simulated_mac(int*, int*);
+int read_xml(const char *xml_file);
+
+}
+
+static uint32_t rand_range(uint32_t min, uint32_t max)
+{
+	return ((rand() % (max + 1 - min)) + min);
+}
+
+
+void* vnf_allocate(size_t size)
+{
+	return (void*)memory_pool::allocate(size);
+}
+
+void vnf_deallocate(void* ptr)
+{
+	memory_pool::deallocate((uint8_t*)ptr);
+}
+
+
+
+class udp_data
+{
+	public:
+		bool enabled;
+		uint32_t rx_port;
+		uint32_t tx_port;
+		std::string tx_addr;
+};
+
+
+class phy_info
+{
+	public:
+
+		uint16_t index;
+		uint16_t id;
+
+		std::vector<uint16_t> rfs;
+		std::vector<uint16_t> excluded_rfs;
+
+		int remote_port;
+		std::string remote_addr;
+
+		uint16_t earfcn;
+
+};
+
+class rf_info
+{
+	public:
+
+		uint16_t index;
+		uint16_t band;
+};
+
+class pnf_info
+{
+	public:
+
+		std::vector<phy_info> phys;
+		std::vector<rf_info> rfs;
+};
+
+class vnf_p7_info
+{
+	public:
+
+		vnf_p7_info()
+			: thread_started(false), 
+			  config(nfapi_vnf_p7_config_create(), 
+				     [] (nfapi_vnf_p7_config_t* f) { nfapi_vnf_p7_config_destory(f); }),
+			  mac(0)
+		{
+			local_port = 0;
+			
+			timing_window = 0;
+			periodic_timing_enabled = 0;
+			aperiodic_timing_enabled = 0;
+			periodic_timing_period = 0;
+			
+			//config = nfapi_vnf_p7_config_create();
+		}
+		
+		vnf_p7_info(const vnf_p7_info& other)  = default;
+		
+		vnf_p7_info(vnf_p7_info&& other) = default;
+		
+		vnf_p7_info& operator=(const vnf_p7_info&) = default;
+		
+		vnf_p7_info& operator=(vnf_p7_info&&) = default;
+		
+		
+		
+		virtual	~vnf_p7_info()
+		{
+			//NFAPI_TRACE(NFAPI_TRACE_INFO, "*** vnf_p7_info delete ***\n");
+			
+			//nfapi_vnf_p7_config_destory(config);
+			
+			// should we delete the mac?
+		}
+		
+
+		int local_port;
+		std::string local_addr;
+
+		unsigned timing_window;
+		unsigned periodic_timing_enabled;
+		unsigned aperiodic_timing_enabled;
+		unsigned periodic_timing_period;
+
+		// This is not really the right place if we have multiple PHY, 
+		// should be part of the phy struct
+		udp_data udp;
+
+		bool thread_started;
+
+		//nfapi_vnf_p7_config_t* config;
+		std::shared_ptr<nfapi_vnf_p7_config_t> config;
+
+		mac_t* mac;
+
+
+};
+
+class vnf_info
+{
+	public:
+	
+		uint8_t wireshark_test_mode;
+
+		std::map<uint16_t, pnf_info> pnfs;
+
+		std::vector<vnf_p7_info> p7_vnfs;
+		
+};
+
+
+/// maybe these should be in the mac file...
+int phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p7_codec_config_t* codec)
+{
+	(void)tl;
+	(void)ppReadPackedMessage;
+	(void)ve;
+	return -1;
+}
+
+int phy_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codec)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
+
+	nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
+	switch(tlv->tag)
+	{
+		case VENDOR_EXT_TLV_1_TAG:
+			{
+				//NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
+				vendor_ext_tlv_1* ve = (vendor_ext_tlv_1*)tlv;
+				if(!push32(ve->dummy, ppWritePackedMsg, end))
+					return 0;
+				return 1;
+			}
+			break;
+		default:
+			return -1;
+			break;
+	}
+}
+
+int vnf_sim_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_pack_vendor_extension_tlv\n");
+	nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
+	switch(tlv->tag)
+	{
+		case VENDOR_EXT_TLV_2_TAG:
+			{
+				//NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_2\n");
+				vendor_ext_tlv_2* ve = (vendor_ext_tlv_2*)tlv;
+				if(!push32(ve->dummy, ppWritePackedMsg, end))
+					return 0;
+				return 1;
+			}
+			break;
+	}
+	return -1;
+}
+
+int vnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* codec)
+{
+	return -1;
+}
+
+
+
+
+int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+	if(header->message_id == P7_VENDOR_EXT_IND)
+	{
+		vendor_ext_p7_ind* req = (vendor_ext_p7_ind*)(header);
+		if(!pull16(ppReadPackedMessage, &req->error_code, end))
+			return 0;
+	}
+	return 1;
+}
+
+int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+	if(header->message_id == P7_VENDOR_EXT_REQ)
+	{
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+		vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
+		if(!(push16(req->dummy1, ppWritePackedMsg, end) &&
+			 push16(req->dummy2, ppWritePackedMsg, end)))
+			return 0;
+	}
+	return 1;
+}
+
+int vnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+	if(header->message_id == P5_VENDOR_EXT_RSP)
+	{
+		vendor_ext_p5_rsp* req = (vendor_ext_p5_rsp*)(header);
+		return(!pull16(ppReadPackedMessage, &req->error_code, end));
+	}
+	return 0;
+}
+
+int vnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
+{
+	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+	if(header->message_id == P5_VENDOR_EXT_REQ)
+	{
+		vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
+		return (!(push16(req->dummy1, ppWritePackedMsg, end) &&
+				  push16(req->dummy2, ppWritePackedMsg, end)));
+	}
+	return 0;
+}
+
+void vnf_sim_trace(nfapi_trace_level_t level, const char* message, ...)
+{
+	va_list args;
+	va_start(args, message);
+	vprintf(message, args);
+	va_end(args);
+}
+
+void mac_dl_config_req(mac_t* mac, nfapi_dl_config_request_t* req)
+{
+	vnf_p7_info* info = (vnf_p7_info*)(mac->user_data);
+
+	nfapi_vnf_p7_dl_config_req(info->config.get(), req);
+}
+
+void mac_ul_config_req(mac_t* mac, nfapi_ul_config_request_t* req)
+{
+	vnf_p7_info* info = (vnf_p7_info*)(mac->user_data);
+
+	nfapi_vnf_p7_ul_config_req(info->config.get(), req);
+}
+
+void mac_hi_dci0_req(mac_t* mac, nfapi_hi_dci0_request_t* req)
+{
+	vnf_p7_info* info = (vnf_p7_info*)(mac->user_data);
+
+	nfapi_vnf_p7_hi_dci0_req(info->config.get(), req);
+}
+
+void mac_tx_req(mac_t* mac, nfapi_tx_request_t* req)
+{
+	vnf_p7_info* info = (vnf_p7_info*)(mac->user_data);
+
+	nfapi_vnf_p7_tx_req(info->config.get(), req);
+}
+
+int phy_subframe_indication(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf)
+{
+	//printf("[VNF_SIM] subframe indication %d\n", sfn_sf);
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_subframe_ind(p7_vnf->mac, phy_id, sfn_sf);
+	return 0;
+}
+int phy_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_harq_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_crc_indication(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_crc_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_rx_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_rach_indication(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_rach_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_srs_indication(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_srs_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_sr_indication(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_sr_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_cqi_indication(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_cqi_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_lbt_dl_indication(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_lbt_dl_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_nb_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_nb_harq_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_nrach_indication(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind)
+{
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
+	mac_nrach_ind(p7_vnf->mac, ind);
+	return 1;
+}
+int phy_vendor_ext(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg)
+{
+	if(msg->message_id == P7_VENDOR_EXT_IND)
+	{
+		//vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
+		//printf("[VNF_SIM] vendor_ext (error_code:%d)\n", ind->error_code);
+	}
+	else
+	{
+		printf("[VNF_SIM] unknown %d\n", msg->message_id);
+	}
+	return 0;
+}
+nfapi_p7_message_header_t* phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size)
+{
+	if(message_id == P7_VENDOR_EXT_IND)
+	{
+		*msg_size = sizeof(vendor_ext_p7_ind);
+		return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_ind));
+	}
+	return 0;
+}
+void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header)
+{
+	free(header);
+}
+
+//static pthread_t vnf_start_pthread;
+static pthread_t vnf_p7_start_pthread;
+void* vnf_p7_start_thread(void *ptr)
+{
+  printf("%s()\n", __FUNCTION__);
+
+  //std::shared_ptr<nfapi_vnf_p7_config> config = std::shared_ptr<nfapi_vnf_p7_config>(ptr);
+  nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
+
+  nfapi_vnf_p7_start(config);
+
+  return 0;
+}
+
+void set_thread_priority(int priority)
+{
+	//printf("%s(priority:%d)\n", __FUNCTION__, priority);
+	
+	pthread_attr_t ptAttr;
+	
+	struct sched_param schedParam;
+	schedParam.__sched_priority = priority; //79;
+	if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0)
+	{
+		printf("Failed to set scheduler to SCHED_RR\n");
+	}
+
+	if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0)
+	{
+		printf("Failed to set pthread sched policy SCHED_RR\n");
+	}
+
+	pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
+
+	struct sched_param thread_params;
+	thread_params.sched_priority = 20;
+	if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0)
+	{
+		printf("failed to set sched param\n");
+	}
+}
+
+void* vnf_p7_thread_start(void* ptr)
+{
+  printf("%s()\n", __FUNCTION__);
+
+	set_thread_priority(79);
+
+	vnf_p7_info* p7_vnf = (vnf_p7_info*)ptr;
+
+	p7_vnf->config->port = p7_vnf->local_port;
+	p7_vnf->config->subframe_indication = &phy_subframe_indication;
+	p7_vnf->config->harq_indication = &phy_harq_indication;
+	p7_vnf->config->crc_indication = &phy_crc_indication;
+	p7_vnf->config->rx_indication = &phy_rx_indication;
+	p7_vnf->config->rach_indication = &phy_rach_indication;
+	p7_vnf->config->srs_indication = &phy_srs_indication;
+	p7_vnf->config->sr_indication = &phy_sr_indication;
+	p7_vnf->config->cqi_indication = &phy_cqi_indication;
+	p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
+	p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
+	p7_vnf->config->nrach_indication = &phy_nrach_indication;
+	p7_vnf->config->malloc = &vnf_allocate;
+	p7_vnf->config->free = &vnf_deallocate;
+
+	p7_vnf->config->trace = &vnf_sim_trace;
+
+	p7_vnf->config->vendor_ext = &phy_vendor_ext;
+	p7_vnf->config->user_data = p7_vnf;
+
+	p7_vnf->mac->user_data = p7_vnf;
+
+	p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
+	p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
+	p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
+	p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
+	p7_vnf->config->codec_config.allocate = &vnf_allocate;
+	p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
+
+	p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
+	p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
+
+        printf("[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
+        pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config.get());
+
+	return 0;
+}
+
+int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx)
+{
+	printf("[VNF_SIM] pnf connection indication idx:%d\n", p5_idx);
+
+	pnf_info pnf;
+	vnf_info* vnf = (vnf_info*)(config->user_data);
+	vnf->pnfs.insert(std::pair<uint16_t, pnf_info>(p5_idx, pnf));
+
+	nfapi_pnf_param_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
+	nfapi_vnf_pnf_param_req(config, p5_idx, &req);
+	return 0;
+}
+int pnf_disconnection_indication_cb(nfapi_vnf_config_t* config, int p5_idx)
+{
+	printf("[VNF_SIM] pnf disconnection indication idx:%d\n", p5_idx);
+
+	
+	vnf_info* vnf = (vnf_info*)(config->user_data);
+	auto find_result = vnf->pnfs.find(p5_idx);
+	
+	if(find_result != vnf->pnfs.end())
+	{
+		pnf_info& pnf = find_result->second;
+
+		for(phy_info& phy : pnf.phys)
+		{
+			vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
+			nfapi_vnf_p7_del_pnf((p7_vnf.config.get()), phy.id);
+		}
+	}
+
+	return 0;
+}
+
+int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp)
+{
+	printf("[VNF_SIM] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
+
+	vnf_info* vnf = (vnf_info*)(config->user_data);
+
+	auto find_result = vnf->pnfs.find(p5_idx);
+	if(find_result != vnf->pnfs.end())
+	{
+		pnf_info& pnf = find_result->second;
+
+		for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
+		{
+			phy_info phy;
+			phy.index = resp->pnf_phy.phy[i].phy_config_index;
+
+			printf("[VNF_SIM] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
+
+			nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
+
+
+
+			for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j)
+			{
+				printf("[VNF_SIM] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
+				phy.rfs.push_back(resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
+			}
+
+
+			pnf.phys.push_back(phy);
+		}
+		for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i)
+		{
+			rf_info rf;
+			rf.index = resp->pnf_rf.rf[i].rf_config_index;
+
+			printf("[VNF_SIM] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
+
+			pnf.rfs.push_back(rf);
+		}
+
+		nfapi_pnf_config_request_t req;
+		memset(&req, 0, sizeof(req));
+		req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
+
+		req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
+		req.pnf_phy_rf_config.number_phy_rf_config_info = pnf.phys.size();
+
+		for(unsigned i = 0; i < pnf.phys.size(); ++i)
+		{
+			req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf.phys[i].id;
+			req.pnf_phy_rf_config.phy_rf_config[i].phy_config_index = pnf.phys[i].index;
+			req.pnf_phy_rf_config.phy_rf_config[i].rf_config_index = pnf.phys[i].rfs[0];
+		}
+
+
+		nfapi_vnf_pnf_config_req(config, p5_idx, &req);
+	}
+	return 0;
+}
+
+int pnf_config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp)
+{
+	printf("[VNF_SIM] pnf config response idx:%d\n", p5_idx);
+	
+	if(1)
+	{
+		vnf_info* vnf = (vnf_info*)(config->user_data);
+		auto find_result = vnf->pnfs.find(p5_idx);
+		if(find_result != vnf->pnfs.end())
+		{
+			//pnf_info& pnf = find_result->second;
+
+			nfapi_pnf_start_request_t req;
+			memset(&req, 0, sizeof(req));
+			req.header.message_id = NFAPI_PNF_START_REQUEST;
+			nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+		}
+	}
+	else
+	{
+		// Rather than send the pnf_start_request we will demonstrate
+		// sending a vendor extention message. The start request will be
+		// send when the vendor extension response is received 
+
+		//vnf_info* vnf = (vnf_info*)(config->user_data);
+		vendor_ext_p5_req req;
+		memset(&req, 0, sizeof(req));
+		req.header.message_id = P5_VENDOR_EXT_REQ;
+		req.dummy1 = 45;
+		req.dummy2 = 1977;
+		nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
+	}
+	return 0;
+}
+
+int pnf_start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp)
+{
+	printf("[VNF_SIM] pnf start response idx:%d\n", p5_idx);
+
+	vnf_info* vnf = (vnf_info*)(config->user_data);
+	vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
+
+	if(p7_vnf.thread_started == false)
+	{
+		pthread_t vnf_p7_thread;
+		pthread_create(&vnf_p7_thread, NULL, &vnf_p7_thread_start, &p7_vnf);
+		p7_vnf.thread_started = true;
+	}
+	else
+	{
+		// P7 thread already running. 
+	}
+
+	// start all the phys in the pnf.
+	
+	auto find_result = vnf->pnfs.find(p5_idx);
+	if(find_result != vnf->pnfs.end())
+	{
+		pnf_info& pnf = find_result->second;
+
+		for(unsigned i = 0; i < pnf.phys.size(); ++i)
+		{
+			pnf_info& pnf = find_result->second;
+
+			nfapi_param_request_t req;
+			memset(&req, 0, sizeof(req));
+			req.header.message_id = NFAPI_PARAM_REQUEST;
+			req.header.phy_id = pnf.phys[i].id;
+			nfapi_vnf_param_req(config, p5_idx, &req);
+		}
+	}
+
+	return 0;
+}
+int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp)
+{
+	printf("[VNF_SIM] param response idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+
+	vnf_info* vnf = (vnf_info*)(config->user_data);
+
+	auto find_result = vnf->pnfs.find(p5_idx);
+	if(find_result != vnf->pnfs.end())
+	{
+		pnf_info& pnf = find_result->second;
+		
+		
+		auto found = std::find_if(pnf.phys.begin(), pnf.phys.end(), [&](phy_info& item)
+								  { return item.id == resp->header.phy_id; });
+
+		if(found != pnf.phys.end())
+		{
+			phy_info& phy = (*found);
+
+			phy.remote_port = resp->nfapi_config.p7_pnf_port.value;
+			
+			struct sockaddr_in pnf_p7_sockaddr;
+			memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
+
+			phy.remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
+
+			// for now just 1
+			vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
+
+			printf("[VNF_SIM] %d.%d pnf p7 %s:%d timing %d %d %d %d\n", p5_idx, phy.id, phy.remote_addr.c_str(), phy.remote_port, p7_vnf.timing_window, p7_vnf.periodic_timing_period, p7_vnf.aperiodic_timing_enabled, p7_vnf.periodic_timing_period);
+
+
+			nfapi_config_request_t req;
+			memset(&req, 0, sizeof(req));
+			req.header.message_id = NFAPI_CONFIG_REQUEST;
+			req.header.phy_id = phy.id;
+
+			
+			req.nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
+			req.nfapi_config.p7_vnf_port.value = p7_vnf.local_port;
+			req.num_tlv++;
+
+			req.nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
+			struct sockaddr_in vnf_p7_sockaddr;
+			vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf.local_addr.c_str());
+			memcpy(&(req.nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
+			req.num_tlv++;
+
+			req.nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
+			req.nfapi_config.timing_window.value = p7_vnf.timing_window;
+			req.num_tlv++;
+
+			if(p7_vnf.periodic_timing_enabled || p7_vnf.aperiodic_timing_enabled)
+			{
+				req.nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG;
+				req.nfapi_config.timing_info_mode.value = (p7_vnf.aperiodic_timing_enabled << 1) | (p7_vnf.periodic_timing_enabled);
+				req.num_tlv++;
+
+				if(p7_vnf.periodic_timing_enabled)
+				{
+					req.nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG;
+					req.nfapi_config.timing_info_period.value = p7_vnf.periodic_timing_period;
+					req.num_tlv++;
+				}
+			}
+
+			req.nfapi_config.earfcn.tl.tag = NFAPI_NFAPI_EARFCN_TAG;
+			req.nfapi_config.earfcn.value = phy.earfcn;
+			req.num_tlv++;
+			
+			
+			if(1)
+			{
+				// Poplate all tlv for wireshark testing
+				req.subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG;
+				req.num_tlv++;
+				
+				req.subframe_config.pcfich_power_offset.tl.tag = NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG;
+				req.num_tlv++;
+				req.subframe_config.pb.tl.tag = NFAPI_SUBFRAME_CONFIG_PB_TAG;
+				req.num_tlv++;
+				req.subframe_config.dl_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG;
+				req.num_tlv++;
+				req.subframe_config.ul_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG;
+				req.num_tlv++;
+	
+				req.rf_config.dl_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG;
+				req.num_tlv++;
+				req.rf_config.ul_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG;
+				req.num_tlv++;
+				req.rf_config.reference_signal_power.tl.tag = NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG;
+				req.num_tlv++;
+				req.rf_config.tx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG;
+				req.num_tlv++;
+				req.rf_config.rx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG;		
+				req.num_tlv++;
+	
+				req.phich_config.phich_resource.tl.tag = NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG;
+				req.num_tlv++;
+				req.phich_config.phich_duration.tl.tag = NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG;
+				req.num_tlv++;
+				req.phich_config.phich_power_offset.tl.tag = NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG;	
+				req.num_tlv++;
+	
+				req.sch_config.primary_synchronization_signal_epre_eprers.tl.tag = NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG;
+				req.num_tlv++;
+				req.sch_config.secondary_synchronization_signal_epre_eprers.tl.tag = NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG;
+				req.num_tlv++;
+				req.sch_config.physical_cell_id.tl.tag = NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG;				
+				req.num_tlv++;
+	
+				req.prach_config.configuration_index.tl.tag = NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG;
+				req.num_tlv++;
+				req.prach_config.root_sequence_index.tl.tag = NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG;
+				req.num_tlv++;
+				req.prach_config.zero_correlation_zone_configuration.tl.tag = NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG;
+				req.num_tlv++;
+				req.prach_config.high_speed_flag.tl.tag = NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG;
+				req.num_tlv++;
+				req.prach_config.frequency_offset.tl.tag = NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG;				
+				req.num_tlv++;
+	
+				req.pusch_config.hopping_mode.tl.tag = NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG;
+				req.num_tlv++;
+				req.pusch_config.hopping_offset.tl.tag = NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG;
+				req.num_tlv++;
+				req.pusch_config.number_of_subbands.tl.tag = NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG;
+				req.num_tlv++;
+	
+				req.pucch_config.delta_pucch_shift.tl.tag = NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG;
+				req.num_tlv++;
+				req.pucch_config.n_cqi_rb.tl.tag = NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG;
+				req.num_tlv++;
+				req.pucch_config.n_an_cs.tl.tag = NFAPI_PUCCH_CONFIG_N_AN_CS_TAG;
+				req.num_tlv++;
+				req.pucch_config.n1_pucch_an.tl.tag = NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG;
+				req.num_tlv++;
+	
+				req.srs_config.bandwidth_configuration.tl.tag = NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG;
+				req.num_tlv++;
+				req.srs_config.max_up_pts.tl.tag = NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG;
+				req.num_tlv++;
+				req.srs_config.srs_subframe_configuration.tl.tag = NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG;
+				req.num_tlv++;
+				req.srs_config.srs_acknack_srs_simultaneous_transmission.tl.tag = NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG;				
+				req.num_tlv++;
+	
+				req.uplink_reference_signal_config.uplink_rs_hopping.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG;
+				req.num_tlv++;
+				req.uplink_reference_signal_config.group_assignment.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG;
+				req.num_tlv++;
+				req.uplink_reference_signal_config.cyclic_shift_1_for_drms.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG;				
+				req.num_tlv++;
+	
+				req.laa_config.ed_threshold_lbt_pdsch.tl.tag = NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG;
+				req.num_tlv++;
+				req.laa_config.ed_threshold_lbt_drs.tl.tag = NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG;
+				req.num_tlv++;
+				req.laa_config.pd_threshold.tl.tag = NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG;
+				req.num_tlv++;
+				req.laa_config.multi_carrier_type.tl.tag = NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG;
+				req.num_tlv++;
+				req.laa_config.multi_carrier_tx.tl.tag = NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG;
+				req.num_tlv++;
+				req.laa_config.multi_carrier_freeze.tl.tag = NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG;
+				req.num_tlv++;
+				req.laa_config.tx_antenna_ports_drs.tl.tag = NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG;
+				req.num_tlv++;
+				req.laa_config.tx_power_drs.tl.tag = NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG;				
+				req.num_tlv++;
+	
+				req.emtc_config.pbch_repetitions_enable_r13.tl.tag = NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_catm_root_sequence_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_catm_zero_correlation_zone_configuration.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_catm_high_speed_flag.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_0_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_0_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_0_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_0_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_0_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_0_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_1_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_1_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_1_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_1_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_1_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_1_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_2_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_2_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_2_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_2_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_2_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_2_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_3_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_3_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_3_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_3_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_3_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG;
+				req.num_tlv++;
+				req.emtc_config.prach_ce_level_3_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG;
+				req.num_tlv++;
+				req.emtc_config.pucch_interval_ulhoppingconfigcommonmodea.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG;
+				req.num_tlv++;
+				req.emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG;			
+				req.num_tlv++;
+				
+				req.nb_iot_config.operating_mode.tl.tag = NFAPI_NB_IOT_CONFIG_OPERATING_MODE_TAG;
+				req.nb_iot_config.operating_mode.value = rand_range(0, 3);
+				req.num_tlv++;				
+				req.nb_iot_config.anchor.tl.tag = NFAPI_NB_IOT_CONFIG_ANCHOR_TAG;
+				req.nb_iot_config.anchor.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.prb_index.tl.tag = NFAPI_NB_IOT_CONFIG_PRB_INDEX_TAG;
+				req.nb_iot_config.prb_index.value = rand_range(0, 0x1F);
+				req.num_tlv++;
+				req.nb_iot_config.control_region_size.tl.tag = NFAPI_NB_IOT_CONFIG_CONTROL_REGION_SIZE_TAG;
+				req.nb_iot_config.control_region_size.value = rand_range(1, 4);
+				req.num_tlv++;
+				req.nb_iot_config.assumed_crs_aps.tl.tag = NFAPI_NB_IOT_CONFIG_ASSUMED_CRS_APS_TAG;
+				req.nb_iot_config.assumed_crs_aps.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_0_enabled.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_ENABLED_TAG;
+				req.nb_iot_config.nprach_config_0_enabled.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_0_sf_periodicity.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_SF_PERIODICITY_TAG;
+				req.nb_iot_config.nprach_config_0_sf_periodicity.value = rand_range(0, 7);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_0_start_time.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_START_TIME_TAG;
+				req.nb_iot_config.nprach_config_0_start_time.value = rand_range(0, 7);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_0_subcarrier_offset.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_SUBCARRIER_OFFSET_TAG;
+				req.nb_iot_config.nprach_config_0_subcarrier_offset.value = rand_range(0, 6);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_0_number_of_subcarriers.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_NUMBER_OF_SUBCARRIERS_TAG;
+				req.nb_iot_config.nprach_config_0_number_of_subcarriers.value = rand_range(0, 3);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_0_cp_length.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_CP_LENGTH_TAG;
+				req.nb_iot_config.nprach_config_0_cp_length.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_0_number_of_repetitions_per_attempt.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+				req.nb_iot_config.nprach_config_0_number_of_repetitions_per_attempt.value = rand_range(0, 7);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_1_enabled.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_ENABLED_TAG;
+				req.nb_iot_config.nprach_config_1_enabled.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_1_sf_periodicity.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_SF_PERIODICITY_TAG;
+				req.nb_iot_config.nprach_config_1_sf_periodicity.value = rand_range(0, 7);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_1_start_time.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_START_TIME_TAG;
+				req.nb_iot_config.nprach_config_1_start_time.value = rand_range(0, 7);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_1_subcarrier_offset.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_SUBCARRIER_OFFSET_TAG;
+				req.nb_iot_config.nprach_config_1_subcarrier_offset.value = rand_range(0, 6);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_1_number_of_subcarriers.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_NUMBER_OF_SUBCARRIERS_TAG;
+				req.nb_iot_config.nprach_config_1_number_of_subcarriers.value = rand_range(0, 3);				
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_1_cp_length.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_CP_LENGTH_TAG;
+				req.nb_iot_config.nprach_config_1_cp_length.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_1_number_of_repetitions_per_attempt.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+				req.nb_iot_config.nprach_config_1_number_of_repetitions_per_attempt.value = rand_range(0, 7);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_2_enabled.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_ENABLED_TAG;
+				req.nb_iot_config.nprach_config_2_enabled.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_2_sf_periodicity.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_SF_PERIODICITY_TAG;
+				req.nb_iot_config.nprach_config_2_sf_periodicity.value = rand_range(0, 7);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_2_start_time.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_START_TIME_TAG;
+				req.nb_iot_config.nprach_config_2_start_time.value = rand_range(0, 7);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_2_subcarrier_offset.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_SUBCARRIER_OFFSET_TAG;
+				req.nb_iot_config.nprach_config_2_subcarrier_offset.value = rand_range(0, 6);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_2_number_of_subcarriers.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_NUMBER_OF_SUBCARRIERS_TAG;
+				req.nb_iot_config.nprach_config_2_number_of_subcarriers.value = rand_range(0, 3);				
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_2_cp_length.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_CP_LENGTH_TAG;
+				req.nb_iot_config.nprach_config_2_cp_length.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.nprach_config_2_number_of_repetitions_per_attempt.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+				req.nb_iot_config.nprach_config_2_number_of_repetitions_per_attempt.value = rand_range(0, 7);				
+				req.num_tlv++;
+				req.nb_iot_config.three_tone_base_sequence.tl.tag = NFAPI_NB_IOT_CONFIG_THREE_TONE_BASE_SEQUENCE_TAG;
+				req.nb_iot_config.three_tone_base_sequence.value = rand_range(0, 0x0F);				
+				req.num_tlv++;
+				req.nb_iot_config.six_tone_base_sequence.tl.tag = NFAPI_NB_IOT_CONFIG_SIX_TONE_BASE_SEQUENCE_TAG;
+				req.nb_iot_config.six_tone_base_sequence.value = rand_range(0, 0x03);				
+				req.num_tlv++;
+				req.nb_iot_config.twelve_tone_base_sequence.tl.tag = NFAPI_NB_IOT_CONFIG_TWELVE_TONE_BASE_SEQUENCE_TAG;
+				req.nb_iot_config.twelve_tone_base_sequence.value = rand_range(0, 0x1F);				
+				req.num_tlv++;
+				req.nb_iot_config.three_tone_cyclic_shift.tl.tag = NFAPI_NB_IOT_CONFIG_THREE_TONE_CYCLIC_SHIFT_TAG;
+				req.nb_iot_config.three_tone_cyclic_shift.value = rand_range(0, 5); // what is the max
+				req.num_tlv++;
+				req.nb_iot_config.six_tone_cyclic_shift.tl.tag = NFAPI_NB_IOT_CONFIG_SIX_TONE_CYCLIC_SHIFT_TAG;
+				req.nb_iot_config.six_tone_cyclic_shift.value = rand_range(0, 5); // what is the max
+				req.num_tlv++;
+				req.nb_iot_config.dl_gap_config_enable.tl.tag = NFAPI_NB_IOT_CONFIG_DL_GAP_CONFIG_ENABLE_TAG;
+				req.nb_iot_config.dl_gap_config_enable.value = rand_range(0, 1);
+				req.num_tlv++;
+				req.nb_iot_config.dl_gap_threshold.tl.tag = NFAPI_NB_IOT_CONFIG_DL_GAP_THRESHOLD_TAG;
+				req.nb_iot_config.dl_gap_threshold.value = rand_range(0, 3);
+				req.num_tlv++;
+				req.nb_iot_config.dl_gap_periodicity.tl.tag = NFAPI_NB_IOT_CONFIG_DL_GAP_PERIODICITY_TAG;
+				req.nb_iot_config.dl_gap_periodicity.value = rand_range(0, 3);
+				req.num_tlv++;
+				req.nb_iot_config.dl_gap_duration_coefficient.tl.tag = NFAPI_NB_IOT_CONFIG_DL_GAP_DURATION_COEFFICIENT_TAG;
+				req.nb_iot_config.dl_gap_duration_coefficient.value = rand_range(0, 3);
+				req.num_tlv++;
+				
+				req.tdd_frame_structure_config.subframe_assignment.tl.tag = NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG;
+				req.num_tlv++;
+				req.tdd_frame_structure_config.special_subframe_patterns.tl.tag = NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG;		
+				req.num_tlv++;
+				
+				req.l23_config.data_report_mode.tl.tag = NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG;
+				req.num_tlv++;
+				req.l23_config.sfnsf.tl.tag = NFAPI_L23_CONFIG_SFNSF_TAG;				
+				req.num_tlv++;
+			}
+
+			vendor_ext_tlv_2 ve2;
+			memset(&ve2, 0, sizeof(ve2));
+			ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
+			ve2.dummy = 2016;
+			req.vendor_extension = &ve2.tl;
+
+			nfapi_vnf_config_req(config, p5_idx, &req);
+		}
+		else
+		{
+			printf("[VNF_SIM] param response failed to find pnf %d phy %d\n", p5_idx, resp->header.phy_id);
+		}
+	}
+	else
+	{
+		printf("[VNF_SIM] param response failed to find pnf %d\n", p5_idx);
+	}
+
+	return 0;
+}
+
+int config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp)
+{
+	printf("[VNF_SIM] config response idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+
+
+	nfapi_start_request_t req;
+	memset(&req, 0, sizeof(req));
+	req.header.message_id = NFAPI_START_REQUEST;
+	req.header.phy_id = resp->header.phy_id;
+	nfapi_vnf_start_req(config, p5_idx, &req);
+
+	return 0;
+}
+
+void test_p4_requests(nfapi_vnf_config_t* config, int p5_idx, int phy_id)
+{
+	{
+		nfapi_measurement_request_t req;
+		memset(&req, 0, sizeof(req));
+		req.header.message_id = NFAPI_MEASUREMENT_REQUEST;
+		req.header.phy_id = phy_id;
+		
+		req.dl_rs_tx_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG;
+		req.dl_rs_tx_power.value = 42;
+		req.received_interference_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG;
+		req.received_interference_power.value = 42;
+		req.thermal_noise_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG;
+		req.thermal_noise_power.value = 42;
+		
+		nfapi_vnf_measurement_req(config, p5_idx, &req);
+	}
+	{
+		nfapi_rssi_request_t lte_req;
+		memset(&lte_req, 0, sizeof(lte_req));
+		lte_req.header.message_id = NFAPI_RSSI_REQUEST;
+		lte_req.header.phy_id = phy_id;
+		
+		lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+		lte_req.lte_rssi_request.tl.tag = NFAPI_LTE_RSSI_REQUEST_TAG;
+		lte_req.lte_rssi_request.frequency_band_indicator = 2;
+		lte_req.lte_rssi_request.measurement_period = 1000;
+		lte_req.lte_rssi_request.bandwidth = 50;
+		lte_req.lte_rssi_request.timeout = 0;
+		lte_req.lte_rssi_request.number_of_earfcns = 2;
+		lte_req.lte_rssi_request.earfcn[0] = 389;
+		lte_req.lte_rssi_request.earfcn[1] = 123;
+		
+		nfapi_vnf_rssi_request(config, p5_idx, &lte_req);
+		
+		nfapi_rssi_request_t utran_req;
+		memset(&utran_req, 0, sizeof(utran_req));
+		utran_req.header.message_id = NFAPI_RSSI_REQUEST;
+		utran_req.header.phy_id = phy_id;
+		
+		utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
+		utran_req.utran_rssi_request.tl.tag = NFAPI_UTRAN_RSSI_REQUEST_TAG;
+		utran_req.utran_rssi_request.frequency_band_indicator = 2;
+		utran_req.utran_rssi_request.measurement_period = 1000;
+		utran_req.utran_rssi_request.timeout = 0;
+		utran_req.utran_rssi_request.number_of_uarfcns = 2;
+		utran_req.utran_rssi_request.uarfcn[0] = 2348;
+		utran_req.utran_rssi_request.uarfcn[1] = 52;
+		
+		nfapi_vnf_rssi_request(config, p5_idx, &utran_req);		
+		
+		
+		nfapi_rssi_request_t geran_req;
+		memset(&geran_req, 0, sizeof(geran_req));
+		geran_req.header.message_id = NFAPI_RSSI_REQUEST;
+		geran_req.header.phy_id = phy_id;
+		
+		geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
+		geran_req.geran_rssi_request.tl.tag = NFAPI_GERAN_RSSI_REQUEST_TAG;
+		geran_req.geran_rssi_request.frequency_band_indicator = 2;
+		geran_req.geran_rssi_request.measurement_period = 1000;
+		geran_req.geran_rssi_request.timeout = 0;
+		geran_req.geran_rssi_request.number_of_arfcns = 1;
+		geran_req.geran_rssi_request.arfcn[0].arfcn = 34;
+		geran_req.geran_rssi_request.arfcn[0].direction = 0;
+		
+		nfapi_vnf_rssi_request(config, p5_idx, &geran_req);		
+	}
+	{
+		nfapi_cell_search_request_t lte_req;
+		memset(&lte_req, 0, sizeof(lte_req));
+		lte_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+		lte_req.header.phy_id = phy_id;		
+		
+		lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+		lte_req.lte_cell_search_request.tl.tag = NFAPI_LTE_CELL_SEARCH_REQUEST_TAG;
+		lte_req.lte_cell_search_request.earfcn = 1234;
+		lte_req.lte_cell_search_request.measurement_bandwidth = 50;
+		lte_req.lte_cell_search_request.exhaustive_search = 1;
+		lte_req.lte_cell_search_request.timeout = 1000;
+		lte_req.lte_cell_search_request.number_of_pci = 1;
+		lte_req.lte_cell_search_request.pci[0] = 234;
+		
+		nfapi_vnf_cell_search_request(config, p5_idx, &lte_req);
+		
+		nfapi_cell_search_request_t utran_req;
+		memset(&utran_req, 0, sizeof(utran_req));
+		utran_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+		utran_req.header.phy_id = phy_id;		
+		
+		utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
+		utran_req.utran_cell_search_request.tl.tag = NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG;
+		utran_req.utran_cell_search_request.uarfcn = 1234;
+		utran_req.utran_cell_search_request.exhaustive_search = 0;
+		utran_req.utran_cell_search_request.timeout = 1000;
+		utran_req.utran_cell_search_request.number_of_psc = 1;
+		utran_req.utran_cell_search_request.psc[0] = 234;
+		
+		nfapi_vnf_cell_search_request(config, p5_idx, &utran_req);		
+		
+		nfapi_cell_search_request_t geran_req;
+		memset(&geran_req, 0, sizeof(geran_req));
+		geran_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+		geran_req.header.phy_id = phy_id;		
+		
+		geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
+		geran_req.geran_cell_search_request.tl.tag = NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG;
+		geran_req.geran_cell_search_request.timeout = 1000;
+		geran_req.geran_cell_search_request.number_of_arfcn = 1;
+		geran_req.geran_cell_search_request.arfcn[0] = 8765;
+		
+		nfapi_vnf_cell_search_request(config, p5_idx, &geran_req);				
+	}
+	{
+		nfapi_broadcast_detect_request_t lte_req;
+		memset(&lte_req, 0, sizeof(lte_req));
+		lte_req.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
+		lte_req.header.phy_id = phy_id;		
+		
+		lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+		lte_req.lte_broadcast_detect_request.tl.tag = NFAPI_LTE_BROADCAST_DETECT_REQUEST_TAG;
+		lte_req.lte_broadcast_detect_request.earfcn = 1234;
+		lte_req.lte_broadcast_detect_request.pci = 50;
+		lte_req.lte_broadcast_detect_request.timeout = 1000;
+		
+		lte_req.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+		lte_req.pnf_cell_search_state.length = 3;
+		
+		nfapi_vnf_broadcast_detect_request(config, p5_idx, &lte_req);
+		
+		nfapi_broadcast_detect_request_t utran_req;
+		memset(&utran_req, 0, sizeof(utran_req));
+		utran_req.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
+		utran_req.header.phy_id = phy_id;		
+		
+		utran_req.rat_type = NFAPI_RAT_TYPE_LTE;
+		utran_req.utran_broadcast_detect_request.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG;
+		utran_req.utran_broadcast_detect_request.uarfcn = 1234;
+		utran_req.utran_broadcast_detect_request.psc = 50;
+		utran_req.utran_broadcast_detect_request.timeout = 1000;
+		
+		utran_req.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+		utran_req.pnf_cell_search_state.length = 3;
+		
+		nfapi_vnf_broadcast_detect_request(config, p5_idx, &utran_req);		
+	}
+	{
+		nfapi_system_information_schedule_request_t lte_req;
+		memset(&lte_req, 0, sizeof(lte_req));
+		lte_req.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST;
+		lte_req.header.phy_id = phy_id;		
+		
+		lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+		lte_req.lte_system_information_schedule_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG;
+		lte_req.lte_system_information_schedule_request.earfcn = 1234;
+		lte_req.lte_system_information_schedule_request.pci = 50;
+		lte_req.lte_system_information_schedule_request.downlink_channel_bandwidth = 100;
+		lte_req.lte_system_information_schedule_request.phich_configuration = 3;
+		lte_req.lte_system_information_schedule_request.number_of_tx_antenna = 2;
+		lte_req.lte_system_information_schedule_request.retry_count = 4;
+		lte_req.lte_system_information_schedule_request.timeout = 1000;
+		
+		lte_req.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+		lte_req.pnf_cell_broadcast_state.length = 3;
+		
+		nfapi_vnf_system_information_schedule_request(config, p5_idx, &lte_req);
+	}
+	{
+		nfapi_system_information_request_t lte_req;
+		memset(&lte_req, 0, sizeof(lte_req));
+		lte_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+		lte_req.header.phy_id = phy_id;		
+		
+		lte_req.rat_type = NFAPI_RAT_TYPE_LTE;		
+		lte_req.lte_system_information_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG;
+		lte_req.lte_system_information_request.earfcn = 1234;
+		lte_req.lte_system_information_request.pci= 456;
+		lte_req.lte_system_information_request.downlink_channel_bandwidth = 5;
+		lte_req.lte_system_information_request.phich_configuration = 2;
+		lte_req.lte_system_information_request.number_of_tx_antenna = 2;
+		lte_req.lte_system_information_request.number_of_si_periodicity = 1;
+		lte_req.lte_system_information_request.si_periodicity[0].si_periodicity = 3;
+		lte_req.lte_system_information_request.si_periodicity[0].si_index = 3;
+		lte_req.lte_system_information_request.si_window_length = 15;
+		lte_req.lte_system_information_request.timeout = 1000;
+		
+		nfapi_vnf_system_information_request(config, p5_idx, &lte_req);
+		
+		nfapi_system_information_request_t utran_req;
+		memset(&utran_req, 0, sizeof(utran_req));
+		utran_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+		utran_req.header.phy_id = phy_id;		
+		
+		utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
+		utran_req.utran_system_information_request.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG;
+		utran_req.utran_system_information_request.uarfcn = 1234;
+		utran_req.utran_system_information_request.psc = 456;
+		utran_req.utran_system_information_request.timeout = 1000;
+		
+		nfapi_vnf_system_information_request(config, p5_idx, &utran_req);		
+		
+		nfapi_system_information_request_t geran_req;
+		memset(&geran_req, 0, sizeof(geran_req));
+		geran_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+		geran_req.header.phy_id = phy_id;		
+		
+		geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
+		geran_req.geran_system_information_request.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG;
+		geran_req.geran_system_information_request.arfcn = 1234;
+		geran_req.geran_system_information_request.bsic = 21;
+		geran_req.geran_system_information_request.timeout = 1000;
+		
+		nfapi_vnf_system_information_request(config, p5_idx, &geran_req);	
+	}
+	{
+		nfapi_nmm_stop_request_t req;
+		memset(&req, 0, sizeof(req));
+		req.header.message_id = NFAPI_NMM_STOP_REQUEST;
+		req.header.phy_id = phy_id;		
+		nfapi_vnf_nmm_stop_request(config, p5_idx, &req);	
+	}
+}
+
+
+int start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp)
+{
+	printf("[VNF_SIM] start response idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+
+	vnf_info* vnf = (vnf_info*)(config->user_data);
+	
+	if(vnf->wireshark_test_mode)
+		test_p4_requests(config, p5_idx,  resp->header.phy_id);
+
+	auto find_result = vnf->pnfs.find(p5_idx);
+	if(find_result != vnf->pnfs.end())
+	{
+		pnf_info& pnf = find_result->second;
+		
+		
+		auto found = std::find_if(pnf.phys.begin(), pnf.phys.end(), [&](phy_info& item)
+								  { return item.id == resp->header.phy_id; });
+
+		if(found != pnf.phys.end())
+		{
+			phy_info& phy = (*found);
+
+			vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
+
+			nfapi_vnf_p7_add_pnf((p7_vnf.config.get()), phy.remote_addr.c_str(), phy.remote_port, phy.id);
+			
+
+		}
+
+
+	}
+	return 0;
+}
+
+
+nfapi_p4_p5_message_header_t* vnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size)
+{
+	if(message_id == P5_VENDOR_EXT_RSP)
+	{
+		*msg_size = sizeof(vendor_ext_p5_rsp);
+		return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_rsp));
+	}
+	return 0;
+}
+void vnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header)
+{
+	free(header);
+}
+int vendor_ext_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg)
+{
+	printf("[VNF_SIM] %s\n", __FUNCTION__);
+
+	switch(msg->message_id)
+	{
+		case P5_VENDOR_EXT_RSP:
+			{
+				vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)msg;
+				printf("[VNF_SIM] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
+
+				// send the start request
+	
+				nfapi_pnf_start_request_t req;
+				memset(&req, 0, sizeof(req));
+				req.header.message_id = NFAPI_PNF_START_REQUEST;
+				nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+			}
+			break;
+
+	}
+
+	return 0;
+}
+
+int read_vnf_xml(vnf_info& vnf, const char* xml_file)
+{
+	try
+	{
+		
+		std::ifstream input(xml_file);
+	
+		using boost::property_tree::ptree;
+		ptree pt;
+	
+		read_xml(input, pt);
+		
+		
+	
+		for(const auto& v : pt.get_child("vnf.vnf_p7_list"))
+		{
+			if(v.first == "vnf_p7")
+			{
+				vnf_p7_info vnf_p7;
+				vnf_p7.local_port = v.second.get<unsigned>("port");
+				vnf_p7.local_addr = v.second.get<std::string>("address");
+	
+				vnf_p7.timing_window = v.second.get<unsigned>("timing_window");
+				vnf_p7.periodic_timing_enabled = v.second.get<unsigned>("periodic_timing_enabled");
+				vnf_p7.aperiodic_timing_enabled = v.second.get<unsigned>("aperiodic_timing_enabled");
+				vnf_p7.periodic_timing_period = v.second.get<unsigned>("periodic_timing_window");
+	
+				
+				boost::optional<const boost::property_tree::ptree&> d = v.second.get_child_optional("data.udp");
+				if(d.is_initialized())
+				{
+					vnf_p7.udp.enabled = true;
+					vnf_p7.udp.rx_port = d.get().get<unsigned>("rx_port");
+					vnf_p7.udp.tx_port = d.get().get<unsigned>("tx_port");
+					vnf_p7.udp.tx_addr = d.get().get<std::string>("tx_addr");
+				}
+				else
+				{
+					vnf_p7.udp.enabled = false;
+				}
+				
+				vnf.wireshark_test_mode = v.second.get<unsigned>("wireshark_test_mode", 0);
+	
+				vnf_p7.mac = mac_create(vnf.wireshark_test_mode);
+				vnf_p7.mac->dl_config_req = &mac_dl_config_req;
+				vnf_p7.mac->ul_config_req = &mac_ul_config_req;
+				vnf_p7.mac->hi_dci0_req = &mac_hi_dci0_req;
+				vnf_p7.mac->tx_req = &mac_tx_req;
+	
+				if(vnf_p7.udp.enabled)
+				{
+					mac_start_data(vnf_p7.mac, 
+								   vnf_p7.udp.rx_port, 
+								   vnf_p7.udp.tx_addr.c_str(), 
+								   vnf_p7.udp.tx_port);
+				}
+	
+				vnf.p7_vnfs.push_back(vnf_p7);
+			}
+		}
+	}
+	catch(std::exception& e)
+	{
+		printf("%s", e.what());
+		return -1;
+	}
+	catch(boost::exception& e)
+	{
+		printf("%s", boost::diagnostic_information(e).c_str());
+	}
+
+	struct ifaddrs *ifaddr;
+	getifaddrs(&ifaddr);
+
+
+	while(ifaddr)
+	{
+		int family = ifaddr->ifa_addr->sa_family;
+		if(family == AF_INET)
+		{
+			char host[128];
+			getnameinfo(ifaddr->ifa_addr, sizeof(sockaddr_in), host, sizeof(host),	NULL, 0, 0);
+			printf("%s\n", host);
+		}
+		ifaddr = ifaddr->ifa_next;
+	}
+	
+	return 0;
+
+}
+
+
+int main(int argc, char *argv[])
+{
+	if (argc < 3)
+	{
+		printf("Use parameters: <P5 Port> <xml config file>\n");
+		return 0;
+	}
+
+	set_thread_priority(50);
+
+	vnf_info vnf;
+
+	if(read_vnf_xml(vnf, argv[2]) < 0)
+	{
+		printf("Failed to read xml file>\n");
+		return 0;
+	}
+
+	nfapi_vnf_config_t* config = nfapi_vnf_config_create();
+
+	config->vnf_ipv4 = 1;
+	config->vnf_p5_port = atoi(argv[1]);
+	config->pnf_connection_indication = &pnf_connection_indication_cb;
+	config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
+	config->pnf_param_resp = &pnf_param_resp_cb;
+	config->pnf_config_resp = &pnf_config_resp_cb;
+	config->pnf_start_resp = &pnf_start_resp_cb;
+	config->param_resp = &param_resp_cb;
+	config->config_resp = &config_resp_cb;
+	config->start_resp = &start_resp_cb;
+	config->vendor_ext = &vendor_ext_cb;
+	
+	
+	
+	config->trace = &vnf_sim_trace;
+	
+	config->malloc = &vnf_allocate;
+	config->free = &vnf_deallocate;
+
+	config->user_data = &vnf;
+
+	config->codec_config.unpack_vendor_extension_tlv = &vnf_sim_unpack_vendor_extension_tlv;
+	config->codec_config.pack_vendor_extension_tlv = &vnf_sim_pack_vendor_extension_tlv;
+
+	config->codec_config.unpack_p4_p5_vendor_extension = &vnf_sim_unpack_p4_p5_vendor_extension;
+	config->codec_config.pack_p4_p5_vendor_extension = &vnf_sim_pack_p4_p5_vendor_extension;
+	config->allocate_p4_p5_vendor_ext = &vnf_sim_allocate_p4_p5_vendor_ext;
+	config->deallocate_p4_p5_vendor_ext = &vnf_sim_deallocate_p4_p5_vendor_ext;
+	config->codec_config.allocate = &vnf_allocate;
+	config->codec_config.deallocate = &vnf_deallocate;
+
+
+	printf("Calling nfapi_vnf_start\n");
+	return nfapi_vnf_start(config);
+}
diff --git a/nfapi/open-nFAPI/xml/pnf_phy_1_A.xml b/nfapi/open-nFAPI/xml/pnf_phy_1_A.xml
new file mode 100644
index 0000000000000000000000000000000000000000..45f8f468319d5a9ef3fe401a5ecb8e6b644f7111
--- /dev/null
+++ b/nfapi/open-nFAPI/xml/pnf_phy_1_A.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pnf>
+	<sync_mode>0</sync_mode>
+	<location_mode>0</location_mode>
+	<location_coordinates></location_coordinates>
+
+	<dl_config_timing>500</dl_config_timing>
+	<ul_config_timing>500</ul_config_timing>
+	<tx_timing>500</tx_timing>
+	<hi_dci0_timing>500</hi_dci0_timing>
+
+	<max_phys>1</max_phys>
+	<max_total_bandwidth>30</max_total_bandwidth>
+	<max_total_num_dl_layers>1</max_total_num_dl_layers>
+	<max_total_num_ul_layers>1</max_total_num_ul_layers>
+
+	<shared_bands>0</shared_bands>
+	<shared_pas>0</shared_pas>
+
+	<maximum_total_power>0</maximum_total_power>
+
+	<oui>ALPHA</oui>
+
+
+	<phys>
+		<phy>
+			<index>88</index>
+			<port>2500</port>
+			<address>192.168.1.74</address>
+
+			<duplex_mode>1</duplex_mode>
+
+			<downlink_channel_bandwidth_support>22</downlink_channel_bandwidth_support>
+			<uplink_channel_bandwidth_support>22</uplink_channel_bandwidth_support>
+
+			<number_of_dl_layers>1</number_of_dl_layers>
+			<number_of_ul_layers>1</number_of_ul_layers>
+
+			<3gpp_release_supported>31</3gpp_release_supported>
+
+			<nmm_modes_supported>0</nmm_modes_supported>
+			
+			<dl_ues_per_subframe>8</dl_ues_per_subframe>
+			<ul_ues_per_subframe>8</ul_ues_per_subframe>
+
+			<!-- todo adn the other release parameters -->
+
+			<rfs>
+				<index>0</index>
+			</rfs>
+			<excluded_rfs>
+				<index>1</index>
+			</excluded_rfs>
+
+			<data>
+				<udp>
+					<rx_port>5201</rx_port>
+					<tx_addr>192.168.1.28</tx_addr>
+					<tx_port>5200</tx_port>
+				</udp>
+			</data>
+		</phy>
+	</phys>
+	<rfs>
+		<rf>
+			<index>0</index>
+			<band>2</band>
+			<max_transmit_power>-30</max_transmit_power>
+			<min_transmit_power>-230</min_transmit_power>
+			<num_antennas_supported>2</num_antennas_supported>
+			<min_downlink_frequency>1890</min_downlink_frequency>
+			<max_downlink_frequency>1890</max_downlink_frequency>
+			<max_uplink_frequency>1890</max_uplink_frequency>
+			<min_uplink_frequency>1890</min_uplink_frequency>
+		</rf>
+		<rf>
+			<index>1</index>
+			<band>3</band>
+			<max_transmit_power>-30</max_transmit_power>
+			<min_transmit_power>-230</min_transmit_power>
+			<num_antennas_supported>2</num_antennas_supported>
+			<min_downlink_frequency>1890</min_downlink_frequency>
+			<max_downlink_frequency>1890</max_downlink_frequency>
+			<max_uplink_frequency>1890</max_uplink_frequency>
+			<min_uplink_frequency>1890</min_uplink_frequency>
+		</rf>
+	</rfs>
+</pnf>
diff --git a/nfapi/open-nFAPI/xml/pnf_phy_1_A_ws.xml b/nfapi/open-nFAPI/xml/pnf_phy_1_A_ws.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5eb02841481391ec81e15d965d43431bd15af450
--- /dev/null
+++ b/nfapi/open-nFAPI/xml/pnf_phy_1_A_ws.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pnf>
+	<wireshark_test_mode>1</wireshark_test_mode>
+	
+	<sync_mode>0</sync_mode>
+	<location_mode>0</location_mode>
+	<location_coordinates></location_coordinates>
+
+	<dl_config_timing>500</dl_config_timing>
+	<ul_config_timing>500</ul_config_timing>
+	<tx_timing>500</tx_timing>
+	<hi_dci0_timing>500</hi_dci0_timing>
+
+	<max_phys>1</max_phys>
+	<max_total_bandwidth>30</max_total_bandwidth>
+	<max_total_num_dl_layers>1</max_total_num_dl_layers>
+	<max_total_num_ul_layers>1</max_total_num_ul_layers>
+
+	<shared_bands>0</shared_bands>
+	<shared_pas>0</shared_pas>
+
+	<maximum_total_power>0</maximum_total_power>
+
+	<oui>ALPHA</oui>
+
+
+	<phys>
+		<phy>
+			<index>88</index>
+			<port>2500</port>
+			<address>127.0.0.1</address>
+
+			<duplex_mode>1</duplex_mode>
+
+			<downlink_channel_bandwidth_support>22</downlink_channel_bandwidth_support>
+			<uplink_channel_bandwidth_support>22</uplink_channel_bandwidth_support>
+
+			<number_of_dl_layers>1</number_of_dl_layers>
+			<number_of_ul_layers>1</number_of_ul_layers>
+
+			<3gpp_release_supported>31</3gpp_release_supported>
+
+			<nmm_modes_supported>0</nmm_modes_supported>
+			
+			<dl_ues_per_subframe>8</dl_ues_per_subframe>
+			<ul_ues_per_subframe>8</ul_ues_per_subframe>
+
+			<!-- todo adn the other release parameters -->
+
+			<rfs>
+				<index>0</index>
+			</rfs>
+			<excluded_rfs>
+				<index>1</index>
+			</excluded_rfs>
+
+			<data>
+				<udp>
+					<rx_port>7722</rx_port>
+					<tx_addr>127.0.0.1</tx_addr>
+					<tx_port>7733</tx_port>
+				</udp>
+			</data>
+		</phy>
+	</phys>
+	<rfs>
+		<rf>
+			<index>0</index>
+			<band>2</band>
+			<max_transmit_power>-30</max_transmit_power>
+			<min_transmit_power>-230</min_transmit_power>
+			<num_antennas_supported>2</num_antennas_supported>
+			<min_downlink_frequency>1890</min_downlink_frequency>
+			<max_downlink_frequency>1890</max_downlink_frequency>
+			<max_uplink_frequency>1890</max_uplink_frequency>
+			<min_uplink_frequency>1890</min_uplink_frequency>
+		</rf>
+		<rf>
+			<index>1</index>
+			<band>3</band>
+			<max_transmit_power>-30</max_transmit_power>
+			<min_transmit_power>-230</min_transmit_power>
+			<num_antennas_supported>2</num_antennas_supported>
+			<min_downlink_frequency>1890</min_downlink_frequency>
+			<max_downlink_frequency>1890</max_downlink_frequency>
+			<max_uplink_frequency>1890</max_uplink_frequency>
+			<min_uplink_frequency>1890</min_uplink_frequency>
+		</rf>
+	</rfs>
+</pnf>
diff --git a/nfapi/open-nFAPI/xml/pnf_phy_1_B.xml b/nfapi/open-nFAPI/xml/pnf_phy_1_B.xml
new file mode 100644
index 0000000000000000000000000000000000000000..302e1e19c537ec8a08a8f91ea8ba1715687bf4d1
--- /dev/null
+++ b/nfapi/open-nFAPI/xml/pnf_phy_1_B.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pnf>
+	<sync_mode>0</sync_mode>
+	<location_mode>0</location_mode>
+	<location_coordinates></location_coordinates>
+
+	<dl_config_timing>500</dl_config_timing>
+	<ul_config_timing>500</ul_config_timing>
+	<tx_timing>500</tx_timing>
+	<hi_dci0_timing>500</hi_dci0_timing>
+
+	<max_phys>1</max_phys>
+	<max_total_bandwidth>30</max_total_bandwidth>
+	<max_total_num_dl_layers>1</max_total_num_dl_layers>
+	<max_total_num_ul_layers>1</max_total_num_ul_layers>
+
+	<shared_bands>0</shared_bands>
+	<shared_pas>0</shared_pas>
+
+	<maximum_total_power>0</maximum_total_power>
+
+	<oui>ALPHA</oui>
+
+
+	<phys>
+		<phy>
+			<index>89</index>
+			<port>2510</port>
+			<address>127.0.0.1</address>
+
+			<duplex_mode>1</duplex_mode>
+
+			<downlink_channel_bandwidth_support>22</downlink_channel_bandwidth_support>
+			<uplink_channel_bandwidth_support>22</uplink_channel_bandwidth_support>
+
+			<number_of_dl_layers>1</number_of_dl_layers>
+			<number_of_ul_layers>1</number_of_ul_layers>
+
+			<3gpp_release_supported>31</3gpp_release_supported>
+
+			<nmm_modes_supported>0</nmm_modes_supported>
+			
+			<dl_ues_per_subframe>8</dl_ues_per_subframe>
+			<ul_ues_per_subframe>8</ul_ues_per_subframe>
+
+			<!-- todo adn the other release parameters -->
+
+			<rfs>
+				<index>0</index>
+			</rfs>
+			<excluded_rfs>
+				<index>1</index>
+			</excluded_rfs>
+
+			<data>
+				<udp>
+					<rx_port>7744</rx_port>
+					<tx_addr>127.0.0.1</tx_addr>
+					<tx_port>7755</tx_port>
+				</udp>
+			</data>
+		</phy>
+	</phys>
+	<rfs>
+		<rf>
+			<index>0</index>
+			<band>2</band>
+			<max_transmit_power>-30</max_transmit_power>
+			<min_transmit_power>-230</min_transmit_power>
+			<num_antennas_supported>2</num_antennas_supported>
+			<min_downlink_frequency>1890</min_downlink_frequency>
+			<max_downlink_frequency>1890</max_downlink_frequency>
+			<max_uplink_frequency>1890</max_uplink_frequency>
+			<min_uplink_frequency>1890</min_uplink_frequency>
+		</rf>
+		<rf>
+			<index>1</index>
+			<band>3</band>
+			<max_transmit_power>-30</max_transmit_power>
+			<min_transmit_power>-230</min_transmit_power>
+			<num_antennas_supported>2</num_antennas_supported>
+			<min_downlink_frequency>1890</min_downlink_frequency>
+			<max_downlink_frequency>1890</max_downlink_frequency>
+			<max_uplink_frequency>1890</max_uplink_frequency>
+			<min_uplink_frequency>1890</min_uplink_frequency>
+		</rf>
+	</rfs>
+</pnf>
diff --git a/nfapi/open-nFAPI/xml/pnf_phy_2_A.xml b/nfapi/open-nFAPI/xml/pnf_phy_2_A.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b820fa135e5c70bac7ee133d8509291bbb41ac9e
--- /dev/null
+++ b/nfapi/open-nFAPI/xml/pnf_phy_2_A.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pnf>
+	<sync_mode>0</sync_mode>
+	<location_mode>0</location_mode>
+	<location_coordinates></location_coordinates>
+
+	<dl_config_timing>500</dl_config_timing>
+	<ul_config_timing>500</ul_config_timing>
+	<tx_timing>500</tx_timing>
+	<hi_dci0_timing>500</hi_dci0_timing>
+
+	<max_phys>1</max_phys>
+	<max_total_bandwidth>30</max_total_bandwidth>
+	<max_total_num_dl_layers>1</max_total_num_dl_layers>
+	<max_total_num_ul_layers>1</max_total_num_ul_layers>
+
+	<shared_bands>0</shared_bands>
+	<shared_pas>0</shared_pas>
+
+	<maximum_total_power>0</maximum_total_power>
+
+	<oui>ALPHA</oui>
+	
+	<phys>
+		<phy>
+			<index>88</index>
+			<port>2500</port>
+			<address>127.0.0.1</address>
+
+			<duplex_mode>1</duplex_mode>
+			<downlink_channel_bandwidth_support>22</downlink_channel_bandwidth_support>
+			<uplink_channel_bandwidth_support>22</uplink_channel_bandwidth_support>
+			<number_of_dl_layers>1</number_of_dl_layers>
+			<number_of_ul_layers>1</number_of_ul_layers>
+			<3gpp_release_supported>31</3gpp_release_supported>
+			<nmm_modes_supported>0</nmm_modes_supported>
+			<dl_ues_per_subframe>8</dl_ues_per_subframe>
+			<ul_ues_per_subframe>8</ul_ues_per_subframe>
+
+			<rfs>
+				<index>0</index>
+			</rfs>
+			<excluded_rfs/>
+		</phy>
+		<phy>
+			<index>44</index>
+			<port>2600</port>
+			<address>127.0.0.1</address>
+
+			<duplex_mode>1</duplex_mode>
+			<downlink_channel_bandwidth_support>22</downlink_channel_bandwidth_support>
+			<uplink_channel_bandwidth_support>22</uplink_channel_bandwidth_support>
+			<number_of_dl_layers>1</number_of_dl_layers>
+			<number_of_ul_layers>1</number_of_ul_layers>
+			<3gpp_release_supported>31</3gpp_release_supported>
+			<nmm_modes_supported>0</nmm_modes_supported>
+			<dl_ues_per_subframe>8</dl_ues_per_subframe>
+			<ul_ues_per_subframe>8</ul_ues_per_subframe>
+
+			<rfs>
+				<index>1</index>
+			</rfs>
+			<excluded_rfs/>
+		</phy>
+	</phys>
+	<rfs>
+		<rf>
+			<index>0</index>
+			<band>2</band>
+			<max_transmit_power>-30</max_transmit_power>
+			<min_transmit_power>-230</min_transmit_power>
+			<num_antennas_supported>2</num_antennas_supported>
+			<min_downlink_frequency>1890</min_downlink_frequency>
+			<max_downlink_frequency>1890</max_downlink_frequency>
+			<max_uplink_frequency>1890</max_uplink_frequency>
+			<min_uplink_frequency>1890</min_uplink_frequency>
+		</rf>
+		<rf>
+			<index>1</index>
+			<band>4</band>
+			<max_transmit_power>-30</max_transmit_power>
+			<min_transmit_power>-230</min_transmit_power>
+			<num_antennas_supported>2</num_antennas_supported>
+			<min_downlink_frequency>1890</min_downlink_frequency>
+			<max_downlink_frequency>1890</max_downlink_frequency>
+			<max_uplink_frequency>1890</max_uplink_frequency>
+			<min_uplink_frequency>1890</min_uplink_frequency>
+		</rf>
+	</rfs>
+</pnf>
diff --git a/nfapi/open-nFAPI/xml/vnf_A.xml b/nfapi/open-nFAPI/xml/vnf_A.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3791239ce7821929893d206605b487efd3e4a4f3
--- /dev/null
+++ b/nfapi/open-nFAPI/xml/vnf_A.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vnf>
+	<vnf_p7_list>
+		<vnf_p7>
+			<port>5201</port>
+			<address>192.168.1.28</address>
+			<timing_window>10</timing_window>
+			<periodic_timing_enabled>0</periodic_timing_enabled>
+			<periodic_timing_window>0</periodic_timing_window>
+			<aperiodic_timing_enabled>0</aperiodic_timing_enabled>
+
+			<data>
+				<udp>
+					<rx_port>8891</rx_port>
+					<tx_addr>192.168.1.28</tx_addr>
+					<tx_port>8892</tx_port>
+				</udp>
+			</data>
+		</vnf_p7>
+	</vnf_p7_list>
+</vnf>
diff --git a/nfapi/open-nFAPI/xml/vnf_A_ws.xml b/nfapi/open-nFAPI/xml/vnf_A_ws.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c26adc3cfa11980c9f9697eceefe6de602eb6846
--- /dev/null
+++ b/nfapi/open-nFAPI/xml/vnf_A_ws.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vnf>
+	
+	<vnf_p7_list>
+		<vnf_p7>
+			<wireshark_test_mode>1</wireshark_test_mode>
+			<port>5200</port>
+			<address>127.0.0.1</address>
+			<timing_window>10</timing_window>
+			<periodic_timing_enabled>0</periodic_timing_enabled>
+			<periodic_timing_window>0</periodic_timing_window>
+			<aperiodic_timing_enabled>0</aperiodic_timing_enabled>
+
+			<data>
+				<udp>
+					<rx_port>8891</rx_port>
+					<tx_addr>127.0.0.1</tx_addr>
+					<tx_port>8892</tx_port>
+				</udp>
+			</data>
+		</vnf_p7>
+	</vnf_p7_list>
+</vnf>
diff --git a/nfapi/open-nfapi.oai.patch b/nfapi/open-nfapi.oai.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5b91e3675b0ab0483cd68d940595c58e2060ea29
--- /dev/null
+++ b/nfapi/open-nfapi.oai.patch
@@ -0,0 +1,20010 @@
+diff --git a/common/public_inc/debug.h b/common/public_inc/debug.h
+index 05e9870..14f97a1 100644
+--- a/common/public_inc/debug.h
++++ b/common/public_inc/debug.h
+@@ -39,7 +39,8 @@ extern nfapi_trace_fn_t nfapi_trace_g;
+ extern nfapi_trace_level_t nfapi_trace_level_g;
+ 
+ /*! NFAPI trace macro */
+-#define NFAPI_TRACE(level, format, ...) { if(nfapi_trace_g && ((nfapi_trace_level_t)level <= nfapi_trace_level_g)) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
++//#define NFAPI_TRACE(level, format, ...) { if(nfapi_trace_g && ((nfapi_trace_level_t)level <= nfapi_trace_level_g)) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
++#define NFAPI_TRACE(level, format, ...) { if (nfapi_trace_g) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
+ 
+ /*! Function to change the trace level 
+  * \param new_level The modified trace level
+diff --git a/nfapi/public_inc/nfapi_interface.h b/nfapi/public_inc/nfapi_interface.h
+index 2d58c2a..f665d11 100644
+--- a/nfapi/public_inc/nfapi_interface.h
++++ b/nfapi/public_inc/nfapi_interface.h
+@@ -1772,7 +1772,7 @@ typedef struct {
+ 	uint8_t number_of_cc;
+ 	struct {
+ 		uint8_t ri_size;
+-		uint8_t dl_cqi_pmi_size;
++		uint8_t dl_cqi_pmi_size[8];
+ 	} cc[NFAPI_MAX_CC];
+ } nfapi_ul_config_aperiodic_cqi_pmi_ri_report_t;
+ 
+diff --git a/nfapi/src/nfapi.c b/nfapi/src/nfapi.c
+index 0e06963..3f017bc 100644
+--- a/nfapi/src/nfapi.c
++++ b/nfapi/src/nfapi.c
+@@ -823,6 +823,10 @@ uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *e
+ 		{
+ 			NFAPI_TRACE(NFAPI_TRACE_WARN, "Warning pack_tlv tag 0x%x does not match expected 0x%x\n", tl->tag, tag);
+ 		}
++                else
++                {
++			//NFAPI_TRACE(NFAPI_TRACE_ERROR, "Warning pack_tlv tag 0x%x ZERO does not match expected 0x%x\n", tl->tag, tag);
++                }
+ 	}
+ 
+ 	return 1;
+diff --git a/nfapi/src/nfapi_p7.c b/nfapi/src/nfapi_p7.c
+index a3b0141..69ff860 100644
+--- a/nfapi/src/nfapi_p7.c
++++ b/nfapi/src/nfapi_p7.c
+@@ -111,6 +111,8 @@ static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWrite
+ {
+ 	nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
+ 	
++        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format);
++
+ 	return ( push8(value->dci_format, ppWritePackedMsg, end) &&
+ 			 push8(value->cce_idx, ppWritePackedMsg, end) &&
+ 			 push8(value->aggregation_level, ppWritePackedMsg, end) &&
+@@ -234,6 +236,8 @@ static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePac
+ {
+ 	nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
+ 	
++        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__);
++
+ 	return( push16(value->length, ppWritePackedMsg, end) &&
+ 			push16(value->pdu_index, ppWritePackedMsg, end) &&
+ 			push16(value->transmission_power, ppWritePackedMsg, end));
+@@ -545,6 +549,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
+ {
+ 	nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
+ 
++        //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich);
++
+ 	if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) &&
+ 		 push8(value->number_dci, ppWritePackedMsg, end) &&
+ 		 push16(value->number_pdu, ppWritePackedMsg, end) &&
+@@ -574,6 +580,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
+ 		{
+ 			case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
+ 				{
++                                  //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__);
++
+ 					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
+ 					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
+ 					pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
+@@ -587,6 +595,8 @@ static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePac
+ 				break;
+ 			case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
+ 				{
++                                  //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__);
++
+ 					if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value)))
+ 						return 0;
+ 				}
+@@ -684,10 +694,21 @@ static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uin
+ {
+ 	nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
+ 	
+-	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+-			 pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
+-			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
++	//return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
++			 //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
++			 //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
++        { 
++          uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
++          uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value);
++          uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+ 
++          if (!x || !y || !z)
++          {
++            NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z);
++          }
++
++          return x && y && z;
++        }
+ }
+ 
+ static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end)
+@@ -796,9 +817,10 @@ static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppW
+ 					if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0)
+ 						return 0;
+ 
+-					if(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size > 0)
++                                        uint8_t j;
++                                        for(j = 0; j < 8; ++j)
+ 					{
+-						if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size, ppWritePackedMsg, end) == 0)
++                                              if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0)
+ 							return 0;
+ 					}
+ 				}
+@@ -1518,7 +1540,21 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg,
+ 		for(j = 0; j < pdu->num_segments; ++j)
+ 		{
+ 			// Use -1 as it is unbounded 
+-			if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
++			// DJP - does not handle -1
++                        // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
++			int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
++                        
++                        if (0 && pdu->segments[j].segment_length == 3)
++                        {
++                          NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, 
++                          pdu->segments[j].segment_data[0], 
++                          pdu->segments[j].segment_data[1], 
++                          pdu->segments[j].segment_data[2]
++                          );
++                        }
++                        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret);
++
++                        if (push_ret == 0)
+ 			{
+ 				return 0;
+ 			}
+@@ -1532,9 +1568,13 @@ static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
+ {
+ 	nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
+ 	
+-	return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+-			 pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value) &&
+-			 pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
++	int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
++        int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value);
++        int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
++
++        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z);
++
++        return x && y && z;
+ }
+ 
+ static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+@@ -1844,6 +1884,8 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
+ {
+ 	nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
+ 
++        //printf("RX ULSCH BODY\n");
++
+ 	if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ 		return 0;
+ 
+@@ -1851,21 +1893,26 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
+ 	uint16_t i = 0;
+ 	uint16_t offset = 2; // taking into account the number_of_pdus
+ 	uint16_t total_number_of_pdus = value->number_of_pdus;
++        //printf("ULSCH:pdus:%d\n", total_number_of_pdus);
++
+ 	for(i = 0; i < total_number_of_pdus; ++i)
+ 	{
+ 		nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+ 		if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
+ 		{
++                  //printf("NFAPI_RX_UE_INFORMATION_TAG\n");
+ 			offset += 4 + 6; 
+ 		}
+ 				
+ 		if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ 		{
++                  //printf("NFAPI_RX_INDICATION_REL8_TAG\n");
+ 			offset += 4 + 7;
+ 		}
+ 
+ 		if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG)
+ 		{
++                  //printf("NFAPI_RX_INDICATION_REL9_TAG\n");
+ 			offset += 4 + 2;
+ 		}
+ 	}
+@@ -2592,11 +2639,16 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
+ 		return -1;
+ 	}
+ 
++        if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
++        {
++          //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
++        }
+ 	// look for the specific message
+ 	uint8_t result = 0;
+ 	switch (pMessageHeader->message_id)
+ 	{
+ 		case NFAPI_DL_CONFIG_REQUEST:
++                  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__);
+ 			result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+ 			break;
+ 
+@@ -2609,6 +2661,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
+ 			break;
+ 
+ 		case NFAPI_TX_REQUEST:
++                        //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
+ 			result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
+ 			break;
+ 
+@@ -2621,6 +2674,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
+ 			break;
+ 
+ 		case NFAPI_RX_ULSCH_INDICATION:
++                        //printf("RX ULSCH\n");
+ 			result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ 			break;
+ 
+@@ -3482,9 +3536,10 @@ static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppRe
+ 					if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0)
+ 						return 0;
+ 
+-					if(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size > 0)
++                                        uint8_t j;
++                                        for(j = 0; j < 8; ++j)
+ 					{
+-						if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size, end) == 0)
++						if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0)
+ 							return 0;
+ 					}
+ 				}
+@@ -4394,6 +4449,14 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
+ 					{
+ 						if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
+ 							return 0;
++                                                if (0 && pdu->segments[0].segment_length == 3)
++                                                {
++                                                  NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, 
++                                                      pdu->segments[0].segment_data[0], 
++                                                      pdu->segments[0].segment_data[1], 
++                                                      pdu->segments[0].segment_data[2]
++                                                      );
++                                                }
+ 					}
+ 					else
+ 					{
+diff --git a/pnf/public_inc/nfapi_pnf_interface.h b/pnf/public_inc/nfapi_pnf_interface.h
+index f93624d..b25caf2 100644
+--- a/pnf/public_inc/nfapi_pnf_interface.h
++++ b/pnf/public_inc/nfapi_pnf_interface.h
+@@ -319,10 +319,10 @@ typedef struct nfapi_pnf_config
+  *  0 will be returned if it fails.
+  * 
+  * \code
+- * nfapi_pnf_config_t* config = nfapi_pnf_config_create();
++ * nfapi_pnf_config_t* config = nfapi_pnf_config_create(void);
+  * \endcode
+  */
+-nfapi_pnf_config_t* nfapi_pnf_config_create();
++nfapi_pnf_config_t* nfapi_pnf_config_create(void);
+ 
+ /*! Delete a pnf configuration 
+  * \param config A pointer to a pnf configuraiton
+@@ -681,7 +681,7 @@ typedef struct nfapi_pnf_p7_config
+ /*! Create and initialise a nfapi_pnf_p7_config structure
+  * \return A pointer to a PNF P7 config structure
+  */
+-nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create();
++nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create(void);
+ 
+ /*! Delete an nfapi_pnf_p7_config structure
+  * \param config 
+diff --git a/pnf/src/pnf.c b/pnf/src/pnf.c
+index d6cf364..d0a7fa6 100644
+--- a/pnf/src/pnf.c
++++ b/pnf/src/pnf.c
+@@ -412,10 +412,10 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
+ 	{
+ 		nfapi_start_request_t req;
+ 	
+-		NFAPI_TRACE(NFAPI_TRACE_INFO, "START.request received\n");
+-	
+ 		nfapi_pnf_config_t* config = &(pnf->_public);
+ 	
++		NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
++	
+ 		// unpack the message
+ 		if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
+ 		{
+diff --git a/pnf/src/pnf_interface.c b/pnf/src/pnf_interface.c
+index 74f29a0..7310fc0 100644
+--- a/pnf/src/pnf_interface.c
++++ b/pnf/src/pnf_interface.c
+@@ -76,6 +76,7 @@ int nfapi_pnf_start(nfapi_pnf_config_t* config)
+ 
+ 		sleep(1);
+ 	}
++	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
+ 
+ 	return 0;
+ }
+@@ -227,7 +228,7 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res
+ 	}
+ 	else
+ 	{
+-		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
++		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknown phy id %d\n", __FUNCTION__, resp->header.phy_id);
+ 		return -1;
+ 	}
+ 
+diff --git a/pnf/src/pnf_p7.c b/pnf/src/pnf_p7.c
+index 0fd7828..02b828d 100644
+--- a/pnf/src/pnf_p7.c
++++ b/pnf/src/pnf_p7.c
+@@ -25,12 +25,64 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <pthread.h>
++#include <stdio.h>
+ 
+ #include "pnf_p7.h"
+ 
+ #define FAPI2_IP_DSCP	0
+ 
+-uint32_t get_current_time_hr()
++extern uint16_t sf_ahead;
++//uint16_t sf_ahead=4;
++
++void add_sf(uint16_t *frameP, uint16_t *subframeP, int offset)
++{
++    *frameP    = *frameP + ((*subframeP + offset) / 10);
++
++    *subframeP = ((*subframeP + offset) % 10);
++}
++
++void subtract_sf(uint16_t *frameP, uint16_t *subframeP, int offset)
++{
++  if (*subframeP < offset)
++  {
++    *frameP = (*frameP+1024-1)%1024;
++  }
++  *subframeP = (*subframeP+10-offset)%10;
++}
++
++uint16_t sfnsf_add_sf(uint16_t sfnsf, int offset)
++{
++  uint16_t new_sfnsf;
++  uint16_t sfn = NFAPI_SFNSF2SFN(sfnsf);
++  uint16_t sf  = NFAPI_SFNSF2SF(sfnsf);
++
++  //printf("%s() sfn:%u sf:%u\n", __FUNCTION__, sfn, sf);
++  add_sf(&sfn, &sf, offset);
++
++  new_sfnsf = sfn<<4|sf;
++
++  //printf("%s() sfn:%u sf:%u offset:%d sfnsf:%d(DEC:%d) new:%d(DEC:%d)\n", __FUNCTION__, sfn, sf, offset, sfnsf, NFAPI_SFNSF2DEC(sfnsf), new_sfnsf, NFAPI_SFNSF2DEC(new_sfnsf));
++
++  return new_sfnsf;
++}
++
++uint16_t sfnsf_subtract_sf(uint16_t sfnsf, int offset)
++{
++  uint16_t new_sfnsf;
++  uint16_t sfn = NFAPI_SFNSF2SFN(sfnsf);
++  uint16_t sf  = NFAPI_SFNSF2SF(sfnsf);
++
++  //printf("%s() sfn:%u sf:%u\n", __FUNCTION__, sfn, sf);
++  subtract_sf(&sfn, &sf, offset);
++
++  new_sfnsf = sfn<<4|sf;
++
++  //printf("%s() offset:%d sfnsf:%d(DEC:%d) new:%d(DEC:%d)\n", __FUNCTION__, offset, sfnsf, NFAPI_SFNSF2DEC(sfnsf), new_sfnsf, NFAPI_SFNSF2DEC(new_sfnsf));
++
++  return new_sfnsf;
++}
++
++uint32_t pnf_get_current_time_hr(void)
+ {
+ 	struct timeval now;
+ 	(void)gettimeofday(&now, NULL);
+@@ -64,11 +116,14 @@ void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr)
+ // todo : for now these just malloc/free need to move to a memory cache
+ nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7) 
+ { 
+-	return pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t));
++	void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_dl_config_request_t));
++        //printf("%s() ptr:%p\n", __FUNCTION__, ptr);
++        return ptr;
+ }
+ 
+ void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t* pnf_p7) 
+ { 
++  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->dl_config_request_body.dl_config_pdu_list);
+ 	if(pnf_p7->_public.codec_config.deallocate)
+ 	{
+ 		(pnf_p7->_public.codec_config.deallocate)(req->dl_config_request_body.dl_config_pdu_list);
+@@ -77,17 +132,21 @@ void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t
+ 	{
+ 		free(req->dl_config_request_body.dl_config_pdu_list);
+ 	}
++        req->dl_config_request_body.dl_config_pdu_list=0;
+ 
+ 	pnf_p7_free(pnf_p7, req);
+ }
+ 
+ nfapi_ul_config_request_t* allocate_nfapi_ul_config_request(pnf_p7_t* pnf_p7) 
+ { 
+-	return pnf_p7_malloc(pnf_p7, sizeof(nfapi_ul_config_request_t));
++	void *ptr= pnf_p7_malloc(pnf_p7, sizeof(nfapi_ul_config_request_t));
++        //printf("%s() ptr:%p\n", __FUNCTION__, ptr);
++        return ptr;
+ }
+ 
+ void deallocate_nfapi_ul_config_request(nfapi_ul_config_request_t* req, pnf_p7_t* pnf_p7) 
+ { 
++  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->ul_config_request_body.ul_config_pdu_list);
+ 	if(pnf_p7->_public.codec_config.deallocate)
+ 	{
+ 		(pnf_p7->_public.codec_config.deallocate)(req->ul_config_request_body.ul_config_pdu_list);
+@@ -96,6 +155,7 @@ void deallocate_nfapi_ul_config_request(nfapi_ul_config_request_t* req, pnf_p7_t
+ 	{
+ 		free(req->ul_config_request_body.ul_config_pdu_list);
+ 	}
++        req->ul_config_request_body.ul_config_pdu_list=0;
+ 
+ 	pnf_p7_free(pnf_p7, req);
+ }
+@@ -107,6 +167,7 @@ nfapi_hi_dci0_request_t* allocate_nfapi_hi_dci0_request(pnf_p7_t* pnf_p7)
+ 
+ void deallocate_nfapi_hi_dci0_request(nfapi_hi_dci0_request_t* req, pnf_p7_t* pnf_p7) 
+ { 
++  //printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->hi_dci0_request_body.hi_dci0_pdu_list);
+ 	if(pnf_p7->_public.codec_config.deallocate)
+ 	{
+ 		(pnf_p7->_public.codec_config.deallocate)(req->hi_dci0_request_body.hi_dci0_pdu_list);
+@@ -115,6 +176,7 @@ void deallocate_nfapi_hi_dci0_request(nfapi_hi_dci0_request_t* req, pnf_p7_t* pn
+ 	{
+ 		free(req->hi_dci0_request_body.hi_dci0_pdu_list);
+ 	}
++        req->hi_dci0_request_body.hi_dci0_pdu_list=0;
+ 
+ 	pnf_p7_free(pnf_p7, req);
+ }
+@@ -127,6 +189,9 @@ nfapi_tx_request_t* allocate_nfapi_tx_request(pnf_p7_t* pnf_p7)
+ void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7) 
+ { 
+ 	int i = 0;
++
++  //printf("%s() SFN/SF:%d %s req:%p pdu[0]:data:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->tx_request_body.tx_pdu_list[i].segments[0].segment_data);
++
+ 	for(i = 0; i < req->tx_request_body.number_of_pdus; ++i)
+ 	{
+ 		void* data = req->tx_request_body.tx_pdu_list[i].segments[0].segment_data;
+@@ -139,6 +204,7 @@ void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7)
+ 		{
+ 			free(data);
+ 		}
++                data=0;
+ 	}
+ 
+ 
+@@ -150,6 +216,7 @@ void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7)
+ 	{
+ 		free(req->tx_request_body.tx_pdu_list);
+ 	}
++        req->tx_request_body.tx_pdu_list=0;
+ 
+ 	pnf_p7_free(pnf_p7, req);
+ }
+@@ -169,6 +236,7 @@ void deallocate_nfapi_lbt_dl_config_request(nfapi_lbt_dl_config_request_t* req,
+ 	{
+ 		free(req->lbt_dl_config_request_body.lbt_dl_config_req_pdu_list);
+ 	}
++        req->lbt_dl_config_request_body.lbt_dl_config_req_pdu_list=0;
+ 
+ 	pnf_p7_free(pnf_p7, req);
+ }
+@@ -307,11 +375,11 @@ void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reas
+ }
+ 
+ 
+-uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
++static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
+ {
+ 	if(now_hr < sf_start_hr)
+ 	{
+-		NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier that start of subframe\n");
++		NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr);
+ 		return 0;
+ 	}
+ 	else
+@@ -482,29 +550,41 @@ void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7)
+ 
+ void send_dummy_subframe(pnf_p7_t* pnf_p7, uint16_t sfn_sf)
+ {
++  struct timespec t;
++  clock_gettime( CLOCK_MONOTONIC, &t);
++
++  //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(sfn_sf:%d) t:%ld.%09ld\n", __FUNCTION__, NFAPI_SFNSF2DEC(sfn_sf), t.tv_sec, t.tv_nsec);
++
++	if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
++	{
++		pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
++		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy tx_req - enter\n");
++		(pnf_p7->_public.tx_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.tx_req);
++		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy tx_req - exit\n");
++	}
+ 	if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
+ 	{
+ 		pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf;
++		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - enter\n");
+ 		(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
++		//NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy dl_config_req - exit\n");
+ 	}
+ 	if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
+ 	{
+ 		pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
++		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy ul_config_req - enter\n");
+ 		(pnf_p7->_public.ul_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.ul_config_req);
+ 	}
+ 	if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req)
+ 	{
+ 		pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf;
++		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy hi_dci0 - enter\n");
+ 		(pnf_p7->_public.hi_dci0_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.hi_dci0_req);
+ 	}
+-	if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
+-	{
+-		pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
+-		(pnf_p7->_public.tx_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.tx_req);
+-	}
+ 	if(pnf_p7->_public.lbt_dl_config_req && pnf_p7->_public.dummy_subframe.lbt_dl_config_req)
+ 	{
+ 		pnf_p7->_public.dummy_subframe.lbt_dl_config_req->sfn_sf = sfn_sf;
++		NFAPI_TRACE(NFAPI_TRACE_INFO, "Dummy lbt - enter\n");
+ 		(pnf_p7->_public.lbt_dl_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.lbt_dl_config_req);
+ 	}
+ }
+@@ -526,10 +606,14 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 		return -1;
+ 	}
+ 
++#if 1
+ 	// save the curren time and sfn_sf
+-	pnf_p7->sf_start_time_hr = get_current_time_hr();
++	pnf_p7->sf_start_time_hr = pnf_get_current_time_hr();
+ 	pnf_p7->sfn_sf = sfn_sf;
+ 
++        uint32_t sfn_sf_tx = sfnsf_add_sf(sfn_sf, sf_ahead);
++        uint32_t tx_sfn_sf_dec = NFAPI_SFNSF2DEC(sfn_sf_tx);
++
+ 	// If the subframe_buffer has been configured
+ 	if(pnf_p7->_public.subframe_buffer_size != 0)
+ 	{
+@@ -550,6 +634,10 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 			NFAPI_TRACE(NFAPI_TRACE_INFO, "Applying shift %d to sfn/sf (%d -> %d)\n", pnf_p7->sfn_sf_shift, NFAPI_SFNSF2DEC(sfn_sf), shifted_sfn_sf);
+ 			sfn_sf = shifted_sfn_sf;
+ 
++                        //
++                        // DJP - why does the shift not apply to pnf_p7->sfn_sf???
++                        //
++
+ 			pnf_p7->sfn_sf_shift = 0;
+ 		}
+ 
+@@ -558,77 +646,119 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 
+ 		nfapi_pnf_p7_subframe_buffer_t* subframe_buffer = &(pnf_p7->subframe_buffer[buffer_index]);
+ 
++		uint8_t tx_buffer_index = tx_sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
++		nfapi_pnf_p7_subframe_buffer_t* tx_subframe_buffer = &(pnf_p7->subframe_buffer[tx_buffer_index]);
++
++                //printf("sfn_sf_dec:%d tx_sfn_sf_dec:%d\n", sfn_sf_dec, tx_sfn_sf_dec);
++
++                if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d subframe_buffer->sfn_sf:%d tx_subframe_buffer->sfn_sf:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
++                    "TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n", 
++                    __FUNCTION__, 
++                    pnf_p7->sfn_sf_shift, 
++                    NFAPI_SFNSF2DEC(subframe_buffer->sfn_sf), 
++                    NFAPI_SFNSF2DEC(tx_subframe_buffer->sfn_sf), 
++                       sfn_sf_dec,    buffer_index,    subframe_buffer->dl_config_req,    subframe_buffer->tx_req, 
++                    tx_sfn_sf_dec, tx_buffer_index, tx_subframe_buffer->dl_config_req, tx_subframe_buffer->tx_req);
++
+ 		// if the subframe buffer sfn sf is set then we have atlease 1 message
+ 		// from the vnf. 
+ 		// todo : how to handle the messages we don't have, send dummies for
+ 		// now
+-		if(subframe_buffer->sfn_sf == sfn_sf)
++
++                //printf("tx_subframe_buffer->sfn_sf:%d sfn_sf_tx:%d\n", tx_subframe_buffer->sfn_sf, sfn_sf_tx);
++                //printf("subframe_buffer->sfn_sf:%d sfn_sf:%d\n", subframe_buffer->sfn_sf, sfn_sf);
++		if(tx_subframe_buffer->sfn_sf == sfn_sf_tx)
+ 		{
+-			if(subframe_buffer->dl_config_req != 0)
++			if(tx_subframe_buffer->tx_req != 0)
+ 			{
+-				if(pnf_p7->_public.dl_config_req)
+-					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), subframe_buffer->dl_config_req);
++				if(pnf_p7->_public.tx_req)
++					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), tx_subframe_buffer->tx_req);
+ 
+-				deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
++				//deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
+ 			}
+ 			else
+ 			{
+ 				// send dummy
+-				if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
++				if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
+ 				{
+-					pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf;
+-					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
++					pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf_tx;
++					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.tx_req);
+ 				}
+ 			}
+ 
+-			if(subframe_buffer->ul_config_req != 0)
++			if(tx_subframe_buffer->dl_config_req != 0)
+ 			{
+-				if(pnf_p7->_public.ul_config_req)
+-					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), subframe_buffer->ul_config_req);
++				if(pnf_p7->_public.dl_config_req)
++					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), tx_subframe_buffer->dl_config_req);
+ 
+-				deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
++				//deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
+ 			}
+ 			else
+ 			{
+ 				// send dummy
+-				if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
++				if(pnf_p7->_public.dl_config_req && pnf_p7->_public.dummy_subframe.dl_config_req)
+ 				{
+-					pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
+-					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.ul_config_req);
++					pnf_p7->_public.dummy_subframe.dl_config_req->sfn_sf = sfn_sf_tx;
++					(pnf_p7->_public.dl_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.dl_config_req);
+ 				}
+ 			}
+ 
+-			if(subframe_buffer->hi_dci0_req != 0)
++			if(tx_subframe_buffer->hi_dci0_req != 0)
+ 			{
+ 				if(pnf_p7->_public.hi_dci0_req)
+-					(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), subframe_buffer->hi_dci0_req);
++					(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), tx_subframe_buffer->hi_dci0_req);
+ 
+-				deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
++				//deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
+ 			}
+ 			else
+ 			{
+ 				//send dummy
+ 				if(pnf_p7->_public.hi_dci0_req && pnf_p7->_public.dummy_subframe.hi_dci0_req)
+ 				{
+-					pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf;
++					pnf_p7->_public.dummy_subframe.hi_dci0_req->sfn_sf = sfn_sf_tx;
+ 					(pnf_p7->_public.hi_dci0_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.hi_dci0_req);
+ 				}
+ 			}
+ 
+-			if(subframe_buffer->tx_req != 0)
++                        if(tx_subframe_buffer->dl_config_req != 0)
++                        {
++                          deallocate_nfapi_dl_config_request(tx_subframe_buffer->dl_config_req, pnf_p7);
++                          tx_subframe_buffer->dl_config_req = 0;
++                        }
++			if(tx_subframe_buffer->tx_req != 0)
++                        {
++                          deallocate_nfapi_tx_request(tx_subframe_buffer->tx_req, pnf_p7);
++                          tx_subframe_buffer->tx_req = 0;
++                        }
++                        if(tx_subframe_buffer->hi_dci0_req != 0)
++                        {
++                          deallocate_nfapi_hi_dci0_request(tx_subframe_buffer->hi_dci0_req, pnf_p7);
++                          tx_subframe_buffer->hi_dci0_req = 0;
++                        }
++                }
++		else
++		{
++                  // If we ever need to "send" a dummy ul_config this won't work!!!
++                  send_dummy_subframe(pnf_p7, sfn_sf_tx);
++		}
++
++                if(subframe_buffer->sfn_sf == sfn_sf)
++		{
++
++			if(subframe_buffer->ul_config_req != 0)
+ 			{
+-				if(pnf_p7->_public.tx_req)
+-					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), subframe_buffer->tx_req);
++				if(pnf_p7->_public.ul_config_req)
++					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), subframe_buffer->ul_config_req);
+ 
+-				deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
++				//deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
+ 			}
+ 			else
+ 			{
+ 				// send dummy
+-				if(pnf_p7->_public.tx_req && pnf_p7->_public.dummy_subframe.tx_req)
++				if(pnf_p7->_public.ul_config_req && pnf_p7->_public.dummy_subframe.ul_config_req)
+ 				{
+-					pnf_p7->_public.dummy_subframe.tx_req->sfn_sf = sfn_sf;
+-					(pnf_p7->_public.tx_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.tx_req);
++					pnf_p7->_public.dummy_subframe.ul_config_req->sfn_sf = sfn_sf;
++					(pnf_p7->_public.ul_config_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.ul_config_req);
+ 				}
+ 			}
+ 
+@@ -637,7 +767,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 				if(pnf_p7->_public.lbt_dl_config_req)
+ 					(pnf_p7->_public.lbt_dl_config_req)(&(pnf_p7->_public), subframe_buffer->lbt_dl_config_req);
+ 
+-				deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
++				//deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
+ 			}
+ 			else
+ 			{
+@@ -650,14 +780,35 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 
+ 			}
+ 
+-			memset(&(pnf_p7->subframe_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_subframe_buffer_t));
+-			pnf_p7->subframe_buffer[buffer_index].sfn_sf = -1;
+-		}
+-		else
+-		{
+-			send_dummy_subframe(pnf_p7, sfn_sf);
++                        //if(subframe_buffer->dl_config_req != 0)
++                          //deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
++			//if(subframe_buffer->tx_req != 0)
++                          //deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
++                        if(subframe_buffer->ul_config_req != 0)
++                        {
++                          deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7);
++                          subframe_buffer->ul_config_req = 0;
++
++                        }
++                        //if(subframe_buffer->hi_dci0_req != 0)
++                          //deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7);
++			if(subframe_buffer->lbt_dl_config_req != 0)
++                        {
++                          deallocate_nfapi_lbt_dl_config_request(subframe_buffer->lbt_dl_config_req, pnf_p7);
++                          subframe_buffer->lbt_dl_config_req = 0;
++                        }
++                } // sfn_sf match
++
++                if (subframe_buffer->dl_config_req == 0 && subframe_buffer->tx_req == 0 && subframe_buffer->ul_config_req == 0 && subframe_buffer->lbt_dl_config_req == 0)
++                {
++                  memset(&(pnf_p7->subframe_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_subframe_buffer_t));
++                  pnf_p7->subframe_buffer[buffer_index].sfn_sf = -1;
+ 		}
+ 
++                //printf("pnf_p7->_public.timing_info_mode_periodic:%d pnf_p7->timing_info_period_counter:%d pnf_p7->_public.timing_info_period:%d\n", pnf_p7->_public.timing_info_mode_periodic, pnf_p7->timing_info_period_counter, pnf_p7->_public.timing_info_period);
++                //printf("pnf_p7->_public.timing_info_mode_aperiodic:%d pnf_p7->timing_info_aperiodic_send:%d\n", pnf_p7->_public.timing_info_mode_aperiodic, pnf_p7->timing_info_aperiodic_send);
++                //printf("pnf_p7->timing_info_ms_counter:%d\n", pnf_p7->timing_info_ms_counter);
++
+ 		// send the periodic timing info if configured
+ 		if(pnf_p7->_public.timing_info_mode_periodic && (pnf_p7->timing_info_period_counter++) == pnf_p7->_public.timing_info_period)
+ 		{
+@@ -678,14 +829,15 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 	}
+ 	else
+ 	{
+-		send_dummy_subframe(pnf_p7, sfn_sf);
++		//send_dummy_subframe(pnf_p7, sfn_sf_tx);
+ 	}
+ 
+ 
++        //printf("pnf_p7->tick:%d\n", pnf_p7->tick);
+ 	if(pnf_p7->tick == 1000)
+ 	{
+ 
+-		NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
++		NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] (ONTIME/LATE) DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
+ 					pnf_p7->stats.dl_conf_ontime, pnf_p7->stats.dl_conf_late, 
+ 					pnf_p7->stats.ul_conf_ontime, pnf_p7->stats.ul_conf_late, 
+ 					pnf_p7->stats.hi_dci0_ontime, pnf_p7->stats.hi_dci0_late, 
+@@ -694,6 +846,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
+ 		memset(&pnf_p7->stats, 0, sizeof(pnf_p7->stats));
+ 	}
+ 	pnf_p7->tick++;
++#endif
+ 
+ 	if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
+ 	{
+@@ -724,7 +877,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
+ 			if(recv_sfn_sf_dec > ((current_sfn_sf_dec + timing_window) % NFAPI_MAX_SFNSFDEC))
+ 			{
+ 				// out of window
+-				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is late %d (with wrap)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
++				NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is late %d (with wrap)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec);
+ 			}
+ 			else
+ 			{
+@@ -736,7 +889,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
+ 		else
+ 		{
+ 			// too late
+-			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in late %d (%d)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (current_sfn_sf_dec - recv_sfn_sf_dec));
++			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in late %d (delta:%d)\n", current_sfn_sf_dec, name, recv_sfn_sf_dec, (current_sfn_sf_dec - recv_sfn_sf_dec));
+ 		}
+ 
+ 	}
+@@ -751,8 +904,8 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
+ 		}
+ 		else
+ 		{
+-			// to far in the future
+-			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (%d) [%d]\n", current_sfn_sf_dec, name, recv_sfn_sf_dec,  (recv_sfn_sf_dec - current_sfn_sf_dec), timing_window);
++			// too far in the future
++			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", current_sfn_sf_dec, name, recv_sfn_sf_dec,  (recv_sfn_sf_dec - current_sfn_sf_dec), timing_window);
+ 		}
+ 
+ 	}
+@@ -785,15 +938,35 @@ void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
+ 			return;
+ 		}
+ 
+-		if(is_p7_request_in_window(req->sfn_sf, "dl_config_request", pnf_p7))
+-		{
+-			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+-			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
++                if (
++                    0 && 
++                    (NFAPI_SFNSF2DEC(req->sfn_sf) % 100 ==0 ||
++                     NFAPI_SFNSF2DEC(req->sfn_sf) % 105 ==0 
++                    )
++                )
++                  NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req sfn_sf:%d pdcch:%u dci:%u pdu:%u pdsch_rnti:%u pcfich:%u\n", 
++                      NFAPI_SFNSF2DEC(req->sfn_sf),
++                      req->dl_config_request_body.number_pdcch_ofdm_symbols,
++                      req->dl_config_request_body.number_dci,
++                      req->dl_config_request_body.number_pdu,
++                      req->dl_config_request_body.number_pdsch_rnti,
++                      req->dl_config_request_body.transmission_power_pcfich
++                      );
++
++                if(is_p7_request_in_window(req->sfn_sf, "dl_config_request", pnf_p7))
++                {
++                  uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
++                  uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
++
++                        struct timespec t;
++                        clock_gettime(CLOCK_MONOTONIC, &t);
++
++                  NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
+ 
+ 			// if there is already an dl_config_req make sure we free it.
+ 			if(pnf_p7->subframe_buffer[buffer_index].dl_config_req != 0)
+ 			{
+-				NFAPI_TRACE(NFAPI_TRACE_NOTE, "HERE HERE HERE\n");
++				NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_sf:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), buffer_index);
+ 				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing dl_config_req at index %d (%d/%d)", 
+ 				//			pMyPhyInfo->sfnSf, bufferIdx,
+ 				//			SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
+@@ -860,6 +1033,11 @@ void pnf_handle_ul_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
+ 			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+ 			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+ 
++                        struct timespec t;
++                        clock_gettime(CLOCK_MONOTONIC, &t);
++
++                        NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_CONFIG_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
++
+ 			if(pnf_p7->subframe_buffer[buffer_index].ul_config_req != 0)
+ 			{
+ 				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing ul_config_req at index %d (%d/%d)", 
+@@ -876,7 +1054,7 @@ void pnf_handle_ul_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
+ 		}
+ 		else
+ 		{
+-			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing ul_config_req SFN/SF %d/%d\n", pMyPhyInfo->sfnSf, SFNSF2SFN(req->sfn_sf), SFNSF2SF(req->sfn_sf));
++			NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing ul_config_req OUTSIDE OF TRANSMIT BUFFER WINDOW SFN/SF %d\n", NFAPI_SFNSF2DEC(pnf_p7->sfn_sf), NFAPI_SFNSF2DEC(req->sfn_sf));
+ 			deallocate_nfapi_ul_config_request(req, pnf_p7);
+ 
+ 			if(pnf_p7->_public.timing_info_mode_aperiodic)
+@@ -994,6 +1172,16 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+ 			uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
+ 			uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
+ 
++                        struct timespec t;
++                        clock_gettime(CLOCK_MONOTONIC, &t);
++
++                        NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE TX_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
++
++                        if (0 && NFAPI_SFNSF2DEC(req->sfn_sf)%100==0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX_REQ.req sfn_sf:%d pdus:%d - TX_REQ is within window\n",
++                            __FUNCTION__,
++                            NFAPI_SFNSF2DEC(req->sfn_sf),
++                            req->tx_request_body.number_of_pdus);
++
+ 			if(pnf_p7->subframe_buffer[buffer_index].tx_req != 0)
+ 			{
+ 				//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing tx_req at index %d (%d/%d)", 
+@@ -1010,6 +1198,8 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
+ 		}
+ 		else
+ 		{
++                  NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() TX_REQUEST Request is outside of window REQ:SFN_SF:%d CURR:SFN_SF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), NFAPI_SFNSF2DEC(pnf_p7->sfn_sf));
++
+ 			deallocate_nfapi_tx_request(req, pnf_p7);
+ 
+ 			if(pnf_p7->_public.timing_info_mode_aperiodic)
+@@ -1126,12 +1316,27 @@ uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t
+ 	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+ 	uint32_t t2 = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us;
+ 
++        if (0)
++        {
++          static uint32_t prev_t2 = 0;
++
++          NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s(now_time_hr:%u sfn_sf:%d sf_start_time_Hr:%u) sf_time_us:%u t2:%u prev_t2:%u diff:%u\n",
++              __FUNCTION__,
++              now_time_hr, NFAPI_SFNSF2DEC(sfn_sf), sf_start_time_hr,
++              sf_time_us,
++              t2,
++              prev_t2,
++              t2-prev_t2);
++
++          prev_t2 = t2;
++        }
++
+ 	return t2;
+ }
+ 
+ uint32_t calculate_t3(uint16_t sfn_sf, uint32_t sf_start_time_hr)
+ {
+-	uint32_t now_time_hr = get_current_time_hr();
++	uint32_t now_time_hr = pnf_get_current_time_hr();
+ 
+ 	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+ 
+@@ -1391,6 +1596,8 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
+ 			// read the segment
+ 			recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size);
+ 
++		now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp???
++
+ 			if(recvfrom_result > 0)
+ 			{
+ 				pnf_handle_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time);
+@@ -1417,7 +1624,10 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
+ 
+ 		// need to update the time as we would only use the value from the
+ 		// select
+-		now_hr_time = get_current_time_hr();
++#if 0
++// DJP - why do this here and not on return from recv???
++		now_hr_time = pnf_get_current_time_hr();
++#endif
+ 	}
+ 	while(recvfrom_result > 0);
+ }
+@@ -1512,7 +1722,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
+ 
+ 		selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout);
+ 
+-		uint32_t now_hr_time = get_current_time_hr();
++		uint32_t now_hr_time = pnf_get_current_time_hr();
+ 
+ 		if(selectRetval == 0)
+ 		{	
+diff --git a/pnf_sim/src/main.cpp b/pnf_sim/src/main.cpp
+index 38767d8..e2622cf 100644
+--- a/pnf_sim/src/main.cpp
++++ b/pnf_sim/src/main.cpp
+@@ -1124,16 +1124,18 @@ int fapi_rx_ulsch_ind(fapi_t* fapi, fapi_rx_ulsch_ind_t* ind)
+ 	rx_ind.header.phy_id = data->p7_config->phy_id;
+ 	rx_ind.sfn_sf = ind->sfn_sf;
+ 	
+-	if(((pnf_info*)(data->config->user_data))->wireshark_test_mode)
++	if(1)//((pnf_info*)(data->config->user_data))->wireshark_test_mode)
+ 	{
+ 		rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
+-		rx_ind.rx_indication_body.number_of_pdus = 8;
++		rx_ind.rx_indication_body.number_of_pdus = 1;
+ 		
+ 		uint8_t rx_data[1024];
+ 		
+ 		nfapi_rx_indication_pdu_t pdus[rx_ind.rx_indication_body.number_of_pdus];
+ 		memset(&pdus, 0, sizeof(pdus));
+ 		
++                strcpy((char*)rx_data, (char*)"123456789");
++
+ 		for(int i = 0; i < rx_ind.rx_indication_body.number_of_pdus;++i)
+ 		{
+ 		
+@@ -1142,13 +1144,13 @@ int fapi_rx_ulsch_ind(fapi_t* fapi, fapi_rx_ulsch_ind_t* ind)
+ 			pdus[i].rx_ue_information.rnti = rand_range(1, 65535);
+ 			
+ 			pdus[i].rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
+-			pdus[i].rx_indication_rel8.length = rand_range(0, 1024);
+-			pdus[i].rx_indication_rel8.offset = 1;
++			pdus[i].rx_indication_rel8.length = 10;//rand_range(0, 1024);
++			pdus[i].rx_indication_rel8.offset = 0;//djp - 1;
+ 			pdus[i].rx_indication_rel8.ul_cqi = rand_range(0, 255);
+ 			pdus[i].rx_indication_rel8.timing_advance = rand_range(0, 63);
+ 			
+-			pdus[i].rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
+-			pdus[i].rx_indication_rel9.timing_advance_r9 = rand_range(0, 7690);
++			//pdus[i].rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
++			//pdus[i].rx_indication_rel9.timing_advance_r9 = rand_range(0, 7690);
+ 			
+ 			pdus[i].data = &rx_data[0];
+ 		}
+diff --git a/vnf/inc/vnf_p7.h b/vnf/inc/vnf_p7.h
+index ab9a335..fc2ab4e 100644
+--- a/vnf/inc/vnf_p7.h
++++ b/vnf/inc/vnf_p7.h
+@@ -116,7 +116,8 @@ typedef struct {
+ 	
+ } vnf_p7_t;
+ 
+-uint32_t get_current_time_hr();
++uint32_t vnf_get_current_time_hr(void);
++
+ uint16_t increment_sfn_sf(uint16_t sfn_sf);
+ int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
+ int send_mac_subframe_indications(vnf_p7_t* config);
+diff --git a/vnf/public_inc/nfapi_vnf_interface.h b/vnf/public_inc/nfapi_vnf_interface.h
+index 6659e5d..4629013 100644
+--- a/vnf/public_inc/nfapi_vnf_interface.h
++++ b/vnf/public_inc/nfapi_vnf_interface.h
+@@ -450,7 +450,7 @@ typedef struct nfapi_vnf_config
+ /*! Creates and initialise the vnf config structure before use
+  * \return A pointer to a vnf config structure
+  */
+-nfapi_vnf_config_t* nfapi_vnf_config_create();
++nfapi_vnf_config_t* nfapi_vnf_config_create(void);
+ 
+ /*! Delete an vnf config
+  */
+@@ -864,7 +864,7 @@ typedef struct nfapi_vnf_p7_config
+ /*! Creates and initializes the nfapi_vnf_p7_config structure before use
+  *  \return A pointer to an allocated vnf p7 configuration
+  */
+-nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create();
++nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create(void);
+ 
+ /*! Cleanup and delete nfapi_vnf_p7_config structure
+  *  \param config A pointer to an vnf p7 configuration structure
+diff --git a/vnf/src/vnf.c b/vnf/src/vnf.c
+index fea3cf7..6800ee2 100644
+--- a/vnf/src/vnf.c
++++ b/vnf/src/vnf.c
+@@ -82,11 +82,18 @@ void nfapi_vnf_pnf_list_add(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* no
+ 
+ nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5_idx)
+ {
++	NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : config->pnf_list:%p\n", __FUNCTION__, config->pnf_list);
++
+ 	nfapi_vnf_pnf_info_t* curr = config->pnf_list;
+ 	while(curr != 0)
+ 	{
+ 		if(curr->p5_idx == p5_idx)
++                {
++                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : curr->p5_idx:%d p5_idx:%d\n", __FUNCTION__, curr->p5_idx, p5_idx);
+ 			return curr;
++                        }
++
++                NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : curr->next:%p\n", __FUNCTION__, curr->next);
+ 
+ 		curr = curr->next;
+ 	}
+diff --git a/vnf/src/vnf_interface.c b/vnf/src/vnf_interface.c
+index e559730..0aba0a2 100644
+--- a/vnf/src/vnf_interface.c
++++ b/vnf/src/vnf_interface.c
+@@ -342,6 +342,7 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
+ 				{
+ 					NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF connection (fd:%d) accepted from %s:%d \n", p5Sock,  inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
+ 					nfapi_vnf_pnf_info_t* pnf = (nfapi_vnf_pnf_info_t*)malloc(sizeof(nfapi_vnf_pnf_info_t));
++					NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
+ 					memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
+ 					pnf->p5_sock = p5Sock;
+ 					pnf->p5_idx = p5_idx++;
+@@ -663,7 +664,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
+ 	info->p5_idx = p5_idx;
+ 	info->phy_id = vnf->next_phy_id++;
+ 
+-	info->timing_window = 10;
++	info->timing_window = 30;       // This seems to override what gets set by the user - why???
+ 	info->timing_info_mode = 0x03;
+ 	info->timing_info_period = 128;
+ 
+diff --git a/vnf/src/vnf_p7.c b/vnf/src/vnf_p7.c
+index 8630385..1304176 100644
+--- a/vnf/src/vnf_p7.c
++++ b/vnf/src/vnf_p7.c
+@@ -15,6 +15,8 @@
+  */
+ 
+ 
++#include <time.h>
++
+ #include <sys/time.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -159,7 +161,7 @@ vnf_p7_rx_message_t* vnf_p7_rx_reassembly_queue_add_segment(vnf_p7_t* vnf_p7, vn
+ 		msg->sequence_number = sequence_number;
+ 		msg->num_segments_expected = m ? 255 : segment_number + 1;
+ 		msg->num_segments_received = 1;
+-		msg->rx_hr_time = get_current_time_hr();
++		msg->rx_hr_time = vnf_get_current_time_hr();
+ 
+ 		msg->segments[segment_number].buffer = (uint8_t*)vnf_p7_malloc(vnf_p7, data_len);
+ 		memcpy(msg->segments[segment_number].buffer, data, data_len);
+@@ -216,7 +218,7 @@ void vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7_t* vnf_p7, vnf_p7_rx_reas
+ 	vnf_p7_rx_message_t* iterator = queue->msg_queue;
+ 	vnf_p7_rx_message_t* previous = 0;
+ 
+-	uint32_t rx_hr_time = get_current_time_hr();
++	uint32_t rx_hr_time = vnf_get_current_time_hr();
+ 
+ 	while(iterator != 0)
+ 	{
+@@ -254,7 +256,7 @@ void vnf_p7_rx_reassembly_queue_remove_old_msgs(vnf_p7_t* vnf_p7, vnf_p7_rx_reas
+ 	}
+ }
+ 
+-uint32_t get_current_time_hr()
++uint32_t vnf_get_current_time_hr()
+ {
+ 	struct timeval now;
+ 	(void)gettimeofday(&now, NULL);
+@@ -297,7 +299,7 @@ struct timespec timespec_delta(struct timespec start, struct timespec end)
+ 	return temp;
+ }
+ 
+-uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
++static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
+ {
+ 	if(now_hr < sf_start_hr)
+ 	{
+@@ -321,7 +323,7 @@ uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
+ 
+ uint32_t calculate_t1(uint16_t sfn_sf, uint32_t sf_start_time_hr)
+ {
+-	uint32_t now_time_hr = get_current_time_hr();
++	uint32_t now_time_hr = vnf_get_current_time_hr();
+ 
+ 	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+ 
+@@ -344,7 +346,7 @@ uint32_t calculate_t4(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t
+ 
+ uint32_t calculate_transmit_timestamp(uint16_t sfn_sf, uint32_t sf_start_time_hr)
+ {
+-	uint32_t now_time_hr = get_current_time_hr();
++	uint32_t now_time_hr = vnf_get_current_time_hr();
+ 
+ 	uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr);
+ 
+@@ -410,6 +412,8 @@ int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* hea
+ 		
+ 		int len = nfapi_p7_message_pack(header, buffer, sizeof(buffer), &vnf_p7->_public.codec_config);
+ 		
++                //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n", __FUNCTION__, header->phy_id, len, vnf_p7->_public.segment_size);
++
+ 		if(len < 0) 
+ 		{
+ 			NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() failed to pack p7 message phy_id:%d\n", __FUNCTION__, header->phy_id);
+@@ -429,6 +433,7 @@ int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* hea
+ 			int segment = 0;
+ 			int offset = NFAPI_P7_HEADER_LENGTH;
+ 			uint8_t tx_buffer[vnf_p7->_public.segment_size];
++                        NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() MORE THAN ONE SEGMENT phy_id:%d nfapi_p7_message_pack()=len=%d vnf_p7->_public.segment_size:%u\n", __FUNCTION__, header->phy_id, len, vnf_p7->_public.segment_size);
+ 			for(segment = 0; segment < segment_count; ++segment)
+ 			{
+ 				uint8_t last = 0;
+@@ -851,7 +856,7 @@ void vnf_handle_p7_vendor_extension(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vn
+ 
+ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ {
+-	uint32_t now_time_hr = get_current_time_hr();
++	uint32_t now_time_hr = vnf_get_current_time_hr();
+ 
+ 	if (pRecvMsg == NULL || vnf_p7  == NULL)
+ 	{
+@@ -871,7 +876,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 	nfapi_vnf_p7_connection_info_t* phy = vnf_p7_connection_info_list_find(vnf_p7, ind.header.phy_id);
+ 	uint32_t t4 = calculate_t4(now_time_hr, phy->sfn_sf, vnf_p7->sf_start_time_hr);
+ 
+-	uint32_t tx_2_rx = t4 - ind.t1;
++	uint32_t tx_2_rx = t4>ind.t1 ? t4 - ind.t1 : t4 + NFAPI_MAX_SFNSFDEC - ind.t1 ;
+ 	uint32_t pnf_proc_time = ind.t3 - ind.t2;
+ 
+ 	// divide by 2 using shift operator
+@@ -881,7 +886,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 	{
+ 		phy->latency[phy->min_sync_cycle_count] = latency;
+ 
+-		NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) PNF to VNF !sync phy_id:%d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d\n",
++		NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) PNF to VNF !sync phy_id:%d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d\n",
+ 				NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id, ind.t1, ind.t2, ind.t3, t4, 
+ 				tx_2_rx, pnf_proc_time, latency);
+ 	}
+@@ -923,15 +928,27 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 
+ 		if(1)
+ 		{
+-			NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n", 
+-					NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
++                  struct timespec ts;
++                  clock_gettime(CLOCK_MONOTONIC, &ts);
++
++			NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n", 
++					NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
+ 					ind.t1, ind.t2, ind.t3, t4, 
+-					tx_2_rx, pnf_proc_time, latency, phy->sf_offset, phy->sf_offset_filtered,
++					tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->sf_offset, phy->sf_offset_filtered,
+ 					(ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
+ 		}
+ 
+ 	}
+ 
++        if (phy->filtered_adjust && (phy->sf_offset_filtered > 1e6 || phy->sf_offset_filtered < -1e6))
++        {
++          phy->filtered_adjust = 0;
++          phy->zero_count=0;
++          phy->min_sync_cycle_count = 2;
++          phy->in_sync = 0;
++          NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s - ADJUST TOO BAD - go out of filtered phy->sf_offset_filtered:%d\n", __FUNCTION__, phy->sf_offset_filtered);
++        }
++
+ 	if(phy->min_sync_cycle_count)
+ 		phy->min_sync_cycle_count--;
+ 
+@@ -954,7 +971,6 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 			phy->sf_offset = ind.t2 - (ind.t1 - phy->average_latency);
+ 
+ 			sfn_sf_dec += (phy->sf_offset / 1000);
+-
+ 		}
+ 		else
+ 		{
+@@ -976,12 +992,11 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 		{
+ 			phy->adjustment = NFAPI_SFNSF2DEC(new_sfn_sf) - NFAPI_SFNSF2DEC(curr_sfn_sf);
+ 
+-			//NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d\n", ind.header.phy_id, phy->adjustment);
++			NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d phy->previous_sf_offset_filtered:%d phy->previous_sf_offset_filtered:%d phy->sf_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_sf_offset_filtered, phy->previous_sf_offset_filtered, phy->sf_offset_trend);
+ 
+ 			phy->previous_t1 = 0;
+ 			phy->previous_t2 = 0;
+ 
+-
+ 			if(phy->previous_sf_offset_filtered > 0)
+ 			{
+ 				if( phy->sf_offset_filtered > phy->previous_sf_offset_filtered)
+@@ -1083,9 +1098,14 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 
+ 						if(phy->insync_minor_adjustment != 0)
+ 						{
+-							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (sf_offset_filtered:%d) %d %d %d\n", 
++							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (sf_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adjustment:%d\n", 
+ 										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
+-										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->sf_offset_filtered, insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend); 
++										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, 
++                                                                                phy->sf_offset_filtered, 
++                                                                                insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend,
++                                                                                NFAPI_SFNSF2DEC(new_sfn_sf),
++                                                                                NFAPI_SFNSF2DEC(curr_sfn_sf),
++                                                                                phy->adjustment); 
+ 						}
+ 					}
+ 				}
+@@ -1121,10 +1141,13 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 								// out of sync?
+ 							}
+ 							
+-							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (adjusment:%d sf_offset_filtered:%d) %d %d %d\n", 
++							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (adjustment:%d sf_offset_filtered:%d) %d %d %d NEW:%d CURR:%d adj:%d\n", 
+ 										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
+ 										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->sf_offset_filtered,
+-										insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend); 
++										insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend,
++                                                                                NFAPI_SFNSF2DEC(new_sfn_sf),
++                                                                                NFAPI_SFNSF2DEC(curr_sfn_sf),
++                                                                                phy->adjustment); 
+ 							
+ 						}
+ 						else if(phy->adjustment < 0)
+@@ -1151,7 +1174,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 								// out of sync?
+ 							}
+ 
+-							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d suframes (adjusment:%d sf_offset_filtered:%d) %d %d %d\n", 
++							NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%d/%d) VNF phy_id:%d Apply minor insync adjustment %dus for %d subframes (adjustment:%d sf_offset_filtered:%d) %d %d %d\n", 
+ 										NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ind.header.phy_id,
+ 										phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->adjustment, phy->sf_offset_filtered,
+ 										insync_minor_adjustment_1, insync_minor_adjustment_2, phy->sf_offset_trend); 
+@@ -1219,7 +1242,16 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+ 		return;
+ 	}
+ 
+-	// todo : how to use this?
++        if (vnf_p7 && vnf_p7->p7_connections)
++        {
++          int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
++
++          //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
++          if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
++          {
++            NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf));
++          }
++        }
+ }
+ 
+ void vnf_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
+diff --git a/vnf/src/vnf_p7_interface.c b/vnf/src/vnf_p7_interface.c
+index ab4f00c..a35d8e3 100644
+--- a/vnf/src/vnf_p7_interface.c
++++ b/vnf/src/vnf_p7_interface.c
+@@ -142,6 +142,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+ 	NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n");
+ 
+ 
++	//struct timespec original_pselect_timeout;
+ 	struct timespec pselect_timeout;
+ 	pselect_timeout.tv_sec = 0;
+ 	pselect_timeout.tv_nsec = 1000000; // ns in a 1 us
+@@ -157,13 +158,13 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+ 
+ 	struct timespec sf_duration;
+ 	sf_duration.tv_sec = 0;
+-	sf_duration.tv_nsec = 1000000; // ns in a 1 us
++	sf_duration.tv_nsec = 1e6; // We want 1ms pause
+ 
+ 	struct timespec sf_start;
+ 	clock_gettime(CLOCK_MONOTONIC, &sf_start);
+ 	long millisecond = sf_start.tv_nsec / 1e6;
+ 	sf_start = timespec_add(sf_start, sf_duration);
+-	//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
++	NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
+ 
+ 	while(vnf_p7->terminate == 0)
+ 	{
+@@ -181,6 +182,8 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+ 
+ 		if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) )
+ 		{
++                  //NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
++
+ 
+ 			if((pselect_start.tv_sec > sf_start.tv_sec) || 
+ 			   ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
+@@ -196,16 +199,26 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+ 			{
+ 				// still time before the end of the subframe wait
+ 				pselect_timeout = timespec_sub(sf_start, pselect_start);
++
++#if 0
++                                NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sf_start:%d.%ld pselect_start:%d.%ld pseclect_timeout:%d.%ld\n",
++                                    __FUNCTION__,
++                                    sf_start.tv_sec, sf_start.tv_nsec,
++                                    pselect_start.tv_sec, pselect_start.tv_nsec,
++                                    pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
++#endif
+ 			}
+ 
++//original_pselect_timeout = pselect_timeout;
++
+ 			// detemine how long to sleep in ns before the start of the next 1ms
+ 			//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
+ 
+-			//uint8_t underun_possiable =0;
++			//uint8_t underrun_possible =0;
+ 			
+ 			// if we are not sleeping until the next milisecond due to the
+ 			// insycn minor adjment flag it so we don't consider it an error
+-			//uint8_t underun_possiable =0;
++			//uint8_t underrun_possible =0;
+ 			/*
+ 			{
+ 				nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
+@@ -222,7 +235,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+ 							pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
+ 
+ 
+-						//underun_possiable = 1;
++						//underrun_possible = 1;
+ 					}
+ 					else if(phy->insync_minor_adjustment < 0)
+ 					{
+@@ -237,41 +250,98 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+ 			*/
+ 			
+ 
++//long wraps = pselect_timeout.tv_nsec % 1e9;
++
++
+ 			selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
+ 
+ 			clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
+ 
++                        nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
++
++if (selectRetval==-1 && errno == 22)
++{
++  NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n", 
++  pselect_timeout.tv_sec, pselect_timeout.tv_nsec, 
++  phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment, 
++  sf_duration.tv_sec, sf_duration.tv_nsec);
++}
++#if 0
++                        if (selectRetval != 0 || phy->insync_minor_adjustment_duration != 0)
++                          NFAPI_TRACE(NFAPI_TRACE_NOTE, "pselect()=%d maxSock:%d vnf_p7->socket:%d pselect_timeout:%u.%u original_pselect_timeout:%u.%u\n", 
++                              selectRetval, maxSock, vnf_p7->socket, pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
++                              original_pselect_timeout.tv_sec, original_pselect_timeout.tv_nsec);
++#endif
++
+ 			if(selectRetval == 0)
+ 			{
+-				// calcualte the start of the next subframe
++				// calculate the start of the next subframe
+ 				sf_start = timespec_add(sf_start, sf_duration);
+ 				//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
+ 
+-				nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
+ 				if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
+ 				{
+-					NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %dus\n", phy->insync_minor_adjustment);
++                                        long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
++
++                                        sf_start.tv_nsec -= insync_minor_adjustment_ns;
++
++#if 1
++                                        if (sf_start.tv_nsec > 1e9)
++                                        {
++                                          sf_start.tv_sec++;
++                                          sf_start.tv_nsec-=1e9;
++                                        }
++                                        else if (sf_start.tv_nsec < 0)
++                                        {
++                                          sf_start.tv_sec--;
++                                          sf_start.tv_nsec+=1e9;
++                                        }
++#else
++                                        //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
+ 					if(phy->insync_minor_adjustment > 0)
+ 					{
+ 						// decrease the subframe duration a little
+-						sf_start.tv_nsec = sf_start.tv_nsec - (phy->insync_minor_adjustment * 1000);
++                                                if (sf_start.tv_nsec > insync_minor_adjustment_ns)
++                                                  sf_start.tv_nsec -= insync_minor_adjustment_ns;
++                                                else
++                                                {
++                                                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
++                                                  sf_start.tv_sec--;
++                                                  sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
++                                                }
+ 					}
+ 					else if(phy->insync_minor_adjustment < 0)
+ 					{
+ 						// todo check we don't go below 0
+ 						// increase the subframe duration a little
+-						sf_start.tv_nsec = sf_start.tv_nsec - (phy->insync_minor_adjustment * 1000);
++						sf_start.tv_nsec += insync_minor_adjustment_ns;
++
++                                                if (sf_start.tv_nsec < 0)
++                                                {
++                                                  NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
++                                                  sf_start.tv_sec++;
++                                                  sf_start.tv_nsec += 1e9;
++                                                }
+ 					}
++#endif
+ 
+ 					//phy->insync_minor_adjustment = 0;
+-					phy->insync_minor_adjustment_duration--;
++                                        phy->insync_minor_adjustment_duration--;
++
++                                        NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n", 
++                                            phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
++
++                                        if (phy->insync_minor_adjustment_duration==0)
++                                        {
++                                          phy->insync_minor_adjustment = 0;
++                                        }
+ 				}
+ 				/*
+ 				long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
+ 				if(millisecond == pselect_stop_millisecond)
+ 				{
+ 					// we have woke up in the same subframe
+-					if(underun_possiable == 0)
++					if(underrun_possible == 0)
+ 						NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect underrun %ld (%d.%d)\n", millisecond, pselect_stop.tv_sec, pselect_stop.tv_nsec);
+ 				}
+ 				else if(((millisecond + 1) % 1000) != pselect_stop_millisecond)
+@@ -298,7 +368,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+ 
+ 		if(selectRetval == 0)
+ 		{
+-			vnf_p7->sf_start_time_hr = get_current_time_hr();
++			vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
+ 
+ 			// pselect timed out
+ 			nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
+@@ -326,14 +396,18 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
+ 		else
+ 		{
+ 			// pselect error
+-			if(selectRetval == EINTR)
++			if(selectRetval == -1 && errno == EINTR)
+ 			{
+ 				// a sigal was received.
+ 			}
+ 			else
+ 			{
+-				NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec);
++				NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
+ 				// should we exit now?
++                                if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
++                                {
++                                  usleep(100000);
++                                }
+ 			}
+ 		}
+ 
+@@ -360,10 +434,12 @@ int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config)
+ 
+ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, int pnf_p7_port, int phy_id)
+ {
+-	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(phy_id:%d pnf_addr:%s:%d)\n", __FUNCTION__, phy_id,  pnf_p7_addr, pnf_p7_port);
++	NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p phy_id:%d pnf_addr:%s pnf_p7_port:%d)\n", __FUNCTION__, config, phy_id,  pnf_p7_addr, pnf_p7_port);
+ 
+ 	if(config == 0)
+-		return -1;
++        {
++          return -1;
++        }
+ 
+ 	vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
+ 
+@@ -411,6 +487,8 @@ int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id)
+ }
+ int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_request_t* req)
+ {
++	//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req);
++
+ 	if(config == 0 || req == 0)
+ 		return -1;
+ 
+diff --git a/vnf_sim/src/mac.cpp b/vnf_sim/src/mac.cpp
+index aa97f72..fa6f487 100644
+--- a/vnf_sim/src/mac.cpp
++++ b/vnf_sim/src/mac.cpp
+@@ -743,7 +743,7 @@ extern "C"
+ 			{
+ 				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.number_of_cc = 1;
+ 				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = rand_range(0, 3);
+-				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size = rand_range(0, 255);
++				cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[0] = rand_range(0, 255);
+ 			}
+ 			
+ 			cqi_ri_information.cqi_ri_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG;
+diff --git a/vnf_sim/src/main.cpp b/vnf_sim/src/main.cpp
+index b79ac40..5dc7161 100644
+--- a/vnf_sim/src/main.cpp
++++ b/vnf_sim/src/main.cpp
+@@ -428,6 +428,20 @@ void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header)
+ 	free(header);
+ }
+ 
++//static pthread_t vnf_start_pthread;
++static pthread_t vnf_p7_start_pthread;
++void* vnf_p7_start_thread(void *ptr)
++{
++  printf("%s()\n", __FUNCTION__);
++
++  //std::shared_ptr<nfapi_vnf_p7_config> config = std::shared_ptr<nfapi_vnf_p7_config>(ptr);
++  nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
++
++  nfapi_vnf_p7_start(config);
++
++  return 0;
++}
++
+ void set_thread_priority(int priority)
+ {
+ 	//printf("%s(priority:%d)\n", __FUNCTION__, priority);
+@@ -458,6 +472,8 @@ void set_thread_priority(int priority)
+ 
+ void* vnf_p7_thread_start(void* ptr)
+ {
++  printf("%s()\n", __FUNCTION__);
++
+ 	set_thread_priority(79);
+ 
+ 	vnf_p7_info* p7_vnf = (vnf_p7_info*)ptr;
+@@ -494,10 +510,10 @@ void* vnf_p7_thread_start(void* ptr)
+ 	p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
+ 	p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
+ 
+-	nfapi_vnf_p7_start(p7_vnf->config.get());
++        printf("[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
++        pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config.get());
+ 
+ 	return 0;
+-
+ }
+ 
+ int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx)
+diff --git a/wireshark/packet-nfapi.c b/wireshark/packet-nfapi.c
+index da0edb0..7e0f23f 100755
+--- a/wireshark/packet-nfapi.c
++++ b/wireshark/packet-nfapi.c
+@@ -1,6069 +1,12284 @@
+-/*
++/* packet-nfapi.c
++* Routines for Network Function Application Platform Interface (nFAPI) dissection
+ * Copyright 2017 Cisco Systems, Inc.
+ *
+-* Licensed under the Apache License, Version 2.0 (the "License");
+-* you may not use this file except in compliance with the License.
+-* You may obtain a copy of the License at
++* 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.
+ *
+-* http://www.apache.org/licenses/LICENSE-2.0
++* References:
++* SCF082.09.04  http://scf.io/en/documents/082_-_nFAPI_and_FAPI_specifications.php
+ *
+-* Unless required by applicable law or agreed to in writing, software
+-* distributed under the License is distributed on an "AS IS" BASIS,
+-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-* See the License for the specific language governing permissions and
+-* limitations under the License.
+ */
+-
+-
+-#include "config.h" 
+-
+-#include <windows.h>
+-#include <stdio.h>
+-#include <stdint.h>
+-
+-#include <epan/packet.h>
+-#include <epan/exceptions.h>
+-#include <epan/prefs.h>
+-#include <epan/expert.h>
+-#include <epan/reassemble.h>
+-
++
++#include "config.h"
++
++#include <epan/packet.h>
++#include <epan/exceptions.h>
++#include <epan/expert.h>
++#include <epan/reassemble.h>
++#include <epan/wmem/wmem.h>
++
++#include <ptvcursor.h>
++
++void proto_register_nfapi(void);
++void proto_reg_handoff_nfapi(void);
++
+ #define NFAPI_HEADER_LENGTH 8
+-#define NFAPI_P7_HEADER_LENGTH 16
+-
+-typedef int(*Decode_operation)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
+-
+-static const value_string nfapi_error_vals[] = {
+-	{ 0x0, "MSG_OK" },
+-	{ 0x1, "MSG_INVALID_STATE" },
+-	{ 0x2, "MSG_INVALID_CONFIG" },
+-	{ 0x3, "SFN_OUT_OF_SYNC" },
+-	{ 0x4, "MSG_SUBFRAME_ERR" },
+-	{ 0x5, "MSG_BCH_MISSING" },
+-	{ 0x6, "MSG_BCH_MISSING" },
+-	{ 0x7, "MSG_HI_ERR" },
+-	{ 0x8, "MSG_TX_ERR" },
+-	{ 0, NULL },
+-};
+-
+-static const value_string nfapi_p4_error_vals[] = {
+-	{ 100, "MSG_OK" },
+-	{ 101, "MSG_INVALID_STATE" },
+-	{ 102, "MSG_INVALID_CONFIG" },
+-	{ 103, "MSG_RAT_NOT_SUPPORTED" },
+-	{ 200, "MSG_NMM_STOP_OK" },
+-	{ 201, "MSG_NMM_STOP_IGNORED" },
+-	{ 202, "MSG_NMM_STOP_INVALID_STATE" },
+-	{ 300, "MSG_PROCEDURE_COMPLETE" },
+-	{ 301, "MSG_PROCEDURE_STOPPED" },
+-	{ 302, "MSG_PARTIAL_RESULTS" },
+-	{ 303, "MSG_TIMEOUT" },
+-	{ 0, NULL },
+-};
+-
+-static const value_string nfapi_rat_type_vals[] = {
+-	{ 0, "LTE" },
+-	{ 1, "UTRAN" },
+-	{ 2, "GERAN" },
+-	{ 0, NULL },
+-};
+-
+-typedef enum{
+-	UN_ALIGNED_SYNCHRONIZATION = 0,
+-	INTERNAL_PNF_FRAME_ALIGNMENT,
+-	ABSOLUTE_TIME_ALIGNED_SYNCHRONIZATION
+-} nfapi_sync_mode_e;
+-
+-static const value_string nfapi_sync_mode_vals[] = {
+-	{ UN_ALIGNED_SYNCHRONIZATION, "UN-ALIGNED SYNCHRONIZATION" },
+-	{ INTERNAL_PNF_FRAME_ALIGNMENT, "INTERNAL PNF FRAME ALIGNMENT" },
+-	{ ABSOLUTE_TIME_ALIGNED_SYNCHRONIZATION, "ABSOLUTE TIME ALIGNED SYNCHRONIZATION" }
+-};
+-
+-typedef enum {
+-	NONE = 0,
+-	GPS,
+-	GLONASS,
+-	BEIDOU
+-} location_mode_e;
+-
+-static const value_string location_mode_vals[] = {
+-	{ NONE, "NONE" },
+-	{ GPS, "GPS" },
+-	{ GLONASS, "GLONASS" },
+-	{ BEIDOU, "BeiDou" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string nfapi_uplink_rs_hopping_vals[] = {
+-	{ 0, "RS_NO_HOPPING" },
+-	{ 1, "RS_GROUP_HOPPING" },
+-	{ 2, "RS_SEQUENCE_HOPPING" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string nfapi_laa_carrier_type_vals[] = {
+-	{ 0, "No multi carrier support" },
+-	{ 1, "Mode A1" },
+-	{ 2, "Mode A12" },
+-	{ 3, "Mode B1" },
+-	{ 4, "Mode B2" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string nfapi_mutli_carrier_lbt_support_vals[] = {
+-	{ 0, "Multi carrier Mode A1" },
+-	{ 1, "Multi carrier Mode A2" },
+-	{ 2, "Multi carrier Mode B1" },
+-	{ 3, "Multi carrier Mode B2" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string nfapi_lbt_dl_req_pdu_type[] = {
+-	{ 0, "LBT_PDSCH_REQ PDU" },
+-	{ 1, "LBT_DRS_REQ PDU" },
+-	{ 0, NULL }
+-};
+-
+-
+-static const value_string nfapi_lbt_dl_ind_pdu_type[] = {
+-	{ 0, "LBT_PDSCH_RSP PDU" },
+-	{ 1, "LBT_DRS_RSP PDU" },
+-
+-	{ 0, NULL }
+-};
+-
+-
+-
+-
+-/* These are definitions where data 0 & 1 represent/provide a string name*/
+-
+-static const true_false_string true_false_strname = {
+-	"TRUE",
+-	"FALSE"
+-};
+-
+-static const true_false_string  nfapi_csi_report_type_strname = {
+-	"Periodic",
+-	"Aperiodic",
+-};
+-
+-static const true_false_string nfapi_control_type_string_name = {
+-	"CQI/PMI",
+-	"RI",
+-};
+-
+-static const true_false_string transport_block_to_codeword_swap_flag = {
+-	"NO_SWAPPING",
+-	"SWAPPED"
+-};
+-
+-static const true_false_string virtual_resource_block_assignment_flag = {
+-	"LOCALIZED",
+-	"DISTRIBUTED"
+-};
+-
+-static const true_false_string ngap_string_name = {
+-	"N-GAP 1",
+-	"N-GAP 2"
+-};
+-
+-static const true_false_string  nprb_strname = {
+-	"= 2",
+-	"= 3",
+-};
+-
+-static const true_false_string cyclic_prefix_type_strname = {
+-	"CP_NORMAL",
+-	"CP_EXTENDED"
+-};
+-
+-static const true_false_string support_strname = {
+-	"No Support",
+-	"Support"
+-};
+-
+-static const true_false_string partial_sf_support_strname =
+-{
+-	"Start partial SF support",
+-	"End partial SF support"
+-};
+-
+-static const true_false_string phich_duration_strname = {
+-	"PHICH_D_NORMAL",
+-	"PHICH_D_EXTENDED"
+-};
+-
+-static const true_false_string high_speed_flag_strname = {
+-	"HS_UNRESTRICTED_SET",
+-	"HS_RESTRICTED_SET"
+-};
+-
+-static const true_false_string hopping_mode_strname = {
+-	"HM_INTER_SF",
+-	"HM_INTRA_INTER_SF"
+-};
+-
+-static const true_false_string enabled_disabled_strname = {
+-	"Enabled",
+-	"Disabled"
+-};
+-
+-static const true_false_string srs_simult_tx_strname = {
+-	"No Simultaneous Transmission",
+-	"Simultaneous Transmission"
+-};
+-
+-static const true_false_string crc_flag_strname = {
+-	"CRC_CORRECT",
+-	"CRC_ERROR"
+-};
+-
+-static const true_false_string hi_value_strname = {
+-	"HI_NACK",
+-	"HI_ACK"
+-};
+-
+-static const true_false_string flag_tb2_strname = {
+-	"HI_NOT_PRESENT",
+-	"HI_PRESENT"
+-};
+-
+-static const true_false_string nfapi_multi_carrier_tx_strname = {
+-	"Mutual transmission (self-deferral support for current carrier)",
+-	"Transmit on channel access win (no self-deferral)"
+-};
+-
+-static const true_false_string nfapi_multi_carrier_freeze_strname = {
+-	"Absence of other technology isn’t guaranteed",
+-	"Absence of other technology is guaranteed"
+-};
+-
+-static const value_string nfapi_dl_config_pdu_type_vals[] = {
+-	{ 0, "DL_CONFIG_DCI_DL_PDU" },
+-	{ 1, "DL_CONFIG_BCH_PDU" },
+-	{ 2, "DL_CONFIG_MCH_PDU" },
+-	{ 3, "DL_CONFIG_DLSCH_PDU" },
+-	{ 4, "DL_CONFIG_PCH_PDU" },
+-	{ 5, "DL_CONFIG_PRS_PDU" },
+-	{ 6, "DL_CONFIG_CSI_RS_PDU" },
+-	{ 7, "DL_CONFIG_EPDCCH_DL_PDU" },
+-	{ 8, "DL_CONFIG_EPDCCH_DL_PDU" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string nfapi_duplex_mode_vals[] = {
+-	{ 0, "TDD" },
+-	{ 1, "FDD" },
+-	{ 2, "HD-FDD" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string modulation_vals[] = {
+-	{ 2, "QPSK" },
+-	{ 4, "16QAM" },
+-	{ 6, "64QAM" },
+-	{ 8, "256QAM" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string pch_modulation_vals[] = {
+-	{ 0, "QPSK" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string ue_mode_vals[] = {
+-	{ 0, "non LC/CE UE" },
+-	{ 1, "LC/CE UE" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string csi_rs_class_vals[] = {
+-	{ 0, "not used" },
+-	{ 1, "Class A" },
+-	{ 1, "Class B" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string csi_rs_cdm_type_vals[] = {
+-	{ 0, "cdm 2" },
+-	{ 1, "cdm 4" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string antenna_ports_vals[] = {
+-	{ 0, "1 antenna ports" },
+-	{ 1, "2 antenna ports" },
+-	{ 2, "4 antenna ports" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string combs_vals[] = {
+-	{ 0, "2 TC" },
+-	{ 1, "4 TC" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string resource_allocation_type_vals[] = {
+-	{ 0, "type 0" },
+-	{ 1, "type 1" },
+-	{ 2, "type 2 1A/1B/1D" },
+-	{ 3, "type 2 1C" },
+-	{ 4, "type 2 6-1A" },
+-	{ 5, "type UEModeB" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string transmission_scheme_vals[] = {
+-	{ 0, "SINGLE_ANTENNA_PORT_0" },
+-	{ 1, "TX_DIVERSITY" },
+-	{ 2, "LARGE_DELAY_CDD" },
+-	{ 3, "CLOSED_LOOP_SPATIAL_MULTIPLEXING" },
+-	{ 4, "MULTI_USER_MIMO" },
+-	{ 5, "CLOSED_LOOP_RANK_1_PRECODING" },
+-	{ 6, "SINGLE_ANTENNA_PORT_5" },
+-	{ 7, "SINGLE_ANTENNA_PORT_7" },
+-	{ 8, "SINGLE_ANTENNA_PORT_8" },
+-	{ 9, "DUAL_LAYER_TX_PORT_7_AND_8" },
+-	{ 10, "UP_TO_8_LAYER_TX" },
+-	{ 11, "SINGLE_ANTENNA_PORT_11" },
+-	{ 12, "SINGLE_ANTENNA_PORT_13" },
+-	{ 13, "SINGLE_ANTENNA_PORT_11_13" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string ul_transmission_scheme_vals[] = {
+-	{ 0, "SINGLE_ANTENNA_PORT_10" },
+-	{ 1, "CLOSED_LOOP_SPATIAL_MULTIPLEXING" },
+-};
+-
+-static const value_string dci_format_vals[] = {
+-	{ 0, "1" },
+-	{ 1, "1A" },
+-	{ 2, "1B" },
+-	{ 3, "1C" },
+-	{ 4, "1D" },
+-	{ 5, "2" },
+-	{ 6, "2A" },
+-	{ 7, "2B" },
+-	{ 8, "2C" },
+-	{ 9, "2D" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string pa_vals[] = {
+-	{ 0, "-6dB" },
+-	{ 1, "-4.77dB" },
+-	{ 2, "-3dB" },
+-	{ 3, "-1.77dB" },
+-	{ 4, "0dB" },
+-	{ 5, "1dB" },
+-	{ 6, "2dB" },
+-	{ 7, "3dB" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string transmission_mode_vals[] = {
+-	{ 1, "Mode 1" },
+-	{ 2, "Mode 2" },
+-	{ 3, "Mode 3" },
+-	{ 4, "Mode 4" },
+-	{ 5, "Mode 5" },
+-	{ 6, "Mode 6" },
+-	{ 7, "Mode 7" },
+-	{ 8, "Mode 8" },
+-	{ 9, "Mode 9" },
+-	{ 10, "Mode 10" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string nfapi_ul_config_pdu_type_vals[] = {
+-	{ 0, "ULSCH" },
+-	{ 1, "ULSCH_CQI_RI" },
+-	{ 2, "ULSCH_HARQ" },
+-	{ 3, "ULSCH_CQI_HARQ_RI" },
+-	{ 4, "UCI_CQI" },
+-	{ 5, "UCI_SR" },
+-	{ 6, "UCI_HARQ" },
+-	{ 7, "UCI_SR_HARQ" },
+-	{ 8, "UCI_CQI_HARQ" },
+-	{ 9, "UCI_CQI_SR" },
+-	{ 10, "UCI_CQI_SR_HARQ" },
+-	{ 11, "SRS" },
+-	{ 12, "HARQ_BUFFER" },
+-	{ 13, "ULSCH_UCI_CSI" },
+-	{ 14, "ULSCH_UCI_HARQ" },
+-	{ 15, "ULSCH_CSI_UCI_HARQ" },
+-	{ 0, NULL }
+-};
+-
+-typedef enum {
+-	NFAPI_ACK_NACK_MODE_BUNDLING = 0,
+-	NFAPI_ACK_NACK_MODE_MULTIPLEXING,
+-	NFAPI_ACK_NACK_MODE_FORMAT_1B_WITH_CHAN_SEL,
+-	NFAPI_ACK_NACK_MODE_FORMAT_3,
+-} nfapi_ack_nack_mode_e;
+-
+-static const value_string nfapi_ack_nack_mode_vals[] = {
+-	{ NFAPI_ACK_NACK_MODE_BUNDLING, "Bundling" },
+-	{ NFAPI_ACK_NACK_MODE_MULTIPLEXING, "Multiplexing" },
+-	{ NFAPI_ACK_NACK_MODE_FORMAT_1B_WITH_CHAN_SEL, "Format 1b with channel selection" },
+-	{ NFAPI_ACK_NACK_MODE_FORMAT_3, "Format 3" },
+-	{ 0, NULL }
+-};
+-
+-typedef enum {
+-	NFAPI_ANTENNA_PORT1 = 0,
+-	NFAPI_ANTENNA_PORT2,
+-	NFAPI_ANTENNA_PORT4,
+-} nfapi_ack_nack_mode_e;
+-
+-static const value_string nfapi_antenna_port_vals[] = {
+-	{ NFAPI_ANTENNA_PORT1, "1 " },
+-	{ NFAPI_ANTENNA_PORT2, "2 " },
+-	{ NFAPI_ANTENNA_PORT4, "4 " },
+-	{ 0, NULL }
+-};
+-
+-typedef enum{
+-	PHICH_R_ONE_SIXTH = 0,
+-	PHICH_R_HALF,
+-	PHICH_R_ONE,
+-	PHICH_R_TWO
+-} nfapi_phich_resource_e;
+-
+-static const value_string nfapi_phich_resource_vals[] = {
+-	{ PHICH_R_ONE_SIXTH, "PHICH_R_ONE_SIXTH " },
+-	{ PHICH_R_HALF, "PHICH_R_HALF" },
+-	{ PHICH_R_ONE, "PHICH_R_ONE" },
+-	{ PHICH_R_TWO, "PHICH_R_TWO" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string local_distributed_vals[] = {
+-	{ 0, "localized" },
+-	{ 1, "distributed" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string transport_block_to_codeword_swap_flag_vals[] = {
+-	{ 0, "no swapping" },
+-	{ 1, "swapped" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string ngap_vals[] = {
+-	{ 0, "Ngap1" },
+-	{ 1, "Ngap2" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string true_false_vals[] = {
+-	{ 0, "false" },
+-	{ 1, "true" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string exhustive_search_vals[] = {
+-	{ 0, "non-exhaustive search" },
+-	{ 1, "exhaustive search" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string not_used_enabled_vals[] = {
+-	{ 0, "not used" },
+-	{ 1, "enabled" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string hopping_vals[] = {
+-	{ 0, "no hopping" },
+-	{ 1, "hopping enabled" },
+-	{ 0, NULL }
+-};
+-
+-
+-static const value_string rnti_type_vals[] = {
+-	{ 1, "C-RNTI" },
+-	{ 2, "RA-RNTI, P-RNTI, SI-RNTI, SC-RNTI, G-RNTI" },
+-	{ 3, "SPS-CRNTI" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string primary_cells_type_vals[] = {
+-	{ 1, "TDD" },
+-	{ 2, "FDD" },
+-	{ 3, "HD_FDD" },
+-	{ 0, NULL }
+-};
+-
+-static const value_string ul_rssi_supported_vals[] = {
+-	{ 0, "Uplink RSSI not supported" },
+-	{ 1, "Uplink RSSI supported" },
+-	{ 0, NULL}
+-};
+-
+-
+-typedef enum
+-{
+-	NMM_NONE = 0,
+-	NMM_ONLY,
+-	NMM_IN_CONFIGURED_STATE,
+-	NMM_IN_RUNNING_STATE,
+-	NMM_IN_CONFIGURED_AND_RUNNING_STATE
+-} nmm_modes_supported_e;
+-
+-static const value_string nmm_modes_supported_vals[] =
+-{
+-	{ NMM_NONE, "NONE" },
+-	{ NMM_ONLY, "NMM_ONLY" },
+-	{ NMM_IN_CONFIGURED_STATE, "NMM_IN_CONFIGURED_STATE" },
+-	{ NMM_IN_RUNNING_STATE, "NMM_IN_RUNNING_STATE" },
+-	{ NMM_IN_CONFIGURED_AND_RUNNING_STATE, "NMM_IN_CONFIGURED_AND_RUNNING_STAT" },
+-	{ 0, NULL }
+-};
+-
+-
+-
+-
+-
+-static int proto_nfapi = -1;
+-
+-/* These are for the subtrees */
+-static gint ett_nfapi_message_tree = -1;
+-static gint ett_nfapi_p4_p5_message_header = -1;
+-static gint ett_nfapi_p7_message_header = -1;
+-static gint ett_nfapi_tlv_tree = -1;
+-static gint ett_nfapi_tl = -1;
+-static gint ett_nfapi_pnf_param_response = -1;
+-static gint ett_nfapi_pnf_phy = -1;
+-static gint ett_nfapi_pnf_phy_rel10 = -1;
+-static gint ett_nfapi_pnf_phy_rel11 = -1;
+-static gint ett_nfapi_pnf_phy_rel12 = -1;
+-static gint ett_nfapi_pnf_phy_rel13 = -1;
+-static gint ett_nfapi_pnf_rf = -1;
+-static gint ett_nfapi_phy_rf_config_info = -1;
+-static gint ett_nfapi_pnf_phy_rf_config = -1;
+-static gint ett_nfapi_pnf_phy_rf_config_instance = -1;
+-static gint ett_nfapi_phy_state = -1;
+-static gint ett_nfapi_l1_status = -1;
+-static gint ett_nfapi_rf_bands = -1;
+-static gint ett_nfapi_tx_antenna_ports = -1;
+-static gint ett_nfapi_harq_ack_nack_data = -1;
+-static gint ett_nfapi_harq_data = -1;
+-static gint ett_nfapi_cc = -1;
+-static gint ett_nfapi_rbs = -1;
+-static gint ett_nfapi_antennas = -1;
+-static gint ett_nfapi_dl_config_dci_dl_pdu_rel8 = -1;
+-static gint ett_nfapi_dl_config_dci_dl_pdu_rel9 = -1;
+-static gint ett_nfapi_dl_config_dci_dl_pdu_rel10 = -1;
+-static gint ett_nfapi_dl_config_dci_dl_pdu = -1;
+-static gint ett_nfapi_dl_config_request_pdu = -1;
+-static gint ett_nfapi_dl_config_request_body = -1;
+-static gint ett_nfapi_dl_config_request_pdu_list = -1;
+-static gint ett_nfapi_ul_config_request_pdu_list = -1;
+-static gint ett_nfapi_hi_dci0_request_pdu_list = -1;
+-static gint ett_nfapi_tx_request_pdu_list = -1;
+-static gint ett_nfapi_rx_indication_pdu_list = -1;
+-static gint ett_nfapi_harq_indication_pdu_list = -1;
+-static gint ett_nfapi_crc_indication_pdu_list = -1;
+-static gint ett_nfapi_sr_indication_pdu_list = -1;
+-static gint ett_nfapi_cqi_indication_pdu_list = -1;
+-static gint ett_nfapi_preamble_indication_pdu_list = -1;
+-static gint ett_nfapi_srs_indication_pdu_list = -1;
+-static gint ett_nfapi_lbt_dl_config_pdu_list = -1;
+-static gint ett_nfapi_lbt_dl_indication_pdu_list = -1;
+-static gint ett_nfapi_dl_node_sync = -1;
+-static gint ett_nfapi_ul_node_sync = -1;
+-static gint ett_nfapi_timing_info = -1;
+-static gint ett_nfapi_dl_config_request_dlsch_pdu_rel8 = -1;
+-static gint ett_nfapi_subbands = -1;
+-static gint ett_nfapi_dl_config_request_dlsch_pdu_rel9 = -1;
+-static gint ett_nfapi_dl_config_request_dlsch_pdu_rel10 = -1;
+-static gint ett_nfapi_dl_config_bch_pdu_rel8 = -1;
+-static gint ett_nfapi_dl_config_mch_pdu_rel8 = -1;
+-static gint ett_nfapi_dl_config_pch_pdu_rel8 = -1;
+-static gint ett_nfapi_dl_config_prs_pdu_rel9 = -1;
+-static gint ett_nfapi_dl_config_csi_rs_pdu_rel10 = -1;
+-static gint ett_nfapi_ul_config_request_body = -1;
+-static gint ett_nfapi_ul_config_harq_buffer_pdu = -1;
+-static gint ett_nfapi_ul_config_ue_information_rel8 = -1;
+-static gint ett_nfapi_ul_config_sr_information_pdu_rel8 = -1;
+-static gint ett_nfapi_ul_config_ulsch_pdu_rel8 = -1;
+-static gint ett_nfapi_ul_config_ulsch_pdu_rel10 = -1;
+-static gint ett_nfapi_ul_config_cqi_ri_information_rel8 = -1;
+-static gint ett_nfapi_ul_config_cqi_ri_information_rel9 = -1;
+-static gint ett_nfapi_ul_config_ulsch_harq_information_rel10 = -1;
+-static gint ett_nfapi_ul_config_initial_transmission_parameters_rel8 = -1;
+-static gint ett_nfapi_ul_config_cqi_information_rel8 = -1;
+-static gint ett_nfapi_ul_config_cqi_information_rel10 = -1;
+-static gint ett_nfapi_ul_config_sr_information_rel8 = -1;
+-static gint ett_nfapi_ul_config_sr_information_rel10 = -1;
+-static gint ett_nfapi_ul_config_harq_information_rel10_tdd = -1;
+-static gint ett_nfapi_ul_config_harq_information_rel8_fdd = -1;
+-static gint ett_nfapi_ul_config_harq_information_rel9_fdd = -1;
+-static gint ett_nfapi_ul_config_srs_pdu_rel8 = -1;
+-static gint ett_nfapi_ul_config_srs_pdu_rel10 = -1;
+-static gint ett_nfapi_crc_indication_body = -1;
+-static gint ett_nfapi_bf_vector_antennas = -1;
+-static gint ett_nfapi_bf_vectors = -1;
+-static gint ett_nfapi_csi_rs_resource_configs = -1;
+-static gint ett_nfapi_csi_rs_bf_vector = -1;
+-static gint ett_nfapi_epdcch_prbs = -1;
+-static gint ett_nfapi_precoding = -1;
+-static gint ett_nfapi_earfcn_list = -1;
+-static gint ett_nfapi_uarfcn_list = -1;
+-static gint ett_nfapi_arfcn_list = -1;
+-static gint ett_nfapi_rssi_list = -1;
+-static gint ett_nfapi_pci_list = -1;
+-static gint ett_nfapi_psc_list = -1;
+-static gint ett_nfapi_lte_cells_found_list = -1;
+-static gint ett_nfapi_utran_cells_found_list = -1;
+-static gint ett_nfapi_geran_cells_found_list = -1;
+-static gint ett_nfapi_si_periodicity_list = -1;
+-
+-static expert_field ei_invalid_range = EI_INIT;
+-static expert_field ei_power_invalid = EI_INIT;
+-static expert_field ei_ref_sig_power_invalid = EI_INIT;
+-
+-
+-static int hf_nfapi_message_tree = -1;
+-
+-static int hf_nfapi_p4_p5_message_header = -1;
+-static int hf_nfapi_p4_p5_message_header_phy_id = -1;
+-static int hf_nfapi_p4_p5_message_header_message_id = -1;
+-static int hf_nfapi_p4_p5_message_header_message_length = -1;
+-static int hf_nfapi_p4_p5_message_header_spare = -1;
+-
+-static int hf_nfapi_p7_message_header = -1;
+-static int hf_nfapi_p7_message_header_phy_id = -1;
+-static int hf_nfapi_p7_message_header_message_id = -1;
+-static int hf_nfapi_p7_message_header_message_length = -1;
+-static int hf_nfapi_p7_message_header_m = -1;
+-static int hf_nfapi_p7_message_header_segment = -1;
+-static int hf_nfapi_p7_message_header_sequence_number = -1;
+-static int hf_nfapi_p7_message_header_checksum = -1;
+-static int hf_nfapi_p7_message_header_transmit_timestamp = -1;
+-
+-static int hf_nfapi_tlv_tree = -1;
+-
+-static int hf_nfapi_tl = -1;
+-static int hf_nfapi_tl_tag = -1;
+-static int hf_nfapi_tl_length = -1;
+-static int hf_nfapi_tag_uint8_value = -1;
+-static int hf_nfapi_tag_uint16_value = -1;
+-
+-static int hf_nfapi_pnf_param_general = -1;
+-static int hf_nfapi_sync_mode = -1;
+-static int hf_nfapi_location_mode = -1;
+-static int hf_nfapi_location_coordinates = -1;
+-static int hf_nfapi_location_coordinates_length = -1;
+-static int hf_nfapi_dl_config_timing = -1;
+-static int hf_nfapi_tx_timing = -1;
+-static int hf_nfapi_ul_config_timing = -1;
+-static int hf_nfapi_hi_dci0_timing = -1;
+-static int hf_nfapi_maximum_number_phys = -1;
+-static int hf_nfapi_maximum_total_bandwidth = -1;
+-static int hf_nfapi_maximum_total_number_dl_layers = -1;
+-static int hf_nfapi_maximum_total_number_ul_layers = -1;
+-static int hf_nfapi_shared_bands = -1;
+-static int hf_nfapi_shared_pa = -1;
+-static int hf_nfapi_maximum_total_power = -1;
+-static int hf_nfapi_oui= -1;
+-
+-static int hf_nfapi_pdu = -1;
+-
+-static int hf_nfapi_pnf_phy = -1;
+-static int hf_nfapi_pnf_phy_nfapi_tl = -1; /* structure hf_nfapi_tl*/
+-static int hf_nfapi_pnf_phy_number_phy = -1;
+-static int hf_nfapi_pnf_phy_config_index = -1;
+-static int hf_nfapi_number_of_rf_exclusions = -1;
+-static int hf_nfapi_dl_bandwidth_support = -1;
+-static int hf_nfapi_ul_bandwidth_support = -1;
+-static int hf_nfapi_downlink_channel_bandwidth_supported = -1;
+-static int hf_nfapi_uplink_channel_bandwidth_supported = -1;
+-static int hf_nfapi_number_of_dl_layers_supported = -1;
+-static int hf_nfapi_number_of_ul_layers_supported = -1;
+-static int hf_nfapi_maximum_3gpp_release_supported = -1;
+-static int hf_nfapi_nmm_modes_supported = -1;
+-
+-
+-static int hf_nfapi_pnf_rf = -1;
+-static int hf_nfapi_pnf_rf_nfapi_tl = -1;
+-static int hf_nfapi_number_of_rfs = -1;
+-static int hf_nfapi_rf_config_index = -1;
+-static int hf_nfapi_band = -1;
+-static int hf_nfapi_maximum_transmit_power = -1;
+-static int hf_nfapi_earfcn = -1;
+-static int hf_nfapi_minimum_transmit_power = -1;
+-static int hf_nfapi_number_of_antennas_suppported = -1;
+-static int hf_nfapi_minimum_downlink_frequency = -1;
+-static int hf_nfapi_maximum_downlink_frequency = -1;
+-static int hf_nfapi_minimum_uplink_frequency = -1;
+-static int hf_nfapi_maximum_uplink_frequency = -1;
+-
+-static int hf_nfapi_number_of_rf_bands = -1;
+-static int hf_nfapi_nmm_uplink_rssi_supported = -1;
+-
+-static int hf_nfapi_phy_rf_config_info = -1;
+-static int hf_nfapi_phy_rf_config_info_phy_id = -1;
+-static int hf_nfapi_phy_rf_config_info_band = -1;
+-
+-static int hf_nfapi_pnf_phy_rf_config = -1;
+-static int hf_nfapi_pnf_phy_rf_config_number_phy_rf_config_info = -1;
+-static int hf_nfapi_pnf_phy_rf_config_array_phy_rf_config_info = -1;
+-
+-static int hf_nfapi_pnf_phy_rel10 = -1;
+-static int hf_nfapi_transmission_mode7_supported = -1;
+-static int hi_nfapi_transmission_mode8_supported = -1;
+-static int hi_nfapi_two_antennas_ports_for_pucch = -1;
+-static int hi_nfapi_transmission_mode_9_supported = -1;
+-static int hi_nfapi_simultaneous_pucch_pusch = -1;
+-static int hi_nfapi_for_layer_tx_with_tm3_and_tm4 = -1;
+-
+-static int hf_nfapi_pnf_phy_rel11 = -1;
+-static int hf_nfapi_epdcch_supported = -1;
+-static int hi_nfapi_multi_ack_csi_reporting = -1;
+-static int hi_nfapi_pucch_tx_diversity_with_channel_selection = -1;
+-static int hi_nfapi_ul_comp_supported = -1;
+-static int hi_nfapi_transmission_mode_5_supported = -1;
+-
+-static int hf_nfapi_pnf_phy_rel12 = -1;
+-static int hf_nfapi_csi_subframe_set = -1;
+-static int hi_nfapi_enhanced_4tx_codebook = -1;
+-static int hi_nfapi_drs_supported = -1;
+-static int hi_nfapi_ul_64qam_supported = -1;
+-static int hi_nfapi_transmission_mode_10_supported = -1;
+-static int hi_nfapi_alternative_tbs_indices = -1;
+-
+-static int hf_nfapi_pnf_phy_rel13 = -1;
+-static int hf_nfapi_pucch_format_4_supported = -1;
+-static int hf_nfapi_pucch_format_5_supported = -1;
+-static int hf_nfapi_more_than_5_ca_supported = -1;
+-static int hf_nfapi_laa_supported = -1;
+-static int hf_nfapi_laa_ending_in_dwpts_supported = -1;
+-static int hf_nfapi_laa_starting_in_second_slot_supported = -1;
+-static int hf_nfapi_beamforming_supported = -1;
+-static int hf_nfapi_csi_rs_enhancements_supported = -1;
+-static int hf_nfapi_drms_enhancements_supported = -1;
+-static int hf_nfapi_srs_enhancements_supported = -1;
+-
+-
+-// P5 Message Structures
+-static int hf_nfapi_pnf_param_response_pnf_param_general = -1;
+-static int hf_nfapi_pnf_param_response_pnf_phy = -1;
+-static int hf_nfapi_pnf_param_response_pnf_rf = -1;
+-
+-static int hf_nfapi_pnf_param_request = -1;
+-static int hf_nfapi_pnf_param_response = -1;
+-static int hf_nfapi_pnf_config_request = -1;
+-static int hf_nfapi_pnf_config_response = -1;
+-static int hf_nfapi_pnf_start_request = -1;
+-static int hf_nfapi_pnf_start_response = -1;
+-static int hf_nfapi_pnf_stop_request = -1;
+-static int hf_nfapi_pnf_stop_response = -1;
+-static int hf_nfapi_param_response = -1;
+-static int hf_nfapi_start_request = -1;
+-static int hf_nfapi_start_response = -1;
+-static int hf_nfapi_stop_request = -1;
+-static int hf_nfapi_stop_response = -1;
+-
+-static int hf_nfapi_uint8_tag = -1;
+-static int hf_nfapi_uint16_tag = -1;
+-
+-static int hf_nfapi_error_code = -1;
+-static int hf_nfapi_p4_error_code = -1;
+-static int hf_nfapi_rat_type = -1;
+-static int hf_nfapi_num_tlv = -1;
+-static int hf_nfapi_phy_state = -1;
+-//	static int hf_nfapi_bandwidth_support = -1;
+-	
+-static int hf_nfapi_modulation_support = -1;
+-static int hf_nfapi_phy_antenna_capability = -1;
+-static int hf_nfapi_release_capability = -1;
+-static int hf_nfapi_mbsfn_capability = -1;
+-
+-static int hf_nfapi_laa_capability = -1;
+-static int hf_nfapi_pd_sensing_lbt_support = -1;
+-static int hf_nfapi_multi_carrier_lbt_support = -1;
+-static int hf_nfapi_partial_sf_support = -1;
+-	
+-/* nfapi nfapi */
+-static int hf_nfapi_pnf_address = -1;
+-static int hf_nfapi_pnf_address_ipv4 = -1;
+-static int hf_nfapi_pnf_address_ipv6 = -1;
+-
+-static int hf_nfapi_vnf_address = -1;
+-static int hf_nfapi_vnf_address_ipv4 = -1;
+-static int hf_nfapi_vnf_address_ipv6 = -1;
+-	
+-static int hf_nfapi_pnf_port = -1;
+-static int hf_nfapi_vnf_port = -1;
+-static int hf_nfapi_dl_ue_per_sf = -1;
+-static int hf_nfapi_ul_ue_per_sf = -1;
+-
+-static int hf_nfapi_rf_bands = -1;
+-static int hf_nfapi_rf_bands_nfapi_tl = -1;
+-static int hf_nfapi_rf_bands_count = -1;
+-static int hf_nfapi_rf_bands_value = -1;
+-
+-static int hf_nfapi_timing_window = -1;
+-static int hf_nfapi_timing_info_mode = -1;
+-static int hf_nfapi_timing_info_period = -1;
+-static int hf_nfapi_max_transmit_power = -1;
+-	
+-/* subframe config */
+-static int hf_nfapi_duplex_mode = -1;
+-static int hf_nfapi_pcfich_power_offset = -1;
+-static int hf_nfapi_pb = -1;
+-static int hf_nfapi_dl_cyclic_prefix_type = -1;
+-static int hf_nfapi_ul_cyclic_prefix_type = -1;
+-
+-static int hf_nfapi_tx_antenna_ports = -1;
+-static int hf_nfapi_rx_antenna_ports = -1;
+-
+-
+-
+-/* RF Config */
+-static int hf_nfapi_downlink_channel_bandwidth = -1;
+-static int hf_nfapi_uplink_channel_bandwidth = -1;
+-static int hf_nfapi_reference_signal_power = -1;
+-
+-/* PHICH config*/
+-static int hf_nfapi_phich_resource = -1;
+-static int hf_nfapi_phich_duration = -1;
+-static int hf_nfapi_phich_power_offset = -1;
+-
+-static int hf_nfapi_value_float = -1;
+-
+-/* SCH Config */
+-static int hf_nfapi_primary_synchronization_signal_epre_eprers = -1;
+-static int hf_nfapi_secondary_synchronization_signal_epre_eprers = -1;
+-static int hf_nfapi_physical_cell_id = -1;
+-
+-/* PRACH config */
+-static int hf_nfapi_configuration_index = -1;
+-static int hf_nfapi_root_sequence_index = -1;
+-static int hf_nfapi_zero_correlation_zone_configuration = -1;
+-static int hf_nfapi_high_speed_flag = -1;
+-static int hf_nfapi_frequency_offset = -1;
+-
+-/* PUSCH config */
+-static int hf_nfapi_hopping_mode = -1;
+-static int hf_nfapi_hopping_offset = -1;
+-
+-/* PUCCH config */
+-static int hf_nfapi_delta_pucch_shift = -1;
+-static int hf_nfapi_n_cqi_rb = -1;
+-static int hf_nfapi_n_an_cs = -1;
+-static int hf_nfapi_n1_pucch_an = -1;
+-
+-/* SRS config */
+-static int hf_nfapi_bandwidth_configuration = -1;
+-static int hf_nfapi_max_up_pts = -1;
+-static int hf_nfapi_srs_subframe_configuration = -1;
+-static int hf_nfapi_srs_acknack_srs_simultaneous_transmission = -1;
+-
+-/* uplink reference signal config */
+-static int hf_nfapi_uplink_rs_hopping = -1;
+-static int hf_nfapi_group_assignment = -1;
+-static int hf_nfapi_cyclic_shift_1_for_drms = -1;
+-
+-/* tdd frame structure */
+-static int hf_nfapi_subframe_assignment = -1;
+-static int hf_nfapi_special_subframe_patterns = -1;
+-
+-/* laa config */
+-static int hf_nfapi_ed_threshold_for_lbt_for_pdsch = -1;
+-static int hf_nfapi_ed_threshold_for_lbt_for_drs = -1;
+-static int hf_nfapi_pd_threshold = -1;
+-static int hf_nfapi_multi_carrier_type = -1;
+-static int hf_nfapi_multi_carrier_tx = -1;
+-static int hf_nfapi_multi_carrier_freeze = -1;
+-static int hf_nfapi_tx_antenna_ports_for_drs = -1;
+-static int hf_nfapi_transmission_power_for_drs = -1;
+-
+-/* eMTC config */
+-static int hf_nfapi_pbch_repetitions_enabled_r13 = -1;
+-static int hf_nfapi_prach_cat_m_root_sequence_index = -1;
+-static int hf_nfapi_prach_cat_m_zero_correlation_zone_configuration = -1;
+-static int hf_nfapi_prach_cat_m_high_speed_flag = -1;
+-
+-static int hf_nfapi_prach_ce_level_0_enable = -1;
+-static int hf_nfapi_prach_ce_level_0_configuration_index = -1;
+-static int hf_nfapi_prach_ce_level_0_frequency_offset = -1;
+-static int hf_nfapi_prach_ce_level_0_number_of_repetitions_per_attempt = -1;
+-static int hf_nfapi_prach_ce_level_0_starting_subframe_periodicity = -1;
+-static int hf_nfapi_prach_ce_level_0_hopping_enabled = -1;
+-static int hf_nfapi_prach_ce_level_0_hopping_offset = -1;
+-
+-static int hf_nfapi_prach_ce_level_1_enable = -1;
+-static int hf_nfapi_prach_ce_level_1_configuration_index = -1;
+-static int hf_nfapi_prach_ce_level_1_frequency_offset = -1;
+-static int hf_nfapi_prach_ce_level_1_number_of_repetitions_per_attempt = -1;
+-static int hf_nfapi_prach_ce_level_1_starting_subframe_periodicity = -1;
+-static int hf_nfapi_prach_ce_level_1_hopping_enabled = -1;
+-static int hf_nfapi_prach_ce_level_1_hopping_offset = -1;
+-
+-static int hf_nfapi_prach_ce_level_2_enable = -1;
+-static int hf_nfapi_prach_ce_level_2_configuration_index = -1;
+-static int hf_nfapi_prach_ce_level_2_frequency_offset = -1;
+-static int hf_nfapi_prach_ce_level_2_number_of_repetitions_per_attempt = -1;
+-static int hf_nfapi_prach_ce_level_2_starting_subframe_periodicity = -1;
+-static int hf_nfapi_prach_ce_level_2_hopping_enabled = -1;
+-static int hf_nfapi_prach_ce_level_2_hopping_offset = -1;
+-
+-static int hf_nfapi_prach_ce_level_3_enable = -1;
+-static int hf_nfapi_prach_ce_level_3_configuration_index = -1;
+-static int hf_nfapi_prach_ce_level_3_frequency_offset = -1;
+-static int hf_nfapi_prach_ce_level_3_number_of_repetitions_per_attempt = -1;
+-static int hf_nfapi_prach_ce_level_3_starting_subframe_periodicity = -1;
+-static int hf_nfapi_prach_ce_level_3_hopping_enabled = -1;
+-static int hf_nfapi_prach_ce_level_3_hopping_offset = -1;
+-static int hf_nfapi_pucch_internal_ul_hopping_config_common_mode_b = -1;
+-static int hf_nfapi_pucch_internal_ul_hopping_config_common_mode_a = -1;
+-
+-static int hf_nfapi_dl_modulation_support = -1;
+-static int hf_nfapi_ul_modulation_support = -1;
+-
+-/* 123 config */
+-static int hf_nfapi_data_report_mode = -1;
+-static int hf_nfapi_sfnsf = -1;
+-
+-// P7 Sub Structures
+-static int hf_nfapi_dl_config_dci_dl_pdu_rel8 = -1;
+-static int hf_nfapi_dci_format = -1;
+-static int hf_nfapi_cce_idx = -1;
+-static int hf_nfapi_aggregation_level = -1;
+-static int hf_nfapi_mcs_1 = -1;
+-static int hf_nfapi_redundancy_version_1 = -1;
+-static int hf_nfapi_new_data_indicator_1 = -1;
+-static int hf_nfapi_mcs_2 = -1;
+-static int hf_nfapi_redundancy_version_2 = -1;
+-static int hf_nfapi_new_data_indicator_2 = -1;
+-static int hf_nfapi_harq_process = -1;
+-static int hf_nfapi_tpmi = -1;
+-static int hf_nfapi_pmi = -1;
+-static int hf_nfapi_precoding_information = -1;
+-static int hf_nfapi_tpc = -1;
+-static int hf_nfapi_downlink_assignment_index = -1;
+-static int hf_nfapi_transport_block_size_index = -1;
+-static int hf_nfapi_downlink_power_offset = -1;
+-static int hf_nfapi_allocate_prach_flag = -1;
+-static int hf_nfapi_preamble_index = -1;
+-static int hf_nfapi_prach_mask_index = -1;
+-static int hf_nfapi_rnti_type = -1;
+-
+-static int hf_nfapi_dl_config_dci_dl_pdu_rel9 = -1;
+-static int hf_nfapi_mcch_flag = -1;
+-static int hf_nfapi_mcch_change_notification = -1;
+-static int hf_nfapi_scrambling_identity = -1;
+-
+-static int hf_nfapi_dl_config_dci_dl_pdu_rel10 = -1;
+-static int hf_nfapi_cross_carrier_scheduling_flag = -1;
+-static int hf_nfapi_carrier_indicator = -1;
+-static int hf_nfapi_srs_flag = -1;
+-static int hf_nfapi_srs_request = -1;
+-static int hf_nfapi_antenna_ports_scrambling_and_layers = -1;
+-static int hf_nfapi_total_dci_length_including_padding = -1;
+-static int hf_nfapi_n_dl_rb = -1;
+-
+-static int hf_nfapi_dl_config_dci_dl_pdu_rel11 = -1;
+-static int hf_nfapi_harq_ack_resource_offset = -1;
+-static int hf_nfapi_pdsch_re_mapping_and_quasi_co_location_indicator = -1;
+-static int hf_nfapi_dl_config_dci_dl_pdu_rel12 = -1;
+-static int hf_nfapi_primary_cell_type = -1;
+-static int hf_nfapi_ul_dl_configuration_flag = -1;
+-static int hf_nfapi_number_of_ul_dl_configurations = -1;
+-static int hf_nfapi_ul_dl_configuration_index = -1;
+-static int hf_nfapi_dl_config_dci_dl_pdu_rel13 = -1;
+-static int hf_nfapi_laa_end_partial_sf_flag = -1;
+-static int hf_nfapi_laa_end_partial_sf_configuration = -1;
+-static int hf_nfapi_initial_lbt_sf = -1;
+-static int hf_nfapi_codebooksize_determination_r13 = -1;
+-static int hf_nfapi_rel13_drms_table_flag = -1;
+-
+-
+-static int hf_nfapi_dl_config_dci_dl_pdu = -1;
+-static int hf_nfapi_dl_config_dci_dl_pdu_nfapi_dl_config_dci_dl_pdu_rel8 = -1;
+-static int hf_nfapi_dl_config_dci_dl_pdu_nfapi_dl_config_dci_dl_pdu_rel9 = -1;
+-static int hf_nfapi_dl_config_dci_dl_pdu_nfapi_dl_config_dci_dl_pdu_rel10 = -1;
+-
+-static int hf_nfapi_bf_vector_antennas = -1;
+-static int hf_nfapi_subbands = -1;
+-static int hf_nfapi_bf_vectors = -1;
+-static int hf_nfapi_csi_rs_resource_config = -1;
+-static int hf_nfapi_csi_rs_number_if_nzp_configurations = -1;
+-static int hf_nfapi_csi_rs_resource_configs = -1;
+-static int hf_nfapi_pdsch_start = -1;
+-static int hf_nfapi_drms_config_flag = -1;
+-static int hf_nfapi_drms_scrambling = -1;
+-static int hf_nfapi_csi_config_flag = -1;
+-static int hf_nfapi_csi_scrambling = -1;
+-static int hf_nfapi_pdsch_re_mapping_flag = -1;
+-static int hf_nfapi_pdsch_re_mapping_antenna_ports = -1;
+-static int hf_nfapi_pdsch_re_mapping_freq_shift = -1;
+-static int hf_nfapi_alt_cqi_table_r12 = -1;
+-static int hf_nfapi_max_layers = -1;
+-static int hf_nfapi_n_dl_harq = -1;
+-static int hf_nfapi_dwpts_symbols = -1;
+-static int hf_nfapi_ue_type = -1;
+-static int hf_nfapi_pdsch_payload_type = -1;
+-static int hf_nfapi_initial_transmission_sf = -1;
+-static int hf_nfapi_req13_drms_table_flag = -1;
+-static int hf_nfapi_prnti = -1;
+-static int hf_nfapi_mcs = -1;
+-static int hf_nfapi_number_of_transport_blocks = -1;
+-static int hf_nfapi_ue_mode = -1;
+-static int hf_prs_bandwidth = -1;
+-static int hf_prs_cyclic_prefix_type = -1;
+-static int hf_prs_muting = -1;
+-static int hf_nfapi_csi_rs_number_of_nzp_configuration = -1;
+-static int hf_nfapi_csi_rs_resource_index = -1;
+-static int hf_nfapi_csi_rs_class = -1;
+-static int hf_nfapi_cdm_type = -1;
+-static int hf_nfapi_csi_rs_bf_vector = -1;
+-static int hf_nfapi_edpcch_prb_index = -1;
+-static int hf_nfapi_epdcch_resource_assignment_flag = -1;
+-static int hf_nfapi_epdcch_id = -1;
+-static int hf_nfapi_epdcch_start_symbol = -1;
+-static int hf_nfapi_epdcch_num_prb = -1;
+-static int hf_nfapi_epdcch_prbs = -1;
+-static int hf_nfapi_precoding_value = -1;
+-static int hf_nfapi_mpdcch_narrowband = -1;
+-static int hf_nfapi_number_of_prb_pairs = -1;
+-static int hf_nfapi_resource_block_assignment = -1;
+-static int hf_nfapi_start_symbol = -1;
+-static int hf_nfapi_ecce_index = -1;
+-static int hf_nfapi_ce_mode = -1;
+-static int hf_nfapi_drms_scrabmling_init = -1;
+-static int hf_nfapi_pdsch_reception_levels = -1;
+-static int hf_nfapi_new_data_indicator = -1;
+-static int hf_nfapi_tpmi_length = -1;
+-static int hf_nfapi_pmi_flag = -1;
+-static int hf_nfapi_harq_resource_offset = -1;
+-static int hf_nfapi_dci_subframe_repetition_number = -1;
+-static int hf_nfapi_downlink_assignment_index_length = -1;
+-static int hf_nfapi_starting_ce_level = -1;
+-static int hf_nfapi_antenna_ports_and_scrambling_identity_flag = -1;
+-static int hf_nfapi_antenna_ports_and_scrambling_identity = -1;
+-static int hf_nfapi_paging_direct_indication_differentiation_flag = -1;
+-static int hf_nfapi_direct_indication = -1;
+-static int hf_nfapi_number_of_tx_antenna_ports = -1;
+-static int hf_nfapi_precoding = -1;
+-
+-
+-
+-// P7 Message Structures
+-static int hf_nfapi_dl_node_sync = -1;
+-static int hf_nfapi_dl_node_sync_nfapi_p7_message_header = -1;
+-static int hf_nfapi_dl_node_sync_t1 = -1;
+-static int hf_nfapi_dl_node_sync_delta_sfn_sf = -1;
+-
+-static int hf_nfapi_ul_node_sync = -1;
+-static int hf_nfapi_ul_node_sync_nfapi_p7_message_header = -1;
+-static int hf_nfapi_ul_node_sync_t1 = -1;
+-static int hf_nfapi_ul_node_sync_t2 = -1;
+-static int hf_nfapi_ul_node_sync_t3 = -1;
+-
+-static int hf_nfapi_timing_info = -1;
+-static int hf_nfapi_timing_info_nfapi_p7_message_header = -1;
+-static int hf_nfapi_timing_info_last_sfn_sf = -1;
+-static int hf_nfapi_timing_info_time_since_last_timing_info = -1;
+-static int hf_nfapi_timing_info_dl_config_jitter = -1;
+-static int hf_nfapi_timing_info_tx_request_jitter = -1;
+-static int hf_nfapi_timing_info_ul_config_jitter = -1;
+-static int hf_nfapi_timing_info_hi_dci0_jitter = -1;
+-static int hf_nfapi_timing_info_dl_config_latest_delay = -1;
+-static int hf_nfapi_timing_info_tx_request_latest_delay = -1;
+-static int hf_nfapi_timing_info_ul_config_latest_delay = -1;
+-static int hf_nfapi_timing_info_hi_dci0_latest_delay = -1;
+-static int hf_nfapi_timing_info_dl_config_earliest_arrival = -1;
+-static int hf_nfapi_timing_info_tx_request_earliest_arrival = -1;
+-static int hf_nfapi_timing_info_ul_config_earliest_arrival = -1;
+-static int hf_nfapi_timing_info_hi_dci0_earliest_arrival = -1;
+-
+-static int hf_nfapi_dl_config_request = -1;
+-static int hf_nfapi_sfn_sf = -1;
+-
+-static int hf_nfapi_dl_config_request_body = -1;
+-static int hf_nfapi_number_pdcch_ofdm_symbols = -1;
+-static int hf_nfapi_number_dci = -1;
+-static int hf_nfapi_number_pdus = -1;
+-static int hf_nfapi_number_pdsch_rnti = -1;
+-static int hf_nfapi_transmission_power_pcfich = -1;
+-
+-static int hf_nfapi_number_of_harqs = -1;
+-static int hf_nfapi_number_of_crcs = -1;
+-static int hf_nfapi_number_of_srs = -1;
+-static int hf_nfapi_number_of_cqi = -1;
+-static int hf_nfapi_number_of_preambles = -1;
+-static int hf_nfapi_number_of_srss = -1;
+-static int hf_nfapi_lbt_dl_req_pdu_type = -1;
+-static int hf_nfapi_lbt_dl_ind_pdu_type = -1;
+-
+-static int hf_nfapi_dl_config_request_pdu_list = -1;
+-static int hf_nfapi_ul_config_request_pdu_list = -1;
+-static int hf_nfapi_hi_dci0_request_pdu_list = -1;
+-static int hf_nfapi_tx_request_pdu_list = -1;
+-static int hf_nfapi_rx_indication_pdu_list = -1;
+-static int hf_nfapi_harq_indication_pdu_list = -1;
+-static int hf_nfapi_crc_indication_pdu_list = -1;
+-static int hf_nfapi_sr_indication_pdu_list = -1;
+-static int hf_nfapi_cqi_indication_pdu_list = -1;
+-static int hf_nfapi_preamble_indication_pdu_list = -1;
+-static int hf_nfapi_srs_indication_pdu_list = -1;
+-static int hf_nfapi_lbt_dl_config_pdu_list = -1;
+-static int hf_nfapi_lbt_dl_indication_pdu_list = -1;
+-
+-
+-static int hf_nfapi_dl_config_pdu_type = -1;
+-static int hf_nfapi_pdu_size = -1;
+-static int hf_nfapi_instance_length = -1;
+-
+-static int hf_nfapi_dl_config_dlsch_pdu_rel8 = -1;
+-static int hf_nfapi_length;
+-static int hf_nfapi_pdu_index = -1;
+-static int hf_nfapi_rnti = -1;
+-static int hf_nfapi_resource_allocation_type = -1;
+-static int hf_nfapi_virtual_resource_block_assignment_flag = -1;
+-static int hf_nfapi_resource_block_coding = -1;
+-static int hf_nfapi_modulation = -1;
+-static int hf_nfapi_redundancy_version = -1;
+-static int hf_nfapi_transport_blocks = -1;
+-static int hf_nfapi_transport_block_to_codeword_swap_flag = -1;
+-static int hf_nfapi_transmission_scheme = -1;
+-static int hf_nfapi_ul_transmission_scheme = -1;
+-static int hf_nfapi_number_of_layers = -1;
+-static int hf_nfapi_number_of_subbands = -1;
+-static int hf_nfapi_codebook_index = -1;
+-static int hf_nfapi_ue_category_capacity = -1;
+-static int hf_nfapi_pa = -1;
+-static int hf_nfapi_delta_power_offset_index = -1;
+-static int hf_nfapi_ngap = -1;
+-static int hf_nfapi_nprb = -1;
+-static int hf_nfapi_transmission_mode = -1;
+-static int hf_nfapi_num_bf_prb_per_subband = -1;
+-
+-static int hf_nfapi_num_bf_vector = -1;
+-static int hf_nfapi_bf_vector_subband_index = -1;
+-static int hf_nfapi_bf_vector_num_antennas = -1;
+-static int hf_nfapi_bf_vector_bf_value = -1;
+-
+-static int hf_nfapi_dl_config_dlsch_pdu_rel9 = -1;
+-static int hf_nfapi_nscid = -1;
+-
+-static int hf_nfapi_dl_config_dlsch_pdu_rel10 = -1;
+-static int hf_nfapi_csi_rs_flag = -1;
+-static int hf_nfapi_csi_rs_resource_config_r10 = -1;
+-static int hf_nfapi_csi_rs_zero_tx_power_resource_config_bitmap_r10 = -1;
+-
+-static int hf_nfapi_dl_config_bch_pdu_rel8 = -1;
+-static int hf_nfapi_transmission_power = -1;
+-
+-static int hf_nfapi_dl_config_mch_pdu_rel8 = -1;
+-static int hf_nfapi_mbsfn_area_id = -1;
+-
+-static int hf_nfapi_dl_config_pch_pdu_rel8 = -1;
+-
+-static int hf_nfapi_dl_config_prs_pdu_rel9 = -1;
+-static int hf_nfapi_prs_bandwidth = -1;
+-static int hf_nfapi_prs_cyclic_prefix_type = -1;
+-		
+-static int hf_nfapi_dl_config_csi_rs_pdu_rel10 = -1;
+-static int hf_nfapi_csi_rs_antenna_port_count_r10 = -1;
+-
+-static int hf_nfapi_ul_config_request = -1;
+-static int hf_nfapi_ul_config_request_body = -1;
+-static int hf_nfapi_ul_config_pdu_type = -1;
+-
+-static int hf_nfapi_rach_prach_frequency_resources = -1;
+-static int hf_nfapi_srs_present = -1;
+-static int hf_nfapi_ul_config_harq_buffer_pdu = -1;
+-
+-static int hf_nfapi_ul_config_ue_information_rel8 = -1;
+-static int hf_nfapi_handle = -1;
+-static int hf_nfapi_ul_config_sr_information_pdu_rel8 = -1;
+-static int hf_nfapi_pucch_index = -1;
+-static int hf_nfapi_size = -1;
+-static int hf_nfapi_resource_block_start = -1;
+-static int hf_nfapi_number_of_resource_blocks = -1;
+-static int hf_nfapi_cyclic_shift_2_for_drms = -1;
+-static int hf_nfapi_frequency_hopping_enabled_flag = -1;
+-static int hf_nfapi_frequency_hopping_bits = -1;
+-static int hf_nfapi_new_data_indication = -1;
+-static int hf_nfapi_harq_process_number = -1;
+-static int hf_nfapi_ul_tx_mode = -1;
+-static int hf_nfapi_current_tx_nb = -1;
+-static int hf_nfapi_n_srs = -1;
+-static int hf_nfapi_disable_sequence_hopping_flag = -1;
+-static int hf_nfapi_dl_cqi_pmi_size_rank_1 = -1;
+-static int hf_nfapi_dl_cqi_pmi_size_rank_greater_1 = -1;
+-static int hf_nfapi_ri_size = -1;
+-static int hf_nfapi_delta_offset_cqi = -1;
+-static int hf_nfapi_delta_offset_ri = -1;
+-static int hf_nfapi_harq_size = -1;
+-static int hf_nfapi_delta_offset_harq = -1;
+-static int hf_nfapi_ack_nack_mode = -1;
+-static int hf_nfapi_n_srs_initial = -1;
+-static int hf_nfapi_initial_number_of_resource_blocks = -1;
+-static int hf_nfapi_dl_cqi_pmi_size = -1;
+-static int hf_nfapi_report_type = -1;
+-static int hf_nfapi_dl_cqi_ri_pmi_size = -1;
+-static int hf_nfapi_control_type = -1;
+-static int hf_nfapi_number_of_cc = -1;
+-static int hf_nfapi_virtual_cell_id_enabled_flag = -1;
+-static int hf_nfapi_npusch_identity = -1;
+-static int hf_nfapi_ndrms_csh_identity = -1;
+-static int hf_nfapi_total_number_of_repetitions = -1;
+-static int hf_nfapi_repetition_number = -1;
+-static int hf_nfapi_initial_sf_io = -1;
+-static int hf_nfapi_empty_symbols_due_to_retunning = -1;
+-static int hf_nfapi_dl_cqi_ri_pmi_size_2 = -1;
+-static int hf_nfapi_npucch_identity = -1;
+-static int hf_nfapi_harq_size_2 = -1;
+-static int hf_nfapi_delta_offset_harq_2 = -1;
+-static int hf_nfapi_empty_symbols = -1;
+-static int hf_nfapi_total_number_of_repetitons = -1;
+-static int hf_nfapi_csi_mode = -1;
+-static int hf_nfapi_dl_cqi_pmi_size_2 = -1;
+-static int hf_nfapi_statring_prb = -1;
+-static int hf_nfapi_cdm_index = -1;
+-static int hf_nfapi_nsrs = -1;
+-static int hf_nfapi_num_ant_ports = -1;
+-static int hf_nfapi_n_pucch_2_0 = -1;
+-static int hf_nfapi_n_pucch_2_1 = -1;
+-static int hf_nfapi_n_pucch_2_2 = -1;
+-static int hf_nfapi_n_pucch_2_3 = -1;
+-static int hf_nfapi_starting_prb = -1;
+-static int hf_nfapi_antenna_port = -1;
+-static int hf_nfapi_number_of_combs = -1;
+-
+-
+-
+-static int hf_nfapi_number_of_pucch_resource = -1;
+-static int hf_nfapi_pucch_index_p1 = -1;
+-static int hf_nfapi_n_pucch_1_0 = -1;
+-static int hf_nfapi_n_pucch_1_1 = -1;
+-static int hf_nfapi_n_pucch_1_2 = -1;
+-static int hf_nfapi_n_pucch_1_3 = -1;
+-static int hf_nfapi_srs_bandwidth = -1;
+-static int hf_nfapi_frequency_domain_position = -1;
+-static int hf_nfapi_srs_hopping_bandwidth = -1;
+-static int hf_nfapi_transmission_comb = -1;
+-static int hf_nfapi_i_srs = -1;
+-static int hf_nfapi_sounding_reference_cyclic_shift = -1;
+-static int hf_nfapi_antenna_ports = -1;
+-static int hf_nfapi_ul_config_srs_pdu_rel10 = -1;
+-static int hf_nfapi_ul_config_srs_pdu_rel8 = -1;
+-static int hf_nfapi_ul_config_harq_information_rel9_fdd = -1;
+-static int hf_nfapi_ul_config_harq_information_rel8_fdd = -1;
+-static int hf_nfapi_ul_config_harq_information_rel10_tdd = -1;
+-static int hf_nfapi_ul_config_sr_information_rel10 = -1;
+-static int hf_nfapi_ul_config_sr_information_rel8 = -1;
+-static int hf_nfapi_ul_config_cqi_information_rel10 = -1;
+-static int hf_nfapi_ul_config_cqi_information_rel8 = -1;
+-static int hf_nfapi_ul_config_initial_transmission_parameters_rel8 = -1;
+-static int hf_nfapi_ul_config_ulsch_harq_information_rel10 = -1;
+-
+-/* Tx request */
+-static int hf_nfapi_pdu_length = -1;
+-static int hf_nfapi_num_segments = -1;
+-static int hf_nfapi_segment_length = -1;
+-static int hf_nfapi_segment_data = -1;
+-
+-/* CRC Indication */
+-static int hf_nfapi_crc_indication_body = -1;
+-static int hf_nfapi_crc_flag = -1;
+-
+-static int hf_nfapi_number_of_hi_pdus = -1;
+-static int hf_nfapi_number_of_dci_pdus = -1;
+-static int hf_nfapi_pdu_type = -1;
+-static int hf_nfapi_hi_value = -1;
+-static int hf_nfapi_i_phich = -1;
+-static int hf_nfapi_flag_tb2 = -1;
+-static int hf_nfapi_hi_value_2 = -1;
+-static int hf_nfapi_ue_tx_antenna_selection = -1;
+-static int hf_nfapi_cqi_csi_request = -1;
+-static int hf_nfapi_ul_index = -1;
+-static int hf_nfapi_dl_assignment_index = -1;
+-static int hf_nfapi_tpc_bitmap = -1;
+-static int hf_nfapi_new_data_indication_two = -1;
+-static int hf_nfapi_size_of_cqi_csi_feild = -1;
+-static int hf_nfapi_resource_allocation_flag = -1;
+-static int hf_nfapi_number_of_antenna_ports =-1 ;
+-
+-static int hf_nfapi_n_ul_rb = -1;
+-static int hf_nfapi_pscch_resource = -1;
+-static int hf_nfapi_time_resource_pattern = -1;
+-static int hf_nfapi_mpdcch_transmission_type = -1;
+-static int hf_nfapi_drms_scrambling_init = -1;
+-static int hf_nfapi_pusch_repetition_levels = -1;
+-static int hf_nfapi_frequency_hopping_flag = -1;
+-static int hf_nfapi_csi_request = -1;
+-static int hf_nfapi_dai_presence_flag = -1;
+-static int hf_nfapi_total_dci_length_include_padding = -1;
+-static int hf_nfapi_data_offset = -1;
+-static int hf_nfapi_ul_cqi = -1;
+-static int hf_nfapi_timing_advance_r9 = -1;
+-static int hf_nfapi_timing_advance = -1;
+-static int hf_nfapi_harq_data_value_0 = -1;
+-static int hf_nfapi_harq_data_value_1 = -1;
+-static int hf_nfapi_harq_data_value_2 = -1;
+-static int hf_nfapi_harq_data_value_3 = -1;
+-static int hf_nfapi_harq_mode = -1;
+-static int hf_nfapi_number_of_ack_nack = -1;
+-static int hf_nfapi_harq_ack_nack_data = -1;
+-static int hf_nfapi_harq_tb_1 = -1;
+-static int hf_nfapi_harq_tb_2 = -1;
+-static int hf_nfapi_harq_tb_n = -1;
+-static int hf_nfapi_harq_data = -1;
+-static int hf_nfapi_channel = -1;
+-static int hf_nfapi_ri = -1;
+-static int hf_nfapi_number_of_cc_reported = -1;
+-static int hf_nfapi_cc = -1;
+-static int hf_nfapi_preamble = -1;
+-static int hf_nfapi_rach_resource_type = -1;
+-static int hf_nfapi_snr = -1;
+-static int hf_nfapi_doppler_estimation = -1;
+-static int hf_nfapi_rb_start = -1;
+-static int hf_nfapi_rbs = -1;
+-static int hf_nfapi_up_pts_symbol = -1;
+-static int hf_nfapi_number_prb_per_subband = -1;
+-static int hf_nfapi_number_antennas = -1;
+-static int hf_nfapi_subband_index = -1;
+-static int hf_nfapi_antennas = -1;
+-static int hf_nfapi_channel_coefficient = -1;
+-static int hf_nfapi_ul_rtoa = -1;
+-static int hf_nfapi_mp_cca = -1;
+-static int hf_nfapi_n_cca = -1;
+-static int hf_nfapi_offset = -1;
+-static int hf_nfapi_lte_txop_sf = -1;
+-static int hf_nfapi_txop_sfn_sf_end = -1;
+-static int hf_nfapi_lbt_mode = -1;
+-static int hf_nfapi_sfn_sf_end = -1;
+-static int hf_nfapi_result = -1;
+-static int hf_nfapi_txop_symbols = -1;
+-static int hf_nfapi_initial_partial_sf = -1;
+-
+-
+-static int hf_nfapi_frequency_band_indicator = -1;
+-static int hf_nfapi_measurement_period = -1;
+-static int hf_nfapi_bandwidth = -1;
+-static int hf_nfapi_timeout = -1;
+-static int hf_nfapi_number_of_earfcns = -1;
+-static int hf_nfapi_earfcn_list = -1;
+-static int hf_nfapi_uarfcn = -1;
+-static int hf_nfapi_number_of_uarfcns = -1;
+-static int hf_nfapi_uarfcn_list = -1;
+-static int hf_nfapi_arfcn = -1;
+-static int hf_nfapi_arfcn_direction = -1;
+-static int hf_nfapi_number_of_arfcns = -1;
+-static int hf_nfapi_arfcn_list = -1;
+-static int hf_nfapi_rssi = -1;
+-static int hf_nfapi_number_of_rssi = -1;
+-static int hf_nfapi_rssi_list = -1;
+-static int hf_nfapi_pci = -1;
+-static int hf_nfapi_measurement_bandwidth = -1;
+-static int hf_nfapi_exhaustive_search = -1;
+-static int hf_nfapi_number_of_pci = -1;
+-static int hf_nfapi_pci_list = -1;
+-static int hf_nfapi_psc = -1;
+-static int hf_nfapi_number_of_psc = -1;
+-static int hf_nfapi_psc_list = -1;
+-static int hf_nfapi_rsrp = -1;
+-static int hf_nfapi_rsrq = -1;
+-static int hf_nfapi_number_of_lte_cells_found = -1;
+-static int hf_nfapi_lte_cells_found_list = -1;
+-static int hf_nfapi_rscp = -1;
+-static int hf_nfapi_enco = -1;
+-static int hf_nfapi_number_of_utran_cells_found = -1;
+-static int hf_nfapi_utran_cells_found_list = -1;
+-static int hf_nfapi_bsic = -1;
+-static int hf_nfapi_rxlev = -1;
+-static int hf_nfapi_rxqual = -1;
+-static int hf_nfapi_sfn_offset = -1;
+-static int hf_nfapi_number_of_geran_cells_found = -1;
+-static int hf_nfapi_geran_cells_found_list = -1;
+-static int hf_nfapi_number_of_tx_antenna = -1;
+-static int hf_nfapi_mib_length = -1;
+-static int hf_nfapi_mib = -1;
+-static int hf_nfapi_phich_configuration = -1;
+-static int hf_nfapi_retry_count = -1;
+-static int hf_nfapi_sib1 = -1;
+-static int hf_nfapi_si_periodicity = -1;
+-static int hf_nfapi_si_index = -1;
+-static int hf_nfapi_number_of_si_periodicity = -1;
+-static int hf_nfapi_si_periodicity_list = -1;
+-static int hf_nfapi_si_window_length = -1;
+-static int hf_nfapi_sib_type = -1;
+-static int hf_nfapi_sib_len = -1;
+-static int hf_nfapi_sib = -1;
+-static int hf_nfapi_si_len = -1;
+-static int hf_nfapi_si = -1;
+-
+-static int hf_nfapi_pnf_search_state = -1;
+-static int hf_nfapi_pnf_broadcast_state = -1;
+-
+-static const value_string message_id_vals[]	= {	{ 0x80, "DL_CONFIG.request"},
+-												{ 0x81, "UL_CONFIG.request"},
+-												{ 0x82, "SUBFRAME_INDICATION"},
+-												{ 0x83, "HI_DCI0.request"},
+-												{ 0x84, "TX.request"},
+-												{ 0x85, "HARQ.indication"},
+-												{ 0x86, "CRC.indication"},
+-												{ 0x87, "RX_ULSCH.indication"},
+-												{ 0x88, "RACH.indication" },
+-												{ 0x89, "SRS.indication" },
+-												{ 0x8A, "RX_SR.indication" },
+-												{ 0x8B, "RX_CQI.indication" },
+-												{ 0x8C,	"LBT_DL_CONFIG.request" } ,
+-												{ 0x8D,	"LBT_DL.indication" } , 
+-
+-												{ 0x0100, "PNF_PARAM.request" },
+-												{ 0x0101, "PNF_PARAM.response" },
+-												{ 0x0102, "PNF_CONFIG.request" },
+-												{ 0x0103, "PNF_CONFIG.response" },
+-												{ 0x0104, "PNF_START.request" },
+-												{ 0x0105, "PNF_START.response" },
+-												{ 0x0106, "PNF_STOP.request" },
+-												{ 0x0107, "PNF_STOP.response" },
+-												{ 0x0108, "PARAM.request" },
+-												{ 0x0109, "PARAM.response" },
+-												{ 0x010A, "CONFIG.request" },
+-												{ 0x010B, "CONFIG.response" },
+-												{ 0x010C, "START.request" },
+-												{ 0x010D, "START.response" },
+-												{ 0x010E, "STOP.request" },
+-												{ 0x010F, "STOP.response" },
+-												{ 0x0110, "MEASUREMENT.request" },
+-												{ 0x0111, "MEASUREMENT.response" },
+-
+-												{ 0x0180, "UL_NODE_SYNC" },
+-												{ 0x0181, "DL_NODE_SYNC" },
+-												{ 0x0182, "TIMING_INFO" },
+-
+-												{ 0x0200, "RSSI.request" },
+-												{ 0x0201, "RSSI.response" },
+-												{ 0x0202, "RSSI.indication" },
+-												{ 0x0203, "CELL_SEARCH.request" },
+-												{ 0x0204, "CELL_SEARCH.response" },
+-												{ 0x0205, "CELL_SEARCH.indication" },
+-												{ 0x0206, "BROADCAST_DETECT.request" },
+-												{ 0x0207, "BROADCAST_DETECT.response" },
+-												{ 0x0208, "BROADCAST_DETECT.indication" },
+-												{ 0x0209, "SYSTEM_INFORMATION_SCHEDULE.request" },
+-												{ 0x020A, "SYSTEM_INFORMATION_SCHEDULE.response" },
+-												{ 0x020B, "SYSTEM_INFORMATION_SCHEDULE.indication" },
+-												{ 0x020C, "SYSTEM_INFORMATION.request" },
+-												{ 0x020D, "SYSTEM_INFORMATION.response" },
+-												{ 0x020E, "SYSTEM_INFORMATION.indication" },
+-												{ 0x020F, "NMM_STOP.request" },
+-												{ 0x0210, "NMM_STOP.response" },
+-
+-												{ 0 , NULL },	
+-};
+-
+-
+-typedef int(*tlv_decode)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end);
+-
+-typedef struct
+-{
+-	uint16_t tag_id;
+-	char* name;
+-	tlv_decode decode;
+-} tlv_t;
+-
+-static int dissect_tlv_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint end);
+-
+-
+-
+-
+-static guint8 proto_tree_add_uint8(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint* offset, char* units)
+-{
+-	guint8 value = tvb_get_guint8(tvb, *offset);
+-	proto_item * item =  proto_tree_add_item(tree, hfindex, tvb, *offset, 1, ENC_NA);
+-
+-	if (units != NULL)
+-	{
+-		proto_item_append_text(item, " ");
+-		proto_item_append_text(item, units);
+-	}
+-
+-	*offset += 1;
+-
+-	return value;
+-}
+-
+-static guint8 proto_tree_add_uint8_with_range(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint* offset, packet_info *pinfo, guint8 min, guint8 max, char* units)
+-{
+-	guint8 value = tvb_get_guint8(tvb, *offset);
+-	proto_item * item = proto_tree_add_item(tree, hfindex, tvb, *offset, 1, ENC_NA);
+-
+-	if (units != NULL)
+-	{
+-		proto_item_append_text(item, " ");
+-		proto_item_append_text(item, units);
+-	}
+-
+-	*offset += 1;
+-
+-	if (value < min || value > max)
+-	{
+-		expert_add_info(pinfo, tree, &ei_invalid_range);
+-	}
+-
+-
+-	return value;
+-}
+-
+-static guint16 proto_tree_add_uint16(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint* offset, char* units)
+-{
+-	guint16 value = tvb_get_guint16(tvb, *offset, ENC_NA);
+-	proto_item * item =  proto_tree_add_item(tree, hfindex, tvb, *offset, 2, ENC_NA);
+-
+-	if (units != NULL)
+-	{
+-		proto_item_append_text(item, " ");
+-		proto_item_append_text(item, units);
+-	}
+-
+-	*offset += 2;
+-
+-	return value;
+-}
+-
+-static void proto_tree_add_int16(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint* offset, char* units)
+-{
+-	proto_item * item = proto_tree_add_item(tree, hfindex, tvb, *offset, 2, ENC_NA);
+-
+-	if (units != NULL)
+-	{
+-		proto_item_append_text(item, " ");
+-		proto_item_append_text(item, units);
+-	}
+-
+-	*offset += 2;
+-}
+-
+-typedef int(*uint8_value_conversion)(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint8 value);
+-
+-static guint8 proto_tree_add_uint8_with_conversion(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint* offset, uint8_value_conversion conversion)
+-{
+-	guint8 value = tvb_get_guint8(tvb, *offset);
+-
+-	conversion(tree, hfindex, tvb, offset, value);
+-
+-	*offset += 1;
+-
+-	return value;
+-}
+-
+-typedef int(*uint16_value_conversion)(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value);
+-
+-static guint16 proto_tree_add_uint16_with_conversion(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint* offset, uint16_value_conversion conversion)
+-{
+-	guint16 value = tvb_get_guint16(tvb, *offset, ENC_NA);
+-
+-	conversion(tree, hfindex, tvb, offset, value);
+-
+-	*offset += 2;
+-
+-	return value;
+-}
+-
+-typedef int(*int16_value_conversion)(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, gint16 value);
+-
+-static gint16 proto_tree_add_int16_with_conversion(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint* offset, int16_value_conversion conversion)
+-{
+-	gint16 value = (gint16)(tvb_get_guint16(tvb, *offset, ENC_NA));
+-
+-	conversion(tree, hfindex, tvb, offset, value);
+-
+-	*offset += 2;
+-
+-	return value;
+-}
+-
+-
+-static void proto_tree_add_uint32(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint* offset, char* units)
+-{
+-	proto_item * item = proto_tree_add_item(tree, hfindex, tvb, *offset, 4, ENC_NA);
+-
+-	if (units != NULL)
+-	{
+-		proto_item_append_text(item, " ");
+-		proto_item_append_text(item, units);
+-	}
+-
+-	*offset += 4;
+-}
+-
+-static void proto_tree_add_uint8_array(proto_tree *tree, int hfindex, guint len, tvbuff_t *tvb, guint* offset)
+-{
+-	proto_tree_add_item(tree, hfindex, tvb, *offset, len, ENC_NA);
+-
+-	*offset += len;
+-}
+-
+-
+-
+-
+-
+-int dissect_array_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end, const char* name, guint32 hf_idx, guint32 ett_idx, guint32 count, tlv_decode decode)
+-{
+-	guint16 i = 0;
+-
+-	if (count > 0)
+-	{
+-		proto_item *list_ti = proto_tree_add_string_format(tree, hf_idx, tvb, *offset, 2, "", name);
+-		proto_tree *list_tree = proto_item_add_subtree(list_ti, ett_idx);
+-
+-		gint start_of_list = *offset;
+-
+-		for (i = 0; i < count; ++i)
+-		{
+-			proto_item *item_ti = proto_tree_add_string_format(list_tree, hf_idx, tvb, *offset, 2, "", "[%d]", i);
+-			proto_tree *item_tree = proto_item_add_subtree(item_ti, ett_idx);
+-
+-			gint start_of_item = *offset;
+-
+-			decode(tvb, pinfo, item_tree, data, offset, end);
+-
+-			if (item_ti != NULL)
+-				item_ti->finfo->length = *offset - start_of_item;
+-		}
+-
+-		if (list_ti != NULL)
+-			list_ti->finfo->length = *offset - start_of_list;
+-	}
+-
+-	return 0;
+-}
+-
+-int dissect_pnf_param_general_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_sync_mode, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_location_mode, tvb, offset, 0);
+-	guint16 len = proto_tree_add_uint16(tree, hf_nfapi_location_coordinates_length, tvb, offset, 0);
+-	if (len > 0)
+-		proto_tree_add_uint8_array(tree, hf_nfapi_location_coordinates, len, tvb, offset);
+-	proto_tree_add_uint32(tree, hf_nfapi_dl_config_timing, tvb, offset, "milliseconds");
+-	proto_tree_add_uint32(tree, hf_nfapi_tx_timing, tvb, offset, "milliseconds");
+-	proto_tree_add_uint32(tree, hf_nfapi_ul_config_timing, tvb, offset, "milliseconds");
+-	proto_tree_add_uint32(tree, hf_nfapi_hi_dci0_timing, tvb, offset, "milliseconds");
+-	proto_tree_add_uint16(tree, hf_nfapi_maximum_number_phys, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_maximum_total_bandwidth, tvb, offset, "(100 khz)");
+-	proto_tree_add_uint8(tree, hf_nfapi_maximum_total_number_dl_layers, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_maximum_total_number_ul_layers, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_shared_bands, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_shared_pa, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_maximum_total_power, tvb, offset, 0);
+-	proto_tree_add_uint8_array(tree, hf_nfapi_oui, 3, tvb, offset);
+-	
+-	return 0;
+-}
+-
+-int dissect_pnf_rf_config_instance_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_rf_config_index, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_instance_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_config_index, tvb, offset, 0);
+-	guint16 num_rf_configs = proto_tree_add_uint16(tree, hf_nfapi_number_of_rfs, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "RF Config List", hf_nfapi_pnf_phy, ett_nfapi_pnf_phy, num_rf_configs, dissect_pnf_rf_config_instance_value);
+-	guint16 num_rf_exclusions = proto_tree_add_uint16(tree, hf_nfapi_number_of_rf_exclusions, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "RF Exclustion List", hf_nfapi_pnf_phy, ett_nfapi_pnf_phy, num_rf_exclusions, dissect_pnf_rf_config_instance_value);
+-	proto_tree_add_uint16(tree, hf_nfapi_downlink_channel_bandwidth_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_uplink_channel_bandwidth_supported, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_dl_layers_supported, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_ul_layers_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_maximum_3gpp_release_supported, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_nmm_modes_supported, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_phy = proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_number_phy, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PHY List", hf_nfapi_pnf_phy, ett_nfapi_pnf_phy, num_phy, dissect_pnf_phy_instance_value);
+-
+-
+-	return 0;
+-
+-}
+-
+-
+-int dissect_pnf_rf_config_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_rf_config_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_band, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_maximum_transmit_power, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_minimum_transmit_power, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_antennas_suppported, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_minimum_downlink_frequency, tvb, offset, "(100 khz)");
+-	proto_tree_add_uint32(tree, hf_nfapi_maximum_downlink_frequency, tvb, offset, "(100 khz)");
+-	proto_tree_add_uint32(tree, hf_nfapi_minimum_uplink_frequency, tvb, offset, "(100 khz)");
+-	proto_tree_add_uint32(tree, hf_nfapi_maximum_uplink_frequency, tvb, offset, "(100 khz)");
+-
+-	return 0;
+-}
+-
+-
+-int dissect_pnf_rf_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_rf = proto_tree_add_uint16(tree, hf_nfapi_number_of_rfs, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "RF List", hf_nfapi_pnf_phy_rf_config_array_phy_rf_config_info, ett_nfapi_pnf_phy_rf_config, num_rf, dissect_pnf_rf_config_value);
+-
+-	return 0;
+-
+-}
+-
+-int dissect_pnf_phy_rel10_instance_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_config_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_transmission_mode7_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_transmission_mode8_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_two_antennas_ports_for_pucch, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_transmission_mode_9_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_simultaneous_pucch_pusch, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_for_layer_tx_with_tm3_and_tm4, tvb, offset, 0);
+-
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_phy = proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_number_phy, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PHY Rel 10 List", hf_nfapi_pnf_phy, ett_nfapi_pnf_phy_rel10, num_phy, dissect_pnf_phy_rel10_instance_value);
+-
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_rel11_instance_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_config_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_epdcch_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_multi_ack_csi_reporting, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_pucch_tx_diversity_with_channel_selection, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_ul_comp_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_transmission_mode_5_supported, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_rel11_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_phy = proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_number_phy, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PHY Rel 11 List", hf_nfapi_pnf_phy, ett_nfapi_pnf_phy_rel11, num_phy, dissect_pnf_phy_rel11_instance_value);
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_rel12_instance_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_config_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_csi_subframe_set, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_enhanced_4tx_codebook, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_drs_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_ul_64qam_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_transmission_mode_10_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hi_nfapi_alternative_tbs_indices, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_rel12_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_phy = proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_number_phy, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PHY Rel 12 List", hf_nfapi_pnf_phy, ett_nfapi_pnf_phy_rel12, num_phy, dissect_pnf_phy_rel12_instance_value);
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_rel13_instance_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_config_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pucch_format_4_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pucch_format_5_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_more_than_5_ca_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_laa_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_laa_ending_in_dwpts_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_laa_starting_in_second_slot_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_beamforming_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_csi_rs_enhancements_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_drms_enhancements_supported, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_srs_enhancements_supported, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_phy = proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_number_phy, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PHY Rel 13 List", hf_nfapi_pnf_phy, ett_nfapi_pnf_phy_rel13, num_phy, dissect_pnf_phy_rel13_instance_value);
+-	return 0;
+-}
+-
+-int dissect_pnf_phy_rf_config_instance_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_phy_rf_config_info_phy_id, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_config_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rf_config_index, tvb, offset, 0);
+-	return 0;
+-}
+-
+-
+-int dissect_pnf_phy_rf_config_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_configs = proto_tree_add_uint16(tree, hf_nfapi_pnf_phy_number_phy, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PHY RF Config List", hf_nfapi_pnf_phy_rf_config, ett_nfapi_pnf_phy_rf_config, num_configs, dissect_pnf_phy_rf_config_instance_value);
+-	return 0;
+-}
+-
+-int bandwidth_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value)
+-{
+-	/*
+-	guint8 comma = 0;
+-
+-	proto_item_append_text(item, "(");
+-
+-	if (value & 0x1)
+-	{
+-		proto_item_append_text(item, "6 Mhz");
+-		comma = 1;
+-	}
+-
+-	if (comma)
+-		proto_item_append_text(item, ", ");
+-
+-	if (value & 0x2)
+-	{
+-		proto_item_append_text(item, "15 Mhz");
+-		comma = 1;
+-	}
+-
+-	if (comma)
+-		proto_item_append_text(item, ", ");
+-
+-	if (value & 0x4)
+-	{
+-		proto_item_append_text(item, "25 Mhz");
+-		comma = 1;
+-	}
+-
+-	if (comma)
+-		proto_item_append_text(item, ", ");
+-
+-	if (value & 0x8)
+-	{
+-		proto_item_append_text(item, "50 Mhz");
+-		comma = 1;
+-	}
+-
+-	if (comma)
+-		proto_item_append_text(item, ", ");
+-
+-	if (value & 0x10)
+-	{
+-		proto_item_append_text(item, "75 Mhz");
+-		comma = 1;
+-	}
+-
+-	if (comma)
+-		proto_item_append_text(item, ", ");
+-
+-	if (value & 0x20)
+-	{
+-		proto_item_append_text(item, "100 Mhz");
+-		comma = 1;
+-	}
+-
+-	proto_item_append_text(item, ")");
+-	*/
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 2, value, "?? (%d)", value);
+-	return 0;
+-
+-}
+-
+-int sfn_sf_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value)
+-{
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 2, value, "%d/%d (%d)", value >> 3, value & 0x0007, value);
+-	return 0;
+-}
+-
+-
+-int dissect_duplex_mode_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_duplex_mode, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int power_offset_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value)
+-{
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 2, value, "%.2f dB (%d)", (((float)value * 0.001) - 6.0), value);
+-	return 0;
+-}
+-
+-int dissect_pcfich_power_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 value = proto_tree_add_uint16_with_conversion(tree, hf_nfapi_pcfich_power_offset, tvb, offset, power_offset_conversion);
+-
+-	if (value > 10000)
+-	{
+-		expert_add_info(pinfo, tree, &ei_power_invalid);
+-	}
+-
+-	return 0;
+-}
+-
+-int dissect_pb_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 value = proto_tree_add_uint16(tree, hf_nfapi_pb, tvb, offset, 0);
+-
+-	if (value > 3)
+-	{
+-		expert_add_info(pinfo, tree, &ei_power_invalid);
+-	}
+-	return 0;
+-}
+-
+-int dissect_dl_cyclic_prefix_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_dl_cyclic_prefix_type, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_cyclic_prefix_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_ul_cyclic_prefix_type, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_dl_channel_bandwidth_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_downlink_channel_bandwidth, tvb, offset, bandwidth_conversion);
+-	return 0;
+-}
+-int dissect_ul_channel_bandwidth_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_uplink_channel_bandwidth, tvb, offset, bandwidth_conversion);
+-	return 0;
+-}
+-
+-
+-int reference_signal_power_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value)
+-{
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 2, value, "%.2f dB (%d)", (((float)value * 0.25) - 63.75), value);
+-	return 0;
+-}
+-
+-int dissect_reference_signal_power_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_reference_signal_power, tvb, offset, reference_signal_power_conversion);
+-	return 0;
+-}
+-int dissect_tx_antenna_ports_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_tx_antenna_ports, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_rx_antenna_ports_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_rx_antenna_ports, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_phich_resource_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_phich_resource, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_phich_duration_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_phich_duration, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_phich_power_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_phich_power_offset, tvb, offset, power_offset_conversion);
+-	return 0;
+-}
+-int dissect_psch_synch_signal_epre_eprers_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_primary_synchronization_signal_epre_eprers, tvb, offset, power_offset_conversion);
+-	return 0;
+-}
+-int dissect_physical_cell_id_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_physical_cell_id, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ssch_synch_signal_epre_eprers_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_secondary_synchronization_signal_epre_eprers, tvb, offset, power_offset_conversion);
+-	return 0;
+-}
+-int dissect_prach_configuration_index_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_configuration_index, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_prach_root_sequence_index_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_root_sequence_index, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_prach_zero_correlation_zone_configuration_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_zero_correlation_zone_configuration, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_prach_high_speed_flag_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_high_speed_flag, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_prach_frequency_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_frequency_offset, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_pusch_hopping_mode_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_hopping_mode, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_pusch_hopping_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_hopping_offset, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_pusch_number_of_subbands_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_number_of_subbands, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_pucch_delta_pucch_shift_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_delta_pucch_shift, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_pucch_n_cqi_rb_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_n_cqi_rb, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_pucch_n_an_cs_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_n_an_cs, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_pucch_n1_pucch_an_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_n1_pucch_an, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_srs_bandwidth_configuration_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_bandwidth_configuration, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_srs_max_uppts_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_max_up_pts, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_srs_subframe_configuration_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_srs_subframe_configuration, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_srs_acknack_srs_sim_tx_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_srs_acknack_srs_simultaneous_transmission, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_uplink_rs_hopping_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_uplink_rs_hopping, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_group_assignment_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_group_assignment, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_cyclic_shift_1_for_drms_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_cyclic_shift_1_for_drms, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_tdd_subframe_assignement_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_subframe_assignment, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_tdd_subframe_patterns_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_special_subframe_patterns, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int laa_threshold_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value)
+-{
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 2, value, "%.2f dB (%d)", (float)(value * -100.00), value);
+-	return 0;
+-}
+-
+-int dissect_laa_ed_threashold_for_lbt_for_pdsch_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_ed_threshold_for_lbt_for_pdsch, tvb, offset, laa_threshold_conversion);
+-	return 0;
+-}
+-int dissect_laa_ed_threashold_for_lbt_for_drs_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_ed_threshold_for_lbt_for_drs, tvb, offset, laa_threshold_conversion);
+-	return 0;
+-}
+-int dissect_laa_pd_threshold_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_pd_threshold, tvb, offset, laa_threshold_conversion);
+-	return 0;
+-}
+-int dissect_laa_multi_carrier_type_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_multi_carrier_type, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_laa_multi_carrier_tx_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_multi_carrier_tx, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_laa_multi_carrier_freeze_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_multi_carrier_freeze, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_laa_tx_antenna_port_for_drs_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_tx_antenna_ports_for_drs, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_laa_transmission_power_for_drs_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power_for_drs, tvb, offset, power_offset_conversion);
+-	return 0;
+-}
+-
+-int dissect_emtc_pbch_repeitions_enabled_r13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pbch_repetitions_enabled_r13, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_cat_m_root_sequence_index_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_cat_m_root_sequence_index, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_cat_m_zero_correlation_zone_configuration_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_cat_m_zero_correlation_zone_configuration, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_cat_m_high_speed_flag_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_cat_m_high_speed_flag, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_emtc_prach_ce_level_0_enabled_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_0_enable, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_ce_level_0_configuration_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_0_configuration_index, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_ce_level_0_frequency_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_0_frequency_offset, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_0_num_of_repeitions_per_attempt_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_0_number_of_repetitions_per_attempt, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_ce_level_0_starting_subframe_periodicity_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_0_starting_subframe_periodicity, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_0_hopping_enabled_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_0_hopping_enabled, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_0_hopping_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_0_hopping_offset, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_emtc_prach_ce_level_1_enabled_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_1_enable, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_ce_level_1_configuration_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_1_configuration_index, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_ce_level_1_frequency_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_1_frequency_offset, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_1_num_of_repeitions_per_attempt_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_1_number_of_repetitions_per_attempt, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_ce_level_1_starting_subframe_periodicity_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_1_starting_subframe_periodicity, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_1_hopping_enabled_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_1_hopping_enabled, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_1_hopping_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_1_hopping_offset, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_emtc_prach_ce_level_2_enabled_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_2_enable, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_ce_level_2_configuration_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_2_configuration_index, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_ce_level_2_frequency_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_2_frequency_offset, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_2_num_of_repeitions_per_attempt_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_2_number_of_repetitions_per_attempt, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_ce_level_2_starting_subframe_periodicity_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_2_starting_subframe_periodicity, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_2_hopping_enabled_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_2_hopping_enabled, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_2_hopping_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_2_hopping_offset, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_emtc_prach_ce_level_3_enabled_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_3_enable, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_ce_level_3_configuration_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_3_configuration_index, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_prach_ce_level_3_frequency_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_3_frequency_offset, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_3_num_of_repeitions_per_attempt_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_3_number_of_repetitions_per_attempt, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_ce_level_3_starting_subframe_periodicity_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_3_starting_subframe_periodicity, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_3_hopping_enabled_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_3_hopping_enabled, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_preach_ce_level_3_hopping_offset_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_prach_ce_level_3_hopping_offset, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_emtc_pucch_interval_ul_hopping_config_common_mode_a_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pucch_internal_ul_hopping_config_common_mode_a, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_emtc_pucch_interval_ul_hopping_config_common_mode_b_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pucch_internal_ul_hopping_config_common_mode_b, tvb, offset, 0);
+-	return 0;
+-}
+-
+-
+-int dissect_dl_bandwidth_support_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_dl_bandwidth_support, tvb, offset, bandwidth_conversion);
+-	return 0;
+-}
+-
+-int dissect_ul_bandwidth_support_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_ul_bandwidth_support, tvb, offset, bandwidth_conversion);
+-	return 0;
+-}
+-
+-int dl_modulation_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value)
+-{
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 2, value, "?? (%d)", value);
+-	return 0;
+-}
+-
+-int dissect_dl_modulation_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_dl_modulation_support, tvb, offset, dl_modulation_conversion);
+-	return 0;
+-}
+-
+-int ul_modulation_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value)
+-{
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 2, value, "?? (%d)", value);
+-	return 0;
+-}
+-int dissect_ul_modulation_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_ul_modulation_support, tvb, offset, ul_modulation_conversion);
+-	return 0;
+-}
+-int dissect_phy_antenna_capability_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_phy_antenna_capability, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int release_capability_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint16 value)
+-{
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 2, value, "?? (%d)", value);
+-	return 0;
+-}
+-int dissect_release_capability_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_release_capability, tvb, offset, release_capability_conversion);
+-	return 0;
+-}
+-int dissect_mbsfn_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_mbsfn_capability, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_laa_support_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_laa_capability, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_laa_pd_sensing_lbt_support_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pd_sensing_lbt_support, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_laa_multi_carrier_lbt_support_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_multi_carrier_lbt_support, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_laa_partial_sf_support_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_partial_sf_support, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_data_report_mode_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_data_report_mode, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_sfn_sf_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_sfnsf, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_phy_state_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_phy_state, tvb, offset, 0);
+-	return 0;
+-}
+-
+-
+-
+-int dissect_p7_vnf_address_ipv4_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8_array(tree, hf_nfapi_vnf_address_ipv4, 4, tvb, offset);
+-	return 0;
+-}
+-int dissect_p7_vnf_address_ipv6_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8_array(tree, hf_nfapi_vnf_address_ipv4, 16, tvb, offset);
+-	return 0;
+-}
+-int dissect_p7_vnf_port_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_vnf_port, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_p7_pnf_address_ipv4_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8_array(tree, hf_nfapi_pnf_address_ipv4, 4, tvb, offset);
+-	return 0;
+-}
+-int dissect_p7_pnf_address_ipv6_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8_array(tree, hf_nfapi_pnf_address_ipv4, 16, tvb, offset);
+-	return 0;
+-}
+-int dissect_p7_pnf_port_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pnf_port, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_downlink_ues_per_subframe_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_dl_ue_per_sf, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_uplink_ues_per_subframe_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_ue_per_sf, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_rf_band_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_band, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_rf_bands_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 count = proto_tree_add_uint16(tree, hf_nfapi_number_of_rf_bands, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "RF Band List", hf_nfapi_rf_bands, ett_nfapi_rf_bands, count, dissect_rf_band_value);
+-	return 0;
+-}
+-
+-int dissect_timing_window_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_timing_window, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_timing_info_mode_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_timing_info_mode, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_timing_info_period_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_timing_info_period, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_maximum_transmit_power_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_maximum_transmit_power, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_earfcn_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_earfcn, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_nmm_gsm_frequency_bands_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 count = proto_tree_add_uint16(tree, hf_nfapi_number_of_rf_bands, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "RF Band List", hf_nfapi_rf_bands, ett_nfapi_rf_bands, count, dissect_rf_band_value);
+-	return 0;
+-}
+-int dissect_nmm_umts_frequency_bands_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 count = proto_tree_add_uint16(tree, hf_nfapi_number_of_rf_bands, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "RF Band List", hf_nfapi_rf_bands, ett_nfapi_rf_bands, count, dissect_rf_band_value);
+-	return 0;
+-}
+-int dissect_nmm_lte_frequency_bands_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 count = proto_tree_add_uint16(tree, hf_nfapi_number_of_rf_bands, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "RF Band List", hf_nfapi_rf_bands, ett_nfapi_rf_bands, count, dissect_rf_band_value);
+-	return 0;
+-}
+-int dissect_nmm_uplink_rssi_supported_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_nmm_uplink_rssi_supported, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_dl_config_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_dl_config_pdu_type, tvb, offset, 0);
+-	guint8 size = proto_tree_add_uint8(tree, hf_nfapi_pdu_size, tvb, offset, 0);
+-
+-	guint pdu_end = (*offset + size - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-
+-	return 0;
+-}
+-
+-
+-static int dissect_dl_config_request_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_number_pdcch_ofdm_symbols, tvb, offset, 0);
+-	guint16 num_pdu = proto_tree_add_uint8(tree, hf_nfapi_number_dci, tvb, offset, 0);
+-	num_pdu += proto_tree_add_uint16(tree, hf_nfapi_number_pdus, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_pdsch_rnti, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power_pcfich, tvb, offset, power_offset_conversion);
+-
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "DL Config PDU List", hf_nfapi_dl_config_request_pdu_list, ett_nfapi_dl_config_request_pdu_list, num_pdu, dissect_dl_config_pdu);
+-
+-
+-	return 0;
+-}
+-
+-static int dissect_dl_config_request_bch_pdu_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_length, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pdu_index, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	return 0;
+-}
+-
+-static int dissect_dl_config_request_dl_dci_pdu_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_dci_format, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cce_idx, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_aggregation_level, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_allocation_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_virtual_resource_block_assignment_flag, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_resource_block_coding, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mcs_1, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_redundancy_version_1, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_new_data_indicator_1, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transport_block_to_codeword_swap_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mcs_2, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_redundancy_version_2, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_new_data_indicator_2, tvb, offset, 0);
+-	proto_tree_add_uint8_with_range(tree, hf_nfapi_harq_process, tvb, offset, pinfo, 0, 15, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_tpmi, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_precoding_information, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_tpc, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_downlink_assignment_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ngap, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transport_block_size_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_downlink_power_offset, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_allocate_prach_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_preamble_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_prach_mask_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_rnti_type, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	return 0;
+-}
+-static int dissect_dl_config_request_dl_dci_pdu_rel9_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_mcch_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mcch_change_notification, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_scrambling_identity, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_dl_config_request_dl_dci_pdu_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_cross_carrier_scheduling_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_carrier_indicator, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_size_of_cqi_csi_feild, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_request, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_antenna_ports_scrambling_and_layers, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_total_dci_length_including_padding, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_n_dl_rb, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_dl_config_request_dl_dci_pdu_rel11_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_ack_resource_offset, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pdsch_re_mapping_and_quasi_co_location_indicator, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_ul_dl_configuration_index_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_dl_configuration_index, tvb, offset, 0);
+-	return 0;
+-}
+-
+-
+-static int dissect_dl_config_request_dl_dci_pdu_rel12_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_primary_cell_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_dl_configuration_flag, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_ul_dl_configurations, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "UL/DL Configurations", hf_nfapi_pnf_phy, ett_nfapi_pnf_phy, count, dissect_ul_dl_configuration_index_value);
+-
+-	return 0;
+-}
+-static int dissect_dl_config_request_dl_dci_pdu_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_laa_end_partial_sf_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_laa_end_partial_sf_configuration, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_initial_lbt_sf, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_codebooksize_determination_r13, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_rel13_drms_table_flag, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_dl_config_request_mch_pdu_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_length, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pdu_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_allocation_type, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_resource_block_coding, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_modulation, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	proto_tree_add_uint16(tree, hf_nfapi_mbsfn_area_id, tvb, offset, 0);
+-
+-	return 0;
+-}
+-
+-int dissect_codebook_index_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_codebook_index, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_bf_vector_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_bf_vector_bf_value, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_bf_vector_type_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_bf_vector_subband_index, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_bf_vector_num_antennas, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "Antennas", hf_nfapi_bf_vector_antennas, ett_nfapi_bf_vector_antennas, count, dissect_bf_vector_value);
+-	return 0;
+-}
+-
+-static int dissect_dl_config_request_dlsch_pdu_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_length, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pdu_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);		
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_allocation_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_virtual_resource_block_assignment_flag, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_resource_block_coding, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_modulation, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_redundancy_version, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transport_blocks, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transport_block_to_codeword_swap_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transmission_scheme, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_layers, tvb, offset, 0);
+-	guint8 num_subbands = proto_tree_add_uint8(tree, hf_nfapi_number_of_subbands, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "Subbands", hf_nfapi_subbands, ett_nfapi_subbands, num_subbands, dissect_codebook_index_value);
+-	proto_tree_add_uint8(tree, hf_nfapi_ue_category_capacity, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pa, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_delta_power_offset_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ngap, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_nprb, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transmission_mode, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_num_bf_prb_per_subband, tvb, offset, 0);
+-	guint8 num_vectors = proto_tree_add_uint8(tree, hf_nfapi_num_bf_vector, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "Beamforming Vectors", hf_nfapi_bf_vectors, ett_nfapi_bf_vectors, num_vectors, dissect_bf_vector_type_value);
+-
+-	
+-	return 0;
+-}
+-
+-int dissect_csi_rs_resource_config_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_rs_resource_config, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_dl_config_request_dlsch_pdu_rel9_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_nscid, tvb, offset, 0);
+-
+-	return 0;
+-}
+-static int dissect_dl_config_request_dlsch_pdu_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_rs_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_rs_resource_config_r10, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_csi_rs_zero_tx_power_resource_config_bitmap_r10, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_csi_rs_number_if_nzp_configurations, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "CSI-RS Resource Configs", hf_nfapi_csi_rs_resource_configs, ett_nfapi_csi_rs_resource_configs, count, dissect_csi_rs_resource_config_value);
+-	proto_tree_add_uint8(tree, hf_nfapi_pdsch_start, tvb, offset, 0);
+-
+-	return 0;
+-}
+-static int dissect_dl_config_request_dlsch_pdu_rel11_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_drms_config_flag, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_drms_scrambling, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_config_flag, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_csi_scrambling, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pdsch_re_mapping_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pdsch_re_mapping_antenna_ports, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pdsch_re_mapping_freq_shift, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_dl_config_request_dlsch_pdu_rel12_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_alt_cqi_table_r12, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_max_layers, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_n_dl_harq, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_dl_config_request_dlsch_pdu_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_dwpts_symbols, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_initial_lbt_sf, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ue_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pdsch_payload_type, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_initial_transmission_sf, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_req13_drms_table_flag, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_dl_config_request_pch_pdu_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_length, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pdu_index, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_prnti, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_allocation_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_virtual_resource_block_assignment_flag, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_resource_block_coding, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mcs, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_redundancy_version, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_transport_blocks, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transport_block_to_codeword_swap_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transmission_scheme, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_layers, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_codebook_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ue_category_capacity, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pa, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	proto_tree_add_uint8(tree, hf_nfapi_nprb, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ngap, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_dl_config_request_pch_pdu_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_ue_mode, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_initial_transmission_sf, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_dl_config_request_prs_pdu_rel9_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	proto_tree_add_uint8(tree, hf_prs_bandwidth, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_prs_cyclic_prefix_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_prs_muting, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_dl_config_request_csi_rs_pdu_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_rs_antenna_port_count_r10, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_rs_resource_config_r10, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	proto_tree_add_uint16(tree, hf_nfapi_csi_rs_zero_tx_power_resource_config_bitmap_r10, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_csi_rs_number_if_nzp_configurations, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "CSI-RS Resource Configs", hf_nfapi_csi_rs_resource_configs, ett_nfapi_csi_rs_resource_configs, count, dissect_csi_rs_resource_config_value);
+-	return 0;
+-}
+-
+-
+-int dissect_csi_rs_bf_vector_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_rs_resource_index, tvb, offset, 0);
+-	//proto_tree_add_uint8(tree, hf_nfapi_csi_rs_resource_config, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_dl_config_request_csi_rs_pdu_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_rs_class, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cdm_type, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_num_bf_vector, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "Beamforming Vector", hf_nfapi_csi_rs_bf_vector, ett_nfapi_csi_rs_bf_vector, count, dissect_csi_rs_bf_vector_value);
+-	return 0;
+-}
+-
+-int dissect_epdcch_prb_index_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_edpcch_prb_index, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_dl_config_request_edpcch_params_rel11_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_epdcch_resource_assignment_flag, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_epdcch_id, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_epdcch_start_symbol, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_epdcch_num_prb, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PRBs", hf_nfapi_epdcch_prbs, ett_nfapi_epdcch_prbs, count, dissect_epdcch_prb_index_value);
+-	dissect_bf_vector_type_value(tvb, pinfo, tree, data, offset, end);
+-
+-	return 0;
+-}
+-static int dissect_dl_config_request_edpcch_params_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_dwpts_symbols, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_initial_lbt_sf, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_precoding_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_precoding_value, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_dl_config_request_mpdpcch_pdu_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_mpdcch_narrowband, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_prb_pairs, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_block_assignment, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_start_symbol, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ecce_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_aggregation_level, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_rnti_type, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ce_mode, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_drms_scrabmling_init, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_initial_transmission_sf, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_transmission_power, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_dci_format, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_resource_block_coding	, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mcs, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pdsch_reception_levels , tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_redundancy_version, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_new_data_indicator, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_process, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_tpmi_length, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_tpmi, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pmi_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_resource_offset, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_dci_subframe_repetition_number, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_tpc, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_downlink_assignment_index_length, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_downlink_assignment_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_allocate_prach_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_preamble_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_prach_mask_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_starting_ce_level, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_request, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_antenna_ports_and_scrambling_identity_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_antenna_ports_and_scrambling_identity, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_hopping_enabled_flag , tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_paging_direct_indication_differentiation_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_direct_indication, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_total_dci_length_including_padding, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_tx_antenna_ports, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "Precoding", hf_nfapi_precoding, ett_nfapi_precoding, count, dissect_precoding_value);
+-	
+-	return 0;
+-}
+-
+-int dissect_ul_config_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_config_pdu_type, tvb, offset, 0);
+-	guint8 size = proto_tree_add_uint8(tree, hf_nfapi_pdu_size, tvb, offset, 0);
+-
+-	guint pdu_end = (*offset + size - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-
+-	return 0;
+-}
+-
+-static int  dissect_ul_config_request_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint8 num_pdu = proto_tree_add_uint8(tree, hf_nfapi_number_pdus, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_rach_prach_frequency_resources, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_present, tvb, offset, 0);
+-
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "UL Config PDU List", hf_nfapi_ul_config_request_pdu_list, ett_nfapi_ul_config_request_pdu_list, num_pdu, dissect_ul_config_pdu);
+-
+-	return 0;
+-}
+-
+-
+-int dissect_ul_config_ulsch_pdu_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_handle, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_size, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_block_start, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_resource_blocks, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_modulation, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cyclic_shift_2_for_drms, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_hopping_enabled_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_hopping_bits, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_new_data_indication, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_redundancy_version, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_process_number, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_tx_mode, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_current_tx_nb, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_n_srs, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_ulsch_pdu_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_allocation_type, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_resource_block_coding, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transport_blocks, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_transmission_scheme, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_layers, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_codebook_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_disable_sequence_hopping_flag, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_ulsch_pdu_rel11_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_virtual_cell_id_enabled_flag, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_npusch_identity, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_drms_config_flag, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_ndrms_csh_identity, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_ulsch_pdu_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_ue_type, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_total_number_of_repetitions, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_repetition_number, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_initial_sf_io, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_empty_symbols_due_to_retunning, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_init_tx_params_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_n_srs_initial, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_initial_number_of_resource_blocks, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_cqi_ri_info_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_dl_cqi_pmi_size_rank_1, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_dl_cqi_pmi_size_rank_greater_1, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ri_size, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_delta_offset_cqi, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_delta_offset_ri, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_cqi_ri_info_rel9_later_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint8 type = proto_tree_add_uint8(tree, hf_nfapi_report_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_delta_offset_cqi, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_delta_offset_ri, tvb, offset, 0);
+-
+-	switch (type)
+-	{
+-		case 0:
+-		{
+-			proto_tree_add_uint8(tree, hf_nfapi_dl_cqi_ri_pmi_size, tvb, offset, 0);
+-			proto_tree_add_uint8(tree, hf_nfapi_control_type, tvb, offset, 0);
+-			break;
+-		}
+-		case 1:
+-		{
+-			/*guint8 num_cc = */proto_tree_add_uint8(tree, hf_nfapi_number_of_cc, tvb, offset, 0);
+-
+-			// todo ...
+-
+-			break;
+-		}
+-	}
+-	return 0;
+-}
+-int dissect_ul_config_cqi_ri_info_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_dl_cqi_ri_pmi_size_2, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_harq_info_ulsch_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_size, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_delta_offset_harq, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ack_nack_mode, tvb, offset, 0);
+-
+-	return 0;
+-}
+-int dissect_ul_config_harq_info_ulsch_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_harq_size_2, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_delta_offset_harq_2, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_ue_info_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_handle, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_ue_info_rel11_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_virtual_cell_id_enabled_flag, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_npucch_identity, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_ue_info_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_ue_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_empty_symbols, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_total_number_of_repetitions, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_repetition_number, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_cqi_info_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pucch_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_dl_cqi_pmi_size, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_cqi_info_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_pucch_resource, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pucch_index_p1, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_cqi_info_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_mode, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_dl_cqi_pmi_size_2, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_statring_prb, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_nprb, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cdm_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_nsrs, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_sr_info_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_pucch_index, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_sr_info_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_pucch_resource, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pucch_index_p1, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_harq_info_uci_rel10_tdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_size, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ack_nack_mode, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_pucch_resource, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_0, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_1, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_2, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_3, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_harq_info_uci_rel8_fdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_0, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_size, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_harq_info_uci_rel9_later_fdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_size, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ack_nack_mode, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_pucch_resource, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_0, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_1, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_2, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_1_3, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_harq_info_uci_rel11_fdd_tdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_num_ant_ports, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_2_0, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_2_1, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_2_2, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_n_pucch_2_3, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_harq_info_uci_rel13_fdd_tdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_harq_size_2, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_starting_prb, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_nprb, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cdm_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_nsrs, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_srs_info_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_handle, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_size, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_bandwidth, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_domain_position, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_hopping_bandwidth, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_transmission_comb, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_i_srs, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_sounding_reference_cyclic_shift, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_srs_info_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_antenna_port, tvb, offset, 0);
+-	return 0;
+-}
+-int dissect_ul_config_srs_info_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_combs, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_hi_dci0_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_pdu_type, tvb, offset, 0);
+-	guint8 size = proto_tree_add_uint8(tree, hf_nfapi_pdu_size, tvb, offset, 0);
+-
+-	guint pdu_end = (*offset + size - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-
+-	return 0;
+-}
+-
+-static int dissect_hi_dci0_request_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_sfn_sf, tvb, offset, 0);
+-	guint8 num_pdu = proto_tree_add_uint8(tree, hf_nfapi_number_of_dci_pdus, tvb, offset, 0);
+-	num_pdu += proto_tree_add_uint8(tree, hf_nfapi_number_of_hi_pdus, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "HI DCI0 PDU List", hf_nfapi_hi_dci0_request_pdu_list, ett_nfapi_hi_dci0_request_pdu_list, num_pdu, dissect_hi_dci0_pdu);
+-	return 0;
+-}
+-
+-static int dissect_hi_dci0_hi_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_block_start, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cyclic_shift_2_for_drms, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_hi_value, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_i_phich, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	return 0;
+-}
+-static int dissect_hi_dci0_hi_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_flag_tb2, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_hi_value_2, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_hi_dci0_dci_ul_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_dci_format, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cce_idx, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_aggregation_level, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_block_start, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_resource_blocks, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mcs_1, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cyclic_shift_2_for_drms, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_hopping_enabled_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_hopping_bits, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_new_data_indication, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ue_tx_antenna_selection, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_tpc, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_cqi_csi_request, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_dl_assignment_index, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_tpc_bitmap, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	return 0;
+-}
+-static int dissect_hi_dci0_dci_ul_rel10_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_cross_carrier_scheduling_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_carrier_indicator, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_size_of_cqi_csi_feild, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_request, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_allocation_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_resource_allocation_type, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_resource_block_coding, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mcs_2, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_new_data_indication_two, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_antenna_ports, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_tpmi, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_total_dci_length_including_padding, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_n_ul_rb, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_hi_dci0_dci_ul_rel12_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_pscch_resource, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_time_resource_pattern, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_hi_dci0_edpcch_dci_ul_rel11_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_epdcch_resource_assignment_flag, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_epdcch_id, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_epdcch_start_symbol, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_epdcch_num_prb, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PRBs", hf_nfapi_epdcch_prbs, ett_nfapi_epdcch_prbs, count, dissect_epdcch_prb_index_value);
+-	dissect_bf_vector_type_value(tvb, pinfo, tree, data, offset, end);
+-	return 0;
+-}
+-
+-static int dissect_hi_dci0_mdpcch_dci_ul_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_mpdcch_narrowband, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_prb_pairs, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_resource_block_assignment, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mpdcch_transmission_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_start_symbol, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ecce_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_aggregation_level, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_rnti_type, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ce_mode, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_drms_scrambling_init, tvb, offset, 0);
+-	proto_tree_add_uint16_with_conversion(tree, hf_nfapi_transmission_power, tvb, offset, power_offset_conversion);
+-	proto_tree_add_uint8(tree, hf_nfapi_dci_format, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_resource_blocks, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_mcs, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_pusch_repetition_levels, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_hopping_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_new_data_indication, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_process, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_redundancy_version, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_tpc, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_csi_request, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_dai_presence_flag, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_dl_assignment_index, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_srs_request, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_dci_subframe_repetition_number, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_tpc_bitmap, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_total_dci_length_include_padding, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_tx_antenna_ports, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "TX Antenna Ports", hf_nfapi_tx_antenna_ports, ett_nfapi_tx_antenna_ports, count, dissect_precoding_value);
+-
+-
+-	return 0;
+-}
+-static int dissect_rx_ue_info_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_handle, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_rx_indication_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_length, tvb, offset, 0);
+-	int data_offset = proto_tree_add_uint16(tree, hf_nfapi_data_offset, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_cqi, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance, tvb, offset, 0);
+-	return data_offset;
+-}
+-static int dissect_rx_indication_rel9_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance_r9, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_harq_indication_data_bundling_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_0, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_1, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_harq_indication_data_multplexing_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_0, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_1, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_2, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_3, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_harq_indication_data_special_bundling_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_0, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_harq_indication_data_channel_selection_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_0, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_harq_indication_data_format_3_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_0, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_harq_indication_data_format_4_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_0, tvb, offset, 0);
+-	return 0;
+-}
+-
+-
+-static int dissect_harq_indication_data_format_5_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_data_value_0, tvb, offset, 0);
+-	return 0;
+-}
+-
+-
+-
+-static int dissect_harq_indication_rel8_tdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint8 mode = proto_tree_add_uint8(tree, hf_nfapi_harq_mode, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_ack_nack, tvb, offset, 0);
+-
+-	switch (mode)
+-	{
+-		case 0:
+-		{
+-			dissect_harq_indication_data_bundling_value(tvb, pinfo, tree, data, offset, end);
+-			break;
+-		}
+-		case 1:
+-		{
+-			dissect_harq_indication_data_multplexing_value(tvb, pinfo, tree, data, offset, end);
+-			break;
+-		}
+-		case 2:
+-		{
+-			dissect_harq_indication_data_special_bundling_value(tvb, pinfo, tree, data, offset, end);
+-			break;
+-		}
+-	};
+-
+-	return 0;
+-}
+-static int dissect_harq_indication_rel9_later_tdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint8 mode = proto_tree_add_uint8(tree, hf_nfapi_harq_mode, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_ack_nack, tvb, offset, 0);
+-
+-	// Have to do this as the mode value is need to decode the value
+-	guint16 i = 0;
+-
+-	proto_item *list_ti = proto_tree_add_string_format(tree, hf_nfapi_harq_ack_nack_data, tvb, *offset, 2, "", "ACK/NACK Data");
+-	proto_tree *list_tree = proto_item_add_subtree(list_ti, ett_nfapi_harq_ack_nack_data);
+-
+-	for (i = 0; i < count; ++i)
+-	{
+-
+-		proto_item *item_ti = proto_tree_add_string_format(list_tree, hf_nfapi_harq_ack_nack_data, tvb, *offset, 2, "", "[%d]", i);
+-		proto_tree *item_tree = proto_item_add_subtree(item_ti, ett_nfapi_harq_ack_nack_data);
+-
+-		switch (mode)
+-		{
+-			case 0:
+-			{
+-				dissect_harq_indication_data_bundling_value(tvb, pinfo, item_tree, data, offset, end);
+-				break;
+-			}
+-			case 1:
+-			{
+-				dissect_harq_indication_data_multplexing_value(tvb, pinfo, item_tree, data, offset, end);
+-				break;
+-			}
+-			case 2:
+-			{
+-				dissect_harq_indication_data_special_bundling_value(tvb, pinfo, item_tree, data, offset, end);
+-				break;
+-			}
+-			case 3:
+-			{
+-				dissect_harq_indication_data_channel_selection_value(tvb, pinfo, item_tree, data, offset, end);
+-				break;
+-			}
+-			case 4:
+-			{
+-				dissect_harq_indication_data_format_3_value(tvb, pinfo, item_tree, data, offset, end);
+-				break;
+-			}
+-		};
+-	}
+-
+-	return 0;
+-}
+-static int dissect_harq_indication_rel13_later_tdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint8 mode = proto_tree_add_uint8(tree, hf_nfapi_harq_mode, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_ack_nack, tvb, offset, 0);
+-
+-	// Have to do this as the mode value is need to decode the value
+-	guint16 i = 0;
+-
+-	proto_item *list_ti = proto_tree_add_string_format(tree, hf_nfapi_harq_ack_nack_data, tvb, *offset, 2, "", "ACK/NACK Data");
+-	proto_tree *list_tree = proto_item_add_subtree(list_ti, ett_nfapi_harq_ack_nack_data);
+-
+-	for (i = 0; i < count; ++i)
+-	{
+-		proto_item *item_ti = proto_tree_add_string_format(list_tree, hf_nfapi_harq_ack_nack_data, tvb, *offset, 2, "", "[%d]", i);
+-		proto_tree *item_tree = proto_item_add_subtree(item_ti, ett_nfapi_harq_ack_nack_data);
+-
+-		switch (mode)
+-		{
+-		case 0:
+-		{
+-			dissect_harq_indication_data_bundling_value(tvb, pinfo, item_tree, data, offset, end);
+-			break;
+-		}
+-		case 1:
+-		{
+-			dissect_harq_indication_data_multplexing_value(tvb, pinfo, item_tree, data, offset, end);
+-			break;
+-		}
+-		case 2:
+-		{
+-			dissect_harq_indication_data_special_bundling_value(tvb, pinfo, item_tree, data, offset, end);
+-			break;
+-		}
+-		case 3:
+-		{
+-			dissect_harq_indication_data_channel_selection_value(tvb, pinfo, item_tree, data, offset, end);
+-			break;
+-		}
+-		case 4:
+-		{
+-			dissect_harq_indication_data_format_3_value(tvb, pinfo, item_tree, data, offset, end);
+-			break;
+-		}
+-		case 5:
+-		{
+-			dissect_harq_indication_data_format_4_value(tvb, pinfo, item_tree, data, offset, end);
+-			break;
+-		}
+-		case 6:
+-		{
+-			dissect_harq_indication_data_format_5_value(tvb, pinfo, item_tree, data, offset, end);
+-			break;
+-		}
+-		};
+-	}
+-
+-	return 0;
+-}
+-static int dissect_harq_indication_rel8_fdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_tb_1, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_tb_2, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_harq_tb_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_harq_tb_n, tvb, offset, 0);
+-	return 0;
+-}
+-
+-
+-static int dissect_harq_indication_rel9_later_fdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_mode, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_ack_nack, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "HARQ TB List", hf_nfapi_harq_data, ett_nfapi_harq_data, count, dissect_harq_tb_value);
+-	return 0;
+-}
+-static int dissect_harq_indication_rel13_later_fdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_harq_mode, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_ack_nack, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "HARQ TB List", hf_nfapi_harq_data, ett_nfapi_harq_data, count, dissect_harq_tb_value);
+-	return 0;
+-}
+-static int dissect_ul_cqi_information_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_cqi, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_channel, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_crc_indication_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_crc_flag, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_rx_cqi_indication_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_length, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_data_offset, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_cqi, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ri, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_ri_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_ri, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_rx_cqi_indication_rel9_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_length, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_data_offset, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_ul_cqi, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_cc_reported, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "CC List", hf_nfapi_cc, ett_nfapi_cc, count, dissect_ri_value);
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance_r9, tvb, offset, 0);
+-
+-	return 0;
+-}
+-static int dissect_rach_indication_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_rnti, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_preamble, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_rach_indication_rel9_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance_r9, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_rach_indication_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_rach_resource_type, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_snr_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_snr, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_srs_indication_rel8_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_doppler_estimation, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance, tvb, offset, 0);
+-	guint8 count = proto_tree_add_uint8(tree, hf_nfapi_number_of_resource_blocks, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_rb_start, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "RB List", hf_nfapi_rbs, ett_nfapi_rbs, count, dissect_snr_value);
+-
+-
+-	return 0;
+-}
+-static int dissect_srs_indication_rel9_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_timing_advance_r9, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_srs_indication_rel10_tdd_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_up_pts_symbol, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_tdd_channel_measuerment_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_number_prb_per_subband, tvb, offset, 0);
+-	guint8 num_subbands = proto_tree_add_uint8(tree, hf_nfapi_number_of_subbands, tvb, offset, 0);
+-	guint8 num_phy_ant = proto_tree_add_uint8(tree, hf_nfapi_number_antennas, tvb, offset, 0);
+-
+-	guint16 i = 0;
+-	guint16 j = 0;
+-
+-	proto_item *sb_list_ti = proto_tree_add_string_format(tree, hf_nfapi_subbands, tvb, *offset, 2, "", "Subbands");
+-	proto_tree *sb_list_tree = proto_item_add_subtree(sb_list_ti, ett_nfapi_subbands);
+-
+-	for (i = 0; i < num_subbands; ++i)
+-	{
+-		proto_item *sb_item_ti = proto_tree_add_string_format(sb_list_tree, hf_nfapi_subbands, tvb, *offset, 2, "", "[%d]", i);
+-		proto_tree *sb_item_tree = proto_item_add_subtree(sb_item_ti, ett_nfapi_subbands);
+-
+-		proto_tree_add_uint8(sb_item_ti, hf_nfapi_subband_index, tvb, offset, 0);
+-
+-
+-		proto_item *ant_list_ti = proto_tree_add_string_format(sb_item_tree, hf_nfapi_antennas, tvb, *offset, 2, "", "Physical Antennas");
+-		proto_tree *ant_list_tree = proto_item_add_subtree(ant_list_ti, ett_nfapi_antennas);
+-
+-		for (j = 0; j < num_phy_ant; ++j)
+-		{
+-			proto_item *ant_item_ti = proto_tree_add_string_format(ant_list_tree, hf_nfapi_antennas, tvb, *offset, 2, "", "[%d]", j);
+-			proto_tree *ant_item_tree = proto_item_add_subtree(ant_item_ti, ett_nfapi_antennas);
+-
+-			proto_tree_add_uint16(ant_item_tree, hf_nfapi_channel_coefficient, tvb, offset, 0);
+-		}
+-	}
+-
+-	return 0;
+-}
+-
+-static int dissect_srs_indication_rel11_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_ul_rtoa, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_lbt_dl_config_request_pdsch_req_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_handle, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_mp_cca, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_n_cca, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_offset, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_lte_txop_sf, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_txop_sfn_sf_end, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_lbt_mode, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_lbt_dl_config_request_drs_req_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_handle, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_offset, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_sfn_sf_end, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_lbt_mode, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_lbt_dl_config_request_pdsch_resp_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_handle, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_result, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_txop_symbols, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_initial_partial_sf, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_lbt_dl_config_request_drs_resp_rel13_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_handle, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_result, tvb, offset, 0);
+-	return 0;
+-}
+-
+-int dissect_tx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 len = proto_tree_add_uint16(tree, hf_nfapi_pdu_length, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pdu_index, tvb, offset, 0);
+-
+-	proto_tree_add_uint8_array(tree, hf_nfapi_pdu, len, tvb, offset);
+-
+-	return 0;
+-}
+-
+-static int dissect_tx_request_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_pdu = proto_tree_add_uint16(tree, hf_nfapi_number_pdus, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "TX PDU List", hf_nfapi_tx_request_pdu_list, ett_nfapi_tx_request_pdu_list, num_pdu, dissect_tx_pdu);
+-	return 0;
+-
+-}
+-
+-int dissect_rx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	//guint end = (*offset + size - 2);
+-	//dissect_tlv_list(tvb, pinfo, tree, data, offset, end);
+-	return 0;
+-}
+-
+-
+-
+-int dissect_harq_indication_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 pdu_len = proto_tree_add_uint16(tree, hf_nfapi_instance_length, tvb, offset, 0);
+-	guint pdu_end = (*offset + pdu_len - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-	return 0;
+-}
+-
+-static int dissect_harq_indication_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_pdu = proto_tree_add_uint16(tree, hf_nfapi_number_of_harqs, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "HARQ PDU List", hf_nfapi_harq_indication_pdu_list, ett_nfapi_harq_indication_pdu_list, num_pdu, dissect_harq_indication_pdu);
+-	return 0;
+-}
+-
+-int dissect_crc_indication_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 pdu_len = proto_tree_add_uint16(tree, hf_nfapi_instance_length, tvb, offset, 0);
+-	guint pdu_end = (*offset + pdu_len - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-	return 0;
+-}
+-
+-
+-static int dissect_crc_indication_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_pdu = proto_tree_add_uint16(tree, hf_nfapi_number_of_crcs, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "CRC PDU List", hf_nfapi_crc_indication_pdu_list, ett_nfapi_crc_indication_pdu_list, num_pdu, dissect_crc_indication_pdu);
+-	return 0;
+-}
+-int dissect_sr_indication_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 pdu_len = proto_tree_add_uint16(tree, hf_nfapi_instance_length, tvb, offset, 0);
+-	guint pdu_end = (*offset + pdu_len - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-	return 0;
+-}
+-
+-static int dissect_rx_sr_indication_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_pdu = proto_tree_add_uint16(tree, hf_nfapi_number_of_srs, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "SR PDU List", hf_nfapi_sr_indication_pdu_list, ett_nfapi_sr_indication_pdu_list, num_pdu, dissect_sr_indication_pdu);
+-	return 0;
+-}
+-int dissect_cqi_indication_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 pdu_len = proto_tree_add_uint16(tree, hf_nfapi_instance_length, tvb, offset, 0);
+-	guint pdu_end = (*offset + pdu_len - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-	return 0;
+-}
+-static int dissect_rx_cqi_indication_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_pdu = proto_tree_add_uint16(tree, hf_nfapi_number_of_cqi, tvb, offset, 0);
+-
+-	guint16* lengths = malloc(num_pdu * 2);
+-	memset(lengths, 0, num_pdu * 2);
+-
+-	guint8 tmp_offset = *offset;
+-
+-	int i = 0;
+-	for (i = 0; i < num_pdu; ++i)
+-	{
+-		guint16 instance_len = tvb_get_guint16(tvb, tmp_offset, ENC_NA);
+-		tmp_offset += 2;
+-		guint8 pdu_end = tmp_offset + instance_len;
+-
+-		while (tmp_offset < pdu_end)
+-		{
+-			guint16 tlv_id = tvb_get_guint16(tvb, tmp_offset, ENC_NA);
+-			tmp_offset += 2;
+-			guint16 tlv_len = tvb_get_guint16(tvb, tmp_offset, ENC_NA);
+-			tmp_offset += 2;
+-
+-			if (tlv_id == 0x202F)
+-			{
+-				lengths[i] = tvb_get_guint16(tvb, tmp_offset, ENC_NA);
+-			}
+-			else if (tlv_id == 0x2030)
+-			{
+-				lengths[i] = tvb_get_guint16(tvb, tmp_offset, ENC_NA);
+-			}
+-
+-			tmp_offset += tlv_len;
+-		}
+-
+-	}
+-
+-
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "CQI PDU List", hf_nfapi_cqi_indication_pdu_list, ett_nfapi_cqi_indication_pdu_list, num_pdu, dissect_cqi_indication_pdu);
+-
+-
+-	for (i = 0; i < num_pdu; ++i)
+-	{
+-		proto_tree_add_uint8_array(tree, hf_nfapi_pdu, lengths[i], tvb, offset);
+-	}
+-
+-	free(lengths);
+-
+-	return 0;
+-}
+-int dissect_preamble_indication_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 pdu_len = proto_tree_add_uint16(tree, hf_nfapi_instance_length, tvb, offset, 0);
+-	guint pdu_end = (*offset + pdu_len - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-	return 0;
+-}
+-static int dissect_rach_indication_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_pdu = proto_tree_add_uint16(tree, hf_nfapi_number_of_preambles, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "Preamble PDU List", hf_nfapi_preamble_indication_pdu_list, ett_nfapi_preamble_indication_pdu_list, num_pdu, dissect_preamble_indication_pdu);
+-	return 0;
+-}
+-int dissect_srs_indication_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 pdu_len = proto_tree_add_uint16(tree, hf_nfapi_instance_length, tvb, offset, 0);
+-	guint pdu_end = (*offset + pdu_len - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-	return 0;
+-}
+-static int dissect_srs_indication_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-
+-	guint8 num_pdu = proto_tree_add_uint8(tree, hf_nfapi_number_of_srss, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "SRS PDU List", hf_nfapi_srs_indication_pdu_list, ett_nfapi_srs_indication_pdu_list, num_pdu, dissect_srs_indication_pdu);
+-	return 0;
+-}
+-int dissect_lbt_dl_config_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_lbt_dl_req_pdu_type, tvb, offset, 0);
+-	guint8 size = proto_tree_add_uint8(tree, hf_nfapi_pdu_size, tvb, offset, 0);
+-	guint pdu_end = (*offset + size - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-	return 0;
+-}
+-static int dissect_lbt_dl_config_request_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint8 num_pdu = proto_tree_add_uint8(tree, hf_nfapi_number_pdus, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "LBT DL PDU List", hf_nfapi_lbt_dl_config_pdu_list, ett_nfapi_lbt_dl_config_pdu_list, num_pdu, dissect_lbt_dl_config_pdu);
+-
+-	return 0;
+-}
+-int dissect_lbt_dl_indication_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_lbt_dl_ind_pdu_type, tvb, offset, 0);
+-	guint8 size = proto_tree_add_uint8(tree, hf_nfapi_pdu_size, tvb, offset, 0);
+-	guint pdu_end = (*offset + size - 2);
+-	dissect_tlv_list(tvb, pinfo, tree, data, offset, pdu_end);
+-	return 0;
+-}
+-static int dissect_lbt_indication_message_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint8 num_pdu = proto_tree_add_uint8(tree, hf_nfapi_number_pdus, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "LBT DL PDU List", hf_nfapi_lbt_dl_indication_pdu_list, ett_nfapi_lbt_dl_indication_pdu_list, num_pdu, dissect_lbt_dl_indication_pdu);
+-	return 0;
+-}
+-
+-static int dissect_lte_rssi_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_band_indicator, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_measurement_period, tvb, offset, "ms");
+-	proto_tree_add_uint8(tree, hf_nfapi_bandwidth, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, "ms");
+-	guint8 num_earfcns = proto_tree_add_uint8(tree, hf_nfapi_number_of_earfcns, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "EARFCNs", hf_nfapi_earfcn_list, ett_nfapi_earfcn_list, num_earfcns, dissect_earfcn_value);
+-	return 0;
+-}
+-
+-int dissect_uarfcn_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_uarfcn, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_utran_rssi_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_band_indicator, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_measurement_period, tvb, offset, "ms");
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, "ms");
+-	guint8 num_uarfcns = proto_tree_add_uint8(tree, hf_nfapi_number_of_uarfcns, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "UARFCNs", hf_nfapi_uarfcn_list, ett_nfapi_uarfcn_list, num_uarfcns, dissect_uarfcn_value);
+-	return 0;
+-}
+-
+-int dissect_arfcn_dir_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_arfcn, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_arfcn_direction, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_geran_rssi_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_frequency_band_indicator, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_measurement_period, tvb, offset, "ms");
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, "ms");
+-	guint8 num_arfcns = proto_tree_add_uint8(tree, hf_nfapi_number_of_arfcns, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "ARFCNs", hf_nfapi_arfcn_list, ett_nfapi_arfcn_list, num_arfcns, dissect_arfcn_dir_value);
+-	return 0;
+-}
+-
+-
+-int rssi_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, gint16 value)
+-{
+-	proto_tree_add_int_format_value(tree, hfindex, tvb, *offset, 2, value, "%.2f dB (%d)", ((float)value * 0.1), value);
+-	return 0;
+-}
+-int dissect_rssi_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_int16_with_conversion(tree, hf_nfapi_rssi, tvb, offset, rssi_conversion);
+-	return 0;
+-}
+-static int dissect_rssi_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_rssi = proto_tree_add_uint16(tree, hf_nfapi_number_of_rssi, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "ARFCNs", hf_nfapi_rssi_list, ett_nfapi_rssi_list, num_rssi, dissect_rssi_value);
+-	return 0;
+-}
+-
+-int dissect_pci_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pci, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_lte_cell_search_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_earfcn, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_measurement_bandwidth, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_exhaustive_search, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, "ms");
+-	guint8 num_pci = proto_tree_add_uint8(tree, hf_nfapi_number_of_pci, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PCIs", hf_nfapi_pci_list, ett_nfapi_pci_list, num_pci, dissect_pci_value);
+-	return 0;
+-}
+-
+-int dissect_psc_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_psc, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_utran_cell_search_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_uarfcn, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_exhaustive_search, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, "ms");
+-	guint8 num_psc = proto_tree_add_uint8(tree, hf_nfapi_number_of_psc, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "PSCs", hf_nfapi_psc_list, ett_nfapi_psc_list, num_psc, dissect_psc_value);
+-	return 0;
+-}
+-
+-int dissect_arfcn_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_arfcn, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_geran_cell_search_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, "ms");
+-	guint8 num_arfcn = proto_tree_add_uint8(tree, hf_nfapi_number_of_arfcns, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "ARFCNs", hf_nfapi_arfcn_list, ett_nfapi_arfcn_list, num_arfcn, dissect_arfcn_value);
+-	return 0;
+-}
+-
+-int neg_pow_conversion(proto_item* tree, int hfindex, tvbuff_t *tvb, guint* offset, guint8 value)
+-{
+-	proto_tree_add_uint_format_value(tree, hfindex, tvb, *offset, 1, value, "%d dB (%d)", ((gint16)value * (-1)), value);
+-	return 0;
+-}
+-
+-int dissect_lte_cell_found_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_pci, tvb, offset, 0);
+-	proto_tree_add_uint8_with_conversion(tree, hf_nfapi_rsrp, tvb, offset, neg_pow_conversion);
+-	proto_tree_add_uint8_with_conversion(tree, hf_nfapi_rsrq, tvb, offset, neg_pow_conversion);
+-	proto_tree_add_int16(tree, hf_nfapi_frequency_offset, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_lte_cell_search_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_lte_cells = proto_tree_add_uint16(tree, hf_nfapi_number_of_lte_cells_found, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "LTE Cells Found", hf_nfapi_lte_cells_found_list, ett_nfapi_lte_cells_found_list, num_lte_cells, dissect_lte_cell_found_value);
+-	return 0;
+-}
+-int dissect_utran_cell_found_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_psc, tvb, offset, 0);
+-	proto_tree_add_uint8_with_conversion(tree, hf_nfapi_rscp, tvb, offset, neg_pow_conversion);
+-	proto_tree_add_uint8_with_conversion(tree, hf_nfapi_enco, tvb, offset, neg_pow_conversion);
+-	proto_tree_add_int16(tree, hf_nfapi_frequency_offset, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_utran_cell_search_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_utran_cells = proto_tree_add_uint16(tree, hf_nfapi_number_of_utran_cells_found, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "UTRAN Cells Found", hf_nfapi_utran_cells_found_list, ett_nfapi_utran_cells_found_list, num_utran_cells, dissect_utran_cell_found_value);
+-	return 0;
+-}
+-
+-int dissect_geran_cell_found_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_arfcn, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_bsic, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_rxlev, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_rxqual, tvb, offset, 0);
+-	proto_tree_add_int16(tree, hf_nfapi_frequency_offset, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_sfn_offset, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_geran_cell_search_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 num_geran_cells = proto_tree_add_uint16(tree, hf_nfapi_number_of_geran_cells_found, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "GERAN Cells Found", hf_nfapi_geran_cells_found_list, ett_nfapi_geran_cells_found_list, num_geran_cells, dissect_geran_cell_found_value);
+-
+-	return 0;
+-}
+-static int dissect_pnf_cell_search_state_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8_array(tree, hf_nfapi_pnf_search_state, *end - *offset, tvb, offset);
+-	return 0;
+-}
+-
+-static int dissect_pnf_cell_broadcast_state_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8_array(tree, hf_nfapi_pnf_broadcast_state, *end - *offset, tvb, offset);
+-	return 0;
+-}
+-static int dissect_lte_broadcast_detect_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_earfcn, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pci, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, "ms");
+-	return 0;
+-}
+-static int dissect_utran_broadcast_detect_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_uarfcn, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_psc, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, "ms");
+-	return 0;
+-}
+-
+-static int dissect_lte_broadcast_detect_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_tx_antenna, tvb, offset, 0);
+-	guint16 mib_len = proto_tree_add_uint16(tree, hf_nfapi_mib_length, tvb, offset, 0);
+-	proto_tree_add_uint8_array(tree, hf_nfapi_mib, mib_len, tvb, offset);
+-	proto_tree_add_uint32(tree, hf_nfapi_sfn_offset, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_utran_broadcast_detect_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 mib_len = proto_tree_add_uint16(tree, hf_nfapi_mib_length, tvb, offset, 0);
+-	proto_tree_add_uint8_array(tree, hf_nfapi_mib, mib_len, tvb, offset);
+-	proto_tree_add_uint32(tree, hf_nfapi_sfn_offset, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_lte_system_information_schedule_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_earfcn, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pci, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_downlink_channel_bandwidth, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_phich_configuration, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_tx_antenna, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_retry_count, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, 0);
+-	return 0;
+-}
+-//static int dissect_pnf_cell_broadcast_state_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-//{
+-//	return 0;
+-//}
+-static int dissect_lte_system_information_schedule_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	// this needs to be SIB 1
+-	proto_tree_add_uint8_array(tree, hf_nfapi_sib1, (*end - *offset), tvb, offset);
+-	return 0;
+-}
+-
+-int dissect_si_periodicity_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_si_periodicity, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_si_index, tvb, offset, 0);
+-	return 0;
+-}
+-
+-static int dissect_lte_system_information_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_earfcn, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_pci, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_downlink_channel_bandwidth, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_phich_configuration, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_number_of_tx_antenna, tvb, offset, 0);
+-	guint8 si_priodicity = proto_tree_add_uint8(tree, hf_nfapi_number_of_si_periodicity, tvb, offset, 0);
+-	dissect_array_value(tvb, pinfo, tree, data, offset, end, "Number SI Periodicity", hf_nfapi_si_periodicity_list, ett_nfapi_si_periodicity_list, si_priodicity, dissect_si_periodicity_value);
+-	proto_tree_add_uint8(tree, hf_nfapi_si_window_length, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, 0);
+-
+-	return 0;
+-}
+-static int dissect_utran_system_information_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_uarfcn, tvb, offset, 0);
+-	proto_tree_add_uint16(tree, hf_nfapi_psc, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, 0);
+-	return 0;
+-}
+-static int dissect_geran_system_information_request_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint16(tree, hf_nfapi_arfcn, tvb, offset, 0);
+-	proto_tree_add_uint8(tree, hf_nfapi_bsic, tvb, offset, 0);
+-	proto_tree_add_uint32(tree, hf_nfapi_timeout, tvb, offset, 0);
+-	return 0;
+-}
+-//static int dissect_pnf_cell_broadcast_state_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-//{
+-//	return 0;
+-//}
+-static int dissect_lte_system_information_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	proto_tree_add_uint8(tree, hf_nfapi_sib_type, tvb, offset, 0);
+-	guint16 sib_len = proto_tree_add_uint16(tree, hf_nfapi_sib_len, tvb, offset, 0);
+-	proto_tree_add_uint8_array(tree, hf_nfapi_sib, sib_len, tvb, offset);
+-	return 0;
+-}
+-static int dissect_utran_system_information_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 sib_len = proto_tree_add_uint16(tree, hf_nfapi_sib_len, tvb, offset, 0);
+-	proto_tree_add_uint8_array(tree, hf_nfapi_sib, sib_len, tvb, offset);
+-	return 0;
+-}
+-static int dissect_geran_system_information_indication_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint16 si_len = proto_tree_add_uint16(tree, hf_nfapi_si_len, tvb, offset, 0);
+-	proto_tree_add_uint8_array(tree, hf_nfapi_si, si_len, tvb, offset);
+-	return 0;
+-}
+-
+-static int dissect_rx_indication_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end);
+-
+-const tlv_t tags[] =
+-{
+-	{ 0x1000, "PNF Param General", dissect_pnf_param_general_value },
+-	{ 0x1001, "PNF PHY", dissect_pnf_phy_value },
+-	{ 0x1002, "PNF RF", dissect_pnf_rf_value },
+-	{ 0x100A, "PNF PHY Rel 10", dissect_pnf_phy_rel10_value },
+-	{ 0x100B, "PNF PHY Rel 11", dissect_pnf_phy_rel11_value },
+-	{ 0x100C, "PNF PHY Rel 12", dissect_pnf_phy_rel12_value },
+-	{ 0x100D, "PNF PHY Rel 13", dissect_pnf_phy_rel13_value },
+-	{ 0x1003, "PNF PHY RF Config", dissect_pnf_phy_rf_config_value },
+-
+-	{ 0x0001, "Subframe config - Duplex Mode", dissect_duplex_mode_value },
+-	{ 0x0002, "Subframe config - PCFICH power offset TLV", dissect_pcfich_power_offset_value },
+-	{ 0x0003, "Subframe config - P-B", dissect_pb_value },
+-	{ 0x0004, "Subframe config - DL cyclic prefix type", dissect_dl_cyclic_prefix_value },
+-	{ 0x0005, "Subframe config - UL cyclic prefix type", dissect_ul_cyclic_prefix_value },
+-	{ 0x000A, "RF config - Downlink channel bandwidth", dissect_dl_channel_bandwidth_value },
+-	{ 0x000B, "RF config - Uplink channel bandwidth", dissect_ul_channel_bandwidth_value },
+-	{ 0x000C, "RF config - Reference signal power", dissect_reference_signal_power_value },
+-	{ 0x000D, "RF config - Tx antenna ports", dissect_tx_antenna_ports_value },
+-	{ 0x000E, "RF config - Rx Antenna ports", dissect_rx_antenna_ports_value },
+-	{ 0x0014, "PHICH config - PHICH resource", dissect_phich_resource_value },
+-	{ 0x0015, "PHICH config - PHICH duration", dissect_phich_duration_value },
+-	{ 0x0016, "PHICH config - PHICH power offset", dissect_phich_power_offset_value },
+-	{ 0x001E, "SCH config - Primary synchronization signal EPRE/EPRERS", dissect_psch_synch_signal_epre_eprers_value },
+-	{ 0x001F, "SCH config - Secondary synchronization signal EPRE/EPRERS", dissect_ssch_synch_signal_epre_eprers_value },
+-	{ 0x0020, "SCH config - Physical Cell Id", dissect_physical_cell_id_value },
+-	{ 0x0028, "PRACH config - Configuration index", dissect_prach_configuration_index_value },
+-	{ 0x0029, "PRACH config - Root sequence index", dissect_prach_root_sequence_index_value },
+-	{ 0x002A, "PRACH config - Zero correlation zone configuration", dissect_prach_zero_correlation_zone_configuration_value },
+-	{ 0x002B, "PRACH config - High speed flag", dissect_prach_high_speed_flag_value },
+-	{ 0x002C, "PRACH config - Frequency offset", dissect_prach_frequency_offset_value },
+-	{ 0x0032, "PUSCH config - Hopping mode", dissect_pusch_hopping_mode_value },
+-	{ 0x0033, "PUSCH config - Hopping offset", dissect_pusch_hopping_offset_value },
+-	{ 0x0034, "PUSCH config - Number of sub-bands", dissect_pusch_number_of_subbands_value },
+-	{ 0x003C, "PUCCH config - Delta PUCCH Shift", dissect_pucch_delta_pucch_shift_value },
+-	{ 0x003D, "PUCCH config - N_CQI RB", dissect_pucch_n_cqi_rb_value },
+-	{ 0x003E, "PUCCH config - N_AN CS", dissect_pucch_n_an_cs_value },
+-	{ 0x003F, "PUCCH config - N1Pucch-AN", dissect_pucch_n1_pucch_an_value },
+-	{ 0x0046, "SRS config - Bandwidth configuration", dissect_srs_bandwidth_configuration_value },
+-	{ 0x0047, "SRS config - MaxUpPTS", dissect_srs_max_uppts_value },
+-	{ 0x0048, "SRS config - SRS subframe configuration", dissect_srs_subframe_configuration_value },
+-	{ 0x0049, "SRS config - SRS AckNack SRS simultaneous transmission", dissect_srs_acknack_srs_sim_tx_value },
+-	{ 0x0050, "Uplink reference signal config - Uplink RS hopping", dissect_uplink_rs_hopping_value },
+-	{ 0x0051, "Uplink reference signal config - Group assignment (delta sequence-shift pattern)", dissect_group_assignment_value },
+-	{ 0x0052, "Uplink reference signal config - Cyclic Shift 1 for DMRS", dissect_cyclic_shift_1_for_drms_value },
+-	{ 0x005A, "TDD frame structure config - Subframe assignment", dissect_tdd_subframe_assignement_value },
+-	{ 0x005B, "TDD frame structure config - Special sub-frame patterns", dissect_tdd_subframe_patterns_value },
+-	{ 0x0064, "LAA config - ED Threshold for LBT for PDSCH", dissect_laa_ed_threashold_for_lbt_for_pdsch_value },
+-	{ 0x0065, "LAA config - ED Threshold for LBT for DRS", dissect_laa_ed_threashold_for_lbt_for_drs_value },
+-	{ 0x0066, "LAA config - PD Threshold", dissect_laa_pd_threshold_value },
+-	{ 0x0067, "LAA config - Multi carrier type", dissect_laa_multi_carrier_type_value },
+-	{ 0x0068, "LAA config - Multi carrier TX", dissect_laa_multi_carrier_tx_value },
+-	{ 0x0069, "LAA config - Multi carrier freeze ", dissect_laa_multi_carrier_freeze_value },
+-	{ 0x006A, "LAA config - Tx antenna ports for DRS", dissect_laa_tx_antenna_port_for_drs_value },
+-	{ 0x006B, "LAA config - Transmission power for DRS", dissect_laa_transmission_power_for_drs_value },
+-
+-	{ 0x0078, "eMTC config - PBCH Repetitions enable R13", dissect_emtc_pbch_repeitions_enabled_r13_value },
+-	{ 0x0079, "eMTC config - PRACH CAT-M Root sequence index", dissect_emtc_prach_cat_m_root_sequence_index_value },
+-	{ 0x007A, "eMTC config - PRACH CAT-M Zero correlation zone configuration", dissect_emtc_prach_cat_m_zero_correlation_zone_configuration_value },
+-	{ 0x007B, "eMTC config - PRACH CAT-M High speed flag", dissect_emtc_prach_cat_m_high_speed_flag_value },
+-	{ 0x007C, "eMTC config - PRACH CE level #0 Enable", dissect_emtc_prach_ce_level_0_enabled_value },
+-	{ 0x007D, "eMTC config - PRACH CE level #0 Configuration index", dissect_emtc_prach_ce_level_0_configuration_offset_value },
+-	{ 0x007E, "eMTC config - PRACH CE level #0 Frequency offset", dissect_emtc_prach_ce_level_0_frequency_offset_value },
+-	{ 0x007F, "eMTC config - PRACH CE level #0 Number of repetitions per attempt", dissect_emtc_preach_ce_level_0_num_of_repeitions_per_attempt_value },
+-	{ 0x0080, "eMTC config - CE level #0 Starting subframe periodicity", dissect_emtc_ce_level_0_starting_subframe_periodicity_value },
+-	{ 0x0081, "eMTC config - PRACH CE level #0 Hopping Enable", dissect_emtc_preach_ce_level_0_hopping_enabled_value },
+-	{ 0x0082, "eMTC config - PRACH CE level #0 Hopping Offset", dissect_emtc_preach_ce_level_0_hopping_offset_value },
+-	{ 0x0083, "eMTC config - PRACH CE level #1 Enable", dissect_emtc_prach_ce_level_1_enabled_value },
+-	{ 0x0084, "eMTC config - PRACH CE level #1 Configuration index", dissect_emtc_prach_ce_level_1_configuration_offset_value },
+-	{ 0x0085, "eMTC config - PRACH CE level #1 Frequency offset", dissect_emtc_prach_ce_level_1_frequency_offset_value },
+-	{ 0x0086, "eMTC config - PRACH CE level #1 Number of repetitions per attempt", dissect_emtc_preach_ce_level_1_num_of_repeitions_per_attempt_value },
+-	{ 0x0087, "eMTC config - CE level #1 Starting subframe periodicity", dissect_emtc_ce_level_1_starting_subframe_periodicity_value },
+-	{ 0x0088, "eMTC config - PRACH CE level #1 Hopping Enable", dissect_emtc_preach_ce_level_1_hopping_enabled_value },
+-	{ 0x0089, "eMTC config - PRACH CE level #1 Hopping Offset", dissect_emtc_preach_ce_level_1_hopping_offset_value },
+-	{ 0x008A, "eMTC config - PRACH CE level #2 Enable", dissect_emtc_prach_ce_level_2_enabled_value },
+-	{ 0x008B, "eMTC config - PRACH CE level #2 Configuration index", dissect_emtc_prach_ce_level_2_configuration_offset_value },
+-	{ 0x008C, "eMTC config - PRACH CE level #2 Frequency offset", dissect_emtc_prach_ce_level_2_frequency_offset_value },
+-	{ 0x008D, "eMTC config - PRACH CE level #2 Number of repetitions per attempt", dissect_emtc_preach_ce_level_2_num_of_repeitions_per_attempt_value },
+-	{ 0x008E, "eMTC config - CE level #2 Starting subframe periodicity", dissect_emtc_ce_level_2_starting_subframe_periodicity_value },
+-	{ 0x008F, "eMTC config - PRACH CE level #2 Hopping Enable", dissect_emtc_preach_ce_level_2_hopping_enabled_value },
+-	{ 0x0090, "eMTC config - PRACH CE level #2 Hopping Offset", dissect_emtc_preach_ce_level_2_hopping_offset_value },
+-	{ 0x0091, "eMTC config - PRACH CE level #3 Enable", dissect_emtc_prach_ce_level_3_enabled_value },
+-	{ 0x0092, "eMTC config - PRACH CE level #3 Configuration index", dissect_emtc_prach_ce_level_3_configuration_offset_value },
+-	{ 0x0093, "eMTC config - PRACH CE level #3 Frequency offset", dissect_emtc_prach_ce_level_3_frequency_offset_value },
+-	{ 0x0094, "eMTC config - PRACH CE level #3 Number of repetitions per attempt", dissect_emtc_preach_ce_level_3_num_of_repeitions_per_attempt_value },
+-	{ 0x0095, "eMTC config - CE level #3 Starting subframe periodicity", dissect_emtc_ce_level_3_starting_subframe_periodicity_value },
+-	{ 0x0096, "eMTC config - PRACH CE level #3 Hopping Enable", dissect_emtc_preach_ce_level_3_hopping_enabled_value },
+-	{ 0x0097, "eMTC config - PRACH CE level #3 Hopping Offset", dissect_emtc_preach_ce_level_3_hopping_offset_value },
+-	{ 0x0098, "eMTC config - PUCCH Interval - ULHoppingConfigCommonModeA", dissect_emtc_pucch_interval_ul_hopping_config_common_mode_a_value },
+-	{ 0x0099, "eMTC config - PUCCH Interval - ULHoppingConfigCommonModeB", dissect_emtc_pucch_interval_ul_hopping_config_common_mode_b_value },
+-	
+-	{ 0x00C8, "Layer 2/3 - Downlink Bandwidth Support", dissect_dl_bandwidth_support_value },
+-	{ 0x00C9, "Layer 2/3 - Uplink Bandwidth Support", dissect_ul_bandwidth_support_value },
+-	{ 0x00CA, "Layer 2/3 - Downlink modulation support", dissect_dl_modulation_value },
+-	{ 0x00CB, "Layer 2/3 - Uplink modulation support", dissect_ul_modulation_value },
+-	{ 0x00CC, "Layer 2/3 - PHY antenna capability", dissect_phy_antenna_capability_value },
+-	{ 0x00CD, "Layer 2/3 - Release capability", dissect_release_capability_value },
+-	{ 0x00CE, "Layer 2/3 - MBSFN capability", dissect_mbsfn_value },
+-
+-	{ 0x00D1, "LAA Capability - LAA support", dissect_laa_support_value },
+-	{ 0x00D1, "LAA Capability - PD sensing LBT support", dissect_laa_pd_sensing_lbt_support_value },
+-	{ 0x00D1, "LAA Capability - Multi carrier LBT support", dissect_laa_multi_carrier_lbt_support_value },
+-	{ 0x00D1, "LAA Capability - Partial SF support", dissect_laa_partial_sf_support_value },
+-
+-	{ 0x00F0, "Layer 2/3 - Data report mode", dissect_data_report_mode_value },
+-	{ 0x00F1, "Layer 2/3 - SFN/SF", dissect_sfn_sf_value },
+-	{ 0x00FA, "Layer 1 - PHY state", dissect_phy_state_value },
+-
+-	{ 0x0100, "NFAPI - P7 VNF Address IPv4", dissect_p7_vnf_address_ipv4_value },
+-	{ 0x0101, "NFAPI - P7 VNF Address IPv4", dissect_p7_vnf_address_ipv6_value },
+-	{ 0x0102, "NFAPI - P7 Port", dissect_p7_vnf_port_value },
+-	{ 0x0103, "NFAPI - P7 PNF Address IPv4", dissect_p7_pnf_address_ipv4_value },
+-	{ 0x0104, "NFAPI - P7 PNF Address IPv4", dissect_p7_pnf_address_ipv6_value },
+-	{ 0x0105, "NFAPI - P7 Port", dissect_p7_pnf_port_value },
+-	{ 0x010A, "NFAPI - Downlink UEs per Subframe", dissect_downlink_ues_per_subframe_value },
+-	{ 0x010B, "NFAPI - Uplink UEs per Subframe", dissect_uplink_ues_per_subframe_value },
+-
+-	{ 0x0114, "NFAPI - nFAPI RF Bands", dissect_rf_bands_value },
+-
+-	{ 0x011E, "NFAPI - Timing window", dissect_timing_window_value },
+-	{ 0x011F, "NFAPI - Timing info mode", dissect_timing_info_mode_value },
+-	{ 0x0120, "NFAPI - Timing info period", dissect_timing_info_period_value },
+-	{ 0x0128, "NFAPI - Maximum Transmit Power", dissect_maximum_transmit_power_value },
+-	{ 0x0129, "NFAPI - EARFCN", dissect_earfcn_value },
+-	{ 0x0130, "NFAPI - NMM GSM Frequency Bands", dissect_nmm_gsm_frequency_bands_value },
+-	{ 0x0131, "NFAPI - NMM UMTS Frequency Bands", dissect_nmm_umts_frequency_bands_value },
+-	{ 0x0132, "NFAPI - NMM LTE Frequency Bands", dissect_nmm_lte_frequency_bands_value },
+-	{ 0x0133, "NFAPI - NMM Uplink RSSI supported", dissect_nmm_uplink_rssi_supported_value },
+-
+-	{ 0x2000, "DL Config Request Body", dissect_dl_config_request_body_value },
+-
+-	{ 0x2001, "DL DCI PDU Release 8", dissect_dl_config_request_dl_dci_pdu_rel8_value },
+-	{ 0x2002, "DL DCI PDU Release 9", dissect_dl_config_request_dl_dci_pdu_rel9_value },
+-	{ 0x2003, "DL DCI PDU Release 10", dissect_dl_config_request_dl_dci_pdu_rel10_value },
+-	{ 0x2039, "DL DCI PDU Release 11", dissect_dl_config_request_dl_dci_pdu_rel11_value },
+-	{ 0x203A, "DL DCI PDU Release 12", dissect_dl_config_request_dl_dci_pdu_rel12_value },
+-	{ 0x203B, "DL DCI PDU Release 13", dissect_dl_config_request_dl_dci_pdu_rel13_value },
+-
+-
+-	{ 0x2004, "BCH PDU Release 8", dissect_dl_config_request_bch_pdu_rel8_value },
+-
+-	{ 0x2005, "MCH PDU Release 8", dissect_dl_config_request_mch_pdu_rel8_value },
+-
+-	{ 0x2006, "DLSCH PDU Release 8", dissect_dl_config_request_dlsch_pdu_rel8_value },
+-	{ 0x2007, "DLSCH PDU Release 9", dissect_dl_config_request_dlsch_pdu_rel9_value },
+-	{ 0x2008, "DLSCH PDU Release 10", dissect_dl_config_request_dlsch_pdu_rel10_value },
+-	{ 0x203C, "DLSCH PDU Release 11", dissect_dl_config_request_dlsch_pdu_rel11_value },
+-	{ 0x203D, "DLSCH PDU Release 12", dissect_dl_config_request_dlsch_pdu_rel12_value },
+-	{ 0x203E, "DLSCH PDU Release 13", dissect_dl_config_request_dlsch_pdu_rel13_value },
+-
+-	{ 0x2009, "PCH PDU Release 8", dissect_dl_config_request_pch_pdu_rel8_value },
+-	{ 0x203F, "PCH PDU Release 13", dissect_dl_config_request_pch_pdu_rel13_value },
+-
+-	{ 0x200A, "PRS PDU Release 9", dissect_dl_config_request_prs_pdu_rel9_value },
+-
+-	{ 0x200B, "CSI-RS PDU Release 10", dissect_dl_config_request_csi_rs_pdu_rel10_value },
+-	{ 0x2040, "CSI-RS PDU Release 13", dissect_dl_config_request_csi_rs_pdu_rel13_value },
+-
+-	//{ 0x2001, "EDPCCH PDU Release 8", ?? },
+-	//{ 0x2002, "EDPCCH PDU Release 8", ?? },
+-	//{ 0x2003, "EDPCCH PDU Release 8", ?? },
+-	//{ 0x2039, "EDPCCH PDU Release 11", ?? },
+-	//{ 0x203A, "EDPCCH PDU Release 12", ?? },
+-	//{ 0x203B, "EDPCCH PDU Release 13", ?? },
+-	{ 0x2041, "EDPCCH PDU Release 11 Parameters", dissect_dl_config_request_edpcch_params_rel11_value },
+-	{ 0x2042, "EDPCCH PDU Release 13 Parameters", dissect_dl_config_request_edpcch_params_rel13_value },
+-
+-	{ 0x205B, "MPDCCH PDU Release 13", dissect_dl_config_request_mpdpcch_pdu_rel13_value },
+-
+-
+-	{ 0x200C, "UL Config Request Body", dissect_ul_config_request_body_value },
+-	{ 0x200D, "ULSCH PDU Release 8", dissect_ul_config_ulsch_pdu_rel8_value },
+-	{ 0x200E, "ULSCH PDU Release 10", dissect_ul_config_ulsch_pdu_rel10_value },
+-	{ 0x2043, "ULSCH PDU Release 11", dissect_ul_config_ulsch_pdu_rel11_value },
+-	{ 0x2044, "ULSCH PDU Release 13", dissect_ul_config_ulsch_pdu_rel13_value },
+-	{ 0x200F, "Initial Transmission Paramters Release 8", dissect_ul_config_init_tx_params_rel8_value },
+-	{ 0x2010, "CQI RI Information Release 8", dissect_ul_config_cqi_ri_info_rel8_value },
+-	{ 0x2011, "CQI RI Information Release 9 or later", dissect_ul_config_cqi_ri_info_rel9_later_value },
+-	{ 0x2045, "CQI RI Information Release 13", dissect_ul_config_cqi_ri_info_rel13_value },
+-	{ 0x2012, "HARQ Information (ULSCH) Release 10", dissect_ul_config_harq_info_ulsch_rel10_value },
+-	{ 0x2046, "HARQ Information (ULSCH) Release 13", dissect_ul_config_harq_info_ulsch_rel13_value },
+-	{ 0x2013, "UE Information Release 8", dissect_ul_config_ue_info_rel8_value },
+-	{ 0x2047, "UE Information Release 11", dissect_ul_config_ue_info_rel11_value },
+-	{ 0x2048, "UE Information Release 13", dissect_ul_config_ue_info_rel13_value },
+-	{ 0x2014, "CQI Information Release 8", dissect_ul_config_cqi_info_rel8_value },
+-	{ 0x2015, "CQI Information Release 10", dissect_ul_config_cqi_info_rel10_value },
+-	{ 0x2049, "CQI Information Release 13", dissect_ul_config_cqi_info_rel13_value },
+-	{ 0x2016, "SR Information Release 8", dissect_ul_config_sr_info_rel8_value },
+-	{ 0x2017, "SR Information Release 10", dissect_ul_config_sr_info_rel10_value },
+-	{ 0x2018, "HARQ Information (UCI) Release 10 TDD", dissect_ul_config_harq_info_uci_rel10_tdd_value },
+-	{ 0x2019, "HARQ Information (UCI) Release 8 FDD", dissect_ul_config_harq_info_uci_rel8_fdd_value },
+-	{ 0x201A, "HARQ Information (UCI) Release 9 or later FDD", dissect_ul_config_harq_info_uci_rel9_later_fdd_value },
+-	{ 0x204A, "HARQ Information (UCI) Release 11 FDD/TDD", dissect_ul_config_harq_info_uci_rel11_fdd_tdd_value },
+-	{ 0x204B, "HARQ Information (UCI) Release 13 FDD/TDD", dissect_ul_config_harq_info_uci_rel13_fdd_tdd_value },
+-	{ 0x201B, "SRS Information Release 8", dissect_ul_config_srs_info_rel8_value },
+-	{ 0x201C, "SRS Information Release 10", dissect_ul_config_srs_info_rel10_value },
+-	{ 0x204C, "SRS Information Release 13", dissect_ul_config_srs_info_rel13_value },
+-
+-	{ 0x201D, "HI DCI0 Request Body", dissect_hi_dci0_request_body_value },
+-	{ 0x201E, "HI PDU Release 8", dissect_hi_dci0_hi_rel8_value },
+-	{ 0x201F, "HI PDU Release 10", dissect_hi_dci0_hi_rel10_value },
+-	{ 0x2020, "DCI UL PDU Release 8", dissect_hi_dci0_dci_ul_rel8_value },
+-	{ 0x2021, "DCI UL PDU Release 10", dissect_hi_dci0_dci_ul_rel10_value },
+-	{ 0x204D, "DCI UL PDU Release 12", dissect_hi_dci0_dci_ul_rel12_value },
+-	//{ 0x2041, "EDPCCH DCI UL PDU Release 11", dissect_hi_dci0_edpcch_dci_ul_rel11_value },
+-	{ 0x204E, "MDPCCH DCI UL PDU Release 13", dissect_hi_dci0_mdpcch_dci_ul_rel13_value },
+-
+-	{ 0x2022, "Tx Request Body", dissect_tx_request_body_value },
+-
+-	{ 0x2038, "RX UE Information", dissect_rx_ue_info_value },
+-
+-	{ 0x2023, "RX Indication Body", dissect_rx_indication_body_value },
+-	{ 0x2024, "RX PDU Release 8", dissect_rx_indication_rel8_value },
+-	{ 0x2025, "RX PDU Release 9", dissect_rx_indication_rel9_value },
+-
+-	{ 0x2026, "HARQ Indication Body", dissect_harq_indication_body_value },
+-	{ 0x2027, "HARQ PDU Release 8 TDD", dissect_harq_indication_rel8_tdd_value },
+-	{ 0x2028, "HARQ PDU Release 9 or later TDD", dissect_harq_indication_rel9_later_tdd_value },
+-	{ 0x204F, "HARQ PDU Release 13 or later TDD", dissect_harq_indication_rel13_later_tdd_value },
+-	{ 0x2029, "HARQ PDU Release 8 FDD", dissect_harq_indication_rel8_fdd_value },
+-	{ 0x202A, "HARQ PDU Release 9 or later FDD", dissect_harq_indication_rel9_later_fdd_value },
+-	{ 0x2050, "HARQ PDU Release 13 or later FDD", dissect_harq_indication_rel13_later_fdd_value },
+-	{ 0x2052, "UL CQI Information", dissect_ul_cqi_information_value },
+-
+-	{ 0x202B, "CRC Indication Body", dissect_crc_indication_body_value },
+-	{ 0x202C, "CRC PDU Release 8", dissect_crc_indication_rel8_value },
+-
+-	{ 0x202D, "RX SR Indication Body", dissect_rx_sr_indication_body_value },
+-
+-	{ 0x202E, "RX CQI Indication Body", dissect_rx_cqi_indication_body_value },
+-	{ 0x202F, "CQI PDU Release 8", dissect_rx_cqi_indication_rel8_value },
+-	{ 0x2030, "CQI PDU Release 9", dissect_rx_cqi_indication_rel9_value },
+-
+-	{ 0x2031, "RACH Indication Body", dissect_rach_indication_body_value },
+-	{ 0x2032, "Preamable PDU Release 8", dissect_rach_indication_rel8_value },
+-	{ 0x2033, "Preamable PDU Release 9", dissect_rach_indication_rel9_value },
+-	{ 0x2051, "Preamable PDU Release 13", dissect_rach_indication_rel13_value },
+-
+-	{ 0x2034, "SRS Indication Body", dissect_srs_indication_body_value },
+-	{ 0x2035, "SRS PDU Release 8", dissect_srs_indication_rel8_value },
+-	{ 0x2036, "SRS PDU Release 9", dissect_srs_indication_rel9_value },
+-	{ 0x2037, "SRS PDU Release 10 TDD", dissect_srs_indication_rel10_tdd_value },
+-	{ 0x2054, "TDD Channel Measurement", dissect_tdd_channel_measuerment_value },
+-	{ 0x2053, "SRS PDU Release 11", dissect_srs_indication_rel11_value },
+-
+-
+-	{ 0x2055, "LBT DL Config Request Body", dissect_lbt_dl_config_request_body_value },
+-	{ 0x2056, "LBT PDSCH Req PDU Release 13", dissect_lbt_dl_config_request_pdsch_req_rel13_value },
+-	{ 0x2057, "LBT DRS req PDU Release 13", dissect_lbt_dl_config_request_drs_req_rel13_value },
+-
+-	{ 0x2058, "LBT DL Indication Message Body", dissect_lbt_indication_message_body_value },
+-	{ 0x2056, "LBT PDSCH Resp PDU Release 13", dissect_lbt_dl_config_request_pdsch_resp_rel13_value },
+-	{ 0x2057, "LBT DRS Resp PDU Release 13", dissect_lbt_dl_config_request_drs_resp_rel13_value },
+-
+-	{ 0x3000, "LTE RSSI Request", dissect_lte_rssi_request_value },
+-	{ 0x3001, "UTRAN RSSI Request", dissect_utran_rssi_request_value },
+-	{ 0x3002, "GERAN RSSI Request", dissect_geran_rssi_request_value },
+-	{ 0x3003, "RSSI Indication", dissect_rssi_indication_value },
+-	{ 0x3004, "LTE CELL SEARCH Request", dissect_lte_cell_search_value },
+-	{ 0x3005, "UTRAN CELL SEARCH Request", dissect_utran_cell_search_value },
+-	{ 0x3006, "GERAN CELL SEARCH Request", dissect_geran_cell_search_value },
+-	{ 0x3007, "LTE CELL SEARCH Indication", dissect_lte_cell_search_indication_value },
+-	{ 0x3008, "UTRAN CELL SEARCH Indication", dissect_utran_cell_search_indication_value },
+-	{ 0x3009, "GERAN CELL SEARCH Indication", dissect_geran_cell_search_indication_value },
+-	{ 0x300a, "PNF CELL SEARCH STATE", dissect_pnf_cell_search_state_value },
+-	{ 0x300b, "LTE BROADCAST DETECT Request", dissect_lte_broadcast_detect_request_value },
+-	{ 0x300c, "UTRAN BROADCAST DETECT Request", dissect_utran_broadcast_detect_request_value },
+-	{ 0x300d, "PNF CELL SEARCH STATE", dissect_pnf_cell_search_state_value },
+-	{ 0x300e, "LTE BROADCAST DETECT Indication", dissect_lte_broadcast_detect_indication_value },
+-	{ 0x300f, "UTRAN BROADCAST DETECT Indication", dissect_utran_broadcast_detect_indication_value },
+-	{ 0x3010, "PNF CELL BROADCAST STATE", dissect_pnf_cell_broadcast_state_value },
+-	{ 0x3011, "LTE SYSTEM INFORMATION SCHEDULE Request", dissect_lte_system_information_schedule_request_value },
+-	{ 0x3012, "PNF CELL BROADCAST STATE", dissect_pnf_cell_broadcast_state_value },
+-	{ 0x3013, "LTE SYSTEM INFORMATION SCHEDULE Indication", dissect_lte_system_information_schedule_indication_value },
+-	{ 0x3014, "LTE SYSTEM INFORMATION Request", dissect_lte_system_information_request_value },
+-	{ 0x3015, "UTRAN SYSTEM INFORMATION Request", dissect_utran_system_information_request_value },
+-	{ 0x3016, "GERAN SYSTEM INFORMATION Request", dissect_geran_system_information_request_value },
+-	{ 0x3017, "PNF CELL BROADCAST STATE", dissect_pnf_cell_broadcast_state_value },
+-	{ 0x3018, "LTE SYSTEM INFORMATION Indication", dissect_lte_system_information_indication_value },
+-	{ 0x3019, "UTRAN SYSTEM INFORMATION Indication", dissect_utran_system_information_indication_value },
+-	{ 0x301a, "GERAN SYSTEM INFORMATION Indication", dissect_geran_system_information_indication_value },
+-
+-
+-
+-
+-};
+-
+-int look_up_tlv(int tag_id)
+-{
+-	int i;
+-	int num_tags = sizeof(tags) / sizeof(tlv_t);
+-
+-	for (i = 0; i < num_tags; i++)
+-	{
+-		if (tag_id == tags[i].tag_id)
+-			return i;
+-	}
+-	return -1;
+-}
+-
+-static int dissect_tl_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset)
+-{
+-	proto_item *tl_ti = proto_tree_add_string_format(tree, hf_nfapi_tl, tvb, *offset, 4, "", "TL");
+-	proto_tree *tl_tree = proto_item_add_subtree(tl_ti, ett_nfapi_tl);
+-
+-	proto_tree_add_uint16(tl_tree, hf_nfapi_tl_tag, tvb, offset, 0);
+-	proto_tree_add_uint16(tl_tree, hf_nfapi_tl_length, tvb, offset, "bytes");
+-
+-	return 0;
+-
+-}
+-
+-static int dissect_tlv_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint len)
+-{	
+-	while (*offset < len)
+-	{
+-		guint16 tlv_id = tvb_get_guint16(tvb, *offset, ENC_NA);
+-		guint16 tlv_len = tvb_get_guint16(tvb, *offset + 2, ENC_NA);
+-
+-		int tlv_index = look_up_tlv(tlv_id);
+-
+-		char* tlv_name = tlv_index != -1 ? tags[tlv_index].name : "Unknown";
+-
+-		proto_item *tlv_ti = proto_tree_add_string_format(tree, hf_nfapi_tlv_tree, tvb, *offset, tlv_len + 4, "", tlv_name);
+-		proto_tree *tlv_tree = proto_item_add_subtree(tlv_ti, ett_nfapi_tlv_tree);
+-
+-		dissect_tl_header(tvb, pinfo, tlv_tree, data, offset);
+-
+-		if (tags[tlv_index].decode != NULL)
+-		{
+-			guint tmp = *offset;
+-			guint end = *offset + tlv_len;
+-			tags[tlv_index].decode(tvb, pinfo, tlv_tree, data, &tmp, &end);
+-			*offset += tlv_len;
+-		}
+-		else
+-		{
+-			*offset += tlv_len;
+-		}
+-	}
+-
+-	return 0;
+-}
+-
+-static int dissect_rx_indication_body_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint* end)
+-{
+-	guint number_of_pdu_addr = *offset;
+-	guint16 count = proto_tree_add_uint16(tree, hf_nfapi_number_pdus, tvb, offset, 0);
+-	//dissect_array_value(tvb, pinfo, tree, data, offset, "RX PDU List", hf_nfapi_rx_indication_pdu_list, ett_nfapi_rx_indication_pdu_list, num_pdu, dissect_rx_pdu);
+-
+-	guint16* lengths = malloc(count * 2);
+-	memset(lengths, 0, count * 2);
+-
+-	guint16 i = 0;
+-
+-	if (count > 0)
+-	{
+-		proto_item *list_ti = proto_tree_add_string_format(tree, hf_nfapi_rx_indication_pdu_list, tvb, *offset, 2, "", "RX PDU List");
+-		proto_tree *list_tree = proto_item_add_subtree(list_ti, ett_nfapi_rx_indication_pdu_list);
+-
+-		//for (i = 0; i < count; ++i)
+-		proto_tree *item_tree = 0;
+-
+-		guint pdu_end = *end;
+-		while (*offset < *end && *offset < pdu_end)
+-		{
+-
+-			guint16 tlv_id = tvb_get_guint16(tvb, *offset, ENC_NA);
+-			guint16 tlv_len = tvb_get_guint16(tvb, *offset + 2, ENC_NA);
+-
+-			if (tlv_id == 0x2038)
+-			{
+-				proto_item *item_ti = proto_tree_add_string_format(list_tree, hf_nfapi_rx_indication_pdu_list, tvb, *offset, 2, "", "[%d]", i);
+-				item_tree = proto_item_add_subtree(item_ti, ett_nfapi_rx_indication_pdu_list);
+-
+-				i++;
+-			}
+-
+-			int tlv_index = look_up_tlv(tlv_id);
+-
+-			char* tlv_name = tlv_index != -1 ? tags[tlv_index].name : "Unknown";
+-
+-			proto_item *tlv_ti = proto_tree_add_string_format(item_tree, hf_nfapi_tlv_tree, tvb, *offset, tlv_len + 4, "", tlv_name);
+-			proto_tree *tlv_tree = proto_item_add_subtree(tlv_ti, ett_nfapi_tlv_tree);
+-
+-
+-	
+-
+-			dissect_tl_header(tvb, pinfo, tlv_tree, data, offset);
+-
+-			guint tmp_offset = *offset;
+-
+-			if (tlv_id == 0x2038)
+-			{
+-				dissect_rx_ue_info_value(tvb, pinfo, tlv_tree, data, &tmp_offset, end);
+-			}
+-
+-			else if (tlv_id == 0x2024)
+-			{
+-				//int data_offset = dissect_rx_indication_rel8_value(tvb, pinfo, tlv_tree, data, &tmp_offset, end);
+-
+-				lengths[i-1] = proto_tree_add_uint16(tlv_tree, hf_nfapi_length, tvb, &tmp_offset, 0);
+-				int data_offset = proto_tree_add_uint16(tlv_tree, hf_nfapi_data_offset, tvb, &tmp_offset, 0);
+-				proto_tree_add_uint8(tlv_tree, hf_nfapi_ul_cqi, tvb, &tmp_offset, 0);
+-				proto_tree_add_uint16(tlv_tree, hf_nfapi_timing_advance, tvb, &tmp_offset, 0);
+-				
+-				if ((data_offset > 0) && (pdu_end == *end))
+-				{
+-					pdu_end = number_of_pdu_addr + data_offset;
+-				}
+-
+-			}
+-			else if (tlv_id == 0x2025)
+-			{
+-				dissect_rx_indication_rel9_value(tvb, pinfo, tlv_tree, data, &tmp_offset, end);
+-			}
+-
+-
+-			*offset += tlv_len;
+-		}
+-
+-	}
+-
+-	for (i = 0; i < count; ++i)
+-	{
+-		proto_tree_add_uint8_array(tree, hf_nfapi_pdu, lengths[i], tvb, offset);
+-	}
+-
+-	free(lengths);
+-
+-	// more to follow here ??
+-	return 0;
+-
+-}
+-
+-
+-// ----------------------------------------------------------------------------|
+-
+-
+-static int dissect_p45_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset)
+-{
+-	proto_item *p4_p5_header_ti = proto_tree_add_string_format(tree, hf_nfapi_p4_p5_message_header, tvb, *offset, NFAPI_HEADER_LENGTH, "", "P4 P5 Header");
+-	proto_tree *p4_p5_header_tree = proto_item_add_subtree(p4_p5_header_ti, ett_nfapi_p4_p5_message_header);
+-
+-	proto_tree_add_uint16(p4_p5_header_tree, hf_nfapi_p4_p5_message_header_phy_id, tvb, offset, 0);
+-	proto_tree_add_uint16(p4_p5_header_tree, hf_nfapi_p4_p5_message_header_message_id, tvb, offset, 0);
+-	proto_tree_add_uint16(p4_p5_header_tree, hf_nfapi_p4_p5_message_header_message_length, tvb, offset, 0);
+-	proto_tree_add_uint16(p4_p5_header_tree, hf_nfapi_p4_p5_message_header_spare, tvb, offset, 0);
+-
+-	return 0;
+-}
+-
+-static int dissect_p7_header_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset, guint8* m, guint8* seg, guint8* seq)
+-{
+-	proto_item *p7_header_ti = proto_tree_add_string_format(tree, hf_nfapi_p7_message_header, tvb, *offset, NFAPI_P7_HEADER_LENGTH, "", "P7 Header");
+-	proto_tree *p7_header_tree = proto_item_add_subtree(p7_header_ti, ett_nfapi_p7_message_header);
+-
+-	proto_tree_add_uint16(p7_header_tree, hf_nfapi_p7_message_header_phy_id, tvb, offset, 0);
+-	proto_tree_add_uint16(p7_header_tree, hf_nfapi_p7_message_header_message_id, tvb, offset, 0);
+-	proto_tree_add_uint16(p7_header_tree, hf_nfapi_p7_message_header_message_length, tvb, offset, "bytes");
+-
+-	// decoding bits for p7 header
+-
+-	guint8 m_seg = tvb_get_guint8(tvb, *offset);
+-	*m = (m_seg & 0x80) >> 7;
+-	*seg = m_seg & 0x7F;
+-
+-
+-	proto_tree_add_bits_item(p7_header_tree, hf_nfapi_p7_message_header_m, tvb, (*offset) * 8, 1, ENC_NA);
+-	proto_tree_add_bits_item(p7_header_tree, hf_nfapi_p7_message_header_segment, tvb, ((*offset) * 8) + 1, 7, ENC_NA);
+-	*offset += 1;
+-
+-	*seq = tvb_get_guint8(tvb, *offset);
+-	proto_tree_add_uint8(p7_header_tree, hf_nfapi_p7_message_header_sequence_number, tvb, offset, 0);
+-
+-
+-	proto_tree_add_uint32(p7_header_tree, hf_nfapi_p7_message_header_checksum, tvb, offset, 0);
+-	proto_tree_add_uint32(p7_header_tree, hf_nfapi_p7_message_header_transmit_timestamp, tvb, offset, "microseconds");
+-
+-	return 0;
+-
+-}
+-
+-
+-
+-
+-static int dissect_p7_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data, guint* offset)
+-{
+-	proto_item *p7_header_ti = proto_tree_add_string_format(tree, hf_nfapi_p7_message_header, tvb, *offset, NFAPI_P7_HEADER_LENGTH, "", "P7 Header");
+-	proto_tree *p7_header_tree = proto_item_add_subtree(p7_header_ti, ett_nfapi_p7_message_header);
+-
+-	proto_tree_add_uint16(p7_header_tree, hf_nfapi_p7_message_header_phy_id, tvb, offset, 0);
+-	proto_tree_add_uint16(p7_header_tree, hf_nfapi_p7_message_header_message_id, tvb, offset, 0);
+-	proto_tree_add_uint16(p7_header_tree, hf_nfapi_p7_message_header_message_length, tvb, offset, "bytes");
+-
+-
+-	proto_tree_add_bits_item(p7_header_tree, hf_nfapi_p7_message_header_m, tvb, (*offset) * 8, 1, ENC_NA);
+-	proto_tree_add_bits_item(p7_header_tree, hf_nfapi_p7_message_header_segment, tvb, ((*offset) * 8) + 1, 7, ENC_NA);
+-	*offset += 1;
+-
+-	proto_tree_add_uint8(p7_header_tree, hf_nfapi_p7_message_header_sequence_number, tvb, offset, 0);
+-	
+-
+-	proto_tree_add_uint32(p7_header_tree, hf_nfapi_p7_message_header_checksum, tvb, offset, 0);
+-	proto_tree_add_uint32(p7_header_tree, hf_nfapi_p7_message_header_transmit_timestamp, tvb, offset, "microseconds");
+-
+-	return 0;
+-
+-}
+-
+-static reassembly_table ul_p7_reassemble_table;
+-static reassembly_table dl_p7_reassemble_table;
+-
+-
+-
+-static int hf_msg_fragments = -1;
+-static int hf_msg_fragment = -1;
+-static int hf_msg_fragment_overlap = -1;
+-static int hf_msg_fragment_overlap_conflicts = -1;
+-static int hf_msg_fragment_multiple_tails = -1;
+-static int hf_msg_fragment_too_long_fragment = -1;
+-static int hf_msg_fragment_error = -1;
+-static int hf_msg_fragment_count = -1;
+-static int hf_msg_reassembled_in = -1;
+-static int hf_msg_reassembled_length = -1;
+-static int hf_msg_reassembled_data = -1;
+-static gint ett_msg_fragment = -1;
+-static gint ett_msg_fragments = -1;
+-
+-static const fragment_items msg_frag_items = {
+-	/* Fragment subtrees */
+-	&ett_msg_fragment,
+-	&ett_msg_fragments,
+-	/* Fragment fields */
+-	&hf_msg_fragments,
+-	&hf_msg_fragment,
+-	&hf_msg_fragment_overlap,
+-	&hf_msg_fragment_overlap_conflicts,
+-	&hf_msg_fragment_multiple_tails,
+-	&hf_msg_fragment_too_long_fragment,
+-	&hf_msg_fragment_error,
+-	&hf_msg_fragment_count,
+-	/* Reassembled in field */
+-	&hf_msg_reassembled_in,
+-	/* Reassembled length field */
+-	&hf_msg_reassembled_length,
+-	NULL,
+-	/* Tag */
+-	"Message fragments"
+-};
+-
+-static int dissect_nfapi_ul_p7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+-{
+-	guint8 m;
+-	guint8 seg;
+-	guint8 seq;
+-	guint offset = 0;
+-
+-	guint16 msg_id = tvb_get_guint16(tvb, 2, ENC_NA);
+-	guint16 msg_len	= tvb_get_guint16(tvb, 4, ENC_NA);
+-
+-	dissect_p7_header_new(tvb, pinfo, tree, data, &offset, &m, &seg, &seq);
+-	
+-	guint8 save_fragmented = pinfo->fragmented;
+-
+-	// not sure why I need to do this, but if I don't it does not reasses the protocol
+-	pinfo->fd->flags.visited = 0;
+-
+-	if (m == 1 || (m == 0 && seg > 0))
+-	{
+-		pinfo->fragmented = TRUE;
+-
+-		fragment_head *fd_head = fragment_add_seq_check(&ul_p7_reassemble_table, tvb, offset, pinfo, seq, NULL, seg, msg_len - offset, (m == 1));
+-
+-		guint8 reassembled = 0;
+-		if (fd_head)
+-		{
+-			tvbuff_t * new_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled UL P7", fd_head, &msg_frag_items, NULL, tree);
+-
+-			if (new_tvb)
+-			{ 
+-				// set the tvb to the new reassembled buffer.
+-				tvb = new_tvb;
+-				reassembled = 1;
+-				col_append_fstr(pinfo->cinfo, COL_INFO, "[NFAPI P7 Reassembled %d]", seg);
+-
+-				// reset the offset for the new tvb
+-				offset = 0;
+-			}
+-			else
+-			{
+-				// Is this a failure to reassemble the data
+-				return 0;
+-			}
+-		}
+-		else
+-		{
+-			// this is a segement skip the body
+-			col_append_fstr(pinfo->cinfo, COL_INFO, "[NFAPI P7 Segment %d]", seg);
+-			return 0;
+-		}
+-	}
+-		
+-	pinfo->fragmented = save_fragmented;
+-	
+-	{
+-		switch (msg_id)
+-		{
+-			//HARQ.indication
+-			case 0x85: 
+-			{
+-				proto_tree_add_uint16_with_conversion(tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-				dissect_tlv_list(tvb, pinfo, tree, data, &offset, tvb_reported_length(tvb));
+-			}
+-			break;
+-			//CRC.indication
+-			case 0x86:
+-			{
+-				proto_tree_add_uint16_with_conversion(tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-				dissect_tlv_list(tvb, pinfo, tree, data, &offset, tvb_reported_length(tvb));
+-			}
+-			break;
+-			//RX_ULSCH.indication
+-			case 0x87:
+-			{
+-				proto_tree_add_uint16_with_conversion(tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-				dissect_tlv_list(tvb, pinfo, tree, data, &offset, tvb_reported_length(tvb));
+-			}
+-			break;
+-			//RACH.indication
+-			case 0x88:
+-			{
+-				proto_tree_add_uint16_with_conversion(tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-				dissect_tlv_list(tvb, pinfo, tree, data, &offset, tvb_reported_length(tvb));
+-			}
+-			break;
+-			//SRS.indication
+-			case 0x89:
+-			{
+-				proto_tree_add_uint16_with_conversion(tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-				dissect_tlv_list(tvb, pinfo, tree, data, &offset, tvb_reported_length(tvb));
+-			}
+-			break;
+-			//RX_SR.indication
+-			case 0x8A:
+-			{
+-				proto_tree_add_uint16_with_conversion(tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-				dissect_tlv_list(tvb, pinfo, tree, data, &offset, tvb_reported_length(tvb));
+-			}
+-			break;
+-			//RX_CQI.indication
+-			case 0x8B:
+-			{
+-				proto_tree_add_uint16_with_conversion(tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-				dissect_tlv_list(tvb, pinfo, tree, data, &offset, tvb_reported_length(tvb));
+-			}
+-			break;
+-		};
+-	}
+-	
+-	return 0;
+-}
+-
+-static int dissect_nfapi_dl_p7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+-{
+-	guint8 m;
+-	guint8 seg;
+-	guint8 seq;
+-	guint offset = 0;
+-
+-	guint16 msg_id = tvb_get_guint16(tvb, 2, ENC_NA);
+-	guint16 msg_len = tvb_get_guint16(tvb, 4, ENC_NA);
+-
+-	dissect_p7_header_new(tvb, pinfo, tree, data, &offset, &m, &seg, &seq);
+-
+-	guint8 save_fragmented = pinfo->fragmented;
+-
+-	// not sure why I need to do this, but if I don't it does not reasses the protocol
+-	pinfo->fd->flags.visited = 0;
+-
+-	if (m == 1 || (m == 0 && seg > 0))
+-	{
+-		pinfo->fragmented = TRUE;
+-
+-		fragment_head *fd_head = fragment_add_seq_check(&dl_p7_reassemble_table, tvb, offset, pinfo, seq, NULL, seg, msg_len - offset, (m == 1));
+-
+-		guint8 reassembled = 0;
+-		if (fd_head)
+-		{
+-			tvbuff_t * new_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled DL P7", fd_head, &msg_frag_items, NULL, tree);
+-
+-			if (new_tvb)
+-			{
+-				// set the tvb to the new reassembled buffer.
+-				tvb = new_tvb;
+-				reassembled = 1;
+-				col_append_fstr(pinfo->cinfo, COL_INFO, "[NFAPI P7 Reassembled %d]", seg);
+-
+-				// reset the offset for the new tvb
+-				offset = 0;
+-			}
+-			else
+-			{
+-				// Is this a failure to reassemble the data
+-				return 0;
+-			}
+-		}
+-		else
+-		{
+-			// this is a segement skip the body
+-			col_append_fstr(pinfo->cinfo, COL_INFO, "[NFAPI P7 Segment %d]", seg);
+-			return 0;
+-		}
+-	}
+-
+-	pinfo->fragmented = save_fragmented;
+-
+-	{
+-		switch (msg_id)
+-		{
+-			// DL_CONFIG.request
+-			case 0x80:
+-			{
+-				//dissect_p7_header(tvb, pinfo, tree, data, &offset);
+-				proto_tree_add_uint16_with_conversion(tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-				dissect_tlv_list(tvb, pinfo, tree, data, &offset, tvb_reported_length(tvb));
+-				break;
+-			}
+-	
+-		};
+-	}
+-
+-	return 0;
+-}
+-
+-
+-static int dissect_nfapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+-{
+-	col_set_str(pinfo->cinfo, COL_PROTOCOL, "NFAPI");
+-
+-	guint16 msg_id = tvb_get_guint16(tvb, 2, ENC_NA);
+-	guint16 msg_len = tvb_get_guint16(tvb, 4, ENC_NA);
+-
+-	const gchar* message_str = val_to_str_const(msg_id, message_id_vals, "Unknown");
+-
+-	col_clear(pinfo->cinfo,COL_INFO);
+-	col_append_fstr(pinfo->cinfo, COL_INFO, " %s ", message_str);
+-
+-	proto_item *msg_tree_ti = proto_tree_add_string_format(tree, hf_nfapi_message_tree,
+-															tvb, 0, msg_len,
+-															"", message_str);
+-
+-	proto_tree *msg_tree = proto_item_add_subtree(msg_tree_ti, ett_nfapi_message_tree);
+-
+-	guint offset = 0;
+-
+-
+-	switch (msg_id)
+-	{
+-		// HARQ.indication
+-		case 0x85:
+-		// CRC.indication
+-		case 0x86:
+-		// RX_ULSCH.indicatoin
+-		case 0x87:
+-		// RACH.indication
+-		case 0x88:
+-		// SRS.indication
+-		case 0x89:
+-		// RX_SR.indication
+-		case 0x8A:
+-		// RX_CQI.indication
+-		case 0x8B:
+-		{
+-			dissect_nfapi_ul_p7(tvb, pinfo, msg_tree, data);
+-		}
+-		break;
+-
+-		// DL_CONFIG.request
+-		case 0x80:
+-		{
+-			dissect_nfapi_dl_p7(tvb, pinfo, msg_tree, data);
+-			//dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			//proto_tree_add_uint16_with_conversion(msg_tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-			//dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
+-		}
+-	
+-		// UL_CONFIG.request
+-		case 0x81:
+-		{
+-			dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint16_with_conversion(msg_tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-		}
+-		break;
+-		// HI_DCI0.request
+-		case 0x83:
+-		{
+-			dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint16_with_conversion(msg_tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-		}
+-		break;
+-		// TX.request
+-		case 0x84:
+-		{
+-			dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint16_with_conversion(msg_tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-		}
+-		break;
+-
+-		// LBT_DL_CONFIG.request
+-		case 0x8C:
+-		{
+-			dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint16_with_conversion(msg_tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-		}
++#define NFAPI_P7_HEADER_LENGTH 16
++
++static const unit_name_string khz_100_units_db = { " (100)khz", NULL };
++
++typedef enum{
++	NFAPI_DL_CONFIG_REQUEST_MSG_ID = 0x0080,
++	NFAPI_UL_CONFIG_REQUEST_MSG_ID,
++	NFAPI_SUBFRAME_INDICATION_MSG_ID,
++	NFAPI_HI_DCI0_REQUEST_MSG_ID,
++	NFAPI_TX_REQUEST_MSG_ID,
++	NFAPI_HARQ_INDICATION_MSG_ID,
++	NFAPI_CRC_INDICATION_MSG_ID,
++	NFAPI_RX_ULSCH_INDICATION_MSG_ID,
++	NFAPI_RACH_INDICATION_MSG_ID,
++	NFAPI_SRS_INDICATION_MSG_ID,
++	NFAPI_RX_SR_INDICATION_MSG_ID,
++	NFAPI_RX_CQI_INDICATION_MSG_ID,
++	NFAPI_LBT_DL_CONFIG_REQUEST_MSG_ID,
++	NFAPI_LBT_DL_INDICATION_MSG_ID,
++
++	NFAPI_PNF_PARAM_REQUEST_MSG_ID = 0x0100,
++	NFAPI_PNF_PARAM_RESPONSE_MSG_ID,
++	NFAPI_PNF_CONFIG_REQUEST_MSG_ID,
++	NFAPI_PNF_CONFIG_RESPONSE_MSG_ID,
++	NFAPI_PNF_START_REQUEST_MSG_ID,
++	NFAPI_PNF_START_RESPONSE_MSG_ID,
++	NFAPI_PNF_STOP_REQUEST_MSG_ID,
++	NFAPI_PNF_STOP_RESPONSE_MSG_ID,
++	NFAPI_PARAM_REQUEST_MSG_ID,
++	NFAPI_PARAM_RESPONSE_MSG_ID,
++	NFAPI_CONFIG_REQUEST_MSG_ID,
++	NFAPI_CONFIG_RESPONSE_MSG_ID,
++	NFAPI_START_REQUEST_MSG_ID,
++	NFAPI_START_RESPONSE_MSG_ID,
++	NFAPI_STOP_REQUEST_MSG_ID,
++	NFAPI_STOP_RESPONSE_MSG_ID,
++	NFAPI_MEASUREMENT_REQUEST_MSG_ID,
++	NFAPI_MEASUREMENT_RESPONSE_MSG_ID,
++
++	NFAPI_DL_NODE_SYNC_MSG_ID = 0x0180,
++	NFAPI_UL_NODE_SYNC_MSG_ID,
++	NFAPI_TIMING_INFO_MSG_ID,
++
++	NFAPI_RSSI_REQUEST_MSG_ID = 0x0200,
++	NFAPI_RSSI_RESPONSE_MSG_ID,
++	NFAPI_RSSI_INDICATION_MSG_ID,
++	NFAPI_CELL_SEARCH_REQUEST_MSG_ID,
++	NFAPI_CELL_SEARCH_RESPONSE_MSG_ID,
++	NFAPI_CELL_SEARCH_INDICATION_MSG_ID,
++	NFAPI_BROADCAST_DETECT_REQUEST_MSG_ID,
++	NFAPI_BROADCAST_DETECT_RESPONSE_MSG_ID,
++	NFAPI_BROADCAST_DETECT_INDICATION_MSG_ID,
++	NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST_MSG_ID,
++	NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE_MSG_ID,
++	NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION_MSG_ID,
++	NFAPI_SYSTEM_INFORMATION_REQUEST_MSG_ID,
++	NFAPI_SYSTEM_INFORMATION_RESPONSE_MSG_ID,
++	NFAPI_SYSTEM_INFORMATION_INDICATION_MSG_ID,
++	NFAPI_NMM_STOP_REQUEST_MSG_ID,
++	NFAPI_NMM_STOP_RESPONSE_MSG_ID,
++} nfapi_message_id_e;
++
++static const value_string nfapi_error_vals[] = {
++	{ 0x0, "MSG_OK" },
++	{ 0x1, "MSG_INVALID_STATE" },
++	{ 0x2, "MSG_INVALID_CONFIG" },
++	{ 0x3, "SFN_OUT_OF_SYNC" },
++	{ 0x4, "MSG_SUBFRAME_ERR" },
++	{ 0x5, "MSG_BCH_MISSING" },
++	{ 0x6, "MSG_BCH_MISSING" },
++	{ 0x7, "MSG_HI_ERR" },
++	{ 0x8, "MSG_TX_ERR" },
++	{ 0, NULL },
++};
++
++static const value_string nfapi_p4_error_vals[] = {
++	{ 100, "MSG_OK" },
++	{ 101, "MSG_INVALID_STATE" },
++	{ 102, "MSG_INVALID_CONFIG" },
++	{ 103, "MSG_RAT_NOT_SUPPORTED" },
++	{ 200, "MSG_NMM_STOP_OK" },
++	{ 201, "MSG_NMM_STOP_IGNORED" },
++	{ 202, "MSG_NMM_STOP_INVALID_STATE" },
++	{ 300, "MSG_PROCEDURE_COMPLETE" },
++	{ 301, "MSG_PROCEDURE_STOPPED" },
++	{ 302, "MSG_PARTIAL_RESULTS" },
++	{ 303, "MSG_TIMEOUT" },
++	{ 0, NULL },
++};
++
++static const value_string nfapi_rat_type_vals[] = {
++	{ 0, "LTE" },
++	{ 1, "UTRAN" },
++	{ 2, "GERAN" },
++	{ 0, NULL },
++};
++
++typedef enum{
++	UN_ALIGNED_SYNCHRONIZATION = 0,
++	INTERNAL_PNF_FRAME_ALIGNMENT,
++	ABSOLUTE_TIME_ALIGNED_SYNCHRONIZATION
++} nfapi_sync_mode_e;
++
++static const value_string nfapi_sync_mode_vals[] = {
++	{ UN_ALIGNED_SYNCHRONIZATION, "UN-ALIGNED SYNCHRONIZATION" },
++	{ INTERNAL_PNF_FRAME_ALIGNMENT, "INTERNAL PNF FRAME ALIGNMENT" },
++	{ ABSOLUTE_TIME_ALIGNED_SYNCHRONIZATION, "ABSOLUTE TIME ALIGNED SYNCHRONIZATION" },
++	{ 0, NULL },
++};
++
++typedef enum {
++	NONE = 0,
++	GPS,
++	GLONASS,
++	BEIDOU
++} location_mode_e;
++
++static const value_string location_mode_vals[] = {
++	{ NONE, "NONE" },
++	{ GPS, "GPS" },
++	{ GLONASS, "GLONASS" },
++	{ BEIDOU, "BeiDou" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_uplink_rs_hopping_vals[] = {
++	{ 0, "RS_NO_HOPPING" },
++	{ 1, "RS_GROUP_HOPPING" },
++	{ 2, "RS_SEQUENCE_HOPPING" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_laa_carrier_type_vals[] = {
++	{ 0, "No multi carrier support" },
++	{ 1, "Mode A1" },
++	{ 2, "Mode A12" },
++	{ 3, "Mode B1" },
++	{ 4, "Mode B2" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_mutli_carrier_lbt_support_vals[] = {
++	{ 0, "Multi carrier Mode A1" },
++	{ 1, "Multi carrier Mode A2" },
++	{ 2, "Multi carrier Mode B1" },
++	{ 3, "Multi carrier Mode B2" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_lbt_dl_req_pdu_type[] = {
++	{ 0, "LBT_PDSCH_REQ PDU" },
++	{ 1, "LBT_DRS_REQ PDU" },
++	{ 0, NULL }
++};
++
++
++static const value_string nfapi_lbt_dl_ind_pdu_type[] = {
++	{ 0, "LBT_PDSCH_RSP PDU" },
++	{ 1, "LBT_DRS_RSP PDU" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_phy_state_vals[] = {
++	{ 0, "IDLE" },
++	{ 1, "CONFIGURED" },
++	{ 2, "RUNNING" },
++	{ 0, NULL },
++};
++
++
++/* These are definitions where data 0 & 1 represent/provide a string name*/
++static const true_false_string  nfapi_csi_report_type_strname = {
++	"Periodic",
++	"Aperiodic",
++};
++
++static const true_false_string nfapi_control_type_string_name = {
++	"CQI/PMI",
++	"RI",
++};
++
++static const true_false_string cyclic_prefix_type_strname = {
++	"CP_NORMAL",
++	"CP_EXTENDED"
++};
++
++static const true_false_string support_strname = {
++	"No Support",
++	"Support"
++};
++
++static const true_false_string partial_sf_support_strname =
++{
++	"Start partial SF support",
++	"End partial SF support"
++};
++
++static const true_false_string phich_duration_strname = {
++	"PHICH_D_NORMAL",
++	"PHICH_D_EXTENDED"
++};
++
++static const true_false_string high_speed_flag_strname = {
++	"HS_UNRESTRICTED_SET",
++	"HS_RESTRICTED_SET"
++};
++
++static const true_false_string hopping_mode_strname = {
++	"HM_INTER_SF",
++	"HM_INTRA_INTER_SF"
++};
++
++static const true_false_string srs_simult_tx_strname = {
++	"No Simultaneous Transmission",
++	"Simultaneous Transmission"
++};
++
++static const true_false_string crc_flag_strname = {
++	"CRC_ERROR",
++	"CRC_CORRECT"
++};
++
++static const true_false_string hi_value_strname = {
++	"HI_ACK",
++	"HI_NACK"
++};
++
++static const true_false_string flag_tb2_strname = {
++	"HI_NOT_PRESENT",
++	"HI_PRESENT"
++};
++
++static const true_false_string nfapi_multi_carrier_tx_strname = {
++	"Mutual transmission (self-deferral support for current carrier)",
++	"Transmit on channel access win (no self-deferral)"
++};
++
++static const true_false_string nfapi_multi_carrier_freeze_strname = {
++	"Absence of other technology is not guaranteed",
++	"Absence of other technology is guaranteed"
++};
++
++static const true_false_string initial_partial_sf_strname = {
++	"Full SF",
++	"Partial SF"
++};
++
++static const true_false_string lbt_mode_strname = {
++	"Full LBT",
++	"Partial LBT"
++};
++
++static const true_false_string data_report_mode_vals = {
++	"Crc reported in CRC.indication",
++	"Crc reported in RX.indication"
++};
++
++static const true_false_string mcch_flag_string_name = {
++	"MCCH or SC-MCCH change notification field is not valid",
++	"MCCH or SC-MCCH change notification field is valid"
++};
++
++static const true_false_string cross_carrier_scheduling_flag_strname = {
++	"Carrier indicator field is not valid",
++	"Carrier indicator field is valid"
++};
++
++static const true_false_string srs_flag_strname = {
++	"SRS request field is not valid",
++	"SRS request field is valid"
++};
++static const true_false_string srs_request_strname = {
++	"SRS not requested",
++	"SRS requested"
++};
++
++static const true_false_string ul_dl_configuration_flag_strname = {
++	"UL/DL configuration field is not valid",
++	"UL/DL configuration field is valid"
++};
++
++static const true_false_string prs_cyclic_prefix_type_strname = {
++	"normal cyclic prefix",
++	"extended cyclic prefix"
++};
++
++static const true_false_string prs_muting_strname = {
++	"no muting",
++	"muting"
++};
++
++
++static const value_string nfapi_dl_config_pdu_type_vals[] = {
++	{ 0, "DL_CONFIG_DCI_DL_PDU" },
++	{ 1, "DL_CONFIG_BCH_PDU" },
++	{ 2, "DL_CONFIG_MCH_PDU" },
++	{ 3, "DL_CONFIG_DLSCH_PDU" },
++	{ 4, "DL_CONFIG_PCH_PDU" },
++	{ 5, "DL_CONFIG_PRS_PDU" },
++	{ 6, "DL_CONFIG_CSI_RS_PDU" },
++	{ 7, "DL_CONFIG_EPDCCH_DL_PDU" },
++	{ 8, "DL_CONFIG_EPDCCH_DL_PDU" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_duplex_mode_vals[] = {
++	{ 0, "TDD" },
++	{ 1, "FDD" },
++	{ 2, "HD-FDD" },
++	{ 0, NULL }
++};
++
++static const value_string modulation_vals[] = {
++	{ 2, "QPSK" },
++	{ 4, "16QAM" },
++	{ 6, "64QAM" },
++	{ 8, "256QAM" },
++	{ 0, NULL }
++};
++
++static const value_string pch_modulation_vals[] = {
++	{ 0, "QPSK" },
++	{ 0, NULL }
++};
++
++static const value_string ue_mode_vals[] = {
++	{ 0, "non LC/CE UE" },
++	{ 1, "LC/CE UE" },
++	{ 0, NULL }
++};
++
++static const value_string csi_rs_class_vals[] = {
++	{ 0, "not used" },
++	{ 1, "Class A" },
++	{ 1, "Class B" },
++	{ 0, NULL }
++};
++
++static const value_string csi_rs_cdm_type_vals[] = {
++	{ 0, "cdm 2" },
++	{ 1, "cdm 4" },
++	{ 0, NULL }
++};
++
++static const value_string antenna_ports_vals[] = {
++	{ 0, "1 antenna ports" },
++	{ 1, "2 antenna ports" },
++	{ 2, "4 antenna ports" },
++	{ 0, NULL }
++};
++
++static const value_string combs_vals[] = {
++	{ 0, "2 TC" },
++	{ 1, "4 TC" },
++	{ 0, NULL }
++};
++
++static const value_string resource_allocation_type_vals[] = {
++	{ 0, "type 0" },
++	{ 1, "type 1" },
++	{ 2, "type 2 1A/1B/1D" },
++	{ 3, "type 2 1C" },
++	{ 4, "type 2 6-1A" },
++	{ 5, "type UEModeB" },
++	{ 6, "NB index" },
++	{ 0, NULL }
++};
++
++static const value_string transmission_scheme_vals[] = {
++	{ 0, "SINGLE_ANTENNA_PORT_0" },
++	{ 1, "TX_DIVERSITY" },
++	{ 2, "LARGE_DELAY_CDD" },
++	{ 3, "CLOSED_LOOP_SPATIAL_MULTIPLEXING" },
++	{ 4, "MULTI_USER_MIMO" },
++	{ 5, "CLOSED_LOOP_RANK_1_PRECODING" },
++	{ 6, "SINGLE_ANTENNA_PORT_5" },
++	{ 7, "SINGLE_ANTENNA_PORT_7" },
++	{ 8, "SINGLE_ANTENNA_PORT_8" },
++	{ 9, "DUAL_LAYER_TX_PORT_7_AND_8" },
++	{ 10, "UP_TO_8_LAYER_TX" },
++	{ 11, "SINGLE_ANTENNA_PORT_11" },
++	{ 12, "SINGLE_ANTENNA_PORT_13" },
++	{ 13, "DUAL_LAYER_TX_PORT_11_13" },
++	{ 0, NULL }
++};
++
++static const value_string ul_transmission_scheme_vals[] = {
++	{ 0, "SINGLE_ANTENNA_PORT_10" },
++	{ 1, "CLOSED_LOOP_SPATIAL_MULTIPLEXING" },
++	{ 0, NULL },
++};
++
++static const value_string dl_dci_format_vals[] = {
++	{ 0, "1" },
++	{ 1, "1A" },
++	{ 2, "1B" },
++	{ 3, "1C" },
++	{ 4, "1D" },
++	{ 5, "2" },
++	{ 6, "2A" },
++	{ 7, "2B" },
++	{ 8, "2C" },
++	{ 9, "2D" },
++	{ 10, "6-1A" },
++	{ 11, "6-1B" },
++	{ 12, "6-2" },
++	{ 0, NULL }
++};
++
++static const value_string ul_dci_format_vals[] = {
++	{ 0, "0" },
++	{ 1, "3" },
++	{ 2, "3A" },
++	{ 3, "4" },
++	{ 4, "5" },
++	{ 0, NULL }
++};
++
++static const value_string mpdcch_ul_dci_format_vals[] = {
++	{ 1, "3" },
++	{ 2, "3A" },
++	{ 4, "6-0A" },
++	{ 5, "6-0B" },
++	{ 0, NULL }
++};
++
++
++static const value_string pa_vals[] = {
++	{ 0, "-6dB" },
++	{ 1, "-4.77dB" },
++	{ 2, "-3dB" },
++	{ 3, "-1.77dB" },
++	{ 4, "0dB" },
++	{ 5, "1dB" },
++	{ 6, "2dB" },
++	{ 7, "3dB" },
++	{ 0, NULL }
++};
++
++static const value_string transmission_mode_vals[] = {
++	{ 1, "Mode 1" },
++	{ 2, "Mode 2" },
++	{ 3, "Mode 3" },
++	{ 4, "Mode 4" },
++	{ 5, "Mode 5" },
++	{ 6, "Mode 6" },
++	{ 7, "Mode 7" },
++	{ 8, "Mode 8" },
++	{ 9, "Mode 9" },
++	{ 10, "Mode 10" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_ul_config_pdu_type_vals[] = {
++	{ 0, "ULSCH" },
++	{ 1, "ULSCH_CQI_RI" },
++	{ 2, "ULSCH_HARQ" },
++	{ 3, "ULSCH_CQI_HARQ_RI" },
++	{ 4, "UCI_CQI" },
++	{ 5, "UCI_SR" },
++	{ 6, "UCI_HARQ" },
++	{ 7, "UCI_SR_HARQ" },
++	{ 8, "UCI_CQI_HARQ" },
++	{ 9, "UCI_CQI_SR" },
++	{ 10, "UCI_CQI_SR_HARQ" },
++	{ 11, "SRS" },
++	{ 12, "HARQ_BUFFER" },
++	{ 13, "ULSCH_UCI_CSI" },
++	{ 14, "ULSCH_UCI_HARQ" },
++	{ 15, "ULSCH_CSI_UCI_HARQ" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_tdd_ack_nack_mode_vals[] = {
++	{ 0, "Bundling" },
++	{ 1, "Multiplexing" },
++	{ 2, "Format 1b with channel selection" },
++	{ 3, "Format 3" },
++	{ 4, "Format 4" },
++	{ 5, "Format 5" },
++	{ 0, NULL }
++};
++static const value_string nfapi_fdd_ack_nack_mode_vals[] = {
++	{ 0, "Format 1a/1b" },
++	{ 1, "Channel selection" },
++	{ 2, "Format 3" },
++	{ 3, "Format 4" },
++	{ 4, "Format 5" },
++	{ 0, NULL }
++};
++
++static const value_string nfapi_phich_resource_vals[] = {
++	{ 0, "PHICH_R_ONE_SIXTH " },
++	{ 1, "PHICH_R_HALF" },
++	{ 2, "PHICH_R_ONE" },
++	{ 3, "PHICH_R_TWO" },
++	{ 0, NULL }
++};
++
++static const value_string local_distributed_vals[] = {
++	{ 0, "localized" },
++	{ 1, "distributed" },
++	{ 0, NULL }
++};
++
++static const value_string transport_block_to_codeword_swap_flag_vals[] = {
++	{ 0, "no swapping" },
++	{ 1, "swapped" },
++	{ 0, NULL }
++};
++
++static const value_string ngap_vals[] = {
++	{ 0, "Ngap1" },
++	{ 1, "Ngap2" },
++	{ 0, NULL }
++};
++
++static const value_string pmi_vals[] = {
++	{ 0, "Use precoding indicated in TPMI field" },
++	{ 1, "Use precoding indicated in last PMI report on PUSCH" },
++	{ 2, "use precoding indicated in TPM field" },
++	{ 0, NULL }
++};
++
++static const value_string true_false_vals[] = {
++	{ 0, "false" },
++	{ 1, "true" },
++	{ 0, NULL }
++};
++
++static const value_string exhustive_search_vals[] = {
++	{ 0, "non-exhaustive search" },
++	{ 1, "exhaustive search" },
++	{ 0, NULL }
++};
++
++static const value_string not_used_enabled_vals[] = {
++	{ 0, "not used" },
++	{ 1, "enabled" },
++	{ 0, NULL }
++};
++
++static const value_string hopping_vals[] = {
++	{ 0, "no hopping" },
++	{ 1, "hopping enabled" },
++	{ 0, NULL }
++};
++
++
++static const value_string mpdcch_rnti_type_vals[] = {
++	{ 1, "Temporary C-RNTI" },
++	{ 2, "RA-RNTI" },
++	{ 3, "P-RNTI" },
++	{ 4, "other" },
++	{ 0, NULL }
++};
++
++static const value_string rnti_type_vals[] = {
++	{ 1, "C-RNTI" },
++	{ 2, "RA-RNTI, P-RNTI, SI-RNTI, SC-RNTI, G-RNTI" },
++	{ 3, "SPS-CRNTI" },
++	{ 0, NULL }
++};
++
++static const value_string primary_cells_type_vals[] = {
++	{ 1, "TDD" },
++	{ 2, "FDD" },
++	{ 3, "HD_FDD" },
++	{ 0, NULL }
++};
++
++static const value_string ul_rssi_supported_vals[] = {
++	{ 0, "Uplink RSSI not supported" },
++	{ 1, "Uplink RSSI supported" },
++	{ 0, NULL }
++};
++
++static const value_string nprb_vals[] = {
++	{ 0, "2" },
++	{ 1, "3" },
++	{ 0, NULL }
++};
++
++static const value_string nmm_modes_supported_vals[] =
++{
++	{ 0, "NONE" },
++	{ 1, "NMM_ONLY" },
++	{ 2, "NMM_IN_CONFIGURED_STATE" },
++	{ 3, "NMM_IN_RUNNING_STATE" },
++	{ 4, "NMM_IN_CONFIGURED_AND_RUNNING_STATE" },
++	{ 0, NULL }
++};
++
++static const value_string dlsch_re13_ue_type_vals[] = {
++	{ 0, "non LC/CE UE" },
++	{ 1, "LC/CE CEModeA UE" },
++	{ 2, "LC/CE CEModeB UE" },
++	{ 0, NULL }
++};
++
++static const value_string dlsch_re13_pdsch_payload_type_vals[] = {
++	{ 0, "PDSCH carrying SIB1-BR " },
++	{ 1, "PDSCH carrying SI message (except for SIB1-BR or PCH)" },
++	{ 2, "PDSCH carrying other" },
++	{ 0, NULL }
++};
++
++static const value_string csi_rs_flags_strname[] = {
++	{ 0, "CSI - RS parameters are not valid" },
++	{ 1, "CSI - RS parameters are valid" },
++	{ 0, NULL}
++};
++
++
++static const value_string paging_direct_indication_differtiation_flag_vals[] = {
++	{ 0, "Direct Information" },
++	{ 1, "Paging" },
++	{ 0, NULL }
++};
++
++static const value_string ul_tx_mode_vals[] = {
++	{ 0, "SISO/MIMO" },
++	{ 1, "MIMO" },
++	{ 0, NULL }
++};
++
++static const value_string n_srs_vals[] = {
++	{ 0, "No overlap" },
++	{ 1, "Overlap" },
++	{ 0, NULL }
++};
++
++static const value_string n_srs_initial_vals[] = {
++	{ 0, "Last OFDM symbol is not punctured" },
++	{ 1, "Last OFDM symbol is punctured." },
++	{ 0, NULL }
++};
++
++
++static const value_string csi_mode_vals[] = {
++	{ 0, "PUCCH format 2/2a/2b/3" },
++	{ 1, "PUCCH format 4" },
++	{ 2, "PUCCH format 5" },
++	{ 0, NULL }
++};
++
++static const value_string hi_dci0_pdu_type_vals[] = {
++	{ 0, "HI" },
++	{ 1, "DCI UL" },
++	{ 2, "EDPCCH DCI UL" },
++	{ 3, "MDPCCH DCI UL" },
++	{ 0, NULL }
++};
++
++static const value_string ue_tx_antenna_selection_vals[] = {
++	{ 0, "Not Configured" },
++	{ 1, "Configured and using UE port 0" },
++	{ 2, "Configured and using UE port 1" },
++	{ 0, NULL }
++};
++
++static const value_string size_of_cqi_csi_feild_vals[] = {
++	{ 0, "1 bit" },
++	{ 1, "2 bits" },
++	{ 2, "3 bits" },
++	{ 0, NULL }
++};
++
++static const value_string number_of_antenna_port_vals[] = {
++	{ 0, "1 antenna port" },
++	{ 1, "2 antenna ports" },
++	{ 2, "4 antenna ports" },
++	{ 0, NULL }
++};
++
++static const value_string ce_mode_vals[] = {
++	{ 1, "CEModeA" },
++	{ 2, "CEModeB" },
++	{ 0, NULL }
++};
++
++
++static const value_string csi_request_vals[] = {
++	{ 0, "Aperiodic CSI not requested" },
++	{ 1, "Aperiodic CSI requested" },
++	{ 0, NULL }
++};
++
++static const value_string tdd_harq_mode_vals[] = {
++	{ 0, "Format 1a/1b BUNDLING" },
++	{ 1, "Format 1a/1b MULTIPLEXING" },
++	{ 2, "Format 1a/1b  SPECIAL BUNDLING" },
++	{ 3, "Channel Selection" },
++	{ 4, "Format 3" },
++	{ 5, "Format 4" },
++	{ 6, "Format 5" },
++	{ 0, NULL }
++};
++
++static const value_string fdd_harq_mode_vals[] = {
++	{ 0, "Format 1a/1b" },
++	{ 1, "Channel Selection" },
++	{ 2, "Format 3" },
++	{ 3, "Format 4" },
++	{ 4, "Format 5" },
++	{ 0, NULL }
++};
++
++static const value_string harq_value_vals[] = {
++	{ 1, "ACK" },
++	{ 2, "NACK" },
++	{ 3, "ACK or NACK" },
++	{ 4, "DTX" },
++	{ 5, "ACK or DTX" },
++	{ 6, "NACK or DTX" },
++	{ 7, "ACK or NACK or DTX" },
++	{ 0, NULL }
++};
++
++
++static const value_string harq_special_value_vals[] = {
++	{ 0, "0 or None" },
++	{ 1, "1 or 4 or 7 ACKs reported" },
++	{ 2, "2 or 5 or 8 ACKs reported" },
++	{ 3, "3 or 6 or 9 ACKs reported" },
++	{ 4, "DTX (UE did not transmit anything)" },
++	{ 0, NULL }
++};
++
++static const value_string channel_vals[] = {
++	{ 0, "PUCCH" },
++	{ 1, "PUSCH" },
++	{ 0, NULL }
++};
++
++static const value_string rach_resource_type_vals[] = {
++	{ 0, "Non LC / CE RACH" },
++	{ 1, "LC / CE RACH CE level 0" },
++	{ 2, "LC / CE RACH CE level 1" },
++	{ 3, "LC / CE RACH CE level 2" },
++	{ 4, "LC / CE RACH CE level 3" },
++	{ 0, NULL }
++};
++
++static const value_string up_pts_symbol_vals[] = {
++	{ 0, "Symbol 0" },
++	{ 1, "Symbol 1" },
++	{ 0, NULL }
++};
++
++static const value_string arfcn_direction_vals[] = {
++	{ 0, "DL" },
++	{ 1, "UL" },
++	{ 0, NULL }
++};
++
++static int proto_nfapi = -1;
++
++/* These are for the subtrees */
++static gint ett_nfapi_message_tree = -1;
++static gint ett_nfapi_p4_p5_message_header = -1;
++static gint ett_nfapi_p7_message_header = -1;
++static gint ett_nfapi_tlv_tree = -1;
++static gint ett_nfapi_tl = -1;
++static gint ett_nfapi_pnf_phy = -1;
++static gint ett_nfapi_pnf_phy_rel10 = -1;
++static gint ett_nfapi_pnf_phy_rel11 = -1;
++static gint ett_nfapi_pnf_phy_rel12 = -1;
++static gint ett_nfapi_pnf_phy_rel13 = -1;
++static gint ett_nfapi_pnf_phy_rf_config = -1;
++static gint ett_nfapi_rf_bands = -1;
++static gint ett_nfapi_tx_antenna_ports = -1;
++static gint ett_nfapi_harq_ack_nack_data = -1;
++static gint ett_nfapi_harq_data = -1;
++static gint ett_nfapi_cqi_pmi_size = -1;
++static gint ett_nfapi_cc = -1;
++static gint ett_nfapi_rbs = -1;
++static gint ett_nfapi_antennas = -1;
++static gint ett_nfapi_dl_config_request_pdu_list = -1;
++static gint ett_nfapi_ul_config_request_pdu_list = -1;
++static gint ett_nfapi_hi_dci0_request_pdu_list = -1;
++static gint ett_nfapi_tx_request_pdu_list = -1;
++static gint ett_nfapi_rx_indication_pdu_list = -1;
++static gint ett_nfapi_harq_indication_pdu_list = -1;
++static gint ett_nfapi_crc_indication_pdu_list = -1;
++static gint ett_nfapi_sr_indication_pdu_list = -1;
++static gint ett_nfapi_cqi_indication_pdu_list = -1;
++static gint ett_nfapi_preamble_indication_pdu_list = -1;
++static gint ett_nfapi_srs_indication_pdu_list = -1;
++static gint ett_nfapi_lbt_dl_config_pdu_list = -1;
++static gint ett_nfapi_lbt_dl_indication_pdu_list = -1;
++static gint ett_nfapi_subbands = -1;
++static gint ett_nfapi_bf_vector_antennas = -1;
++static gint ett_nfapi_bf_vectors = -1;
++static gint ett_nfapi_csi_rs_resource_configs = -1;
++static gint ett_nfapi_csi_rs_bf_vector = -1;
++static gint ett_nfapi_epdcch_prbs = -1;
++static gint ett_nfapi_precoding = -1;
++static gint ett_nfapi_earfcn_list = -1;
++static gint ett_nfapi_uarfcn_list = -1;
++static gint ett_nfapi_arfcn_list = -1;
++static gint ett_nfapi_rssi_list = -1;
++static gint ett_nfapi_pci_list = -1;
++static gint ett_nfapi_psc_list = -1;
++static gint ett_nfapi_lte_cells_found_list = -1;
++static gint ett_nfapi_utran_cells_found_list = -1;
++static gint ett_nfapi_geran_cells_found_list = -1;
++static gint ett_nfapi_si_periodicity_list = -1;
++static gint ett_nfapi_downlink_bandwidth_support = -1;
++static gint ett_nfapi_uplink_bandwidth_support = -1;
++static gint ett_nfapi_downlink_modulation_support = -1;
++static gint ett_nfapi_uplink_modulation_support = -1;
++static gint ett_nfapi_received_interference_power_mesurement_results = -1;
++static gint ett_nfapi_release_support = -1;
++static expert_field ei_invalid_range = EI_INIT;
++static expert_field ei_invalid_tlv_length = EI_INIT;
++
++static int hf_nfapi_p4_p5_message_header_phy_id = -1;
++static int hf_nfapi_p4_p5_message_header_message_id = -1;
++static int hf_nfapi_p4_p5_message_header_message_length = -1;
++static int hf_nfapi_p4_p5_message_header_spare = -1;
++static int hf_nfapi_p7_message_header_phy_id = -1;
++static int hf_nfapi_p7_message_header_message_id = -1;
++static int hf_nfapi_p7_message_header_message_length = -1;
++static int hf_nfapi_p7_message_header_m = -1;
++static int hf_nfapi_p7_message_header_segment = -1;
++static int hf_nfapi_p7_message_header_sequence_number = -1;
++static int hf_nfapi_p7_message_header_checksum = -1;
++static int hf_nfapi_p7_message_header_transmit_timestamp = -1;
++static int hf_nfapi_tl_tag = -1;
++static int hf_nfapi_tl_length = -1;
++static int hf_nfapi_sync_mode = -1;
++static int hf_nfapi_location_mode = -1;
++static int hf_nfapi_location_coordinates = -1;
++static int hf_nfapi_location_coordinates_length = -1;
++static int hf_nfapi_dl_config_timing = -1;
++static int hf_nfapi_tx_timing = -1;
++static int hf_nfapi_ul_config_timing = -1;
++static int hf_nfapi_hi_dci0_timing = -1;
++static int hf_nfapi_maximum_number_phys = -1;
++static int hf_nfapi_maximum_total_bandwidth = -1;
++static int hf_nfapi_maximum_total_number_dl_layers = -1;
++static int hf_nfapi_maximum_total_number_ul_layers = -1;
++static int hf_nfapi_shared_bands = -1;
++static int hf_nfapi_shared_pa = -1;
++static int hf_nfapi_maximum_total_power = -1;
++static int hf_nfapi_oui = -1;
++static int hf_nfapi_pdu = -1;
++static int hf_nfapi_pnf_phy_number_phy = -1;
++static int hf_nfapi_pnf_phy_config_index = -1;
++static int hf_nfapi_number_of_rf_exclusions = -1;
++static int hf_nfapi_dl_bandwidth_support = -1;
++static int hf_nfapi_dl_bandwidth_support_6 = -1;
++static int hf_nfapi_dl_bandwidth_support_15 = -1;
++static int hf_nfapi_dl_bandwidth_support_25 = -1;
++static int hf_nfapi_dl_bandwidth_support_50 = -1;
++static int hf_nfapi_dl_bandwidth_support_75 = -1;
++static int hf_nfapi_dl_bandwidth_support_100 = -1;
++static int hf_nfapi_ul_bandwidth_support = -1;
++static int hf_nfapi_ul_bandwidth_support_6 = -1;
++static int hf_nfapi_ul_bandwidth_support_15= -1;
++static int hf_nfapi_ul_bandwidth_support_25 = -1;
++static int hf_nfapi_ul_bandwidth_support_50 = -1;
++static int hf_nfapi_ul_bandwidth_support_75 = -1;
++static int hf_nfapi_ul_bandwidth_support_100 = -1;
++static int hf_nfapi_downlink_channel_bandwidth_supported = -1;
++static int hf_nfapi_uplink_channel_bandwidth_supported = -1;
++static int hf_nfapi_number_of_dl_layers_supported = -1;
++static int hf_nfapi_number_of_ul_layers_supported = -1;
++static int hf_nfapi_maximum_3gpp_release_supported = -1;
++static int hf_nfapi_maximum_3gpp_release_supported_rel8 = -1;
++static int hf_nfapi_maximum_3gpp_release_supported_rel9 = -1;
++static int hf_nfapi_maximum_3gpp_release_supported_rel10 = -1;
++static int hf_nfapi_maximum_3gpp_release_supported_rel11 = -1;
++static int hf_nfapi_maximum_3gpp_release_supported_rel12 = -1;
++static int hf_nfapi_maximum_3gpp_release_supported_rel13 = -1;
++static int hf_nfapi_nmm_modes_supported = -1;
++static int hf_nfapi_number_of_rfs = -1;
++static int hf_nfapi_rf_config_index = -1;
++static int hf_nfapi_band = -1;
++static int hf_nfapi_maximum_transmit_power = -1;
++static int hf_nfapi_maximum_transmit_power_2 = -1;
++static int hf_nfapi_earfcn = -1;
++static int hf_nfapi_minimum_transmit_power = -1;
++static int hf_nfapi_number_of_antennas_suppported = -1;
++static int hf_nfapi_minimum_downlink_frequency = -1;
++static int hf_nfapi_maximum_downlink_frequency = -1;
++static int hf_nfapi_minimum_uplink_frequency = -1;
++static int hf_nfapi_maximum_uplink_frequency = -1;
++static int hf_nfapi_number_of_rf_bands = -1;
++static int hf_nfapi_nmm_uplink_rssi_supported = -1;
++static int hf_nfapi_phy_rf_config_info_phy_id = -1;
++static int hf_nfapi_transmission_mode7_supported = -1;
++static int hi_nfapi_transmission_mode8_supported = -1;
++static int hi_nfapi_two_antennas_ports_for_pucch = -1;
++static int hi_nfapi_transmission_mode_9_supported = -1;
++static int hi_nfapi_simultaneous_pucch_pusch = -1;
++static int hi_nfapi_four_layer_tx_with_tm3_and_tm4 = -1;
++static int hf_nfapi_epdcch_supported = -1;
++static int hi_nfapi_multi_ack_csi_reporting = -1;
++static int hi_nfapi_pucch_tx_diversity_with_channel_selection = -1;
++static int hi_nfapi_ul_comp_supported = -1;
++static int hi_nfapi_transmission_mode_5_supported = -1;
++static int hf_nfapi_csi_subframe_set = -1;
++static int hi_nfapi_enhanced_4tx_codebook = -1;
++static int hi_nfapi_drs_supported = -1;
++static int hi_nfapi_ul_64qam_supported = -1;
++static int hi_nfapi_transmission_mode_10_supported = -1;
++static int hi_nfapi_alternative_tbs_indices = -1;
++static int hf_nfapi_pucch_format_4_supported = -1;
++static int hf_nfapi_pucch_format_5_supported = -1;
++static int hf_nfapi_more_than_5_ca_supported = -1;
++static int hf_nfapi_laa_supported = -1;
++static int hf_nfapi_laa_ending_in_dwpts_supported = -1;
++static int hf_nfapi_laa_starting_in_second_slot_supported = -1;
++static int hf_nfapi_beamforming_supported = -1;
++static int hf_nfapi_csi_rs_enhancements_supported = -1;
++static int hf_nfapi_drms_enhancements_supported = -1;
++static int hf_nfapi_srs_enhancements_supported = -1;
++static int hf_nfapi_dl_rs_tx_power = -1;
++static int hf_nfapi_received_interference_power = -1;
++static int hf_nfapi_thermal_noise_power = -1;
++static int hf_nfapi_dl_rs_tx_power_measurement = -1;
++static int hf_nfapi_received_interference_power_measurement = -1;
++static int hf_nfapi_thermal_noise_power_measurement = -1;
++
++// P5 Message Structures
++static int hf_nfapi_error_code = -1;
++static int hf_nfapi_p4_error_code = -1;
++static int hf_nfapi_rat_type = -1;
++static int hf_nfapi_num_tlv = -1;
++static int hf_nfapi_phy_state = -1;
++static int hf_nfapi_phy_antenna_capability = -1;
++static int hf_nfapi_release_capability = -1;
++static int hf_nfapi_mbsfn_capability = -1;
++static int hf_nfapi_laa_capability = -1;
++static int hf_nfapi_pd_sensing_lbt_support = -1;
++static int hf_nfapi_multi_carrier_lbt_support = -1;
++static int hf_nfapi_partial_sf_support = -1;
++
++static int hf_nfapi_pnf_address_ipv4 = -1;
++static int hf_nfapi_pnf_address_ipv6 = -1;
++static int hf_nfapi_vnf_address_ipv4 = -1;
++static int hf_nfapi_vnf_address_ipv6 = -1;
++static int hf_nfapi_pnf_port = -1;
++static int hf_nfapi_vnf_port = -1;
++static int hf_nfapi_dl_ue_per_sf = -1;
++static int hf_nfapi_ul_ue_per_sf = -1;
++static int hf_nfapi_timing_window = -1;
++static int hf_nfapi_timing_info_mode = -1;
++static int hf_nfapi_timing_info_period = -1;
++static int hf_nfapi_duplex_mode = -1;
++static int hf_nfapi_pcfich_power_offset = -1;
++static int hf_nfapi_pb = -1;
++static int hf_nfapi_dl_cyclic_prefix_type = -1;
++static int hf_nfapi_ul_cyclic_prefix_type = -1;
++static int hf_nfapi_tx_antenna_ports = -1;
++static int hf_nfapi_rx_antenna_ports = -1;
++static int hf_nfapi_downlink_channel_bandwidth = -1;
++static int hf_nfapi_uplink_channel_bandwidth = -1;
++static int hf_nfapi_reference_signal_power = -1;
++static int hf_nfapi_phich_resource = -1;
++static int hf_nfapi_phich_duration = -1;
++static int hf_nfapi_phich_power_offset = -1;
++static int hf_nfapi_primary_synchronization_signal_epre_eprers = -1;
++static int hf_nfapi_secondary_synchronization_signal_epre_eprers = -1;
++static int hf_nfapi_physical_cell_id = -1;
++static int hf_nfapi_configuration_index = -1;
++static int hf_nfapi_root_sequence_index = -1;
++static int hf_nfapi_zero_correlation_zone_configuration = -1;
++static int hf_nfapi_high_speed_flag = -1;
++static int hf_nfapi_frequency_offset = -1;
++static int hf_nfapi_hopping_mode = -1;
++static int hf_nfapi_hopping_offset = -1;
++static int hf_nfapi_delta_pucch_shift = -1;
++static int hf_nfapi_n_cqi_rb = -1;
++static int hf_nfapi_n_an_cs = -1;
++static int hf_nfapi_n1_pucch_an = -1;
++static int hf_nfapi_bandwidth_configuration = -1;
++static int hf_nfapi_max_up_pts = -1;
++static int hf_nfapi_srs_subframe_configuration = -1;
++static int hf_nfapi_srs_acknack_srs_simultaneous_transmission = -1;
++static int hf_nfapi_uplink_rs_hopping = -1;
++static int hf_nfapi_group_assignment = -1;
++static int hf_nfapi_cyclic_shift_1_for_drms = -1;
++static int hf_nfapi_subframe_assignment = -1;
++static int hf_nfapi_special_subframe_patterns = -1;
++static int hf_nfapi_ed_threshold_for_lbt_for_pdsch = -1;
++static int hf_nfapi_ed_threshold_for_lbt_for_drs = -1;
++static int hf_nfapi_pd_threshold = -1;
++static int hf_nfapi_multi_carrier_type = -1;
++static int hf_nfapi_multi_carrier_tx = -1;
++static int hf_nfapi_multi_carrier_freeze = -1;
++static int hf_nfapi_tx_antenna_ports_for_drs = -1;
++static int hf_nfapi_transmission_power_for_drs = -1;
++static int hf_nfapi_pbch_repetitions_enabled_r13 = -1;
++static int hf_nfapi_prach_cat_m_root_sequence_index = -1;
++static int hf_nfapi_prach_cat_m_zero_correlation_zone_configuration = -1;
++static int hf_nfapi_prach_cat_m_high_speed_flag = -1;
++static int hf_nfapi_prach_ce_level_0_enable = -1;
++static int hf_nfapi_prach_ce_level_0_configuration_index = -1;
++static int hf_nfapi_prach_ce_level_0_frequency_offset = -1;
++static int hf_nfapi_prach_ce_level_0_number_of_repetitions_per_attempt = -1;
++static int hf_nfapi_prach_ce_level_0_starting_subframe_periodicity = -1;
++static int hf_nfapi_prach_ce_level_0_hopping_enabled = -1;
++static int hf_nfapi_prach_ce_level_0_hopping_offset = -1;
++static int hf_nfapi_prach_ce_level_1_enable = -1;
++static int hf_nfapi_prach_ce_level_1_configuration_index = -1;
++static int hf_nfapi_prach_ce_level_1_frequency_offset = -1;
++static int hf_nfapi_prach_ce_level_1_number_of_repetitions_per_attempt = -1;
++static int hf_nfapi_prach_ce_level_1_starting_subframe_periodicity = -1;
++static int hf_nfapi_prach_ce_level_1_hopping_enabled = -1;
++static int hf_nfapi_prach_ce_level_1_hopping_offset = -1;
++static int hf_nfapi_prach_ce_level_2_enable = -1;
++static int hf_nfapi_prach_ce_level_2_configuration_index = -1;
++static int hf_nfapi_prach_ce_level_2_frequency_offset = -1;
++static int hf_nfapi_prach_ce_level_2_number_of_repetitions_per_attempt = -1;
++static int hf_nfapi_prach_ce_level_2_starting_subframe_periodicity = -1;
++static int hf_nfapi_prach_ce_level_2_hopping_enabled = -1;
++static int hf_nfapi_prach_ce_level_2_hopping_offset = -1;
++static int hf_nfapi_prach_ce_level_3_enable = -1;
++static int hf_nfapi_prach_ce_level_3_configuration_index = -1;
++static int hf_nfapi_prach_ce_level_3_frequency_offset = -1;
++static int hf_nfapi_prach_ce_level_3_number_of_repetitions_per_attempt = -1;
++static int hf_nfapi_prach_ce_level_3_starting_subframe_periodicity = -1;
++static int hf_nfapi_prach_ce_level_3_hopping_enabled = -1;
++static int hf_nfapi_prach_ce_level_3_hopping_offset = -1;
++static int hf_nfapi_pucch_internal_ul_hopping_config_common_mode_b = -1;
++static int hf_nfapi_pucch_internal_ul_hopping_config_common_mode_a = -1;
++static int hf_nfapi_dl_modulation_support = -1;
++static int hf_nfapi_dl_modulation_support_qpsk = -1;
++static int hf_nfapi_dl_modulation_support_16qam = -1;
++static int hf_nfapi_dl_modulation_support_64qam = -1;
++static int hf_nfapi_dl_modulation_support_256qam = -1;
++static int hf_nfapi_ul_modulation_support = -1;
++static int hf_nfapi_ul_modulation_support_qpsk = -1;
++static int hf_nfapi_ul_modulation_support_16qam = -1;
++static int hf_nfapi_ul_modulation_support_64qam = -1;
++static int hf_nfapi_data_report_mode = -1;
++static int hf_nfapi_sfnsf = -1;
++
++// P7 Sub Structures
++static int hf_nfapi_dl_dci_format = -1;
++static int hf_nfapi_ul_dci_format = -1;
++static int hf_nfapi_mpdcch_ul_dci_format = -1;
++static int hf_nfapi_cce_idx = -1;
++static int hf_nfapi_aggregation_level = -1;
++static int hf_nfapi_mcs_1 = -1;
++static int hf_nfapi_redundancy_version_1 = -1;
++static int hf_nfapi_new_data_indicator_1 = -1;
++static int hf_nfapi_mcs_2 = -1;
++static int hf_nfapi_redundancy_version_2 = -1;
++static int hf_nfapi_new_data_indicator_2 = -1;
++static int hf_nfapi_harq_process = -1;
++static int hf_nfapi_tpmi = -1;
++static int hf_nfapi_pmi = -1;
++static int hf_nfapi_precoding_information = -1;
++static int hf_nfapi_tpc = -1;
++static int hf_nfapi_downlink_assignment_index = -1;
++static int hf_nfapi_transport_block_size_index = -1;
++static int hf_nfapi_downlink_power_offset = -1;
++static int hf_nfapi_allocate_prach_flag = -1;
++static int hf_nfapi_preamble_index = -1;
++static int hf_nfapi_prach_mask_index = -1;
++static int hf_nfapi_rnti_type = -1;
++static int hf_nfapi_mpdcch_rnti_type = -1;
++static int hf_nfapi_mcch_flag = -1;
++static int hf_nfapi_mcch_change_notification = -1;
++static int hf_nfapi_scrambling_identity = -1;
++static int hf_nfapi_cross_carrier_scheduling_flag = -1;
++static int hf_nfapi_carrier_indicator = -1;
++static int hf_nfapi_srs_flag = -1;
++static int hf_nfapi_srs_request = -1;
++static int hf_nfapi_antenna_ports_scrambling_and_layers = -1;
++static int hf_nfapi_total_dci_length_including_padding = -1;
++static int hf_nfapi_harq_ack_resource_offset = -1;
++static int hf_nfapi_pdsch_re_mapping_and_quasi_co_location_indicator = -1;
++static int hf_nfapi_primary_cell_type = -1;
++static int hf_nfapi_ul_dl_configuration_flag = -1;
++static int hf_nfapi_number_of_ul_dl_configurations = -1;
++static int hf_nfapi_ul_dl_configuration_index = -1;
++static int hf_nfapi_laa_end_partial_sf_flag = -1;
++static int hf_nfapi_laa_end_partial_sf_configuration = -1;
++static int hf_nfapi_initial_lbt_sf = -1;
++static int hf_nfapi_codebooksize_determination_r13 = -1;
++static int hf_nfapi_rel13_drms_table_flag = -1;
++static int hf_nfapi_csi_rs_resource_config = -1;
++static int hf_nfapi_csi_rs_number_of_nzp_configurations = -1;
++static int hf_nfapi_pdsch_start = -1;
++static int hf_nfapi_drms_config_flag = -1;
++static int hf_nfapi_drms_scrambling = -1;
++static int hf_nfapi_csi_config_flag = -1;
++static int hf_nfapi_csi_scrambling = -1;
++static int hf_nfapi_pdsch_re_mapping_flag = -1;
++static int hf_nfapi_pdsch_re_mapping_antenna_ports = -1;
++static int hf_nfapi_pdsch_re_mapping_freq_shift = -1;
++static int hf_nfapi_alt_cqi_table_r12 = -1;
++static int hf_nfapi_max_layers = -1;
++static int hf_nfapi_n_dl_harq = -1;
++static int hf_nfapi_dwpts_symbols = -1;
++static int hf_nfapi_ue_type = -1;
++static int hf_nfapi_pdsch_payload_type = -1;
++static int hf_nfapi_initial_transmission_sf = -1;
++static int hf_nfapi_req13_drms_table_flag = -1;
++static int hf_nfapi_prnti = -1;
++static int hf_nfapi_mcs = -1;
++static int hf_nfapi_number_of_transport_blocks = -1;
++static int hf_nfapi_ue_mode = -1;
++static int hf_prs_bandwidth = -1;
++static int hf_prs_cyclic_prefix_type = -1;
++static int hf_prs_muting = -1;
++static int hf_nfapi_csi_rs_resource_index = -1;
++static int hf_nfapi_csi_rs_class = -1;
++static int hf_nfapi_cdm_type = -1;
++static int hf_nfapi_edpcch_prb_index = -1;
++static int hf_nfapi_epdcch_resource_assignment_flag = -1;
++static int hf_nfapi_epdcch_id = -1;
++static int hf_nfapi_epdcch_start_symbol = -1;
++static int hf_nfapi_epdcch_num_prb = -1;
++static int hf_nfapi_precoding_value = -1;
++static int hf_nfapi_mpdcch_narrowband = -1;
++static int hf_nfapi_number_of_prb_pairs = -1;
++static int hf_nfapi_resource_block_assignment = -1;
++static int hf_nfapi_start_symbol = -1;
++static int hf_nfapi_ecce_index = -1;
++static int hf_nfapi_ce_mode = -1;
++static int hf_nfapi_drms_scrabmling_init = -1;
++static int hf_nfapi_pdsch_reception_levels = -1;
++static int hf_nfapi_new_data_indicator = -1;
++static int hf_nfapi_tpmi_length = -1;
++static int hf_nfapi_pmi_flag = -1;
++static int hf_nfapi_harq_resource_offset = -1;
++static int hf_nfapi_dci_subframe_repetition_number = -1;
++static int hf_nfapi_downlink_assignment_index_length = -1;
++static int hf_nfapi_starting_ce_level = -1;
++static int hf_nfapi_antenna_ports_and_scrambling_identity_flag = -1;
++static int hf_nfapi_antenna_ports_and_scrambling_identity = -1;
++static int hf_nfapi_paging_direct_indication_differentiation_flag = -1;
++static int hf_nfapi_direct_indication = -1;
++static int hf_nfapi_number_of_tx_antenna_ports = -1;
++
++// P7 Message Structures
++static int hf_nfapi_dl_node_sync_t1 = -1;
++static int hf_nfapi_dl_node_sync_delta_sfn_sf = -1;
++static int hf_nfapi_ul_node_sync_t1 = -1;
++static int hf_nfapi_ul_node_sync_t2 = -1;
++static int hf_nfapi_ul_node_sync_t3 = -1;
++static int hf_nfapi_timing_info_last_sfn_sf = -1;
++static int hf_nfapi_timing_info_time_since_last_timing_info = -1;
++static int hf_nfapi_timing_info_dl_config_jitter = -1;
++static int hf_nfapi_timing_info_tx_request_jitter = -1;
++static int hf_nfapi_timing_info_ul_config_jitter = -1;
++static int hf_nfapi_timing_info_hi_dci0_jitter = -1;
++static int hf_nfapi_timing_info_dl_config_latest_delay = -1;
++static int hf_nfapi_timing_info_tx_request_latest_delay = -1;
++static int hf_nfapi_timing_info_ul_config_latest_delay = -1;
++static int hf_nfapi_timing_info_hi_dci0_latest_delay = -1;
++static int hf_nfapi_timing_info_dl_config_earliest_arrival = -1;
++static int hf_nfapi_timing_info_tx_request_earliest_arrival = -1;
++static int hf_nfapi_timing_info_ul_config_earliest_arrival = -1;
++static int hf_nfapi_timing_info_hi_dci0_earliest_arrival = -1;
++static int hf_nfapi_sfn_sf = -1;
++static int hf_nfapi_number_pdcch_ofdm_symbols = -1;
++static int hf_nfapi_number_dci = -1;
++static int hf_nfapi_number_pdus = -1;
++static int hf_nfapi_number_pdsch_rnti = -1;
++static int hf_nfapi_transmission_power_pcfich = -1;
++static int hf_nfapi_number_of_harqs = -1;
++static int hf_nfapi_number_of_crcs = -1;
++static int hf_nfapi_number_of_srs = -1;
++static int hf_nfapi_number_of_cqi = -1;
++static int hf_nfapi_number_of_preambles = -1;
++static int hf_nfapi_number_of_srss = -1;
++static int hf_nfapi_lbt_dl_req_pdu_type = -1;
++static int hf_nfapi_lbt_dl_ind_pdu_type = -1;
++static int hf_nfapi_dl_config_pdu_type = -1;
++static int hf_nfapi_pdu_size = -1;
++static int hf_nfapi_instance_length = -1;
++static int hf_nfapi_length;
++static int hf_nfapi_pdu_index = -1;
++static int hf_nfapi_rnti = -1;
++static int hf_nfapi_resource_allocation_type = -1;
++static int hf_nfapi_virtual_resource_block_assignment_flag = -1;
++static int hf_nfapi_resource_block_coding = -1;
++static int hf_nfapi_modulation = -1;
++static int hf_nfapi_redundancy_version = -1;
++static int hf_nfapi_transport_blocks = -1;
++static int hf_nfapi_transport_block_to_codeword_swap_flag = -1;
++static int hf_nfapi_transmission_scheme = -1;
++static int hf_nfapi_ul_transmission_scheme = -1;
++static int hf_nfapi_number_of_layers = -1;
++static int hf_nfapi_number_of_subbands = -1;
++static int hf_nfapi_codebook_index = -1;
++static int hf_nfapi_ue_category_capacity = -1;
++static int hf_nfapi_pa = -1;
++static int hf_nfapi_delta_power_offset_index = -1;
++static int hf_nfapi_ngap = -1;
++static int hf_nfapi_nprb = -1;
++static int hf_nfapi_transmission_mode = -1;
++static int hf_nfapi_num_bf_prb_per_subband = -1;
++static int hf_nfapi_num_bf_vector = -1;
++static int hf_nfapi_bf_vector_subband_index = -1;
++static int hf_nfapi_bf_vector_num_antennas = -1;
++static int hf_nfapi_bf_vector_bf_value = -1;
++static int hf_nfapi_nscid = -1;
++static int hf_nfapi_csi_rs_flag = -1;
++static int hf_nfapi_csi_rs_resource_config_r10 = -1;
++static int hf_nfapi_csi_rs_zero_tx_power_resource_config_bitmap_r10 = -1;
++static int hf_nfapi_transmission_power = -1;
++static int hf_nfapi_mbsfn_area_id = -1;
++static int hf_nfapi_csi_rs_antenna_port_count_r10 = -1;
++static int hf_nfapi_ul_config_pdu_type = -1;
++static int hf_nfapi_rach_prach_frequency_resources = -1;
++static int hf_nfapi_srs_present = -1;
++static int hf_nfapi_handle = -1;
++static int hf_nfapi_pucch_index = -1;
++static int hf_nfapi_size = -1;
++static int hf_nfapi_resource_block_start = -1;
++static int hf_nfapi_number_of_resource_blocks = -1;
++static int hf_nfapi_cyclic_shift_2_for_drms = -1;
++static int hf_nfapi_frequency_hopping_enabled_flag = -1;
++static int hf_nfapi_frequency_hopping_bits = -1;
++static int hf_nfapi_new_data_indication = -1;
++static int hf_nfapi_harq_process_number = -1;
++static int hf_nfapi_ul_tx_mode = -1;
++static int hf_nfapi_current_tx_nb = -1;
++static int hf_nfapi_n_srs = -1;
++static int hf_nfapi_disable_sequence_hopping_flag = -1;
++static int hf_nfapi_dl_cqi_pmi_size_rank_1 = -1;
++static int hf_nfapi_dl_cqi_pmi_size_rank_greater_1 = -1;
++static int hf_nfapi_ri_size = -1;
++static int hf_nfapi_delta_offset_cqi = -1;
++static int hf_nfapi_delta_offset_ri = -1;
++static int hf_nfapi_harq_size = -1;
++static int hf_nfapi_delta_offset_harq = -1;
++static int hf_nfapi_tdd_ack_nack_mode = -1;
++static int hf_nfapi_fdd_ack_nack_mode = -1;
++static int hf_nfapi_n_srs_initial = -1;
++static int hf_nfapi_initial_number_of_resource_blocks = -1;
++static int hf_nfapi_dl_cqi_pmi_size = -1;
++static int hf_nfapi_report_type = -1;
++static int hf_nfapi_dl_cqi_ri_pmi_size = -1;
++static int hf_nfapi_control_type = -1;
++static int hf_nfapi_number_of_cc = -1;
++static int hf_nfapi_virtual_cell_id_enabled_flag = -1;
++static int hf_nfapi_npusch_identity = -1;
++static int hf_nfapi_ndrms_csh_identity = -1;
++static int hf_nfapi_total_number_of_repetitions = -1;
++static int hf_nfapi_repetition_number = -1;
++static int hf_nfapi_initial_sf_io = -1;
++static int hf_nfapi_empty_symbols_due_to_retunning = -1;
++static int hf_nfapi_dl_cqi_ri_pmi_size_2 = -1;
++static int hf_nfapi_npucch_identity = -1;
++static int hf_nfapi_harq_size_2 = -1;
++static int hf_nfapi_delta_offset_harq_2 = -1;
++static int hf_nfapi_empty_symbols = -1;
++static int hf_nfapi_csi_mode = -1;
++static int hf_nfapi_dl_cqi_pmi_size_2 = -1;
++static int hf_nfapi_statring_prb = -1;
++static int hf_nfapi_cdm_index = -1;
++static int hf_nfapi_nsrs = -1;
++static int hf_nfapi_num_ant_ports = -1;
++static int hf_nfapi_n_pucch_2_0 = -1;
++static int hf_nfapi_n_pucch_2_1 = -1;
++static int hf_nfapi_n_pucch_2_2 = -1;
++static int hf_nfapi_n_pucch_2_3 = -1;
++static int hf_nfapi_starting_prb = -1;
++static int hf_nfapi_antenna_port = -1;
++static int hf_nfapi_number_of_combs = -1;
++static int hf_nfapi_number_of_pucch_resource = -1;
++static int hf_nfapi_pucch_index_p1 = -1;
++static int hf_nfapi_n_pucch_1_0 = -1;
++static int hf_nfapi_n_pucch_1_1 = -1;
++static int hf_nfapi_n_pucch_1_2 = -1;
++static int hf_nfapi_n_pucch_1_3 = -1;
++static int hf_nfapi_srs_bandwidth = -1;
++static int hf_nfapi_frequency_domain_position = -1;
++static int hf_nfapi_srs_hopping_bandwidth = -1;
++static int hf_nfapi_transmission_comb = -1;
++static int hf_nfapi_i_srs = -1;
++static int hf_nfapi_sounding_reference_cyclic_shift = -1;
++static int hf_nfapi_pdu_length = -1;
++static int hf_nfapi_crc_flag = -1;
++static int hf_nfapi_number_of_hi_pdus = -1;
++static int hf_nfapi_number_of_dci_pdus = -1;
++static int hf_nfapi_hi_dci0_pdu_type = -1;
++static int hf_nfapi_hi_value = -1;
++static int hf_nfapi_i_phich = -1;
++static int hf_nfapi_flag_tb2 = -1;
++static int hf_nfapi_hi_value_2 = -1;
++static int hf_nfapi_ue_tx_antenna_selection = -1;
++static int hf_nfapi_cqi_csi_request = -1;
++static int hf_nfapi_ul_index = -1;
++static int hf_nfapi_dl_assignment_index = -1;
++static int hf_nfapi_tpc_bitmap = -1;
++static int hf_nfapi_new_data_indication_two = -1;
++static int hf_nfapi_size_of_cqi_csi_feild = -1;
++static int hf_nfapi_resource_allocation_flag = -1;
++static int hf_nfapi_number_of_antenna_ports = -1;
++static int hf_nfapi_n_ul_rb = -1;
++static int hf_nfapi_pscch_resource = -1;
++static int hf_nfapi_time_resource_pattern = -1;
++static int hf_nfapi_mpdcch_transmission_type = -1;
++static int hf_nfapi_drms_scrambling_init = -1;
++static int hf_nfapi_pusch_repetition_levels = -1;
++static int hf_nfapi_frequency_hopping_flag = -1;
++static int hf_nfapi_csi_request = -1;
++static int hf_nfapi_dai_presence_flag = -1;
++static int hf_nfapi_total_dci_length_include_padding = -1;
++static int hf_nfapi_data_offset = -1;
++static int hf_nfapi_ul_cqi = -1;
++static int hf_nfapi_timing_advance_r9 = -1;
++static int hf_nfapi_timing_advance = -1;
++static int hf_nfapi_harq_data_value_0 = -1;
++static int hf_nfapi_harq_data_value_0_special = -1;
++static int hf_nfapi_harq_data_value_1 = -1;
++static int hf_nfapi_harq_data_value_2 = -1;
++static int hf_nfapi_harq_data_value_3 = -1;
++static int hf_nfapi_tdd_harq_mode = -1;
++static int hf_nfapi_fdd_harq_mode = -1;
++static int hf_nfapi_number_of_ack_nack = -1;
++static int hf_nfapi_harq_tb_1 = -1;
++static int hf_nfapi_harq_tb_2 = -1;
++static int hf_nfapi_harq_tb_n = -1;
++static int hf_nfapi_channel = -1;
++static int hf_nfapi_ri = -1;
++static int hf_nfapi_number_of_cc_reported = -1;
++static int hf_nfapi_preamble = -1;
++static int hf_nfapi_rach_resource_type = -1;
++static int hf_nfapi_snr = -1;
++static int hf_nfapi_doppler_estimation = -1;
++static int hf_nfapi_rb_start = -1;
++static int hf_nfapi_up_pts_symbol = -1;
++static int hf_nfapi_number_prb_per_subband = -1;
++static int hf_nfapi_number_antennas = -1;
++static int hf_nfapi_subband_index = -1;
++static int hf_nfapi_channel_coefficient = -1;
++static int hf_nfapi_ul_rtoa = -1;
++static int hf_nfapi_mp_cca = -1;
++static int hf_nfapi_n_cca = -1;
++static int hf_nfapi_offset = -1;
++static int hf_nfapi_lte_txop_sf = -1;
++static int hf_nfapi_txop_sfn_sf_end = -1;
++static int hf_nfapi_lbt_mode = -1;
++static int hf_nfapi_sfn_sf_end = -1;
++static int hf_nfapi_result = -1;
++static int hf_nfapi_txop_symbols = -1;
++static int hf_nfapi_initial_partial_sf = -1;
++static int hf_nfapi_frequency_band_indicator = -1;
++static int hf_nfapi_measurement_period = -1;
++static int hf_nfapi_bandwidth = -1;
++static int hf_nfapi_timeout = -1;
++static int hf_nfapi_number_of_earfcns = -1;
++static int hf_nfapi_uarfcn = -1;
++static int hf_nfapi_number_of_uarfcns = -1;
++static int hf_nfapi_arfcn = -1;
++static int hf_nfapi_arfcn_direction = -1;
++static int hf_nfapi_number_of_arfcns = -1;
++static int hf_nfapi_rssi = -1;
++static int hf_nfapi_number_of_rssi = -1;
++static int hf_nfapi_pci = -1;
++static int hf_nfapi_measurement_bandwidth = -1;
++static int hf_nfapi_exhaustive_search = -1;
++static int hf_nfapi_number_of_pci = -1;
++static int hf_nfapi_psc = -1;
++static int hf_nfapi_number_of_psc = -1;
++static int hf_nfapi_rsrp = -1;
++static int hf_nfapi_rsrq = -1;
++static int hf_nfapi_number_of_lte_cells_found = -1;
++static int hf_nfapi_rscp = -1;
++static int hf_nfapi_enco = -1;
++static int hf_nfapi_number_of_utran_cells_found = -1;
++static int hf_nfapi_bsic = -1;
++static int hf_nfapi_rxlev = -1;
++static int hf_nfapi_rxqual = -1;
++static int hf_nfapi_sfn_offset = -1;
++static int hf_nfapi_number_of_geran_cells_found = -1;
++static int hf_nfapi_number_of_tx_antenna = -1;
++static int hf_nfapi_mib_length = -1;
++static int hf_nfapi_mib = -1;
++static int hf_nfapi_phich_configuration = -1;
++static int hf_nfapi_retry_count = -1;
++static int hf_nfapi_sib1 = -1;
++static int hf_nfapi_si_periodicity = -1;
++static int hf_nfapi_si_index = -1;
++static int hf_nfapi_number_of_si_periodicity = -1;
++static int hf_nfapi_si_window_length = -1;
++static int hf_nfapi_sib_type = -1;
++static int hf_nfapi_sib_len = -1;
++static int hf_nfapi_sib = -1;
++static int hf_nfapi_si_len = -1;
++static int hf_nfapi_si = -1;
++static int hf_nfapi_pnf_search_state = -1;
++static int hf_nfapi_pnf_broadcast_state = -1;
++
++static const value_string message_id_vals[] =
++{
++	{ NFAPI_DL_CONFIG_REQUEST_MSG_ID, "DL_CONFIG.request" },
++	{ NFAPI_UL_CONFIG_REQUEST_MSG_ID, "UL_CONFIG.request" },
++	{ NFAPI_SUBFRAME_INDICATION_MSG_ID, "SUBFRAME_INDICATION" },
++	{ NFAPI_HI_DCI0_REQUEST_MSG_ID, "HI_DCI0.request" },
++	{ NFAPI_TX_REQUEST_MSG_ID, "TX.request" },
++	{ NFAPI_HARQ_INDICATION_MSG_ID, "HARQ.indication" },
++	{ NFAPI_CRC_INDICATION_MSG_ID, "CRC.indication" },
++	{ NFAPI_RX_ULSCH_INDICATION_MSG_ID, "RX_ULSCH.indication" },
++	{ NFAPI_RACH_INDICATION_MSG_ID, "RACH.indication" },
++	{ NFAPI_SRS_INDICATION_MSG_ID, "SRS.indication" },
++	{ NFAPI_RX_SR_INDICATION_MSG_ID, "RX_SR.indication" },
++	{ NFAPI_RX_CQI_INDICATION_MSG_ID, "RX_CQI.indication" },
++	{ NFAPI_LBT_DL_CONFIG_REQUEST_MSG_ID, "LBT_DL_CONFIG.request" },
++	{ NFAPI_LBT_DL_INDICATION_MSG_ID, "LBT_DL.indication" },
++
++	{ NFAPI_PNF_PARAM_REQUEST_MSG_ID, "PNF_PARAM.request" },
++	{ NFAPI_PNF_PARAM_RESPONSE_MSG_ID, "PNF_PARAM.response" },
++	{ NFAPI_PNF_CONFIG_REQUEST_MSG_ID, "PNF_CONFIG.request" },
++	{ NFAPI_PNF_CONFIG_RESPONSE_MSG_ID, "PNF_CONFIG.response" },
++	{ NFAPI_PNF_START_REQUEST_MSG_ID, "PNF_START.request" },
++	{ NFAPI_PNF_START_RESPONSE_MSG_ID, "PNF_START.response" },
++	{ NFAPI_PNF_STOP_REQUEST_MSG_ID, "PNF_STOP.request" },
++	{ NFAPI_PNF_STOP_RESPONSE_MSG_ID, "PNF_STOP.response" },
++	{ NFAPI_PARAM_REQUEST_MSG_ID, "PARAM.request" },
++	{ NFAPI_PARAM_RESPONSE_MSG_ID, "PARAM.response" },
++	{ NFAPI_CONFIG_REQUEST_MSG_ID, "CONFIG.request" },
++	{ NFAPI_CONFIG_RESPONSE_MSG_ID, "CONFIG.response" },
++	{ NFAPI_START_REQUEST_MSG_ID, "START.request" },
++	{ NFAPI_START_RESPONSE_MSG_ID, "START.response" },
++	{ NFAPI_STOP_REQUEST_MSG_ID, "STOP.request" },
++	{ NFAPI_STOP_RESPONSE_MSG_ID, "STOP.response" },
++	{ NFAPI_MEASUREMENT_REQUEST_MSG_ID, "MEASUREMENT.request" },
++	{ NFAPI_MEASUREMENT_RESPONSE_MSG_ID, "MEASUREMENT.response" },
++
++	{ NFAPI_DL_NODE_SYNC_MSG_ID, "UL_NODE_SYNC" },
++	{ NFAPI_UL_NODE_SYNC_MSG_ID, "DL_NODE_SYNC" },
++	{ NFAPI_TIMING_INFO_MSG_ID, "TIMING_INFO" },
++
++	{ NFAPI_RSSI_REQUEST_MSG_ID, "RSSI.request" },
++	{ NFAPI_RSSI_RESPONSE_MSG_ID, "RSSI.response" },
++	{ NFAPI_RSSI_INDICATION_MSG_ID, "RSSI.indication" },
++	{ NFAPI_CELL_SEARCH_REQUEST_MSG_ID, "CELL_SEARCH.request" },
++	{ NFAPI_CELL_SEARCH_RESPONSE_MSG_ID, "CELL_SEARCH.response" },
++	{ NFAPI_CELL_SEARCH_INDICATION_MSG_ID, "CELL_SEARCH.indication" },
++	{ NFAPI_BROADCAST_DETECT_REQUEST_MSG_ID, "BROADCAST_DETECT.request" },
++	{ NFAPI_BROADCAST_DETECT_RESPONSE_MSG_ID, "BROADCAST_DETECT.response" },
++	{ NFAPI_BROADCAST_DETECT_INDICATION_MSG_ID, "BROADCAST_DETECT.indication" },
++	{ NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST_MSG_ID, "SYSTEM_INFORMATION_SCHEDULE.request" },
++	{ NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE_MSG_ID, "SYSTEM_INFORMATION_SCHEDULE.response" },
++	{ NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION_MSG_ID, "SYSTEM_INFORMATION_SCHEDULE.indication" },
++	{ NFAPI_SYSTEM_INFORMATION_REQUEST_MSG_ID, "SYSTEM_INFORMATION.request" },
++	{ NFAPI_SYSTEM_INFORMATION_RESPONSE_MSG_ID, "SYSTEM_INFORMATION.response" },
++	{ NFAPI_SYSTEM_INFORMATION_INDICATION_MSG_ID, "SYSTEM_INFORMATION.indication" },
++	{ NFAPI_NMM_STOP_REQUEST_MSG_ID, "NMM_STOP.request" },
++	{ NFAPI_NMM_STOP_RESPONSE_MSG_ID, "NMM_STOP.response" },
++
++	{ 0, NULL },
++};
++
++typedef void(*tlv_decode)(ptvcursor_t * ptvc, packet_info* pinfo);
++
++typedef struct
++{
++	guint16 tag_id;
++	char* name;
++	tlv_decode decode;
++} tlv_t;
++
++static void dissect_tlv_list(ptvcursor_t * ptvc, packet_info* pinfo, gint len);
++
++static void dissect_array_value(ptvcursor_t * ptvc, packet_info* pinfo, const char* name, guint32 ett_idx, guint32 count, tlv_decode decode)
++{
++	guint16 i = 0;
++
++	if (count > 0)
++	{
++		ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_idx, "%s", name);
++
++		for (i = 0; i < count; ++i)
++		{
++			ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_idx, "[%d]", i);
++			decode(ptvc, pinfo);
++			ptvcursor_pop_subtree(ptvc);
++		}
++
++		ptvcursor_pop_subtree(ptvc);
++	}
++}
++
++static void dissect_pnf_param_general_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// nFAPI Sync Mode
++	guint8 nfapi_sync_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_sync_mode, 1, ENC_BIG_ENDIAN);
++	if (nfapi_sync_mode_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid nfapi sync mode value [0..2]");
++	}
++
++	// Location Mode
++	guint8 location_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_location_mode, 1, ENC_BIG_ENDIAN);
++	if (location_mode_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid location mode value [0..3]");
++	}
++
++	guint16 len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_location_coordinates_length, 2, ENC_BIG_ENDIAN);
++	if (len > 0)
++		ptvcursor_add(ptvc, hf_nfapi_location_coordinates, len, ENC_NA);
++	ptvcursor_add(ptvc, hf_nfapi_dl_config_timing, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_tx_timing, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_ul_config_timing, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_hi_dci0_timing, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_maximum_number_phys, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_maximum_total_bandwidth, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_maximum_total_number_dl_layers, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_maximum_total_number_ul_layers, 1, ENC_BIG_ENDIAN);
++
++	// Shared Bands
++	guint8 shared_bands_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_shared_bands, 1, ENC_BIG_ENDIAN);
++	if (shared_bands_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid shared bands value [0..1]");
++	}
++
++	// Shared PA
++	guint8 shared_pa_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_shared_pa, 1, ENC_BIG_ENDIAN);
++	if (shared_pa_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid shared pa value [0..1]");
++	}
++
++	ptvcursor_add(ptvc, hf_nfapi_maximum_total_power, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_oui, 3, ENC_HOST_ENDIAN);
++}
++static void dissect_pnf_rf_config_instance_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_rf_config_index, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_pnf_phy_instance_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_config_index, 2, ENC_BIG_ENDIAN);
++
++	guint16 num_rf_configs = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_rfs, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "RF Config List", ett_nfapi_pnf_phy, num_rf_configs, dissect_pnf_rf_config_instance_value);
++
++	guint16 num_rf_exclusions = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_rf_exclusions, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "RF Exclustion List", ett_nfapi_pnf_phy, num_rf_exclusions, dissect_pnf_rf_config_instance_value);
++
++	// Downlink Channel Bandwidth Supported
++	guint16 downlink_channel_bandwidth_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add_no_advance(ptvc, hf_nfapi_downlink_channel_bandwidth_supported, 2, ENC_BIG_ENDIAN);
++	if (downlink_channel_bandwidth_supported_value > 0x3F)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink channel bandwidht supported bits [0..0x3F]");
++	}
++
++	proto_tree* dl_bw_support_tree = proto_item_add_subtree(item, ett_nfapi_downlink_bandwidth_support);
++
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_6, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 15, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_15, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 14, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_25, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 13, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_50, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 12, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_75, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 11, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_100, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 10, 1, ENC_NA);
++
++	ptvcursor_advance(ptvc, 2);
++
++
++
++	// Uplink Channel Bandwidth Supported
++	guint16 uplink_channel_bandwidth_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add_no_advance(ptvc, hf_nfapi_uplink_channel_bandwidth_supported, 2, ENC_BIG_ENDIAN);
++	if (uplink_channel_bandwidth_supported_value > 0x3F)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid uplink channel bandwidht supported bits [0..0x3F]");
++	}
++
++	proto_tree* ul_bw_support_tree = proto_item_add_subtree(item, ett_nfapi_uplink_bandwidth_support);
++
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_6, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 15, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_15, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 14, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_25, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 13, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_50, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 12, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_75, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 11, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_100, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 10, 1, ENC_NA);
++
++	ptvcursor_advance(ptvc, 2);
++
++	// Number of DL layers supported
++	guint8 number_of_dl_layer_supported_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_dl_layers_supported, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_dl_layer_supported_value == 1 || number_of_dl_layer_supported_value == 2 ||
++		  number_of_dl_layer_supported_value == 4 || number_of_dl_layer_supported_value == 8))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of dl layers supported value [1, 2, 4, 8]");
++	}
++
++	// Number of DL layers supported
++	guint8 number_of_ul_layer_supported_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_ul_layers_supported, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_ul_layer_supported_value == 1 || number_of_ul_layer_supported_value == 2 ||
++		  number_of_ul_layer_supported_value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ul layers supported value [1, 2, 4]");
++	}
++
++	// Maximum 3GPP Release Supported
++	guint16 maximum_3gpp_release_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add_no_advance(ptvc, hf_nfapi_maximum_3gpp_release_supported, 2, ENC_BIG_ENDIAN);
++	if (maximum_3gpp_release_supported_value > 0x3F)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid maximum 3GPP release supported value [0..0x3F]");
++	}
++
++	proto_tree* release_support_tree = proto_item_add_subtree(item, ett_nfapi_release_support);
++
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel8, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 15, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel9, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 14, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel10, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 13, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel11, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 12, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel12, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 11, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel13, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 10, 1, ENC_NA);
++
++	ptvcursor_advance(ptvc, 2);
++
++
++	// NMM Modes Supported
++	guint8 nmm_modes_supported_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_nmm_modes_supported, 1, ENC_BIG_ENDIAN);
++	if (nmm_modes_supported_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid nmm modes supported value [0..3]");
++	}
++}
++
++static void dissect_pnf_phy_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 num_phy = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_number_phy, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "PHY List", ett_nfapi_pnf_phy, num_phy, dissect_pnf_phy_instance_value);
++}
++
++static void dissect_pnf_rf_config_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	ptvcursor_add(ptvc, hf_nfapi_rf_config_index, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_band, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_maximum_transmit_power, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_minimum_transmit_power, 2, ENC_BIG_ENDIAN);
++
++	guint8 number_of_antennas_supported_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_antennas_suppported, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_antennas_supported_value == 1 || number_of_antennas_supported_value == 2 ||
++		  number_of_antennas_supported_value == 4 || number_of_antennas_supported_value == 8))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of supported antennas [1, 2, 4, 8]");
++	}
++
++	ptvcursor_add(ptvc, hf_nfapi_minimum_downlink_frequency, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_maximum_downlink_frequency, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_minimum_uplink_frequency, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_maximum_uplink_frequency, 4, ENC_BIG_ENDIAN);
++}
++
++
++static void dissect_pnf_rf_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 num_rf = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_rfs, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "RF List", ett_nfapi_pnf_phy_rf_config, num_rf, dissect_pnf_rf_config_value);
++}
++
++static void dissect_pnf_phy_rel10_instance_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// PHY Config Index
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_config_index, 2, ENC_BIG_ENDIAN);
++
++	// Transmission mode 7 supported
++	guint16 transmission_mode7_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_mode7_supported, 2, ENC_BIG_ENDIAN);
++	if (transmission_mode7_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission mode 7 supported value [0..1]");
++	}
++
++	// Two antennas ports for PUCCH
++	guint16 transmission_mode8_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_transmission_mode8_supported, 2, ENC_BIG_ENDIAN);
++	if (transmission_mode8_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission mode 8 supported value [0..1]");
++	}
++
++	// Transmission mode 8 supported
++	guint16 two_antennas_port_for_pucch_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_two_antennas_ports_for_pucch, 2, ENC_BIG_ENDIAN);
++	if (two_antennas_port_for_pucch_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid two antennas ports for pucch value [0..1]");
++	}
++
++	// Transmission mode 9 supported
++	guint16 transmission_mode9_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_transmission_mode_9_supported, 2, ENC_BIG_ENDIAN);
++	if (transmission_mode9_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission mode 9 supported value [0..1]");
++	}
++
++	// Simultaneous PUCCH PUSCH
++	guint16 simultaenous_pucch_pusch_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_simultaneous_pucch_pusch, 2, ENC_BIG_ENDIAN);
++	if (simultaenous_pucch_pusch_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid simultaneous pucch pusch supported value [0..1]");
++	}
++
++	// Four layer Tx with TM3 and TM4
++	guint16 four_layer_tx_with_tm3_and_tm4_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_four_layer_tx_with_tm3_and_tm4, 2, ENC_BIG_ENDIAN);
++	if (four_layer_tx_with_tm3_and_tm4_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid four layer tx with tm3 and tm4 value [0..1]");
++	}
++}
++
++static void dissect_pnf_phy_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 num_phy = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_number_phy, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "PHY Rel 10 List", ett_nfapi_pnf_phy_rel10, num_phy, dissect_pnf_phy_rel10_instance_value);
++}
++
++static void dissect_pnf_phy_rel11_instance_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// PHY Config Index
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_config_index, 2, ENC_BIG_ENDIAN);
++
++	// ePDCCH supported
++	guint16 epdcch_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_epdcch_supported, 2, ENC_BIG_ENDIAN);
++	if (epdcch_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid edpcch supported value [0..1]");
++	}
++
++	// Multi ACK CSI reporting
++	guint16 multi_ack_csi_reporting_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_multi_ack_csi_reporting, 2, ENC_BIG_ENDIAN);
++	if (multi_ack_csi_reporting_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid multi ack csi reporting value [0..1]");
++	}
++
++	// PUCCH Tx diversity with channel selection
++	guint16 pucch_tx_diversity_with_channel_selection_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_pucch_tx_diversity_with_channel_selection, 2, ENC_BIG_ENDIAN);
++	if (pucch_tx_diversity_with_channel_selection_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch tx diversity with channel selection value [0..1]");
++	}
++
++	// UL CoMP supported
++	guint16 ul_comp_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_ul_comp_supported, 2, ENC_BIG_ENDIAN);
++	if (ul_comp_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul comp supported value [0..1]");
++	}
++
++	// Transmission mode 5 supported
++	guint16 transmission_mode_5_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_transmission_mode_5_supported, 2, ENC_BIG_ENDIAN);
++	if (transmission_mode_5_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission mode 5 supported value [0..1]");
++	}
++}
++
++static void dissect_pnf_phy_rel11_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 num_phy = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_number_phy, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "PHY Rel 11 List", ett_nfapi_pnf_phy_rel11, num_phy, dissect_pnf_phy_rel11_instance_value);
++}
++
++static void dissect_pnf_phy_rel12_instance_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// PHY Config Index
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_config_index, 2, ENC_BIG_ENDIAN);
++
++	// CSI subframe set
++	guint16 csi_subframe_set_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_subframe_set, 2, ENC_BIG_ENDIAN);
++	if (csi_subframe_set_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi subframe set value [0..1]");
++	}
++
++	// Enhanced 4TX codebook
++	guint16 enhanced_4tx_codebook_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_enhanced_4tx_codebook, 2, ENC_BIG_ENDIAN);
++	if (enhanced_4tx_codebook_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid enhanced 4TX codebook value [0..1]");
++	}
++
++	// DRS supported
++	guint16 drs_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_drs_supported, 2, ENC_BIG_ENDIAN);
++	if (drs_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid drs supported value [0..1]");
++	}
++
++	// UL 64QAM supported
++	guint16 ul_64qam_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_ul_64qam_supported, 2, ENC_BIG_ENDIAN);
++	if (ul_64qam_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul 64 QAM supported value [0..1]");
++	}
++
++	// Transmission mode 10 supported
++	guint16 transmission_mode_10_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_transmission_mode_10_supported, 2, ENC_BIG_ENDIAN);
++	if (transmission_mode_10_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission mode 10 supported value [0..1]");
++	}
++
++	// Alternative TBS indices
++	guint16 alternative_tbs_indices_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hi_nfapi_alternative_tbs_indices, 2, ENC_BIG_ENDIAN);
++	if (alternative_tbs_indices_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid alternative tbs indicies supported value [0..1]");
++	}
++}
++
++static void dissect_pnf_phy_rel12_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 num_phy = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_number_phy, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "PHY Rel 12 List", ett_nfapi_pnf_phy_rel12, num_phy, dissect_pnf_phy_rel12_instance_value);
++}
++
++static void dissect_pnf_phy_rel13_instance_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// PHY Config Index
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_config_index, 2, ENC_BIG_ENDIAN);
++
++	// PUCCH format 4 supported
++	guint16 pucch_format_4_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pucch_format_4_supported, 2, ENC_BIG_ENDIAN);
++	if (pucch_format_4_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch format 4 supported value [0..1]");
++	}
++
++	// PUCCH format 5 supported
++	guint16 pucch_format_5_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pucch_format_5_supported, 2, ENC_BIG_ENDIAN);
++	if (pucch_format_5_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch format 5 supported value [0..1]");
++	}
++
++	// More than 5 CA support
++	guint16 more_than_5_ca_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_more_than_5_ca_supported, 2, ENC_BIG_ENDIAN);
++	if (more_than_5_ca_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid more than 5 ca supported value [0..1]");
++	}
++
++	// LAA supported
++	guint16 laa_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_laa_supported, 2, ENC_BIG_ENDIAN);
++	if (laa_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid laa supported value [0..1]");
++	}
++
++	// LAA ending in DwPTS supported
++	guint16 laa_ending_in_dwpts_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_laa_ending_in_dwpts_supported, 2, ENC_BIG_ENDIAN);
++	if (laa_ending_in_dwpts_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid laa ending in dwpts supported value [0..1]");
++	}
++
++	// LAA starting in second slot Supported
++	guint16 laa_starting_in_second_slot_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_laa_starting_in_second_slot_supported, 2, ENC_BIG_ENDIAN);
++	if (laa_starting_in_second_slot_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid laa starting in second slot supported value [0..1]");
++	}
++
++	// Beamforming Supported
++	guint16 beamingforming_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_beamforming_supported, 2, ENC_BIG_ENDIAN);
++	if (beamingforming_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid beamforming supported value [0..1]");
++	}
++
++	// CSI-RS enhancements supported
++	guint16 csi_rs_enhancements_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_rs_enhancements_supported, 2, ENC_BIG_ENDIAN);
++	if (csi_rs_enhancements_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi rs enhancements supported value [0..1]");
++	}
++
++	// DMRS enhancements supported
++	guint16 drms_enhancements_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_drms_enhancements_supported, 2, ENC_BIG_ENDIAN);
++	if (drms_enhancements_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid drms enhancements supported value [0..1]");
++	}
++
++	// SRS enhancements supported
++	guint16 srs_enhancements_supported_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_enhancements_supported, 2, ENC_BIG_ENDIAN);
++	if (srs_enhancements_supported_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs enhancements supported value [0..1]");
++	}
++
++}
++
++static void dissect_pnf_phy_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 num_phy = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_number_phy, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "PHY Rel 13 List", ett_nfapi_pnf_phy_rel13, num_phy, dissect_pnf_phy_rel13_instance_value);
++}
++
++static void dissect_pnf_phy_rf_config_instance_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_phy_rf_config_info_phy_id, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_config_index, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_rf_config_index, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_pnf_phy_rf_config_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 num_configs = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pnf_phy_number_phy, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "PHY RF Config List", ett_nfapi_pnf_phy_rf_config, num_configs, dissect_pnf_phy_rf_config_instance_value);
++}
++
++static void dissect_dl_rs_tx_power_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_dl_rs_tx_power, 2, ENC_BIG_ENDIAN);
++
++	if (!(value >= 1 && value <= 255))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value [1..255]");
++	}
++}
++static void dissect_received_interference_power_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_received_interference_power, 2, ENC_BIG_ENDIAN);
++
++	if (!(value >= 1 && value <= 255))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value [1..255]");
++	}
++}
++static void dissect_thermal_noise_power_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_thermal_noise_power, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_dl_rs_tx_power_measurement_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_dl_rs_tx_power_measurement, 2, ENC_BIG_ENDIAN);
++}
++
++static void dissect_received_interference_power_result_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_received_interference_power_measurement, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_received_interference_power_measurement_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 num_resource_block = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_resource_blocks, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "Results", ett_nfapi_received_interference_power_mesurement_results, num_resource_block, dissect_received_interference_power_result_value);
++}
++static void dissect_thermal_noise_power_measurement_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_thermal_noise_power_measurement, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_duplex_mode_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_duplex_mode, 2, ENC_BIG_ENDIAN);
++
++	if (value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid duplex mode [0..2]");
++	}
++}
++static void dissect_pcfich_power_offset_value(ptvcursor_t* ptvc, packet_info *pinfo)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_pcfich_power_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid power level [0..10000]");
++	}
++}
++static void dissect_pb_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_pb, 2, ENC_BIG_ENDIAN);
++
++	if (value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink power allocation index [0..3]");
++	}
++}
++
++static void dissect_dl_cyclic_prefix_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_dl_cyclic_prefix_type, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dl cyclic prefix type [0..1]");
++	}
++}
++static void dissect_ul_cyclic_prefix_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_ul_cyclic_prefix_type, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul cyclic prefix type [0..1]");
++	}
++}
++static void dissect_dl_channel_bandwidth_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_downlink_channel_bandwidth, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 6 || value == 15 || value == 25 || value == 50 || value == 75 || value == 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink bandwidth value [6, 15, 25, 50, 75, 100]");
++	}
++}
++static void dissect_ul_channel_bandwidth_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_uplink_channel_bandwidth, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 6 || value == 15 || value == 25 || value == 50 || value == 75 || value == 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid uplink bandwidth value [6, 15, 25, 50, 75, 100]");
++	}
++}
++static void dissect_reference_signal_power_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_reference_signal_power, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid reference signal power [0..255]");
++	}
++
++}
++static void dissect_tx_antenna_ports_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_tx_antenna_ports, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 1 || value == 2 || value == 4 || value == 8 || value == 16))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tx antenna ports value [1, 2, 4, 8, 16]");
++	}
++}
++static void dissect_rx_antenna_ports_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_rx_antenna_ports, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 1 || value == 2 || value == 4 || value == 8 || value == 16))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rx antenna ports value [1, 2, 4, 8, 16]");
++	}
++}
++static void dissect_phich_resource_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_phich_resource, 2, ENC_BIG_ENDIAN);
++
++	if (value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid phich resource value [0..3]");
++	}
++}
++static void dissect_phich_duration_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_phich_duration, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid phich duration value [0..1]");
++	}
++}
++static void dissect_phich_power_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_phich_power_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid phich power offset value [0..10000]");
++	}
++}
++static void dissect_psch_synch_signal_epre_eprers_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_primary_synchronization_signal_epre_eprers, 2, ENC_BIG_ENDIAN);
++
++	if (value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid primary synchronization signal epre/eprers value [0..10000]");
++	}
++}
++static void dissect_physical_cell_id_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_physical_cell_id, 2, ENC_BIG_ENDIAN);
++
++	if (value > 503)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid physical cell id [0..503]");
++	}
++}
++static void dissect_ssch_synch_signal_epre_eprers_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_secondary_synchronization_signal_epre_eprers, 2, ENC_BIG_ENDIAN);
++
++	if (value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid secondary synchronization signal epre/eprers value [0..10000]");
++	}
++}
++static void dissect_prach_configuration_index_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_configuration_index, 2, ENC_BIG_ENDIAN);
++
++	if (value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach configuration index [0..63]");
++	}
++}
++static void dissect_prach_root_sequence_index_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_root_sequence_index, 2, ENC_BIG_ENDIAN);
++
++	if (value > 837)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach root sequency index [0..837]");
++	}
++}
++static void dissect_prach_zero_correlation_zone_configuration_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_zero_correlation_zone_configuration, 2, ENC_BIG_ENDIAN);
++
++	// How do differentiate between fdd 0..6 and tdd 0..15 ranges?
++	if (value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid zero correlation zone configuration [0..15]");
++	}
++}
++static void dissect_prach_high_speed_flag_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_high_speed_flag, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid high speed flag value [0..1]");
++	}
++}
++static void dissect_prach_frequency_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_frequency_offset, 2, ENC_BIG_ENDIAN);
++
++	// How to determine the ul channel bandiwdth?
++	if (value > (100 -6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach frequency offset value [0..94]");
++	}
++}
++static void dissect_pusch_hopping_mode_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_hopping_mode, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pusch hopping mode value [0..1]");
++	}
++}
++static void dissect_pusch_hopping_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_hopping_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > 98)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pusch hopping offset value [0..98]");
++	}
++}
++static void dissect_pusch_number_of_subbands_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_number_of_subbands, 2, ENC_BIG_ENDIAN);
++
++	if (!(value >= 1 && value <= 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of sub-bands [1..4]");
++	}
++}
++static void dissect_pucch_delta_pucch_shift_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_delta_pucch_shift, 2, ENC_BIG_ENDIAN);
++
++	if (!(value >= 1 && value <= 3))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta pucch shift [1..3]");
++	}
++}
++static void dissect_pucch_n_cqi_rb_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_n_cqi_rb, 2, ENC_BIG_ENDIAN);
++
++	if (value > 98)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n cqi rb value [0..98]");
++	}
++}
++static void dissect_pucch_n_an_cs_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_n_an_cs, 2, ENC_BIG_ENDIAN);
++
++	if (value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n an cs value [0..7]");
++	}
++}
++static void dissect_pucch_n1_pucch_an_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_n1_pucch_an, 2, ENC_BIG_ENDIAN);
++
++	if (value > 2047)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n1pucch an value [0..2047]");
++	}
++}
++static void dissect_srs_bandwidth_configuration_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_bandwidth_configuration, 2, ENC_BIG_ENDIAN);
++
++	if (value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs bandwidth configuration value [0..7]");
++	}
++}
++static void dissect_srs_max_uppts_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_max_up_pts, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid max up pts value [0..1]");
++	}
++}
++static void dissect_srs_subframe_configuration_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_srs_subframe_configuration, 2, ENC_BIG_ENDIAN);
++
++	if (value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs subframe configuration value [0..15]");
++	}
++}
++static void dissect_srs_acknack_srs_sim_tx_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_srs_acknack_srs_simultaneous_transmission, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs ack nack srs simultaneous transmission value [0..1]");
++	}
++}
++static void dissect_uplink_rs_hopping_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_uplink_rs_hopping, 2, ENC_BIG_ENDIAN);
++
++	if (value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid uplink rs hopping value [0..2]");
++	}
++}
++static void dissect_group_assignment_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_group_assignment, 2, ENC_BIG_ENDIAN);
++
++	if (value > 29)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid group assignment value [0..29]");
++	}
++}
++static void dissect_cyclic_shift_1_for_drms_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_cyclic_shift_1_for_drms, 2, ENC_BIG_ENDIAN);
++
++	if (value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cyclic shift 1 for drms value [0..7]");
++	}
++}
++static void dissect_tdd_subframe_assignement_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_subframe_assignment, 2, ENC_BIG_ENDIAN);
++
++	if (value > 6)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tdd subframe assignment value [0..6]");
++	}
++}
++static void dissect_tdd_subframe_patterns_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_special_subframe_patterns, 2, ENC_BIG_ENDIAN);
++
++	if (value > 9)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid special subframe pattern value [0..9]");
++	}
++}
++static void dissect_laa_ed_threashold_for_lbt_for_pdsch_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_ed_threshold_for_lbt_for_pdsch, 2, ENC_BIG_ENDIAN);
++
++	if (value > 70)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ed threshold for ltb for pdsch value [0..70]");
++	}
++}
++static void dissect_laa_ed_threashold_for_lbt_for_drs_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_ed_threshold_for_lbt_for_drs, 2, ENC_BIG_ENDIAN);
++
++	if (value > 70)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ed threshold for ltb for drs value [0..70]");
++	}
++}
++static void dissect_laa_pd_threshold_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_pd_threshold, 2, ENC_BIG_ENDIAN);
++
++	if (value > 70 && value != 65535)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pd threshold value [0..70, 65536]");
++	}
++}
++static void dissect_laa_multi_carrier_type_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_multi_carrier_type, 2, ENC_BIG_ENDIAN);
++
++	if (value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mutli carrier type [0..4]");
++	}
++}
++static void dissect_laa_multi_carrier_tx_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_multi_carrier_tx, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mutli carrier tx value [0..1]");
++	}
++}
++static void dissect_laa_multi_carrier_freeze_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_multi_carrier_freeze, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mutli carrier freeze value [0..1]");
++	}
++}
++static void dissect_laa_tx_antenna_port_for_drs_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_tx_antenna_ports_for_drs, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 1 || value == 2 || value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tx antenna ports for drs value [1, 2, 4]");
++	}
++}
++static void dissect_laa_transmission_power_for_drs_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_transmission_power_for_drs, 2, ENC_BIG_ENDIAN);
++
++	if (value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power for drs [0..10000]");
++	}
++}
++static void dissect_emtc_pbch_repeitions_enabled_r13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_pbch_repetitions_enabled_r13, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pbch repetitions enabled r13 value [0..1]");
++	}
++}
++static void dissect_emtc_prach_cat_m_root_sequence_index_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_cat_m_root_sequence_index, 2, ENC_BIG_ENDIAN);
++
++	if (value > 837)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach cat-m root sequence index value [0..837]");
++	}
++}
++static void dissect_emtc_prach_cat_m_zero_correlation_zone_configuration_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_cat_m_zero_correlation_zone_configuration, 2, ENC_BIG_ENDIAN);
++
++	if (value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach cat-m zero correlation zone configuration value [0..15]");
++	}
++}
++static void dissect_emtc_prach_cat_m_high_speed_flag_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_cat_m_high_speed_flag, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach cat-m high speed flag value [0..1]");
++	}
++}
++static void dissect_emtc_prach_ce_level_0_enabled_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_0_enable, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #0 enable value [0..1]");
++	}
++}
++static void dissect_emtc_prach_ce_level_0_configuration_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_0_configuration_index, 2, ENC_BIG_ENDIAN);
++
++	if (value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #0 configuration index value [0..63]");
++	}
++}
++static void dissect_emtc_prach_ce_level_0_frequency_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_0_frequency_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > (100 - 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #0 frequency offset value [0..94]");
++	}
++}
++static void dissect_emtc_preach_ce_level_0_num_of_repeitions_per_attempt_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_0_number_of_repetitions_per_attempt, 2, ENC_BIG_ENDIAN);
++
++	if (!( value == 1 || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 ||
++		   value == 64 || value == 128))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #0 number of repetitions per attempt value [1, 2, 4, 8, 16, 32, 64, 128]");
++	}
++}
++static void dissect_emtc_ce_level_0_starting_subframe_periodicity_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_0_starting_subframe_periodicity, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 0xFFF || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 ||
++		  value == 64 || value == 128 || value == 256))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #0 starting subframe periodicity value [2, 4, 8, 16, 32, 64, 128, 256, 0xFFFF]");
++	}
++}
++static void dissect_emtc_preach_ce_level_0_hopping_enabled_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_0_hopping_enabled, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #0 hopping enabled value [0..1]");
++	}
++}
++static void dissect_emtc_preach_ce_level_0_hopping_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_0_hopping_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > 94)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #0 hopping offset value [0..94]");
++	}
++}
++static void dissect_emtc_prach_ce_level_1_enabled_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_1_enable, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #1 enable value [0..1]");
++	}
++}
++static void dissect_emtc_prach_ce_level_1_configuration_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_1_configuration_index, 2, ENC_BIG_ENDIAN);
++
++	if (value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #1 configuration index value [0..63]");
++	}
++}
++static void dissect_emtc_prach_ce_level_1_frequency_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_1_frequency_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > (100 - 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #1 frequency offset value [0..94]");
++	}
++}
++static void dissect_emtc_preach_ce_level_1_num_of_repeitions_per_attempt_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_1_number_of_repetitions_per_attempt, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 1 || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 ||
++		value == 64 || value == 128))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #1 number of repetitions per attempt value [1, 2, 4, 8, 16, 32, 64, 128]");
++	}
++}
++static void dissect_emtc_ce_level_1_starting_subframe_periodicity_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_1_starting_subframe_periodicity, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 0xFFF || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 ||
++		value == 64 || value == 128 || value == 256))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #1 starting subframe periodicity value [2, 4, 8, 16, 32, 64, 128, 256, 0xFFFF]");
++	}
++}
++static void dissect_emtc_preach_ce_level_1_hopping_enabled_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_1_hopping_enabled, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #1 hopping enabled value [0..1]");
++	}
++}
++static void dissect_emtc_preach_ce_level_1_hopping_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_1_hopping_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > 94)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #1 hopping offset value [0..94]");
++	}
++}
++static void dissect_emtc_prach_ce_level_2_enabled_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_2_enable, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #2 enable value [0..1]");
++	}
++}
++static void dissect_emtc_prach_ce_level_2_configuration_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_2_configuration_index, 2, ENC_BIG_ENDIAN);
++
++	if (value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #2 configuration index value [0..63]");
++	}
++}
++static void dissect_emtc_prach_ce_level_2_frequency_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_2_frequency_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > (100 - 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #2 frequency offset value [0..94]");
++	}
++}
++static void dissect_emtc_preach_ce_level_2_num_of_repeitions_per_attempt_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_2_number_of_repetitions_per_attempt, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 1 || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 ||
++		value == 64 || value == 128))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #2 number of repetitions per attempt value [1, 2, 4, 8, 16, 32, 64, 128]");
++	}
++}
++static void dissect_emtc_ce_level_2_starting_subframe_periodicity_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_2_starting_subframe_periodicity, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 0xFFF || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 ||
++		value == 64 || value == 128 || value == 256))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #2 starting subframe periodicity value [2, 4, 8, 16, 32, 64, 128, 256, 0xFFFF]");
++	}
++}
++static void dissect_emtc_preach_ce_level_2_hopping_enabled_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_2_hopping_enabled, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #2 hopping enabled value [0..1]");
++	}
++}
++static void dissect_emtc_preach_ce_level_2_hopping_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_2_hopping_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > 94)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #2 hopping offset value [0..94]");
++	}
++}
++static void dissect_emtc_prach_ce_level_3_enabled_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_3_enable, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #3 enable value [0..1]");
++	}
++}
++static void dissect_emtc_prach_ce_level_3_configuration_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_3_configuration_index, 2, ENC_BIG_ENDIAN);
++
++	if (value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #2 configuration index value [0..63]");
++	}
++}
++static void dissect_emtc_prach_ce_level_3_frequency_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_3_frequency_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > (100 - 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #3 frequency offset value [0..94]");
++	}
++}
++static void dissect_emtc_preach_ce_level_3_num_of_repeitions_per_attempt_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_3_number_of_repetitions_per_attempt, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 1 || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 ||
++		value == 64 || value == 128))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #3 number of repetitions per attempt value [1, 2, 4, 8, 16, 32, 64, 128]");
++	}
++}
++static void dissect_emtc_ce_level_3_starting_subframe_periodicity_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_3_starting_subframe_periodicity, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 0xFFF || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 ||
++		value == 64 || value == 128 || value == 256))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #3 starting subframe periodicity value [2, 4, 8, 16, 32, 64, 128, 256, 0xFFFF]");
++	}
++}
++static void dissect_emtc_preach_ce_level_3_hopping_enabled_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_3_hopping_enabled, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #3 hopping enabled value [0..1]");
++	}
++}
++static void dissect_emtc_preach_ce_level_3_hopping_offset_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_prach_ce_level_3_hopping_offset, 2, ENC_BIG_ENDIAN);
++
++	if (value > 94)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach ce level #3 hopping offset value [0..94]");
++	}
++}
++static void dissect_emtc_pucch_interval_ul_hopping_config_common_mode_a_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_pucch_internal_ul_hopping_config_common_mode_a, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 1 || value == 2 || value == 4 || value == 8 || value == 5 || value == 10 || value == 20))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch internal ul hopping config common mode a value [1, 2, 4, 8] or [1, 5, 10, 20]");
++	}
++}
++static void dissect_emtc_pucch_interval_ul_hopping_config_common_mode_b_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_pucch_internal_ul_hopping_config_common_mode_b, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 2 || value == 4 || value == 8 || value == 16 || value == 5 || value == 10 || value == 20 || value == 40))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch internal ul hopping config common mode a value [2, 4, 8, 16] or [5, 10, 20, 40]");
++	}
++}
++static void dissect_dl_bandwidth_support_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add_no_advance(ptvc, hf_nfapi_dl_bandwidth_support, 2, ENC_BIG_ENDIAN);
++
++	if (value > 0x1F)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink bandwidth support bit [0..0x1F]");
++	}
++
++	proto_tree* dl_bw_support_tree = proto_item_add_subtree(item, ett_nfapi_downlink_bandwidth_support);
++
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_6, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 15, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_15, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 14, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_25, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 13, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_50, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 12, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_75, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 11, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_bw_support_tree, hf_nfapi_dl_bandwidth_support_100, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 10, 1, ENC_NA);
++
++	ptvcursor_advance(ptvc, 2);
++}
++static void dissect_ul_bandwidth_support_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add_no_advance(ptvc, hf_nfapi_ul_bandwidth_support, 2, ENC_BIG_ENDIAN);
++
++	if (value > 0x1F)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid uplink bandwidth support bit [0..0x1F]");
++	}
++
++	proto_tree* ul_bw_support_tree = proto_item_add_subtree(item, ett_nfapi_uplink_bandwidth_support);
++
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_6, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 15, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_15, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 14, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_25, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 13, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_50, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 12, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_75, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 11, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_bw_support_tree, hf_nfapi_ul_bandwidth_support_100, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 10, 1, ENC_NA);
++
++	ptvcursor_advance(ptvc, 2);
++
++}
++static void dissect_dl_modulation_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add_no_advance(ptvc, hf_nfapi_dl_modulation_support, 2, ENC_BIG_ENDIAN);
++
++	if (value > 0x7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink modulation support bit [0..0x7]");
++	}
++
++	proto_tree* dl_mod_support_tree = proto_item_add_subtree(item, ett_nfapi_downlink_modulation_support);
++
++	proto_tree_add_bits_item(dl_mod_support_tree, hf_nfapi_dl_modulation_support_qpsk, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 15, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_mod_support_tree, hf_nfapi_dl_modulation_support_16qam, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 14, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_mod_support_tree, hf_nfapi_dl_modulation_support_64qam, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 13, 1, ENC_NA);
++	proto_tree_add_bits_item(dl_mod_support_tree, hf_nfapi_dl_modulation_support_256qam, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 12, 1, ENC_NA);
++
++	ptvcursor_advance(ptvc, 2);
++}
++static void dissect_ul_modulation_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add_no_advance(ptvc, hf_nfapi_ul_modulation_support, 2, ENC_BIG_ENDIAN);
++
++	if (value > 0x7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid uplink modulation support bit [0..0x7]");
++	}
++
++	proto_tree* ul_mod_support_tree = proto_item_add_subtree(item, ett_nfapi_uplink_modulation_support);
++
++	proto_tree_add_bits_item(ul_mod_support_tree, hf_nfapi_ul_modulation_support_qpsk, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 15, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_mod_support_tree, hf_nfapi_ul_modulation_support_16qam, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 14, 1, ENC_NA);
++	proto_tree_add_bits_item(ul_mod_support_tree, hf_nfapi_ul_modulation_support_64qam, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 13, 1, ENC_NA);
++
++	ptvcursor_advance(ptvc, 2);
++}
++static void dissect_phy_antenna_capability_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_phy_antenna_capability, 2, ENC_BIG_ENDIAN);
++
++	if (!(value == 1 || value == 2 || value == 4 || value == 8 || value == 16))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid phy antenna capability [1, 2, 4, 8, 16]");
++	}
++}
++static void dissect_release_capability_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add_no_advance(ptvc, hf_nfapi_release_capability, 2, ENC_BIG_ENDIAN);
++
++	if (value > 0x3F)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid release capability value [0..0x3F]");
++	}
++
++	proto_tree* release_support_tree = proto_item_add_subtree(item, ett_nfapi_release_support);
++
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel8, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 15, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel9, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 14, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel10, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 13, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel11, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 12, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel12, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 11, 1, ENC_NA);
++	proto_tree_add_bits_item(release_support_tree, hf_nfapi_maximum_3gpp_release_supported_rel13, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8 + 10, 1, ENC_NA);
++
++	ptvcursor_advance(ptvc, 2);
++}
++static void dissect_mbsfn_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_mbsfn_capability, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mbsfn capability bit [0..0x1]");
++	}
++}
++static void dissect_laa_support_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_laa_capability, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid laa support bit [0..0x1]");
++	}
++}
++static void dissect_laa_pd_sensing_lbt_support_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_pd_sensing_lbt_support, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pd sensing lbt support bit [0..0x1]");
++	}
++}
++static void dissect_laa_multi_carrier_lbt_support_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_multi_carrier_lbt_support, 2, ENC_BIG_ENDIAN);
++
++	if (value > 0xF)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid multi carrier LBT support bit [0..0xF]");
++	}
++}
++static void dissect_laa_partial_sf_support_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_partial_sf_support, 2, ENC_BIG_ENDIAN);
++
++	if (value > 0x1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid partial SF support bit [0..0x1]");
++	}
++}
++static void dissect_data_report_mode_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_data_report_mode, 2, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid data report mode value [0..1]");
++	}
++}
++static void dissect_sfn_sf_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_sfnsf, 2, ENC_BIG_ENDIAN);
++
++	guint16 sfn = value >> 0x4;
++	guint16 sf = value & 0x000F;
++	if (sfn > 1023 || sf > 9)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid sfn/sf value sfn:%d [0..1023] sf:%d [0..9]", sfn, sf);
++	}
++}
++static void dissect_phy_state_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_phy_state, 2, ENC_BIG_ENDIAN);
++
++	if (value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid phy state [0..2]");
++	}
++}
++static void dissect_p7_vnf_address_ipv4_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_vnf_address_ipv4, 4, ENC_NA);
++}
++static void dissect_p7_vnf_address_ipv6_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_vnf_address_ipv6, 16, ENC_NA);
++}
++static void dissect_p7_vnf_port_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_vnf_port, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_p7_pnf_address_ipv4_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_pnf_address_ipv4, 4, ENC_NA);
++}
++static void dissect_p7_pnf_address_ipv6_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_pnf_address_ipv6, 16, ENC_NA);
++}
++static void dissect_p7_pnf_port_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_pnf_port, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_downlink_ues_per_subframe_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_dl_ue_per_sf, 1, ENC_BIG_ENDIAN);
++}
++static void dissect_uplink_ues_per_subframe_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_ul_ue_per_sf, 1, ENC_BIG_ENDIAN);
++}
++static void dissect_rf_band_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_band, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_rf_bands_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 count = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_rf_bands, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "RF Band List", ett_nfapi_rf_bands, count, dissect_rf_band_value);
++}
++static void dissect_timing_window_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_timing_window, 1, ENC_BIG_ENDIAN);
++
++	if (value > 30)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing window value [0..30]");
++	}
++}
++static void dissect_timing_info_mode_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_timing_info_mode, 1, ENC_BIG_ENDIAN);
++
++	if (value > 0x3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing info mode [0..0x3]");
++	}
++}
++static void dissect_timing_info_period_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_timing_info_period, 1, ENC_BIG_ENDIAN);
++
++	// Compiler throws an hissy fit that value <= 255 is always true... Yes, but I am trying to
++	// follow the specification...
++	if (!(value >= 1 /* && value <= 255*/))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing info period [1..255]");
++	}
++}
++static void dissect_maximum_transmit_power_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_maximum_transmit_power_2, 2, ENC_BIG_ENDIAN);
++
++	if (value > 700)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid maxiumum transmit power [0..700]");
++	}
++}
++static void dissect_earfcn_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_earfcn, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_nmm_gsm_frequency_bands_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 count = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_rf_bands, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "RF Band List", ett_nfapi_rf_bands, count, dissect_rf_band_value);
++}
++static void dissect_nmm_umts_frequency_bands_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 count = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_rf_bands, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "RF Band List", ett_nfapi_rf_bands, count, dissect_rf_band_value);
++}
++static void dissect_nmm_lte_frequency_bands_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 count = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_rf_bands, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "RF Band List", ett_nfapi_rf_bands, count, dissect_rf_band_value);
++}
++static void dissect_nmm_uplink_rssi_supported_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_nmm_uplink_rssi_supported, 1, ENC_BIG_ENDIAN);
++
++	if (value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid nmm uplink rssi supported value [0..1]");
++	}
++}
++static void dissect_dl_config_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_dl_config_pdu_type, 1, ENC_BIG_ENDIAN);
++	guint8 size = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pdu_size, 1, ENC_BIG_ENDIAN);
++
++	guint pdu_end = (ptvcursor_current_offset(ptvc) + size - 2);
++	dissect_tlv_list(ptvc, pinfo, pdu_end);
++}
++static void dissect_dl_config_request_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Number of PDCCH OFDM symbols
++	guint8 number_of_pdcch_ofdm_symbols_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item  = ptvcursor_add(ptvc, hf_nfapi_number_pdcch_ofdm_symbols, 1, ENC_BIG_ENDIAN);
++	if (number_of_pdcch_ofdm_symbols_value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of pdcch ofdm symbols value [0..4]");
++	}
++
++	// Number of DCIs
++	guint8 number_of_dcis_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_dci, 1, ENC_BIG_ENDIAN);
++
++	// Number of  PDUs
++	guint16 number_of_pdus_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_pdus, 2, ENC_BIG_ENDIAN);
++	if (number_of_pdus_value > 514)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of pdus value [0..514]");
++	}
++
++	// Number of PDSCH RNTIs
++	ptvcursor_add(ptvc, hf_nfapi_number_pdsch_rnti, 1, ENC_BIG_ENDIAN);
++
++	// Transmission power for PCFICH
++	guint16 transmission_power_for_pdsch_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power_pcfich, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_for_pdsch_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power for pcfich value [0..10000]");
++	}
++
++	dissect_array_value(ptvc, pinfo, "DL Config PDU List", ett_nfapi_dl_config_request_pdu_list, number_of_dcis_value + number_of_pdus_value, dissect_dl_config_pdu);
++}
++static void dissect_dl_config_request_bch_pdu_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Length
++	ptvcursor_add(ptvc, hf_nfapi_length, 2, ENC_BIG_ENDIAN);
++
++	// PDU index
++	ptvcursor_add(ptvc, hf_nfapi_pdu_index, 2, ENC_BIG_ENDIAN);
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..10000]");
++	}
++
++}
++static void dissect_dl_config_request_dl_dci_pdu_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// DCI format
++	guint8 dci_format_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dl_dci_format, 1, ENC_BIG_ENDIAN);
++	if (dci_format_value > 9)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dci format value [0..9]");
++	}
++
++	// CCE index
++	guint8 cce_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cce_idx, 1, ENC_BIG_ENDIAN);
++	if (cce_index_value > 88)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cce index value [0..88]");
++	}
++
++	// Aggregation level
++	guint8 aggregation_level_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_aggregation_level, 1, ENC_BIG_ENDIAN);
++	if (!(aggregation_level_value == 1 || aggregation_level_value == 2 || aggregation_level_value == 4 ||
++		  aggregation_level_value == 8 || aggregation_level_value == 16 || aggregation_level_value == 32))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid aggregation level value [1, 2, 4, 8, 16, 32]");
++	}
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (rnti_value < 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++
++	// Resource allocation type
++	guint8 resource_allocation_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_allocation_type, 1, ENC_BIG_ENDIAN);
++	if (resource_allocation_type_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource allocation type value [0..1]");
++	}
++
++	// Virtual resource block assignment flag
++	guint8 virtual_resource_block_assignment_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_virtual_resource_block_assignment_flag, 1, ENC_BIG_ENDIAN);
++	if (virtual_resource_block_assignment_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid virtual resource block assignment flag value [0..1]");
++	}
++
++	// Resource block coding
++	ptvcursor_add(ptvc, hf_nfapi_resource_block_coding, 4, ENC_BIG_ENDIAN);
++
++	// MCS_1
++	guint8 mcs_1_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mcs_1, 1, ENC_BIG_ENDIAN);
++	if (mcs_1_value > 31)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mcs 1 value [0..31]");
++	}
++
++	// Redundancy version_1
++	guint8 redundancy_version_1_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_redundancy_version_1, 1, ENC_BIG_ENDIAN);
++	if (redundancy_version_1_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid redundancy version 1 value [0..3]");
++	}
++
++	// New data indicator_1
++	guint8 new_data_indicator_1_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_new_data_indicator_1, 1, ENC_BIG_ENDIAN);
++	if (new_data_indicator_1_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid new data indicator 1 value [0..1]");
++	}
++
++	// Transport block to codeword swap flag
++	guint8 transport_block_to_codeword_swap_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transport_block_to_codeword_swap_flag, 1, ENC_BIG_ENDIAN);
++	if (transport_block_to_codeword_swap_flag_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transport block to codeword swap flag value [0..1]");
++	}
++
++	// MCS_2
++	guint8 mcs_2_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mcs_2, 1, ENC_BIG_ENDIAN);
++	if (mcs_2_value > 31)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mcs 2 value [0..31]");
++	}
++
++	// Redundancy version_2
++	guint8 redundancy_version_2_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_redundancy_version_2, 1, ENC_BIG_ENDIAN);
++	if (redundancy_version_2_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid redundancy version 2 value [0..3]");
++	}
++
++	// New Data indicator_2
++	guint8 new_data_indicator_2_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_new_data_indicator_2, 1, ENC_BIG_ENDIAN);
++	if (new_data_indicator_2_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid new data indicator 2 value [0..1]");
++	}
++
++	// HARQ process
++	guint8 harq_process_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_process, 1, ENC_BIG_ENDIAN);
++	if (harq_process_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq process value [0..15]");
++	}
++
++	// TPMI
++	guint8 tpmi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tpmi, 1, ENC_BIG_ENDIAN);
++	if (tpmi_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpmi value [0..3]");
++	}
++
++	// PMI
++	guint8 pmi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pmi, 1, ENC_BIG_ENDIAN);
++	if (pmi_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpmi value [0..2]");
++	}
++
++	// Precoding information
++	guint8 precoding_information_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_precoding_information, 1, ENC_BIG_ENDIAN);
++	if (precoding_information_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid precoding information value [0..15]");
++	}
++
++	// TPC
++	guint8 tpc_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tpc, 1, ENC_BIG_ENDIAN);
++	if (tpc_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpc value [0..3]");
++	}
++
++	// Downlink assignment index
++	guint8 downlink_assignment_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_downlink_assignment_index, 1, ENC_BIG_ENDIAN);
++	if (downlink_assignment_index_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink assignment value [0..15]");
++	}
++
++	// NGAP
++	guint8 ngap_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ngap, 1, ENC_BIG_ENDIAN);
++	if (ngap_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ngap value [0..1]");
++	}
++
++	// Transport block size index
++	guint8 transport_block_size_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transport_block_size_index, 1, ENC_BIG_ENDIAN);
++	if (transport_block_size_index_value > 31)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transport block size index value [0..31]");
++	}
++
++	// Downlink power offset
++	guint8 downlink_power_offset_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_downlink_power_offset, 1, ENC_BIG_ENDIAN);
++	if (downlink_power_offset_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink power offset value [0..1]");
++	}
++
++	// Allocate PRACH flag
++	guint8 allocate_prach_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_allocate_prach_flag, 1, ENC_BIG_ENDIAN);
++	if (allocate_prach_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid allocate prach flag value [0..1]");
++	}
++
++	// Preamble index
++	guint8 preamble_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_preamble_index, 1, ENC_BIG_ENDIAN);
++	if (preamble_index_value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid preamble index value [0..63]");
++	}
++
++	// PRACH mask index
++	guint8 prach_mask_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_prach_mask_index, 1, ENC_BIG_ENDIAN);
++	if (prach_mask_index_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach mask index value [0..15]");
++	}
++
++	// RNTI type
++	guint8 rnti_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti_type, 1, ENC_BIG_ENDIAN);
++	if (!(rnti_type_value >= 1 && rnti_type_value <= 3))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti type value [1..3]");
++	}
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value value [0..10000]");
++	}
++
++}
++static void dissect_dl_config_request_dl_dci_pdu_rel9_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// MCCH flag
++	guint8 mcch_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mcch_flag, 1, ENC_BIG_ENDIAN);
++	if (mcch_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mcch flag value [0..1]");
++	}
++
++	// MCCH change notification
++	ptvcursor_add(ptvc, hf_nfapi_mcch_change_notification, 1, ENC_BIG_ENDIAN);
++
++	// Scrambling identity
++	guint8 scrambling_identity_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_scrambling_identity, 1, ENC_BIG_ENDIAN);
++	if (scrambling_identity_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid scrambling identity value [0..1]");
++	}
++
++}
++static void dissect_dl_config_request_dl_dci_pdu_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Cross carrier scheduling flag
++	guint8 cross_carrier_scheduling_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cross_carrier_scheduling_flag, 1, ENC_BIG_ENDIAN);
++	if (cross_carrier_scheduling_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cross carrier scheduling flag value [0..1]");
++	}
++
++	// Carrier indicator
++	guint8 carrier_indicator_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_carrier_indicator, 1, ENC_BIG_ENDIAN);
++	if (carrier_indicator_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid carrier indicator value [0..7]");
++	}
++
++	// SRS flag
++	guint8 srs_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_flag, 1, ENC_BIG_ENDIAN);
++	if (srs_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs flag value [0..1]");
++	}
++
++	// SRS request
++	guint8 srs_request_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_request, 1, ENC_BIG_ENDIAN);
++	if (srs_request_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs request value [0..1]");
++	}
++
++	// Antenna ports, scrambling and layers
++	guint8 antenna_ports_scrambling_and_layers_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_antenna_ports_scrambling_and_layers, 1, ENC_BIG_ENDIAN);
++	if (antenna_ports_scrambling_and_layers_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid antenna ports scrambling and layers value [0..15]");
++	}
++
++	// Total DCI length including padding
++	ptvcursor_add(ptvc, hf_nfapi_total_dci_length_including_padding, 1, ENC_BIG_ENDIAN);
++
++	// N_DL_RB
++	// TODO : This is missing from the encoder....
++	//ptvcursor_add(ptvc, hf_nfapi_n_dl_rb, 1, ENC_BIG_ENDIAN);
++}
++static void dissect_dl_config_request_dl_dci_pdu_rel11_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// HARQ-ACK resource offset
++	guint8 harq_ack_resource_offset_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_ack_resource_offset, 1, ENC_BIG_ENDIAN);
++	if (harq_ack_resource_offset_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid hack ack resource offset value [0..3]");
++	}
++
++	// PDSCH RE Mapping and Quasi-Co-Location Indicator
++	guint8 pdsch_re_mapping_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pdsch_re_mapping_and_quasi_co_location_indicator, 1, ENC_BIG_ENDIAN);
++	if (pdsch_re_mapping_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdsch re mapping value [0..3]");
++	}
++
++}
++static void dissect_ul_dl_configuration_index_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// UL/DL configuration indication
++	guint8 ul_dl_configuration_indication_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_ul_dl_configuration_index, 1, ENC_BIG_ENDIAN);
++	if (!(ul_dl_configuration_indication_value >= 1 && ul_dl_configuration_indication_value <= 5))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul/dl configuration indication value [1..5]");
++	}
++}
++static void dissect_dl_config_request_dl_dci_pdu_rel12_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Primary cell type
++	guint8 primary_cell_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_primary_cell_type, 1, ENC_BIG_ENDIAN);
++	if (primary_cell_type_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid primary cell type value [0..2]");
++	}
++
++	// UL/DL configuration flag
++	guint8 ul_dl_configuration_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ul_dl_configuration_flag, 1, ENC_BIG_ENDIAN);
++	if (ul_dl_configuration_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul/dl configuration flag value [0..1]");
++	}
++
++	// Number of UL / DL configurations
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_ul_dl_configurations, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "UL/DL Configurations", ett_nfapi_pnf_phy, count, dissect_ul_dl_configuration_index_value);
++}
++static void dissect_dl_config_request_dl_dci_pdu_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_laa_end_partial_sf_flag, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_laa_end_partial_sf_configuration, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_initial_lbt_sf, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_codebooksize_determination_r13, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_rel13_drms_table_flag, 1, ENC_BIG_ENDIAN);
++}
++static void dissect_dl_config_request_mch_pdu_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_length, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_pdu_index, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_resource_allocation_type, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_resource_block_coding, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_modulation, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_mbsfn_area_id, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_codebook_index_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 codebook_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_codebook_index, 1, ENC_BIG_ENDIAN);
++	if (codebook_index_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid codebook index value [0..15]");
++	}
++}
++static void dissect_bf_vector_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_bf_vector_bf_value, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_bf_vector_type_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_bf_vector_subband_index, 1, ENC_BIG_ENDIAN);
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_bf_vector_num_antennas, 1, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "Antennas",  ett_nfapi_bf_vector_antennas, count, dissect_bf_vector_value);
++}
++static void dissect_dl_config_request_dlsch_pdu_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Length
++	ptvcursor_add(ptvc, hf_nfapi_length, 2, ENC_BIG_ENDIAN);
++
++	// PDU index
++	ptvcursor_add(ptvc, hf_nfapi_pdu_index, 2, ENC_BIG_ENDIAN);
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (!(rnti_value >= 1 /* && rnti_value <= 65535)*/))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid codebook index value [1..65535]");
++	}
++
++	// Resource allocation type
++	guint8 resource_allocation_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_allocation_type, 1, ENC_BIG_ENDIAN);
++	if (resource_allocation_type_value > 5)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource allocation type value [0..5]");
++	}
++
++	// Virtual resource block assignment flag
++	guint8 virtual_resource_block_assignment_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_virtual_resource_block_assignment_flag, 1, ENC_BIG_ENDIAN);
++	if (virtual_resource_block_assignment_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid virtual resource block allocation assignment value [0..1]");
++	}
++
++	// Resource block coding
++	ptvcursor_add(ptvc, hf_nfapi_resource_block_coding, 4, ENC_BIG_ENDIAN);
++
++	// Modulation
++	guint8 modulation_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_modulation, 1, ENC_BIG_ENDIAN);
++	if (!(modulation_value == 2 || modulation_value == 4 || modulation_value == 6 || modulation_value == 8))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid modulation value [2, 4, 6, 8]");
++	}
++
++	// Redundancy version
++	guint8 redundancy_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_redundancy_version, 1, ENC_BIG_ENDIAN);
++	if (redundancy_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid redundancy value [0..3]");
++	}
++
++	// Transport blocks
++	guint8 transport_blocks_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transport_blocks, 1, ENC_BIG_ENDIAN);
++	if (!(transport_blocks_value >= 1 && transport_blocks_value <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transport blocks value [1..2]");
++	}
++
++	// Transport block to codeword swap flag
++	guint8 transport_blocks_to_codeword_swap_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transport_block_to_codeword_swap_flag, 1, ENC_BIG_ENDIAN);
++	if (transport_blocks_to_codeword_swap_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transport block to codeword swap flag value [0..1]");
++	}
++
++	// Transmission scheme
++	guint8 transmission_scheme_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_scheme, 1, ENC_BIG_ENDIAN);
++	if (transmission_scheme_value > 13)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission scheme value [0..13]");
++	}
++
++	// Number of layers
++	guint8 number_of_layers_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_layers, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_layers_value >= 1 && number_of_layers_value <= 8))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of layers value [1..8]");
++	}
++
++	// Number of subbands
++	guint8 num_subbands = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_subbands, 1, ENC_BIG_ENDIAN);
++	if (num_subbands > 13)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of subbands value [0..13]");
++	}
++
++	dissect_array_value(ptvc, pinfo, "Subbands", ett_nfapi_subbands, num_subbands, dissect_codebook_index_value);
++
++	// UE category capacity
++	guint8 ue_category_capacity_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ue_category_capacity, 1, ENC_BIG_ENDIAN);
++	if (ue_category_capacity_value > 14)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ue category capacity value [0..14]");
++	}
++
++	// P-A
++	guint8 pa_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pa, 1, ENC_BIG_ENDIAN);
++	if (pa_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid p-a value [0..7]");
++	}
++
++	// Delta power offset index
++	guint8 delta_power_offset_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_delta_power_offset_index, 1, ENC_BIG_ENDIAN);
++	if (delta_power_offset_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta power offset value [0..1]");
++	}
++
++	// NGAP
++	guint8 ngap_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ngap, 1, ENC_BIG_ENDIAN);
++	if (ngap_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ngap value [0..1]");
++	}
++
++	// NPRB
++	guint8 nrpb_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_nprb, 1, ENC_BIG_ENDIAN);
++	if (nrpb_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid nprb value [0..1]");
++	}
++
++	// Transmission mode
++	guint8 transmission_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_mode, 1, ENC_BIG_ENDIAN);
++	if (!(transmission_mode_value >= 1 && transmission_mode_value <= 10))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission mode value [1..10]");
++	}
++
++	// numBfPRBperSubband
++	ptvcursor_add(ptvc, hf_nfapi_num_bf_prb_per_subband, 1, ENC_BIG_ENDIAN);
++
++	// numBfVector
++	guint8 num_vectors = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_num_bf_vector, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "Beamforming Vectors", ett_nfapi_bf_vectors, num_vectors, dissect_bf_vector_type_value);
++}
++static void dissect_csi_rs_resource_config_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 csi_rs_resource_config_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_csi_rs_resource_config, 1, ENC_BIG_ENDIAN);
++	if (csi_rs_resource_config_value > 31)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi-rs resource config value [0..31]");
++	}
++}
++static void dissect_dl_config_request_dlsch_pdu_rel9_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 nscid_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_nscid, 1, ENC_BIG_ENDIAN);
++	if (nscid_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid nscid value [0..1]");
++	}
++}
++static void dissect_dl_config_request_dlsch_pdu_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// CSI-RS flag
++	guint8 csi_rs_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_rs_flag, 1, ENC_BIG_ENDIAN);
++	if (csi_rs_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi-rs flag value [0..1]");
++	}
++
++	// CSI-RS resource config R10
++	ptvcursor_add(ptvc, hf_nfapi_csi_rs_resource_config_r10, 1, ENC_BIG_ENDIAN);
++
++	// CSI-RS zero Tx power resource config bitmap R10
++	ptvcursor_add(ptvc, hf_nfapi_csi_rs_zero_tx_power_resource_config_bitmap_r10, 2, ENC_BIG_ENDIAN);
++
++	// CSI-RS Number of NZP configuration
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_rs_number_of_nzp_configurations, 1, ENC_BIG_ENDIAN);
++	if (count > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi-rs number of nzp configuration value [0..3]");
++	}
++
++	// CSI-RS configuration
++	dissect_array_value(ptvc, pinfo, "CSI-RS Resource Configs", ett_nfapi_csi_rs_resource_configs, count, dissect_csi_rs_resource_config_value);
++
++	// PDSCH start
++	guint8 pdsch_start_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pdsch_start, 1, ENC_BIG_ENDIAN);
++	if (pdsch_start_value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdsch start value [0..4]");
++	}
++
++}
++static void dissect_dl_config_request_dlsch_pdu_rel11_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// DMRS Config flag
++	guint8 drms_config_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_drms_config_flag, 1, ENC_BIG_ENDIAN);
++	if (drms_config_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid drms config flag value [0..1]");
++	}
++
++	// DMRS-Scrambling
++	guint16 drms_scrambling_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_drms_scrambling, 2, ENC_BIG_ENDIAN);
++	if (drms_scrambling_value > 503)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid drms scrambling value [0..503]");
++	}
++
++	// CSI Config flag
++	guint8 csi_config_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_config_flag, 1, ENC_BIG_ENDIAN);
++	if (csi_config_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi config flag value [0..1]");
++	}
++
++	// CSI- Scrambling
++	guint16 csi_scrambling_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_scrambling, 2, ENC_BIG_ENDIAN);
++	if (csi_scrambling_value > 503)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi scrambling value [0..503]");
++	}
++
++	// PDSCH RE mapping flag
++	guint8 pdsch_re_mapping_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pdsch_re_mapping_flag, 1, ENC_BIG_ENDIAN);
++	if (pdsch_re_mapping_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdsch re mapping flag value [0..1]");
++	}
++
++	// PDSCH RE mapping antenna ports
++	guint8 pdsch_re_mapping_antenna_ports_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pdsch_re_mapping_antenna_ports, 1, ENC_BIG_ENDIAN);
++	if (!(pdsch_re_mapping_antenna_ports_value == 1 || pdsch_re_mapping_antenna_ports_value == 2 ||
++		  pdsch_re_mapping_antenna_ports_value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdsch re mapping antenna ports value [1, 2, 4]");
++	}
++
++	// PDSCH RE mapping freq shift
++	guint8 pdsch_re_mapping_freq_shift_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pdsch_re_mapping_freq_shift, 1, ENC_BIG_ENDIAN);
++	if (pdsch_re_mapping_freq_shift_value > 5)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdsch re mapping freq shift value [0..5]");
++	}
++}
++static void dissect_dl_config_request_dlsch_pdu_rel12_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// altCQI-Table-r12
++	guint8 alt_cqi_table_r12_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_alt_cqi_table_r12, 1, ENC_BIG_ENDIAN);
++	if (alt_cqi_table_r12_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid alt cqi table r12 value [0..1]");
++	}
++
++	// MaxLayers
++	guint8 max_layers_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_max_layers, 1, ENC_BIG_ENDIAN);
++	if (!(max_layers_value >= 1 && max_layers_value <= 8))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid max layers value [1..8]");
++	}
++
++	ptvcursor_add(ptvc, hf_nfapi_n_dl_harq, 1, ENC_BIG_ENDIAN);
++}
++static void dissect_dl_config_request_dlsch_pdu_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// DwPTS Symbols
++	guint8 dwpts_symbols_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dwpts_symbols, 1, ENC_BIG_ENDIAN);
++	if (!(dwpts_symbols_value == 3 || dwpts_symbols_value == 6 || dwpts_symbols_value == 9 ||
++		dwpts_symbols_value == 10 || dwpts_symbols_value == 11 || dwpts_symbols_value == 12 ||
++		dwpts_symbols_value == 14))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dwpts symbols value [3, 6, 9, 10, 11, 12, 14]");
++	}
++
++	// Initial LBT SF
++	guint8 initial_lbt_sf_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_lbt_sf, 1, ENC_BIG_ENDIAN);
++	if (initial_lbt_sf_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid initial lbt sf value [0..1]");
++	}
++
++	// UE Type
++	guint8 ue_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ue_type, 1, ENC_BIG_ENDIAN);
++	if (ue_type_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ue type value [0..2]");
++	}
++
++	// PDSCH Payload Type
++	guint8 pdsch_payload_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pdsch_payload_type, 1, ENC_BIG_ENDIAN);
++	if (pdsch_payload_type_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdsch payload type value [0..2]");
++	}
++
++	// Initial transmission SF (io)
++	guint16 initial_transmission_sf_io_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_transmission_sf, 2, ENC_BIG_ENDIAN);
++	if (!(initial_transmission_sf_io_value <= 10239 || initial_transmission_sf_io_value == 0xFFFF))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid initial transmission sf io value [0..10239, 0xFFFF]");
++	}
++
++	// Rel-13-DMRS-tabe flag
++	guint8 rel13_drms_table_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_req13_drms_table_flag, 1, ENC_BIG_ENDIAN);
++	if (rel13_drms_table_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rel13 drms table flag value [0..1]");
++	}
++}
++static void dissect_dl_config_request_pch_pdu_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Length
++	ptvcursor_add(ptvc, hf_nfapi_length, 2, ENC_BIG_ENDIAN);
++
++	// PDU index
++	ptvcursor_add(ptvc, hf_nfapi_pdu_index, 2, ENC_BIG_ENDIAN);
++
++	// P-RNTI
++	guint16 prnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_prnti, 2, ENC_BIG_ENDIAN);
++	if (prnti_value != 0xFFFE)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prnti value [0xFFFE]");
++	}
++
++	// Resource allocation type
++	guint8 resource_allocation_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_allocation_type, 1, ENC_BIG_ENDIAN);
++	if (!(resource_allocation_type_value == 2 || resource_allocation_type_value == 3 || resource_allocation_type_value == 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource allocate type value [2, 3, 6]");
++	}
++
++	// Virtual resource block assignment flag
++	guint8 virtual_resource_block_assignment_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_virtual_resource_block_assignment_flag, 1, ENC_BIG_ENDIAN);
++	if (virtual_resource_block_assignment_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid virtual resource block assignment flag value [0..1]");
++	}
++
++	// Resource block coding
++	ptvcursor_add(ptvc, hf_nfapi_resource_block_coding, 4, ENC_BIG_ENDIAN);
++
++	// MCS
++	guint8 mcs_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mcs, 1, ENC_BIG_ENDIAN);
++	if (mcs_value != 0)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mcs value [0]");
++	}
++
++	// Redundancy version
++	guint8 redundancy_version_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_redundancy_version, 1, ENC_BIG_ENDIAN);
++	if (redundancy_version_value != 0)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid redundancy value [0]");
++	}
++
++	// Number of transport blocks
++	guint8 number_of_transport_blocks_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_transport_blocks, 1, ENC_BIG_ENDIAN);
++	if (number_of_transport_blocks_value != 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transport blocks value [1]");
++	}
++
++	// Transport block to codeword swap flag
++	ptvcursor_add(ptvc, hf_nfapi_transport_block_to_codeword_swap_flag, 1, ENC_BIG_ENDIAN);
++
++	// Transmission scheme
++	guint8 transmission_scheme_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_scheme, 1, ENC_BIG_ENDIAN);
++	if (!(transmission_scheme_value == 0 || transmission_scheme_value == 1 || transmission_scheme_value == 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission schemes value [0, 1, 6]");
++	}
++
++	// Number of layers
++	guint8 number_of_layers_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_layers, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_layers_value >= 1 && number_of_layers_value <= 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of layers value [1..4]");
++	}
++
++	// Codebook index
++	ptvcursor_add(ptvc, hf_nfapi_codebook_index, 1, ENC_BIG_ENDIAN);
++
++	// UE category capacity
++	guint8 ue_category_capacity_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ue_category_capacity, 1, ENC_BIG_ENDIAN);
++	if (ue_category_capacity_value > 14)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ue category capacity value [0..14]");
++	}
++
++	// P-A
++	guint8 p_a_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pa, 1, ENC_BIG_ENDIAN);
++	if (p_a_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid p-a value value [0..7]");
++	}
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..10000]");
++	}
++
++	// NPRB
++	guint8 nprb_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_nprb, 1, ENC_BIG_ENDIAN);
++	if (nprb_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid nprb value [0..1]");
++	}
++
++	// NGAP
++	guint8 ngap_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ngap, 1, ENC_BIG_ENDIAN);
++	if (ngap_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ngap value [0..1]");
++	}
++
++}
++static void dissect_dl_config_request_pch_pdu_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// UE mode
++	guint8 ue_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ue_mode, 1, ENC_BIG_ENDIAN);
++	if (ue_mode_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ue mode value [0..1]");
++	}
++
++	// Initial transmission SF (io)
++	guint16 initial_transmission_sf_io_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_transmission_sf, 2, ENC_BIG_ENDIAN);
++	if (!(initial_transmission_sf_io_value <= 10239 || initial_transmission_sf_io_value == 0xFFFF))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid initial transmission sf io value [0..10239, 0xFFFF]");
++	}
++}
++static void dissect_dl_config_request_prs_pdu_rel9_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..10000]");
++	}
++
++	// PRS bandwidth
++	guint8 prs_bandwidth_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_prs_bandwidth, 1, ENC_BIG_ENDIAN);
++	if (!(prs_bandwidth_value == 6 || prs_bandwidth_value == 15 || prs_bandwidth_value == 25 ||
++		  prs_bandwidth_value == 50 || prs_bandwidth_value == 75 || prs_bandwidth_value == 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prs bandwidth value [6, 15, 25, 50, 75, 100]");
++	}
++
++	// PRS cyclic prefix type
++	guint8 prs_cyclic_prefix_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_prs_cyclic_prefix_type, 1, ENC_BIG_ENDIAN);
++	if (prs_cyclic_prefix_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prs cyclic prefix value [0..1]");
++	}
++
++	// PRS muting
++	guint8 prs_muting_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_prs_muting, 1, ENC_BIG_ENDIAN);
++	if (prs_muting_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prs muting value [0..1]");
++	}
++}
++static void dissect_dl_config_request_csi_rs_pdu_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// CSI-RS antenna port count R10
++	guint8 csi_rs_antenna_port_count_r10_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_rs_antenna_port_count_r10, 1, ENC_BIG_ENDIAN);
++	if (!(csi_rs_antenna_port_count_r10_value == 1 || csi_rs_antenna_port_count_r10_value == 2 ||
++		  csi_rs_antenna_port_count_r10_value == 4 || csi_rs_antenna_port_count_r10_value == 8 ||
++		  csi_rs_antenna_port_count_r10_value == 12 || csi_rs_antenna_port_count_r10_value == 16))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi rs antenna port count r10 value [1, 2, 4, 6, 8, 10]");
++	}
++
++	// CSI-RS resource config R10
++	ptvcursor_add(ptvc, hf_nfapi_csi_rs_resource_config_r10, 1, ENC_BIG_ENDIAN);
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..10000]");
++	}
++
++	// CSI-RS zero Tx power resource config bitmap R10
++	ptvcursor_add(ptvc, hf_nfapi_csi_rs_zero_tx_power_resource_config_bitmap_r10, 2, ENC_BIG_ENDIAN);
++
++	// CSI-RS Number of NZP configuration
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_rs_number_of_nzp_configurations, 1, ENC_BIG_ENDIAN);
++	if (count > 8)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi-rs number of nzp configuration value [0..8]");
++	}
++
++	// CSI-RS configuration
++	dissect_array_value(ptvc, pinfo, "CSI-RS Resource Configs", ett_nfapi_csi_rs_resource_configs, count, dissect_csi_rs_resource_config_value);
++}
++static void dissect_csi_rs_bf_vector_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_csi_rs_resource_index, 1, ENC_BIG_ENDIAN);
++	if (count > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi-rs resource index value [0..7]");
++	}
++
++	// todo : how to work out the antenna port count for the bfValue
++}
++static void dissect_dl_config_request_csi_rs_pdu_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Class
++	guint8 class_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_rs_class, 1, ENC_BIG_ENDIAN);
++	if (class_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid class value [0..2]");
++	}
++
++	// cdmType
++	guint8 cdm_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cdm_type, 1, ENC_BIG_ENDIAN);
++	if (cdm_type_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cdm type value [0..1]");
++	}
++
++	// numBfVector
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_num_bf_vector, 1, ENC_BIG_ENDIAN);
++	if (!((class_value == 1 && count == 0) || (class_value == 2 && count <= 8)))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid num bf vector value [0] or [0..8]");
++	}
++
++	dissect_array_value(ptvc, pinfo, "Beamforming Vector", ett_nfapi_csi_rs_bf_vector, count, dissect_csi_rs_bf_vector_value);
++}
++static void dissect_epdcch_prb_index_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// EPDCCH PRB index
++	guint8 epdcch_prb_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_edpcch_prb_index, 1, ENC_BIG_ENDIAN);
++	if (epdcch_prb_index_value > 99)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid epdcch prb_index value [0..99]");
++	}
++}
++static void dissect_dl_config_request_edpcch_params_rel11_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// EPDCCH Resource assignment flag
++	guint8 epdcch_resource_assignment_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_epdcch_resource_assignment_flag, 1, ENC_BIG_ENDIAN);
++	if (epdcch_resource_assignment_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid epdcch resource assignment flag value [0..1]");
++	}
++
++	// EPDCCH ID
++	guint16 epdcch_id_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_epdcch_id, 2, ENC_BIG_ENDIAN);
++	if (epdcch_id_value > 503)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid epdcch id value [0..503]");
++	}
++
++	// EPDCCH Start Symbol
++	guint8 epdcch_start_symbol_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_epdcch_start_symbol, 1, ENC_BIG_ENDIAN);
++	if (!(epdcch_start_symbol_value >= 1 && epdcch_start_symbol_value <= 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid epdcch start symbol value [1..4]");
++	}
++
++	// EPDCCH NumPRB
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_epdcch_num_prb, 1, ENC_BIG_ENDIAN);
++	if (!(count == 2 || count == 4 || count == 8))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid epdcch num prb value [2, 4, 8]");
++	}
++
++	dissect_array_value(ptvc, pinfo, "PRBs", ett_nfapi_epdcch_prbs, count, dissect_epdcch_prb_index_value);
++
++	dissect_bf_vector_type_value(ptvc, pinfo);
++}
++static void dissect_dl_config_request_edpcch_params_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// DwPTS Symbols
++	guint8 dwtps_symbols_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_lbt_sf, 1, ENC_BIG_ENDIAN);
++	if (!(dwtps_symbols_value == 3 || dwtps_symbols_value == 6 || dwtps_symbols_value == 9 ||
++		dwtps_symbols_value == 10 || dwtps_symbols_value == 11 || dwtps_symbols_value == 12 ||
++		dwtps_symbols_value == 14))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dwpts symbols value [3, 6, 9, 10, 11, 12, 14]");
++	}
++
++	// Initial LBT SF
++	guint8 initial_lbt_sf_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dwpts_symbols, 1, ENC_BIG_ENDIAN);
++	if (initial_lbt_sf_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid initial lbt sf value [0..1]");
++	}
++
++}
++static void dissect_precoding_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add(ptvc, hf_nfapi_precoding_value, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_dl_config_request_mpdpcch_pdu_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// MPDCCH Narrowband
++	guint8 mpdcch_narrowband_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mpdcch_narrowband, 1, ENC_BIG_ENDIAN);
++	if (mpdcch_narrowband_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mpdcch narrowband value [0..15]");
++	}
++
++	// Number of PRB pairs
++	guint8 number_of_prb_pair_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_prb_pairs, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_prb_pair_value == 2 || number_of_prb_pair_value == 4 || number_of_prb_pair_value == 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of prb pair value [2, 4, 6]");
++	}
++
++	// Resource Block Assignment
++	guint8 resource_block_assignment_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_block_assignment, 1, ENC_BIG_ENDIAN);
++	if (resource_block_assignment_value > 14)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource block assignment value [0..14]");
++	}
++
++	// MPDCCH transmission type
++	guint8 mpdcch_transmission_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mpdcch_transmission_type, 1, ENC_BIG_ENDIAN);
++	if (mpdcch_transmission_type_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mpdcch transmission type value [0..1]");
++	}
++
++	// Start symbol
++	guint8 start_symbol_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_start_symbol, 1, ENC_BIG_ENDIAN);
++	if (!(start_symbol_value >= 1 && start_symbol_value <=4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid start symbol value [1..4]");
++	}
++
++	// ECCE index
++	guint8 ecce_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ecce_index, 1, ENC_BIG_ENDIAN);
++	if (ecce_index_value > 22)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ecce index value [0..22]");
++	}
++
++	// Aggregation level
++	guint8 aggregation_level_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_aggregation_level, 1, ENC_BIG_ENDIAN);
++	if (!(aggregation_level_value == 2 || aggregation_level_value == 4 || aggregation_level_value == 8 ||
++		aggregation_level_value == 16 || aggregation_level_value == 24))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid aggregation level value [2, 4, 8, 16, 24]");
++	}
++
++	// RNTI type
++	guint8 rnti_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mpdcch_rnti_type, 1, ENC_BIG_ENDIAN);
++	if (rnti_type_value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti type value [0..4]");
++	}
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (!(rnti_value >= 1))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++
++	// CEMode
++	guint8 cemode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ce_mode, 1, ENC_BIG_ENDIAN);
++	if (!(cemode_value >= 1 && cemode_value <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cemode value [1..2]");
++	}
++
++	// DMRS scrambling init
++	guint16 drms_scrambling_init_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_drms_scrabmling_init, 2, ENC_BIG_ENDIAN);
++	if (drms_scrambling_init_value > 503)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid drms scrambling init value [0..503]");
++	}
++
++	// Initial transmission SF (io)
++	guint16 initial_transmission_sf_io_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_transmission_sf, 2, ENC_BIG_ENDIAN);
++	if (!(initial_transmission_sf_io_value <= 10239 || initial_transmission_sf_io_value == 0xFFFF))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid initial transmission sf io value [0..10239, 0xFFFF]");
++	}
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..10000]");
++	}
++
++	// DCI format
++	guint8 dci_format_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dl_dci_format, 1, ENC_BIG_ENDIAN);
++	if (!(dci_format_value == 10 || dci_format_value == 11 || dci_format_value == 12))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dci format value [10, 11, 12]");
++	}
++
++	// Resource block coding
++	ptvcursor_add(ptvc, hf_nfapi_resource_block_coding, 2, ENC_BIG_ENDIAN);
++
++	// MCS
++	guint8 mcs_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mcs, 1, ENC_BIG_ENDIAN);
++	if (mcs_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..15]");
++	}
++
++	// PDSCH repetition levels
++	guint8 pdsch_repetition_levels_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pdsch_reception_levels, 1, ENC_BIG_ENDIAN);
++	if (!(pdsch_repetition_levels_value >= 1 && pdsch_repetition_levels_value <= 8))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdsch repetition levels value [1..8]");
++	}
++
++	// Redundancy version
++	guint8 redundancy_version_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_redundancy_version, 1, ENC_BIG_ENDIAN);
++	if (redundancy_version_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid redundancy version value [0..3]");
++	}
++
++	// New data indicator
++	guint8 new_data_indicator_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_new_data_indicator, 1, ENC_BIG_ENDIAN);
++	if (new_data_indicator_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid new data indicator value [0..1]");
++	}
++
++	// HARQ process
++	guint8 harq_process_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_process, 1, ENC_BIG_ENDIAN);
++	if (harq_process_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq process value [0..15]");
++	}
++
++	// TPMI length
++	guint8 tpmi_length_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tpmi_length, 1, ENC_BIG_ENDIAN);
++	if (!(tpmi_length_value == 0 || tpmi_length_value == 2 || tpmi_length_value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpmi length value [0, 2, 4]");
++	}
++
++	// TPMI
++	guint8 tpmi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tpmi, 1, ENC_BIG_ENDIAN);
++	if (tpmi_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpmi value [0..15]");
++	}
++
++	// PMI flag
++	guint8 pmi_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pmi_flag, 1, ENC_BIG_ENDIAN);
++	if (pmi_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pmi flag value [0..1]");
++	}
++
++	// PMI
++	guint8 pmi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pmi, 1, ENC_BIG_ENDIAN);
++	if (pmi_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pmi value [0..1]");
++	}
++
++	// HARQ resource offset
++	guint8 harq_resource_offset_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_resource_offset, 1, ENC_BIG_ENDIAN);
++	if (harq_resource_offset_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq resource offset value [0..3]");
++	}
++
++	// DCI subframe repetition number
++	guint8 dci_subframe_reptition_number_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dci_subframe_repetition_number, 1, ENC_BIG_ENDIAN);
++	if (!(dci_subframe_reptition_number_value >= 1 && dci_subframe_reptition_number_value <= 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dci subframe repetition number value [1..4]");
++	}
++
++	// TPC
++	guint8 tpc_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tpc, 1, ENC_BIG_ENDIAN);
++	if (tpc_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpc value [0..3]");
++	}
++
++	// Downlink assignment index Length
++	guint8 downlink_assignment_index_length_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_downlink_assignment_index_length, 1, ENC_BIG_ENDIAN);
++	if (!(downlink_assignment_index_length_value == 0 || downlink_assignment_index_length_value == 2 ||
++		downlink_assignment_index_length_value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink assignmnet index value [0, 2, 4]");
++	}
++
++	// Downlink assignment index
++	guint8 downlink_assignment_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_downlink_assignment_index, 1, ENC_BIG_ENDIAN);
++	if (downlink_assignment_index_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid downlink assignment index value [0..15]");
++	}
++
++	// Allocate PRACH flag
++	guint8 allocate_prach_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_allocate_prach_flag, 1, ENC_BIG_ENDIAN);
++	if (allocate_prach_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid allocate prach flag value [0..1]");
++	}
++
++	// Preamble index
++	guint8 preamble_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_preamble_index, 1, ENC_BIG_ENDIAN);
++	if (preamble_index_value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid preamble index value [0..63]");
++	}
++
++	// PRACH mask index
++	guint8 prach_mask_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_prach_mask_index, 1, ENC_BIG_ENDIAN);
++	if (prach_mask_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid prach mask index value [0..15]");
++	}
++
++	// Starting CE Level
++	guint8 starting_ce_level_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_starting_ce_level, 1, ENC_BIG_ENDIAN);
++	if (starting_ce_level_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid starting ce level value [0..3]");
++	}
++
++	// SRS request
++	guint8 srs_request_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_request, 1, ENC_BIG_ENDIAN);
++	if (srs_request_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs request value [0..1]");
++	}
++
++	// Antenna ports and scrambling identity flag
++	guint8 antenna_ports_and_scrambling_identity_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_antenna_ports_and_scrambling_identity_flag, 1, ENC_BIG_ENDIAN);
++	if (antenna_ports_and_scrambling_identity_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid antenna ports and scrambling identity flag value [0..1]");
++	}
++
++	// Antenna ports and scrambling identity
++	guint8 antenna_ports_and_scrambling_identity_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_antenna_ports_and_scrambling_identity, 1, ENC_BIG_ENDIAN);
++	if (antenna_ports_and_scrambling_identity_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid antenna ports and scrambling identity value [0..3]");
++	}
++
++	// Frequency hopping enabled flag
++	guint8 frequency_hopping_enabled_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_frequency_hopping_enabled_flag, 1, ENC_BIG_ENDIAN);
++	if (frequency_hopping_enabled_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid frequency hopping enabled flag value [0..1]");
++	}
++
++	// Paging/Direct indication differentiation flag
++	guint8 paging_direct_indicaton_differentiation_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_paging_direct_indication_differentiation_flag, 1, ENC_BIG_ENDIAN);
++	if (paging_direct_indicaton_differentiation_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid paging/direct indication differentiation flag value [0..1]");
++	}
++
++	// Direct indication
++	ptvcursor_add(ptvc, hf_nfapi_direct_indication, 1, ENC_BIG_ENDIAN);
++
++	// Total DCI length including padding
++	item = ptvcursor_add(ptvc, hf_nfapi_total_dci_length_including_padding, 1, ENC_BIG_ENDIAN);
++
++	// Number of TX Antenna ports
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_tx_antenna_ports, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "Precoding", ett_nfapi_precoding, count, dissect_precoding_value);
++}
++static void dissect_ul_config_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// PDU Type
++	guint8 ul_pdu_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ul_config_pdu_type, 1, ENC_BIG_ENDIAN);
++	if (ul_pdu_type_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul pdu type value [0..15]");
++	}
++
++	guint8 size = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pdu_size, 1, ENC_BIG_ENDIAN);
++
++	guint pdu_end = (ptvcursor_current_offset(ptvc) + size - 2);
++	dissect_tlv_list(ptvc, pinfo, pdu_end);
++}
++static void  dissect_ul_config_request_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Number of PDUs
++	guint8 num_pdu = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_pdus, 1, ENC_BIG_ENDIAN);
++
++	// RACH/PRACH frequency resources
++	guint8 rach_prach_frequency_resources_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rach_prach_frequency_resources, 1, ENC_BIG_ENDIAN);
++	if (rach_prach_frequency_resources_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rach prach frequency resources value [0..1]");
++	}
++
++	// SRS present
++	guint8 srs_present_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_present, 1, ENC_BIG_ENDIAN);
++	if (srs_present_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs present value [0..1]");
++	}
++
++	dissect_array_value(ptvc, pinfo, "UL Config PDU List", ett_nfapi_ul_config_request_pdu_list, num_pdu, dissect_ul_config_pdu);
++}
++static void dissect_ul_config_ulsch_pdu_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Handle
++	ptvcursor_add(ptvc, hf_nfapi_handle, 4, ENC_BIG_ENDIAN);
++
++	// Size
++	ptvcursor_add(ptvc, hf_nfapi_size, 2, ENC_BIG_ENDIAN);
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (!(rnti_value >= 1))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++
++	// Resource block start
++	guint8 resource_block_start_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_block_start, 1, ENC_BIG_ENDIAN);
++	if (resource_block_start_value > 99)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource block start value [0..99]");
++	}
++
++	// Number of resource blocks
++	guint8 number_of_resource_blocks_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_resource_blocks, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_resource_blocks_value >= 1 && number_of_resource_blocks_value <= 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of resource blocks value [1..100]");
++	}
++
++	// Modulation type
++	guint8 modulation_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_modulation, 1, ENC_BIG_ENDIAN);
++	if (!(modulation_type_value == 2 || modulation_type_value == 4 || modulation_type_value ==  6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid modulation type value [2, 4, 6]");
++	}
++
++	// Cyclic Shift 2 for DMRS
++	guint8 cyclic_shift_2_for_drms_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cyclic_shift_2_for_drms, 1, ENC_BIG_ENDIAN);
++	if (cyclic_shift_2_for_drms_value > 99)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cyclic shift 2 for drms value [0..7]");
++	}
++
++	// Frequency hopping enabled flag
++	guint8 frequency_hopping_enabled_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_frequency_hopping_enabled_flag, 1, ENC_BIG_ENDIAN);
++	if (frequency_hopping_enabled_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid frequency hopping enabled flag value [0..1]");
++	}
++
++	// Frequency hopping bits
++	guint8 frequency_hopping_bits_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_frequency_hopping_bits, 1, ENC_BIG_ENDIAN);
++	if (frequency_hopping_bits_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid frequency hopping bits value [0..3]");
++	}
++
++	// New data indication
++	guint8 new_data_indication_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_new_data_indication, 1, ENC_BIG_ENDIAN);
++	if (new_data_indication_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid new data indicator value [0..1]");
++	}
++
++	// Redundancy version
++	guint8 redundancy_version_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_redundancy_version, 1, ENC_BIG_ENDIAN);
++	if (redundancy_version_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid redundancy version value [0..3]");
++	}
++
++	// HARQ process number
++	guint8 harq_process_number_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_process_number, 1, ENC_BIG_ENDIAN);
++	if (harq_process_number_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq process number value [0..15]");
++	}
++
++	// UL Tx mode
++	guint8 ul_tx_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ul_tx_mode, 1, ENC_BIG_ENDIAN);
++	if (ul_tx_mode_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul tx mode value [0..1]");
++	}
++
++	// Current TX NB
++	ptvcursor_add(ptvc, hf_nfapi_current_tx_nb, 1, ENC_BIG_ENDIAN);
++
++	// N srs
++	guint8 n_srs_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_srs, 1, ENC_BIG_ENDIAN);
++	if (n_srs_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n_srs value [0..1]");
++	}
++}
++static void dissect_ul_config_ulsch_pdu_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Resource allocation type
++	guint8 resource_allocation_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_allocation_type, 1, ENC_BIG_ENDIAN);
++	if (resource_allocation_type_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource allocation type value [0..1]");
++	}
++
++	// Resource block coding
++	ptvcursor_add(ptvc, hf_nfapi_resource_block_coding, 4, ENC_BIG_ENDIAN);
++
++	// Transport blocks
++	guint8 transport_blocks_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transport_blocks, 1, ENC_BIG_ENDIAN);
++	if (!(transport_blocks_value >= 1 && transport_blocks_value <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transport blocks value [1..2]");
++	}
++
++	// Transmission scheme
++	guint8 transmission_scheme_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ul_transmission_scheme, 1, ENC_BIG_ENDIAN);
++	if (transmission_scheme_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission scheme value [0..1]");
++	}
++
++	// Number Of layers
++	guint8 number_of_layers_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_layers, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_layers_value >= 1 && number_of_layers_value <=4 ))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of layers value [1..4]");
++	}
++
++	// Codebook Index
++	guint8 codebook_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_codebook_index, 1, ENC_BIG_ENDIAN);
++	if (codebook_index_value > 23)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid codebook index value [0..23]");
++	}
++
++	// Disable sequence hopping flag
++	guint8 disable_sequence_hopping_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_disable_sequence_hopping_flag, 1, ENC_BIG_ENDIAN);
++	if (disable_sequence_hopping_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid disable sequence hopping flag value [0..1]");
++	}
++}
++static void dissect_ul_config_ulsch_pdu_rel11_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Virtual cell ID enabled flag
++	guint8 virtual_cell_id_enabled_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_virtual_cell_id_enabled_flag, 1, ENC_BIG_ENDIAN);
++	if (virtual_cell_id_enabled_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid virtual cell id enabled flag value [0..1]");
++	}
++
++	// nPUSCH Identity
++	guint16 npusch_identity_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_npusch_identity, 2, ENC_BIG_ENDIAN);
++	if (npusch_identity_value > 509)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npusch identity value [0..509]");
++	}
++
++	// DMRS Config flag
++	guint8 drms_config_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_drms_config_flag, 1, ENC_BIG_ENDIAN);
++	if (drms_config_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid drms config flag value [0..1]");
++	}
++
++	// nDMRS-CSH Identity
++	guint16 ndrms_csh_identity_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ndrms_csh_identity, 2, ENC_BIG_ENDIAN);
++	if (ndrms_csh_identity_value > 509)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ndrms-csh identity value [0..509]");
++	}
++
++}
++static void dissect_ul_config_ulsch_pdu_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// UE Type
++	guint8 ue_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ue_type, 1, ENC_BIG_ENDIAN);
++	if (ue_type_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ue type value [0..2]");
++	}
++
++	// Total Number of repetitions
++	guint16 total_number_of_repetitions_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_total_number_of_repetitions, 2, ENC_BIG_ENDIAN);
++	if (!(total_number_of_repetitions_value >= 1 && total_number_of_repetitions_value <= 2048))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid total number of repetitions value [1..2048]");
++	}
++
++	// Repetition Number
++	guint16 repetition_number_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_repetition_number, 2, ENC_BIG_ENDIAN);
++	if (!(repetition_number_value >= 1 && repetition_number_value <= 2048))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid repetition number value [1..2048]");
++	}
++
++	// Initial transmission SF (io)
++	guint16 intial_transmission_sf_io_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_sf_io, 2, ENC_BIG_ENDIAN);
++	if (!(intial_transmission_sf_io_value <= 10239 || intial_transmission_sf_io_value == 0xFFFF))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid repetition number value [0..10239, 0xFFFF]");
++	}
++
++	// Empy symbols due to re-tunning
++	// todo : decode as a bitmap
++	ptvcursor_add(ptvc, hf_nfapi_empty_symbols_due_to_retunning, 1, ENC_BIG_ENDIAN);
++}
++static void dissect_ul_config_init_tx_params_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// N srs initial
++	guint8 n_srs_initial_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_srs_initial, 1, ENC_BIG_ENDIAN);
++	if (n_srs_initial_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n srs initial value [0..1]");
++	}
++
++	// Initial number of resource blocks
++	guint8 initial_number_of_resource_blocks_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_number_of_resource_blocks, 1, ENC_BIG_ENDIAN);
++	if (!(initial_number_of_resource_blocks_value >= 1 && initial_number_of_resource_blocks_value <= 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid initial number of reosurce blocks value [1..100]");
++	}
++
++}
++static void dissect_ul_config_cqi_ri_info_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// DL CQI/PMI Size Rank = 1
++	ptvcursor_add(ptvc, hf_nfapi_dl_cqi_pmi_size_rank_1, 1, ENC_BIG_ENDIAN);
++
++	// DL CQI/PMI Size Rank>1
++	ptvcursor_add(ptvc, hf_nfapi_dl_cqi_pmi_size_rank_greater_1, 1, ENC_BIG_ENDIAN);
++
++	// RI Size
++	guint8 ri_size_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ri_size, 1, ENC_BIG_ENDIAN);
++	if (ri_size_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ri size value [0..3]");
++	}
++
++	// Delta Offset CQI
++	guint8 delta_offset_cqi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_delta_offset_cqi, 1, ENC_BIG_ENDIAN);
++	if (delta_offset_cqi_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta offset cqi value [0..15]");
++	}
++
++	// Delta Offset RI
++	guint8 delta_offset_ri_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_delta_offset_ri, 1, ENC_BIG_ENDIAN);
++	if (delta_offset_ri_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta offset ri value [0..15]");
++	}
++}
++static void dissect_ul_cqi_pmi_size(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Delta Offset RI
++	guint8 dl_cqi_pmi_size_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_delta_offset_ri, 1, ENC_BIG_ENDIAN);
++	if (dl_cqi_pmi_size_value > 255)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta offset ri value [0..255]");
++	}
++}
++
++static void dissect_ul_config_cqi_ri_info_rel9_later_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++	// Report type
++	guint8 type = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_report_type, 1, ENC_BIG_ENDIAN);
++	if (type > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid report type value [0..1]");
++	}
++
++	// Delta offset CQI
++	guint8 delta_offset_cqi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_delta_offset_cqi, 1, ENC_BIG_ENDIAN);
++	if (delta_offset_cqi_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta offset cqi value [0..15]");
++	}
++
++	// Delta offset RI
++	guint8 delta_offset_ri_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_delta_offset_ri, 1, ENC_BIG_ENDIAN);
++	if (delta_offset_ri_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta offset ri value [0..15]");
++	}
++
++	switch (type)
++	{
++		case 0:
++		{
++			// DL CQI/PMI/RI size
++			ptvcursor_add(ptvc, hf_nfapi_dl_cqi_ri_pmi_size, 1, ENC_BIG_ENDIAN);
++
++			// Control Type
++			guint8 control_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++			ptvcursor_add(ptvc, hf_nfapi_control_type, 1, ENC_BIG_ENDIAN);
++			if (control_type_value > 1)
++			{
++				expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid control type value [0..1]");
++			}
++			break;
++		}
++		case 1:
++		{
++			// todo : encoder not right for this case.
++			gint8 num_cc_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++			ptvcursor_add(ptvc, hf_nfapi_number_of_cc, 1, ENC_BIG_ENDIAN);
++
++			if (!(num_cc_value >= 1 && num_cc_value <= 32))
++			{
++				expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of cc value [1..32]");
++			}
++
++                        // UL CONFIG CQI PMI SIZE
++                        dissect_array_value(ptvc, pinfo, "CQI PMI SIZE", ett_nfapi_cqi_pmi_size, 8, dissect_ul_cqi_pmi_size);
++
++			/*
++			ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_tlv_tree, "CCs");
++
++			for (int i = 0; i < num_cc; ++i)
++			{
++				ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_tlv_tree, "[%d]", i);
++
++				guint8 ri_size = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++				ptvcursor_add(ptvc, hf_nfapi_ri_size, 1, ENC_BIG_ENDIAN);
++
++				ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_tlv_tree, "Rank");
++
++				for (int j = 0; j < ri_size; ++j)
++				{
++					ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_tlv_tree, "[%d]", j);
++					ptvcursor_add(ptvc, hf_nfapi_dl_cqi_pmi_size, 1, ENC_BIG_ENDIAN);
++					ptvcursor_pop_subtree(ptvc);
++				}
++
++				ptvcursor_pop_subtree(ptvc);
++
++				ptvcursor_pop_subtree(ptvc);
++			}
++
++			ptvcursor_pop_subtree(ptvc);
++			*/
++
++			break;
++		}
++	}
++}
++static void dissect_ul_config_cqi_ri_info_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// DL CQI/PMI/RI size 2
++	guint16 dl_cqi_ri_pmi_size_2_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_dl_cqi_ri_pmi_size_2, 2, ENC_BIG_ENDIAN);
++	if (dl_cqi_ri_pmi_size_2_value < 255)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dl cqi ri pmi size 2 value [>= 255]");
++	}
++}
++static void dissect_ul_config_harq_info_ulsch_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// HARQ Size
++	guint8 harq_size_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_size, 1, ENC_BIG_ENDIAN);
++	if (harq_size_value > 21)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq size value [0..21]");
++	}
++
++	// Delta Offset HARQ
++	guint8 delta_offset_harq_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_delta_offset_harq, 1, ENC_BIG_ENDIAN);
++	if (delta_offset_harq_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta offset harq value [0..15]");
++	}
++
++	// ACK_NACK mode
++	guint8 ack_nack_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tdd_ack_nack_mode, 1, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value > 5)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ack nack mode value [0..5]");
++	}
++}
++static void dissect_ul_config_harq_info_ulsch_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// HARQ Size 2
++	ptvcursor_add(ptvc, hf_nfapi_harq_size_2, 2, ENC_BIG_ENDIAN);
++
++	// Delta Offset HARQ 2
++	guint8 delta_offset_harq_2_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_delta_offset_harq_2, 1, ENC_BIG_ENDIAN);
++	if (delta_offset_harq_2_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid delta offset harq 2 value [0..15]");
++	}
++}
++static void dissect_ul_config_ue_info_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Handle
++	ptvcursor_add(ptvc, hf_nfapi_handle, 4, ENC_BIG_ENDIAN);
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (rnti_value < 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++}
++static void dissect_ul_config_ue_info_rel11_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Virtual cell ID enabled flag
++	guint8 virtual_cell_id_enabled_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_virtual_cell_id_enabled_flag, 1, ENC_BIG_ENDIAN);
++	if (virtual_cell_id_enabled_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid virtual cell id enabled flag value [0..1]");
++	}
++
++	// nPUCCH Identity
++	guint16 npucch_identity_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_npucch_identity, 2, ENC_BIG_ENDIAN);
++	if (npucch_identity_value > 503)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch identity value [0..503]");
++	}
++
++}
++static void dissect_ul_config_ue_info_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// UE Type
++	guint8 ue_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ue_type, 1, ENC_BIG_ENDIAN);
++	if (ue_type_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ue type value [0..2]");
++	}
++
++	// Empty symbols
++	// todo : use bit map decoding
++	ptvcursor_add(ptvc, hf_nfapi_empty_symbols, 1, ENC_BIG_ENDIAN);
++
++	// Total Number of repetitions
++	guint16 total_number_of_repetitions_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_total_number_of_repetitions, 2, ENC_BIG_ENDIAN);
++	if (!(total_number_of_repetitions_value >= 1 && total_number_of_repetitions_value <= 32))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid total number of repetitions value [1..32]");
++	}
++
++	// Repetition Number
++	guint16 repetition_number_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_repetition_number, 2, ENC_BIG_ENDIAN);
++	if (!(repetition_number_value >= 1 && repetition_number_value <= 32))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid repetition number value [1..32]");
++	}
++
++}
++static void dissect_ul_config_cqi_info_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// PUCCH index
++	guint16 pucch_index_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pucch_index, 2, ENC_BIG_ENDIAN);
++	if (pucch_index_value > 1184)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch index value [0..1184]");
++	}
++
++	// DL CQI/PMI Size
++	ptvcursor_add(ptvc, hf_nfapi_dl_cqi_pmi_size, 1, ENC_BIG_ENDIAN);
++}
++static void dissect_ul_config_cqi_info_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Number of PUCCH Resources
++	guint8 number_of_pucch_resources_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_pucch_resource, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_pucch_resources_value >= 1 && number_of_pucch_resources_value <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of pucch resources value [1..2]");
++	}
++
++	//PUCCH Index P1
++	guint16 pucch_index_p1_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pucch_index_p1, 2, ENC_BIG_ENDIAN);
++	if (pucch_index_p1_value > 1184)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch index p1 value [0..1184]");
++	}
++}
++static void dissect_ul_config_cqi_info_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// CSI_mode
++	guint8 csi_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_mode, 1, ENC_BIG_ENDIAN);
++	if (csi_mode_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi mode value [0..2]");
++	}
++
++	// DL CQI/PMI Size 2
++	ptvcursor_add(ptvc, hf_nfapi_dl_cqi_pmi_size_2, 2, ENC_BIG_ENDIAN);
++
++	// Starting PRB
++	guint8 starting_prb_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_statring_prb, 1, ENC_BIG_ENDIAN);
++	if (starting_prb_value > 109)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid starting prb value [0..109]");
++	}
++
++	// n_PRB
++	guint8 n_prb_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_nprb, 1, ENC_BIG_ENDIAN);
++	if (n_prb_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n prb value [0..7]");
++	}
++
++	// cdm_Index
++	guint8 cdm_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cdm_index, 1, ENC_BIG_ENDIAN);
++	if (cdm_index_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cdm index value [0..1]");
++	}
++
++	// N srs
++	guint8 n_srs_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_nsrs, 1, ENC_BIG_ENDIAN);
++	if (n_srs_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n srs value [0..1]");
++	}
++
++}
++static void dissect_ul_config_sr_info_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 pucch_index_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_pucch_index, 2, ENC_BIG_ENDIAN);
++	if (pucch_index_value > 2047)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch index value [0..2047]");
++	}
++}
++static void dissect_ul_config_sr_info_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Number of PUCCH Resources
++	guint8 number_of_pucch_resources_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_pucch_resource, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_pucch_resources_value >= 1 && number_of_pucch_resources_value <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of pucch resources value [0..2047]");
++	}
++
++	// PUCCH Index P1
++	guint16 pucch_index_p1_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pucch_index_p1, 2, ENC_BIG_ENDIAN);
++	if (pucch_index_p1_value > 2047)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pucch index p1 value [0..2047]");
++	}
++}
++static void dissect_ul_config_harq_info_uci_rel10_tdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// HARQ size
++	guint8 harq_size_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_size, 1, ENC_BIG_ENDIAN);
++	if (harq_size_value > 21)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq size value [0..21]");
++	}
++
++	// ACK_NACK mode
++	guint8 ack_nack_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tdd_ack_nack_mode, 1, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value > 5)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ack nack mode value [0..5]");
++	}
++
++	// Number of PUCCH resources
++	guint8 number_of_pucch_resources_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_pucch_resource, 1, ENC_BIG_ENDIAN);
++	if (number_of_pucch_resources_value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of pucch resources value [0..4]");
++	}
++
++	// n_PUCCH_1_0
++	guint16 npucch_1_0_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_0, 2, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value == 0 || ack_nack_mode_value == 1 || ack_nack_mode_value == 2)
++	{
++		if (npucch_1_0_value > 2047)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n pucch 1 0 value [0..2047] (All Format 1a/1b)");
++		}
++	}
++	else if (ack_nack_mode_value == 3)
++	{
++		if (npucch_1_0_value > 549)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n pucch 1 0 value [0..549] (Format 3)");
++		}
++	}
++
++	// n_PUCCH_1_1
++	guint16 npucch_1_1_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_1, 2, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value == 0 || ack_nack_mode_value == 1 || ack_nack_mode_value == 2)
++	{
++		if (npucch_1_1_value > 2047)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n pucch 1 1 value [0..2047] (All Format 1a/1b)");
++		}
++	}
++
++	// n_PUCCH_1_2
++	guint16 npucch_1_2_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_2, 2, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value == 2)
++	{
++		if (npucch_1_2_value > 2047)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n pucch 1 2 value [0..2047] (All Format 1a/1b)");
++		}
++	}
++
++	// n_PUCCH_1_3
++	guint16 npucch_1_3_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_3, 2, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value == 2)
++	{
++		if (npucch_1_3_value > 2047)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n pucch 1 3 value [0..2047] (All Format 1a/1b)");
++		}
++	}
++}
++static void dissect_ul_config_harq_info_uci_rel8_fdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// n_PUCCH_1_0
++	// todo : how to work out the ack_nack mode?
++	guint16 npucch_1_0_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_0, 2, ENC_BIG_ENDIAN);
++	if (npucch_1_0_value > 2047)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n pucch 1 0 value [0..2047]");
++	}
++
++	// HARQ Size
++	guint8 harq_size_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_size, 1, ENC_BIG_ENDIAN);
++	if (!(harq_size_value >= 1 && harq_size_value <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq size value [1..2]");
++	}
++}
++static void dissect_ul_config_harq_info_uci_rel9_later_fdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// HARQ Size
++	guint8 harq_size_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* harq_size_item = ptvcursor_add(ptvc, hf_nfapi_harq_size, 1, ENC_BIG_ENDIAN);
++
++	// ACK_NAK mode
++	guint8 ack_nack_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_fdd_ack_nack_mode, 1, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ack nack mode value [0..4]");
++	}
++
++	if (ack_nack_mode_value == 0 || ack_nack_mode_value == 2)
++	{
++		if (!(harq_size_value >= 1 && harq_size_value <= 10))
++		{
++			expert_add_info_format(pinfo, harq_size_item, &ei_invalid_range, "Invalid harq size value [1..10] (Format 1a/1b/3)");
++		}
++	}
++	else if (ack_nack_mode_value == 3 ||  ack_nack_mode_value == 4)
++	{
++		if (harq_size_value != 0)
++		{
++			expert_add_info_format(pinfo, harq_size_item, &ei_invalid_range, "Invalid harq size value [0] (Format 4/5)");
++		}
++	}
++
++	// Number of PUCCH Resources
++	guint8 number_of_pucch_resources_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_pucch_resource, 1, ENC_BIG_ENDIAN);
++	if (number_of_pucch_resources_value == 0 || number_of_pucch_resources_value == 2)
++	{
++		if (!(number_of_pucch_resources_value >= 1 && number_of_pucch_resources_value <= 4))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq size value [1..4] (Format 1a/1b/3)");
++		}
++	}
++	else if (number_of_pucch_resources_value == 3 || number_of_pucch_resources_value == 4)
++	{
++		if (number_of_pucch_resources_value != 0)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq size value [0] (Format 4/5)");
++		}
++	}
++
++	// n_PUCCH_1_0
++	guint16 npucch_1_0_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_0, 2, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value == 0 || ack_nack_mode_value == 1)
++	{
++		if (npucch_1_0_value > 2047)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 1 0 value [0..2047] (Format 1a/1b/channel selection)");
++		}
++	}
++	else if (ack_nack_mode_value == 2)
++	{
++		if (npucch_1_0_value > 549)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 1 0 value [0..549] (Format 3)");
++		}
++	}
++
++	// n_PUCCH_1_1
++	guint16 npucch_1_1_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_1, 2, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value == 0 || ack_nack_mode_value == 1)
++	{
++		if (npucch_1_1_value > 2047)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 1 1 value [0..2047] (Format 1a/1b/channel selection)");
++		}
++	}
++
++	// n_PUCCH_1_2
++	guint16 npucch_1_2_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_2, 2, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value == 0 || ack_nack_mode_value == 1)
++	{
++		if (npucch_1_2_value > 2047)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 1 2 value [0..2047] (Format 1a/1b/channel selection)");
++		}
++	}
++
++	// n_PUCCH_1_3
++	guint16 npucch_1_3_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_1_3, 2, ENC_BIG_ENDIAN);
++	if (ack_nack_mode_value == 0 || ack_nack_mode_value == 1)
++	{
++		if (npucch_1_3_value > 2047)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 1 3 value [0..2047] (Format 1a/1b/channel selection)");
++		}
++	}
++}
++static void dissect_ul_config_harq_info_uci_rel11_fdd_tdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Num_ant_ports
++	guint8 num_ant_ports_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_num_ant_ports, 1, ENC_BIG_ENDIAN);
++	if (!(num_ant_ports_value >= 1 && num_ant_ports_value <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid num ant ports value [1..2]");
++	}
++
++	// n_PUCCH_2_0
++	// todo : how to work out the ack nack mode
++	guint16 npucch_2_0_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_2_0, 2, ENC_BIG_ENDIAN);
++	if (npucch_2_0_value > 2047)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 2 0 value [0..2047]");
++	}
++
++	// n_PUCCH_2_1
++	guint16 npucch_2_1_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_2_1, 2, ENC_BIG_ENDIAN);
++	if (npucch_2_1_value > 2047)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 2 1 value [0..2047]");
++	}
++
++	// n_PUCCH_2_2
++	guint16 npucch_2_2_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_2_2, 2, ENC_BIG_ENDIAN);
++	if (npucch_2_2_value > 2047)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 2 2 value [0..2047]");
++	}
++
++	// n_PUCCH_2_3
++	guint16 npucch_2_3_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_pucch_2_3, 2, ENC_BIG_ENDIAN);
++	if (npucch_2_3_value > 2047)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid npucch 2 3 value [0..2047]");
++	}
++
++}
++static void dissect_ul_config_harq_info_uci_rel13_fdd_tdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// HARQ Size 2
++	ptvcursor_add(ptvc, hf_nfapi_harq_size_2, 2, ENC_BIG_ENDIAN);
++
++	// Starting PRB
++	guint8 starting_prb_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_starting_prb, 1, ENC_BIG_ENDIAN);
++	if (starting_prb_value > 109)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid starting prb value [0..109]");
++	}
++
++	// n_PRB
++	guint8 n_prb_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_nprb, 1, ENC_BIG_ENDIAN);
++	if (n_prb_value > 109)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n prb value [0..7]");
++	}
++
++	// cdm_Index
++	guint8 cdm_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cdm_index, 1, ENC_BIG_ENDIAN);
++	if (cdm_index_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cdm index value [0..1]");
++	}
++
++	// N srs
++	guint8 n_srs_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_nsrs, 1, ENC_BIG_ENDIAN);
++	if (n_srs_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n srs value [0..1]");
++	}
++}
++static void dissect_ul_config_srs_info_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Handle
++	ptvcursor_add(ptvc, hf_nfapi_handle, 4, ENC_BIG_ENDIAN);
++
++	// Size
++	ptvcursor_add(ptvc, hf_nfapi_size, 2, ENC_BIG_ENDIAN);
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (rnti_value < 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++
++	// SRS Bandwidth
++	guint8 srs_bandwidth_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_bandwidth, 1, ENC_BIG_ENDIAN);
++	if (srs_bandwidth_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs bandwidth value [0..3]");
++	}
++
++	// Frequency Domain Position
++	guint8 frequency_domain_position_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_frequency_domain_position, 1, ENC_BIG_ENDIAN);
++	if (frequency_domain_position_value > 23)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid frequency domain bandwidth value [0..23]");
++	}
++
++	// SRS Hopping Bandwidth
++	guint8 srs_hopping_bandwidth_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_hopping_bandwidth, 1, ENC_BIG_ENDIAN);
++	if (srs_hopping_bandwidth_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs hopping bandwidth value [0..3]");
++	}
++
++	// Transmission Comb
++	guint8 transmission_comb_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_comb, 1, ENC_BIG_ENDIAN);
++	if (transmission_comb_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission comb value [0..3]");
++	}
++
++	// ISRS / SRS-ConfigIndex
++	guint16 srs_config_index_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_i_srs, 2, ENC_BIG_ENDIAN);
++	if (srs_config_index_value > 1023)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid isrs/srs-configindex value [0..1023]");
++	}
++
++	// Sounding Reference Cyclic Shift
++	guint8 sounding_reference_cyclic_shift_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_sounding_reference_cyclic_shift, 1, ENC_BIG_ENDIAN);
++	if (sounding_reference_cyclic_shift_value > 11)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid sounding reference cyclic shift value [0..11]");
++	}
++}
++static void dissect_ul_config_srs_info_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 antenna_port_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_antenna_port, 1, ENC_BIG_ENDIAN);
++	if (antenna_port_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid antenna port value [0..2]");
++	}
++}
++static void dissect_ul_config_srs_info_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 number_of_combs_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_number_of_combs, 1, ENC_BIG_ENDIAN);
++	if (number_of_combs_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of combs value [0..1]");
++	}
++}
++static void dissect_hi_dci0_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++
++	// PDU Type
++	guint8 pdu_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_hi_dci0_pdu_type, 1, ENC_BIG_ENDIAN);
++	if (pdu_type_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdu type value [0..3]");
++	}
++
++	// PDU Size
++	guint8 size = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pdu_size, 1, ENC_BIG_ENDIAN);
++
++	guint pdu_end = (ptvcursor_current_offset(ptvc) + size - 2);
++	dissect_tlv_list(ptvc, pinfo, pdu_end);
++}
++static void dissect_hi_dci0_request_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// SFN/SF
++	ptvcursor_add(ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++
++	// Number of DCI
++	guint8 num_pdu = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_dci_pdus, 1, ENC_BIG_ENDIAN);
++
++	// Number of  HI
++	num_pdu += tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_hi_pdus, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "HI DCI0 PDU List", ett_nfapi_hi_dci0_request_pdu_list, num_pdu, dissect_hi_dci0_pdu);
++}
++static void dissect_hi_dci0_hi_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Resource block start
++	guint8 resource_block_start_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_block_start, 1, ENC_BIG_ENDIAN);
++	if (resource_block_start_value > 100)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource block start value [0..100]");
++	}
++
++	// Cyclic Shift 2 for DMRS
++	guint8 cyclic_shift_2_for_drms_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cyclic_shift_2_for_drms, 1, ENC_BIG_ENDIAN);
++	if (cyclic_shift_2_for_drms_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cyclic shift 2 for drms value [0..7]");
++	}
++
++	// HI value
++	guint8 hi_value_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_hi_value, 1, ENC_BIG_ENDIAN);
++	if (hi_value_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid hi value [0..1]");
++	}
++
++	// I_PHICH
++	guint8 i_pich_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_i_phich, 1, ENC_BIG_ENDIAN);
++	if (i_pich_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid i phich value [0..1]");
++	}
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..10000]");
++	}
++
++}
++static void dissect_hi_dci0_hi_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Flag TB2
++	guint8 flag_tb2_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_flag_tb2, 1, ENC_BIG_ENDIAN);
++	if (flag_tb2_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid flag tb2 value [0..1]");
++	}
++
++	// HI Value 2
++	guint8 hi2_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_hi_value_2, 1, ENC_BIG_ENDIAN);
++	if (hi2_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid hi2 value [0..1]");
++	}
++
++}
++static void dissect_hi_dci0_dci_ul_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// DCI format
++	guint8 dci_format_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ul_dci_format, 1, ENC_BIG_ENDIAN);
++	if (dci_format_value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dci format value [0..4]");
++	}
++
++	// CCE index
++	guint8 cce_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cce_idx, 1, ENC_BIG_ENDIAN);
++	if (cce_index_value > 88)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cce index value [0..88]");
++	}
++
++	// Aggregation level
++	guint8 aggregation_level_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_aggregation_level, 1, ENC_BIG_ENDIAN);
++	if (!(aggregation_level_value == 1 || aggregation_level_value == 2 || aggregation_level_value == 4 ||
++		  aggregation_level_value == 8))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid aggregation level value [1, 2, 4, 8]");
++	}
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (rnti_value < 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++
++	// Resource block start
++	guint8 resource_block_start_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_block_start, 1, ENC_BIG_ENDIAN);
++	if (resource_block_start_value > 100)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource block start value [0..100]");
++	}
++
++	// Number of resource blocks
++	guint8 number_of_resource_blocks_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_resource_blocks, 1, ENC_BIG_ENDIAN);
++	if (number_of_resource_blocks_value > 100)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of resource blocks value [0..100]");
++	}
++
++	// MCS_1
++	guint8 mcs_1_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mcs_1, 1, ENC_BIG_ENDIAN);
++	if (mcs_1_value > 31)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mcs 1 value [0..31]");
++	}
++
++	// Cyclic Shift 2 for DMRS
++	guint8 cyclic_shift_2_for_drms_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cyclic_shift_2_for_drms, 1, ENC_BIG_ENDIAN);
++	if (cyclic_shift_2_for_drms_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cyclic shift 2 for drms value [0..7]");
++	}
++
++	// Frequency hopping enabled flag
++	guint8 frequency_hopping_enabled_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_frequency_hopping_enabled_flag, 1, ENC_BIG_ENDIAN);
++	if (frequency_hopping_enabled_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid frequency hopping enabled flag value [0..1]");
++	}
++
++	// Frequency hopping bits
++	guint8 frequency_hopping_bit_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_frequency_hopping_bits, 1, ENC_BIG_ENDIAN);
++	if (frequency_hopping_bit_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid frequency hopping bits value [0..3]");
++	}
++
++	// New Data indication_1
++	guint8 new_data_indication_1_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_new_data_indication, 1, ENC_BIG_ENDIAN);
++	if (new_data_indication_1_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid new data indication value [0..1]");
++	}
++
++	// UE TX antenna selection
++	guint8 ue_tx_antenna_selection_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ue_tx_antenna_selection, 1, ENC_BIG_ENDIAN);
++	if (ue_tx_antenna_selection_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ue tx antenna selection value [0..2]");
++	}
++
++	// TPC
++	guint8 tpc_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tpc, 1, ENC_BIG_ENDIAN);
++	if (tpc_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpc value value [0..3]");
++	}
++
++	// CQI/CSI request
++	guint8 cqi_csi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cqi_csi_request, 1, ENC_BIG_ENDIAN);
++	if (cqi_csi_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cqi csi value [0..7]");
++	}
++
++	// UL index
++	guint8 ul_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ul_index, 1, ENC_BIG_ENDIAN);
++	if (ul_index_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul index value [0..3]");
++	}
++
++	// DL assignment index
++	guint8 dl_assignment_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dl_assignment_index, 1, ENC_BIG_ENDIAN);
++	if (!(dl_assignment_index_value >= 1 && dl_assignment_index_value <= 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dl assignment index value [1..4]");
++	}
++
++	// TPC bitmap
++	ptvcursor_add(ptvc, hf_nfapi_tpc_bitmap, 4, ENC_BIG_ENDIAN);
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..10000]");
++	}
++}
++static void dissect_hi_dci0_dci_ul_rel10_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Cross carrier scheduling flag
++	guint8 cross_carrier_scheduling_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_cross_carrier_scheduling_flag, 1, ENC_BIG_ENDIAN);
++	if (cross_carrier_scheduling_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cross carrier scheduling flag value [0..1]");
++	}
++
++	// Carrier indicator
++	guint8 carrier_indicator_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_carrier_indicator, 1, ENC_BIG_ENDIAN);
++	if (carrier_indicator_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid carrier indicator value [0..7]");
++	}
++
++	// Size of CQI/CSI field
++	guint8 size_of_cqi_csi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_size_of_cqi_csi_feild, 1, ENC_BIG_ENDIAN);
++	if (size_of_cqi_csi_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid size of cqi/csi field value [0..2]");
++	}
++
++	// SRS flag
++	guint8 srs_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_flag, 1, ENC_BIG_ENDIAN);
++	if (srs_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs field value [0..1]");
++	}
++
++	// SRS request
++	//guint8 srs_request_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	//item = ptvcursor_add(ptvc, hf_nfapi_srs_request, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_srs_request, 1, ENC_BIG_ENDIAN);
++
++	// Resource allocation flag
++	guint8 resource_allocation_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_allocation_flag, 1, ENC_BIG_ENDIAN);
++	if (resource_allocation_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource allocation flag value [0..1]");
++	}
++
++	// Resource allocation type
++	guint8 resource_alloction_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_allocation_type, 1, ENC_BIG_ENDIAN);
++	if (resource_alloction_type_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource allocation type value [0..1]");
++	}
++
++	// Resource block coding
++	ptvcursor_add(ptvc, hf_nfapi_resource_block_coding, 4, ENC_BIG_ENDIAN);
++
++	// MCS_2
++	guint8 mcs_2_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mcs_2, 1, ENC_BIG_ENDIAN);
++	if (mcs_2_value > 31)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mcs 2 value [0..31]");
++	}
++
++	// New data indication_2
++	guint8 new_data_indication_2_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_new_data_indication_two, 1, ENC_BIG_ENDIAN);
++	if (new_data_indication_2_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid new data indication 2 value [0..1]");
++	}
++
++	// Number of antenna ports
++	guint8 number_of_antenna_ports_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_antenna_ports, 1, ENC_BIG_ENDIAN);
++	if (number_of_antenna_ports_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of antenna ports value [0..2]");
++	}
++
++	// TPMI
++	guint8 tpmi_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tpmi, 1, ENC_BIG_ENDIAN);
++	if (number_of_antenna_ports_value == 2)
++	{
++		if (tpmi_value > 7)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpmi value [0..7]");
++		}
++	}
++	else if (number_of_antenna_ports_value == 4)
++	{
++		if (tpmi_value > 63)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpmi value [0..63]");
++		}
++	}
++
++	// Total DCI length including padding
++	ptvcursor_add(ptvc, hf_nfapi_total_dci_length_including_padding, 1, ENC_BIG_ENDIAN);
++
++	// N_UL_RB
++	guint8 n_ul_rb_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_n_ul_rb, 1, ENC_BIG_ENDIAN);
++	if (!(n_ul_rb_value == 6 || n_ul_rb_value == 15 || n_ul_rb_value == 25 || n_ul_rb_value == 50 ||
++		n_ul_rb_value == 75 || n_ul_rb_value == 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid n ul rb value [6, 15, 25, 50, 75, 100]");
++	}
++}
++static void dissect_hi_dci0_dci_ul_rel12_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// PSCCH Resource
++	guint8 pscch_resource_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pscch_resource, 1, ENC_BIG_ENDIAN);
++	if (pscch_resource_value > 0x3F)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pscch resource value [0..0x3F]");
++	}
++
++	// Time resource pattern
++	guint8 time_resource_pattern_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_time_resource_pattern, 1, ENC_BIG_ENDIAN);
++	if (time_resource_pattern_value > 0x7F)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid time resource pattern value [0..0x7F]");
++	}
++
++}
++static void dissect_hi_dci0_mdpcch_dci_ul_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// MPDCCH Narrowband
++	guint8 mpdcch_narrowband_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mpdcch_narrowband, 1, ENC_BIG_ENDIAN);
++	if (mpdcch_narrowband_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mpdcch narrowband value [0..15]");
++	}
++
++	// Number of PRB pairs
++	guint8 number_of_prb_pairs_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_prb_pairs, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_prb_pairs_value == 2 || number_of_prb_pairs_value == 4 || number_of_prb_pairs_value == 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of prb pairs value [2, 4, 6]");
++	}
++
++	// Resource Block Assignment
++	guint8 resource_block_assignment_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_block_assignment, 1, ENC_BIG_ENDIAN);
++	if (resource_block_assignment_value > 14)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource block assignment value [0..14]");
++	}
++
++	// MPDCCH transmission type
++	guint8 mpdcch_transmission_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mpdcch_transmission_type, 1, ENC_BIG_ENDIAN);
++	if (mpdcch_transmission_type_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mpdcch transmission type value [0..1]");
++	}
++
++	// Start symbol
++	guint8 start_symbol_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_start_symbol, 1, ENC_BIG_ENDIAN);
++	if (!(start_symbol_value >= 1 && start_symbol_value <=4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid start symbol value [0..1]");
++	}
++
++	// ECCE index
++	guint8 ecce_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ecce_index, 1, ENC_BIG_ENDIAN);
++	if (ecce_index_value > 22)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ecce index value [0..22]");
++	}
++
++	// Aggregation level
++	guint8 aggregation_level_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_aggregation_level, 1, ENC_BIG_ENDIAN);
++	if (!(aggregation_level_value == 2 || aggregation_level_value == 4 || aggregation_level_value == 8 ||
++		aggregation_level_value == 16 || aggregation_level_value == 24))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid aggregation level value [2, 4, 8, 16, 24]");
++	}
++
++	// RNTI type
++	guint8 rnti_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mpdcch_rnti_type, 1, ENC_BIG_ENDIAN);
++	if (!(rnti_type_value == 0 || rnti_type_value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti type value [0, 4]");
++	}
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (rnti_value < 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++
++	// CEMode
++	guint8 cemode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ce_mode, 1, ENC_BIG_ENDIAN);
++	if (!(cemode_value == 1 || cemode_value == 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid cemode value [1,2]");
++	}
++
++	// DMRS scrambling init
++	guint16 drms_scrambling_init_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_drms_scrambling_init, 2, ENC_BIG_ENDIAN);
++	if (drms_scrambling_init_value < 503)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid drms scrambling init value [0..503]");
++	}
++
++	// Initial transmission SF (io)
++	guint16 initial_transmission_sf_io_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_transmission_sf, 2, ENC_BIG_ENDIAN);
++	if (!(initial_transmission_sf_io_value <= 10239 || initial_transmission_sf_io_value == 0xFFFF))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid initial transmission sf io value [0..10239, 0xFFFF]");
++	}
++
++	// Transmission power
++	guint16 transmission_power_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_transmission_power, 2, ENC_BIG_ENDIAN);
++	if (transmission_power_value > 10000)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid transmission power value [0..10000]");
++	}
++
++	// DCI format
++	guint8 dci_format_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mpdcch_ul_dci_format, 1, ENC_BIG_ENDIAN);
++	if (!(dci_format_value == 1 || dci_format_value == 2 || dci_format_value == 4 || dci_format_value == 5))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dci format value [1, 2, 4, 5]");
++	}
++
++	// Resource block start
++	guint8 resource_block_start_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_resource_block_start, 1, ENC_BIG_ENDIAN);
++	if (resource_block_start_value > 99)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid resource block start value [0..99]");
++	}
++
++	// Number of resource blocks
++	guint8 number_of_resource_blocks_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_resource_blocks, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_resource_blocks_value >= 1 && number_of_resource_blocks_value <= 6))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of resource blocks value [1..6]");
++	}
++
++	// MCS
++	guint8 mcs_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_mcs, 1, ENC_BIG_ENDIAN);
++	if (mcs_value > 15)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mcs value [0..15]");
++	}
++
++	// PUSCH repetition levels
++	guint8 pusch_repetition_levels_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_pusch_repetition_levels, 1, ENC_BIG_ENDIAN);
++	if (dci_format_value == 4)
++	{
++		if (!(pusch_repetition_levels_value >= 1 && pusch_repetition_levels_value <= 4))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pusch repetition levels value [1..4]");
++		}
++	}
++	else if (dci_format_value == 5)
++	{
++		if (!(pusch_repetition_levels_value >= 1 && pusch_repetition_levels_value <= 8))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pusch repetition levels value [1..8]");
++		}
++	}
++
++	// Frequency hopping flag
++	guint8 frequency_hopping_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_frequency_hopping_flag, 1, ENC_BIG_ENDIAN);
++	if (frequency_hopping_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid frequency hopping flag value [0..1]");
++	}
++
++	// New Data indication
++	guint8 new_data_indication_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_new_data_indication, 1, ENC_BIG_ENDIAN);
++	if (new_data_indication_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid new data indication value [0..1]");
++	}
++
++	// HARQ process
++	guint8 harq_process_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_process, 1, ENC_BIG_ENDIAN);
++	if (harq_process_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq process value [0..7]");
++	}
++
++	// Redundancy version
++	guint8 redundancy_version_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_redundancy_version, 1, ENC_BIG_ENDIAN);
++	if (redundancy_version_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid redundancy version value [0..3]");
++	}
++
++	// TPC
++	guint8 tpc_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tpc, 1, ENC_BIG_ENDIAN);
++	if (tpc_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid tpc value [0..3]");
++	}
++
++	// CSI request
++	guint8 csi_request_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_csi_request, 1, ENC_BIG_ENDIAN);
++	if (csi_request_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid csi request value [0..1]");
++	}
++
++	// UL index
++	guint8 ul_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ul_index, 1, ENC_BIG_ENDIAN);
++	if (ul_index_value > 3)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul index value [0..3]");
++	}
++
++	// DAI presence flag
++	guint8 dai_presence_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dai_presence_flag, 1, ENC_BIG_ENDIAN);
++	if (dai_presence_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dai presence value [0..1]");
++	}
++
++	// DL assignment index
++	guint8 dl_assignment_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dl_assignment_index, 1, ENC_BIG_ENDIAN);
++	if (!(dl_assignment_value >=1 && dl_assignment_value <= 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dl assignment value [1, 2, 3, 4]");
++	}
++
++	// SRS request
++	guint8 srs_request_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_srs_request, 1, ENC_BIG_ENDIAN);
++	if (srs_request_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid srs request value [0..1]");
++	}
++
++	// DCI subframe repetition number
++	guint8 dci_subframe_repetition_number_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_dci_subframe_repetition_number, 1, ENC_BIG_ENDIAN);
++	if (!(dci_subframe_repetition_number_value >= 1 && dci_subframe_repetition_number_value <= 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid dci subframe repetition number value [1..4]");
++	}
++
++	//TPC bitmap
++	ptvcursor_add(ptvc, hf_nfapi_tpc_bitmap, 4, ENC_BIG_ENDIAN);
++
++	// Total DCI length including padding
++	ptvcursor_add(ptvc, hf_nfapi_total_dci_length_include_padding, 1, ENC_BIG_ENDIAN);
++
++	// Number of TX Antenna ports
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_tx_antenna_ports, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "TX Antenna Ports", ett_nfapi_tx_antenna_ports, count, dissect_precoding_value);
++}
++static void dissect_rx_ue_info_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Handle
++	ptvcursor_add(ptvc, hf_nfapi_handle, 4, ENC_BIG_ENDIAN);
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (rnti_value < 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++}
++static void dissect_rx_indication_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Length
++	ptvcursor_add(ptvc, hf_nfapi_length, 2, ENC_BIG_ENDIAN);
++
++	// Data offset
++	ptvcursor_add(ptvc, hf_nfapi_data_offset, 2, ENC_BIG_ENDIAN);
++
++	// UL_CQI
++	ptvcursor_add(ptvc, hf_nfapi_ul_cqi, 1, ENC_BIG_ENDIAN);
++
++	// Timing advance
++	guint16 timing_advance_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_timing_advance, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance value [0..63]");
++	}
++}
++static void dissect_rx_indication_rel9_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Timing advance R9
++	guint16 timing_advance_r9_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_timing_advance_r9, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_r9_value > 7690)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance r9 value [0..7690]");
++	}
++
++}
++static void dissect_harq_indication_data_bundling_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0, 1, ENC_BIG_ENDIAN);
++	if (!(value_0 >= 1 && value_0 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [1..7]");
++	}
++
++	guint8 value_1 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_1, 1, ENC_BIG_ENDIAN);
++	if (!(value_1 >= 1 && value_1 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 1 [1..7]");
++	}
++}
++static void dissect_harq_indication_data_format_1a_1b_bundling_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0, 1, ENC_BIG_ENDIAN);
++	if (!(value_0 >= 1 && value_0 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [1..7]");
++	}
++}
++static void dissect_harq_indication_data_multplexing_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0, 1, ENC_BIG_ENDIAN);
++	if (!(value_0 >= 1 && value_0 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [1..7]");
++	}
++
++	guint8 value_1 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_1, 1, ENC_BIG_ENDIAN);
++	if (!(value_1 >= 1 && value_1 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 1 [1..7]");
++	}
++
++	guint8 value_2 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_2, 1, ENC_BIG_ENDIAN);
++	if (!(value_2 >= 1 && value_2 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 2 [1..7]");
++	}
++
++	guint8 value_3 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_3, 1, ENC_BIG_ENDIAN);
++	if (!(value_3 >= 1 && value_3 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 3 [1..7]");
++	}
++
++}
++static void dissect_harq_indication_data_format_1a_1b_multplexing_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0, 1, ENC_BIG_ENDIAN);
++	if (!(value_0 >= 1 && value_0 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [1..7]");
++	}
++}
++static void dissect_harq_indication_data_special_bundling_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0_special, 1, ENC_BIG_ENDIAN);
++	if (value_0 > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [0..4]");
++	}
++}
++static void dissect_harq_indication_data_format_1a_1b_special_bundling_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0_special, 1, ENC_BIG_ENDIAN);
++	if (value_0 > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [0..4]");
++	}
++}
++static void dissect_harq_indication_data_channel_selection_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0, 1, ENC_BIG_ENDIAN);
++	if (!(value_0 >= 1 && value_0 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [1..7]");
++	}
++}
++static void dissect_harq_indication_data_format_3_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0, 1, ENC_BIG_ENDIAN);
++	if (!(value_0 >= 1 && value_0 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [1..7]");
++	}
++}
++static void dissect_harq_indication_data_format_4_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0, 1, ENC_BIG_ENDIAN);
++	if (!(value_0 >= 1 && value_0 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [1..7]");
++	}
++}
++static void dissect_harq_indication_data_format_5_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 value_0 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_data_value_0, 1, ENC_BIG_ENDIAN);
++	if (!(value_0 >= 1 && value_0 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid value 0 [1..7]");
++	}
++}
++static void dissect_harq_indication_rel8_tdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	guint8 mode = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tdd_harq_mode, 1, ENC_BIG_ENDIAN);
++	if (mode > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mode value [0..4]");
++	}
++
++	guint8 number_of_ack_nack_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_ack_nack, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_ack_nack_value >= 1 && number_of_ack_nack_value <= 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack nack value [1..4]");
++	}
++
++	switch (mode)
++	{
++		case 0:
++		{
++			dissect_harq_indication_data_bundling_value(ptvc, pinfo);
++			break;
++		}
++		case 1:
++		{
++			dissect_harq_indication_data_multplexing_value(ptvc, pinfo);
++			break;
++		}
++		case 2:
++		{
++			dissect_harq_indication_data_special_bundling_value(ptvc, pinfo);
++			break;
++		}
++	};
++}
++static void dissect_harq_indication_rel9_later_tdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 i;
++	proto_item* item;
++
++	guint8 mode = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tdd_harq_mode, 1, ENC_BIG_ENDIAN);
++	if (mode > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mode value [0..4]");
++	}
++
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_ack_nack, 1, ENC_BIG_ENDIAN);
++	if (mode == 0 || mode == 1)
++	{
++		if (!(count >= 1 && count <= 4))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack nack value [1..4]");
++		}
++	}
++	else if (mode == 3)
++	{
++		if (!(count >= 1 && count <= 8))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack nack value [1..8]");
++		}
++	}
++	else if (mode == 4)
++	{
++		if (!(count >= 1 && count <= 21))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack nack value [1..21]");
++		}
++	}
++
++
++	ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_harq_ack_nack_data, "ACK/NACK Data");
++
++	for (i = 0; i < count; ++i)
++	{
++		ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_harq_ack_nack_data, "[%d]", i);
++
++		switch (mode)
++		{
++			case 0:
++			{
++				dissect_harq_indication_data_format_1a_1b_bundling_value(ptvc, pinfo);
++				break;
++			}
++			case 1:
++			{
++				dissect_harq_indication_data_format_1a_1b_multplexing_value(ptvc, pinfo);
++				break;
++			}
++			case 2:
++			{
++				dissect_harq_indication_data_format_1a_1b_special_bundling_value(ptvc, pinfo);
++				break;
++			}
++			case 3:
++			{
++				dissect_harq_indication_data_channel_selection_value(ptvc, pinfo);
++				break;
++			}
++			case 4:
++			{
++				dissect_harq_indication_data_format_3_value(ptvc, pinfo);
++				break;
++			}
++		};
++
++		ptvcursor_pop_subtree(ptvc);
++	}
++
++	ptvcursor_pop_subtree(ptvc);
++}
++static void dissect_harq_indication_rel13_later_tdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 i = 0;
++	proto_item* item;
++
++	guint8 mode = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_tdd_harq_mode, 1, ENC_BIG_ENDIAN);
++	if (mode > 6)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid mode value [0..6]");
++	}
++
++
++	guint16 count = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_ack_nack, 2, ENC_BIG_ENDIAN);
++	if (mode == 0 || mode == 1)
++	{
++		if (!(count >= 1 && count <= 4))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack nack value [1..4]");
++		}
++	}
++	else if (mode == 3)
++	{
++		if (!(count >= 1 && count <= 8))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack nack value [1..8]");
++		}
++	}
++	else if (mode == 4)
++	{
++		if (!(count >= 1 && count <= 21))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack nack value [1..21]");
++		}
++	}
++	else if (mode == 5 || mode == 6)
++	{
++		if (count < 22)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack nack value [>= 22]");
++		}
++
++	}
++
++	ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_harq_ack_nack_data, "ACK/NACK Data");
++
++	for (i = 0; i < count; ++i)
++	{
++		ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_harq_ack_nack_data, "[%d]", i);
++
++		switch (mode)
++		{
++			case 0:
++			{
++				dissect_harq_indication_data_format_1a_1b_bundling_value(ptvc, pinfo);
++				break;
++			}
++			case 1:
++			{
++				dissect_harq_indication_data_format_1a_1b_multplexing_value(ptvc, pinfo);
++				break;
++			}
++			case 2:
++			{
++				dissect_harq_indication_data_special_bundling_value(ptvc, pinfo);
++				break;
++			}
++			case 3:
++			{
++				dissect_harq_indication_data_channel_selection_value(ptvc, pinfo);
++				break;
++			}
++			case 4:
++			{
++				dissect_harq_indication_data_format_3_value(ptvc, pinfo);
++				break;
++			}
++			case 5:
++			{
++				dissect_harq_indication_data_format_4_value(ptvc, pinfo);
++				break;
++			}
++			case 6:
++			{
++				dissect_harq_indication_data_format_5_value(ptvc, pinfo);
++				break;
++			}
++		};
++
++		ptvcursor_pop_subtree(ptvc);
++	}
++
++	ptvcursor_pop_subtree(ptvc);
++}
++static void dissect_harq_indication_rel8_fdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	guint8 harq_tb_1 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_tb_1, 1, ENC_BIG_ENDIAN);
++	if (!(harq_tb_1 >= 1 && harq_tb_1 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq tb 1 [1..7]");
++	}
++
++	guint8 harq_tb_2 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_harq_tb_2, 1, ENC_BIG_ENDIAN);
++	if (!(harq_tb_2 >= 1 && harq_tb_2 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq tb 2 [1..7]");
++	}
++
++}
++static void dissect_harq_tb_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint8 harq_tb_1 = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_harq_tb_n, 1, ENC_BIG_ENDIAN);
++	if (!(harq_tb_1 >= 1 && harq_tb_1 <= 7))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq tb n [1..7]");
++	}
++}
++static void dissect_harq_indication_rel9_later_fdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Mode
++	guint8 harq_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_fdd_harq_mode, 1, ENC_BIG_ENDIAN);
++	if (harq_mode_value > 2)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq mode value [0..2]");
++	}
++
++	// Number of ACK/NACK
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_ack_nack, 1, ENC_BIG_ENDIAN);
++
++	if (harq_mode_value == 0)
++	{
++		if (!(count >=1 && count <= 2))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack/nack value [1..2]");
++		}
++	}
++	else if (harq_mode_value == 1)
++	{
++		if (!(count >= 1 && count <= 4))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack/nack value [1..4]");
++		}
++
++	}
++	else if (harq_mode_value == 2)
++	{
++		if (!(count >= 1 && count <= 10))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack/nack value [1..10]");
++		}
++
++	}
++
++	dissect_array_value(ptvc, pinfo, "HARQ TB List", ett_nfapi_harq_data, count, dissect_harq_tb_value);
++}
++static void dissect_harq_indication_rel13_later_fdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Mode
++	guint8 harq_mode_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_fdd_harq_mode, 1, ENC_BIG_ENDIAN);
++	if (harq_mode_value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid harq mode value [0..4]");
++	}
++
++	// Number of ACK/NACK
++	guint16 count = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_ack_nack, 2, ENC_BIG_ENDIAN);
++
++	if (harq_mode_value == 0)
++	{
++		if (!(count >= 1 && count <= 2))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack/nack value [1..2]");
++		}
++	}
++	else if (harq_mode_value == 1)
++	{
++		if (!(count >= 1 && count <= 4))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack/nack value [1..4]");
++		}
++
++	}
++	else if (harq_mode_value == 2)
++	{
++		if (!(count >= 1 && count <= 10))
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack/nack value [1..10]");
++		}
++	}
++	else if (harq_mode_value == 3 || harq_mode_value == 4)
++	{
++		if (count < 22)
++		{
++			expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of ack/nack value [>= 22]");
++		}
++	}
++
++	dissect_array_value(ptvc, pinfo, "HARQ TB List", ett_nfapi_harq_data, count, dissect_harq_tb_value);
++}
++static void dissect_ul_cqi_information_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// UL_CQI
++	ptvcursor_add(ptvc, hf_nfapi_ul_cqi, 1, ENC_BIG_ENDIAN);
++
++	// Channel
++	guint8 channel_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_channel, 1, ENC_BIG_ENDIAN);
++	if (channel_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid channel value [0..1]");
++	}
++}
++static void dissect_crc_indication_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// CRC Flag
++	guint8 crc_flag_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_crc_flag, 1, ENC_BIG_ENDIAN);
++	if (crc_flag_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid crc flag value [0..1]");
++	}
++}
++static void dissect_rx_cqi_indication_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	//Length
++	ptvcursor_add(ptvc, hf_nfapi_length, 2, ENC_BIG_ENDIAN);
++
++	// Data Offset
++	ptvcursor_add(ptvc, hf_nfapi_data_offset, 2, ENC_BIG_ENDIAN);
++
++	// UL_CQI
++	ptvcursor_add(ptvc, hf_nfapi_ul_cqi, 1, ENC_BIG_ENDIAN);
++
++	// RI
++	guint8 ri_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_ri, 1, ENC_BIG_ENDIAN);
++	if (ri_value > 8)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ri value [0..8]");
++	}
++
++	// Timing Advance
++	guint16 timing_advance_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_timing_advance, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_value > 8)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance value [0..63]");
++	}
++}
++static void dissect_ri_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// RI
++	guint8 ri_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_ri, 1, ENC_BIG_ENDIAN);
++	if (ri_value > 8)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ri value [0..8]");
++	}
++}
++static void dissect_rx_cqi_indication_rel9_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Length
++	ptvcursor_add(ptvc, hf_nfapi_length, 2, ENC_BIG_ENDIAN);
++
++	// Data Offset
++	ptvcursor_add(ptvc, hf_nfapi_data_offset, 2, ENC_BIG_ENDIAN);
++
++	// UL_CQI
++	ptvcursor_add(ptvc, hf_nfapi_ul_cqi, 1, ENC_BIG_ENDIAN);
++
++	// Number of CC reported
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_cc_reported, 1, ENC_BIG_ENDIAN);
++	if (!(count >= 1 && count <= 5))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of CC reported value [1..5]");
++	}
++
++	dissect_array_value(ptvc, pinfo, "CC List", ett_nfapi_cc, count, dissect_ri_value);
++
++	// Timing Advance
++	guint16 timing_advance_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_timing_advance, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance value [0..63]");
++	}
++
++	// Timing Advance R9
++	guint16 timing_advance_r9_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_timing_advance_r9, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_r9_value > 7690)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance value [0..7690]");
++	}
++}
++static void dissect_rach_indication_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// RNTI
++	guint16 rnti_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_rnti, 2, ENC_BIG_ENDIAN);
++	if (rnti_value < 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rnti value [1..65535]");
++	}
++
++	// Preamble
++	guint8 preamble_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_preamble, 1, ENC_BIG_ENDIAN);
++	if (preamble_value > 63)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid preamble value [0..63]");
++	}
++
++	// Timing Advance
++	guint16 timing_advance_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_timing_advance, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_value > 1282)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance value [0..1282]");
++	}
++
++}
++static void dissect_rach_indication_rel9_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Timing Advance R9
++	guint16 timing_advance_r9_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_timing_advance_r9, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_r9_value > 7690)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance value [0..7690]");
++	}
++}
++static void dissect_rach_indication_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// RACH resource type
++	guint8 rach_resource_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_rach_resource_type, 1, ENC_BIG_ENDIAN);
++	if (rach_resource_type_value > 4)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid rach resource type value [0..4]");
++	}
++}
++static void dissect_snr_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// SNR
++	ptvcursor_add(ptvc, hf_nfapi_snr, 1, ENC_BIG_ENDIAN);
++}
++static void dissect_srs_indication_rel8_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Doppler estimation
++	ptvcursor_add(ptvc, hf_nfapi_doppler_estimation, 2, ENC_BIG_ENDIAN);
++
++	// Timing Advance
++	guint16 timing_advance_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_timing_advance, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_value > 1282)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance value [0..1282]");
++	}
++
++	// Number of resource blocks
++	guint8 count = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_resource_blocks, 1, ENC_BIG_ENDIAN);
++
++	// RB start
++	ptvcursor_add(ptvc, hf_nfapi_rb_start, 1, ENC_BIG_ENDIAN);
++
++
++	dissect_array_value(ptvc, pinfo, "RB List", ett_nfapi_rbs, count, dissect_snr_value);
++}
++static void dissect_srs_indication_rel9_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Timing Advance R9
++	guint16 timing_advance_r9_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_timing_advance_r9, 2, ENC_BIG_ENDIAN);
++	if (timing_advance_r9_value > 7690)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid timing advance value [0..7690]");
++	}
++}
++static void dissect_srs_indication_rel10_tdd_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// UpPTS Symbol
++	guint8 uppts_symbol_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_up_pts_symbol, 1, ENC_BIG_ENDIAN);
++	if (uppts_symbol_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid up pts symbol value [0..1]");
++	}
++
++}
++static void dissect_tdd_channel_measurement_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint16 i = 0;
++	guint16 j = 0;
++
++	// numPRBperSubband
++	ptvcursor_add(ptvc, hf_nfapi_number_prb_per_subband, 1, ENC_BIG_ENDIAN);
++
++	// Number of subbands
++	guint8 num_subbands = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_subbands, 1, ENC_BIG_ENDIAN);
++
++	// numAntennas
++	guint8 num_phy_ant = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_antennas, 1, ENC_BIG_ENDIAN);
++
++	ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_subbands, "Subbands");
++
++	for (i = 0; i < num_subbands; ++i)
++	{
++		ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_subbands, "[%d]", i);
++
++		// subbandIndex
++		ptvcursor_add(ptvc, hf_nfapi_subband_index, 1, ENC_BIG_ENDIAN);
++
++		ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_antennas, "Physical Antennas");
++
++		for (j = 0; j < num_phy_ant; ++j)
++		{
++			ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_antennas, "[%d]", j);
++
++			// Channel
++			ptvcursor_add(ptvc, hf_nfapi_channel_coefficient, 2, ENC_BIG_ENDIAN);
++
++			ptvcursor_pop_subtree(ptvc);
++		}
++
++		ptvcursor_pop_subtree(ptvc);
++
++		ptvcursor_pop_subtree(ptvc);
++	}
++
++	ptvcursor_pop_subtree(ptvc);
++}
++static void dissect_srs_indication_rel11_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	//UL_RTOA
++	guint16 ul_rtoa_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_ul_rtoa, 2, ENC_BIG_ENDIAN);
++	if (ul_rtoa_value > 4800)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid ul rtoa value [0..4800]");
++	}
++}
++static void dissect_lbt_dl_config_request_pdsch_req_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Handle
++	ptvcursor_add(ptvc, hf_nfapi_handle, 4, ENC_BIG_ENDIAN);
++
++	// nCCA
++	ptvcursor_add(ptvc, hf_nfapi_mp_cca, 4, ENC_BIG_ENDIAN);
++
++	// NCCA
++	ptvcursor_add(ptvc, hf_nfapi_n_cca, 4, ENC_BIG_ENDIAN);
++
++	// Offset
++	guint32 ul_rtoa_value = tvb_get_guint32(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc), ENC_BIG_ENDIAN);
++	item = ptvcursor_add(ptvc, hf_nfapi_offset, 4, ENC_BIG_ENDIAN);
++	if (ul_rtoa_value > 999)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid offset value [0..999]");
++	}
++
++	// LTE TXOP SF
++	ptvcursor_add(ptvc, hf_nfapi_lte_txop_sf, 4, ENC_BIG_ENDIAN);
++
++	// TXOP SFN/SF End
++	ptvcursor_add(ptvc, hf_nfapi_txop_sfn_sf_end, 2, ENC_BIG_ENDIAN);
++
++	// LBT mode
++	guint32 lbt_mode = tvb_get_guint32(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc), ENC_BIG_ENDIAN);
++	item = ptvcursor_add(ptvc, hf_nfapi_lbt_mode, 4, ENC_BIG_ENDIAN);
++	if (lbt_mode > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid offset value [0..1]");
++	}
++}
++static void dissect_lbt_dl_config_request_drs_req_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Handle
++	ptvcursor_add(ptvc, hf_nfapi_handle, 4, ENC_BIG_ENDIAN);
++
++	// Offset
++	guint32 ul_rtoa_value = tvb_get_guint32(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc), ENC_BIG_ENDIAN);
++	item = ptvcursor_add(ptvc, hf_nfapi_offset, 4, ENC_BIG_ENDIAN);
++	if (ul_rtoa_value > 999)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid offset value [0..999]");
++	}
++
++	// SFN/SF End
++	ptvcursor_add(ptvc, hf_nfapi_sfn_sf_end, 2, ENC_BIG_ENDIAN);
++
++	// LBT mode
++	guint32 lbt_mode = tvb_get_guint32(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc), ENC_BIG_ENDIAN);
++	item = ptvcursor_add(ptvc, hf_nfapi_lbt_mode, 4, ENC_BIG_ENDIAN);
++	if (lbt_mode > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid offset value [0..1]");
++	}
++}
++static void dissect_lbt_dl_config_request_pdsch_resp_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Handle
++	ptvcursor_add(ptvc, hf_nfapi_handle, 4, ENC_BIG_ENDIAN);
++
++	// result
++	guint32 result_value = tvb_get_guint32(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc), ENC_BIG_ENDIAN);
++	item = ptvcursor_add(ptvc, hf_nfapi_result, 4, ENC_BIG_ENDIAN);
++	if (result_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid result value [0..1]");
++	}
++
++	// LTE TXOP symbols
++	ptvcursor_add(ptvc, hf_nfapi_txop_symbols, 4, ENC_BIG_ENDIAN);
++
++	// Initial Partial SF
++	guint32 initial_partial_sf_value = tvb_get_guint32(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc), ENC_BIG_ENDIAN);
++	item = ptvcursor_add(ptvc, hf_nfapi_initial_partial_sf, 4, ENC_BIG_ENDIAN);
++	if (initial_partial_sf_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid initial partial sf value [0..1]");
++	}
++}
++static void dissect_lbt_dl_config_request_drs_resp_rel13_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// Handle
++	ptvcursor_add(ptvc, hf_nfapi_handle, 4, ENC_BIG_ENDIAN);
++
++	// result
++	guint32 result_value = tvb_get_guint32(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc), ENC_BIG_ENDIAN);
++	item = ptvcursor_add(ptvc, hf_nfapi_result, 4, ENC_BIG_ENDIAN);
++	if (result_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid result value [0..1]");
++	}
++}
++static void dissect_tx_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// PDU length
++	guint16 len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pdu_length, 2, ENC_BIG_ENDIAN);
++
++	// PDU index
++	ptvcursor_add(ptvc, hf_nfapi_pdu_index, 2, ENC_BIG_ENDIAN);
++
++	// PDU#N
++	ptvcursor_add(ptvc, hf_nfapi_pdu, len, ENC_NA);
++}
++static void dissect_tx_request_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of PDUs
++	guint16 num_pdu = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_pdus, 2, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "TX PDU List", ett_nfapi_tx_request_pdu_list, num_pdu, dissect_tx_pdu);
++}
++static void dissect_harq_indication_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Instance Length
++	guint16 instance_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_instance_length, 2, ENC_BIG_ENDIAN);
++
++	guint instance_end = (ptvcursor_current_offset(ptvc) + instance_len - 2);
++	dissect_tlv_list(ptvc, pinfo, instance_end);
++}
++static void dissect_harq_indication_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of HARQs
++	guint16 num_pdu = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_harqs, 2, ENC_BIG_ENDIAN);
++
++
++	dissect_array_value(ptvc, pinfo, "HARQ PDU List", ett_nfapi_harq_indication_pdu_list, num_pdu, dissect_harq_indication_pdu);
++}
++static void dissect_crc_indication_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Instance Length
++	guint16 instance_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_instance_length, 2, ENC_BIG_ENDIAN);
++
++	guint instance_end = (ptvcursor_current_offset(ptvc) + instance_len - 2);
++	dissect_tlv_list(ptvc, pinfo, instance_end);
++}
++static void dissect_crc_indication_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of CRCs
++	guint16 num_pdu = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_crcs, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "CRC PDU List", ett_nfapi_crc_indication_pdu_list, num_pdu, dissect_crc_indication_pdu);
++}
++static void dissect_sr_indication_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Instance Length
++	guint16 instance_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_instance_length, 2, ENC_BIG_ENDIAN);
++
++	guint instance_end = (ptvcursor_current_offset(ptvc) + instance_len - 2);
++	dissect_tlv_list(ptvc, pinfo, instance_end);
++}
++static void dissect_rx_sr_indication_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of SRs
++	guint16 num_pdu = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_srs, 2, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "SR PDU List", ett_nfapi_sr_indication_pdu_list, num_pdu, dissect_sr_indication_pdu);
++}
++static void dissect_cqi_indication_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Instance Length
++	guint16 instance_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_instance_length, 2, ENC_BIG_ENDIAN);
++
++	guint instance_end = (ptvcursor_current_offset(ptvc) + instance_len - 2);
++	dissect_tlv_list(ptvc, pinfo, instance_end);
++}
++static void dissect_rx_cqi_indication_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of PDUs
++	guint16 num_pdu = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_cqi, 2, ENC_BIG_ENDIAN);
++
++	guint16* lengths = (guint16*)wmem_alloc0(wmem_packet_scope(), num_pdu * 2);
++	memset(lengths, 0, num_pdu * 2);
++
++	tvbuff_t* tvb = ptvcursor_tvbuff(ptvc);
++	guint8 tmp_offset = ptvcursor_current_offset(ptvc);
++
++	int i = 0;
++	for (i = 0; i < num_pdu; ++i)
++	{
++		guint16 instance_len = tvb_get_ntohs(tvb, tmp_offset);
++		tmp_offset += 2;
++		guint8 pdu_end = tmp_offset + instance_len;
++
++		while (tmp_offset < pdu_end)
++		{
++			guint16 tlv_id = tvb_get_ntohs(tvb, tmp_offset);
++			tmp_offset += 2;
++			guint16 tlv_len = tvb_get_ntohs(tvb, tmp_offset);
++			tmp_offset += 2;
++
++			if (tlv_id == 0x202F)
++			{
++				lengths[i] = tvb_get_ntohs(tvb, tmp_offset);
++			}
++			else if (tlv_id == 0x2030)
++			{
++				lengths[i] = tvb_get_ntohs(tvb, tmp_offset);
++			}
++
++			tmp_offset += tlv_len;
++		}
++	}
++
++	dissect_array_value(ptvc, pinfo, "CQI PDU List", ett_nfapi_cqi_indication_pdu_list, num_pdu, dissect_cqi_indication_pdu);
++
++	for (i = 0; i < num_pdu; ++i)
++	{
++		ptvcursor_add(ptvc, hf_nfapi_pdu, lengths[i], ENC_NA);
++	}
++}
++static void dissect_preamble_indication_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Instance Length
++	guint16 instance_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_instance_length, 2, ENC_BIG_ENDIAN);
++
++	guint instance_end = (ptvcursor_current_offset(ptvc) + instance_len - 2);
++	dissect_tlv_list(ptvc, pinfo, instance_end);
++}
++static void dissect_rach_indication_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of Preambles
++	guint16 num_pdu = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_preambles, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "Preamble PDU List", ett_nfapi_preamble_indication_pdu_list, num_pdu, dissect_preamble_indication_pdu);
++}
++static void dissect_srs_indication_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Instance Length
++	guint16 instance_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_instance_length, 2, ENC_BIG_ENDIAN);
++	guint instance_end = (ptvcursor_current_offset(ptvc) + instance_len - 2);
++	dissect_tlv_list(ptvc, pinfo, instance_end);
++}
++static void dissect_srs_indication_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of UEs
++	guint8 num_pdu = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_srss, 1, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "SRS PDU List", ett_nfapi_srs_indication_pdu_list, num_pdu, dissect_srs_indication_pdu);
++}
++static void dissect_lbt_dl_config_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// PDU Type
++	guint8 pdu_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_lbt_dl_req_pdu_type, 1, ENC_BIG_ENDIAN);
++	if (pdu_type_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdu type value [0..1]");
++	}
++
++	guint8 size = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pdu_size, 1, ENC_BIG_ENDIAN);
++	guint pdu_end = (ptvcursor_current_offset(ptvc) + size - 2);
++
++	dissect_tlv_list(ptvc, pinfo, pdu_end);
++}
++static void dissect_lbt_dl_config_request_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of  PDUs
++	guint16 num_pdu = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_number_pdus, 2, ENC_BIG_ENDIAN);
++	if (!(num_pdu >= 1 && num_pdu <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of pdus value [1..2]");
++	}
++
++	dissect_array_value(ptvc, pinfo, "LBT DL PDU List", ett_nfapi_lbt_dl_config_pdu_list, num_pdu, dissect_lbt_dl_config_pdu);
++}
++static void dissect_lbt_dl_indication_pdu(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// PDU Type
++	guint8 pdu_type_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_lbt_dl_ind_pdu_type, 1, ENC_BIG_ENDIAN);
++	if (pdu_type_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid pdu type value [0..1]");
++	}
++
++	// PDU Size
++	guint8 size = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pdu_size, 1, ENC_BIG_ENDIAN);
++	guint pdu_end = (ptvcursor_current_offset(ptvc) + size - 2);
++	dissect_tlv_list(ptvc, pinfo, pdu_end);
++}
++static void dissect_lbt_indication_message_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of  PDUs
++	guint16 num_pdu = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_number_pdus, 2, ENC_BIG_ENDIAN);
++	if (!(num_pdu >= 1 && num_pdu <= 2))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of pdus value [1..2]");
++	}
++
++	dissect_array_value(ptvc, pinfo, "LBT DL PDU List", ett_nfapi_lbt_dl_indication_pdu_list, num_pdu, dissect_lbt_dl_indication_pdu);
++}
++static void dissect_lte_rssi_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Frequency Band Indicator
++	ptvcursor_add(ptvc, hf_nfapi_frequency_band_indicator, 1, ENC_BIG_ENDIAN);
++
++	// Measurement Period
++	ptvcursor_add(ptvc, hf_nfapi_measurement_period, 2, ENC_BIG_ENDIAN);
++
++	// Bandwidth
++	guint8 bandwidth_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_bandwidth, 1, ENC_BIG_ENDIAN);
++	if (!(bandwidth_value == 6 || bandwidth_value == 15 || bandwidth_value == 25 ||
++		bandwidth_value == 50 || bandwidth_value == 75 || bandwidth_value == 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid bandwidth value [6, 15, 25, 50, 75, 100]");
++	}
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++
++	// Number of EARFCNs
++	guint8 num_earfcns = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_earfcns, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "EARFCNs", ett_nfapi_earfcn_list, num_earfcns, dissect_earfcn_value);
++}
++static void dissect_uarfcn_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// UARFCN
++	ptvcursor_add(ptvc, hf_nfapi_uarfcn, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_utran_rssi_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Frequency Band Indicator
++	ptvcursor_add(ptvc, hf_nfapi_frequency_band_indicator, 1, ENC_BIG_ENDIAN);
++
++	// Measurement Period
++	ptvcursor_add(ptvc, hf_nfapi_measurement_period, 2, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++
++	// Number of UARFCNs
++	guint8 num_uarfcns = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_uarfcns, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "UARFCNs", ett_nfapi_uarfcn_list, num_uarfcns, dissect_uarfcn_value);
++}
++static void dissect_arfcn_dir_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// ARFCN
++	ptvcursor_add(ptvc, hf_nfapi_arfcn, 2, ENC_BIG_ENDIAN);
++
++	// Direction
++	guint8 direction_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_arfcn_direction, 1, ENC_BIG_ENDIAN);
++	if (direction_value > 1)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid direction value [0..1]");
++	}
++
++}
++static void dissect_geran_rssi_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Frequency Band Indicator
++	ptvcursor_add(ptvc, hf_nfapi_frequency_band_indicator, 1, ENC_BIG_ENDIAN);
++
++	// Measurement Period
++	ptvcursor_add(ptvc, hf_nfapi_measurement_period, 2, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++
++	// Number of ARFCNs
++	guint8 num_arfcns = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_arfcns, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "ARFCNs", ett_nfapi_arfcn_list, num_arfcns, dissect_arfcn_dir_value);
++}
++static void dissect_rssi_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// RSSI
++	ptvcursor_add(ptvc, hf_nfapi_rssi, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_rssi_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of RSSI
++	guint16 num_rssi = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_rssi, 2, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "ARFCNs", ett_nfapi_rssi_list, num_rssi, dissect_rssi_value);
++}
++static void dissect_pci_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// PCI
++	ptvcursor_add(ptvc, hf_nfapi_pci, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_lte_cell_search_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// EARFCN
++	ptvcursor_add(ptvc, hf_nfapi_earfcn, 2, ENC_BIG_ENDIAN);
++
++	// Measurement Bandwidth
++	ptvcursor_add(ptvc, hf_nfapi_measurement_bandwidth, 1, ENC_BIG_ENDIAN);
++
++	// Exhaustive Search
++	ptvcursor_add(ptvc, hf_nfapi_exhaustive_search, 1, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++
++	// Number of PCI
++	guint8 num_pci = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_pci, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "PCIs", ett_nfapi_pci_list, num_pci, dissect_pci_value);
++}
++static void dissect_psc_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// PSC
++	ptvcursor_add(ptvc, hf_nfapi_psc, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_utran_cell_search_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// UARFCN
++	ptvcursor_add(ptvc, hf_nfapi_uarfcn, 2, ENC_BIG_ENDIAN);
++
++	// Exhaustive Search
++	ptvcursor_add(ptvc, hf_nfapi_exhaustive_search, 1, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++
++	// Number of PSC
++	guint8 num_psc = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_psc, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "PSCs", ett_nfapi_psc_list, num_psc, dissect_psc_value);
++}
++static void dissect_arfcn_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// ARFCN
++	ptvcursor_add(ptvc, hf_nfapi_arfcn, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_geran_cell_search_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++
++	// Number of ARFCN
++	guint8 num_arfcn = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_arfcns, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "ARFCNs", ett_nfapi_arfcn_list, num_arfcn, dissect_arfcn_value);
++}
++
++static void dissect_lte_cell_found_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// PCI
++	ptvcursor_add(ptvc, hf_nfapi_pci, 2, ENC_BIG_ENDIAN);
++
++	// RSRP
++	ptvcursor_add(ptvc, hf_nfapi_rsrp, 1, ENC_BIG_ENDIAN);
++
++	// RSRQ
++	ptvcursor_add(ptvc, hf_nfapi_rsrq, 1, ENC_BIG_ENDIAN);
++
++	// Frequency Offset
++	ptvcursor_add(ptvc, hf_nfapi_frequency_offset, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_lte_cell_search_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of LTE Cells Found
++	guint16 num_lte_cells = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_lte_cells_found, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "LTE Cells Found", ett_nfapi_lte_cells_found_list, num_lte_cells, dissect_lte_cell_found_value);
++}
++static void dissect_utran_cell_found_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// PSC
++	ptvcursor_add(ptvc, hf_nfapi_psc, 2, ENC_BIG_ENDIAN);
++
++	// RSCP
++	ptvcursor_add(ptvc, hf_nfapi_rscp, 1, ENC_BIG_ENDIAN);
++
++	// EcN0
++	ptvcursor_add(ptvc, hf_nfapi_enco, 1, ENC_BIG_ENDIAN);
++
++	// Frequency Offset
++	ptvcursor_add(ptvc, hf_nfapi_frequency_offset, 2, ENC_BIG_ENDIAN);
++}
++static void dissect_utran_cell_search_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of UTRAN Cells Found
++	guint16 num_utran_cells = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_utran_cells_found, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "UTRAN Cells Found", ett_nfapi_utran_cells_found_list, num_utran_cells, dissect_utran_cell_found_value);
++}
++static void dissect_geran_cell_found_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// ARFCN
++	ptvcursor_add(ptvc, hf_nfapi_arfcn, 2, ENC_BIG_ENDIAN);
++
++	// BSIC
++	ptvcursor_add(ptvc, hf_nfapi_bsic, 1, ENC_BIG_ENDIAN);
++
++	// RxLev
++	ptvcursor_add(ptvc, hf_nfapi_rxlev, 1, ENC_BIG_ENDIAN);
++
++	// RxQual
++	ptvcursor_add(ptvc, hf_nfapi_rxqual, 1, ENC_BIG_ENDIAN);
++
++	// Frequency Offset
++	ptvcursor_add(ptvc, hf_nfapi_frequency_offset, 2, ENC_BIG_ENDIAN);
++
++	// SFN Offset
++	ptvcursor_add(ptvc, hf_nfapi_sfn_offset, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_geran_cell_search_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of GSM Cells Found
++	guint16 num_geran_cells = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_geran_cells_found, 2, ENC_BIG_ENDIAN);
++	dissect_array_value(ptvc, pinfo, "GERAN Cells Found", ett_nfapi_geran_cells_found_list, num_geran_cells, dissect_geran_cell_found_value);
++}
++static void dissect_pnf_cell_search_state_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint len = tvb_reported_length_remaining(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pnf_search_state, len, ENC_NA);
++}
++static void dissect_pnf_cell_broadcast_state_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint len = tvb_reported_length_remaining(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_pnf_broadcast_state, len, ENC_NA);
++}
++static void dissect_lte_broadcast_detect_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// EARFCN
++	ptvcursor_add(ptvc, hf_nfapi_earfcn, 2, ENC_BIG_ENDIAN);
++
++	// PCI
++	ptvcursor_add(ptvc, hf_nfapi_pci, 2, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_utran_broadcast_detect_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// UARFCN
++	ptvcursor_add(ptvc, hf_nfapi_uarfcn, 2, ENC_BIG_ENDIAN);
++
++	// PSC
++	ptvcursor_add(ptvc, hf_nfapi_psc, 2, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_lte_broadcast_detect_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// Number of Tx Antenna
++	guint8 number_of_tx_antenna_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_number_of_tx_antenna, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_tx_antenna_value == 1 || number_of_tx_antenna_value == 2 || number_of_tx_antenna_value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of tx antenna value [1, 2, 4]");
++	}
++
++
++	// MIB Length
++	guint16 mib_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_mib_length, 2, ENC_BIG_ENDIAN);
++
++	// MIB[MIB Length]
++	ptvcursor_add(ptvc, hf_nfapi_mib, mib_len, ENC_NA);
++
++	// SFN Offset
++	ptvcursor_add(ptvc, hf_nfapi_sfn_offset, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_utran_broadcast_detect_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// MIB Length
++	guint16 mib_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_mib_length, 2, ENC_BIG_ENDIAN);
++
++	// MIB[MIB Length]
++	ptvcursor_add(ptvc, hf_nfapi_mib, mib_len, ENC_NA);
++
++	// SFN Offset
++	ptvcursor_add(ptvc, hf_nfapi_sfn_offset, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_lte_system_information_schedule_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// EARFCN
++	ptvcursor_add(ptvc, hf_nfapi_earfcn, 2, ENC_BIG_ENDIAN);
++
++	// PCI
++	ptvcursor_add(ptvc, hf_nfapi_pci, 2, ENC_BIG_ENDIAN);
++
++	// Bandwidth
++	guint16 bandwidth_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_bandwidth, 2, ENC_BIG_ENDIAN);
++	if (!(bandwidth_value == 6 || bandwidth_value == 15 || bandwidth_value == 25 ||
++		bandwidth_value == 50 || bandwidth_value == 75 || bandwidth_value == 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid bandwidth value [6, 15, 25, 50, 75, 100]");
++	}
++
++	// PHICH Configuration
++	// todo : phich bit decode
++	ptvcursor_add(ptvc, hf_nfapi_phich_configuration, 1, ENC_BIG_ENDIAN);
++
++	// Number of Tx Antenna
++	guint8 number_of_tx_antenna_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_tx_antenna, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_tx_antenna_value == 1 || number_of_tx_antenna_value == 2 || number_of_tx_antenna_value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of tx antenna value [1, 2, 4]");
++	}
++
++	// retryCount
++	ptvcursor_add(ptvc, hf_nfapi_retry_count, 1, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_lte_system_information_schedule_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// this needs to be SIB 1
++	guint len = tvb_reported_length_remaining(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_sib1, len, ENC_NA);
++}
++static void dissect_si_periodicity_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	proto_item* item;
++
++	// SI Periodicity
++	guint8 si_periodicity_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_si_periodicity, 1, ENC_BIG_ENDIAN);
++	if (si_periodicity_value > 7)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid si periodicity value [0..7]");
++	}
++
++	// SI Index
++	guint8 si_index_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_si_index, 1, ENC_BIG_ENDIAN);
++	if (si_index_value > 32)
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid si index value [0..32]");
++	}
++}
++
++static void dissect_lte_system_information_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// EARFCN
++	ptvcursor_add(ptvc, hf_nfapi_earfcn, 2, ENC_BIG_ENDIAN);
++
++	// PCI
++	ptvcursor_add(ptvc, hf_nfapi_pci, 2, ENC_BIG_ENDIAN);
++
++	// Downlink channel bandwidth
++	guint16 bandwidth_value = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_downlink_channel_bandwidth, 2, ENC_BIG_ENDIAN);
++	if (!(bandwidth_value == 6 || bandwidth_value == 15 || bandwidth_value == 25 ||
++		bandwidth_value == 50 || bandwidth_value == 75 || bandwidth_value == 100))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid bandwidth value [6, 15, 25, 50, 75, 100]");
++	}
++
++	// PHICH Configuration
++	ptvcursor_add(ptvc, hf_nfapi_phich_configuration, 1, ENC_BIG_ENDIAN);
++
++	// Number of Tx Antenna
++	guint8 number_of_tx_antenna_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_number_of_tx_antenna, 1, ENC_BIG_ENDIAN);
++	if (!(number_of_tx_antenna_value == 1 || number_of_tx_antenna_value == 2 || number_of_tx_antenna_value == 4))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid number of tx antenna value [1, 2, 4]");
++	}
++
++	// Number of SI Periodicity
++	guint8 si_priodicity = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_of_si_periodicity, 1, ENC_BIG_ENDIAN);
++
++	dissect_array_value(ptvc, pinfo, "Number SI Periodicity", ett_nfapi_si_periodicity_list, si_priodicity, dissect_si_periodicity_value);
++
++	// SI Window Length
++	guint8 si_window_length_value = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	item = ptvcursor_add(ptvc, hf_nfapi_si_window_length, 1, ENC_BIG_ENDIAN);
++	if (!(si_window_length_value == 1 || si_window_length_value == 2 || si_window_length_value == 5 || si_window_length_value == 10 ||
++		  si_window_length_value == 15 || si_window_length_value == 20 || si_window_length_value == 40))
++	{
++		expert_add_info_format(pinfo, item, &ei_invalid_range, "Invalid si window length value [1, 2, 5, 10, 15, 20, 40]");
++	}
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_utran_system_information_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// UARFCN
++	ptvcursor_add(ptvc, hf_nfapi_uarfcn, 2, ENC_BIG_ENDIAN);
++
++	// PSC
++	ptvcursor_add(ptvc, hf_nfapi_psc, 2, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_geran_system_information_request_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// ARFCN
++	ptvcursor_add(ptvc, hf_nfapi_arfcn, 2, ENC_BIG_ENDIAN);
++
++	// BSIC
++	ptvcursor_add(ptvc, hf_nfapi_bsic, 1, ENC_BIG_ENDIAN);
++
++	// Timeout
++	ptvcursor_add(ptvc, hf_nfapi_timeout, 4, ENC_BIG_ENDIAN);
++}
++static void dissect_lte_system_information_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// SIB Type
++	ptvcursor_add(ptvc, hf_nfapi_sib_type, 1, ENC_BIG_ENDIAN);
++
++	// SIB Length
++	guint16 sib_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_sib_len, 2, ENC_BIG_ENDIAN);
++
++	// SIB[SIB Length]
++	ptvcursor_add(ptvc, hf_nfapi_sib, sib_len, ENC_NA);
++}
++static void dissect_utran_system_information_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// SIB Length
++	guint16 sib_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_sib_len, 2, ENC_BIG_ENDIAN);
++
++	// SIB[SIB Length]
++	ptvcursor_add(ptvc, hf_nfapi_sib, sib_len, ENC_NA);
++}
++static void dissect_geran_system_information_indication_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	// SI Length
++	guint16 si_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_si_len, 2, ENC_BIG_ENDIAN);
++
++	// SI[SI Length]
++	ptvcursor_add(ptvc, hf_nfapi_si, si_len, ENC_NA);
++}
++
++static void dissect_rx_indication_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_);
++
++// Important the tags must be in numerical order so that they can be indexed correctly
++const tlv_t nfapi_tags[] =
++{
++	{ 0x1000, "PNF Param General", dissect_pnf_param_general_value },
++	{ 0x1001, "PNF PHY", dissect_pnf_phy_value },
++	{ 0x1002, "PNF RF", dissect_pnf_rf_value },
++	{ 0x1003, "PNF PHY RF Config", dissect_pnf_phy_rf_config_value },
++	{ 0x1004, "DL RS Tx power", dissect_dl_rs_tx_power_value },
++	{ 0x1005, "Received interference power", dissect_received_interference_power_value },
++	{ 0x1006, "Thermal noise power", dissect_thermal_noise_power_value },
++	{ 0x1007, "DL RS TX Power measurement", dissect_dl_rs_tx_power_measurement_value },
++	{ 0x1008, "Received Interference power measurement", dissect_received_interference_power_measurement_value },
++	{ 0x1009, "Thermal noise power measurement", dissect_thermal_noise_power_measurement_value },
++	{ 0x100A, "PNF PHY Rel 10", dissect_pnf_phy_rel10_value },
++	{ 0x100B, "PNF PHY Rel 11", dissect_pnf_phy_rel11_value },
++	{ 0x100C, "PNF PHY Rel 12", dissect_pnf_phy_rel12_value },
++	{ 0x100D, "PNF PHY Rel 13", dissect_pnf_phy_rel13_value },
++};
++
++const tlv_t configuration_tags[] =
++{
++	{ 0x0000, NULL, NULL },
++	{ 0x0001, "Subframe config - Duplex Mode", dissect_duplex_mode_value },
++	{ 0x0002, "Subframe config - PCFICH power offset TLV", dissect_pcfich_power_offset_value },
++	{ 0x0003, "Subframe config - P-B", dissect_pb_value },
++	{ 0x0004, "Subframe config - DL cyclic prefix type", dissect_dl_cyclic_prefix_value },
++	{ 0x0005, "Subframe config - UL cyclic prefix type", dissect_ul_cyclic_prefix_value },
++	{ 0x0006, NULL, NULL },
++	{ 0x0007, NULL, NULL },
++	{ 0x0008, NULL, NULL },
++	{ 0x0009, NULL, NULL },
++	{ 0x000A, "RF config - Downlink channel bandwidth", dissect_dl_channel_bandwidth_value },
++	{ 0x000B, "RF config - Uplink channel bandwidth", dissect_ul_channel_bandwidth_value },
++	{ 0x000C, "RF config - Reference signal power", dissect_reference_signal_power_value },
++	{ 0x000D, "RF config - Tx antenna ports", dissect_tx_antenna_ports_value },
++	{ 0x000E, "RF config - Rx Antenna ports", dissect_rx_antenna_ports_value },
++	{ 0x000F, NULL, NULL },
++	{ 0x0010, NULL, NULL },
++	{ 0x0011, NULL, NULL },
++	{ 0x0012, NULL, NULL },
++	{ 0x0013, NULL, NULL },
++	{ 0x0014, "PHICH config - PHICH resource", dissect_phich_resource_value },
++	{ 0x0015, "PHICH config - PHICH duration", dissect_phich_duration_value },
++	{ 0x0016, "PHICH config - PHICH power offset", dissect_phich_power_offset_value },
++	{ 0x0017, NULL, NULL },
++	{ 0x0018, NULL, NULL },
++	{ 0x0019, NULL, NULL },
++	{ 0x001A, NULL, NULL },
++	{ 0x001B, NULL, NULL },
++	{ 0x001C, NULL, NULL },
++	{ 0x001D, NULL, NULL },
++	{ 0x001E, "SCH config - Primary synchronization signal EPRE/EPRERS", dissect_psch_synch_signal_epre_eprers_value },
++	{ 0x001F, "SCH config - Secondary synchronization signal EPRE/EPRERS", dissect_ssch_synch_signal_epre_eprers_value },
++	{ 0x0020, "SCH config - Physical Cell Id", dissect_physical_cell_id_value },
++	{ 0x0021, NULL, NULL },
++	{ 0x0022, NULL, NULL },
++	{ 0x0023, NULL, NULL },
++	{ 0x0024, NULL, NULL },
++	{ 0x0025, NULL, NULL },
++	{ 0x0026, NULL, NULL },
++	{ 0x0027, NULL, NULL },
++	{ 0x0028, "PRACH config - Configuration index", dissect_prach_configuration_index_value },
++	{ 0x0029, "PRACH config - Root sequence index", dissect_prach_root_sequence_index_value },
++	{ 0x002A, "PRACH config - Zero correlation zone configuration", dissect_prach_zero_correlation_zone_configuration_value },
++	{ 0x002B, "PRACH config - High speed flag", dissect_prach_high_speed_flag_value },
++	{ 0x002C, "PRACH config - Frequency offset", dissect_prach_frequency_offset_value },
++	{ 0x002D, NULL, NULL },
++	{ 0x002E, NULL, NULL },
++	{ 0x002F, NULL, NULL },
++	{ 0x0030, NULL, NULL },
++	{ 0x0031, NULL, NULL },
++	{ 0x0032, "PUSCH config - Hopping mode", dissect_pusch_hopping_mode_value },
++	{ 0x0033, "PUSCH config - Hopping offset", dissect_pusch_hopping_offset_value },
++	{ 0x0034, "PUSCH config - Number of sub-bands", dissect_pusch_number_of_subbands_value },
++	{ 0x0035, NULL, NULL },
++	{ 0x0036, NULL, NULL },
++	{ 0x0037, NULL, NULL },
++	{ 0x0038, NULL, NULL },
++	{ 0x0039, NULL, NULL },
++	{ 0x003A, NULL, NULL },
++	{ 0x003B, NULL, NULL },
++	{ 0x003C, "PUCCH config - Delta PUCCH Shift", dissect_pucch_delta_pucch_shift_value },
++	{ 0x003D, "PUCCH config - N_CQI RB", dissect_pucch_n_cqi_rb_value },
++	{ 0x003E, "PUCCH config - N_AN CS", dissect_pucch_n_an_cs_value },
++	{ 0x003F, "PUCCH config - N1Pucch-AN", dissect_pucch_n1_pucch_an_value },
++	{ 0x0040, NULL, NULL },
++	{ 0x0041, NULL, NULL },
++	{ 0x0042, NULL, NULL },
++	{ 0x0043, NULL, NULL },
++	{ 0x0044, NULL, NULL },
++	{ 0x0045, NULL, NULL },
++	{ 0x0046, "SRS config - Bandwidth configuration", dissect_srs_bandwidth_configuration_value },
++	{ 0x0047, "SRS config - MaxUpPTS", dissect_srs_max_uppts_value },
++	{ 0x0048, "SRS config - SRS subframe configuration", dissect_srs_subframe_configuration_value },
++	{ 0x0049, "SRS config - SRS AckNack SRS simultaneous transmission", dissect_srs_acknack_srs_sim_tx_value },
++	{ 0x004A, NULL, NULL },
++	{ 0x004B, NULL, NULL },
++	{ 0x004C, NULL, NULL },
++	{ 0x004D, NULL, NULL },
++	{ 0x004E, NULL, NULL },
++	{ 0x004F, NULL, NULL },
++	{ 0x0050, "Uplink reference signal config - Uplink RS hopping", dissect_uplink_rs_hopping_value },
++	{ 0x0051, "Uplink reference signal config - Group assignment (delta sequence-shift pattern)", dissect_group_assignment_value },
++	{ 0x0052, "Uplink reference signal config - Cyclic Shift 1 for DMRS", dissect_cyclic_shift_1_for_drms_value },
++	{ 0x0053, NULL, NULL },
++	{ 0x0054, NULL, NULL },
++	{ 0x0055, NULL, NULL },
++	{ 0x0056, NULL, NULL },
++	{ 0x0057, NULL, NULL },
++	{ 0x0058, NULL, NULL },
++	{ 0x0059, NULL, NULL },
++	{ 0x005A, "TDD frame structure config - Subframe assignment", dissect_tdd_subframe_assignement_value },
++	{ 0x005B, "TDD frame structure config - Special sub-frame patterns", dissect_tdd_subframe_patterns_value },
++	{ 0x005C, NULL, NULL },
++	{ 0x005D, NULL, NULL },
++	{ 0x005E, NULL, NULL },
++	{ 0x005F, NULL, NULL },
++	{ 0x0060, NULL, NULL },
++	{ 0x0061, NULL, NULL },
++	{ 0x0062, NULL, NULL },
++	{ 0x0063, NULL, NULL },
++	{ 0x0064, "LAA config - ED Threshold for LBT for PDSCH", dissect_laa_ed_threashold_for_lbt_for_pdsch_value },
++	{ 0x0065, "LAA config - ED Threshold for LBT for DRS", dissect_laa_ed_threashold_for_lbt_for_drs_value },
++	{ 0x0066, "LAA config - PD Threshold", dissect_laa_pd_threshold_value },
++	{ 0x0067, "LAA config - Multi carrier type", dissect_laa_multi_carrier_type_value },
++	{ 0x0068, "LAA config - Multi carrier TX", dissect_laa_multi_carrier_tx_value },
++	{ 0x0069, "LAA config - Multi carrier freeze", dissect_laa_multi_carrier_freeze_value },
++	{ 0x006A, "LAA config - Tx antenna ports for DRS", dissect_laa_tx_antenna_port_for_drs_value },
++	{ 0x006B, "LAA config - Transmission power for DRS", dissect_laa_transmission_power_for_drs_value },
++	{ 0x006C, NULL, NULL },
++	{ 0x006D, NULL, NULL },
++	{ 0x006E, NULL, NULL },
++	{ 0x006F, NULL, NULL },
++	{ 0x0070, NULL, NULL },
++	{ 0x0071, NULL, NULL },
++	{ 0x0072, NULL, NULL },
++	{ 0x0073, NULL, NULL },
++	{ 0x0074, NULL, NULL },
++	{ 0x0075, NULL, NULL },
++	{ 0x0076, NULL, NULL },
++	{ 0x0077, NULL, NULL },
++	{ 0x0078, "eMTC config - PBCH Repetitions enable R13", dissect_emtc_pbch_repeitions_enabled_r13_value },
++	{ 0x0079, "eMTC config - PRACH CAT-M Root sequence index", dissect_emtc_prach_cat_m_root_sequence_index_value },
++	{ 0x007A, "eMTC config - PRACH CAT-M Zero correlation zone configuration", dissect_emtc_prach_cat_m_zero_correlation_zone_configuration_value },
++	{ 0x007B, "eMTC config - PRACH CAT-M High speed flag", dissect_emtc_prach_cat_m_high_speed_flag_value },
++	{ 0x007C, "eMTC config - PRACH CE level #0 Enable", dissect_emtc_prach_ce_level_0_enabled_value },
++	{ 0x007D, "eMTC config - PRACH CE level #0 Configuration index", dissect_emtc_prach_ce_level_0_configuration_offset_value },
++	{ 0x007E, "eMTC config - PRACH CE level #0 Frequency offset", dissect_emtc_prach_ce_level_0_frequency_offset_value },
++	{ 0x007F, "eMTC config - PRACH CE level #0 Number of repetitions per attempt", dissect_emtc_preach_ce_level_0_num_of_repeitions_per_attempt_value },
++	{ 0x0080, "eMTC config - CE level #0 Starting subframe periodicity", dissect_emtc_ce_level_0_starting_subframe_periodicity_value },
++	{ 0x0081, "eMTC config - PRACH CE level #0 Hopping Enable", dissect_emtc_preach_ce_level_0_hopping_enabled_value },
++	{ 0x0082, "eMTC config - PRACH CE level #0 Hopping Offset", dissect_emtc_preach_ce_level_0_hopping_offset_value },
++	{ 0x0083, "eMTC config - PRACH CE level #1 Enable", dissect_emtc_prach_ce_level_1_enabled_value },
++	{ 0x0084, "eMTC config - PRACH CE level #1 Configuration index", dissect_emtc_prach_ce_level_1_configuration_offset_value },
++	{ 0x0085, "eMTC config - PRACH CE level #1 Frequency offset", dissect_emtc_prach_ce_level_1_frequency_offset_value },
++	{ 0x0086, "eMTC config - PRACH CE level #1 Number of repetitions per attempt", dissect_emtc_preach_ce_level_1_num_of_repeitions_per_attempt_value },
++	{ 0x0087, "eMTC config - CE level #1 Starting subframe periodicity", dissect_emtc_ce_level_1_starting_subframe_periodicity_value },
++	{ 0x0088, "eMTC config - PRACH CE level #1 Hopping Enable", dissect_emtc_preach_ce_level_1_hopping_enabled_value },
++	{ 0x0089, "eMTC config - PRACH CE level #1 Hopping Offset", dissect_emtc_preach_ce_level_1_hopping_offset_value },
++	{ 0x008A, "eMTC config - PRACH CE level #2 Enable", dissect_emtc_prach_ce_level_2_enabled_value },
++	{ 0x008B, "eMTC config - PRACH CE level #2 Configuration index", dissect_emtc_prach_ce_level_2_configuration_offset_value },
++	{ 0x008C, "eMTC config - PRACH CE level #2 Frequency offset", dissect_emtc_prach_ce_level_2_frequency_offset_value },
++	{ 0x008D, "eMTC config - PRACH CE level #2 Number of repetitions per attempt", dissect_emtc_preach_ce_level_2_num_of_repeitions_per_attempt_value },
++	{ 0x008E, "eMTC config - CE level #2 Starting subframe periodicity", dissect_emtc_ce_level_2_starting_subframe_periodicity_value },
++	{ 0x008F, "eMTC config - PRACH CE level #2 Hopping Enable", dissect_emtc_preach_ce_level_2_hopping_enabled_value },
++	{ 0x0090, "eMTC config - PRACH CE level #2 Hopping Offset", dissect_emtc_preach_ce_level_2_hopping_offset_value },
++	{ 0x0091, "eMTC config - PRACH CE level #3 Enable", dissect_emtc_prach_ce_level_3_enabled_value },
++	{ 0x0092, "eMTC config - PRACH CE level #3 Configuration index", dissect_emtc_prach_ce_level_3_configuration_offset_value },
++	{ 0x0093, "eMTC config - PRACH CE level #3 Frequency offset", dissect_emtc_prach_ce_level_3_frequency_offset_value },
++	{ 0x0094, "eMTC config - PRACH CE level #3 Number of repetitions per attempt", dissect_emtc_preach_ce_level_3_num_of_repeitions_per_attempt_value },
++	{ 0x0095, "eMTC config - CE level #3 Starting subframe periodicity", dissect_emtc_ce_level_3_starting_subframe_periodicity_value },
++	{ 0x0096, "eMTC config - PRACH CE level #3 Hopping Enable", dissect_emtc_preach_ce_level_3_hopping_enabled_value },
++	{ 0x0097, "eMTC config - PRACH CE level #3 Hopping Offset", dissect_emtc_preach_ce_level_3_hopping_offset_value },
++	{ 0x0098, "eMTC config - PUCCH Interval - ULHoppingConfigCommonModeA", dissect_emtc_pucch_interval_ul_hopping_config_common_mode_a_value },
++	{ 0x0099, "eMTC config - PUCCH Interval - ULHoppingConfigCommonModeB", dissect_emtc_pucch_interval_ul_hopping_config_common_mode_b_value },
++	{ 0x009A, NULL, NULL },
++	{ 0x009B, NULL, NULL },
++	{ 0x009C, NULL, NULL },
++	{ 0x009D, NULL, NULL },
++	{ 0x009E, NULL, NULL },
++	{ 0x009F, NULL, NULL },
++	{ 0x00A0, NULL, NULL },
++	{ 0x00A1, NULL, NULL },
++	{ 0x00A2, NULL, NULL },
++	{ 0x00A3, NULL, NULL },
++	{ 0x00A4, NULL, NULL },
++	{ 0x00A5, NULL, NULL },
++	{ 0x00A6, NULL, NULL },
++	{ 0x00A7, NULL, NULL },
++	{ 0x00A8, NULL, NULL },
++	{ 0x00A9, NULL, NULL },
++	{ 0x00AA, NULL, NULL },
++	{ 0x00AB, NULL, NULL },
++	{ 0x00AC, NULL, NULL },
++	{ 0x00AD, NULL, NULL },
++	{ 0x00AE, NULL, NULL },
++	{ 0x00AF, NULL, NULL },
++	{ 0x00B0, NULL, NULL },
++	{ 0x00B1, NULL, NULL },
++	{ 0x00B2, NULL, NULL },
++	{ 0x00B3, NULL, NULL },
++	{ 0x00B4, NULL, NULL },
++	{ 0x00B5, NULL, NULL },
++	{ 0x00B6, NULL, NULL },
++	{ 0x00B7, NULL, NULL },
++	{ 0x00B8, NULL, NULL },
++	{ 0x00B9, NULL, NULL },
++	{ 0x00BA, NULL, NULL },
++	{ 0x00BB, NULL, NULL },
++	{ 0x00BC, NULL, NULL },
++	{ 0x00BD, NULL, NULL },
++	{ 0x00BE, NULL, NULL },
++	{ 0x00BF, NULL, NULL },
++	{ 0x00C0, NULL, NULL },
++	{ 0x00C1, NULL, NULL },
++	{ 0x00C2, NULL, NULL },
++	{ 0x00C3, NULL, NULL },
++	{ 0x00C4, NULL, NULL },
++	{ 0x00C5, NULL, NULL },
++	{ 0x00C6, NULL, NULL },
++	{ 0x00C7, NULL, NULL },
++	{ 0x00C8, "Layer 2/3 - Downlink Bandwidth Support", dissect_dl_bandwidth_support_value },
++	{ 0x00C9, "Layer 2/3 - Uplink Bandwidth Support", dissect_ul_bandwidth_support_value },
++	{ 0x00CA, "Layer 2/3 - Downlink modulation support", dissect_dl_modulation_value },
++	{ 0x00CB, "Layer 2/3 - Uplink modulation support", dissect_ul_modulation_value },
++	{ 0x00CC, "Layer 2/3 - PHY antenna capability", dissect_phy_antenna_capability_value },
++	{ 0x00CD, "Layer 2/3 - Release capability", dissect_release_capability_value },
++	{ 0x00CE, "Layer 2/3 - MBSFN capability", dissect_mbsfn_value },
++	{ 0x00CF, NULL, NULL },
++	{ 0x00D0, NULL, NULL },
++	{ 0x00D1, "LAA Capability - LAA support", dissect_laa_support_value },
++	{ 0x00D2, "LAA Capability - PD sensing LBT support", dissect_laa_pd_sensing_lbt_support_value },
++	{ 0x00D3, "LAA Capability - Multi carrier LBT support", dissect_laa_multi_carrier_lbt_support_value },
++	{ 0x00D4, "LAA Capability - Partial SF support", dissect_laa_partial_sf_support_value },
++	{ 0x00D5, NULL, NULL },
++	{ 0x00D6, NULL, NULL },
++	{ 0x00D7, NULL, NULL },
++	{ 0x00D8, NULL, NULL },
++	{ 0x00D9, NULL, NULL },
++	{ 0x00DA, NULL, NULL },
++	{ 0x00DB, NULL, NULL },
++	{ 0x00DC, NULL, NULL },
++	{ 0x00DD, NULL, NULL },
++	{ 0x00DE, NULL, NULL },
++	{ 0x00DF, NULL, NULL },
++	{ 0x00E0, NULL, NULL },
++	{ 0x00E1, NULL, NULL },
++	{ 0x00E2, NULL, NULL },
++	{ 0x00E3, NULL, NULL },
++	{ 0x00E4, NULL, NULL },
++	{ 0x00E5, NULL, NULL },
++	{ 0x00E6, NULL, NULL },
++	{ 0x00E7, NULL, NULL },
++	{ 0x00E8, NULL, NULL },
++	{ 0x00E9, NULL, NULL },
++	{ 0x00EA, NULL, NULL },
++	{ 0x00EB, NULL, NULL },
++	{ 0x00EC, NULL, NULL },
++	{ 0x00ED, NULL, NULL },
++	{ 0x00EE, NULL, NULL },
++	{ 0x00EF, NULL, NULL },
++	{ 0x00F0, "Layer 2/3 - Data report mode", dissect_data_report_mode_value },
++	{ 0x00F1, "Layer 2/3 - SFN/SF", dissect_sfn_sf_value },
++	{ 0x00F2, NULL, NULL },
++	{ 0x00F3, NULL, NULL },
++	{ 0x00F4, NULL, NULL },
++	{ 0x00F5, NULL, NULL },
++	{ 0x00F6, NULL, NULL },
++	{ 0x00F7, NULL, NULL },
++	{ 0x00F8, NULL, NULL },
++	{ 0x00F9, NULL, NULL },
++	{ 0x00FA, "Layer 1 - PHY state", dissect_phy_state_value },
++	{ 0x00FB, NULL, NULL },
++	{ 0x00FC, NULL, NULL },
++	{ 0x00FD, NULL, NULL },
++	{ 0x00FE, NULL, NULL },
++	{ 0x00FF, NULL, NULL },
++	{ 0x0100, "NFAPI - P7 VNF Address IPv4", dissect_p7_vnf_address_ipv4_value },
++	{ 0x0101, "NFAPI - P7 VNF Address IPv4", dissect_p7_vnf_address_ipv6_value },
++	{ 0x0102, "NFAPI - P7 Port", dissect_p7_vnf_port_value },
++	{ 0x0103, "NFAPI - P7 PNF Address IPv4", dissect_p7_pnf_address_ipv4_value },
++	{ 0x0104, "NFAPI - P7 PNF Address IPv4", dissect_p7_pnf_address_ipv6_value },
++	{ 0x0105, "NFAPI - P7 Port", dissect_p7_pnf_port_value },
++	{ 0x0106, NULL, NULL },
++	{ 0x0107, NULL, NULL },
++	{ 0x0108, NULL, NULL },
++	{ 0x0109, NULL, NULL },
++	{ 0x010A, "NFAPI - Downlink UEs per Subframe", dissect_downlink_ues_per_subframe_value },
++	{ 0x010B, "NFAPI - Uplink UEs per Subframe", dissect_uplink_ues_per_subframe_value },
++	{ 0x010C, NULL, NULL },
++	{ 0x010D, NULL, NULL },
++	{ 0x010E, NULL, NULL },
++	{ 0x010F, NULL, NULL },
++	{ 0x0110, NULL, NULL },
++	{ 0x0111, NULL, NULL },
++	{ 0x0112, NULL, NULL },
++	{ 0x0113, NULL, NULL },
++	{ 0x0114, "NFAPI - nFAPI RF Bands", dissect_rf_bands_value },
++	{ 0x0115, NULL, NULL },
++	{ 0x0116, NULL, NULL },
++	{ 0x0117, NULL, NULL },
++	{ 0x0118, NULL, NULL },
++	{ 0x0119, NULL, NULL },
++	{ 0x011A, NULL, NULL },
++	{ 0x011B, NULL, NULL },
++	{ 0x011C, NULL, NULL },
++	{ 0x011D, NULL, NULL },
++	{ 0x011E, "NFAPI - Timing window", dissect_timing_window_value },
++	{ 0x011F, "NFAPI - Timing info mode", dissect_timing_info_mode_value },
++	{ 0x0120, "NFAPI - Timing info period", dissect_timing_info_period_value },
++	{ 0x0121, NULL, NULL },
++	{ 0x0122, NULL, NULL },
++	{ 0x0123, NULL, NULL },
++	{ 0x0124, NULL, NULL },
++	{ 0x0125, NULL, NULL },
++	{ 0x0126, NULL, NULL },
++	{ 0x0127, NULL, NULL },
++	{ 0x0128, "NFAPI - Maximum Transmit Power", dissect_maximum_transmit_power_value },
++	{ 0x0129, "NFAPI - EARFCN", dissect_earfcn_value },
++	{ 0x012A, NULL, NULL },
++	{ 0x012B, NULL, NULL },
++	{ 0x012C, NULL, NULL },
++	{ 0x012D, NULL, NULL },
++	{ 0x012E, NULL, NULL },
++	{ 0x012F, NULL, NULL },
++	{ 0x0130, "NFAPI - NMM GSM Frequency Bands", dissect_nmm_gsm_frequency_bands_value },
++	{ 0x0131, "NFAPI - NMM UMTS Frequency Bands", dissect_nmm_umts_frequency_bands_value },
++	{ 0x0132, "NFAPI - NMM LTE Frequency Bands", dissect_nmm_lte_frequency_bands_value },
++	{ 0x0133, "NFAPI - NMM Uplink RSSI supported", dissect_nmm_uplink_rssi_supported_value },
++};
++
++const tlv_t p7_tags[] =
++{
++	{ 0x2000, "DL Config Request Body", dissect_dl_config_request_body_value },
++	{ 0x2001, "DL DCI PDU Release 8", dissect_dl_config_request_dl_dci_pdu_rel8_value },
++	{ 0x2002, "DL DCI PDU Release 9", dissect_dl_config_request_dl_dci_pdu_rel9_value },
++	{ 0x2003, "DL DCI PDU Release 10", dissect_dl_config_request_dl_dci_pdu_rel10_value },
++	{ 0x2004, "BCH PDU Release 8", dissect_dl_config_request_bch_pdu_rel8_value },
++	{ 0x2005, "MCH PDU Release 8", dissect_dl_config_request_mch_pdu_rel8_value },
++	{ 0x2006, "DLSCH PDU Release 8", dissect_dl_config_request_dlsch_pdu_rel8_value },
++	{ 0x2007, "DLSCH PDU Release 9", dissect_dl_config_request_dlsch_pdu_rel9_value },
++	{ 0x2008, "DLSCH PDU Release 10", dissect_dl_config_request_dlsch_pdu_rel10_value },
++	{ 0x2009, "PCH PDU Release 8", dissect_dl_config_request_pch_pdu_rel8_value },
++	{ 0x200A, "PRS PDU Release 9", dissect_dl_config_request_prs_pdu_rel9_value },
++	{ 0x200B, "CSI-RS PDU Release 10", dissect_dl_config_request_csi_rs_pdu_rel10_value },
++	{ 0x200C, "UL Config Request Body", dissect_ul_config_request_body_value },
++	{ 0x200D, "ULSCH PDU Release 8", dissect_ul_config_ulsch_pdu_rel8_value },
++	{ 0x200E, "ULSCH PDU Release 10", dissect_ul_config_ulsch_pdu_rel10_value },
++	{ 0x200F, "Initial Transmission Parameters Release 8", dissect_ul_config_init_tx_params_rel8_value },
++	{ 0x2010, "CQI RI Information Release 8", dissect_ul_config_cqi_ri_info_rel8_value },
++	{ 0x2011, "CQI RI Information Release 9 or later", dissect_ul_config_cqi_ri_info_rel9_later_value },
++	{ 0x2012, "HARQ Information (ULSCH) Release 10", dissect_ul_config_harq_info_ulsch_rel10_value },
++	{ 0x2013, "UE Information Release 8", dissect_ul_config_ue_info_rel8_value },
++	{ 0x2014, "CQI Information Release 8", dissect_ul_config_cqi_info_rel8_value },
++	{ 0x2015, "CQI Information Release 10", dissect_ul_config_cqi_info_rel10_value },
++	{ 0x2016, "SR Information Release 8", dissect_ul_config_sr_info_rel8_value },
++	{ 0x2017, "SR Information Release 10", dissect_ul_config_sr_info_rel10_value },
++	{ 0x2018, "HARQ Information (UCI) Release 10 TDD", dissect_ul_config_harq_info_uci_rel10_tdd_value },
++	{ 0x2019, "HARQ Information (UCI) Release 8 FDD", dissect_ul_config_harq_info_uci_rel8_fdd_value },
++	{ 0x201A, "HARQ Information (UCI) Release 9 or later FDD", dissect_ul_config_harq_info_uci_rel9_later_fdd_value },
++	{ 0x201B, "SRS Information Release 8", dissect_ul_config_srs_info_rel8_value },
++	{ 0x201C, "SRS Information Release 10", dissect_ul_config_srs_info_rel10_value },
++	{ 0x201D, "HI DCI0 Request Body", dissect_hi_dci0_request_body_value },
++	{ 0x201E, "HI PDU Release 8", dissect_hi_dci0_hi_rel8_value },
++	{ 0x201F, "HI PDU Release 10", dissect_hi_dci0_hi_rel10_value },
++	{ 0x2020, "DCI UL PDU Release 8", dissect_hi_dci0_dci_ul_rel8_value },
++	{ 0x2021, "DCI UL PDU Release 10", dissect_hi_dci0_dci_ul_rel10_value },
++	{ 0x2022, "Tx Request Body", dissect_tx_request_body_value },
++	{ 0x2023, "RX Indication Body", dissect_rx_indication_body_value },
++	{ 0x2024, "RX PDU Release 8", dissect_rx_indication_rel8_value },
++	{ 0x2025, "RX PDU Release 9", dissect_rx_indication_rel9_value },
++	{ 0x2026, "HARQ Indication Body", dissect_harq_indication_body_value },
++	{ 0x2027, "HARQ PDU Release 8 TDD", dissect_harq_indication_rel8_tdd_value },
++	{ 0x2028, "HARQ PDU Release 9 or later TDD", dissect_harq_indication_rel9_later_tdd_value },
++	{ 0x2029, "HARQ PDU Release 8 FDD", dissect_harq_indication_rel8_fdd_value },
++	{ 0x202A, "HARQ PDU Release 9 or later FDD", dissect_harq_indication_rel9_later_fdd_value },
++	{ 0x202B, "CRC Indication Body", dissect_crc_indication_body_value },
++	{ 0x202C, "CRC PDU Release 8", dissect_crc_indication_rel8_value },
++	{ 0x202D, "RX SR Indication Body", dissect_rx_sr_indication_body_value },
++	{ 0x202E, "RX CQI Indication Body", dissect_rx_cqi_indication_body_value },
++	{ 0x202F, "CQI PDU Release 8", dissect_rx_cqi_indication_rel8_value },
++	{ 0x2030, "CQI PDU Release 9", dissect_rx_cqi_indication_rel9_value },
++	{ 0x2031, "RACH Indication Body", dissect_rach_indication_body_value },
++	{ 0x2032, "Preamable PDU Release 8", dissect_rach_indication_rel8_value },
++	{ 0x2033, "Preamable PDU Release 9", dissect_rach_indication_rel9_value },
++	{ 0x2034, "SRS Indication Body", dissect_srs_indication_body_value },
++	{ 0x2035, "SRS PDU Release 8", dissect_srs_indication_rel8_value },
++	{ 0x2036, "SRS PDU Release 9", dissect_srs_indication_rel9_value },
++	{ 0x2037, "SRS PDU Release 10 TDD", dissect_srs_indication_rel10_tdd_value },
++	{ 0x2038, "RX UE Information", dissect_rx_ue_info_value },
++	{ 0x2039, "DL DCI PDU Release 11", dissect_dl_config_request_dl_dci_pdu_rel11_value },
++	{ 0x203A, "DL DCI PDU Release 12", dissect_dl_config_request_dl_dci_pdu_rel12_value },
++	{ 0x203B, "DL DCI PDU Release 13", dissect_dl_config_request_dl_dci_pdu_rel13_value },
++	{ 0x203C, "DLSCH PDU Release 11", dissect_dl_config_request_dlsch_pdu_rel11_value },
++	{ 0x203D, "DLSCH PDU Release 12", dissect_dl_config_request_dlsch_pdu_rel12_value },
++	{ 0x203E, "DLSCH PDU Release 13", dissect_dl_config_request_dlsch_pdu_rel13_value },
++	{ 0x203F, "PCH PDU Release 13", dissect_dl_config_request_pch_pdu_rel13_value },
++	{ 0x2040, "CSI-RS PDU Release 13", dissect_dl_config_request_csi_rs_pdu_rel13_value },
++	{ 0x2041, "EDPCCH PDU Release 11 Parameters", dissect_dl_config_request_edpcch_params_rel11_value },
++	{ 0x2042, "EDPCCH PDU Release 13 Parameters", dissect_dl_config_request_edpcch_params_rel13_value },
++	{ 0x2043, "ULSCH PDU Release 11", dissect_ul_config_ulsch_pdu_rel11_value },
++	{ 0x2044, "ULSCH PDU Release 13", dissect_ul_config_ulsch_pdu_rel13_value },
++	{ 0x2045, "CQI RI Information Release 13", dissect_ul_config_cqi_ri_info_rel13_value },
++	{ 0x2046, "HARQ Information (ULSCH) Release 13", dissect_ul_config_harq_info_ulsch_rel13_value },
++	{ 0x2047, "UE Information Release 11", dissect_ul_config_ue_info_rel11_value },
++	{ 0x2048, "UE Information Release 13", dissect_ul_config_ue_info_rel13_value },
++	{ 0x2049, "CQI Information Release 13", dissect_ul_config_cqi_info_rel13_value },
++	{ 0x204A, "HARQ Information (UCI) Release 11 FDD/TDD", dissect_ul_config_harq_info_uci_rel11_fdd_tdd_value },
++	{ 0x204B, "HARQ Information (UCI) Release 13 FDD/TDD", dissect_ul_config_harq_info_uci_rel13_fdd_tdd_value },
++	{ 0x204C, "SRS Information Release 13", dissect_ul_config_srs_info_rel13_value },
++	{ 0x204D, "DCI UL PDU Release 12", dissect_hi_dci0_dci_ul_rel12_value },
++	{ 0x204E, "MDPCCH DCI UL PDU Release 13", dissect_hi_dci0_mdpcch_dci_ul_rel13_value },
++	{ 0x204F, "HARQ PDU Release 13 or later TDD", dissect_harq_indication_rel13_later_tdd_value },
++	{ 0x2050, "HARQ PDU Release 13 or later FDD", dissect_harq_indication_rel13_later_fdd_value },
++	{ 0x2051, "Preamable PDU Release 13", dissect_rach_indication_rel13_value },
++	{ 0x2052, "UL CQI Information", dissect_ul_cqi_information_value },
++	{ 0x2053, "SRS PDU Release 11", dissect_srs_indication_rel11_value },
++	{ 0x2054, "TDD Channel Measurement", dissect_tdd_channel_measurement_value },
++	{ 0x2055, "LBT DL Config Request Body", dissect_lbt_dl_config_request_body_value },
++	{ 0x2056, "LBT PDSCH Req PDU Release 13", dissect_lbt_dl_config_request_pdsch_req_rel13_value },
++	{ 0x2057, "LBT DRS req PDU Release 13", dissect_lbt_dl_config_request_drs_req_rel13_value },
++	{ 0x2058, "LBT DL Indication Message Body", dissect_lbt_indication_message_body_value },
++	{ 0x2059, "LBT PDSCH Resp PDU Release 13", dissect_lbt_dl_config_request_pdsch_resp_rel13_value },
++	{ 0x205A, "LBT DRS Resp PDU Release 13", dissect_lbt_dl_config_request_drs_resp_rel13_value },
++	{ 0x205B, "MPDCCH PDU Release 13", dissect_dl_config_request_mpdpcch_pdu_rel13_value },
++};
++
++const tlv_t p4_tags[] =
++{
++	{ 0x3000, "LTE RSSI Request", dissect_lte_rssi_request_value },
++	{ 0x3001, "UTRAN RSSI Request", dissect_utran_rssi_request_value },
++	{ 0x3002, "GERAN RSSI Request", dissect_geran_rssi_request_value },
++	{ 0x3003, "RSSI Indication", dissect_rssi_indication_value },
++	{ 0x3004, "LTE CELL SEARCH Request", dissect_lte_cell_search_value },
++	{ 0x3005, "UTRAN CELL SEARCH Request", dissect_utran_cell_search_value },
++	{ 0x3006, "GERAN CELL SEARCH Request", dissect_geran_cell_search_value },
++	{ 0x3007, "LTE CELL SEARCH Indication", dissect_lte_cell_search_indication_value },
++	{ 0x3008, "UTRAN CELL SEARCH Indication", dissect_utran_cell_search_indication_value },
++	{ 0x3009, "GERAN CELL SEARCH Indication", dissect_geran_cell_search_indication_value },
++	{ 0x300A, "PNF CELL SEARCH STATE", dissect_pnf_cell_search_state_value },
++	{ 0x300B, "LTE BROADCAST DETECT Request", dissect_lte_broadcast_detect_request_value },
++	{ 0x300C, "UTRAN BROADCAST DETECT Request", dissect_utran_broadcast_detect_request_value },
++	{ 0x300D, "PNF CELL SEARCH STATE", dissect_pnf_cell_search_state_value },
++	{ 0x300E, "LTE BROADCAST DETECT Indication", dissect_lte_broadcast_detect_indication_value },
++	{ 0x300F, "UTRAN BROADCAST DETECT Indication", dissect_utran_broadcast_detect_indication_value },
++	{ 0x3010, "PNF CELL BROADCAST STATE", dissect_pnf_cell_broadcast_state_value },
++	{ 0x3011, "LTE SYSTEM INFORMATION SCHEDULE Request", dissect_lte_system_information_schedule_request_value },
++	{ 0x3012, "PNF CELL BROADCAST STATE", dissect_pnf_cell_broadcast_state_value },
++	{ 0x3013, "LTE SYSTEM INFORMATION SCHEDULE Indication", dissect_lte_system_information_schedule_indication_value },
++	{ 0x3014, "LTE SYSTEM INFORMATION Request", dissect_lte_system_information_request_value },
++	{ 0x3015, "UTRAN SYSTEM INFORMATION Request", dissect_utran_system_information_request_value },
++	{ 0x3016, "GERAN SYSTEM INFORMATION Request", dissect_geran_system_information_request_value },
++	{ 0x3017, "PNF CELL BROADCAST STATE", dissect_pnf_cell_broadcast_state_value },
++	{ 0x3018, "LTE SYSTEM INFORMATION Indication", dissect_lte_system_information_indication_value },
++	{ 0x3019, "UTRAN SYSTEM INFORMATION Indication", dissect_utran_system_information_indication_value },
++	{ 0x301A, "GERAN SYSTEM INFORMATION Indication", dissect_geran_system_information_indication_value },
++};
++
++
++static const tlv_t* look_up_tlv(int tag_id)
++{
++	const tlv_t* tlv = NULL;
++
++	static const gint num_configuration_tags = sizeof(configuration_tags) / sizeof(tlv_t);
++	static const gint num_nfapi_tags = sizeof(nfapi_tags) / sizeof(tlv_t);
++	static const gint num_p7_tags = sizeof(p7_tags) / sizeof(tlv_t);
++	static const gint num_p4_tags = sizeof(p4_tags) / sizeof(tlv_t);
++
++	if (tag_id >= 0x0000 && tag_id <= (0x0000 + num_configuration_tags - 1)) // 0x0133)
++	{
++		tlv = &configuration_tags[tag_id];
++	}
++	else if (tag_id >= 0x1000 && tag_id <= (0x1000 + num_nfapi_tags - 1)) // 0x100D)
++	{
++		tlv = &nfapi_tags[tag_id - 0x1000];
++	}
++	else if (tag_id >= 0x2000 && tag_id <= (0x2000 + num_p7_tags - 1)) //0x205B)
++	{
++		tlv = &p7_tags[tag_id - 0x2000];
++	}
++	else if (tag_id >= 0x3000 && tag_id <= (0x3000 + num_p4_tags - 1)) // 0x301A)
++	{
++		tlv = &p4_tags[tag_id - 0x3000];
++	}
++	return tlv;
++}
++
++
++static proto_item* dissect_tl_header(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_tl, "TL");
++	ptvcursor_add(ptvc, hf_nfapi_tl_tag, 2, ENC_BIG_ENDIAN);
++	proto_item* item = ptvcursor_add(ptvc, hf_nfapi_tl_length, 2, ENC_BIG_ENDIAN);
++	ptvcursor_pop_subtree(ptvc);
++
++	return item;
++}
++
++static void dissect_tlv_list(ptvcursor_t* ptvc, packet_info* pinfo, gint len)
++{
++	while (ptvcursor_current_offset(ptvc) < len)
++	{
++		guint16 tlv_id = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++		guint16 tlv_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc) + 2);
++
++		const tlv_t* tlv = look_up_tlv(tlv_id);
++
++		if (tlv != NULL && tlv->name != NULL && tlv->tag_id == tlv_id)
++		{
++			ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_tlv_tree, "%s", tlv->name);
++			proto_item* tlv_length_item = dissect_tl_header(ptvc, pinfo);
++
++			// There are rare cases where the len of the tlv is 0.
++			if (tlv_len > 0)
++			{
++
++				if (tlv->decode != NULL)
++				{
++					// Create a sub buff with the correct length, so we can detect reading off the end
++					tvbuff_t* sub_tvbuff = tvb_new_subset_length(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc), tlv_len);
++					ptvcursor_t* sub_ptvc = ptvcursor_new(ptvcursor_tree(ptvc), sub_tvbuff, 0);
++
++					tlv->decode(sub_ptvc, pinfo);
++
++					if (ptvcursor_current_offset(sub_ptvc) != tlv_len)
++					{
++						// error in the tlv length
++						expert_add_info_format(pinfo, tlv_length_item, &ei_invalid_tlv_length, "TLV length does not match decoded length");
++					}
++
++					ptvcursor_free(sub_ptvc);
++				}
++
++				ptvcursor_advance(ptvc, tlv_len);
++			}
++
++			ptvcursor_pop_subtree(ptvc);
++		}
++		else
++		{
++			if (tlv_id >= 0xF000 /* && tlv_id <= 0xFFFF*/)
++			{
++				ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_tlv_tree, "Unknown Vendor Extension Tag");
++			}
++			else
++			{
++				ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_tlv_tree, "Unknown");
++			}
++
++			dissect_tl_header(ptvc, pinfo);
++			ptvcursor_advance(ptvc, tlv_len);
++			ptvcursor_pop_subtree(ptvc);
++		}
++	}
++}
++
++
++static void dissect_rx_indication_body_value(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	guint number_of_pdu_addr = ptvcursor_current_offset(ptvc); // *offset;
++	guint16 count = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_number_pdus, 2, ENC_BIG_ENDIAN);
++
++	guint16* lengths = (guint16*)wmem_alloc0(wmem_packet_scope(), count * 2);
++	memset(lengths, 0, count * 2);
++
++	guint16 i = 0;
++
++	if (count > 0)
++	{
++		ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_rx_indication_pdu_list, "RX PDU List");
++		gint pdu_end = tvb_reported_length_remaining(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc)) + ptvcursor_current_offset(ptvc);
++
++		while (tvb_reported_length_remaining(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc)) > 0 &&
++			   ptvcursor_current_offset(ptvc) < pdu_end )
++		{
++			guint16 tlv_id = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++			//guint16 tlv_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc) + 2);
++
++			if (tlv_id == 0x2038)
++			{
++				if (i != 0)
++					ptvcursor_pop_subtree(ptvc);
++
++				ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_rx_indication_pdu_list, "[%d]", i);
++
++				i++;
++			}
++
++			char* tlv_name = "Unknown";
++			const tlv_t* tlv = look_up_tlv(tlv_id);
++
++			if (tlv != NULL && tlv->name != NULL && tlv->tag_id == tlv_id)
++			{
++				tlv_name = tlv->name;
++			}
++
++			ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_rx_indication_pdu_list, "%s", tlv_name);
++
++			dissect_tl_header(ptvc, pinfo);
++
++
++			if (tlv_id == 0x2038)
++			{
++				dissect_rx_ue_info_value(ptvc, pinfo);
++			}
++			else if (tlv_id == 0x2024)
++			{
++				lengths[i - 1] = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++				ptvcursor_add(ptvc, hf_nfapi_length, 2, ENC_BIG_ENDIAN);
++				int data_offset = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++				ptvcursor_add(ptvc, hf_nfapi_data_offset, 2, ENC_BIG_ENDIAN);
++				ptvcursor_add(ptvc, hf_nfapi_ul_cqi, 1, ENC_BIG_ENDIAN);
++				ptvcursor_add(ptvc, hf_nfapi_timing_advance, 2, ENC_BIG_ENDIAN);
++
++				if ((data_offset > 0) && (pdu_end == (tvb_reported_length_remaining(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc)) + ptvcursor_current_offset(ptvc))))
++				{
++					pdu_end = number_of_pdu_addr + data_offset;
++				}
++
++			}
++			else if (tlv_id == 0x2025)
++			{
++				dissect_rx_indication_rel9_value(ptvc, pinfo);
++			}
++
++			ptvcursor_pop_subtree(ptvc);
++
++		}
++
++		// pop the last pdu index.
++		ptvcursor_pop_subtree(ptvc);
++
++		ptvcursor_pop_subtree(ptvc);
++	}
++
++	for (i = 0; i < count; ++i)
++	{
++		ptvcursor_add(ptvc, hf_nfapi_pdu, lengths[i], ENC_NA);
++	}
++}
++
++
++// ----------------------------------------------------------------------------|
++
++static void dissect_p45_header(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_p4_p5_message_header, "P4 P5 Header");
++	ptvcursor_add(ptvc, hf_nfapi_p4_p5_message_header_phy_id, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p4_p5_message_header_message_id, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p4_p5_message_header_message_length, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p4_p5_message_header_spare, 2, ENC_BIG_ENDIAN);
++	ptvcursor_pop_subtree(ptvc);
++
++}
++
++static void dissect_p7_header_new(ptvcursor_t* ptvc, guint8* m, guint8* seg, guint8* seq)
++{
++	ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_p7_message_header, "P7 Header");
++
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_phy_id, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_message_id, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_message_length, 2, ENC_BIG_ENDIAN);
++
++	guint8 m_seg = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	*m = (m_seg & 0x80) >> 7;
++	*seg = m_seg & 0x7F;
++
++	proto_tree_add_bits_item(ptvcursor_tree(ptvc), hf_nfapi_p7_message_header_m, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8, 1, ENC_NA);
++	proto_tree_add_bits_item(ptvcursor_tree(ptvc), hf_nfapi_p7_message_header_segment, ptvcursor_tvbuff(ptvc), ((ptvcursor_current_offset(ptvc)) * 8) + 1, 7, ENC_NA);
++	ptvcursor_advance(ptvc, 1);
++
++
++	*seq = tvb_get_guint8(ptvcursor_tvbuff(ptvc), ptvcursor_current_offset(ptvc));
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_sequence_number, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_checksum, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_transmit_timestamp, 4, ENC_BIG_ENDIAN);
++
++	ptvcursor_pop_subtree(ptvc);
++}
++
++
++static void dissect_p7_header(ptvcursor_t * ptvc, packet_info* pinfo _U_)
++{
++	ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_p7_message_header, "P7 Header");
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_phy_id, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_message_id, 2, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_message_length, 2, ENC_BIG_ENDIAN);
++
++	proto_tree_add_bits_item(ptvcursor_tree(ptvc), hf_nfapi_p7_message_header_m, ptvcursor_tvbuff(ptvc), (ptvcursor_current_offset(ptvc)) * 8, 1, ENC_NA);
++	proto_tree_add_bits_item(ptvcursor_tree(ptvc), hf_nfapi_p7_message_header_segment, ptvcursor_tvbuff(ptvc), ((ptvcursor_current_offset(ptvc)) * 8) + 1, 7, ENC_NA);
++	ptvcursor_advance(ptvc, 1);
++
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_sequence_number, 1, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_checksum, 4, ENC_BIG_ENDIAN);
++	ptvcursor_add(ptvc, hf_nfapi_p7_message_header_transmit_timestamp, 4, ENC_BIG_ENDIAN);
++
++	ptvcursor_pop_subtree(ptvc);
++}
++
++static reassembly_table ul_p7_reassemble_table;
++static reassembly_table dl_p7_reassemble_table;
++
++static int hf_msg_fragments = -1;
++static int hf_msg_fragment = -1;
++static int hf_msg_fragment_overlap = -1;
++static int hf_msg_fragment_overlap_conflicts = -1;
++static int hf_msg_fragment_multiple_tails = -1;
++static int hf_msg_fragment_too_long_fragment = -1;
++static int hf_msg_fragment_error = -1;
++static int hf_msg_fragment_count = -1;
++static int hf_msg_reassembled_in = -1;
++static int hf_msg_reassembled_length = -1;
++static gint ett_msg_fragment = -1;
++static gint ett_msg_fragments = -1;
++
++static const fragment_items msg_frag_items = {
++	/* Fragment subtrees */
++	&ett_msg_fragment,
++	&ett_msg_fragments,
++	/* Fragment fields */
++	&hf_msg_fragments,
++	&hf_msg_fragment,
++	&hf_msg_fragment_overlap,
++	&hf_msg_fragment_overlap_conflicts,
++	&hf_msg_fragment_multiple_tails,
++	&hf_msg_fragment_too_long_fragment,
++	&hf_msg_fragment_error,
++	&hf_msg_fragment_count,
++	/* Reassembled in field */
++	&hf_msg_reassembled_in,
++	/* Reassembled length field */
++	&hf_msg_reassembled_length,
++	NULL,
++	/* Tag */
++	"Message fragments"
++};
++
++static void dissect_nfapi_ul_p7(ptvcursor_t *ptvc, packet_info *pinfo)
++{
++	guint8 m;
++	guint8 seg;
++	guint8 seq;
++
++	guint8 save_fragmented;
++	ptvcursor_t* sub_ptvc = 0;
++
++	guint16 msg_id = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), 2);
++	guint16 msg_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), 4);
++
++	dissect_p7_header_new(ptvc, &m, &seg, &seq);
++	save_fragmented = pinfo->fragmented;
++
++	if (m == 1 || (m == 0 && seg > 0))
++	{
++		tvbuff_t* tvbuff = ptvcursor_tvbuff(ptvc);
++		guint offset = ptvcursor_current_offset(ptvc);
++		proto_tree* tree = ptvcursor_tree(ptvc);
++
++		pinfo->fragmented = TRUE;
++
++		fragment_head *fd_head = fragment_add_seq_check(&ul_p7_reassemble_table, tvbuff, offset, pinfo, seq, NULL, seg, msg_len - offset, (m == 1));
++
++		if (fd_head)
++		{
++			tvbuff_t * new_tvb = process_reassembled_data(tvbuff, offset, pinfo, "Reassembled UL P7", fd_head, &msg_frag_items, NULL, tree);
++			if (new_tvb)
++			{
++				sub_ptvc = ptvcursor_new(tree, new_tvb, 0);
++
++				col_append_fstr(pinfo->cinfo, COL_INFO, "[NFAPI P7 Reassembled %d]", seg);
++			}
++			else
++			{
++				col_append_fstr(pinfo->cinfo, COL_INFO, "[NFAPI P7 Segment %d]", seg);
++				return;
++			}
++		}
++		else
++		{
++			return;
++		}
++	}
++
++	pinfo->fragmented = save_fragmented;
++
++	{
++		switch (msg_id)
++		{
++			case NFAPI_HARQ_INDICATION_MSG_ID:
++			{
++				ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++				dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			}
++			break;
++			case NFAPI_CRC_INDICATION_MSG_ID:
++			{
++				ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++				dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			}
++			break;
++			case NFAPI_RX_ULSCH_INDICATION_MSG_ID:
++			{
++				ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++				dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			}
++			break;
++			case NFAPI_RACH_INDICATION_MSG_ID:
++			{
++				ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++				dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			}
++			break;
++			case NFAPI_SRS_INDICATION_MSG_ID:
++			{
++				ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++				dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			}
++			break;
++			case NFAPI_RX_SR_INDICATION_MSG_ID:
++			{
++				ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++				dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			}
++			break;
++			case NFAPI_RX_CQI_INDICATION_MSG_ID:
++			{
++				ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++				dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			}
++			break;
++
++		};
++	}
++
++	if (sub_ptvc)
++		ptvcursor_free(sub_ptvc);
++}
++
++static void dissect_nfapi_dl_p7(ptvcursor_t *ptvc, packet_info *pinfo)
++{
++	guint8 m;
++	guint8 seg;
++	guint8 seq;
++
++	guint8 save_fragmented;
++	ptvcursor_t* sub_ptvc = 0;
++
++	guint16 msg_id = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), 2);
++	guint16 msg_len = tvb_get_ntohs(ptvcursor_tvbuff(ptvc), 4);
++
++	dissect_p7_header_new(ptvc, &m, &seg, &seq);
++	save_fragmented = pinfo->fragmented;
++
++	if (m == 1 || (m == 0 && seg > 0))
++	{
++		tvbuff_t* tvbuff = ptvcursor_tvbuff(ptvc);
++		guint offset = ptvcursor_current_offset(ptvc);
++		proto_tree* tree = ptvcursor_tree(ptvc);
++
++		pinfo->fragmented = TRUE;
++
++		fragment_head *fd_head = fragment_add_seq_check(&dl_p7_reassemble_table, tvbuff, offset, pinfo, seq, NULL, seg, msg_len - offset, (m == 1));
++
++		if (fd_head)
++		{
++			tvbuff_t * new_tvb = process_reassembled_data(tvbuff, offset, pinfo, "Reassembled DL P7", fd_head, &msg_frag_items, NULL, tree);
++			if (new_tvb)
++			{
++				sub_ptvc = ptvcursor_new(tree, new_tvb, 0);
++				col_append_fstr(pinfo->cinfo, COL_INFO, "[NFAPI P7 Reassembled %d]", seg);
++			}
++			else
++			{
++				col_append_fstr(pinfo->cinfo, COL_INFO, "[NFAPI P7 Segment %d]", seg);
++				return;
++			}
++		}
++		else
++		{
++			return;
++		}
++	}
++
++	pinfo->fragmented = save_fragmented;
++
++	switch (msg_id)
++	{
++		case NFAPI_DL_CONFIG_REQUEST_MSG_ID:
++		{
++			ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++			dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			break;
++		}
++		case NFAPI_UL_CONFIG_REQUEST_MSG_ID:
++		{
++			ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++			dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++		}
++		break;
++		case NFAPI_HI_DCI0_REQUEST_MSG_ID:
++		{
++			ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++			dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++		}
++		break;
++		case NFAPI_TX_REQUEST_MSG_ID:
++		{
++			ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++			dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++		}
++		break;
++		case NFAPI_LBT_DL_CONFIG_REQUEST_MSG_ID:
++		{
++			ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++			dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++		}
++		break;
++		case NFAPI_LBT_DL_INDICATION_MSG_ID:
++		{
++			ptvcursor_add(sub_ptvc ? sub_ptvc : ptvc, hf_nfapi_sfn_sf, 2, ENC_BIG_ENDIAN);
++			dissect_tlv_list(sub_ptvc ? sub_ptvc : ptvc, pinfo, msg_len);
++			break;
++		}
++	}
++
++	if (sub_ptvc)
++		ptvcursor_free(sub_ptvc);
++}
++
++
++static int dissect_nfapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
++{
++	col_set_str(pinfo->cinfo, COL_PROTOCOL, "NFAPI");
++
++	ptvcursor_t* ptvc = ptvcursor_new(tree, tvb, 0);
++
++	guint16 msg_id = tvb_get_ntohs(tvb, 2);
++
++	// Get the name of the message
++	const gchar* message_str = val_to_str_const(msg_id, message_id_vals, "Unknown");
++
++	// Append to the Info string the nFAPI messages
++	col_clear(pinfo->cinfo, COL_INFO);
++	col_append_fstr(pinfo->cinfo, COL_INFO, " %s ", message_str);
++
++	// Flag if this is a vendor extention message, could do it for P4, 5, 7
++	if (msg_id >= 0x0300 && msg_id <= 0x03FF)
++	{
++		col_append_fstr(pinfo->cinfo, COL_INFO, " Vendor Extension");
++	}
++
++	// Create the top level tree
++	ptvcursor_add_text_with_subtree(ptvc, SUBTREE_UNDEFINED_LENGTH, ett_nfapi_message_tree, "%s", message_str);
++
++	switch (msg_id)
++	{
++		case NFAPI_HARQ_INDICATION_MSG_ID:
++		case NFAPI_CRC_INDICATION_MSG_ID:
++		case NFAPI_RX_ULSCH_INDICATION_MSG_ID:
++		case NFAPI_RACH_INDICATION_MSG_ID:
++		case NFAPI_SRS_INDICATION_MSG_ID:
++		case NFAPI_RX_SR_INDICATION_MSG_ID:
++		case NFAPI_RX_CQI_INDICATION_MSG_ID:
++		{
++			dissect_nfapi_ul_p7(ptvc, pinfo);
++		}
+ 		break;
+-		// LBT_DL.indication
+-		case 0x8D:
+-		{
+-			dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint16_with_conversion(msg_tree, hf_nfapi_sfn_sf, tvb, &offset, sfn_sf_conversion);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
+-		}
+-		// PNF_PARAM.request
+-		case 0x100:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
+-		}
+-		// PNF_PARAM.response
+-		case 0x101:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
+-		}
+-		// PNF_CONFIG.request
+-		case 0x102:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
+-		}
+-		// PNF_CONFIG.response
+-		case 0x103:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			break;
+-		}
+-		// PNF_START.request
+-		case 0x104:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			break;
+-		}
+-		// PNF_START.response
+-		case 0x105:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			break;
+-		}
+-		// PNF_STOP.response
+-		case 0x106:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			break;
+-		}
+-		// PNF_STOP.request
+-		case 0x107:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			break;
+-		}
+-		// PARAM.request
+-		case 0x108:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			break;
+-		}
+-		// PARAM.response
+-		case 0x109:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
+-		}
+-		// CONFIG.request
+-		case 0x10A:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint8(msg_tree, hf_nfapi_num_tlv, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
+-		}
+-		// CONFIG.response
+-		case 0x10B:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			break;
+-		}
+-		// START.request
+-		case 0x10C:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			break;
+-		}
+-		// START.response
+-		case 0x10D:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			break;
+-		}
+-		// STOP.request
+-		case 0x10E:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			break;
+-		}
+-		// STOP.response
+-		case 0x10F:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			break;
+-		}
+-		// MEASUREMENT.request
+-		case 0x110:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++
++		case NFAPI_DL_CONFIG_REQUEST_MSG_ID:
++		case NFAPI_UL_CONFIG_REQUEST_MSG_ID:
++		case NFAPI_HI_DCI0_REQUEST_MSG_ID:
++		case NFAPI_TX_REQUEST_MSG_ID:
++		case NFAPI_LBT_DL_CONFIG_REQUEST_MSG_ID:
++		case NFAPI_LBT_DL_INDICATION_MSG_ID:
++		{
++			dissect_nfapi_dl_p7(ptvc, pinfo);
++			break;
++		}
++
++		case NFAPI_PNF_PARAM_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
++		}
++		case NFAPI_PNF_PARAM_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 4, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++
++			break;
++		}
++		case NFAPI_PNF_CONFIG_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
++		}
++		case NFAPI_PNF_CONFIG_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 4, ENC_BIG_ENDIAN);
++			break;
++		}
++		case NFAPI_PNF_START_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			break;
++		}
++		case NFAPI_PNF_START_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 4, ENC_BIG_ENDIAN);
++			break;
++		}
++		case NFAPI_PNF_STOP_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			break;
++		}
++		case NFAPI_PNF_STOP_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 4, ENC_BIG_ENDIAN);
++			break;
++		}
++		case NFAPI_PARAM_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			break;
++		}
++		case NFAPI_PARAM_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 1, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_num_tlv, 1, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
++		}
++		case NFAPI_CONFIG_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 1, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
++		}
++		case NFAPI_CONFIG_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 4, ENC_BIG_ENDIAN);
++			break;
++		}
++		case NFAPI_START_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			break;
++		}
++		case NFAPI_START_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 4, ENC_BIG_ENDIAN);
++			break;
++		}
++		case NFAPI_STOP_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			break;
++		}
++		case NFAPI_STOP_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 4, ENC_BIG_ENDIAN);
++			break;
++		}
++		case NFAPI_MEASUREMENT_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
++		}
++		case NFAPI_MEASUREMENT_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_error_code, 4, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
++		}
++
++		// P4
++		case NFAPI_RSSI_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_rat_type, 1, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
++		}
++		case NFAPI_RSSI_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			break;
++		}
++		case NFAPI_RSSI_INDICATION_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
++		}
++		case NFAPI_CELL_SEARCH_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_rat_type, 1, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
+ 		}
+-		// MEASUREMENT.response
+-		case 0x111:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_error_code, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
+-		}
+-
+-		// P4
+-		// RSSI.request
+-		case 0x200:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint8(msg_tree, hf_nfapi_rat_type, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_CELL_SEARCH_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			break;
+ 		}
+-		// RSSI.response
+-		case 0x201:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			break;
++		case NFAPI_CELL_SEARCH_INDICATION_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
+ 		}
+-		// RSSI.indication
+-		case 0x202:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_BROADCAST_DETECT_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_rat_type, 1, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
+ 		}
+-		// CELL_SEARCH.request
+-		case 0x203:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint8(msg_tree, hf_nfapi_rat_type, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_BROADCAST_DETECT_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			break;
+ 		}
+-		// CELL_SEARCH.response
+-		case 0x204:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			break;
++		case NFAPI_BROADCAST_DETECT_INDICATION_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
+ 		}
+-		// CELL_SEARCH.indication
+-		case 0x205:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_rat_type, 1, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
+ 		}
+-		// BROADCAST_DETECT.request
+-		case 0x206:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint8(msg_tree, hf_nfapi_rat_type, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			break;
+ 		}
+-		// BROADCAST_DETECT.response
+-		case 0x207:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			break;
++		case NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
+ 		}
+-		// BROADCAST_DETECT.indication
+-		case 0x208:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_SYSTEM_INFORMATION_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_rat_type, 1, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
+ 		}
+-		// SYSTEM_INFORMATION_SCHEDULE.request
+-		case 0x209:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint8(msg_tree, hf_nfapi_rat_type, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_SYSTEM_INFORMATION_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			break;
+ 		}
+-		// SYSTEM_INFORMATOIN_SCHEDULE.response
+-		case 0x20A:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			break;
++		case NFAPI_SYSTEM_INFORMATION_INDICATION_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			dissect_tlv_list(ptvc, pinfo, tvb_reported_length(tvb));
++			break;
+ 		}
+-		// SYSTEM_INFORMATION_SCHEDULE.indication
+-		case 0x20B:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_NMM_STOP_REQUEST_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			break;
+ 		}
+-		// SYSTEM_INFORMATION.request
+-		case 0x20C:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint8(msg_tree, hf_nfapi_rat_type, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_NMM_STOP_RESPONSE_MSG_ID:
++		{
++			dissect_p45_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_p4_error_code, 4, ENC_BIG_ENDIAN);
++			break;
+ 		}
+-		// SYSTEM_INFORMATION.response
+-		case 0x20D:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			break;
++		case NFAPI_DL_NODE_SYNC_MSG_ID:
++		{
++			dissect_p7_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_ul_node_sync_t1, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_ul_node_sync_t2, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_ul_node_sync_t3, 4, ENC_BIG_ENDIAN);
++			break;
+ 		}
+-		// SYSTEM_INFORMATION.indication
+-		case 0x20E:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			dissect_tlv_list(tvb, pinfo, msg_tree, data, &offset, tvb_reported_length(tvb));
+-			break;
++		case NFAPI_UL_NODE_SYNC_MSG_ID:
++		{
++			dissect_p7_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_dl_node_sync_t1, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_dl_node_sync_delta_sfn_sf, 4, ENC_BIG_ENDIAN);
++			break;
+ 		}
+-		// NMM_STOP.request
+-		case 0x20F:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			break;
++		case NFAPI_TIMING_INFO_MSG_ID:
++		{
++			dissect_p7_header(ptvc, pinfo);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_last_sfn_sf, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_time_since_last_timing_info, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_dl_config_jitter, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_tx_request_jitter, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_ul_config_jitter, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_hi_dci0_jitter, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_dl_config_latest_delay, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_tx_request_latest_delay, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_ul_config_latest_delay, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_hi_dci0_latest_delay, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_dl_config_earliest_arrival, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_tx_request_earliest_arrival, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_ul_config_earliest_arrival, 4, ENC_BIG_ENDIAN);
++			ptvcursor_add(ptvc, hf_nfapi_timing_info_hi_dci0_earliest_arrival, 4, ENC_BIG_ENDIAN);
++			break;
+ 		}
+-		// NMM_STOP_response
+-		case 0x210:
+-		{
+-			dissect_p45_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_p4_error_code, tvb, &offset, 0);
+-			break;
+-		}
+-
+-		// DL_NODE.sync
+-		case 0x0180:
+-		{
+-			dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_ul_node_sync_t1, tvb, &offset, "microseconds");
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_ul_node_sync_t2, tvb, &offset, "microseconds");
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_ul_node_sync_t3, tvb, &offset, "microseconds");
+-			break;
+-		}
+-		// UL_NODE.sync
+-		case 0x0181:
+-		{
+-			dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_dl_node_sync_t1, tvb, &offset, "microseconds");
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_dl_node_sync_delta_sfn_sf, tvb, &offset, 0);
+-			break;
+-		}
+-		// TIMING_INFO
+-		case 0x0182:
+-		{
+-			dissect_p7_header(tvb, pinfo, msg_tree, data, &offset);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_last_sfn_sf, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_time_since_last_timing_info, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_dl_config_jitter, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_tx_request_jitter, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_ul_config_jitter, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_hi_dci0_jitter, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_dl_config_latest_delay, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_tx_request_latest_delay, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_ul_config_latest_delay, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_hi_dci0_latest_delay, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_dl_config_earliest_arrival, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_tx_request_earliest_arrival, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_ul_config_earliest_arrival, tvb, &offset, 0);
+-			proto_tree_add_uint32(msg_tree, hf_nfapi_timing_info_hi_dci0_earliest_arrival, tvb, &offset, 0);
+-			break;
+-		}
+-		default:
+-		{
+-			// todo : is this vendor extention?
+-			break;
+-		}
+-	};
+-
+-	return tvb_captured_length(tvb);
+-}
+-
+-static void nfapi_tag_vals_fn(gchar* s, guint32 v)
+-{
+-	int index = look_up_tlv(v);
+-	if (v >= 0)
+-	{
+-		g_snprintf(s, ITEM_LABEL_LENGTH, "%s (0x%x)", tags[index].name, v);
+-	}
+-	else
+-	{
+-		g_snprintf(s, ITEM_LABEL_LENGTH, "%s (0x%x)", "Unknown", v);
+-	}
+-}
+-
+-// ----------------------------------------------------------------------------|
+-
+-void proto_register_nfapi(void)
+-{
+-
+-	static hf_register_info hf[] =
+-	{
+-		{ &hf_msg_fragments, { "Message fragments", "afs.fragments", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_fragment, { "Message fragment", "afs.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_fragment_overlap, { "Message fragment overlap", "afs.fragment.overlap", FT_BOOLEAN, 0, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_fragment_overlap_conflicts, { "Message fragment overlapping with conflicting data", "afs.fragment.overlap.conflicts", FT_BOOLEAN, 0, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_fragment_multiple_tails, { "Message has multiple tail fragments", "afs.fragment.multiple_tails", FT_BOOLEAN, 0, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_fragment_too_long_fragment, { "Message fragment too long", "afs.fragment.too_long_fragment", FT_BOOLEAN, 0, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_fragment_error, { "Message defragmentation error", "afs.fragment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_fragment_count, { "Message fragment count", "afs.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_reassembled_in, { "Reassembled in", "afs.reassembled.in", FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_reassembled_length, { "Reassembled length", "afs.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_msg_reassembled_data, { "Reassembled data", "afs.reassembled.data", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
+-		{ &hf_nfapi_message_tree, { "Message tree", "nfapi.message_tree", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p4_p5_message_header, { "P4 P5 Header", "nfapi.p4_p5_message_header",	FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p4_p5_message_header_phy_id, { "PHY ID", "nfapi.p4_p5_message_header.phy_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p4_p5_message_header_message_id, { "Message ID", "nfapi.p4_p5_message_header.message_id", FT_UINT16, BASE_HEX_DEC, VALS(message_id_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p4_p5_message_header_message_length, { "Message Length", "nfapi.p4_p5_message_header.message_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p4_p5_message_header_spare,	{ "Spare", "nfapi.p4_p5_message_header.spare", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header, { "P7 Header", "nfapi.p7_message_header", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header_phy_id, { "Phy ID", "nfapi.p7_message_header.phy_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header_message_id, { "Message ID", "nfapi.p7.message_header.message_id", FT_UINT16, BASE_HEX_DEC, VALS(message_id_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header_message_length, { "Message Length", "nfapi.p7_message_header.message_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header_m, { "M", "nfapi.p7_message_header.m_segment_sequence", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header_segment, { "Segment Number", "nfapi.p7_message_header.m_segment_sequence", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header_sequence_number, { "Sequence Number", "nfapi.p7_message_header.m_segment_sequence", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header_checksum, { "Checksum", "nfapi.p7_message_header.checksum", FT_UINT32, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p7_message_header_transmit_timestamp, { "Transmit Timestamp", "nfapi.p7_message_header.timestamp", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tlv_tree, { "TAG", "nfapi.tlv.tree", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tl, { "TL", "nfapi.tl", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tl_tag, { "TL Tag", "nfapi.tl_tag", FT_UINT16, BASE_CUSTOM, CF_FUNC(nfapi_tag_vals_fn), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tl_length, { "TL Length", "nfapi.tl_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tag_uint8_value, { "Value", "nfapi.tag.uint8.value", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tag_uint16_value, { "Value", "nfapi.tag.uint16.value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_param_response, { "Param Request", "nfapi.param.request", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_error_code, { "Error Code", "nfapi.error.code", FT_UINT8, BASE_DEC, VALS(nfapi_error_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_p4_error_code, { "Error Code", "nfapi.p4_error.code", FT_UINT8, BASE_DEC, VALS(nfapi_p4_error_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rat_type, { "RAT Type", "nfapi.rat_type", FT_UINT8, BASE_DEC, VALS(nfapi_rat_type_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_num_tlv, { "Number of TLV", "nfapi.param.response.num_tlv", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phy_state, { "Phy state value", "nfapi.phy.state", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_modulation_support,	{ "Modulation value", "nfapi.modulation.support", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_ue_per_sf, { "Downlink UEs per Subframe", "nfapi.dl.ue.per.sf", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_ue_per_sf, { "Uplink UEs per Subframe", "nfapi.ul.ue.per.sf", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_duplex_mode, { "Duplex Mode", "nfapi.duplex.mode", FT_UINT16, BASE_DEC, VALS(nfapi_duplex_mode_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_bandwidth_support, { "Downlink bandwidth support", "nfapi.dl.bandwidth.support", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_bandwidth_support, { "Uplink bandwidth support", "nfapi.ul.bandwidth.support", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_modulation_support, { "Downlink modulation support", "nfapi.dl.modulation.support", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_modulation_support, { "Uplink modulation support", "nfapi.ul.modulation.support", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phy_antenna_capability, { "Phy Antenna capability", "nfapi.phy.antenna.capability", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_release_capability, { "Release capability", "nfapi.release.capability", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mbsfn_capability, { "MBSFN capability", "nfapi.mbsfn.capability", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_laa_capability, { "LAA Support", "nfapi.laa.support", FT_BOOLEAN, 8, TFS(&support_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pd_sensing_lbt_support, { "PD sensing LBT support", "nfapi.pd.sensing.lbt.support", FT_BOOLEAN, 8, TFS(&support_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_multi_carrier_lbt_support, { "Multi carrier LBT support", "nfapi.multi.carrier.lbt.support", FT_UINT16, BASE_DEC, VALS(nfapi_mutli_carrier_lbt_support_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_partial_sf_support, { "Partial SF support", "nfapi.partial.sf.support", FT_BOOLEAN, 8, TFS(&partial_sf_support_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_reference_signal_power, { "Reference signal power", "nfapi.ref_sig_power", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_primary_synchronization_signal_epre_eprers, { "Primary synchronization signal EPRE/EPRERS", "nfapi.primary.sync.signal", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_secondary_synchronization_signal_epre_eprers, { "Secondary synchronization signal EPRE/EPRERS", "nfapi.secondary.sync.signal", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_physical_cell_id, { "Physical Cell ID", "nfapi.physical.cell.id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phich_resource, { "PHICH Resource", "nfapi.phich.resource", FT_UINT16, BASE_DEC, VALS(nfapi_phich_resource_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phich_duration, { "PHICH Duration", "nfapi.phich.duration", FT_BOOLEAN, 8, TFS(&phich_duration_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phich_power_offset, { "PHICH Power Offset", "nfapi.phich.power.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_configuration_index, { "Configuration Index", "nfapi.configuration.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_root_sequence_index, { "Root sequence Index", "nfapi.root.sequence.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_zero_correlation_zone_configuration, { "Zero correlation zone configuration", "nfapi.zero.correlation.zone.configuration", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_high_speed_flag, { "High Speed Flag", "nfapi.high.speed.flag", FT_BOOLEAN, 8, TFS(&high_speed_flag_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_frequency_offset, { "Frequency offset", "nfapi.frequency.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_hopping_mode, { "Hopping Mode", "nfapi.hopping.mode", FT_BOOLEAN, 8, TFS(&hopping_mode_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_hopping_offset, { "Hopping offset", "nfapi.hopping.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_delta_pucch_shift, { "Delta PUCCH Shift", "nfapi.delta.pucch.shift", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_cqi_rb, { "N CQI RB", "nfapi.n.cqi.rb", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_an_cs, { "N AN CS", "nfapi.n.an.cs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n1_pucch_an, { "N1 PUCCH AN", "nfapi.n1.pucch.an", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_bandwidth_configuration, { "Bandwidth configuration", "nfapi.bw.configuration", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_subframe_configuration, { "SRS subframe configuration", "nfapi.srs.subframe.configuration", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_uplink_rs_hopping, { "Uplink RS hopping", "nfapi.uplink.rs.hopping", FT_UINT16, BASE_DEC, VALS(nfapi_uplink_rs_hopping_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_group_assignment, { "Group assigment", "nfapi.group.assignment", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cyclic_shift_1_for_drms, { "Cyclic Shift 1 for DRMS", "nfapi.cyclic.shift.1.for.drms", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_subframe_assignment, { "Subframe_assignment", "nfapi.subframe.assignment", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_special_subframe_patterns, { "Special Subframe patterns", "nfapi.special.subframe.patterns", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ed_threshold_for_lbt_for_pdsch, { "ED Threshold for LBT for PDSCH", "nfapi.subframe.assignment", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ed_threshold_for_lbt_for_drs, { "ED Threshold for LBT for DRS", "nfapi.subframe.assignment", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pd_threshold, { "PD Threshold", "nfapi.subframe.assignment", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_multi_carrier_type, { "Multi carrier type", "nfapi.subframe.assignment", FT_UINT16, BASE_DEC, VALS(nfapi_laa_carrier_type_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_multi_carrier_tx, { "Multi carrier TX", "nfapi.subframe.assignment", FT_BOOLEAN, 8, TFS(&nfapi_multi_carrier_tx_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_multi_carrier_freeze, { "Multi carrier freeze ", "nfapi.subframe.assignment", FT_BOOLEAN, 8, TFS(&nfapi_multi_carrier_freeze_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tx_antenna_ports_for_drs, { "Tx antenna ports for DRS", "nfapi.subframe.assignment", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transmission_power_for_drs, { "Transmission power for DRS", "nfapi.subframe.assignment", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pbch_repetitions_enabled_r13, { "PBCH Repetitions enable R13", "nfapi.pbch.repetitions.enabled_r13", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_cat_m_root_sequence_index, { "PRACH CAT-M Root sequence index", "nfapi.prach.cat_m.root.squence.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_cat_m_zero_correlation_zone_configuration, { "PRACH CAT-M Zero correlation zone configuration", "nfapi.prach.cat_m.zero.correlation.zone.configuration", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_cat_m_high_speed_flag, { "PRACH CAT-M High speed flag", "nfapi.prach.cat_m.high.speed.flag", FT_BOOLEAN, 8, TFS(&high_speed_flag_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_0_enable, { "PRACH CE level #0 Enable", "nfapi.prach.ce.level.0.enable", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_0_configuration_index, { "PRACH CE level #0 Configuration index", "nfapi.prach.ce.level.0.configuration.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_0_frequency_offset, { "PRACH CE level #0 Frequency offset", "nfapi.prach.ce.level.0.frequency_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_0_number_of_repetitions_per_attempt, { "PRACH CE level #0 Number of repetitions per attempt", "nfapi.prach.ce.level.0.number.of.repetitions.per_attempt", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_0_starting_subframe_periodicity, { "CE level #0 Starting subframe periodicity", "nfapi.prach.ce.level.0.starting.subframe_periodicity", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_0_hopping_enabled, { "PRACH CE level #0 Hopping Enable", "nfapi.prach.ce.level.0.hopping_enable", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_0_hopping_offset, { "PRACH CE level #0 Hopping Offset", "nfapi.prach.ce.level.0.hopping.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_1_enable, { "PRACH CE level #1 Enable", "nfapi.prach.ce.level.0.enable", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_1_configuration_index, { "PRACH CE level #1 Configuration index", "nfapi.prach.ce.level.0.configuration.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_1_frequency_offset, { "PRACH CE level #1 Frequency offset", "nfapi.prach.ce.level.0.frequency_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_1_number_of_repetitions_per_attempt, { "PRACH CE level #1 Number of repetitions per attempt", "nfapi.prach.ce.level.0.number.of.repetitions.per_attempt", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_1_starting_subframe_periodicity, { "CE level #1 Starting subframe periodicity", "nfapi.prach.ce.level.0.starting.subframe_periodicity", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_1_hopping_enabled, { "PRACH CE level #1 Hopping Enable", "nfapi.prach.ce.level.0.hopping_enable", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_1_hopping_offset, { "PRACH CE level #1 Hopping Offset", "nfapi.prach.ce.level.0.hopping.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_2_enable, { "PRACH CE level #2 Enable", "nfapi.prach.ce.level.0.enable", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_2_configuration_index, { "PRACH CE level #2 Configuration index", "nfapi.prach.ce.level.0.configuration.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_2_frequency_offset, { "PRACH CE level #2 Frequency offset", "nfapi.prach.ce.level.0.frequency_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_2_number_of_repetitions_per_attempt, { "PRACH CE level #2 Number of repetitions per attempt", "nfapi.prach.ce.level.0.number.of.repetitions.per_attempt", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_2_starting_subframe_periodicity, { "CE level #2 Starting subframe periodicity", "nfapi.prach.ce.level.0.starting.subframe_periodicity", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_2_hopping_enabled, { "PRACH CE level #2 Hopping Enable", "nfapi.prach.ce.level.0.hopping_enable", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_2_hopping_offset, { "PRACH CE level #2 Hopping Offset", "nfapi.prach.ce.level.0.hopping.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_3_enable, { "PRACH CE level #3 Enable", "nfapi.prach.ce.level.0.enable", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_3_configuration_index, { "PRACH CE level #3 Configuration index", "nfapi.prach.ce.level.0.configuration.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_3_frequency_offset, { "PRACH CE level #3 Frequency offset", "nfapi.prach.ce.level.0.frequency_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_3_number_of_repetitions_per_attempt, { "PRACH CE level #3 Number of repetitions per attempt", "nfapi.prach.ce.level.0.number.of.repetitions.per_attempt", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_3_starting_subframe_periodicity, { "CE level #3 Starting subframe periodicity", "nfapi.prach.ce.level.0.starting.subframe_periodicity", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_3_hopping_enabled, { "PRACH CE level #3 Hopping Enable", "nfapi.prach.ce.level.0.hopping_enable", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_ce_level_3_hopping_offset, { "PRACH CE level #3 Hopping Offset", "nfapi.prach.ce.level.0.hopping.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pucch_internal_ul_hopping_config_common_mode_a, { "PUCCH Interval-ULHoppingConfigCommonModeA", "nfapi.pucch.interval.ulhopping.config.common.mode.a", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pucch_internal_ul_hopping_config_common_mode_b, { "PUCCH Interval-ULHoppingConfigCommonModeB", "nfapi.pucch.interval.ulhopping.config.common.mode.b", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_data_report_mode, { "Data Report Mode", "nfapi.data.report.mode", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sfnsf, { "SFN/SF", "nfapi.sfn.sf", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_max_up_pts, { "Max UpPTS frames", "nfapi.max.uppts.frame", FT_BOOLEAN, 8, TFS(&enabled_disabled_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_acknack_srs_simultaneous_transmission, { "SRS AckNack Simultaneous transmission", "nfapi.srs.acknack.simult.tx", FT_BOOLEAN, 8, TFS(&srs_simult_tx_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_address, { "PNF address", "nfapi.p7.pnf.address", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_address_ipv4, { "PNF IPV4", "nfapi.pnf.address.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_address_ipv6, { "PNF IPV6", "nfapi.pnf.address.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_vnf_address, { "VNF address", "nfapi.vnf.address", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_vnf_address_ipv4, { "VNF IPV4 Address", "nfapi.vnf.address.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_vnf_address_ipv6, { "VNF IPV6 Address", "nfapi.vnf.address.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_port, { "PNF PORT value", "nfapi.config.pnf.port.value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_vnf_port, { "VNF PORT value", "nfapi.config.vnf.port.value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rf_bands, { "RF Bands", "nfapi.rf.bands", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rf_bands_count,	{ "Number of RF Bands", "nfapi.rf.bands.count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rf_bands_value, { "Band value", "nfapi.rf.bands.value",	FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_param_request, { "PNF Param Request", "nfapi.pnf.param.request", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_param_response, { "PNF Param Response", "nfapi.pnf.param.response",	FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_config_request,	{ "PNF Config Request", "nfapi.pnf.config.request",	FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_config_response, { "PNF Config Response", "nfapi.pnf.config.response", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_start_request, { "PNF Start Request", "nfapi.pnf.start.request", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_start_response, { "PNF Start Response", "nfapi.pnf.start.response", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_start_request, { "PNF Start Request", "nfapi.start.request", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_start_response, { "PNF Start Response", "nfapi.start.response", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_param_general, { "PNF Param General ", "nfapi.pnf.param.general", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sync_mode, { "Sync Mode", "nfapi.sync.mode", FT_UINT8, BASE_DEC, VALS(nfapi_sync_mode_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_location_mode, { "Location Mode", "nfapi.location.mode", FT_UINT8, BASE_DEC, VALS(location_mode_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_location_coordinates_length, { "Location Coordinates Length", "nfapi.location.coordinates.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_location_coordinates, { "Location Coordinates", "nfapi.location.coordinates", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdu, { "PDU", "nfapi.pdu", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_timing, { "DL config Timing", "nfapi.dl.config.timing", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tx_timing, { "Tx Timing", "nfapi.general.tx.timing", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_timing, { "UL Config Timing", "nfapi.ul.config.timing", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_hi_dci0_timing, { "HI DCi0 Timing", "nfapi.hi.dci0.timing", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_number_phys, { "Maximum number of Phys", "nfapi.maximum.number.phys", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_total_bandwidth, { "Maximum Total Bandwidth", "nfapi.maximum.total.bandwidth", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_total_number_dl_layers,	{ "Maximum Total Number DL Layers", "nfapi.maximum.total.number.dl.layers", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_total_number_ul_layers,	{ "Maximum Total Number UL Layers", "nfapi.maximum.total.number.ul.layers",	FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_shared_bands, { "Shared bands", "nfapi.shared.bands", FT_BOOLEAN, 8, TFS(&true_false_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_shared_pa, { "Shared pa", "nfapi.shared.pa", FT_BOOLEAN, 8, TFS(&true_false_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_total_power, { "Maximum total power", "nfapi.maximum.total.power", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_oui, { "OUI", "nfapi.oui", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_phy, { "PNF Phy", "nfapi.pnf.phy", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_phy_number_phy, { "PNF Phy Number of Phy", "nfapi.pnf.phy.number.phy", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_phy_config_index, { "PNF Phy Config Index", "nfapi.pnf.phy.config.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_rf,	{ "PNF Phy RF", "nfapi.pnf.rf",	FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_rfs, { "Number of RFs", "nfapi.pnf.rf.number.rf",	FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phy_rf_config_info,	{ "Phy RF Config Info", "nfapi.phy.rf.config.info",	FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phy_rf_config_info_phy_id, { "Phy ID", "nfapi.pnf.phy.rf.config.phy.id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phy_rf_config_info_band, { "RF Band", "nfapi.pnf.phy.rf.config.phy.id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_phy_rf_config, { "PNF Phy RF Config", "nfapi.pnf.phy.rf.config", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_phy_rf_config_number_phy_rf_config_info, { "Number of RF Config Info(s)", "nfapi.pnf.phy.rf.config.number.phy.rf.config.info", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_phy_rf_config_array_phy_rf_config_info,	{ "PNF Phy RF Config array phy rf config info ", "nfapi.pnf.phy.rf.config.array.phy.rf.config.info", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rf_config_index, { "RF Config Index", "nfapi.rf_config_index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_rf_exclusions, { "Number of RF exclusions", "nfapi.hf_nfapi_number_of_rf_exclusions",	FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_3gpp_release_supported,	{ "Maximum 3gpp Release Supported", "nfapi.maximum_3gpp_release_supported",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_downlink_channel_bandwidth_supported, { "Maximum Channel Downlink Bandwidth Supported", "nfapi.downlink_channel_bandwidth_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_uplink_channel_bandwidth_supported, { "Maximum Channel Uplink Bandwidth Supported", "nfapi.uplink_channel_bandwidth_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_dl_layers_supported, { "Number of DL Layers Supported", "nfapi.number_of_dl_layer_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_ul_layers_supported, { "Number of UL Layers Supported", "nfapi.number_of_ul_layer_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_nmm_modes_supported, { "NMM modes supported", "nfapi.nmm_modes_supported", FT_UINT8, BASE_DEC, VALS(nmm_modes_supported_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_band, { "Band", "nfapi.band", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_transmit_power, { "Maximum transmit power", "nfapi.maximum_transmit_power", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_earfcn, { "EARFCN", "nfapi.earfcn", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_rf_bands, { "Number of RF Bands", "nfapi.num.rf_bands", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_nmm_uplink_rssi_supported, { "NMM Uplink RSSI supported", "nfapi.nmm.uplink.rssi.supported", FT_UINT16, BASE_DEC, VALS(ul_rssi_supported_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_minimum_transmit_power, { "Minimum transmit power", "nfapi.minimum_transmit_power", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_antennas_suppported, { "Number of Supported Antennas", "nfapi.number_of_antennas_suppported", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_minimum_downlink_frequency, { "Minimum downlink frequency", "nfapi.minimum_downlink_frequency", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_downlink_frequency, { "Maximum downlink frequency", "nfapi.maximum_downlink_frequency", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_minimum_uplink_frequency, { "Minimum uplink frequency", "nfapi.minimum_downlink_frequency", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_maximum_uplink_frequency, { "Maximum uplink frequency", "nfapi.maximum_downlink_frequency", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transmission_mode7_supported, { "Transmission Mode 7 Supported", "nfapi.pnf.phy_rel10.tx_mode7_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_transmission_mode8_supported, { "Transmission Mode 8 Supported", "nfapi.pnf.phy_rel10.tx_mode8_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_two_antennas_ports_for_pucch, { "Two antennas ports for PUCCH", "nfapi.pnf.phy_rel10.two_antennas_ports_for_pucch", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_transmission_mode_9_supported, { "Transmission Mode 9 Supported", "nfapi.pnf.phy_rel10.tx_mode9_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_simultaneous_pucch_pusch, { "Simultaneous PUCCH PUSCH", "nfapi.pnf.simultaneous_pucch_pusch", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_for_layer_tx_with_tm3_and_tm4, { "Four layer Tx with TM3 and TM4", "nfapi.pnf.phy_rel10.layer_tx_with_tm3_and_tm4", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_epdcch_supported, { "ePDCCH supported", "nfapi.pnf.phy_rel11.epdcch_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_multi_ack_csi_reporting, { "Multi ACK CSI reporting", "nfapi.pnf.phy_rel11.mutli_ack_csi_reporting", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_pucch_tx_diversity_with_channel_selection, { "PUCCH Tx diversity with channel selection", "nfapi.pnf.phy_rel11.tx_div_with_channel_selection", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_ul_comp_supported, { "UL CoMP supported", "nfapi.pnf.phy_rel11.ul_comp_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_transmission_mode_5_supported, { "Transmission mode 5 supported", "nfapi.pnf.phy_rel11.tx_mode5_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_subframe_set, { "CSI subframe set", "nfapi.pnf.phy_rel12.csi_subframe_set", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_enhanced_4tx_codebook, { "Enhanced 4TX codebook", "nfapi.pnf.phy_rel12.exhanced_t4x_codebook", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_drs_supported, { "DRS supported", "nfapi.pnf.phy_rel12.drs_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_ul_64qam_supported, { "UL 64QAM supported", "nfapi.pnf.phy_rel12.ul_64qam_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_transmission_mode_10_supported, { "Transmission mode 10 supported", "nfapi.pnf.phy_rel12.tx_mode10_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hi_nfapi_alternative_tbs_indices, { "Alternative TBS indices", "nfapi.pnf.phy_rel12.alternative_tbs_indices", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pucch_format_4_supported, { "PUCCH format 4 supported", "nfapi.pnf.phy_rel13.pucch_format4_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pucch_format_5_supported, { "PUCCH format 5 supported", "nfapi.pnf.phy_rel13.pucch_format5_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_more_than_5_ca_supported, { "More than 5 CA support", "nfapi.pnf.phy_rel13.mode_than_5_ca_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_laa_supported, { "LAA supported", "nfapi.pnf.phy_rel13.laa_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_laa_ending_in_dwpts_supported, { "LAA ending in DwPTS supported", "nfapi.pnf.phy_rel13.laa_ending_in_dwpts_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_laa_starting_in_second_slot_supported, { "LAA starting in second slot Supported", "nfapi.pnf.phy_rel13.laa_starting_in_second_slot_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_beamforming_supported, { "Beamforming Supported", "nfapi.pnf.phy_rel13.beamingforming_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_enhancements_supported, { "CSI-RS enhancements supported", "nfapi.pnf.phy_rel13.csi_rs_enchancements_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_drms_enhancements_supported, { "DMRS enhancements supported", "nfapi.pnf.phy_rel13.drms_enhancements_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_enhancements_supported, { "SRS enhancements supported", "nfapi.pnf.phy_rel13.srs_enhancements_supported", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sfn_sf, { "SFN_SF", "nfapi.sfn_sf", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_request_body, { "DL Config Request body", "nfapi.dl.config.request.body", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_pdcch_ofdm_symbols, { "Number of PDCCH OFDM Symbols", "nfapi.number_pdcch_ofdm_symbols", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_dci, { "Number of DCI", "nfapi.number_dci", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_pdus, { "Number of PDUs", "nfapi.number_pdu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_harqs, { "Number of HARQs", "nfapi.number_harqs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_crcs, { "Number of CRCs", "nfapi.number_crcs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_srs, { "Number of SRs", "nfapi.number_srs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_cqi, { "Number of CQIs", "nfapi.number_cqi", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_preambles, { "Number of Preambles", "nfapi.number_preambles", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_srss, { "Number of SRSs", "nfapi.number_srss", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_lbt_dl_req_pdu_type, { "LBT DL Request PDU Type", "nfapi.number_srss", FT_UINT16, BASE_DEC, VALS(nfapi_lbt_dl_req_pdu_type), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_lbt_dl_ind_pdu_type, { "LBT DL Indication PDU Type", "nfapi.number_srss", FT_UINT16, BASE_DEC, VALS(nfapi_lbt_dl_ind_pdu_type), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_pdsch_rnti, { "Number of PDSCH RNTI", "nfapi.number_pdsch_rnti", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transmission_power_pcfich, { "Transmission Power PCFICH", "nfapi.transmission_power_pcfich", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_request_pdu_list,	{ "DL Config Request body", "nfapi.dl.config.request.pdu_list",	FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_request_pdu_list,	{ "UL Config Request body", "nfapi.ul.config.request.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_hi_dci0_request_pdu_list, { "HI DCI0 Request body", "nfapi.hi.dci0.config.request.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tx_request_pdu_list, { "Tx Request body", "nfapi.tx.request.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rx_indication_pdu_list, { "Rx Indication body", "nfapi.rx.indication.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_indication_pdu_list, { "Harq Indication body", "nfapi.harq.indication.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_crc_indication_pdu_list, { "CRC Indication body", "nfapi.crc.indication.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sr_indication_pdu_list, { "SR Indication body", "nfapi.sr.indication.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cqi_indication_pdu_list, { "CQI Indication body", "nfapi.cqi.indication.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_preamble_indication_pdu_list, { "Preamble Indication body", "nfapi.preamble.indication.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_indication_pdu_list, { "SRS Indication body", "nfapi.srs.indication.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_lbt_dl_config_pdu_list, { "LBT DL Config Request body", "nfapi.lbt.dl.request.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_lbt_dl_indication_pdu_list, { "LBT DL Indicatoin body", "nfapi.lbt.dl.indication.pdu_list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_pdu_type, { "PDU Type", "nfapi.pdu.type",	FT_UINT8, BASE_DEC, VALS(nfapi_dl_config_pdu_type_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdu_size, { "PDU size", "nfapi.pdu.size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_instance_length, { "Instance length", "nfapi.instance.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_dlsch_pdu_rel8, { "DL CONFIG DLSCH PDU REL8", "nfapi.dl.config.dlsch.pdu.rel8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_length, { "PDU length", "nfapi.pdu.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdu_index, { "PDU Index", "nfapi.pdu.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rnti, { "RNTI", "nfapi.rnti", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_resource_allocation_type, { "Resource Allocation Type", "nfapi.resource.allocation.type", FT_UINT8, BASE_DEC, VALS(resource_allocation_type_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_virtual_resource_block_assignment_flag, { "Virtual resource block assignment flag", "nfapi.resource.block.assignment.flag", FT_UINT8, BASE_DEC, VALS(local_distributed_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_resource_block_coding, { "Resource block coding", "nfapi.resource.block.coding", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_modulation, { "Modulation", "nfapi.modulation", FT_UINT8, BASE_DEC, VALS(modulation_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_redundancy_version, { "Redundancy version", "nfapi.redundancy.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transport_blocks, { "Transport blocks", "nfapi.transport.blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transport_block_to_codeword_swap_flag, { "Transport block to codeword swap flag", "nfapi.transport.block.to.codeword.swap.flag", FT_UINT8, BASE_DEC, VALS(transport_block_to_codeword_swap_flag_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transmission_scheme, { "Transmission scheme", "nfapi.transmission.scheme", FT_UINT8, BASE_DEC, VALS(transmission_scheme_vals), 0x0, "The MIMO mode used in the PDU", HFILL } },
+-		{ &hf_nfapi_ul_transmission_scheme, { "Transmission scheme", "nfapi.transmission.scheme", FT_UINT8, BASE_DEC, VALS(ul_transmission_scheme_vals), 0x0, "The MIMO mode used in the PDU", HFILL } },
+-		{ &hf_nfapi_number_of_layers, { "Number of layers", "nfapi.number.of.layers", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_subbands, { "Number of subbands", "nfapi.number.of.subbands", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_codebook_index, { "Codebook index", "nfapi.number.of.codebook.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ue_category_capacity, { "UE category capacity", "nfapi.ue.category.capacity", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pa, { "P-A", "nfapi.pa", FT_UINT8, BASE_DEC, VALS(pa_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_delta_power_offset_index, { "Delta Power offset index", "nfapi.delta.power.offset.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_nprb, { "Nprb", "nfapi.nprb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transmission_mode, { "Transmission Mode", "nfapi.transmission_nprb", FT_UINT8, BASE_DEC, VALS(transmission_mode_vals), 0x0, "Transmission mode associated with the UE", HFILL } },
+-		{ &hf_nfapi_prnti, { "P-RNTI", "nfapi.prnti", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mcs, { "MCS", "nfapi.mcs", FT_UINT8, BASE_DEC, VALS(pch_modulation_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_transport_blocks, { "Number of transport blocks", "nfapi.number_of_transport_blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ue_mode, { "UE Mode", "nfapi.ue.mode", FT_UINT8, BASE_DEC, VALS(ue_mode_vals), 0x0, NULL, HFILL } },
+-		{ &hf_prs_bandwidth, { "PRS bandwidth", "nfapi.prs.bandwidth", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_prs_cyclic_prefix_type, { "PRS cyclic prefix type", "nfapi.prs.cyclic.prefix.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_prs_muting, { "PRS muting", "nfapi.prs.muting", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_num_bf_prb_per_subband, { "Num of BF PRB per Subband", "nfapi.num.bf.prb.per.subband", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_num_bf_vector, { "Num of BF Vector", "nfapi.num.bf.vector", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_resource_config, { "CSI-RS resource config", "nfapi.csi.rs.resource.config", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_bf_vector_subband_index, { "BF Subband Index", "nfapi.num.bf.vector.subband.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_bf_vector_num_antennas, { "BF Num of Antennas", "nfapi.num.bf.vector.bf.value", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_bf_vector_bf_value, { "BF Value per Antenna", "nfapi.num.bf.vector.bf.value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_dlsch_pdu_rel9, { "DL CONFIG DLSCH PDU REL9", "nfapi.dl.config.dlsch.pdu.rel9", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_nscid, { "NSC id", "nfapi.nscid", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_dlsch_pdu_rel10, { "DL CONFIG DLSCH PDU REL10", "nfapi.dl.config.dlsch.pdu.rel10", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_flag, { "CSI RS Flag", "nfapi.csi.rs.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_subbands, { "Subbands", "nfapi.subbands", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_bf_vectors, { "BF Vectors", "nfapi.bf.vectors", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_bf_vector_antennas, { "Antennas", "nfapi.antennas", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_resource_config_r10, { "CSI RS resource config R10", "nfapi.csi.rs.resource_config_r10", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_zero_tx_power_resource_config_bitmap_r10, { "CSI-RS Number of NZP configuration", "nfapi.csi.rs.num.of.nzp.configurations",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_number_if_nzp_configurations, { "CSI RS zero Tx Power Resource config bitmap R10", "nfapi.csi.rs.zero.tx.power.resource.config.bitmap.r10", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_resource_configs, { "CSR/RS Resource Configs", "nfapi.csi.rs.resource.configs", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdsch_start, { "PDSCH_start", "nfapi.pdsch.start", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_drms_config_flag, { "DMRS Config flag", "nfapi.drms.config.flag", FT_UINT8, BASE_DEC, VALS(not_used_enabled_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_drms_scrambling, { "DMRS Scrambling", "nfapi.drms.scrambling", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_config_flag, { "CSI Config flag", "nfapi.csi.config.flag", FT_UINT8, BASE_DEC, VALS(not_used_enabled_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_scrambling, { "CSI Scrambling", "nfapi.csi.scrambling", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdsch_re_mapping_flag, { "PDSCH RE mapping flag", "nfapi.pdsch.remapping.flag", FT_UINT8, BASE_DEC, VALS(not_used_enabled_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdsch_re_mapping_antenna_ports, { "PDSCH RE mapping antenna ports", "nfapi.pdsch.remapping.antenna.ports", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdsch_re_mapping_freq_shift, { "PDSCH RE mapping freq shift", "nfapi.pdsch.remapping.freq.shift", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_alt_cqi_table_r12, { "altCQI-Table-r12", "nfapi.alt.cqi.table.r12", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_max_layers, { "MaxLayers", "nfapi.max.layers", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_dl_harq, { "N_DL_HARQ", "nfapi.n.dl.harq", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dwpts_symbols, { "DwPTS Symbols", "nfapi.dwpts.symbols", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_initial_lbt_sf, { "Initial LBT SF", "nfapi.initial.lbt.sf", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ue_type, { "UE Type", "nfapi.ue.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdsch_payload_type, { "PDSCH Payload Type", "nfapi.pdsch.payload.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_initial_transmission_sf, { "Initial transmission SF (io) ", "nfapi.init.tx.sf.io", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_req13_drms_table_flag, { "Rel-13-DMRS-tabe flag", "nfapi.r13.drms.table.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_resource_index, { "CSI-RS resource index", "nfapi.csi.rs.resource.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_class, { "Class", "nfapi.csi.rs.class", FT_UINT8, BASE_DEC, VALS(csi_rs_class_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cdm_type, { "CDM Type", "nfapi.cdm.type", FT_UINT8, BASE_DEC, VALS(csi_rs_cdm_type_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_bf_vector, { "BF Vector", "nfapi.bf.vector", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_edpcch_prb_index, { "EPDCCH PRB index", "nfapi.edpcch.prb.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_epdcch_resource_assignment_flag, { "EPDCCH Resource assignment flag", "nfapi.epdcch.resource.assignment.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_epdcch_id, { "EPDCCH ID", "nfapi.epdcch.id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_epdcch_start_symbol, { "EPDCCH Start Symbol", "nfapi.epdcch.start.symbol", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_epdcch_num_prb, { "EPDCCH NumPRB", "nfapi.epdcch.num.prb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_epdcch_prbs, { "EPDCCH PRBs", "nfapi.epdcch.prbs", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_precoding_value, { "Precoding value", "nfapi.precoding.value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mpdcch_narrowband, { "MPDCCH Narrowband", "nfapi.mpdcch.narrowband", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_prb_pairs, { "Number of PRB pairs", "nfapi.number.prb.pairs", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_resource_block_assignment, { "Resource Block Assignment", "nfapi.resource.block.assignement", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_start_symbol, { "Start symbol", "nfapi.start.symbol", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ecce_index, { "ECCE index", "nfapi.ecce.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ce_mode, { "Rel-13-DMRS-tabe flag", "nfapi.r13.drms.table.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_drms_scrabmling_init, { "DMRS scrambling init", "nfapi.drms.scrambling.init", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdsch_reception_levels, { "PDSCH repetition levels", "nfapi.pdsch.repetition.levels", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_new_data_indicator, { "New data indicator", "nfapi.new.data.indicator", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tpmi_length, { "TPMI length", "nfapi.tpmi.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pmi_flag, { "PMI flag", "nfapi.pmi.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_resource_offset, { "HARQ resource offset", "nfapi.harq.resource.offset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dci_subframe_repetition_number, { "DCI subframe repetition number", "nfapi.dci.subframe.repetition.number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_downlink_assignment_index_length, { "Downlink assignment index Length", "nfapi.dl.assignement.index.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_starting_ce_level, { "Starting CE Level", "nfapi.starting.ce.level", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_antenna_ports_and_scrambling_identity_flag, { "Antenna ports and scrambling identity flag", "nfapi.antenna.ports.and.scrambling.identity.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_antenna_ports_and_scrambling_identity, { "Antenna ports and scrambling identity", "nfapi.antenna.ports.and.scrambling.identit", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_paging_direct_indication_differentiation_flag, { "Paging/Direct indication differentiation flag", "nfapi.paging.direct.indictation.differentiation.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_direct_indication, { "Direct indication", "nfapi.direct.indication", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_tx_antenna_ports, { "Number of TX Antenna ports", "nfapi.num.of.tx.antenna.ports.", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_precoding, { "Precoding", "nfapi.precodiing", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_bch_pdu_rel8, { "DL CONFIG BCH PDU Rel8", "nfapi.dl.config.bch.pdu.rel8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_value_float, { "Value", "nfapi.value.float", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transmission_power, { "Transmission Power", "nfapi.transmission_power", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_mch_pdu_rel8, { "DL CONFIG MCH PDU Rel8", "nfapi.dl.config.mch.pdu.rel8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mbsfn_area_id, { "MBSFN Area id", "nfapi.mbsfn.area.id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_pch_pdu_rel8, { "DL CONFIG MCH PDU Rel8", "nfapi.dl.config.mch.pdu.rel8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_dci_dl_pdu_rel8, { "DL CONFIG DCI DL PDU Rel8", "nfapi.dl.config.mch.pdu.rel8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dci_format, { "DCI format", "nfapi.dci.format", FT_UINT8, BASE_DEC, VALS(dci_format_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cce_idx, { "CCE index", "nfapi.cce.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_aggregation_level, { "Aggregation level", "nfapi.aggregation.level", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mcs_1, { "MCS_1", "nfapi.mcs_1", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mcs_2, { "MCS_2", "nfapi.mcs_2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_redundancy_version_1, { "Redundancy version_1", "nfapi.redundancy.version.1", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_redundancy_version_2, { "Redundancy version_2", "nfapi.redundancy.version.2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_new_data_indicator_1, { "New data indicator_1", "nfapi.new.data.indicator.1", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_new_data_indicator_2 ,{ "New data indicator_2", "nfapi.new.data.indicator.2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_process, { "HARQ process", "nfapi.harq.process", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tpmi, { "TPMI", "nfapi.tpmi", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pmi, { "PMI", "nfapi.pmi", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_precoding_information, { "Precoding information", "nfapi.precoding.information", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tpc, { "TPC", "nfapi.tpc", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_downlink_assignment_index, { "Downlink assignment index", "nfapi.downlink.assignment.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ngap, { "Ngap", "nfapi.ngap", FT_UINT8, BASE_DEC, VALS(ngap_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transport_block_size_index, { "Transport block size index", "nfapi.transport.block.size.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_downlink_power_offset, { "Downlink power offset", "nfapi.downlink.power.offset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_allocate_prach_flag, { "Allocation PRACH flag", "nfapi.allocation.prach.flag", FT_UINT8, BASE_DEC, VALS(true_false_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_preamble_index, { "Preamble index", "nfapi.preamable.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prach_mask_index, { "PRACH mask index", "nfapi.prach.mask.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rnti_type, { "RNTI type", "nfapi.rnti.type", FT_UINT8, BASE_DEC, VALS(rnti_type_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_dci_dl_pdu_rel9, { "DL CONFIG DCI DL PDU Rel9", "nfapi.dl.config.mch.pdu.rel9", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mcch_flag, { "MCCH flag", "nfapi.mcch.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mcch_change_notification, { "MCCH change notification", "nfapi.mcch.change.notification", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_scrambling_identity, { "Scrambling identity", "nfapi.scrambling.identity", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_dci_dl_pdu_rel10, { "DL CONFIG DCI DL PDU Rel10", "nfapi.dl.config.mch.pdu.rel10", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cross_carrier_scheduling_flag, { "Cross Carrier scheduling flag", "nfapi.cross.carrier.scheduling.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_carrier_indicator, { "Carrier Indicator", "nfapi.carrier.indicator", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_flag, { "SRS flag", "nfapi.srs.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_request, { "SRS request", "nfapi.srs.request", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_antenna_ports_scrambling_and_layers, { "Antenna ports scrambling and layers", "nfapi.antenna.ports.scrambling.and.layers", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_total_dci_length_including_padding, { "Total DCI length including padding", "nfapi.total.dci.length.including.padding", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_dl_rb, { "N_DL_RB", "nfapi.n.dl.rb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_ul_rb, { "N_UL_RB", "nfapi.n.dl.rb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_ack_resource_offset, { "HARQ-ACK resource offset", "nfapi.harq.ack.resource.offset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdsch_re_mapping_and_quasi_co_location_indicator, { "PDSCH RE Mapping and Quasi-Co-Location Indicator", "nfapi.pdsch.re.mapping", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_primary_cell_type, { "Primary cell type", "nfapi.primary.cell.type", FT_UINT8, BASE_DEC, VALS(primary_cells_type_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_dl_configuration_flag, { "UL/DL configuration flag", "nfapi.ul.dl.configuration.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_ul_dl_configurations, { "Number of UL/DL configurations", "nfapi.number.ul.dl.configurations", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_dl_configuration_index, { "UL/DL configuration indication", "nfapi.ul.dl.configuration.indication", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_laa_end_partial_sf_flag, { "LAA end partial SF flag", "nfapi.laa.end.partial.sf.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_laa_end_partial_sf_configuration, { "LAA end partial SF configuration", "nfapi.laa.end.partial.sf.configuration", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_codebooksize_determination_r13, { "Codebook Size Determination R13", "nfapi.codebook.size.determination.r13", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rel13_drms_table_flag, { "Rel-13-DMRS-tabe flag", "nfapi.drms.table.flag.r13", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pscch_resource, { "PSCCH Resource", "nfapi.pscch.resource", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_time_resource_pattern, { "Time resource pattern", "nfapi.time.resource.pattern", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mpdcch_transmission_type, { "MPDCCH transmission type", "nfapi.mpdcch.transmission.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_drms_scrambling_init, { "DMRS scrambling init", "nfapi.drms.scrambling.init", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pusch_repetition_levels, { "PUSCH repetition levels", "nfapi.pusch.repetition.levels", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_frequency_hopping_flag, { "Frequency hopping flag", "nfapi.frequency.hopping.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_request, { "CSI request", "nfapi.csi.request", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dai_presence_flag, { "DAI presence flag", "nfapi.dia.presence.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_total_dci_length_include_padding, { "Total DCI length including padding", "nfapi.total.dci.length.including.padding", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_prs_pdu_rel9, { "DL CONFIG PRS PDU Rel9", "nfapi.dl.config.prs.pdu.rel9", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prs_bandwidth, { "PRS Bandwidth", "nfapi.prs.bandwidth", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_prs_cyclic_prefix_type, { "PRS cyclic prefix type", "nfapi.prs.cyclic.prefix.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_config_csi_rs_pdu_rel10, { "DL CONFIG CSI RS PDU Rel10", "nfapi.dl.config.csi.rs.pdu.rel10", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_rs_antenna_port_count_r10, { "Antenna port count r10", "nfapi.csi.rs.antenna.port.count.r10", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_request_body, { "UL Config Request body", "nfapi.ul.config.request.body", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_pdu_type,	{ "UL Config PDU Type", "nfapi.ul.config.pdu.type", FT_UINT8, BASE_DEC, VALS(nfapi_ul_config_pdu_type_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rach_prach_frequency_resources,	{ "RACH PRACH Frequency resources", "nfapi.rach.prach.frequency.resources",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_present, { "SRS present", "nfapi.srs.present", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_harq_buffer_pdu, { "HARQ Buffer PDU", "nfapi.ul.config.harq.buffer.pdu", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_ue_information_rel8, { "UE Information Rel 8", "nfapi.ul.config.ue.information.pdu.rel8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_handle,	{ "Handle", "nfapi.handle",	FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_sr_information_pdu_rel8, { "SR Information Rel 8", "nfapi.ul.config.sr.information.pdu.rel8",	FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pucch_index, { "PUCCH Index", "nfapi.pucch.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_size, { "Size", "nfapi.size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_resource_block_start, { "Resource block start", "nfapi.resource.block.start", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_resource_blocks, { "Number of resource blocks", "nfapi.resource.blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cyclic_shift_2_for_drms, { "Cyclic Shift 2 for DRMS", "nfapi.cyclic.shift.2.for.drms", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_frequency_hopping_enabled_flag, { "Frequency hopping enabled flag", "nfapi.frequency.hopping.enabled.flag", FT_UINT8, BASE_DEC, VALS(hopping_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_frequency_hopping_bits, { "Frequency hopping bits", "nfapi.frequency.hopping.bits", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_new_data_indication, { "New Data inidication", "nfapi.new.data.indication", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_process_number, { "HARQ Process number", "nfapi.harq.process.number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_tx_mode, { "UL Tx Mode", "nfapi.ul.tx.mode", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_current_tx_nb, { "Current Tx nb", "nfapi.current.tx.nb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_srs, { "N SRS", "nfapi.n.srs", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_disable_sequence_hopping_flag, { "Disable seqeunce hopping flag", "nfapi.disable.sequence.hopping.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_virtual_cell_id_enabled_flag, { "Virtual cell ID enabled flag", "nfapi.virtual.cell.id.enabled.flag", FT_UINT8, BASE_DEC, VALS(not_used_enabled_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_npusch_identity, { "nPUSCH Identity", "nfapi.npusch.identity", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ndrms_csh_identity, { "nDMRS-CSH Identity", "nfapi.ndrms.csh.identity", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_total_number_of_repetitions, { "Total Number of repetitions", "nfapi.total.number.of.repetitions", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_repetition_number, { "Repetition Number", "nfapi.repetition.number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_initial_sf_io, { "Initial transmission SF (io) ", "nfapi.initial.sf.io", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_empty_symbols_due_to_retunning, { "Empy symbols due to re-tunning", "nfapi.empty.symbols.due.to.retunning", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_cqi_ri_pmi_size_2, { "DL CQI/PMI/RI size 2", "nfapi.dl.cqi.ri.pmi.size.2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_size_2, { "HARQ Size 2", "nfapi.harq.size2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_delta_offset_harq_2, { "Delta Offset HARQ 2", "nfapi.delta.offset.harq.2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_starting_prb, { "Starting PRB", "nfapi.starting.prb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_antenna_port, { "Antenna Port", "nfapi.antenna.port", FT_UINT8, BASE_DEC, VALS(antenna_ports_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_combs, { "Number of Combs", "nfapi.num.of.combs", FT_UINT8, BASE_DEC, VALS(combs_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_npucch_identity, { "nPUCCH Identity", "nfapi.npucch.identity", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_empty_symbols, { "Empty symbols", "nfapi.empty.symbols", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_csi_mode, { "CSI_mode", "nfapi.csi.mode", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_cqi_pmi_size_2, { "DL CQI/PMI Size 2", "nfapi.dl.cqi.pmi.size.2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_statring_prb, { "Starting PRB", "nfapi.starting.prb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cdm_index, { "cdm_Index", "nfapi.cdm.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_nsrs, { "N srs", "nfapi.n.srs", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_num_ant_ports, { "Num_ant_ports", "nfapi.num.ant.port", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_pucch_2_0, { "n_PUCCH_2_0", "nfapi.n.pucch.2.0", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_pucch_2_1, { "n_PUCCH_2_1", "nfapi.n.pucch.2.1", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_pucch_2_2, { "n_PUCCH_2_2", "nfapi.n.pucch.2.2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_pucch_2_3, { "n_PUCCH_2_3", "nfapi.n.pucch.2.3", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_cqi_pmi_size_rank_1, { "DL CQI PMI size rank 1", "nfapi.dl.cqi.pmi.size.rank.1",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_cqi_pmi_size_rank_greater_1,	{ "DL CQI PMI size rank greater 1", "nfapi.dl.cqi.pmi.size.rank.1",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ri_size, { "RI size", "nfapi.ri.size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_delta_offset_cqi, { "Delta offset cqi", "nfapi.delta.offset.cqi", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_delta_offset_ri, { "Delta offset ri", "nfapi.delta.offset.ri", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_size, { "HARQ size", "nfapi.harq_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_delta_offset_harq, { "Delta offset HARQ", "nfapi.delta.offset.harq", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ack_nack_mode, { "ACK NACK mode", "nfapi.ack.nack.mode", FT_UINT8, BASE_DEC, VALS(nfapi_ack_nack_mode_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_srs_initial, { "N srs initial", "nfapi.n.srs.initial", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_initial_number_of_resource_blocks, { "Initial number of resource blocks", "nfapi.initial.number.of.resource.blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_cqi_pmi_size, { "DL cqi pmi size", "nfapi.dl.cqi.pmi.size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_report_type, { "Report type", "nfapi.report.type", FT_BOOLEAN, 8, TFS(&nfapi_csi_report_type_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_cqi_ri_pmi_size,	{ "DL CQI RI PMI size", "nfapi.dl.cqi.ri.pmi.size",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_control_type, { "Control type", "nfapi.control.type", FT_BOOLEAN, 8, TFS(&nfapi_control_type_string_name), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_cc, { "Number of cc", "nfapi.number.of.cc",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_pucch_resource, { "Number of PUCCH Resource", "nfapi.number.of.pucch.resource", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pucch_index_p1, { "PUCCH Index P1", "nfapi.pucch.index.p1", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_pucch_1_0, { "N PUCCH 1 0", "nfapi.n.pucch.1.0", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_pucch_1_1, { "N PUCCH 1 1", "nfapi.n.pucch.1.1", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_pucch_1_2, { "N PUCCH 1 2", "nfapi.n.pucch.1.2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_n_pucch_1_3, { "N PUCCH 1 3", "nfapi.n.pucch.1.3", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_bandwidth, { "SRS Bandwidth", "nfapi.srs.bandwidth", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_frequency_domain_position, { "Frequency Domain position", "nfapi.frequency.domain.position", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_srs_hopping_bandwidth, { "SRS hopping bandwidth", "nfapi.srs.hopping.bandwidth", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_transmission_comb, { "Transmission comb", "nfapi.transmission.comb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_i_srs, { "I SRS", "nfapi.i.srs", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sounding_reference_cyclic_shift, { "Sounding reference cyclic shift", "nfapi.sounding.reference.cyclic.shift", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_antenna_ports, { "Antenna port(s)", "nfapi.antenna.port", FT_UINT8, BASE_DEC, VALS(nfapi_antenna_port_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_srs_pdu_rel10, { "SRS PDU Rel 10", "nfapi.srs.pdu.rel.10", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_srs_pdu_rel8, { "SRS PDU Rel 8", "nfapi.srs.pdu.rel.8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_harq_information_rel9_fdd, { "HARQ information Rel 9 FDD", "nfapi.harq.information.rel.9.fdd", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_harq_information_rel8_fdd, { "HARQ information Rel 8 FDD", "nfapi.harq.information.rel.8.fdd", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_harq_information_rel10_tdd, { "HARQ information Rel 10 TDD", "nfapi.harq.information.rel.10.tdd", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_sr_information_rel10, { "SR information Rel 10", "nfapi.sr.information.rel.10", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_sr_information_rel8, { "SR information Rel 8", "nfapi.sr.information.rel.8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_cqi_information_rel10, { "CQI information Rel 10", "nfapi.cqi.information.rel.10", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_cqi_information_rel8, { "CQI information Rel 8", "nfapi.cqi.information.rel.8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_initial_transmission_parameters_rel8, { "Initial transmission parameters Rel 8", "nfapi.initial.transmission.parameters.rel.8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_config_ulsch_harq_information_rel10, { "HARQ Information Rel 10", "nfapi.harq.information.rel.10", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdu_length, { "PDU length", "nfapi.pdu.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_num_segments, { "Num segments", "nfapi.num.segments", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_segment_length, { "Segment length", "nfapi.segment.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_segment_data, { "Segment data", "nfapi.segment.data", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_crc_indication_body, { "CRC Indication Body", "nfapi.crc_indication_body", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_crc_flag, { "CRC flag", "nfapi.crc.flag", FT_BOOLEAN, 8, TFS(&crc_flag_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_hi_pdus, { "Number of HI Pdu's", "nfapi.number_of_hi_pdus", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_dci_pdus, { "Number of DCI Pdu's", "nfapi.number_of_dci_pdus", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pdu_type, { "PDU Type", "nfapi.pdu_type",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_hi_value, { "HI Value", "nfapi.hi_value", FT_BOOLEAN, 8, TFS(&hi_value_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_i_phich, { "i phich", "nfapi.i_phich", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_flag_tb2, { "Flag TB2", "nfapi.flag_tb2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_hi_value_2, { "HI Value 2", "nfapi.hi_value_2", FT_BOOLEAN, BASE_NONE, TFS(&hi_value_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ue_tx_antenna_selection, { "UE Tx Antenna selection", "nfapi.ue_tx_antenna_selection", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cqi_csi_request, { "cqi csi request", "nfapi.cqi_csi_request", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_index, { "UL index", "nfapi.ul_index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_assignment_index, { "DL Assignment index", "nfapi.dl_assignment_index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tpc_bitmap, { "TPC bitmap", "nfapi.tpc_bitmap", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_antenna_ports, { "Number of antenna ports", "nfapi.number.of.antenna.ports", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_size_of_cqi_csi_feild, { "Size of cqi csi feild", "nfapi.size.of.cqi.csi.feild", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_new_data_indication_two, { "New data indicatipon 2", "nfapi.new.data.indication.two", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_resource_allocation_flag, { "Resource allocation flag", "nfapi.resource.allocation.flag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_node_sync, { "DL Node Sync", "nfapi.dl.node.sync", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_node_sync_t1, { "DL Node Sync t1", "nfapi.dl.node.sync.t1", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_node_sync_delta_sfn_sf, { "DL Node Sync Delta SFN SF", "nfapi.dl.node.sync.delta_sfn_sf", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_dl_cyclic_prefix_type, { "DL Cyclic Prefix type", "nfapi.dl.cyclic.prefix.type", FT_BOOLEAN, 8, TFS(&cyclic_prefix_type_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_cyclic_prefix_type, { "UL Cyclic Prefix type", "nfapi.ul.cyclic.prefix.type", FT_BOOLEAN, 8, TFS(&cyclic_prefix_type_strname), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_downlink_channel_bandwidth, { "Downlink Channel Bandwidth", "nfapi.dl.channel.bandwidth", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_uplink_channel_bandwidth, { "Uplink Channel Bandwidth", "nfapi.ul.channel_bandwidth", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_tx_antenna_ports, { "Tx Antenna Ports", "nfapi.tx.antenna.ports", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rx_antenna_ports, { "Tx Antenna Ports", "nfapi.rx.antenna.ports", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_node_sync, { "UL Node Sync", "nfapi.ul.node.sync", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_node_sync_t1, { "UL Node Sync t1", "nfapi.ul.node.sync.t1", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_node_sync_t2, { "UL Node Sync t2", "nfapi.ul.node.sync.t2", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_node_sync_t3, { "UL Node Sync t3", "nfapi.ul.node.sync.t3", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pb, { "P-B", "nfapi.pb.allocation", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_last_sfn_sf, { "Last SFN/SF", "nfapi.timing.info.last.sfn.sf", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_time_since_last_timing_info, { "Time since last Timing Info", "nfapi.timing.info.time.since.last.timing.info", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_dl_config_jitter, { "DL Config Jitter", "nfapi.timing.info.dl.config.jitter", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_tx_request_jitter, { "Tx Request Jitter", "nfapi.timing.info.tx.req.jitter", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_ul_config_jitter, { "UL Config Jitter", "nfapi.timing.info.ul.config.jitter", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_hi_dci0_jitter, { "HI_DCI0 Jitter", "nfapi.timing.info.hi.dci0.jitter", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_dl_config_latest_delay, { "DL Config Latest Delay", "nfapi.timing.info.dl.config.latest.delay", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_tx_request_latest_delay, { "Tx Request Latest Delay", "nfapi.timing.info.tx.request.latest.delay", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_ul_config_latest_delay, { "UL Config Latest Delay", "nfapi.timing.info.ul.config.latest.delay", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_hi_dci0_latest_delay, { "HI_DCI0 Latest Delay", "nfapi.timing.info.hi.dci0.latest.delay", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_dl_config_earliest_arrival, { "DL Config Earliest Arrival", "nfapi.timing.info.dl.config.earliest.arrival", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_tx_request_earliest_arrival, { "Tx Request Earliest Arrival", "nfapi.timing.info.tx.request.earliest.arrival", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_ul_config_earliest_arrival, { "UL Config Earliest Arrival", "nfapi.timing.info.ul.config.earliest.arrival", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_hi_dci0_earliest_arrival, { "HI_DCI0 Earliest Arrival", "nfapi.timing.info.hi.dci0.earliest.arrival", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pcfich_power_offset, { "PCFICH Power Offset", "nfapi.pcfich.power.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_window, { "NFAPI Timing window", "nfapi.timing.window", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_mode, { "Timing Info mode", "nfapi.timing.info.mode", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_info_period, { "Timing info period", "nfapi.timing.info.period", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_max_transmit_power, { "Max transmit power", "nfapi.max.transmit.power", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_uint8_tag, { "uint8 tag", "nfapi.uint8.tag", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_uint16_tag, { "uint16 tag", "nfapi.uint16.tag", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_mode, { "Mode", "nfapi.harq.mode", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_ack_nack,	{ "Number of ACK/NACK", "nfapi.uint16.tag",	FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_data_value_0,	{ "Value 0", "nfapi.harq.value.0",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_data_value_1,	{ "Value 1", "nfapi.harq.value.1",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_data_value_2,	{ "Value 2", "nfapi.harq.value.2",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_data_value_3,	{ "Value 3", "nfapi.harq.value.3",	FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_tb_1, { "HARQ TB1", "nfapi.harq.tb.", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_tb_2, { "HARQ TB2", "nfapi.harq.tb.2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_tb_n, { "HARQ TB_N", "nfapi.harq.tb.n", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_cqi, { "UL_CQI", "nfapi.ul.cqi", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_channel, { "Channel", "nfapi.channel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_data_offset, { "Data Offset", "nfapi.data.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },		
+-		{ &hf_nfapi_ri, { "RI", "nfapi.ri", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_ack_nack_data, { "HARQ Ack/Nack Data", "nfapi.harq.ack.nack.data", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_harq_data, { "HARQ TB Data", "nfapi.harq.tb.data", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_cc, { "CC", "nfapi.cc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rbs, { "RBs", "nfapi.rbs", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_antennas, { "Physical Antennas", "nfapi.physical.antennas", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_advance, { "Timing Advance", "nfapi.timing.advance", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timing_advance_r9, { "Timing Advance R9", "nfapi.timing.advance.r9", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_cc_reported, { "Number of CC reported", "nfapi.number.of.cc.reported", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_preamble, { "Preamble", "nfapi.preamble", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rach_resource_type, { "RACH resource type", "nfapi.rach.resource.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_doppler_estimation, { "Doppler estimation", "nfapi.doppler.estimation", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rb_start, { "RB Start", "nfapi.rb.start", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_snr, { "SNR", "nfapi.snr", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_up_pts_symbol, { "UpPTS Symbol", "nfapi.uppts.symbol", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_prb_per_subband, { "numPRBperSubband", "nfapi.num.prb.per.subband", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_antennas, { "numAntennas", "nfapi.num.antennas", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_subband_index, { "subbandIndex", "nfapi.subband.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_channel_coefficient, { "Channel", "nfapi.channel.coefficient", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_ul_rtoa, { "UL_RTOA", "nfapi.ul.rtoa", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_frequency_band_indicator, { "Frequency Band Indicator", "nfapi.frequency.band.indicator", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_measurement_period, { "Measurement Period", "nfapi.measurement.period", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_bandwidth, { "Bandwidth", "nfapi.bandwidth", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_timeout, { "Timeout", "nfapi.timeout", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_earfcns, { "Number of EARFCNs", "nfapi.number.of.earfcns", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_earfcn_list, { "EARFCN List", "nfapi.earfcn.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_uarfcn, { "UARFCN", "nfapi.uarfcn", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_uarfcns, { "Number of UARFCNs", "nfapi.number.of.uarfcn", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_uarfcn_list, { "UARFCN List", "nfapi.uarfcn.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_arfcn, { "ARFCN", "nfapi.arfcn", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_arfcn_direction, { "Direction", "nfapi.arfcn.direction", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_arfcns, { "Number of ARFCNs", "nfapi.number.of.arfcn", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_arfcn_list, { "ARFCN List", "nfapi.arfcn.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rssi, { "RSSI", "nfapi.rssi", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_rssi, { "Number of RSSI", "nfapi.number.of.rssi", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rssi_list, { "RSSI List", "nfapi.rssi.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pci, { "PCI", "nfapi.pci", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_measurement_bandwidth, { "Measurement Bandwidth", "nfapi.measurement.bandwidth", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_exhaustive_search, { "Exhaustive Search", "nfapi.exhaustive.search", FT_UINT8, BASE_DEC, VALS(exhustive_search_vals), 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_pci, { "Number of PCI", "nfapi.number.of.pci", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pci_list, { "PCI List", "nfapi.pci.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_psc, { "PSC", "nfapi.psc", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_psc, { "Number of PSC", "nfapi.number.of.psc", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_psc_list, { "PCS List", "nfapi.psc.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rsrp, { "RSRP", "nfapi.rsrp", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rsrq, { "RSRQ", "nfapi.rsrq", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_lte_cells_found, { "Number of LTE Cells Found", "nfapi.number.of.lte.cells.found", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_lte_cells_found_list, { "LTE Cells Found List", "nfapi.lte.cells.found.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rscp, { "RSCP", "nfapi.rscp", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_enco, { "EcNo", "nfapi.ecno", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_utran_cells_found, { "Number of UTRAN Cells Found", "nfapi.number.of.utran.cells.found", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_utran_cells_found_list, { "UTRAN Cells Found List", "nfapi.utran.cells.found.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_bsic, { "BSIC", "nfapi.bsic", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rxlev, { "RxLev", "nfapi.rxlev", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_rxqual, { "RxQual", "nfapi.rxqual", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sfn_offset, { "SFN Offset", "nfapi.sfn.offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_geran_cells_found, { "Number of GSM Cells Found", "nfapi.number.of.geran.cells.found", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_geran_cells_found_list, { "GERAN Cells Found List", "nfapi.geran.cells.found.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_tx_antenna, { "Number of Tx Antenna", "nfapi.number.of.tx.antenna", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mib_length, { "MIB Length", "nfapi.mib.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_mib, { "MIB", "nfapi.mib", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_phich_configuration, { "PHICH Configuration", "nfapi.phich.configuration", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_retry_count, { "retryCount", "nfapi.retry.count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sib1, { "SIB1", "nfapi.sib1", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_si_periodicity, { "SI Periodicity", "nfapi.si.periodicity", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_si_index, { "SI Index", "nfapi.si.index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_number_of_si_periodicity, { "Number of SI Periodicity", "nfapi.number.of.si.periodicity", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_si_periodicity_list, { "SI Periodicity List", "nfapi.si.periodicity.list", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_si_window_length, { "SI Window Length", "nfapi.si.window.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sib_type, { "SIB Type", "nfapi.sib.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sib_len, { "SIB Length", "nfapi.sib.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_sib, { "SIB", "nfapi.sib", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_si_len, { "SI Length", "nfapi.si.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_si, { "SI", "nfapi.si", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_search_state, { "State", "nfapi.state", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-		{ &hf_nfapi_pnf_broadcast_state, { "State", "nfapi.state", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+-
+-	};
+-
+-    /* Setup protocol subtree array */
+-    static gint *ett[] = {
+-        &ett_nfapi_message_tree,
+-		&ett_nfapi_p4_p5_message_header,
+-		&ett_nfapi_p7_message_header,
+-		&ett_nfapi_tlv_tree,
+-		&ett_nfapi_tl,
+-		&ett_nfapi_pnf_param_response,
+-		&ett_nfapi_pnf_phy_rf_config,
+-		&ett_nfapi_pnf_phy_rf_config_instance,
+-		&ett_nfapi_pnf_phy,
+-		&ett_nfapi_pnf_phy_rel10,
+-		&ett_nfapi_pnf_phy_rel11,
+-		&ett_nfapi_pnf_phy_rel12,
+-		&ett_nfapi_pnf_phy_rel13,
+-		&ett_nfapi_pnf_rf,
+-		&ett_nfapi_phy_state,
+-		&ett_nfapi_rf_bands,
+-		&ett_nfapi_bf_vectors,
+-		&ett_nfapi_csi_rs_bf_vector,
+-		&ett_nfapi_csi_rs_resource_configs,
+-		&ett_nfapi_tx_antenna_ports,
+-		&ett_nfapi_harq_ack_nack_data,
+-		&ett_nfapi_harq_data,
+-		&ett_nfapi_cc,
+-		&ett_nfapi_rbs,
+-		&ett_nfapi_antennas,
+-		&ett_nfapi_epdcch_prbs,
+-		&ett_nfapi_dl_config_request_body,
+-		&ett_nfapi_dl_config_request_pdu_list,
+-		&ett_nfapi_ul_config_request_pdu_list,
+-		&ett_nfapi_hi_dci0_request_pdu_list,
+-		&ett_nfapi_tx_request_pdu_list,
+-		&ett_nfapi_rx_indication_pdu_list,
+-		&ett_nfapi_harq_indication_pdu_list,
+-		&ett_nfapi_crc_indication_pdu_list,
+-		&ett_nfapi_sr_indication_pdu_list,
+-		&ett_nfapi_cqi_indication_pdu_list,
+-		&ett_nfapi_preamble_indication_pdu_list,
+-		&ett_nfapi_srs_indication_pdu_list,
+-		&ett_nfapi_lbt_dl_config_pdu_list,
+-		&ett_nfapi_lbt_dl_indication_pdu_list,
+-		&ett_nfapi_dl_config_request_dlsch_pdu_rel8,
+-		&ett_nfapi_dl_config_request_dlsch_pdu_rel9,
+-		&ett_nfapi_dl_config_request_dlsch_pdu_rel10,
+-		&ett_nfapi_dl_config_bch_pdu_rel8,
+-		&ett_nfapi_dl_config_mch_pdu_rel8,
+-		&ett_nfapi_dl_config_pch_pdu_rel8,
+-		&ett_nfapi_dl_config_dci_dl_pdu_rel8,
+-		&ett_nfapi_dl_config_dci_dl_pdu_rel9,
+-		&ett_nfapi_dl_config_dci_dl_pdu_rel10,
+-		&ett_nfapi_dl_config_prs_pdu_rel9,
+-		&ett_nfapi_dl_config_csi_rs_pdu_rel10,
+-		&ett_nfapi_subbands,
+-		&ett_nfapi_precoding,
+-		&ett_nfapi_bf_vector_antennas,
+-		&ett_nfapi_ul_config_request_body,
+-		&ett_nfapi_ul_config_harq_buffer_pdu,
+-		&ett_nfapi_ul_config_ue_information_rel8,
+-		&ett_nfapi_ul_config_sr_information_pdu_rel8,
+-		&ett_nfapi_ul_config_ulsch_pdu_rel8,
+-		&ett_nfapi_ul_config_ulsch_pdu_rel10,
+-		&ett_nfapi_ul_config_cqi_ri_information_rel8,
+-		&ett_nfapi_ul_config_cqi_ri_information_rel9,
+-		&ett_nfapi_ul_config_ulsch_harq_information_rel10,
+-		&ett_nfapi_ul_config_initial_transmission_parameters_rel8,
+-		&ett_nfapi_ul_config_cqi_information_rel8,
+-		&ett_nfapi_ul_config_cqi_information_rel10,
+-		&ett_nfapi_ul_config_sr_information_rel8,
+-		&ett_nfapi_ul_config_sr_information_rel10,
+-		&ett_nfapi_ul_config_harq_information_rel10_tdd,
+-		&ett_nfapi_ul_config_harq_information_rel8_fdd,
+-		&ett_nfapi_ul_config_harq_information_rel9_fdd,
+-		&ett_nfapi_ul_config_srs_pdu_rel8,
+-		&ett_nfapi_ul_config_srs_pdu_rel10,
+-		&ett_nfapi_crc_indication_body,
+-
+-		&ett_nfapi_earfcn_list,
+-		&ett_nfapi_uarfcn_list,
+-		&ett_nfapi_arfcn_list,
+-		&ett_nfapi_rssi_list,
+-		&ett_nfapi_pci_list,
+-		&ett_nfapi_psc_list,
+-		&ett_nfapi_lte_cells_found_list,
+-		&ett_nfapi_utran_cells_found_list,
+-		&ett_nfapi_geran_cells_found_list,
+-		&ett_nfapi_si_periodicity_list,
+-
+-		/* for fragmentation support*/
+-		&ett_msg_fragment,
+-		&ett_msg_fragments
+-    };
+-
+-    static ei_register_info ei[] = 
+-	{
+-		{ &ei_power_invalid, { "nfapi.power.invalid", PI_PROTOCOL, PI_ERROR, "Tx Power range invalid [0 - 10000]", EXPFILL } },
+-		{ &ei_ref_sig_power_invalid, { "nfapi.ref_sig_power.invalid", PI_PROTOCOL, PI_ERROR, "Ref Sig Power range invalid [0 - 255]", EXPFILL }},
+-		{ &ei_invalid_range, { "nfapi.invalid.range", PI_PROTOCOL, PI_ERROR, "Out of valid range. Todo create more specific error", EXPFILL } },
+-    };
+-	
+-
+-
+-    expert_module_t* expert_nfapi;
+-
+-	/* Register protocol */
+-	proto_nfapi = proto_register_protocol("Nfapi", "NFAPI", "nfapi");
+-
+-    expert_nfapi = expert_register_protocol(proto_nfapi);
+-
+-    expert_register_field_array(expert_nfapi, ei, array_length(ei));
+-
+-    proto_register_field_array(proto_nfapi, hf, array_length(hf));
+-    proto_register_subtree_array(ett, array_length(ett));
+-	
+-	reassembly_table_register(&ul_p7_reassemble_table, &addresses_ports_reassembly_table_functions);
+-	reassembly_table_register(&dl_p7_reassemble_table, &addresses_ports_reassembly_table_functions);
+-
+-	register_dissector("nfapi", dissect_nfapi, proto_nfapi);
+-
+-}
+-
+-// ----------------------------------------------------------------------------|
+-
+-void proto_reg_handoff_nfapi(void)
+-{
+-	static dissector_handle_t nfapi_handle;
+-
+-	nfapi_handle = create_dissector_handle(dissect_nfapi, proto_nfapi);
+-
+-	dissector_add_for_decode_as("sctp.port", nfapi_handle);
+-
+-	dissector_add_uint("udp.port", 41700, nfapi_handle);
+-
+-}
++
++		default:
++		{
++			if (msg_id >= 0x112 && msg_id <= 0x017f)
++			{
++				// reserved P5 message
++			}
++			else if (msg_id >= 0x183 && msg_id <= 0x01ff)
++			{
++				// reserved P7 message
++			}
++			else if (msg_id >= 0x0200 && msg_id <= 0x02ff)
++			{
++				// reserved P4 message
++			}
++			else if (msg_id >= 0x0300 && msg_id <= 0x03ff)
++			{
++				// reserved vendor extentions
++			}
++
++			break;
++		}
++	};
++
++	ptvcursor_pop_subtree(ptvc);
++	ptvcursor_free(ptvc);
++
++	return tvb_captured_length(tvb);
++}
++
++static void nfapi_tag_vals_fn(gchar* s, guint32 v)
++{
++	const tlv_t* tlv = look_up_tlv(v);
++	if (tlv != 0)
++	{
++		g_snprintf(s, ITEM_LABEL_LENGTH, "%s (0x%x)", tlv->name, v);
++	}
++	else
++	{
++		g_snprintf(s, ITEM_LABEL_LENGTH, "%s (0x%x)", "Unknown", v);
++	}
++}
++static void neg_pow_conversion_fn(gchar* s, guint8 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%d dB (%d)", ((gint16)v * (-1)), v);
++}
++static void power_offset_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f dB (%d)", (((float)v * 0.001) - 6.0), v);
++}
++static void reference_signal_power_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f dB (%d)", (((float)v * 0.25) - 63.75), v);
++}
++static void laa_threshold_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f dB (%d)", (float)(v * -100.00), v);
++}
++static void max_transmit_power_2_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f dB (%d)", ((float)v * 0.1) - 10.0, v);
++}
++static void max_transmit_power_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f dB (%d)", ((float)v * 0.1), v);
++}
++static void sfn_sf_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%d/%d (%d)", v >> 0x4, v & 0x000F, v);
++}
++static void rssi_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f dB (%d)", ((float)v * 0.1), v);
++}
++static void dl_rs_tx_pow_measment_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f dB (%d)", ((float)v * 0.1), v);
++}
++
++static void ul_cqi_conversion_fn(gchar* s, guint16 v)
++{
++	g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f dB (%d)", (((float)v / 2 ) - 64.0), v);
++}
++
++// ----------------------------------------------------------------------------|
++
++void proto_register_nfapi(void)
++{
++	static hf_register_info hf[] =
++	{
++		{ &hf_msg_fragments,
++			{ "Message fragments", "nfapi.fragments",
++			FT_NONE, BASE_NONE, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_fragment,
++			{ "Message fragment", "nfapi.fragment",
++			FT_FRAMENUM, BASE_NONE, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_fragment_overlap,
++			{ "Message fragment overlap", "nfapi.fragment.overlap",
++			FT_BOOLEAN, 0, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_fragment_overlap_conflicts,
++			{ "Message fragment overlapping with conflicting data", "nfapi.fragment.overlap.conflicts",
++			FT_BOOLEAN, 0, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_fragment_multiple_tails,
++			{ "Message has multiple tail fragments", "nfapi.fragment.multiple_tails",
++			FT_BOOLEAN, 0, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_fragment_too_long_fragment,
++			{ "Message fragment too long", "nfapi.fragment.too_long_fragment",
++			FT_BOOLEAN, 0, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_fragment_error,
++			{ "Message defragmentation error", "nfapi.fragment.error",
++			FT_FRAMENUM, BASE_NONE, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_fragment_count,
++			{ "Message fragment count", "nfapi.fragment.count",
++			FT_UINT32, BASE_DEC, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_reassembled_in,
++			{ "Reassembled in", "nfapi.reassembled.in",
++			FT_FRAMENUM, BASE_NONE, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_msg_reassembled_length,
++			{ "Reassembled length", "nfapi.reassembled.length",
++			FT_UINT32, BASE_DEC, NULL, 0x00,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_p4_p5_message_header_phy_id,
++			{ "PHY ID", "nfapi.p4_p5_message_header.phy_id",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Within the PNF Device, the unique identity of the PHY instance as assigned through the PNF_CONFIG.request", HFILL }
++		},
++		{ &hf_nfapi_p4_p5_message_header_message_id,
++			{ "Message ID", "nfapi.p4_p5_message_header.message_id",
++			FT_UINT16, BASE_HEX_DEC, VALS(message_id_vals), 0x0,
++			"The nFAPI message identity", HFILL }
++		},
++		{ &hf_nfapi_p4_p5_message_header_message_length,
++			{ "Message Length", "nfapi.p4_p5_message_header.message_length",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The length in bytes of the message including the header", HFILL }
++		},
++		{ &hf_nfapi_p4_p5_message_header_spare,
++			{ "Spare", "nfapi.p4_p5_message_header.spare",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Reserved field to be populated with zeros on transmission and ignored on reception", HFILL }
++		},
++		{ &hf_nfapi_p7_message_header_phy_id,
++			{ "Phy ID", "nfapi.p7_message_header.phy_id",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Within the PNF Device, the unique identity of the PHY instance as assigned through the PNF_CONFIG.request", HFILL }
++		},
++		{ &hf_nfapi_p7_message_header_message_id,
++			{ "Message ID", "nfapi.p7.message_header.message_id",
++			FT_UINT16, BASE_HEX_DEC, VALS(message_id_vals), 0x0,
++			"The nFAPI message identity", HFILL }
++		},
++		{ &hf_nfapi_p7_message_header_message_length,
++			{ "Message Length", "nfapi.p7_message_header.message_length",
++			FT_UINT16, BASE_DEC | BASE_UNIT_STRING, &units_byte_bytes, 0x0,
++			"The length in bytes of the message segment including the header", HFILL }
++		},
++		{ &hf_nfapi_p7_message_header_m,
++			{ "M", "nfapi.p7_message_header.m_segment_sequence",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"A More flag indicating there are more segments to follow to complete the entire message", HFILL }
++		},
++		{ &hf_nfapi_p7_message_header_segment,
++			{ "Segment Number", "nfapi.p7_message_header.m_segment_sequence",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The segment number starting at zero and incrementing by one between each segment", HFILL }
++		},
++		{ &hf_nfapi_p7_message_header_sequence_number,
++			{ "Sequence Number", "nfapi.p7_message_header.m_segment_sequence",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The incrementing sequence number for all complete messages over the P7 nFAPI interface per PHY instance", HFILL }
++		},
++		{ &hf_nfapi_p7_message_header_checksum,
++			{ "Checksum", "nfapi.p7_message_header.checksum",
++			FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
++			"The checksum of the whole message segment (including header) as calculated using "
++			"the CRC32c algorithm following the same method as the SCTP protocol defined in IETF RFC 4960 "
++			"The Checksum is optional to populate and must be filled with zero's when not used", HFILL }
++		},
++		{ &hf_nfapi_p7_message_header_transmit_timestamp,
++			{ "Transmit Timestamp", "nfapi.p7_message_header.timestamp",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The offset from VNF SFN/SF 0/0 time reference of the message transmission at the transport layer, in microseconds, with a range of 0 to 10239999", HFILL }
++		},
++		{ &hf_nfapi_tl_tag,
++			{ "TLV Tag", "nfapi.tl_tag",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(nfapi_tag_vals_fn), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_tl_length,
++			{ "TLV Length", "nfapi.tl_length",
++			FT_UINT16, BASE_DEC | BASE_UNIT_STRING, &units_byte_bytes, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_error_code,
++			{ "Error Code", "nfapi.error.code",
++			FT_UINT8, BASE_DEC, VALS(nfapi_error_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_p4_error_code,
++			{ "Error Code", "nfapi.p4_error.code",
++			FT_UINT8, BASE_DEC, VALS(nfapi_p4_error_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_rat_type,
++			{ "RAT Type", "nfapi.rat_type",
++			FT_UINT8, BASE_DEC, VALS(nfapi_rat_type_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_num_tlv,
++			{ "Number of TLV", "nfapi.param.response.num_tlv",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_phy_state,
++			{ "Phy state value", "nfapi.phy.state",
++			FT_UINT16, BASE_DEC, VALS(nfapi_phy_state_vals), 0x0,
++			"Indicates the current operational state of the PHY", HFILL }
++		},
++		{ &hf_nfapi_dl_ue_per_sf,
++			{ "Downlink UEs per Subframe", "nfapi.dl.ue.per.sf",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The maximum number of downlink UEs per subframe supported."
++			"This is the maximum number of downlink UEs that can be scheduled per "
++			"subframe, non-inclusive of broadcast, paging and common channels.", HFILL }
++		},
++		{ &hf_nfapi_ul_ue_per_sf,
++			{ "Uplink UEs per Subframe", "nfapi.ul.ue.per.sf",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The maximum number of uplink UEs per subframe supported."
++			"This is the maximum number of uplink UEs that can be scheduled per "
++			"subframe, non-inclusive of common channels.", HFILL }
++		},
++		{ &hf_nfapi_duplex_mode,
++			{ "Duplex Mode", "nfapi.duplex.mode",
++			FT_UINT16, BASE_DEC, VALS(nfapi_duplex_mode_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_bandwidth_support,
++			{ "Downlink bandwidth support", "nfapi.dl.bandwidth.support",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PHY downlink channel bandwidth capability (in resource blocks)", HFILL }
++		},
++		{ &hf_nfapi_dl_bandwidth_support_6,
++			{ "6Mhz", "nfapi.dl.bandwidth.support.6",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_bandwidth_support_15,
++			{ "15Mhz", "nfapi.dl.bandwidth.support.15",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_bandwidth_support_25,
++			{ "25Mhz", "nfapi.dl.bandwidth.support.25",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_bandwidth_support_50,
++			{ "50Mhz", "nfapi.dl.bandwidth.support.50",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_bandwidth_support_75,
++			{ "75Mhz", "nfapi.dl.bandwidth.support.75",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_bandwidth_support_100,
++			{ "100Mhz", "nfapi.dl.bandwidth.support.100",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_bandwidth_support,
++			{ "Uplink bandwidth support", "nfapi.ul.bandwidth.support",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PHY uplink channel bandwidth capability (in resource blocks)", HFILL }
++		},
++		{ &hf_nfapi_ul_bandwidth_support_6,
++			{ "6Mhz", "nfapi.ul.bandwidth.support.6",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_bandwidth_support_15,
++			{ "15Mhz", "nfapi.ul.bandwidth.support.15",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_bandwidth_support_25,
++			{ "25Mhz", "nfapi.ul.bandwidth.support.25",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_bandwidth_support_50,
++			{ "50Mhz", "nfapi.ul.bandwidth.support.50",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_bandwidth_support_75,
++			{ "75Mhz", "nfapi.ul.bandwidth.support.75",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_bandwidth_support_100,
++			{ "100Mhz", "nfapi.ul.bandwidth.support.100",
++			FT_BOOLEAN, 1, TFS(&tfs_supported_not_supported), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_modulation_support,
++			{ "Downlink modulation support", "nfapi.dl.modulation.support",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PHY downlink modulation capability", HFILL }
++		},
++		{ &hf_nfapi_dl_modulation_support_qpsk,
++			{ "QPSK", "nfapi.dl.modulation.support.qpsk",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_modulation_support_16qam,
++			{ "16QAM", "nfapi.dl.modulation.support.16qam",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_modulation_support_64qam,
++			{ "64QAM", "nfapi.dl.modulation.support.64qam",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_modulation_support_256qam,
++			{ "256QAM", "nfapi.dl.modulation.support.256qam",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_modulation_support,
++			{ "Uplink modulation support", "nfapi.ul.modulation.support",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PHY uplink modulation capability", HFILL }
++		},
++		{ &hf_nfapi_ul_modulation_support_qpsk,
++			{ "QPSK", "nfapi.ul.modulation.support.qpsk",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_modulation_support_16qam,
++			{ "16QAM", "nfapi.ul.modulation.support.16qam",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_modulation_support_64qam,
++			{ "64QAM", "nfapi.ul.modulation.support.64qam",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_phy_antenna_capability,
++			{ "Phy Antenna capability", "nfapi.phy.antenna.capability",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of antennas supported", HFILL }
++		},
++		{ &hf_nfapi_release_capability,
++			{ "Release capability", "nfapi.release.capability",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates which release the PHY supports", HFILL }
++		},
++		{ &hf_nfapi_mbsfn_capability,
++			{ "MBSFN capability", "nfapi.mbsfn.capability",
++			FT_BOOLEAN, 8, TFS(&support_strname), 0x0,
++			"Indicates support for MBSFN features", HFILL }
++		},
++		{ &hf_nfapi_laa_capability,
++			{ "LAA Support", "nfapi.laa.support",
++			FT_BOOLEAN, 8, TFS(&support_strname), 0x0,
++			"Indicates support for LAA features", HFILL }
++		},
++		{ &hf_nfapi_pd_sensing_lbt_support,
++			{ "PD sensing LBT support", "nfapi.pd.sensing.lbt.support",
++			FT_BOOLEAN, 8, TFS(&support_strname), 0x0,
++			"Indicates support for PD sensing in L1", HFILL }
++		},
++		{ &hf_nfapi_multi_carrier_lbt_support,
++			{ "Multi carrier LBT support", "nfapi.multi.carrier.lbt.support",
++			FT_UINT16, BASE_DEC, VALS(nfapi_mutli_carrier_lbt_support_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_partial_sf_support,
++			{ "Partial SF support", "nfapi.partial.sf.support",
++			FT_BOOLEAN, 8, TFS(&partial_sf_support_strname), 0x0,
++			"Indicates support for Partial SF in L1", HFILL }
++		},
++		{ &hf_nfapi_reference_signal_power,
++			{ "Reference signal power", "nfapi.ref_sig_power",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(reference_signal_power_conversion_fn), 0x0,
++			"Normalized value levels (relative) to accommodate different absolute Tx Power used by eNb", HFILL }
++		},
++		{ &hf_nfapi_primary_synchronization_signal_epre_eprers,
++			{ "Primary synchronization signal EPRE/EPRERS", "nfapi.primary.sync.signal",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(power_offset_conversion_fn), 0x0,
++			"The power of synchronization signal with respect to the reference signal, (PSS for LTE cell, NPSS for NB-IOT cell)", HFILL }
++		},
++		{ &hf_nfapi_secondary_synchronization_signal_epre_eprers,
++			{ "Secondary synchronization signal EPRE/EPRERS", "nfapi.secondary.sync.signal",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(power_offset_conversion_fn), 0x0,
++			"The power of synchronization signal with respect to the reference signal, (SSS for LTE cell, NSSS for NB-IOT cell)", HFILL }
++		},
++		{ &hf_nfapi_physical_cell_id,
++			{ "Physical Cell ID", "nfapi.physical.cell.id",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The Cell ID sent with the synchronization signal", HFILL }
++		},
++		{ &hf_nfapi_phich_resource,
++			{ "PHICH Resource", "nfapi.phich.resource",
++			FT_UINT16, BASE_DEC, VALS(nfapi_phich_resource_vals), 0x0,
++			"The number of resource element groups used for PHICH", HFILL }
++		},
++		{ &hf_nfapi_phich_duration,
++			{ "PHICH Duration", "nfapi.phich.duration",
++			FT_BOOLEAN, 8, TFS(&phich_duration_strname), 0x0,
++			"The PHICH duration for MBSFN and non-MBSFN sub-frames", HFILL }
++		},
++		{ &hf_nfapi_phich_power_offset,
++			{ "PHICH Power Offset", "nfapi.phich.power.offset",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(power_offset_conversion_fn), 0x0,
++			"The power per antenna of the PHICH with respect to the reference signal", HFILL }
++		},
++		{ &hf_nfapi_configuration_index,
++			{ "Configuration Index", "nfapi.configuration.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Provides information about the location and format of the PRACH.", HFILL }
++		},
++		{ &hf_nfapi_root_sequence_index,
++			{ "Root sequence Index", "nfapi.root.sequence.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"PRACH Root sequence index", HFILL }
++		},
++		{ &hf_nfapi_zero_correlation_zone_configuration,
++			{ "Zero correlation zone configuration", "nfapi.zero.correlation.zone.configuration",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Equivalent to Ncs", HFILL }
++		},
++		{ &hf_nfapi_high_speed_flag,
++			{ "High Speed Flag", "nfapi.high.speed.flag",
++			FT_BOOLEAN, 8, TFS(&high_speed_flag_strname), 0x0,
++			"Indicates if unrestricted, or restricted, set of preambles is used", HFILL }
++		},
++		{ &hf_nfapi_frequency_offset,
++			{ "Frequency offset", "nfapi.frequency.offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The first physical resource block available for PRACH", HFILL }
++		},
++		{ &hf_nfapi_hopping_mode,
++			{ "Hopping Mode", "nfapi.hopping.mode",
++			FT_BOOLEAN, 8, TFS(&hopping_mode_strname), 0x0,
++			"If hopping is enabled indicates the type of hopping used", HFILL }
++		},
++		{ &hf_nfapi_hopping_offset,
++			{ "Hopping offset", "nfapi.hopping.offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The offset used if hopping is enabled", HFILL }
++		},
++		{ &hf_nfapi_delta_pucch_shift,
++			{ "Delta PUCCH Shift", "nfapi.delta.pucch.shift",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The cyclic shift difference", HFILL }
++		},
++		{ &hf_nfapi_n_cqi_rb,
++			{ "N CQI RB", "nfapi.n.cqi.rb",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The bandwidth, in units of resource blocks, that is available for use by PUCCH formats 2/2a/2b transmission in each slot", HFILL }
++		},
++		{ &hf_nfapi_n_an_cs,
++			{ "N AN CS", "nfapi.n.an.cs",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of cyclic shifts used for PUCCH formats 1/1a/1b in a resource block with a mix of formats 1/a/1/ab and 2/2a/2b.", HFILL }
++		},
++		{ &hf_nfapi_n1_pucch_an,
++			{ "N1 PUCCH AN", "nfapi.n1.pucch.an",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"N1 PUCCH", HFILL }
++		},
++		{ &hf_nfapi_bandwidth_configuration,
++			{ "Bandwidth configuration", "nfapi.bw.configuration",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The available SRS bandwidth of the cell", HFILL }
++		},
++		{ &hf_nfapi_srs_subframe_configuration,
++			{ "SRS subframe configuration", "nfapi.srs.subframe.configuration",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The subframe configuration. Needed if semi-static configuration is held in PHY", HFILL }
++		},
++		{ &hf_nfapi_uplink_rs_hopping,
++			{ "Uplink RS hopping", "nfapi.uplink.rs.hopping",
++			FT_UINT16, BASE_DEC, VALS(nfapi_uplink_rs_hopping_vals), 0x0,
++			"Indicates the type of hopping to use", HFILL }
++		},
++		{ &hf_nfapi_group_assignment,
++			{ "Group assignment", "nfapi.group.assignment",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The sequence shift pattern used if group hopping is enabled", HFILL }
++		},
++		{ &hf_nfapi_cyclic_shift_1_for_drms,
++			{ "Cyclic Shift 1 for DRMS", "nfapi.cyclic.shift.1.for.drms",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Specifies the cyclic shift for the reference signal used in the cell.", HFILL }
++		},
++		{ &hf_nfapi_subframe_assignment,
++			{ "Subframe_assignment", "nfapi.subframe.assignment",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"For TDD mode only, indicates the DL/UL subframe structure", HFILL }
++		},
++		{ &hf_nfapi_special_subframe_patterns,
++			{ "Special Subframe patterns", "nfapi.special.subframe.patterns",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"For TDD mode only. Length of fields DwPTS, GP and UpPTS", HFILL }
++		},
++		{ &hf_nfapi_ed_threshold_for_lbt_for_pdsch,
++			{ "ED Threshold for LBT for PDSCH", "nfapi.ed.threshold.for.lbt.pdsch",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(laa_threshold_conversion_fn), 0x0,
++			"Indicates the energy detection threshold in dBm for LBT for PDSCH", HFILL }
++		},
++		{ &hf_nfapi_ed_threshold_for_lbt_for_drs,
++			{ "ED Threshold for LBT for DRS", "nfapi.ed.threshold.for.lbt.for.drs",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(laa_threshold_conversion_fn), 0x0,
++			"Indicates the energy detection threshold in dBm for LBT for DRS", HFILL }
++		},
++		{ &hf_nfapi_pd_threshold,
++			{ "PD Threshold", "nfapi.pd.threshold",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(laa_threshold_conversion_fn), 0x0,
++			"Indicates the preamble detection threshold in dBm, if the L1 capabilities support PD", HFILL }
++		},
++		{ &hf_nfapi_multi_carrier_type,
++			{ "Multi carrier type", "nfapi.multi.carrier.type",
++			FT_UINT16, BASE_DEC, VALS(nfapi_laa_carrier_type_vals), 0x0,
++			"Indicates multi carrier type configuration of L1 (according to L1 capabilities and L2 scheduler requirements", HFILL }
++		},
++		{ &hf_nfapi_multi_carrier_tx,
++			{ "Multi carrier TX", "nfapi.multi.carrier.tx",
++			FT_BOOLEAN, 8, TFS(&nfapi_multi_carrier_tx_strname), 0x0,
++			"Indicates multi carrier transmission configuration of L1 (according to type if supporting multi carrier)", HFILL }
++		},
++		{ &hf_nfapi_multi_carrier_freeze,
++			{ "Multi carrier freeze", "nfapi.multi.carrier.freeze",
++			FT_BOOLEAN, 8, TFS(&nfapi_multi_carrier_freeze_strname), 0x0,
++			"Indicates multi carrier freeze, configuration of L1 (applicable only to type A type if supporting multi carrier)", HFILL }
++		},
++		{ &hf_nfapi_tx_antenna_ports_for_drs,
++			{ "Tx antenna ports for DRS", "nfapi.tx.antenna.ports.for.drs",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of cell specific transmit antenna ports within the DRS occasions", HFILL }
++		},
++		{ &hf_nfapi_transmission_power_for_drs,
++			{ "Transmission power for DRS", "nfapi.transmission.power.for.drs.",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(power_offset_conversion_fn), 0x0,
++			"Offset of cell specific Reference signals power within DRS occasions to the reference signal power", HFILL }
++		},
++		{ &hf_nfapi_pbch_repetitions_enabled_r13,
++			{ "PBCH Repetitions enable R13", "nfapi.pbch.repetitions.enabled_r13",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable / Disable PBCH repetitions", HFILL }
++		},
++		{ &hf_nfapi_prach_cat_m_root_sequence_index,
++			{ "PRACH CAT-M Root sequence index", "nfapi.prach.cat_m.root.squence.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"PRACH Root sequence index", HFILL }
++		},
++		{ &hf_nfapi_prach_cat_m_zero_correlation_zone_configuration,
++			{ "PRACH CAT-M Zero correlation zone configuration", "nfapi.prach.cat_m.zero.correlation.zone.configuration",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Equivalent to Ncs", HFILL }
++		},
++		{ &hf_nfapi_prach_cat_m_high_speed_flag,
++			{ "PRACH CAT-M High speed flag", "nfapi.prach.cat_m.high.speed.flag",
++			FT_BOOLEAN, 8, TFS(&high_speed_flag_strname), 0x0,
++			"Indicates if unrestricted, or restricted, set of preambles is used", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_0_enable,
++			{ "PRACH CE level #0 Enable", "nfapi.prach.ce.level.0.enable",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable \\ Disable CE level #0.", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_0_configuration_index,
++			{ "PRACH CE level #0 Configuration index", "nfapi.prach.ce.level.0.configuration.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Provides information about the location and format of the PRACH", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_0_frequency_offset,
++			{ "PRACH CE level #0 Frequency offset", "nfapi.prach.ce.level.0.frequency_offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The first physical resource block available for PRACH for each CE", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_0_number_of_repetitions_per_attempt,
++			{ "PRACH CE level #0 Number of repetitions per attempt", "nfapi.prach.ce.level.0.number.of.repetitions.per_attempt",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of PRACH repetitions per attempt for each CE level", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_0_starting_subframe_periodicity,
++			{ "CE level #0 Starting subframe periodicity", "nfapi.prach.ce.level.0.starting.subframe_periodicity",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Optional. PRACH starting subframe periodicity, expressed in number of slots available for preamble transmission(PRACH opportunities)", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_0_hopping_enabled,
++			{ "PRACH CE level #0 Hopping Enable", "nfapi.prach.ce.level.0.hopping_enable",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable \\ Disable PRACH frequency hopping for each CE level", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_0_hopping_offset,
++			{ "PRACH CE level #0 Hopping Offset", "nfapi.prach.ce.level.0.hopping.offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Valid in case 'PRACH Hopping Enable' is enabled", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_1_enable,
++			{ "PRACH CE level #1 Enable", "nfapi.prach.ce.level.0.enable",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable \\ Disable CE level #1", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_1_configuration_index,
++			{ "PRACH CE level #1 Configuration index", "nfapi.prach.ce.level.1.configuration.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Provides information about the location and format of the PRACH", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_1_frequency_offset,
++			{ "PRACH CE level #1 Frequency offset", "nfapi.prach.ce.level.1.frequency_offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The first physical resource block available for PRACH for each CE", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_1_number_of_repetitions_per_attempt,
++			{ "PRACH CE level #1 Number of repetitions per attempt", "nfapi.prach.ce.level.1.number.of.repetitions.per_attempt",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of PRACH repetitions per attempt for each CE level", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_1_starting_subframe_periodicity,
++			{ "CE level #1 Starting subframe periodicity", "nfapi.prach.ce.level.1.starting.subframe_periodicity",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Optional.PRACH starting subframe periodicity, expressed in number of slots available for preamble transmission(PRACH opportunities),", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_1_hopping_enabled,
++			{ "PRACH CE level #1 Hopping Enable", "nfapi.prach.ce.level.1.hopping_enable",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable \\ Disable PRACH frequency hopping for each CE level.", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_1_hopping_offset,
++			{ "PRACH CE level #1 Hopping Offset", "nfapi.prach.ce.level.1.hopping.offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Valid in case 'PRACH Hopping Enable' is enabled.", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_2_enable,
++			{ "PRACH CE level #2 Enable", "nfapi.prach.ce.level.2.enable",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable \\ Disable CE level #2", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_2_configuration_index,
++			{ "PRACH CE level #2 Configuration index", "nfapi.prach.ce.level.2.configuration.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Provides information about the location and format of the PRACH", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_2_frequency_offset,
++			{ "PRACH CE level #2 Frequency offset", "nfapi.prach.ce.level.2.frequency_offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The first physical resource block available for PRACH for each CE", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_2_number_of_repetitions_per_attempt,
++			{ "PRACH CE level #2 Number of repetitions per attempt", "nfapi.prach.ce.level.2.number.of.repetitions.per_attempt",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of PRACH repetitions per attempt for each CE level", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_2_starting_subframe_periodicity,
++			{ "CE level #2 Starting subframe periodicity", "nfapi.prach.ce.level.2.starting.subframe_periodicity",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Optional. PRACH starting subframe periodicity, expressed in number of slots available for preamble transmission(PRACH opportunities)", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_2_hopping_enabled,
++			{ "PRACH CE level #2 Hopping Enable", "nfapi.prach.ce.level.2.hopping_enable",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable \\ Disable PRACH frequency hopping for each CE level", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_2_hopping_offset,
++			{ "PRACH CE level #2 Hopping Offset", "nfapi.prach.ce.level.2.hopping.offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Valid in case 'PRACH Hopping Enable' is enabled.", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_3_enable,
++			{ "PRACH CE level #3 Enable", "nfapi.prach.ce.level.3.enable",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable \\ Disable CE level #3.", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_3_configuration_index,
++			{ "PRACH CE level #3 Configuration index", "nfapi.prach.ce.level.3.configuration.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Provides information about the location and format of the PRACH.", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_3_frequency_offset,
++			{ "PRACH CE level #3 Frequency offset", "nfapi.prach.ce.level.3.frequency_offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The first physical resource block available for PRACH for each CE", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_3_number_of_repetitions_per_attempt,
++			{ "PRACH CE level #3 Number of repetitions per attempt", "nfapi.prach.ce.level.3.number.of.repetitions.per_attempt",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of PRACH repetitions per attempt for each CE level", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_3_starting_subframe_periodicity,
++			{ "CE level #3 Starting subframe periodicity", "nfapi.prach.ce.level.3.starting.subframe_periodicity",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Optional. PRACH starting subframe periodicity, expressed in number of slots available for preamble transmission(PRACH opportunities)", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_3_hopping_enabled,
++			{ "PRACH CE level #3 Hopping Enable", "nfapi.prach.ce.level.3.hopping_enable",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Enable \\ Disable PRACH frequency hopping for each CE level.", HFILL }
++		},
++		{ &hf_nfapi_prach_ce_level_3_hopping_offset,
++			{ "PRACH CE level #3 Hopping Offset", "nfapi.prach.ce.level.3.hopping.offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Valid in case 'PRACH Hopping Enable' is enabled.", HFILL }
++		},
++		{ &hf_nfapi_pucch_internal_ul_hopping_config_common_mode_a,
++			{ "PUCCH Interval-ULHoppingConfigCommonModeA", "nfapi.pucch.interval.ulhopping.config.common.mode.a",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"NthULNB for UEModeA", HFILL }
++		},
++		{ &hf_nfapi_pucch_internal_ul_hopping_config_common_mode_b,
++			{ "PUCCH Interval-ULHoppingConfigCommonModeB", "nfapi.pucch.interval.ulhopping.config.common.mode.b",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"NthULNB for UEModeB", HFILL }
++		},
++		{ &hf_nfapi_data_report_mode,
++			{ "Data Report Mode", "nfapi.data.report.mode",
++			FT_BOOLEAN, 8, TFS(&data_report_mode_vals), 0x0,
++			"The data report mode for the uplink data", HFILL }
++		},
++		{ &hf_nfapi_sfnsf,
++			{ "SFN/SF", "nfapi.sfn.sf",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(sfn_sf_conversion_fn), 0x0,
++			"The future SFN/SF subframe where the TLVs included in the message should be applied", HFILL }
++		},
++		{ &hf_nfapi_max_up_pts,
++			{ "Max UpPTS frames", "nfapi.max.uppts.frame",
++			FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x0,
++			"Used for TDD only and indicates how SRS operates in UpPTS subframes", HFILL }
++		},
++		{ &hf_nfapi_srs_acknack_srs_simultaneous_transmission,
++			{ "SRS AckNack Simultaneous transmission", "nfapi.srs.acknack.simult.tx",
++			FT_BOOLEAN, 8, TFS(&srs_simult_tx_strname), 0x0,
++			"Indicates if SRS and ACK/NACK can be received in the same subframe. Needed if semi-static configuration is held in PHY.", HFILL }
++		},
++		{ &hf_nfapi_pnf_address_ipv4,
++			{ "PNF IPV4", "nfapi.pnf.address.ipv4",
++			FT_IPv4, BASE_NONE, NULL, 0x0,
++			"The IPv4 address of the PNF PHY instance to be used by the VNF for this PNF PHY instance", HFILL }
++		},
++		{ &hf_nfapi_pnf_address_ipv6,
++			{ "PNF IPV6", "nfapi.pnf.address.ipv6",
++			FT_IPv6, BASE_NONE, NULL, 0x0,
++			"The IPv6 address of the PNF PHY instance to be used by the VNF for this PNF PHY instance", HFILL }
++		},
++		{ &hf_nfapi_vnf_address_ipv4,
++			{ "VNF IPV4 Address", "nfapi.vnf.address.ipv4",
++			FT_IPv4, BASE_NONE, NULL, 0x0,
++			"The IPv4 address of the VNF to be used by the PNF for this P7 PHY instance", HFILL }
++		},
++		{ &hf_nfapi_vnf_address_ipv6,
++			{ "VNF IPV6 Address", "nfapi.vnf.address.ipv6",
++			FT_IPv6, BASE_NONE, NULL, 0x0,
++			"The IPv6 address of the VNF to be used by the PNF for this P7 PHY instance", HFILL }
++		},
++		{ &hf_nfapi_pnf_port,
++			{ "PNF PORT value", "nfapi.config.pnf.port.value",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The port of the PNF PHY instance to be used by the VNF for this PNF PHY instance", HFILL }
++		},
++		{ &hf_nfapi_vnf_port,
++			{ "VNF PORT value", "nfapi.config.vnf.port.value",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The port of the VNF to be used by the PNF for this P7 PHY instance", HFILL } },
++		{ &hf_nfapi_sync_mode,
++			{ "Sync Mode", "nfapi.sync.mode",
++			FT_UINT8, BASE_DEC, VALS(nfapi_sync_mode_vals), 0x0,
++			"The method of nFAPI Synchronization supported by the PNF", HFILL }
++		},
++		{ &hf_nfapi_location_mode,
++			{ "Location Mode", "nfapi.location.mode",
++			FT_UINT8, BASE_DEC, VALS(location_mode_vals), 0x0,
++			"The method of location derivation supported by the PNF", HFILL }
++		},
++		{ &hf_nfapi_location_coordinates_length,
++			{ "Location Coordinates Length", "nfapi.location.coordinates.length",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Length in bytes of the Location Coordinates Array field", HFILL }
++		},
++		{ &hf_nfapi_location_coordinates,
++			{ "Location Coordinates", "nfapi.location.coordinates",
++			FT_BYTES, BASE_NONE, NULL, 0x0,
++			"The Location of the PNF. The value is formatted as the LocationCoordinates IE using BASIC-PER encoding as defined in "
++			"TS36.355 section 6.4.2. The first bit of the LocationCoordinates IE is in the LSB of the first byte of the array."
++			"The MSBs of the last element of the array may be padded with zeros if the ASN.1 element is not an integer number of bytes", HFILL }
++		},
++		{ &hf_nfapi_pdu,
++			{ "PDU", "nfapi.pdu",
++			FT_BYTES, BASE_NONE, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_config_timing,
++			{ "DL config Timing", "nfapi.dl.config.timing",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The timing offset before the air interface subframe start that the DL_Config.request must be received at the PNF.", HFILL }
++		},
++		{ &hf_nfapi_tx_timing,
++			{ "Tx Timing", "nfapi.general.tx.timing",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The timing offset before the air interface subframe start that the TX.request must be received at the PNF.", HFILL }
++		},
++		{ &hf_nfapi_ul_config_timing,
++			{ "UL Config Timing", "nfapi.ul.config.timing",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The timing offset before the air interface subframe start that the UL_CONFIG.request must be received at the PNF.", HFILL }
++		},
++		{ &hf_nfapi_hi_dci0_timing,
++			{ "HI DCi0 Timing", "nfapi.hi.dci0.timing",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The timing offset before the air interface subframe start that the HI_DCI0.request must be received at the PNF.", HFILL }
++		},
++		{ &hf_nfapi_maximum_number_phys,
++			{ "Maximum number of Phys", "nfapi.maximum.number.phys",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The maximum number of operational PHYs supported by the PNF device.", HFILL }
++		},
++		{ &hf_nfapi_maximum_total_bandwidth,
++			{ "Maximum Total Bandwidth", "nfapi.maximum.total.bandwidth",
++			FT_UINT16, BASE_DEC | BASE_UNIT_STRING, &khz_100_units_db, 0x0,
++			"The total maximum bandwidth (in units of 100kHz) supported by the PNF device.", HFILL }
++		},
++		{ &hf_nfapi_maximum_total_number_dl_layers,
++			{ "Maximum Total Number DL Layers", "nfapi.maximum.total.number.dl.layers",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The maximum total number of downlink layers supported.", HFILL }
++		},
++		{ &hf_nfapi_maximum_total_number_ul_layers,
++			{ "Maximum Total Number UL Layers", "nfapi.maximum.total.number.ul.layers",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The maximum total number of uplink layers supported across all available PHYs.", HFILL }
++		},
++		{ &hf_nfapi_shared_bands,
++			{ "Shared bands", "nfapi.shared.bands",
++			FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x0,
++			"Indication that the PNF device shares the list of RF band options available across all available PHYs, so each may only be used with a single PHY.", HFILL }
++		},
++		{ &hf_nfapi_shared_pa,
++			{ "Shared pa", "nfapi.shared.pa",
++			FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x0,
++			"Indication that the PNF device shares a single RF PA across all available PHYs, so that the maximum Total Power is shared across all available PHYs.", HFILL }
++		},
++		{ &hf_nfapi_maximum_total_power,
++			{ "Maximum total power", "nfapi.maximum.total.power",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(dl_rs_tx_pow_measment_conversion_fn), 0x0,
++			"The maximum transmit power of the PNF device summed across all PHYs.", HFILL }
++		},
++		{ &hf_nfapi_oui,
++			{ "OUI", "nfapi.oui",
++			FT_STRING, BASE_NONE, NULL, 0x0,
++			"The PNF OUI in the format as specified by IEEE", HFILL }
++		},
++		{ &hf_nfapi_pnf_phy_number_phy,
++			{ "PNF Phy Number of Phy", "nfapi.pnf.phy.number.phy",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of PHY instances", HFILL }
++		},
++		{ &hf_nfapi_pnf_phy_config_index,
++			{ "PNF Phy Config Index", "nfapi.pnf.phy.config.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The unique index number of the PHY to permit the PNF to identify the PHY in the PNF_CONFIG.Request", HFILL }
++		},
++		{ &hf_nfapi_number_of_rfs,
++			{ "Number of RFs", "nfapi.pnf.rf.number.rf",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of RF configurations", HFILL }
++		},
++		{ &hf_nfapi_phy_rf_config_info_phy_id,
++			{ "Phy ID", "nfapi.pnf.phy.rf.config.phy.id",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_rf_config_index,
++			{ "RF Config Index", "nfapi.rf_config_index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The index number defined in the PNF RF struct that the PHY can support",
++			HFILL }
++		},
++		{ &hf_nfapi_number_of_rf_exclusions,
++			{ "Number of RF exclusions", "nfapi.hf_nfapi_number_of_rf_exclusions",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of RF configurations excluded from use by this PHY", HFILL }
++		},
++		{ &hf_nfapi_maximum_3gpp_release_supported,
++			{ "Maximum 3gpp Release Supported", "nfapi.maximum_3gpp_release_supported",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The major 3GPP releases supported", HFILL }
++		},
++		{ &hf_nfapi_maximum_3gpp_release_supported_rel8,
++			{ "Release 8", "nfapi.maximum_3gpp_release_supported.rel8",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_maximum_3gpp_release_supported_rel9,
++			{ "Release 9", "nfapi.maximum_3gpp_release_supported.rel9",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_maximum_3gpp_release_supported_rel10,
++			{ "Release 10", "nfapi.maximum_3gpp_release_supported.rel10",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_maximum_3gpp_release_supported_rel11,
++			{ "Release 11", "nfapi.maximum_3gpp_release_supported.rel11",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_maximum_3gpp_release_supported_rel12,
++			{ "Release 12", "nfapi.maximum_3gpp_release_supported.rel12",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_maximum_3gpp_release_supported_rel13,
++			{ "Release 13", "nfapi.maximum_3gpp_release_supported.rel13",
++			FT_BOOLEAN, 1, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_downlink_channel_bandwidth_supported,
++			{ "Maximum Channel Downlink Bandwidth Supported", "nfapi.downlink_channel_bandwidth_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The downlink channel bandwidth supported in resource blocks as specified in 3GPP TS 36.104", HFILL }
++		},
++		{ &hf_nfapi_uplink_channel_bandwidth_supported,
++			{ "Maximum Channel Uplink Bandwidth Supported", "nfapi.uplink_channel_bandwidth_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The uplink channel bandwidth supported in resource blocks as specified in 3GPP TS 36.104.", HFILL }
++		},
++		{ &hf_nfapi_number_of_dl_layers_supported,
++			{ "Number of DL Layers Supported", "nfapi.number_of_dl_layer_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The maximum number of downlink layers supported", HFILL }
++		},
++		{ &hf_nfapi_number_of_ul_layers_supported,
++			{ "Number of UL Layers Supported", "nfapi.number_of_ul_layer_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The maximum number of uplink layers supported", HFILL }
++		},
++		{ &hf_nfapi_nmm_modes_supported,
++			{ "NMM modes supported", "nfapi.nmm_modes_supported",
++			FT_UINT8, BASE_DEC, VALS(nmm_modes_supported_vals), 0x0,
++			"Network Monitor Modes Supported.", HFILL }
++		},
++		{ &hf_nfapi_band,
++			{ "Band", "nfapi.band",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Band number as specified in 3GPP TS36.101", HFILL }
++		},
++		{ &hf_nfapi_maximum_transmit_power_2,
++			{ "Maximum transmit power", "nfapi.maximum_transmit_power",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(max_transmit_power_2_conversion_fn), 0x0,
++			"The maximum transmit power for the PHY and RF operating at the configured bandwidth as defined in 3GPP TS 36.104.", HFILL }
++		},
++		{ &hf_nfapi_maximum_transmit_power,
++			{ "Maximum transmit power", "nfapi.maximum_transmit_power",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(max_transmit_power_conversion_fn), 0x0,
++			"The maximum transmit power for the RF chain operating at the maximum supported bandwidth as defined in 3GPP TS 36.104.", HFILL }
++		},
++		{ &hf_nfapi_earfcn,
++			{ "EARFCN", "nfapi.earfcn",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The EARFCN to be measured.", HFILL }
++		},
++		{ &hf_nfapi_number_of_rf_bands,
++			{ "Number of RF Bands", "nfapi.num.rf_bands",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of RF Band instances", HFILL }
++		},
++		{ &hf_nfapi_nmm_uplink_rssi_supported,
++			{ "NMM Uplink RSSI supported", "nfapi.nmm.uplink.rssi.supported",
++			FT_UINT8, BASE_DEC, VALS(ul_rssi_supported_vals), 0x0,
++			"Indicates if the uplink RSSI meausremnts are supported by NMM.", HFILL }
++		},
++		{ &hf_nfapi_minimum_transmit_power,
++			{ "Minimum transmit power", "nfapi.minimum_transmit_power",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(max_transmit_power_conversion_fn), 0x0,
++			"The minimum transmit power for the RF chain operating at the maximum supported bandwidth as defined in 3GPP TS 36.104.", HFILL }
++		},
++		{ &hf_nfapi_number_of_antennas_suppported,
++			{ "Number of Supported Antennas", "nfapi.number_of_antennas_suppported",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The maximum number of antennas supported.", HFILL }
++		},
++		{ &hf_nfapi_minimum_downlink_frequency,
++			{ "Minimum downlink frequency", "nfapi.minimum_downlink_frequency",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &khz_100_units_db, 0x0,
++			"The minimum supported downlink frequency in 100kHz units", HFILL }
++		},
++		{ &hf_nfapi_maximum_downlink_frequency,
++			{ "Maximum downlink frequency", "nfapi.maximum_downlink_frequency",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &khz_100_units_db, 0x0,
++			"The maximum supported downlink frequency in 100kHz units", HFILL }
++		},
++		{ &hf_nfapi_minimum_uplink_frequency,
++			{ "Minimum uplink frequency", "nfapi.minimum_downlink_frequency",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &khz_100_units_db, 0x0,
++			"The minimum supported uplink frequency in 100kHz units", HFILL }
++		},
++		{ &hf_nfapi_maximum_uplink_frequency,
++			{ "Maximum uplink frequency", "nfapi.maximum_downlink_frequency",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &khz_100_units_db, 0x0,
++			"The maximum supported uplink frequency in 100kHz units", HFILL }
++		},
++		{ &hf_nfapi_transmission_mode7_supported,
++			{ "Transmission Mode 7 Supported", "nfapi.pnf.phy_rel10.tx_mode7_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports TM7 for PDSCH", HFILL }
++		},
++		{ &hi_nfapi_transmission_mode8_supported,
++			{ "Transmission Mode 8 Supported", "nfapi.pnf.phy_rel10.tx_mode8_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports TM8 for PDSCH", HFILL }
++		},
++		{ &hi_nfapi_two_antennas_ports_for_pucch,
++			{ "Two antennas ports for PUCCH", "nfapi.pnf.phy_rel10.two_antennas_ports_for_pucch",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports PUCCH transmit diversity introduced in Release 10. Equivalent to two-AntennaPortsForPUCCH-r10 in TS36.306", HFILL }
++		},
++		{ &hi_nfapi_transmission_mode_9_supported,
++			{ "Transmission Mode 9 Supported", "nfapi.pnf.phy_rel10.tx_mode9_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports TM9 for PDSCH with 8 antennas and 8 CSI. Equivalent to tm9-With-8Tx-FDD-r10 in TS36.306", HFILL }
++		},
++		{ &hi_nfapi_simultaneous_pucch_pusch,
++			{ "Simultaneous PUCCH PUSCH", "nfapi.pnf.simultaneous_pucch_pusch",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports UE sending simultaneous PUCCH and PUSCH introduced in Release 10. Equivalent to simultaneousPUCCH-PUSCH-r10 in TS36.306", HFILL }
++		},
++		{ &hi_nfapi_four_layer_tx_with_tm3_and_tm4,
++			{ "Four layer Tx with TM3 and TM4", "nfapi.pnf.phy_rel10.layer_tx_with_tm3_and_tm4",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports four layer transmission for TM3 and TM4. Equivalent to fourLayerTM3-TM4-r10 in TS36.306", HFILL }
++		},
++		{ &hf_nfapi_epdcch_supported,
++			{ "ePDCCH supported", "nfapi.pnf.phy_rel11.epdcch_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports Enhanced PDCCH", HFILL }
++		},
++		{ &hi_nfapi_multi_ack_csi_reporting,
++			{ "Multi ACK CSI reporting", "nfapi.pnf.phy_rel11.mutli_ack_csi_reporting",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports the multi ACK and CSI reporting required with CA and mixed FDD/TDD carriers. Equivalent to multiACK-CSI-Reporting-r11 in TS36.306", HFILL }
++		},
++		{ &hi_nfapi_pucch_tx_diversity_with_channel_selection,
++			{ "PUCCH Tx diversity with channel selection", "nfapi.pnf.phy_rel11.tx_div_with_channel_selection",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports transmit diversity for PUCCH format 1b with channel selection. Equivalent to txDiv-PUCCH1b-ChSelect in TS36.306", HFILL }
++		},
++		{ &hi_nfapi_ul_comp_supported,
++			{ "UL CoMP supported", "nfapi.pnf.phy_rel11.ul_comp_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports UL CoMP", HFILL }
++		},
++		{ &hi_nfapi_transmission_mode_5_supported,
++			{ "Transmission mode 5 supported", "nfapi.pnf.phy_rel11.tx_mode5_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports TM5 for PDSCH", HFILL }
++		},
++		{ &hf_nfapi_csi_subframe_set,
++			{ "CSI subframe set", "nfapi.pnf.phy_rel12.csi_subframe_set",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Equivalent to csi-SubframeSet-r12 in TS36.306", HFILL }
++		},
++		{ &hi_nfapi_enhanced_4tx_codebook,
++			{ "Enhanced 4TX codebook", "nfapi.pnf.phy_rel12.exhanced_t4x_codebook",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports the enhanced 4TX codebook. Equivalent to enhanced-4TxCodebook-r12 in TS36.306", HFILL }
++		},
++		{ &hi_nfapi_drs_supported,
++			{ "DRS supported", "nfapi.pnf.phy_rel12.drs_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports the Discovery Reference Signal", HFILL }
++		},
++		{ &hi_nfapi_ul_64qam_supported,
++			{ "UL 64QAM supported", "nfapi.pnf.phy_rel12.ul_64qam_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY support 64 QAM in the uplink", HFILL }
++		},
++		{ &hi_nfapi_transmission_mode_10_supported,
++			{ "Transmission mode 10 supported", "nfapi.pnf.phy_rel12.tx_mode10_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports TM10 for PDSCH (DL CoMP)", HFILL }
++		},
++		{ &hi_nfapi_alternative_tbs_indices,
++			{ "Alternative TBS indices", "nfapi.pnf.phy_rel12.alternative_tbs_indices",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports the alternate TBS indices (256 QAM).  Equivalent to alternativeTBS-Indices-r12 in TS36.306", HFILL }
++		},
++		{ &hf_nfapi_pucch_format_4_supported,
++			{ "PUCCH format 4 supported", "nfapi.pnf.phy_rel13.pucch_format4_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports PUCCH format 4", HFILL }
++		},
++		{ &hf_nfapi_pucch_format_5_supported,
++			{ "PUCCH format 5 supported", "nfapi.pnf.phy_rel13.pucch_format5_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports PUCCH format 5", HFILL }
++		},
++		{ &hf_nfapi_more_than_5_ca_supported,
++			{ "More than 5 CA support", "nfapi.pnf.phy_rel13.mode_than_5_ca_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports features required for more than 5 CA support on PUSCH. Equivalent to uci-PUSCH-Ext-r13 in TS36.306", HFILL }
++		},
++		{ &hf_nfapi_laa_supported,
++			{ "LAA supported", "nfapi.pnf.phy_rel13.laa_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports DL LAA (subframe format 3)", HFILL }
++		},
++		{ &hf_nfapi_laa_ending_in_dwpts_supported,
++			{ "LAA ending in DwPTS supported", "nfapi.pnf.phy_rel13.laa_ending_in_dwpts_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports DL LAA ending in a DwPTS subframe. Equivalent to endingDwPTS-r13i n TS36.306", HFILL }
++		},
++		{ &hf_nfapi_laa_starting_in_second_slot_supported,
++			{ "LAA starting in second slot Supported", "nfapi.pnf.phy_rel13.laa_starting_in_second_slot_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports DL LAA starting in the second slot in a subframe. Equivalent to secondSlotStartingPosition-r13 in TS36.306", HFILL }
++		},
++		{ &hf_nfapi_beamforming_supported,
++			{ "Beamforming Supported", "nfapi.pnf.phy_rel13.beamingforming_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports beamforming (FD-MIMO Class B). Equivalent to beamformed-r13 in TS36.306", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_enhancements_supported,
++			{ "CSI-RS enhancements supported", "nfapi.pnf.phy_rel13.csi_rs_enchancements_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports CSI-RS enhancements (FD-MIMO Class A). Equivalent to csi-RS-EnhancementsTDD-r13 in TS36.306", HFILL }
++		},
++		{ &hf_nfapi_drms_enhancements_supported,
++			{ "DMRS enhancements supported", "nfapi.pnf.phy_rel13.drms_enhancements_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports DMRS enhancements added in Release 13. Equivalent to dmrs-Enhancements-r13 in TS36.306", HFILL }
++		},
++		{ &hf_nfapi_srs_enhancements_supported,
++			{ "SRS enhancements supported", "nfapi.pnf.phy_rel13.srs_enhancements_supported",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates if PHY supports SRS enhancements added in Release 13. Equivalent to srs-Enhancements-r13in TS36.306", HFILL }
++		},
++		{ &hf_nfapi_sfn_sf,
++			{ "SFN_SF", "nfapi.sfn_sf",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(sfn_sf_conversion_fn), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_number_pdcch_ofdm_symbols,
++			{ "Number of PDCCH OFDM Symbols", "nfapi.number_pdcch_ofdm_symbols",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of OFDM symbols for the PDCCH", HFILL }
++		},
++		{ &hf_nfapi_number_dci,
++			{ "Number of DCI", "nfapi.number_dci",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of DCI PDUs included in this message", HFILL }
++		},
++		{ &hf_nfapi_number_pdus,
++			{ "Number of PDUs", "nfapi.number_pdu",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of PDUs that are included in this message", HFILL }
++		},
++		{ &hf_nfapi_number_of_harqs,
++			{ "Number of HARQs", "nfapi.number_harqs",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of HARQs included in this message", HFILL }
++		},
++		{ &hf_nfapi_number_of_crcs,
++			{ "Number of CRCs", "nfapi.number_crcs",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of CRCs included in this message", HFILL }
++		},
++		{ &hf_nfapi_number_of_srs,
++			{ "Number of SRs", "nfapi.number_srs",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of SRs included in this message", HFILL }
++		},
++		{ &hf_nfapi_number_of_cqi,
++			{ "Number of CQIs", "nfapi.number_cqi",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of CQIs included in this message", HFILL }
++		},
++		{ &hf_nfapi_number_of_preambles,
++			{ "Number of Preambles", "nfapi.number_preambles",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of RACH preambles", HFILL }
++		},
++		{ &hf_nfapi_number_of_srss,
++			{ "Number of SRSs", "nfapi.number_srss",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Number of UEs contributing to the uplink SRS", HFILL }
++		},
++		{ &hf_nfapi_lbt_dl_req_pdu_type,
++			{ "LBT DL Request PDU Type", "nfapi.number_srss",
++			FT_UINT16, BASE_DEC, VALS(nfapi_lbt_dl_req_pdu_type), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_lbt_dl_ind_pdu_type,
++			{ "LBT DL Indication PDU Type", "nfapi.number_srss",
++			FT_UINT16, BASE_DEC, VALS(nfapi_lbt_dl_ind_pdu_type), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_number_pdsch_rnti,
++			{ "Number of PDSCH RNTI", "nfapi.number_pdsch_rnti",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of unique RNTIs sent on the PDSCH", HFILL }
++		},
++		{ &hf_nfapi_transmission_power_pcfich,
++			{ "Transmission Power PCFICH", "nfapi.transmission_power_pcfich",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(power_offset_conversion_fn), 0x0,
++			"Offset to the reference signal power.", HFILL }
++		},
++		{ &hf_nfapi_dl_config_pdu_type,
++			{ "PDU Type", "nfapi.pdu.type",
++			FT_UINT8, BASE_DEC, VALS(nfapi_dl_config_pdu_type_vals), 0x0,
++			"DL_CONFIG.request PDU Type", HFILL }
++		},
++		{ &hf_nfapi_pdu_size,
++			{ "PDU size", "nfapi.pdu.size",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Size of the PDU control information (in bytes). This length value includes the 2 bytes required for the PDU type and PDU size parameters", HFILL }
++		},
++		{ &hf_nfapi_instance_length,
++			{ "Instance length", "nfapi.instance.length",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The Length in bytes of all TLVs within this instance", HFILL }
++		},
++		{ &hf_nfapi_length,
++			{ "PDU length", "nfapi.pdu.length",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Length of PDU in bytes.", HFILL }
++		},
++		{ &hf_nfapi_pdu_index,
++			{ "PDU Index", "nfapi.pdu.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PDU index parameter specified for each PDU", HFILL }
++		},
++		{ &hf_nfapi_rnti,
++			{ "RNTI", "nfapi.rnti",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The RNTI used for identifying the UE when receiving the PDU", HFILL }
++		},
++		{ &hf_nfapi_resource_allocation_type,
++			{ "Resource Allocation Type", "nfapi.resource.allocation.type",
++			FT_UINT8, BASE_DEC, VALS(resource_allocation_type_vals), 0x0,
++			"Resource allocation type/header Valid for DCI formats : 1, 2, 2A, 2B, 2C, 2D", HFILL }
++		},
++		{ &hf_nfapi_virtual_resource_block_assignment_flag,
++			{ "Virtual resource block assignment flag", "nfapi.resource.block.assignment.flag",
++			FT_UINT8, BASE_DEC, VALS(local_distributed_vals), 0x0,
++			"Type of virtual resource block used Valid for DCI formats : 1A, 1B, 1D", HFILL }
++		},
++		{ &hf_nfapi_resource_block_coding,
++			{ "Resource block coding", "nfapi.resource.block.coding",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"The encoding for the resource blocks. The coding is dependent on whether resource allocation type 0, 1, 2 is in use", HFILL }
++		},
++		{ &hf_nfapi_modulation,
++			{ "Modulation", "nfapi.modulation",
++			FT_UINT8, BASE_DEC, VALS(modulation_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_redundancy_version,
++			{ "Redundancy version", "nfapi.redundancy.version",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"HARQ redundancy version", HFILL }
++		},
++		{ &hf_nfapi_transport_blocks,
++			{ "Transport blocks", "nfapi.transport.blocks",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The transport block transmitted to this RNTI", HFILL }
++		},
++		{ &hf_nfapi_transport_block_to_codeword_swap_flag,
++			{ "Transport block to codeword swap flag", "nfapi.transport.block.to.codeword.swap.flag",
++			FT_UINT8, BASE_DEC, VALS(transport_block_to_codeword_swap_flag_vals), 0x0,
++			"Indicates the mapping of transport block to codewords.", HFILL }
++		},
++		{ &hf_nfapi_transmission_scheme,
++			{ "Transmission scheme", "nfapi.transmission.scheme",
++			FT_UINT8, BASE_DEC, VALS(transmission_scheme_vals), 0x0,
++			"The MIMO mode used in the PDU", HFILL }
++		},
++		{ &hf_nfapi_ul_transmission_scheme,
++			{ "Transmission scheme", "nfapi.transmission.scheme",
++			FT_UINT8, BASE_DEC, VALS(ul_transmission_scheme_vals), 0x0,
++			"The MIMO mode used in the PDU", HFILL }
++		},
++		{ &hf_nfapi_number_of_layers,
++			{ "Number of layers", "nfapi.number.of.layers",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of layers used in transmission", HFILL }
++		},
++		{ &hf_nfapi_number_of_subbands,
++			{ "Number of subbands", "nfapi.number.of.subbands",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Only valid when transmission scheme = 3, 4, 5. Defines the number of subbands and "
++			"codebooks used for PMI.If value = 1 then a single PMI value is supplied which should be used over all RB", HFILL }
++		},
++		{ &hf_nfapi_codebook_index,
++			{ "Codebook index", "nfapi.number.of.codebook.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Only valid when transmission scheme = 3, 4, 5. Defines the codebook used.", HFILL }
++		},
++		{ &hf_nfapi_ue_category_capacity,
++			{ "UE category capacity", "nfapi.ue.category.capacity",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The UE capabilities category", HFILL }
++		},
++		{ &hf_nfapi_pa,
++			{ "P-A", "nfapi.pa",
++			FT_UINT8, BASE_DEC, VALS(pa_vals), 0x0,
++			"The ratio of PDSCH EPRE to cell-specific RS EPRE among PDSCH REs in all the OFDM symbols not containing cell-specific RS in dB.", HFILL }
++		},
++		{ &hf_nfapi_delta_power_offset_index,
++			{ "Delta Power offset index", "nfapi.delta.power.offset.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Delta power offset, value: 0..1", HFILL }
++		},
++		{ &hf_nfapi_nprb,
++			{ "Nprb", "nfapi.nprb",
++			FT_UINT8, BASE_DEC, VALS(nprb_vals), 0x0,
++			"Used with DCI format 1A and RNTI=SI-RNTI or RA-RNTI. This should match the value sent in the TPC field of the DCI 1A PDU which allocated this grant.", HFILL }
++		},
++		{ &hf_nfapi_transmission_mode,
++			{ "Transmission Mode", "nfapi.transmission_nprb",
++			FT_UINT8, BASE_DEC, VALS(transmission_mode_vals), 0x0,
++			"Transmission mode associated with the UE", HFILL }
++		},
++		{ &hf_nfapi_prnti,
++			{ "P-RNTI", "nfapi.prnti",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The P-RNTI associated with the paging", HFILL }
++		},
++		{ &hf_nfapi_mcs,
++			{ "MCS", "nfapi.mcs",
++			FT_UINT8, BASE_DEC, VALS(pch_modulation_vals), 0x0,
++			"The modulation and coding scheme for the transport block", HFILL }
++		},
++		{ &hf_nfapi_number_of_transport_blocks,
++			{ "Number of transport blocks", "nfapi.number_of_transport_blocks",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of transport blocks transmitted to this RNTI", HFILL }
++		},
++		{ &hf_nfapi_ue_mode,
++			{ "UE Mode", "nfapi.ue.mode",
++			FT_UINT8, BASE_DEC, VALS(ue_mode_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_prs_bandwidth,
++			{ "PRS bandwidth", "nfapi.prs.bandwidth",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"PRS bandwidth in resource blocks.", HFILL }
++		},
++		{ &hf_prs_cyclic_prefix_type,
++			{ "PRS cyclic prefix type", "nfapi.prs.cyclic.prefix.type",
++			FT_BOOLEAN, 8, TFS(&prs_cyclic_prefix_type_strname), 0x0,
++			"The cyclic prefix used for PRS transmission", HFILL }
++		},
++		{ &hf_prs_muting,
++			{ "PRS muting", "nfapi.prs.muting",
++			FT_BOOLEAN, 8, TFS(&prs_muting_strname), 0x0,
++			"PRS muting dictates if PRS REs are vacant (prsMutingInfo-r9 indicates the SF occasions)", HFILL }
++		},
++		{ &hf_nfapi_num_bf_prb_per_subband,
++			{ "Num of BF PRB per Subband", "nfapi.num.bf.prb.per.subband",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of PRBs that are treated as one subband", HFILL }
++		},
++		{ &hf_nfapi_num_bf_vector,
++			{ "Num of BF Vector", "nfapi.num.bf.vector",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of beam forming vectors. One beam forming vector is specified for each subband", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_resource_config,
++			{ "CSI-RS resource config", "nfapi.csi.rs.resource.config",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates reference signal configuration for CSI-RS", HFILL }
++		},
++		{ &hf_nfapi_bf_vector_subband_index,
++			{ "BF Subband Index", "nfapi.num.bf.vector.subband.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Index of subband for which the following beam forming vector is applied", HFILL }
++		},
++		{ &hf_nfapi_bf_vector_num_antennas,
++			{ "BF Num of Antennas", "nfapi.num.bf.vector.bf.value",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of physical antennas", HFILL }
++		},
++		{ &hf_nfapi_bf_vector_bf_value,
++			{ "BF Value per Antenna", "nfapi.num.bf.vector.bf.value",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Beam forming vector element for physical antenna #i real 8 bits followed by imaginary 8 bits", HFILL }
++		},
++		{ &hf_nfapi_nscid,
++			{ "NSC id", "nfapi.nscid",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Used with DCI format 2B and 2C.", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_flag,
++			{ "CSI RS Flag", "nfapi.csi.rs.flag",
++			FT_BOOLEAN, 8, TFS(&csi_rs_flags_strname), 0x0,
++			"Indicates if parameters related to CSI-RS are valid or not.", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_resource_config_r10,
++			{ "CSI RS resource config R10", "nfapi.csi.rs.resource_config_r10",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"This value is deprecated", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_zero_tx_power_resource_config_bitmap_r10,
++			{ "CSI-RS Number of NZP configuration", "nfapi.csi.rs.num.of.nzp.configurations",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Bitmap of 16 bits. Encoding format of bitmap follows section 6.10.5.2 of 36.211", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_number_of_nzp_configurations,
++			{ "CSI RS zero Tx Power Resource config bitmap R10", "nfapi.csi.rs.zero.tx.power.resource.config.bitmap.r10",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates the number of Non-Zero power CSI-RS configurations.", HFILL }
++		},
++		{ &hf_nfapi_pdsch_start,
++			{ "PDSCH_start", "nfapi.pdsch.start",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Per UE starting OFDM symbol for the PDSCH, impacts the mapping of PDSCH to REs", HFILL }
++		},
++		{ &hf_nfapi_drms_config_flag,
++			{ "DMRS Config flag", "nfapi.drms.config.flag",
++			FT_UINT8, BASE_DEC, VALS(not_used_enabled_vals), 0x0,
++			"Indicates if the DMRS Config parameter is valid", HFILL }
++		},
++		{ &hf_nfapi_drms_scrambling,
++			{ "DMRS Scrambling", "nfapi.drms.scrambling",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The scrambling identity for UE specific reference signals.", HFILL }
++		},
++		{ &hf_nfapi_csi_config_flag,
++			{ "CSI Config flag", "nfapi.csi.config.flag",
++			FT_UINT8, BASE_DEC, VALS(not_used_enabled_vals), 0x0,
++			"Indicates if the CSI Config parameter is valid", HFILL }
++		},
++		{ &hf_nfapi_csi_scrambling,
++			{ "CSI Scrambling", "nfapi.csi.scrambling",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The scrambling identity for CSI.", HFILL }
++		},
++		{ &hf_nfapi_pdsch_re_mapping_flag,
++			{ "PDSCH RE mapping flag", "nfapi.pdsch.remapping.flag",
++			FT_UINT8, BASE_DEC, VALS(not_used_enabled_vals), 0x0,
++			"Indicates if the PDSCH RE parameters are valid.", HFILL }
++		},
++		{ &hf_nfapi_pdsch_re_mapping_antenna_ports,
++			{ "PDSCH RE mapping antenna ports", "nfapi.pdsch.remapping.antenna.ports",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates number of antennas used for PDSCH RE mapping", HFILL }
++		},
++		{ &hf_nfapi_pdsch_re_mapping_freq_shift,
++			{ "PDSCH RE mapping freq shift", "nfapi.pdsch.remapping.freq.shift",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the frequency shift used for PDSCH RE mapping.", HFILL }
++		},
++		{ &hf_nfapi_alt_cqi_table_r12,
++			{ "altCQI-Table-r12", "nfapi.alt.cqi.table.r12",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"altCQI-Table-r12 is indicative of using an alternative MCS table for UEs supporting 256QAM."
++			"This is taken into account  for calculation of soft buffer size for the transport block", HFILL }
++		},
++		{ &hf_nfapi_max_layers,
++			{ "MaxLayers", "nfapi.max.layers",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Maximal number of negotiated / configured layers for a UE, used for the calculation of soft buffer size for the transport block", HFILL }
++		},
++		{ &hf_nfapi_n_dl_harq,
++			{ "N_DL_HARQ", "nfapi.n.dl.harq",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dwpts_symbols,
++			{ "DwPTS Symbols", "nfapi.dwpts.symbols",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Valid if DCI format 1C is being used to signal LAA end partial SF. Indicates the number of starting symbols according to 36.213 Table  13-A-1", HFILL }
++		},
++		{ &hf_nfapi_initial_lbt_sf,
++			{ "Initial LBT SF", "nfapi.initial.lbt.sf",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if the DCI PDU is prepared for full SF (regular) or for initial partial SF (2nd slot) according to [11] section 6.2.4 (if PDCCH) or 6.2.4A (if ePDCCH)", HFILL }
++		},
++		{ &hf_nfapi_ue_type,
++			{ "UE Type", "nfapi.ue.type",
++			FT_UINT8, BASE_DEC, VALS(dlsch_re13_ue_type_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_pdsch_payload_type,
++			{ "PDSCH Payload Type", "nfapi.pdsch.payload.type",
++			FT_UINT8, BASE_DEC, VALS(dlsch_re13_pdsch_payload_type_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_initial_transmission_sf,
++			{ "Initial transmission SF (io)", "nfapi.init.tx.sf.io",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Absolute Sub-Frame  of the initial transmission", HFILL }
++		},
++		{ &hf_nfapi_req13_drms_table_flag,
++			{ "Rel-13-DMRS-tabe flag", "nfapi.r13.drms.table.flag",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if Release 13 DMRS table is used.", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_resource_index,
++			{ "CSI-RS resource index", "nfapi.csi.rs.resource.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Index of the CSI-RS resource. This is included to link bfValues to CSI-RS resources included in Release 10 parameters.", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_class,
++			{ "Class", "nfapi.csi.rs.class",
++			FT_UINT8, BASE_DEC, VALS(csi_rs_class_vals), 0x0,
++			"Indicates CSI-RS class", HFILL }
++		},
++		{ &hf_nfapi_cdm_type,
++			{ "CDM Type", "nfapi.cdm.type",
++			FT_UINT8, BASE_DEC, VALS(csi_rs_cdm_type_vals), 0x0,
++			"Indicates CDM type for CSI-RS. See [36.211] section 6.10.5.2. Valid for Class A", HFILL }
++		},
++		{ &hf_nfapi_edpcch_prb_index,
++			{ "EPDCCH PRB index", "nfapi.edpcch.prb.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"PRB index", HFILL }
++		},
++		{ &hf_nfapi_epdcch_resource_assignment_flag,
++			{ "EPDCCH Resource assignment flag", "nfapi.epdcch.resource.assignment.flag",
++			FT_UINT8, BASE_DEC, VALS(local_distributed_vals), 0x0,
++			"Type of virtual resource block used", HFILL }
++		},
++		{ &hf_nfapi_epdcch_id,
++			{ "EPDCCH ID", "nfapi.epdcch.id",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"EPDCCH index- used for the scrambler initiation The DMRS scrambling sequence initialization parameter defined in[11] section 6.10.3A.1", HFILL }
++		},
++		{ &hf_nfapi_epdcch_start_symbol,
++			{ "EPDCCH Start Symbol", "nfapi.epdcch.start.symbol",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the OFDM starting symbol for any EPDCCH and PDSCH", HFILL }
++		},
++		{ &hf_nfapi_epdcch_num_prb,
++			{ "EPDCCH NumPRB", "nfapi.epdcch.num.prb",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of PRBs allocated for EPDCCH", HFILL }
++		},
++		{ &hf_nfapi_precoding_value,
++			{ "Precoding value", "nfapi.precoding.value",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Precoding element for physical antenna #i real 8 bits followed by imaginary 8 bits", HFILL }
++		},
++		{ &hf_nfapi_mpdcch_narrowband,
++			{ "MPDCCH Narrowband", "nfapi.mpdcch.narrowband",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Narrowband for MPDCCH", HFILL }
++		},
++		{ &hf_nfapi_number_of_prb_pairs,
++			{ "Number of PRB pairs", "nfapi.number.prb.pairs",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of PRB-pairs constituting the MPDCCH-PRB-pair set", HFILL }
++		},
++		{ &hf_nfapi_resource_block_assignment,
++			{ "Resource Block Assignment", "nfapi.resource.block.assignement",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Combinational index r", HFILL }
++		},
++		{ &hf_nfapi_start_symbol,
++			{ "Start symbol", "nfapi.start.symbol",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ecce_index,
++			{ "ECCE index", "nfapi.ecce.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"CCE index used to send the DCI", HFILL }
++		},
++		{ &hf_nfapi_ce_mode,
++			{ "CE Mode", "nfapi.ce.mode",
++			FT_UINT8, BASE_DEC, VALS(ce_mode_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_drms_scrabmling_init,
++			{ "DMRS scrambling init", "nfapi.drms.scrambling.init",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The DMRS scrambling sequence initialization parameter defined in [11] section 6.10.3A.1", HFILL }
++		},
++		{ &hf_nfapi_pdsch_reception_levels,
++			{ "PDSCH repetition levels", "nfapi.pdsch.repetition.levels",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Valid for DCI formats: 6-0A, 6-0B", HFILL }
++		},
++		{ &hf_nfapi_new_data_indicator,
++			{ "New data indicator", "nfapi.new.data.indicator",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The new data indicator for the transport block", HFILL }
++		},
++		{ &hf_nfapi_tpmi_length,
++			{ "TPMI length", "nfapi.tpmi.length",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Length of 'TPMI' field in units of bits", HFILL }
++		},
++		{ &hf_nfapi_pmi_flag,
++			{ "PMI flag", "nfapi.pmi.flag",
++			FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x0,
++			"Indicates if 'PMI' field is present", HFILL }
++		},
++		{ &hf_nfapi_harq_resource_offset,
++			{ "HARQ resource offset", "nfapi.harq.resource.offset",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"HARQ-ACK resource offset used", HFILL }
++		},
++		{ &hf_nfapi_dci_subframe_repetition_number,
++			{ "DCI subframe repetition number", "nfapi.dci.subframe.repetition.number",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the number of MPDCCH repetitions", HFILL }
++		},
++		{ &hf_nfapi_downlink_assignment_index_length,
++			{ "Downlink assignment index Length", "nfapi.dl.assignement.index.length",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Length of Downlink assignment index field in units of bits.", HFILL }
++		},
++		{ &hf_nfapi_starting_ce_level,
++			{ "Starting CE Level", "nfapi.starting.ce.level",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"2 bits provide the PRACH starting CE level", HFILL }
++		},
++		{ &hf_nfapi_antenna_ports_and_scrambling_identity_flag,
++			{ "Antenna ports and scrambling identity flag", "nfapi.antenna.ports.and.scrambling.identity.flag",
++			FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x0,
++			"Indicates if 'Antenna ports and scrambling identity' field is present.", HFILL }
++		},
++		{ &hf_nfapi_antenna_ports_and_scrambling_identity,
++			{ "Antenna ports and scrambling identity", "nfapi.antenna.ports.and.scrambling.identit",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the Antenna port and, scrambling identity value", HFILL }
++		},
++		{ &hf_nfapi_paging_direct_indication_differentiation_flag,
++			{ "Paging/Direct indication differentiation flag", "nfapi.paging.direct.indictation.differentiation.flag",
++			FT_UINT8, BASE_DEC, VALS(paging_direct_indication_differtiation_flag_vals), 0x0,
++			"Valid for DCI format 6-2", HFILL }
++		},
++		{ &hf_nfapi_direct_indication,
++			{ "Direct indication", "nfapi.direct.indication",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Valid for DCI format 6-2", HFILL }
++		},
++		{ &hf_nfapi_number_of_tx_antenna_ports,
++			{ "Number of TX Antenna ports", "nfapi.num.of.tx.antenna.ports.",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of TX physical antenna ports", HFILL }
++		},
++		{ &hf_nfapi_transmission_power,
++			{ "Transmission Power", "nfapi.transmission_power",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(power_offset_conversion_fn), 0x0,
++			"Offset to the reference signal power.", HFILL }
++		},
++		{ &hf_nfapi_mbsfn_area_id,
++			{ "MBSFN Area id", "nfapi.mbsfn.area.id",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates MBSFN area ID", HFILL }
++		},
++		{ &hf_nfapi_dl_dci_format,
++			{ "DL DCI format", "nfapi.dl.dci.format",
++			FT_UINT8, BASE_DEC, VALS(dl_dci_format_vals), 0x0,
++			"Format of the DL DCI", HFILL }
++		},
++		{ &hf_nfapi_ul_dci_format,
++			{ "UL DCI format", "nfapi.ul_dci.format",
++			FT_UINT8, BASE_DEC, VALS(ul_dci_format_vals), 0x0,
++			"Format of the UL DCI", HFILL }
++		},
++		{ &hf_nfapi_mpdcch_ul_dci_format,
++			{ "UL DCI format", "nfapi.mpdcch.ul_dci.format",
++			FT_UINT8, BASE_DEC, VALS(mpdcch_ul_dci_format_vals), 0x0,
++			"Format of the UL DCI", HFILL }
++		},
++		{ &hf_nfapi_cce_idx,
++			{ "CCE index", "nfapi.cce.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"CCE index used to send the DCI", HFILL }
++		},
++		{ &hf_nfapi_aggregation_level,
++			{ "Aggregation level", "nfapi.aggregation.level",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The aggregation level used", HFILL }
++		},
++		{ &hf_nfapi_mcs_1,
++			{ "MCS_1", "nfapi.mcs_1",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The modulation and coding scheme for 1st transport block", HFILL }
++		},
++		{ &hf_nfapi_mcs_2,
++			{ "MCS_2", "nfapi.mcs_2",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The modulation and coding scheme for 2nd transport block", HFILL }
++		},
++		{ &hf_nfapi_redundancy_version_1,
++			{ "Redundancy version_1", "nfapi.redundancy.version.1",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The redundancy version for 1st transport block.", HFILL }
++		},
++		{ &hf_nfapi_redundancy_version_2,
++			{ "Redundancy version_2", "nfapi.redundancy.version.2",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The redundancy version for 2nd transport block", HFILL }
++		},
++		{ &hf_nfapi_new_data_indicator_1,
++			{ "New data indicator_1", "nfapi.new.data.indicator.1",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The new data indicator for 1st transport block.", HFILL }
++		},
++		{ &hf_nfapi_new_data_indicator_2,
++			{ "New data indicator_2", "nfapi.new.data.indicator.2",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The new data indicator for 2nd transport block.", HFILL }
++		},
++		{ &hf_nfapi_harq_process,
++			{ "HARQ process", "nfapi.harq.process",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"HARQ process number", HFILL }
++		},
++		{ &hf_nfapi_tpmi,
++			{ "TPMI", "nfapi.tpmi",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The codebook index to be used for precoding", HFILL }
++		},
++		{ &hf_nfapi_pmi,
++			{ "PMI", "nfapi.pmi",
++			FT_UINT8, BASE_DEC, VALS(pmi_vals), 0x0,
++			"Confirmation for precoding", HFILL }
++		},
++		{ &hf_nfapi_precoding_information,
++			{ "Precoding information", "nfapi.precoding.information",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_tpc,
++			{ "TPC", "nfapi.tpc",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Tx power control command for PUCCH", HFILL }
++		},
++		{ &hf_nfapi_downlink_assignment_index,
++			{ "Downlink assignment index", "nfapi.downlink.assignment.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The downlink assignment index. In release 8-11 this is only used in TDD mode, "
++			"value ignored for FDD. In release 12 or later a field indicating the structure "
++			"type of the primary cell is used to determine if this is valid with size 2 bits."
++			"In release 13 or later a field indicating codebooksizeDetermination - r13 = 0 is "
++			"used to determine is this field is valid with size 4 bits", HFILL }
++		},
++		{ &hf_nfapi_ngap,
++			{ "Ngap", "nfapi.ngap",
++			FT_UINT8, BASE_DEC, VALS(ngap_vals), 0x0,
++			"Used in virtual resource block distribution", HFILL }
++		},
++		{ &hf_nfapi_transport_block_size_index,
++			{ "Transport block size index", "nfapi.transport.block.size.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The transport block size", HFILL }
++		},
++		{ &hf_nfapi_downlink_power_offset,
++			{ "Downlink power offset", "nfapi.downlink.power.offset",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the DL power offset type for multi-user MIMO transmission", HFILL }
++		},
++		{ &hf_nfapi_allocate_prach_flag,
++			{ "Allocation PRACH flag", "nfapi.allocation.prach.flag",
++			FT_UINT8, BASE_DEC, VALS(true_false_vals), 0x0,
++			"Indicates that PRACH procedure is initiated", HFILL }
++		},
++		{ &hf_nfapi_preamble_index,
++			{ "Preamble index", "nfapi.preamable.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The preamble index to be used on the PRACH", HFILL }
++		},
++		{ &hf_nfapi_prach_mask_index,
++			{ "PRACH mask index", "nfapi.prach.mask.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The mask index to be used on the PRACH", HFILL }
++		},
++		{ &hf_nfapi_rnti_type,
++			{ "RNTI type", "nfapi.rnti.type",
++			FT_UINT8, BASE_DEC, VALS(rnti_type_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_mpdcch_rnti_type,
++			{ "RNTI type", "nfapi.mpdcch.rnti.type",
++			FT_UINT8, BASE_DEC, VALS(mpdcch_rnti_type_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_mcch_flag,
++			{ "MCCH flag", "nfapi.mcch.flag",
++			FT_BOOLEAN, BASE_NONE, TFS(&mcch_flag_string_name), 0x0,
++			"Indicates if format 1C is being used to signal a MCCH or SC-MCCH change notification", HFILL }
++		},
++		{ &hf_nfapi_mcch_change_notification,
++			{ "MCCH change notification", "nfapi.mcch.change.notification",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"MCCH or SC-MCCH Change Notification", HFILL }
++		},
++		{ &hf_nfapi_scrambling_identity,
++			{ "Scrambling identity", "nfapi.scrambling.identity",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the scrambling identity value NSCID", HFILL }
++		},
++		{ &hf_nfapi_cross_carrier_scheduling_flag,
++			{ "Cross Carrier scheduling flag", "nfapi.cross.carrier.scheduling.flag",
++			FT_BOOLEAN, 8, TFS(&cross_carrier_scheduling_flag_strname), 0x0,
++			"Indicates if cross carrier scheduling has been enabled for the UE receiving this DCI", HFILL }
++		},
++		{ &hf_nfapi_carrier_indicator,
++			{ "Carrier Indicator", "nfapi.carrier.indicator",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Serving Cell Index", HFILL }
++		},
++		{ &hf_nfapi_srs_flag,
++			{ "SRS flag", "nfapi.srs.flag",
++			FT_BOOLEAN, 8, TFS(&srs_flag_strname), 0x0,
++			"Indicates if the SRS request parameter is valid", HFILL }
++		},
++		{ &hf_nfapi_srs_request,
++			{ "SRS request", "nfapi.srs.request",
++			FT_BOOLEAN, 8, TFS(&srs_request_strname), 0x0,
++			"SRS request flag", HFILL }
++		},
++		{ &hf_nfapi_antenna_ports_scrambling_and_layers,
++			{ "Antenna ports scrambling and layers", "nfapi.antenna.ports.scrambling.and.layers",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the Antenna port, scrambling identity value NSCID and number of layers", HFILL }
++		},
++		{ &hf_nfapi_total_dci_length_including_padding,
++			{ "Total DCI length including padding", "nfapi.total.dci.length.including.padding",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The total DCI length including padding bits", HFILL }
++		},
++		{ &hf_nfapi_n_ul_rb,
++			{ "N_UL_RB", "nfapi.n.dl.rb",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"BW of serving cell for which the DCI was scheduled for.  This is valid for "
++			"the case of cross carrier scheduling, for the case of a self - "
++			"scheduling(cross carrier scheduling is not valid or Carrier indicator has value '0', "
++			"the BW is the 'DL BW support' as configured in configuration phase(params) "
++			"Uplink channel bandwidth in resource blocks", HFILL }
++		},
++		{ &hf_nfapi_harq_ack_resource_offset,
++			{ "HARQ-ACK resource offset", "nfapi.harq.ack.resource.offset",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"HARQ-ACK resource offset field is present only when this format is carried by EPDCCH.", HFILL }
++		},
++		{ &hf_nfapi_pdsch_re_mapping_and_quasi_co_location_indicator,
++			{ "PDSCH RE Mapping and Quasi-Co-Location Indicator", "nfapi.pdsch.re.mapping",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the parameter set configured by the higher layers which the UE should use.", HFILL }
++		},
++		{ &hf_nfapi_primary_cell_type,
++			{ "Primary cell type", "nfapi.primary.cell.type",
++			FT_UINT8, BASE_DEC, VALS(primary_cells_type_vals), 0x0,
++			"Indicates the type of the primary cell.", HFILL }
++		},
++		{ &hf_nfapi_ul_dl_configuration_flag,
++			{ "UL/DL configuration flag", "nfapi.ul.dl.configuration.flag",
++			FT_BOOLEAN, 8, TFS(&ul_dl_configuration_flag_strname), 0x0,
++			"Indicates if format 1C is being used to signal UL/DL configuration", HFILL }
++		},
++		{ &hf_nfapi_number_of_ul_dl_configurations,
++			{ "Number of UL/DL configurations", "nfapi.number.ul.dl.configurations",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_dl_configuration_index,
++			{ "UL/DL configuration indication", "nfapi.ul.dl.configuration.indication",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"UL/DL configuration index", HFILL }
++		},
++		{ &hf_nfapi_laa_end_partial_sf_flag,
++			{ "LAA end partial SF flag", "nfapi.laa.end.partial.sf.flag",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if DCI format 1C is being used to signal LAA end partial SF (valid if end partial SF support configuraton is set)", HFILL }
++		},
++		{ &hf_nfapi_laa_end_partial_sf_configuration,
++			{ "LAA end partial SF configuration", "nfapi.laa.end.partial.sf.configuration",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"If DCI format 1C scrambled by CC - RNTI is used to signal end partial SF, this field "
++			"contains LAA common information (4 bits used in [9] Table 13A-1 for configuration of "
++			"occupied OFDM symbols for current and next SF)", HFILL }
++		},
++		{ &hf_nfapi_codebooksize_determination_r13,
++			{ "Codebook Size Determination R13", "nfapi.codebook.size.determination.r13",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if the downlink assignment index parameter (DAI) is 4 bits", HFILL }
++		},
++		{ &hf_nfapi_rel13_drms_table_flag,
++			{ "Rel-13-DMRS-tabe flag", "nfapi.drms.table.flag.r13",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if Release 13 DMRS table for be used", HFILL }
++		},
++		{ &hf_nfapi_pscch_resource,
++			{ "PSCCH Resource", "nfapi.pscch.resource",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"6-bits describing the resource blocks for transmitting PSCCH", HFILL }
++		},
++		{ &hf_nfapi_time_resource_pattern,
++			{ "Time resource pattern", "nfapi.time.resource.pattern",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"7-bits describing the time resource pattern index", HFILL }
++		},
++		{ &hf_nfapi_mpdcch_transmission_type,
++			{ "MPDCCH transmission type", "nfapi.mpdcch.transmission.type",
++			FT_UINT8, BASE_DEC, VALS(local_distributed_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_drms_scrambling_init,
++			{ "DMRS scrambling init", "nfapi.drms.scrambling.init",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The DMRS scrambling sequence initialization", HFILL }
++		},
++		{ &hf_nfapi_pusch_repetition_levels,
++			{ "PUSCH repetition levels", "nfapi.pusch.repetition.levels",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Valid for DCI formats: 6-0A, 6-0B", HFILL }
++		},
++		{ &hf_nfapi_frequency_hopping_flag,
++			{ "Frequency hopping flag", "nfapi.frequency.hopping.flag",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if hopping is being used.", HFILL }
++		},
++		{ &hf_nfapi_csi_request,
++			{ "CSI request", "nfapi.csi.request",
++			FT_UINT8, BASE_DEC, VALS(csi_request_vals), 0x0,
++			"Aperiodic CSI request flag", HFILL }
++		},
++		{ &hf_nfapi_dai_presence_flag,
++			{ "DAI presence flag", "nfapi.dia.presence.flag",
++			FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x0,
++			"Indicates if DL assignment index field is present in the DCI", HFILL }
++		},
++		{ &hf_nfapi_total_dci_length_include_padding,
++			{ "Total DCI length including padding", "nfapi.total.dci.length.including.padding",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The total DCI length including padding bits", HFILL }
++		},
++		{ &hf_nfapi_csi_rs_antenna_port_count_r10,
++			{ "CSI-RS antenna port count r10", "nfapi.csi.rs.antenna.port.count.r10",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates number of antennas used for transmission of CSI reference signal.", HFILL }
++		},
++		{ &hf_nfapi_ul_config_pdu_type,
++			{ "UL Config PDU Type", "nfapi.ul.config.pdu.type",
++			FT_UINT8, BASE_DEC, VALS(nfapi_ul_config_pdu_type_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_rach_prach_frequency_resources,
++			{ "RACH PRACH Frequency resources", "nfapi.rach.prach.frequency.resources",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"If semi-static information is held in the MAC", HFILL }
++		},
++		{ &hf_nfapi_srs_present,
++			{ "SRS present", "nfapi.srs.present",
++			FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x0,
++			"If semi-static information is held in the MAC", HFILL }
++		},
++		{ &hf_nfapi_handle,
++			{ "Handle", "nfapi.handle",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"An opaque handle", HFILL }
++		},
++		{ &hf_nfapi_pucch_index,
++			{ "PUCCH Index", "nfapi.pucch.index",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PUCCH index value", HFILL }
++		},
++		{ &hf_nfapi_size,
++			{ "Size", "nfapi.size",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The size of the ULSCH PDU in bytes as defined by the relevant UL grant", HFILL }
++		},
++		{ &hf_nfapi_resource_block_start,
++			{ "Resource block start", "nfapi.resource.block.start",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The starting resource block for this ULSCH allocation", HFILL }
++		},
++		{ &hf_nfapi_number_of_resource_blocks,
++			{ "Number of resource blocks", "nfapi.resource.blocks",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of resource blocks allocated to this ULSCH grant", HFILL }
++		},
++		{ &hf_nfapi_cyclic_shift_2_for_drms,
++			{ "Cyclic Shift 2 for DRMS", "nfapi.cyclic.shift.2.for.drms",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The 2nd cyclic shift for DMRS assigned to the UE in the ULSCH grant", HFILL }
++		},
++		{ &hf_nfapi_frequency_hopping_enabled_flag,
++			{ "Frequency hopping enabled flag", "nfapi.frequency.hopping.enabled.flag",
++			FT_UINT8, BASE_DEC, VALS(hopping_vals), 0x0,
++			"Indicates if hopping is being used", HFILL }
++		},
++		{ &hf_nfapi_frequency_hopping_bits,
++			{ "Frequency hopping bits", "nfapi.frequency.hopping.bits",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_new_data_indication,
++			{ "New Data inidication", "nfapi.new.data.indication",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Specify whether this received transport block is a new transmission from UE", HFILL }
++		},
++		{ &hf_nfapi_harq_process_number,
++			{ "HARQ Process number", "nfapi.harq.process.number",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_ul_tx_mode,
++			{ "UL Tx Mode", "nfapi.ul.tx.mode",
++			FT_UINT8, BASE_DEC, VALS(ul_tx_mode_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_current_tx_nb,
++			{ "Current Tx nb", "nfapi.current.tx.nb",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The current HARQ transmission count of this transport block. Valid if frequency hopping enabled.", HFILL }
++		},
++		{ &hf_nfapi_n_srs,
++			{ "N SRS", "nfapi.n.srs",
++			FT_UINT8, BASE_DEC, VALS(n_srs_vals), 0x0,
++			"Indicates if the resource blocks allocated for this grant overlap with the SRS configuration.", HFILL }
++		},
++		{ &hf_nfapi_disable_sequence_hopping_flag,
++			{ "Disable seqeunce hopping flag", "nfapi.disable.sequence.hopping.flag",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if any configured group hopping should be disabled for this UE.", HFILL }
++		},
++		{ &hf_nfapi_virtual_cell_id_enabled_flag,
++			{ "Virtual cell ID enabled flag", "nfapi.virtual.cell.id.enabled.flag",
++			FT_UINT8, BASE_DEC, VALS(not_used_enabled_vals), 0x0,
++			"Indicates if virtual cell is being used and nPUSCH identity is valid.", HFILL }
++		},
++		{ &hf_nfapi_npusch_identity,
++			{ "nPUSCH Identity", "nfapi.npusch.identity",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Virtual cell ID for initialization of group hopping, sequence hopping and sequence shift pattern of PUSCH DMRS.", HFILL }
++		},
++		{ &hf_nfapi_ndrms_csh_identity,
++			{ "nDMRS-CSH Identity", "nfapi.ndrms.csh.identity",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Virtual cell ID for initialization of cyclic shift hopping of PUSCH DMRS.", HFILL }
++		},
++		{ &hf_nfapi_total_number_of_repetitions,
++			{ "Total Number of repetitions", "nfapi.total.number.of.repetitions",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_repetition_number,
++			{ "Repetition Number", "nfapi.repetition.number",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Current transmission number", HFILL }
++		},
++		{ &hf_nfapi_initial_sf_io,
++			{ "Initial transmission SF (io)", "nfapi.initial.sf.io",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Absolute Sub-Frame  of the initial transmission", HFILL }
++		},
++		{ &hf_nfapi_empty_symbols_due_to_retunning,
++			{ "Empy symbols due to re-tunning", "nfapi.empty.symbols.due.to.retunning",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the symbols that are left empty due to eMTC retuning.", HFILL }
++		},
++		{ &hf_nfapi_dl_cqi_ri_pmi_size_2,
++			{ "DL CQI/PMI/RI size 2", "nfapi.dl.cqi.ri.pmi.size.2",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The size of the DL CQI/PMI/RI in bits. If the CQI/PMI/RI size exceeds 255 (8-bits) then the Release 9 size value = 0, and this field is used instead.", HFILL }
++		},
++		{ &hf_nfapi_harq_size_2,
++			{ "HARQ Size 2", "nfapi.harq.size2",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The size of the ACK/NACK in bits.", HFILL }
++		},
++		{ &hf_nfapi_delta_offset_harq_2,
++			{ "Delta Offset HARQ 2", "nfapi.delta.offset.harq.2",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Delta offset 2 for HARQ. This value is fixed for a UE, allocated in RRC connection setup and used for ACK_NACK mode = 4 or 5", HFILL }
++		},
++		{ &hf_nfapi_starting_prb,
++			{ "Starting PRB", "nfapi.starting.prb",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The starting PRB for the PUCCH", HFILL }
++		},
++		{ &hf_nfapi_antenna_port,
++			{ "Antenna Port", "nfapi.antenna.port",
++			FT_UINT8, BASE_DEC, VALS(antenna_ports_vals), 0x0,
++			"Defines the number of antenna ports used by the UE for the SRS. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_number_of_combs,
++			{ "Number of Combs", "nfapi.num.of.combs",
++			FT_UINT8, BASE_DEC, VALS(combs_vals), 0x0,
++			"Defines the maximum number of transmission combs (TC).", HFILL }
++		},
++		{ &hf_nfapi_npucch_identity,
++			{ "nPUCCH Identity", "nfapi.npucch.identity",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Virtual cell ID for initialization of base sequence and cyclic shift hopping of PUCCH.", HFILL }
++		},
++		{ &hf_nfapi_empty_symbols,
++			{ "Empty symbols", "nfapi.empty.symbols",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates the symbols that are left empty due to eMTC retuning.", HFILL }
++		},
++		{ &hf_nfapi_csi_mode,
++			{ "CSI_mode", "nfapi.csi.mode",
++			FT_UINT8, BASE_DEC, VALS(csi_mode_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_dl_cqi_pmi_size_2,
++			{ "DL CQI/PMI Size 2", "nfapi.dl.cqi.pmi.size.2",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The size of the DL CQI/PMI in bits", HFILL }
++		},
++		{ &hf_nfapi_statring_prb,
++			{ "Starting PRB", "nfapi.starting.prb",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The starting PRB for the PUCCH", HFILL }
++		},
++		{ &hf_nfapi_cdm_index,
++			{ "cdm_Index", "nfapi.cdm.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Selected CDM option", HFILL }
++		},
++		{ &hf_nfapi_nsrs,
++			{ "N srs", "nfapi.n.srs",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if the resource blocks allocated for this grant overlap with the SRS configuration.", HFILL }
++		},
++		{ &hf_nfapi_num_ant_ports,
++			{ "Num_ant_ports", "nfapi.num.ant.port",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of antenna ports used by the UE transmit", HFILL }
++		},
++		{ &hf_nfapi_n_pucch_2_0,
++			{ "n_PUCCH_2_0", "nfapi.n.pucch.2.0",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PUCCH Index value for ACK/NACK HARQ resource 4 on antenna port", HFILL }
++		},
++		{ &hf_nfapi_n_pucch_2_1,
++			{ "n_PUCCH_2_1", "nfapi.n.pucch.2.1",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"HARQ resource 5", HFILL }
++		},
++		{ &hf_nfapi_n_pucch_2_2,
++			{ "n_PUCCH_2_2", "nfapi.n.pucch.2.2",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"HARQ resource 6", HFILL }
++		},
++		{ &hf_nfapi_n_pucch_2_3,
++			{ "n_PUCCH_2_3", "nfapi.n.pucch.2.3",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"HARQ resource 7", HFILL }
++		},
++		{ &hf_nfapi_dl_cqi_pmi_size_rank_1,
++			{ "DL CQI PMI size rank 1", "nfapi.dl.cqi.pmi.size.rank.1",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The size of the DL CQI/PMI in bits in case of rank 1 report.", HFILL }
++		},
++		{ &hf_nfapi_dl_cqi_pmi_size_rank_greater_1,
++			{ "DL CQI PMI size rank greater 1", "nfapi.dl.cqi.pmi.size.rank.1",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The size of the DL CQI/PMI in bits in case of rank>1 report.", HFILL }
++		},
++		{ &hf_nfapi_ri_size,
++			{ "RI size", "nfapi.ri.size",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The size of RI in bits", HFILL }
++		},
++		{ &hf_nfapi_delta_offset_cqi,
++			{ "Delta offset cqi", "nfapi.delta.offset.cqi",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Delta offset for CQI. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_delta_offset_ri,
++			{ "Delta offset ri", "nfapi.delta.offset.ri",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Delta offset for RI. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_harq_size,
++			{ "HARQ size", "nfapi.harq_size",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The size of the ACK/NACK in bits", HFILL }
++		},
++		{ &hf_nfapi_delta_offset_harq,
++			{ "Delta offset HARQ", "nfapi.delta.offset.harq",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Delta offset for HARQ. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_tdd_ack_nack_mode,
++			{ "ACK NACK mode", "nfapi.tdd.ack.nack.mode",
++			FT_UINT8, BASE_DEC, VALS(nfapi_tdd_ack_nack_mode_vals), 0x0,
++			"The format of the ACK/NACK response expected. For TDD only.", HFILL }
++		},
++		{ &hf_nfapi_fdd_ack_nack_mode,
++			{ "ACK NACK mode", "nfapi.fdd.ack.nack.mode",
++			FT_UINT8, BASE_DEC, VALS(nfapi_fdd_ack_nack_mode_vals), 0x0,
++			"The format of the ACK/NACK response expected. For TDD only.", HFILL }
++		},
++		{ &hf_nfapi_n_srs_initial,
++			{ "N srs initial", "nfapi.n.srs.initial",
++			FT_UINT8, BASE_DEC, VALS(n_srs_initial_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_initial_number_of_resource_blocks,
++			{ "Initial number of resource blocks", "nfapi.initial.number.of.resource.blocks",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of resource blocks used in the initial transmission of this transport block.", HFILL }
++		},
++		{ &hf_nfapi_dl_cqi_pmi_size,
++			{ "DL cqi pmi size", "nfapi.dl.cqi.pmi.size",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The size of the DL CQI/PMI in bits in case of this RI value. The size of the DL CQI / PMI / RI in bits in case of this CRI value", HFILL }
++		},
++		{ &hf_nfapi_report_type,
++			{ "Report type", "nfapi.report.type",
++			FT_BOOLEAN, 8, TFS(&nfapi_csi_report_type_strname), 0x0,
++			"Type of CSI report", HFILL }
++		},
++		{ &hf_nfapi_dl_cqi_ri_pmi_size,
++			{ "DL CQI/PMI/RI size", "nfapi.dl.cqi.ri.pmi.size",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The size of the DL CQI/PMI/RI/CRI in bits", HFILL }
++		},
++		{ &hf_nfapi_control_type,
++			{ "Control type", "nfapi.control.type",
++			FT_BOOLEAN, 8, TFS(&nfapi_control_type_string_name), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_number_of_cc,
++			{ "Number of cc", "nfapi.number.of.cc",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of CC in the aperiodic report", HFILL }
++		},
++		{ &hf_nfapi_number_of_pucch_resource,
++			{ "Number of PUCCH Resource", "nfapi.number.of.pucch.resource",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"A value of 2 indicates that the UE is configured to transmit on two antenna ports", HFILL }
++		},
++		{ &hf_nfapi_pucch_index_p1,
++			{ "PUCCH Index P1", "nfapi.pucch.index.p1",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PUCCH index value   for antenna port P1", HFILL }
++		},
++		{ &hf_nfapi_n_pucch_1_0,
++			{ "N PUCCH 1 0", "nfapi.n.pucch.1.0",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"HARQ resource 0", HFILL }
++		},
++		{ &hf_nfapi_n_pucch_1_1,
++			{ "N PUCCH 1 1", "nfapi.n.pucch.1.1",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"HARQ resource 1", HFILL }
++		},
++		{ &hf_nfapi_n_pucch_1_2,
++			{ "N PUCCH 1 2", "nfapi.n.pucch.1.2",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"HARQ resource 2", HFILL }
++		},
++		{ &hf_nfapi_n_pucch_1_3,
++			{ "N PUCCH 1 3", "nfapi.n.pucch.1.3",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"HARQ resource 3", HFILL }
++		},
++		{ &hf_nfapi_srs_bandwidth,
++			{ "SRS Bandwidth", "nfapi.srs.bandwidth",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"SRS Bandwidth. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_frequency_domain_position,
++			{ "Frequency Domain position", "nfapi.frequency.domain.position",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Frequency-domain position, NRRC This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_srs_hopping_bandwidth,
++			{ "SRS hopping bandwidth", "nfapi.srs.hopping.bandwidth",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Configures the frequency hopping on the SRS. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_transmission_comb,
++			{ "Transmission comb", "nfapi.transmission.comb",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Configures the frequency location of the SRS. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_i_srs,
++			{ "I SRS", "nfapi.i.srs",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Defines the periodicity and subframe location of the SRS. SRS Configuration Index. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_sounding_reference_cyclic_shift,
++			{ "Sounding reference cyclic shift", "nfapi.sounding.reference.cyclic.shift",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Configures the SRS sequence generation. This value is fixed for a UE and allocated in RRC connection setup.", HFILL }
++		},
++		{ &hf_nfapi_pdu_length,
++			{ "PDU length", "nfapi.pdu.length",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The total length (in bytes) of the PDU description and PDU data, without the padding bytes", HFILL }
++		},
++		{ &hf_nfapi_crc_flag,
++			{ "CRC flag", "nfapi.crc.flag",
++			FT_BOOLEAN, 8, TFS(&crc_flag_strname), 0x0,
++			"A flag indicating if a CRC error was detected", HFILL }
++		},
++		{ &hf_nfapi_number_of_hi_pdus,
++			{ "Number of HI Pdu's", "nfapi.number_of_hi_pdus",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of HI PDUs included in this message", HFILL }
++		},
++		{ &hf_nfapi_number_of_dci_pdus,
++			{ "Number of DCI Pdu's", "nfapi.number_of_dci_pdus",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of DCI PDUs included in this message", HFILL }
++		},
++		{ &hf_nfapi_hi_dci0_pdu_type,
++			{ "PDU Type", "nfapi.pdu_type",
++			FT_UINT8, BASE_DEC, VALS(hi_dci0_pdu_type_vals), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_hi_value,
++			{ "HI Value", "nfapi.hi_value",
++			FT_BOOLEAN, 8, TFS(&hi_value_strname), 0x0,
++			"The PHICH value which is sent on the resource", HFILL }
++		},
++		{ &hf_nfapi_i_phich,
++			{ "i phich", "nfapi.i_phich",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Is used in the calculation of the PHICH location. For TDD only", HFILL }
++		},
++		{ &hf_nfapi_flag_tb2,
++			{ "Flag TB2", "nfapi.flag_tb2",
++			FT_BOOLEAN, BASE_NONE, TFS(&flag_tb2_strname), 0x0,
++			"Indicates is HI is present for a second transport block", HFILL }
++		},
++		{ &hf_nfapi_hi_value_2,
++			{ "HI Value 2", "nfapi.hi_value_2",
++			FT_BOOLEAN, BASE_NONE, TFS(&hi_value_strname), 0x0,
++			"The PHICH value for a second transport block.", HFILL }
++		},
++		{ &hf_nfapi_ue_tx_antenna_selection,
++			{ "UE Tx Antenna selection", "nfapi.ue_tx_antenna_selection",
++			FT_UINT8, BASE_DEC, VALS(ue_tx_antenna_selection_vals), 0x0,
++			"Indicates how the CRC is calculated on the PDCCH.", HFILL }
++		},
++		{ &hf_nfapi_cqi_csi_request,
++			{ "cqi csi request", "nfapi.cqi_csi_request",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Aperiodic CQI request flag", HFILL }
++		},
++		{ &hf_nfapi_ul_index,
++			{ "UL index", "nfapi.ul_index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Valid for TDD mode only", HFILL }
++		},
++		{ &hf_nfapi_dl_assignment_index,
++			{ "DL Assignment index", "nfapi.dl_assignment_index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Valid for TDD mode only.", HFILL }
++		},
++		{ &hf_nfapi_tpc_bitmap,
++			{ "TPC bitmap", "nfapi.tpc_bitmap",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"TPC commands for PUCCH and PUSCH", HFILL }
++		},
++		{ &hf_nfapi_number_of_antenna_ports,
++			{ "Number of antenna ports", "nfapi.number.of.antenna.ports",
++			FT_UINT8, BASE_DEC, VALS(number_of_antenna_port_vals), 0x0,
++			"Defines number of antenna ports for this ULSCH allocation", HFILL }
++		},
++		{ &hf_nfapi_size_of_cqi_csi_feild,
++			{ "Size of cqi csi feild", "nfapi.size.of.cqi.csi.feild",
++			FT_UINT8, BASE_DEC, VALS(size_of_cqi_csi_feild_vals), 0x0,
++			"Indicates the size of the CQI/CSI request field", HFILL }
++		},
++		{ &hf_nfapi_new_data_indication_two,
++			{ "New data indication 2", "nfapi.new.data.indication.two",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The new data indicator for the second transport block", HFILL }
++		},
++		{ &hf_nfapi_resource_allocation_flag,
++			{ "Resource allocation flag", "nfapi.resource.allocation.flag",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Indicates if the Resource Allocation Type parameter is valid.", HFILL }
++		},
++		{ &hf_nfapi_dl_node_sync_t1,
++			{ "DL Node Sync t1", "nfapi.dl.node.sync.t1",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"Offset from VNF SFN/SF 0/0 time reference of the DL Node Sync message transmission at the transport layer, in microseconds.", HFILL }
++		},
++		{ &hf_nfapi_dl_node_sync_delta_sfn_sf,
++			{ "DL Node Sync Delta SFN SF", "nfapi.dl.node.sync.delta_sfn_sf",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The delta shift in subframes that the PNF PHY instance must update to on the next subframe boundary", HFILL }
++		},
++		{ &hf_nfapi_dl_cyclic_prefix_type,
++			{ "DL Cyclic Prefix type", "nfapi.dl.cyclic.prefix.type",
++			FT_BOOLEAN, 8, TFS(&cyclic_prefix_type_strname), 0x0,
++			"Cyclic prefix type, used for DL", HFILL }
++		},
++		{ &hf_nfapi_ul_cyclic_prefix_type,
++			{ "UL Cyclic Prefix type", "nfapi.ul.cyclic.prefix.type",
++			FT_BOOLEAN, 8, TFS(&cyclic_prefix_type_strname), 0x0,
++			"Cyclic prefix type, used for UL", HFILL }
++		},
++		{ &hf_nfapi_downlink_channel_bandwidth,
++			{ "Downlink Channel Bandwidth", "nfapi.dl.channel.bandwidth",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Downlink channel bandwidth in resource blocks.", HFILL }
++		},
++		{ &hf_nfapi_uplink_channel_bandwidth,
++			{ "Uplink Channel Bandwidth", "nfapi.ul.channel_bandwidth",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Uplink channel bandwidth in resource blocks.", HFILL }
++		},
++		{ &hf_nfapi_tx_antenna_ports,
++			{ "Tx Antenna Ports", "nfapi.tx.antenna.ports",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of cell specific or NB transmit antenna ports.", HFILL }
++		},
++		{ &hf_nfapi_rx_antenna_ports,
++			{ "Tx Antenna Ports", "nfapi.rx.antenna.ports",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of cell specific or NB receive antenna ports.", HFILL }
++		},
++		{ &hf_nfapi_ul_node_sync_t1,
++			{ "UL Node Sync t1", "nfapi.ul.node.sync.t1",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The supplied t1 field in the DL Node Sync", HFILL }
++		},
++		{ &hf_nfapi_ul_node_sync_t2,
++			{ "UL Node Sync t2", "nfapi.ul.node.sync.t2",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"Offset from PNF SFN/SF 0/0 time reference of the DL Node Sync message reception at the transport layer, in microseconds.", HFILL }
++		},
++		{ &hf_nfapi_ul_node_sync_t3,
++			{ "UL Node Sync t3", "nfapi.ul.node.sync.t3",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"Offset from PNF SFN/SF 0/0 time reference of the UL Node Sync message transmission at the transport layer, in microseconds.", HFILL }
++		},
++		{ &hf_nfapi_pb,
++			{ "P-B", "nfapi.pb.allocation",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Refers to downlink power allocation. Value is an index into the referenced table.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_last_sfn_sf,
++			{ "Last SFN/SF", "nfapi.timing.info.last.sfn.sf",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"The completed SFN/SF at the PNF PHY instance that triggered the Timing Info message", HFILL }
++		},
++		{ &hf_nfapi_timing_info_time_since_last_timing_info,
++			{ "Time since last Timing Info", "nfapi.timing.info.time.since.last.timing.info",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"The number of ms since the last Timing Info was sent from this PNF PHY instance.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_dl_config_jitter,
++			{ "DL Config Jitter", "nfapi.timing.info.dl.config.jitter",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"The inter message jitter of the DL Config message reception in microseconds", HFILL }
++		},
++		{ &hf_nfapi_timing_info_tx_request_jitter,
++			{ "Tx Request Jitter", "nfapi.timing.info.tx.req.jitter",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"The inter message jitter of the Tx Request message reception in microseconds", HFILL }
++		},
++		{ &hf_nfapi_timing_info_ul_config_jitter,
++			{ "UL Config Jitter", "nfapi.timing.info.ul.config.jitter",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"The inter message jitter of the UL Config message reception in microseconds", HFILL }
++		},
++		{ &hf_nfapi_timing_info_hi_dci0_jitter,
++			{ "HI_DCI0 Jitter", "nfapi.timing.info.hi.dci0.jitter",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"The inter message jitter of the HI_DCI0 message reception in microseconds", HFILL }
++		},
++		{ &hf_nfapi_timing_info_dl_config_latest_delay,
++			{ "DL Config Latest Delay", "nfapi.timing.info.dl.config.latest.delay",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The latest delay offset in microseconds from the latest acceptable time for the DL Config as defined in the DL Config Timing in the PNF_PARAM.Response since the last transmission of the Timing Info Message.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_tx_request_latest_delay,
++			{ "Tx Request Latest Delay", "nfapi.timing.info.tx.request.latest.delay",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The latest delay offset in microseconds from the latest acceptable time for the Tx Request as defined in the Tx Config Timing in the PNF_PARAM.Response since the last transmission of the Timing Info Message.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_ul_config_latest_delay,
++			{ "UL Config Latest Delay", "nfapi.timing.info.ul.config.latest.delay",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The latest delay offset in microseconds from the latest acceptable time for the UL Config as defined in the UL Config Timing in the PNF_PARAM.Response since the last transmission of the Timing Info Message.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_hi_dci0_latest_delay,
++			{ "HI_DCI0 Latest Delay", "nfapi.timing.info.hi.dci0.latest.delay",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The latest delay offset in microseconds from the latest acceptable time for the HI_DCI0 as defined in the HI_DCI0 Timing in the PNF_PARAM.Response since the last transmission of the Timing Info Message.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_dl_config_earliest_arrival,
++			{ "DL Config Earliest Arrival", "nfapi.timing.info.dl.config.earliest.arrival",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The earlierst arrival offset in microseconds from the latest time acceptable for the DL Config as defined in the Timing Window in the PARAM.Response since the last transmission of the Timing Info Message.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_tx_request_earliest_arrival,
++			{ "Tx Request Earliest Arrival", "nfapi.timing.info.tx.request.earliest.arrival",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The earlierst arrival offset in microseconds from the latest time acceptable for the Tx Request as defined in the Timing Window in the PARAM.Response since the last transmission of the Timing Info Message.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_ul_config_earliest_arrival,
++			{ "UL Config Earliest Arrival", "nfapi.timing.info.ul.config.earliest.arrival",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The earlierst arrival offset in microseconds from the latest time acceptable for the UL Config as defined in the Timing Window in the PARAM.Response since the last transmission of the Timing Info Message.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_hi_dci0_earliest_arrival,
++			{ "HI_DCI0 Earliest Arrival", "nfapi.timing.info.hi.dci0.earliest.arrival",
++			FT_INT32, BASE_DEC, NULL, 0x0,
++			"The earlierst arrival offset in microseconds from the latest time acceptable for the HI_DCI0 as defined in the Timing Window in the PARAM.Response since the last transmission of the Timing Info Message.", HFILL }
++		},
++		{ &hf_nfapi_pcfich_power_offset,
++			{ "PCFICH Power Offset", "nfapi.pcfich.power.offset",
++			FT_UINT16, BASE_CUSTOM, CF_FUNC(power_offset_conversion_fn), 0x0,
++			"The power per antenna of the PCFICH with respect to the reference signal.", HFILL }
++		},
++		{ &hf_nfapi_timing_window,
++			{ "NFAPI Timing window", "nfapi.timing.window",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The window in milliseconds that the PHY must receive and queue the P7 messages.", HFILL }
++		},
++		{ &hf_nfapi_timing_info_mode,
++			{ "Timing Info mode", "nfapi.timing.info.mode",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The configured mode of operation for the timing info message to be sent to the VNF from the PHY", HFILL }
++		},
++		{ &hf_nfapi_timing_info_period,
++			{ "Timing info period", "nfapi.timing.info.period",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"If Periodic timing mode is enabled, this defines the periodicity in subframes. This field is ignored if periodic timing mode is disabled.", HFILL }
++		},
++		{ &hf_nfapi_tdd_harq_mode,
++			{ "Mode", "nfapi.tdd.harq.mode",
++			FT_UINT8, BASE_DEC, VALS(tdd_harq_mode_vals), 0x0,
++			"The format of the ACK/NACK response expected", HFILL }
++		},
++		{ &hf_nfapi_fdd_harq_mode,
++			{ "Mode", "nfapi.fdd.harq.mode",
++			FT_UINT8, BASE_DEC, VALS(fdd_harq_mode_vals), 0x0,
++			"The format of the ACK/NACK response expected", HFILL }
++		},
++		{ &hf_nfapi_number_of_ack_nack,
++			{ "Number of ACK/NACK", "nfapi.uint16.tag",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of ACK/NACK results reported for this UE", HFILL }
++		},
++		{ &hf_nfapi_harq_data_value_0,
++			{ "Value 0", "nfapi.harq.value.0",
++			FT_UINT8, BASE_DEC, VALS(harq_value_vals), 0x0,
++			"Indicates HARQ results", HFILL }
++		},
++		{ &hf_nfapi_harq_data_value_0_special,
++			{ "Value 0", "nfapi.harq.value.0.special",
++			FT_UINT8, BASE_DEC, VALS(harq_special_value_vals), 0x0,
++			"Indicates HARQ results", HFILL }
++		},
++		{ &hf_nfapi_harq_data_value_1,
++			{ "Value 1", "nfapi.harq.value.1",
++			FT_UINT8, BASE_DEC, VALS(harq_value_vals), 0x0,
++			"Indicates HARQ results", HFILL }
++		},
++		{ &hf_nfapi_harq_data_value_2,
++			{ "Value 2", "nfapi.harq.value.2",
++			FT_UINT8, BASE_DEC, VALS(harq_value_vals), 0x0,
++			"Indicates HARQ results", HFILL }
++		},
++		{ &hf_nfapi_harq_data_value_3,
++			{ "Value 3", "nfapi.harq.value.3",
++			FT_UINT8, BASE_DEC, VALS(harq_value_vals), 0x0,
++			"Indicates HARQ results", HFILL }
++		},
++		{ &hf_nfapi_harq_tb_1,
++			{ "HARQ TB1", "nfapi.harq.tb.",
++			FT_UINT8, BASE_DEC, VALS(harq_value_vals), 0x0,
++			"HARQ feedback of 1st TB.", HFILL }
++		},
++		{ &hf_nfapi_harq_tb_2,
++			{ "HARQ TB2", "nfapi.harq.tb.2",
++			FT_UINT8, BASE_DEC, VALS(harq_value_vals), 0x0,
++			"HARQ feedback of 2nd TB.", HFILL }
++		},
++		{ &hf_nfapi_harq_tb_n,
++			{ "HARQ TB_N", "nfapi.harq.tb.n",
++			FT_UINT8, BASE_DEC, VALS(harq_value_vals), 0x0,
++			"HARQ feedback of Nth TB.", HFILL }
++		},
++		{ &hf_nfapi_ul_cqi,
++			{ "UL_CQI", "nfapi.ul.cqi",
++			FT_UINT8, BASE_CUSTOM, CF_FUNC(ul_cqi_conversion_fn), 0x0,
++			"SNR", HFILL }
++		},
++		{ &hf_nfapi_channel,
++			{ "Channel", "nfapi.channel",
++			FT_UINT8, BASE_DEC, VALS(channel_vals), 0x0,
++			"The channel to which this measurement refers", HFILL }
++		},
++		{ &hf_nfapi_data_offset,
++			{ "Data Offset", "nfapi.data.offset",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Gives the PDU#i data address offset from the beginning of the 'Number of PDUs' field. An offset of 0 indicates a CRC or decoding error", HFILL }
++		},
++		{ &hf_nfapi_ri,
++			{ "RI", "nfapi.ri",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The rank indication reported by the UE on PUSCH for aperiodic CSI.", HFILL }
++		},
++		{ &hf_nfapi_timing_advance,
++			{ "Timing Advance", "nfapi.timing.advance",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The timing advance measured for this PDU and UE.", HFILL }
++		},
++		{ &hf_nfapi_timing_advance_r9,
++			{ "Timing Advance R9", "nfapi.timing.advance.r9",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Timing advance used for positioning", HFILL }
++		},
++		{ &hf_nfapi_number_of_cc_reported,
++			{ "Number of CC reported", "nfapi.number.of.cc.reported",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_preamble,
++			{ "Preamble", "nfapi.preamble",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The detected preamble", HFILL }
++		},
++		{ &hf_nfapi_rach_resource_type,
++			{ "RACH resource type", "nfapi.rach.resource.type",
++			FT_UINT8, BASE_DEC, VALS(rach_resource_type_vals), 0x0,
++			"Indicates if this indication is related to Cat-M UE and in which CE level", HFILL }
++		},
++		{ &hf_nfapi_doppler_estimation,
++			{ "Doppler estimation", "nfapi.doppler.estimation",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"FFS", HFILL }
++		},
++		{ &hf_nfapi_rb_start,
++			{ "RB Start", "nfapi.rb.start",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The starting point of the RBs to be reported", HFILL }
++		},
++		{ &hf_nfapi_snr,
++			{ "SNR", "nfapi.snr",
++			FT_UINT8, BASE_CUSTOM, CF_FUNC(ul_cqi_conversion_fn), 0x0,
++			"Field size dependent on configured bandwidth SNR for RBs, each RBs report one SNR.", HFILL }
++		},
++		{ &hf_nfapi_up_pts_symbol,
++			{ "UpPTS Symbol", "nfapi.uppts.symbol",
++			FT_UINT8, BASE_DEC, VALS(up_pts_symbol_vals), 0x0,
++			"Indicates symbol where SRS was received. Only valid if the SRS was received in subframe 1 or 6.", HFILL }
++		},
++		{ &hf_nfapi_number_prb_per_subband,
++			{ "numPRBperSubband", "nfapi.num.prb.per.subband",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of PRBs that are treated as one subband", HFILL }
++		},
++		{ &hf_nfapi_number_antennas,
++			{ "numAntennas", "nfapi.num.antennas",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Number of physical antennas", HFILL }
++		},
++		{ &hf_nfapi_subband_index,
++			{ "subbandIndex", "nfapi.subband.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"Index of subband for which the following channel coefficient is applied", HFILL }
++		},
++		{ &hf_nfapi_channel_coefficient,
++			{ "Channel", "nfapi.channel.coefficient",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Averaged channel coefficient in a subband for physical antenna #i, real 8 bits followed by imaginary 8 bits", HFILL }
++		},
++		{ &hf_nfapi_ul_rtoa,
++			{ "UL_RTOA", "nfapi.ul.rtoa",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"UL relative time of arrival used for network based positioning", HFILL }
++		},
++		{ &hf_nfapi_frequency_band_indicator,
++			{ "Frequency Band Indicator", "nfapi.frequency.band.indicator",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The E-UTRA band for which the carrierList applies.", HFILL }
++		},
++		{ &hf_nfapi_measurement_period,
++			{ "Measurement Period", "nfapi.measurement.period",
++			FT_UINT16, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The length of time to measure RSSI over, in units of 1ms.", HFILL }
++		},
++		{ &hf_nfapi_bandwidth,
++			{ "Bandwidth", "nfapi.bandwidth",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The bandwidth (in resource blocks) over which the RSSI is measured.", HFILL }
++		},
++		{ &hf_nfapi_timeout,
++			{ "Timeout", "nfapi.timeout",
++			FT_UINT32, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The timeout value after which the PNF should abort the procedure in units of 1ms. The value of 0 indicates that the PNF should attempt to complete the procedure without any VNF-imposed timeout.", HFILL }
++		},
++		{ &hf_nfapi_number_of_earfcns,
++			{ "Number of EARFCNs", "nfapi.number.of.earfcns",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of EARFCNs which should be measured. In the case that no EARFCN (value 0) is specified, all valid EARFCNs for the specified bandwidth in the band shall be measured, in order of ascending EARCFN.", HFILL }
++		},
++		{ &hf_nfapi_uarfcn,
++			{ "UARFCN", "nfapi.uarfcn",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"UARFCN to be measured.", HFILL }
++		},
++		{ &hf_nfapi_number_of_uarfcns,
++			{ "Number of UARFCNs", "nfapi.number.of.uarfcn",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of UARFCNs which should be measured. In the case that no UARFCN (value 0) is specified, all UARFCNs in the band shall be measured, in order of ascending UARCFN.", HFILL }
++		},
++		{ &hf_nfapi_arfcn,
++			{ "ARFCN", "nfapi.arfcn",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The ARFCN to be measured", HFILL }
++		},
++		{ &hf_nfapi_arfcn_direction,
++			{ "Direction", "nfapi.arfcn.direction",
++			FT_UINT8, BASE_DEC, VALS(arfcn_direction_vals), 0x0,
++			"The link direction to be measured", HFILL }
++		},
++		{ &hf_nfapi_number_of_arfcns,
++			{ "Number of ARFCNs", "nfapi.number.of.arfcn",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of ARFCNs which should be measured. In the case that no ARFCN (value 0) is specified, all ARFCNs in the band shall be measured, in order of ascending ARCFN.", HFILL }
++		},
++		{ &hf_nfapi_rssi,
++			{ "RSSI", "nfapi.rssi",
++			FT_INT16, BASE_CUSTOM, CF_FUNC(rssi_conversion_fn), 0x0,
++			"The list of RSSI values of the carriers measured, in the order of the list of the original request.", HFILL }
++		},
++		{ &hf_nfapi_number_of_rssi,
++			{ "Number of RSSI", "nfapi.number.of.rssi",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of RSSI results returned in the following array.", HFILL }
++		},
++		{ &hf_nfapi_pci,
++			{ "PCI", "nfapi.pci",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PCI for cell which should be searched", HFILL }
++		},
++		{ &hf_nfapi_measurement_bandwidth,
++			{ "Measurement Bandwidth", "nfapi.measurement.bandwidth",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of resource blocks which should be used for measuring RSRP", HFILL }
++		},
++		{ &hf_nfapi_exhaustive_search,
++			{ "Exhaustive Search", "nfapi.exhaustive.search",
++			FT_UINT8, BASE_DEC, VALS(exhustive_search_vals), 0x0,
++			"NMM should try to find all cells on the carrier", HFILL }
++		},
++		{ &hf_nfapi_number_of_pci,
++			{ "Number of PCI", "nfapi.number.of.pci",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of cells in the PCI list. If 0 all cells on the carrier should be found. Otherwise, depending on exhaustiveSearch flag, only the given pciList is searched or the pciList is used for indicating a priority list. Range: 0 to MAX_PCI_LIST.", HFILL }
++		},
++		{ &hf_nfapi_psc,
++			{ "PSC", "nfapi.psc",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The PSC for cells which should be searched.", HFILL }
++		},
++		{ &hf_nfapi_number_of_psc,
++			{ "Number of PSC", "nfapi.number.of.psc",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of cells in the PSC list. If 0 all cells on the carrier should be found. Otherwise, depending on Exhaustive Search flag, only the given PSC list is searched or the PSC list is used for indicating a priority list. Range: 0 to MAX_PSC_LIST.", HFILL }
++		},
++		{ &hf_nfapi_rsrp,
++			{ "RSRP", "nfapi.rsrp",
++			FT_UINT8, BASE_CUSTOM, CF_FUNC(neg_pow_conversion_fn), 0x0,
++			"The measured RSRP value in units of -1dB", HFILL }
++		},
++		{ &hf_nfapi_rsrq,
++			{ "RSRQ", "nfapi.rsrq",
++			FT_UINT8, BASE_CUSTOM, CF_FUNC(neg_pow_conversion_fn), 0x0,
++			"The measured RSRQ value in units of -1dB", HFILL }
++		},
++		{ &hf_nfapi_number_of_lte_cells_found,
++			{ "Number of LTE Cells Found", "nfapi.number.of.lte.cells.found",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of LTE cells indicated in this message.", HFILL }
++		},
++		{ &hf_nfapi_rscp,
++			{ "RSCP", "nfapi.rscp",
++			FT_UINT8, BASE_CUSTOM, CF_FUNC(neg_pow_conversion_fn), 0x0,
++			"The measured RSCP value in units of -1dB", HFILL }
++		},
++		{ &hf_nfapi_enco,
++			{ "EcNo", "nfapi.ecno",
++			FT_UINT8, BASE_CUSTOM, CF_FUNC(neg_pow_conversion_fn), 0x0,
++			"The measured RSCP value in units of -1dB", HFILL }
++		},
++		{ &hf_nfapi_number_of_utran_cells_found,
++			{ "Number of UTRAN Cells Found", "nfapi.number.of.utran.cells.found",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of LTE cells indicated in this message", HFILL }
++		},
++		{ &hf_nfapi_bsic,
++			{ "BSIC", "nfapi.bsic",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The BSIC of the cell which the NMM synchronized to", HFILL }
++		},
++		{ &hf_nfapi_rxlev,
++			{ "RxLev", "nfapi.rxlev",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The measured RxLev value", HFILL }
++		},
++		{ &hf_nfapi_rxqual,
++			{ "RxQual", "nfapi.rxqual",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The measured RxQual value", HFILL }
++		},
++		{ &hf_nfapi_sfn_offset,
++			{ "SFN Offset", "nfapi.sfn.offset",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"The offset in us of the start of the current GSM Radio HyperFrame (i.e. FN=0) from the start of the preceding LTE Radio Frame of the PNF for SFN=0", HFILL }
++		},
++		{ &hf_nfapi_number_of_geran_cells_found,
++			{ "Number of GSM Cells Found", "nfapi.number.of.geran.cells.found",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The number of GSM cells indicated in this message", HFILL }
++		},
++		{ &hf_nfapi_number_of_tx_antenna,
++			{ "Number of Tx Antenna", "nfapi.number.of.tx.antenna",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of Tx Antenna detected for the cell", HFILL }
++		},
++		{ &hf_nfapi_mib_length,
++			{ "MIB Length", "nfapi.mib.length",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Length in bytes of the following MIB array", HFILL }
++		},
++		{ &hf_nfapi_mib,
++			{ "MIB", "nfapi.mib",
++			FT_BYTES, BASE_NONE, NULL, 0x0,
++			"The MIB read from the specified cell.", HFILL }
++		},
++		{ &hf_nfapi_phich_configuration,
++			{ "PHICH Configuration", "nfapi.phich.configuration",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The PHICH-Config of the cell", HFILL }
++		},
++		{ &hf_nfapi_retry_count,
++			{ "retryCount", "nfapi.retry.count",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of SIB1 repetition periods for which decoding of SIB1 should be retried.", HFILL }
++		},
++		{ &hf_nfapi_sib1,
++			{ "SIB1", "nfapi.sib1",
++			FT_BYTES, BASE_NONE, NULL, 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_si_periodicity,
++			{ "SI Periodicity", "nfapi.si.periodicity",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The SI Periodicity of the requested SIBs, with the first element being for SIB2, the next for SIB3, etc, encoded as follows", HFILL }
++		},
++		{ &hf_nfapi_si_index,
++			{ "SI Index", "nfapi.si.index",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The index of this SIB in the SIB1 SchedulingInfoList:", HFILL }
++		},
++		{ &hf_nfapi_number_of_si_periodicity,
++			{ "Number of SI Periodicity", "nfapi.number.of.si.periodicity",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The number of System Information periodicity values in the following array", HFILL }
++		},
++		{ &hf_nfapi_si_window_length,
++			{ "SI Window Length", "nfapi.si.window.length",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The SI window in units of 1ms", HFILL }
++		},
++		{ &hf_nfapi_sib_type,
++			{ "SIB Type", "nfapi.sib.type",
++			FT_UINT8, BASE_DEC, NULL, 0x0,
++			"The SIB type", HFILL }
++		},
++		{ &hf_nfapi_sib_len,
++			{ "SIB Length", "nfapi.sib.length",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The length in bytes of the following SIB array", HFILL }
++		},
++		{ &hf_nfapi_sib,
++			{ "SIB", "nfapi.sib",
++			FT_BYTES, BASE_NONE, NULL, 0x0,
++			"The SIB element read from the specified cell.", HFILL }
++		},
++		{ &hf_nfapi_si_len,
++			{ "SI Length", "nfapi.si.length",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The length in bytes of the following SI array", HFILL }
++		},
++		{ &hf_nfapi_si,
++			{ "SI", "nfapi.si",
++			FT_BYTES, BASE_NONE, NULL, 0x0,
++			"The SI element read from the specified cell.", HFILL }
++		},
++		{ &hf_nfapi_pnf_search_state,
++			{ "State", "nfapi.state",
++			FT_BYTES, BASE_NONE, NULL, 0x0,
++			"A structure of opaque data optionally sent by the PNF to the VNF", HFILL }
++		},
++		{ &hf_nfapi_pnf_broadcast_state,
++			{ "State", "nfapi.state",
++			FT_BYTES, BASE_NONE, NULL, 0x0,
++			"A structure of opaque data optionally sent by the PNF to the VNF", HFILL }
++		},
++		{ &hf_nfapi_dl_rs_tx_power,
++			{ "DL RS Tx power", "nfapi.dl.rs.tx.power",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"The DL RS Tx power measurement", HFILL }
++		},
++		{ &hf_nfapi_received_interference_power,
++			{ "Received interference power", "nfapi.received.interference.power",
++			FT_UINT16, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The Received interference power measurement", HFILL }
++		},
++		{ &hf_nfapi_thermal_noise_power,
++			{ "Thermal noise power", "nfapi.thermal.noise.power",
++			FT_UINT16, BASE_DEC | BASE_UNIT_STRING, &units_milliseconds, 0x0,
++			"The Thermal noise power measurement", HFILL }
++		},
++		{ &hf_nfapi_dl_rs_tx_power_measurement,
++			{ "DL RS TX Power measurement", "nfapi.dl.rs.tx.power.measurement",
++			FT_INT16, BASE_CUSTOM, CF_FUNC(dl_rs_tx_pow_measment_conversion_fn), 0x0,
++			"The DL RS Tx power measurement defined", HFILL }
++		},
++		{ &hf_nfapi_received_interference_power_measurement,
++			{ "Received interference power measurement", "nfapi.received.interference.power.measurement",
++			FT_INT16, BASE_CUSTOM, CF_FUNC(dl_rs_tx_pow_measment_conversion_fn), 0x0,
++			NULL, HFILL }
++		},
++		{ &hf_nfapi_thermal_noise_power_measurement,
++			{ "Thermal noise power measurement", "nfapi.thermal.noise.power.measurement",
++			FT_INT16, BASE_CUSTOM, CF_FUNC(dl_rs_tx_pow_measment_conversion_fn), 0x0,
++			"The Thermal noise power measurement", HFILL }
++		},
++		{ &hf_nfapi_initial_partial_sf,
++			{ "Initial Partial SF", "nfapi.initial.partial.sf",
++			FT_BOOLEAN, 32, TFS(&initial_partial_sf_strname), 0x0,
++			"Indicates whether the initial SF in the LBT process is full or partial", HFILL }
++		},
++		{ &hf_nfapi_lbt_mode,
++			{ "LBT Mode", "nfapi.lbt.mode",
++			FT_BOOLEAN, 32, TFS(&lbt_mode_strname), 0x0,
++			"Part of multi-carrier support. Indicates whether full LBT process is carried or partial LBT process is carried (multi carrier mode B according to [9] section 15.1.5.2)", HFILL }
++		},
++		{ &hf_nfapi_lte_txop_sf,
++			{ "LTE TXOP SF", "nfapi.txop.sf",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"Indicates the LTE TXOP (TMCOT,P in [9] section 15.1.1) duration in subframes.", HFILL }
++		},
++		{ &hf_nfapi_mp_cca,
++			{ "mp cca", "nfapi.mp.cca",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"Indicates the value of the defer factor", HFILL }
++		},
++		{ &hf_nfapi_n_cca,
++			{ "n cca", "nfapi.n.cca",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"Indicates the value of LBT backoff counter", HFILL }
++		},
++		{ &hf_nfapi_offset,
++			{ "offset", "nfapi.offset",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"Indicates the LBT start time in microseconds from the beginning of the subframe scheduled by this message.", HFILL }
++		},
++		{ &hf_nfapi_result,
++			{ "result", "nfapi.result",
++			FT_BOOLEAN, 32, TFS(&tfs_fail_success), 0x0,
++			"Indicates the LBT procedure result of SFN/SF:", HFILL }
++		},
++		{ &hf_nfapi_sfn_sf_end,
++			{ "SFN/SF End", "nfapi.sfn.sf.end",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates the SFN/SF by which the DRS window (Discovery signal occasion as described in [9] section 6.11A) must end. In worst case, this would be the last TXOP subframe.", HFILL }
++		},
++		{ &hf_nfapi_txop_sfn_sf_end,
++			{ "TXOP SFN/SF End", "nfapi.txop.sfn.sf.end",
++			FT_UINT16, BASE_DEC, NULL, 0x0,
++			"Indicates the SFN/SF by which the TXOP must end. In worst case, this would be the last TXOP subframe.", HFILL }
++		},
++		{ &hf_nfapi_txop_symbols,
++			{ "LTE TXOP symbols", "nfapi.lte.txop.symbols",
++			FT_UINT32, BASE_DEC, NULL, 0x0,
++			"Actual LTE TXOP in symbols", HFILL }
++		},
++	};
++
++	/* Setup protocol subtree array */
++	static gint *ett[] =
++	{
++		&ett_nfapi_message_tree,
++		&ett_nfapi_p4_p5_message_header,
++		&ett_nfapi_p7_message_header,
++		&ett_nfapi_tlv_tree,
++		&ett_nfapi_tl,
++		&ett_nfapi_pnf_phy_rf_config,
++		&ett_nfapi_pnf_phy,
++		&ett_nfapi_pnf_phy_rel10,
++		&ett_nfapi_pnf_phy_rel11,
++		&ett_nfapi_pnf_phy_rel12,
++		&ett_nfapi_pnf_phy_rel13,
++		&ett_nfapi_rf_bands,
++		&ett_nfapi_bf_vectors,
++		&ett_nfapi_csi_rs_bf_vector,
++		&ett_nfapi_csi_rs_resource_configs,
++		&ett_nfapi_tx_antenna_ports,
++		&ett_nfapi_harq_ack_nack_data,
++		&ett_nfapi_harq_data,
++		&ett_nfapi_cqi_pmi_size,
++		&ett_nfapi_cc,
++		&ett_nfapi_rbs,
++		&ett_nfapi_antennas,
++		&ett_nfapi_epdcch_prbs,
++		&ett_nfapi_dl_config_request_pdu_list,
++		&ett_nfapi_ul_config_request_pdu_list,
++		&ett_nfapi_hi_dci0_request_pdu_list,
++		&ett_nfapi_tx_request_pdu_list,
++		&ett_nfapi_rx_indication_pdu_list,
++		&ett_nfapi_harq_indication_pdu_list,
++		&ett_nfapi_crc_indication_pdu_list,
++		&ett_nfapi_sr_indication_pdu_list,
++		&ett_nfapi_cqi_indication_pdu_list,
++		&ett_nfapi_preamble_indication_pdu_list,
++		&ett_nfapi_srs_indication_pdu_list,
++		&ett_nfapi_lbt_dl_config_pdu_list,
++		&ett_nfapi_lbt_dl_indication_pdu_list,
++		&ett_nfapi_subbands,
++		&ett_nfapi_precoding,
++		&ett_nfapi_bf_vector_antennas,
++		&ett_nfapi_received_interference_power_mesurement_results,
++		&ett_nfapi_downlink_bandwidth_support,
++		&ett_nfapi_uplink_bandwidth_support,
++		&ett_nfapi_release_support,
++		&ett_nfapi_downlink_modulation_support,
++		&ett_nfapi_uplink_modulation_support,
++
++		&ett_nfapi_earfcn_list,
++		&ett_nfapi_uarfcn_list,
++		&ett_nfapi_arfcn_list,
++		&ett_nfapi_rssi_list,
++		&ett_nfapi_pci_list,
++		&ett_nfapi_psc_list,
++		&ett_nfapi_lte_cells_found_list,
++		&ett_nfapi_utran_cells_found_list,
++		&ett_nfapi_geran_cells_found_list,
++		&ett_nfapi_si_periodicity_list,
++
++		/* for fragmentation support*/
++		&ett_msg_fragment,
++		&ett_msg_fragments
++	};
++
++	static ei_register_info ei[] =
++	{
++		{ &ei_invalid_range, { "nfapi.invalid.range", PI_PROTOCOL, PI_WARN, NULL, EXPFILL } },
++		{ &ei_invalid_tlv_length, { "nfapi.invalid.tlv.length", PI_PROTOCOL, PI_ERROR, NULL, EXPFILL } },
++	};
++
++	expert_module_t* expert_nfapi;
++	/* Register protocol */
++	proto_nfapi = proto_register_protocol("Nfapi", "NFAPI", "nfapi");
++
++	expert_nfapi = expert_register_protocol(proto_nfapi);
++	expert_register_field_array(expert_nfapi, ei, array_length(ei));
++
++
++	proto_register_field_array(proto_nfapi, hf, array_length(hf));
++	proto_register_subtree_array(ett, array_length(ett));
++
++	reassembly_table_register(&ul_p7_reassemble_table, &addresses_ports_reassembly_table_functions);
++	reassembly_table_register(&dl_p7_reassemble_table, &addresses_ports_reassembly_table_functions);
++
++	register_dissector("nfapi", dissect_nfapi, proto_nfapi);
++
++}
++
++// ----------------------------------------------------------------------------|
++
++void proto_reg_handoff_nfapi(void)
++{
++	static dissector_handle_t nfapi_handle;
++
++	nfapi_handle = create_dissector_handle(dissect_nfapi, proto_nfapi);
++
++	dissector_add_for_decode_as("sctp.port", nfapi_handle);
++
++	dissector_add_uint("udp.port", 41700, nfapi_handle);
++
++}
++
++
++/*
++* Editor modelines  -  http://www.wireshark.org/tools/modelines.html
++*
++* Local variables:
++* c-basic-offset: 8
++* tab-width: 8
++* indent-tabs-mode: t
++* End:
++*
++* vi: set shiftwidth=8 tabstop=8 noexpandtab:
++* :indentSize=8:tabSize=8:noTabs=false:
++*/
+diff --git a/xml/pnf_phy_1_A.xml b/xml/pnf_phy_1_A.xml
+index da6cc26..45f8f46 100644
+--- a/xml/pnf_phy_1_A.xml
++++ b/xml/pnf_phy_1_A.xml
+@@ -26,7 +26,7 @@
+ 		<phy>
+ 			<index>88</index>
+ 			<port>2500</port>
+-			<address>127.0.0.1</address>
++			<address>192.168.1.74</address>
+ 
+ 			<duplex_mode>1</duplex_mode>
+ 
+@@ -54,9 +54,9 @@
+ 
+ 			<data>
+ 				<udp>
+-					<rx_port>7722</rx_port>
+-					<tx_addr>127.0.0.1</tx_addr>
+-					<tx_port>7733</tx_port>
++					<rx_port>5201</rx_port>
++					<tx_addr>192.168.1.28</tx_addr>
++					<tx_port>5200</tx_port>
+ 				</udp>
+ 			</data>
+ 		</phy>
+diff --git a/xml/vnf_A.xml b/xml/vnf_A.xml
+index e609c93..3791239 100644
+--- a/xml/vnf_A.xml
++++ b/xml/vnf_A.xml
+@@ -2,8 +2,8 @@
+ <vnf>
+ 	<vnf_p7_list>
+ 		<vnf_p7>
+-			<port>5200</port>
+-			<address>127.0.0.1</address>
++			<port>5201</port>
++			<address>192.168.1.28</address>
+ 			<timing_window>10</timing_window>
+ 			<periodic_timing_enabled>0</periodic_timing_enabled>
+ 			<periodic_timing_window>0</periodic_timing_window>
+@@ -12,7 +12,7 @@
+ 			<data>
+ 				<udp>
+ 					<rx_port>8891</rx_port>
+-					<tx_addr>127.0.0.1</tx_addr>
++					<tx_addr>192.168.1.28</tx_addr>
+ 					<tx_port>8892</tx_port>
+ 				</udp>
+ 			</data>
diff --git a/open-nfapi.oai.patch b/open-nfapi.oai.patch
deleted file mode 100644
index 95aeb2e64a40eb403a1f4df3c4b60cbcc056596c..0000000000000000000000000000000000000000
--- a/open-nfapi.oai.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --git a/nfapi/public_inc/nfapi_interface.h b/nfapi/public_inc/nfapi_interface.h
-index 2d58c2a..45af99a 100644
---- a/nfapi/public_inc/nfapi_interface.h
-+++ b/nfapi/public_inc/nfapi_interface.h
-@@ -34,7 +34,7 @@
- #define NFAPI_MAX_NUM_ANTENNAS 8
- #define NFAPI_MAX_NUM_SUBBANDS 13
- #define NFAPI_MAX_BF_VECTORS 8
--#define NFAPI_MAX_CC 1
-+#define NFAPI_MAX_CC 2
- #define NFAPI_MAX_NUM_PHYSICAL_ANTENNAS 8
- #define NFAPI_MAX_RSSI 8
- #define NFAPI_MAX_PSC_LIST 32
-@@ -1689,7 +1689,7 @@ typedef struct {
- 	uint16_t number_pdu;
- 	uint8_t number_pdsch_rnti;
- 	uint16_t transmission_power_pcfich;
--	nfapi_dl_config_request_pdu_t* dl_config_pdu_list;
-+        nfapi_dl_config_request_pdu_t* dl_config_pdu_list;
- } nfapi_dl_config_request_body_t;
- #define NFAPI_DL_CONFIG_REQUEST_BODY_TAG 0x2000
- 
-@@ -1772,7 +1772,7 @@ typedef struct {
- 	uint8_t number_of_cc;
- 	struct {
- 		uint8_t ri_size;
--		uint8_t dl_cqi_pmi_size;
-+		uint8_t dl_cqi_pmi_size[8];
- 	} cc[NFAPI_MAX_CC];
- } nfapi_ul_config_aperiodic_cqi_pmi_ri_report_t;
- 
-@@ -1962,7 +1962,7 @@ typedef struct {
- } nfapi_ul_config_harq_information_rel8_fdd_t;
- #define NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG 0x2019
- 
--typedef struct { 
-+typedef struct {  
- 	nfapi_tl_t tl;
- 	uint8_t harq_size;
- 	uint8_t ack_nack_mode;
diff --git a/openair1/Makefile b/openair1/Makefile
deleted file mode 100644
index 04be9ff8b0ed954d4019967c5d1dc707247db9dd..0000000000000000000000000000000000000000
--- a/openair1/Makefile
+++ /dev/null
@@ -1,121 +0,0 @@
-# command line flags are automatically exported and thus passed down to any sub-make. 
-# here we set the default flags in case on command line flags are provided
-# these flags have to be explicitely exported so that the sub-make is aware of them
-
-
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-ifndef OPENAIR_LTE
-export OPENAIR_LTE=1
-endif
-
-ifndef OPENAIR1
-export OPENAIR1=1
-endif
-
-ifndef OPENAIR2
-export OPENAIR2=0
-endif
-
-ifndef EMOS
-export EMOS=0
-endif
-
-ifndef FIRMWARE2010
-export FIRMWARE2010=0
-endif
-
-all: openair_rf_cbmimo1_softmodem.ko asn1_msg_kern.ko
-
-openair_rf_cbmimo1_softmodem.ko:  
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 && mv openair_rf.ko openair_rf_softmodem.ko)
-
-oai_user_cbmimo1.ko:
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 BIT8_TX=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko openair_rf_softmodem.ko)
-
-oai_user_exmimo.ko:
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko openair_rf_softmodem.ko)
-
-asn1_msg_kern.ko:
-	(cd ../openair2/RRC/LITE/MESSAGES && $(MAKE) -C $(KERNEL_DIR) V=0 M=`pwd` RTAI=1 -j2)
-
-#Remove all but source files
-cleanall: 
-	find -name '*.o' -delete -print; \
-	find -name '*.ko' -delete -print; \
-	find -name '*.bak' -delete -print; \
-	find -name '*.cmd' -delete -print; \
-	find -name '*~' -delete -print; \
-	find -name octave-core -delete -print; \
-
-#Remove files created by SVN, dangerous!!! DO NOT RUN ON YOUR WORKING REPOSITORY!
-#FK: Don't do this! Use svn export instead.
-#cleansvn:
-#	rm -rf `find -name *.svn* -print`; \
-#	find -name *.svn* -delete -print
-
-tgz:
-	mkdir /tmp/openair1_tmp; \
-	$(MAKE) cleanall; \
-	cp -r . /tmp/openair1_tmp; \
-	(cd /tmp/openair1_tmp && $(MAKE) cleansvn && cd .. && tar czfv openair1.tgz openair1_tmp) ; \
-	cp /tmp/openair1.tgz . ;\
-	rm -rf /tmp/openair1_tmp
-
-fifos:
-	@for i in `seq 0 64`;\
-	do \
-	have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
-	if [ "$$have_rtfX" -eq 0 ] ;then \
-	mknod -m 666 /dev/rtf$$i c 150 $$i; \
-	fi;\
-	done
-
-openair0:
-	mknod /dev/openair0 c 127 0
-	chmod a+rw /dev/openair0
-
-install_oai_user:
-	make fifos
-	insmod ARCH/CBMIMO1/DEVICE_DRIVER/openair_rf_softmodem.ko
-
-updatefw:
-	USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr_exmimo2/main -s 0x43fffff0 
-
-boot_exmimo:
-	sudo make install_oai_user
-	USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 
-	sudo rmmod openair_rf
-	sudo make install_oai_user
-
-reboot_exmimo:
-	USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 -b
-	rmmod openair_rf
-	make install_oai_user
-	USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 
-	rmmod openair_rf
-	make install_oai_user
-
-install_softmodem:
-	make fifos
-ifeq ($(OPENAIR2),1)
-	insmod ../openair2/RRC/LITE/MESSAGES/asn1_msg_kern.ko
-endif
-	insmod ARCH/CBMIMO1/DEVICE_DRIVER/openair_rf_softmodem.ko ; \
-
-remove:
-	rmmod openair_rf
-ifeq ($(OPENAIR2),1)
-	rmmod asn1_msg_kern
-endif
-
-test:
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) test RTAI=1 CBMIMO1=1)	
-	(cd ../openair2/RRC/LITE/MESSAGES && $(MAKE) test)
-
-clean: clean_l1 
-
-clean_l1:
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) clean RTAI=1 CBMIMO1=1)
-
-clean_asn1:
-	(cd ../openair2/RRC/LITE/MESSAGES && $(MAKE) clean)
diff --git a/openair1/PHY/CODING/3gpplte.c b/openair1/PHY/CODING/3gpplte.c
index 99b3923746705c8552682effdeec8a8cfb5b2582..61acdb2ad9d3040dca9ed68d4264cc0fe0e332c4 100644
--- a/openair1/PHY/CODING/3gpplte.c
+++ b/openair1/PHY/CODING/3gpplte.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -27,7 +27,9 @@
 #ifndef TC_MAIN
 //#include "defs.h"
 #endif
-
+#include <stdint.h>
+#include <stdio.h>
+#include "PHY/CODING/defs.h"
 #include "extern_3GPPinterleaver.h"
 
 //#define DEBUG_TURBO_ENCODER 1
@@ -35,7 +37,7 @@
 uint32_t threegpplte_interleaver_output;
 uint32_t threegpplte_interleaver_tmp;
 
-inline void threegpplte_interleaver_reset()
+inline void threegpplte_interleaver_reset(void)
 {
   threegpplte_interleaver_output = 0;
   threegpplte_interleaver_tmp    = 0;
@@ -82,7 +84,7 @@ uint8_t output_lut[16],state_lut[16];
 inline uint8_t threegpplte_rsc_lut(uint8_t input,uint8_t *state)
 {
 
-  uint8_t output;
+
   uint8_t off;
 
   off = (*state<<1)|input;
@@ -146,7 +148,7 @@ void threegpplte_turbo_encoder(uint8_t *input,
   for (i=0; f1f2mat[i].nb_bits!= input_length_bits && i <188; i++);
 
   if ( i == 188 ) {
-    msg("Illegal frame length!\n");
+    printf("Illegal frame length!\n");
     return;
   } else {
     base_interleaver=il_tb+f1f2mat[i].beg_index;
diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c
index aeec529562c5c200708e559c9b47cffa1a60b47d..8150f02da89abd7ed2e5351de2cf25057c238263 100644
--- a/openair1/PHY/CODING/3gpplte_sse.c
+++ b/openair1/PHY/CODING/3gpplte_sse.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -96,7 +96,7 @@ static inline void threegpplte_rsc_termination(unsigned char *x,unsigned char *z
   *state = (*state)>>1;
 }
 
-void treillis_table_init(void)
+static void treillis_table_init(void)
 {
   //struct treillis t[][]=all_treillis;
   //t=memalign(16,sizeof(struct treillis)*8*256);
@@ -536,12 +536,12 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
   }
 */
 
-void threegpplte_turbo_encoder(unsigned char *input,
-                               unsigned short input_length_bytes,
-                               unsigned char *output,
-                               unsigned char F,
-                               unsigned short interleaver_f1,
-                               unsigned short interleaver_f2)
+void threegpplte_turbo_encoder_sse(unsigned char *input,
+                                   unsigned short input_length_bytes,
+                                   unsigned char *output,
+                                   unsigned char F,
+                                   unsigned short interleaver_f1,
+                                   unsigned short interleaver_f2)
 {
 
   int i;
@@ -641,7 +641,24 @@ void threegpplte_turbo_encoder(unsigned char *input,
 #endif
 }
 
-
+void init_encoder_sse (void) {
+    treillis_table_init(); 	   
+}
+/* function which will be called by the shared lib loader, to check shared lib version
+   against main exec version. version mismatch no considered as fatal (interfaces not supposed to change)
+*/ 
+int  coding_checkbuildver(char * mainexec_buildversion, char ** shlib_buildversion)
+{
+#ifndef PACKAGE_VERSION
+#define PACKAGE_VERSION "standalone built: " __DATE__ __TIME__
+#endif
+    *shlib_buildversion = PACKAGE_VERSION;
+    if (strcmp(mainexec_buildversion, *shlib_buildversion) != 0) {
+          fprintf(stderr,"[CODING] shared lib version %s, doesn't match main version %s, compatibility should be checked\n",
+                mainexec_buildversion,*shlib_buildversion);
+    }
+    return 0;
+}
 
 #ifdef TC_MAIN
 #define INPUT_LENGTH 20 
@@ -679,7 +696,7 @@ int main(int argc,char **argv)
     printf("Input %d : %d\n",i,input[i]);
   }
 
-  threegpplte_turbo_encoder(&input[0],
+  threegpplte_turbo_encoder_sse(&input[0],
                             INPUT_LENGTH,
                             &output[0],
                             0,
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder.c b/openair1/PHY/CODING/3gpplte_turbo_decoder.c
index c6976df16495685095be08c80588f304ed33ebb9..c0e4ca12db42a30e768718336467da778dac3aa3 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -550,7 +550,7 @@ void compute_alpha_s(llr_t* alpha,llr_t* m_11,llr_t* m_10,unsigned short frame_l
 
 void compute_beta_s(llr_t* beta,llr_t *m_11,llr_t* m_10,llr_t* alpha,unsigned short frame_length,unsigned char F)
 {
-  int k,i;
+  int k;
   llr_t old0, old1, old2, old3, old4, old5, old6, old7;
   llr_t new0, new1, new2, new3, new4, new5, new6, new7;
   llr_t m_b0, m_b1, m_b2, m_b3, m_b4,m_b5, m_b6, m_b7;
@@ -874,14 +874,22 @@ void compute_ext_s(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext,
 
 
 unsigned char phy_threegpplte_turbo_decoder_scalar(llr_t *y,
+    llr_t *y2,
     unsigned char *decoded_bytes,
+    unsigned char *decoded_bytes2,
     unsigned short n,
     unsigned short f1,
     unsigned short f2,
     unsigned char max_iterations,
     unsigned char crc_type,
     unsigned char F,
-    unsigned char inst)
+    time_stats_t *init_stats,
+    time_stats_t *alpha_stats,
+    time_stats_t *beta_stats,
+    time_stats_t *gamma_stats,
+    time_stats_t *ext_stats,
+    time_stats_t *intl1_stats,
+    time_stats_t *intl2_stats)
 {
 
   /*  y is a pointer to the input
@@ -897,7 +905,7 @@ unsigned char phy_threegpplte_turbo_decoder_scalar(llr_t *y,
   unsigned char crc_len,temp;
 
   if (crc_type > 3) {
-    msg("Illegal crc length!\n");
+    fprintf(stderr,"Illegal crc length!\n");
     return 255;
   }
 
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
index 4efd366bed2cb39058fa685b7e4f53baeb2dccb2..ef0ca48df465971ed2b89b66068f366a4937a519 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -37,9 +37,9 @@
 ///
 ///
 
-#ifdef __AVX2__
 
-#include "PHY/sse_intrin.h"
+
+
 
 #ifndef TEST_DEBUG
 #include "PHY/defs.h"
@@ -58,6 +58,8 @@
 #include "mex.h"
 #endif
 
+#ifdef __AVX2__
+#include "PHY/sse_intrin.h"
 
 //#define DEBUG_LOGMAP
 
@@ -830,14 +832,14 @@ void free_td16avx2(void)
   int ind;
 
   for (ind=0; ind<188; ind++) {
-    free(pi2tab16avx2[ind]);
-    free(pi5tab16avx2[ind]);
-    free(pi4tab16avx2[ind]);
-    free(pi6tab16avx2[ind]);
+    free_and_zero(pi2tab16avx2[ind]);
+    free_and_zero(pi5tab16avx2[ind]);
+    free_and_zero(pi4tab16avx2[ind]);
+    free_and_zero(pi6tab16avx2[ind]);
   }
 }
 
-void init_td16avx2()
+void init_td16avx2(void)
 {
 
   int ind,i,i2,i3,j,n,pi,pi2_i,pi2_pi;
@@ -1408,6 +1410,36 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
 #endif
   return(iteration_cnt);
 }
+#else  //__AVX2__
+unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
+						  int16_t *y2,
+						  uint8_t *decoded_bytes,
+						  uint8_t *decoded_bytes2,
+						  uint16_t n,
+						  uint16_t f1,
+						  uint16_t f2,
+						  uint8_t max_iterations,
+						  uint8_t crc_type,
+						  uint8_t F,
+						  time_stats_t *init_stats,
+						  time_stats_t *alpha_stats,
+						  time_stats_t *beta_stats,
+						  time_stats_t *gamma_stats,
+						  time_stats_t *ext_stats,
+						  time_stats_t *intl1_stats,
+						  time_stats_t *intl2_stats)
+{
+   return 0;
+}
+void free_td16avx2(void)
+{
+
+}
+
+void init_td16avx2(void)
+{
+    
+}
 
 #endif //__AVX2__
 
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse.c
index 085dbb723c3eee5382886e253fdaebc5ac9a520e..f628bff55b7c08223ad13efff2807c8a9a4fb658 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -1907,6 +1907,18 @@ void compute_ext(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext, ll
 //int pi2[n],pi3[n+8],pi5[n+8],pi4[n+8],pi6[n+8],
 int *pi2tab[188],*pi5tab[188],*pi4tab[188],*pi6tab[188];
 
+void free_td()
+{
+  int ind;
+
+  for (ind = 0; ind < 188; ind++) {
+    free_and_zero(pi2tab[ind]);
+    free_and_zero(pi5tab[ind]);
+    free_and_zero(pi4tab[ind]);
+    free_and_zero(pi6tab[ind]);
+  }
+}
+
 void init_td()
 {
 
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
index a1e408dcda72ff57ec520b8138e0193266155f7c..ae3ce531d037cce540522aa6454a20ab96733132 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -1117,14 +1117,14 @@ void free_td16(void)
   int ind;
 
   for (ind=0; ind<188; ind++) {
-    free(pi2tab16[ind]);
-    free(pi5tab16[ind]);
-    free(pi4tab16[ind]);
-    free(pi6tab16[ind]);
+    free_and_zero(pi2tab16[ind]);
+    free_and_zero(pi5tab16[ind]);
+    free_and_zero(pi4tab16[ind]);
+    free_and_zero(pi6tab16[ind]);
   }
 }
 
-void init_td16()
+void init_td16(void)
 {
 
   int ind,i,i2,i3,j,n,pi,pi3;
@@ -1172,7 +1172,9 @@ void init_td16()
 }
 
 unsigned char phy_threegpplte_turbo_decoder16(short *y,
+    short *y2,
     unsigned char *decoded_bytes,
+    unsigned char *decoded_bytes2,
     unsigned short n,
     unsigned short f1,
     unsigned short f2,
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
index b43f477e0693428638357f50a5528bc8621f4102..5b7174e98964b9c9fec7e450fb892778755e57ff 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -838,10 +838,10 @@ void free_td8(void)
   int ind;
 
   for (ind=0; ind<188; ind++) {
-    free(pi2tab8[ind]);
-    free(pi5tab8[ind]);
-    free(pi4tab8[ind]);
-    free(pi6tab8[ind]);
+    free_and_zero(pi2tab8[ind]);
+    free_and_zero(pi5tab8[ind]);
+    free_and_zero(pi4tab8[ind]);
+    free_and_zero(pi6tab8[ind]);
   }
 }
 
@@ -849,7 +849,7 @@ void free_td8(void)
 
 extern RAN_CONTEXT_t RC;
 
-void init_td8()
+void init_td8(void)
 {
 
   int ind,i,j,n,n2,pi,pi3;
@@ -898,7 +898,9 @@ void init_td8()
 }
 
 unsigned char phy_threegpplte_turbo_decoder8(short *y,
+    short y2,
     unsigned char *decoded_bytes,
+    unsigned char *decoded_bytes2,
     unsigned short n,
     unsigned short f1,
     unsigned short f2,
diff --git a/openair1/PHY/CODING/Makefile.arm b/openair1/PHY/CODING/Makefile.arm
index 07dbf559098a689e12c8db2d657fb16c296f363c..04598075e325aaa6b048b8a4e9ca54625793214a 100644
--- a/openair1/PHY/CODING/Makefile.arm
+++ b/openair1/PHY/CODING/Makefile.arm
@@ -5,7 +5,7 @@ RATE12CC_SRC = ccoding_byte.c viterbi.c crc_byte.c
 all: 3gpplte_sse 
 
 3gpplte_sse: $(TURBO_SRC)
-	gcc -O3  -gdwarf-2 -mfloat-abi=hard -mfpu=neon -lm -lgcc -lrt ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DTC_MAIN -DNB_ANTENNAS_RX=1 -o 3gpplte_sse 3gpplte_sse.c -Wall -g -ggdb -DTC_MAIN
+	gcc -O3  -gdwarf-2 -mfloat-abi=hard -mfpu=neon -lm -lgcc -lrt ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DTC_MAIN -DNB_ANTENNAS_RX=1 -o 3gpplte_sse 3gpplte_sse.c -Wall -g -ggdb -DTC_MAIN
 
 
 
diff --git a/openair1/PHY/CODING/TESTBENCH/Makefile b/openair1/PHY/CODING/TESTBENCH/Makefile
index a8ddd1fcb55b59875f018b17cb8e2ca4f95b30a1..030f19b47bb0747fa1c28c944721fa74ca6a487b 100644
--- a/openair1/PHY/CODING/TESTBENCH/Makefile
+++ b/openair1/PHY/CODING/TESTBENCH/Makefile
@@ -7,7 +7,7 @@ OPENAIR2_TOP = $(OPENAIR2_DIR)
 OPENAIR3 = $(OPENAIR3_DIR)
 
 
-CFLAGS += -DNODE_RG -DUSER_MODE -DPC_TARGET -DNO_UL_REF -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DOPENAIR_LTE -DMAX_NUM_CCs=1
+CFLAGS += -DNODE_RG -DNO_UL_REF -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DOPENAIR_LTE -DMAX_NUM_CCs=1
 
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
diff --git a/openair1/PHY/CODING/TESTBENCH/ltetest.c b/openair1/PHY/CODING/TESTBENCH/ltetest.c
index 6bc5e2526430336465824f72a9ac26d866536ccc..77e1f3f14fdc5292bd77e6d7507fa16da6fd2017 100644
--- a/openair1/PHY/CODING/TESTBENCH/ltetest.c
+++ b/openair1/PHY/CODING/TESTBENCH/ltetest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/TESTBENCH/pdcch_test.c b/openair1/PHY/CODING/TESTBENCH/pdcch_test.c
index c083da85a776935fff8d721f913c5525ed1485af..9e055412f0e0117c2a75f8b358c4335110b11138 100644
--- a/openair1/PHY/CODING/TESTBENCH/pdcch_test.c
+++ b/openair1/PHY/CODING/TESTBENCH/pdcch_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/TESTBENCH/viterbi_test.c b/openair1/PHY/CODING/TESTBENCH/viterbi_test.c
index 907d7b6384659f46c591dfae544e771a30ca2002..385910f680ec52caaee86d45fedc902ce822b0c7 100644
--- a/openair1/PHY/CODING/TESTBENCH/viterbi_test.c
+++ b/openair1/PHY/CODING/TESTBENCH/viterbi_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/ccoding_byte.c b/openair1/PHY/CODING/ccoding_byte.c
index 5595ee9af3815510d0fcdf4c1adc3970e16556b8..8511a5ea0f7103cfcf252a9ededf4103ab8e4977 100644
--- a/openair1/PHY/CODING/ccoding_byte.c
+++ b/openair1/PHY/CODING/ccoding_byte.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/ccoding_byte_lte.c b/openair1/PHY/CODING/ccoding_byte_lte.c
index ac3ff1cd7b3702a4ccb7318e49dba0376946c964..6eb654827bc874c9d27a405d2975b014a572a32d 100644
--- a/openair1/PHY/CODING/ccoding_byte_lte.c
+++ b/openair1/PHY/CODING/ccoding_byte_lte.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/coding_load.c b/openair1/PHY/CODING/coding_load.c
new file mode 100644
index 0000000000000000000000000000000000000000..31f71e6b31965e7777cba5fb9b4a2f260c56da51
--- /dev/null
+++ b/openair1/PHY/CODING/coding_load.c
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file openair1/PHY/CODING
+ * \brief: load library implementing coding/decoding algorithms
+ * \author Francois TABURET
+ * \date 2017
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+#define _GNU_SOURCE 
+#include <sys/types.h>
+
+
+#include "PHY/defs.h"
+#include "PHY/extern.h"
+#include "common/utils/load_module_shlib.h" 
+#include "common/utils/telnetsrv/telnetsrv.h" 
+
+static int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt);
+static telnetshell_cmddef_t coding_cmdarray[] = {
+   {"mode","[sse,avx2,stdc,none]",coding_setmod_cmd},
+   {"","",NULL},
+};
+telnetshell_vardef_t coding_vardef[] = {
+{"maxiter",TELNET_VARTYPE_INT32,&max_turbo_iterations},
+{"",0,NULL}
+};
+/* PHY/defs.h contains MODE_DECODE_XXX macros, following table must match */
+static char *modedesc[] = {"none","sse","C","avx2"};
+static int curmode;
+/* function description array, to be used when loading the encoding/decoding shared lib */
+loader_shlibfunc_t shlib_fdesc[DECODE_NUM_FPTR];
+
+/* encoding decoding functions pointers, filled here and used when encoding/decoding */
+/*defined as extern in PHY?CODING/extern.h */
+decoder_if_t    decoder16;
+decoder_if_t    decoder8;
+encoder_if_t    encoder;
+
+extern int _may_i_use_cpu_feature(unsigned __int64);
+uint8_t  nodecod(short *y,
+    short *y2,
+    unsigned char *decoded_bytes,
+    unsigned char *decoded_bytes2,
+    unsigned short n,
+    unsigned short f1,
+    unsigned short f2,
+    unsigned char max_iterations,
+    unsigned char crc_type,
+    unsigned char F,
+    time_stats_t *init_stats,
+    time_stats_t *alpha_stats,
+    time_stats_t *beta_stats,
+    time_stats_t *gamma_stats,
+    time_stats_t *ext_stats,
+    time_stats_t *intl1_stats,
+    time_stats_t *intl2_stats)
+{
+ return max_iterations+1;
+};
+
+void decoding_setmode (int mode) {
+   switch (mode) {
+       case MODE_DECODE_NONE:
+          decoder8=nodecod;
+          decoder16=nodecod;
+          encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
+       break;
+       case MODE_DECODE_C:
+          decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
+          decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
+          encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;   
+       break;
+       case MODE_DECODE_AVX2:
+          decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
+          decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr; 
+          encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;  
+       break;
+       default:
+           mode=MODE_DECODE_SSE;
+       case MODE_DECODE_SSE:
+          decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr; 
+          decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
+          encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
+       break;
+   }
+   curmode=mode;
+}
+
+
+int load_codinglib(void) {
+ int ret;
+ 
+     memset(shlib_fdesc,0,sizeof(shlib_fdesc));
+     shlib_fdesc[DECODE_INITTD8_SSE_FPTRIDX].fname = "init_td8";
+     shlib_fdesc[DECODE_INITTD16_SSE_FPTRIDX].fname= "init_td16";
+     shlib_fdesc[DECODE_INITTD_AVX2_FPTRIDX].fname="init_td16avx2";
+
+     shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fname=   "phy_threegpplte_turbo_decoder8";
+     shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fname=  "phy_threegpplte_turbo_decoder16";
+     shlib_fdesc[DECODE_TD_C_FPTRIDX].fname=      "phy_threegpplte_turbo_decoder_scalar";
+     shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fname= "phy_threegpplte_turbo_decoder16avx2";
+
+
+     shlib_fdesc[DECODE_FREETD8_FPTRIDX].fname =    "free_td8";
+     shlib_fdesc[DECODE_FREETD16_FPTRIDX].fname=    "free_td16";
+     shlib_fdesc[DECODE_FREETD_AVX2_FPTRIDX].fname= "free_td16avx2";    
+
+     shlib_fdesc[ENCODE_SSE_FPTRIDX].fname=    "threegpplte_turbo_encoder_sse";
+     shlib_fdesc[ENCODE_C_FPTRIDX].fname=      "threegpplte_turbo_encoder";
+     shlib_fdesc[ENCODE_INIT_SSE_FPTRIDX].fname=       "init_encoder_sse";
+     ret=load_module_shlib("coding",shlib_fdesc,DECODE_NUM_FPTR);
+     if (ret < 0) exit_fun("Error loading coding library");
+
+/* execute encoder/decoder init functions */     
+     shlib_fdesc[DECODE_INITTD8_SSE_FPTRIDX].fptr();
+     shlib_fdesc[DECODE_INITTD16_SSE_FPTRIDX].fptr();
+     if(shlib_fdesc[DECODE_INITTD_AVX2_FPTRIDX].fptr != NULL) {
+        shlib_fdesc[DECODE_INITTD_AVX2_FPTRIDX].fptr();
+     }
+     if(shlib_fdesc[ENCODE_INIT_SSE_FPTRIDX].fptr != NULL) {
+        shlib_fdesc[ENCODE_INIT_SSE_FPTRIDX].fptr();
+     }
+     decoding_setmode(MODE_DECODE_SSE);
+/* look for telnet server, if it is loaded, add the coding commands to it */
+     add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
+     if (addcmd != NULL) {
+         addcmd("coding",coding_vardef,coding_cmdarray); 
+     }
+return 0;
+}
+
+void free_codinglib(void) {
+
+     shlib_fdesc[DECODE_FREETD8_FPTRIDX].fptr();
+     shlib_fdesc[DECODE_FREETD16_FPTRIDX].fptr();
+     shlib_fdesc[DECODE_FREETD_AVX2_FPTRIDX].fptr();
+
+
+}
+
+/* functions for telnet support, when telnet server is loaded */
+int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt)
+{
+   if (debug > 0)
+       prnt( "coding_setmod_cmd received %s\n",buff);
+
+      if (strcasestr(buff,"sse") != NULL) {
+         decoding_setmode(MODE_DECODE_SSE);
+      } else if (strcasestr(buff,"avx2") != NULL) {
+         decoding_setmode(MODE_DECODE_AVX2);
+      } else if (strcasestr(buff,"stdc") != NULL) {
+         decoding_setmode(MODE_DECODE_C);
+      } else if (strcasestr(buff,"none") != NULL) {
+         decoding_setmode(MODE_DECODE_NONE);
+      } else {
+          prnt("%s: wrong setmod parameter...\n",buff);
+      }
+   prnt("Coding and decoding current mode: %s\n",modedesc[curmode]);
+   return 0;
+}
diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c
index 46d48e5d69e65e7d33dba48214b582b99abda1cb..21427de19b88c1568ac96b4a08b40b4d0813f1f2 100644
--- a/openair1/PHY/CODING/crc_byte.c
+++ b/openair1/PHY/CODING/crc_byte.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -31,13 +31,6 @@
 */
 
 
-#ifndef USER_MODE
-#define __NO_VERSION__
-
-#endif
-
-//#include "PHY/types.h"
-
 #include "defs.h"
 
 
@@ -116,7 +109,7 @@ crc24a (unsigned char * inptr, int bitlen)
   resbit = (bitlen % 8);
 
   while (octetlen-- > 0) {
-    //    printf("in %x => crc %x\n",crc,*inptr);
+    //   printf("crc24a: in %x => crc %x\n",crc,*inptr);
     crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)];
   }
 
@@ -135,6 +128,7 @@ unsigned int crc24b (unsigned char * inptr, int bitlen)
   resbit = (bitlen % 8);
 
   while (octetlen-- > 0) {
+    //    printf("crc24b: in %x => crc %x (%x)\n",crc,*inptr,crc24bTable[(*inptr) ^ (crc >> 24)]);
     crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)];
   }
 
diff --git a/openair1/PHY/CODING/defs.h b/openair1/PHY/CODING/defs.h
index 97dcc11b2e690417bc1a0956d401293e9715d204..40e19964dfa1abc0d847f84bfc2560ee3f2ea96f 100644
--- a/openair1/PHY/CODING/defs.h
+++ b/openair1/PHY/CODING/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,11 +29,7 @@
 
 #include <stdint.h>
 
-#ifndef NO_OPENAIR1
 #include "PHY/defs.h"
-#else
-#include "PHY/TOOLS/time_meas.h"
-#endif
 
 #define CRC24_A 0
 #define CRC24_B 1
@@ -41,7 +37,7 @@
 #define CRC8 3
 
 #define MAX_TURBO_ITERATIONS_MBSFN 8
-#define MAX_TURBO_ITERATIONS 4
+#define MAX_TURBO_ITERATIONS max_turbo_iterations
 
 #define LTE_NULL 2
 
@@ -296,25 +292,9 @@ void ccodedot11_init(void);
 \brief This function initializes the trellis structure for decoding an 802.11 convolutional code.*/
 void ccodedot11_init_inv(void);
 
-/*!\fn void teillis_table_init(void)
-\brief This function initializes the trellis structure for 3GPP LTE Turbo code.*/
-void treillis_table_init(void);
-
-/*\fn void threegpplte_turbo_encoder(uint8_t *input,uint16_t input_length_bytes,uint8_t *output,uint8_t F,uint16_t interleaver_f1,uint16_t interleaver_f2)
-\brief This function implements a rate 1/3 8-state parralel concatenated turbo code (3GPP-LTE).
-@param input Pointer to input buffer
-@param input_length_bytes Number of bytes to encode
-@param output Pointer to output buffer
-@param F Number of filler bits at input
-@param interleaver_f1 F1 generator
-@param interleaver_f2 F2 generator
-*/
-void threegpplte_turbo_encoder(uint8_t *input,
-                               uint16_t input_length_bytes,
-                               uint8_t *output,
-                               uint8_t F,
-                               uint16_t interleaver_f1,
-                               uint16_t interleaver_f2);
+
+
+
 
 
 /** \fn void ccodelte_encode(int32_t numbits,uint8_t add_crc, uint8_t *inPtr,uint8_t *outPtr,uint16_t rnti)
@@ -356,26 +336,8 @@ void ccodedab_init_inv(void);
 \brief This function initializes the different crc tables.*/
 void crcTableInit (void);
 
-/*!\fn void init_td8(void)
-\brief This function initializes the tables for 8-bit LLR Turbo decoder.*/
-void init_td8 (void);
-
-
-/*!\fn void init_td16(void)
-\brief This function initializes the tables for 16-bit LLR Turbo decoder.*/
-void init_td16 (void);
-
-#ifdef __AVX2__
-/*!\fn void init_td8(void)
-\brief This function initializes the tables for 8-bit LLR Turbo decoder (AVX2).*/
-void init_td8avx2 (void);
 
 
-/*!\fn void init_td16(void)
-\brief This function initializes the tables for 16-bit LLR Turbo decoder (AVX2).*/
-void init_td16avx2 (void);
-#endif
-
 /*!\fn uint32_t crc24a(uint8_t *inPtr, int32_t bitlen)
 \brief This computes a 24-bit crc ('a' variant for overall transport block)
 based on 3GPP UMTS/LTE specifications.
@@ -464,95 +426,7 @@ int32_t rate_matching_lte(uint32_t N_coded,
                           uint32_t off);
 
 
-/*!
-\brief This routine performs max-logmap detection for the 3GPP turbo code (with termination).  It is optimized for SIMD processing and 16-bit
-LLR arithmetic, and requires SSE2,SSSE3 and SSE4.1 (gcc >=4.3 and appropriate CPU)
-@param y LLR input (16-bit precision)
-@param decoded_bytes Pointer to decoded output
-@param n number of coded bits (including tail bits)
-@param max_iterations The maximum number of iterations to perform
-@param interleaver_f1 F1 generator
-@param interleaver_f2 F2 generator
-@param crc_type Length of 3GPPLTE crc (CRC24a,CRC24b,CRC16,CRC8)
-@param F Number of filler bits at start of packet
-@returns number of iterations used (this is 1+max if incorrect crc or if crc_len=0)
-*/
-uint8_t phy_threegpplte_turbo_decoder16(int16_t *y,
-                                        uint8_t *decoded_bytes,
-                                        uint16_t n,
-                                        uint16_t interleaver_f1,
-                                        uint16_t interleaver_f2,
-                                        uint8_t max_iterations,
-                                        uint8_t crc_type,
-                                        uint8_t F,
-                                        time_stats_t *init_stats,
-                                        time_stats_t *alpha_stats,
-                                        time_stats_t *beta_stats,
-                                        time_stats_t *gamma_stats,
-                                        time_stats_t *ext_stats,
-                                        time_stats_t *intl1_stats,
-                                        time_stats_t *intl2_stats);
-
-uint8_t phy_threegpplte_turbo_decoder16avx2(int16_t *y,
-					    int16_t *y2,
-					    uint8_t *decoded_bytes,
-					    uint8_t *decoded_bytes2,
-					    uint16_t n,
-					    uint16_t interleaver_f1,
-					    uint16_t interleaver_f2,
-					    uint8_t max_iterations,
-					    uint8_t crc_type,
-					    uint8_t F,
-					    time_stats_t *init_stats,
-					    time_stats_t *alpha_stats,
-					    time_stats_t *beta_stats,
-					    time_stats_t *gamma_stats,
-					    time_stats_t *ext_stats,
-					    time_stats_t *intl1_stats,
-					    time_stats_t *intl2_stats);
-
-/*!
-\brief This routine performs max-logmap detection for the 3GPP turbo code (with termination).  It is optimized for SIMD processing and 8-bit
-LLR arithmetic, and requires SSE2,SSSE3 and SSE4.1 (gcc >=4.3 and appropriate CPU)
-@param y LLR input (16-bit precision)
-@param decoded_bytes Pointer to decoded output
-@param n number of coded bits (including tail bits)
-@param max_iterations The maximum number of iterations to perform
-@param interleaver_f1 F1 generator
-@param interleaver_f2 F2 generator
-@param crc_type Length of 3GPPLTE crc (CRC24a,CRC24b,CRC16,CRC8)
-@param F Number of filler bits at start of packet
-@returns number of iterations used (this is 1+max if incorrect crc or if crc_len=0)
-*/
-uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
-                                       uint8_t *decoded_bytes,
-                                       uint16_t n,
-                                       uint16_t interleaver_f1,
-                                       uint16_t interleaver_f2,
-                                       uint8_t max_iterations,
-                                       uint8_t crc_type,
-                                       uint8_t F,
-                                       time_stats_t *init_stats,
-                                       time_stats_t *alpha_stats,
-                                       time_stats_t *beta_stats,
-                                       time_stats_t *gamma_stats,
-                                       time_stats_t *ext_stats,
-                                       time_stats_t *intl1_stats,
-                                       time_stats_t *intl2_stats);
-
-uint8_t phy_threegpplte_turbo_decoder_scalar(int16_t *y,
-    uint8_t *decoded_bytes,
-    uint16_t n,
-    uint16_t interleaver_f1,
-    uint16_t interleaver_f2,
-    uint8_t max_iterations,
-    uint8_t crc_type,
-    uint8_t F,
-    uint8_t inst);
-
-
-
-/** @} */
+
 
 uint32_t crcbit (uint8_t * ,
                  int32_t,
diff --git a/openair1/PHY/CODING/defs_NB_IoT.h b/openair1/PHY/CODING/defs_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..2a6bee792412ae4f73d38f741b6ef5b615065418
--- /dev/null
+++ b/openair1/PHY/CODING/defs_NB_IoT.h
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/* file: PHY/CODING/defs_NB_IoT.h
+   purpose: Top-level definitions, data types and function prototypes for openairinterface coding blocks for NB-IoT
+   author: matthieu.kanj@b-com.com, raymond.knopp@eurecom.fr, michele.paffetti@studio.unibo.it
+   date: 29.06.2017
+*/
+
+#ifndef OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_
+#define OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_
+
+#include <stdint.h>  // for uint8/16/32_t
+
+/* check if this ifndef is required for NB-IoT ?!
+//#ifndef NO_OPENAIR1
+//#include "PHY/defs_NB_IoT.h"
+//#else
+//#include "PHY/TOOLS/time_meas.h"
+//#endif
+*/
+
+#define CRC24_A_NB_IoT 0
+#define CRC24_B_NB_IoT 1
+#define CRC16_NB_IoT 2
+#define CRC8_NB_IoT 3
+
+//#define MAX_TURBO_ITERATIONS_MBSFN 8  // no MBSFN
+#define MAX_TURBO_ITERATIONS_NB_IoT 4
+
+#define LTE_NULL_NB_IoT 2  // defined also in PHY/LTE_TRANSPORT/defs_NB_IoT.h
+
+/** \fn uint32_t sub_block_interleaving_cc(uint32_t D, uint8_t *d,uint8_t *w)
+\brief This is the subblock interleaving algorithm for convolutionally coded blocks from 36-212 (Release 13.4, 2017).
+This function takes the d-sequence and generates the w-sequence.  The nu-sequence from 36-212 is implicit.
+\param D Number of input bits
+\param d Pointer to input (d-sequence, convolutional code output)
+\param w Pointer to output (w-sequence, interleaver output)
+\returns Interleaving matrix cardinality (\f$K_{\pi}\f$  from 36-212)
+*/
+uint32_t sub_block_interleaving_cc_NB_IoT(uint32_t D, uint8_t *d,uint8_t *w);
+
+/**
+\brief This is the NB-IoT rate matching algorithm for Convolutionally-coded channels (e.g. BCH,DCI,UCI).  It is taken directly from 36-212 (Rel 8 8.6, 2009-03), pages 16-18 )
+\param RCC R^CC_subblock from subblock interleaver (number of rows in interleaving matrix) for up to 8 segments
+\param E Number of coded channel bits
+\param w This is a pointer to the w-sequence (second interleaver output)
+\param e This is a pointer to the e-sequence (rate matching output, channel input/output bits)
+\returns \f$E\f$, the number of coded bits per segment */
+
+uint32_t lte_rate_matching_cc_NB_IoT(uint32_t RCC,      // RRC = 2
+				     				 uint16_t E,        // E = 1600
+				     				 uint8_t *w,	// length
+				    				 uint8_t *e);	// length 1600
+
+/** \fn void ccodelte_encode(int32_t numbits,uint8_t add_crc, uint8_t *inPtr,uint8_t *outPtr,uint16_t rnti)
+\brief This function implements the LTE convolutional code of rate 1/3
+  with a constraint length of 7 bits. The inputs are bit packed in octets
+(from MSB to LSB). Trellis tail-biting is included here.
+@param numbits Number of bits to encode
+@param add_crc crc to be appended (8 bits) if add_crc = 1
+@param inPtr Pointer to input buffer
+@param outPtr Pointer to output buffer
+@param rnti RNTI for CRC scrambling
+*/
+
+void ccode_encode_NB_IoT (int32_t numbits,
+						  uint8_t add_crc,
+						  uint8_t *inPtr,
+						  uint8_t *outPtr,
+						  uint16_t rnti);
+
+/*!\fn void ccodelte_init(void)
+\brief This function initializes the generator polynomials for an LTE convolutional code.*/
+void ccodelte_init_NB_IoT(void);
+
+/*!\fn void crcTableInit(void)
+\brief This function initializes the different crc tables.*/
+void crcTableInit_NB_IoT (void);
+
+
+/*!\fn uint32_t crc24a(uint8_t *inPtr, int32_t bitlen)
+\brief This computes a 24-bit crc ('a' variant for overall transport block)
+based on 3GPP UMTS/LTE specifications.
+@param inPtr Pointer to input byte stream
+@param bitlen length of inputs in bits
+*/
+uint32_t crc24a_NB_IoT (uint8_t *inPtr, int32_t bitlen);
+
+/*!\fn uint32_t crc24b(uint8_t *inPtr, int32_t bitlen)
+\brief This computes a 24-bit crc ('b' variant for transport-block segments)
+based on 3GPP UMTS/LTE specifications.
+@param inPtr Pointer to input byte stream
+@param bitlen length of inputs in bits
+*/
+uint32_t crc24b_NB_IoT (uint8_t *inPtr, int32_t bitlen);
+
+/*!\fn uint32_t crc16(uint8_t *inPtr, int32_t bitlen)
+\brief This computes a 16-bit crc based on 3GPP UMTS specifications.
+@param inPtr Pointer to input byte stream
+@param bitlen length of inputs in bits*/
+uint32_t crc16_NB_IoT (uint8_t *inPtr, int32_t bitlen);
+
+/*!\fn uint32_t crc8(uint8_t *inPtr, int32_t bitlen)
+\brief This computes a 8-bit crc based on 3GPP UMTS specifications.
+@param inPtr Pointer to input byte stream
+@param bitlen length of inputs in bits*/
+uint32_t crc8_NB_IoT  (uint8_t *inPtr, int32_t bitlen);
+
+
+
+
+
+
+uint32_t crcbit_NB_IoT (uint8_t * ,
+                 		int32_t,
+                 		uint32_t);
+
+
+/*!\fn void phy_viterbi_lte_sse2(int8_t *y, uint8_t *decoded_bytes, uint16_t n)
+\brief This routine performs a SIMD optmized Viterbi decoder for the LTE 64-state tail-biting convolutional code.
+@param y Pointer to soft input (coded on 8-bits but should be limited to 4-bit precision to avoid overflow)
+@param decoded_bytes Pointer to decoded output
+@param n Length of input/trellis depth in bits*/
+//void phy_viterbi_lte_sse2(int8_t *y,uint8_t *decoded_bytes,uint16_t n);
+void phy_viterbi_lte_sse2_NB_IoT(int8_t *y,uint8_t *decoded_bytes,uint16_t n);
+
+/** \fn void sub_block_deinterleaving_cc(uint32_t D, int8_t *d,int8_t *w)
+\brief This is the subblock deinterleaving algorithm for convolutionally-coded data from 36-212 (Release 8, 8.6 2009-03), pages 15-16.
+This function takes the w-sequence and generates the d-sequence.  The nu-sequence from 36-212 is implicit.
+\param D Number of input bits
+\param d Pointer to output (d-sequence, turbo code output)
+\param w Pointer to input (w-sequence, interleaver output)
+*/
+void sub_block_deinterleaving_cc_NB_IoT(uint32_t D,int8_t *d,int8_t *w);
+
+
+/*
+\brief This is the LTE rate matching algorithm for Convolutionally-coded channels (e.g. BCH,DCI,UCI).  It is taken directly from 36-212 (Rel 8 8.6, 2009-03), pages 16-18 )
+\param RCC R^CC_subblock from subblock interleaver (number of rows in interleaving matrix)
+\param E This the number of coded bits allocated for channel
+\param w This is a pointer to the soft w-sequence (second interleaver output) with soft-combined outputs from successive HARQ rounds
+\param dummy_w This is the first row of the interleaver matrix for identifying/discarding the "LTE-NULL" positions
+\param soft_input This is a pointer to the soft channel output
+\returns \f$E\f$, the number of coded bits per segment
+*/
+void lte_rate_matching_cc_rx_NB_IoT(uint32_t RCC,
+                             		uint16_t E,
+                             		int8_t *w,
+                             		uint8_t *dummy_w,
+                             		int8_t *soft_input);
+
+/** \fn generate_dummy_w_cc(uint32_t D, uint8_t *w)
+\brief This function generates a dummy interleaved sequence (first row) for receiver (convolutionally-coded data), in order to identify the NULL positions used to make the matrix complete.
+\param D Number of systematic bits plus 4 (plus 4 for termination)
+\param w This is the dummy sequence (first row), it will contain zeros and at most 31 "LTE_NULL" values
+\returns Interleaving matrix cardinality (\f$K_{\pi}\f$ from 36-212)
+*/
+uint32_t generate_dummy_w_cc_NB_IoT(uint32_t D, uint8_t *w);
+
+/** \fn lte_segmentation(uint8_t *input_buffer,
+              uint8_t **output_buffers,
+            uint32_t B,
+            uint32_t *C,
+            uint32_t *Cplus,
+            uint32_t *Cminus,
+            uint32_t *Kplus,
+            uint32_t *Kminus,
+            uint32_t *F)
+\brief This function implements the LTE transport block segmentation algorithm from 36-212, V8.6 2009-03.
+@param input_buffer
+@param output_buffers
+@param B
+@param C
+@param Cplus
+@param Cminus
+@param Kplus
+@param Kminus
+@param F
+*/
+int32_t lte_segmentation_NB_IoT(uint8_t *input_buffer,
+                         		uint8_t **output_buffers,
+                         		uint32_t B,
+                         		uint32_t *C,
+                         		uint32_t *Cplus,
+                         		uint32_t *Cminus,
+                         		uint32_t *Kplus,
+                         		uint32_t *Kminus,
+                         		uint32_t *F);
+
+/** \fn void sub_block_deinterleaving_turbo(uint32_t D, int16_t *d,int16_t *w)
+\brief This is the subblock deinterleaving algorithm from 36-212 (Release 8, 8.6 2009-03), pages 15-16.
+This function takes the w-sequence and generates the d-sequence.  The nu-sequence from 36-212 is implicit.
+\param D Number of systematic bits plus 4 (plus 4 for termination)
+\param d Pointer to output (d-sequence, turbo code output)
+\param w Pointer to input (w-sequence, interleaver output)
+*/
+//*****************void sub_block_deinterleaving_turbo(uint32_t D, int16_t *d,int16_t *w);
+
+/**
+\brief This is the LTE rate matching algorithm for Turbo-coded channels (e.g. DLSCH,ULSCH).  It is taken directly from 36-212 (Rel 8 8.6, 2009-03), pages 16-18 )
+\param RTC R^TC_subblock from subblock interleaver (number of rows in interleaving matrix)
+\param G This the number of coded transport bits allocated in sub-frame
+\param w This is a pointer to the soft w-sequence (second interleaver output) with soft-combined outputs from successive HARQ rounds
+\param dummy_w This is the first row of the interleaver matrix for identifying/discarding the "LTE-NULL" positions
+\param soft_input This is a pointer to the soft channel output
+\param C Number of segments (codewords) in the sub-frame
+\param Nsoft Total number of soft bits (from UE capabilities in 36-306)
+\param Mdlharq Number of HARQ rounds
+\param Kmimo MIMO capability for this DLSCH (0 = no MIMO)
+\param rvidx round index (0-3)
+\param clear 1 means clear soft buffer (start of HARQ round)
+\param Qm modulation order (2,4,6)
+\param Nl number of layers (1,2)
+\param r segment number
+\param E_out the number of coded bits per segment
+\returns 0 on success, -1 on failure
+*/
+
+// int lte_rate_matching_turbo_rx(uint32_t RTC,
+//                                uint32_t G,
+//                                int16_t *w,
+//                                uint8_t *dummy_w,
+//                                int16_t *soft_input,
+//                                uint8_t C,
+//                                uint32_t Nsoft,
+//                                uint8_t Mdlharq,
+//                                uint8_t Kmimo,
+//                                uint8_t rvidx,
+//                                uint8_t clear,
+//                                uint8_t Qm,
+//                                uint8_t Nl,
+//                                uint8_t r,
+//                                uint32_t *E_out);
+
+// uint32_t lte_rate_matching_turbo_rx_abs(uint32_t RTC,
+//                                         uint32_t G,
+//                                         double *w,
+//                                         uint8_t *dummy_w,
+//                                         double *soft_input,
+//                                         uint8_t C,
+//                                         uint32_t Nsoft,
+//                                         uint8_t Mdlharq,
+//                                         uint8_t Kmimo,
+//                                         uint8_t rvidx,
+//                                         uint8_t clear,
+//                                         uint8_t Qm,
+//                                         uint8_t Nl,
+//                                         uint8_t r,
+//                                         uint32_t *E_out);
+
+void ccode_encode_npdsch_NB_IoT (int32_t   numbits,
+								 uint8_t   *inPtr,
+								 uint8_t   *outPtr,
+								 uint32_t  crc);
+
+#endif /* OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_ */
diff --git a/openair1/PHY/CODING/extern.h b/openair1/PHY/CODING/extern.h
index aed8e90d75f743be78bb90fa9cfe5c37b0763757..0d3e2ccb02e3b050243443603bc0946f414f9745 100644
--- a/openair1/PHY/CODING/extern.h
+++ b/openair1/PHY/CODING/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -20,5 +20,9 @@
  */
 
 extern unsigned short f1f2mat_old[2*188];
-
-
+extern double cpuf;
+extern decoder_if_t decoder16;
+extern decoder_if_t decoder8;
+extern encoder_if_t encoder;
+extern int load_codinglib(void);
+extern int free_codinglib(void);
diff --git a/openair1/PHY/CODING/extern_3GPPinterleaver.h b/openair1/PHY/CODING/extern_3GPPinterleaver.h
index e7134b56907dfbbdc9068e60824cf8a6cb7c901a..007c1fecc31445cc1a4ddbd5390fac0a0ebf4159 100644
--- a/openair1/PHY/CODING/extern_3GPPinterleaver.h
+++ b/openair1/PHY/CODING/extern_3GPPinterleaver.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/lte_interleaver.h b/openair1/PHY/CODING/lte_interleaver.h
index 165dcfac277c4584db0025d186a1bf194a87cf40..fbf26a8e1f45f566a1f7735e9b5dac5dc323c71f 100644
--- a/openair1/PHY/CODING/lte_interleaver.h
+++ b/openair1/PHY/CODING/lte_interleaver.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/lte_interleaver2.h b/openair1/PHY/CODING/lte_interleaver2.h
index 74805922f95c83b049e657f2a4d9d24d2b5044be..60b2fa6d1f6f65439f69925e982e82cf1431cd80 100644
--- a/openair1/PHY/CODING/lte_interleaver2.h
+++ b/openair1/PHY/CODING/lte_interleaver2.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/lte_interleaver_inline.h b/openair1/PHY/CODING/lte_interleaver_inline.h
index 8dc56f869e5d78f42c2d2ad59b31630a361ad726..bf560128f0e4f2c5ce7fb25d565ca36158518268 100644
--- a/openair1/PHY/CODING/lte_interleaver_inline.h
+++ b/openair1/PHY/CODING/lte_interleaver_inline.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/lte_rate_matching.c b/openair1/PHY/CODING/lte_rate_matching.c
index a25dbe8b79ceb8cdc4463bc2590297b6bb9431e9..41c3c5e5a91b314c62c2d9a701c1802def0b306c 100644
--- a/openair1/PHY/CODING/lte_rate_matching.c
+++ b/openair1/PHY/CODING/lte_rate_matching.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -463,7 +463,7 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
                                  uint8_t Qm,
                                  uint8_t Nl,
                                  uint8_t r,
-                                 uint8_t nb_rb) 
+                                 uint8_t nb_rb)
 //                                 uint8_t m)
 {
 
@@ -513,7 +513,7 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
   //    counter_buffer[rvidx][cnt]=0;
   if (Ncb>(3*(RTC<<5)))
     AssertFatal(1==0,"Exiting, RM condition (Ncb %d, RTC %d, Nir/C %d, Nsoft %d, Kw %d)\n",Ncb,RTC,Nir/C,Nsoft,3*(RTC<<5));
-  
+
   AssertFatal(Nl>0,"Nl is 0\n");
   AssertFatal(Qm>0,"Qm is 0\n");
   Gp = G/Nl/Qm;
@@ -749,6 +749,10 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
 
   for (; (ind<Ncb)&&(k<E); ind++) {
     if (dummy_w[ind] != LTE_NULL) {
+      /*
+      if ((w[ind]>0 && soft_input2[k]<0) ||
+	  (w[ind]<0 && soft_input2[k]>0))
+	  printf("ind %d: w %d => soft_in %d\n",ind,w[ind],soft_input2[k]);*/
       w[ind] += soft_input2[k++];
 #ifdef RM_DEBUG
       printf("RM_RX k%d Ind: %d (%d)\n",k-1,ind,w[ind]);
diff --git a/openair1/PHY/CODING/lte_segmentation.c b/openair1/PHY/CODING/lte_segmentation.c
index 0941069067dbaced2ef7a83233a64a27b13ec723..3ae65e20900e95323efee6563cbc9d7dd705b856 100644
--- a/openair1/PHY/CODING/lte_segmentation.c
+++ b/openair1/PHY/CODING/lte_segmentation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/scrambler.h b/openair1/PHY/CODING/scrambler.h
index 06ff2d7663fc9ddea33a6ebc8bd035d11e9a90bd..3c1b1de0a71eb8b0198ea114dbb109f755d11005 100644
--- a/openair1/PHY/CODING/scrambler.h
+++ b/openair1/PHY/CODING/scrambler.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/vars.h b/openair1/PHY/CODING/vars.h
index 9c0cf66c3e8cb7069472222c81691e2e1bd5f8b2..944ea08d0c8121e92189ea06d9edd1d2f3154854 100644
--- a/openair1/PHY/CODING/vars.h
+++ b/openair1/PHY/CODING/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/viterbi.c b/openair1/PHY/CODING/viterbi.c
index b2ab26e91c2d121b447538ec27e8757510eb8170..f44e2ebf8f203336cb8389d63cd00a77c5363c6e 100644
--- a/openair1/PHY/CODING/viterbi.c
+++ b/openair1/PHY/CODING/viterbi.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/CODING/viterbi_lte.c b/openair1/PHY/CODING/viterbi_lte.c
index e1d3a99cbeac0ec9f7445b14b02fb5ccb129b5b5..5e11cb3453ab9dd2f425a175389acfd0edcca432 100644
--- a/openair1/PHY/CODING/viterbi_lte.c
+++ b/openair1/PHY/CODING/viterbi_lte.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,10 +28,6 @@
    date: 21.10.2009
 */
 
-#ifdef USER_MODE
-#include <stdio.h>
-#endif
-
 #ifndef TEST_DEBUG
 #include "PHY/defs.h"
 #include "PHY/extern.h"
@@ -126,7 +122,7 @@ void print_shorts(__m128i x,char *s) {
 
 }
 */
-#endif // USER_MODE
+#endif // DEBUG_VITERBI
 
 
 
diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/defs.h
index 36d8aa00be4fcf51cb784903b5fde240535e0dae..be3e5c160b61a7ad71562befd3f2da89cd3a8fb0 100644
--- a/openair1/PHY/INIT/defs.h
+++ b/openair1/PHY/INIT/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -65,7 +65,7 @@ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
 @returns -1 if any memory allocation failed
 @note The current implementation will never return -1, but segfault.
  */
-int phy_init_lte_ue_signal(PHY_VARS_UE *phy_vars_ue,
+int init_lte_ue_signal(PHY_VARS_UE *phy_vars_ue,
 			   int          nb_connected_eNB,
 			   uint8_t         abstraction_flag);
 
@@ -90,6 +90,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNb,
                      unsigned char is_secondary_eNb,
                      unsigned char abstraction_flag);
 
+/*!
+\brief Free the PHY variables relevant to the LTE implementation (eNB).
+\details Only a subset of phy_vars_eNb is freed (those who have been allocated with phy_init_lte_eNB()).
+@param[in] phy_vars_eNb Pointer to eNB Variables
+ */
+void phy_free_lte_eNB(PHY_VARS_eNB *phy_vars_eNb);
+
 /** \brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB decoding + primary/secondary synch).
 \details The basically allows configuration of \f$N_{\mathrm{RB}}^{\mathrm{DL}}\f$, the cell id  \f$N_{\mathrm{ID}}^{\mathrm{cell}}\f$, the normal/extended prefix mode, the frame type (FDD/TDD), \f$N_{\mathrm{cp}}\f$, the number of TX antennas at eNB (\f$p\f$) and the number of PHICH groups, \f$N_{\mathrm{group}}^{\mathrm{PHICH}}\f$
 @param lte_frame_parms pointer to LTE parameter structure
@@ -317,24 +324,31 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB);
  */
 int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb);
 
+void free_lte_top(void);
 
 void 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_port_eNB,
-		    unsigned char N_tx, 
-		    unsigned char N_rx,
+void lte_param_init(PHY_VARS_eNB **eNBp,
+		    PHY_VARS_UE **UEp,
+		    RU_t **rup,
+		    unsigned char N_tx_port_eNB,
+                    unsigned char N_tx_phy,
+		    unsigned char N_rx_ru,
+		    unsigned char N_rx_ue,
 		    unsigned char transmission_mode,
 		    uint8_t extended_prefix_flag,
-		    frame_t frame_type, 
+		    frame_t frame_type,
 		    uint16_t Nid_cell,
 		    uint8_t tdd_config,
 		    uint8_t N_RB_DL,
+		    uint8_t pa,
 		    uint8_t threequarter_fs,
                     uint8_t osf,
 		    uint32_t perfect_ce);
 
+
 #if defined(Rel10) || defined(Rel14)
 void phy_config_dedicated_scell_ue(uint8_t Mod_id,
                                    uint8_t eNB_index,
@@ -359,18 +373,6 @@ void phy_config_request(PHY_Config_t *phy_config);
 int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
 void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
 
-void lte_param_init(unsigned char N_tx_port_eNB, 
-                    unsigned char N_tx_phy,
-		    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);
 /** @} */
 #endif
 
diff --git a/openair1/PHY/INIT/defs_NB_IoT.h b/openair1/PHY/INIT/defs_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a83cbd03843e44686809823570832a8ef03c2e2
--- /dev/null
+++ b/openair1/PHY/INIT/defs_NB_IoT.h
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+
+#ifndef __INIT_DEFS_NB_IOT__H__
+#define __INIT_DEFS_NB_IOT__H__
+
+//#include "PHY/defs_NB_IoT.h"
+#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"  
+#include "nfapi_interface.h"  
+
+//#include "SystemInformationBlockType2.h"
+//#include "RadioResourceConfigCommonSIB.h"
+//#include "RadioResourceConfigDedicated.h"
+//#include "TDD-Config.h"
+//#include "MBSFN-SubframeConfigList.h"
+//#include "MobilityControlInfo.h"
+//#if defined(Rel10) || defined(Rel14)
+//#include "SCellToAddMod-r10.h"
+//#endif
+
+/*brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB-NB decoding + primary/secondary synch).*/
+void phy_config_mib_eNB_NB_IoT(int  		Mod_id,
+						   	   int          eutra_band,
+						       int          Nid_cell,
+						       int          Ncp,
+						       int			Ncp_UL,
+						       int          p_eNB,
+						       uint16_t		EARFCN,
+						       uint16_t		prb_index, // NB_IoT_RB_ID,
+						       uint16_t 	operating_mode,
+						       uint16_t		control_region_size,
+						       uint16_t		eutra_NumCRS_ports);
+
+/*NB_phy_config_sib1_eNB is not needed since NB-IoT use only FDD mode*/
+
+/*brief Configure LTE_DL_FRAME_PARMS with components of SIB2-NB (at eNB).*/
+
+//void NB_phy_config_sib2_eNB(module_id_t                            Mod_id,
+//                         int                                		CC_id,
+//                         RadioResourceConfigCommonSIB_NB_r13_t      *radioResourceConfigCommon
+//                         );
+
+void phy_config_sib2_eNB_NB_IoT(uint8_t Mod_id,
+				nfapi_nb_iot_config_t *config,
+				nfapi_rf_config_t *rf_config,
+				nfapi_uplink_reference_signal_config_t* ul_nrs_config,
+				extra_phyConfig_t* extra_phy_parms);
+
+void phy_config_dedicated_eNB_NB_IoT(module_id_t Mod_id,
+				     rnti_t rnti,
+				     extra_phyConfig_t* extra_phy_parms); 
+
+// void phy_init_lte_top_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms); 
+void phy_init_nb_iot_eNB(PHY_VARS_eNB_NB_IoT *phyvar);
+int l1_north_init_NB_IoT(void);
+
+#endif
+
diff --git a/openair1/PHY/INIT/extern.h b/openair1/PHY/INIT/extern.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair1/PHY/INIT/extern.h
+++ b/openair1/PHY/INIT/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c
index 33ff141203f351fb8549b5ecd026072f99af2706..6213520b8c8bf042aaf7c7212ea8a5a237156ba8 100644
--- a/openair1/PHY/INIT/init_top.c
+++ b/openair1/PHY/INIT/init_top.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -20,25 +20,49 @@
  */
 
 /*!\brief Initilization and reconfiguration routines for LTE PHY */
-#ifndef USER_MODE
-#define __NO_VERSION__
-#endif
-
 #include "defs.h"
 #include "PHY/extern.h"
-#include "MAC_INTERFACE/extern.h"
-//#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
+#include "PHY/CODING/extern.h"
+void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
+{
+
+  crcTableInit();
+
+  ccodedot11_init();
+  ccodedot11_init_inv();
+
+  ccodelte_init();
+  ccodelte_init_inv();
+
+
+
+  phy_generate_viterbi_tables();
+  phy_generate_viterbi_tables_lte();
+
+  load_codinglib();
+  lte_sync_time_init(frame_parms);
+
+  generate_ul_ref_sigs();
+  generate_ul_ref_sigs_rx();
+
+  generate_64qam_table();
+  generate_16qam_table();
+  generate_RIV_tables();
+
+  init_unscrambling_lut();
+  init_scrambling_lut();
+  //set_taus_seed(1328);
+
 
-/*!
-* @addtogroup _PHY_STRUCTURES_
-* Memory Initializaion and Cleanup for LTE MODEM.
-* @{
-\section _Memory_init_ Memory Initialization for LTE MODEM
+}
 
-*/
+void free_lte_top(void)
+{
+  free_codinglib();
+  lte_sync_time_free();
 
-//#define DEBUG_PHY
-t
+  /* free_ul_ref_sigs() is called in phy_free_lte_eNB() */
+}
 
 
 /*
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index db9306f5c2a026a41e569523ed3eead47350501f..474207a407ae1e54db3dc425e46d7de77b58fdff 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -32,6 +32,9 @@
 #include "assertions.h"
 #include <math.h>
 
+extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
+extern int32_t get_uldl_offset(int eutra_bandP);
+
 extern uint16_t prach_root_sequence_map0_3[838];
 extern uint16_t prach_root_sequence_map4[138];
 uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10};
@@ -42,24 +45,41 @@ int N_RB_DL_array[6] = {6,15,25,50,75,100};
 int l1_north_init_eNB() {
 
   int i,j;
-  AssertFatal(RC.nb_L1_inst>0,"nb_L1_inst=%d\n",RC.nb_L1_inst);
-  AssertFatal(RC.nb_L1_CC!=NULL,"nb_L1_CC is null\n");
-  AssertFatal(RC.eNB!=NULL,"RC.eNB is null\n");
-  for (i=0;i<RC.nb_L1_inst;i++) {
-    AssertFatal(RC.eNB[i]!=NULL,"RC.eNB[%d] is null\n",i);
-    AssertFatal(RC.nb_L1_CC[i]>0,"RC.nb_L1_CC[%d]=%d\n",i,RC.nb_L1_CC[i]);
-    for (j=0;j<RC.nb_L1_CC[i];j++) {
-      AssertFatal(RC.eNB[i][j]!=NULL,"RC.eNB[%d][%d] is null\n",i,j);
-      if ((RC.eNB[i][j]->if_inst =  IF_Module_init(i))<0) return(-1); 
-      RC.eNB[i][j]->if_inst->PHY_config_req = phy_config_request;
-      RC.eNB[i][j]->if_inst->schedule_response = schedule_response;
+
+  if (RC.nb_L1_inst > 0 && RC.nb_L1_CC != NULL && RC.eNB != NULL)
+  {
+    AssertFatal(RC.nb_L1_inst>0,"nb_L1_inst=%d\n",RC.nb_L1_inst);
+    AssertFatal(RC.nb_L1_CC!=NULL,"nb_L1_CC is null\n");
+    AssertFatal(RC.eNB!=NULL,"RC.eNB is null\n");
+
+    LOG_I(PHY,"%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst);
+
+    for (i=0;i<RC.nb_L1_inst;i++) {
+      AssertFatal(RC.eNB[i]!=NULL,"RC.eNB[%d] is null\n",i);
+      AssertFatal(RC.nb_L1_CC[i]>0,"RC.nb_L1_CC[%d]=%d\n",i,RC.nb_L1_CC[i]);
+
+      LOG_I(PHY,"%s() RC.nb_L1_CC[%d]:%d\n", __FUNCTION__, i,  RC.nb_L1_CC[i]);
+
+      for (j=0;j<RC.nb_L1_CC[i];j++) {
+        AssertFatal(RC.eNB[i][j]!=NULL,"RC.eNB[%d][%d] is null\n",i,j);
+
+        if ((RC.eNB[i][j]->if_inst =  IF_Module_init(i))<0) return(-1); 
+
+        LOG_I(PHY,"%s() RC.eNB[%d][%d] installing callbacks\n", __FUNCTION__, i,  j);
+
+        RC.eNB[i][j]->if_inst->PHY_config_req = phy_config_request;
+        RC.eNB[i][j]->if_inst->schedule_response = schedule_response;
+      }
     }
   }
+  else
+  {
+    LOG_I(PHY,"%s() Not installing PHY callbacks - RC.nb_L1_inst:%d RC.nb_L1_CC:%p RC.eNB:%p\n", __FUNCTION__, RC.nb_L1_inst, RC.nb_L1_CC, RC.eNB);
+  }
   return(0);
 }
 
 
-
 void phy_config_request(PHY_Config_t *phy_config) {
 
   uint8_t Mod_id              = phy_config->Mod_id;
@@ -71,13 +91,14 @@ void phy_config_request(PHY_Config_t *phy_config) {
   PHICH_RESOURCE_t phich_resource_table[4]={oneSixth,half,one,two};
   int                 eutra_band     = cfg->nfapi_config.rf_bands.rf_band[0];  
   int                 dl_Bandwidth   = cfg->rf_config.dl_channel_bandwidth.value;
+  int                 ul_Bandwidth   = cfg->rf_config.ul_channel_bandwidth.value;
   int                 Nid_cell       = cfg->sch_config.physical_cell_id.value;
   int                 Ncp            = cfg->subframe_config.dl_cyclic_prefix_type.value;
   int                 p_eNB          = cfg->rf_config.tx_antenna_ports.value;
   uint32_t            dl_CarrierFreq = cfg->nfapi_config.earfcn.value;
 
-  LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,Ncp %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
-	Mod_id, CC_id, eutra_band, N_RB_DL_array[dl_Bandwidth], Nid_cell, p_eNB,Ncp,dl_CarrierFreq,
+  LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,eNB_tx_antenna_ports %d,Ncp %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
+	Mod_id, CC_id, eutra_band, dl_Bandwidth, ul_Bandwidth, Nid_cell, p_eNB,Ncp,dl_CarrierFreq,
 	cfg->phich_config.phich_resource.value,
 	cfg->phich_config.phich_duration.value);
 
@@ -86,13 +107,18 @@ void phy_config_request(PHY_Config_t *phy_config) {
   AssertFatal(RC.eNB[Mod_id][CC_id] != NULL, "PHY instance %d, CCid %d doesn't exist\n",Mod_id,CC_id);
 
 
+  if (RC.eNB[Mod_id][CC_id]->configured == 1)
+  {
+    LOG_E(PHY,"Already eNB already configured, do nothing\n");
+    return;
+  }
 
   RC.eNB[Mod_id][CC_id]->mac_enabled     = 1;
 
   fp = &RC.eNB[Mod_id][CC_id]->frame_parms;
 
-  fp->N_RB_DL                            = N_RB_DL_array[dl_Bandwidth];
-  fp->N_RB_UL                            = N_RB_DL_array[dl_Bandwidth];
+  fp->N_RB_DL                            = dl_Bandwidth;
+  fp->N_RB_UL                            = ul_Bandwidth;
   fp->Nid_cell                           = Nid_cell;
   fp->nushift                            = fp->Nid_cell%6;
   fp->eutra_band                         = eutra_band;
@@ -154,93 +180,95 @@ void phy_config_request(PHY_Config_t *phy_config) {
                     RC.eNB[Mod_id][CC_id]->X_u);
 
 #ifdef Rel14
-  if (cfg->emtc_config.prach_ce_level_0_enable.value == 1) {
-    fp->prach_emtc_config_common.prach_Config_enabled=1;
-
-    fp->prach_emtc_config_common.rootSequenceIndex                                         = cfg->emtc_config.prach_catm_root_sequence_index.value;
-
-    fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag                            = cfg->emtc_config.prach_catm_high_speed_flag.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig                = cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.value;
-
-    // CE Level 3 parameters
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3]                  = cfg->emtc_config.prach_ce_level_3_enable.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3]   = cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3] = cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.value;
-    AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3],
-		"prach_starting_subframe_periodicity[3] < prach_numPetitionPerPreambleAttempt[3]\n");
-
-
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3]                     = cfg->emtc_config.prach_ce_level_3_configuration_index.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[3]                      = cfg->emtc_config.prach_ce_level_3_frequency_offset.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[3]                  = cfg->emtc_config.prach_ce_level_3_hopping_enable.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[3]                  = cfg->emtc_config.prach_ce_level_3_hopping_offset.value;
-    if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3] == 1)
-      compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
-			fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
-			fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
-			fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
-			fp->frame_type,
-			RC.eNB[Mod_id][CC_id]->X_u_br[3]);
-
-    // CE Level 2 parameters
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2]                  = cfg->emtc_config.prach_ce_level_2_enable.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[2]   = cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[2] = cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.value;
-    AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[2]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[2],
-		"prach_starting_subframe_periodicity[2] < prach_numPetitionPerPreambleAttempt[2]\n");
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[2]                     = cfg->emtc_config.prach_ce_level_2_configuration_index.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[2]                      = cfg->emtc_config.prach_ce_level_2_frequency_offset.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[2]                  = cfg->emtc_config.prach_ce_level_2_hopping_enable.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[2]                  = cfg->emtc_config.prach_ce_level_2_hopping_offset.value;
-    if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2] == 1)
-      compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
-			fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
-			fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
-			fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
-			fp->frame_type,
-			RC.eNB[Mod_id][CC_id]->X_u_br[2]);
-
-    // CE Level 1 parameters
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1]                  = cfg->emtc_config.prach_ce_level_1_enable.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1]   = cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1] = cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value;
-    AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1],
-		"prach_starting_subframe_periodicity[1] < prach_numPetitionPerPreambleAttempt[1]\n");
-
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[1]                     = cfg->emtc_config.prach_ce_level_1_configuration_index.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[1]                      = cfg->emtc_config.prach_ce_level_1_frequency_offset.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[1]                  = cfg->emtc_config.prach_ce_level_1_hopping_enable.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[1]                  = cfg->emtc_config.prach_ce_level_1_hopping_offset.value;
-    if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1] == 1)
-      compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
-			fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
-			fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
-			fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
-			fp->frame_type,
-			RC.eNB[Mod_id][CC_id]->X_u_br[1]);
+  fp->prach_emtc_config_common.prach_Config_enabled=1;
+
+  fp->prach_emtc_config_common.rootSequenceIndex                                         = cfg->emtc_config.prach_catm_root_sequence_index.value;
+
+  fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag                            = cfg->emtc_config.prach_catm_high_speed_flag.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig                = cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.value;
+
+  // CE Level 3 parameters
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3]                  = cfg->emtc_config.prach_ce_level_3_enable.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3]   = cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3] = cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.value;
+  AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3],
+	      "prach_starting_subframe_periodicity[3] < prach_numPetitionPerPreambleAttempt[3]\n");
+
+
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3]                     = cfg->emtc_config.prach_ce_level_3_configuration_index.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[3]                      = cfg->emtc_config.prach_ce_level_3_frequency_offset.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[3]                  = cfg->emtc_config.prach_ce_level_3_hopping_enable.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[3]                  = cfg->emtc_config.prach_ce_level_3_hopping_offset.value;
+  if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3] == 1)
+    compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
+		      fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
+		      fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+		      fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
+		      fp->frame_type,
+		      RC.eNB[Mod_id][CC_id]->X_u_br[3]);
+
+  // CE Level 2 parameters
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2]                  = cfg->emtc_config.prach_ce_level_2_enable.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[2]   = cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[2] = cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.value;
+  AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[2]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[2],
+	      "prach_starting_subframe_periodicity[2] < prach_numPetitionPerPreambleAttempt[2]\n");
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[2]                     = cfg->emtc_config.prach_ce_level_2_configuration_index.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[2]                      = cfg->emtc_config.prach_ce_level_2_frequency_offset.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[2]                  = cfg->emtc_config.prach_ce_level_2_hopping_enable.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[2]                  = cfg->emtc_config.prach_ce_level_2_hopping_offset.value;
+  if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2] == 1)
+    compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
+		      fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
+		      fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+		      fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
+		      fp->frame_type,
+		      RC.eNB[Mod_id][CC_id]->X_u_br[2]);
+
+  // CE Level 1 parameters
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1]                  = cfg->emtc_config.prach_ce_level_1_enable.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1]   = cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1] = cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value;
+  AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1],
+	      "prach_starting_subframe_periodicity[1] < prach_numPetitionPerPreambleAttempt[1]\n");
+
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[1]                     = cfg->emtc_config.prach_ce_level_1_configuration_index.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[1]                      = cfg->emtc_config.prach_ce_level_1_frequency_offset.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[1]                  = cfg->emtc_config.prach_ce_level_1_hopping_enable.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[1]                  = cfg->emtc_config.prach_ce_level_1_hopping_offset.value;
+  if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1] == 1)
+    compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
+		      fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
+		      fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+		      fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
+		      fp->frame_type,
+		      RC.eNB[Mod_id][CC_id]->X_u_br[1]);
   
-    // CE Level 0 parameters
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]                  = cfg->emtc_config.prach_ce_level_0_enable.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0]   = cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] = cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.value;
-    AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0],
-		"prach_starting_subframe_periodicity[0] %d < prach_numPetitionPerPreambleAttempt[0] %d\n",
-		fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0],
-		fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]);
-    AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] > 0,
-		"prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]==0\n");
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[0]                     = cfg->emtc_config.prach_ce_level_0_configuration_index.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0]                      = cfg->emtc_config.prach_ce_level_0_frequency_offset.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[0]                = cfg->emtc_config.prach_ce_level_0_hopping_enable.value;
-    fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[0]                = cfg->emtc_config.prach_ce_level_0_hopping_offset.value;
-    if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] == 1)
-      compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
-			fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
-			fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
-			fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
-			fp->frame_type,
-			RC.eNB[Mod_id][CC_id]->X_u_br[0]);
-  }
+  // CE Level 0 parameters
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]                  = cfg->emtc_config.prach_ce_level_0_enable.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0]   = cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] = cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.value;
+  AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0],
+	      "prach_starting_subframe_periodicity[0] %d < prach_numPetitionPerPreambleAttempt[0] %d\n",
+	      fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0],
+	      fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]);
+#if 0
+  AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] > 0,
+	      "prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]==0\n");
+#else
+  LOG_E(PHY,"***DJP*** removed assert on preamble fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]:%d expecting >0 %s:%d\n\n\n", fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0], __FILE__, __LINE__);
+#endif
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[0]                     = cfg->emtc_config.prach_ce_level_0_configuration_index.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0]                      = cfg->emtc_config.prach_ce_level_0_frequency_offset.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[0]                = cfg->emtc_config.prach_ce_level_0_hopping_enable.value;
+  fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[0]                = cfg->emtc_config.prach_ce_level_0_hopping_offset.value;
+  if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] == 1)
+    compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex,
+		      fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3],
+		      fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+		      fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag,
+		      fp->frame_type,
+		      RC.eNB[Mod_id][CC_id]->X_u_br[0]);
 #endif
 
 
@@ -267,9 +295,9 @@ void phy_config_request(PHY_Config_t *phy_config) {
   fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled     = 0;
   fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled  = 0;
   if (cfg->uplink_reference_signal_config.uplink_rs_hopping.value == 1) 
-    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
+      fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 1;
   if (cfg->uplink_reference_signal_config.uplink_rs_hopping.value == 2) 
-    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 1;
+      fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 1;
   LOG_I(PHY,"pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = %d\n",fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
   fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH   =  cfg->uplink_reference_signal_config.group_assignment.value;
   LOG_I(PHY,"pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = %d\n",fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
@@ -297,33 +325,15 @@ void phy_config_request(PHY_Config_t *phy_config) {
   LOG_I(PHY,"eNB %d/%d configured\n",Mod_id,CC_id);
 }
 
-void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
-                        uint8_t eNB_id,
-                        TDD_Config_t *tdd_Config,
-                        uint8_t SIwindowsize,
-                        uint16_t SIperiod)
-{
-
-  LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
-
-  if (tdd_Config) {
-    fp->tdd_config    = tdd_Config->subframeAssignment;
-    fp->tdd_config_S  = tdd_Config->specialSubframePatterns;
-  }
-
-  fp->SIwindowsize  = SIwindowsize;
-  fp->SIPeriod      = SIperiod;
-}
-
 /*
-  void phy_config_sib2_eNB(uint8_t Mod_id,
-  int CC_id,
-  RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
-  ARFCN_ValueEUTRA_t *ul_CArrierFreq,
-  long *ul_Bandwidth,
-  AdditionalSpectrumEmission_t *additionalSpectrumEmission,
-  struct MBSFN_SubframeConfigList  *mbsfn_SubframeConfigList)
-  {
+void phy_config_sib2_eNB(uint8_t Mod_id,
+                         int CC_id,
+                         RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
+                         ARFCN_ValueEUTRA_t *ul_CArrierFreq,
+                         long *ul_Bandwidth,
+                         AdditionalSpectrumEmission_t *additionalSpectrumEmission,
+                         struct MBSFN_SubframeConfigList  *mbsfn_SubframeConfigList)
+{
 
   LTE_DL_FRAME_PARMS *fp = &RC.eNB[Mod_id][CC_id]->frame_parms;
   //LTE_eNB_UE_stats *eNB_UE_stats      = RC.eNB[Mod_id][CC_id].eNB_UE_stats;
@@ -350,7 +360,7 @@ void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
 
   init_prach_tables(839);
   compute_prach_seq(&fp->prach_config_common,fp->frame_type,
-  RC.eNB[Mod_id][CC_id]->X_u);
+                    RC.eNB[Mod_id][CC_id]->X_u);
 
   fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon.deltaPUCCH_Shift;
   fp->pucch_config_common.nRB_CQI          = radioResourceConfigCommon->pucch_ConfigCommon.nRB_CQI;
@@ -391,130 +401,6 @@ void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
 
   fp->soundingrs_ul_config_common.enabled_flag                        = 0;
 
-  if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) {
-  fp->soundingrs_ul_config_common.enabled_flag                        = 1;
-  fp->soundingrs_ul_config_common.srs_BandwidthConfig                 = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
-  fp->soundingrs_ul_config_common.srs_SubframeConfig                  = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
-  fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
-
-  if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
-  fp->soundingrs_ul_config_common.srs_MaxUpPts                      = 1;
-  else
-  fp->soundingrs_ul_config_common.srs_MaxUpPts                      = 0;
-  }
-
-
-
-  fp->ul_power_control_config_common.p0_NominalPUSCH       = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUSCH;
-  fp->ul_power_control_config_common.alpha                 = radioResourceConfigCommon->uplinkPowerControlCommon.alpha;
-  fp->ul_power_control_config_common.p0_NominalPUCCH       = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUCCH;
-  fp->ul_power_control_config_common.deltaPreambleMsg3     = radioResourceConfigCommon->uplinkPowerControlCommon.deltaPreambleMsg3;
-  fp->ul_power_control_config_common.deltaF_PUCCH_Format1  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1;
-  fp->ul_power_control_config_common.deltaF_PUCCH_Format1b  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b;
-  fp->ul_power_control_config_common.deltaF_PUCCH_Format2  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2;
-  fp->ul_power_control_config_common.deltaF_PUCCH_Format2a  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a;
-  fp->ul_power_control_config_common.deltaF_PUCCH_Format2b  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b;
-
-  fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx;
-
-
-  // Now configure some of the Physical Channels
-
-  // PUCCH
-
-  init_ncs_cell(fp,RC.eNB[Mod_id][CC_id]->ncs_cell);
-
-  init_ul_hopping(fp);
-
-  // MBSFN
-  if (mbsfn_SubframeConfigList != NULL) {
-  fp->num_MBSFN_config = mbsfn_SubframeConfigList->list.count;
-
-  for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
-  fp->MBSFN_config[i].radioframeAllocationPeriod = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod;
-  fp->MBSFN_config[i].radioframeAllocationOffset = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset;
-
-  if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
-  fp->MBSFN_config[i].fourFrames_flag = 0;
-  fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
-  LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is  %d\n", i,
-  fp->MBSFN_config[i].mbsfn_SubframeConfig);
-  } else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
-  fp->MBSFN_config[i].fourFrames_flag = 1;
-  fp->MBSFN_config[i].mbsfn_SubframeConfig =
-  mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]|
-  (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
-  (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16);
-
-  LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is  %d\n", i,
-  fp->MBSFN_config[i].mbsfn_SubframeConfig);
-  }
-  }
-
-  } else
-  fp->num_MBSFN_config = 0;
-
-  //
-  }
-*/
-
-void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
-                        uint8_t eNB_id,
-                        RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
-                        ARFCN_ValueEUTRA_t *ul_CarrierFreq,
-                        long *ul_Bandwidth,
-                        AdditionalSpectrumEmission_t *additionalSpectrumEmission,
-                        struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
-{
-
-  PHY_VARS_UE *ue        = PHY_vars_UE_g[Mod_id][CC_id];
-  LTE_DL_FRAME_PARMS *fp = &ue->frame_parms;
-  int i;
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_IN);
-
-  LOG_I(PHY,"[UE%d] Applying radioResourceConfigCommon from eNB%d\n",Mod_id,eNB_id);
-
-  fp->prach_config_common.rootSequenceIndex                           =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
-
-  fp->prach_config_common.prach_Config_enabled=1;
-  fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex          =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
-  fp->prach_config_common.prach_ConfigInfo.highSpeedFlag              =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.highSpeedFlag;
-  fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig  =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
-  fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset           =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset;
-
-  compute_prach_seq(fp->prach_config_common.rootSequenceIndex,
-		    fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
-		    fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
-		    fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
-		    fp->frame_type,ue->X_u);
-
-
-
-  fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon.deltaPUCCH_Shift;
-  fp->pucch_config_common.nRB_CQI          = radioResourceConfigCommon->pucch_ConfigCommon.nRB_CQI;
-  fp->pucch_config_common.nCS_AN           = radioResourceConfigCommon->pucch_ConfigCommon.nCS_AN;
-  fp->pucch_config_common.n1PUCCH_AN       = radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN;
-
-
-
-  fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon.referenceSignalPower;
-  fp->pdsch_config_common.p_b                  = radioResourceConfigCommon->pdsch_ConfigCommon.p_b;
-
-
-  fp->pusch_config_common.n_SB                                         = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
-  fp->pusch_config_common.hoppingMode                                  = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
-  fp->pusch_config_common.pusch_HoppingOffset                          = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
-  fp->pusch_config_common.enable64QAM                                  = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
-  fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled    = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
-  fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH   = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
-  fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
-  fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift            = dmrs1_tab[radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift];
-
-
-  init_ul_hopping(fp);
-  fp->soundingrs_ul_config_common.enabled_flag                        = 0;
-
   if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) {
     fp->soundingrs_ul_config_common.enabled_flag                        = 1;
     fp->soundingrs_ul_config_common.srs_BandwidthConfig                 = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
@@ -529,10 +415,10 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
 
 
 
-  fp->ul_power_control_config_common.p0_NominalPUSCH   = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUSCH;
-  fp->ul_power_control_config_common.alpha             = radioResourceConfigCommon->uplinkPowerControlCommon.alpha;
-  fp->ul_power_control_config_common.p0_NominalPUCCH   = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUCCH;
-  fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaPreambleMsg3;
+  fp->ul_power_control_config_common.p0_NominalPUSCH       = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUSCH;
+  fp->ul_power_control_config_common.alpha                 = radioResourceConfigCommon->uplinkPowerControlCommon.alpha;
+  fp->ul_power_control_config_common.p0_NominalPUCCH       = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUCCH;
+  fp->ul_power_control_config_common.deltaPreambleMsg3     = radioResourceConfigCommon->uplinkPowerControlCommon.deltaPreambleMsg3;
   fp->ul_power_control_config_common.deltaF_PUCCH_Format1  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1;
   fp->ul_power_control_config_common.deltaF_PUCCH_Format1b  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b;
   fp->ul_power_control_config_common.deltaF_PUCCH_Format2  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2;
@@ -541,18 +427,16 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
 
   fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx;
 
+
   // Now configure some of the Physical Channels
 
   // PUCCH
-  init_ncs_cell(fp,ue->ncs_cell);
 
-  init_ul_hopping(fp);
+  init_ncs_cell(fp,RC.eNB[Mod_id][CC_id]->ncs_cell);
 
-  // PCH
-  init_ue_paging_info(ue,radioResourceConfigCommon->pcch_Config.defaultPagingCycle,radioResourceConfigCommon->pcch_Config.nB);
+  init_ul_hopping(fp);
 
   // MBSFN
-
   if (mbsfn_SubframeConfigList != NULL) {
     fp->num_MBSFN_config = mbsfn_SubframeConfigList->list.count;
 
@@ -576,30 +460,13 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
               fp->MBSFN_config[i].mbsfn_SubframeConfig);
       }
     }
-  }
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_OUT);
-
-}
-
-void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
-                         long mbsfn_AreaId_r9)
-{
-
-  LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
 
+  } else
+    fp->num_MBSFN_config = 0;
 
-  LOG_I(PHY,"[UE%d] Applying MBSFN_Area_id %ld for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
-
-  if (mbsfn_Area_idx == 0) {
-    fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
-    LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
-  }
-
-  lte_gold_mbsfn(fp,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
-
+  //
 }
-
+*/
 
 void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
                           long mbsfn_AreaId_r9)
@@ -667,9 +534,9 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
         eNB->pusch_config_dedicated[UE_id].betaOffset_RI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
         eNB->pusch_config_dedicated[UE_id].betaOffset_CQI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
 
-        LOG_D(PHY,"pusch_config_dedicated.betaOffset_ACK_Index %d\n",eNB->pusch_config_dedicated[UE_id].betaOffset_ACK_Index);
-        LOG_D(PHY,"pusch_config_dedicated.betaOffset_RI_Index %d\n",eNB->pusch_config_dedicated[UE_id].betaOffset_RI_Index);
-        LOG_D(PHY,"pusch_config_dedicated.betaOffset_CQI_Index %d\n",eNB->pusch_config_dedicated[UE_id].betaOffset_CQI_Index);
+        LOG_E(PHY,"pusch_config_dedicated.betaOffset_ACK_Index %d\n",eNB->pusch_config_dedicated[UE_id].betaOffset_ACK_Index);
+        LOG_E(PHY,"pusch_config_dedicated.betaOffset_RI_Index %d\n",eNB->pusch_config_dedicated[UE_id].betaOffset_RI_Index);
+        LOG_E(PHY,"pusch_config_dedicated.betaOffset_CQI_Index %d\n",eNB->pusch_config_dedicated[UE_id].betaOffset_CQI_Index);
         LOG_D(PHY,"\n");
 
 
@@ -740,495 +607,119 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
 }
 
 /*
- * Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover
- */
-void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
+void phy_config_dedicated_eNB(uint8_t Mod_id,
+                              int CC_id,
+                              uint16_t rnti,
+                              struct PhysicalConfigDedicated *physicalConfigDedicated)
 {
 
-  if(mobilityControlInfo!=NULL) {
-    RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon;
-    LOG_I(PHY,"radioResourceConfigCommon %p\n", radioResourceConfigCommon);
-    memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho,
-           (void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,
-           sizeof(LTE_DL_FRAME_PARMS));
-    PHY_vars_UE_g[Mod_id][CC_id]->ho_triggered = 1;
-    //PHY_vars_UE_g[UE_id]->UE_mode[0] = PRACH;
-
-    LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
-    //     int N_ZC;
-    //     uint8_t prach_fmt;
-    //     int u;
-
-    LOG_I(PHY,"[UE%d] Handover triggered: Applying radioResourceConfigCommon from eNB %d\n",
-          Mod_id,eNB_id);
-
-    fp->prach_config_common.rootSequenceIndex                           =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
-    fp->prach_config_common.prach_Config_enabled=1;
-    fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex          =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex;
-    fp->prach_config_common.prach_ConfigInfo.highSpeedFlag              =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->highSpeedFlag;
-    fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig  =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->zeroCorrelationZoneConfig;
-    fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset           =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_FreqOffset;
-
-    //     prach_fmt = get_prach_fmt(radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex,fp->frame_type);
-    //     N_ZC = (prach_fmt <4)?839:139;
-    //     u = (prach_fmt < 4) ? prach_root_sequence_map0_3[fp->prach_config_common.rootSequenceIndex] :
-    //       prach_root_sequence_map4[fp->prach_config_common.rootSequenceIndex];
-
-    //compute_prach_seq(u,N_ZC, PHY_vars_UE_g[Mod_id]->X_u);
-    compute_prach_seq(PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.rootSequenceIndex,
-		      PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
-		      PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
-		      PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,
-                      fp->frame_type,
-                      PHY_vars_UE_g[Mod_id][CC_id]->X_u);
-
-
-    fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon->deltaPUCCH_Shift;
-    fp->pucch_config_common.nRB_CQI          = radioResourceConfigCommon->pucch_ConfigCommon->nRB_CQI;
-    fp->pucch_config_common.nCS_AN           = radioResourceConfigCommon->pucch_ConfigCommon->nCS_AN;
-    fp->pucch_config_common.n1PUCCH_AN       = radioResourceConfigCommon->pucch_ConfigCommon->n1PUCCH_AN;
-    fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon->referenceSignalPower;
-    fp->pdsch_config_common.p_b                  = radioResourceConfigCommon->pdsch_ConfigCommon->p_b;
-
-
-    fp->pusch_config_common.n_SB                                         = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
-    fp->pusch_config_common.hoppingMode                                  = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
-    fp->pusch_config_common.pusch_HoppingOffset                          = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
-    fp->pusch_config_common.enable64QAM                                  = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
-    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled    = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
-    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH   = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
-    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
-    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift            = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift;
-
-    init_ul_hopping(fp);
-    fp->soundingrs_ul_config_common.enabled_flag                        = 0;
-
-    if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present==SoundingRS_UL_ConfigCommon_PR_setup) {
-      fp->soundingrs_ul_config_common.enabled_flag                        = 1;
-      fp->soundingrs_ul_config_common.srs_BandwidthConfig                 = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_BandwidthConfig;
-      fp->soundingrs_ul_config_common.srs_SubframeConfig                  = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig;
-      fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.ackNackSRS_SimultaneousTransmission;
-
-      if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_MaxUpPts)
-        fp->soundingrs_ul_config_common.srs_MaxUpPts                      = 1;
-      else
-        fp->soundingrs_ul_config_common.srs_MaxUpPts                      = 0;
-    }
-
-    fp->ul_power_control_config_common.p0_NominalPUSCH   = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUSCH;
-    fp->ul_power_control_config_common.alpha             = radioResourceConfigCommon->uplinkPowerControlCommon->alpha;
-    fp->ul_power_control_config_common.p0_NominalPUCCH   = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUCCH;
-    fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaPreambleMsg3;
-    fp->ul_power_control_config_common.deltaF_PUCCH_Format1  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1;
-    fp->ul_power_control_config_common.deltaF_PUCCH_Format1b  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1b;
-    fp->ul_power_control_config_common.deltaF_PUCCH_Format2  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2;
-    fp->ul_power_control_config_common.deltaF_PUCCH_Format2a  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2a;
-    fp->ul_power_control_config_common.deltaF_PUCCH_Format2b  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2b;
-
-    fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon->maxHARQ_Msg3Tx;
-
-    // Now configure some of the Physical Channels
-    if (radioResourceConfigCommon->antennaInfoCommon)
-      fp->nb_antennas_tx                     = (1<<radioResourceConfigCommon->antennaInfoCommon->antennaPortsCount);
-    else
-      fp->nb_antennas_tx                     = 1;
-
-    //PHICH
-    if (radioResourceConfigCommon->antennaInfoCommon) {
-      fp->phich_config_common.phich_resource = radioResourceConfigCommon->phich_Config->phich_Resource;
-      fp->phich_config_common.phich_duration = radioResourceConfigCommon->phich_Config->phich_Duration;
-    }
-
-    //Target CellId
-    fp->Nid_cell = mobilityControlInfo->targetPhysCellId;
-    fp->nushift  = fp->Nid_cell%6;
-
-    // PUCCH
-    init_ncs_cell(fp,PHY_vars_UE_g[Mod_id][CC_id]->ncs_cell);
-
-    init_ul_hopping(fp);
-
-    // RNTI
-
-
-    PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
-    PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
-
-    LOG_I(PHY,"SET C-RNTI %x %x\n",PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti,
-	  PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti);
-  }
-
-  if(ho_failed) {
-    LOG_D(PHY,"[UE%d] Handover failed, triggering RACH procedure\n",Mod_id);
-    memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,(void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho, sizeof(LTE_DL_FRAME_PARMS));
-    PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_id] = PRACH;
-  }
-}
-
-void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id)
-{
-
-  PHY_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id][CC_id]->measurements;
-  int i;
-
-  LOG_I(PHY,"Configuring inter-cell measurements for %d cells, ids: \n",n_adj_cells);
-
-  for (i=0; i<n_adj_cells; i++) {
-    LOG_I(PHY,"%d\n",adj_cell_id[i]);
-    lte_gold(&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_table[i+1],adj_cell_id[i]);
-  }
-
-  phy_meas->n_adj_cells = n_adj_cells;
-  memcpy((void*)phy_meas->adj_cell_id,(void *)adj_cell_id,n_adj_cells*sizeof(unsigned int));
-
-}
-
-/*
-  void phy_config_dedicated_eNB(uint8_t Mod_id,
-  int CC_id,
-  uint16_t rnti,
-  struct PhysicalConfigDedicated *physicalConfigDedicated)
-  {
-
   PHY_VARS_eNB *eNB = RC.eNB[Mod_id][CC_id];
   int8_t UE_id = find_ue(rnti,eNB);
   int i;
 
   if (UE_id == -1) {
-  LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id);
-  return;
-  }
-
-
-  if (physicalConfigDedicated) {
-  eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated;
-  LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
-
-  if (physicalConfigDedicated->antennaInfo) {
-  switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
-  case AntennaInfoDedicated__transmissionMode_tm1:
-  eNB->transmission_mode[UE_id] = 1;
-  break;
-  case AntennaInfoDedicated__transmissionMode_tm2:
-  eNB->transmission_mode[UE_id] = 2;
-  break;
-  case AntennaInfoDedicated__transmissionMode_tm3:
-  eNB->transmission_mode[UE_id] = 3;
-  break;
-  case AntennaInfoDedicated__transmissionMode_tm4:
-  eNB->transmission_mode[UE_id] = 4;
-  break;
-  case AntennaInfoDedicated__transmissionMode_tm5:
-  eNB->transmission_mode[UE_id] = 5;
-  break;
-  case AntennaInfoDedicated__transmissionMode_tm6:
-  eNB->transmission_mode[UE_id] = 6;
-  break;
-  case AntennaInfoDedicated__transmissionMode_tm7:
-  lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],eNB->frame_parms.Nid_cell,rnti);
-
-  for (i=0;i<eNB->num_RU;i++) eNB->RU_list[i]->do_precoding=1;
-  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",eNB->transmission_mode[UE_id]);
-
-  } else {
-  LOG_D(PHY,"[eNB %d] : Received NULL radioResourceConfigDedicated->antennaInfo from eNB %d\n",Mod_id,UE_id);
-  }
-  } else {
-  LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
-  return;
-  }
-
-  }
-*/
-
-#if defined(Rel10) || defined(Rel14)
-void phy_config_dedicated_scell_ue(uint8_t Mod_id,
-                                   uint8_t eNB_index,
-                                   SCellToAddMod_r10_t *sCellToAddMod_r10,
-                                   int CC_id)
-{
-
-}
-/*
-  void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
-  uint16_t rnti,
-  SCellToAddMod_r10_t *sCellToAddMod_r10,
-  int CC_id)
-  {
-
-
-  uint8_t UE_id = find_ue(rnti,RC.eNB[Mod_id][0]);
-  struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10;
-  //struct RadioResourceConfigCommonSCell_r10 *physicalConfigCommonSCell_r10 = sCellToAddMod_r10->radioResourceConfigCommonSCell_r10;
-  //PhysCellId_t physCellId_r10 = sCellToAddMod_r10->cellIdentification_r10->physCellId_r10;
-  ARFCN_ValueEUTRA_t dl_CarrierFreq_r10 = sCellToAddMod_r10->cellIdentification_r10->dl_CarrierFreq_r10;
-  uint32_t carrier_freq_local;
-
-  if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) {
-  carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1
-  LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,
-  //eNB->frame
-  0,
-  CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
-  } else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) {
-  carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1
-  // this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band
-  LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,
-  //eNB->frame
-  0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
-  } else {
-  LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %ld of SCell %d for UE %d not supported\n",Mod_id,
-  //eNB->frame
-  0,dl_CarrierFreq_r10,CC_id,UE_id);
-  }
-
-  if (physicalConfigDedicatedSCell_r10) {
-  //#warning " eNB->physicalConfigDedicatedSCell_r10 does not exist in eNB"
-  //  eNB->physicalConfigDedicatedSCell_r10[UE_id] = physicalConfigDedicatedSCell_r10;
-  LOG_I(PHY,"[eNB %d] Frame %d: Configured phyConfigDedicatedSCell with CC_id %d for UE %d\n",Mod_id,
-  //eNB->frame
-  0,CC_id,UE_id);
-  } else {
-  LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated (CC_id %d, UE %d)\n",Mod_id, 
-  //eNB->frame
-  0,CC_id,UE_id);
-  return;
+    LOG_E( PHY, "[eNB %"PRIu8"] find_ue() returns -1\n", Mod_id);
+    return;
   }
 
-  }
-*/
-
-#endif
-
-
-void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
-                        uint16_t max_harq_tx )
-{
-
-  PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
-  phy_vars_ue->ulsch[eNB_id]->Mlimit = max_harq_tx;
-}
-
-extern uint16_t beta_cqi[16];
-
-void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
-                             struct PhysicalConfigDedicated *physicalConfigDedicated )
-{
-
-  static uint8_t first_dedicated_configuration = 0;
-  PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
-
-  phy_vars_ue->total_TBS[eNB_id]=0;
-  phy_vars_ue->total_TBS_last[eNB_id]=0;
-  phy_vars_ue->bitrate[eNB_id]=0;
-  phy_vars_ue->total_received_bits[eNB_id]=0;
-  phy_vars_ue->dlsch_errors[eNB_id]=0;
-  phy_vars_ue->dlsch_errors_last[eNB_id]=0;
-  phy_vars_ue->dlsch_received[eNB_id]=0;
-  phy_vars_ue->dlsch_received_last[eNB_id]=0;
-  phy_vars_ue->dlsch_fer[eNB_id]=0;
-
-  phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
-  phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
 
   if (physicalConfigDedicated) {
-    LOG_D(PHY,"[UE %d] Received physicalConfigDedicated from eNB %d\n",Mod_id, eNB_id);
-    LOG_D(PHY,"------------------------------------------------------------------------\n");
-
-    if (physicalConfigDedicated->pdsch_ConfigDedicated) {
-      phy_vars_ue->pdsch_config_dedicated[eNB_id].p_a=physicalConfigDedicated->pdsch_ConfigDedicated->p_a;
-      LOG_D(PHY,"pdsch_config_dedicated.p_a %d\n",phy_vars_ue->pdsch_config_dedicated[eNB_id].p_a);
-      LOG_D(PHY,"\n");
-    }
-
-    if (physicalConfigDedicated->pucch_ConfigDedicated) {
-      if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==PUCCH_ConfigDedicated__ackNackRepetition_PR_release)
-        phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=0;
-      else {
-        phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=1;
-      }
-
-      if (physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode)
-        phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode = *physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode;
-      else
-        phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode = bundling;
-
-      if ( phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode == multiplexing)
-        LOG_D(PHY,"pucch_config_dedicated.tdd_AckNackFeedbackMode = multiplexing\n");
-      else
-        LOG_D(PHY,"pucch_config_dedicated.tdd_AckNackFeedbackMode = bundling\n");
-    }
-
-    if (physicalConfigDedicated->pusch_ConfigDedicated) {
-      phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index;
-      phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
-      phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
-
-
-      LOG_D(PHY,"pusch_config_dedicated.betaOffset_ACK_Index %d\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index);
-      LOG_D(PHY,"pusch_config_dedicated.betaOffset_RI_Index %d\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index);
-      LOG_D(PHY,"pusch_config_dedicated.betaOffset_CQI_Index %d => %d)\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index,beta_cqi[phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index]);
-      LOG_D(PHY,"\n");
-
-
-    }
-
-    if (physicalConfigDedicated->uplinkPowerControlDedicated) {
-
-      phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH = physicalConfigDedicated->uplinkPowerControlDedicated->p0_UE_PUSCH;
-      phy_vars_ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled= physicalConfigDedicated->uplinkPowerControlDedicated->deltaMCS_Enabled;
-      phy_vars_ue->ul_power_control_dedicated[eNB_id].accumulationEnabled= physicalConfigDedicated->uplinkPowerControlDedicated->accumulationEnabled;
-      phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUCCH= physicalConfigDedicated->uplinkPowerControlDedicated->p0_UE_PUCCH;
-      phy_vars_ue->ul_power_control_dedicated[eNB_id].pSRS_Offset= physicalConfigDedicated->uplinkPowerControlDedicated->pSRS_Offset;
-      phy_vars_ue->ul_power_control_dedicated[eNB_id].filterCoefficient= *physicalConfigDedicated->uplinkPowerControlDedicated->filterCoefficient;
-      LOG_D(PHY,"ul_power_control_dedicated.p0_UE_PUSCH %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH);
-      LOG_D(PHY,"ul_power_control_dedicated.deltaMCS_Enabled %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled);
-      LOG_D(PHY,"ul_power_control_dedicated.accumulationEnabled %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].accumulationEnabled);
-      LOG_D(PHY,"ul_power_control_dedicated.p0_UE_PUCCH %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUCCH);
-      LOG_D(PHY,"ul_power_control_dedicated.pSRS_Offset %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].pSRS_Offset);
-      LOG_D(PHY,"ul_power_control_dedicated.filterCoefficient %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].filterCoefficient);
-      LOG_D(PHY,"\n");
-    }
+    eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated;
+    LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
 
     if (physicalConfigDedicated->antennaInfo) {
-      phy_vars_ue->transmission_mode[eNB_id] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
-      LOG_I(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[eNB_id]);
       switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
       case AntennaInfoDedicated__transmissionMode_tm1:
-        phy_vars_ue->transmission_mode[eNB_id] = 1;
+        eNB->transmission_mode[UE_id] = 1;
         break;
       case AntennaInfoDedicated__transmissionMode_tm2:
-        phy_vars_ue->transmission_mode[eNB_id] = 2;
+        eNB->transmission_mode[UE_id] = 2;
         break;
       case AntennaInfoDedicated__transmissionMode_tm3:
-        phy_vars_ue->transmission_mode[eNB_id] = 3;
+        eNB->transmission_mode[UE_id] = 3;
         break;
       case AntennaInfoDedicated__transmissionMode_tm4:
-        phy_vars_ue->transmission_mode[eNB_id] = 4;
+        eNB->transmission_mode[UE_id] = 4;
         break;
       case AntennaInfoDedicated__transmissionMode_tm5:
-        phy_vars_ue->transmission_mode[eNB_id] = 5;
+        eNB->transmission_mode[UE_id] = 5;
         break;
       case AntennaInfoDedicated__transmissionMode_tm6:
-        phy_vars_ue->transmission_mode[eNB_id] = 6;
+        eNB->transmission_mode[UE_id] = 6;
         break;
       case AntennaInfoDedicated__transmissionMode_tm7:
-        lte_gold_ue_spec_port5(phy_vars_ue->lte_gold_uespec_port5_table, phy_vars_ue->frame_parms.Nid_cell, phy_vars_ue->pdcch_vars[0][eNB_id]->crnti);
-        phy_vars_ue->transmission_mode[eNB_id] = 7;
-        break;
+        lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],eNB->frame_parms.Nid_cell,rnti);
+
+	for (i=0;i<eNB->num_RU;i++) eNB->RU_list[i]->do_precoding=1;
+	eNB->transmission_mode[UE_id] = 7;
+	break;
       default:
         LOG_E(PHY,"Unknown transmission mode!\n");
         break;
       }
-    } else {
-      LOG_D(PHY,"[UE %d] Received NULL physicalConfigDedicated->antennaInfo from eNB %d\n",Mod_id, eNB_id);
-    }
-
-    if (physicalConfigDedicated->schedulingRequestConfig) {
-      if (physicalConfigDedicated->schedulingRequestConfig->present == SchedulingRequestConfig_PR_setup) {
-        phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex = physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex;
-        phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex=physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_ConfigIndex;
-        phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax=physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax;
-
-        LOG_D(PHY,"scheduling_request_config.sr_PUCCH_ResourceIndex %d\n",phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex);
-        LOG_D(PHY,"scheduling_request_config.sr_ConfigIndex %d\n",phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex);
-        LOG_D(PHY,"scheduling_request_config.dsr_TransMax %d\n",phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax);
-      }
-
-      LOG_D(PHY,"------------------------------------------------------------\n");
+      LOG_I(PHY,"Transmission Mode (phy_config_dedicated_eNB) %d\n",eNB->transmission_mode[UE_id]);
 
+    } else {
+      LOG_D(PHY,"[eNB %d] : Received NULL radioResourceConfigDedicated->antennaInfo from eNB %d\n",Mod_id,UE_id);
     }
+  } else {
+    LOG_E(PHY,"[eNB %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, UE_id);
+    return;
+  }
 
-    if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) {
-
-      phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0;
-      if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
-        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1;
-        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration             = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration;
-        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift          = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift;
-        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].freqDomainPosition   = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition;
-        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_Bandwidth        = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth;
-        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex      = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
-        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_HoppingBandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;
-        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].transmissionComb     = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
-
-
-        LOG_D(PHY,"soundingrs_ul_config_dedicated.srs_ConfigIndex %d\n",phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex);
-      }
-
-      LOG_D(PHY,"------------------------------------------------------------\n");
-
-    }
+}
+*/
 
+/*
+void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
+                                    uint16_t rnti,
+                                    SCellToAddMod_r10_t *sCellToAddMod_r10,
+                                    int CC_id)
+{
 
-    if (physicalConfigDedicated->cqi_ReportConfig) {
-      if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) {
-        // configure PUSCH CQI reporting
-        phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic;
-        if ((phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm12) &&
-            (phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm30) &&
-            (phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm31))
-          LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic);
-      }
-      if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) {
-        if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) {
-	  // configure PUCCH CQI reporting
-          phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
-          phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex     = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
-          if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex)
-            phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex;
-        }
-        else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_release) {
-          // handle release
-          phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
-          phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
-        }
-      }
-    }
 
-#ifdef CBA
+  uint8_t UE_id = find_ue(rnti,RC.eNB[Mod_id][0]);
+  struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10;
+  //struct RadioResourceConfigCommonSCell_r10 *physicalConfigCommonSCell_r10 = sCellToAddMod_r10->radioResourceConfigCommonSCell_r10;
+  //PhysCellId_t physCellId_r10 = sCellToAddMod_r10->cellIdentification_r10->physCellId_r10;
+  ARFCN_ValueEUTRA_t dl_CarrierFreq_r10 = sCellToAddMod_r10->cellIdentification_r10->dl_CarrierFreq_r10;
+  uint32_t carrier_freq_local;
 
-    if (physicalConfigDedicated->pusch_CBAConfigDedicated_vlola) {
-      phy_vars_ue->pusch_ca_config_dedicated[eNB_id].betaOffset_CA_Index = (uint16_t) *physicalConfigDedicated->pusch_CBAConfigDedicated_vlola->betaOffset_CBA_Index;
-      phy_vars_ue->pusch_ca_config_dedicated[eNB_id].cShift = (uint16_t) *physicalConfigDedicated->pusch_CBAConfigDedicated_vlola->cShift_CBA;
-      LOG_D(PHY,"[UE %d ] physicalConfigDedicated pusch CBA config dedicated: beta offset %d cshift %d \n",Mod_id,
-            phy_vars_ue->pusch_ca_config_dedicated[eNB_id].betaOffset_CA_Index,
-            phy_vars_ue->pusch_ca_config_dedicated[eNB_id].cShift);
-    }
+  if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) {
+    carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1
+    LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,
+	  //eNB->frame
+	  0,
+	  CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
+  } else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) {
+    carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1
+    // this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band
+    LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %ld) for UE %d\n",Mod_id,
+          //eNB->frame
+          0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
+  } else {
+    LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %ld of SCell %d for UE %d not supported\n",Mod_id,
+	  //eNB->frame
+	  0,dl_CarrierFreq_r10,CC_id,UE_id);
+  }
 
-#endif
+  if (physicalConfigDedicatedSCell_r10) {
+//#warning " eNB->physicalConfigDedicatedSCell_r10 does not exist in eNB"
+    //  eNB->physicalConfigDedicatedSCell_r10[UE_id] = physicalConfigDedicatedSCell_r10;
+    LOG_I(PHY,"[eNB %d] Frame %d: Configured phyConfigDedicatedSCell with CC_id %d for UE %d\n",Mod_id,
+	  //eNB->frame
+          0,CC_id,UE_id);
   } else {
-    LOG_D(PHY,"[PHY][UE %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id,eNB_id);
+    LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated (CC_id %d, UE %d)\n",Mod_id, 
+	  //eNB->frame
+	  0,CC_id,UE_id);
     return;
   }
 
-  // fill cqi parameters for periodic CQI reporting
-  get_cqipmiri_params(phy_vars_ue,eNB_id);
-
-  // disable MIB SIB decoding once we are on connected mode
-  first_dedicated_configuration ++;
-  if(first_dedicated_configuration > 1)
-  {
-  	LOG_I(PHY,"Disable SIB MIB decoding \n");
-  	phy_vars_ue->decode_SIB = 0;
-  	phy_vars_ue->decode_MIB = 0;
-  }
-  //phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
-  if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
-    phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
-  else
-    phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
+}
+*/
 
-  LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
-	phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
 
-}
 
 void  phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups)
 {
@@ -1247,537 +738,7 @@ void  phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uin
   }
 }
 
-void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
-{
-
-  crcTableInit();
-
-  ccodedot11_init();
-  ccodedot11_init_inv();
-
-  ccodelte_init();
-  ccodelte_init_inv();
-
-  treillis_table_init();
-
-  phy_generate_viterbi_tables();
-  phy_generate_viterbi_tables_lte();
-  init_td8();
-  init_td16();
-#ifdef __AVX2__
-  init_td16avx2();
-#endif
-  lte_sync_time_init(frame_parms);
-
-  generate_ul_ref_sigs();
-  generate_ul_ref_sigs_rx();
-
-  generate_64qam_table();
-  generate_16qam_table();
-  generate_qpsk_table();
-  generate_RIV_tables();
-
-  init_unscrambling_lut();
-  init_scrambling_lut();
-  //set_taus_seed(1328);
-
-
-}
-
-/*! \brief Helper function to allocate memory for DLSCH data structures.
- * \param[out] pdsch Pointer to the LTE_UE_PDSCH structure to initialize.
- * \param[in] frame_parms LTE_DL_FRAME_PARMS structure.
- * \note This function is optimistic in that it expects malloc() to succeed.
- */
-void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS* const fp )
-{
-  AssertFatal( pdsch, "pdsch==0" );
-
-  pdsch->pmi_ext = (uint8_t*)malloc16_clear( fp->N_RB_DL );
-  pdsch->llr[0] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
-  pdsch->llr128 = (int16_t**)malloc16_clear( sizeof(int16_t*) );
-  // FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV
-  // FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there
-
-
-  pdsch->rxdataF_ext            = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  pdsch->rxdataF_uespec_pilots  = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  pdsch->rxdataF_comp0          = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  pdsch->rho                    = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
-  pdsch->dl_ch_estimates_ext    = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  pdsch->dl_bf_ch_estimates     = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  pdsch->dl_bf_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  //pdsch->dl_ch_rho_ext          = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  //pdsch->dl_ch_rho2_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  pdsch->dl_ch_mag0             = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-  pdsch->dl_ch_magb0            = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-
-
-  // the allocated memory size is fixed:
-  AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
-
-  for (int i=0; i<fp->nb_antennas_rx; i++) {
-    pdsch->rho[i]     = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
-
-    for (int j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
-      const int idx = (j<<1)+i;
-      const size_t num = 7*2*fp->N_RB_DL*12;
-      pdsch->rxdataF_ext[idx]             = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-      pdsch->rxdataF_uespec_pilots[idx]   = (int32_t*)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12);
-      pdsch->rxdataF_comp0[idx]           = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-      pdsch->dl_ch_estimates_ext[idx]     = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-      pdsch->dl_bf_ch_estimates[idx]      = (int32_t*)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2);
-      pdsch->dl_bf_ch_estimates_ext[idx]  = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-      //pdsch->dl_ch_rho_ext[idx]           = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-      //pdsch->dl_ch_rho2_ext[idx]          = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-      pdsch->dl_ch_mag0[idx]              = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-      pdsch->dl_ch_magb0[idx]             = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-    }
-  }
-}
-
-int init_lte_ue_signal(PHY_VARS_UE *ue,
-		       int nb_connected_eNB,
-		       uint8_t abstraction_flag)
-{
-
-  // create shortcuts
-  LTE_DL_FRAME_PARMS* const fp            = &ue->frame_parms;
-  LTE_UE_COMMON* const common_vars        = &ue->common_vars;
-  LTE_UE_PDSCH** const pdsch_vars_SI      = ue->pdsch_vars_SI;
-  LTE_UE_PDSCH** const pdsch_vars_ra      = ue->pdsch_vars_ra;
-  LTE_UE_PDSCH** const pdsch_vars_p       = ue->pdsch_vars_p;
-  LTE_UE_PDSCH** const pdsch_vars_mch     = ue->pdsch_vars_MCH;
-  LTE_UE_PDSCH* (*pdsch_vars_th)[][NUMBER_OF_CONNECTED_eNB_MAX+1] = &ue->pdsch_vars;
-  LTE_UE_PDCCH* (*pdcch_vars_th)[][NUMBER_OF_CONNECTED_eNB_MAX]   = &ue->pdcch_vars;
-  LTE_UE_PBCH** const pbch_vars           = ue->pbch_vars;
-  LTE_UE_PRACH** const prach_vars         = ue->prach_vars;
-
-
-
-  int i,j,k,l;
-  int eNB_id;
-  int th_id;
-
-  LOG_D(PHY,"Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
-  LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
-
-
-
-  init_frame_parms(&ue->frame_parms,1);
-  init_lte_top(&ue->frame_parms);
-  init_ul_hopping(&ue->frame_parms);
-
-
-  // many memory allocation sizes are hard coded
-  AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
-  AssertFatal( ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
-  // init phy_vars_ue
-
-  for (i=0; i<4; i++) {
-    ue->rx_gain_max[i] = 135;
-    ue->rx_gain_med[i] = 128;
-    ue->rx_gain_byp[i] = 120;
-  }
-
-  ue->n_connected_eNB = nb_connected_eNB;
-
-  for(eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
-    ue->total_TBS[eNB_id] = 0;
-    ue->total_TBS_last[eNB_id] = 0;
-    ue->bitrate[eNB_id] = 0;
-    ue->total_received_bits[eNB_id] = 0;
-  }
-
-  for (i=0;i<10;i++)
-    ue->tx_power_dBm[i]=-127;
-
-
-
-  // init TX buffers
-  
-  common_vars->txdata  = (int32_t**)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) );
-  common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) );
-  
-  for (i=0; i<fp->nb_antennas_tx; i++) {
-    
-    common_vars->txdata[i]  = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
-    common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
-  }
-  
-  // init RX buffers
-  
-  common_vars->rxdata   = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
-  common_vars->common_vars_rx_data_per_thread[0].rxdataF  = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
-  common_vars->common_vars_rx_data_per_thread[1].rxdataF  = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
-  
-  for (i=0; i<fp->nb_antennas_rx; i++) {
-    common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_tti*10+2048)*sizeof(int32_t) );
-    common_vars->common_vars_rx_data_per_thread[0].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
-    common_vars->common_vars_rx_data_per_thread[1].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
-  }
-
-
-  // Channel estimates
-  for (eNB_id=0; eNB_id<7; eNB_id++) {
-    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-        common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates[eNB_id]      = (int32_t**)malloc16_clear(8*sizeof(int32_t*));
-        common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates_time[eNB_id] = (int32_t**)malloc16_clear(8*sizeof(int32_t*));
-    }
-
-    for (i=0; i<fp->nb_antennas_rx; i++)
-      for (j=0; j<4; j++) {
-        int idx = (j<<1) + i;
-        for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-            common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates[eNB_id][idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->symbols_per_tti*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
-            common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates_time[eNB_id][idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
-        }
-      }
-  }
-
-  // DLSCH
-  for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) {
-    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-        (*pdsch_vars_th)[th_id][eNB_id]     = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
-    }
-
-    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-        (*pdcch_vars_th)[th_id][eNB_id] = (LTE_UE_PDCCH *)malloc16_clear(sizeof(LTE_UE_PDCCH));
-    }
-
-    pdsch_vars_SI[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
-    pdsch_vars_ra[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
-    pdsch_vars_p[eNB_id]   = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
-    pdsch_vars_mch[eNB_id] = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
-    prach_vars[eNB_id]     = (LTE_UE_PRACH *)malloc16_clear(sizeof(LTE_UE_PRACH));
-    pbch_vars[eNB_id]      = (LTE_UE_PBCH *)malloc16_clear(sizeof(LTE_UE_PBCH));
-
-    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-      phy_init_lte_ue__PDSCH( (*pdsch_vars_th)[th_id][eNB_id], fp );
-    }
-
-    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-      (*pdsch_vars_th)[th_id][eNB_id]->llr_shifts      = (uint8_t*)malloc16_clear(7*2*fp->N_RB_DL*12);
-      (*pdsch_vars_th)[th_id][eNB_id]->llr_shifts_p        = (*pdsch_vars_th)[0][eNB_id]->llr_shifts;
-      (*pdsch_vars_th)[th_id][eNB_id]->llr[1]              = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
-      (*pdsch_vars_th)[th_id][eNB_id]->llr128_2ndstream    = (int16_t**)malloc16_clear( sizeof(int16_t*) );
-      (*pdsch_vars_th)[th_id][eNB_id]->rho                 = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
-    }
-    
-    for (int i=0; i<fp->nb_antennas_rx; i++){
-      for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-	(*pdsch_vars_th)[th_id][eNB_id]->rho[i]     = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
-      }
-      
-    }
-    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-      (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho2_ext      = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-    }
-    
-    for (i=0; i<fp->nb_antennas_rx; i++)
-      for (j=0; j<4; j++) {
-	const int idx = (j<<1)+i;
-	const size_t num = 7*2*fp->N_RB_DL*12+4;
-	for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-	  (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-	}
-	
-      }
-    
-    //const size_t num = 7*2*fp->N_RB_DL*12+4;
-    for (k=0;k<8;k++) { //harq_pid
-      for (l=0;l<8;l++) { //round
-	for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-	  (*pdsch_vars_th)[th_id][eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-	  (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-	  (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_mag1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-	  (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_magb1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-	}
-	
-	
-	for (int i=0; i<fp->nb_antennas_rx; i++)
-	  for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
-	    const int idx = (j<<1)+i;
-	    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-	      (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
-	      (*pdsch_vars_th)[th_id][eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
-	      (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_mag1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
-	      (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_magb1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
-	    }
-	    
-	  }
-      }
-    }
-    phy_init_lte_ue__PDSCH( pdsch_vars_SI[eNB_id], fp );
-    phy_init_lte_ue__PDSCH( pdsch_vars_ra[eNB_id], fp );
-    phy_init_lte_ue__PDSCH( pdsch_vars_p[eNB_id], fp );
-    phy_init_lte_ue__PDSCH( pdsch_vars_mch[eNB_id], fp );
-    
-    // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
-    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-      (*pdcch_vars_th)[th_id][eNB_id]->llr   = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
-      (*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
-      (*pdcch_vars_th)[th_id][eNB_id]->wbar  = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
-      (*pdcch_vars_th)[th_id][eNB_id]->e_rx  = (int8_t*)malloc16_clear( 4*2*100*12 );
-      
-      (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp        = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-      (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext       = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-      (*pdcch_vars_th)[th_id][eNB_id]->rho                 = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
-      (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-      (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-    }
-    
-    for (i=0; i<fp->nb_antennas_rx; i++) {
-      //ue_pdcch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
-      for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-	(*pdcch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(100*12*4) );
-      }
-      
-      for (j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
-	int idx = (j<<1)+i;
-	//  size_t num = 7*2*fp->N_RB_DL*12;
-	size_t num = 4*100*12;  // 4 symbols, 100 PRBs, 12 REs per PRB
-	for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-	  (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp[idx]        = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-	  (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[idx]       = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-	  (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext[idx]         = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-              (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-	}
-      }
-    }
-    phy_init_lte_ue__PDSCH( pdsch_vars_SI[eNB_id], fp );
-    phy_init_lte_ue__PDSCH( pdsch_vars_ra[eNB_id], fp );
-    phy_init_lte_ue__PDSCH( pdsch_vars_p[eNB_id], fp );
-    phy_init_lte_ue__PDSCH( pdsch_vars_mch[eNB_id], fp );
-    
-    // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
-    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-      (*pdcch_vars_th)[th_id][eNB_id]->llr   = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
-      (*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
-      (*pdcch_vars_th)[th_id][eNB_id]->wbar  = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
-      (*pdcch_vars_th)[th_id][eNB_id]->e_rx  = (int8_t*)malloc16_clear( 4*2*100*12 );
-      
-      (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp        = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-      (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext       = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-      (*pdcch_vars_th)[th_id][eNB_id]->rho                 = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
-      (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-      (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-    }
-    
-    for (i=0; i<fp->nb_antennas_rx; i++) {
-      //ue_pdcch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
-
-      for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-	(*pdcch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(100*12*4) );
-      }
-      
-      for (j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
-	int idx = (j<<1)+i;
-	//  size_t num = 7*2*fp->N_RB_DL*12;
-	size_t num = 4*100*12;  // 4 symbols, 100 PRBs, 12 REs per PRB
-	for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-	  (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp[idx]        = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-	  (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[idx]       = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-	  (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext[idx]         = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-	  (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
-	}
-      }
-    }
-    
-    // PBCH
-    pbch_vars[eNB_id]->rxdataF_ext         = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
-    pbch_vars[eNB_id]->rxdataF_comp        = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-    pbch_vars[eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
-    pbch_vars[eNB_id]->llr                 = (int8_t*)malloc16_clear( 1920 );
-    prach_vars[eNB_id]->prachF             = (int16_t*)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
-    prach_vars[eNB_id]->prach              = (int16_t*)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
-    
-    for (i=0; i<fp->nb_antennas_rx; i++) {
-      pbch_vars[eNB_id]->rxdataF_ext[i]    = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
-      
-      for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
-	int idx = (j<<1)+i;
-	pbch_vars[eNB_id]->rxdataF_comp[idx]        = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
-	pbch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
-      }
-    }
-  
-    
-    pbch_vars[eNB_id]->decoded_output = (uint8_t*)malloc16_clear( 64 );
-  }
-
-  // initialization for the last instance of pdsch_vars (used for MU-MIMO)
-  for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-      (*pdsch_vars_th)[th_id][eNB_id]     = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
-  }
-
-  pdsch_vars_SI[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
-  pdsch_vars_ra[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
-  pdsch_vars_p[eNB_id]   = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
-
-  for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
-    phy_init_lte_ue__PDSCH( (*pdsch_vars_th)[th_id][eNB_id], fp );
-    (*pdsch_vars_th)[th_id][eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
-  }
-
-
-  ue->sinr_CQI_dB = (double*) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
-
-  ue->init_averaging = 1;
-  // default value until overwritten by RRCConnectionReconfiguration
-  if (fp->nb_antenna_ports_eNB==2)
-    ue->pdsch_config_dedicated->p_a = dBm3;
-  else
-    ue->pdsch_config_dedicated->p_a = dB0;
-
-  // set channel estimation to do linear interpolation in time
-  ue->high_speed_flag = 1;
-  ue->ch_est_alpha    = 24576;
-
-  // enable MIB/SIB decoding by default
-  ue->decode_MIB = 1;
-  ue->decode_SIB = 1;
-
-  init_prach_tables(839);
-
-
-  return 0;
-}
-
-void init_lte_ue_transport(PHY_VARS_UE *ue,int abstraction_flag) {
-
-  int i,j,k;
-
-  for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
-    for (j=0; j<2; j++) {
-      for (k=0; k<2; k++) {
-	AssertFatal((ue->dlsch[k][i][j]  = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
-
-	LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]);
-      }
-    }
-
-    AssertFatal((ue->ulsch[i]  = new_ue_ulsch(ue->frame_parms.N_RB_UL, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n");
-
-    ue->dlsch_SI[i]  = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
-    ue->dlsch_ra[i]  = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
-
-    ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_eNB==1 ? 1 : 2;
-  }
-
-  ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
-
-  ue->dlsch_MCH[0]  = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
-
-}
-
-int phy_init_RU(RU_t *ru) {
-
-  LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
-  int i,j;
-  int p;
-  int re;
-
-  LOG_I(PHY,"Initializing RU signal buffers (if_south %s)\n",ru_if_types[ru->if_south]);
-
-  if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals 
-    // Time-domain signals
-    ru->common.txdata        = (int32_t**)malloc16(ru->nb_tx*sizeof(int32_t*));
-    ru->common.rxdata        = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
-
-
-    for (i=0; i<ru->nb_tx; i++) {
-      // Allocate 10 subframes of I/Q TX signal data (time) if not
-      ru->common.txdata[i]  = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
-
-      LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes)\n",i,ru->common.txdata[i],
-	    fp->samples_per_tti*10*sizeof(int32_t));
-
-    }
-    for (i=0;i<ru->nb_rx;i++) {
-      ru->common.rxdata[i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
-    }
-  } // IF5 or local RF
-  else {
-    LOG_I(PHY,"No rxdata/txdata for RU\n");
-    ru->common.txdata        = (int32_t**)NULL;
-    ru->common.rxdata        = (int32_t**)NULL;
-
-  }
-  if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing
-    ru->common.rxdata_7_5kHz = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
-    for (i=0;i<ru->nb_rx;i++) {
-      ru->common.rxdata_7_5kHz[i] = (int32_t*)malloc16_clear( 2*fp->samples_per_tti*2*sizeof(int32_t) );
-      LOG_I(PHY,"rxdata_7_5kHz[%d] %p for RU %d\n",i,ru->common.rxdata_7_5kHz[i],ru->idx);
-    }
-  
-
-    // allocate IFFT input buffers (TX)
-    ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*));
-    LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n",ru->common.txdataF_BF,
-	  ru->nb_tx*sizeof(int32_t*));
-    for (i=0; i<ru->nb_tx; i++) {
-      ru->common.txdataF_BF[i] = (int32_t*)malloc16_clear(fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t) );
-      LOG_I(PHY,"txdataF_BF[%d] %p for RU %d\n",i,ru->common.txdataF_BF[i],ru->idx);
-    }
-    // allocate FFT output buffers (RX)
-    ru->common.rxdataF     = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
-    for (i=0; i<ru->nb_rx; i++) {    
-      // allocate 2 subframes of I/Q signal data (frequency)
-      ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(2*fp->ofdm_symbol_size*fp->symbols_per_tti) ); 
-      LOG_I(PHY,"rxdataF[%d] %p for RU %d\n",i,ru->common.rxdataF[i],ru->idx);
-    }
-
-    /* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
-    AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
-		"nb_antennas_rx too large");
-    ru->prach_rxsigF = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
-    for (j=0;j<4;j++) ru->prach_rxsigF_br[j] = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
 
-    for (i=0; i<ru->nb_rx; i++) {
-      ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
-      LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
-#ifdef Rel14
-      for (j=0;j<4;j++) {
-	ru->prach_rxsigF_br[j][i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
-	LOG_D(PHY,"[INIT] prach_vars_br->rxsigF[%d] = %p\n",i,ru->prach_rxsigF_br[j][i]);
-      }
-#endif
-    }
-    
-    AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
-		RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
-
-    for (i=0; i<RC.nb_L1_inst; i++) {
-      for (p=0;p<15;p++) {
-	if (p<ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p==5) {
-	  ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
-	  for (j=0; j<ru->nb_tx; j++) {
-	    ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
-	    // antenna ports 0-3 are mapped on antennas 0-3
-	    // antenna port 4 is mapped on antenna 0
-	    // antenna ports 5-14 are mapped on all antennas 
-	    if (((p<4) && (p==j)) || ((p==4) && (j==0))) {
-	      for (re=0; re<fp->ofdm_symbol_size; re++) 
-		ru->beam_weights[i][p][j][re] = 0x00007fff; 
-	    }
-	    else if (p>4) {
-	      for (re=0; re<fp->ofdm_symbol_size; re++) 
-		ru->beam_weights[i][p][j][re] = 0x00007fff/ru->nb_tx; 
-	    }  
-	    LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d] = %p (%lu bytes)\n",
-		  i,j,ru->beam_weights[i][p][j],
-		  fp->ofdm_symbol_size*sizeof(int32_t)); 
-	  }
-	}
-      }
-    }
-  }
-  ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_tti );
-
-  return(0);
-}
-  
 int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
                      unsigned char is_secondary_eNB,
                      unsigned char abstraction_flag)
@@ -1794,6 +755,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
 #endif
   int i, UE_id; 
 
+  LOG_I(PHY,"[eNB %d] %s() About to wait for eNB to be configured", eNB->Mod_id, __FUNCTION__);
 
   eNB->total_dlsch_bitrate = 0;
   eNB->total_transmitted_bits = 0;
@@ -1802,10 +764,18 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
  
   while(eNB->configured == 0) usleep(10000);
 
-  LOG_I(PHY,"[eNB %"PRIu8"] Initializing DL_FRAME_PARMS : N_RB_DL %"PRIu8", PHICH Resource %d, PHICH Duration %d\n",
+  LOG_I(PHY,"[eNB %"PRIu8"] Initializing DL_FRAME_PARMS : N_RB_DL %"PRIu8", PHICH Resource %d, PHICH Duration %d nb_antennas_tx:%u nb_antennas_rx:%u nb_antenna_ports_eNB:%u PRACH[rootSequenceIndex:%u prach_Config_enabled:%u configIndex:%u highSpeed:%u zeroCorrelationZoneConfig:%u freqOffset:%u]\n",
         eNB->Mod_id,
         fp->N_RB_DL,fp->phich_config_common.phich_resource,
-        fp->phich_config_common.phich_duration);
+        fp->phich_config_common.phich_duration,
+        fp->nb_antennas_tx, fp->nb_antennas_rx, fp->nb_antenna_ports_eNB,
+        fp->prach_config_common.rootSequenceIndex,
+        fp->prach_config_common.prach_Config_enabled,
+        fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
+        fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
+        fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+        fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset
+        );
   LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_eNB][MOD %02"PRIu8"][]\n", eNB->Mod_id);
 
 
@@ -1832,6 +802,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
   common_vars->txdataF = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t*));
   common_vars->rxdataF = (int32_t **)malloc16(64*sizeof(int32_t*));
   
+  LOG_D(PHY,"[INIT] NB_ANTENNA_PORTS_ENB:%d fp->nb_antenna_ports_eNB:%d\n", NB_ANTENNA_PORTS_ENB, fp->nb_antenna_ports_eNB);
+
   for (i=0; i<NB_ANTENNA_PORTS_ENB; i++) {
     if (i<fp->nb_antenna_ports_eNB || i==5) {
       common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
@@ -1858,6 +830,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
 
   generate_ul_ref_sigs_rx();
   
+  init_ulsch_power_LUT();
+
   // SRS
   for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
     srs_vars[UE_id].srs = (int32_t*)malloc16_clear(2*fp->ofdm_symbol_size*sizeof(int32_t));
@@ -1884,12 +858,12 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
 #endif
   
   /* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) 
-     AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->rxsigF) / sizeof(prach_vars->rxsigF[0]),
-     "nb_antennas_rx too large");
-     for (i=0; i<fp->nb_antennas_rx; i++) {
-     prach_vars->rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
-     LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]);
-     }*/
+  AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->rxsigF) / sizeof(prach_vars->rxsigF[0]),
+              "nb_antennas_rx too large");
+  for (i=0; i<fp->nb_antennas_rx; i++) {
+    prach_vars->rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
+    LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]);
+    }*/
   
   for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
     
@@ -1910,14 +884,14 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
     for (i=0; i<2; i++) {
       // RK 2 times because of output format of FFT!
       // FIXME We should get rid of this
-      pusch_vars[UE_id]->rxdataF_ext[i]      = (int32_t*)malloc16_clear( 2*sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+      pusch_vars[UE_id]->rxdataF_ext[i]      = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
       pusch_vars[UE_id]->rxdataF_ext2[i]     = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
       pusch_vars[UE_id]->drs_ch_estimates[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
-      pusch_vars[UE_id]->drs_ch_estimates_time[i] = (int32_t*)malloc16_clear( 2*2*sizeof(int32_t)*fp->ofdm_symbol_size );
+      pusch_vars[UE_id]->drs_ch_estimates_time[i] = (int32_t*)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
       pusch_vars[UE_id]->rxdataF_comp[i]     = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
       pusch_vars[UE_id]->ul_ch_mag[i]  = (int32_t*)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
       pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t*)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
-    }
+      }
     
     pusch_vars[UE_id]->llr = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
   } //UE_id
@@ -1932,3 +906,83 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
   return (0);
 
 }
+
+void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
+{
+  LTE_DL_FRAME_PARMS* const fp       = &eNB->frame_parms;
+  LTE_eNB_COMMON* const common_vars  = &eNB->common_vars;
+  LTE_eNB_PUSCH** const pusch_vars   = eNB->pusch_vars;
+  LTE_eNB_SRS* const srs_vars        = eNB->srs_vars;
+  LTE_eNB_PRACH* const prach_vars    = &eNB->prach_vars;
+#ifdef Rel14
+  LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
+#endif
+  int i, UE_id;
+
+  for (i = 0; i < NB_ANTENNA_PORTS_ENB; i++) {
+    if (i < fp->nb_antenna_ports_eNB || i == 5) {
+      free_and_zero(common_vars->txdataF[i]);
+      /* rxdataF[i] is not allocated -> don't free */
+    }
+  }
+  free_and_zero(common_vars->txdataF);
+  free_and_zero(common_vars->rxdataF);
+
+  // Channel estimates for SRS
+  for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+    for (i=0; i<64; i++) {
+      free_and_zero(srs_vars[UE_id].srs_ch_estimates[i]);
+      free_and_zero(srs_vars[UE_id].srs_ch_estimates_time[i]);
+    }
+    free_and_zero(srs_vars[UE_id].srs_ch_estimates);
+    free_and_zero(srs_vars[UE_id].srs_ch_estimates_time);
+  } //UE_id
+
+  free_ul_ref_sigs();
+
+  for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) free_and_zero(srs_vars[UE_id].srs);
+
+  free_and_zero(prach_vars->prachF);
+
+  for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
+  free_and_zero(prach_vars->prach_ifft[0]);
+
+#ifdef Rel14
+  for (int ce_level = 0; ce_level < 4; ce_level++) {
+    for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]);
+    free_and_zero(prach_vars_br->prach_ifft[ce_level]);
+    free_and_zero(prach_vars->rxsigF[ce_level]);
+  }
+  free_and_zero(prach_vars_br->prachF);
+#endif
+  free_and_zero(prach_vars->rxsigF[0]);
+
+  for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
+    for (i = 0; i < 2; i++) {
+      free_and_zero(pusch_vars[UE_id]->rxdataF_ext[i]);
+      free_and_zero(pusch_vars[UE_id]->rxdataF_ext2[i]);
+      free_and_zero(pusch_vars[UE_id]->drs_ch_estimates[i]);
+      free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time[i]);
+      free_and_zero(pusch_vars[UE_id]->rxdataF_comp[i]);
+      free_and_zero(pusch_vars[UE_id]->ul_ch_mag[i]);
+      free_and_zero(pusch_vars[UE_id]->ul_ch_magb[i]);
+    }
+    free_and_zero(pusch_vars[UE_id]->rxdataF_ext);
+    free_and_zero(pusch_vars[UE_id]->rxdataF_ext2);
+    free_and_zero(pusch_vars[UE_id]->drs_ch_estimates);
+    free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time);
+    free_and_zero(pusch_vars[UE_id]->rxdataF_comp);
+    free_and_zero(pusch_vars[UE_id]->ul_ch_mag);
+    free_and_zero(pusch_vars[UE_id]->ul_ch_magb);
+    free_and_zero(pusch_vars[UE_id]->llr);
+    free_and_zero(pusch_vars[UE_id]);
+  } //UE_id
+
+  for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) eNB->UE_stats_ptr[UE_id] = NULL;
+}
+
+void install_schedule_handlers(IF_Module_t *if_inst)
+{
+  if_inst->PHY_config_req = phy_config_request;
+  if_inst->schedule_response = schedule_response;
+}
diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c
new file mode 100644
index 0000000000000000000000000000000000000000..91681930748052dd38dd69a74cd7a782e1d6cf6d
--- /dev/null
+++ b/openair1/PHY/INIT/lte_init_ru.c
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#include "defs.h"
+#include "SCHED/defs.h"
+#include "PHY/extern.h"
+#include "SIMULATION/TOOLS/defs.h"
+#include "RadioResourceConfigCommonSIB.h"
+#include "RadioResourceConfigDedicated.h"
+#include "TDD-Config.h"
+#include "LAYER2/MAC/extern.h"
+#include "MBSFN-SubframeConfigList.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
+#include "assertions.h"
+#include <math.h>
+
+int phy_init_RU(RU_t *ru) {
+
+  LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
+  int i,j;
+  int p;
+  int re;
+
+  LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d\n",ru_if_types[ru->if_south],ru->nb_tx);
+
+  if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals 
+    // Time-domain signals
+    ru->common.txdata        = (int32_t**)malloc16(ru->nb_tx*sizeof(int32_t*));
+    ru->common.rxdata        = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
+
+
+    for (i=0; i<ru->nb_tx; i++) {
+      // Allocate 10 subframes of I/Q TX signal data (time) if not
+      ru->common.txdata[i]  = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
+
+      LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes)\n",i,ru->common.txdata[i],
+	     fp->samples_per_tti*10*sizeof(int32_t));
+
+    }
+    for (i=0;i<ru->nb_rx;i++) {
+      ru->common.rxdata[i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
+    }
+  } // IF5 or local RF
+  else {
+    //    LOG_I(PHY,"No rxdata/txdata for RU\n");
+    ru->common.txdata        = (int32_t**)NULL;
+    ru->common.rxdata        = (int32_t**)NULL;
+
+  }
+  if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing
+    LOG_I(PHY,"nb_tx %d\n",ru->nb_tx);
+    ru->common.rxdata_7_5kHz = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
+    for (i=0;i<ru->nb_rx;i++) {
+      ru->common.rxdata_7_5kHz[i] = (int32_t*)malloc16_clear( 2*fp->samples_per_tti*2*sizeof(int32_t) );
+      LOG_I(PHY,"rxdata_7_5kHz[%d] %p for RU %d\n",i,ru->common.rxdata_7_5kHz[i],ru->idx);
+    }
+  
+
+    // allocate IFFT input buffers (TX)
+    ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*));
+    LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n",ru->common.txdataF_BF,
+	  ru->nb_tx*sizeof(int32_t*));
+    for (i=0; i<ru->nb_tx; i++) {
+      ru->common.txdataF_BF[i] = (int32_t*)malloc16_clear(fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t) );
+      LOG_I(PHY,"txdataF_BF[%d] %p for RU %d\n",i,ru->common.txdataF_BF[i],ru->idx);
+    }
+    // allocate FFT output buffers (RX)
+    ru->common.rxdataF     = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
+    for (i=0; i<ru->nb_rx; i++) {    
+      // allocate 2 subframes of I/Q signal data (frequency)
+      ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(2*fp->ofdm_symbol_size*fp->symbols_per_tti) ); 
+      LOG_I(PHY,"rxdataF[%d] %p for RU %d\n",i,ru->common.rxdataF[i],ru->idx);
+    }
+
+    /* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
+    //    AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
+    //		"nb_antennas_rx too large");
+    ru->prach_rxsigF = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
+    for (j=0;j<4;j++) ru->prach_rxsigF_br[j] = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
+
+    for (i=0; i<ru->nb_rx; i++) {
+      ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
+      LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
+#ifdef Rel14
+      for (j=0;j<4;j++) {
+	ru->prach_rxsigF_br[j][i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
+	LOG_D(PHY,"[INIT] prach_vars_br->rxsigF[%d] = %p\n",i,ru->prach_rxsigF_br[j][i]);
+      }
+#endif
+    }
+    
+    AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
+		RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
+
+    LOG_E(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
+
+    for (i=0; i<RC.nb_L1_inst; i++) {
+      for (p=0;p<15;p++) {
+        LOG_D(PHY,"[INIT] %s() nb_antenna_ports_eNB:%d \n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB);
+	if (p<ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p==5) {
+          LOG_D(PHY,"[INIT] %s() DO BEAM WEIGHTS nb_antenna_ports_eNB:%d nb_tx:%d\n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB, ru->nb_tx);
+	  ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
+	  for (j=0; j<ru->nb_tx; j++) {
+	    ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
+	    // antenna ports 0-3 are mapped on antennas 0-3
+	    // antenna port 4 is mapped on antenna 0
+	    // antenna ports 5-14 are mapped on all antennas 
+	    if (((p<4) && (p==j)) || ((p==4) && (j==0))) {
+	      for (re=0; re<fp->ofdm_symbol_size; re++) 
+              {
+		ru->beam_weights[i][p][j][re] = 0x00007fff; 
+
+                //LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]);
+              }
+	    }
+	    else if (p>4) {
+	      for (re=0; re<fp->ofdm_symbol_size; re++) 
+              {
+		ru->beam_weights[i][p][j][re] = 0x00007fff/ru->nb_tx; 
+                //LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]);
+              }
+	    }  
+	    //LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d] = %p (%lu bytes)\n", i,j,ru->beam_weights[i][p][j], fp->ofdm_symbol_size*sizeof(int32_t)); 
+	  } // for (j=0
+	} // if (p<ru
+      } // for p
+    } //for i
+  } // !=IF5
+  ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_tti );
+
+  return(0);
+}
+
+void phy_free_RU(RU_t *ru)
+{
+  int i,j;
+  int p;
+
+  LOG_I(PHY, "Feeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
+
+  if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
+    for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdata[i]);
+    for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata[i]);
+    free_and_zero(ru->common.txdata);
+    free_and_zero(ru->common.rxdata);
+  } // else: IF5 or local RF -> nothing to free()
+
+  if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing
+    for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata_7_5kHz[i]);
+    free_and_zero(ru->common.rxdata_7_5kHz);
+
+    // free IFFT input buffers (TX)
+    for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF_BF[i]);
+    free_and_zero(ru->common.txdataF_BF);
+
+    // free FFT output buffers (RX)
+    for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdataF[i]);
+    free_and_zero(ru->common.rxdataF);
+
+    for (i = 0; i < ru->nb_rx; i++) {
+      free_and_zero(ru->prach_rxsigF[i]);
+#ifdef Rel14
+      for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]);
+#endif
+    }
+    for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j]);
+    free_and_zero(ru->prach_rxsigF);
+    /* ru->prach_rxsigF_br is not allocated -> don't free */
+
+    for (i = 0; i < RC.nb_L1_inst; i++) {
+      for (p = 0; p < 15; p++) {
+	if (p < ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p == 5) {
+	  for (j=0; j<ru->nb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
+	  free_and_zero(ru->beam_weights[i][p]);
+	}
+      }
+    }
+  }
+  free_and_zero(ru->common.sync_corr);
+}
diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c
new file mode 100644
index 0000000000000000000000000000000000000000..16274d687841098c06042d9c471f2add19900fcb
--- /dev/null
+++ b/openair1/PHY/INIT/lte_init_ue.c
@@ -0,0 +1,963 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#include "defs.h"
+#include "SCHED/defs.h"
+#include "PHY/extern.h"
+#include "SIMULATION/TOOLS/defs.h"
+#include "RadioResourceConfigCommonSIB.h"
+#include "RadioResourceConfigDedicated.h"
+#include "TDD-Config.h"
+#include "LAYER2/MAC/extern.h"
+#include "MBSFN-SubframeConfigList.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
+#include "assertions.h"
+#include <math.h>
+
+
+uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
+
+void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
+                        uint8_t eNB_id,
+                        TDD_Config_t *tdd_Config,
+                        uint8_t SIwindowsize,
+                        uint16_t SIperiod)
+{
+
+  LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
+
+  if (tdd_Config) {
+    fp->tdd_config    = tdd_Config->subframeAssignment;
+    fp->tdd_config_S  = tdd_Config->specialSubframePatterns;
+  }
+
+  fp->SIwindowsize  = SIwindowsize;
+  fp->SIPeriod      = SIperiod;
+}
+
+void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
+                        uint8_t eNB_id,
+                        RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
+                        ARFCN_ValueEUTRA_t *ul_CarrierFreq,
+                        long *ul_Bandwidth,
+                        AdditionalSpectrumEmission_t *additionalSpectrumEmission,
+                        struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
+{
+
+  PHY_VARS_UE *ue        = PHY_vars_UE_g[Mod_id][CC_id];
+  LTE_DL_FRAME_PARMS *fp = &ue->frame_parms;
+  int i;
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_IN);
+
+  LOG_I(PHY,"[UE%d] Applying radioResourceConfigCommon from eNB%d\n",Mod_id,eNB_id);
+
+  fp->prach_config_common.rootSequenceIndex                           =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
+
+  fp->prach_config_common.prach_Config_enabled=1;
+  fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex          =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
+  fp->prach_config_common.prach_ConfigInfo.highSpeedFlag              =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.highSpeedFlag;
+  fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig  =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
+  fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset           =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset;
+
+  compute_prach_seq(fp->prach_config_common.rootSequenceIndex,
+		    fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
+		    fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+		    fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
+		    fp->frame_type,ue->X_u);
+
+
+
+  fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon.deltaPUCCH_Shift;
+  fp->pucch_config_common.nRB_CQI          = radioResourceConfigCommon->pucch_ConfigCommon.nRB_CQI;
+  fp->pucch_config_common.nCS_AN           = radioResourceConfigCommon->pucch_ConfigCommon.nCS_AN;
+  fp->pucch_config_common.n1PUCCH_AN       = radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN;
+
+
+
+  fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon.referenceSignalPower;
+  fp->pdsch_config_common.p_b                  = radioResourceConfigCommon->pdsch_ConfigCommon.p_b;
+
+
+  fp->pusch_config_common.n_SB                                         = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
+  fp->pusch_config_common.hoppingMode                                  = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
+  fp->pusch_config_common.pusch_HoppingOffset                          = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
+  fp->pusch_config_common.enable64QAM                                  = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
+  fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled    = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
+  fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH   = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
+  fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
+  fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift            = dmrs1_tab_ue[radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift];
+
+
+  init_ul_hopping(fp);
+  fp->soundingrs_ul_config_common.enabled_flag                        = 0;
+
+  if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) {
+    fp->soundingrs_ul_config_common.enabled_flag                        = 1;
+    fp->soundingrs_ul_config_common.srs_BandwidthConfig                 = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
+    fp->soundingrs_ul_config_common.srs_SubframeConfig                  = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
+    fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
+
+    if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
+      fp->soundingrs_ul_config_common.srs_MaxUpPts                      = 1;
+    else
+      fp->soundingrs_ul_config_common.srs_MaxUpPts                      = 0;
+  }
+
+
+
+  fp->ul_power_control_config_common.p0_NominalPUSCH   = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUSCH;
+  fp->ul_power_control_config_common.alpha             = radioResourceConfigCommon->uplinkPowerControlCommon.alpha;
+  fp->ul_power_control_config_common.p0_NominalPUCCH   = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUCCH;
+  fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaPreambleMsg3;
+  fp->ul_power_control_config_common.deltaF_PUCCH_Format1  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1;
+  fp->ul_power_control_config_common.deltaF_PUCCH_Format1b  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b;
+  fp->ul_power_control_config_common.deltaF_PUCCH_Format2  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2;
+  fp->ul_power_control_config_common.deltaF_PUCCH_Format2a  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a;
+  fp->ul_power_control_config_common.deltaF_PUCCH_Format2b  = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b;
+
+  fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx;
+
+  // Now configure some of the Physical Channels
+
+  // PUCCH
+  init_ncs_cell(fp,ue->ncs_cell);
+
+  init_ul_hopping(fp);
+
+  // PCH
+  init_ue_paging_info(ue,radioResourceConfigCommon->pcch_Config.defaultPagingCycle,radioResourceConfigCommon->pcch_Config.nB);
+
+  // MBSFN
+
+  if (mbsfn_SubframeConfigList != NULL) {
+    fp->num_MBSFN_config = mbsfn_SubframeConfigList->list.count;
+
+    for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
+      fp->MBSFN_config[i].radioframeAllocationPeriod = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod;
+      fp->MBSFN_config[i].radioframeAllocationOffset = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset;
+
+      if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
+        fp->MBSFN_config[i].fourFrames_flag = 0;
+        fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
+        LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is  %d\n", i,
+              fp->MBSFN_config[i].mbsfn_SubframeConfig);
+      } else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
+        fp->MBSFN_config[i].fourFrames_flag = 1;
+        fp->MBSFN_config[i].mbsfn_SubframeConfig =
+          mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]|
+          (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
+          (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16);
+
+        LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is  %d\n", i,
+              fp->MBSFN_config[i].mbsfn_SubframeConfig);
+      }
+    }
+  }
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_OUT);
+
+}
+
+void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
+                         long mbsfn_AreaId_r9)
+{
+
+  LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
+
+
+  LOG_I(PHY,"[UE%d] Applying MBSFN_Area_id %ld for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
+
+  if (mbsfn_Area_idx == 0) {
+    fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
+    LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
+  }
+
+  lte_gold_mbsfn(fp,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
+
+}
+
+
+/*
+ * Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover
+ */
+void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
+{
+
+  if(mobilityControlInfo!=NULL) {
+    RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon;
+    LOG_I(PHY,"radioResourceConfigCommon %p\n", radioResourceConfigCommon);
+    memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho,
+           (void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,
+           sizeof(LTE_DL_FRAME_PARMS));
+    PHY_vars_UE_g[Mod_id][CC_id]->ho_triggered = 1;
+    //PHY_vars_UE_g[UE_id]->UE_mode[0] = PRACH;
+
+    LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
+    //     int N_ZC;
+    //     uint8_t prach_fmt;
+    //     int u;
+
+    LOG_I(PHY,"[UE%d] Handover triggered: Applying radioResourceConfigCommon from eNB %d\n",
+          Mod_id,eNB_id);
+
+    fp->prach_config_common.rootSequenceIndex                           =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
+    fp->prach_config_common.prach_Config_enabled=1;
+    fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex          =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex;
+    fp->prach_config_common.prach_ConfigInfo.highSpeedFlag              =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->highSpeedFlag;
+    fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig  =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->zeroCorrelationZoneConfig;
+    fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset           =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_FreqOffset;
+
+    //     prach_fmt = get_prach_fmt(radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex,fp->frame_type);
+    //     N_ZC = (prach_fmt <4)?839:139;
+    //     u = (prach_fmt < 4) ? prach_root_sequence_map0_3[fp->prach_config_common.rootSequenceIndex] :
+    //       prach_root_sequence_map4[fp->prach_config_common.rootSequenceIndex];
+
+    //compute_prach_seq(u,N_ZC, PHY_vars_UE_g[Mod_id]->X_u);
+    compute_prach_seq(PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.rootSequenceIndex,
+		      PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
+		      PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+		      PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,
+                      fp->frame_type,
+                      PHY_vars_UE_g[Mod_id][CC_id]->X_u);
+
+
+    fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon->deltaPUCCH_Shift;
+    fp->pucch_config_common.nRB_CQI          = radioResourceConfigCommon->pucch_ConfigCommon->nRB_CQI;
+    fp->pucch_config_common.nCS_AN           = radioResourceConfigCommon->pucch_ConfigCommon->nCS_AN;
+    fp->pucch_config_common.n1PUCCH_AN       = radioResourceConfigCommon->pucch_ConfigCommon->n1PUCCH_AN;
+    fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon->referenceSignalPower;
+    fp->pdsch_config_common.p_b                  = radioResourceConfigCommon->pdsch_ConfigCommon->p_b;
+
+
+    fp->pusch_config_common.n_SB                                         = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
+    fp->pusch_config_common.hoppingMode                                  = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
+    fp->pusch_config_common.pusch_HoppingOffset                          = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
+    fp->pusch_config_common.enable64QAM                                  = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
+    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled    = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
+    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH   = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
+    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
+    fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift            = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift;
+
+    init_ul_hopping(fp);
+    fp->soundingrs_ul_config_common.enabled_flag                        = 0;
+
+    if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present==SoundingRS_UL_ConfigCommon_PR_setup) {
+      fp->soundingrs_ul_config_common.enabled_flag                        = 1;
+      fp->soundingrs_ul_config_common.srs_BandwidthConfig                 = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_BandwidthConfig;
+      fp->soundingrs_ul_config_common.srs_SubframeConfig                  = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig;
+      fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.ackNackSRS_SimultaneousTransmission;
+
+      if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_MaxUpPts)
+        fp->soundingrs_ul_config_common.srs_MaxUpPts                      = 1;
+      else
+        fp->soundingrs_ul_config_common.srs_MaxUpPts                      = 0;
+    }
+
+    fp->ul_power_control_config_common.p0_NominalPUSCH   = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUSCH;
+    fp->ul_power_control_config_common.alpha             = radioResourceConfigCommon->uplinkPowerControlCommon->alpha;
+    fp->ul_power_control_config_common.p0_NominalPUCCH   = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUCCH;
+    fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaPreambleMsg3;
+    fp->ul_power_control_config_common.deltaF_PUCCH_Format1  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1;
+    fp->ul_power_control_config_common.deltaF_PUCCH_Format1b  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1b;
+    fp->ul_power_control_config_common.deltaF_PUCCH_Format2  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2;
+    fp->ul_power_control_config_common.deltaF_PUCCH_Format2a  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2a;
+    fp->ul_power_control_config_common.deltaF_PUCCH_Format2b  = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2b;
+
+    fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon->maxHARQ_Msg3Tx;
+
+    // Now configure some of the Physical Channels
+    if (radioResourceConfigCommon->antennaInfoCommon)
+      fp->nb_antennas_tx                     = (1<<radioResourceConfigCommon->antennaInfoCommon->antennaPortsCount);
+    else
+      fp->nb_antennas_tx                     = 1;
+
+    //PHICH
+    if (radioResourceConfigCommon->antennaInfoCommon) {
+      fp->phich_config_common.phich_resource = radioResourceConfigCommon->phich_Config->phich_Resource;
+      fp->phich_config_common.phich_duration = radioResourceConfigCommon->phich_Config->phich_Duration;
+    }
+
+    //Target CellId
+    fp->Nid_cell = mobilityControlInfo->targetPhysCellId;
+    fp->nushift  = fp->Nid_cell%6;
+
+    // PUCCH
+    init_ncs_cell(fp,PHY_vars_UE_g[Mod_id][CC_id]->ncs_cell);
+
+    init_ul_hopping(fp);
+
+    // RNTI
+
+
+    PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
+    PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
+
+    LOG_I(PHY,"SET C-RNTI %x %x\n",PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti,
+                                   PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti);
+  }
+
+  if(ho_failed) {
+    LOG_D(PHY,"[UE%d] Handover failed, triggering RACH procedure\n",Mod_id);
+    memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,(void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho, sizeof(LTE_DL_FRAME_PARMS));
+    PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_id] = PRACH;
+  }
+}
+
+void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id)
+{
+
+  PHY_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id][CC_id]->measurements;
+  int i;
+
+  LOG_I(PHY,"Configuring inter-cell measurements for %d cells, ids: \n",n_adj_cells);
+
+  for (i=0; i<n_adj_cells; i++) {
+    LOG_I(PHY,"%d\n",adj_cell_id[i]);
+    lte_gold(&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_table[i+1],adj_cell_id[i]);
+  }
+
+  phy_meas->n_adj_cells = n_adj_cells;
+  memcpy((void*)phy_meas->adj_cell_id,(void *)adj_cell_id,n_adj_cells*sizeof(unsigned int));
+
+}
+
+#if defined(Rel10) || defined(Rel14)
+void phy_config_dedicated_scell_ue(uint8_t Mod_id,
+                                   uint8_t eNB_index,
+                                   SCellToAddMod_r10_t *sCellToAddMod_r10,
+                                   int CC_id)
+{
+
+}
+#endif
+
+
+void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
+                        uint16_t max_harq_tx )
+{
+
+  PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
+  phy_vars_ue->ulsch[eNB_id]->Mlimit = max_harq_tx;
+}
+
+extern uint16_t beta_cqi[16];
+
+void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
+                             struct PhysicalConfigDedicated *physicalConfigDedicated )
+{
+
+  static uint8_t first_dedicated_configuration = 0;
+  PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
+
+  phy_vars_ue->total_TBS[eNB_id]=0;
+  phy_vars_ue->total_TBS_last[eNB_id]=0;
+  phy_vars_ue->bitrate[eNB_id]=0;
+  phy_vars_ue->total_received_bits[eNB_id]=0;
+  phy_vars_ue->dlsch_errors[eNB_id]=0;
+  phy_vars_ue->dlsch_errors_last[eNB_id]=0;
+  phy_vars_ue->dlsch_received[eNB_id]=0;
+  phy_vars_ue->dlsch_received_last[eNB_id]=0;
+  phy_vars_ue->dlsch_fer[eNB_id]=0;
+
+  phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
+  phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
+
+  if (physicalConfigDedicated) {
+    LOG_D(PHY,"[UE %d] Received physicalConfigDedicated from eNB %d\n",Mod_id, eNB_id);
+    LOG_D(PHY,"------------------------------------------------------------------------\n");
+
+    if (physicalConfigDedicated->pdsch_ConfigDedicated) {
+      phy_vars_ue->pdsch_config_dedicated[eNB_id].p_a=physicalConfigDedicated->pdsch_ConfigDedicated->p_a;
+      LOG_D(PHY,"pdsch_config_dedicated.p_a %d\n",phy_vars_ue->pdsch_config_dedicated[eNB_id].p_a);
+      LOG_D(PHY,"\n");
+    }
+
+    if (physicalConfigDedicated->pucch_ConfigDedicated) {
+      if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==PUCCH_ConfigDedicated__ackNackRepetition_PR_release)
+        phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=0;
+      else {
+        phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=1;
+      }
+
+      if (physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode)
+        phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode = *physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode;
+      else
+        phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode = bundling;
+
+      if ( phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode == multiplexing)
+        LOG_D(PHY,"pucch_config_dedicated.tdd_AckNackFeedbackMode = multiplexing\n");
+      else
+        LOG_D(PHY,"pucch_config_dedicated.tdd_AckNackFeedbackMode = bundling\n");
+    }
+
+    if (physicalConfigDedicated->pusch_ConfigDedicated) {
+      phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index;
+      phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
+      phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
+
+
+      LOG_D(PHY,"pusch_config_dedicated.betaOffset_ACK_Index %d\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index);
+      LOG_D(PHY,"pusch_config_dedicated.betaOffset_RI_Index %d\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index);
+      LOG_D(PHY,"pusch_config_dedicated.betaOffset_CQI_Index %d => %d)\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index,beta_cqi[phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index]);
+      LOG_D(PHY,"\n");
+
+
+    }
+
+    if (physicalConfigDedicated->uplinkPowerControlDedicated) {
+
+      phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH = physicalConfigDedicated->uplinkPowerControlDedicated->p0_UE_PUSCH;
+      phy_vars_ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled= physicalConfigDedicated->uplinkPowerControlDedicated->deltaMCS_Enabled;
+      phy_vars_ue->ul_power_control_dedicated[eNB_id].accumulationEnabled= physicalConfigDedicated->uplinkPowerControlDedicated->accumulationEnabled;
+      phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUCCH= physicalConfigDedicated->uplinkPowerControlDedicated->p0_UE_PUCCH;
+      phy_vars_ue->ul_power_control_dedicated[eNB_id].pSRS_Offset= physicalConfigDedicated->uplinkPowerControlDedicated->pSRS_Offset;
+      phy_vars_ue->ul_power_control_dedicated[eNB_id].filterCoefficient= *physicalConfigDedicated->uplinkPowerControlDedicated->filterCoefficient;
+      LOG_D(PHY,"ul_power_control_dedicated.p0_UE_PUSCH %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH);
+      LOG_D(PHY,"ul_power_control_dedicated.deltaMCS_Enabled %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled);
+      LOG_D(PHY,"ul_power_control_dedicated.accumulationEnabled %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].accumulationEnabled);
+      LOG_D(PHY,"ul_power_control_dedicated.p0_UE_PUCCH %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUCCH);
+      LOG_D(PHY,"ul_power_control_dedicated.pSRS_Offset %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].pSRS_Offset);
+      LOG_D(PHY,"ul_power_control_dedicated.filterCoefficient %d\n",phy_vars_ue->ul_power_control_dedicated[eNB_id].filterCoefficient);
+      LOG_D(PHY,"\n");
+    }
+
+    if (physicalConfigDedicated->antennaInfo) {
+      phy_vars_ue->transmission_mode[eNB_id] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
+      LOG_I(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[eNB_id]);
+      switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
+      case AntennaInfoDedicated__transmissionMode_tm1:
+        phy_vars_ue->transmission_mode[eNB_id] = 1;
+        break;
+      case AntennaInfoDedicated__transmissionMode_tm2:
+        phy_vars_ue->transmission_mode[eNB_id] = 2;
+        break;
+      case AntennaInfoDedicated__transmissionMode_tm3:
+        phy_vars_ue->transmission_mode[eNB_id] = 3;
+        break;
+      case AntennaInfoDedicated__transmissionMode_tm4:
+        phy_vars_ue->transmission_mode[eNB_id] = 4;
+        break;
+      case AntennaInfoDedicated__transmissionMode_tm5:
+        phy_vars_ue->transmission_mode[eNB_id] = 5;
+        break;
+      case AntennaInfoDedicated__transmissionMode_tm6:
+        phy_vars_ue->transmission_mode[eNB_id] = 6;
+        break;
+      case AntennaInfoDedicated__transmissionMode_tm7:
+        lte_gold_ue_spec_port5(phy_vars_ue->lte_gold_uespec_port5_table, phy_vars_ue->frame_parms.Nid_cell, phy_vars_ue->pdcch_vars[0][eNB_id]->crnti);
+        phy_vars_ue->transmission_mode[eNB_id] = 7;
+        break;
+      default:
+        LOG_E(PHY,"Unknown transmission mode!\n");
+        break;
+      }
+    } else {
+      LOG_D(PHY,"[UE %d] Received NULL physicalConfigDedicated->antennaInfo from eNB %d\n",Mod_id, eNB_id);
+    }
+
+    if (physicalConfigDedicated->schedulingRequestConfig) {
+      if (physicalConfigDedicated->schedulingRequestConfig->present == SchedulingRequestConfig_PR_setup) {
+        phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex = physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex;
+        phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex=physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_ConfigIndex;
+        phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax=physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax;
+
+        LOG_D(PHY,"scheduling_request_config.sr_PUCCH_ResourceIndex %d\n",phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex);
+        LOG_D(PHY,"scheduling_request_config.sr_ConfigIndex %d\n",phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex);
+        LOG_D(PHY,"scheduling_request_config.dsr_TransMax %d\n",phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax);
+      }
+
+      LOG_D(PHY,"------------------------------------------------------------\n");
+
+    }
+
+    if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) {
+
+      phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0;
+      if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
+        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1;
+        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration             = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration;
+        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift          = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift;
+        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].freqDomainPosition   = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition;
+        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_Bandwidth        = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth;
+        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex      = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
+        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_HoppingBandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;
+        phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].transmissionComb     = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
+
+
+        LOG_D(PHY,"soundingrs_ul_config_dedicated.srs_ConfigIndex %d\n",phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex);
+      }
+
+      LOG_D(PHY,"------------------------------------------------------------\n");
+
+    }
+
+
+    if (physicalConfigDedicated->cqi_ReportConfig) {
+      if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) {
+        // configure PUSCH CQI reporting
+        phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic;
+        if ((phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm12) &&
+            (phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm30) &&
+            (phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm31))
+          LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic);
+      }
+      if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) {
+        if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) {
+        // configure PUCCH CQI reporting
+          phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
+          phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex     = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
+          if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex)
+            phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex;
+        }
+        else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_release) {
+          // handle release
+          phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
+          phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
+        }
+      }
+    }
+
+#ifdef CBA
+
+    if (physicalConfigDedicated->pusch_CBAConfigDedicated_vlola) {
+      phy_vars_ue->pusch_ca_config_dedicated[eNB_id].betaOffset_CA_Index = (uint16_t) *physicalConfigDedicated->pusch_CBAConfigDedicated_vlola->betaOffset_CBA_Index;
+      phy_vars_ue->pusch_ca_config_dedicated[eNB_id].cShift = (uint16_t) *physicalConfigDedicated->pusch_CBAConfigDedicated_vlola->cShift_CBA;
+      LOG_D(PHY,"[UE %d ] physicalConfigDedicated pusch CBA config dedicated: beta offset %d cshift %d \n",Mod_id,
+            phy_vars_ue->pusch_ca_config_dedicated[eNB_id].betaOffset_CA_Index,
+            phy_vars_ue->pusch_ca_config_dedicated[eNB_id].cShift);
+    }
+
+#endif
+  } else {
+    LOG_D(PHY,"[PHY][UE %d] Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id,eNB_id);
+    return;
+  }
+
+  // fill cqi parameters for periodic CQI reporting
+  get_cqipmiri_params(phy_vars_ue,eNB_id);
+
+  // disable MIB SIB decoding once we are on connected mode
+  first_dedicated_configuration ++;
+  if(first_dedicated_configuration > 1)
+  {
+  	LOG_I(PHY,"Disable SIB MIB decoding \n");
+  	phy_vars_ue->decode_SIB = 0;
+  	phy_vars_ue->decode_MIB = 0;
+  }
+  //phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
+  if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
+      phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
+  else
+      phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
+
+  LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
+                               phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
+
+
+}
+
+/*! \brief Helper function to allocate memory for DLSCH data structures.
+ * \param[out] pdsch Pointer to the LTE_UE_PDSCH structure to initialize.
+ * \param[in] frame_parms LTE_DL_FRAME_PARMS structure.
+ * \note This function is optimistic in that it expects malloc() to succeed.
+ */
+void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS* const fp )
+{
+  AssertFatal( pdsch, "pdsch==0" );
+
+  pdsch->pmi_ext = (uint8_t*)malloc16_clear( fp->N_RB_DL );
+  pdsch->llr[0] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+  pdsch->llr128 = (int16_t**)malloc16_clear( sizeof(int16_t*) );
+  // FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV
+  // FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there
+
+
+  pdsch->rxdataF_ext            = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->rxdataF_uespec_pilots  = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->rxdataF_comp0          = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->rho                    = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
+  pdsch->dl_ch_estimates_ext    = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->dl_bf_ch_estimates     = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->dl_bf_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  //pdsch->dl_ch_rho_ext          = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  //pdsch->dl_ch_rho2_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->dl_ch_mag0             = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->dl_ch_magb0            = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+
+
+  // the allocated memory size is fixed:
+  AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
+
+  for (int i=0; i<fp->nb_antennas_rx; i++) {
+    pdsch->rho[i]     = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
+
+    for (int j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
+      const int idx = (j<<1)+i;
+      const size_t num = 7*2*fp->N_RB_DL*12;
+      pdsch->rxdataF_ext[idx]             = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->rxdataF_uespec_pilots[idx]   = (int32_t*)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12);
+      pdsch->rxdataF_comp0[idx]           = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->dl_ch_estimates_ext[idx]     = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->dl_bf_ch_estimates[idx]      = (int32_t*)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2);
+      pdsch->dl_bf_ch_estimates_ext[idx]  = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      //pdsch->dl_ch_rho_ext[idx]           = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      //pdsch->dl_ch_rho2_ext[idx]          = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->dl_ch_mag0[idx]              = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->dl_ch_magb0[idx]             = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+    }
+  }
+}
+
+int init_lte_ue_signal(PHY_VARS_UE *ue,
+		       int nb_connected_eNB,
+		       uint8_t abstraction_flag)
+{
+
+  // create shortcuts
+  LTE_DL_FRAME_PARMS* const fp            = &ue->frame_parms;
+  LTE_UE_COMMON* const common_vars        = &ue->common_vars;
+  LTE_UE_PDSCH** const pdsch_vars_SI      = ue->pdsch_vars_SI;
+  LTE_UE_PDSCH** const pdsch_vars_ra      = ue->pdsch_vars_ra;
+  LTE_UE_PDSCH** const pdsch_vars_p       = ue->pdsch_vars_p;
+  LTE_UE_PDSCH** const pdsch_vars_mch     = ue->pdsch_vars_MCH;
+  LTE_UE_PDSCH* (*pdsch_vars_th)[][NUMBER_OF_CONNECTED_eNB_MAX+1] = &ue->pdsch_vars;
+  LTE_UE_PDCCH* (*pdcch_vars_th)[][NUMBER_OF_CONNECTED_eNB_MAX]   = &ue->pdcch_vars;
+  LTE_UE_PBCH** const pbch_vars           = ue->pbch_vars;
+  LTE_UE_PRACH** const prach_vars         = ue->prach_vars;
+
+
+
+  int i,j,k,l;
+  int eNB_id;
+  int th_id;
+
+  LOG_D(PHY,"Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
+  LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
+
+
+
+  init_frame_parms(&ue->frame_parms,1);
+  init_lte_top(&ue->frame_parms);
+  init_ul_hopping(&ue->frame_parms);
+
+
+  // many memory allocation sizes are hard coded
+  AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
+  AssertFatal( ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
+  // init phy_vars_ue
+
+  for (i=0; i<4; i++) {
+    ue->rx_gain_max[i] = 135;
+    ue->rx_gain_med[i] = 128;
+    ue->rx_gain_byp[i] = 120;
+  }
+
+  ue->n_connected_eNB = nb_connected_eNB;
+
+  for(eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
+    ue->total_TBS[eNB_id] = 0;
+    ue->total_TBS_last[eNB_id] = 0;
+    ue->bitrate[eNB_id] = 0;
+    ue->total_received_bits[eNB_id] = 0;
+  }
+
+  for (i=0;i<10;i++)
+    ue->tx_power_dBm[i]=-127;
+
+
+
+  // init TX buffers
+  
+  common_vars->txdata  = (int32_t**)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) );
+  common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) );
+  
+  for (i=0; i<fp->nb_antennas_tx; i++) {
+    
+    common_vars->txdata[i]  = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
+    common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
+  }
+  
+  // init RX buffers
+  
+  common_vars->rxdata   = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
+  common_vars->common_vars_rx_data_per_thread[0].rxdataF  = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
+  common_vars->common_vars_rx_data_per_thread[1].rxdataF  = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
+  
+  for (i=0; i<fp->nb_antennas_rx; i++) {
+    common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_tti*10+2048)*sizeof(int32_t) );
+    common_vars->common_vars_rx_data_per_thread[0].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
+    common_vars->common_vars_rx_data_per_thread[1].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
+  }
+
+
+  // Channel estimates
+  for (eNB_id=0; eNB_id<7; eNB_id++) {
+    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+        common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates[eNB_id]      = (int32_t**)malloc16_clear(8*sizeof(int32_t*));
+        common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates_time[eNB_id] = (int32_t**)malloc16_clear(8*sizeof(int32_t*));
+    }
+
+    for (i=0; i<fp->nb_antennas_rx; i++)
+      for (j=0; j<4; j++) {
+        int idx = (j<<1) + i;
+        for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+            common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates[eNB_id][idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->symbols_per_tti*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
+            common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates_time[eNB_id][idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
+        }
+      }
+  }
+
+  // DLSCH
+  for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) {
+    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+        (*pdsch_vars_th)[th_id][eNB_id]     = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
+    }
+
+    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+        (*pdcch_vars_th)[th_id][eNB_id] = (LTE_UE_PDCCH *)malloc16_clear(sizeof(LTE_UE_PDCCH));
+    }
+
+    pdsch_vars_SI[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
+    pdsch_vars_ra[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
+    pdsch_vars_p[eNB_id]   = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
+    pdsch_vars_mch[eNB_id] = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
+    prach_vars[eNB_id]     = (LTE_UE_PRACH *)malloc16_clear(sizeof(LTE_UE_PRACH));
+    pbch_vars[eNB_id]      = (LTE_UE_PBCH *)malloc16_clear(sizeof(LTE_UE_PBCH));
+
+    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+      phy_init_lte_ue__PDSCH( (*pdsch_vars_th)[th_id][eNB_id], fp );
+    }
+
+    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+      (*pdsch_vars_th)[th_id][eNB_id]->llr_shifts      = (uint8_t*)malloc16_clear(7*2*fp->N_RB_DL*12);
+      (*pdsch_vars_th)[th_id][eNB_id]->llr_shifts_p        = (*pdsch_vars_th)[0][eNB_id]->llr_shifts;
+      (*pdsch_vars_th)[th_id][eNB_id]->llr[1]              = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+      (*pdsch_vars_th)[th_id][eNB_id]->llr128_2ndstream    = (int16_t**)malloc16_clear( sizeof(int16_t*) );
+      (*pdsch_vars_th)[th_id][eNB_id]->rho                 = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
+    }
+    
+    for (int i=0; i<fp->nb_antennas_rx; i++){
+      for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+	(*pdsch_vars_th)[th_id][eNB_id]->rho[i]     = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
+      }
+      
+    }
+    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+      (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho2_ext      = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+    }
+    
+    for (i=0; i<fp->nb_antennas_rx; i++)
+      for (j=0; j<4; j++) {
+	const int idx = (j<<1)+i;
+	const size_t num = 7*2*fp->N_RB_DL*12+4;
+	for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+	  (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+	}
+	
+      }
+    
+    //const size_t num = 7*2*fp->N_RB_DL*12+4;
+    for (k=0;k<8;k++) { //harq_pid
+      for (l=0;l<8;l++) { //round
+	for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+	  (*pdsch_vars_th)[th_id][eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+	  (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+	  (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_mag1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+	  (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_magb1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+	}
+	
+	
+	for (int i=0; i<fp->nb_antennas_rx; i++)
+	  for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
+	    const int idx = (j<<1)+i;
+	    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+	      (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
+	      (*pdsch_vars_th)[th_id][eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
+	      (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_mag1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
+	      (*pdsch_vars_th)[th_id][eNB_id]->dl_ch_magb1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
+	    }
+	    
+	  }
+      }
+    }
+    phy_init_lte_ue__PDSCH( pdsch_vars_SI[eNB_id], fp );
+    phy_init_lte_ue__PDSCH( pdsch_vars_ra[eNB_id], fp );
+    phy_init_lte_ue__PDSCH( pdsch_vars_p[eNB_id], fp );
+    phy_init_lte_ue__PDSCH( pdsch_vars_mch[eNB_id], fp );
+    
+    // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
+    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+      (*pdcch_vars_th)[th_id][eNB_id]->llr   = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+      (*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+      (*pdcch_vars_th)[th_id][eNB_id]->wbar  = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+      (*pdcch_vars_th)[th_id][eNB_id]->e_rx  = (int8_t*)malloc16_clear( 4*2*100*12 );
+      
+      (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp        = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext       = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      (*pdcch_vars_th)[th_id][eNB_id]->rho                 = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
+      (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+    }
+    
+    for (i=0; i<fp->nb_antennas_rx; i++) {
+      //ue_pdcch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
+      for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+	(*pdcch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(100*12*4) );
+      }
+      
+      for (j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
+	int idx = (j<<1)+i;
+	//  size_t num = 7*2*fp->N_RB_DL*12;
+	size_t num = 4*100*12;  // 4 symbols, 100 PRBs, 12 REs per PRB
+	for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+	  (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp[idx]        = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+	  (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[idx]       = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+	  (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext[idx]         = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+              (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+	}
+      }
+    }
+    phy_init_lte_ue__PDSCH( pdsch_vars_SI[eNB_id], fp );
+    phy_init_lte_ue__PDSCH( pdsch_vars_ra[eNB_id], fp );
+    phy_init_lte_ue__PDSCH( pdsch_vars_p[eNB_id], fp );
+    phy_init_lte_ue__PDSCH( pdsch_vars_mch[eNB_id], fp );
+    
+    // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
+    for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+      (*pdcch_vars_th)[th_id][eNB_id]->llr   = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+      (*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+      (*pdcch_vars_th)[th_id][eNB_id]->wbar  = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+      (*pdcch_vars_th)[th_id][eNB_id]->e_rx  = (int8_t*)malloc16_clear( 4*2*100*12 );
+      
+      (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp        = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext       = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      (*pdcch_vars_th)[th_id][eNB_id]->rho                 = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
+      (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+    }
+    
+    for (i=0; i<fp->nb_antennas_rx; i++) {
+      //ue_pdcch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
+
+      for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+	(*pdcch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(100*12*4) );
+      }
+      
+      for (j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
+	int idx = (j<<1)+i;
+	//  size_t num = 7*2*fp->N_RB_DL*12;
+	size_t num = 4*100*12;  // 4 symbols, 100 PRBs, 12 REs per PRB
+	for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+	  (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp[idx]        = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+	  (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[idx]       = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+	  (*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext[idx]         = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+	  (*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+	}
+      }
+    }
+    
+    // PBCH
+    pbch_vars[eNB_id]->rxdataF_ext         = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
+    pbch_vars[eNB_id]->rxdataF_comp        = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+    pbch_vars[eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+    pbch_vars[eNB_id]->llr                 = (int8_t*)malloc16_clear( 1920 );
+    prach_vars[eNB_id]->prachF             = (int16_t*)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
+    prach_vars[eNB_id]->prach              = (int16_t*)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
+    
+    for (i=0; i<fp->nb_antennas_rx; i++) {
+      pbch_vars[eNB_id]->rxdataF_ext[i]    = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
+      
+      for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
+	int idx = (j<<1)+i;
+	pbch_vars[eNB_id]->rxdataF_comp[idx]        = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
+	pbch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
+      }
+    }
+  
+    
+    pbch_vars[eNB_id]->decoded_output = (uint8_t*)malloc16_clear( 64 );
+  }
+
+  // initialization for the last instance of pdsch_vars (used for MU-MIMO)
+  for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+      (*pdsch_vars_th)[th_id][eNB_id]     = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
+  }
+
+  pdsch_vars_SI[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
+  pdsch_vars_ra[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
+  pdsch_vars_p[eNB_id]   = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
+
+  for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
+    phy_init_lte_ue__PDSCH( (*pdsch_vars_th)[th_id][eNB_id], fp );
+    (*pdsch_vars_th)[th_id][eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+  }
+
+
+  ue->sinr_CQI_dB = (double*) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
+
+  ue->init_averaging = 1;
+  // default value until overwritten by RRCConnectionReconfiguration
+  if (fp->nb_antenna_ports_eNB==2)
+    ue->pdsch_config_dedicated->p_a = dBm3;
+  else
+    ue->pdsch_config_dedicated->p_a = dB0;
+
+  // set channel estimation to do linear interpolation in time
+  ue->high_speed_flag = 1;
+  ue->ch_est_alpha    = 24576;
+
+  // enable MIB/SIB decoding by default
+  ue->decode_MIB = 1;
+  ue->decode_SIB = 1;
+
+  init_prach_tables(839);
+
+
+  return 0;
+}
+
+void init_lte_ue_transport(PHY_VARS_UE *ue,int abstraction_flag) {
+
+  int i,j,k;
+
+  for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
+    for (j=0; j<2; j++) {
+      for (k=0; k<2; k++) {
+	AssertFatal((ue->dlsch[k][i][j]  = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
+
+	LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]);
+      }
+    }
+
+    AssertFatal((ue->ulsch[i]  = new_ue_ulsch(ue->frame_parms.N_RB_UL, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n");
+
+    ue->dlsch_SI[i]  = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
+    ue->dlsch_ra[i]  = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
+
+    ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_eNB==1 ? 1 : 2;
+  }
+
+  ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
+
+  ue->dlsch_MCH[0]  = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
+
+}
diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c
index 188b7237a41aa399cd29ed1a3f0accbb36b1433b..6cf05769e52e4ca2b4dfc4a0bba6ac5d4848239f 100644
--- a/openair1/PHY/INIT/lte_param_init.c
+++ b/openair1/PHY/INIT/lte_param_init.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -32,16 +32,23 @@
 
 extern PHY_VARS_eNB *eNB;
 extern PHY_VARS_UE *UE;
+extern RU_t *ru;
+extern void  phy_init_RU(RU_t*);
 
-void lte_param_init(unsigned char N_tx_port_eNB, 
+void lte_param_init(PHY_VARS_eNB **eNBp,
+		    PHY_VARS_UE **UEp,
+		    RU_t **rup,
+		    unsigned char N_tx_port_eNB,
                     unsigned char N_tx_phy,
-		    unsigned char N_rx,
+		    unsigned char N_rx_ru,
+                    unsigned char N_rx_ue,
 		    unsigned char transmission_mode,
 		    uint8_t extended_prefix_flag,
-		    frame_t frame_type, 
+		    frame_t frame_type,
 		    uint16_t Nid_cell,
 		    uint8_t tdd_config,
 		    uint8_t N_RB_DL,
+		    uint8_t pa,
 		    uint8_t threequarter_fs,
                     uint8_t osf,
 		    uint32_t perfect_ce)
@@ -49,13 +56,27 @@ void lte_param_init(unsigned char N_tx_port_eNB,
 
   LTE_DL_FRAME_PARMS *frame_parms;
   int i;
-
+  PHY_VARS_eNB *eNB;
+  PHY_VARS_UE  *UE;
+  RU_t         *ru;
   printf("Start lte_param_init\n");
-  eNB = malloc(sizeof(PHY_VARS_eNB));
-  UE = malloc(sizeof(PHY_VARS_UE));
+  *eNBp = malloc(sizeof(PHY_VARS_eNB));
+  *UEp = malloc(sizeof(PHY_VARS_UE));
+  *rup = malloc(sizeof(RU_t));
+  eNB = *eNBp;
+  UE  = *UEp;
+  ru  = *rup;
+  printf("eNB %p, UE %p, ru %p\n",eNB,UE,ru);
+
+
+
   memset((void*)eNB,0,sizeof(PHY_VARS_eNB));
   memset((void*)UE,0,sizeof(PHY_VARS_UE));
+  memset((void*)ru,0,sizeof(RU_t));
 
+  ru->eNB_list[0] = eNB;
+  eNB->RU_list[0] = ru;
+  ru->num_eNB=1;
 
   srand(0);
   randominit(0);
@@ -71,7 +92,7 @@ void lte_param_init(unsigned char N_tx_port_eNB,
   frame_parms->Nid_cell           = Nid_cell;
   frame_parms->nushift            = Nid_cell%6;
   frame_parms->nb_antennas_tx     = N_tx_phy;
-  frame_parms->nb_antennas_rx     = N_rx;
+  frame_parms->nb_antennas_rx     = N_rx_ru;
   frame_parms->nb_antenna_ports_eNB = N_tx_port_eNB;
   frame_parms->phich_config_common.phich_resource         = oneSixth;
   frame_parms->phich_config_common.phich_duration         = normal;
@@ -90,12 +111,18 @@ void lte_param_init(unsigned char N_tx_port_eNB,
 
   UE->is_secondary_ue = 0;
   UE->frame_parms = *frame_parms;
-  eNB->frame_parms = *frame_parms;
+  UE->frame_parms.nb_antennas_rx=N_rx_ue;
+  //  eNB->frame_parms = *frame_parms;
+  ru->frame_parms = *frame_parms;
+  ru->nb_tx = N_tx_phy;
+  ru->nb_rx = N_rx_ru;
+  ru->if_south = LOCAL_RF;
+
+  eNB->configured=1;
 
   eNB->transmission_mode[0] = transmission_mode;
   UE->transmission_mode[0] = transmission_mode;
 
-  init_lte_top(frame_parms);
   dump_frame_parms(frame_parms);
 
   UE->measurements.n_adj_cells=0;
@@ -105,23 +132,24 @@ void lte_param_init(unsigned char N_tx_port_eNB,
   for (i=0; i<3; i++)
     lte_gold(frame_parms,UE->lte_gold_table[i],Nid_cell+i);
 
-  init_lte_ue(UE,1,0);
+  printf("Calling init_lte_ue_signal\n");
+  init_lte_ue_signal(UE,1,0);
+  printf("Calling phy_init_lte_eNB\n");
   phy_init_lte_eNB(eNB,0,0);
-
+  printf("Calling phy_init_RU (%p)\n",ru);
+  phy_init_RU(ru);
   generate_pcfich_reg_mapping(&UE->frame_parms);
   generate_phich_reg_mapping(&UE->frame_parms);
 
   // DL power control init
   //if (transmission_mode == 1) {
+  UE->pdsch_config_dedicated->p_a  = pa;
+
   if (transmission_mode == 1 || transmission_mode ==7) {
-    eNB->pdsch_config_dedicated->p_a  = dB0; // 4 = 0dB
     ((eNB->frame_parms).pdsch_config_common).p_b = 0;
-    UE->pdsch_config_dedicated->p_a  = dB0; // 4 = 0dB
     ((UE->frame_parms).pdsch_config_common).p_b = 0;
   } else { // rho_a = rhob
-    eNB->pdsch_config_dedicated->p_a  = dBm3; // 4 = 0dB
     ((eNB->frame_parms).pdsch_config_common).p_b = 1;
-    UE->pdsch_config_dedicated->p_a  = dBm3; // 4 = 0dB
     ((UE->frame_parms).pdsch_config_common).p_b = 1;
   }
 
@@ -130,6 +158,13 @@ void lte_param_init(unsigned char N_tx_port_eNB,
   /* the UE code is multi-thread "aware", we need to setup this array */
   for (i = 0; i < 10; i++) UE->current_thread_id[i] = i % 2;
 
+  if (eNB->frame_parms.frame_type == TDD) {
+    if      (eNB->frame_parms.N_RB_DL == 100) ru->N_TA_offset = 624;
+    else if (eNB->frame_parms.N_RB_DL == 50)  ru->N_TA_offset = 624/2;
+    else if (eNB->frame_parms.N_RB_DL == 25)  ru->N_TA_offset = 624/4;
+  }
+  else ru->N_TA_offset=0;
+
   printf("Done lte_param_init\n");
 
 
diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c
index e071a57bc85b88ce52e2ca2be3950587532305ee..2f2bd95617ebcffa60092376e9778935bd3ce877 100644
--- a/openair1/PHY/INIT/lte_parms.c
+++ b/openair1/PHY/INIT/lte_parms.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/INIT/vars.h b/openair1/PHY/INIT/vars.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair1/PHY/INIT/vars.h
+++ b/openair1/PHY/INIT/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_ESTIMATION/adjust_gain.c b/openair1/PHY/LTE_ESTIMATION/adjust_gain.c
index 4f6763fa070566939d415f7d737784a542a42ff4..7272b7247d93f451754d41eadfa5edfaf2b51057 100644
--- a/openair1/PHY/LTE_ESTIMATION/adjust_gain.c
+++ b/openair1/PHY/LTE_ESTIMATION/adjust_gain.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_ESTIMATION/defs.h b/openair1/PHY/LTE_ESTIMATION/defs.h
index e1346bb9556e9c04101f2f2314d1ce116ef8756b..a7b5d14701874da4fb4894dca2382bfd7102708b 100644
--- a/openair1/PHY/LTE_ESTIMATION/defs.h
+++ b/openair1/PHY/LTE_ESTIMATION/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -23,12 +23,6 @@
 #define __LTE_ESTIMATION_DEFS__H__
 
 #include "PHY/defs.h"
-/*
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
- */
-
 /** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_
  * @{
  */
@@ -136,18 +130,6 @@ int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *phy_vars_ue,
                                     int subframe,
                                     unsigned char l);
 
-/*
-#ifdef EMOS
-int lte_dl_channel_estimation_emos(int dl_ch_estimates_emos[NB_ANTENNAS_RX*NB_ANTENNAS_TX][N_RB_DL_EMOS*N_PILOTS_PER_RB*N_SLOTS_EMOS],
-           int **rxdataF,
-           LTE_DL_FRAME_PARMS *frame_parms,
-           unsigned char Ns,
-           unsigned char p,
-           unsigned char l,
-           unsigned char sector);
-#endif
- */
-
 /*!
 \brief Frequency offset estimation for LTE
 We estimate the frequency offset by calculating the phase difference between channel estimates for symbols carrying pilots (l==0 or l==3/4). We take a moving average of the phase difference.
diff --git a/openair1/PHY/LTE_ESTIMATION/extern.h b/openair1/PHY/LTE_ESTIMATION/extern.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair1/PHY/LTE_ESTIMATION/extern.h
+++ b/openair1/PHY/LTE_ESTIMATION/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_ESTIMATION/filt96_32.h b/openair1/PHY/LTE_ESTIMATION/filt96_32.h
index 14f80ef1ee82c49e7252c3ee4304efe45d5affd4..929dfd4d85d220919b2828c23cb19dbeb72d7748 100644
--- a/openair1/PHY/LTE_ESTIMATION/filt96_32.h
+++ b/openair1/PHY/LTE_ESTIMATION/filt96_32.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
index 11701aecedca389d7dcb14079555e646bdf27a23..2c318d85e401d529bb78f5bdda5ffc6c74be5c05 100644
--- a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
+++ b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -306,7 +306,7 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
 
   AssertFatal(symbol<frame_parms->symbols_per_tti,"symbol %d >= %d\n",
 	      symbol,frame_parms->symbols_per_tti);
-  AssertFatal(Msc_RS<frame_parms->N_RB_UL*12,"Msc_RS %d >= %d\n",
+  AssertFatal(Msc_RS<=frame_parms->N_RB_UL*12,"Msc_RS %d >= %d\n",
 	      Msc_RS,frame_parms->N_RB_UL*12);
 
   for (re=0; re<(Msc_RS>>2); re++) {
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c
index 8875b110237615187585954ba99d70421d768c4e..18444076f315de40ee4ef925e31ccd93043b1d37 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -149,10 +149,8 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
   int temp, i, aa, max_pos = 0,ind;
   int max_val=0;
   short Re,Im,ncoef;
-#ifdef USER_MODE
 #ifdef DEBUG_PHY
   char fname[100],vname[100];
-#endif
 #endif
 
   ncoef = 32768 - coef;
@@ -187,12 +185,10 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
 	       1);
 	break;
       }
-#ifdef USER_MODE
 #ifdef DEBUG_PHY
       sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa);
       sprintf(vname,"srs_time_%d%d",ind,aa);
       write_output(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1);
-#endif
 #endif
     }
 
@@ -227,11 +223,8 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
 
 int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
 {
-  static int first_run=1;
-  static int max_pos_fil2=0;
   int temp, i, aa, max_pos=0, max_val=0;
-  short Re,Im,coef=24576;
-  short ncoef = 32768 - coef;
+  short Re,Im;
 
   LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
   LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id];
@@ -260,16 +253,9 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
   if (max_pos>frame_parms->ofdm_symbol_size/2)
     max_pos = max_pos-frame_parms->ofdm_symbol_size;
 
-  // filter position to reduce jitter
-  if (first_run == 1) {
-    first_run=0;
-    max_pos_fil2 = max_pos;
-  } else
-    max_pos_fil2 = ((max_pos_fil2 * coef) + (max_pos * ncoef)) >> 15;
-
   //#ifdef DEBUG_PHY
-  LOG_D(PHY,"frame %d: max_pos = %d, max_pos_fil = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,max_pos_fil2,sync_pos);
+  LOG_D(PHY,"frame %d: max_pos = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,sync_pos);
   //#endif //DEBUG_PHY
 
-  return(max_pos_fil2-sync_pos);
+  return max_pos - sync_pos;
 }
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
index 4e7dbb350fee8f4e3bb0b0b666fb60ee535e8286..55d2cf6c5c5f2aae5eb34b045f394fdfeea08f24 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,9 +19,7 @@
  *      contact@openairinterface.org
  */
 
-#ifdef USER_MODE
 #include <string.h>
-#endif
 #include "defs.h"
 #include "PHY/defs.h"
 #include "filt16_32.h"
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
index 8edb66ab4c66fc20722261e0f6748c0769566472..a4b29bb25ec407efbbb4ec696bada4557bbd1ec1 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,9 +19,7 @@
  *      contact@openairinterface.org
  */
 
-#ifdef USER_MODE
 #include <string.h>
-#endif
 #include "defs.h"
 #include "SCHED/defs.h"
 #include "PHY/defs.h"
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation_emos.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation_emos.c
deleted file mode 100644
index 331140de0afba16c95e6653e2ea93ff00141524d..0000000000000000000000000000000000000000
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation_emos.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#ifdef USER_MODE
-#include <string.h>
-#endif
-#include "defs.h"
-#include "PHY/defs.h"
-#include "SCHED/phy_procedures_emos.h"
-
-// TODO: make channel estimation possible for multiple sectors (Gold sequences for pilots)
-
-//#define DEBUG_CH
-int lte_dl_channel_estimation_emos(int dl_ch_estimates_emos[NB_ANTENNAS_RX*NB_ANTENNAS_TX][N_RB_DL_EMOS*N_PILOTS_PER_RB*N_SLOTS_EMOS],
-                                   int **rxdataF,
-                                   LTE_DL_FRAME_PARMS *frame_parms,
-                                   unsigned char Ns,
-                                   unsigned char p,
-                                   unsigned char l,
-                                   unsigned char sector)
-{
-
-  int pilot[2][200] __attribute__((aligned(16)));
-  unsigned char nu,aarx;
-  unsigned short k;
-  unsigned int rb,pilot_cnt;
-  short ch[2],*pil,*rxF,*dl_ch,*dl_ch_prev; //*f,*f2,*fl,*f2l2,*fr,*f2r2;
-  int ch_offset,symbol_offset;
-  unsigned int n;
-  int i;
-
-  unsigned char symbol = l+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame
-
-  if ((p==0) && (l==0) )
-    nu = 0;
-  else if ((p==0) && (l>0))
-    nu = 3;
-  else if ((p==1) && (l==0))
-    nu = 3;
-  else if ((p==1) && (l>0))
-    nu = 0;
-  else {
-    msg("lte_dl_channel_estimation_emos: p %d, l %d -> ERROR\n",p,l);
-    return(-1);
-  }
-
-  if (sector > 2) {
-    msg("lte_dl_channel_estimation_emos: sector must be 0,1, or 2\n");
-    return(-1);
-  }
-
-  switch (Ns) {
-  case 0:
-    ch_offset = ((l==0)?0:1)*2*frame_parms->N_RB_DL;
-    break;
-
-  case 1:
-    ch_offset = ((l==0)?2:3)*2*frame_parms->N_RB_DL;
-    break;
-
-  case 12:
-    ch_offset = ((l==0)?4:5)*2*frame_parms->N_RB_DL;
-    break;
-
-  case 13:
-    ch_offset = ((l==0)?6:7)*2*frame_parms->N_RB_DL;
-    break;
-
-  default:
-    msg("lte_dl_channel_estimation_emos: Ns must be  0, 1, 12, or 13\n");
-    return(-1);
-    break;
-
-  }
-
-  symbol_offset = symbol*frame_parms->ofdm_symbol_size; // offset within rxdataF
-
-  k = nu + sector;
-
-  if (k > 6)
-    k -=6;
-
-#ifdef DEBUG_CH
-  printf("Channel Estimation : ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d, symbol=%d\n",ch_offset,frame_parms->ofdm_symbol_size,frame_parms->Ncp,l,Ns,k,symbol);
-#endif
-
-  // generate pilot
-  lte_dl_cell_spec_rx(&pilot[p][0],
-                      frame_parms,
-                      Ns,
-                      (l==0)?0:1,
-                      p);
-
-
-  for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
-
-    pil   = (short *)&pilot[p][0];
-    rxF   = (short *)&rxdataF[aarx][((symbol_offset+k+frame_parms->first_carrier_offset)<<1)];
-    dl_ch = (short *)&dl_ch_estimates_emos[(p<<1)+aarx][ch_offset];
-    memset(dl_ch,0,frame_parms->N_RB_DL);
-
-    for (pilot_cnt=0; pilot_cnt<frame_parms->N_RB_DL; pilot_cnt++) {
-
-      dl_ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
-      dl_ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
-
-      pil+=2;    // Re Im
-      rxF+=24;   // remember replicated format (Re0 Im0 Re0 Im0) !!!
-      dl_ch+=2;
-
-    }
-
-    // printf("Second half\n");
-    // Second half of RBs
-    rxF   = (short *)&rxdataF[aarx][((symbol_offset+1+k)<<1)];
-
-    for (pilot_cnt=0; pilot_cnt<frame_parms->N_RB_DL; pilot_cnt++) {
-
-
-      dl_ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
-      dl_ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
-
-      pil+=2;
-      rxF+=24;
-      dl_ch+=2;
-
-    }
-
-  }
-
-  return(0);
-}
-
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
index e1ad291eec90551270f04cfbbc648128c365a6c5..17d44b22f8815442a5c10921410e685b02d64f1a 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,9 +19,7 @@
  *      contact@openairinterface.org
  */
 
-#ifdef USER_MODE
 #include <string.h>
-#endif
 #include "defs.h"
 #include "PHY/defs.h"
 
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
index 31136b9eb6b325798f0969615a85ea041e7201ed..42409cbaae6c4d9e53029483543adf79430eb14b 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
index 736a9a412f8e24aba9abf366ffe2846c314ad864..cce1e06df4bce134e149558b4b64c8a4b3f95de5 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index a4be2a776ba5ab731cc300c0017cd8e627295373..21e33cf1c0ce5325168e1d06b6beaaf047ecb149 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -465,7 +465,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
 
   *eNB_id = sync_source;
 
-  LOG_D(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
+  LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
 
 
 #ifdef DEBUG_PHY
@@ -578,30 +578,3 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
 
 }
 
-#ifdef PHY_ABSTRACTION
-#include "SIMULATION/TOOLS/defs.h"
-#include "SIMULATION/RF/defs.h"
-//extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
-
-int lte_sync_time_eNB_emul(PHY_VARS_eNB *phy_vars_eNB,
-                           uint8_t sect_id,
-                           int32_t *sync_val)
-{
-
-  uint8_t UE_id;
-  uint8_t CC_id = phy_vars_eNB->CC_id;
-
-  LOG_E(PHY,"[PHY] EMUL lte_sync_time_eNB_emul eNB %d, sect_id %d\n",phy_vars_eNB->Mod_id,sect_id);
-  *sync_val = 0;
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-    //LOG_E(PHY,"[PHY] EMUL : eNB %d checking UE %d (PRACH %d) PL %d dB\n",phy_vars_eNB->Mod_id,UE_id,PHY_vars_UE_g[UE_id]->generate_prach,UE2eNB[UE_id][phy_vars_eNB->Mod_id]->path_loss_dB);
-    if ((PHY_vars_UE_g[UE_id][CC_id]->generate_prach == 1) && (phy_vars_eNB->Mod_id == (UE_id % NB_eNB_INST))) {
-      *sync_val = 1;
-      return(0);
-    }
-  }
-
-  return(-1);
-}
-#endif
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
index 64ff012d536266d28e215ee83838466cf9fc5386..d428f8e6e6d9f927da6dbc7be5a0ffd77ebbf501 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
index cd37f19df0ca6c1e10a88dfc6e3af5f16726dfe9..ce6cd869599087d1b4a1258d4d894bc1fbaec717 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -38,7 +38,6 @@
 
 int16_t cond_num_threshold = 0;
 
-#ifdef USER_MODE
 void print_shorts(char *s,short *x)
 {
 
@@ -57,8 +56,6 @@ void print_ints(char *s,int *x)
         );
 
 }
-#endif
-
 
 int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
 {
@@ -210,10 +207,8 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
              ((ue->frame_parms.frame_type == TDD) && ((subframe == 1) || (subframe == 6)))
                 )
         {  // FDD PSS/SSS, compute noise in DTX REs
-
-          if (ue->frame_parms.Ncp==NORMAL) {
+          if (ue->frame_parms.Ncp == NORMAL) {
             for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
-
           if(ue->frame_parms.frame_type == FDD)
           {
 	      rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aarx][(5*ue->frame_parms.ofdm_symbol_size)];
@@ -269,7 +264,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
         ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
         ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
         } else {
-            LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length = EXTENDED\n");
+            LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length == EXTENDED\n");
         }
         }
         else if ((ue->frame_parms.frame_type == TDD) &&
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
index 17748af0b9e4428ab998160346fd3eb510cf9b43..9ef23f23d06ebcaee853c03d4d110de305ee4130 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -91,7 +91,6 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
                   eNB->ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS2 +
                   frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+Ns]) % 12;
 
-#if defined(USER_MODE)
   Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints);
 
   if (Msc_idx_ptr)
@@ -101,26 +100,14 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
     return(-1);
   }
 
-#else
-  uint8_t b;
-
-  for (b=0; b<33; b++)
-    if (Msc_RS==dftsizes[b])
-      Msc_RS_idx = b;
-
-#endif
-
-  //  LOG_I(PHY,"subframe %d, Ns %d, l %d, Msc_RS = %d, Msc_RS_idx = %d, u %d, v %d, cyclic_shift %d\n",subframe,Ns,l,Msc_RS, Msc_RS_idx,u,v,cyclic_shift);
+  LOG_D(PHY,"subframe %d, Ns %d, l %d, Msc_RS = %d, Msc_RS_idx = %d, u %d, v %d, cyclic_shift %d\n",subframe,Ns,l,Msc_RS, Msc_RS_idx,u,v,cyclic_shift);
 #ifdef DEBUG_CH
 
-#ifdef USER_MODE
-
   if (Ns==0)
     write_output("drs_seq0.m","drsseq0",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
   else
     write_output("drs_seq1.m","drsseq1",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
 
-#endif
 #endif
 
 
@@ -304,7 +291,7 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
 
 #ifdef DEBUG_CH
 
-      if (aa==0) {
+      if (aa==1) {
         if (Ns == 0) {
           write_output("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset],512*2,2,1);
           write_output("tmpin_ifft.m","drs_in",temp_in_ifft_0,512,1,1);
@@ -489,12 +476,10 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
 			   15,
 			   0);
 
-#ifdef USER_MODE
 #ifdef DEBUG_SRS
       sprintf(fname,"srs_ch_est%d.m",aa);
       sprintf(vname,"srs_est%d",aa);
       write_output(fname,vname,srs_vars->srs_ch_estimates[aa],frame_parms->ofdm_symbol_size,1,1);
-#endif
 #endif
     }
 
diff --git a/openair1/PHY/LTE_ESTIMATION/pss6144.h b/openair1/PHY/LTE_ESTIMATION/pss6144.h
index 0fb5e1569d026d151ef3b1517f5a7a01c38a6433..d3d5ee0100e4b39db9a0064f9dcb313f2a0ac19f 100644
--- a/openair1/PHY/LTE_ESTIMATION/pss6144.h
+++ b/openair1/PHY/LTE_ESTIMATION/pss6144.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_ESTIMATION/vars.h b/openair1/PHY/LTE_ESTIMATION/vars.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair1/PHY/LTE_ESTIMATION/vars.h
+++ b/openair1/PHY/LTE_ESTIMATION/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_REFSIG/defs.h b/openair1/PHY/LTE_REFSIG/defs.h
index 9c12458ff0fe18d7048dfc502a25665a213d6e92..838406b4444222c2ca341f69ad85213fcd27018c 100644
--- a/openair1/PHY/LTE_REFSIG/defs.h
+++ b/openair1/PHY/LTE_REFSIG/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_REFSIG/defs_NB_IoT.h b/openair1/PHY/LTE_REFSIG/defs_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f0b7b8c4ce7fb48a2dcabc360d9756ddae98d7e
--- /dev/null
+++ b/openair1/PHY/LTE_REFSIG/defs_NB_IoT.h
@@ -0,0 +1,60 @@
+/*******************************************************************************
+
+ *******************************************************************************/
+/*! \file PHY/LTE_REFSIG/defs_NB_IoT.c
+* \function called by lte_dl_cell_spec_NB_IoT.c ,	 TS 36-211, V13.4.0 2017-02
+* \author M. KANJ
+* \date 2017
+* \version 0.0
+* \company bcom
+* \email: matthieu.kanj@b-com.com
+* \note
+* \warning
+*/
+
+/* Definitions for NB_IoT Reference signals */
+
+#ifndef __LTE_REFSIG_DEFS_NB_IOT__H__
+#define __LTE_REFSIG_DEFS_NB_IOT__H__
+
+#include "PHY/defs_L1_NB_IoT.h"
+
+/** @ingroup _PHY_REF_SIG
+ * @{
+*/
+/*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL reference signals.
+@param frame_parms LTE DL Frame parameters
+@param lte_gold_table pointer to table where sequences are stored
+@param Nid_cell Cell Id for NB_IoT (to compute sequences for local and adjacent cells) */
+
+void lte_gold_NB_IoT(NB_IoT_DL_FRAME_PARMS  *frame_parms,
+					 uint32_t 				lte_gold_table_NB_IoT[20][2][14],
+					 uint16_t 				Nid_cell);
+
+/*! \brief This function generates the Narrowband reference signal (NRS) sequence (36-211, Sec 6.10.1.1)
+@param phy_vars_eNB Pointer to eNB variables
+@param output Output vector for OFDM symbol (Frequency Domain)
+@param amp Q15 amplitude
+@param Ns Slot number (0..19)
+@param l symbol (0,1) - Note 1 means 3!
+@param p antenna index
+@param RB_IoT_ID the ID of the RB dedicated for NB_IoT
+*/
+int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB_NB_IoT  *phy_vars_eNB,
+                     		int32_t 			 *output,
+                     		short 				 amp,
+                     		unsigned char 		 Ns,
+                     		unsigned char 		 l,
+                     		unsigned char 		 p,
+					 		unsigned short 		 RB_IoT_ID); 
+
+
+unsigned int lte_gold_generic_NB_IoT(unsigned int  *x1,
+									 unsigned int  *x2,
+									 unsigned char reset);
+		
+void generate_ul_ref_sigs_rx_NB_IoT(void);
+
+void free_ul_ref_sigs_NB_IoT(void);
+			 
+#endif
diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c b/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c
index 022e8bb373ca8334e9c6e4faf41595f04d42b693..5bf69578d194269b656266e0245d38fbd2a39b56 100644
--- a/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c
+++ b/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,10 +19,8 @@
  *      contact@openairinterface.org
  */
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
-#endif
 
 #include "defs.h"
 #include "PHY/defs.h"
diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
index bb0133f7fcb2c5e8e8482b93ba874f65d1430289..35e5fe6affa62885f33bde299fe1d63a7375d475 100644
--- a/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
+++ b/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,10 +21,8 @@
 
 // 6.10.2.2 MBSFN reference signals Mapping to resource elements
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
-#endif
 
 #include "defs.h"
 #include "PHY/defs.h"
diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c
index 3cf88fbb7639366ae9e696a2be0e983fefdc43f0..a7db8fd5aa321848cb1a4b903b5fb2b1cc780842 100644
--- a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c
+++ b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -30,10 +30,8 @@
 * \warning
 */
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
-#endif
 
 #include "defs.h"
 #include "PHY/defs.h"
diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c
index b15bc06cbdd1abf309f6c96862ae5dab1eae0d96..c3a3f42456293460213b3bea994b8757b0be37a0 100644
--- a/openair1/PHY/LTE_REFSIG/lte_gold.c
+++ b/openair1/PHY/LTE_REFSIG/lte_gold.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c
index f5c809539609e954b975dc7a23e4a899c9e91cbe..66d7fa8fb253c3cb3ed3d6220e475f0d526ab7b3 100644
--- a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c
+++ b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_REFSIG/lte_ul_ref.c b/openair1/PHY/LTE_REFSIG/lte_ul_ref.c
index 52cd65fb924a82305523acfa381f0e210653a969..93ca7646e63cdaabfc0d229d2e8241cdf8480541 100644
--- a/openair1/PHY/LTE_REFSIG/lte_ul_ref.c
+++ b/openair1/PHY/LTE_REFSIG/lte_ul_ref.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -185,14 +185,18 @@ void free_ul_ref_sigs(void)
 
   unsigned int u,v,Msc_RS;
 
-  for (Msc_RS=2; Msc_RS<33; Msc_RS++) {
+  for (Msc_RS=0; Msc_RS<33; Msc_RS++) {
     for (u=0; u<30; u++) {
       for (v=0; v<2; v++) {
-        if (ul_ref_sigs[u][v][Msc_RS])
+        if (ul_ref_sigs[u][v][Msc_RS]) {
           free16(ul_ref_sigs[u][v][Msc_RS],2*sizeof(int16_t)*dftsizes[Msc_RS]);
+          ul_ref_sigs[u][v][Msc_RS] = NULL;
+        }
 
-        if (ul_ref_sigs_rx[u][v][Msc_RS])
+        if (ul_ref_sigs_rx[u][v][Msc_RS]) {
           free16(ul_ref_sigs_rx[u][v][Msc_RS],4*sizeof(int16_t)*dftsizes[Msc_RS]);
+          ul_ref_sigs_rx[u][v][Msc_RS] = NULL;
+        }
       }
     }
   }
diff --git a/openair1/PHY/LTE_REFSIG/mod_table.h b/openair1/PHY/LTE_REFSIG/mod_table.h
index 776ae8acf155607b78220a8533b3997617271659..7bdc1f518f1c072c2381e13ec726154af1e66493 100644
--- a/openair1/PHY/LTE_REFSIG/mod_table.h
+++ b/openair1/PHY/LTE_REFSIG/mod_table.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_REFSIG/primary_synch.h b/openair1/PHY/LTE_REFSIG/primary_synch.h
index 717f2e552cab59313b7c02b7ef4347070f4667b6..8152722df321790018ca88df814a820fbc1bf3e3 100644
--- a/openair1/PHY/LTE_REFSIG/primary_synch.h
+++ b/openair1/PHY/LTE_REFSIG/primary_synch.h
@@ -1,3 +1,24 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
 short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0};
 short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0};
 short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0};
diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c
index ef3e2cb679b7b4ff5eb257dd5a802ffafd66e907..ded49d1c73a8c53d0574dfdc8f43aa46a3e001e0 100755
--- a/openair1/PHY/LTE_TRANSPORT/dci.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,20 +29,19 @@
 * \note
 * \warning
 */
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#endif
 #include "PHY/defs.h"
 #include "PHY/extern.h"
 #include "SCHED/defs.h"
-#include "SIMULATION/TOOLS/defs.h" // for taus 
+#include "SIMULATION/TOOLS/defs.h" // for taus
 #include "PHY/sse_intrin.h"
 
-#include "assertions.h" 
+#include "assertions.h"
 #include "T.h"
 #include "UTIL/LOG/log.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
 
 //#define DEBUG_DCI_ENCODING 1
 //#define DEBUG_DCI_DECODING 1
@@ -153,7 +152,7 @@ uint16_t extract_crc(uint8_t *dci,uint8_t dci_len)
   //  dci[(dci_len>>3)+1] = 0;
   //  dci[(dci_len>>3)+2] = 0;
   return((uint16_t)crc16);
-  
+
 }
 
 
@@ -178,7 +177,7 @@ void dci_encoding(uint8_t *a,
   // encode dci
 
 #ifdef DEBUG_DCI_ENCODING
-  printf("Doing DCI encoding for %d bits, e %p, rnti %x\n",A,e,rnti);
+  printf("Doing DCI encoding for %d bits, e %p, rnti %x, E %d\n",A,e,rnti,E);
 #endif
 
   memset((void *)d,LTE_NULL,96);
@@ -216,10 +215,10 @@ uint8_t *generate_dci0(uint8_t *dci,
   uint16_t coded_bits;
   uint8_t dci_flip[8];
 
-  AssertFatal((aggregation_level==1) || 
-	      (aggregation_level==2) || 
-	      (aggregation_level==4) || 
-	      (aggregation_level==8) 
+  AssertFatal((aggregation_level==1) ||
+	      (aggregation_level==2) ||
+	      (aggregation_level==4) ||
+	      (aggregation_level==8)
 #ifdef Rel14 // Added for EPDCCH/MPDCCH
 	      ||
 	      (aggregation_level==16) ||
@@ -228,22 +227,27 @@ uint8_t *generate_dci0(uint8_t *dci,
 #endif
 	      ,
 	      "generate_dci FATAL, illegal aggregation_level %d\n",aggregation_level);
-  
+
 
   coded_bits = 72 * aggregation_level;
 
-  /*
+
 
   #ifdef DEBUG_DCI_ENCODING
-  for (i=0;i<1+((DCI_LENGTH+16)/8);i++)
+  for (int i=0;i<1+((DCI_LENGTH+16)/8);i++)
     printf("i %d : %x\n",i,dci[i]);
   #endif
-  */
+
   if (DCI_LENGTH<=32) {
     dci_flip[0] = dci[3];
     dci_flip[1] = dci[2];
     dci_flip[2] = dci[1];
     dci_flip[3] = dci[0];
+#ifdef DEBUG_DCI_ENCODING
+    printf("DCI => %x,%x,%x,%x\n",
+	   dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3]);
+
+#endif
   } else {
     dci_flip[0] = dci[7];
     dci_flip[1] = dci[6];
@@ -473,7 +477,7 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
     wptr[1] = wptr2[1];
     wptr[2] = wptr2[2];
     wptr[3] = wptr2[3];
-    /*    
+    /*
     printf("pdcch_deinterleaving (%p,%p): quad %d (%d) -> (%d,%d %d,%d %d,%d %d,%d)\n",wptr,wptr2,i,(i+frame_parms->Nid_cell)%Mquad,
 	   ((char*)wptr2)[0],
 	   ((char*)wptr2)[1],
@@ -512,7 +516,7 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
         zptr[2] = wptr[2];
         zptr[3] = wptr[3];
 
-	/*        
+	/*
         printf("deinterleaving ; k %d, index-Nd %d  => (%d,%d,%d,%d,%d,%d,%d,%d)\n",k,(index-ND),
                ((int8_t *)wptr)[0],
                ((int8_t *)wptr)[1],
@@ -533,7 +537,7 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
 
   for (i=0; i<Mquad; i++) {
     zptr = &z[i<<2];
-    /*    
+    /*
     printf("deinterleaving ; quad %d  => (%d,%d,%d,%d,%d,%d,%d,%d)\n",i,
      ((int8_t *)zptr)[0],
      ((int8_t *)zptr)[1],
@@ -543,7 +547,7 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
      ((int8_t *)zptr)[5],
      ((int8_t *)zptr)[6],
      ((int8_t *)zptr)[7]);
-    */  
+    */
   }
 
 }
@@ -1506,7 +1510,7 @@ void pdcch_channel_compensation(int32_t **rxdataF_ext,
       dl_ch128_2    = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12];
 
 #elif defined(__arm__)
-      
+
 #endif
       for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
 #if defined(__x86_64__) || defined(__i386__)
@@ -1870,12 +1874,6 @@ int32_t rx_pdcch(PHY_VARS_UE *ue,
 #endif //MU_RECEIVER
 
 
-#if T_TRACER
-  T(T_UE_PHY_PDCCH_IQ, T_INT(frame_parms->N_RB_DL), T_INT(frame_parms->N_RB_DL),
-    T_INT(n_pdcch_symbols),
-    T_BUFFER(pdcch_vars[eNB_id]->rxdataF_comp, frame_parms->N_RB_DL*12*n_pdcch_symbols* 4));
-#endif
-
   // decode pcfich here and find out pdcch ofdm symbol number
   n_pdcch_symbols = rx_pcfich(frame_parms,
                               subframe,
@@ -1886,6 +1884,12 @@ int32_t rx_pdcch(PHY_VARS_UE *ue,
   if (n_pdcch_symbols>3)
     n_pdcch_symbols=1;
 
+#if T_TRACER
+  T(T_UE_PHY_PDCCH_IQ, T_INT(frame_parms->N_RB_DL), T_INT(frame_parms->N_RB_DL),
+    T_INT(n_pdcch_symbols),
+    T_BUFFER(pdcch_vars[eNB_id]->rxdataF_comp, frame_parms->N_RB_DL*12*n_pdcch_symbols* 4));
+#endif
+
 
 #ifdef DEBUG_DCI_DECODING
 
@@ -2065,6 +2069,8 @@ void pdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
   uint8_t reset;
   uint32_t x1, x2, s=0;
 
+  //LOG_D(PHY, "%s(fp, subframe:%d, e, length:%d)\n", __FUNCTION__, subframe, length);
+
   reset = 1;
   // x1 is set in lte_gold_generic
 
@@ -2105,7 +2111,7 @@ void pdcch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
       reset = 0;
     }
 
-    
+
     //    printf("unscrambling %d : e %d, c %d => ",i,llr[i],((s>>(i&0x1f))&1));
     if (((s>>(i%32))&1)==0)
       llr[i] = -llr[i];
@@ -2247,24 +2253,34 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
   }
 
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,1);
   generate_pcfich(num_pdcch_symbols,
                   amp,
                   frame_parms,
                   txdataF,
                   subframe);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,0);
   wbar[0] = &wbar0[0];
   wbar[1] = &wbar1[0];
   y[0] = &yseq0[0];
   y[1] = &yseq1[0];
 
+#if 1
   // 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]=taus()&1;*/
+  for (i=0; i<DCI_BITS_MAX; i++)
+    e[i]=taus()&1;
+#endif
+
+  /* clear all bits, the above code may generate too much false detections
+   * (not sure about this, to be checked somehow)
+   */
+  // memset(e, 0, DCI_BITS_MAX);
 
   e_ptr = e;
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,1);
 
   // generate DCIs in order of decreasing aggregation level, then common/ue spec
   // MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization
@@ -2274,11 +2290,11 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
       if (dci_alloc[i].L == (uint8_t)L) {
 
 	#ifdef DEBUG_DCI_ENCODING
-	if (dci_alloc[i].rnti==0x02)
-	  LOG_I(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
+	if (dci_alloc[i].rnti==0x1234)
+	  LOG_D(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
 		*(unsigned int*)dci_alloc[i].dci_pdu,
 		dci_alloc[i].rnti);
-       //dump_dci(frame_parms,&dci_alloc[i]);
+       dump_dci(frame_parms,&dci_alloc[i]);
 	#endif
 
         if (dci_alloc[i].firstCCE>=0) {
@@ -2291,18 +2307,26 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
       }
     }
   }
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,0);
 
   // Scrambling
-  //  printf("pdcch scrambling\n");
+#ifdef DEBUG_DCI_ENCODING
+  printf("pdcch scrambling\n");
+#endif
+  //LOG_D(PHY, "num_pdcch_symbols:%d mi:%d nquad:%d\n", num_pdcch_symbols, mi, get_nquad(num_pdcch_symbols, frame_parms, mi));
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,1);
   pdcch_scrambling(frame_parms,
                    subframe,
                    e,
                    8*get_nquad(num_pdcch_symbols, frame_parms, mi));
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,0);
   //72*get_nCCE(num_pdcch_symbols,frame_parms,mi));
 
 
 
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,1);
   // Now do modulation
   if (frame_parms->nb_antenna_ports_eNB==1)
     gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
@@ -2315,12 +2339,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
   printf(" PDCCH Modulation, Msymb %d, Msymb2 %d,gain_lin_QPSK %d\n",Msymb,Msymb2,gain_lin_QPSK);
 #endif
 
+  //LOG_D(PHY,"%s() Msymb2:%d\n", __FUNCTION__, Msymb2);
 
   if (frame_parms->nb_antenna_ports_eNB==1) { //SISO
 
 
     for (i=0; i<Msymb2; i++) {
-      
+
       //((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
       //((int16_t*)(&(y[1][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;
@@ -2361,22 +2386,38 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
 
     }
   }
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,0);
 
 
 #ifdef DEBUG_DCI_ENCODING
   printf(" PDCCH Interleaving\n");
 #endif
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,1);
   //  printf("y %p (%p,%p), wbar %p (%p,%p)\n",y,y[0],y[1],wbar,wbar[0],wbar[1]);
   // This is the interleaving procedure defined in 36-211, first part of Section 6.8.5
   pdcch_interleaving(frame_parms,&y[0],&wbar[0],num_pdcch_symbols,mi);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,0);
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,1);
   mprime=0;
   nsymb = (frame_parms->Ncp==0) ? 14:12;
   re_offset = frame_parms->first_carrier_offset;
 
   // This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
   //  printf("DCI (SF %d) : txdataF %p (0 %p)\n",subframe,&txdataF[0][512*14*subframe],&txdataF[0][0]);
+#ifdef DEBUG_DCI_ENCODING
+  printf("kprime loop - N_RB_DL:%d lprime:num_pdcch_symbols:%d Ncp:%d pcfich:%02x,%02x,%02x,%02x ofdm_symbol_size:%d first_carrier_offset:%d nb_antenna_ports_eNB:%d\n",
+  frame_parms->N_RB_DL, num_pdcch_symbols,frame_parms->Ncp,
+  frame_parms->pcfich_reg[0],
+  frame_parms->pcfich_reg[1],
+  frame_parms->pcfich_reg[2],
+  frame_parms->pcfich_reg[3],
+  frame_parms->ofdm_symbol_size,
+  frame_parms->first_carrier_offset,
+  frame_parms->nb_antenna_ports_eNB
+  );
+#endif
   for (kprime=0; kprime<frame_parms->N_RB_DL*12; kprime++) {
     for (lprime=0; lprime<num_pdcch_symbols; lprime++) {
 
@@ -2493,6 +2534,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
     if (re_offset == (frame_parms->ofdm_symbol_size))
       re_offset = 1;
   } // kprime loop
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,0);
 
   return(num_pdcch_symbols);
 }
@@ -2617,15 +2659,15 @@ uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int sub
   // check for eNB only !
   return(get_nCCE(num_pdcch_symbols,
 		  &RC.eNB[Mod_id][CC_id]->frame_parms,
-		  get_mi(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe))); 
+		  get_mi(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe)));
 }
 
 
 int get_nCCE_offset_l1(int *CCE_table,
-		       const unsigned char L, 
-		       const int nCCE, 
-		       const int common_dci, 
-		       const unsigned short rnti, 
+		       const unsigned char L,
+		       const int nCCE,
+		       const int common_dci,
+		       const unsigned short rnti,
 		       const unsigned char subframe)
 {
 
@@ -2655,7 +2697,7 @@ int get_nCCE_offset_l1(int *CCE_table,
           break;
         }
       }
-     
+
       if (search_space_free == 1) {
 
 	//	printf("returning %d\n",m*L);
@@ -2857,17 +2899,17 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
         LOG_D(PHY,"[DCI search nPdcch %d - common] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x)\n",
                 pdcch_vars[eNB_id]->num_pdcch_symbols,m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask);
       else
-        LOG_D(PHY,"[DCI search nPdcch %d - ue spec] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x) format %d\n",
-                pdcch_vars[eNB_id]->num_pdcch_symbols,m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask,format_c);
+        LOG_D(PHY,"[DCI search nPdcch %d - ue spec %x] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x) format %d\n",
+	      pdcch_vars[eNB_id]->num_pdcch_symbols,pdcch_vars[eNB_id]->crnti,m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask,format_c);
 
        dci_decoding(sizeof_bits,
                    L,
                    &pdcch_vars[eNB_id]->e_rx[CCEind*72],
                    &dci_decoded_output[current_thread_id][0]);
-      /*
+       /*
         for (i=0;i<3+(sizeof_bits>>3);i++)
-        printf("dci_decoded_output[%d] => %x\n",i,dci_decoded_output[i]);
-      */
+	  printf("dci_decoded_output[%d][%d] => %x\n",current_thread_id,i,dci_decoded_output[current_thread_id][i]);
+       */
 
       crc = (crc16(&dci_decoded_output[current_thread_id][0],sizeof_bits)>>16) ^ extract_crc(&dci_decoded_output[current_thread_id][0],sizeof_bits);
 #ifdef DEBUG_DCI_DECODING
@@ -2978,7 +3020,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
          return;
       } // rnti match
     }  // CCEmap_cand == 0
-/*    
+/*
 	if ( agregationLevel != 0xFF &&
         (format_c == format0 && m==0 && si_rnti != SI_RNTI))
     {
@@ -3088,8 +3130,8 @@ uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_UE *ue,
                           mi,
                           ((ue->decode_SIB == 1) ? SI_RNTI : 0),
                           ra_rnti,
-              P_RNTI,
-              agregationLevel,
+			  P_RNTI,
+			  agregationLevel,
                           format1A,
                           format1A,
                           format1A,
@@ -3107,7 +3149,7 @@ uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_UE *ue,
       ((format0_found==1)&&(format_c_found==1)))
     return(dci_cnt);
 
-  if (DCIFormat == 1)
+  if (DCIFormat == format1)
   {
       if ((tmode < 3) || (tmode == 7)) {
           //printf("Crnti decoding frame param agregation %d DCI %d \n",agregationLevel,DCIFormat);
@@ -3150,14 +3192,14 @@ uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_UE *ue,
           //printf("Crnti 1 decoding frame param agregation %d DCI %d \n",agregationLevel,DCIFormat);
 
       }
-      else
+      else if (DCIFormat == format1A)
       {
           AssertFatal(0,"Other Transmission mode not yet coded\n");
       }
   }
   else
   {
-     AssertFatal(0,"DCI format %d not yet implemented \n",DCIFormat);
+     LOG_W(PHY,"DCI format %d wrong or not yet implemented \n",DCIFormat);
   }
 
   return(dci_cnt);
@@ -3381,7 +3423,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
 
   if (do_common == 1) {
 #ifdef DEBUG_DCI_DECODING
-    printf("[DCI search] doing common search/format0 aggregation 4\n");
+    printf("[DCI search] subframe %d: doing common search/format0 aggregation 4\n",subframe);
 #endif
 
     if (ue->prach_resources[eNB_id])
@@ -3786,7 +3828,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
   } else if (tmode == 3) {
 
 
-    LOG_D(PHY," Now check UE_SPEC format 2A_2A search aggregation 1 dci length: %d[bits] %d[bytes]\n",format2A_size_bits,format2A_size_bytes);
+    //    LOG_D(PHY," Now check UE_SPEC format 2A_2A search aggregation 1 dci length: %d[bits] %d[bytes]\n",format2A_size_bits,format2A_size_bytes);
     // Now check UE_SPEC format 2A_2A search spaces at aggregation 1
     old_dci_cnt=dci_cnt;
     dci_decoding_procedure0(pdcch_vars,0,mode,
@@ -3858,7 +3900,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
       return(dci_cnt);
 
     // Now check UE_SPEC format 2_2A search spaces at aggregation 4
-    LOG_D(PHY," Now check UE_SPEC format 2_2A search spaces at aggregation 4 \n");
+    //    LOG_D(PHY," Now check UE_SPEC format 2_2A search spaces at aggregation 4 \n");
     old_dci_cnt=dci_cnt;
     dci_decoding_procedure0(pdcch_vars,0,mode,
                             subframe,
@@ -4201,33 +4243,3 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
 
   return(dci_cnt);
 }
-
-#ifdef PHY_ABSTRACTION
-uint16_t dci_decoding_procedure_emul(LTE_UE_PDCCH **pdcch_vars,
-                                     uint8_t num_ue_spec_dci,
-                                     uint8_t num_common_dci,
-                                     DCI_ALLOC_t *dci_alloc_tx,
-                                     DCI_ALLOC_t *dci_alloc_rx,
-                                     int16_t eNB_id)
-{
-
-  uint8_t  dci_cnt=0,i;
-
-  memcpy(dci_alloc_rx,dci_alloc_tx,num_common_dci*sizeof(DCI_ALLOC_t));
-  dci_cnt = num_common_dci;
-  LOG_D(PHY,"[DCI][EMUL] : num_common_dci %d\n",num_common_dci);
-
-  for (i=num_common_dci; i<(num_ue_spec_dci+num_common_dci); i++) {
-    LOG_D(PHY,"[DCI][EMUL] Checking dci %d => %x format %d (bit 0 %d)\n",i,pdcch_vars[eNB_id]->crnti,dci_alloc_tx[i].format,
-          dci_alloc_tx[i].dci_pdu[0]&0x80);
-
-    if (dci_alloc_tx[i].rnti == pdcch_vars[eNB_id]->crnti) {
-      memcpy(dci_alloc_rx+dci_cnt,dci_alloc_tx+i,sizeof(DCI_ALLOC_t));
-      dci_cnt++;
-    }
-  }
-
-
-  return(dci_cnt);
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/dci.h b/openair1/PHY/LTE_TRANSPORT/dci.h
index a6926777af8997ba0f4ae017d5a689cd76a5cb7f..9381dd63fdd1a3d49b50e6ce4b27793c1a1074c1 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci.h
+++ b/openair1/PHY/LTE_TRANSPORT/dci.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -482,8 +482,8 @@ typedef struct DCI1A_20MHz_FDD DCI1A_20MHz_FDD_t;
 
 /// DCI Format Type 1 (1.5 MHz, TDD, 23 bits)
 struct DCI1_1_5MHz_TDD {
-  /// Dummy bits to align to 32-bits
-  uint32_t dummy:9;
+  /// padding bits to align to 32-bits
+  uint32_t padding:9;
   /// DAI (TDD)
   uint32_t dai:2;
   /// Power Control
@@ -507,8 +507,8 @@ typedef struct DCI1_1_5MHz_TDD DCI1_1_5MHz_TDD_t;
 
 /// DCI Format Type 1 (5 MHz, TDD, 30 bits)
 struct DCI1_5MHz_TDD {
-  /// Dummy bits to align to 32-bits
-  uint32_t dummy:2;
+  /// padding bits to align to 32-bits
+  uint32_t padding:2;
   /// DAI (TDD)
   uint32_t dai:2;
   /// Power Control
@@ -532,8 +532,8 @@ typedef struct DCI1_5MHz_TDD DCI1_5MHz_TDD_t;
 
 /// DCI Format Type 1 (10 MHz, TDD, 34 bits)
 struct DCI1_10MHz_TDD {
-  /// Dummy bits to align to 64-bits
-  uint64_t dummy:30;
+  /// padding bits to align to 64-bits
+  uint64_t padding:30;
   /// DAI (TDD)
   uint64_t dai:2;
   /// Power Control
@@ -557,8 +557,8 @@ typedef struct DCI1_10MHz_TDD DCI1_10MHz_TDD_t;
 
 /// DCI Format Type 1 (20 MHz, TDD, 42 bits)
 struct DCI1_20MHz_TDD {
-  /// Dummy bits to align to 64-bits
-  uint64_t dummy:22;
+  /// padding bits to align to 64-bits
+  uint64_t padding:22;
   /// DAI (TDD)
   uint64_t dai:2;
   /// Power Control
@@ -582,8 +582,8 @@ typedef struct DCI1_20MHz_TDD DCI1_20MHz_TDD_t;
 
 /// DCI Format Type 1 (1.5 MHz, FDD, 21 bits)
 struct DCI1_1_5MHz_FDD {
-  /// Dummy bits to align to 32-bits
-  uint32_t dummy:11;
+  /// padding bits to align to 32-bits
+  uint32_t padding:11;
   /// Power Control
   uint32_t TPC:2;
   /// Redundancy version
@@ -605,8 +605,8 @@ typedef struct DCI1_1_5MHz_FDD DCI1_1_5MHz_FDD_t;
 
 /// DCI Format Type 1 (5 MHz, FDD, 27 bits)
 struct DCI1_5MHz_FDD {
-  /// dummy bits (not transmitted)
-  uint32_t dummy:5;
+  /// padding its (not transmitted)
+  uint32_t padding:5;
   /// Power Control
   uint32_t TPC:2;
   /// Redundancy version
@@ -628,8 +628,8 @@ typedef struct DCI1_5MHz_FDD DCI1_5MHz_FDD_t;
 
 /// DCI Format Type 1 (10 MHz, FDD, 31 bits)
 struct DCI1_10MHz_FDD {
-  /// dummy bits (not transmitted)
-  uint32_t dummy:1;
+  /// padding bits (not transmitted)
+  uint32_t padding:1;
   /// Power Control
   uint32_t TPC:2;
   /// Redundancy version
@@ -651,8 +651,8 @@ typedef struct DCI1_10MHz_FDD DCI1_10MHz_FDD_t;
 
 /// DCI Format Type 1 (20 MHz, FDD, 39 bits)
 struct DCI1_20MHz_FDD {
-  /// dummy bits (not transmitted)
-  uint64_t dummy:25;
+  /// padding bits (not transmitted)
+  uint64_t padding:25;
   /// Power Control
   uint64_t TPC:2;
   /// Redundancy version
@@ -674,10 +674,8 @@ typedef struct DCI1_20MHz_FDD DCI1_20MHz_FDD_t;
 
 /// DCI Format Type 1A (5 MHz, TDD, frame 1-6, 27 bits)
 struct DCI1A_RA_5MHz_TDD_1_6 {
-  /// Dummy bits to align to 32-bits
-  uint32_t dummy:5;
-  /// Padding
-  uint32_t padding:6;
+  /// padding bits to align to 32-bits
+  uint32_t padding:11;
   /// PRACH mask index
   uint32_t prach_mask_index:4;
   /// Preamble Index
@@ -822,7 +820,7 @@ typedef struct DCI1B_5MHz_4A_TDD DCI1B_5MHz_4A_TDD_t;
 struct DCI1C_1_5MHz
 {
   /// padding to 32bits
-  uint32_t padding32:24;
+  uint32_t padding:24;
   uint32_t mcs:5;
   uint32_t rballoc:3;  // N_RB_step = 2, Ngap=Ngap1=3, NDLVRBGap = 6, ceil(log2((3*4)/2)) = 3
 } __attribute__ ((__packed__));
@@ -836,7 +834,7 @@ typedef struct DCI1C_1_5MHz DCI1C_1_5MHz_t;
 struct DCI1C_5MHz
 {
   /// padding to 32bits
-  uint32_t padding32:20;
+  uint32_t padding:20;
   uint32_t mcs:5;
   uint32_t rballoc:7;   // N_RB_step = 2, Ngap1=Ngap2=12, NDLVRBGap = 24, ceil(log2((12*13)/2)) = 7
 } __attribute__ ((__packed__));
@@ -848,7 +846,7 @@ typedef struct DCI1C_5MHz DCI1C_5MHz_t;
 struct DCI1C_10MHz
 {
   /// padding to 32bits
-  uint32_t padding32:19;
+  uint32_t padding:19;
   uint32_t mcs:5;
   uint32_t rballoc:7;  // N_RB_step = 4, Ngap1=27, NDLVRBGap = 46, ceil(log2(((11*12)/2)) = 7
   uint32_t Ngap:1;
@@ -861,7 +859,7 @@ typedef struct DCI1C_10MHz DCI1C_10MHz_t;
 struct DCI1C_15MHz
 {
   /// padding to 32bits
-  uint32_t padding32:18;
+  uint32_t padding:18;
   uint32_t mcs:5;
   uint32_t rballoc:8; // N_RB_step = 4, Ngap1=64, ceil(log2((16*17)/2)) = 8
   uint32_t Ngap:1;
@@ -874,7 +872,7 @@ typedef struct DCI1C_15MHz DCI1C_15MHz_t;
 struct DCI1C_20MHz
 {
   /// padding to 32bits
-  uint32_t padding32:17;
+  uint32_t padding:17;
   uint32_t mcs:5;
   uint32_t rballoc:9; // N_RB_step = 4, Ngap1=48, ceil(log2((24*25)/2)) = 9
   uint32_t Ngap:1;
@@ -1006,7 +1004,7 @@ typedef struct DCI1D_5MHz_4A_TDD DCI1D_5MHz_4A_TDD_t;
 /// DCI Format Type 1E (5 MHz, TDD, 2 Antenna Ports, more than 10 PRBs, 34 bits)
 struct DCI1E_5MHz_2A_M10PRB_TDD {
   /// padding to 64bits
-  uint64_t padding64:30;
+  uint64_t padding:30;
   /// Redundancy version 2
   ///uint64_t rv2:2;
   /// New Data Indicator 2
@@ -1045,7 +1043,7 @@ typedef struct DCI1E_5MHz_2A_M10PRB_TDD DCI1E_5MHz_2A_M10PRB_TDD_t;
 /// DCI Format Type 2 (1.5 MHz, TDD, 2 Antenna Ports, 34 bits)
 struct DCI2_1_5MHz_2A_TDD {
   /// padding to 64bits
-  uint64_t padding64:30;
+  uint64_t padding:30;
   /// TPMI information for precoding
   uint64_t tpmi:3;
   /// Redundancy version 2
@@ -1078,7 +1076,7 @@ typedef struct DCI2_1_5MHz_2A_TDD DCI2_1_5MHz_2A_TDD_t;
 /// DCI Format Type 2 (1.5 MHz, TDD, 4 Antenna Ports, 37 bits)
 struct DCI2_1_5MHz_4A_TDD {
   /// padding for 64-bit
-  uint64_t padding64:27;
+  uint64_t padding:27;
   /// TPMI information for precoding
   uint64_t tpmi:6;
   /// Redundancy version 2
@@ -1111,7 +1109,7 @@ typedef struct DCI2_1_5MHz_4A_TDD DCI2_1_5MHz_4A_TDD_t;
 /// DCI Format Type 2 (5 MHz, TDD, 2 Antenna Ports, 42 bits)
 struct DCI2_5MHz_2A_TDD {
   /// padding to 64bits
-  uint64_t padding64:22;
+  uint64_t padding:22;
   /// TPMI information for precoding
   uint64_t tpmi:3;
   /// Redundancy version 2
@@ -1146,7 +1144,7 @@ typedef struct DCI2_5MHz_2A_TDD DCI2_5MHz_2A_TDD_t;
 /// DCI Format Type 2 (5 MHz, TDD, 4 Antenna Ports, 45 bits)
 struct DCI2_5MHz_4A_TDD {
   /// padding for 64-bit
-  uint64_t padding64:19;
+  uint64_t padding:19;
   /// TPMI information for precoding
   uint64_t tpmi:6;
   /// Redundancy version 2
@@ -1181,7 +1179,7 @@ typedef struct DCI2_5MHz_4A_TDD DCI2_5MHz_4A_TDD_t;
 /// DCI Format Type 2 (10 MHz, TDD, 2 Antenna Ports, 46 bits)
 struct DCI2_10MHz_2A_TDD {
   /// padding to 64bits
-  uint64_t padding64:18;
+  uint64_t padding:18;
   /// TPMI information for precoding
   uint64_t tpmi:3;
   /// Redundancy version 2
@@ -1216,7 +1214,7 @@ typedef struct DCI2_10MHz_2A_TDD DCI2_10MHz_2A_TDD_t;
 /// DCI Format Type 2 (10 MHz, TDD, 4 Antenna Ports, 49 bits)
 struct DCI2_10MHz_4A_TDD {
   /// padding for 64-bit
-  uint64_t padding64:15;
+  uint64_t padding:15;
   /// TPMI information for precoding
   uint64_t tpmi:6;
   /// Redundancy version 2
@@ -1251,7 +1249,7 @@ typedef struct DCI2_10MHz_4A_TDD DCI2_10MHz_4A_TDD_t;
 /// DCI Format Type 2 (20 MHz, TDD, 2 Antenna Ports, 54 bits)
 struct DCI2_20MHz_2A_TDD {
   /// padding to 64bits
-  uint64_t padding64:10;
+  uint64_t padding:10;
   /// TPMI information for precoding
   uint64_t tpmi:3;
   /// Redundancy version 2
@@ -1286,7 +1284,7 @@ typedef struct DCI2_20MHz_2A_TDD DCI2_20MHz_2A_TDD_t;
 /// DCI Format Type 2 (20 MHz, TDD, 4 Antenna Ports, 57 bits)
 struct DCI2_20MHz_4A_TDD {
   /// padding for 64-bit
-  uint64_t padding64:7;
+  uint64_t padding:7;
   /// TPMI information for precoding
   uint64_t tpmi:6;
   /// Redundancy version 2
@@ -1321,7 +1319,7 @@ typedef struct DCI2_20MHz_4A_TDD DCI2_20MHz_4A_TDD_t;
 /// DCI Format Type 2 (1.5 MHz, FDD, 2 Antenna Ports, 31 bits)
 struct DCI2_1_5MHz_2A_FDD {
   //padding for 32 bits
-  uint32_t padding32:1;
+  uint32_t padding:1;
   /// precoding bits
   uint32_t tpmi:3;
   /// Redundancy version 2
@@ -1352,7 +1350,7 @@ typedef struct DCI2_1_5MHz_2A_FDD DCI2_1_5MHz_2A_FDD_t;
 /// DCI Format Type 2 (1.5 MHz, FDD, 4 Antenna Ports, 34 bits)
 struct DCI2_1_5MHz_4A_FDD {
   /// padding for 32 bits
-  uint64_t padding64:30;
+  uint64_t padding:30;
   /// precoding bits
   uint64_t tpmi:6;
   /// Redundancy version 2
@@ -1383,7 +1381,7 @@ typedef struct DCI2_1_5MHz_4A_FDD DCI2_1_5MHz_4A_FDD_t;
 /// DCI Format Type 2 (5 MHz, FDD, 2 Antenna Ports, 39 bits)
 struct DCI2_5MHz_2A_FDD {
   /// padding for 64-bit
-  uint64_t padding64:25;
+  uint64_t padding:25;
   /// TPMI information for precoding
   uint64_t tpmi:3;
   /// Redundancy version 2
@@ -1416,7 +1414,7 @@ typedef struct DCI2_5MHz_2A_FDD DCI2_5MHz_2A_FDD_t;
 /// DCI Format Type 2 (5 MHz, TDD, 4 Antenna Ports, 42 bits)
 struct DCI2_5MHz_4A_FDD {
   /// padding for 64-bit
-  uint64_t padding64:21;
+  uint64_t padding:21;
   /// TPMI information for precoding
   uint64_t tpmi:6;
   /// Redundancy version 2
@@ -1448,7 +1446,7 @@ typedef struct DCI2_5MHz_4A_FDD DCI2_5MHz_4A_FDD_t;
 /// DCI Format Type 2 (10 MHz, FDD, 2 Antenna Ports, 43 bits)
 struct DCI2_10MHz_2A_FDD {
   /// padding for 64-bit
-  uint64_t padding64:21;
+  uint64_t padding:21;
   /// TPMI information for precoding
   uint64_t tpmi:3;
   /// Redundancy version 2
@@ -1481,7 +1479,7 @@ typedef struct DCI2_10MHz_2A_FDD DCI2_10MHz_2A_FDD_t;
 /// DCI Format Type 2 (5 MHz, TDD, 4 Antenna Ports, 46 bits)
 struct DCI2_10MHz_4A_FDD {
   /// padding for 64-bit
-  uint64_t padding64:18;
+  uint64_t padding:18;
   /// TPMI information for precoding
   uint64_t tpmi:6;
   /// Redundancy version 2
@@ -1513,7 +1511,7 @@ typedef struct DCI2_10MHz_4A_FDD DCI2_10MHz_4A_FDD_t;
 /// DCI Format Type 2 (20 MHz, FDD, 2 Antenna Ports, 51 bits)
 struct DCI2_20MHz_2A_FDD {
   /// padding for 64-bit
-  uint64_t padding64:13;
+  uint64_t padding:13;
   /// TPMI information for precoding
   uint64_t tpmi:3;
   /// Redundancy version 2
@@ -1546,7 +1544,7 @@ typedef struct DCI2_20MHz_2A_FDD DCI2_20MHz_2A_FDD_t;
 /// DCI Format Type 2 (20 MHz, FDD, 4 Antenna Ports, 54 bits)
 struct DCI2_20MHz_4A_FDD {
   /// padding for 64-bit
-  uint64_t padding64:10;
+  uint64_t padding:10;
   /// TPMI information for precoding
   uint64_t tpmi:6;
   /// Redundancy version 2
@@ -2083,7 +2081,7 @@ typedef struct DCI2A_20MHz_4A_FDD DCI2A_20MHz_4A_FDD_t;
 // *******************************************************************
 /// DCI Format Type 2B (1.5 MHz, TDD,  33 bits)
 struct DCI2B_1_5MHz_TDD {
-  uint64_t padding64:31;
+  uint64_t padding:31;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2109,7 +2107,7 @@ struct DCI2B_1_5MHz_TDD {
   /// RB Assignment (ceil(log2(N_RB_DL/P)) bits)
   uint64_t rballoc:6;
   /// Padding for ambiguity
-  uint64_t padding:1;
+  uint64_t padding0:1;
 } __attribute__ ((__packed__));
 
 typedef struct DCI2B_1_5MHz_TDD DCI2B_1_5MHz_TDD_t;
@@ -2118,7 +2116,7 @@ typedef struct DCI2B_1_5MHz_TDD DCI2B_1_5MHz_TDD_t;
 /// DCI Format Type 2B (5 MHz, TDD,  39 bits)
 struct DCI2B_5MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:25;
+  uint64_t padding:25;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2153,7 +2151,7 @@ typedef struct DCI2B_5MHz_TDD DCI2B_5MHz_TDD_t;
 /// DCI Format Type 2B (10 MHz, TDD,  43 bits)
 struct DCI2B_10MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:21;
+  uint64_t padding:21;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2188,7 +2186,7 @@ typedef struct DCI2B_10MHz_TDD DCI2B_10MHz_TDD_t;
 /// DCI Format Type 2B (20 MHz, TDD,  51 bits)
 struct DCI2B_20MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:13;
+  uint64_t padding:13;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2223,7 +2221,7 @@ typedef struct DCI2B_20MHz_TDD DCI2B_20MHz_TDD_t;
 /// DCI Format Type 2B (1.5 MHz, FDD,  28 bits)
 struct DCI2B_1_5MHz_FDD {
   //padding for 32 bits
-  uint32_t padding32:4;
+  uint32_t padding:4;
   /// Redundancy version 2
   uint32_t rv2:2;
   /// New Data Indicator 2
@@ -2252,7 +2250,7 @@ typedef struct DCI2B_1_5MHz_FDD DCI2B_1_5MHz_FDD_t;
 /// DCI Format Type 2B (5 MHz, FDD,  36 bits)
 struct DCI2B_5MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:28;
+  uint64_t padding:28;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2283,7 +2281,7 @@ typedef struct DCI2B_5MHz_FDD DCI2B_5MHz_FDD_t;
 /// DCI Format Type 2B (10 MHz, FDD,  41 bits)
 struct DCI2B_10MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:23;
+  uint64_t padding:23;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2307,7 +2305,7 @@ struct DCI2B_10MHz_FDD {
   /// Resource Allocation Header
   uint64_t rah:1;
   /// Padding for ambiguity
-  uint64_t padding:1;
+  uint64_t padding0:1;
 } __attribute__ ((__packed__));
 
 #define sizeof_DCI2B_10MHz_FDD_t 41
@@ -2316,7 +2314,7 @@ typedef struct DCI2B_10MHz_FDD DCI2B_10MHz_FDD_t;
 /// DCI Format Type 2B (20 MHz, FDD,  48 bits)
 struct DCI2B_20MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:16;
+  uint64_t padding:16;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2350,7 +2348,7 @@ typedef struct DCI2B_20MHz_FDD DCI2B_20MHz_FDD_t;
 
 /// DCI Format Type 2C (1.5 MHz, TDD,  34 bits)
 struct DCI2C_1_5MHz_TDD {
-  uint64_t padding64:30;
+  uint64_t padding:30;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2383,7 +2381,7 @@ typedef struct DCI2C_1_5MHz_TDD DCI2C_1_5MHz_TDD_t;
 /// DCI Format Type 2C (5 MHz, TDD,  41 bits)
 struct DCI2C_5MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:23;
+  uint64_t padding:23;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2418,7 +2416,7 @@ typedef struct DCI2C_5MHz_TDD DCI2C_5MHz_TDD_t;
 /// DCI Format Type 2C (10 MHz, TDD,  45 bits)
 struct DCI2C_10MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:19;
+  uint64_t padding:19;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2453,7 +2451,7 @@ typedef struct DCI2C_10MHz_TDD DCI2C_10MHz_TDD_t;
 /// DCI Format Type 2C (20 MHz, TDD,  53 bits)
 struct DCI2C_20MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:11;
+  uint64_t padding:11;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2488,7 +2486,7 @@ typedef struct DCI2C_20MHz_TDD DCI2C_20MHz_TDD_t;
 /// DCI Format Type 2C (1.5 MHz, FDD,  30 bits)
 struct DCI2C_1_5MHz_FDD {
   //padding for 32 bits
-  uint32_t padding32:2;
+  uint32_t padding:2;
   /// Redundancy version 2
   uint32_t rv2:2;
   /// New Data Indicator 2
@@ -2517,7 +2515,7 @@ typedef struct DCI2C_1_5MHz_FDD DCI2C_1_5MHz_FDD_t;
 /// DCI Format Type 2C (5 MHz, FDD,  38 bits)
 struct DCI2C_5MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:26;
+  uint64_t padding:26;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2548,7 +2546,7 @@ typedef struct DCI2C_5MHz_FDD DCI2C_5MHz_FDD_t;
 /// DCI Format Type 2C (10 MHz, FDD,  42 bits)
 struct DCI2C_10MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:22;
+  uint64_t padding:22;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2579,7 +2577,7 @@ typedef struct DCI2C_10MHz_FDD DCI2C_10MHz_FDD_t;
 /// DCI Format Type 2C (20 MHz, FDD,  50 bits)
 struct DCI2C_20MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:14;
+  uint64_t padding:14;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
@@ -2613,7 +2611,7 @@ typedef struct DCI2C_20MHz_FDD DCI2C_20MHz_FDD_t;
 
 /// DCI Format Type 2D (1.5 MHz, TDD,  36 bits)
 struct DCI2D_1_5MHz_TDD {
-  uint64_t padding64:28;
+  uint64_t padding:28;
   /// PDSCH REsource Mapping and Quasi-Co-Location Indicator
   uint64_t REMQCL:2;
   /// Redundancy version 2
@@ -2648,7 +2646,7 @@ typedef struct DCI2D_1_5MHz_TDD DCI2D_1_5MHz_TDD_t;
 /// DCI Format Type 2D (5 MHz, TDD,  43 bits)
 struct DCI2D_5MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:21;
+  uint64_t padding:21;
   /// PDSCH REsource Mapping and Quasi-Co-Location Indicator
   uint64_t REMQCL:2;
   /// Redundancy version 2
@@ -2685,7 +2683,7 @@ typedef struct DCI2D_5MHz_TDD DCI2D_5MHz_TDD_t;
 /// DCI Format Type 2D (10 MHz, TDD,  47 bits)
 struct DCI2D_10MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:17;
+  uint64_t padding:17;
   /// PDSCH REsource Mapping and Quasi-Co-Location Indicator
   uint64_t REMQCL:2;
   /// Redundancy version 2
@@ -2722,7 +2720,7 @@ typedef struct DCI2D_10MHz_TDD DCI2D_10MHz_TDD_t;
 /// DCI Format Type 2D (20 MHz, TDD,  55 bits)
 struct DCI2D_20MHz_TDD {
   /// padding to 64bits
-  uint64_t padding64:9;
+  uint64_t padding:9;
   /// PDSCH REsource Mapping and Quasi-Co-Location Indicator
   uint64_t REMQCL:2;
   /// Redundancy version 2
@@ -2759,7 +2757,7 @@ typedef struct DCI2D_20MHz_TDD DCI2D_20MHz_TDD_t;
 /// DCI Format Type 2D (1.5 MHz, FDD,  33 bits)
 struct DCI2D_1_5MHz_FDD {
   //padding for 33 bits
-  uint64_t padding64:31;
+  uint64_t padding:31;
   /// PDSCH REsource Mapping and Quasi-Co-Location Indicator
   uint64_t REMQCL:2;
   /// Redundancy version 2
@@ -2783,7 +2781,7 @@ struct DCI2D_1_5MHz_FDD {
   /// RB Assignment (ceil(log2(N_RB_DL/P)) bits)
   uint64_t rballoc:6;
   /// padding for ambiguity
-  uint64_t padding;
+  uint64_t padding0;
 } __attribute__ ((__packed__));
 
 typedef struct DCI2D_1_5MHz_FDD DCI2D_1_5MHz_FDD_t;
@@ -2792,7 +2790,7 @@ typedef struct DCI2D_1_5MHz_FDD DCI2D_1_5MHz_FDD_t;
 /// DCI Format Type 2D (5 MHz, FDD,  41 bits)
 struct DCI2D_5MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:23;
+  uint64_t padding:23;
   /// PDSCH REsource Mapping and Quasi-Co-Location Indicator
   uint64_t REMQCL:2;
   /// Redundancy version 2
@@ -2818,7 +2816,7 @@ struct DCI2D_5MHz_FDD {
   /// Resource Allocation Header
   uint64_t rah:1;
   /// padding for ambiguity
-  uint64_t padding:1;
+  uint64_t padding0:1;
 } __attribute__ ((__packed__));
 
 #define sizeof_DCI2D_5MHz_FDD_t 41
@@ -2827,7 +2825,7 @@ typedef struct DCI2D_5MHz_FDD DCI2D_5MHz_FDD_t;
 /// DCI Format Type 2D (10 MHz, FDD,  45 bits)
 struct DCI2D_10MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:19;
+  uint64_t padding:19;
   /// PDSCH REsource Mapping and Quasi-Co-Location Indicator
   uint64_t REMQCL:2;
   /// Redundancy version 2
@@ -2853,7 +2851,7 @@ struct DCI2D_10MHz_FDD {
   /// Resource Allocation Header
   uint64_t rah:1;
   /// padding for ambiguity
-  uint64_t padding:1;
+  uint64_t padding0:1;
 } __attribute__ ((__packed__));
 
 #define sizeof_DCI2D_10MHz_FDD_t 45
@@ -2862,7 +2860,7 @@ typedef struct DCI2D_10MHz_FDD DCI2D_10MHz_FDD_t;
 /// DCI Format Type 2D (20 MHz, FDD,  52 bits)
 struct DCI2D_20MHz_FDD {
   /// padding for 64-bit
-  uint64_t padding64:12;
+  uint64_t padding:12;
   /// Redundancy version 2
   uint64_t rv2:2;
   /// New Data Indicator 2
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/dci_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..60720e13b706c7112aa40e6a29bb0200200be355
--- /dev/null
+++ b/openair1/PHY/LTE_TRANSPORT/dci_NB_IoT.h
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file PHY/LTE_TRANSPORT/dci.h
+* \brief typedefs for LTE DCI structures from 36-212, V8.6 2009-03.  Limited to 5 MHz formats for the moment.Current LTE compliance V8.6 2009-03.
+* \author R. Knopp
+* \date 2011
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr
+* \note
+* \warning
+*/
+#ifndef __DCI_NB_IOT_H__
+#define __DCI_NB_IOT_H__
+
+//#ifndef USER_MODE
+//#include "PHY/types.h"
+//#else
+#include <stdint.h>
+//#endif
+
+typedef enum 
+{
+  DCIFormatN0 = 0,
+  DCIFormatN1,
+  DCIFormatN1_RA,//is for initial RA procedure (semi-static information) so maybe is not needed
+  DCIFormatN1_RAR,
+  DCIFormatN2,
+  DCIFormatN2_Ind,
+  DCIFormatN2_Pag,
+}DCI_format_NB_IoT_t;
+
+///  DCI Format Type 0 (180 kHz, 23 bits)
+struct DCIFormatN0{
+  /// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
+  uint8_t type;
+  /// Subcarrier indication, 6 bits
+  uint8_t scind;
+  /// Resourse Assignment (RU Assignment), 3 bits
+  uint8_t ResAssign;
+  /// Modulation and Coding Scheme, 4 bits
+  uint8_t mcs;
+  /// New Data Indicator, 1 bits
+  uint8_t ndi;
+  /// Scheduling Delay, 2 bits
+  uint8_t Scheddly;
+  /// Repetition Number, 3 bits
+  uint8_t RepNum;
+  /// Redundancy version for HARQ (only use 0 and 2), 1 bits
+  uint8_t rv;
+  /// DCI subframe repetition Number, 2 bits
+  uint8_t DCIRep;
+};
+
+typedef struct DCIFormatN0 DCIFormatN0_t;
+
+///  DCI Format Type N1 for User data
+struct DCIFormatN1{
+  /// type = 0 => DCI Format N0, type = 1 => DCI Format N1,1bits
+  uint8_t type;
+  //NPDCCH order indicator (set to 0), 1 bits
+  uint8_t orderIndicator;
+  // Scheduling Delay,3 bits
+  uint8_t Scheddly;
+  // Resourse Assignment (RU Assignment),3 bits
+  uint8_t ResAssign;
+  // Modulation and Coding Scheme,4 bits
+  uint8_t mcs;
+  // Repetition Number,4 bits
+  uint8_t RepNum;
+  // New Data Indicator,1 bits
+  uint8_t ndi;
+  // HARQ-ACK resource,4 bits
+  uint8_t HARQackRes;
+  // DCI subframe repetition Number,2 bits
+  uint8_t DCIRep;
+};
+
+
+typedef struct DCIFormatN1 DCIFormatN1_t;
+
+///  DCI Format Type N1 for initial RA
+struct DCIFormatN1_RA{
+  /// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
+  uint8_t type;
+  //NPDCCH order indicator (set to 0),1 bits
+  uint8_t orderIndicator;
+  // Start number of NPRACH repetiiton, 2 bits
+  uint8_t Scheddly;
+  // Subcarrier indication of NPRACH, 6 bits
+  uint8_t scind;
+  // All the remainging bits, 13 bits
+  uint8_t remaingingBits;
+};
+
+typedef struct DCIFormatN1_RA DCIFormatN1_RA_t;
+
+///  DCI Format Type N1 for User data
+struct DCIFormatN1_RAR{
+  /// type = 0 => DCI Format N0, type = 1 => DCI Format N1,1bits
+  uint8_t type;
+  //NPDCCH order indicator (set to 0), 1 bits
+  uint8_t orderIndicator;
+  // Scheduling Delay,3 bits
+  uint8_t Scheddly;
+  // Resourse Assignment (RU Assignment),3 bits
+  uint8_t ResAssign;
+  // Modulation and Coding Scheme,4 bits
+  uint8_t mcs;
+  // Repetition Number,4 bits
+  uint8_t RepNum;
+  // New Data Indicator,1 bits,reserved in the RAR
+  uint8_t ndi;
+  // HARQ-ACK resource,4 bits,reserved in the RAR
+  uint8_t HARQackRes;
+  // DCI subframe repetition Number,2 bits
+  uint8_t DCIRep;
+};
+
+typedef struct DCIFormatN1_RAR DCIFormatN1_RAR_t;
+
+//  DCI Format Type N2 for direct indication, 15 bits
+struct DCIFormatN2_Ind{
+  //Flag for paging(1)/direct indication(0), set to 0,1 bits
+  uint8_t type;
+  //Direct indication information, 8 bits
+  uint8_t directIndInf;
+  // Reserved information bits, 6 bits
+  uint8_t resInfoBits;
+};
+
+typedef struct DCIFormatN2_Ind DCIFormatN2_Ind_t;
+
+//  DCI Format Type N2 for Paging, 15 bits
+struct DCIFormatN2_Pag{
+  //Flag for paging(1)/direct indication(0), set to 1,1 bits
+  uint8_t type;
+  // Resourse Assignment (RU Assignment), 3 bits
+  uint8_t ResAssign;
+  // Modulation and Coding Scheme, 4 bits
+  uint8_t mcs;
+  // Repetition Number, 4 bits
+  uint8_t RepNum;
+  // Reserved 3 bits
+  uint8_t DCIRep;
+};
+
+typedef struct DCIFormatN2_Pag DCIFormatN2_Pag_t;
+
+typedef union DCI_CONTENT {
+ // 
+ DCIFormatN0_t DCIN0;
+ //
+ DCIFormatN1_t DCIN1;
+ //
+ DCIFormatN1_RA_t DCIN1_RA;
+ //
+ DCIFormatN1_RAR_t DCIN1_RAR;
+ //
+ DCIFormatN2_Ind_t DCIN2_Ind;
+ //
+ DCIFormatN2_Pag_t DCIN2_Pag;
+
+ }DCI_CONTENT;
+
+ /*Structure for packing*/
+
+ struct DCIN0{
+  /// DCI subframe repetition Number, 2 bits
+  uint8_t DCIRep:2;
+  /// New Data Indicator, 1 bits
+  uint8_t ndi:1;
+  /// Repetition Number, 3 bits
+  uint8_t RepNum:3;
+  /// Redundancy version for HARQ (only use 0 and 2), 1 bits
+  uint8_t rv:1;
+  /// Modulation and Coding Scheme, 4 bits
+  uint8_t mcs:4;
+  /// Scheduling Delay, 2 bits
+  uint8_t Scheddly:2;
+  /// Resourse Assignment (RU Assignment), 3 bits
+  uint8_t ResAssign:3;
+  /// Subcarrier indication, 6 bits
+  uint8_t scind:6;
+  /// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
+  uint8_t type:1;
+ } __attribute__ ((__packed__));
+
+ typedef struct DCIN0 DCIN0_t;
+#define sizeof_DCIN0_t 23
+
+struct DCIN1_RAR{
+  // DCI subframe repetition Number, 2 bits
+  uint8_t DCIRep:2;
+  // HARQ-ACK resource,4 bits
+  uint8_t HARQackRes:4; 
+  // New Data Indicator,1 bits
+  uint8_t ndi:1;
+  // Repetition Number, 4 bits
+  uint8_t RepNum:4;
+  // Modulation and Coding Scheme, 4 bits
+  uint8_t mcs:4;
+  // Resourse Assignment (RU Assignment), 3 bits
+  uint8_t ResAssign:3;
+  // Scheduling Delay, 3 bits
+  uint8_t Scheddly:3;
+  //NPDCCH order indicator (set to 0),1 bits
+  uint8_t orderIndicator:1;
+  /// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
+  uint8_t type:1;
+ } __attribute__ ((__packed__));
+
+ typedef struct DCIN1_RAR DCIN1_RAR_t;
+#define sizeof_DCIN1_RAR_t 23
+
+struct DCIN1{
+  // DCI subframe repetition Number, 2 bits
+  uint8_t DCIRep:2;
+  // HARQ-ACK resource,4 bits
+  uint8_t HARQackRes:4; 
+  // New Data Indicator,1 bits
+  uint8_t ndi:1;
+  // Repetition Number, 4 bits
+  uint8_t RepNum:4;
+  // Modulation and Coding Scheme, 4 bits
+  uint8_t mcs:4;
+  // Resourse Assignment (RU Assignment), 3 bits
+  uint8_t ResAssign:3;
+  // Scheduling Delay, 3 bits
+  uint8_t Scheddly:3;
+  //NPDCCH order indicator (set to 0),1 bits
+  uint8_t orderIndicator:1;
+  /// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
+  uint8_t type:1;
+ } __attribute__ ((__packed__));
+
+ typedef struct DCIN1 DCIN1_t;
+#define sizeof_DCIN1_t 23
+
+//  DCI Format Type N2 for direct indication, 15 bits
+struct DCIN2_Ind{
+  // Reserved information bits, 6 bits
+  uint8_t resInfoBits:6;
+  //Direct indication information, 8 bits
+  uint8_t directIndInf:8;
+  //Flag for paging(1)/direct indication(0), set to 0,1 bits
+  uint8_t type:1;
+} __attribute__ ((__packed__));;
+
+typedef struct DCIN2_Ind DCIN2_Ind_t;
+#define sizeof_DCIN2_Ind_t 15
+
+//  DCI Format Type N2 for Paging, 15 bits
+struct DCIN2_Pag{
+  // Reserved 3 bits
+  uint8_t DCIRep:3;
+  // Repetition Number, 4 bits
+  uint8_t RepNum:4;
+  // Modulation and Coding Scheme, 4 bits
+  uint8_t mcs:4;
+  // Resourse Assignment (RU Assignment), 3 bits
+  uint8_t ResAssign:3;
+  //Flag for paging(1)/direct indication(0), set to 1,1 bits
+  uint8_t type:1;
+} __attribute__ ((__packed__));;
+
+typedef struct DCIN2_Pag DCIN2_Pag_t;
+
+#define sizeof_DCIN2_Pag_t 15
+
+#define MAX_DCI_SIZE_BITS_NB_IoT 23
+
+#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
index 8a3047b5b2dac3aedd81088398610565f88865c2..4b73de6fcc72864fa1a55d7924819dab46cd5e14 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -810,8 +810,7 @@ int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
   for (i=0; i<NUMBER_OF_UE_MAX; i++) {
     AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i);
     AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i);
-    LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n",
-          rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
+    LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
     if ((eNB->dlsch[i][0]->harq_mask >0) &&
         (eNB->dlsch[i][0]->rnti==rnti))       return i;
     else if ((eNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
@@ -861,18 +860,164 @@ uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti)
 }
 */
 
-void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu) {
+void fill_pdcch_order(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu)
+{
+  LTE_DL_FRAME_PARMS                *fp      = &eNB->frame_parms;
+  uint8_t                           *dci_pdu = &dci_alloc->dci_pdu[0];
+  nfapi_dl_config_dci_dl_pdu_rel8_t *rel8    = &pdu->dci_dl_pdu_rel8;
 
-  LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
+  dci_alloc->firstCCE = rel8->cce_idx;
+  dci_alloc->L        = rel8->aggregation_level;
+  dci_alloc->rnti     = rel8->rnti;
+  dci_alloc->harq_pid = rel8->harq_process;
+  dci_alloc->ra_flag  = 0;
+  dci_alloc->format   = format1A;
+
+  LOG_D(PHY,"NFAPI: DCI format %d, nCCE %d, L %d, rnti %x,harq_pid %d\n",
+        rel8->dci_format,rel8->cce_idx,rel8->aggregation_level,rel8->rnti,rel8->harq_process);
+
+  switch (fp->N_RB_DL) {
+  case 6:
+    if (fp->frame_type == TDD) {
+      dci_alloc->dci_length                         = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->type     = 1;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->mcs      = rel8->mcs_1;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->ndi      = rel8->new_data_indicator_1;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->rballoc  = rel8->resource_block_coding;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->rv       = rel8->redundancy_version_1;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->TPC      = rel8->tpc;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;
+      ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->padding  = 0;
+    } else {
+      dci_alloc->dci_length                         = sizeof_DCI1A_1_5MHz_FDD_t;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->type         = 1;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->vrb_type     = rel8->virtual_resource_block_assignment_flag;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->mcs          = rel8->mcs_1;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->ndi          = rel8->new_data_indicator_1;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rballoc      = rel8->resource_block_coding;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rv           = rel8->redundancy_version_1;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC          = rel8->tpc;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid     = rel8->harq_process;
+      ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->padding      = 0;
+      //      printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+    }
+    break;
+  case 25:
+    if (fp->frame_type == TDD) {
+      dci_alloc->dci_length                         = sizeof_DCI1A_5MHz_TDD_1_6_t;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->type       = 1;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type   = rel8->virtual_resource_block_assignment_flag;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->mcs        = rel8->mcs_1;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->ndi        = rel8->new_data_indicator_1;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rballoc    = rel8->resource_block_coding;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rv         = rel8->redundancy_version_1;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->TPC        = rel8->tpc;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid   = rel8->harq_process;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->dai        = rel8->downlink_assignment_index;
+      ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->padding    = 0;
+       //        printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+    } else {
+      dci_alloc->dci_length                         = sizeof_DCI1A_5MHz_FDD_t;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->type           = 1;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->vrb_type       = rel8->virtual_resource_block_assignment_flag;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->mcs            = rel8->mcs_1;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->ndi            = rel8->new_data_indicator_1;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->rballoc        = rel8->resource_block_coding;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->rv             = rel8->redundancy_version_1;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->TPC            = rel8->tpc;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->harq_pid       = rel8->harq_process;
+      ((DCI1A_5MHz_FDD_t *)dci_pdu)->padding        = 0;
+      //      printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+    }
+    break;
+  case 50:
+    if (fp->frame_type == TDD) {
+      dci_alloc->dci_length                         = sizeof_DCI1A_10MHz_TDD_1_6_t;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->type      = 1;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->vrb_type  = rel8->virtual_resource_block_assignment_flag;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->mcs       = rel8->mcs_1;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->ndi       = rel8->new_data_indicator_1;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rballoc   = rel8->resource_block_coding;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rv        = rel8->redundancy_version_1;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->TPC       = rel8->tpc;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->harq_pid  = rel8->harq_process;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;
+      ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->padding   = 0;
+      //        printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+    } else {
+      dci_alloc->dci_length                         = sizeof_DCI1A_10MHz_FDD_t;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->type          = 1;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->vrb_type      = rel8->virtual_resource_block_assignment_flag;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->mcs           = rel8->mcs_1;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->ndi           = rel8->new_data_indicator_1;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->rballoc       = rel8->resource_block_coding;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->rv            = rel8->redundancy_version_1;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->TPC           = rel8->tpc;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->harq_pid      = rel8->harq_process;
+      ((DCI1A_10MHz_FDD_t *)dci_pdu)->padding       = 0;
+      //      printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+    }
+    break;
+  case 100:
+    if (fp->frame_type == TDD) {
+      dci_alloc->dci_length                         = sizeof_DCI1A_20MHz_TDD_1_6_t;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->type      = 1;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->vrb_type  = rel8->virtual_resource_block_assignment_flag;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->mcs       = rel8->mcs_1;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->ndi       = rel8->new_data_indicator_1;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rballoc   = rel8->resource_block_coding;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rv        = rel8->redundancy_version_1;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->TPC       = rel8->tpc;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid  = rel8->harq_process;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;
+      ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->padding   = 0;
+      //        printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+    } else {
+      dci_alloc->dci_length                         = sizeof_DCI1A_20MHz_FDD_t;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->type          = 1;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->vrb_type      = rel8->virtual_resource_block_assignment_flag;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->mcs           = rel8->mcs_1;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->ndi           = rel8->new_data_indicator_1;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->rballoc       = rel8->resource_block_coding;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->rv            = rel8->redundancy_version_1;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->TPC           = rel8->tpc;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->harq_pid      = rel8->harq_process;
+      ((DCI1A_20MHz_FDD_t *)dci_pdu)->padding       = 0;
+      //      printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
+    }
+    break;
+  }
 
+  LOG_I(PHY,"%d.%d: DCI 1A: rnti %x, PDCCH order to do PRACH\n",
+        proc->frame_tx, proc->subframe_tx, rel8->rnti);
+}
+
+void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu)
+{
+  LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
   uint8_t *dci_pdu = &dci_alloc->dci_pdu[0];
   nfapi_dl_config_dci_dl_pdu_rel8_t *rel8 = &pdu->dci_dl_pdu_rel8;
 
+  /* check if this is a DCI 1A PDCCH order for RAPROC */
+  if (rel8->dci_format == NFAPI_DL_DCI_FORMAT_1A && rel8->rnti_type == 1) {
+    int full_rb;
+    switch (fp->N_RB_DL) {
+    case 6:   full_rb = 63;   break;
+    case 25:  full_rb = 511;  break;
+    case 50:  full_rb = 2047; break;
+    case 100: full_rb = 8191; break;
+    default:  abort();
+    }
+    if (rel8->resource_block_coding == full_rb)
+      return fill_pdcch_order(eNB, proc, dci_alloc, pdu);
+  }
+
   LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
   LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
   int beamforming_mode = 0;
   int UE_id=-1;
-  int subframe = proc->subframe_tx;
   int NPRB;
   int TB0_active;
   int TB1_active;
@@ -885,8 +1030,8 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci
   dci_alloc->harq_pid = rel8->harq_process;
   dci_alloc->ra_flag  = 0;
 
-  LOG_D(PHY,"NFAPI: DCI format %d, nCCE %d, L %d, rnti %x,harq_pid %d\n",
-	rel8->dci_format,rel8->cce_idx,rel8->aggregation_level,rel8->rnti,rel8->harq_process);
+  LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:[SFN/SF:%04d%d] DCI format %d, nCCE %d, L %d, rnti %x, harq_pid %d\n",
+	frame,subframe,proc->frame_tx,proc->subframe_tx,rel8->dci_format,rel8->cce_idx,rel8->aggregation_level,rel8->rnti,rel8->harq_process);
   if ((rel8->rnti_type == 2 ) && (rel8->rnti != SI_RNTI) && (rel8->rnti != P_RNTI)) dci_alloc->ra_flag = 1;
 
   UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
@@ -902,6 +1047,14 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci
   dlsch1_harq                               = dlsch1->harq_processes[rel8->harq_process];
   dlsch1_harq->codeword                     = 1;
   dlsch0->subframe_tx[subframe]             = 1;
+
+  LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d dlsch0[rnti:%x harq_mask:%04x] dci_pdu[rnti:%x rnti_type:%d harq_process:%d ndi1:%d] dlsch0_harq[round:%d harq_mask:%x ndi:%d]\n", 
+      frame,subframe,
+      proc->frame_tx,proc->subframe_tx,
+      dlsch0->rnti,dlsch0->harq_mask,
+      rel8->rnti, rel8->rnti_type, rel8->harq_process, rel8->new_data_indicator_1,
+      dlsch0_harq->round, dlsch0->harq_mask, dlsch0_harq->ndi);
+
   if (dlsch0->rnti != rel8->rnti) { // if rnti of dlsch is not the same as in the config, this is a new entry
     dlsch0_harq->round=0;
     dlsch0->harq_mask=0;
@@ -918,15 +1071,19 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci
   dlsch0->active        = 1;
   if (rel8->rnti_type == 2)
       dlsch0_harq->round    = 0;
-LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n",rel8->harq_process,dlsch0->harq_mask,dlsch0_harq->round,
-	dlsch0_harq->ndi,rel8->new_data_indicator_1, rel8->rnti_type);
+
+  LOG_D(PHY,"NFAPI: rel8[rnti %x dci_format %d harq_process %d ndi1 %d rnti type %d] dlsch0[rnti %x harq_mask %x] dlsch0_harq[round %d ndi %d]\n",
+      rel8->rnti,rel8->dci_format,rel8->harq_process, rel8->new_data_indicator_1, rel8->rnti_type,
+      dlsch0->rnti,dlsch0->harq_mask,
+      dlsch0_harq->round,dlsch0_harq->ndi
+      );
 
   switch (rel8->dci_format) {
 
   case NFAPI_DL_DCI_FORMAT_1A:
 
-      AssertFatal(rel8->resource_block_coding < 8192, "Frame %d, Subframe %d: rel8->resource_block_coding (%p) %u >= 8192 (rnti %x, rnti_type %d, format %d, harq_id %d\n",
-                proc->frame_tx,subframe,
+      AssertFatal(rel8->resource_block_coding < 8192, "SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: rel8->resource_block_coding (%p) %u >= 8192 (rnti %x, rnti_type %d, format %d, harq_id %d\n",
+                frame,subframe,proc->frame_tx,subframe,
                 &rel8->resource_block_coding,rel8->resource_block_coding,rel8->rnti,rel8->rnti_type,rel8->dci_format,rel8->harq_process);
   
 
@@ -945,6 +1102,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->TPC      = rel8->tpc;
         ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process;
         ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;
+        ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->padding  = 0;
 	
       } else {
 	dci_alloc->dci_length                         = sizeof_DCI1A_1_5MHz_FDD_t; 
@@ -956,13 +1114,9 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rv           = rel8->redundancy_version_1;
         ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC          = rel8->tpc;
         ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid     = rel8->harq_process;
+        ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->padding      = 0;
         //      printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
-      // check if PDCCH order
-      if (rel8->resource_block_coding == 63) { 
-          dlsch0->active        = 0;
-          return;
-      }
       AssertFatal(rel8->virtual_resource_block_assignment_flag==LOCALIZED,"Distributed RB allocation not done yet\n");
       dlsch0_harq->rb_alloc[0]    = localRIV2alloc_LUT6[rel8->resource_block_coding];
       dlsch0_harq->vrb_type           =  rel8->virtual_resource_block_assignment_flag;
@@ -979,7 +1133,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rv         = rel8->redundancy_version_1;
         ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->TPC        = rel8->tpc;
         ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid   = rel8->harq_process;
-        ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->dai      = rel8->downlink_assignment_index; 	
+        ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->dai        = rel8->downlink_assignment_index;
+        ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->padding    = 0;
          //        printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                         = sizeof_DCI1A_5MHz_FDD_t; 
@@ -991,14 +1146,9 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1A_5MHz_FDD_t *)dci_pdu)->rv             = rel8->redundancy_version_1;
         ((DCI1A_5MHz_FDD_t *)dci_pdu)->TPC            = rel8->tpc;
         ((DCI1A_5MHz_FDD_t *)dci_pdu)->harq_pid       = rel8->harq_process;
+        ((DCI1A_5MHz_FDD_t *)dci_pdu)->padding        = 0;
         //      printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
-
-      // check if PDCCH order
-	  if (rel8->resource_block_coding == 511)  {
-          dlsch0->active        = 0;
-          return;
-      }
       AssertFatal(rel8->virtual_resource_block_assignment_flag==LOCALIZED,"Distributed RB allocation not done yet\n");
       dlsch0_harq->rb_alloc[0]    = localRIV2alloc_LUT25[rel8->resource_block_coding];
       dlsch0_harq->vrb_type           =  rel8->virtual_resource_block_assignment_flag;
@@ -1015,7 +1165,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rv        = rel8->redundancy_version_1;
         ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->TPC       = rel8->tpc;
         ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->harq_pid  = rel8->harq_process;
-        ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;	
+        ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;
+        ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->padding   = 0;
         //        printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                         = sizeof_DCI1A_10MHz_FDD_t; 
@@ -1027,13 +1178,9 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1A_10MHz_FDD_t *)dci_pdu)->rv            = rel8->redundancy_version_1;
         ((DCI1A_10MHz_FDD_t *)dci_pdu)->TPC           = rel8->tpc;
         ((DCI1A_10MHz_FDD_t *)dci_pdu)->harq_pid      = rel8->harq_process;
+        ((DCI1A_10MHz_FDD_t *)dci_pdu)->padding       = 0;
 	//      printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
-      // check if PDCCH order
-      if (rel8->resource_block_coding == 2047) {
-          dlsch0->active        = 0;
-          return;
-      }
       AssertFatal(rel8->virtual_resource_block_assignment_flag==LOCALIZED,"Distributed RB allocation not done yet\n");
       dlsch0_harq->rb_alloc[0]     = localRIV2alloc_LUT50_0[rel8->resource_block_coding];
       dlsch0_harq->rb_alloc[1]     = localRIV2alloc_LUT50_1[rel8->resource_block_coding];
@@ -1051,7 +1198,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rv        = rel8->redundancy_version_1;
         ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->TPC       = rel8->tpc;
         ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid  = rel8->harq_process;
-        ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;	
+        ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;
+        ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->padding   = 0;
         //        printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                         = sizeof_DCI1A_20MHz_FDD_t; 
@@ -1063,13 +1211,9 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1A_20MHz_FDD_t *)dci_pdu)->rv            = rel8->redundancy_version_1;
         ((DCI1A_20MHz_FDD_t *)dci_pdu)->TPC           = rel8->tpc;
         ((DCI1A_20MHz_FDD_t *)dci_pdu)->harq_pid      = rel8->harq_process;
+        ((DCI1A_20MHz_FDD_t *)dci_pdu)->padding       = 0;
 	//      printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
-      // check if PDCCH order
-      if (rel8->resource_block_coding == 8191) {
-          dlsch0->active        = 0;
-          return;
-      }
       AssertFatal(rel8->virtual_resource_block_assignment_flag==LOCALIZED,"Distributed RB allocation not done yet\n");
       dlsch0_harq->rb_alloc[0]      = localRIV2alloc_LUT100_0[rel8->resource_block_coding];
       dlsch0_harq->rb_alloc[1]      = localRIV2alloc_LUT100_1[rel8->resource_block_coding];
@@ -1090,7 +1234,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
       NPRB      = dlsch0_harq->nb_rb;
       I_mcs     = get_I_TBS(rel8->mcs_1);
     }
-    AssertFatal(NPRB>0,"DCI 1A: NPRB = 0 (rnti %x, rnti type %d, tpc %d, round %d, resource_block_coding %d)\n",rel8->rnti,rel8->rnti_type,rel8->tpc,dlsch0_harq->round,rel8->resource_block_coding);
+    AssertFatal(NPRB>0,"DCI 1A: NPRB = 0 (rnti %x, rnti type %d, tpc %d, round %d, resource_block_coding %d, harq process %d)\n",rel8->rnti,rel8->rnti_type,rel8->tpc,dlsch0_harq->round,rel8->resource_block_coding,rel8->harq_process);
     dlsch0_harq->rvidx         = rel8->redundancy_version_1;
     dlsch0_harq->Nl            = 1;
     dlsch0_harq->mimo_mode     = (fp->nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI;
@@ -1110,7 +1254,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
 
     dlsch0->harq_mask            |= (1<<rel8->harq_process);
 
-    if (rel8->rnti_type == 1) LOG_I(PHY,"DCI 1A: round %d, mcs %d, rballoc %x,rv %d, rnti %x\n",dlsch0_harq->round,rel8->mcs_1,rel8->resource_block_coding,rel8->redundancy_version_1,rel8->rnti);
+    if (rel8->rnti_type == 1) LOG_I(PHY,"DCI 1A: round %d, mcs %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,rel8->resource_block_coding,rel8->redundancy_version_1,rel8->rnti,rel8->harq_process);
 
     break;
   case NFAPI_DL_DCI_FORMAT_1:
@@ -1118,7 +1262,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
     dci_alloc->format           = format1;
     dlsch0->active              = 1;
 
-    LOG_D(PHY,"Frame %d, Subframe %d: Programming DLSCH for Format 1 DCI, harq_pid %d\n",proc->frame_tx,subframe,rel8->harq_process);
+    LOG_D(PHY,"SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: Programming DLSCH for Format 1 DCI, harq_pid %d\n",frame,subframe,proc->frame_tx,subframe,rel8->harq_process);
 
     switch (fp->N_RB_DL) {
     case 6:
@@ -1131,7 +1275,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1_1_5MHz_TDD_t *)dci_pdu)->rv        = rel8->redundancy_version_1;
         ((DCI1_1_5MHz_TDD_t *)dci_pdu)->TPC       = rel8->tpc;
         ((DCI1_1_5MHz_TDD_t *)dci_pdu)->harq_pid  = rel8->harq_process;
-        ((DCI1_1_5MHz_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index; 	
+        ((DCI1_1_5MHz_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;
+        ((DCI1_1_5MHz_TDD_t *)dci_pdu)->padding   = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                         = sizeof_DCI1_1_5MHz_FDD_t; 
@@ -1142,6 +1287,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1_1_5MHz_FDD_t *)dci_pdu)->rv            = rel8->redundancy_version_1;
         ((DCI1_1_5MHz_FDD_t *)dci_pdu)->TPC           = rel8->tpc;
         ((DCI1_1_5MHz_FDD_t *)dci_pdu)->harq_pid      = rel8->harq_process;
+        ((DCI1_1_5MHz_FDD_t *)dci_pdu)->padding       = 0;
         //      printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
       break;
@@ -1155,7 +1301,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1_5MHz_TDD_t *)dci_pdu)->rv       = rel8->redundancy_version_1;
         ((DCI1_5MHz_TDD_t *)dci_pdu)->TPC      = rel8->tpc;
         ((DCI1_5MHz_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
-        ((DCI1_5MHz_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;	
+        ((DCI1_5MHz_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;
+        ((DCI1_5MHz_TDD_t *)dci_pdu)->padding  = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                  = sizeof_DCI1_5MHz_FDD_t; 
@@ -1166,6 +1313,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1_5MHz_FDD_t *)dci_pdu)->rv       = rel8->redundancy_version_1;
         ((DCI1_5MHz_FDD_t *)dci_pdu)->TPC      = rel8->tpc;
         ((DCI1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
+        ((DCI1_5MHz_FDD_t *)dci_pdu)->padding  = 0;
         //      printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
       break;
@@ -1179,7 +1327,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1_10MHz_TDD_t *)dci_pdu)->rv       = rel8->redundancy_version_1;
         ((DCI1_10MHz_TDD_t *)dci_pdu)->TPC      = rel8->tpc;
         ((DCI1_10MHz_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
-        ((DCI1_10MHz_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;	
+        ((DCI1_10MHz_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;
+        ((DCI1_10MHz_TDD_t *)dci_pdu)->padding  = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                   = sizeof_DCI1_10MHz_FDD_t; 
@@ -1190,6 +1339,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1_10MHz_FDD_t *)dci_pdu)->rv       = rel8->redundancy_version_1;
         ((DCI1_10MHz_FDD_t *)dci_pdu)->TPC      = rel8->tpc;
         ((DCI1_10MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
+        ((DCI1_10MHz_FDD_t *)dci_pdu)->padding  = 0;
       }
       break;
     case 100:
@@ -1202,7 +1352,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1_20MHz_TDD_t *)dci_pdu)->rv       = rel8->redundancy_version_1;
         ((DCI1_20MHz_TDD_t *)dci_pdu)->TPC      = rel8->tpc;
         ((DCI1_20MHz_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
-        ((DCI1_20MHz_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;	
+        ((DCI1_20MHz_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;
+        ((DCI1_20MHz_TDD_t *)dci_pdu)->padding  = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                   = sizeof_DCI1_20MHz_FDD_t; 
@@ -1213,6 +1364,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI1_20MHz_FDD_t *)dci_pdu)->rv       = rel8->redundancy_version_1;
         ((DCI1_20MHz_FDD_t *)dci_pdu)->TPC      = rel8->tpc;
         ((DCI1_20MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
+        ((DCI1_20MHz_FDD_t *)dci_pdu)->padding  = 0;
       }
       break;
     }
@@ -1297,6 +1449,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
 	((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->tb_swap  = rel8->transport_block_to_codeword_swap_flag;
         ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;
+        /* there is no padding in this structure, it is exactly 32 bits */
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                         = sizeof_DCI2A_1_5MHz_2A_FDD_t; 
@@ -1311,6 +1464,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->TPC          = rel8->tpc;
         ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->harq_pid     = rel8->harq_process;
 	((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->tb_swap      = rel8->transport_block_to_codeword_swap_flag;
+	((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->padding      = 0;
         //      printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
       break;
@@ -1327,8 +1481,9 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rv2       = rel8->redundancy_version_2;
         ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->TPC       = rel8->tpc;
         ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->harq_pid  = rel8->harq_process;
-	((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;	
-        ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;	
+	((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;
+        ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;
+        ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->padding   = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                           = sizeof_DCI2A_5MHz_2A_FDD_t; 
@@ -1343,6 +1498,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->TPC           = rel8->tpc;
         ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->harq_pid      = rel8->harq_process;
 	((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->tb_swap       = rel8->transport_block_to_codeword_swap_flag;	
+	((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->padding       = 0;
         //      printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
       break;
@@ -1359,8 +1515,9 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rv2      = rel8->redundancy_version_2;
         ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->TPC      = rel8->tpc;
         ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process;
-	((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->tb_swap  = rel8->transport_block_to_codeword_swap_flag;	
-        ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;	
+	((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->tb_swap  = rel8->transport_block_to_codeword_swap_flag;
+        ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;
+        ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->padding  = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                        = sizeof_DCI2A_10MHz_2A_FDD_t; 
@@ -1374,7 +1531,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rv2       = rel8->redundancy_version_2;
         ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->TPC       = rel8->tpc;
         ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->harq_pid  = rel8->harq_process;
-	((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;	
+	((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;
+	((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->padding   = 0;
       }
       break;
     case 100:
@@ -1390,8 +1548,9 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rv2       = rel8->redundancy_version_2;
         ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->TPC       = rel8->tpc;
         ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->harq_pid  = rel8->harq_process;
-	((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;		
-        ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;	
+	((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;
+        ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;
+        ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->padding   = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                           = sizeof_DCI2A_20MHz_2A_FDD_t; 
@@ -1405,7 +1564,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rv2          = rel8->redundancy_version_2;
         ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->TPC          = rel8->tpc;
         ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->harq_pid     = rel8->harq_process;
-	((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap      = rel8->transport_block_to_codeword_swap_flag;	
+	((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap      = rel8->transport_block_to_codeword_swap_flag;
+	((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->padding      = 0;
       }
       break;
 
@@ -1608,6 +1768,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
 	((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->tb_swap  = rel8->transport_block_to_codeword_swap_flag;
         ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;
         ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->tpmi     = rel8->precoding_information;
+        ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->padding  = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                         = sizeof_DCI2_1_5MHz_2A_FDD_t; 
@@ -1622,6 +1783,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->harq_pid     = rel8->harq_process;
 	((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->tb_swap      = rel8->transport_block_to_codeword_swap_flag;
         ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->tpmi         = rel8->precoding_information;
+        ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->padding      = 0;
         //      printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
       break;
@@ -1641,6 +1803,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
 	((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;	
         ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;	
         ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tpmi      = rel8->precoding_information;
+        ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->padding   = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                           = sizeof_DCI2_5MHz_2A_FDD_t; 
@@ -1655,7 +1818,8 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->TPC           = rel8->tpc;
         ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->harq_pid      = rel8->harq_process;
 	((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tb_swap       = rel8->transport_block_to_codeword_swap_flag;
-        ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tpmi     = rel8->precoding_information;	
+        ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tpmi          = rel8->precoding_information;
+        ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->padding       = 0;
         //      printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       }
       break;
@@ -1675,6 +1839,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
 	((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tb_swap  = rel8->transport_block_to_codeword_swap_flag;	
         ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->dai      = rel8->downlink_assignment_index;	
         ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tpmi     = rel8->precoding_information;
+        ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->padding  = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
 	dci_alloc->dci_length                        = sizeof_DCI2_10MHz_2A_FDD_t; 
@@ -1688,13 +1853,14 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rv2       = rel8->redundancy_version_2;
         ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->TPC       = rel8->tpc;
         ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->harq_pid  = rel8->harq_process;
-	((DCI2_10MHz_2A_FDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;	
+	((DCI2_10MHz_2A_FDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;
         ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tpmi      = rel8->precoding_information;
+        ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->padding   = 0;
       }
       break;
     case 100:
       if (fp->frame_type == TDD) {
-	dci_alloc->dci_length                        = sizeof_DCI2_20MHz_2A_TDD_t; 
+	dci_alloc->dci_length                        = sizeof_DCI2_20MHz_2A_TDD_t;
         ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rah       = rel8->resource_allocation_type;
         ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->mcs1      = rel8->mcs_1;
         ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->mcs2      = rel8->mcs_2;
@@ -1705,12 +1871,13 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rv2       = rel8->redundancy_version_2;
         ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->TPC       = rel8->tpc;
         ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->harq_pid  = rel8->harq_process;
-	((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;		
-        ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;	
+	((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tb_swap   = rel8->transport_block_to_codeword_swap_flag;
+        ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->dai       = rel8->downlink_assignment_index;
         ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tpmi      = rel8->precoding_information;
+        ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->padding   = 0;
         //        printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB);
       } else {
-	dci_alloc->dci_length                           = sizeof_DCI2_20MHz_2A_FDD_t; 
+	dci_alloc->dci_length                           = sizeof_DCI2_20MHz_2A_FDD_t;
         ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rah          = rel8->resource_allocation_type;
         ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->mcs1         = rel8->mcs_1;
         ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->mcs2         = rel8->mcs_2;
@@ -1721,8 +1888,9 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
         ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rv2          = rel8->redundancy_version_2;
         ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->TPC          = rel8->tpc;
         ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->harq_pid     = rel8->harq_process;
-	((DCI2_20MHz_2A_FDD_t *)dci_pdu)->tb_swap      = rel8->transport_block_to_codeword_swap_flag;	
+	((DCI2_20MHz_2A_FDD_t *)dci_pdu)->tb_swap      = rel8->transport_block_to_codeword_swap_flag;
         ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tpmi         = rel8->precoding_information;
+        ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->padding      = 0;
       }
       break;
 
@@ -1975,11 +2143,11 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
   }
 
   if (dlsch0_harq) {
-    dlsch0_harq->frame    = proc->frame_tx;
+    dlsch0_harq->frame    = frame;
     dlsch0_harq->subframe = subframe;
   }
   if (dlsch1_harq) {
-    dlsch1_harq->frame    = proc->frame_tx;
+    dlsch1_harq->frame    = frame;
     dlsch1_harq->subframe = subframe;
   }
 
@@ -2017,7 +2185,7 @@ LOG_D(PHY,"NFAPI: harq_pid %d harq_mask %x, round %d ndi (%d,%d) rnti type %d\n"
     
 #if T_TRACER
   if (dlsch0->active)
-    T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(proc->frame_tx), T_INT(proc->subframe_tx),
+    T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame), T_INT(subframe),
       T_INT(rel8->rnti), T_INT(rel8->dci_format), T_INT(rel8->harq_process),
       T_INT(rel8->mcs_1), T_INT(dlsch0_harq->TBS));
 #endif
@@ -2083,6 +2251,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       ((DCI6_1A_5MHz_t *)dci_pdu)->srs_req      = rel13->srs_request;
       ((DCI6_1A_5MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
       ((DCI6_1A_5MHz_t *)dci_pdu)->dci_rep      = rel13->dci_subframe_repetition_number-1;
+      ((DCI6_1A_5MHz_t *)dci_pdu)->padding      = 0;
     
       break;
     case 50:
@@ -2099,6 +2268,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       ((DCI6_1A_10MHz_t *)dci_pdu)->srs_req      = rel13->srs_request;
       ((DCI6_1A_10MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
       ((DCI6_1A_10MHz_t *)dci_pdu)->dci_rep      = rel13->dci_subframe_repetition_number-1;
+      ((DCI6_1A_10MHz_t *)dci_pdu)->padding      = 0;
       break;
     case 100:
       dci_alloc->dci_length                     = sizeof_DCI6_1A_20MHz_t; 
@@ -2114,6 +2284,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       ((DCI6_1A_20MHz_t *)dci_pdu)->srs_req      = rel13->srs_request;
       ((DCI6_1A_20MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
       ((DCI6_1A_20MHz_t *)dci_pdu)->dci_rep      = rel13->dci_subframe_repetition_number-1;
+      ((DCI6_1A_20MHz_t *)dci_pdu)->padding      = 0;
       break;
     }
     break;
@@ -2132,6 +2303,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       ((DCI6_1B_5MHz_t *)dci_pdu)->ndi          = rel13->new_data_indicator;
       ((DCI6_1B_5MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
       ((DCI6_1B_5MHz_t *)dci_pdu)->dci_rep      = rel13->dci_subframe_repetition_number-1;
+      ((DCI6_1B_5MHz_t *)dci_pdu)->padding      = 0;
   
       break;
     case 50:
@@ -2144,6 +2316,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       ((DCI6_1B_10MHz_t *)dci_pdu)->ndi          = rel13->new_data_indicator;
       ((DCI6_1B_10MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
       ((DCI6_1B_10MHz_t *)dci_pdu)->dci_rep      = rel13->dci_subframe_repetition_number-1;
+      ((DCI6_1B_10MHz_t *)dci_pdu)->padding      = 0;
       break;
     case 100:
       dci_alloc->dci_length                      = sizeof_DCI6_1B_20MHz_t; 
@@ -2155,6 +2328,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       ((DCI6_1B_20MHz_t *)dci_pdu)->ndi          = rel13->new_data_indicator;
       ((DCI6_1B_20MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
       ((DCI6_1B_20MHz_t *)dci_pdu)->dci_rep      = rel13->dci_subframe_repetition_number-1;
+      ((DCI6_1B_20MHz_t *)dci_pdu)->padding      = 0;
       break;
     }
   case 12: // Format 6-2
@@ -2166,6 +2340,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       if (rel13->paging_direct_indication_differentiation_flag==0) {
 	((DCI6_2_di_5MHz_t *)dci_pdu)->type    = 0;
 	((DCI6_2_di_5MHz_t *)dci_pdu)->di_info = rel13->direct_indication;
+	((DCI6_2_di_5MHz_t *)dci_pdu)->padding = 0;
       }
       else {
 	((DCI6_2_paging_5MHz_t *)dci_pdu)->type    = 1;
@@ -2173,6 +2348,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
 	((DCI6_2_paging_5MHz_t *)dci_pdu)->mcs     = rel13->mcs;
 	((DCI6_2_paging_5MHz_t *)dci_pdu)->rep     = (rel13->pdsch_reptition_levels-1);
 	((DCI6_2_paging_5MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1;
+	((DCI6_2_paging_5MHz_t *)dci_pdu)->padding = 0;
       }
 
     break;
@@ -2181,6 +2357,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       if (rel13->paging_direct_indication_differentiation_flag==0) {
 	((DCI6_2_di_10MHz_t *)dci_pdu)->type    = 0;
 	((DCI6_2_di_10MHz_t *)dci_pdu)->di_info = rel13->direct_indication;
+	((DCI6_2_di_10MHz_t *)dci_pdu)->padding = 0;
       }
       else {
 	((DCI6_2_paging_10MHz_t *)dci_pdu)->type    = 1;
@@ -2188,6 +2365,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
 	((DCI6_2_paging_10MHz_t *)dci_pdu)->mcs     = rel13->mcs;
 	((DCI6_2_paging_10MHz_t *)dci_pdu)->rep     = (rel13->pdsch_reptition_levels-1);
 	((DCI6_2_paging_10MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1;
+	((DCI6_2_paging_10MHz_t *)dci_pdu)->padding = 0;
       }
 
     break;
@@ -2196,6 +2374,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
       if (rel13->paging_direct_indication_differentiation_flag==0) {
 	((DCI6_2_di_20MHz_t *)dci_pdu)->type    = 0;
 	((DCI6_2_di_20MHz_t *)dci_pdu)->di_info = rel13->direct_indication;
+	((DCI6_2_di_20MHz_t *)dci_pdu)->padding = 0;
       }
       else {
 	((DCI6_2_paging_20MHz_t *)dci_pdu)->type    = 1;
@@ -2203,6 +2382,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
 	((DCI6_2_paging_20MHz_t *)dci_pdu)->mcs     = rel13->mcs;
 	((DCI6_2_paging_20MHz_t *)dci_pdu)->rep     = (rel13->pdsch_reptition_levels-1);
 	((DCI6_2_paging_20MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1;
+	((DCI6_2_paging_20MHz_t *)dci_pdu)->padding = 0;
       }
 
       break;
@@ -2264,8 +2444,8 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
 
 }
 
-void fill_dci0(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,
-               nfapi_hi_dci0_dci_pdu *pdu)
+void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
+    DCI_ALLOC_t *dci_alloc,nfapi_hi_dci0_dci_pdu *pdu)
 {
   LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
 
@@ -2282,21 +2462,23 @@ void fill_dci0(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,
   uint32_t ndi     = pdu->dci_pdu_rel8.new_data_indication_1;
 
 #ifdef T_TRACER
-  T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(proc->subframe_tx),
-    T_INT(pdu->dci_pdu_rel8.rnti), T_INT(((proc->frame_tx*10+proc->subframe_tx+4) % 8) /* TODO: correct harq pid */),
+  T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
+    T_INT(pdu->dci_pdu_rel8.rnti), T_INT(((frame*10+subframe+4) % 8) /* TODO: correct harq pid */),
     T_INT(mcs), T_INT(-1 /* TODO: remove round? */),
     T_INT(pdu->dci_pdu_rel8.resource_block_start),
     T_INT(pdu->dci_pdu_rel8.number_of_resource_block),
-    T_INT(-1 /* TODO: get TBS */),
+    T_INT(get_TBS_UL(mcs, pdu->dci_pdu_rel8.number_of_resource_block) * 8),
     T_INT(pdu->dci_pdu_rel8.aggregation_level),
     T_INT(pdu->dci_pdu_rel8.cce_index));
 #endif
 
   void *dci_pdu = (void*)dci_alloc->dci_pdu;
 
-  LOG_D(PHY,"Filling DCI0 with cqi %d, mcs %d, hopping %d, rballoc %x (%d,%d) ndi %d TPC %d cshift %d\n",cqi_req,
-	mcs,hopping,rballoc,pdu->dci_pdu_rel8.resource_block_start,pdu->dci_pdu_rel8.number_of_resource_block,
-	ndi,TPC,cshift);
+  LOG_D(PHY,"SFN/SF:%04d%d DCI0[rnti %x cqi %d mcs %d hopping %d rballoc %x (%d,%d) ndi %d TPC %d cshift %d]\n",
+        frame,subframe,
+        pdu->dci_pdu_rel8.rnti,cqi_req, mcs,hopping,rballoc,
+        pdu->dci_pdu_rel8.resource_block_start,
+        pdu->dci_pdu_rel8.number_of_resource_block, ndi,TPC,cshift);
 
   dci_alloc->format   = format0;
   dci_alloc->firstCCE = pdu->dci_pdu_rel8.cce_index;
@@ -2456,10 +2638,10 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
   ulsch->harq_processes[harq_pid]->dci_alloc                             = 1;
   ulsch->harq_processes[harq_pid]->rar_alloc                             = 0;
   ulsch->harq_processes[harq_pid]->n_DMRS                                = ulsch_pdu->ulsch_pdu_rel8.cyclic_shift_2_for_drms;
-
+  
   ulsch->harq_processes[harq_pid]->Nsymb_pusch                           = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1);
   ulsch->harq_processes[harq_pid]->srs_active                            = use_srs;
-
+  
   //Mapping of cyclic shift field in DCI format0 to n_DMRS2 (3GPP 36.211, Table 5.5.2.1.1-1)
   if(ulsch->harq_processes[harq_pid]->n_DMRS == 0)
     ulsch->harq_processes[harq_pid]->n_DMRS2 = 0;
@@ -2477,23 +2659,26 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
     ulsch->harq_processes[harq_pid]->n_DMRS2 = 10;
   else if(ulsch->harq_processes[harq_pid]->n_DMRS == 7)
     ulsch->harq_processes[harq_pid]->n_DMRS2 = 9;
-
-  LOG_D(PHY,"[eNB %d][PUSCH %d] Programming PUSCH with n_DMRS2 %d (cshift %d) for Frame %d, Subframe %d\n",
-	eNB->Mod_id,harq_pid,ulsch->harq_processes[harq_pid]->n_DMRS2,ulsch->harq_processes[harq_pid]->n_DMRS,
-	frame,subframe);
-
+  
+  LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, Subframe %d Programming PUSCH with n_DMRS2 %d (cshift %d) ulsch:ndi:%d ulsch_pdu:ndi:%d new_ulsch:%d status:%d ulsch_pdu:rvidx:%d\n",
+	eNB->Mod_id,harq_pid,frame,subframe,
+        ulsch->harq_processes[harq_pid]->n_DMRS2,
+        ulsch->harq_processes[harq_pid]->n_DMRS,
+	ulsch->harq_processes[harq_pid]->ndi, ulsch_pdu->ulsch_pdu_rel8.new_data_indication, new_ulsch, ulsch->harq_processes[harq_pid]->status,
+	ulsch_pdu->ulsch_pdu_rel8.redundancy_version);
+  
   ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version;
   ulsch->harq_processes[harq_pid]->Qm    = ulsch_pdu->ulsch_pdu_rel8.modulation_type;
-  // Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be
+  // Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be 
   ulsch->harq_processes[harq_pid]->O_ACK         = 0;
 
   if ((ulsch->harq_processes[harq_pid]->status == SCH_IDLE) ||
       (ulsch->harq_processes[harq_pid]->ndi    != ulsch_pdu->ulsch_pdu_rel8.new_data_indication) ||
 	  (new_ulsch == TRUE)){
     ulsch->harq_processes[harq_pid]->status        = ACTIVE;
-
+    
     ulsch->harq_processes[harq_pid]->TBS           = ulsch_pdu->ulsch_pdu_rel8.size<<3;
-
+    
     ulsch->harq_processes[harq_pid]->Msc_initial   = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
     ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->harq_processes[harq_pid]->Nsymb_pusch;
     ulsch->harq_processes[harq_pid]->round         = 0;
@@ -2503,23 +2688,25 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
     // will be set if MAC has activated ULSCH_CQI_RI_PDU or ULSCH_CQI_HARQ_RI_PDU
     ulsch->harq_processes[harq_pid]->Or1           = 0;
     ulsch->harq_processes[harq_pid]->Or2           = 0;
-  }
+  } 
   else  ulsch->harq_processes[harq_pid]->round++;
 
   ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti;
-  LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
+  LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
 	ulsch->rnti,
         UE_id,
         new_ulsch,
 	frame,
 	subframe,
 	harq_pid,
+	ulsch->harq_processes[harq_pid]->status,
+	ulsch->harq_processes[harq_pid]->handled,
 	ulsch->harq_processes[harq_pid]->first_rb,
 	ulsch->harq_processes[harq_pid]->nb_rb,
 	ulsch->harq_processes[harq_pid]->rvidx,
 	ulsch->harq_processes[harq_pid]->Qm,
 	ulsch->harq_processes[harq_pid]->TBS,
-	ulsch->harq_processes[harq_pid]->round);
+	ulsch->harq_processes[harq_pid]->round);  
 }
 
 int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
@@ -4494,13 +4681,13 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
 
     if(harq_pid>=8)
     {
-        LOG_I(PHY,"bad harq id \n");
+      //        LOG_I(PHY,"bad harq id \n");
         return(0);
     }
 
     if(dci_format == format1 && ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) )
     {
-        LOG_I(PHY,"bad dci format \n");
+      //        LOG_I(PHY,"bad dci format \n");
         return(0);
     }
 
@@ -4509,13 +4696,13 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
     {
         if(pdlsch0_harq->round == 0)
         {
-            LOG_I(PHY,"bad dci mcs + round \n");
+	  //            LOG_I(PHY,"bad dci mcs + round \n");
             return(0);
         }
 
         if((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti))
         {
-            LOG_I(PHY,"bad dci mcs + rnti  \n");
+	  //            LOG_I(PHY,"bad dci mcs + rnti  \n");
             return(0);
         }
     }
@@ -4581,7 +4768,7 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
 
     if(rballoc > RIV_max)
     {
-        LOG_I(PHY,"bad dci rballoc rballoc %d  RIV_max %lld \n",rballoc, RIV_max);
+      //        LOG_I(PHY,"bad dci rballoc rballoc %d  RIV_max %lld \n",rballoc, RIV_max);
         // DCI false detection
         return(0);
     }
@@ -4589,7 +4776,7 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
     if(NPRB == 0)
     {
         // DCI false detection
-        LOG_I(PHY,"bad NPRB = 0 \n");
+      //        LOG_I(PHY,"bad NPRB = 0 \n");
         return(0);
     }
 
@@ -4708,13 +4895,13 @@ int check_dci_format2_2a_coherency(DCI_format_t dci_format,
     // I- check dci content minimum coherency
     if(harq_pid>=8)
     {
-        LOG_I(PHY,"bad harq pid\n");
+      //        LOG_I(PHY,"bad harq pid\n");
       return(0);
     }
 
     if( (rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti) )
     {
-        LOG_I(PHY,"bad rnti\n");
+      //        LOG_I(PHY,"bad rnti\n");
         return(0);
     }
 
@@ -4723,7 +4910,7 @@ int check_dci_format2_2a_coherency(DCI_format_t dci_format,
     {
       if(pdlsch0_harq->round == 0)
       {
-          LOG_I(PHY,"bad mcs1\n");
+	//          LOG_I(PHY,"bad mcs1\n");
         return(0);
       }
     }
@@ -4732,7 +4919,7 @@ int check_dci_format2_2a_coherency(DCI_format_t dci_format,
     {
       if(pdlsch1_harq->round == 0)
       {
-          LOG_I(PHY,"bad mcs2\n");
+	//          LOG_I(PHY,"bad mcs2\n");
           return(0);
       }
     }
@@ -4741,14 +4928,14 @@ int check_dci_format2_2a_coherency(DCI_format_t dci_format,
     if((pdlsch0_harq->round == 0) && (rv1 > 0) && (mcs1 != 0))
     {
       // DCI false detection
-        LOG_I(PHY,"bad rv1\n");
+      //        LOG_I(PHY,"bad rv1\n");
       return(0);
     }
 
     if((pdlsch1_harq->round == 0) && (rv2 > 0) && (mcs2 != 0))
     {
       // DCI false detection
-        LOG_I(PHY,"bad rv2\n");
+      //        LOG_I(PHY,"bad rv2\n");
       return(0);
     }
 
@@ -4809,14 +4996,14 @@ int check_dci_format2_2a_coherency(DCI_format_t dci_format,
    if( (rballoc > RIV_max) && (rah == 1) )
    {
       // DCI false detection
-       LOG_I(PHY,"bad rballoc %d RIV_max %lld\n", rballoc, RIV_max);
+     //       LOG_I(PHY,"bad rballoc %d RIV_max %lld\n", rballoc, RIV_max);
       return(0);
    }
 
    if(NPRB == 0)
    {
       // DCI false detection
-       LOG_I(PHY,"bad NPRB\n");
+     //       LOG_I(PHY,"bad NPRB\n");
       return(0);
    }
 
@@ -4840,7 +5027,7 @@ void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms,
 
     pdsch_vars->llr_offset[pdcch_vars->num_pdcch_symbols] = 0;
 
-    //LOG_I(PHY,"compute_llr_offset:  nb RB %d - Qm %d \n", nb_rb_alloc, dlsch0_harq->Qm);
+    LOG_I(PHY,"compute_llr_offset:  nb RB %d - Qm %d \n", nb_rb_alloc, dlsch0_harq->Qm);
 
     //dlsch0_harq->rb_alloc_even;
     //dlsch0_harq->rb_alloc_odd;
@@ -4870,15 +5057,15 @@ void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms,
         if(symbol < (frame_parms->symbols_per_tti-1))
           pdsch_vars->llr_offset[symbol+1] = pdsch_vars->llr_offset[symbol] + llr_offset;
 
-        //LOG_I(PHY,"Granted Re subframe %d / symbol %d => %d (%d RBs)\n", subframe, symbol_mod, granted_re,dlsch0_harq->nb_rb);
-        //LOG_I(PHY,"Pbch/PSS/SSS Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, pbch_pss_sss_re);
-        //LOG_I(PHY,"CRS Re Per PRB subframe %d / symbol %d => %d \n", subframe, symbol_mod, crs_re);
-        //LOG_I(PHY,"Data Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, data_re);
+	LOG_I(PHY,"Granted Re subframe %d / symbol %d => %d (%d RBs)\n", subframe, symbol_mod, granted_re,dlsch0_harq->nb_rb);
+	LOG_I(PHY,"Pbch/PSS/SSS Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, pbch_pss_sss_re);
+	LOG_I(PHY,"CRS Re Per PRB subframe %d / symbol %d => %d \n", subframe, symbol_mod, crs_re);
+	LOG_I(PHY,"Data Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, data_re);
 
 
 
-        //LOG_I(PHY,"Data Re subframe %d-symbol %d => llr length %d, llr offset %d \n", subframe, symbol,
-        //      pdsch_vars->llr_length[symbol], pdsch_vars->llr_offset[symbol]);
+        LOG_I(PHY,"Data Re subframe %d-symbol %d => llr length %d, llr offset %d \n", subframe, symbol,
+              pdsch_vars->llr_length[symbol], pdsch_vars->llr_offset[symbol]);
     }
 }
 void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
@@ -4910,7 +5097,6 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
 
     uint8_t  NPRB      = 0;
     uint8_t  NPRB4TBS  = 0;
-    uint8_t  nb_rb_alloc = 0;
 
     if(dci_format == format1A)
     {
@@ -4952,14 +5138,12 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
             }
 
 	  */
-	  nb_rb_alloc = NPRB;
         }
     }
     else // format1
     {
         NPRB = conv_nprb(rah, rballoc, N_RB_DL);
 	NPRB4TBS=NPRB;
-	nb_rb_alloc = NPRB;
     }
 
     pdlsch0->current_harq_pid = harq_pid;
@@ -4996,7 +5180,7 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
                 //packet was actually decoded in previous transmission (ACK was missed by eNB)
                 //However, the round is not a good check as it might have been decoded in a retransmission prior to this one.
             {
-                LOG_D(PHY,"skip pdsch decoding and report ack\n");
+	      //                LOG_D(PHY,"skip pdsch decoding and report ack\n");
                 // skip pdsch decoding and report ack
                 //pdlsch0_harq->status   = SCH_IDLE;
                 pdlsch0->active       = 0;
@@ -5060,7 +5244,6 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
                 pdlsch0_harq->rb_alloc_even[1] = localRIV2alloc_LUT50_1[rballoc];
                 pdlsch0_harq->rb_alloc_odd[0]  = localRIV2alloc_LUT50_0[rballoc];
                 pdlsch0_harq->rb_alloc_odd[1]  = localRIV2alloc_LUT50_1[rballoc];
-                      printf("rballoc: %08x.%08x\n",pdlsch0_harq->rb_alloc_even[0],pdlsch0_harq->rb_alloc_even[1]);
             } else { // DISTRIBUTED
                 if ((rballoc&(1<<10)) == 0) {
                     rballoc = rballoc&(~(1<<10));
@@ -5142,7 +5325,7 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
                        pdcch_vars,
                        pdsch_vars,
                        pdlsch0_harq,
-                       nb_rb_alloc,
+                       NPRB,
                        subframe);
 }
 
@@ -5622,7 +5805,7 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
           //LOG_I(PHY,"[UE] DLSCH: New Data Indicator CW0 subframe %d (pid %d, round %d)\n",
           //           subframe,harq_pid,dlsch0_harq->round);
           if ( dlsch0_harq->first_tx==1) {
-            LOG_D(PHY,"Format 2 DCI First TX0: Clearing flag\n");
+	    //            LOG_D(PHY,"Format 2 DCI First TX0: Clearing flag\n");
             dlsch0_harq->first_tx = 0;
           }
         }
@@ -5670,7 +5853,7 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
           //LOG_I(PHY,"[UE] DLSCH: New Data Indicator CW1 subframe %d (pid %d, round %d)\n",
           //           subframe,harq_pid,dlsch0_harq->round);
           if (dlsch1_harq->first_tx==1) {
-            LOG_D(PHY,"Format 2 DCI First TX1: Clearing flag\n");
+	    //            LOG_D(PHY,"Format 2 DCI First TX1: Clearing flag\n");
             dlsch1_harq->first_tx = 0;
           }
         }
@@ -6283,7 +6466,7 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
   uint8_t ret = 255;
 
   if (frame_parms->frame_type == FDD) {
-    ret = (((frame<<1)+subframe)&7);
+    ret = (((frame*10)+subframe)&7);
   } else {
 
     switch (frame_parms->tdd_config) {
@@ -6374,6 +6557,8 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
   else
     ul_subframe = ((n+4)%10);
 
+  AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n);
+
   LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe);
   return ul_subframe;
 }
@@ -7073,6 +7258,10 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
       harq_pid = subframe2harq_pid(frame_parms,
                                    pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe),
                                    pdcch_alloc2ul_subframe(frame_parms,subframe));
+    LOG_D(PHY,"Frame %d, Subframe %d: Programming ULSCH for (%d.%d) => harq_pid %d\n",
+	  proc->frame_rx,subframe,
+	  pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe),
+	  pdcch_alloc2ul_subframe(frame_parms,subframe), harq_pid);
 
     if (harq_pid == 255) {
       LOG_E(PHY, "frame %d, subframe %d, rnti %x, format %d: illegal harq_pid!\n",
@@ -7865,7 +8054,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
     dlsch[0]->harq_ack[subframe].vDAI_UL = dai+1;
 
 
-    /*LOG_I(PHY, "[PUSCH %d] Format0 DCI %s, CQI_req=%d, cshift=%d, TPC=%d, DAI=%d, vDAI_UL[sf#%d]=%d, NDI=%d, MCS=%d, RBalloc=%d, first_rb=%d, harq_pid=%d, nb_rb=%d, subframe_scheduling_flag=%d"
+    LOG_D(PHY, "[PUSCH %d] Format0 DCI %s, CQI_req=%d, cshift=%d, TPC=%d, DAI=%d, vDAI_UL[sf#%d]=%d, NDI=%d, MCS=%d, RBalloc=%d, first_rb=%d, harq_pid=%d, nb_rb=%d, subframe_scheduling_flag=%d"
             "   ulsch->bundling %d, O_ACK %d \n",
         harq_pid,
         (frame_parms->frame_type == TDD? "TDD" : "FDD"),
@@ -7873,7 +8062,8 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
         ulsch->harq_processes[harq_pid]->first_rb, harq_pid, ulsch->harq_processes[harq_pid]->nb_rb,
         ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,
         ulsch->bundling,
-        ulsch->harq_processes[harq_pid]->O_ACK);*/
+        ulsch->harq_processes[harq_pid]->O_ACK);
+
     LOG_D(PHY,"Setting beta_offset_cqi_times8 to %d, index %d\n",
 	  beta_cqi[ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index],
 	  ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index);
@@ -7930,7 +8120,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
 
 #ifdef UE_DEBUG_TRACE
 
-    LOG_I(PHY,"Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx%1024,subframe);
+    LOG_D(PHY,"Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx%1024,subframe);
     LOG_D(PHY,"Format 0 DCI : ulsch (ue): NBRB        %d\n",ulsch->harq_processes[harq_pid]->nb_rb);
     LOG_D(PHY,"Format 0 DCI :ulsch (ue): first_rb    %d\n",ulsch->harq_processes[harq_pid]->first_rb);
     LOG_D(PHY,"Format 0 DCI :ulsch (ue): rballoc     %d\n",rballoc);
diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h
index 1413fbe2aa00303beb3a316e154eee24b1286589..f1f4be3072c86b166168fc906a061b599aa0cfc5 100644
--- a/openair1/PHY/LTE_TRANSPORT/defs.h
+++ b/openair1/PHY/LTE_TRANSPORT/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..3574ba67405c271fefe0a43d01936fb49010efd6
--- /dev/null
+++ b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h
@@ -0,0 +1,787 @@
+/*******************************************************************************
+ 
+ *******************************************************************************/
+/*! \file PHY/LTE_TRANSPORT/defs_NB_IoT.h
+* \brief data structures for NPDSCH/NDLSCH/NPUSCH/NULSCH physical and transport channel descriptors (TX/RX) of NB-IoT
+* \author M. KANJ
+* \date 2017
+* \version 0.0
+* \company bcom
+* \email: matthieu.kanj@b-com.com
+* \note
+* \warning
+*/
+#ifndef __LTE_TRANSPORT_DEFS_NB_IOT__H__
+#define __LTE_TRANSPORT_DEFS_NB_IOT__H__
+////#include "PHY/defs.h"
+//#include "PHY/defs_nb_iot.h"
+#include "PHY/LTE_TRANSPORT/dci_NB_IoT.h"
+#include "PHY/impl_defs_lte_NB_IoT.h"
+#include "openair2/COMMON/platform_types.h"
+//#include "dci.h"
+#include "PHY/LTE_TRANSPORT/uci_NB_IoT.h"
+//#include "dci.h"
+//#include "uci.h"
+//#ifndef STANDALONE_COMPILE
+//#include "UTIL/LISTS/list.h"
+//#endif
+ 
+//#include "dci_nb_iot.h"
+
+//#define MOD_TABLE_QPSK_OFFSET 1
+//#define MOD_TABLE_16QAM_OFFSET 5
+//#define MOD_TABLE_64QAM_OFFSET 21
+//#define MOD_TABLE_PSS_OFFSET 85
+//
+//// structures below implement 36-211 and 36-212
+//
+//#define NSOFT 1827072
+#define LTE_NULL_NB_IoT 2
+//
+//// maximum of 3 segments before each coding block if data length exceeds 6144 bits.
+//
+#define MAX_NUM_DLSCH_SEGMENTS_NB_IoT 16
+//#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS
+//#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768)
+//#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768)
+//
+//#define MAX_NUM_CHANNEL_BITS_NB_IOT (14*1200*6)  // 14 symbols, 1200 REs, 12 bits/RE
+//#define MAX_NUM_RE (14*1200)
+//
+//#if !defined(SI_RNTI)
+//#define SI_RNTI  (rnti_t)0xffff
+//#endif
+//#if !defined(M_RNTI)
+//#define M_RNTI   (rnti_t)0xfffd
+//#endif
+//#if !defined(P_RNTI)
+//#define P_RNTI   (rnti_t)0xfffe
+//#endif
+//#if !defined(CBA_RNTI)
+//#define CBA_RNTI (rnti_t)0xfff4
+//#endif
+//#if !defined(C_RNTI)
+//#define C_RNTI   (rnti_t)0x1234
+//#endif
+//
+//#define PMI_2A_11 0
+//#define PMI_2A_1m1 1
+//#define PMI_2A_1j 2
+//#define PMI_2A_1mj 3
+//
+//// for NB-IoT
+#define MAX_NUM_CHANNEL_BITS_NB_IoT 3360 			//14 symbols * 12 sub-carriers * 10 SF * 2bits/RE  // to check during real tests
+#define MAX_DL_SIZE_BITS_NB_IoT 680 				// in release 13 // in release 14 = 2048      // ??? **** not sure
+////#define MAX_NUM_CHANNEL_BITS_NB_IOT 3*680  			/// ??? ****not sure
+//
+//// to be created LTE_eNB_DLSCH_t --> is duplicated for each number of UE and then indexed in the table
+//
+//typedef struct {                              // LTE_DL_eNB_HARQ_t
+//  /// Status Flag indicating for this DLSCH (idle,active,disabled)
+//  SCH_status_t status;
+//  /// Transport block size
+//  uint32_t TBS;
+//  /// The payload + CRC size in bits, "B" from 36-212
+//  uint32_t B;        // keep this parameter
+//  /// Pointer to the payload
+//  uint8_t *b;   // keep this parameter
+//  /// Pointers to transport block segments
+//  //uint8_t *c[MAX_NUM_DLSCH_SEGMENTS];
+//  /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
+// // uint32_t RTC[MAX_NUM_DLSCH_SEGMENTS];
+//  /// Frame where current HARQ round was sent
+//  uint32_t frame;
+//  /// Subframe where current HARQ round was sent
+//  uint32_t subframe;
+//  /// Index of current HARQ round for this DLSCH
+//  uint8_t round;
+//  /// MCS format for this DLSCH
+//  uint8_t mcs;
+//  /// Redundancy-version of the current sub-frame
+//  uint8_t rvidx;
+//  /// MIMO mode for this DLSCH
+//  MIMO_mode_t mimo_mode;
+//  /// Current RB allocation
+//  uint32_t rb_alloc[4];
+//  /// distributed/localized flag
+//  vrb_t vrb_type;
+//  /// Current subband PMI allocation
+//  uint16_t pmi_alloc;
+//  /// Current subband RI allocation
+//  uint32_t ri_alloc;
+//  /// Current subband CQI1 allocation
+//  uint32_t cqi_alloc1;
+//  /// Current subband CQI2 allocation
+//  uint32_t cqi_alloc2;
+//  /// Current Number of RBs
+//  uint16_t nb_rb;
+//  /// downlink power offset field
+//  uint8_t dl_power_off;
+//  /// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
+//  uint8_t e[MAX_NUM_CHANNEL_BITS_NB_IOT];
+//  /// data after scrambling
+//  uint8_t s_e[MAX_NUM_CHANNEL_BITS_NB_IOT];
+//  /// length of the table e
+//  uint16_t length_e                 // new parameter
+//  /// Tail-biting convolutional coding outputs
+//  uint8_t d[96+(3*(24+MAX_DL_SIZE_BITS_NB_IOT))];  // new parameter
+//  /// Sub-block interleaver outputs
+//  uint8_t w[3*3*(MAX_DL_SIZE_BITS_NB_IOT+24)];      // new parameter
+//  /// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17, TM3-4)
+//  uint8_t Nl;
+//  /// Number of layers for this PDSCH transmission (TM8-10)
+//  uint8_t Nlayers;
+//  /// First layer for this PSCH transmission
+//  uint8_t first_layer;
+//} NB_IoT_DL_eNB_HARQ_t;
+
+typedef enum {
+
+  SCH_IDLE_NB_IoT,
+  ACTIVE_NB_IoT,
+  CBA_ACTIVE_NB_IoT,
+  DISABLED_NB_IoT
+
+} SCH_status_NB_IoT_t;
+
+
+typedef struct {
+  /// NB-IoT
+  SCH_status_NB_IoT_t   status;
+  /// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
+  uint8_t               scheduling_delay;
+  /// The number of the subframe to transmit the NPDSCH Table TS 36.213 Table 16.4.1.3-1  (Nsf) (NB. in this case is not the index Isf)
+  uint8_t               resource_assignment;
+  /// is the index that determined the repeat number of NPDSCH through table TS 36.213 Table 16.4.1.3-2 / for SIB1-NB Table 16.4.1.3-3
+  uint8_t               repetition_number;
+  /// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
+  uint8_t               HARQ_ACK_resource;
+  /// Determined the repetition number value 0-3 (2 biut carried by the FAPI NPDCCH)
+  uint8_t               dci_subframe_repetitions;
+  /// modulation always QPSK Qm = 2 
+  uint8_t               modulation;
+  /// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
+  uint8_t               e[MAX_NUM_CHANNEL_BITS_NB_IoT];
+  /// data after scrambling
+  uint8_t               s_e[MAX_NUM_CHANNEL_BITS_NB_IoT];
+  //length of the table e
+  uint16_t              length_e;                // new parameter
+  /// Tail-biting convolutional coding outputs
+  uint8_t               d[96+(3*(24+MAX_DL_SIZE_BITS_NB_IoT))];  // new parameter
+  /// Sub-block interleaver outputs
+  uint8_t               w[3*3*(MAX_DL_SIZE_BITS_NB_IoT+24)];      // new parameter
+
+  /// Status Flag indicating for this DLSCH (idle,active,disabled)
+  //SCH_status_t status;
+  /// Transport block size
+  uint32_t              TBS;
+  /// The payload + CRC size in bits, "B" from 36-212
+  uint32_t              B;
+  /// Pointer to the payload
+  uint8_t               *b;
+  ///pdu of the ndlsch message
+  uint8_t               *pdu;
+  /// Frame where current HARQ round was sent
+  uint32_t              frame;
+  /// Subframe where current HARQ round was sent
+  uint32_t              subframe;
+  /// Index of current HARQ round for this DLSCH
+  uint8_t               round;
+  /// MCS format for this NDLSCH , TS 36.213 Table 16.4.1.5
+  uint8_t               mcs;
+  // we don't have code block segmentation / crc attachment / concatenation in NB-IoT R13 36.212 6.4.2
+  // we don't have beamforming in NB-IoT
+  //this index will be used mainly for SI message buffer
+   uint8_t               pdu_buffer_index;
+
+} NB_IoT_DL_eNB_HARQ_t;
+
+
+typedef struct {                                        // LTE_eNB_DLSCH_t
+ /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
+ uint32_t               *txdataF[8];
+ /// Allocated RNTI (0 means DLSCH_t is not currently used)
+ uint16_t               rnti;
+ /// Active flag for baseband transmitter processing
+ uint8_t                active;
+ /// Indicator of TX activation per subframe.  Used during PUCCH detection for ACK/NAK.
+ uint8_t                subframe_tx[10];
+ /// First CCE of last PDSCH scheduling per subframe.  Again used during PUCCH detection for ACK/NAK.
+ uint8_t                nCCE[10];
+ /// Current HARQ process id
+ uint8_t                current_harq_pid;
+ /// Process ID's per subframe.  Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
+ uint8_t                harq_ids[10];
+ /// Window size (in outgoing transport blocks) for fine-grain rate adaptation
+ uint8_t                ra_window_size;
+ /// First-round error threshold for fine-grain rate adaptation
+ uint8_t                error_threshold;
+ /// Pointers to 8 HARQ processes for the DLSCH
+ NB_IoT_DL_eNB_HARQ_t   harq_process;
+ /// circular list of free harq PIDs (the oldest come first)
+ /// (10 is arbitrary value, must be > to max number of DL HARQ processes in LTE)
+ int                    harq_pid_freelist[10];
+ /// the head position of the free list (if list is free then head=tail)
+ int                    head_freelist;
+ /// the tail position of the free list
+ int                    tail_freelist;
+ /// Number of soft channel bits
+ uint32_t               G;
+ /// Codebook index for this dlsch (0,1,2,3)
+ uint8_t                codebook_index;
+ /// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
+ uint8_t                Mdlharq;
+ /// Maximum number of HARQ rounds
+ uint8_t                Mlimit;
+ /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
+ uint8_t                Kmimo;
+ /// Nsoft parameter related to UE Category
+ uint32_t               Nsoft;
+ /// amplitude of PDSCH (compared to RS) in symbols without pilots
+ int16_t                sqrt_rho_a;
+ /// amplitude of PDSCH (compared to RS) in symbols containing pilots
+ int16_t                sqrt_rho_b;
+
+} NB_IoT_eNB_DLSCH_t;
+
+
+typedef struct {
+  /// HARQ process id
+  uint8_t   harq_id;
+  /// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX
+  uint8_t   ack;
+  /// send status (for PUCCH)
+  uint8_t   send_harq_status;
+  /// nCCE (for PUCCH)
+  uint8_t   nCCE;
+  /// DAI value detected from DCI1/1a/1b/1d/2/2a/2b/2c. 0xff indicates not touched
+  uint8_t   vDAI_DL;
+  /// DAI value detected from DCI0/4. 0xff indicates not touched
+  uint8_t   vDAI_UL;
+} harq_status_NB_IoT_t;
+
+typedef struct {
+  /// UL RSSI per receive antenna
+  int32_t             UL_rssi[NB_ANTENNAS_RX];
+  /// PUCCH1a/b power (digital linear)
+  uint32_t            Po_PUCCH;
+  /// PUCCH1a/b power (dBm)
+  int32_t             Po_PUCCH_dBm;
+  /// PUCCH1 power (digital linear), conditioned on below threshold
+  uint32_t            Po_PUCCH1_below;
+  /// PUCCH1 power (digital linear), conditioned on above threshold
+  uint32_t            Po_PUCCH1_above;
+  /// Indicator that Po_PUCCH has been updated by PHY
+  int32_t             Po_PUCCH_update;
+  /// DL Wideband CQI index (2 TBs)
+  uint8_t             DL_cqi[2];
+  /// DL Subband CQI index (from HLC feedback)
+  uint8_t             DL_subband_cqi[2][13];
+  /// DL PMI Single Stream
+  uint16_t            DL_pmi_single;
+  /// DL PMI Dual Stream
+  uint16_t            DL_pmi_dual;
+  /// Current RI
+  uint8_t             rank;
+  /// CRNTI of UE
+  uint16_t            crnti; ///user id (rnti) of connected UEs
+  /// Initial timing offset estimate from PRACH for RAR
+  int32_t             UE_timing_offset;
+  /// Timing advance estimate from PUSCH for MAC timing advance signalling
+  int32_t             timing_advance_update;
+  /// Current mode of UE (NOT SYCHED, RAR, PUSCH)
+  UE_MODE_NB_IoT_t    mode;
+  /// Current sector where UE is attached
+  uint8_t             sector;
+
+  /// dlsch l2 errors
+  uint32_t            dlsch_l2_errors[8];
+  /// dlsch trials per harq and round
+  uint32_t            dlsch_trials[8][8];
+  /// dlsch ACK/NACK per hard_pid and round
+  uint32_t            dlsch_ACK[8][8];
+  uint32_t            dlsch_NAK[8][8];
+
+  /// ulsch l2 errors per harq_pid
+  uint32_t            ulsch_errors[8];
+  /// ulsch l2 consecutive errors per harq_pid
+  uint32_t            ulsch_consecutive_errors; //[8];
+  /// ulsch trials/errors/fer per harq and round
+  uint32_t            nulsch_decoding_attempts[8][8];
+  uint32_t            ulsch_round_errors[8][8];
+  uint32_t            ulsch_decoding_attempts_last[8][8];
+  uint32_t            ulsch_round_errors_last[8][8];
+  uint32_t            ulsch_round_fer[8][8];
+  uint32_t            sr_received;
+  uint32_t            sr_total;
+
+  /// dlsch sliding count and total errors in round 0 are used to compute the dlsch_mcs_offset
+  uint32_t            dlsch_sliding_cnt;
+  uint32_t            dlsch_NAK_round0;
+  int8_t              dlsch_mcs_offset;
+
+  /// Target mcs1 after rate-adaptation (used by MAC layer scheduler)
+  uint8_t             dlsch_mcs1;
+  /// Target mcs2 after rate-adaptation (used by MAC layer scheduler)
+  uint8_t             dlsch_mcs2;
+  /// Total bits received from MAC on PDSCH
+  int                 total_TBS_MAC;
+  /// Total bits acknowledged on PDSCH
+  int                 total_TBS;
+  /// Total bits acknowledged on PDSCH (last interval)
+  int                 total_TBS_last;
+  /// Bitrate on the PDSCH [bps]
+  unsigned int        dlsch_bitrate;
+  //  unsigned int total_transmitted_bits;
+
+} NB_IoT_eNB_UE_stats;
+
+typedef struct {
+  /// Indicator of first transmission
+  uint8_t     first_tx;
+  /// Last Ndi received for this process on DCI (used for C-RNTI only)
+  uint8_t     DCINdi;
+  /// DLSCH status flag indicating
+  //SCH_status_t status;
+  /// Transport block size
+  uint32_t    TBS;
+  /// The payload + CRC size in bits
+  uint32_t    B;
+  /// Pointer to the payload
+  uint8_t     *b;
+  /// Pointers to transport block segments
+  uint8_t     *c[MAX_NUM_DLSCH_SEGMENTS_NB_IoT];
+  /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
+  uint32_t    RTC[MAX_NUM_DLSCH_SEGMENTS_NB_IoT];
+  /// Index of current HARQ round for this DLSCH
+  uint8_t     round;
+  /// MCS format for this DLSCH
+  uint8_t     mcs;
+  /// Qm (modulation order) for this DLSCH
+  uint8_t     Qm;
+  /// Redundancy-version of the current sub-frame
+  uint8_t     rvidx;
+  /// MIMO mode for this DLSCH
+ // MIMO_mode_t mimo_mode;
+  /// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
+  int16_t     w[MAX_NUM_DLSCH_SEGMENTS_NB_IoT][3*(6144+64)];
+  /// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
+  double      w_abs[MAX_NUM_DLSCH_SEGMENTS_NB_IoT][3*(6144+64)];
+  /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
+  int16_t     *d[MAX_NUM_DLSCH_SEGMENTS_NB_IoT];
+  /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9)
+  uint32_t    C;
+  /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t    Cminus;
+  /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t    Cplus;
+  /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t    Kminus;
+  /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t    Kplus;
+  /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t    F;
+  /// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17)
+  uint8_t     Nl;
+  /// current delta_pucch
+  int8_t      delta_PUCCH;
+  /// Number of soft channel bits
+  uint32_t    G;
+  /// Current Number of RBs
+  uint16_t    nb_rb;
+  /// Current subband PMI allocation
+  uint16_t    pmi_alloc;
+  /// Current RB allocation (even slots)
+  uint32_t    rb_alloc_even[4];
+  /// Current RB allocation (odd slots)
+  uint32_t    rb_alloc_odd[4];
+  /// distributed/localized flag
+  //vrb_t vrb_type;
+  /// downlink power offset field
+  uint8_t     dl_power_off;
+  /// trials per round statistics
+  uint32_t    trials[8];
+  /// error statistics per round
+  uint32_t    errors[8];
+  /// codeword this transport block is mapped to
+  uint8_t     codeword;
+
+} NB_IoT_DL_UE_HARQ_t;
+
+typedef struct {
+  /// RNTI
+  uint16_t              rnti;
+  /// Active flag for DLSCH demodulation
+  uint8_t               active;
+  /// Transmission mode
+  uint8_t               mode1_flag;
+  /// amplitude of PDSCH (compared to RS) in symbols without pilots
+  int16_t               sqrt_rho_a;
+  /// amplitude of PDSCH (compared to RS) in symbols containing pilots
+  int16_t               sqrt_rho_b;
+  /// Current HARQ process id threadRx Odd and threadRx Even
+  uint8_t               current_harq_pid;
+  /// Current subband antenna selection
+  uint32_t              antenna_alloc;
+  /// Current subband RI allocation
+  uint32_t              ri_alloc;
+  /// Current subband CQI1 allocation
+  uint32_t              cqi_alloc1;
+  /// Current subband CQI2 allocation
+  uint32_t              cqi_alloc2;
+  /// saved subband PMI allocation from last PUSCH/PUCCH report
+  uint16_t              pmi_alloc;
+  /// HARQ-ACKs
+  harq_status_NB_IoT_t  harq_ack;
+  /// Pointers to up to 8 HARQ processes
+  NB_IoT_DL_UE_HARQ_t   *harq_process;
+  /// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17
+  uint8_t               Mdlharq;
+  /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
+  uint8_t               Kmimo;
+  /// Nsoft parameter related to UE Category
+  uint32_t              Nsoft;
+  /// Maximum number of Turbo iterations
+  uint8_t               max_turbo_iterations;
+  /// number of iterations used in last turbo decoding
+  uint8_t               last_iteration_cnt;
+  /// accumulated tx power adjustment for PUCCH
+  int8_t                g_pucch;
+
+} NB_IoT_UE_DLSCH_t;
+
+//----------------------------------------------------------------------------------------------------------
+// NB-IoT
+//----------------------------------------------------------------------------------------------------
+
+//enum for distinguish the different type of ndlsch (may in the future will be not needed)
+typedef enum
+{
+
+  SIB1,
+  SI_Message,
+  RAR,
+  UE_Data
+
+}ndlsch_flag_t;
+
+
+
+typedef struct {
+  rnti_t          rnti;
+  //array containing the pdus of DCI
+  uint8_t         *a[2];
+  //Array containing encoded DCI data
+  uint8_t         *e[2];
+
+  //UE specific parameters
+  uint16_t        npdcch_NumRepetitions;
+
+  uint16_t        repetition_number;
+  //indicate the corresponding subframe within the repetition (set to 0 when a new NPDCCH pdu is received)
+  uint16_t        repetition_idx;
+
+  //  uint16_t npdcch_Offset_USS;
+  //  uint16_t npdcch_StartSF_USS;
+
+
+}NB_IoT_eNB_NPDCCH_t;
+
+
+typedef struct{
+
+  //Number of repetitions (R) for common search space (RAR and PAGING)
+  uint16_t    number_repetition_RA;
+  uint16_t    number_repetition_PAg;
+  //index of the current subframe among the repetition (set to 0 when we receive the new NPDCCH)
+  uint16_t    repetition_idx_RA;
+  uint16_t    repetition_idx_Pag;
+
+}NB_IoT_eNB_COMMON_NPDCCH_t;
+
+
+typedef struct {
+
+  /// Length of DCI in bits
+  uint8_t               dci_length;
+  /// Aggregation level only 1,2 in NB-IoT
+  uint8_t               L;
+  /// Position of first CCE of the dci
+  int                   firstCCE;
+  /// flag to indicate that this is a RA response
+  boolean_t      ra_flag;
+  /// rnti
+  rnti_t                rnti;
+  /// Format
+  DCI_format_NB_IoT_t   format;
+  /// DCI pdu
+  uint8_t               dci_pdu[8];
+
+} DCI_ALLOC_NB_IoT_t;
+
+
+typedef struct {
+  //delete the count for the DCI numbers,NUM_DCI_MAX should set to 2
+  uint32_t              num_npdcch_symbols;
+  ///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDCCH transmission
+  /// see FAPI/NFAPI specs Table 4-45
+  uint8_t               npdcch_start_symbol;
+  uint8_t               Num_dci;
+  DCI_ALLOC_NB_IoT_t    dci_alloc[2] ;
+
+} DCI_PDU_NB_IoT;
+
+
+
+
+typedef struct {
+  /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
+  int32_t                 *txdataF[8];
+  /// dl channel estimates (estimated from ul channel estimates)
+  int32_t                 **calib_dl_ch_estimates;
+  /// Allocated RNTI (0 means DLSCH_t is not currently used)
+  uint16_t                rnti;
+  /// Active flag for baseband transmitter processing
+  uint8_t                 active;
+  /// Indicator of TX activation per subframe.  Used during PUCCH detection for ACK/NAK.
+  uint8_t                 subframe_tx[10];
+  /// First CCE of last PDSCH scheduling per subframe.  Again used during PUCCH detection for ACK/NAK.
+  uint8_t                 nCCE[10];
+  /*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/
+  /// The only HARQ process for the DLSCH
+  NB_IoT_DL_eNB_HARQ_t    *harq_process;
+  /// Number of soft channel bits
+  uint32_t                G;
+  /// Maximum number of HARQ rounds
+  uint8_t                 Mlimit;
+  /// Nsoft parameter related to UE Category
+  uint32_t                Nsoft;
+  /// amplitude of PDSCH (compared to RS) in symbols without pilots
+  int16_t                 sqrt_rho_a;
+  /// amplitude of PDSCH (compared to RS) in symbols containing pilots
+  int16_t                 sqrt_rho_b;
+  ///NB-IoT
+  /// may use in the npdsch_procedures
+  uint16_t                scrambling_sequence_intialization;
+  /// number of cell specific TX antenna ports assumed by the UE
+  uint8_t                 nrs_antenna_ports;
+
+  //This indicate the current subframe within the subframe interval between the NPDSCH transmission (Nsf*Nrep)
+  uint16_t                sf_index;
+  ///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDSCH transmission
+  /// see FAPI/NFAPI specs Table 4-47
+  uint8_t                 npdsch_start_symbol;
+  /*SIB1-NB related parameters*/
+  ///flag for indicate if the current frame is the start of a new SIB1-NB repetition within the SIB1-NB period (0 = FALSE, 1 = TRUE)
+  uint8_t                 sib1_rep_start;
+  ///the number of the frame within the 16 continuous frame in which sib1-NB is transmitted (1-8 = 1st, 2nd ecc..) (0 = not foresees a transmission)
+  uint8_t                 relative_sib1_frame;
+  //Flag  used to discern among different NDLSCH structures (SIB1,SI,RA,UE-spec)
+  //(used inside the ndlsch procedure for distinguish the different type of data to manage also in term of repetitions and transmission over more subframes
+  ndlsch_flag_t           ndlsch_type;
+
+} NB_IoT_eNB_NDLSCH_t;
+
+typedef struct {
+  /// Length of CQI data under RI=1 assumption(bits)
+  uint8_t               Or1;
+  /// Rank information
+  uint8_t               o_RI[2];
+  /// Format of CQI data
+  UCI_format_NB_IoT_t   uci_format;
+  /// The value of DAI in DCI format 0
+  uint8_t               V_UL_DAI;
+  /// Pointer to CQI data
+  uint8_t               o[MAX_CQI_BYTES_NB_IoT];
+  /// CQI CRC status
+  uint8_t               cqi_crc_status;
+  /// PHICH active flag
+  uint8_t               phich_active;
+  /// PHICH ACK
+  uint8_t               phich_ACK;
+  /// Length of rank information (bits)
+  uint8_t               O_RI;
+  /// First Allocated RB
+  uint16_t              first_rb;
+  /// Current Number of RBs
+  uint16_t              nb_rb;
+  /// Determined the subcarrier allocation for the NPUSCH.(15, 3.75 KHz)
+  uint8_t               subcarrier_indication;
+  /// Determined the number of resource unit for the NPUSCH
+  uint8_t               resource_assignment;
+  /// Determined the scheduling delay for NPUSCH
+  uint8_t               scheduling_delay;
+  /// The number of the repetition number for NPUSCH Transport block
+  uint8_t               repetition_number;
+  /// Determined the repetition number value 0-3
+  uint8_t               dci_subframe_repetitions;
+  /// Flag indicating that this ULSCH has been allocated by a DCI (otherwise it is a retransmission based on PHICH NAK)
+  uint8_t               dci_alloc;
+  /// Flag indicating that this ULSCH has been allocated by a RAR (otherwise it is a retransmission based on PHICH NAK or DCI)
+  uint8_t               rar_alloc;
+  /// Status Flag indicating for this ULSCH (idle,active,disabled)
+  SCH_status_NB_IoT_t   status;
+  /// Subframe scheduling indicator (i.e. Transmission opportunity indicator)
+  uint8_t               subframe_scheduling_flag;
+  /// Transport block size
+  uint32_t              TBS;
+  /// The payload + CRC size in bits
+  uint32_t              B;
+  /// Number of soft channel bits
+  uint32_t              G;
+  /// Pointer to ACK
+  uint8_t               o_ACK[4];
+  /// Length of ACK information (bits)
+  uint8_t               O_ACK;
+  /// coded ACK bits
+  int16_t               q_ACK[MAX_ACK_PAYLOAD_NB_IoT];
+  /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9)
+  /// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
+  int16_t               e[MAX_NUM_CHANNEL_BITS_NB_IoT] __attribute__((aligned(32)));
+  /// coded RI bits
+  int16_t               q_RI[MAX_RI_PAYLOAD_NB_IoT];
+  /// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
+  int8_t                q[MAX_CQI_PAYLOAD_NB_IoT];
+  /// number of coded CQI bits after interleaving
+  uint8_t               o_RCC;
+  /// coded and interleaved CQI bits
+  int8_t                o_w[(MAX_CQI_BITS_NB_IoT+8)*3];
+  /// coded CQI bits
+  int8_t                o_d[96+((MAX_CQI_BITS_NB_IoT+8)*3)];
+  ///
+  uint32_t              C;
+  /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t              Cminus;
+  /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t              Cplus;
+  /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t              Kminus;
+  /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t              Kplus;
+  /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10)
+  uint32_t              F;
+  /// Temporary h sequence to flag PUSCH_x/PUSCH_y symbols which are not scrambled
+  //uint8_t h[MAX_NUM_CHANNEL_BITS];
+  /// SRS active flag
+  uint8_t               srs_active;
+  /// Pointer to the payload
+  uint8_t               *b;
+  /// Current Number of Symbols
+  uint8_t               Nsymb_pusch;
+  /// Index of current HARQ round for this ULSCH
+  uint8_t               round;
+  /// MCS format for this ULSCH
+  uint8_t               mcs;
+  /// Redundancy-version of the current sub-frame (value 0->RV0,value 1 ->RV2)
+  uint8_t               rvidx;
+  /// Msc_initial, Initial number of subcarriers for ULSCH (36-212, v8.6 2009-03, p.26-27)
+  uint16_t              Msc_initial;
+  /// Nsymb_initial, Initial number of symbols for ULSCH (36-212, v8.6 2009-03, p.26-27)
+  uint8_t               Nsymb_initial;
+  /// n_DMRS  for cyclic shift of DMRS (36.213 Table 9.1.2-2)
+  uint8_t               n_DMRS;
+  /// n_DMRS  for cyclic shift of DMRS (36.213 Table 9.1.2-2) - previous scheduling
+  /// This is needed for PHICH generation which
+  /// is done after a new scheduling
+  uint8_t               previous_n_DMRS;
+  /// n_DMRS 2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1)
+  uint8_t               n_DMRS2;
+  /// Flag to indicate that this ULSCH is for calibration information sent from UE (i.e. no MAC SDU to pass up)
+  //  int calibration_flag;
+  /// delta_TF for power control
+  int32_t               delta_TF;
+  ///////////////////////////////////////////// 4 parameter added by vincent ///////////////////////////////////////////////
+  // NB_IoT: Nsymb_UL and Nslot_UL are defined in 36.211, Section 10.1.2.3, Table 10.1.2.3-1
+  // The number of symbol in a resource unit is given by Nsymb_UL*Nslot_UL
+  uint8_t               Nsymb_UL; 
+  // Number of NPUSCH slots
+  uint8_t               Nslot_UL; 
+  // Number of subcarrier for NPUSH, can be 1, 3, 6, 12
+  uint8_t               N_sc_RU; 
+  // Index of UL NB_IoT resource block
+  uint32_t              UL_RB_ID_NB_IoT; 
+  // Subcarrier indication fields, obtained through DCI, Section 16.5.1.1 in 36.213
+  uint16_t              I_sc; 
+  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+} NB_IoT_UL_eNB_HARQ_t;
+
+
+typedef struct {
+  /// Pointers to the HARQ processes for the NULSCH
+  NB_IoT_UL_eNB_HARQ_t    *harq_process;
+  /// Maximum number of HARQ rounds
+  uint8_t                 Mlimit;
+  /// Value 0 = npush format 1 (data) value 1 = npusch format 2 (ACK/NAK)
+  uint8_t                 npusch_format;
+  /// Flag to indicate that eNB awaits UE Msg3
+  uint8_t                 Msg3_active;
+  /// Flag to indicate that eNB should decode UE Msg3
+  uint8_t                 Msg3_flag;
+  /// Subframe for Msg3
+  uint8_t                 Msg3_subframe;
+  /// Frame for Msg3
+  uint32_t                Msg3_frame;
+  /// RNTI attributed to this ULSCH
+  uint16_t                rnti;
+  /// cyclic shift for DM RS
+  uint8_t                 cyclicShift;
+  /// cooperation flag
+  uint8_t                 cooperation_flag;
+  /// (only in-band mode), indicate the resource block overlap the SRS configuration of LTE
+  uint8_t                 N_srs;
+  ///
+  uint8_t                 scrambling_re_intialization_batch_index;
+  /// number of cell specific TX antenna ports assumed by the UE
+  uint8_t                 nrs_antenna_ports;
+  ///
+  uint16_t                scrambling_sequence_intialization;
+  ///
+  uint16_t                sf_index;
+  /// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
+  uint8_t                 HARQ_ACK_resource;
+
+  ///////////// kept from LTE ///////////////////////////////////////////////////
+
+  /// Maximum number of iterations used in eNB turbo decoder
+  uint8_t                 max_turbo_iterations;
+  /// ACK/NAK Bundling flag
+  uint8_t                 bundling;
+  /// beta_offset_cqi times 8
+  uint16_t                beta_offset_cqi_times8;
+  /// beta_offset_ri times 8
+  uint16_t                beta_offset_ri_times8;
+  /// beta_offset_harqack times 8
+  uint16_t                beta_offset_harqack_times8;
+  /// num active cba group
+  uint8_t                 num_active_cba_groups;
+  /// allocated CBA RNTI for this ulsch
+  uint16_t                cba_rnti[4];//NUM_MAX_CBA_GROUP];
+  #ifdef LOCALIZATION
+  /// epoch timestamp in millisecond
+  int32_t                 reference_timestamp_ms;
+  /// aggregate physical states every n millisecond
+  int32_t                 aggregation_period_ms;
+  /// a set of lists used for localization
+  struct                  list loc_rss_list[10], loc_rssi_list[10], loc_subcarrier_rss_list[10], loc_timing_advance_list[10], loc_timing_update_list[10];
+  struct                  list tot_loc_rss_list, tot_loc_rssi_list, tot_loc_subcarrier_rss_list, tot_loc_timing_advance_list, tot_loc_timing_update_list;
+  #endif
+
+} NB_IoT_eNB_NULSCH_t;
+
+#define NPBCH_A 34
+
+typedef struct {
+  //the 2 LSB of the hsfn (the MSB are indicated by the SIB1-NB)
+  uint16_t  h_sfn_lsb;
+
+  uint8_t   npbch_d[96+(3*(16+NPBCH_A))];
+  uint8_t   npbch_w[3*3*(16+NPBCH_A)];
+  uint8_t   npbch_e[1600];
+  ///pdu of the npbch message
+  uint8_t   *pdu;
+
+} NB_IoT_eNB_NPBCH_t;
+
+
+#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
index 1797c0a99987f8986c1e64670da46db73c291fe2..dd073584f0f3ee1f06b121ba6fa1a80900aa7fa1 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -63,42 +63,20 @@ extern int codingw;
 
 void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
 {
-  int i;
-  int r;
+  int i, r, aa, layer;
 
   if (dlsch) {
-#ifdef DEBUG_DLSCH_FREE
-    printf("Freeing dlsch %p\n",dlsch);
-#endif
-
+    for (layer=0; layer<4; layer++) {
+      for (aa=0; aa<64; aa++) free16(dlsch->ue_spec_bf_weights[layer][aa], OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
+      free16(dlsch->ue_spec_bf_weights[layer], 64*sizeof(int32_t*));
+    }
     for (i=0; i<dlsch->Mdlharq; i++) {
-#ifdef DEBUG_DLSCH_FREE
-      printf("Freeing dlsch process %d\n",i);
-#endif
-
       if (dlsch->harq_processes[i]) {
-#ifdef DEBUG_DLSCH_FREE
-        printf("Freeing dlsch process %d (%p)\n",i,dlsch->harq_processes[i]);
-#endif
-
         if (dlsch->harq_processes[i]->b) {
           free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES);
           dlsch->harq_processes[i]->b = NULL;
-#ifdef DEBUG_DLSCH_FREE
-          printf("Freeing dlsch process %d b (%p)\n",i,dlsch->harq_processes[i]->b);
-#endif
         }
-
-#ifdef DEBUG_DLSCH_FREE
-        printf("Freeing dlsch process %d c (%p)\n",i,dlsch->harq_processes[i]->c);
-#endif
-
         for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) {
-
-#ifdef DEBUG_DLSCH_FREE
-          printf("Freeing dlsch process %d c[%d] (%p)\n",i,r,dlsch->harq_processes[i]->c[r]);
-#endif
-
           if (dlsch->harq_processes[i]->c[r]) {
             free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
             dlsch->harq_processes[i]->c[r] = NULL;
@@ -107,17 +85,14 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
             free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
             dlsch->harq_processes[i]->d[r] = NULL;
           }
-
 	}
 	free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
 	dlsch->harq_processes[i] = NULL;
       }
     }
-
     free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
     dlsch = NULL;
-    }
-
+  }
 }
 
 LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms)
@@ -254,6 +229,7 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
     Mdlharq = dlsch->Mdlharq;
     dlsch->rnti = 0;
     dlsch->active = 0;
+    dlsch->harq_mask = 0;
 
     for (i=0; i<10; i++)
       dlsch->harq_ids[i] = Mdlharq;
@@ -321,13 +297,13 @@ int dlsch_encoding_2threads0(te_params *tep) {
 
 
 
-      threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
-                                Kr>>3,
-                                &dlsch->harq_processes[harq_pid]->d[r][96],
-                                (r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
-                                f1f2mat_old[iind*2],   // f1 (see 36121-820, page 14)
-                                f1f2mat_old[(iind*2)+1]  // f2 (see 36121-820, page 14)
-                               );
+      encoder(dlsch->harq_processes[harq_pid]->c[r],
+              Kr>>3,
+              &dlsch->harq_processes[harq_pid]->d[r][96],
+              (r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
+              f1f2mat_old[iind*2],   // f1 (see 36121-820, page 14)
+              f1f2mat_old[(iind*2)+1]  // f2 (see 36121-820, page 14)
+             );
       dlsch->harq_processes[harq_pid]->RTC[r] =
         sub_block_interleaving_turbo(4+(Kr_bytes*8),
                                      &dlsch->harq_processes[harq_pid]->d[r][96],
@@ -536,13 +512,13 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
 
 
       start_meas(te_stats);
-      threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
-                                Kr>>3,
-                                &dlsch->harq_processes[harq_pid]->d[r][96],
-                                (r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
-                                f1f2mat_old[iind*2],   // f1 (see 36121-820, page 14)
-                                f1f2mat_old[(iind*2)+1]  // f2 (see 36121-820, page 14)
-                               );
+      encoder(dlsch->harq_processes[harq_pid]->c[r],
+              Kr>>3,
+              &dlsch->harq_processes[harq_pid]->d[r][96],
+              (r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
+              f1f2mat_old[iind*2],   // f1 (see 36121-820, page 14)
+              f1f2mat_old[(iind*2)+1]  // f2 (see 36121-820, page 14)
+             );
       stop_meas(te_stats);
 
       start_meas(i_stats);
@@ -782,7 +758,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
   //  if (dlsch->harq_processes[harq_pid]->Ndi == 1) {  // this is a new packet
   if (dlsch->harq_processes[harq_pid]->round == 0) {  // this is a new packet
 #ifdef DEBUG_DLSCH_CODING
-  printf("encoding thinks this is a new packet \n");
+    printf("encoding thinks this is a new packet for harq_pid %d (%p) \n",harq_pid,dlsch->harq_processes[harq_pid]->b);
 #endif
     /*
     int i;
@@ -792,6 +768,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
     printf("\n");
     */
     // Add 24-bit crc (polynomial A) to payload
+
     crc = crc24a(a,
                  A)>>8;
     a[A>>3] = ((uint8_t*)&crc)[2];
@@ -853,13 +830,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
       printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
 #endif
       start_meas(te_stats);
-      threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
-                                Kr>>3,
-                                &dlsch->harq_processes[harq_pid]->d[r][96],
-                                (r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
-                                f1f2mat_old[iind*2],   // f1 (see 36121-820, page 14)
-                                f1f2mat_old[(iind*2)+1]  // f2 (see 36121-820, page 14)
-                               );
+      encoder(dlsch->harq_processes[harq_pid]->c[r],
+              Kr>>3,
+              &dlsch->harq_processes[harq_pid]->d[r][96],
+              (r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
+              f1f2mat_old[iind*2],   // f1 (see 36121-820, page 14)
+              f1f2mat_old[(iind*2)+1]  // f2 (see 36121-820, page 14)
+             );
       stop_meas(te_stats);
 #ifdef DEBUG_DLSCH_CODING
 
@@ -1035,13 +1012,13 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
       printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
 #endif
       start_meas(te_stats);
-      threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
-                                Kr>>3,
-                                &dlsch->harq_processes[harq_pid]->d[r][96],
-                                (r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
-                                f1f2mat_old[iind*2],   // f1 (see 36121-820, page 14)
-                                f1f2mat_old[(iind*2)+1]  // f2 (see 36121-820, page 14)
-                               );
+      encoder(dlsch->harq_processes[harq_pid]->c[r],
+              Kr>>3,
+              &dlsch->harq_processes[harq_pid]->d[r][96],
+              (r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
+              f1f2mat_old[iind*2],   // f1 (see 36121-820, page 14)
+              f1f2mat_old[(iind*2)+1]  // f2 (see 36121-820, page 14)
+             );
       stop_meas(te_stats);
 #ifdef DEBUG_DLSCH_CODING
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
index d23a7d7e21ab40e546389a949c4837e3bd76d5c7..4020056e6f68043a591f4792c287202e49a76ab0 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -37,8 +37,8 @@
 #include "SCHED/extern.h"
 #include "SIMULATION/TOOLS/defs.h"
 //#define DEBUG_DLSCH_DECODING
+//#define UE_DEBUG_TRACE 1
 
-extern double cpuf;
 
 void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
 {
@@ -205,21 +205,7 @@ uint32_t  dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
 		    time_stats_t *);
 
 #endif
-  uint8_t (*tc)(int16_t *y,
-                uint8_t *,
-                uint16_t,
-                uint16_t,
-                uint16_t,
-                uint8_t,
-                uint8_t,
-                uint8_t,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *);
+decoder_if_t tc;
 
 
 
@@ -254,13 +240,13 @@ uint32_t  dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
 #if 0
     tc_2cw = phy_threegpplte_turbo_decoder16avx2;
 #endif
-    tc = phy_threegpplte_turbo_decoder16;
+    tc = decoder16;
   }
   else
   {
 	  AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
 			  harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
-	    tc = phy_threegpplte_turbo_decoder8;
+	    tc = decoder8;
   }
 
 
@@ -489,7 +475,9 @@ uint32_t  dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
       LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
       ret = tc
             (&harq_process->d[r][96],
+             NULL,
              harq_process->c[r],
+             NULL,
              Kr,
              f1f2mat_old[iind*2],
              f1f2mat_old[(iind*2)+1],
@@ -758,318 +746,3 @@ uint32_t  dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
   return(ret);
 }
 
-#ifdef PHY_ABSTRACTION
-#include "SIMULATION/TOOLS/defs.h"
-#ifdef OPENAIR2
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/defs.h"
-#endif
-
-int dlsch_abstraction_EESM(double* sinr_dB, uint8_t TM, uint32_t rb_alloc[4], uint8_t mcs, uint8_t dl_power_off)
-{
-
-  int ii;
-  double sinr_eff = 0;
-  int rb_count = 0;
-  int offset;
-  double bler = 0;
-
-  if(TM==5 && dl_power_off==1) {
-    //do nothing -- means there is no second UE and TM 5 is behaving like TM 6 for a singal user
-  } else
-    TM = TM-1;
-
-  for (offset = 0; offset <= 24; offset++) {
-    if (rb_alloc[0] & (1<<offset)) {
-      rb_count++;
-
-      for(ii=0; ii<12; ii++) {
-        sinr_eff += exp(-(pow(10, 0.1*(sinr_dB[(offset*12)+ii])))/beta1_dlsch[TM][mcs]);
-        //printf("sinr_eff1 = %f, power %lf\n",sinr_eff, exp(-pow(10,6.8)));
-
-        //  sinr_eff += exp(-(pow(10, (sinr_dB[offset*2+1])/10))/beta1_dlsch[TM][mcs]);
-        //printf("sinr_dB[%d]=%f\n",offset,sinr_dB[offset*2]);
-      }
-    }
-  }
-
-  LOG_D(OCM,"sinr_eff (lin, unweighted) = %f\n",sinr_eff);
-  sinr_eff =  -beta2_dlsch[TM][mcs]*log((sinr_eff)/(12*rb_count));
-  LOG_D(OCM,"sinr_eff (lin, weighted) = %f\n",sinr_eff);
-  sinr_eff = 10 * log10(sinr_eff);
-  LOG_D(OCM,"sinr_eff (dB) = %f\n",sinr_eff);
-
-  bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]);
-
-#ifdef USER_MODE // need to be adapted for the emulation in the kernel space
-
-  if (uniformrandom() < bler) {
-    LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f, TM %d)\n",mcs,sinr_eff,bler, TM);
-    return(1);
-  } else {
-    LOG_I(OCM,"abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f, TM %d)\n",mcs,sinr_eff,bler, TM);
-    return(1);
-  }
-
-#endif
-}
-
-int dlsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint32_t rb_alloc[4], uint8_t mcs,uint8_t dl_power_off)
-{
-  int ii;
-  double sinr_eff = 0;
-  double x = 0;
-  double I =0;
-  double qpsk_max=12.2;
-  double qam16_max=19.2;
-  double qam64_max=25.2;
-  double sinr_min = -20;
-  int rb_count = 0;
-  int offset=0;
-  double bler = 0;
-
-  if(TM==5 && dl_power_off==1) {
-    //do nothing -- means there is no second UE and TM 5 is behaving like TM 6 for a singal user
-  } else
-    TM = TM-1;
-
-
-  for (offset = 0; offset <= 24; offset++) {
-    if (rb_alloc[0] & (1<<offset)) {
-      rb_count++;
-
-      for(ii=0; ii<12; ii++) {
-        //x is the sinr_dB in dB
-        x = sinr_dB[(offset*12)+ii] - 10*log10(beta1_dlsch_MI[TM][mcs]);
-
-        if(x<sinr_min)
-          I +=0;
-        else {
-          if(mcs<10) {
-            if(x>qpsk_max)
-              I += 1;
-            else
-              I += (q_qpsk[0]*pow(x,7) + q_qpsk[1]*pow(x,6) + q_qpsk[2]*pow(x,5) + q_qpsk[3]*pow(x,4) + q_qpsk[4]*pow(x,3) + q_qpsk[5]*pow(x,2) + q_qpsk[6]*x + q_qpsk[7]);
-          } else if(mcs>9 && mcs<17) {
-            if(x>qam16_max)
-              I += 1;
-            else
-              I += (q_qam16[0]*pow(x,7) + q_qam16[1]*pow(x,6) + q_qam16[2]*pow(x,5) + q_qam16[3]*pow(x,4) + q_qam16[4]*pow(x,3) + q_qam16[5]*pow(x,2) + q_qam16[6]*x + q_qam16[7]);
-          } else if(mcs>16 && mcs<23) {
-
-            if(x>qam64_max)
-              I += 1;
-            else
-              I += (q_qam64[0]*pow(x,7) + q_qam64[1]*pow(x,6) + q_qam64[2]*pow(x,5) + q_qam64[3]*pow(x,4) + q_qam64[4]*pow(x,3) + q_qam64[5]*pow(x,2) + q_qam64[6]*x + q_qam64[7]);
-          }
-        }
-      }
-    }
-  }
-
-  // averaging of accumulated MI
-  I = I/(12*rb_count);
-  //Now  I->SINR_effective Mapping
-
-  if(mcs<10) {
-    sinr_eff = (p_qpsk[0]*pow(I,7) + p_qpsk[1]*pow(I,6) + p_qpsk[2]*pow(I,5) + p_qpsk[3]*pow(I,4) + p_qpsk[4]*pow(I,3) + p_qpsk[5]*pow(I,2) + p_qpsk[6]*I + p_qpsk[7]);
-  } else if(mcs>9 && mcs<17) {
-    sinr_eff = (p_qam16[0]*pow(I,7) + p_qam16[1]*pow(I,6) + p_qam16[2]*pow(I,5) + p_qam16[3]*pow(I,4) + p_qam16[4]*pow(I,3) + p_qam16[5]*pow(I,2) + p_qam16[6]*I + p_qam16[7]);
-  } else if(mcs>16 && mcs<23) {
-    sinr_eff = (p_qam64[0]*pow(I,7) + p_qam64[1]*pow(I,6) + p_qam64[2]*pow(I,5) + p_qam64[3]*pow(I,4) + p_qam64[4]*pow(I,3) + p_qam64[5]*pow(I,2) + p_qam64[6]*I + p_qam64[7]);
-  }
-
-  //sinr_eff = sinr_eff + 10*log10(beta2_dlsch_MI[TM][mcs]);
-  LOG_D(OCM,"SINR_Eff = %e\n",sinr_eff);
-
-  bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]);
-
-#ifdef USER_MODE // need to be adapted for the emulation in the kernel space
-
-  if (uniformrandom() < bler) {
-    LOG_N(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(0);
-  } else {
-    LOG_I(OCM,"abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(1);
-  }
-
-#endif
-}
-
-/*
-uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
-                             uint8_t subframe,
-                             PDSCH_t dlsch_id,
-                             uint8_t eNB_id)
-{
-
-  LTE_UE_DLSCH_t *dlsch_ue;
-  LTE_eNB_DLSCH_t *dlsch_eNB;
-  uint8_t harq_pid;
-  uint32_t eNB_id2;
-  uint32_t ue_id;
-#ifdef DEBUG_DLSCH_DECODING
-  uint16_t i;
-#endif
-  uint8_t CC_id = phy_vars_ue->CC_id;
-
-  // may not be necessary for PMCH??
-  for (eNB_id2=0; eNB_id2<NB_eNB_INST; eNB_id2++) {
-    if (RC.eNB[eNB_id2][CC_id]->frame_parms.Nid_cell == phy_vars_ue->frame_parms.Nid_cell)
-      break;
-  }
-
-  AssertFatal(eNB_id2!=NB_eNB_INST,
-              "FATAL : Could not find attached eNB for DLSCH emulation !!!!\n");
-
-  LOG_D(PHY,"[UE] dlsch_decoding_emul : subframe %d, eNB_id %d, dlsch_id %d\n",subframe,eNB_id2,dlsch_id);
-
-  //  printf("dlsch_eNB_ra->harq_processes[0] %p\n",PHY_vars_eNB_g[eNB_id]->dlsch_eNB_ra->harq_processes[0]);
-
-
-  switch (dlsch_id) {
-  case SI_PDSCH: // SI
-    dlsch_ue = phy_vars_ue->dlsch_SI[eNB_id];
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch_SI;
-    //    printf("Doing SI: TBS %d\n",dlsch_ue->harq_processes[0]->TBS>>3);
-    memcpy(dlsch_ue->harq_processes[0]->b,dlsch_eNB->harq_processes[0]->b,dlsch_ue->harq_processes[0]->TBS>>3);
-#ifdef DEBUG_DLSCH_DECODING
-    LOG_D(PHY,"SI Decoded\n");
-
-    for (i=0; i<dlsch_ue->harq_processes[0]->TBS>>3; i++)
-      LOG_T(PHY,"%x.",dlsch_eNB->harq_processes[0]->b[i]);
-
-    LOG_T(PHY,"\n");
-#endif
-    return(1);
-    break;
-
-  case RA_PDSCH: // RA
-    dlsch_ue  = phy_vars_ue->dlsch_ra[eNB_id];
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch_ra;
-    memcpy(dlsch_ue->harq_processes[0]->b,dlsch_eNB->harq_processes[0]->b,dlsch_ue->harq_processes[0]->TBS>>3);
-#ifdef DEBUG_DLSCH_DECODING
-    LOG_D(PHY,"RA Decoded\n");
-
-    for (i=0; i<dlsch_ue->harq_processes[0]->TBS>>3; i++)
-      LOG_T(PHY,"%x.",dlsch_eNB->harq_processes[0]->b[i]);
-
-    LOG_T(PHY,"\n");
-#endif
-    return(1);
-    break;
-
-  case PDSCH: // TB0
-    dlsch_ue  = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0];
-    harq_pid = dlsch_ue->current_harq_pid;
-    ue_id= (uint32_t)find_ue((int16_t)phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][(uint32_t)eNB_id]->crnti,RC.eNB[eNB_id2][CC_id]);
-    DevAssert( ue_id != (uint32_t)-1 );
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch[ue_id][0];
-
-#ifdef DEBUG_DLSCH_DECODING
-
-    for (i=0; i<dlsch_ue->harq_processes[harq_pid]->TBS>>3; i++)
-      LOG_T(PHY,"%x.",dlsch_eNB->harq_processes[harq_pid]->b[i]);
-
-    LOG_T(PHY,"\n current harq pid is %d ue id %d \n", harq_pid, ue_id);
-#endif
-
-    if (dlsch_abstraction_MIESM(phy_vars_ue->sinr_dB,
-                                phy_vars_ue->transmission_mode[eNB_id],
-                                dlsch_eNB->harq_processes[harq_pid]->rb_alloc,
-                                dlsch_eNB->harq_processes[harq_pid]->mcs,
-                                RC.eNB[eNB_id][CC_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) {
-      // reset HARQ
-      dlsch_ue->harq_processes[harq_pid]->status = SCH_IDLE;
-      dlsch_ue->harq_processes[harq_pid]->round  = 0;
-      dlsch_ue->harq_ack[subframe].ack = 1;
-      dlsch_ue->harq_ack[subframe].harq_id = harq_pid;
-      dlsch_ue->harq_ack[subframe].send_harq_status = 1;
-
-      if (dlsch_ue->harq_processes[harq_pid]->round == 0)
-        memcpy(dlsch_ue->harq_processes[harq_pid]->b,
-               dlsch_eNB->harq_processes[harq_pid]->b,
-               dlsch_ue->harq_processes[harq_pid]->TBS>>3);
-
-      return(1);
-    } else {
-      // retransmission
-      dlsch_ue->harq_processes[harq_pid]->status = ACTIVE;
-      dlsch_ue->harq_processes[harq_pid]->round++;
-      dlsch_ue->harq_ack[subframe].ack = 0;
-      dlsch_ue->harq_ack[subframe].harq_id = harq_pid;
-      dlsch_ue->harq_ack[subframe].send_harq_status = 1;
-      dlsch_ue->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
-      return(1+dlsch_ue->max_turbo_iterations);
-    }
-
-    break;
-
-  case PDSCH1: { // TB1
-    dlsch_ue = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1];
-    harq_pid = dlsch_ue->current_harq_pid;
-    int8_t UE_id = find_ue( phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->crnti, RC.eNB[eNB_id2][CC_id] );
-
-    DevAssert( UE_id != -1 );
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch[UE_id][1];
-    // reset HARQ
-    dlsch_ue->harq_processes[harq_pid]->status = SCH_IDLE;
-    dlsch_ue->harq_processes[harq_pid]->round  = 0;
-    dlsch_ue->harq_ack[subframe].ack = 1;
-    dlsch_ue->harq_ack[subframe].harq_id = harq_pid;
-    dlsch_ue->harq_ack[subframe].send_harq_status = 1;
-
-    if (dlsch_ue->harq_processes[harq_pid]->round == 0)
-      memcpy(dlsch_eNB->harq_processes[harq_pid]->b,dlsch_ue->harq_processes[harq_pid]->b,dlsch_ue->harq_processes[harq_pid]->TBS>>3);
-
-    break;
-  }
-
-  case PMCH: // PMCH
-
-    dlsch_ue  = phy_vars_ue->dlsch_MCH[eNB_id];
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch_MCH;
-
-    LOG_D(PHY,"decoding pmch emul (size is %d, enb %d %d)\n",  dlsch_ue->harq_processes[0]->TBS>>3, eNB_id, eNB_id2);
-#ifdef DEBUG_DLSCH_DECODING
-
-    for (i=0; i<dlsch_ue->harq_processes[0]->TBS>>3; i++)
-      printf("%x.",dlsch_eNB->harq_processes[0]->b[i]);
-
-    printf("\n");
-#endif
-
-    
-    //  if (dlsch_abstraction_MIESM(phy_vars_ue->sinr_dB, phy_vars_ue->transmission_mode[eNB_id], dlsch_eNB->rb_alloc,
-    //    dlsch_eNB->harq_processes[0]->mcs,RC.eNB[eNB_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) {
-    
-    if (1) {
-      // reset HARQ
-      dlsch_ue->harq_processes[0]->status = SCH_IDLE;
-      dlsch_ue->harq_processes[0]->round  = 0;
-      memcpy(dlsch_ue->harq_processes[0]->b,
-             dlsch_eNB->harq_processes[0]->b,
-             dlsch_ue->harq_processes[0]->TBS>>3);
-      dlsch_ue->last_iteration_cnt = 1;
-      return(1);
-    } else {
-      // retransmission
-      dlsch_ue->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
-      return(1+dlsch_ue->max_turbo_iterations);
-    }
-
-    break;
-
-  default:
-    dlsch_ue = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0];
-    LOG_E(PHY,"dlsch_decoding_emul: FATAL, unknown DLSCH_id %d\n",dlsch_id);
-    dlsch_ue->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
-    return(1+dlsch_ue->max_turbo_iterations);
-  }
-
-  LOG_E(PHY,"[FATAL] dlsch_decoding.c: Should never exit here ...\n");
-  return(0);
-  }*/
-#endif
-
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c
index dfd2b2af5f32648c9704a489b2669fc3b74fcdca..6284f279d895d04590cf44ca3d792c1fcda40f47 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -37,11 +37,7 @@
 #include "PHY/sse_intrin.h"
 #include "T.h"
 
-#ifndef USER_MODE
-#define NOCYGWIN_STATIC static
-#else
 #define NOCYGWIN_STATIC
-#endif
 
 /* dynamic shift for LLR computation for TM3/4
  * set as command line argument, see lte-softmodem.c
@@ -52,13 +48,10 @@ int16_t interf_unaw_shift = 13;
 
 //#define DEBUG_HARQ
 
-//#undef LOG_D
-//#define LOG_D LOG_I
-
-//#define DEBUG_PHY 1
+#define DEBUG_PHY 1
 //#define DEBUG_DLSCH_DEMOD 1
 
-
+//#define DISABLE_LOG_X
 
 // [MCS][i_mod (0,1,2) = (2,4,6)]
 unsigned char offset_mumimo_llr_drange_fix=0;
@@ -374,7 +367,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
 
   //printf("nb_rb = %d, eNB_id %d\n",nb_rb,eNB_id);
   if (nb_rb==0) {
-    LOG_D(PHY,"dlsch_demodulation.c: nb_rb=0\n");
+    //    LOG_D(PHY,"dlsch_demodulation.c: nb_rb=0\n");
     return(-1);
   }
 
@@ -850,17 +843,19 @@ int rx_pdsch(PHY_VARS_UE *ue,
   pllr_symbol_cw0 += llr_offset_symbol;
   pllr_symbol_cw1 += llr_offset_symbol;
 
-  /*LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x\n",
-             proc->frame_rx, proc->subframe_rx,symbol,
+  LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p\n",
+             frame, subframe,symbol,
              nb_rb,dlsch0_harq->Qm,
              pdsch_vars[eNB_id]->llr_length[symbol],
              pdsch_vars[eNB_id]->llr_offset[symbol],
              (int16_t*)pdsch_vars[eNB_id]->llr[0],
-             pllr_symbol);*/
+             pllr_symbol_cw0);
 
   switch (dlsch0_harq->Qm) {
   case 2 :
     if ((rx_type==rx_standard) || (codeword_TB1 == -1)) {
+
+
         dlsch_qpsk_llr(frame_parms,
                        pdsch_vars[eNB_id]->rxdataF_comp0,
                        (int16_t*)pllr_symbol_cw0,
@@ -6027,9 +6022,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF,
 
 //==============================================================================================
 
-#ifdef USER_MODE
-
-
 void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *coded_bits_per_codeword,int round,  unsigned char harq_pid)
 {
   unsigned int nsymb = (ue->frame_parms.Ncp == 0) ? 14 : 12;
@@ -6119,7 +6111,6 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *c
 
   //  printf("log2_maxh = %d\n",ue->pdsch_vars[eNB_id]->log2_maxh);
 }
-#endif
 
 #ifdef DEBUG_DLSCH_DEMOD
 /*
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c
index 26c76c553125d090605b813b80b2e60c3354ebd3..7682045ae1307ca6a10ee83ef071091f7e28528d 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,7 +40,7 @@
 //#define DEBUG_LLR_SIC
 
 
-int16_t zero[8] __attribute__ ((aligned(16))) = {0,0,0,0,0,0,0,0};
+int16_t zeros[8] __attribute__ ((aligned(16))) = {0,0,0,0,0,0,0,0};
 int16_t ones[8] __attribute__ ((aligned(16))) = {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff};
 #if defined(__x86_64__) || defined(__i386__)
 __m128i rho_rpi __attribute__ ((aligned(16)));
@@ -672,14 +672,14 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
   }
 
 
-  //printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
-  /*LOG_I(PHY,"dlsch_qpsk_llr: [symb %d / FirstSym %d / Length %d]: @LLR Buff %x, @LLR Buff(symb) %x \n",
+  /*
+  LOG_I(PHY,"dlsch_qpsk_llr: [symb %d / FirstSym %d / Length %d]: @LLR Buff %x, @LLR Buff(symb) %x \n",
              symbol,
              first_symbol_flag,
              len,
              dlsch_llr,
-             llr32);*/
-
+             llr32);
+  */
   //printf("ll32p=%p , dlsch_llr=%p, symbol=%d, flag=%d \n", llr32, dlsch_llr, symbol, first_symbol_flag);
   for (i=0; i<len; i++) {
     *llr32 = *rxF;
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c
index cda5ad0f55ee8afbe37bf4d3536cea17fb3ed575..588adfbc55c65f736444797013a08ab37ade4a65 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
index b4cfdb65fe887ab4dfc41a81f07934dbbdb9e3ea..5aec52240bfe58427dd2582b033e107ea41752ee 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -79,7 +79,7 @@ uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp,
         if ((re!=nushift+offset) && (re!=((nushift+4+offset)%12)) &&  (re!=((nushift+8+offset)%12)))
           return(1);
         /*else{
-          printf("(is_no_UEspec_RS):lprime=%d, re=%d, nushift=%d, offset=%d\n",lprime, re,nushift,offset);
+          LOG_I(PHY,"(is_no_UEspec_RS):lprime=%d, re=%d, nushift=%d, offset=%d\n",lprime, re,nushift,offset);
         }*/
       } else {
         if ((re!=nushift+offset) && (re!=((nushift+3+offset)%12)) && (re!=((nushift+6+offset)%12)) && (re!=((nushift+9+offset)%12)))
@@ -434,7 +434,7 @@ int allocate_REs_in_RB_pilots_16QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
 
 
   if (skip_dc == 0) {
-    //    printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
+    //    LOG_I(PHY,"pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
     for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
          re<12;
          x0p+=4) {
@@ -445,7 +445,7 @@ int allocate_REs_in_RB_pilots_16QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
       qam16_table_offset_im+=x0p[3];
       ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
       ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
-      //      printf("pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
+      //      LOG_I(PHY,"pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
       tti_offset+=P1_SHIFT[re+1];
       re+=P1_SHIFT[re+1];
     }
@@ -661,7 +661,7 @@ int allocate_REs_in_RB_pilots_64QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
 
 
   if (skip_dc == 0) {
-    //    printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
+    //    LOG_I(PHY,"pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
     for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
          re<12;
          x0p+=6) {
@@ -674,7 +674,7 @@ int allocate_REs_in_RB_pilots_64QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
       qam64_table_offset_im+=x0p[5];
       ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
       ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
-      //      printf("pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
+      //      LOG_I(PHY,"pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
       tti_offset+=P1_SHIFT[re+1];
       re+=P1_SHIFT[re+1];
     }
@@ -831,11 +831,11 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
 
   if (dlsch0_harq != NULL){
     #ifdef DEBUG_DLSCH_MODULATION
-      printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
+      LOG_I(PHY,"allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
     #endif
   } else{
     #ifdef DEBUG_DLSCH_MODULATION
-      printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
+      LOG_I(PHY,"allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
     #endif
   }
 
@@ -849,7 +849,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
 
 
   for (re=first_re; re<last_re; re++) {
-  // printf("element %d precoder_index for allocation %d\n",re, precoder_index );
+  // LOG_I(PHY,"element %d precoder_index for allocation %d\n",re, precoder_index );
 
     if ((skip_dc == 1) && (re==6))
       re_off=re_off - frame_parms->ofdm_symbol_size+1;
@@ -859,7 +859,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
       //check that RE is not from Cell-specific RS
 
     if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==1) {
-      //printf("re %d (jj %d)\n",re,*jj);
+      //LOG_I(PHY,"re %d (jj %d)\n",re,*jj);
 
 
       if (mimo_mode == SISO) {  //SISO mapping
@@ -869,7 +869,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
         case 2:  //QPSK
 
 
-          //printf("re %d %d(%d) : %d,%d => ",re,tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+          //LOG_I(PHY,"re %d %d(%d) : %d,%d => ",re,tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
           ((int16_t*)&txdataF[0][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
 
           *jj = *jj + 1;
@@ -1135,12 +1135,12 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
             break;
 
           case 2:  //QPSK
-            //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+            //LOG_I(PHY,"%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
             xx0_re = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
             *jj = *jj + 1;
             xx0_im = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
             *jj = *jj + 1;
-            //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+            //LOG_I(PHY,"%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
             break;
 
           case 4:  //16QAM
@@ -1206,12 +1206,12 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
             break;
 
           case 2:  //QPSK
-            //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+            //LOG_I(PHY,"%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
             xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
             *jj2 = *jj2 + 1;
             xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
             *jj2 = *jj2 + 1;
-            //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+            //LOG_I(PHY,"%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
             break;
 
           case 4:  //16QAM
@@ -1278,7 +1278,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
           ((int16_t *)&txdataF[0][tti_offset])[1]+=((xx0_im+xx1_im)>>1);
           ((int16_t *)&txdataF[1][tti_offset])[1]+=(s*((xx0_im-xx1_im)>>1));
           /*
-          printf("CDD: xx0 (%d,%d), xx1(%d,%d), s(%d), txF[0] (%d,%d), txF[1] (%d,%d)\n",
+          LOG_I(PHY,"CDD: xx0 (%d,%d), xx1(%d,%d), s(%d), txF[0] (%d,%d), txF[1] (%d,%d)\n",
            xx0_re,xx0_im,xx1_re,xx1_im, s, ((int16_t *)&txdataF[0][tti_offset])[0],((int16_t *)&txdataF[0][tti_offset])[1],
            ((int16_t *)&txdataF[1][tti_offset])[0],((int16_t *)&txdataF[1][tti_offset])[1]);
           */
@@ -1408,7 +1408,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
           precoder_index1 = 3; //[1 -j]
         }
         else {
-         printf("problem with precoder in TM4\n");
+         LOG_I(PHY,"problem with precoder in TM4\n");
           return(-1);
         }
 
@@ -1427,7 +1427,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
           ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
           ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
 
-          //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+          //LOG_I(PHY,"%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
 
           if (frame_parms->nb_antenna_ports_eNB == 2) {
             layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
@@ -1630,7 +1630,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
               ((int16_t*)&txdataF[5][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
               *jj = *jj + 1;
 
-              //printf("%d(%d) : %d,%d =>
+              //LOG_I(PHY,"%d(%d) : %d,%d =>
               //",tti_offset,*jj,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]);
               break;
 
@@ -1709,7 +1709,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
           }
         } else {
           //precoding UE spec RS
-          //printf("precoding UE spec RS\n");
+          //LOG_I(PHY,"precoding UE spec RS\n");
 
           ind = 3*lprime*dlsch0_harq->nb_rb+mprime2;
           ind_dword = ind>>4;
@@ -1727,7 +1727,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
           switch (mod_order0) {
           case 2:  //QPSK
 
-            //    printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+            //    LOG_I(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
             for (int layer=first_layer0; layer<=(first_layer0+Nlayers0); layer++) {
               ((int16_t*)&txdataF[layer][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
               *jj = *jj + 1;
@@ -1815,7 +1815,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
           }
         }
       } else if (mimo_mode>=TM9_10) {
-        printf("allocate_REs_in_RB() [dlsch.c] : ERROR, unknown mimo_mode %d\n",mimo_mode);
+        LOG_I(PHY,"allocate_REs_in_RB() [dlsch.c] : ERROR, unknown mimo_mode %d\n",mimo_mode);
         return(-1);
       }
     }
@@ -1850,7 +1850,7 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
   uint8_t first_re,last_re;
   int inc;
 #ifdef DEBUG_DLSCH_MODULATION
-  printf("allocate_re_MCH (mod %d): symbol_offset %d re_offset %d (%d), jj %d -> %d,%d, gain_lin_QPSK %d,txdataF %p\n",mod_order,symbol_offset,re_offset,skip_dc,*jj, x0[*jj], x0[1+*jj],gain_lin_QPSK,&txdataF[0][symbol_offset]);
+  LOG_I(PHY,"allocate_re_MCH (mod %d): symbol_offset %d re_offset %d (%d), jj %d -> %d,%d, gain_lin_QPSK %d,txdataF %p\n",mod_order,symbol_offset,re_offset,skip_dc,*jj, x0[*jj], x0[1+*jj],gain_lin_QPSK,&txdataF[0][symbol_offset]);
 #endif
 
   last_re=12;
@@ -1871,7 +1871,7 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
 
     tti_offset = symbol_offset + re_off + re;
 
-    //printf("re %d (jj %d)\n",re,*jj);
+    //LOG_I(PHY,"re %d (jj %d)\n",re,*jj);
     *re_allocated = *re_allocated + 1;
 
 
@@ -1879,7 +1879,7 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
 
       case 2:  //QPSK
 
-      //            printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+      //            LOG_I(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
       ((int16_t*)&txdataF[4][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
 
       *jj = *jj + 1;
@@ -1888,7 +1888,7 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
 
       *jj = *jj + 1;
 
-      //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
+      //LOG_I(PHY,"%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
       break;
 
 
@@ -2095,7 +2095,7 @@ inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms
 inline int check_skiphalf(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms,int l,int nsymb) __attribute__((always_inline));
 inline int check_skiphalf(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms,int l,int nsymb) {
 
-  //  printf("check_skiphalf : rb %d, subframe_offset %d,l %d, nsymb %d\n",rb,subframe_offset,l,nsymb);
+  //  LOG_I(PHY,"check_skiphalf : rb %d, subframe_offset %d,l %d, nsymb %d\n",rb,subframe_offset,l,nsymb);
 
   if ((frame_parms->N_RB_DL&1) == 1) { // ODD N_RB_DL
 
@@ -2333,19 +2333,19 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
   re_allocated=0;
 
 
-  //  printf("num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
+  //  LOG_I(PHY,"num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
   for (l=num_pdcch_symbols; l<nsymb; l++) {
 
   if (dlsch0 != NULL ) {
 #ifdef DEBUG_DLSCH_MODULATION
-    printf("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n",
+    LOG_I(PHY,"Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d)\n",
             harq_pid,
             dlsch0_harq->mimo_mode,
             pmi2hex_2Ar2(dlsch0_harq->pmi_alloc),
             mod_order0,
             mod_order1,
-            rb_alloc[0],
-            len);
+            rb_alloc[0]
+            );
 #endif
   }
 
@@ -2395,6 +2395,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
 	for (eNB_id=0;eNB_id<ru->num_eNB;eNB_id++){
 	  if (phy_vars_eNB == ru->eNB_list[eNB_id]) {
 	    for (aa=0;aa<ru->nb_tx;aa++){
+              LOG_I(PHY,"ru_id:%d eNB_id:%d aa:%d memcpy(ru->beam_weights, dlsch0->ue_spec_bf_weights[ru_id][0],)\n", ru_id, eNB_id, aa);
 	      memcpy(ru->beam_weights[eNB_id][5][aa],
 		     dlsch0->ue_spec_bf_weights[ru_id][0],
 		     frame_parms->ofdm_symbol_size*sizeof(int32_t));
@@ -2412,7 +2413,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
 
     if (pilots>0) {  // compute pilot arrays, could be done statically if performance suffers
       if (frame_parms->nb_antenna_ports_eNB == 1) {
-	//	printf("l %d, nushift %d, offset %d\n",l,frame_parms->nushift,offset);
+	//	LOG_I(PHY,"l %d, nushift %d, offset %d\n",l,frame_parms->nushift,offset);
 	for (i=0,i2=0;i<12;i++) {
 	  if ((i!=(frame_parms->nushift+offset)) && (i!=((frame_parms->nushift+6+offset)%12)))
 	    P1_SHIFT[i2++]=1;
@@ -2539,7 +2540,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
 
     //for (aa=0;aa<frame_parms->nb_antennas_tx;aa++)
     //memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2);
-    //printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots);
+    //LOG_I(PHY,"symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots);
     for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
 
       if (rb < 32)
@@ -2570,7 +2571,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
 
       if (dlsch1) {
         if (dlsch1_harq->Nlayers>1) {
-          printf("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
+          LOG_I(PHY,"Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
           return(-1);
         }
       }
@@ -2578,7 +2579,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
 
 
       if (rb_alloc_ind > 0) {
-        //    printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj);
+        //    LOG_I(PHY,"Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj);
 
       if (dlsch0 != NULL) {
         get_pmi_temp = get_pmi(frame_parms->N_RB_DL,
@@ -2618,7 +2619,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
             mprime +=3+frame_parms->Ncp;
       }
       else {
-        //      printf("Unallocated rb %d/symbol %d, re_offset %d, jj %d\n",rb,l,re_offset,jj);
+        //      LOG_I(PHY,"Unallocated rb %d/symbol %d, re_offset %d, jj %d\n",rb,l,re_offset,jj);
       }
       re_offset+=12; // go to next RB
 
@@ -2635,9 +2636,9 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
 
 #ifdef DEBUG_DLSCH_MODULATION
   if (dlsch0 != NULL){
-    printf("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset));
+    LOG_I(PHY,"generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset,1));
   }else{
-    printf("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch1_harq->nb_rb,dlsch1_harq->rb_alloc,mod_order1,Nl1,2,0,subframe_offset));
+    LOG_I(PHY,"generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch1_harq->nb_rb,dlsch1_harq->rb_alloc,mod_order1,Nl1,2,0,subframe_offset,1));
   }
 #endif
 
@@ -2692,7 +2693,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
 
       jj = jj + 1;
 
-      //printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
+      //LOG_I(PHY,"recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
       i++;
 
       break;
@@ -2779,7 +2780,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
 
 
 #ifdef DEBUG_DLSCH_MODULATION
-  printf("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset,1/*transmission mode*/));
+  LOG_I(PHY,"generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset,1/*transmission mode*/));
 #endif
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT);
@@ -2817,11 +2818,11 @@ int mch_modulation(int32_t **txdataF,
   jj=0;
   re_allocated=0;
 
-  //  printf("num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
+  //  LOG_I(PHY,"num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
   for (l=2; l<nsymb_pmch; l++) {
 
 #ifdef DEBUG_DLSCH_MODULATION
-    printf("Generating MCH (mod %d) in subframe %d for symbol %d\n",mod_order, subframe_offset,l);
+    LOG_I(PHY,"Generating MCH (mod %d) in subframe %d for symbol %d\n",mod_order, subframe_offset,l);
 #endif
 
     re_offset = frame_parms->first_carrier_offset;
@@ -2846,7 +2847,7 @@ int mch_modulation(int32_t **txdataF,
       else
         qam_table_s = NULL;
 
-      //printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
+      //LOG_I(PHY,"Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
       allocate_REs_in_RB_MCH(txdataF,
                              &jj,
                              re_offset,
@@ -2873,7 +2874,7 @@ int mch_modulation(int32_t **txdataF,
   }
 
 #ifdef DEBUG_DLSCH_MODULATION
-  printf("generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset,1/*transmission mode*/));
+  LOG_I(PHY,"generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset,1/*transmission mode*/));
 #endif
 
   return (re_allocated);
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
index 5eeb661f8cb4dba068ab9a6f36b40424c3855b4f..8d650bbe217db458bcacef79a463469c66c6813a 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -124,14 +124,18 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
   }
 
 #ifdef DEBUG_SCRAMBLING
+#ifdef Rel14
   printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
+#else
+  printf("scrambling: rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
+#endif
 #endif
   s = lte_gold_scram(&x1, &x2, 1);
 
   for (n=0; n<(1+(G>>5)); n++) {
 
 #ifdef DEBUG_SCRAMBLING
-    printf("scrambling %d : %d => ",k,e[k]);
+    for (int k=0;k<32;k++) printf("scrambling %d : %d xor %d = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1));
 #endif
 
                 
@@ -171,9 +175,8 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
     // This is not faster for some unknown reason
     //    ((__m128i *)e)[0] = _mm_xor_si128(((__m128i *)e)[0],((__m128i *)scrambling_lut)[s&65535]);
     //    ((__m128i *)e)[1] = _mm_xor_si128(((__m128i *)e)[1],((__m128i *)scrambling_lut)[s>>16]);
-#ifdef DEBUG_SCRAMBLING
-    printf("%d\n",e[k]);
-#endif
+
+
     
     
     s = lte_gold_scram(&x1, &x2, 0);
@@ -213,7 +216,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
   for (i=0; i<(1+(G>>5)); i++) {
     for (j=0; j<32; j++,k++) {
 #ifdef DEBUG_SCRAMBLING
-      printf("unscrambling %d : %d => ",k,llr[k]);
+    printf("unscrambling %d : %d xor %d =",k,llr[k],(s>>j)&1);
 #endif
       llr[k] = ((2*((s>>j)&1))-1)*llr[k];
 #ifdef DEBUG_SCRAMBLING
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
index 5428aa3f832cd74d19bcf21d5f673aed91464221..54803387284b1d31805b2a609b73a05a3791576e 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h
index 10ac5f866b60c173ae48c22b79a42c371b47dae4..9673ba15b503df82ee7ca7befb7f09d1bd2e6fd0 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/drs_modulation.c b/openair1/PHY/LTE_TRANSPORT/drs_modulation.c
index 861a25fabb4e505a524ed9462f0a3bebe168ce06..a0bde219b57706e59b5d5746f8408bc1307f46be 100644
--- a/openair1/PHY/LTE_TRANSPORT/drs_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/drs_modulation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -81,7 +81,6 @@ int generate_drs_pusch(PHY_VARS_UE *ue,
   //        cyclic_shift1 = 0;
   Msc_RS = 12*nb_rb;
 
-#ifdef USER_MODE
   Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints);
 
   if (Msc_idx_ptr)
@@ -91,26 +90,14 @@ int generate_drs_pusch(PHY_VARS_UE *ue,
     return(-1);
   }
 
-#else
-  uint8_t b;
-
-  for (b=0; b<33; b++)
-    if (Msc_RS==dftsizes[b])
-      Msc_RS_idx = b;
-
-#endif
-#ifdef DEBUG_DRS
-  printf("[PHY] drs_modulation: Msc_RS = %d, Msc_RS_idx = %d,cyclic_shift %d, u0 %d, v0 %d, u1 %d, v1 %d,cshift0 %d,cshift1 %d\n",Msc_RS, Msc_RS_idx,cyclic_shift,u0,v0,u1,v1,cyclic_shift0,cyclic_shift1);
-
-#endif
-
-
   for (l = (3 - frame_parms->Ncp),u=u0,v=v0,cyclic_shift=cyclic_shift0;
        l<frame_parms->symbols_per_tti;
        l += (7 - frame_parms->Ncp),u=u1,v=v1,cyclic_shift=cyclic_shift1) {
 
-    drs_offset = 0;  //  printf("drs_modulation: Msc_RS = %d, Msc_RS_idx = %d\n",Msc_RS, Msc_RS_idx);
-
+    drs_offset = 0;
+#ifdef DEBUG_DRS
+    printf("drs_modulation: Msc_RS = %d, Msc_RS_idx = %d, u=%d,v=%d\n",Msc_RS, Msc_RS_idx,u,v);
+#endif
 
 
     re_offset = frame_parms->first_carrier_offset;
diff --git a/openair1/PHY/LTE_TRANSPORT/edci.c b/openair1/PHY/LTE_TRANSPORT/edci.c
index 49a60ae9e89354e210eae247739c11b6fdea1264..5caf5bcd710f6da6e42ded836e5eca0ed547082e 100755
--- a/openair1/PHY/LTE_TRANSPORT/edci.c
+++ b/openair1/PHY/LTE_TRANSPORT/edci.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,11 +29,9 @@
 * \note
 * \warning
 */
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#endif
 #include "PHY/defs.h"
 #include "PHY/extern.h"
 #include "SCHED/defs.h"
diff --git a/openair1/PHY/LTE_TRANSPORT/extern.h b/openair1/PHY/LTE_TRANSPORT/extern.h
index 723177f6c96a4e67578132cff0d6219c3aefb4de..7ab9031010ba0fa16341899e31a81e17f7b69210 100644
--- a/openair1/PHY/LTE_TRANSPORT/extern.h
+++ b/openair1/PHY/LTE_TRANSPORT/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/group_hopping.c b/openair1/PHY/LTE_TRANSPORT/group_hopping.c
index 9cbdfad39ff0bff094be640bfe584d77631d99c6..a7c8921c2ca0c10a76b666c9b79995b0fb8e10c1 100644
--- a/openair1/PHY/LTE_TRANSPORT/group_hopping.c
+++ b/openair1/PHY/LTE_TRANSPORT/group_hopping.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
index 6024f859c9d3d7838624141ecc36f803566f7259..88312e4a4611af3cab61f73476e003429fc4e073 100644
--- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -58,7 +58,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
   uint16_t db_fulllength, db_halflength; 
   int slotoffsetF=0, blockoffsetF=0; 
 
-  uint16_t *data_block=NULL, *i=NULL;
+  uint16_t *data_block=NULL, *i=NULL, *d=NULL;
 
   IF4p5_header_t *packet_header=NULL;
   eth_state_t *eth = (eth_state_t*) (ru->ifdevice.priv);
@@ -67,11 +67,12 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
   if (ru->idx==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 );   
 
   if (packet_type == IF4p5_PDLFFT) {
-    LOG_D(PHY,"send DL_IF4p5: RU %d frame %d, subframe %d\n",ru->idx,frame,subframe);
+    //LOG_D(PHY,"send DL_IF4p5: RU %d frame %d, subframe %d\n",ru->idx,frame,subframe);
 
     if (subframe_select(fp,subframe)==SF_S)
       nsym=fp->dl_symbols_in_S_subframe;
 
+
     db_fulllength = 12*fp->N_RB_DL;
     db_halflength = (db_fulllength)>>1;
     slotoffsetF = 1;//(subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
@@ -104,7 +105,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
       if ((ru->ifdevice.trx_write_func(&ru->ifdevice,
 				       symbol_id,
 				       &tx_buffer,
-				       db_fulllength,
+				       db_fulllength, 
 				       1,
 				       IF4p5_PDLFFT)) < 0) {
         perror("ETHERNET write for IF4p5_PDLFFT\n");
@@ -137,24 +138,47 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
 
     if (packet_type == IF4p5_PULFFT) {
 
-      for (symbol_id=fp->symbols_per_tti-nsym; symbol_id<fp->symbols_per_tti; symbol_id++) {	     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF4_SYMBOL, symbol_id );
+      for (symbol_id=fp->symbols_per_tti-nsym; symbol_id<fp->symbols_per_tti; symbol_id++) {
+
+	uint32_t *rx0 = (uint32_t*) &rxdataF[0][blockoffsetF];
+	uint32_t *rx1 = (uint32_t*) &rxdataF[0][slotoffsetF];
+
+	VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF4_SYMBOL, symbol_id );
 	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 1 );		
-	LOG_D(PHY,"IF4p5_PULFFT: frame %d, subframe %d, symbol %d: %d dB\n",frame,subframe,symbol_id,
-	      dB_fixed(signal_energy((int32_t*)&rxdataF[0][blockoffsetF],db_halflength)));
-
-	for (element_id=0; element_id<db_halflength; element_id++) {
-	  i = (uint16_t*) &rxdataF[0][blockoffsetF+element_id];
-	  data_block[element_id] = ((uint16_t) lin2alaw_if4p5[*i]) | ((uint16_t)(lin2alaw_if4p5[*(i+1)]<<8));
-	  
-	  i = (uint16_t*) &rxdataF[0][slotoffsetF+element_id];
-	  data_block[element_id+db_halflength] = ((uint16_t) lin2alaw_if4p5[*i]) | ((uint16_t)(lin2alaw_if4p5[*(i+1)]<<8));
-	  //if (element_id==0) LOG_I(PHY,"send_if4p5: symbol %d rxdata0 = (%d,%d)\n",symbol_id,*i,*(i+1));
-		
-	}
-	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 0 );   	
+
+	start_meas(&ru->compression);
+
+	for (element_id=0; element_id<db_halflength; element_id+=8) {
+	  i = (uint16_t*) &rx0[element_id];
+          d = (uint16_t*) &data_block[element_id];
+          d[0] = ((uint16_t) lin2alaw_if4p5[i[0]])  | ((uint16_t)(lin2alaw_if4p5[i[1]]<<8));
+          d[1] = ((uint16_t) lin2alaw_if4p5[i[2]])  | ((uint16_t)(lin2alaw_if4p5[i[3]]<<8));
+          d[2] = ((uint16_t) lin2alaw_if4p5[i[4]])  | ((uint16_t)(lin2alaw_if4p5[i[5]]<<8));
+          d[3] = ((uint16_t) lin2alaw_if4p5[i[6]])  | ((uint16_t)(lin2alaw_if4p5[i[7]]<<8));
+          d[4] = ((uint16_t) lin2alaw_if4p5[i[8]])  | ((uint16_t)(lin2alaw_if4p5[i[9]]<<8));
+          d[5] = ((uint16_t) lin2alaw_if4p5[i[10]]) | ((uint16_t)(lin2alaw_if4p5[i[11]]<<8));
+          d[6] = ((uint16_t) lin2alaw_if4p5[i[12]]) | ((uint16_t)(lin2alaw_if4p5[i[13]]<<8));
+          d[7] = ((uint16_t) lin2alaw_if4p5[i[14]]) | ((uint16_t)(lin2alaw_if4p5[i[15]]<<8));
+
+          i = (uint16_t*) &rx1[element_id];
+          d = (uint16_t*) &data_block[element_id+db_halflength];
+          d[0] = ((uint16_t) lin2alaw_if4p5[i[0]])  | ((uint16_t)(lin2alaw_if4p5[i[1]]<<8));
+          d[1] = ((uint16_t) lin2alaw_if4p5[i[2]])  | ((uint16_t)(lin2alaw_if4p5[i[3]]<<8));
+          d[2] = ((uint16_t) lin2alaw_if4p5[i[4]])  | ((uint16_t)(lin2alaw_if4p5[i[5]]<<8));
+          d[3] = ((uint16_t) lin2alaw_if4p5[i[6]])  | ((uint16_t)(lin2alaw_if4p5[i[7]]<<8));
+          d[4] = ((uint16_t) lin2alaw_if4p5[i[8]])  | ((uint16_t)(lin2alaw_if4p5[i[9]]<<8));
+          d[5] = ((uint16_t) lin2alaw_if4p5[i[10]]) | ((uint16_t)(lin2alaw_if4p5[i[11]]<<8));
+          d[6] = ((uint16_t) lin2alaw_if4p5[i[12]]) | ((uint16_t)(lin2alaw_if4p5[i[13]]<<8));
+          d[7] = ((uint16_t) lin2alaw_if4p5[i[14]]) | ((uint16_t)(lin2alaw_if4p5[i[15]]<<8));
+
+        }
+
+        stop_meas(&ru->compression);
+        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 0 );   	
 	packet_header->frame_status &= ~(0x000f<<26);
 	packet_header->frame_status |= (symbol_id&0x000f)<<26; 
 	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF, 1 );  
+	start_meas(&ru->transport);
 	if ((ru->ifdevice.trx_write_func(&ru->ifdevice,
 					 symbol_id,
 					 &tx_buffer,
@@ -163,6 +187,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
 					 IF4p5_PULFFT)) < 0) {
 	  perror("ETHERNET write for IF4p5_PULFFT\n");
 	}
+	stop_meas(&ru->transport);
 	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF, 0 );
 	slotoffsetF  += fp->ofdm_symbol_size;
 	blockoffsetF += fp->ofdm_symbol_size;
@@ -181,7 +206,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
   } else if (packet_type >= IF4p5_PRACH && 
 	     packet_type <= IF4p5_PRACH+4) {
     // FIX: hard coded prach samples length
-    LOG_D(PHY,"IF4p5_PRACH: frame %d, subframe %d\n",frame,subframe);
+    LOG_D(PHY,"IF4p5_PRACH: frame %d, subframe %d,packet type %x\n",frame,subframe,packet_type);
     db_fulllength = PRACH_NUM_SAMPLES;
     
     if (eth->flags == ETH_RAW_IF4p5_MODE) {
@@ -222,6 +247,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
 				     packet_type)) < 0) {
       perror("ETHERNET write for IF4p5_PRACH\n");
     }
+
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF, 0 );      
   } else {    
     AssertFatal(1==0, "send_IF4p5 - Unknown packet_type %x", packet_type);     
@@ -283,7 +309,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
   *subframe = ((packet_header->frame_status)>>22)&0x000f;
 
   *packet_type = packet_header->sub_type; 
-
+  LOG_D(PHY,"recv_IF4p5: Frame %d, Subframe %d: packet_type %x\n",*frame,*subframe,*packet_type);
   if (*packet_type == IF4p5_PDLFFT) {          
     *symbol_number = ((packet_header->frame_status)>>26)&0x000f;         
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RECV_IF4_SYMBOL, *symbol_number );
@@ -313,7 +339,6 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
     slotoffsetF = (*symbol_number)*(fp->ofdm_symbol_size);
     blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength; 
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 1 );  
-    if (ru->idx==0) LOG_D(PHY,"UL_IF4p5: CC_id %d : frame %d, subframe %d, symbol %d\n",ru->idx,*frame,*subframe,*symbol_number);
     for (element_id=0; element_id<db_halflength; element_id++) {
       i = (uint16_t*) &rxdataF[0][blockoffsetF+element_id];
       *i = alaw2lin_if4p5[ (data_block[element_id] & 0xff) ]; 
@@ -325,6 +350,9 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
 
 	//if (element_id==0) LOG_I(PHY,"recv_if4p5: symbol %d rxdata0 = (%u,%u)\n",*symbol_number,*i,*(i+1));
     }
+    LOG_D(PHY,"PULFFT_IF4p5: CC_id %d : frame %d, subframe %d (symbol %d)=> %d dB\n",ru->idx,*frame,*subframe,*symbol_number,
+	  dB_fixed(signal_energy((int*)&rxdataF[0][slotoffsetF],db_halflength)+
+		   signal_energy((int*)&rxdataF[0][blockoffsetF],db_halflength)));
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 );		
   } else if (*packet_type >= IF4p5_PRACH &&
 	     *packet_type <= IF4p5_PRACH + 4) {  
diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.h b/openair1/PHY/LTE_TRANSPORT/if4_tools.h
index 830c580eb0e3e98655ecf423d1085d1be9256f33..0a95e60ead3c7af2bad4c55e73f742fc0308e4f1 100644
--- a/openair1/PHY/LTE_TRANSPORT/if4_tools.h
+++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -39,11 +39,11 @@
 #define IF4p5_PULFFT 0x0019 
 #define IF4p5_PDLFFT 0x0020
 #define IF4p5_PRACH 0x0021
-#define IF4p5_PRACH_BR_CE0 0x0021
-#define IF4p5_PRACH_BR_CE1 0x0022
-#define IF4p5_PRACH_BR_CE2 0x0023
-#define IF4p5_PRACH_BR_CE3 0x0024
-#define IF4p5_PULTICK 0x0025
+#define IF4p5_PRACH_BR_CE0 0x0022
+#define IF4p5_PRACH_BR_CE1 0x0023
+#define IF4p5_PRACH_BR_CE2 0x0024
+#define IF4p5_PRACH_BR_CE3 0x0025
+#define IF4p5_PULTICK 0x0026
 
 struct IF4p5_header {  
   /// Type
diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_tools.c
index 72253742e20a6d97c89106fa762351b4fc965878..b160318a6ee9899366430f656c2f300582a53251 100644
--- a/openair1/PHY/LTE_TRANSPORT/if5_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.h b/openair1/PHY/LTE_TRANSPORT/if5_tools.h
index f1150cd4d9376dd61a4b9985764ab8f6251fdbf7..84ad5305261b2fa29bbc6fb20aec20f9013715c4 100644
--- a/openair1/PHY/LTE_TRANSPORT/if5_tools.h
+++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c
index ab66c6fc5481c8f5a677a877bcc017e4b15cf47a..918696968b373ce1830f4abe081fa01505e4e7ae 100644
--- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c
+++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -237,10 +237,6 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
         ue->proc.proc_rxtx[i].frame_rx =   (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
         ue->proc.proc_rxtx[i].frame_rx =   (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
 
-#ifndef USER_MODE
-        // one frame delay
-        ue->proc.proc_rxtx[i].frame_rx ++;
-#endif
         ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx;
     }
 #ifdef DEBUG_INITIAL_SYNCH
diff --git a/openair1/PHY/LTE_TRANSPORT/lte_mcs.c b/openair1/PHY/LTE_TRANSPORT/lte_mcs.c
index bf206bd318492d65163d3605d53a68053c75f5a0..910610b9694c806262928ccd891a5d38f7128150 100644
--- a/openair1/PHY/LTE_TRANSPORT/lte_mcs.c
+++ b/openair1/PHY/LTE_TRANSPORT/lte_mcs.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h b/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h
index be7f6a7529a1eddf24e36300e0bc59f0cb345340..59959a90fd3b8203cb59a52c963a5e30229ba8da 100644
--- a/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h
+++ b/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/mdci.h b/openair1/PHY/LTE_TRANSPORT/mdci.h
index 1e278f8011b7e15201ff2d622b69ef6a44864bf8..060227eac033a3f979d32b29077b5de1f0aaa577 100644
--- a/openair1/PHY/LTE_TRANSPORT/mdci.h
+++ b/openair1/PHY/LTE_TRANSPORT/mdci.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c
index 603c92d69f121b8384d6eda2c8d7bd5e1121200c..9e5b6757fc84e9411c32e28fecd2465b575aac0b 100644
--- a/openair1/PHY/LTE_TRANSPORT/pbch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pbch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -37,11 +37,6 @@
 #include "PHY/extern.h"
 #include "PHY/sse_intrin.h"
 
-#ifdef PHY_ABSTRACTION
-#include "SIMULATION/TOOLS/defs.h"
-#endif
-
-
 //#define DEBUG_PBCH 1
 //#define DEBUG_PBCH_ENCODING
 //#define INTERFERENCE_MITIGATION 1
@@ -174,6 +169,8 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
   pbch_E  = (frame_parms->Ncp==NORMAL) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
   //  pbch_E_bytes = pbch_coded_bits>>3;
 
+  LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4==0);
+
   if (frame_mod4==0) {
     bzero(pbch_a,PBCH_A>>3);
     bzero(eNB_pbch->pbch_e,pbch_E);
@@ -258,13 +255,11 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
       #endif
 
       #ifdef DEBUG_PBCH
-      #ifdef USER_MODE
       write_output("pbch_encoded_output2.m","pbch_encoded_out2",
       pbch_coded_data2,
       pbch_coded_bits,
       1,
       4);
-      #endif //USER_MODE
       #endif //DEBUG_PBCH
     */
 #ifdef DEBUG_PBCH_ENCODING
@@ -286,8 +281,6 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
 
 
 #ifdef DEBUG_PBCH
-#ifdef USER_MODE
-
     if (frame_mod4==0) {
       write_output("pbch_e.m","pbch_e",
                    eNB_pbch->pbch_e,
@@ -298,8 +291,6 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
       for (i=0; i<16; i++)
         printf("e[%d] %d\n",i,eNB_pbch->pbch_e[i]);
     }
-
-#endif //USER_MODE
 #endif //DEBUG_PBCH
     // scrambling
 
@@ -307,8 +298,6 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
                     eNB_pbch->pbch_e,
                     pbch_E);
 #ifdef DEBUG_PBCH
-#ifdef USER_MODE
-
     if (frame_mod4==0) {
       write_output("pbch_e_s.m","pbch_e_s",
                    eNB_pbch->pbch_e,
@@ -319,8 +308,6 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
       for (i=0; i<16; i++)
         printf("e_s[%d] %d\n",i,eNB_pbch->pbch_e[i]);
     }
-
-#endif //USER_MODE
 #endif //DEBUG_PBCH 
   } // frame_mod4==0
 
@@ -1026,44 +1013,3 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
 
 
 }
-
-#ifdef PHY_ABSTRACTION
-uint16_t rx_pbch_emul(PHY_VARS_UE *phy_vars_ue,
-                      uint8_t eNB_id,
-                      uint8_t pbch_phase)
-{
-
-  double bler=0.0;//, x=0.0;
-  double sinr=0.0;
-  uint16_t nb_rb = phy_vars_ue->frame_parms.N_RB_DL;
-  int16_t f;
-  uint8_t CC_id=phy_vars_ue->CC_id;
-  int frame_rx = phy_vars_ue->proc.proc_rxtx[0].frame_rx;
-
-  // compute effective sinr
-  // TODO: adapt this to varible bandwidth
-  for (f=(nb_rb*6-3*12); f<(nb_rb*6+3*12); f++) {
-    if (f!=0) //skip DC
-      sinr += pow(10, 0.1*(phy_vars_ue->sinr_dB[f]));
-  }
-
-  sinr = 10*log10(sinr/(6*12));
-
-  bler = pbch_bler(sinr);
-
-  LOG_D(PHY,"EMUL UE rx_pbch_emul: eNB_id %d, pbch_phase %d, sinr %f dB, bler %f \n",
-        eNB_id,
-        pbch_phase,
-        sinr,
-        bler);
-
-  if (pbch_phase == (frame_rx % 4)) {
-    if (uniformrandom() >= bler) {
-      memcpy(phy_vars_ue->pbch_vars[eNB_id]->decoded_output,RC.eNB[eNB_id][CC_id]->pbch_pdu,PBCH_PDU_SIZE);
-      return(RC.eNB[eNB_id][CC_id]->frame_parms.nb_antenna_ports_eNB);
-    } else
-      return(-1);
-  } else
-    return(-1);
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/pcfich.c b/openair1/PHY/LTE_TRANSPORT/pcfich.c
index 83b3f7331f6a038caab7f62eb7999efc9629d15f..b7e24cb87dad212b71f461996a6a6a89f02468fa 100644
--- a/openair1/PHY/LTE_TRANSPORT/pcfich.c
+++ b/openair1/PHY/LTE_TRANSPORT/pcfich.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/pch.c b/openair1/PHY/LTE_TRANSPORT/pch.c
index f3dd046373c7bb3183ad304363ef5b75fcef05a5..600c5215bdd5c4bbde741ff86b4dad7196620633 100644
--- a/openair1/PHY/LTE_TRANSPORT/pch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c
index 0f6270956c174ab846be74653634e7887d5266aa..2bd7140c32ccc96524b58d9e489280bae5cf7754 100644
--- a/openair1/PHY/LTE_TRANSPORT/phich.c
+++ b/openair1/PHY/LTE_TRANSPORT/phich.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -38,10 +38,6 @@
 #include "LAYER2/MAC/extern.h"
 #include "LAYER2/MAC/defs.h"
 
-#ifndef USER_MODE
-#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
-#endif
-
 #include "T.h"
 
 //#define DEBUG_PHICH 1
@@ -162,7 +158,7 @@ int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int sub
     pusch_frame = (frame);
   }
 
-  LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, subframe, pusch_frame);
+  //LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, subframe, pusch_frame);
   return pusch_frame % 1024;
 }
 
@@ -184,8 +180,8 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
     else if (subframe == 1)
       pusch_subframe = (7);
     else {
-      LOG_E(PHY, "phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
-            subframe,frame_parms->tdd_config);
+      AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
+		  subframe,frame_parms->tdd_config);
       pusch_subframe = (0);
     }
 
@@ -201,7 +197,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
     else if (subframe == 4)
       pusch_subframe = (8);
     else {
-      LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
+      AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
             subframe,frame_parms->tdd_config);
       pusch_subframe = (0);
     }
@@ -214,7 +210,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
     else if (subframe == 3)
       pusch_subframe = (7);
     else {
-      LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
+      AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
             subframe,frame_parms->tdd_config);
       pusch_subframe = (0);
     }
@@ -227,7 +223,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
     } else if (subframe==0)
       pusch_subframe = (4);
     else {
-      LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
+      AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
             subframe,frame_parms->tdd_config);
       pusch_subframe = (0);
     }
@@ -238,7 +234,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
     if ( (subframe == 8) || (subframe == 9) ) {
       pusch_subframe = (subframe-6);
     } else {
-      LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
+      AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
             subframe,frame_parms->tdd_config);
       pusch_subframe = (0);
     }
@@ -249,7 +245,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
     if (subframe == 8) {
       pusch_subframe = (2);
     } else {
-      LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
+      AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
             subframe,frame_parms->tdd_config);
       pusch_subframe = (0);
     }
@@ -268,7 +264,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
     } else if (subframe == 5) {
       pusch_subframe = (8);
     } else {
-      LOG_E(PHY,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
+      AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
             subframe,frame_parms->tdd_config);
       pusch_subframe = (0);
     }
@@ -276,7 +272,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s
     break;
 
   default:
-    LOG_E(PHY, "no implementation for TDD UL/DL-config = %d!\n", frame_parms->tdd_config);
+    AssertFatal(1==0, "no implementation for TDD UL/DL-config = %d!\n", frame_parms->tdd_config);
     pusch_subframe = (0);
   }
 
@@ -560,7 +556,7 @@ void generate_phich(LTE_DL_FRAME_PARMS *frame_parms,
         break;
 
       default:
-        LOG_E(PHY,"phich_coding.c: Illegal PHICH Number\n");
+        AssertFatal(1==0,"phich_coding.c: Illegal PHICH Number\n");
       } // nseq_PHICH
     }
 
@@ -858,7 +854,7 @@ void generate_phich(LTE_DL_FRAME_PARMS *frame_parms,
       break;
 
     default:
-      LOG_E(PHY,"phich_coding.c: Illegal PHICH Number\n");
+      AssertFatal(1==0,"phich_coding.c: Illegal PHICH Number\n");
     }
 
 
@@ -1255,7 +1251,7 @@ void rx_phich(PHY_VARS_UE *ue,
         break;
 
       default:
-        LOG_E(PHY,"phich_coding.c: Illegal PHICH Number\n");
+        AssertFatal(1==0,"phich_coding.c: Illegal PHICH Number\n");
       } // nseq_PHICH
     }
 
@@ -1342,7 +1338,7 @@ void rx_phich(PHY_VARS_UE *ue,
       break;
 
     default:
-      LOG_E(PHY,"phich_coding.c: Illegal PHICH Number\n");
+      AssertFatal(1==0,"phich_coding.c: Illegal PHICH Number\n");
     }
   }
 
@@ -1527,9 +1523,11 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
   if (frame_parms->Ncp == 1)
     NSF_PHICH = 2;
 
-  pusch_frame = phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe);
-  pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
-  harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe);
+  if (eNB->phich_vars[subframe&1].num_hi > 0) {
+    pusch_frame = phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe);
+    pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
+    harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe);
+  }
 
   for (i=0; i<eNB->phich_vars[subframe&1].num_hi; i++) {
 
diff --git a/openair1/PHY/LTE_TRANSPORT/pilots.c b/openair1/PHY/LTE_TRANSPORT/pilots.c
index 03fd2928860d7893384ec05e096dd2096b6fba02..01b4bb7a8ea4e1ec0703e6ff51ce018e51d3da77 100644
--- a/openair1/PHY/LTE_TRANSPORT/pilots.c
+++ b/openair1/PHY/LTE_TRANSPORT/pilots.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c b/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c
index 45bd163cf2e12cc49f0fbdf1720828fadc329c35..90e9ae329caed2bf17853f64ea511e4315ec21d8 100644
--- a/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c
+++ b/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c
index b4199d9b605e36e2f0ca7fa7002d1b9890e25e11..63aac7f091b0288eb172e775ca103e5eec6a80f2 100644
--- a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c
+++ b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/pmch.c b/openair1/PHY/LTE_TRANSPORT/pmch.c
index eb2fa1d8431c2e22cbae2845c6db4c12abf06935..e756df1fe1a5b4fd4612d0f019bca3bd57c7a64f 100644
--- a/openair1/PHY/LTE_TRANSPORT/pmch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pmch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/power_control.c b/openair1/PHY/LTE_TRANSPORT/power_control.c
index 9421efe52d7857f59c07503110a950a8667ef259..36b2bfbeab81abcaac6287a9219898f24160742e 100644
--- a/openair1/PHY/LTE_TRANSPORT/power_control.c
+++ b/openair1/PHY/LTE_TRANSPORT/power_control.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,20 +33,20 @@ double ratioPB[2][4]={{ 0.00000,  -0.96910,  -2.21849,  -3.97940}, //in db
 
 double pa_values[8]={-6.0,-4.77,-3.0,-1.77,0.0,1.0,2.0,3.0}; //reported by higher layers
 
-double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated)
+double get_pa_dB(uint8_t pa)
 {
-  if (pdsch_config_dedicated)
-    return(pa_values[ pdsch_config_dedicated->p_a]);
-  else
-    return(0.0);
+  AssertFatal(pa<8,"pa %d is not in (0...7)\n",pa);
+
+  return(pa_values[pa]);
+
 }
 
-double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
+double computeRhoA_eNB(uint8_t pa,
                        LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port){
   double rho_a_dB;
   double sqrt_rho_a_lin;
 
-  rho_a_dB = get_pa_dB(pdsch_config_dedicated);
+  rho_a_dB = get_pa_dB(pa);
 
   if(!dl_power_off) //if dl_power_offset is 0, this is for MU-interference, TM5
     rho_a_dB-=10*log10(2);
@@ -59,14 +59,14 @@ double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
   dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
 
 #if DEBUG_PC
-  printf("eNB: p_a=%d, value=%f, sqrt_rho_a=%d\n",pdsch_config_dedicated->p_a,pa_values[ pdsch_config_dedicated->p_a],dlsch_eNB->sqrt_rho_a);
+  printf("eNB: p_a=%d, value=%f, sqrt_rho_a=%d\n",p_a,pa_values[ pdsch_config_dedicated->p_a],dlsch_eNB->sqrt_rho_a);
 #endif
 
   return(rho_a_dB);
 }
 
-double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED  *pdsch_config_dedicated,
-                       PDSCH_CONFIG_COMMON *pdsch_config_common,
+double computeRhoB_eNB(uint8_t pa,
+                       uint8_t pb,
                        uint8_t n_antenna_port,
                        LTE_eNB_DLSCH_t *dlsch_eNB,
                        int dl_power_off)
@@ -75,19 +75,21 @@ double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED  *pdsch_config_dedicated,
   double rho_a_dB, rho_b_dB;
   double sqrt_rho_b_lin;
 
-  rho_a_dB= computeRhoA_eNB(pdsch_config_dedicated,dlsch_eNB,dl_power_off, n_antenna_port);
+  AssertFatal(pa<8,"pa %d is not in (0...7)\n",pa);
+  AssertFatal(pb<4,"pb %d is not in (0...3)\n",pb);
+  rho_a_dB= computeRhoA_eNB(pa,dlsch_eNB,dl_power_off, n_antenna_port);
 
   if(n_antenna_port>1)
-    rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
+    rho_b_dB= ratioPB[1][pb] + rho_a_dB;
   else
-    rho_b_dB= ratioPB[0][pdsch_config_common->p_b] + rho_a_dB;
+    rho_b_dB= ratioPB[0][pb] + rho_a_dB;
 
   sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB));
 
   dlsch_eNB->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13));
 
 #ifdef DEBUG_PC
-  printf("eNB: n_ant=%d, p_b=%d -> rho_b/rho_a=%f -> sqrt_rho_b=%d\n",n_antenna_port,pdsch_config_common->p_b,ratioPB[1][pdsch_config_common->p_b],dlsch_eNB->sqrt_rho_b);
+  printf("eNB: n_ant=%d, p_b=%d -> rho_b/rho_a=%f -> sqrt_rho_b=%d\n",n_antenna_port,pb,ratioPB[1][pb],dlsch_eNB->sqrt_rho_b);
 #endif
   return(rho_b_dB);
 }
@@ -102,7 +104,7 @@ double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
   double rho_a_dB;
   double sqrt_rho_a_lin;
 
-  rho_a_dB = get_pa_dB(pdsch_config_dedicated);
+  rho_a_dB = get_pa_dB(pdsch_config_dedicated->p_a);
 
   if(!dl_power_off)
     rho_a_dB-=10*log10(2);
diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c
index 0282b780d9201a46270a82d936f470857ea2c76a..b58aa91636a4d83fb9aa5d6aabfa3a476fc2e884 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -39,6 +39,7 @@
 #include "UTIL/LOG/vcd_signal_dumper.h"
 
 //#define PRACH_DEBUG 1
+//#define PRACH_WRITE_OUTPUT_DEBUG 1
 
 uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
 uint16_t NCS_restricted[15]   = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case
@@ -341,7 +342,6 @@ uint16_t prach_root_sequence_map4[138] = {  1,138,2,137,3,136,4,135,5,134,6,133,
                                             61,78,62,77,63,76,64,75,65,74,66,73,67,72,68,71,69,70
                                          };
 
-#ifdef USER_MODE
 void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
 {
 
@@ -362,7 +362,6 @@ void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
   fclose(fd);
 
 }
-#endif
 
 // This function computes the du
 void fill_du(uint8_t prach_fmt)
@@ -562,7 +561,7 @@ int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex
     t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
     t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
 #ifdef PRACH_DEBUG
-    LOG_D(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
+    LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
           prach_ConfigIndex,
           subframe,
           t0_ra,t1_ra,t2_ra);
@@ -575,7 +574,7 @@ int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex
          (((subframe>4)&&(t1_ra==1))))) {                // PRACH is in 2nd half-frame
       if ((prach_ConfigIndex<48) &&                          // PRACH only in normal UL subframe
 	  (((subframe%5)-2)==t2_ra)) prach_mask=1;
-      else if ((((subframe%5)-1)==t2_ra)) prach_mask=1;      // PRACH can be in UpPTS
+      else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1;      // PRACH can be in UpPTS
     }
   }
 
@@ -655,7 +654,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
 
 #else //normal case (simulation)
   prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset;
-  LOG_D(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
+  LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
     prach_start,
     ue->rx_offset,
     ue->hw_timing_advance,
@@ -723,7 +722,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
   } else { // This is the high-speed case
 
 #ifdef PRACH_DEBUG
-    LOG_D(PHY,"[UE %d] High-speed mode, NCS_config %d\n",ue->Mod_id,Ncs_config);
+    LOG_I(PHY,"[UE %d] High-speed mode, NCS_config %d\n",ue->Mod_id,Ncs_config);
 #endif
 
     not_found = 1;
@@ -784,7 +783,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
 #ifdef PRACH_DEBUG
 
   if (NCS>0)
-    LOG_D(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n",
+    LOG_I(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n",
           rootSequenceIndex,preamble_index,NCS,Ncs_config,N_ZC/NCS,n_ra_prb,
           preamble_offset,preamble_shift);
 
@@ -1039,14 +1038,14 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
     break;
   }
 
-  //LOG_D(PHY,"prach_len=%d\n",prach_len);
+  //LOG_I(PHY,"prach_len=%d\n",prach_len);
 
   AssertFatal(prach_fmt<4,
 	      "prach_fmt4 not fully implemented" );
 #if defined(EXMIMO) || defined(OAI_USRP)
   int j;
   int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti;
-  LOG_D( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
+  LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
   
   for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) {
     ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
@@ -1079,7 +1078,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
   
 
   
-#if 0
+#if defined(PRACH_WRITE_OUTPUT_DEBUG)
   write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
   write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
   write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
@@ -1090,6 +1089,10 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
 }
 //__m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3;
 
+#ifndef Rel14
+#define rx_prach0 rx_prach
+#endif
+
 void rx_prach0(PHY_VARS_eNB *eNB,
 	       RU_t *ru,
 	       uint16_t *max_preamble,
@@ -1114,7 +1117,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
   uint8_t            restricted_set;      
   uint8_t            n_ra_prb;
 
+#ifdef PRACH_DEBUG
   int                frame;
+#endif
   int                subframe;
   int16_t            *prachF=NULL;
   int16_t            **rxsigF=NULL;
@@ -1131,7 +1136,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
   uint16_t numshift=0;
   uint16_t *prach_root_sequence_map;
   uint8_t not_found;
-  int k;
+  int k=0;
   uint16_t u;
   int16_t *Xu;
   uint16_t offset;
@@ -1151,7 +1156,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 #ifdef PRACH_DEBUG
   int en0=0;
 #endif
-  int en;
+
   if (ru) { 
     fp    = &ru->frame_parms;
     nb_rx = ru->nb_rx;
@@ -1202,7 +1207,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 #ifdef Rel14
     if (br_flag == 1) {
       prach_ifftp         = eNB->prach_vars_br.prach_ifft[ce_level];
+#ifdef PRACH_DEBUG
       frame               = eNB->proc.frame_prach_br;
+#endif
       subframe            = eNB->proc.subframe_prach_br;
       prachF              = eNB->prach_vars_br.prachF;
       rxsigF              = eNB->prach_vars_br.rxsigF[ce_level];
@@ -1219,19 +1226,23 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 #endif
       {
         prach_ifftp       = eNB->prach_vars.prach_ifft[0];
+#ifdef PRACH_DEBUG
         frame             = eNB->proc.frame_prach;
+#endif
         subframe          = eNB->proc.subframe_prach;
         prachF            = eNB->prach_vars.prachF;
         rxsigF            = eNB->prach_vars.rxsigF[0];
 #ifdef PRACH_DEBUG
-        if ((frame&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n",
-				     subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
+        //if ((frame&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
 #endif
       }
   }
   else {
 #ifdef Rel14
     if (br_flag == 1) {
+#ifdef PRACH_DEBUG
+        frame             = ru->proc.frame_prach_br;
+#endif
         subframe          = ru->proc.subframe_prach_br;
         rxsigF            = ru->prach_rxsigF_br[ce_level];
 #ifdef PRACH_DEBUG
@@ -1242,6 +1253,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
     else
 #endif
       {
+#ifdef PRACH_DEBUG
+        frame             = ru->proc.frame_prach;
+#endif
         subframe          = ru->proc.subframe_prach;
         rxsigF            = ru->prach_rxsigF;
 #ifdef PRACH_DEBUG
@@ -1256,9 +1270,32 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 
   for (aa=0; aa<nb_rx; aa++) {
     if (ru->if_south == LOCAL_RF) { // set the time-domain signal if we have to use it in this node
+      // DJP - indexing below in subframe zero takes us off the beginning of the array???
       prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
 #ifdef PRACH_DEBUG
-	if ((frame&1023) < 20) LOG_I(PHY,"RU %d, br_flag %d ce_level %d frame %d subframe %d, : prach %p (energy %d)\n",ru->idx,br_flag,ce_level,frame,subframe,prach[aa],dB_fixed(en0=signal_energy(prach[aa],fp->samples_per_tti))); 
+      int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
+      int8_t dbEn0 = dB_fixed(en0);
+      int8_t rach_dBm = dbEn0 - eNB->rx_total_gain_dB;
+
+#ifdef PRACH_WRITE_OUTPUT_DEBUG
+        if (dbEn0>32 && prach[0]!= NULL)
+        {
+          static int counter=0;
+
+          char buffer[80];
+          //counter++;
+          sprintf(buffer, "%s%d", "/tmp/prach_rx",counter);
+          write_output(buffer,"prach_rx",prach[0],fp->samples_per_tti,1,13);
+        }
+#endif
+
+      if (dbEn0>32)
+      {
+#ifdef PRACH_WRITE_OUTPUT_DEBUG
+        if (prach[0]!= NULL) write_output("prach_rx","prach_rx",prach[0],fp->samples_per_tti,1,1);
+#endif
+        LOG_I(PHY,"RU %d, br_flag %d ce_level %d frame %d subframe %d per_tti:%d prach:%p (energy %d) TA:%d rach_dBm:%d rxdata:%p index:%d\n",ru->idx,br_flag,ce_level,frame,subframe,fp->samples_per_tti,prach[aa],dbEn0,ru->N_TA_offset,rach_dBm,ru->common.rxdata[aa], (subframe*fp->samples_per_tti)-ru->N_TA_offset);
+        }
 #endif
     }
   }
@@ -1341,7 +1378,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
   if (((eNB!=NULL) && (ru->function != NGFI_RAU_IF4p5))||
       ((eNB==NULL) && (ru->function == NGFI_RRU_IF4p5))) { // compute the DFTs of the PRACH temporal resources
     // Do forward transform
-    LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d\n",fp->N_RB_UL);
+#ifdef PRACH_DEBUG
+    LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d nb_rx:%d Ncp:%d\n",fp->N_RB_UL, nb_rx, Ncp);
+#endif
     for (aa=0; aa<nb_rx; aa++) {
       AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa);
       prach2 = prach[aa] + (Ncp<<1);
@@ -1446,7 +1485,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
       k+=13; 
       k*=2;
       int dftsize_x2 = fp->ofdm_symbol_size*24;
-      LOG_D(PHY,"Shifting prach_rxF from %d to 0\n",k);
+      //LOG_D(PHY,"Shifting prach_rxF from %d to 0\n",k);
 
       if ((k+(839*2)) > dftsize_x2) { // PRACH signal is split around DC 
 	memmove((void*)&rxsigF[aa][dftsize_x2-k],(void*)&rxsigF[aa][0],(k+(839*2)-dftsize_x2)*2);	
@@ -1472,11 +1511,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
     return;
   } else if (eNB!=NULL) {
 
-    en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
 #ifdef PRACH_DEBUG
+    int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
     if ((en > 60)&&(br_flag==1)) LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
 #endif
-
   }
   
   // in case of RAU and prach received rx_thread wakes up prach
@@ -1621,7 +1659,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 	}
 
       memset(prachF, 0, sizeof(int16_t)*2*1024 );
-#ifdef PRACH_DEBUG
+#if defined(PRACH_WRITE_OUTPUT_DEBUG)
       if (prach[0]!= NULL) write_output("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
 #endif
       // write_output("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
@@ -1646,16 +1684,16 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 	  idft1024(prachF,prach_ifft_tmp,1);
 	  // compute energy and accumulate over receive antennas and repetitions for BR
 	  for (i=0;i<2048;i++)
-	    prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[i<<1] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>15;
+	    prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[i<<1] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
 	} else {
 	  idft256(prachF,prach_ifft_tmp,1);
 	  log2_ifft_size = 8;
 	  // compute energy and accumulate over receive antennas and repetitions for BR
 	  for (i=0;i<256;i++)
-	    prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>15;
+	    prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
 	}
 	
-#ifdef PRACH_DEBUG
+#if defined(PRACH_WRITE_OUTPUT_DEBUG)
 	if (aa==0) write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
 #endif
       // if (aa=1) write_output("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
@@ -1704,19 +1742,22 @@ void rx_prach0(PHY_VARS_eNB *eNB,
     k*=2;
     
     if (br_flag == 0) {
-      /*
+#if defined(PRACH_WRITE_OUTPUT_DEBUG)
 	write_output("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
 	write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
 	write_output("Xu.m","xu",Xu,N_ZC,1,1);
-	write_output("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);*/
+	write_output("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);
+#endif
     }
     else {
+#if defined(PRACH_WRITE_OUTPUT_DEBUG)
       printf("Dumping prach (br_flag %d), k = %d (n_ra_prb %d)\n",br_flag,k,n_ra_prb);
       write_output("rxsigF_br.m","prach_rxF_br",&rxsigF[0][0],12288,1,1);
       write_output("prach_rxF_comp0_br.m","prach_rxF_comp0_br",prachF,1024,1,1);
       write_output("Xu_br.m","xu_br",Xu,N_ZC,1,1);
       write_output("prach_ifft0_br.m","prach_t0_br",prach_ifft,1024,1,1);
       exit(-1);      
+#endif
     }
 
   }
@@ -1727,9 +1768,8 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 
 
 
-#ifndef Rel14
-#define rx_prach rx_prach0
-#else
+#ifdef Rel14
+
 void rx_prach(PHY_VARS_eNB *eNB,
 	      RU_t *ru,
 	      uint16_t *max_preamble,
@@ -1769,7 +1809,8 @@ void rx_prach(PHY_VARS_eNB *eNB,
     }
   }
 }
-#endif
+
+#endif /* Rel14 */
 
 void init_prach_tables(int N_ZC)
 {
diff --git a/openair1/PHY/LTE_TRANSPORT/prach.h b/openair1/PHY/LTE_TRANSPORT/prach.h
index efdb257785d8cfdaff3cdd29db228f963e6e13e6..f135af6d811b5187a2fe5d4892bdce7b7ff88b7b 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach.h
+++ b/openair1/PHY/LTE_TRANSPORT/prach.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c
index d4ed922274679e0a133a550d7e967b22479b3057..9e328353a4fdd975b26640822813bd4d5a909846 100644
--- a/openair1/PHY/LTE_TRANSPORT/print_stats.c
+++ b/openair1/PHY/LTE_TRANSPORT/print_stats.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h
index f67af89bf701076e0ddec39dd760072ce2605f2d..e706bbbaeb2658fba754ce367e9f248d09f0e490 100644
--- a/openair1/PHY/LTE_TRANSPORT/proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/proto.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -83,6 +83,12 @@ void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
 
 void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch);
 
+/** \fn free_eNB_ulsch(LTE_eNB_DLSCH_t *dlsch)
+    \brief This function frees memory allocated for a particular ULSCH at eNB
+    @param ulsch Pointer to ULSCH to be removed
+*/
+void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch);
+
 LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
 
 LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag);
@@ -1736,13 +1742,15 @@ int generate_ue_dlsch_params_from_dci(int frame,
                                       uint16_t tc_rnti);
 
 void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
+                        int frame,
+                        int subframe,
 			eNB_rxtx_proc_t *proc,
 			DCI_ALLOC_t *dci_alloc,
 			nfapi_dl_config_dci_dl_pdu *pdu);
 
 void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *dci_alloc,nfapi_dl_config_mpdcch_pdu *pdu);
 
-void fill_dci0(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,
+void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,
 	      nfapi_hi_dci0_dci_pdu *pdu);
 
 void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe);
@@ -1801,7 +1809,7 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB,
                                        uint8_t use_srs);
 
 
-void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_id);
+void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_id,int round);
 
 int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci);
 
@@ -2134,6 +2142,8 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
                       uint8_t *payload);
 
 
+void init_ulsch_power_LUT(void);
+
 /*!
   \brief Check for PRACH TXop in subframe
   @param frame_parms Pointer to LTE_DL_FRAME_PARMS
@@ -2172,9 +2182,12 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru,
 	      uint16_t *max_preamble, 
 	      uint16_t *max_preamble_energy, 
 	      uint16_t *max_preamble_delay, 
-	      uint16_t Nf, uint8_t tdd_mapindex,
-	      uint8_t br_flag);
-
+	      uint16_t Nf, uint8_t tdd_mapindex
+#ifdef Rel14
+	      ,
+              uint8_t br_flag
+#endif
+	      );
 /*!
   \brief Helper for MAC, returns number of available PRACH in TDD for a particular configuration index
   @param frame_parms Pointer to LTE_DL_FRAME_PARMS structure
@@ -2239,15 +2252,15 @@ uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB,
                                     uint8_t num_pdcch_symbols);
 
 // DL power control functions
-double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated);
+double get_pa_dB(uint8_t pa);
 
-double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
-                       LTE_eNB_DLSCH_t *dlsch_eNB,
+double computeRhoA_eNB(uint8_t pa,
+		       LTE_eNB_DLSCH_t *dlsch_eNB,
                        int dl_power_off,
                        uint8_t n_antenna_port);
 
-double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED  *pdsch_config_dedicated,
-                       PDSCH_CONFIG_COMMON *pdsch_config_common,
+double computeRhoB_eNB(uint8_t pa,
+		       uint8_t pb,
                        uint8_t n_antenna_port,
                        LTE_eNB_DLSCH_t *dlsch_eNB,
                        int dl_power_off);
diff --git a/openair1/PHY/LTE_TRANSPORT/proto_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/proto_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..d8b17ff26386e5f825c514faee7d8a0cbfbae331
--- /dev/null
+++ b/openair1/PHY/LTE_TRANSPORT/proto_NB_IoT.h
@@ -0,0 +1,362 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file PHY/LTE_TRANSPORT/proto.h
+ * \brief Function prototypes for PHY physical/transport channel processing and generation V8.6 2009-03
+ * \author R. Knopp, F. Kaltenberger
+ * \date 2011
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+#ifndef __LTE_TRANSPORT_PROTO_NB_IOT__H__
+#define __LTE_TRANSPORT_PROTO_NB_IOT__H__
+#include "PHY/defs_L1_NB_IoT.h"
+//#include <math.h>
+
+//NPSS
+
+int generate_npss_NB_IoT(int32_t                **txdataF,
+                         short                  amp,
+                         NB_IoT_DL_FRAME_PARMS  *frame_parms,
+                         unsigned short         symbol_offset,          // symbol_offset should equal to 3 for NB-IoT 
+                         unsigned short         slot_offset,
+                         unsigned short         RB_IoT_ID);             // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
+
+//NSSS
+
+int generate_sss_NB_IoT(int32_t                **txdataF,
+                        int16_t                amp,
+                        NB_IoT_DL_FRAME_PARMS  *frame_parms, 
+                        uint16_t               symbol_offset,             // symbol_offset = 3 for NB-IoT 
+                        uint16_t               slot_offset, 
+                        unsigned short         frame_number,        // new attribute (Get value from higher layer), it does not exist for LTE
+                        unsigned short         RB_IoT_ID);          // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
+
+//*****************Vincent part for Cell ID estimation from NSSS ******************// 
+
+int rx_nsss_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int32_t *tot_metric); 
+
+int nsss_extract_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
+            NB_IoT_DL_FRAME_PARMS *frame_parms,
+            int32_t **nsss_ext,
+            int l);
+
+//NRS
+
+void generate_pilots_NB_IoT(PHY_VARS_eNB_NB_IoT  *phy_vars_eNB,
+                            int32_t              **txdataF,
+                            int16_t              amp,
+                            uint16_t             Ntti,                // Ntti = 10
+                            unsigned short       RB_IoT_ID,       // RB reserved for NB-IoT
+                            unsigned short       With_NSSS);      // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
+
+
+//NPBCH
+
+int allocate_npbch_REs_in_RB(NB_IoT_DL_FRAME_PARMS  *frame_parms,
+                             int32_t                **txdataF,
+                             uint32_t               *jj,
+                             uint32_t               symbol_offset,
+                             uint8_t                *x0,
+                             uint8_t                pilots,
+                             int16_t                amp,
+                             unsigned short         id_offset,
+                             uint32_t               *re_allocated);
+
+
+int generate_npbch(NB_IoT_eNB_NPBCH_t     *eNB_npbch,
+                   int32_t                **txdataF,
+                   int                    amp,
+                   NB_IoT_DL_FRAME_PARMS  *frame_parms,
+                   uint8_t                *npbch_pdu,
+                   uint8_t                frame_mod64,
+                   unsigned short         NB_IoT_RB_ID);
+
+
+void npbch_scrambling(NB_IoT_DL_FRAME_PARMS  *frame_parms,
+                      uint8_t                *npbch_e,
+                      uint32_t               length);
+
+// Functions below implement 36-211 and 36-212
+
+/*Function to pack the DCI*/ 
+// newly added function for NB-IoT , does not exist for LTE
+void add_dci_NB_IoT(DCI_PDU_NB_IoT    *DCI_pdu,
+                    void              *pdu,
+                    rnti_t            rnti,
+                    unsigned char     dci_size_bytes,
+                    unsigned char     aggregation, 
+                    unsigned char     dci_size_bits,
+                    unsigned char     dci_fmt,
+                    uint8_t           npdcch_start_symbol);
+
+
+/*Use the UL DCI Information to configure PHY and also Pack the DCI*/
+int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT     *eNB,
+                                              eNB_rxtx_proc_NB_IoT_t  *proc,
+                                              DCI_CONTENT             *DCI_Content,
+                                              uint16_t                rnti,
+                                              DCI_format_NB_IoT_t     dci_format,
+                                              uint8_t                 UE_id,
+                                              uint8_t                 aggregation,
+									                            uint8_t                 npdcch_start_symbol);
+
+
+/*Use the DL DCI Information to configure PHY and also Pack the DCI*/
+int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB_NB_IoT    *eNB,
+                                              int                    frame,
+                                              uint8_t                subframe,
+                                              DCI_CONTENT            *DCI_Content,
+                                              uint16_t               rnti,
+                                              DCI_format_NB_IoT_t    dci_format,
+                                              NB_IoT_eNB_NDLSCH_t    *ndlsch,
+                                              NB_IoT_DL_FRAME_PARMS  *frame_parms,
+                                              uint8_t                aggregation,
+									                            uint8_t                npdcch_start_symbol);
+
+
+/*Function for DCI encoding, scrambling, modulation*/
+uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t     *npdcch,
+						                    uint8_t                 Num_dci,
+                                DCI_ALLOC_NB_IoT_t      *dci_alloc,
+                                int16_t                 amp,
+                                NB_IoT_DL_FRAME_PARMS   *fp,
+                                int32_t                 **txdataF,
+                                uint32_t                subframe,
+						                    uint8_t                 npdcch_start_symbol);
+
+/*!
+  \brief Decoding of PUSCH/ACK/RI/ACK from 36-212.
+  @param phy_vars_eNB Pointer to eNB top-level descriptor
+  @param proc Pointer to RXTX proc variables
+  @param UE_id ID of UE transmitting this PUSCH
+  @param subframe Index of subframe for PUSCH
+  @param control_only_flag Receive PUSCH with control information only
+  @param Nbundled Nbundled parameter for ACK/NAK scrambling from 36-212/36-213
+  @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used
+  @returns 0 on success
+*/
+unsigned int  ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT     *phy_vars_eNB,
+                                    eNB_rxtx_proc_NB_IoT_t  *proc,
+                                    uint8_t                 UE_id,
+                                    uint8_t                 control_only_flag,
+                                    uint8_t                 Nbundled,
+                                    uint8_t                 llr8_flag);
+
+//NB-IoT version
+NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(//unsigned char Kmimo,
+                                          //unsigned char Mdlharq,
+                                          uint32_t Nsoft,
+                                          //unsigned char N_RB_DL,
+                                          uint8_t abstraction_flag,
+                                          NB_IoT_DL_FRAME_PARMS* frame_parms);
+
+
+NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB_IoT(uint8_t abstraction_flag);
+
+
+uint8_t subframe2harq_pid_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe);
+
+
+/** \brief Compute Q (modulation order) based on I_MCS for PUSCH.  Implements table 8.6.1-1 from 36.213.
+    @param I_MCS */
+
+//uint8_t get_Qm_ul_NB_IoT(uint8_t I_MCS);
+unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU);
+
+/** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
+    uint8_t *input_buffer,
+    LTE_DL_FRAME_PARMS *frame_parms,
+    uint8_t num_pdcch_symbols,
+    LTE_eNB_DLSCH_t *dlsch,
+    int frame,
+    uint8_t subframe)
+    \brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are:
+    - CRC computation and addition
+    - Code block segmentation and sub-block CRC addition
+    - Channel coding (Turbo coding)
+    - Rate matching (sub-block interleaving, bit collection, selection and transmission
+    - Code block concatenation
+    @param eNB Pointer to eNB PHY context
+    @param input_buffer Pointer to input buffer for sub-frame
+    @param frame_parms Pointer to frame descriptor structure
+    @param num_pdcch_symbols Number of PDCCH symbols in this subframe
+    @param dlsch Pointer to dlsch to be encoded
+    @param frame Frame number
+    @param subframe Subframe number
+    @param rm_stats Time statistics for rate-matching
+    @param te_stats Time statistics for turbo-encoding
+    @param i_stats Time statistics for interleaving
+    @returns status
+*/
+
+int32_t dlsch_encoding_NB_IoT(unsigned char              *a,
+                              NB_IoT_eNB_DLSCH_t         *dlsch,
+                              uint8_t                    Nsf,        // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
+                              unsigned int               G,          // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
+                              time_stats_t               *rm_stats,
+                              time_stats_t               *te_stats,
+                              time_stats_t               *i_stats);
+
+
+void rx_ulsch_NB_IoT(PHY_VARS_eNB_NB_IoT      *phy_vars_eNB,
+                     eNB_rxtx_proc_NB_IoT_t   *proc,
+                     uint8_t                  eNB_id,               // this is the effective sector id
+                     uint8_t                  UE_id,
+                     NB_IoT_eNB_NULSCH_t      **ulsch,
+                     uint8_t                  cooperation_flag);
+
+
+
+
+void ulsch_extract_rbs_single_NB_IoT(int32_t                **rxdataF,
+                                     int32_t                **rxdataF_ext,
+                                     // uint32_t               first_rb, 
+                                     //uint32_t               UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block 
+                                     uint8_t                N_sc_RU, // number of subcarriers in UL
+				     uint32_t               I_sc, // subcarrier indication field
+                                     uint32_t               nb_rb,
+                                     uint8_t                l,
+                                     uint8_t                Ns,
+                                     NB_IoT_DL_FRAME_PARMS  *frame_parms);
+
+void extract_CQI_NB_IoT(void *o,UCI_format_NB_IoT_t uci_format,NB_IoT_eNB_UE_stats *stats,uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode);
+
+//*****************Vincent part for nprach ******************//
+void RX_NPRACH_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int16_t *Rx_buffer); 
+
+uint32_t TA_estimation_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, 
+                              int16_t *Rx_sub_sampled_buffer, 
+                              uint16_t sub_sampling_rate, 
+                              uint16_t FRAME_LENGTH_COMPLEX_SUB_SAMPLES, 
+                              uint32_t estimated_TA_coarse, 
+                              char coarse); 
+
+uint8_t NPRACH_detection_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, int16_t *Rx_sub_sampled_buffer, uint16_t sub_sampling_rate, uint32_t FRAME_LENGTH_COMPLEX_SUB_SAMPLES); 
+
+int16_t* sub_sampling_NB_IoT(int16_t *input_buffer, uint32_t length_input, uint32_t *length_ouput, uint16_t sub_sampling_rate);
+//************************************************************//
+//*****************Vincent part for ULSCH demodulation ******************//
+uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc); 
+
+void generate_grouphop_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms); 
+
+void init_ul_hopping_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms); 
+
+void rotate_single_carrier_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, 
+                                  NB_IoT_DL_FRAME_PARMS *frame_parms,
+                                  int32_t **rxdataF_comp, 
+                                  uint8_t UE_id,
+                                  uint8_t symbol, 
+                                  uint8_t Qm); 
+
+void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, 
+                                  NB_IoT_DL_FRAME_PARMS *frame_parms,
+                                  int32_t **rxdataF_comp, 
+                                  uint8_t UE_id,
+                                  uint8_t symbol); 
+
+int32_t ulsch_bpsk_llr_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, 
+                              NB_IoT_DL_FRAME_PARMS *frame_parms,
+                              int32_t **rxdataF_comp,
+                              int16_t *ulsch_llr,
+                              uint8_t symbol, 
+                              uint8_t uint8_t, 
+                              int16_t **llrp); 
+
+
+int32_t ulsch_qpsk_llr_NB_IoT(
+                              NB_IoT_DL_FRAME_PARMS *frame_parms,
+                              int32_t **rxdataF_comp,
+                              int16_t *ulsch_llr, 
+                              uint8_t symbol, 
+                              uint8_t nb_rb, 
+                              int16_t **llrp); 
+
+void rotate_bpsk_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, 
+                        NB_IoT_DL_FRAME_PARMS *frame_parms,
+                        int32_t **rxdataF_comp, 
+                        uint8_t UE_id,
+                        uint8_t symbol); 
+//************************************************************// 
+
+//************************************************************//
+//*****************Vincent part for DLSCH demodulation ******************//
+
+int rx_npdsch_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
+                      unsigned char eNB_id,
+                      unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference
+                      uint32_t frame,
+                      uint8_t subframe,
+                      unsigned char symbol,
+                      unsigned char first_symbol_flag,
+                      unsigned char i_mod,
+                      unsigned char harq_pid); 
+
+unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF,
+                                        int **dl_ch_estimates,
+                                        int **rxdataF_ext,
+                                        int **dl_ch_estimates_ext,
+                                        unsigned short pmi,
+                                        unsigned char *pmi_ext,
+                                        unsigned int *rb_alloc,
+                                        unsigned char symbol,
+                                        unsigned char subframe,
+                                        uint32_t frame,
+                                        uint32_t high_speed_flag,
+                                        NB_IoT_DL_FRAME_PARMS *frame_parms); 
+
+void dlsch_channel_level_NB_IoT(int **dl_ch_estimates_ext,
+                                NB_IoT_DL_FRAME_PARMS *frame_parms,
+                                int32_t *avg,
+                                uint8_t symbol,
+                                unsigned short nb_rb); 
+
+void dlsch_channel_compensation_NB_IoT(int **rxdataF_ext,
+                                        int **dl_ch_estimates_ext,
+                                        int **dl_ch_mag,
+                                        int **dl_ch_magb,
+                                        int **rxdataF_comp,
+                                        int **rho,
+                                        NB_IoT_DL_FRAME_PARMS *frame_parms,
+                                        unsigned char symbol,
+                                        uint8_t first_symbol_flag,
+                                        unsigned char mod_order,
+                                        unsigned short nb_rb,
+                                        unsigned char output_shift,
+                                        PHY_MEASUREMENTS_NB_IoT *measurements); 
+
+int dlsch_qpsk_llr_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
+                           int32_t **rxdataF_comp,
+                           int16_t *dlsch_llr,
+                           uint8_t symbol,
+                           uint8_t first_symbol_flag,
+                           uint16_t nb_rb,
+                           int16_t **llr32p,
+                           uint8_t beamforming_mode); 
+
+//************************************************************//
+
+
+#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/pss.c b/openair1/PHY/LTE_TRANSPORT/pss.c
index e6674d6cc780e7c800d929bd55e9621dfec295c4..c746a331db246e2e46139d4386120389d3549557 100644
--- a/openair1/PHY/LTE_TRANSPORT/pss.c
+++ b/openair1/PHY/LTE_TRANSPORT/pss.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c
index ad9ed2c95d8089f261513ce4767000ddc6c6f91a..9a19b0ddaf3dee79997ca3af075bd9448b74d43b 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -113,7 +113,18 @@ int16_t W3_im[3][6] = {{0    ,0     ,0     },
   {0    ,-28378, 28377}
 };
 
-char pucch_format_string[6][20] = {"format 1\0","format 1a\0","format 1b\0","format 2\0","format 2a\0","format 2b\0"};
+char *pucch_format_string[] = {
+  "format 1",
+  "format 1a",
+  "format 1b",
+  "pucch_format1b_csA2",
+  "pucch_format1b_csA3",
+  "pucch_format1b_csA4",
+  "format 2",
+  "format 2a",
+  "format 2b",
+  "pucch_format3"
+};
 
 /* PUCCH format3 >> */
 #define D_I             0
@@ -1860,6 +1871,23 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
 	eNB->pucch1ab_stats_cnt[j][i]=0;
       }
     }
+#if defined(USRP_REC_PLAY)
+    // It's probably bad to do this statically only once.
+    // Looks like the above is incomplete.
+    // Such reset needs to be done once a UE PHY structure is being used/re-used
+    // Don't know if this is ever possible in current architecture
+    for (i=0;i<10240;i++) {
+      for (j=0;j<NUMBER_OF_UE_MAX;j++) {
+	eNB->pucch1_stats[j][i]=0;
+	eNB->pucch1_stats_thres[j][i]=0;
+      }
+    }
+    for (i=0;i<20480;i++) {
+      for (j=0;j<NUMBER_OF_UE_MAX;j++) {
+	eNB->pucch1ab_stats[j][i]=0;
+      }
+    }
+#endif    
     first_call=0;
   }
 
@@ -2141,8 +2169,9 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
     } //phase
 
 //    stat_max *= nsymb;  // normalize to energy per symbol
-//    stat_max /= (frame_parms->N_RB_UL*12); // 
+//    stat_max /= (frame_parms->N_RB_UL*12); //
     stat_max /= (nsymb*12);
+    
 #ifdef DEBUG_PUCCH_RX
     printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max);
 #endif
@@ -2278,8 +2307,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
     stat_im=0;
 
     // Do detection now
+#if defined(USRP_REC_PLAY)
+    // It looks like the value is a bit messy when RF is replayed.
+    // For instance i assume to skip pucch1_thres from the test below.
+    if (sigma2_dB<(dB_fixed(stat_max)))  {//
+#else
     if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres))  {//
-
+#endif
       chL = (nsymb>>1)-4;
       chest_mag=0;
       cfo =  (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max];
@@ -2420,7 +2454,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
       if (fmt==pucch_format1b)
         *(1+payload) = (stat_im<0) ? 1 : 2;
     } else { // insufficient energy on PUCCH so NAK
-      LOG_I(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
+#if defined(USRP_REC_PLAY)
+      LOG_D(PHY,"PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
+#else
+      LOG_D(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
+#endif      
       *payload = 4;  // DTX
       ((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
       ((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
diff --git a/openair1/PHY/LTE_TRANSPORT/rar_tools.c b/openair1/PHY/LTE_TRANSPORT/rar_tools.c
index b62e46244980703ec41a3a9c34fc4b108ad60f5d..9934b71d78b0165c32d9b4df855e97779c43ee33 100644
--- a/openair1/PHY/LTE_TRANSPORT/rar_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/rar_tools.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -173,7 +173,9 @@ int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB,
 		 &ulsch_harq->frame,
 		 &ulsch_harq->subframe);
 
-  LOG_I(PHY,"Programming msg3 reception in (%d,%d)\n",ulsch_harq->frame,ulsch_harq->subframe);
+  LOG_I(PHY,"Programming msg3 reception in (%d,%d) mcs:%d TBS:%d Qm:%d Mcs_intial:%d Nsymb_intial:%d round:%d\n",
+      ulsch_harq->frame,ulsch_harq->subframe,
+      mcs, ulsch_harq->TBS, ulsch_harq->Qm, ulsch_harq->Msc_initial, ulsch_harq->Nsymb_initial, ulsch_harq->round);
   use_srs = is_srs_occasion_common(frame_parms,ulsch_harq->frame,ulsch_harq->subframe);
   ulsch_harq->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1);
   ulsch_harq->srs_active                            = use_srs;
@@ -185,7 +187,7 @@ int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB,
   LOG_D(PHY,"ulsch ra (eNB): harq_pid %d\n",harq_pid);
   LOG_D(PHY,"ulsch ra (eNB): round    %d\n",ulsch_harq->round);
   LOG_D(PHY,"ulsch ra (eNB): TBS      %d\n",ulsch_harq->TBS);
-  LOG_D(PHY,"ulsch ra (eNB): mcs      %d\n",ulsch_harq->mcs);
+  LOG_D(PHY,"ulsch ra (eNB): mcs      %d\n",ulsch_harq->Msc_initial);
   LOG_D(PHY,"ulsch ra (eNB): Or1      %d\n",ulsch_harq->Or1);
   LOG_D(PHY,"ulsch ra (eNB): ORI      %d\n",ulsch_harq->O_RI);
 #endif
diff --git a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c
index 8381eca5e411c95d9130f93eb1e3206fa1401aa1..c4c02e631279a3833da27c1b2aedceb431e55b7d 100644
--- a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -180,7 +180,6 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms,
     return(-1);
   }
 
-#ifdef USER_MODE
   Msc_idx_ptr = (uint16_t*) bsearch((uint16_t*) &Msc_RS, (uint16_t*) dftsizes, 33, sizeof(uint16_t), compareints);
 
   if (Msc_idx_ptr)
@@ -190,19 +189,6 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms,
     return(-1);
   }
 
-#else //stdlib not availiable in RTAI
-
-  if (Msc_RS==216)
-    Msc_RS_idx = 12;
-  else if (Msc_RS==144)
-    Msc_RS_idx = 9;
-  else {
-    LOG_E(PHY,"generate_srs: index for Msc_RS=%d not implemented\n",Msc_RS);
-    return(-1);
-  }
-
-#endif
-
 #ifdef DEBUG_SRS
   LOG_D(PHY,"generate_srs_tx: Msc_RS = %d, Msc_RS_idx = %d, k0 = %d\n",Msc_RS, Msc_RS_idx,k0);
 #endif
@@ -279,7 +265,6 @@ int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms,
     return(-1);
   }
 
-#ifdef USER_MODE
   Msc_idx_ptr = (uint16_t*) bsearch((uint16_t*) &Msc_RS, (uint16_t*) dftsizes, 33, sizeof(uint16_t), compareints);
 
   if (Msc_idx_ptr)
@@ -289,19 +274,6 @@ int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms,
     return(-1);
   }
 
-#else //stdlib not availiable in RTAI
-
-  if (Msc_RS==216)
-    Msc_RS_idx = 12;
-  else if (Msc_RS==144)
-    Msc_RS_idx = 9;
-  else {
-    LOG_E(PHY,"generate_srs: index for Msc_RS=%d not implemented\n",Msc_RS);
-    return(-1);
-  }
-
-#endif
-
 #ifdef DEBUG_SRS
   LOG_I(PHY,"generate_srs_rx: Msc_RS = %d, Msc_RS_idx = %d, k0=%d\n",Msc_RS, Msc_RS_idx,k0);
 #endif
diff --git a/openair1/PHY/LTE_TRANSPORT/sss.c b/openair1/PHY/LTE_TRANSPORT/sss.c
index bb12be9157126f6d8798786c0526191506d41ab1..17a4680c54f7a19beee1b91225b9ef54095ea672 100644
--- a/openair1/PHY/LTE_TRANSPORT/sss.c
+++ b/openair1/PHY/LTE_TRANSPORT/sss.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/sss.h b/openair1/PHY/LTE_TRANSPORT/sss.h
index 290e2453e25aada3dd1e6ba13f42e4444825d9df..6d42acaefc1e45450300e0af347f77dba52c01f5 100644
--- a/openair1/PHY/LTE_TRANSPORT/sss.h
+++ b/openair1/PHY/LTE_TRANSPORT/sss.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/uci.h b/openair1/PHY/LTE_TRANSPORT/uci.h
index 8b479ed9ba452003e78e6750594fcf2d77c93a85..c7741533da543b909aa00bbaad4151274b210595 100644
--- a/openair1/PHY/LTE_TRANSPORT/uci.h
+++ b/openair1/PHY/LTE_TRANSPORT/uci.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/uci_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/uci_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f2dd0f989cb90fc65ac8a658a6ad9ca78db7051
--- /dev/null
+++ b/openair1/PHY/LTE_TRANSPORT/uci_NB_IoT.h
@@ -0,0 +1,324 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#ifndef __UCI_NB_IOT__H__
+#define __UCI_NB_IOT__H__
+//#include "PHY/types_NB_IoT.h"
+
+
+
+typedef enum {
+  ue_selected_NB_IoT,
+  wideband_cqi_rank1_2A_NB_IoT, //wideband_cqi_rank1_2A,
+  wideband_cqi_rank2_2A_NB_IoT, //wideband_cqi_rank2_2A,
+  HLC_subband_cqi_nopmi_NB_IoT, //HLC_subband_cqi_nopmi,
+  HLC_subband_cqi_rank1_2A_NB_IoT, //HLC_subband_cqi_rank1_2A,
+  HLC_subband_cqi_rank2_2A_NB_IoT, //HLC_subband_cqi_rank2_2A,
+  HLC_subband_cqi_modes123_NB_IoT, //HLC_subband_cqi_modes123
+  HLC_subband_cqi_mcs_CBA_NB_IoT, // MCS and RNTI, for contention-based acces
+  unknown_cqi_NB_IoT//
+} UCI_format_NB_IoT_t;
+
+// **********************************************1.5 MHz***************************************************************************
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:16;
+  uint32_t pmi:12;
+  uint32_t cqi1:4;
+}
+wideband_cqi_rank1_2A_1_5MHz_NB_IoT ;
+#define sizeof_wideband_cqi_rank1_2A_1_5MHz_NB_IoT 16
+
+typedef struct __attribute__((packed))
+{
+  uint16_t padding:2;
+  uint16_t pmi:6;
+  uint16_t cqi2:4;
+  uint16_t cqi1:4;
+}
+wideband_cqi_rank2_2A_1_5MHz_NB_IoT ;
+#define sizeof_wideband_cqi_rank2_2A_1_5MHz_NB_IoT 14
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:16;
+  uint32_t diffcqi1:12;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_nopmi_1_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_nopmi_1_5MHz_NB_IoT 16
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:14;
+  uint32_t pmi:2;
+  uint32_t diffcqi1:12;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_rank1_2A_1_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_rank1_2A_1_5MHz_NB_IoT 18
+
+typedef struct __attribute__((packed))
+{
+  uint64_t padding:31;
+  uint64_t pmi:1;
+  uint64_t diffcqi2:12;
+  uint64_t cqi2:4;
+  uint64_t diffcqi1:12;
+  uint64_t cqi1:4;
+}
+HLC_subband_cqi_rank2_2A_1_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_rank2_2A_1_5MHz_NB_IoT 33
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:16;
+  uint32_t diffcqi1:12;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_modes123_1_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_modes123_1_5MHz_NB_IoT 16
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:11;
+  uint32_t crnti:16;
+  uint32_t mcs:5;
+}
+HLC_subband_cqi_mcs_CBA_1_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz_NB_IoT 21
+
+
+// **********************************************5 MHz***************************************************************************
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:14;
+  uint32_t pmi:14;
+  uint32_t cqi1:4;
+}
+wideband_cqi_rank1_2A_5MHz_NB_IoT ;
+#define sizeof_wideband_cqi_rank1_2A_5MHz_NB_IoT 18
+
+typedef struct __attribute__((packed))
+{
+  uint16_t padding:1;
+  uint16_t pmi:7;
+  uint16_t cqi2:4;
+  uint16_t cqi1:4;
+}
+wideband_cqi_rank2_2A_5MHz_NB_IoT ;
+#define sizeof_wideband_cqi_rank2_2A_5MHz_NB_IoT 15
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:14;
+  uint32_t diffcqi1:14;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_nopmi_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_nopmi_5MHz_NB_IoT 18
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:12;
+  uint32_t pmi:2;
+  uint32_t diffcqi1:14;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_rank1_2A_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_rank1_2A_5MHz_NB_IoT 20
+
+typedef struct __attribute__((packed))
+{
+  uint64_t padding:27;
+  uint64_t pmi:1;
+  uint64_t diffcqi2:14;
+  uint64_t cqi2:4;
+  uint64_t diffcqi1:14;
+  uint64_t cqi1:4;
+}
+HLC_subband_cqi_rank2_2A_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_rank2_2A_5MHz_NB_IoT 37
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:14;
+  uint32_t diffcqi1:14;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_modes123_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_modes123_5MHz_NB_IoT 18
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:11;
+  uint32_t crnti:16;
+  uint32_t mcs:5;
+}
+HLC_subband_cqi_mcs_CBA_5MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_mcs_CBA_5MHz_NB_IoT 21
+
+// **********************************************10 MHz***************************************************************************
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:10;
+  uint32_t pmi:18;
+  uint32_t cqi1:4;
+}
+wideband_cqi_rank1_2A_10MHz_NB_IoT ;
+#define sizeof_wideband_cqi_rank1_2A_10MHz_NB_IoT 22
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:15;
+  uint32_t pmi:9;
+  uint32_t cqi2:4;
+  uint32_t cqi1:4;
+}
+wideband_cqi_rank2_2A_10MHz_NB_IoT ;
+#define sizeof_wideband_cqi_rank2_2A_10MHz_NB_IoT 17
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:10;
+  uint32_t diffcqi1:18;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_nopmi_10MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_nopmi_10MHz_NB_IoT 22
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:8;
+  uint32_t pmi:2;
+  uint32_t diffcqi1:18;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_rank1_2A_10MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_rank1_2A_10MHz_NB_IoT 24
+
+typedef struct __attribute__((packed))
+{
+  uint64_t padding:19;
+  uint64_t pmi:1;
+  uint64_t diffcqi2:18;
+  uint64_t cqi2:4;
+  uint64_t diffcqi1:18;
+  uint64_t cqi1:4;
+}
+HLC_subband_cqi_rank2_2A_10MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_rank2_2A_10MHz_NB_IoT 45
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:10;
+  uint32_t diffcqi1:18;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_modes123_10MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_modes123_10MHz_NB_IoT 22
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:11;
+  uint32_t crnti:16;
+  uint32_t mcs:5;
+}
+HLC_subband_cqi_mcs_CBA_10MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_mcs_CBA_10MHz_NB_IoT 21
+
+// **********************************************20 MHz***************************************************************************
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:2;
+  uint32_t pmi:26;
+  uint32_t cqi1:4;
+}
+wideband_cqi_rank1_2A_20MHz_NB_IoT ;
+#define sizeof_wideband_cqi_rank1_2A_20MHz_NB_IoT 20
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:11;
+  uint32_t pmi:13;
+  uint32_t cqi2:4;
+  uint32_t cqi1:4;
+}
+wideband_cqi_rank2_2A_20MHz_NB_IoT ;
+#define sizeof_wideband_cqi_rank2_2A_20MHz_NB_IoT 21
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:2;
+  uint32_t diffcqi1:26;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_nopmi_20MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_nopmi_20MHz_NB_IoT 30
+
+typedef struct __attribute__((packed))
+{
+  //  uint32_t padding:12;
+  uint32_t pmi:2;
+  uint32_t diffcqi1:26;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_rank1_2A_20MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_rank1_2A_20MHz_NB_IoT 32
+
+typedef struct __attribute__((packed))
+{
+  uint64_t padding:3;
+  uint64_t pmi:1;
+  uint64_t diffcqi2:26;
+  uint64_t cqi2:4;
+  uint64_t diffcqi1:26;
+  uint64_t cqi1:4;
+}
+HLC_subband_cqi_rank2_2A_20MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_rank2_2A_20MHz_NB_IoT 61
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:2;
+  uint32_t diffcqi1:26;
+  uint32_t cqi1:4;
+}
+HLC_subband_cqi_modes123_20MHz_NB_IoT;
+#define sizeof_HLC_subband_cqi_modes123_20MHz_NB_IoT 30
+
+typedef struct __attribute__((packed))
+{
+  uint32_t padding:11;
+  uint32_t crnti:16;
+  uint32_t mcs:5;
+}
+HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT;
+
+#define sizeof_HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT 21
+
+#define MAX_CQI_PAYLOAD_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT)*8*20)
+#define MAX_CQI_BITS_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT)*8)
+#define MAX_CQI_BYTES_NB_IoT (sizeof(HLC_subband_cqi_rank2_2A_20MHz_NB_IoT))
+#define MAX_ACK_PAYLOAD_NB_IoT 18
+#define MAX_RI_PAYLOAD_NB_IoT 6
+
+#endif
\ No newline at end of file
diff --git a/openair1/PHY/LTE_TRANSPORT/uci_tools.c b/openair1/PHY/LTE_TRANSPORT/uci_tools.c
index f61749e6cac54e3b88cd8ba6d842eae0dea0b862..65640e2ec713331c9531e5b852dd953a45707bea 100644
--- a/openair1/PHY/LTE_TRANSPORT/uci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/uci_tools.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c
index f4d7cee401ddc6d1f7d6f6d7921541c486bd2cdd..09420f48ab1a7029fdbbb2015fd7f28f47ffcd8c 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -66,33 +66,12 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
 #endif
 
     for (i=0; i<8; i++) {
-#ifdef DEBUG_ULSCH_FREE
-      printf("Freeing ulsch process %d\n",i);
-#endif
-
       if (ulsch->harq_processes[i]) {
-#ifdef DEBUG_ULSCH_FREE
-        printf("Freeing ulsch process %d (%p)\n",i,ulsch->harq_processes[i]);
-#endif
-
         if (ulsch->harq_processes[i]->b) {
           free16(ulsch->harq_processes[i]->b,MAX_ULSCH_PAYLOAD_BYTES);
           ulsch->harq_processes[i]->b = NULL;
-#ifdef DEBUG_ULSCH_FREE
-          printf("Freeing ulsch process %d b (%p)\n",i,ulsch->harq_processes[i]->b);
-#endif
         }
-
-#ifdef DEBUG_ULSCH_FREE
-        printf("Freeing ulsch process %d c (%p)\n",i,ulsch->harq_processes[i]->c);
-#endif
-
         for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
-
-#ifdef DEBUG_ULSCH_FREE
-          printf("Freeing ulsch process %d c[%d] (%p)\n",i,r,ulsch->harq_processes[i]->c[r]);
-#endif
-
           if (ulsch->harq_processes[i]->c[r]) {
             free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
             ulsch->harq_processes[i]->c[r] = NULL;
@@ -103,7 +82,6 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
         ulsch->harq_processes[i] = NULL;
       }
     }
-
     free16(ulsch,sizeof(LTE_UE_ULSCH_t));
     ulsch = NULL;
   }
@@ -393,13 +371,13 @@ uint32_t ulsch_encoding(uint8_t *a,
         printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
 #endif
         start_meas(te_stats);
-        threegpplte_turbo_encoder(ulsch->harq_processes[harq_pid]->c[r],
-                                  Kr>>3,
-                                  &ulsch->harq_processes[harq_pid]->d[r][96],
-                                  (r==0) ? ulsch->harq_processes[harq_pid]->F : 0,
-                                  f1f2mat_old[iind*2],   // f1 (see 36212-820, page 14)
-                                  f1f2mat_old[(iind*2)+1]  // f2 (see 36212-820, page 14)
-                                 );
+        encoder(ulsch->harq_processes[harq_pid]->c[r],
+        	Kr>>3,
+        	&ulsch->harq_processes[harq_pid]->d[r][96],
+        	(r==0) ? ulsch->harq_processes[harq_pid]->F : 0,
+        	f1f2mat_old[iind*2],   // f1 (see 36212-820, page 14)
+        	f1f2mat_old[(iind*2)+1]  // f2 (see 36212-820, page 14)
+               );
         stop_meas(te_stats);
 #ifdef DEBUG_ULSCH_CODING
 
@@ -953,77 +931,3 @@ uint32_t ulsch_encoding(uint8_t *a,
   return(0);
 }
 
-
-#ifdef PHY_ABSTRACTION
-#ifdef OPENAIR2
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/defs.h"
-#endif
-int ulsch_encoding_emul(uint8_t *ulsch_buffer,
-                        PHY_VARS_UE *ue,
-                        uint8_t eNB_id,
-                        uint8_t subframe_rx,
-                        uint8_t harq_pid,
-                        uint8_t control_only_flag)
-{
-
-  LTE_UE_ULSCH_t *ulsch = ue->ulsch[eNB_id];
-  LTE_UE_DLSCH_t **dlsch = ue->dlsch[0][eNB_id];
-  PHY_MEASUREMENTS *meas = &ue->measurements;
-  uint8_t tmode = ue->transmission_mode[eNB_id];
-  uint16_t rnti=ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti;
-  LOG_D(PHY,"EMUL UE ulsch_encoding for eNB %d,mod_id %d, harq_pid %d rnti %x, ACK(%d,%d) \n",
-        eNB_id,ue->Mod_id, harq_pid, rnti,ulsch->o_ACK[0],ulsch->o_ACK[1]);
-
-  if (ulsch->O>0) {
-    /*
-    if(flag_LA==1)
-      sinr_eff = sinr_eff_cqi_calc(ue, eNB_id);
-    else
-      sinr_eff = meas->wideband_cqi_avg[eNB_id];
-    */
-
-    fill_CQI(ulsch,meas,eNB_id,harq_pid,ue->frame_parms.N_RB_DL,rnti,tmode,ue->sinr_eff);
-    //LOG_D(PHY,"UE CQI\n");
-    //    print_CQI(ulsch->o,ulsch->uci_format,eNB_id);
-
-    // save PUSCH pmi for later (transmission modes 4,5,6)
-    //    printf("ulsch: saving pmi for DL %x\n",pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi));
-    // if (ulsch->uci_format != HLC_subband_cqi_mcs_CBA)
-    dlsch[0]->harq_processes[harq_pid]->pmi_alloc = ((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi;
-  }
-
-  memcpy(ue->ulsch[eNB_id]->harq_processes[harq_pid]->b,
-         ulsch_buffer,
-         ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3);
-
-
-  //memcpy(&UE_transport_info[ue->Mod_id].transport_blocks[UE_transport_info_TB_index[ue->Mod_id]],
-  memcpy(&UE_transport_info[ue->Mod_id][ue->CC_id].transport_blocks,
-         ulsch_buffer,
-         ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3);
-  //UE_transport_info_TB_index[ue->Mod_id]+=ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3;
-  // navid: currently more than one eNB is not supported in the code
-  UE_transport_info[ue->Mod_id][ue->CC_id].num_eNB = 1;
-  UE_transport_info[ue->Mod_id][ue->CC_id].rnti[0] = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][0]->crnti;
-  UE_transport_info[ue->Mod_id][ue->CC_id].eNB_id[0]  = eNB_id;
-  UE_transport_info[ue->Mod_id][ue->CC_id].harq_pid[0] = harq_pid;
-  UE_transport_info[ue->Mod_id][ue->CC_id].tbs[0]     = ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3 ;
-  // printf("\nue->Mod_id%d\n",ue->Mod_id);
-
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pusch_flag = 1;
-  //UE_transport_info[ue->Mod_id].cntl.pusch_uci = *(uint32_t *)ulsch->o;
-  memcpy(UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pusch_uci,
-         ulsch->o,
-         MAX_CQI_BYTES);
-  // printf("[UE]cqi is %d \n", ((HLC_subband_cqi_rank1_2A_5MHz *)ulsch->o)->cqi1);
-
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.length_uci = ulsch->O;
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.uci_format = ulsch->uci_format;
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pusch_ri = (ulsch->o_RI[0]&1)+((ulsch->o_RI[1]&1)<<1);
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pusch_ack =   (ulsch->o_ACK[0]&1) + ((ulsch->o_ACK[1]&1)<<1);
-  //printf("ack is %d %d %d\n",UE_transport_info[ue->Mod_id].cntl.pusch_ack, (ulsch->o_ACK[1]&1)<<1, ulsch->o_ACK[0]&1);
-  return(0);
-
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
index 01a76d307d2ecd00b8d462a82252e4fd071a08c2..b76bfc2d37f3e107f41040b75ba3786e9c0388cb 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -44,11 +44,6 @@
 #include "PHY_INTERFACE/extern.h"
 #endif
 
-#ifdef PHY_ABSTRACTION
-#include "UTIL/OCG/OCG.h"
-#include "UTIL/OCG/OCG_extern.h"
-#endif
-
 #include "UTIL/LOG/vcd_signal_dumper.h"
 //#define DEBUG_ULSCH_DECODING
 #include "targets/RT/USER/rt_wrapper.h"
@@ -173,6 +168,7 @@ void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch)
   //ulsch = (LTE_eNB_ULSCH_t *)malloc16(sizeof(LTE_eNB_ULSCH_t));
   if (ulsch) {
     ulsch->rnti = 0;
+    ulsch->harq_mask = 0;
 
     for (i=0; i<8; i++) {
       if (ulsch->harq_processes[i]) {
@@ -181,9 +177,26 @@ void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch)
         //ulsch->harq_processes[i]->phich_active = 0; //this will be done later after transmission of PHICH
         ulsch->harq_processes[i]->phich_ACK = 0;
         ulsch->harq_processes[i]->round = 0;
+        ulsch->harq_processes[i]->rar_alloc = 0;
+        ulsch->harq_processes[i]->first_rb = 0;
+        ulsch->harq_processes[i]->nb_rb = 0;
+        ulsch->harq_processes[i]->TBS = 0;
+        ulsch->harq_processes[i]->Or1 = 0;
+        ulsch->harq_processes[i]->Or2 = 0;
+        for ( int j = 0; j < 2; j++ ) {
+          ulsch->harq_processes[i]->o_RI[j] = 0;
+        }
+        ulsch->harq_processes[i]->O_ACK = 0;
+        ulsch->harq_processes[i]->srs_active = 0;
+        ulsch->harq_processes[i]->rvidx = 0;
+        ulsch->harq_processes[i]->Msc_initial = 0;
+        ulsch->harq_processes[i]->Nsymb_initial = 0;
       }
     }
-
+    ulsch->beta_offset_cqi_times8 = 0;
+    ulsch->beta_offset_ri_times8 = 0;
+    ulsch->beta_offset_harqack_times8 = 0;
+    ulsch->Msg3_active = 0;
   }
 }
 
@@ -230,27 +243,12 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
   uint32_t E=0;
   uint32_t Gp,GpmodC,Nl=1;
   uint32_t C = ulsch_harq->C;
-
-  uint8_t (*tc)(int16_t *y,
-                uint8_t *,
-                uint16_t,
-                uint16_t,
-                uint16_t,
-                uint8_t,
-                uint8_t,
-                uint8_t,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *);
+  decoder_if_t tc;
 
   if (llr8_flag == 0)
-    tc = phy_threegpplte_turbo_decoder16;
+    tc = decoder16;
   else
-    tc = phy_threegpplte_turbo_decoder8;
+    tc = decoder8;
 
 
 
@@ -373,7 +371,9 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
     
     
     ret = tc(&ulsch_harq->d[r][96],
+             NULL,
 	     ulsch_harq->c[r],
+             NULL,
 	     Kr,
 	     f1f2mat_old[iind*2],
 	     f1f2mat_old[(iind*2)+1],
@@ -457,22 +457,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
   int G = ulsch_harq->G;
   unsigned int E;
   int Cby2;
-
-  uint8_t (*tc)(int16_t *y,
-                uint8_t *,
-                uint16_t,
-                uint16_t,
-                uint16_t,
-                uint8_t,
-                uint8_t,
-                uint8_t,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *);
+  decoder_if_t tc;
 
   struct timespec wait;
 
@@ -481,9 +466,9 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
 
 
   if (llr8_flag == 0)
-    tc = phy_threegpplte_turbo_decoder16;
+    tc = decoder16;
   else
-    tc = phy_threegpplte_turbo_decoder8;
+    tc = decoder8;
 
   if (ulsch_harq->C>1) { // wakeup worker if more than 1 segment
     if (pthread_mutex_timedlock(&proc->mutex_td,&wait) != 0) {
@@ -602,7 +587,9 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
     start_meas(&eNB->ulsch_turbo_decoding_stats);
     
     ret = tc(&ulsch_harq->d[r][96],
+             NULL,
 	     ulsch_harq->c[r],
+             NULL,
 	     Kr,
 	     f1f2mat_old[iind*2],
 	     f1f2mat_old[(iind*2)+1],
@@ -643,7 +630,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
       break;
     }
     stop_meas(&eNB->ulsch_turbo_decoding_stats);    
-  printf("/////////////////////////////////////////**************************loop for %d time in ulsch_decoding main\n",r);
+  //printf("/////////////////////////////////////////**************************loop for %d time in ulsch_decoding main\n",r);
   }
 
    // wait for worker to finish
@@ -665,27 +652,12 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
 
   int G = ulsch_harq->G;
   unsigned int E;
-
-  uint8_t (*tc)(int16_t *y,
-                uint8_t *,
-                uint16_t,
-                uint16_t,
-                uint16_t,
-                uint8_t,
-                uint8_t,
-                uint8_t,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *,
-                time_stats_t *);
+  decoder_if_t tc;
 
   if (llr8_flag == 0)
-    tc = phy_threegpplte_turbo_decoder16;
+    tc = *decoder16;
   else
-    tc = phy_threegpplte_turbo_decoder8;
+    tc = *decoder8;
 
 
   for (r=0; r<ulsch_harq->C; r++) {
@@ -768,7 +740,9 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
     start_meas(&eNB->ulsch_turbo_decoding_stats);
     
     ret = tc(&ulsch_harq->d[r][96],
+             NULL,
 	     ulsch_harq->c[r],
+             NULL,
 	     Kr,
 	     f1f2mat_old[iind*2],
 	     f1f2mat_old[(iind*2)+1],
@@ -819,8 +793,6 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
 int ulsch_decoding_data_all(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) 
 {
   int ret = 0;
-  LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
-  LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
   if(codingw)
   {
     ret = ulsch_decoding_data_2thread(eNB,UE_id,harq_pid,llr8_flag);
@@ -898,12 +870,13 @@ unsigned int  ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
   int16_t cseq[6*14*1200] __attribute__((aligned(32)));
   int off;
 
+  int frame = proc->frame_rx;
   int subframe = proc->subframe_rx;
   LTE_UL_eNB_HARQ_t *ulsch_harq;
 
 
 
-  harq_pid = subframe2harq_pid(frame_parms,proc->frame_rx,subframe);
+  harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0+harq_pid,1);
 
@@ -928,7 +901,8 @@ unsigned int  ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
 
 
   //#ifdef DEBUG_ULSCH_DECODING
-  LOG_D(PHY,"Frame %d, Subframe %d: ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): A %d, round %d, RV %d, O_r1 %d, O_RI %d, O_ACK %d, G %d\n",
+  LOG_D(PHY,"[PUSCH %d] Frame %d, Subframe %d: ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): A %d, round %d, RV %d, O_r1 %d, O_RI %d, O_ACK %d, G %d, Q_m %d Nsymb_pusch %d nb_rb %d\n",
+      harq_pid,
 	proc->frame_rx,subframe,
 	frame_parms->Nid_cell,ulsch->rnti,x2,
 	A,
@@ -937,7 +911,10 @@ unsigned int  ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
 	ulsch_harq->Or1,
 	ulsch_harq->O_RI,
 	ulsch_harq->O_ACK,
-	G);
+	G,
+        ulsch_harq->Qm,
+        ulsch_harq->Nsymb_pusch,
+        nb_rb);
 	
   //#endif
 
@@ -1284,7 +1261,7 @@ unsigned int  ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
   }
 
   if (ulsch_harq->O_ACK > 2) {
-    LOG_E(PHY,"ulsch_decoding: FATAL, ACK cannot be more than 2 bits yet\n");
+    LOG_E(PHY,"ulsch_decoding: FATAL, ACK cannot be more than 2 bits yet O_ACK:%d SFN/SF:%04d%d UE_id:%d rnti:%x\n",ulsch_harq->O_ACK,proc->frame_rx,proc->subframe_rx,UE_id,ulsch->rnti);
     return(-1);
   }
 
@@ -1596,6 +1573,7 @@ unsigned int  ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
 #endif
   }
 
+  LOG_D(PHY,"frame %d subframe %d O_ACK:%d o_ACK[]=%d:%d:%d:%d\n",frame,subframe,ulsch_harq->O_ACK,ulsch_harq->o_ACK[0],ulsch_harq->o_ACK[1],ulsch_harq->o_ACK[2],ulsch_harq->o_ACK[3]);
 
   // Do ULSCH Decoding for data portion
 
@@ -1605,460 +1583,3 @@ unsigned int  ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
 
   return(ret);
 }
-
-#ifdef PHY_ABSTRACTION
-
-#ifdef PHY_ABSTRACTION_UL
-int ulsch_abstraction(double* sinr_dB, uint8_t TM, uint8_t mcs,uint16_t nrb, uint16_t frb)
-{
-
-  int index,ii;
-  double sinr_eff = 0;
-  int rb_count = 0;
-  int offset;
-  double bler = 0;
-  TM = TM-1;
-  sinr_eff = sinr_dB[frb]; //the single sinr_eff value we calculated with MMSE FDE formula in init_snr_up function
-
-
-  sinr_eff *= 10;
-  sinr_eff = floor(sinr_eff);
-  sinr_eff /= 10;
-
-  LOG_D(PHY,"[ABSTRACTION] sinr_eff after rounding = %f\n",sinr_eff);
-
-  for (index = 0; index < 16; index++) {
-    if(index == 0) {
-      if (sinr_eff < sinr_bler_map_up[mcs][0][index]) {
-        bler = 1;
-        break;
-      }
-    }
-
-    if (sinr_eff == sinr_bler_map_up[mcs][0][index]) {
-      bler = sinr_bler_map_up[mcs][1][index];
-    }
-  }
-
-#ifdef USER_MODE // need to be adapted for the emulation in the kernel space 
-
-  if (uniformrandom() < bler) {
-    LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(0);
-  } else {
-    LOG_I(OCM,"abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(1);
-  }
-
-#endif
-}
-
-
-
-
-
-
-
-int ulsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint8_t mcs,uint16_t nrb, uint16_t frb)
-{
-  int index;
-  double sinr_eff = 0;
-  double sinr_db1 = 0;
-  double sinr_db2 = 0;
-  double SI=0;
-  double RBIR=0;
-  int rb_count = 0;
-  int offset, M=0;
-  double bler = 0;
-  int start,middle,end;
-  TM = TM-1;
-
-  for (offset = frb; offset <= (frb + nrb -1); offset++) {
-
-    rb_count++;
-
-    //we need to do the table lookups here for the mutual information corresponding to the certain sinr_dB.
-
-    sinr_db1 = sinr_dB[offset*2];
-    sinr_db2 = sinr_dB[offset*2+1];
-
-    printf("sinr_db1=%f\n,sinr_db2=%f\n",sinr_db1,sinr_db2);
-
-    //rounding up for the table lookup
-    sinr_db1 *= 10;
-    sinr_db2 *= 10;
-
-    sinr_db1 = floor(sinr_db1);
-    sinr_db2 = floor(sinr_db2);
-
-    if ((int)sinr_db1%2) {
-      sinr_db1 += 1;
-    }
-
-    if ((int)sinr_db2%2) {
-      sinr_db2 += 1;
-    }
-
-    sinr_db1 /= 10;
-    sinr_db2 /= 10;
-
-    if(mcs<10) {
-      //for sinr_db1
-      for (index = 0; index < 162; index++) {
-        if (sinr_db1 < MI_map_4qam[0][0]) {
-          SI += (MI_map_4qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-
-        if (sinr_db1 > MI_map_4qam[0][161]) {
-          SI += (MI_map_4qam[1][161]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-
-        if (sinr_db1 == MI_map_4qam[0][index]) {
-          SI += (MI_map_4qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-      }
-
-      //for sinr_db2
-      for (index = 0; index < 162; index++) {
-        if (sinr_db2 < MI_map_4qam[0][0]) {
-          SI += (MI_map_4qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-
-        if (sinr_db2 > MI_map_4qam[0][161]) {
-          SI += (MI_map_4qam[1][161]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-
-        if (sinr_db2 == MI_map_4qam[0][index]) {
-          SI += (MI_map_4qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-      }
-
-    } else if(mcs>9 && mcs<17) {
-      //for sinr_db1
-      for (index = 0; index < 197; index++) {
-        if (sinr_db1 < MI_map_16qam[0][0]) {
-          SI += (MI_map_16qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-
-        if (sinr_db1 > MI_map_16qam[0][196]) {
-          SI += (MI_map_16qam[1][196]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-
-        if (sinr_db1 == MI_map_16qam[0][index]) {
-          SI += (MI_map_16qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-      }
-
-      //for sinr_db2
-      for (index = 0; index < 197; index++) {
-        if (sinr_db2 < MI_map_16qam[0][0]) {
-          SI += (MI_map_16qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-
-        if (sinr_db2 > MI_map_16qam[0][196]) {
-          SI += (MI_map_16qam[1][196]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-
-        if (sinr_db2 == MI_map_16qam[0][index]) {
-          SI += (MI_map_16qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-      }
-
-    } else if(mcs>16 && mcs<22) {
-      //for sinr_db1
-      for (index = 0; index < 227; index++) {
-        if (sinr_db1 < MI_map_64qam[0][0]) {
-          SI += (MI_map_64qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-
-        if (sinr_db1 > MI_map_64qam[0][226]) {
-          SI += (MI_map_64qam[1][226]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-
-        if (sinr_db1 == MI_map_64qam[0][index]) {
-          SI += (MI_map_64qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-      }
-
-      //for sinr_db2
-      for (index = 0; index < 227; index++) {
-        if (sinr_db2 < MI_map_64qam[0][0]) {
-          SI += (MI_map_64qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-
-        if (sinr_db2 > MI_map_64qam[0][226]) {
-          SI += (MI_map_64qam[1][226]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-
-        if (sinr_db2 == MI_map_64qam[0][index]) {
-          SI += (MI_map_64qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-      }
-    }
-  }
-
-  // }
-
-  RBIR = SI/M;
-
-  //Now RBIR->SINR_effective Mapping
-  //binary search method is performed here
-  if(mcs<10) {
-    start = 0;
-    end = 161;
-    middle = end/2;
-
-    if (RBIR <= MI_map_4qam[2][start]) {
-      sinr_eff =  MI_map_4qam[0][start];
-    } else {
-      if (RBIR >= MI_map_4qam[2][end])
-        sinr_eff =  MI_map_4qam[0][end];
-      else {
-        //while((end-start > 1) && (RBIR >= MI_map_4qam[2]))
-        if (RBIR < MI_map_4qam[2][middle]) {
-          end = middle;
-          middle = end/2;
-        } else {
-          start = middle;
-          middle = (end-middle)/2;
-        }
-      }
-
-      for (; end>start; end--) {
-        if ((RBIR < MI_map_4qam[2][end]) && (RBIR >  MI_map_4qam[2][end-2])) {
-          sinr_eff = MI_map_4qam[0][end-1];
-          break;
-        }
-      }
-    }
-
-    sinr_eff = sinr_eff * beta2_dlsch_MI[TM][mcs];
-  }
-
-
-
-  else if (mcs>9 && mcs<17) {
-
-    start = 0;
-    end = 196;
-    middle = end/2;
-
-    if (RBIR <= MI_map_16qam[2][start]) {
-      sinr_eff =  MI_map_16qam[0][start];
-    } else {
-      if (RBIR >= MI_map_16qam[2][end])
-        sinr_eff =  MI_map_16qam[0][end];
-      else {
-        //while((end-start > 1) && (RBIR >= MI_map_4qam[2]))
-        if (RBIR < MI_map_16qam[2][middle]) {
-          end = middle;
-          middle = end/2;
-        } else {
-          start = middle;
-          middle = (end-middle)/2;
-        }
-      }
-
-      for (; end>start; end--) {
-        if ((RBIR < MI_map_16qam[2][end]) && (RBIR >  MI_map_16qam[2][end-2])) {
-          sinr_eff = MI_map_16qam[0][end-1];
-          break;
-        }
-      }
-    }
-
-    sinr_eff = sinr_eff * beta2_dlsch_MI[TM][mcs];
-  } else if (mcs>16) {
-    start = 0;
-    end = 226;
-    middle = end/2;
-
-    if (RBIR <= MI_map_64qam[2][start]) {
-      sinr_eff =  MI_map_64qam[0][start];
-    } else {
-      if (RBIR >= MI_map_64qam[2][end])
-        sinr_eff =  MI_map_64qam[0][end];
-      else {
-        //while((end-start > 1) && (RBIR >= MI_map_4qam[2]))
-        if (RBIR < MI_map_64qam[2][middle]) {
-          end = middle;
-          middle = end/2;
-        } else {
-          start = middle;
-          middle = (end-middle)/2;
-        }
-      }
-
-      for (; end>start; end--) {
-        if ((RBIR < MI_map_64qam[2][end]) && (RBIR >  MI_map_64qam[2][end-2])) {
-          sinr_eff = MI_map_64qam[0][end-1];
-          break;
-        }
-      }
-    }
-
-    sinr_eff = sinr_eff * beta2_dlsch_MI[TM][mcs];
-  }
-
-  printf("SINR_Eff = %e\n",sinr_eff);
-
-  sinr_eff *= 10;
-  sinr_eff = floor(sinr_eff);
-  // if ((int)sinr_eff%2) {
-  //   sinr_eff += 1;
-  // }
-  sinr_eff /= 10;
-  printf("sinr_eff after rounding = %f\n",sinr_eff);
-
-  for (index = 0; index < 16; index++) {
-    if(index == 0) {
-      if (sinr_eff < sinr_bler_map_up[mcs][0][index]) {
-        bler = 1;
-        break;
-      }
-    }
-
-    if (sinr_eff == sinr_bler_map_up[mcs][0][index]) {
-      bler = sinr_bler_map_up[mcs][1][index];
-    }
-  }
-
-#ifdef USER_MODE // need to be adapted for the emulation in the kernel space 
-
-  if (uniformrandom() < bler) {
-    printf("abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(0);
-  } else {
-    printf("abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(1);
-  }
-
-#endif
-
-}
-
-#endif
-
-uint32_t ulsch_decoding_emul(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc,
-                             uint8_t UE_index,
-                             uint16_t *crnti)
-{
-
-  uint8_t UE_id;
-  uint16_t rnti;
-  int subframe = proc->subframe_rx;
-  uint8_t harq_pid;
-  uint8_t CC_id = eNB->CC_id;
-
-  harq_pid = subframe2harq_pid(&eNB->frame_parms,proc->frame_rx,subframe);
-
-  rnti = eNB->ulsch[UE_index]->rnti;
-#ifdef DEBUG_PHY
-  LOG_D(PHY,"[eNB %d] ulsch_decoding_emul : subframe %d UE_index %d harq_pid %d rnti %x\n",eNB->Mod_id,subframe,UE_index,harq_pid,rnti);
-#endif
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-    if (rnti == PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[PHY_vars_UE_g[UE_id][CC_id]->current_thread_id[subframe]][0]->crnti)
-      break;
-
-  }
-
-  if (UE_id==NB_UE_INST) {
-    LOG_W(PHY,"[eNB %d] ulsch_decoding_emul: FATAL, didn't find UE with rnti %x (UE index %d)\n",
-          eNB->Mod_id, rnti, UE_index);
-    return(1+eNB->ulsch[UE_id]->max_turbo_iterations);
-  } else {
-    LOG_D(PHY,"[eNB %d] Found UE with rnti %x => UE_id %d\n",eNB->Mod_id, rnti, UE_id);
-  }
-
-  if (PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->harq_processes[harq_pid]->status == CBA_ACTIVE) {
-    *crnti = rnti;
-    PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->harq_processes[harq_pid]->status=IDLE;
-  } else
-    *crnti = 0x0;
-
-  if (1) {
-    LOG_D(PHY,"ulsch_decoding_emul abstraction successful\n");
-
-    memcpy(eNB->ulsch[UE_index]->harq_processes[harq_pid]->b,
-           PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->harq_processes[harq_pid]->b,
-           eNB->ulsch[UE_index]->harq_processes[harq_pid]->TBS>>3);
-
-    // get local ue's ack
-    if ((UE_index >= oai_emulation.info.first_ue_local) ||(UE_index <(oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local))) {
-      get_ack(&eNB->frame_parms,
-              PHY_vars_UE_g[UE_id][CC_id]->dlsch[0][0][0]->harq_ack,
-              proc->subframe_tx,
-              proc->subframe_rx,
-              eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK,0);
-    } else { // get remote UEs' ack
-      eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[0] = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_ACK[0];
-      eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[1] = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_ACK[1];
-    }
-
-    // Do abstraction of PUSCH feedback
-#ifdef DEBUG_PHY
-    LOG_D(PHY,"[eNB %d][EMUL] ue index %d UE_id %d: subframe %d : o_ACK (%d %d), cqi (val %d, len %d)\n",
-          eNB->Mod_id,UE_index, UE_id, subframe,eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[0],
-          eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[1],
-          ((HLC_subband_cqi_rank1_2A_5MHz *)PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o)->cqi1,
-          PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->O);
-#endif
-
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->Or1 = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->O;
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->Or2 = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->O;
-
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->uci_format = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->uci_format;
-    memcpy(eNB->ulsch[UE_index]->harq_processes[harq_pid]->o,PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o,MAX_CQI_BYTES);
-    memcpy(eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_RI,PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_RI,2);
-
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->cqi_crc_status = 1;
-
-    return(1);
-  } else {
-    LOG_W(PHY,"[eNB %d] ulsch_decoding_emul abstraction failed for UE %d\n",eNB->Mod_id,UE_index);
-
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->cqi_crc_status = 0;
-
-    // retransmission
-    return(1+eNB->ulsch[UE_index]->max_turbo_iterations);
-  }
-
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
index 43c14bde1c1a2178bc964b86b5ae0eca4e929608..920d8ff3fdbdfd1505d6f7e059217ec844bd632e 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -725,8 +725,8 @@ void ulsch_extract_rbs_single(int32_t **rxdataF,
   //uint8_t symbol = l+Ns*frame_parms->symbols_per_tti/2;
   uint8_t symbol = l+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame
 
-  AssertFatal((frame_parms->nb_antennas_rx>0) && (frame_parms->nb_antennas_rx<3),
-	      "nb_antennas_rx not in (1-2)\n");
+  AssertFatal((frame_parms->nb_antennas_rx>0) && (frame_parms->nb_antennas_rx<5),
+	      "nb_antennas_rx not in (1-4)\n");
 
   for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
 
@@ -1102,7 +1102,15 @@ void ulsch_channel_level(int32_t **drs_ch_estimates_ext,
 #endif
 }
 
+int ulsch_power_LUT[750];
 
+void init_ulsch_power_LUT() {
+  
+  int i;
+
+  for (i=0;i<750;i++) ulsch_power_LUT[i] = (int)ceil((pow(2.0,(double)i/100) - 1.0));
+
+}
 
 void rx_ulsch(PHY_VARS_eNB *eNB,
 	      eNB_rxtx_proc_t *proc,
@@ -1119,7 +1127,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
   uint32_t l,i;
   int32_t avgs;
   uint8_t log2_maxh=0,aarx;
-  int32_t avgU[2];
+  int32_t avgU[eNB->frame_parms.nb_antennas_rx];
 
 
   //  uint8_t harq_pid = ( ulsch->RRCConnRequest_flag== 0) ? subframe2harq_pid_tdd(frame_parms->tdd_config,subframe) : 0;
@@ -1166,19 +1174,26 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
 
   int correction_factor = 1;
   int deltaMCS=1; 
-  int MPR_times_Ks;
+  int MPR_times_100Ks;
 
   if (deltaMCS==1) {
-// Note we're using TBS instead of sumKr, since didn't run segmentation yet!
-    MPR_times_Ks = 5*ulsch[UE_id]->harq_processes[harq_pid]->TBS/(ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*4*ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
-    if (MPR_times_Ks > 0) correction_factor = (1<<MPR_times_Ks) - 1;
+    // Note we're using TBS instead of sumKr, since didn't run segmentation yet!
+
+    MPR_times_100Ks = 500*ulsch[UE_id]->harq_processes[harq_pid]->TBS/(ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*4*ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
+
+    AssertFatal(MPR_times_100Ks < 750 && MPR_times_100Ks >= 0,"Impossible value for MPR_times_100Ks %d (TBS %d,Nre %d)\n",
+		MPR_times_100Ks,ulsch[UE_id]->harq_processes[harq_pid]->TBS,
+		(ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*4*ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch));
+
+    if (MPR_times_100Ks > 0) correction_factor = ulsch_power_LUT[MPR_times_100Ks];
+			       
   }
   for (i=0; i<frame_parms->nb_antennas_rx; i++) {
     
     pusch_vars->ulsch_power[i] = signal_energy_nodc(pusch_vars->drs_ch_estimates[i],
 						    ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor;
-//printf("%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d)  power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_Ks,correction_factor,dB_fixed_times10(pusch_vars->ulsch_power[i])); 
-    
+    /*    printf("%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d)  power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_times10(pusch_vars->ulsch_power[i])); 
+     */
   }
 
 
@@ -1197,7 +1212,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
   avgs = 0;
   
   for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
-    avgs = cmax(avgs,avgU[(aarx<<1)]);
+    avgs = cmax(avgs,avgU[aarx]);
   
   //      log2_maxh = 4+(log2_approx(avgs)/2);
   
@@ -1334,36 +1349,54 @@ void rx_ulsch_emul(PHY_VARS_eNB *eNB,
 }
 
 
- void dump_ulsch(PHY_VARS_eNB *eNB,int frame,int subframe,uint8_t UE_id) {
+ void dump_ulsch(PHY_VARS_eNB *eNB,int frame,int subframe,uint8_t UE_id,int round) {
   
   uint32_t nsymb = (eNB->frame_parms.Ncp == 0) ? 14 : 12;
   uint8_t harq_pid;
+  char fname[100],vname[100];
 
   harq_pid = subframe2harq_pid(&eNB->frame_parms,frame,subframe);
 
-  printf("Dumping ULSCH in subframe %d with harq_pid %d, for NB_rb %d, TBS %d, Qm %d, N_symb %d\n", 
-	 subframe,harq_pid,eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
+  printf("Dumping ULSCH in subframe %d with harq_pid %d, round %d for NB_rb %d, TBS %d, Qm %d, N_symb %d\n", 
+	 subframe,harq_pid,round,eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
          eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS,eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm,
          eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
-  //#ifndef OAI_EMU
-  write_output("/tmp/ulsch_d.m","ulsch_dseq",&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
+  sprintf(fname,"/tmp/ulsch_r%d_d",round);
+  sprintf(vname,"/tmp/ulsch_r%d_dseq",round);
+  write_output(fname,vname,&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
                eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
-  if (eNB->common_vars.rxdata) write_output("/tmp/rxsig0.m","rxs0", &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
-  
-  if (eNB->frame_parms.nb_antennas_rx>1)
-    if (eNB->common_vars.rxdata) write_output("/tmp/rxsig1.m","rxs1", &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
+  if (eNB->common_vars.rxdata) {
+    sprintf(fname,"/tmp/rxsig0_r%d.m",round);
+    sprintf(vname,"rxs0_r%d",round);
+    write_output(fname,vname, &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
   
+    if (eNB->frame_parms.nb_antennas_rx>1)
+      if (eNB->common_vars.rxdata) {
+	sprintf(fname,"/tmp/rxsig1_r%d.m",round);
+	sprintf(vname,"rxs1_r%d",round);
+	write_output(fname,vname, &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
+      }
+  }
 
-  write_output("/tmp/rxsigF0.m","rxsF0", &eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
-
-  if (eNB->frame_parms.nb_antennas_rx>1)
-    write_output("/tmp/rxsigF1.m","rxsF1", &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
+  sprintf(fname,"/tmp/rxsigF0_r%d.m",round);
+  sprintf(vname,"rxsF0_r%d",round);
+  write_output(fname,vname, (void*)&eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
 
-  write_output("/tmp/rxsigF0_ext.m","rxsF0_ext", &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+  if (eNB->frame_parms.nb_antennas_rx>1) {
+    sprintf(fname,"/tmp/rxsigF1_r%d.m",round);
+    sprintf(vname,"rxsF1_r%d",round);
+    write_output(vname,fname, &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
+  }
 
-  if (eNB->frame_parms.nb_antennas_rx>1)
-    write_output("/tmp/rxsigF1_ext.m","rxsF1_ext", &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+  sprintf(fname,"/tmp/rxsigF0_ext_r%d.m",round);
+  sprintf(vname,"rxsF0_ext_r%d",round);
+  write_output(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
 
+  if (eNB->frame_parms.nb_antennas_rx>1) {
+    sprintf(fname,"/tmp/rxsigF1_ext_r%d.m",round);
+    sprintf(vname,"rxsF1_ext_r%d",round);
+    write_output(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_ext[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+  }
   /*
   if (eNB->srs_vars[UE_id].srs_ch_estimates) write_output("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
 
@@ -1371,17 +1404,28 @@ void rx_ulsch_emul(PHY_VARS_eNB *eNB,
     if (eNB->srs_vars[UE_id].srs_ch_estimates) write_output("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
   */
 
-  write_output("/tmp/drs_est0.m","drsest0",eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+  sprintf(fname,"/tmp/drs_est0_r%d.m",round);
+  sprintf(vname,"drsest0_r%d",round);
+  write_output(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
 
-  if (eNB->frame_parms.nb_antennas_rx>1)
-    write_output("/tmp/drs_est1.m","drsest1",eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+  if (eNB->frame_parms.nb_antennas_rx>1) {
+    sprintf(fname,"/tmp/drs_est1_r%d.m",round);
+    sprintf(vname,"drsest1_r%d",round);
+    write_output(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+  }
 
-  write_output("/tmp/ulsch_rxF_comp0.m","ulsch0_rxF_comp0",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+  sprintf(fname,"/tmp/ulsch0_rxF_comp0_r%d.m",round);
+  sprintf(vname,"ulsch0_rxF_comp0_r%d",round);
+  write_output(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
   //  write_output("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
-  write_output("/tmp/ulsch_rxF_llr.m","ulsch_llr",eNB->pusch_vars[UE_id]->llr,
+  sprintf(fname,"/tmp/ulsch_rxF_llr_r%d.m",round);
+  sprintf(vname,"ulsch_llr_r%d",round);
+  write_output(fname,vname,eNB->pusch_vars[UE_id]->llr,
                eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm
                *eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch,1,0);
-  write_output("/tmp/ulsch_ch_mag.m","ulsch_ch_mag",&eNB->pusch_vars[UE_id]->ul_ch_mag[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
+  sprintf(fname,"/tmp/ulsch_ch_mag_r%d.m",round);
+  sprintf(vname,"ulsch_ch_mag_r%d",round);
+  write_output(fname,vname,&eNB->pusch_vars[UE_id]->ul_ch_mag[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
   //  write_output("ulsch_ch_mag1.m","ulsch_ch_mag1",&eNB->pusch_vars[UE_id]->ul_ch_mag[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
   //#endif
 }
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c
index 6dced43b5f65b951785e9224ba5da10ef10a8bfc..d1718f6e90f600927f5d93f3a18e93213bea86f8 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/LTE_TRANSPORT/vars.h b/openair1/PHY/LTE_TRANSPORT/vars.h
index 886b067cf6a133d4947679222968363c37c4dff5..41ee40b64af7a3df0b484706e67d08f8da45a26f 100644
--- a/openair1/PHY/LTE_TRANSPORT/vars.h
+++ b/openair1/PHY/LTE_TRANSPORT/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c
index e1a28ea4f0a5d623dcaa5a430a150124e05a8462..84863c81e89ce8c6742e8ca10896cd81ed3fa92c 100644
--- a/openair1/PHY/MODULATION/beamforming.c
+++ b/openair1/PHY/MODULATION/beamforming.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/defs.h b/openair1/PHY/MODULATION/defs.h
index 65bfda2fbfd16d7fb7a59184b72a32ca78daedce..f9bbdcd27156e82cd7e41d010f406a58a905d6ca 100644
--- a/openair1/PHY/MODULATION/defs.h
+++ b/openair1/PHY/MODULATION/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/extern.h b/openair1/PHY/MODULATION/extern.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair1/PHY/MODULATION/extern.h
+++ b/openair1/PHY/MODULATION/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/kHz_7_5.h b/openair1/PHY/MODULATION/kHz_7_5.h
index c6d484143a9fd3636e2aa632e6cdea30b1fa9c9a..ce2f0d5f2c11a3c06a93baf368a99f8cee01308b 100644
--- a/openair1/PHY/MODULATION/kHz_7_5.h
+++ b/openair1/PHY/MODULATION/kHz_7_5.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c
index 369a63355c93d97aaaf102d84fed10cad526c752..37d1a483119cda97b5e455787d51bada349b83fc 100644
--- a/openair1/PHY/MODULATION/ofdm_mod.c
+++ b/openair1/PHY/MODULATION/ofdm_mod.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/prach625Hz.h b/openair1/PHY/MODULATION/prach625Hz.h
index 63606ae57bbc5e3d2ad2d6dfbb47b017fc901fd4..38b63b3b053bb02d7e609137bcfcd0af78031d1c 100644
--- a/openair1/PHY/MODULATION/prach625Hz.h
+++ b/openair1/PHY/MODULATION/prach625Hz.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c
index d97ffbc543e080a5d594b430ccb798c85daf25d6..39ae90217f9b336d2afc397bd60106adc4ecb50f 100644
--- a/openair1/PHY/MODULATION/slot_fep.c
+++ b/openair1/PHY/MODULATION/slot_fep.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/slot_fep_mbsfn.c b/openair1/PHY/MODULATION/slot_fep_mbsfn.c
index adcd8cd186bd7d50c556c536f9c7dd90a78baa84..7b902bb8f1524199980c08a7b9dc3bf1208ed403 100644
--- a/openair1/PHY/MODULATION/slot_fep_mbsfn.c
+++ b/openair1/PHY/MODULATION/slot_fep_mbsfn.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/MODULATION/slot_fep_ul.c b/openair1/PHY/MODULATION/slot_fep_ul.c
index bbf29508745a9ec68c5644f85322735ac4337a85..5beb7eccfdc14880ee953d10b198422a8b30a525 100644
--- a/openair1/PHY/MODULATION/slot_fep_ul.c
+++ b/openair1/PHY/MODULATION/slot_fep_ul.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -24,6 +24,8 @@
 #include "defs.h"
 //#define DEBUG_FEP
 
+
+
 int slot_fep_ul(RU_t *ru,
                 unsigned char l,
                 unsigned char Ns,
@@ -134,7 +136,7 @@ int slot_fep_ul(RU_t *ru,
   }
 
 #ifdef DEBUG_FEP
-  LOG_D(PHY,"slot_fep: done\n");
+  //  LOG_D(PHY,"slot_fep: done\n");
 #endif
   return(0);
 }
diff --git a/openair1/PHY/MODULATION/ul_7_5_kHz.c b/openair1/PHY/MODULATION/ul_7_5_kHz.c
index 14abd2380d2038b8d1e121e31ab5101887e1fada..d92dc1c8b3203bf5c0d103ec3d7fd09ce220f138 100644
--- a/openair1/PHY/MODULATION/ul_7_5_kHz.c
+++ b/openair1/PHY/MODULATION/ul_7_5_kHz.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -23,11 +23,7 @@
 #include "PHY/extern.h"
 #include "extern.h"
 #include "kHz_7_5.h"
-#ifdef USER_MODE
 #include <math.h>
-#else
-#include "rtai_math.h"
-#endif
 #include "PHY/sse_intrin.h"
 
 short conjugate75[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ;
@@ -192,7 +188,7 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
   }
 
 
-  slot_offset = (uint32_t)slot * frame_parms->samples_per_tti/2-ru->N_TA_offset;
+  slot_offset = ((uint32_t)slot * frame_parms->samples_per_tti/2)-ru->N_TA_offset;
   slot_offset2 = (uint32_t)(slot&1) * frame_parms->samples_per_tti/2;
 
   len = frame_parms->samples_per_tti/2;
diff --git a/openair1/PHY/MODULATION/vars.h b/openair1/PHY/MODULATION/vars.h
index adda18dffc1188a303fc9fa078f542bf2c8dd7ab..a05999afe1661142ecb9fbbce6c5f1d46bce0f4b 100644
--- a/openair1/PHY/MODULATION/vars.h
+++ b/openair1/PHY/MODULATION/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/8bit_rxdemux.c b/openair1/PHY/TOOLS/8bit_rxdemux.c
index 47d7b27571a169604bddf7436ae0d22ea1cf9a02..030be47b5daf1a04b524de31f36eb93f314a8e4d 100644
--- a/openair1/PHY/TOOLS/8bit_rxdemux.c
+++ b/openair1/PHY/TOOLS/8bit_rxdemux.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/8bit_txmux.c b/openair1/PHY/TOOLS/8bit_txmux.c
index 761f15c4f09196f5439343966a51d5ec03dc54b6..b103bc9c5cd9b49a4d0df7411da79410c518250c 100644
--- a/openair1/PHY/TOOLS/8bit_txmux.c
+++ b/openair1/PHY/TOOLS/8bit_txmux.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/Makefile b/openair1/PHY/TOOLS/Makefile
index eee9d7834426077de14d2b71b80d7011283ce276..59b6a1e03beedc51371c2a611964fb3d5a2682b6 100644
--- a/openair1/PHY/TOOLS/Makefile
+++ b/openair1/PHY/TOOLS/Makefile
@@ -1,14 +1,14 @@
 lte_dfts_sse4: lte_dfts.c
-	gcc -O2 -msse4.1 -g -ggdb -o lte_dfts_sse4 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
+	gcc -O2 -msse4.1 -g -ggdb -o lte_dfts_sse4 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
 
 lte_dfts_avx2: lte_dfts.c
-	gcc -O2 -mavx2 -g -ggdb -o lte_dfts_avx2 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
+	gcc -O2 -mavx2 -g -ggdb -o lte_dfts_avx2 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
 
 lte_dfts_avx2.s: lte_dfts.c
-	gcc -O2 -mavx2 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
+	gcc -O2 -mavx2 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
 
 lte_dfts_sse4.s: lte_dfts.c
-	gcc -O2 -msse4.1 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
+	gcc -O2 -msse4.1 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
 
 dft_cycles_avx2: lte_dfts_avx2
 	./lte_dfts_avx2 | egrep cycles
diff --git a/openair1/PHY/TOOLS/alaw_lut.h b/openair1/PHY/TOOLS/alaw_lut.h
index 0531e4eba7f721a87b351c54f1aa1e26e2189d92..e7b9539e7f3ffcce0301be82c3468261dc77bf7e 100644
--- a/openair1/PHY/TOOLS/alaw_lut.h
+++ b/openair1/PHY/TOOLS/alaw_lut.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/angle.c b/openair1/PHY/TOOLS/angle.c
index 9ea714b4fcf73d390f7dad84d943a43ce621100b..a06640d1cf4a8762121b515c4b78bd9db0c0a42d 100644
--- a/openair1/PHY/TOOLS/angle.c
+++ b/openair1/PHY/TOOLS/angle.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/cadd_sv.c b/openair1/PHY/TOOLS/cadd_sv.c
index b83f9e1fce9d076b338aa027441ac5f22bd952b5..caa8d1cc04197480ee30483bf544dc03baeb75bf 100644
--- a/openair1/PHY/TOOLS/cadd_sv.c
+++ b/openair1/PHY/TOOLS/cadd_sv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/cadd_vv.c b/openair1/PHY/TOOLS/cadd_vv.c
index a08564daf302e5da32f96fbe8b124931437d2f5a..34808552fcaab7966d46249853b2ed4a6c9093d8 100644
--- a/openair1/PHY/TOOLS/cadd_vv.c
+++ b/openair1/PHY/TOOLS/cadd_vv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/cdot_prod.c b/openair1/PHY/TOOLS/cdot_prod.c
index 7e73e58e5e6523305b4aff7ae5d64222e9d026a1..91ba246bddf51afeb637976ace75c8decec83cae 100644
--- a/openair1/PHY/TOOLS/cdot_prod.c
+++ b/openair1/PHY/TOOLS/cdot_prod.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/cmult_sv.c b/openair1/PHY/TOOLS/cmult_sv.c
index bc631bd6ccc7768d342243fea9df2ebb6876efff..61970ca2b69afa6d8ce38df8fe9d3bf3cc9c9636 100644
--- a/openair1/PHY/TOOLS/cmult_sv.c
+++ b/openair1/PHY/TOOLS/cmult_sv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/cmult_vv.c b/openair1/PHY/TOOLS/cmult_vv.c
index f8caa0c6da0261e84d6f6ecfca7119937c637b03..13facf69077a165a0f6c05378bb1f847c6c4ab0b 100644
--- a/openair1/PHY/TOOLS/cmult_vv.c
+++ b/openair1/PHY/TOOLS/cmult_vv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -20,10 +20,7 @@
  */
 
 #include "defs.h"
-//#include "MAC_INTERFACE/extern.h"
-#ifdef USER_MODE
 #include <stdio.h>
-#endif
 
 #if defined(__x86_64__) || defined(__i386__)
 int16_t conjug[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ;
@@ -267,4 +264,4 @@ int multadd_cpx_vector(int16_t *x1,
   _mm_empty();
   _m_empty();
   return(0);
-}
\ No newline at end of file
+}
diff --git a/openair1/PHY/TOOLS/costable.h b/openair1/PHY/TOOLS/costable.h
index 03682f84dcd787cbece6b2add79f07c21074750d..b9d24c75b4857f46960b60e3680592eae6005d79 100644
--- a/openair1/PHY/TOOLS/costable.h
+++ b/openair1/PHY/TOOLS/costable.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/dB_routines.c b/openair1/PHY/TOOLS/dB_routines.c
index 1bcefbba03a76e9b04fe9813f37bff5526e1f8b9..c99703eaf3c6139682f098aa932691a6522bcfc5 100644
--- a/openair1/PHY/TOOLS/dB_routines.c
+++ b/openair1/PHY/TOOLS/dB_routines.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/dB_routines.h b/openair1/PHY/TOOLS/dB_routines.h
index 965caf76d7b25e2a1301e788b23949fbbdde0b4e..c28184259f4d909770da23675be35658f8cbe07e 100644
--- a/openair1/PHY/TOOLS/dB_routines.h
+++ b/openair1/PHY/TOOLS/dB_routines.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/defs.h b/openair1/PHY/TOOLS/defs.h
index a90a8b718cfc36ec6ccbd3927eae8f70ae3abfea..b92c2a42367b59acae680d167af8665f3de7093e 100644
--- a/openair1/PHY/TOOLS/defs.h
+++ b/openair1/PHY/TOOLS/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -34,13 +34,10 @@
 #include "PHY/sse_intrin.h"
 
 
-//defined in rtai_math.h
-#ifndef _RTAI_MATH_H
 struct complex {
   double x;
   double y;
 };
-#endif
 
 struct complexf {
   float r;
@@ -286,7 +283,6 @@ void bit8_txmux(int32_t length,int32_t offset);
 
 void bit8_rxdemux(int32_t length,int32_t offset);
 
-#ifdef USER_MODE
 /*!\fn int32_t write_output(const char *fname, const char *vname, void *data, int length, int dec, char format);
 \brief Write output file from signal data
 @param fname output file name
@@ -297,7 +293,6 @@ void bit8_rxdemux(int32_t length,int32_t offset);
 @param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
 */
 int32_t write_output(const char *fname, const char *vname, void *data, int length, int dec, char format);
-#endif
 
 void Zero_Buffer(void *,uint32_t);
 void Zero_Buffer_nommx(void *buf,uint32_t length);
@@ -361,17 +356,6 @@ int16_t dB_fixed_times10(uint32_t x);
 int32_t phy_phase_compensation_top (uint32_t pilot_type, uint32_t initial_pilot,
                                     uint32_t last_pilot, int32_t ignore_prefix);
 
-/*!\fn void phy_phase_compensation (int16_t *ref_sch, int16_t *tgt_sch, int16_t *out_sym, int32_t ignore_prefix, int32_t aa, struct complex16 *perror_out);
-This function is used by the EMOS to compensate the phase rotation of the RF. It has been designed for symbols of type CHSCH or SCH, but cannot be used for the data channels.
-@param ref_sch reference symbol
-@param tgt_sch target symbol
-@param out_sym output of the operation
-@param ignore_prefix  set to 1 if cyclic prefix has not been removed (by the hardware)
-@param aa antenna index
-@param perror_out phase error (output parameter)
-*/
-void phy_phase_compensation (int16_t *ref_sch, int16_t *tgt_sch, int16_t *out_sym, int32_t ignore_prefix, int32_t aa, struct complex16 *perror_out );
-
 int32_t dot_product(int16_t *x,
                     int16_t *y,
                     uint32_t N, //must be a multiple of 8
diff --git a/openair1/PHY/TOOLS/extern.h b/openair1/PHY/TOOLS/extern.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair1/PHY/TOOLS/extern.h
+++ b/openair1/PHY/TOOLS/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/file_output.c b/openair1/PHY/TOOLS/file_output.c
index 16b8b108d0fcf8cd3e262b1e09b9ffd8d7941217..1e0b31a47f0a31b08a17c279e09a5fb9f53d473f 100644
--- a/openair1/PHY/TOOLS/file_output.c
+++ b/openair1/PHY/TOOLS/file_output.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,8 +19,6 @@
  *      contact@openairinterface.org
  */
 
-#ifdef USER_MODE
-
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -180,5 +178,3 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
 
   return 0;
 }
-
-#endif // USER_MODE
diff --git a/openair1/PHY/TOOLS/invSqrt.c b/openair1/PHY/TOOLS/invSqrt.c
index 332cb638863460d74f136adf7a4e3115620b027e..b3e0d9749afed846cd04f2a15aac314166fad728 100644
--- a/openair1/PHY/TOOLS/invSqrt.c
+++ b/openair1/PHY/TOOLS/invSqrt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/log2_approx.c b/openair1/PHY/TOOLS/log2_approx.c
index bd4d5d04ab87fec8fad51b0026163fa1a3bce3c2..acd15348571a290f80b3d83cca86e3210d6eb608 100644
--- a/openair1/PHY/TOOLS/log2_approx.c
+++ b/openair1/PHY/TOOLS/log2_approx.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/lte_dfts.c b/openair1/PHY/TOOLS/lte_dfts.c
index 0aaea70d7d4a95f517e6d832f2f235dd23f2fb48..47b39ea7d2666154005d4086e0fdea4c82d8d628 100644
--- a/openair1/PHY/TOOLS/lte_dfts.c
+++ b/openair1/PHY/TOOLS/lte_dfts.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,11 +19,9 @@
  *      contact@openairinterface.org
  */
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#endif
 
 #include <stdint.h>
 
@@ -2049,6 +2047,8 @@ const static int16_t tw16c[24] __attribute__((aligned(32))) = { 0,32767,12540,30
                                                    0,32767,30273,12539,23170,-23170,-12539,-30273
                                                  };
 
+#ifdef __AVX2__
+
 const static int16_t tw16rep[48] __attribute__((aligned(32))) = { 32767,0,30272,-12540,23169 ,-23170,12539 ,-30273,32767,0,30272,-12540,23169 ,-23170,12539 ,-30273,
 						     32767,0,23169,-23170,0     ,-32767,-23170,-23170,32767,0,23169,-23170,0     ,-32767,-23170,-23170,
 						     32767,0,12539,-30273,-23170,-23170,-30273,12539,32767,0,12539,-30273,-23170,-23170,-30273,12539
@@ -2069,6 +2069,8 @@ const static int16_t tw16crep[48] __attribute__((aligned(32))) = { 0,32767,12540
 						      0,32767,30273,12539,23170,-23170,-12539,-30273,0,32767,30273,12539,23170,-23170,-12539,-30273
                                                     };
 
+#endif /* __AVX2__ */
+
 
 
 static inline void dft16(int16_t *x,int16_t *y) __attribute__((always_inline));
diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c
index ad51a348ec467a1ef5239b822b9744b331735d08..eb86af916597fe0869af11ada340788751f301be 100644
--- a/openair1/PHY/TOOLS/lte_phy_scope.c
+++ b/openair1/PHY/TOOLS/lte_phy_scope.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -162,7 +162,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
   int16_t **chest_t;
   int16_t **chest_f;
   int16_t *pusch_llr;
-  int16_t *pusch_comp;
+  int32_t *pusch_comp;
   int32_t *pucch1_comp;
   int32_t *pucch1_thres;
   int32_t *pucch1ab_comp;
@@ -200,7 +200,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
   chest_t = (int16_t**) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates[eNB_id];
   chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id];
   pusch_llr = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->llr;
-  pusch_comp = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0];
+  pusch_comp = (int32_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0];
   pucch1_comp = (int32_t*) phy_vars_enb->pucch1_stats[UE_id];
   pucch1_thres = (int32_t*) phy_vars_enb->pucch1_stats_thres[UE_id];
   pucch1ab_comp = (int32_t*) phy_vars_enb->pucch1ab_stats[UE_id];
diff --git a/openair1/PHY/TOOLS/lte_phy_scope.h b/openair1/PHY/TOOLS/lte_phy_scope.h
index 2e8ca96c3aff82f34ad1a92c7b85edd1ae7357dc..1d2b2ea1ed99c5b579aaa6f77b16bf5485108a7d 100644
--- a/openair1/PHY/TOOLS/lte_phy_scope.h
+++ b/openair1/PHY/TOOLS/lte_phy_scope.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/lte_phy_scope_tm4.c b/openair1/PHY/TOOLS/lte_phy_scope_tm4.c
index e5d667c3c20c6528cb2126f27a49fdaac9c225b6..8dd41548ab3b62f915b1873acdfe84227fa425fe 100644
--- a/openair1/PHY/TOOLS/lte_phy_scope_tm4.c
+++ b/openair1/PHY/TOOLS/lte_phy_scope_tm4.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/lut.c b/openair1/PHY/TOOLS/lut.c
index ba9da904e3b897f45907896140787a1da945a62f..f58a06c8ae103cbace8f22927f4e1f3fe94c0af8 100644
--- a/openair1/PHY/TOOLS/lut.c
+++ b/openair1/PHY/TOOLS/lut.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/memory_routines.c b/openair1/PHY/TOOLS/memory_routines.c
index c7015ff46e050f1fed0f840f27f74c5c239f30fb..cef9928988bd79cd809b0108810d65f3c74fa262 100644
--- a/openair1/PHY/TOOLS/memory_routines.c
+++ b/openair1/PHY/TOOLS/memory_routines.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/signal_energy.c b/openair1/PHY/TOOLS/signal_energy.c
index 2ae49ae87f7baaa2cc1adfb5cdbcecfe5c1d065b..918d2e3ba0043c636dcd67a2a875f338e7234063 100644
--- a/openair1/PHY/TOOLS/signal_energy.c
+++ b/openair1/PHY/TOOLS/signal_energy.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/smbv.c b/openair1/PHY/TOOLS/smbv.c
index adc512d7e5a2aeac61db41b8ae0e87d9cfd3841f..e020ca0c5200573c391d2d0235a9d0bfb855b3cb 100644
--- a/openair1/PHY/TOOLS/smbv.c
+++ b/openair1/PHY/TOOLS/smbv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/smbv.h b/openair1/PHY/TOOLS/smbv.h
index 40a954d6e30968dc8e7376d0db080135e1c7f6bc..127cd3f7b976ad6a5c54aff5e064cd4e436c5745 100644
--- a/openair1/PHY/TOOLS/smbv.h
+++ b/openair1/PHY/TOOLS/smbv.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/sqrt.c b/openair1/PHY/TOOLS/sqrt.c
index b950f4b542a352511c97fd745e88ec600eec4255..e6a4d9bb244202ae3127beaaf95ae6923a99675b 100644
--- a/openair1/PHY/TOOLS/sqrt.c
+++ b/openair1/PHY/TOOLS/sqrt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c
index 857696a48f33f36d01f62d02a330b2dcf343a4a8..cb7775904099a769091795d62d23cc1b1d950b25 100644
--- a/openair1/PHY/TOOLS/time_meas.c
+++ b/openair1/PHY/TOOLS/time_meas.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h
index 233d16ebbea83f7e95acebbbc196dc7c82fffca0..32e6883d56f5a7c2fca509b282e8205ef2a04104 100644
--- a/openair1/PHY/TOOLS/time_meas.h
+++ b/openair1/PHY/TOOLS/time_meas.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/twiddle12288.h b/openair1/PHY/TOOLS/twiddle12288.h
index 8039b0b0ce094601197030db975098c03fb43c01..17fa92f4e9b341ccb0dd05cc44e83817ed6a2475 100644
--- a/openair1/PHY/TOOLS/twiddle12288.h
+++ b/openair1/PHY/TOOLS/twiddle12288.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/twiddle1536.h b/openair1/PHY/TOOLS/twiddle1536.h
index c84724904e933ec39cfe776ae1fee21aecffe6a0..304766caaf13fc507afa08a357b82c5562f50dae 100644
--- a/openair1/PHY/TOOLS/twiddle1536.h
+++ b/openair1/PHY/TOOLS/twiddle1536.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/twiddle18432.h b/openair1/PHY/TOOLS/twiddle18432.h
index 8c6c9822dc69c7c15ef1141b40a5ea4454e323bd..696c7f37aeb2fe25dbc4edabc6bccaef1d53fdc7 100644
--- a/openair1/PHY/TOOLS/twiddle18432.h
+++ b/openair1/PHY/TOOLS/twiddle18432.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/twiddle24576.h b/openair1/PHY/TOOLS/twiddle24576.h
index 4ab699b9fd1765bb089d080ec5da66fe9a5c5b5e..34fc59d7796a54a9aafb230ddcfa7c02dd0057c9 100644
--- a/openair1/PHY/TOOLS/twiddle24576.h
+++ b/openair1/PHY/TOOLS/twiddle24576.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/twiddle6144.h b/openair1/PHY/TOOLS/twiddle6144.h
index bc46647dbf7c91769575fd33b541002444cb5116..6fc18ebfbe0cbe52c5da48026e59f209e696e87d 100644
--- a/openair1/PHY/TOOLS/twiddle6144.h
+++ b/openair1/PHY/TOOLS/twiddle6144.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/twiddles4096.h b/openair1/PHY/TOOLS/twiddles4096.h
index 3122e1fbb907ec1882526d33ee913cac88d110ec..af2b6a8887619bd82949cfa72ac54f814d5b83a6 100644
--- a/openair1/PHY/TOOLS/twiddles4096.h
+++ b/openair1/PHY/TOOLS/twiddles4096.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/twiddles8192.h b/openair1/PHY/TOOLS/twiddles8192.h
index 344f5e33255c3c37bed118d18f7037142e45744a..6b76619013387f85ddac1292a29fa5b39fff4ecd 100644
--- a/openair1/PHY/TOOLS/twiddles8192.h
+++ b/openair1/PHY/TOOLS/twiddles8192.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/TOOLS/vars.h b/openair1/PHY/TOOLS/vars.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair1/PHY/TOOLS/vars.h
+++ b/openair1/PHY/TOOLS/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h
index e53513817db76440d3b029c2e049afefb649f614..1d2b622e7e748db1610f3bf96a30f26177df7c8c 100644
--- a/openair1/PHY/defs.h
+++ b/openair1/PHY/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -79,6 +79,12 @@
 #define bigmalloc16 malloc16
 #define openair_free(y,x) free((y))
 #define PAGE_SIZE 4096
+#define free_and_zero(PtR) do { \
+      if (PtR) {           \
+        free(PtR);         \
+        PtR = NULL;        \
+      }                    \
+    } while (0)
 
 #define RX_NB_TH_MAX 2
 #define RX_NB_TH 2
@@ -772,6 +778,8 @@ typedef struct RU_t_s{
   void                 (*fh_south_asynch_in)(struct RU_t_s *ru,int *frame, int *subframe);
   /// function pointer to initialization function for radio interface
   int                  (*start_rf)(struct RU_t_s *ru);
+  /// function pointer to release function for radio interface
+  int                  (*stop_rf)(struct RU_t_s *ru);
   /// function pointer to initialization function for radio interface
   int                  (*start_if)(struct RU_t_s *ru,struct PHY_VARS_eNB_s *eNB);
   /// function pointer to RX front-end processing routine (DFTs/prefix removal or NULL)
@@ -784,8 +792,10 @@ typedef struct RU_t_s{
   int (*wakeup_rxtx)(struct PHY_VARS_eNB_s *eNB, struct RU_t_s *ru);
   /// function pointer to wakeup routine in lte-enb.
   void (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
+#ifdef Rel14
   /// function pointer to wakeup routine in lte-enb.
   void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
+#endif
   /// function pointer to eNB entry routine
   void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string,struct RU_t_s *ru);
   /// Timing statistics
@@ -800,6 +810,14 @@ typedef struct RU_t_s{
   time_stats_t ofdm_mod_wait_stats;
   /// Timing wakeup statistics (TX)
   time_stats_t ofdm_mod_wakeup_stats;
+  /// Timing statistics (RX Fronthaul + Compression)
+  time_stats_t rx_fhaul;
+  /// Timing statistics (TX Fronthaul + Compression)
+  time_stats_t tx_fhaul; 
+  /// Timong statistics (Compression)
+  time_stats_t compression;
+  /// Timing statistics (Fronthaul transport)
+  time_stats_t transport;
   /// RX and TX buffers for precoder output
   RU_COMMON            common;
   /// beamforming weight vectors per eNB
@@ -963,7 +981,8 @@ typedef struct {
   int            subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
   /// Total Subband CQI and RB
   int            subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100];
-
+  /// PRACH background noise level
+  int            prach_I0;
 } PHY_MEASUREMENTS_eNB;
 
 
@@ -1028,6 +1047,7 @@ typedef struct PHY_VARS_eNB_s {
   LTE_eNB_ULSCH_t     *ulsch[NUMBER_OF_UE_MAX+1];      // Nusers + number of RA
   LTE_eNB_DLSCH_t     *dlsch_SI,*dlsch_ra,*dlsch_p;
   LTE_eNB_DLSCH_t     *dlsch_MCH;
+  LTE_eNB_DLSCH_t     *dlsch_PCH;
   LTE_eNB_UE_stats     UE_stats[NUMBER_OF_UE_MAX];
   LTE_eNB_UE_stats    *UE_stats_ptr[NUMBER_OF_UE_MAX];
 
@@ -1079,8 +1099,8 @@ typedef struct PHY_VARS_eNB_s {
 
   /// if ==0 enables phy only test mode
   int mac_enabled;
-
-
+  /// counter to average prach energh over first 100 prach opportunities
+  int prach_energy_counter;
 
   // PDSCH Varaibles
   PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_UE_MAX];
@@ -1498,6 +1518,53 @@ extern pthread_cond_t sync_cond;
 extern pthread_mutex_t sync_mutex;
 extern int sync_var;
 
+
+#define MODE_DECODE_NONE         0
+#define MODE_DECODE_SSE          1
+#define MODE_DECODE_C            2
+#define MODE_DECODE_AVX2         3
+
+#define DECODE_INITTD8_SSE_FPTRIDX   0
+#define DECODE_INITTD16_SSE_FPTRIDX  1
+#define DECODE_INITTD_AVX2_FPTRIDX   2
+#define DECODE_TD8_SSE_FPTRIDX       3
+#define DECODE_TD16_SSE_FPTRIDX      4
+#define DECODE_TD_C_FPTRIDX          5
+#define DECODE_TD16_AVX2_FPTRIDX     6
+#define DECODE_FREETD8_FPTRIDX       7
+#define DECODE_FREETD16_FPTRIDX      8
+#define DECODE_FREETD_AVX2_FPTRIDX   9
+#define ENCODE_SSE_FPTRIDX           10
+#define ENCODE_C_FPTRIDX             11
+#define ENCODE_INIT_SSE_FPTRIDX      12
+#define DECODE_NUM_FPTR              13
+
+
+typedef uint8_t(*decoder_if_t)(int16_t *y,
+                               int16_t *y2,
+    		               uint8_t *decoded_bytes,
+    		               uint8_t *decoded_bytes2,
+	   		       uint16_t n,
+	   		       uint16_t f1,
+	   		       uint16_t f2,
+	   		       uint8_t max_iterations,
+	   		       uint8_t crc_type,
+	   		       uint8_t F,
+	   		       time_stats_t *init_stats,
+	   		       time_stats_t *alpha_stats,
+	   		       time_stats_t *beta_stats,
+	   		       time_stats_t *gamma_stats,
+	   		       time_stats_t *ext_stats,
+	   		       time_stats_t *intl1_stats,
+                               time_stats_t *intl2_stats);
+
+typedef uint8_t(*encoder_if_t)(uint8_t *input,
+                               uint16_t input_length_bytes,
+                               uint8_t *output,
+                               uint8_t F,
+                               uint16_t interleaver_f1,
+                               uint16_t interleaver_f2);
+
 #define MAX_RRU_CONFIG_SIZE 1024
 typedef enum {
   RAU_tick=0,
@@ -1553,6 +1620,10 @@ typedef struct RRU_config_s {
   uint8_t num_bands;
   /// EUTRA band list configured in RRU
   uint8_t band_list[MAX_BANDS_PER_RRU];
+  /// TDD configuration (0-6)
+  uint8_t tdd_config[MAX_BANDS_PER_RRU];
+  /// TDD special subframe configuration (0-10)
+  uint8_t tdd_config_S[MAX_BANDS_PER_RRU];
   /// TX frequency
   uint32_t tx_freq[MAX_BANDS_PER_RRU];
   /// RX frequency
diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..25ee6465482012c0c42a9457cb6dbac02b075dd3
--- /dev/null
+++ b/openair1/PHY/defs_L1_NB_IoT.h
@@ -0,0 +1,1031 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file PHY/defs.h
+ \brief Top-level defines and structure definitions
+ \author R. Knopp, F. Kaltenberger
+ \date 2011
+ \version 0.1
+ \company Eurecom
+ \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+ \note
+ \warning
+*/
+#ifndef __PHY_DEFS_NB_IOT__H__
+#define __PHY_DEFS_NB_IOT__H__
+
+#define _GNU_SOURCE 
+#include <stdio.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <string.h>
+#include <math.h>
+#include "common_lib.h"
+#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
+
+//#include <complex.h>
+#include "assertions.h"
+#ifdef MEX
+# define msg mexPrintf
+#else
+# ifdef OPENAIR2
+#   if ENABLE_RAL
+#     include "collection/hashtable/hashtable.h"
+#     include "COMMON/ral_messages_types.h"
+#     include "UTIL/queue.h"
+#   endif
+#   include "log.h"
+#   define msg(aRGS...) LOG_D(PHY, ##aRGS)
+# else
+#   define msg printf
+# endif
+#endif
+//use msg in the real-time thread context
+#define msg_nrt printf
+//use msg_nrt in the non real-time context (for initialization, ...)
+#ifndef malloc16
+#  ifdef __AVX2__
+#    define malloc16(x) memalign(32,x)
+#  else
+#    define malloc16(x) memalign(16,x)
+#  endif
+#endif
+#define free16(y,x) free(y)
+#define bigmalloc malloc
+#define bigmalloc16 malloc16
+#define openair_free(y,x) free((y))
+#define PAGE_SIZE 4096
+
+//#ifdef SHRLIBDEV
+//extern int rxrescale;
+//#define RX_IQRESCALELEN rxrescale
+//#else
+//#define RX_IQRESCALELEN 15
+//#endif
+
+//! \brief Allocate \c size bytes of memory on the heap with alignment 16 and zero it afterwards.
+//! If no more memory is available, this function will terminate the program with an assertion error.
+//******************************************************************************************************
+/*
+static inline void* malloc16_clear( size_t size )
+{
+#ifdef __AVX2__
+  void* ptr = memalign(32, size);
+#else
+  void* ptr = memalign(16, size);
+#endif
+  DevAssert(ptr);
+  memset( ptr, 0, size );
+  return ptr;
+}
+
+*/
+
+
+// #define PAGE_MASK 0xfffff000
+// #define virt_to_phys(x) (x)
+
+// #define openair_sched_exit() exit(-1)
+
+
+// #define max(a,b)  ((a)>(b) ? (a) : (b))
+// #define min(a,b)  ((a)<(b) ? (a) : (b))
+
+
+// #define bzero(s,n) (memset((s),0,(n)))
+
+// #define cmax(a,b)  ((a>b) ? (a) : (b))
+// #define cmin(a,b)  ((a<b) ? (a) : (b))
+
+// #define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
+
+// /// suppress compiler warning for unused arguments
+// #define UNUSED(x) (void)x;
+
+
+#include "PHY/impl_defs_top_NB_IoT.h"
+//#include "impl_defs_top.h"
+//#include "impl_defs_lte.h"
+#include "PHY/impl_defs_lte_NB_IoT.h"
+
+#include "PHY/TOOLS/time_meas.h"
+//#include "PHY/CODING/defs.h"
+#include "PHY/CODING/defs_NB_IoT.h"
+#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
+//#include "PHY/TOOLS/defs.h"
+//#include "platform_types.h"
+///#include "openair1/PHY/LTE_TRANSPORT/defs_nb_iot.h"
+
+////////////////////////////////////////////////////////////////////#ifdef OPENAIR_LTE    (check if this is required)
+
+//#include "PHY/LTE_TRANSPORT/defs.h"
+#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
+#include <pthread.h>
+
+#include "targets/ARCH/COMMON/common_lib.h"
+#include "targets/COMMON/openairinterface5g_limits.h"
+
+#define NUM_DCI_MAX_NB_IoT 32
+
+#define NUMBER_OF_eNB_SECTORS_MAX_NB_IoT 3
+
+#define NB_BANDS_MAX_NB_IoT 8
+
+
+#ifdef OCP_FRAMEWORK
+#include <enums.h>
+#else
+typedef enum {normal_txrx_NB_IoT=0,rx_calib_ue_NB_IoT=1,rx_calib_ue_med_NB_IoT=2,rx_calib_ue_byp_NB_IoT=3,debug_prach_NB_IoT=4,no_L2_connect_NB_IoT=5,calib_prach_tx_NB_IoT=6,rx_dump_frame_NB_IoT=7,loop_through_memory_NB_IoT=8} runmode_NB_IoT_t;
+#endif
+/*
+enum transmission_access_mode {
+  NO_ACCESS=0,
+  POSTPONED_ACCESS,
+  CANCELED_ACCESS,
+  UNKNOWN_ACCESS,
+  SCHEDULED_ACCESS,
+  CBA_ACCESS};
+
+typedef enum  {
+  eNodeB_3GPP=0,   // classical eNodeB function
+  eNodeB_3GPP_BBU, // eNodeB with NGFI IF5
+  NGFI_RCC_IF4p5,  // NGFI_RCC (NGFI radio cloud center)
+  NGFI_RAU_IF4p5,
+  NGFI_RRU_IF5,    // NGFI_RRU (NGFI remote radio-unit,IF5)
+  NGFI_RRU_IF4p5   // NGFI_RRU (NGFI remote radio-unit,IF4p5)
+} eNB_func_t;
+
+typedef enum {
+  synch_to_ext_device=0,  // synch to RF or Ethernet device
+  synch_to_other          // synch to another source (timer, other CC_id)
+} eNB_timing_t;
+#endif
+*/
+typedef struct UE_SCAN_INFO_NB_IoT_s {
+  /// 10 best amplitudes (linear) for each pss signals
+  int32_t             amp[3][10];
+  /// 10 frequency offsets (kHz) corresponding to best amplitudes, with respect do minimum DL frequency in the band
+  int32_t             freq_offset_Hz[3][10];
+
+} UE_SCAN_INFO_NB_IoT_t;
+
+/// Top-level PHY Data Structure for RN
+typedef struct {
+  /// Module ID indicator for this instance
+  uint8_t             Mod_id;
+  uint32_t            frame;
+  // phy_vars_eNB_NB_IoT
+  // phy_vars ue
+  // cuurently only used to store and forward the PMCH
+  uint8_t             mch_avtive[10];
+  uint8_t             sync_area[10]; // num SF
+  NB_IoT_UE_DLSCH_t   *dlsch_rn_MCH[10];
+
+} PHY_VARS_RN_NB_IoT;
+/*
+#ifdef OCP_FRAMEWORK
+#include <enums.h>
+#else
+//typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t;
+*/
+// enum transmission_access_mode {
+//   NO_ACCESS=0,
+//   POSTPONED_ACCESS,
+//   CANCELED_ACCESS,
+//   UNKNOWN_ACCESS,
+//   SCHEDULED_ACCESS,
+//   CBA_ACCESS};
+
+typedef enum  {
+  eNodeB_3GPP_NB_IoT=0,   // classical eNodeB function
+  eNodeB_3GPP_BBU_NB_IoT, // eNodeB with NGFI IF5
+  NGFI_RCC_IF4p5_NB_IoT,  // NGFI_RCC (NGFI radio cloud center)
+  NGFI_RAU_IF4p5_NB_IoT,
+  NGFI_RRU_IF5_NB_IoT,    // NGFI_RRU (NGFI remote radio-unit,IF5)
+  NGFI_RRU_IF4p5_NB_IoT   // NGFI_RRU (NGFI remote radio-unit,IF4p5)
+} eNB_func_NB_IoT_t;
+
+typedef enum {
+
+  synch_to_ext_device_NB_IoT=0,  // synch to RF or Ethernet device
+  synch_to_other_NB_IoT          // synch to another source (timer, other CC_id)
+
+} eNB_timing_NB_IoT_t;
+////////////////////////////////////////////////////////////////////#endif
+
+
+typedef struct {
+
+  struct                        PHY_VARS_eNB_NB_IoT_s       *eNB;
+  NB_IoT_eNB_NDLSCH_t           *dlsch;
+  int                           G;
+
+} te_params_NB_IoT;
+
+
+typedef struct {
+
+  struct                        PHY_VARS_eNB_NB_IoT_s       *eNB;
+  int                           UE_id;
+  int                           harq_pid;
+  int                           llr8_flag;
+  int                           ret;
+
+} td_params_NB_IoT;
+
+
+/// Context data structure for RX/TX portion of subframe processing
+typedef struct {
+  /// timestamp transmitted to HW
+  openair0_timestamp    timestamp_tx;
+  /// subframe to act upon for transmission
+  int                   subframe_tx;
+  /// subframe to act upon for reception
+  int                   subframe_rx;
+  /// frame to act upon for transmission
+  int                   frame_tx;
+  /// frame to act upon for reception
+  int                   frame_rx;
+  /// \brief Instance count for RXn-TXnp4 processing thread.
+  /// \internal This variable is protected by \ref mutex_rxtx.
+  int                   instance_cnt_rxtx;
+  /// pthread structure for RXn-TXnp4 processing thread
+  pthread_t             pthread_rxtx;
+  /// pthread attributes for RXn-TXnp4 processing thread
+  pthread_attr_t        attr_rxtx;
+  /// condition variable for tx processing thread
+  pthread_cond_t        cond_rxtx;
+  /// mutex for RXn-TXnp4 processing thread
+  pthread_mutex_t       mutex_rxtx;
+  /// scheduling parameters for RXn-TXnp4 thread
+  struct                sched_param sched_param_rxtx;
+  /// NB-IoT for IF_Module
+  pthread_t             pthread_l2;
+  pthread_cond_t        cond_l2;
+  pthread_mutex_t       mutex_l2;
+  int                   instance_cnt_l2;
+  pthread_attr_t        attr_l2;
+
+} eNB_rxtx_proc_NB_IoT_t;
+/*
+typedef struct {
+  struct PHY_VARS_eNB_NB_IoT_s *eNB;
+  int UE_id;
+  int harq_pid;
+  int llr8_flag;
+  int ret;
+} td_params;
+
+typedef struct {
+  struct PHY_VARS_eNB_NB_IoT_s *eNB;
+  LTE_eNB_DLSCH_t *dlsch;
+  int G;
+} te_params;
+*/
+
+/// Context data structure for eNB subframe processing
+typedef struct eNB_proc_NB_IoT_t_s {
+  /// thread index
+  int                     thread_index;
+  /// timestamp received from HW
+  openair0_timestamp      timestamp_rx;
+  /// timestamp to send to "slave rru"
+  openair0_timestamp      timestamp_tx;
+  /// subframe to act upon for reception
+  int                     subframe_rx;
+  /// symbol mask for IF4p5 reception per subframe
+  uint32_t                symbol_mask[10];
+  /// subframe to act upon for PRACH
+  int                     subframe_prach;
+  /// frame to act upon for reception
+  int                     frame_rx;
+  /// frame to act upon for transmission
+  int                     frame_tx;
+  /// frame offset for secondary eNBs (to correct for frame asynchronism at startup)
+  int                     frame_offset;
+  /// frame to act upon for PRACH
+  int                     frame_prach;
+  /// \internal This variable is protected by \ref mutex_fep.
+  int                     instance_cnt_fep;
+  /// \internal This variable is protected by \ref mutex_td.
+  int                     instance_cnt_td;
+  /// \internal This variable is protected by \ref mutex_te.
+  int                     instance_cnt_te;
+  /// \brief Instance count for FH processing thread.
+  /// \internal This variable is protected by \ref mutex_FH.
+  int                     instance_cnt_FH;
+  /// \brief Instance count for rx processing thread.
+  /// \internal This variable is protected by \ref mutex_prach.
+  int                     instance_cnt_prach;
+  // instance count for over-the-air eNB synchronization
+  int                     instance_cnt_synch;
+  /// \internal This variable is protected by \ref mutex_asynch_rxtx.
+  int                     instance_cnt_asynch_rxtx;
+  /// pthread structure for FH processing thread
+  pthread_t               pthread_FH;
+  /// pthread structure for eNB single processing thread
+  pthread_t               pthread_single;
+  /// pthread structure for asychronous RX/TX processing thread
+  pthread_t               pthread_asynch_rxtx;
+  /// flag to indicate first RX acquisition
+  int                     first_rx;
+  /// flag to indicate first TX transmission
+  int                     first_tx;
+  /// pthread attributes for parallel fep thread
+  pthread_attr_t          attr_fep;
+  /// pthread attributes for parallel turbo-decoder thread
+  pthread_attr_t          attr_td;
+  /// pthread attributes for parallel turbo-encoder thread
+  pthread_attr_t          attr_te;
+  /// pthread attributes for FH processing thread
+  pthread_attr_t          attr_FH;
+  /// pthread attributes for single eNB processing thread
+  pthread_attr_t          attr_single;
+  /// pthread attributes for prach processing thread
+  pthread_attr_t          attr_prach;
+  /// pthread attributes for over-the-air synch thread
+  pthread_attr_t          attr_synch;
+  /// pthread attributes for asynchronous RX thread
+  pthread_attr_t          attr_asynch_rxtx;
+  /// scheduling parameters for parallel fep thread
+  struct                  sched_param sched_param_fep;
+  /// scheduling parameters for parallel turbo-decoder thread
+  struct                  sched_param sched_param_td;
+  /// scheduling parameters for parallel turbo-encoder thread
+  struct                  sched_param sched_param_te;
+  /// scheduling parameters for FH thread
+  struct                  sched_param sched_param_FH;
+  /// scheduling parameters for single eNB thread
+  struct                  sched_param sched_param_single;
+  /// scheduling parameters for prach thread
+  struct                  sched_param sched_param_prach;
+  /// scheduling parameters for over-the-air synchronization thread
+  struct                  sched_param sched_param_synch;
+  /// scheduling parameters for asynch_rxtx thread
+  struct                  sched_param sched_param_asynch_rxtx;
+  /// pthread structure for parallel fep thread
+  pthread_t               pthread_fep;
+  /// pthread structure for parallel turbo-decoder thread
+  pthread_t               pthread_td;
+  /// pthread structure for parallel turbo-encoder thread
+  pthread_t               pthread_te;
+  /// pthread structure for PRACH thread
+  pthread_t               pthread_prach;
+  /// pthread structure for eNB synch thread
+  pthread_t               pthread_synch;
+  /// condition variable for parallel fep thread
+  pthread_cond_t          cond_fep;
+  /// condition variable for parallel turbo-decoder thread
+  pthread_cond_t          cond_td;
+  /// condition variable for parallel turbo-encoder thread
+  pthread_cond_t          cond_te;
+  /// condition variable for FH thread
+  pthread_cond_t          cond_FH;
+  /// condition variable for PRACH processing thread;
+  pthread_cond_t          cond_prach;
+  // condition variable for over-the-air eNB synchronization
+  pthread_cond_t          cond_synch;
+  /// condition variable for asynch RX/TX thread
+  pthread_cond_t          cond_asynch_rxtx;
+  /// mutex for RU access to  processing (NPDSCH/PUSCH)
+  pthread_mutex_t mutex_RU;
+  /// mutex for parallel fep thread
+  pthread_mutex_t         mutex_fep;
+  /// mutex for parallel turbo-decoder thread
+  pthread_mutex_t         mutex_td;
+  /// mutex for parallel turbo-encoder thread
+  pthread_mutex_t         mutex_te;
+  /// mutex for FH
+  pthread_mutex_t         mutex_FH;
+  /// mutex for PRACH thread
+  pthread_mutex_t         mutex_prach;
+  // mutex for over-the-air eNB synchronization
+  pthread_mutex_t         mutex_synch;
+  /// mutex for RU access to NB-IoT processing (NPRACH)
+  pthread_mutex_t mutex_RU_PRACH;
+  /// mutex for asynch RX/TX thread
+  pthread_mutex_t         mutex_asynch_rxtx;
+  /// mask for RUs serving nbiot  (NPDSCH/NPUSCH)
+  int RU_mask;
+  /// mask for RUs serving nbiot (PRACH)
+  int RU_mask_prach;
+#ifdef Rel14
+  /// mask for RUs serving eNB (PRACH)
+  int RU_mask_prach_br;
+#endif
+  /// parameters for turbo-decoding worker thread
+  td_params_NB_IoT        tdp;
+  /// parameters for turbo-encoding worker thread
+  te_params_NB_IoT        tep;
+  /// number of slave threads
+  int                     num_slaves;
+  /// array of pointers to slaves
+  struct                  eNB_proc_NB_IoT_t_s           **slave_proc;
+  /// set of scheduling variables RXn-TXnp4 threads
+  // newly added for NB_IoT
+  eNB_rxtx_proc_NB_IoT_t  proc_rxtx[2];
+
+} eNB_proc_NB_IoT_t;
+
+
+/// Context data structure for RX/TX portion of subframe processing
+typedef struct {
+  /// index of the current UE RX/TX proc
+  int                   proc_id;
+  /// timestamp transmitted to HW
+  openair0_timestamp    timestamp_tx;
+  /// subframe to act upon for transmission
+  int                   subframe_tx;
+  /// subframe to act upon for reception
+  int                   subframe_rx;
+  /// frame to act upon for transmission
+  int                   frame_tx;
+  /// frame to act upon for reception
+  int                   frame_rx;
+  /// \brief Instance count for RXn-TXnp4 processing thread.
+  /// \internal This variable is protected by \ref mutex_rxtx.
+  int                   instance_cnt_rxtx;
+  /// pthread structure for RXn-TXnp4 processing thread
+  pthread_t             pthread_rxtx;
+  /// pthread attributes for RXn-TXnp4 processing thread
+  pthread_attr_t        attr_rxtx;
+  /// condition variable for tx processing thread
+  pthread_cond_t        cond_rxtx;
+  /// mutex for RXn-TXnp4 processing thread
+  pthread_mutex_t       mutex_rxtx;
+  /// scheduling parameters for RXn-TXnp4 thread
+  struct                sched_param sched_param_rxtx;
+  /// 
+  int                   sub_frame_start;
+  ///
+  int                   sub_frame_step;
+  ///
+  unsigned long long    gotIQs;
+
+} UE_rxtx_proc_NB_IoT_t;
+
+/// Context data structure for eNB subframe processing
+typedef struct {
+  /// Last RX timestamp
+  openair0_timestamp      timestamp_rx;
+  /// pthread attributes for main UE thread
+  pthread_attr_t          attr_ue;
+  /// scheduling parameters for main UE thread
+  struct                  sched_param sched_param_ue;
+  /// pthread descriptor main UE thread
+  pthread_t               pthread_ue;
+  /// \brief Instance count for synch thread.
+  /// \internal This variable is protected by \ref mutex_synch.
+  int                     instance_cnt_synch;
+  /// pthread attributes for synch processing thread
+  pthread_attr_t          attr_synch;
+  /// scheduling parameters for synch thread
+  struct                  sched_param sched_param_synch;
+  /// pthread descriptor synch thread
+  pthread_t               pthread_synch;
+  /// condition variable for UE synch thread;
+  pthread_cond_t          cond_synch;
+  /// mutex for UE synch thread
+  pthread_mutex_t         mutex_synch;
+  /// set of scheduling variables RXn-TXnp4 threads
+  UE_rxtx_proc_NB_IoT_t   proc_rxtx[2];
+
+} UE_proc_NB_IoT_t;
+
+
+
+/// Top-level PHY Data Structure for eNB
+typedef struct PHY_VARS_eNB_NB_IoT_s {
+  /// Module ID indicator for this instance
+  module_id_t                   Mod_id;
+  uint8_t                       configured;
+  eNB_proc_NB_IoT_t             proc;
+  int                           num_RU;
+  RU_t                          *RU_list[MAX_NUM_RU_PER_eNB];
+  /// Ethernet parameters for northbound midhaul interface (L1 to Mac)
+  eth_params_t         eth_params_n;
+  /// Ethernet parameters for fronthaul interface (upper L1 to Radio head)
+  eth_params_t         eth_params;
+  int                           single_thread_flag;
+  openair0_rf_map               rf_map;
+  int                           abstraction_flag;
+  openair0_timestamp            ts_offset;
+  // indicator for synchronization state of eNB
+  int                           in_synch;
+  // indicator for master/slave (RRU)
+  int                           is_slave;
+  // indicator for precoding function (eNB,3GPP_eNB_BBU)
+  int                           do_precoding;
+  IF_Module_NB_IoT_t            *if_inst_NB_IoT;
+  UL_IND_NB_IoT_t               UL_INFO_NB_IoT;
+  pthread_mutex_t               UL_INFO_mutex;
+  void                          (*do_prach)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int frame,int subframe);
+  void                          (*fep)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc);
+  int                           (*td)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int UE_id,int harq_pid,int llr8_flag);
+  int                           (*te)(struct PHY_VARS_eNB_NB_IoT_s *,uint8_t *,uint8_t,NB_IoT_eNB_DLSCH_t *,int,uint8_t,time_stats_t *,time_stats_t *,time_stats_t *);
+  void                          (*proc_uespec_rx)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc,const relaying_type_t_NB_IoT r_type);
+  void                          (*proc_tx)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc,relaying_type_t_NB_IoT r_type,PHY_VARS_RN_NB_IoT *rn);
+  void                          (*tx_fh)(struct PHY_VARS_eNB_NB_IoT_s *eNB,eNB_rxtx_proc_NB_IoT_t *proc);
+  void                          (*rx_fh)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int *frame, int *subframe);
+  int                           (*start_rf)(struct PHY_VARS_eNB_NB_IoT_s *eNB);
+  int                           (*start_if)(struct PHY_VARS_eNB_NB_IoT_s *eNB);
+  void                          (*fh_asynch)(struct PHY_VARS_eNB_NB_IoT_s *eNB,int *frame, int *subframe);
+  uint8_t                       local_flag;
+  uint32_t                      rx_total_gain_dB;
+  NB_IoT_DL_FRAME_PARMS         frame_parms;
+  PHY_MEASUREMENTS_eNB_NB_IoT   measurements[NUMBER_OF_eNB_SECTORS_MAX_NB_IoT]; /// Measurement variables
+  NB_IoT_eNB_COMMON             common_vars;
+  NB_IoT_eNB_SRS                srs_vars[NUMBER_OF_UE_MAX_NB_IoT];
+  NB_IoT_eNB_PBCH               pbch;
+  NB_IoT_eNB_PUSCH              *pusch_vars[NUMBER_OF_UE_MAX_NB_IoT];
+  NB_IoT_eNB_PRACH              prach_vars;
+  //LTE_eNB_DLSCH_t             *dlsch[NUMBER_OF_UE_MAX_NB_IoT][2];             // Nusers times two spatial streams
+  NB_IoT_eNB_NULSCH_t            *ulsch[NUMBER_OF_UE_MAX_NB_IoT+1];              // Nusers + number of RA (the ulsch[0] contains RAR)
+  //LTE_eNB_DLSCH_t             *dlsch_SI,*dlsch_ra;
+  //LTE_eNB_DLSCH_t             *dlsch_MCH;
+  NB_IoT_eNB_UE_stats           UE_stats[NUMBER_OF_UE_MAX_NB_IoT];
+  //LTE_eNB_UE_stats            *UE_stats_ptr[NUMBER_OF_UE_MAX_NB_IoT];
+  /// cell-specific reference symbols
+  uint32_t                      lte_gold_table_NB_IoT[20][2][14];
+  /// UE-specific reference symbols (p=5), TM 7
+  uint32_t                      lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX_NB_IoT][20][38];
+  /// UE-specific reference symbols (p=7...14), TM 8/9/10
+  uint32_t                      lte_gold_uespec_table[2][20][2][21];
+  /// mbsfn reference symbols
+  uint32_t                      lte_gold_mbsfn_table[10][3][42];
+  ///
+  uint32_t                      X_u[64][839];
+  ///
+  uint8_t                       pbch_pdu[4];                                      //PBCH_PDU_SIZE
+  ///
+  char                          eNB_generate_rar;
+  /// Indicator set to 0 after first SR
+  uint8_t                       first_sr[NUMBER_OF_UE_MAX_NB_IoT];
+
+  uint32_t                      max_peak_val;
+  ///
+  int                           max_eNB_id, max_sync_pos;
+  ///
+  int                           N_TA_offset;                        ///timing offset used in TDD
+  /// \brief sinr for all subcarriers of the current link (used only for abstraction).
+  /// first index: ? [0..N_RB_DL*12[
+  double                        *sinr_dB;
+  /// N0 (used for abstraction)
+  double                        N0;
+  ///
+  unsigned char                 first_run_timing_advance[NUMBER_OF_UE_MAX_NB_IoT];
+  unsigned char                 first_run_I0_measurements;
+
+  unsigned char                 cooperation_flag;                   // for cooperative communication
+
+  unsigned char                 is_secondary_eNB;                   // primary by default
+  unsigned char                 is_init_sync;                       /// Flag to tell if initial synchronization is performed. This affects how often the secondary eNB will listen to the PSS from the primary system.
+  unsigned char                 has_valid_precoder;                 /// Flag to tell if secondary eNB has channel estimates to create NULL-beams from, and this B/F vector is created.
+  unsigned char                 PeNB_id;                            /// id of Primary eNB
+  int                           rx_offset;                          /// Timing offset (used if is_secondary_eNB)
+
+  /// hold the precoder for NULL beam to the primary user
+  int                           **dl_precoder_SeNB[3];
+  ///
+  char                          log2_maxp;                          /// holds the maximum channel/precoder coefficient
+  /// if ==0 enables phy only test mode
+  int                           mac_enabled;
+  /// For emulation only (used by UE abstraction to retrieve DCI)
+  uint8_t                       num_common_dci[2];                  // num_dci in even/odd subframes
+  ///
+  uint8_t                       num_ue_spec_dci[2];                 // num_dci in even/odd subframes
+  ///
+  DCI_ALLOC_NB_IoT_t            dci_alloc[2][NUM_DCI_MAX_NB_IoT];   // dci_alloc from even/odd subframes
+  /////////////
+  // PDSCH Variables
+  PDSCH_CONFIG_DEDICATED_NB_IoT             pdsch_config_dedicated[NUMBER_OF_UE_MAX_NB_IoT];
+  // PUSCH Variables
+  PUSCH_CONFIG_DEDICATED_NB_IoT             pusch_config_dedicated[NUMBER_OF_UE_MAX_NB_IoT];
+  // PUCCH variables
+  PUCCH_CONFIG_DEDICATED_NB_IoT             pucch_config_dedicated[NUMBER_OF_UE_MAX_NB_IoT];
+  // UL-POWER-Control
+  UL_POWER_CONTROL_DEDICATED_NB_IoT         ul_power_control_dedicated[NUMBER_OF_UE_MAX_NB_IoT];
+  // TPC
+  TPC_PDCCH_CONFIG_NB_IoT                   tpc_pdcch_config_pucch[NUMBER_OF_UE_MAX_NB_IoT];
+  ///
+  TPC_PDCCH_CONFIG_NB_IoT                   tpc_pdcch_config_pusch[NUMBER_OF_UE_MAX_NB_IoT];
+  // CQI reporting
+  CQI_REPORT_CONFIG_NB_IoT                  cqi_report_config[NUMBER_OF_UE_MAX_NB_IoT];
+  // SRS Variables
+  SOUNDINGRS_UL_CONFIG_DEDICATED_NB_IoT     soundingrs_ul_config_dedicated[NUMBER_OF_UE_MAX_NB_IoT];
+  ///
+  uint8_t                                   ncs_cell[20][7];
+  // Scheduling Request Config
+  SCHEDULING_REQUEST_CONFIG_NB_IoT          scheduling_request_config[NUMBER_OF_UE_MAX_NB_IoT];
+  // Transmission mode per UE
+  uint8_t                                   transmission_mode[NUMBER_OF_UE_MAX_NB_IoT];
+  /// cba_last successful reception for each group, used for collision detection
+  uint8_t                                   cba_last_reception[4];
+  // Pointers for active physicalConfigDedicated to be applied in current subframe
+  struct                                    PhysicalConfigDedicated                         *physicalConfigDedicated[NUMBER_OF_UE_MAX_NB_IoT];
+  //Pointers for actve physicalConfigDedicated for NB-IoT to be applied in current subframe
+  struct                                    PhysicalConfigDedicated_NB_r13                  *phy_config_dedicated_NB_IoT[NUMBER_OF_UE_MAX_NB_IoT];
+  ///
+  uint32_t                                  rb_mask_ul[4];
+  /// Information regarding TM5
+  MU_MIMO_mode_NB_IoT                       mu_mimo_mode[NUMBER_OF_UE_MAX_NB_IoT];
+  /// target_ue_dl_mcs : only for debug purposes
+  uint32_t                                  target_ue_dl_mcs;
+  /// target_ue_ul_mcs : only for debug purposes
+  uint32_t                                  target_ue_ul_mcs;
+  /// target_ue_dl_rballoc : only for debug purposes
+  uint32_t                                  ue_dl_rb_alloc;
+  /// target ul PRBs : only for debug
+  uint32_t                                  ue_ul_nb_rb;
+  ///check for Total Transmissions
+  uint32_t                                  check_for_total_transmissions;
+  ///check for MU-MIMO Transmissions
+  uint32_t                                  check_for_MUMIMO_transmissions;
+  ///check for SU-MIMO Transmissions
+  uint32_t                                  check_for_SUMIMO_transmissions;
+  ///check for FULL MU-MIMO Transmissions
+  uint32_t                                  FULL_MUMIMO_transmissions;
+  /// Counter for total bitrate, bits and throughput in downlink
+  uint32_t                                  total_dlsch_bitrate;
+  ///
+  uint32_t                                  total_transmitted_bits;
+  ///
+  uint32_t                                  total_system_throughput;
+  ///
+  int                                       hw_timing_advance;
+  ///
+  time_stats_t                       phy_proc;
+  time_stats_t                       phy_proc_tx;
+  time_stats_t                       phy_proc_rx;
+  time_stats_t                       rx_prach;
+
+  time_stats_t                       ofdm_mod_stats;
+  time_stats_t                       dlsch_encoding_stats;
+  time_stats_t                       dlsch_modulation_stats;
+  time_stats_t                       dlsch_scrambling_stats;
+  time_stats_t                       dlsch_rate_matching_stats;
+  time_stats_t                       dlsch_turbo_encoding_stats;
+  time_stats_t                       dlsch_interleaving_stats;
+
+  time_stats_t                       ofdm_demod_stats;
+  time_stats_t                       rx_dft_stats;
+  time_stats_t                       ulsch_channel_estimation_stats;
+  time_stats_t                       ulsch_freq_offset_estimation_stats;
+  time_stats_t                       ulsch_decoding_stats;
+  time_stats_t                       ulsch_demodulation_stats;
+  time_stats_t                       ulsch_rate_unmatching_stats;
+  time_stats_t                       ulsch_turbo_decoding_stats;
+  time_stats_t                       ulsch_deinterleaving_stats;
+  time_stats_t                       ulsch_demultiplexing_stats;
+  time_stats_t                       ulsch_llr_stats;
+  time_stats_t                       ulsch_tc_init_stats;
+  time_stats_t                       ulsch_tc_alpha_stats;
+  time_stats_t                       ulsch_tc_beta_stats;
+  time_stats_t                       ulsch_tc_gamma_stats;
+  time_stats_t                       ulsch_tc_ext_stats;
+  time_stats_t                       ulsch_tc_intl1_stats;
+  time_stats_t                       ulsch_tc_intl2_stats;
+
+  #ifdef LOCALIZATION
+  /// time state for localization
+  time_stats_t                       localization_stats;
+  #endif
+
+  int32_t                                   pucch1_stats_cnt[NUMBER_OF_UE_MAX_NB_IoT][10];
+  int32_t                                   pucch1_stats[NUMBER_OF_UE_MAX_NB_IoT][10*1024];
+  int32_t                                   pucch1_stats_thres[NUMBER_OF_UE_MAX_NB_IoT][10*1024];
+  int32_t                                   pucch1ab_stats_cnt[NUMBER_OF_UE_MAX_NB_IoT][10];
+  int32_t                                   pucch1ab_stats[NUMBER_OF_UE_MAX_NB_IoT][2*10*1024];
+  int32_t                                   pusch_stats_rb[NUMBER_OF_UE_MAX_NB_IoT][10240];
+  int32_t                                   pusch_stats_round[NUMBER_OF_UE_MAX_NB_IoT][10240];
+  int32_t                                   pusch_stats_mcs[NUMBER_OF_UE_MAX_NB_IoT][10240];
+  int32_t                                   pusch_stats_bsr[NUMBER_OF_UE_MAX_NB_IoT][10240];
+  int32_t                                   pusch_stats_BO[NUMBER_OF_UE_MAX_NB_IoT][10240];
+
+  /// RF and Interface devices per CC
+  openair0_device                           rfdevice;
+  openair0_device                           ifdevice;
+  /// Pointer for ifdevice buffer struct
+  if_buffer_t                               ifbuffer;
+
+  //------------------------
+  // NB-IoT
+  //------------------------
+
+  /*
+   * NUMBER_OF_UE_MAX_NB_IoT maybe in the future should be dynamic because could be very large and the memory may explode
+   * (is almost the indication of the number of UE context that we are storing at PHY layer)
+   *
+   * reasoning: the following data structure (ndlsch, nulsch ecc..) are used to store the context that should be transmitted in at least n+4 subframe later
+   * (the minimum interval between NPUSCH and the ACK for this)
+   * the problem is that in NB_IoT the ACK for the UPLINK is contained in the DCI through the NDI field (if this value change from the previous one then it means ACK)
+   * but may we could schedule this DCI long time later so may lots of contents shuld be stored (there is no concept of phich channel in NB-IoT)
+   * For the DL transmission the UE send a proper ACK/NACK message
+   *
+   * *the HARQ process should be killed when the NDI change
+   *
+   * *In the Structure for nulsch we should also store the information related to the subframe (because each time we should read it and understand what should be done
+   * in that subframe)
+   *
+   */
+
+
+  /*
+   * TIMING
+   * the entire transmission and scheduling are done for the "subframe" concept but the subframe = proc->subframe_tx (that in reality is the subframe_rx +4)
+   * (see USER/lte-enb/wakeup_rxtx )
+   *
+   * Related to FAPI:
+   * DCI and  DL_CONFIG.request (also more that 1) and MAC_PDU are transmitted in the same subframe (our assumption) so will be all contained in the schedule_response getting from the scheduler
+   * DCI0 and UL_CONFIG.request are transmitted in the same subframe (our assumption) so contained in the schedule_response
+   *
+   */
+
+  //TODO: check what should be NUMBER_OF_UE_MAX_NB_IoT value
+  NB_IoT_eNB_NPBCH_t        *npbch;
+  NB_IoT_eNB_NPDCCH_t       *npdcch[NUMBER_OF_UE_MAX_NB_IoT];
+  NB_IoT_eNB_NDLSCH_t       *ndlsch[NUMBER_OF_UE_MAX_NB_IoT][2];
+  NB_IoT_eNB_NULSCH_t       *nulsch[NUMBER_OF_UE_MAX_NB_IoT+1]; //nulsch[0] contains the RAR
+  NB_IoT_eNB_NDLSCH_t       *ndlsch_SI,*ndlsch_ra, *ndlsch_SIB1;
+
+  NB_IoT_DL_FRAME_PARMS     frame_parms_NB_IoT;
+  // DCI for at most 2 DCI pdus
+  DCI_PDU_NB_IoT            *DCI_pdu;
+
+
+
+} PHY_VARS_eNB_NB_IoT;
+
+//#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
+
+/// Top-level PHY Data Structure for UE
+typedef struct {
+  /// \brief Module ID indicator for this instance
+  uint8_t                       Mod_id;
+  /// \brief Mapping of CC_id antennas to cards
+  openair0_rf_map               rf_map;
+  //uint8_t local_flag;
+  /// \brief Indicator of current run mode of UE (normal_txrx, rx_calib_ue, no_L2_connect, debug_prach)
+  runmode_NB_IoT_t              mode;
+  /// \brief Indicator that UE should perform band scanning
+  int                           UE_scan;
+  /// \brief Indicator that UE should perform coarse scanning around carrier
+  int                           UE_scan_carrier;
+  /// \brief Indicator that UE is synchronized to an eNB
+  int                           is_synchronized;
+  /// Data structure for UE process scheduling
+  UE_proc_NB_IoT_t              proc;
+  /// Flag to indicate the UE shouldn't do timing correction at all
+  int                           no_timing_correction;
+  /// \brief Total gain of the TX chain (16-bit baseband I/Q to antenna)
+  uint32_t                      tx_total_gain_dB;
+  /// \brief Total gain of the RX chain (antenna to baseband I/Q) This is a function of rx_gain_mode (and the corresponding gain) and the rx_gain of the card.
+  uint32_t                      rx_total_gain_dB;
+  /// \brief Total gains with maximum RF gain stage (ExpressMIMO2/Lime)
+  uint32_t                      rx_gain_max[4];
+  /// \brief Total gains with medium RF gain stage (ExpressMIMO2/Lime)
+  uint32_t                      rx_gain_med[4];
+  /// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime)
+  uint32_t                      rx_gain_byp[4];
+  /// \brief Current transmit power
+  int16_t                       tx_power_dBm[10];
+  /// \brief Total number of REs in current transmission
+  int                           tx_total_RE[10];
+  /// \brief Maximum transmit power
+  int8_t                        tx_power_max_dBm;
+  /// \brief Number of eNB seen by UE
+  uint8_t                       n_connected_eNB;
+  /// \brief indicator that Handover procedure has been initiated
+  uint8_t                       ho_initiated;
+  /// \brief indicator that Handover procedure has been triggered
+  uint8_t                       ho_triggered;
+  /// \brief Measurement variables.
+  PHY_MEASUREMENTS_NB_IoT       measurements;
+  NB_IoT_DL_FRAME_PARMS         frame_parms;
+  /// \brief Frame parame before ho used to recover if ho fails.
+  NB_IoT_DL_FRAME_PARMS         frame_parms_before_ho;
+  NB_IoT_UE_COMMON              common_vars;
+
+  NB_IoT_UE_PDSCH     *pdsch_vars[2][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads
+  NB_IoT_UE_DLSCH_t   *dlsch[2][NUMBER_OF_CONNECTED_eNB_MAX][2]; // two RxTx Threads
+  //Paging parameters
+  uint32_t                        IMSImod1024;
+  uint32_t                        PF;
+  uint32_t                        PO;
+  // For abstraction-purposes only
+  uint8_t                         sr[10];
+  uint8_t                         pucch_sel[10];
+  uint8_t                         pucch_payload[22];
+  //UE_MODE_t                     UE_mode[NUMBER_OF_CONNECTED_eNB_MAX];
+  //cell-specific reference symbols
+  uint32_t                        lte_gold_table[7][20][2][14];
+  //UE-specific reference symbols (p=5), TM 7
+  uint32_t                        lte_gold_uespec_port5_table[20][38];
+  //ue-specific reference symbols
+  uint32_t                        lte_gold_uespec_table[2][20][2][21];
+  //mbsfn reference symbols
+  uint32_t                        lte_gold_mbsfn_table[10][3][42];
+  ///
+  uint32_t                        X_u[64][839];
+  /// 
+  uint32_t                        high_speed_flag;
+  uint32_t                        perfect_ce;
+  int16_t                         ch_est_alpha;
+  int                             generate_ul_signal[NUMBER_OF_CONNECTED_eNB_MAX];
+  ///
+  UE_SCAN_INFO_NB_IoT_t           scan_info[NB_BANDS_MAX_NB_IoT];
+  ///
+  char                            ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_eNB_MAX];
+
+/*
+
+  unsigned char ulsch_Msg3_active[NUMBER_OF_CONNECTED_eNB_MAX];
+  uint32_t  ulsch_Msg3_frame[NUMBER_OF_CONNECTED_eNB_MAX];
+  unsigned char ulsch_Msg3_subframe[NUMBER_OF_CONNECTED_eNB_MAX];
+  PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_eNB_MAX];
+  int turbo_iterations, turbo_cntl_iterations;
+  /// \brief ?.
+  /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
+  uint32_t total_TBS[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// \brief ?.
+  /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
+  uint32_t total_TBS_last[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// \brief ?.
+  /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
+  uint32_t bitrate[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// \brief ?.
+  /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
+  uint32_t total_received_bits[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_errors[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_errors_last[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_received[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_received_last[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_fer[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_SI_received[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_SI_errors[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_ra_received[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_ra_errors[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_p_received[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_p_errors[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_mch_received_sf[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_mch_received[NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_mcch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_mtch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_mcch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_mtch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_mcch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
+  int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
+  int current_dlsch_cqi[NUMBER_OF_CONNECTED_eNB_MAX];
+  unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_eNB_MAX];
+  uint8_t               generate_prach;
+  uint8_t               prach_cnt;
+  uint8_t               prach_PreambleIndex;
+  //  uint8_t               prach_timer;
+  uint8_t               decode_SIB;
+  uint8_t               decode_MIB;
+  int              rx_offset; /// Timing offset
+  int              rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP
+  int              timing_advance; ///timing advance signalled from eNB
+  int              hw_timing_advance;
+  int              N_TA_offset; ///timing offset used in TDD
+  /// Flag to tell if UE is secondary user (cognitive mode)
+  unsigned char    is_secondary_ue;
+  /// Flag to tell if secondary eNB has channel estimates to create NULL-beams from.
+  unsigned char    has_valid_precoder;
+  /// hold the precoder for NULL beam to the primary eNB
+  int              **ul_precoder_S_UE;
+  /// holds the maximum channel/precoder coefficient
+  char             log2_maxp;
+*/
+  /// if ==0 enables phy only test mode
+  int              mac_enabled;
+  /// Flag to initialize averaging of PHY measurements
+  int              init_averaging;
+  /// \brief sinr for all subcarriers of the current link (used only for abstraction).
+  /// - first index: ? [0..12*N_RB_DL[
+  double           *sinr_dB;
+  /// \brief sinr for all subcarriers of first symbol for the CQI Calculation.
+  /// - first index: ? [0..12*N_RB_DL[
+  double           *sinr_CQI_dB;
+  /// sinr_effective used for CQI calulcation
+  double           sinr_eff;
+  /// N0 (used for abstraction)
+  double           N0;
+/*
+  /// PDSCH Varaibles
+  PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// PUSCH Varaibles
+  PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// PUSCH contention-based access vars
+  PUSCH_CA_CONFIG_DEDICATED  pusch_ca_config_dedicated[NUMBER_OF_eNB_MAX]; // lola
+
+  /// PUCCH variables
+
+  PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  uint8_t ncs_cell[20][7];
+
+  /// UL-POWER-Control
+  UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// TPC
+  TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_CONNECTED_eNB_MAX];
+  TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// CQI reporting
+  CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// SRS Variables
+  SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// Scheduling Request Config
+  SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// Transmission mode per eNB
+  uint8_t transmission_mode[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  time_stats_t phy_proc;
+  time_stats_t phy_proc_tx;
+  time_stats_t phy_proc_rx[2];
+
+  uint32_t use_ia_receiver;
+
+  time_stats_t ofdm_mod_stats;
+  time_stats_t ulsch_encoding_stats;
+  time_stats_t ulsch_modulation_stats;
+  time_stats_t ulsch_segmentation_stats;
+  time_stats_t ulsch_rate_matching_stats;
+  time_stats_t ulsch_turbo_encoding_stats;
+  time_stats_t ulsch_interleaving_stats;
+  time_stats_t ulsch_multiplexing_stats;
+
+  time_stats_t generic_stat;
+  time_stats_t pdsch_procedures_stat;
+  time_stats_t dlsch_procedures_stat;
+
+  time_stats_t ofdm_demod_stats;
+  time_stats_t dlsch_rx_pdcch_stats;
+  time_stats_t rx_dft_stats;
+  time_stats_t dlsch_channel_estimation_stats;
+  time_stats_t dlsch_freq_offset_estimation_stats;
+  time_stats_t dlsch_decoding_stats[2];
+  time_stats_t dlsch_demodulation_stats;
+  time_stats_t dlsch_rate_unmatching_stats;
+  time_stats_t dlsch_turbo_decoding_stats;
+  time_stats_t dlsch_deinterleaving_stats;
+  time_stats_t dlsch_llr_stats;
+  time_stats_t dlsch_unscrambling_stats;
+  time_stats_t dlsch_rate_matching_stats;
+  time_stats_t dlsch_turbo_encoding_stats;
+  time_stats_t dlsch_interleaving_stats;
+  time_stats_t dlsch_tc_init_stats;
+  time_stats_t dlsch_tc_alpha_stats;
+  time_stats_t dlsch_tc_beta_stats;
+  time_stats_t dlsch_tc_gamma_stats;
+  time_stats_t dlsch_tc_ext_stats;
+  time_stats_t dlsch_tc_intl1_stats;
+  time_stats_t dlsch_tc_intl2_stats;
+  time_stats_t tx_prach;
+
+  /// RF and Interface devices per CC
+  openair0_device rfdevice;
+  time_stats_t dlsch_encoding_SIC_stats;
+  time_stats_t dlsch_scrambling_SIC_stats;
+  time_stats_t dlsch_modulation_SIC_stats;
+  time_stats_t dlsch_llr_stripping_unit_SIC_stats;
+  time_stats_t dlsch_unscrambling_SIC_stats;
+
+#if ENABLE_RAL
+  hash_table_t    *ral_thresholds_timed;
+  SLIST_HEAD(ral_thresholds_gen_poll_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX];
+  SLIST_HEAD(ral_thresholds_lte_poll_s, ral_threshold_phy_t) ral_thresholds_lte_polled[RAL_LINK_PARAM_LTE_MAX];
+#endif
+*/
+} PHY_VARS_UE_NB_IoT;
+
+
+
+#include "PHY/INIT/defs_NB_IoT.h"
+#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
+#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
+#endif //  __PHY_DEFS__H__
diff --git a/openair1/PHY/extern.h b/openair1/PHY/extern.h
index 5f86678159f91f87fd09c046357f4e928cab219f..5868c1c0221ce345d81aa10267d76bfe211be1a2 100644
--- a/openair1/PHY/extern.h
+++ b/openair1/PHY/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -126,6 +126,6 @@ extern unsigned short Nb_81_110[8][4];
 
 extern uint16_t hundred_times_log10_NPRB[100];
 extern uint8_t alpha_lut[8];
-
+extern uint8_t max_turbo_iterations;
 #endif /*__PHY_EXTERN_H__ */
 
diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h
index b5b1774c6e7af9fadbb09477ddc0c1d8a45fb2b7..066dc7012c317f08da23c8b5433be624f1937f6a 100644
--- a/openair1/PHY/impl_defs_lte.h
+++ b/openair1/PHY/impl_defs_lte.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -144,8 +144,6 @@ typedef struct {
   uint8_t prach_hopping_offset[4];
 } PRACH_eMTC_CONFIG_INFO;
 
-#endif
-
 /// PRACH-ConfigSIB or PRACH-Config from 36.331 RRC spec
 typedef struct {
   /// Parameter: RACH_ROOT_SEQUENCE, see TS 36.211 (5.7.1). \vr{[0..837]}
@@ -153,9 +151,13 @@ typedef struct {
   /// prach_Config_enabled=1 means enabled. \vr{[0..1]}
   uint8_t prach_Config_enabled;
   /// PRACH Configuration Information
+#ifdef Rel14
   PRACH_eMTC_CONFIG_INFO prach_ConfigInfo;
+#endif  
 } PRACH_eMTC_CONFIG_COMMON;
 
+#endif
+
 /// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor.
 typedef enum {
   n2=0,
@@ -817,7 +819,7 @@ typedef struct {
   uint8_t narrowband;
   /// number of PRB pairs for MPDCCH
   uint8_t number_of_prb_pairs;
-  /// mpdcch resource assignement (combinatorial index r)
+  /// mpdcch resource assignment (combinatorial index r)
   uint8_t resource_block_assignment;
   /// transmission type (0=localized,1=distributed) 
   uint8_t transmission_type;
diff --git a/openair1/PHY/impl_defs_lte_NB_IoT.h b/openair1/PHY/impl_defs_lte_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..1167323174e1a3048df10768afd2ca481841c97a
--- /dev/null
+++ b/openair1/PHY/impl_defs_lte_NB_IoT.h
@@ -0,0 +1,813 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file PHY/impl_defs_lte.h
+* \brief LTE Physical channel configuration and variable structure definitions
+* \author R. Knopp, F. Kaltenberger
+* \date 2011
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \note
+* \warning
+*/
+
+#ifndef __PHY_IMPL_DEFS_NB_IOT__H__
+#define __PHY_IMPL_DEFS_NB_IOT__H__
+
+#include "types_NB_IoT.h"
+//#include "defs.h"
+
+typedef enum {TDD_NB_IoT=1,FDD_NB_IoT=0} NB_IoT_frame_type_t;
+typedef enum {EXTENDED_NB_IoT=1,NORMAL_NB_IoT=0} NB_IoT_prefix_type_t;
+typedef enum {SF_DL_NB_IoT, SF_UL_NB_IoT, SF_S_NB_IoT} NB_IoT_subframe_t;
+
+#define	A_SEQUENCE_OF(type)	A_SET_OF(type)
+
+#define	A_SET_OF(type)					\
+	struct {					\
+		type **array;				\
+		int count;	/* Meaningful size */	\
+		int size;	/* Allocated size */	\
+		void (*free)(type *);			\
+	}
+
+
+/////////////////////////
+  /// Union for \ref TPC_PDCCH_CONFIG::tpc_Index.
+typedef union {
+  /// Index of N when DCI format 3 is used. See TS 36.212 (5.3.3.1.6). \vr{[1..15]}
+  uint8_t indexOfFormat3;
+  /// Index of M when DCI format 3A is used. See TS 36.212 (5.3.3.1.7). \vr{[1..31]}
+  uint8_t indexOfFormat3A;
+} TPC_INDEX_NB_IoT_t;
+
+/// TPC-PDCCH-Config Information Element from 36.331 RRC spec
+typedef struct {
+  /// RNTI for power control using DCI format 3/3A, see TS 36.212. \vr{[0..65535]}
+  uint16_t rnti;
+  /// Index of N or M, see TS 36.212 (5.3.3.1.6 and 5.3.3.1.7), where N or M is dependent on the used DCI format (i.e. format 3 or 3a).
+  TPC_INDEX_NB_IoT_t tpc_Index;
+} TPC_PDCCH_CONFIG_NB_IoT;
+  /// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor.
+typedef enum {
+  //n2=0,
+  n4_n,
+  n6_n
+} ACKNAKREP_NB_IoT_t;
+
+/// Enumeration for \ref PUCCH_CONFIG_DEDICATED::tdd_AckNackFeedbackMode.
+typedef enum {
+  bundling_N=0,
+  multiplexing_N
+} ANFBmode_NB_IoT_t;
+
+/// PUCCH-ConfigDedicated from 36.331 RRC spec
+typedef struct {
+  /// Flag to indicate ACK NAK repetition activation, see TS 36.213 (10.1). \vr{[0..1]}
+  uint8_t ackNackRepetition;
+  /// Parameter: \f$N_\text{ANRep}\f$, see TS 36.213 (10.1).
+  ACKNAKREP_NB_IoT_t repetitionFactor;
+  /// Parameter: \f$n^{(1)}_\text{PUCCH,ANRep}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
+  uint16_t n1PUCCH_AN_Rep;
+  /// Feedback mode, see TS 36.213 (7.3). \details Applied to both PUCCH and PUSCH feedback. For TDD, should always be set to bundling.
+  ANFBmode_NB_IoT_t tdd_AckNackFeedbackMode;
+} PUCCH_CONFIG_DEDICATED_NB_IoT;
+  // UE specific PUSCH configuration.
+typedef struct {
+  /// Parameter: \f$I^\text{HARQ-ACK}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-1). \vr{[0..15]}
+  uint16_t betaOffset_ACK_Index;
+  /// Parameter: \f$I^{RI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-2). \vr{[0..15]}
+  uint16_t betaOffset_RI_Index;
+  /// Parameter: \f$I^{CQI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-3). \vr{[0..15]}
+  uint16_t betaOffset_CQI_Index;
+} PUSCH_CONFIG_DEDICATED_NB_IoT;
+/// Enumeration for Parameter \f$P_A\f$ \ref PDSCH_CONFIG_DEDICATED::p_a.
+typedef enum {
+  //dBm6=0, ///< (dB-6) corresponds to -6 dB
+ // dBm477, ///< (dB-4dot77) corresponds to -4.77 dB
+ // dBm3,   ///< (dB-3) corresponds to -3 dB
+  //dBm177, ///< (dB-1dot77) corresponds to -1.77 dB
+  //dB0,    ///< corresponds to 0 dB
+ // dB1,    ///< corresponds to 1 dB
+  dB2_NB,    ///< corresponds to 2 dB
+  dB3_NB     ///< corresponds to 3 dB
+} PA_NB_IoT_t;
+
+/// PDSCH-ConfigDedicated from 36.331 RRC spec
+typedef struct {
+  /// Parameter: \f$P_A\f$, see TS 36.213 (5.2).
+  PA_NB_IoT_t p_a;
+} PDSCH_CONFIG_DEDICATED_NB_IoT;
+
+/// UplinkPowerControlDedicated Information Element from 36.331 RRC spec
+typedef struct {
+  /// Parameter: \f$P_\text{0\_UE\_PUSCH}(1)\f$, see TS 36.213 (5.1.1.1), unit dB. \vr{[-8..7]}\n This field is applicable for non-persistent scheduling, only.
+  int8_t p0_UE_PUSCH;
+  /// Parameter: Ks, see TS 36.213 (5.1.1.1). \vr{[0..1]}\n en0 corresponds to value 0 corresponding to state “disabled”. en1 corresponds to value 1.25 corresponding to “enabled”. \note the specification sais it is an enumerated value. \warning the enumeration values do not correspond to the given values in the specification (en1 should be 1.25).
+  uint8_t deltaMCS_Enabled;
+  /// Parameter: Accumulation-enabled, see TS 36.213 (5.1.1.1). \vr{[0..1]} 1 corresponds to "enabled" whereas 0 corresponds to "disabled".
+  uint8_t accumulationEnabled;
+  /// Parameter: \f$P_\text{0\_UE\_PUCCH}(1)\f$, see TS 36.213 (5.1.2.1), unit dB. \vr{[-8..7]}
+  int8_t p0_UE_PUCCH;
+  /// Parameter: \f$P_\text{SRS\_OFFSET}\f$, see TS 36.213 (5.1.3.1). \vr{[0..15]}\n For Ks=1.25 (\ref deltaMCS_Enabled), the actual parameter value is pSRS_Offset value - 3. For Ks=0, the actual parameter value is -10.5 + 1.5*pSRS_Offset value.
+  int8_t pSRS_Offset;
+  /// Specifies the filtering coefficient for RSRP measurements used to calculate path loss, as specified in TS 36.213 (5.1.1.1).\details The same filtering mechanism applies as for quantityConfig described in 5.5.3.2. \note the specification sais it is an enumerated value.
+  uint8_t filterCoefficient;
+} UL_POWER_CONTROL_DEDICATED_NB_IoT;
+
+/// Union for \ref TPC_PDCCH_CONFIG::tpc_Index.
+//typedef union {
+  /// Index of N when DCI format 3 is used. See TS 36.212 (5.3.3.1.6). \vr{[1..15]}
+ // uint8_t indexOfFormat3;
+  /// Index of M when DCI format 3A is used. See TS 36.212 (5.3.3.1.7). \vr{[1..31]}
+ // uint8_t indexOfFormat3A;
+//} TPC_INDEX_NB_IoT_t;
+
+/// CQI-ReportPeriodic
+typedef struct {
+  /// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}, -1 indicates inactivity
+  int16_t cqi_PUCCH_ResourceIndex;
+  /// Parameter: CQI/PMI Periodicity and Offset Configuration Index \f$I_\text{CQI/PMI}\f$, see TS 36.213 (tables 7.2.2-1A and 7.2.2-1C). \vr{[0..1023]}
+  int16_t cqi_PMI_ConfigIndex;
+  /// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]}
+  uint8_t K;
+  /// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}, -1 indicates inactivity
+  int16_t ri_ConfigIndex;
+  /// Parameter: Simultaneous-AN-and-CQI, see TS 36.213 (10.1). \vr{[0..1]} 1 indicates that simultaneous transmission of ACK/NACK and CQI is allowed.
+  uint8_t simultaneousAckNackAndCQI;
+  /// parameter computed from Tables 7.2.2-1A and 7.2.2-1C
+  uint16_t Npd;
+  /// parameter computed from Tables 7.2.2-1A and 7.2.2-1C
+  uint16_t N_OFFSET_CQI;
+} CQI_REPORTPERIODIC_NB_IoT;
+
+/// Enumeration for parameter reporting mode \ref CQI_REPORT_CONFIG::cqi_ReportModeAperiodic.
+typedef enum {
+  //rm12=0,
+  //rm20=1,
+  //rm22=2,
+  rm30_N=3,
+  rm31_N=4
+} CQI_REPORTMODEAPERIODIC_NB_IoT;
+
+/// CQI-ReportConfig Information Element from 36.331 RRC spec
+typedef struct {
+  /// Parameter: reporting mode. Value rm12 corresponds to Mode 1-2, rm20 corresponds to Mode 2-0, rm22 corresponds to Mode 2-2 etc. PUSCH reporting modes are described in TS 36.213 [23, 7.2.1].
+  CQI_REPORTMODEAPERIODIC_NB_IoT cqi_ReportModeAperiodic;
+  /// Parameter: \f$\Delta_\text{offset}\f$, see TS 36.213 (7.2.3). \vr{[-1..6]}\n Actual value = IE value * 2 [dB].
+  int8_t nomPDSCH_RS_EPRE_Offset;
+  CQI_REPORTPERIODIC_NB_IoT CQI_ReportPeriodic;
+} CQI_REPORT_CONFIG_NB_IoT;
+
+/// SoundingRS-UL-ConfigDedicated Information Element from 36.331 RRC spec
+typedef struct {
+  /// Parameter: \f$B_\text{SRS}\f$, see TS 36.211 (table 5.5.3.2-1, 5.5.3.2-2, 5.5.3.2-3 and 5.5.3.2-4). \vr{[0..3]} \note the specification sais it is an enumerated value.
+  uint8_t srs_Bandwidth;
+  /// Parameter: SRS hopping bandwidth \f$b_\text{hop}\in\{0,1,2,3\}\f$, see TS 36.211 (5.5.3.2) \vr{[0..3]} \note the specification sais it is an enumerated value.
+  uint8_t srs_HoppingBandwidth;
+  /// Parameter: \f$n_\text{RRC}\f$, see TS 36.211 (5.5.3.2). \vr{[0..23]}
+  uint8_t freqDomainPosition;
+  /// Parameter: Duration, see TS 36.213 (8.2). \vr{[0..1]} 0 corresponds to "single" and 1 to "indefinite".
+  uint8_t duration;
+  /// Parameter: \f$k_\text{TC}\in\{0,1\}\f$, see TS 36.211 (5.5.3.2). \vr{[0..1]}
+  uint8_t transmissionComb;
+  /// Parameter: \f$I_\text{SRS}\f$, see TS 36.213 (table 8.2-1). \vr{[0..1023]}
+  uint16_t srs_ConfigIndex;
+  /// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value.
+  uint8_t cyclicShift;
+  // Parameter: internal implementation: UE SRS configured
+  uint8_t srsConfigDedicatedSetup;
+  // Parameter: cell srs subframe for internal implementation
+  uint8_t srsCellSubframe;
+  // Parameter: ue srs subframe for internal implementation
+  uint8_t srsUeSubframe;
+} SOUNDINGRS_UL_CONFIG_DEDICATED_NB_IoT;
+
+
+/// Enumeration for parameter SR transmission \ref SCHEDULING_REQUEST_CONFIG::dsr_TransMax.
+typedef enum {
+  //sr_n4=0,
+ // sr_n8=1,
+ // sr_n16=2,
+  sr_n32_N=3,
+  sr_n64_N=4
+} DSR_TRANSMAX_NB_IoT_t;
+
+/// SchedulingRequestConfig Information Element from 36.331 RRC spec
+typedef struct {
+  /// Parameter: \f$n^{(1)}_\text{PUCCH,SRI}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
+  uint16_t sr_PUCCH_ResourceIndex;
+  /// Parameter: \f$I_\text{SR}\f$, see TS 36.213 (10.1). \vr{[0..155]}
+  uint8_t sr_ConfigIndex;
+  /// Parameter for SR transmission in TS 36.321 (5.4.4). \details The value n4 corresponds to 4 transmissions, n8 corresponds to 8 transmissions and so on.
+  DSR_TRANSMAX_NB_IoT_t dsr_TransMax;
+} SCHEDULING_REQUEST_CONFIG_NB_IoT;
+
+typedef struct {
+  /// Downlink Power offset field
+  uint8_t dl_pow_off;
+  ///Subband resource allocation field
+  uint8_t rballoc_sub[50];
+  ///Total number of PRBs indicator
+  uint8_t pre_nb_available_rbs;
+} MU_MIMO_mode_NB_IoT;
+////////////////////////
+
+typedef struct {
+
+    /// \brief Holds the received data in the frequency domain.
+    /// - first index: rx antenna [0..nb_antennas_rx[
+    /// - second index: symbol [0..28*ofdm_symbol_size[
+    int32_t **rxdataF;
+
+    /// \brief Hold the channel estimates in frequency domain.
+    /// - first index: eNB id [0..6] (hard coded)
+    /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+    /// - third index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
+    int32_t **dl_ch_estimates[7];
+
+    /// \brief Hold the channel estimates in time domain (used for tracking).
+    /// - first index: eNB id [0..6] (hard coded)
+    /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+    /// - third index: samples? [0..2*ofdm_symbol_size[
+    int32_t **dl_ch_estimates_time[7];
+}NB_IoT_UE_COMMON_PER_THREAD;
+
+typedef struct {
+  /// \brief Holds the transmit data in time domain.
+  /// For IFFT_FPGA this points to the same memory as PHY_vars->tx_vars[a].TX_DMA_BUFFER.
+  /// - first index: tx antenna [0..nb_antennas_tx[
+  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES[
+  int32_t **txdata;
+  /// \brief Holds the transmit data in the frequency domain.
+  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
+  /// - first index: tx antenna [0..nb_antennas_tx[
+  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX[
+  int32_t **txdataF;
+
+  /// \brief Holds the received data in time domain.
+  /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES+2048[
+  int32_t **rxdata;
+
+  NB_IoT_UE_COMMON_PER_THREAD common_vars_rx_data_per_thread[2];
+
+  /// holds output of the sync correlator
+  int32_t *sync_corr;
+  /// estimated frequency offset (in radians) for all subcarriers
+  int32_t freq_offset;
+  /// eNb_id user is synched to
+  int32_t eNb_id;
+} NB_IoT_UE_COMMON;
+
+typedef struct {
+  /// \brief Received frequency-domain signal after extraction.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **rxdataF_ext;
+  /// \brief Received frequency-domain ue specific pilots.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..12*N_RB_DL[
+  int32_t **rxdataF_uespec_pilots;
+  /// \brief Received frequency-domain signal after extraction and channel compensation.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **rxdataF_comp0;
+  /// \brief Received frequency-domain signal after extraction and channel compensation for the second stream. For the SIC receiver we need to store the history of this for each harq process and round
+  /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid
+  /// - second index: ? [0..7] (hard coded) accessed via \c round
+  /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - fourth index: ? [0..168*N_RB_DL[
+  int32_t **rxdataF_comp1[8][8];
+  /// \brief Downlink channel estimates extracted in PRBS.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **dl_ch_estimates_ext;
+  /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS. For the SIC receiver we need to store the history of this for each harq process and round
+  /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid
+  /// - second index: ? [0..7] (hard coded) accessed via \c round
+  /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - fourth index: ? [0..168*N_RB_DL[
+  int32_t **dl_ch_rho_ext[8][8];
+  /// \brief Downlink beamforming channel estimates in frequency domain.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
+  int32_t **dl_bf_ch_estimates;
+  /// \brief Downlink beamforming channel estimates.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **dl_bf_ch_estimates_ext;
+  /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **dl_ch_rho2_ext;
+  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
+  /// - first index: ressource block [0..N_RB_DL[
+  uint8_t *pmi_ext;
+  /// \brief Magnitude of Downlink Channel first layer (16QAM level/First 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **dl_ch_mag0;
+  /// \brief Magnitude of Downlink Channel second layer (16QAM level/First 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **dl_ch_mag1[8][8];
+  /// \brief Magnitude of Downlink Channel, first layer (2nd 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **dl_ch_magb0;
+  /// \brief Magnitude of Downlink Channel second layer (2nd 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
+  int32_t **dl_ch_magb1[8][8];
+  /// \brief Cross-correlation of two eNB signals.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: symbol [0..]
+  int32_t **rho;
+  /// never used... always send dl_ch_rho_ext instead...
+  int32_t **rho_i;
+  /// \brief Pointers to llr vectors (2 TBs).
+  /// - first index: ? [0..1] (hard coded)
+  /// - second index: ? [0..1179743] (hard coded)
+  int16_t *llr[2];
+  /// \f$\log_2(\max|H_i|^2)\f$
+  int16_t log2_maxh;
+    /// \f$\log_2(\max|H_i|^2)\f$ //this is for TM3-4 layer1 channel compensation
+  int16_t log2_maxh0;
+    /// \f$\log_2(\max|H_i|^2)\f$ //this is for TM3-4 layer2 channel commpensation
+  int16_t log2_maxh1;
+  /// \brief LLR shifts for subband scaling.
+  /// - first index: ? [0..168*N_RB_DL[
+  uint8_t *llr_shifts;
+  /// \brief Pointer to LLR shifts.
+  /// - first index: ? [0..168*N_RB_DL[
+  uint8_t *llr_shifts_p;
+  /// \brief Pointers to llr vectors (128-bit alignment).
+  /// - first index: ? [0..0] (hard coded)
+  /// - second index: ? [0..]
+  int16_t **llr128;
+  /// \brief Pointers to llr vectors (128-bit alignment).
+  /// - first index: ? [0..0] (hard coded)
+  /// - second index: ? [0..]
+  int16_t **llr128_2ndstream;
+  //uint32_t *rb_alloc;
+  //uint8_t Qm[2];
+  //MIMO_mode_t mimo_mode;
+} NB_IoT_UE_PDSCH;
+
+/// NPRACH-ParametersList-NB-r13 from 36.331 RRC spec
+typedef struct NPRACH_Parameters_NB_IoT{
+  /// the period time for nprach
+  uint16_t nprach_Periodicity;
+  /// for the start time for the NPRACH resource from 40ms-2560ms
+  uint16_t nprach_StartTime;
+  /// for the subcarrier of set to the NPRACH preamble from n0 - n34
+  uint16_t nprach_SubcarrierOffset;
+  ///number of subcarriers in a NPRACH resource allowed values (n12,n24,n36,n48)
+  uint16_t nprach_NumSubcarriers;
+  /// where is the region that in NPRACH resource to indicate if this UE support MSG3 for multi-tone or not. from 0 - 1
+  uint16_t nprach_SubcarrierMSG3_RangeStart;
+  /// The max preamble transmission attempt for the CE level from 1 - 128
+  uint16_t maxNumPreambleAttemptCE;
+  /// Number of NPRACH repetitions per attempt for each NPRACH resource
+  uint16_t numRepetitionsPerPreambleAttempt;
+  /// The number of the repetition for DCI use in RAR/MSG3/MSG4 from 1 - 2048 (Rmax)
+  uint16_t npdcch_NumRepetitions_RA;
+  /// Starting subframe for NPDCCH Common searching space for (RAR/MSG3/MSG4)
+  uint16_t npdcch_StartSF_CSS_RA;
+  /// Fractional period offset of starting subframe for NPDCCH common search space
+  uint16_t npdcch_Offset_RA;
+} nprach_parameters_NB_IoT_t;
+
+typedef struct{
+  nprach_parameters_NB_IoT_t list[3];
+}NPRACH_List_NB_IoT_t;
+
+typedef long RSRP_Range_t;
+
+typedef struct {
+  A_SEQUENCE_OF(RSRP_Range_t) list;
+}rsrp_ThresholdsNPrachInfoList;
+
+
+/// NPRACH_ConfigSIB-NB from 36.331 RRC spec
+typedef struct {
+  /// nprach_CP_Length_r13, for the CP length(unit us) only 66.7 and 266.7 is implemented
+  uint16_t nprach_CP_Length;
+  /// The criterion for UEs to select a NPRACH resource. Up to 2 RSRP threshold values can be signalled.  \vr{[1..2]}
+  struct rsrp_ThresholdsNPrachInfoList *rsrp_ThresholdsPrachInfoList;
+  /// NPRACH Parameters List
+  NPRACH_List_NB_IoT_t nprach_ParametersList;
+
+} NPRACH_CONFIG_COMMON;
+
+/// NPDSCH-ConfigCommon from 36.331 RRC spec
+typedef struct {
+  ///see TS 36.213 (16.2). \vr{[-60..50]}\n Provides the downlink reference-signal EPRE. The actual value in dBm.
+  uint16_t nrs_Power;
+} NPDSCH_CONFIG_COMMON;
+
+typedef struct{
+  /// The base sequence of DMRS sequence in a cell for 3 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 12. Value 12 is not used.
+  uint16_t threeTone_BaseSequence;
+  /// Define 3 cyclic shifts for the 3-tone case, see TS 36.211 [21, 10.1.4.1.2].
+  uint16_t threeTone_CyclicShift;
+  /// The base sequence of DMRS sequence in a cell for 6 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 14. Value 14 is not used.
+  uint16_t sixTone_BaseSequence;
+  /// Define 4 cyclic shifts for the 6-tone case, see TS 36.211 [21, 10.1.4.1.2].
+  uint16_t sixTone_CyclicShift;
+  /// The base sequence of DMRS sequence in a cell for 12 tones transmission; see TS 36.211 [21, 10.1.4.1.2]. If absent, it is given by NB-IoT CellID mod 30. Value 30 is not used.
+  uint16_t twelveTone_BaseSequence;
+
+}DMRS_CONFIG_t;
+
+/// UL-ReferenceSignalsNPUSCH from 36.331 RRC spec
+typedef struct {
+  /// Parameter: Group-hopping-enabled, see TS 36.211 (5.5.1.3). \vr{[0..1]}
+  uint8_t groupHoppingEnabled;
+  /// , see TS 36.211 (5.5.1.3). \vr{[0..29]}
+  uint8_t groupAssignmentNPUSCH;
+  /// Parameter: cyclicShift, see TS 36.211 (Table 5.5.2.1.1-2). \vr{[0..7]}
+  uint8_t cyclicShift;
+  /// nPRS for cyclic shift of DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
+  uint8_t nPRS[20];
+  /// group hopping sequence for DMRS, 36.211, Section 10.1.4.1.3. Second index corresponds to the four possible subcarrier configurations
+  uint8_t grouphop[20][4];
+  /// sequence hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
+  uint8_t seqhop[20];
+} UL_REFERENCE_SIGNALS_NPUSCH_t;
+
+
+/// PUSCH-ConfigCommon from 36.331 RRC spec.
+typedef struct {
+  /// Number of repetitions for ACK/NACK HARQ response to NPDSCH containing Msg4 per NPRACH resource, see TS 36.213 [23, 16.4.2].
+  uint8_t ack_NACK_NumRepetitions_Msg4[3];
+  /// SRS SubframeConfiguration. See TS 36.211 [21, table 5.5.3.3-1]. Value sc0 corresponds to value 0, sc1 to value 1 and so on.
+  uint8_t srs_SubframeConfig;
+  /// Parameter: \f$N^{HO}_{RB}\f$, see TS 36.211 (5.3.4). \vr{[0..98]}
+  DMRS_CONFIG_t dmrs_Config;
+  /// Ref signals configuration
+  UL_REFERENCE_SIGNALS_NPUSCH_t ul_ReferenceSignalsNPUSCH;
+
+} NPUSCH_CONFIG_COMMON;
+
+
+typedef struct{
+  /// See TS 36.213 [23, 16.2.1.1], unit dBm.
+  uint8_t p0_NominalNPUSCH;
+  /// See TS 36.213 [23, 16.2.1.1] where al0 corresponds to 0, al04 corresponds to value 0.4, al05 to 0.5, al06 to 0.6, al07 to 0.7, al08 to 0.8, al09 to 0.9 and al1 corresponds to 1. 
+  uint8_t alpha;
+  /// See TS 36.213 [23, 16.2.1.1]. Actual value = IE value * 2 [dB].
+  uint8_t deltaPreambleMsg3;
+}UplinkPowerControlCommon_NB_IoT;
+
+
+/* DL-GapConfig-NB-r13 */
+typedef struct {
+	uint16_t	 dl_GapThreshold;
+	uint16_t	 dl_GapPeriodicity;
+	uint16_t	 dl_GapDurationCoeff;
+} DL_GapConfig_NB_IoT;
+
+#define NBIOT_INBAND_LTEPCI 0
+#define NBIOT_INBAND_IOTPCI 1
+#define NBIOT_INGUARD       2
+#define NBIOT_STANDALONE    3
+
+
+typedef struct {
+  /// for inband, lte bandwidth
+  uint8_t LTE_N_RB_DL;
+  uint8_t LTE_N_RB_UL;
+  /// Cell ID
+  uint16_t Nid_cell;
+  /// shift of pilot position in one RB
+  uint8_t nushift;
+  /// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0).
+  uint8_t node_id;
+  /// Frequency index of CBMIMO1 card
+  uint8_t freq_idx;
+  /// RX Frequency for ExpressMIMO/LIME
+  uint32_t carrier_freq[4];
+  /// TX Frequency for ExpressMIMO/LIME
+  uint32_t carrier_freqtx[4];
+  /// RX gain for ExpressMIMO/LIME
+  uint32_t rxgain[4];
+  /// TX gain for ExpressMIMO/LIME
+  uint32_t txgain[4];
+  /// RF mode for ExpressMIMO/LIME
+  uint32_t rfmode[4];
+  /// RF RX DC Calibration for ExpressMIMO/LIME
+  uint32_t rxdc[4];
+  /// RF TX DC Calibration for ExpressMIMO/LIME
+  uint32_t rflocal[4];
+  /// RF VCO calibration for ExpressMIMO/LIME
+  uint32_t rfvcolocal[4];
+  /// Turns on second TX of CBMIMO1 card
+  uint8_t dual_tx;
+  /// flag to indicate SISO transmission
+  uint8_t mode1_flag;
+  /// Indicator that 20 MHz channel uses 3/4 sampling frequency
+  //uint8_t threequarter_fs;
+  /// Size of FFT
+  uint16_t ofdm_symbol_size;
+  /// Number of prefix samples in all but first symbol of slot
+  uint16_t nb_prefix_samples;
+  /// Number of prefix samples in first symbol of slot
+  uint16_t nb_prefix_samples0;
+  /// Carrier offset in FFT buffer for first RE in PRB0
+  uint16_t first_carrier_offset;
+  /// Number of samples in a subframe
+  uint32_t samples_per_tti;
+  /// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL)
+  uint16_t symbols_per_tti;
+  /// Number of Physical transmit antennas in node
+  uint8_t nb_antennas_tx;
+  /// Number of Receive antennas in node
+  uint8_t nb_antennas_rx;
+  /// Number of common transmit antenna ports in eNodeB (1 or 2)
+  uint8_t nb_antenna_ports_eNB;
+  /// Number of common receiving antenna ports in eNodeB (1 or 2)
+  uint8_t nb_antenna_ports_rx_eNB;
+  /// NPRACH Config Common (from 36-331 RRC spec)
+  NPRACH_CONFIG_COMMON nprach_config_common;
+  /// NPDSCH Config Common (from 36-331 RRC spec)
+  NPDSCH_CONFIG_COMMON npdsch_config_common;
+  /// PUSCH Config Common (from 36-331 RRC spec)
+  NPUSCH_CONFIG_COMMON npusch_config_common;
+  /// UL Power Control (from 36-331 RRC spec)
+  UplinkPowerControlCommon_NB_IoT ul_power_control_config_common;
+  /// DL Gap
+  DL_GapConfig_NB_IoT DL_gap_config;
+  /// Size of SI windows used for repetition of one SI message (in frames)
+  uint8_t SIwindowsize;
+  /// Period of SI windows used for repetition of one SI message (in frames)
+  uint16_t SIPeriod;
+  int                 eutra_band;
+  uint32_t            dl_CarrierFreq;
+  uint32_t            ul_CarrierFreq;
+  // CE level to determine the NPRACH Configuration (one CE for each NPRACH config.)
+  uint8_t             CE;
+
+  /*
+   * index of the PRB assigned to NB-IoT carrier in in-band/guard-band operating mode
+   */
+  unsigned short NB_IoT_RB_ID;
+
+
+  /*Following FAPI approach:
+   * 0 = in-band with same PCI
+   * 1 = in-band with diff PCI
+   * 2 = guard band
+   * 3 =stand alone
+   */
+  uint16_t operating_mode;
+  /*
+   * Only for In-band operating mode with same PCI
+   * its measured in number of OFDM symbols
+   * allowed values:
+   * 1, 2, 3, 4(this value is written in FAPI specs but not exist in TS 36.331 v14.2.1 pag 587)
+   * -1 (we put this value when is not defined - other operating mode)
+   */
+  uint16_t control_region_size;
+
+  /*Number of EUTRA CRS antenna ports (AP)
+   * valid only for in-band different PCI mode
+   * value 0 = indicates the same number of AP as NRS APs
+   * value 1 = four CRS APs
+   */
+  uint16_t eutra_NumCRS_ports;
+
+  /* Subcarrier bandwidth
+  0 -> 3.75 kHz
+  1 -> 15 kHz
+  */
+  uint8_t subcarrier_spacing; 
+
+} NB_IoT_DL_FRAME_PARMS;
+
+typedef struct {
+  /// \brief Pointers (dynamic) to the received data in the time domain.
+  /// - first index: rx antenna [0..nb_antennas_rx]
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti]
+  int32_t **rxdata;
+  /// \brief Pointers (dynamic) to the received data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti]
+  int32_t **rxdataF;
+  /// \brief holds the transmit data in the frequency domain.
+  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
+  /// - third index: sample [0..]
+  int32_t **txdataF; 
+} NB_IoT_eNB_COMMON;
+
+typedef struct {
+  /// \brief Holds the transmit data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
+  int32_t **txdata;
+  /// \brief Holds the receive data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
+  int32_t **rxdata[3];
+  /// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: sample [0..samples_per_tti[
+  int32_t **rxdata_7_5kHz[3];
+  /// \brief Holds the received data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
+  int32_t **rxdataF[3];
+  /// \brief Holds output of the sync correlator.
+  /// - first index: sample [0..samples_per_tti*10[
+  uint32_t *sync_corr[3];
+} NB_IoT_RU_COMMON;
+
+typedef struct {
+  /// \brief Hold the channel estimates in frequency domain based on SRS.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..ofdm_symbol_size[
+  int32_t **srs_ch_estimates[3];
+  /// \brief Hold the channel estimates in time domain based on SRS.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..2*ofdm_symbol_size[
+  int32_t **srs_ch_estimates_time[3];
+  /// \brief Holds the SRS for channel estimation at the RX.
+  /// - first index: ? [0..ofdm_symbol_size[
+  int32_t *srs;
+} NB_IoT_eNB_SRS;
+
+typedef struct {
+  /// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..2*ofdm_symbol_size[
+  /// - third index (definition from phy_init_lte_eNB()): ? [0..24*N_RB_UL*frame_parms->symbols_per_tti[
+  /// \warning inconsistent third index definition
+  int32_t **rxdataF_ext[3];
+  /// \brief Holds the received data in the frequency domain for the allocated RBs in normal format.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index (definition from phy_init_lte_eNB()): ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **rxdataF_ext2[3];
+  /// \brief Hold the channel estimates in time domain based on DRS.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..4*ofdm_symbol_size[
+  int32_t **drs_ch_estimates_time[3];
+  /// \brief Hold the channel estimates in frequency domain based on DRS.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **drs_ch_estimates[3];
+  /// \brief Hold the channel estimates for UE0 in case of Distributed Alamouti Scheme.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **drs_ch_estimates_0[3];
+  /// \brief Hold the channel estimates for UE1 in case of Distributed Almouti Scheme.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **drs_ch_estimates_1[3];
+  /// \brief Holds the compensated signal.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **rxdataF_comp[3];
+  /// \brief Hold the compensated data (y)*(h0*) in case of Distributed Alamouti Scheme.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **rxdataF_comp_0[3];
+  /// \brief Hold the compensated data (y*)*(h1) in case of Distributed Alamouti Scheme.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **rxdataF_comp_1[3];
+  /// \brief ?.
+  /// - first index: sector id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **ul_ch_mag[3];
+  /// \brief ?.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **ul_ch_magb[3];
+  /// \brief Hold the channel mag for UE0 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **ul_ch_mag_0[3];
+  /// \brief Hold the channel magb for UE0 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **ul_ch_magb_0[3];
+  /// \brief Hold the channel mag for UE1 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **ul_ch_mag_1[3];
+  /// \brief Hold the channel magb for UE1 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
+  int32_t **ul_ch_magb_1[3];
+  /// measured RX power based on DRS
+  int ulsch_power[2];
+  /// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
+  int ulsch_power_0[2];
+  /// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
+  int ulsch_power_1[2];
+  /// \brief llr values.
+  /// - first index: ? [0..1179743] (hard coded)
+  int16_t *llr;
+#ifdef LOCALIZATION
+  /// number of active subcarrier for a specific UE
+  int32_t active_subcarrier;
+  /// subcarrier power in dBm
+  int32_t *subcarrier_power;
+#endif
+} NB_IoT_eNB_PUSCH;
+
+#define PBCH_A_NB_IoT 24
+typedef struct {
+  uint8_t pbch_d[96+(3*(16+PBCH_A_NB_IoT))];
+  uint8_t pbch_w[3*3*(16+PBCH_A_NB_IoT)];
+  uint8_t pbch_e[1920];
+} NB_IoT_eNB_PBCH;
+
+
+typedef enum {
+  /// TM1
+  SISO_NB_IoT=0,
+  /// TM2
+  ALAMOUTI_NB_IoT=1,
+  /// TM3
+  LARGE_CDD_NB_IoT=2,
+  /// the next 6 entries are for TM5
+  UNIFORM_PRECODING11_NB_IoT=3,
+  UNIFORM_PRECODING1m1_NB_IoT=4,
+  UNIFORM_PRECODING1j_NB_IoT=5,
+  UNIFORM_PRECODING1mj_NB_IoT=6,
+  PUSCH_PRECODING0_NB_IoT=7,
+  PUSCH_PRECODING1_NB_IoT=8,
+  /// the next 3 entries are for TM4
+  DUALSTREAM_UNIFORM_PRECODING1_NB_IoT=9,
+  DUALSTREAM_UNIFORM_PRECODINGj_NB_IoT=10,
+  DUALSTREAM_PUSCH_PRECODING_NB_IoT=11,
+  TM7_NB_IoT=12,
+  TM8_NB_IoT=13,
+  TM9_10_NB_IoT=14
+} MIMO_mode_NB_IoT_t;
+
+typedef struct {
+  /// \brief ?.
+  /// first index: ? [0..1023] (hard coded)
+  int16_t *prachF;
+  /// \brief ?.
+  /// first index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
+  /// second index: ? [0..ofdm_symbol_size*12[
+  int16_t *rxsigF[64];
+  /// \brief local buffer to compute prach_ifft (necessary in case of multiple CCs)
+  /// first index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
+  /// second index: ? [0..2047] (hard coded)
+  int16_t *prach_ifft[64];
+} NB_IoT_eNB_PRACH;
+
+typedef enum {
+  NOT_SYNCHED_NB_IoT=0,
+  PRACH_NB_IoT=1,
+  RA_RESPONSE_NB_IoT=2,
+  PUSCH_NB_IoT=3,
+  RESYNCH_NB_IoT=4
+} UE_MODE_NB_IoT_t;
+
+
+#endif
diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h
index 13b6d1c8a792441fae62927813d2103021d864af..2697dc55789078aadc22ed4d701156381ef15a55 100644
--- a/openair1/PHY/impl_defs_top.h
+++ b/openair1/PHY/impl_defs_top.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -125,10 +125,6 @@
 #define FIRST_CARRIER_OFFSET (HALF_NUMBER_OF_USEFUL_CARRIERS+NUMBER_OF_ZERO_CARRIERS)
 #define NUMBER_OF_OFDM_SYMBOLS_PER_SLOT (NUMBER_OF_SYMBOLS_PER_FRAME/LTE_SLOTS_PER_FRAME)
 
-#ifdef EMOS
-#define EMOS_SCH_INDEX 1
-#endif //EMOS
-
 #define EXTENSION_TYPE (PHY_config->PHY_framing.Extension_type)
 
 #define NUMBER_OF_OFDM_CARRIERS_BYTES   NUMBER_OF_OFDM_CARRIERS*4
diff --git a/openair1/PHY/impl_defs_top_NB_IoT.h b/openair1/PHY/impl_defs_top_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..f7e0c7ff7fceff153f24d5e82e39eb4aeca3d1f8
--- /dev/null
+++ b/openair1/PHY/impl_defs_top_NB_IoT.h
@@ -0,0 +1,541 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file PHY/impl_defs_top.h
+* \brief More defines and structure definitions
+* \author R. Knopp, F. Kaltenberger
+* \date 2011
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \note
+* \warning
+*/
+
+#ifndef __PHY_IMPLEMENTATION_DEFS_NB_IOT_H__
+#define __PHY_IMPLEMENTATION_DEFS_NB_IOT_H__
+
+
+#include "openairinterface5g_limits.h"
+/** @defgroup _ref_implementation_ OpenAirInterface LTE Implementation
+ * @{
+
+ * @defgroup _PHY_RF_INTERFACE_ PHY - RF Interface
+ * @ingroup _PHY_RF_INTERFACE_
+ * @{
+ * @defgroup _GENERIC_PHY_RF_INTERFACE_ Generic PHY - RF Interface
+ * @defgroup _USRP_PHY_RF_INTERFACE_    PHY - USRP RF Interface
+ * @defgroup _BLADERF_PHY_RF_INTERFACE_    PHY - BLADERF RF Interface
+ * @defgroup _LMSSDR_PHY_RF_INTERFACE_    PHY - LMSSDR RF Interface
+ * @}
+ *
+ * @ingroup _ref_implementation_
+ * @{
+ * This module is responsible for defining the generic interface between PHY and RF Target
+ * @}
+ 
+ * @defgroup _openair1_ openair1 Reference Implementation 
+ * @ingroup _ref_implementation_
+ * @{
+
+
+ * @defgroup _physical_layer_ref_implementation_ Physical Layer Reference Implementation
+ * @ingroup _openair1_
+ * @{
+
+
+ * @defgroup _PHY_STRUCTURES_ Basic Structures and Memory Initialization
+ * @ingroup _physical_layer_ref_implementation_
+ * @{
+ * This module is responsible for defining and initializing the PHY variables during static configuration of OpenAirInterface.
+ * @}
+
+ * @defgroup _PHY_DSP_TOOLS_ DSP Tools
+ * @ingroup _physical_layer_ref_implementation_
+ * @{
+ * This module is responsible for basic signal processing related to inner-MODEM processing.
+ * @}
+
+ * @defgroup _PHY_MODULATION_ Modulation and Demodulation
+ * @ingroup _physical_layer_ref_implementation_
+ * @{
+ * This module is responsible for procedures related to OFDMA modulation and demodulation.
+ * @}
+
+ * @defgroup _PHY_PARAMETER_ESTIMATION_BLOCKS_ Parameter Estimation
+ * @ingroup _physical_layer_ref_implementation_
+ * @{
+ * This module is responsible for procedures related to OFDMA frequency-domain channel estimation for LTE Downlink Channels.
+ * @}
+
+ * @defgroup _PHY_CODING_BLOCKS_ Channel Coding/Decoding Functions
+ * @ingroup _physical_layer_ref_implementation_
+ * @{
+ * This module is responsible for procedures related to channel coding/decoding, rate-matching, segementation and interleaving.
+ * @}
+
+ * @defgroup _PHY_TRANSPORT_ Transport/Physical Channel Processing
+ * @ingroup _physical_layer_ref_implementation_
+ * @{
+ * This module is responsible for defining and processing the PHY procedures (TX/RX) related to transport and physical channels.
+ * @}
+
+ * @defgroup _PHY_PROCEDURES_ Physical Layer Procedures
+ * @ingroup _physical_layer_ref_implementation_
+ * @{
+ * This module is responsible for defining and processing the PHY procedures (TX/RX) related to transport and physical channels.
+ * @}
+
+ * @}
+ * @}
+ * @}
+ */
+
+//#include "types.h"
+
+/*
+
+
+#define NUMBER_OF_OFDM_CARRIERS (frame_parms->ofdm_symbol_size)
+#define NUMBER_OF_SYMBOLS_PER_FRAME (frame_parms->symbols_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)
+#define NUMBER_OF_USEFUL_CARRIERS (12*frame_parms->N_RB_DL)
+#define NUMBER_OF_ZERO_CARRIERS (NUMBER_OF_OFDM_CARRIERS-NUMBER_OF_USEFUL_CARRIERS)
+#define NUMBER_OF_USEFUL_CARRIERS_BYTES (NUMBER_OF_USEFUL_CARRIERS>>2)
+#define HALF_NUMBER_OF_USEFUL_CARRIERS (NUMBER_OF_USEFUL_CARRIERS>>1)
+#define HALF_NUMBER_OF_USEFUL_CARRIERS_BYTES (HALF_NUMBER_OF_USEFUL_CARRIERS>>2)
+#define FIRST_CARRIER_OFFSET (HALF_NUMBER_OF_USEFUL_CARRIERS+NUMBER_OF_ZERO_CARRIERS)
+#define NUMBER_OF_OFDM_SYMBOLS_PER_SLOT (NUMBER_OF_SYMBOLS_PER_FRAME/LTE_SLOTS_PER_FRAME)
+
+#ifdef EMOS
+#define EMOS_SCH_INDEX 1
+#endif //EMOS
+
+#define EXTENSION_TYPE (PHY_config->PHY_framing.Extension_type)
+
+#define NUMBER_OF_OFDM_CARRIERS_BYTES   NUMBER_OF_OFDM_CARRIERS*4
+//#define NUMBER_OF_USEFUL_CARRIERS_BYTES NUMBER_OF_USEFUL_CARRIERS*4
+#define HALF_NUMBER_OF_USER_CARRIERS_BYTES NUMBER_OF_USEFUL_CARRIERS/2
+
+#define CYCLIC_PREFIX_LENGTH (frame_parms->nb_prefix_samples)
+#define CYCLIC_PREFIX_LENGTH_SAMPLES (CYCLIC_PREFIX_LENGTH*2)
+#define CYCLIC_PREFIX_LENGTH_BYTES (CYCLIC_PREFIX_LENGTH*4)
+#define CYCLIC_PREFIX_LENGTH0 (frame_parms->nb_prefix_samples0)
+#define CYCLIC_PREFIX_LENGTH_SAMPLES0 (CYCLIC_PREFIX_LENGTH0*2)
+#define CYCLIC_PREFIX_LENGTH_BYTES0 (CYCLIC_PREFIX_LENGTH0*4)
+
+#define OFDM_SYMBOL_SIZE_SAMPLES ((NUMBER_OF_OFDM_CARRIERS + CYCLIC_PREFIX_LENGTH)*2)   // 16-bit units (i.e. real samples)
+#define OFDM_SYMBOL_SIZE_SAMPLES0 ((NUMBER_OF_OFDM_CARRIERS + CYCLIC_PREFIX_LENGTH0)*2)   // 16-bit units (i.e. real samples)
+#define OFDM_SYMBOL_SIZE_SAMPLES_MAX 4096   // 16-bit units (i.e. real samples)
+#define OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES (OFDM_SYMBOL_SIZE_SAMPLES/2)                   // 32-bit units (i.e. complex samples)
+#define OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0 (OFDM_SYMBOL_SIZE_SAMPLES0/2)                   // 32-bit units (i.e. complex samples)
+#define OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX ((NUMBER_OF_OFDM_CARRIERS)*2)
+#define OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX (OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX/2)
+#define OFDM_SYMBOL_SIZE_BYTES (OFDM_SYMBOL_SIZE_SAMPLES*2)
+#define OFDM_SYMBOL_SIZE_BYTES0 (OFDM_SYMBOL_SIZE_SAMPLES0*2)
+#define OFDM_SYMBOL_SIZE_BYTES_NO_PREFIX (OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX*2)
+
+#define SLOT_LENGTH_BYTES (frame_parms->samples_per_tti<<1) // 4 bytes * samples_per_tti/2
+#define SLOT_LENGTH_BYTES_NO_PREFIX (OFDM_SYMBOL_SIZE_BYTES_NO_PREFIX * NUMBER_OF_OFDM_SYMBOLS_PER_SLOT)
+
+#define FRAME_LENGTH_COMPLEX_SAMPLES (frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)
+#define FRAME_LENGTH_SAMPLES (FRAME_LENGTH_COMPLEX_SAMPLES*2)
+#define FRAME_LENGTH_SAMPLES_NO_PREFIX (NUMBER_OF_SYMBOLS_PER_FRAME*OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX)
+#define FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX (FRAME_LENGTH_SAMPLES_NO_PREFIX/2)
+
+#define NUMBER_OF_CARRIERS_PER_GROUP (NUMBER_OF_USEFUL_CARRIERS/NUMBER_OF_FREQUENCY_GROUPS)
+
+#define RX_PRECISION (16)
+#define LOG2_RX_PRECISION (4)
+#define RX_OUTPUT_SHIFT (4)
+
+
+#define SAMPLE_SIZE_BYTES    2                                           // 2 bytes/real sample
+
+#define FRAME_LENGTH_BYTES   (FRAME_LENGTH_SAMPLES * SAMPLE_SIZE_BYTES)  // frame size in bytes
+#define FRAME_LENGTH_BYTES_NO_PREFIX   (FRAME_LENGTH_SAMPLES_NO_PREFIX * SAMPLE_SIZE_BYTES)  // frame size in bytes
+
+
+#define FFT_SCALE_FACTOR     8                                           // Internal Scaling for FFT
+#define DMA_BLKS_PER_SLOT    (SLOT_LENGTH_BYTES/2048)                    // Number of DMA blocks per slot
+#define SLOT_TIME_NS         (SLOT_LENGTH_SAMPLES*(1e3)/7.68)            // slot time in ns
+
+#define NB_ANTENNA_PORTS_ENB  6                                         // total number of eNB antenna ports
+
+#ifdef EXMIMO
+#define TARGET_RX_POWER 55    // Target digital power for the AGC
+#define TARGET_RX_POWER_MAX 55    // Maximum digital power, such that signal does not saturate (value found by simulation)
+#define TARGET_RX_POWER_MIN 50    // Minimum digital power, anything below will be discarded (value found by simulation)
+#else
+#define TARGET_RX_POWER 50    // Target digital power for the AGC
+#define TARGET_RX_POWER_MAX 65    // Maximum digital power, such that signal does not saturate (value found by simulation)
+#define TARGET_RX_POWER_MIN 35    // Minimum digital power, anything below will be discarded (value found by simulation)
+#endif
+
+//the min and max gains have to match the calibrated gain table
+//#define MAX_RF_GAIN 160
+//#define MIN_RF_GAIN 96
+#define MAX_RF_GAIN 200
+#define MIN_RF_GAIN 80
+
+#define PHY_SYNCH_OFFSET ((OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)-1)  // OFFSET of BEACON SYNCH
+#define PHY_SYNCH_MIN_POWER 1000
+#define PHY_SYNCH_THRESHOLD 100
+
+*/
+
+#define ONE_OVER_SQRT2_Q15_NB_IoT 23170
+
+/*
+#define ONE_OVER_2_Q15 16384
+
+// QAM amplitude definitions
+
+/// First Amplitude for QAM16 (\f$ 2^{15} \times 2/\sqrt{10}\f$)
+#define QAM16_n1 20724
+/// Second Amplitude for QAM16 (\f$ 2^{15} \times 1/\sqrt{10}\f$)
+#define QAM16_n2 10362
+
+///First Amplitude for QAM64 (\f$ 2^{15} \times 4/\sqrt{42}\f$)
+#define QAM64_n1 20225
+///Second Amplitude for QAM64 (\f$ 2^{15} \times 2/\sqrt{42}\f$)
+#define QAM64_n2 10112
+///Third Amplitude for QAM64 (\f$ 2^{15} \times 1/\sqrt{42}\f$)
+#define QAM64_n3 5056
+
+/// First Amplitude for QAM16 for TM5 (\f$ 2^{15} \times 2/sqrt(20)\f$)
+#define QAM16_TM5_n1 14654
+/// Second Amplitude for QAM16 for TM5 Receiver (\f$ 2^{15} \times 1/\sqrt{20}\f$)
+#define QAM16_TM5_n2 7327
+
+///First Amplitude for QAM64 (\f$ 2^{15} \times 4/\sqrt{84}\f$)
+#define QAM64_TM5_n1 14301
+///Second Amplitude for QAM64 (\f$ 2^{15} \times 2/\sqrt{84}\f$)
+#define QAM64_TM5_n2 7150
+///Third Amplitude for QAM64 for TM5 Receiver (\f$ 2^{15} \times 1/\sqrt{84}\f$)
+#define QAM64_TM5_n3 3575
+
+
+#ifdef BIT8_RXMUX
+#define PERROR_SHIFT 0
+#else
+#define PERROR_SHIFT 10
+#endif
+
+#define BIT8_TX_SHIFT 2
+#define BIT8_TX_SHIFT_DB 12
+
+//#define CHBCH_RSSI_MIN -75
+
+#ifdef BIT8_TX
+#define AMP 128
+#else
+#define AMP 512//1024 //4096
+#endif
+
+#define AMP_OVER_SQRT2 ((AMP*ONE_OVER_SQRT2_Q15)>>15)
+#define AMP_OVER_2 (AMP>>1)
+
+/// Threshold for PUCCH Format 1 detection
+#define PUCCH1_THRES 0
+/// Threshold for PUCCH Format 1a/1b detection
+#define PUCCH1a_THRES 4
+
+/// Data structure for transmission.
+typedef struct {
+  /// RAW TX sample buffer
+  char *TX_DMA_BUFFER[2];
+} TX_VARS ;
+
+/// Data structure for reception.
+typedef struct {
+  /// RAW TX sample buffer
+  char *TX_DMA_BUFFER[2];
+  /// RAW RX sample buffer
+  int *RX_DMA_BUFFER[2];
+} TX_RX_VARS;
+
+//! \brief Extension Type /
+typedef enum {
+  CYCLIC_PREFIX,
+  CYCLIC_SUFFIX,
+  ZEROS,
+  NONE
+} Extension_t;
+	
+/// Measurement Variables
+*/
+#define NUMBER_OF_SUBBANDS_MAX_NB_IoT 13
+/*
+#define NUMBER_OF_HARQ_PID_MAX 8
+
+#define MAX_FRAME_NUMBER 0x400
+#include "openairinterface5g_limits.h"
+
+#define NUMBER_OF_RN_MAX 3
+typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_relay} relaying_type_t;
+
+typedef struct {
+  //unsigned int   rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];     //! estimated received signal power (linear)
+  //unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];  //! estimated received signal power (dB)
+  //unsigned short rx_avg_power_dB[NUMBER_OF_CONNECTED_eNB_MAX];              //! estimated avg received signal power (dB)
+
+  // RRC measurements
+  uint32_t rssi;
+  int n_adj_cells;
+  unsigned int adj_cell_id[6];
+  uint32_t rsrq[7];
+  uint32_t rsrp[7];
+  float rsrp_filtered[7]; // after layer 3 filtering
+  float rsrq_filtered[7];
+  // common measurements
+  //! estimated noise power (linear)
+  unsigned int   n0_power[NB_ANTENNAS_RX];
+  //! estimated noise power (dB)
+  unsigned short n0_power_dB[NB_ANTENNAS_RX];
+  //! total estimated noise power (linear)
+  unsigned int   n0_power_tot;
+  //! total estimated noise power (dB)
+  unsigned short n0_power_tot_dB;
+  //! average estimated noise power (linear)
+  unsigned int   n0_power_avg;
+  //! average estimated noise power (dB)
+  unsigned short n0_power_avg_dB;
+  //! total estimated noise power (dBm)
+  short n0_power_tot_dBm;
+
+  // UE measurements
+  //! estimated received spatial signal power (linear)
+  int            rx_spatial_power[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
+  //! estimated received spatial signal power (dB)
+  unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
+
+  /// estimated received signal power (sum over all TX antennas)
+  //int            wideband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  int            rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  /// estimated received signal power (sum over all TX antennas)
+  //int            wideband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+
+  /// estimated received signal power (sum over all TX/RX antennas)
+  int            rx_power_tot[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
+  /// estimated received signal power (sum over all TX/RX antennas)
+  unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
+
+  //! estimated received signal power (sum of all TX/RX antennas, time average)
+  int            rx_power_avg[NUMBER_OF_CONNECTED_eNB_MAX];
+  //! estimated received signal power (sum of all TX/RX antennas, time average, in dB)
+  unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// SINR (sum of all TX/RX antennas, in dB)
+  int            wideband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// SINR (sum of all TX/RX antennas, time average, in dB)
+  int            wideband_cqi_avg[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  //! estimated rssi (dBm)
+  short          rx_rssi_dBm[NUMBER_OF_CONNECTED_eNB_MAX];
+  //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
+  int            rx_correlation[NUMBER_OF_CONNECTED_eNB_MAX][2];
+  //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
+  int            rx_correlation_dB[NUMBER_OF_CONNECTED_eNB_MAX][2];
+
+  /// Wideband CQI (sum of all RX antennas, in dB, for precoded transmission modes (3,4,5,6), up to 4 spatial streams)
+  int            precoded_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX+1][4];
+  /// Subband CQI per RX antenna (= SINR)
+  int            subband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
+  /// Total Subband CQI  (= SINR)
+  int            subband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
+  /// Subband CQI in dB (= SINR dB)
+  int            subband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
+  /// Total Subband CQI
+  int            subband_cqi_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
+  /// Wideband PMI for each RX antenna
+  int            wideband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  /// Wideband PMI for each RX antenna
+  int            wideband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  ///Subband PMI for each RX antenna
+  int            subband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
+  ///Subband PMI for each RX antenna
+  int            subband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
+  /// chosen RX antennas (1=Rx antenna 1, 2=Rx antenna 2, 3=both Rx antennas)
+  unsigned char           selected_rx_antennas[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
+  /// Wideband Rank indication
+  unsigned char  rank[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// Number of RX Antennas
+  unsigned char  nb_antennas_rx;
+  /// DLSCH error counter
+  // short          dlsch_errors;
+
+} PHY_MEASUREMENTS;
+*/
+typedef enum {no_relay_NB_IoT=1,unicast_relay_type1_NB_IoT,unicast_relay_type2_NB_IoT, multicast_relay_NB_IoT} relaying_type_t_NB_IoT;
+typedef struct {
+  //unsigned int   rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];     //! estimated received signal power (linear)
+  //unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];  //! estimated received signal power (dB)
+  //unsigned short rx_avg_power_dB[NUMBER_OF_CONNECTED_eNB_MAX];              //! estimated avg received signal power (dB)
+
+  // RRC measurements
+  uint32_t rssi;
+  int n_adj_cells;
+  unsigned int adj_cell_id[6];
+  uint32_t rsrq[7];
+  uint32_t rsrp[7];
+  float rsrp_filtered[7]; // after layer 3 filtering
+  float rsrq_filtered[7];
+  // common measurements
+  //! estimated noise power (linear)
+  unsigned int   n0_power[NB_ANTENNAS_RX];
+  //! estimated noise power (dB)
+  unsigned short n0_power_dB[NB_ANTENNAS_RX];
+  //! total estimated noise power (linear)
+  unsigned int   n0_power_tot;
+  //! total estimated noise power (dB)
+  unsigned short n0_power_tot_dB;
+  //! average estimated noise power (linear)
+  unsigned int   n0_power_avg;
+  //! average estimated noise power (dB)
+  unsigned short n0_power_avg_dB;
+  //! total estimated noise power (dBm)
+  short n0_power_tot_dBm;
+
+  // UE measurements
+  //! estimated received spatial signal power (linear)
+  int            rx_spatial_power[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
+  //! estimated received spatial signal power (dB)
+  unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
+
+  /// estimated received signal power (sum over all TX antennas)
+  //int            wideband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  int            rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  /// estimated received signal power (sum over all TX antennas)
+  //int            wideband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+
+  /// estimated received signal power (sum over all TX/RX antennas)
+  int            rx_power_tot[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
+  /// estimated received signal power (sum over all TX/RX antennas)
+  unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
+
+  //! estimated received signal power (sum of all TX/RX antennas, time average)
+  int            rx_power_avg[NUMBER_OF_CONNECTED_eNB_MAX];
+  //! estimated received signal power (sum of all TX/RX antennas, time average, in dB)
+  unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  /// SINR (sum of all TX/RX antennas, in dB)
+  int            wideband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// SINR (sum of all TX/RX antennas, time average, in dB)
+  int            wideband_cqi_avg[NUMBER_OF_CONNECTED_eNB_MAX];
+
+  //! estimated rssi (dBm)
+  short          rx_rssi_dBm[NUMBER_OF_CONNECTED_eNB_MAX];
+  //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
+  int            rx_correlation[NUMBER_OF_CONNECTED_eNB_MAX][2];
+  //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
+  int            rx_correlation_dB[NUMBER_OF_CONNECTED_eNB_MAX][2];
+
+  /// Wideband CQI (sum of all RX antennas, in dB, for precoded transmission modes (3,4,5,6), up to 4 spatial streams)
+  int            precoded_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX+1][4];
+  /// Subband CQI per RX antenna (= SINR)
+  int            subband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX_NB_IoT];
+  /// Total Subband CQI  (= SINR)
+  int            subband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX_NB_IoT];
+  /// Subband CQI in dB (= SINR dB)
+  int            subband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX_NB_IoT];
+  /// Total Subband CQI
+  int            subband_cqi_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX_NB_IoT];
+  /// Wideband PMI for each RX antenna
+  int            wideband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  /// Wideband PMI for each RX antenna
+  int            wideband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
+  ///Subband PMI for each RX antenna
+  int            subband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX_NB_IoT][NB_ANTENNAS_RX];
+  ///Subband PMI for each RX antenna
+  int            subband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX_NB_IoT][NB_ANTENNAS_RX];
+  /// chosen RX antennas (1=Rx antenna 1, 2=Rx antenna 2, 3=both Rx antennas)
+  unsigned char           selected_rx_antennas[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX_NB_IoT];
+  /// Wideband Rank indication
+  unsigned char  rank[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// Number of RX Antennas
+  unsigned char  nb_antennas_rx;
+  /// DLSCH error counter
+  // short          dlsch_errors;
+
+} PHY_MEASUREMENTS_NB_IoT;
+
+
+typedef struct {
+  //unsigned int   rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];     //! estimated received signal power (linear)
+  //unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];  //! estimated received signal power (dB)
+  //unsigned short rx_avg_power_dB[NUMBER_OF_CONNECTED_eNB_MAX];              //! estimated avg received signal power (dB)
+
+  // common measurements
+  //! estimated noise power (linear)
+  unsigned int   n0_power[NB_ANTENNAS_RX];
+  //! estimated noise power (dB)
+  unsigned short n0_power_dB[NB_ANTENNAS_RX];
+  //! total estimated noise power (linear)
+  unsigned int   n0_power_tot;
+  //! estimated avg noise power (dB)
+  unsigned short n0_power_tot_dB;
+  //! estimated avg noise power (dB)
+  short n0_power_tot_dBm;
+  //! estimated avg noise power per RB per RX ant (lin)
+  unsigned short n0_subband_power[NB_ANTENNAS_RX][100];
+  //! estimated avg noise power per RB per RX ant (dB)
+  unsigned short n0_subband_power_dB[NB_ANTENNAS_RX][100];
+  //! estimated avg noise power per RB (dB)
+  short n0_subband_power_tot_dB[100];
+  //! estimated avg noise power per RB (dBm)
+  short n0_subband_power_tot_dBm[100];
+  // eNB measurements (per user)
+  //! estimated received spatial signal power (linear)
+  unsigned int   rx_spatial_power[NUMBER_OF_UE_MAX_NB_IoT][2][2];
+  //! estimated received spatial signal power (dB)
+  unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX_NB_IoT][2][2];
+  //! estimated rssi (dBm)
+  short          rx_rssi_dBm[NUMBER_OF_UE_MAX_NB_IoT];
+  //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
+  int            rx_correlation[NUMBER_OF_UE_MAX_NB_IoT][2];
+  //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
+  int            rx_correlation_dB[NUMBER_OF_UE_MAX_NB_IoT][2];
+
+  /// Wideband CQI (= SINR)
+  int            wideband_cqi[NUMBER_OF_UE_MAX_NB_IoT][NB_ANTENNAS_RX];
+  /// Wideband CQI in dB (= SINR dB)
+  int            wideband_cqi_dB[NUMBER_OF_UE_MAX_NB_IoT][NB_ANTENNAS_RX];
+  /// Wideband CQI (sum of all RX antennas, in dB)
+  char           wideband_cqi_tot[NUMBER_OF_UE_MAX_NB_IoT];
+  /// Subband CQI per RX antenna and RB (= SINR)
+  int            subband_cqi[NUMBER_OF_UE_MAX_NB_IoT][NB_ANTENNAS_RX][100];
+  /// Total Subband CQI and RB (= SINR)
+  int            subband_cqi_tot[NUMBER_OF_UE_MAX_NB_IoT][100];
+  /// Subband CQI in dB and RB (= SINR dB)
+  int            subband_cqi_dB[NUMBER_OF_UE_MAX_NB_IoT][NB_ANTENNAS_RX][100];
+  /// Total Subband CQI and RB
+  int            subband_cqi_tot_dB[NUMBER_OF_UE_MAX_NB_IoT][100];
+
+} PHY_MEASUREMENTS_eNB_NB_IoT;
+/*
+#define MCS_COUNT 28
+#define MCS_TABLE_LENGTH_MAX 64
+*/
+#endif //__PHY_IMPLEMENTATION_DEFS_H__ 
+/**@} 
+*/
diff --git a/openair1/PHY/sse_intrin.h b/openair1/PHY/sse_intrin.h
index 8ae5de547a9f480a5b4795b6248123d460815d58..da4d1db846b30c24d927e4b6975c61296665ab34 100644
--- a/openair1/PHY/sse_intrin.h
+++ b/openair1/PHY/sse_intrin.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/PHY/types.h b/openair1/PHY/types.h
index 61cafaefa94b12a408723dbf1586b7548dacfbf8..c0a9af388cfcc02643e118851719e05364c60570 100644
--- a/openair1/PHY/types.h
+++ b/openair1/PHY/types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -22,11 +22,7 @@
 #ifndef __openair_TYPES_H__
 #define __openair_TYPES_H__
 
-#ifdef USER_MODE
 #include <stdint.h>
-#else
-#include <linux/types.h>
-#endif
 
 
 #endif /*__openair_TYPES_H__ */
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.h b/openair1/PHY/types_NB_IoT.h
similarity index 66%
rename from openair1/SIMULATION/ETH_TRANSPORT/pgm_link.h
rename to openair1/PHY/types_NB_IoT.h
index b444d123bc51b4ea632f6a62ce5780f6cdb02ac0..6735092583ce8916ac19ea4966e9dd6a55a30b38 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.h
+++ b/openair1/PHY/types_NB_IoT.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,20 +19,14 @@
  *      contact@openairinterface.org
  */
 
-#ifndef PGM_LINK_H_
-#define PGM_LINK_H_
-
-/* Define prototypes only if enabled */
-#if defined(ENABLE_PGM_TRANSPORT)
-void bypass_tx_nack(unsigned int frame, unsigned int next_slot);
-
-int pgm_oai_init(char *if_name);
-
-int pgm_recv_msg(int group, uint8_t *buffer, uint32_t length,
-                 unsigned int frame, unsigned int next_slot);
-
-int pgm_link_send_msg(int group, uint8_t *data, uint32_t len);
+#ifndef __openair_TYPES_NB_IOT_H__
+#define __openair_TYPES_NB_IOT_H__
 
+#ifdef USER_MODE
+#include <stdint.h>
+#else
+#include <linux/types.h>
 #endif
 
-#endif /* PGM_LINK_H_ */
+
+#endif /*__openair_TYPES_NB_IOT_H__ */
diff --git a/openair1/PHY/vars.h b/openair1/PHY/vars.h
index 7bdb072b967a6e6238b9e6902fff19870c2ddaec..e8f4e27de13e6c5c0c818b1a721981536f3f7b3b 100644
--- a/openair1/PHY/vars.h
+++ b/openair1/PHY/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -24,6 +24,7 @@
 
 #include "PHY/types.h"
 #include "PHY/defs.h"
+#include "common/ran_context.h"
 
 char* namepointer_chMag ;
 char fmageren_name2[512];
@@ -148,5 +149,5 @@ int16_t unscrambling_lut[65536*16] __attribute__((aligned(32)));
 /// lookup table for scrambling in TX
 uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
 
-
+uint8_t max_turbo_iterations=4;
 #endif /*__PHY_VARS_H__ */
diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h
index 785e34e3c4459a911953993a8e0a6b24f41d4cb8..3c232a82b755bc001c59f50d4de5a6433f47db3d 100644
--- a/openair1/SCHED/defs.h
+++ b/openair1/SCHED/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -208,11 +208,19 @@ void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,re
   @param phy_vars_eNB Pointer to eNB variables on which to act
   @param br_flag indicator for eMTC PRACH
 */
-void prach_procedures(PHY_VARS_eNB *eNB,
 #ifdef Rel14
-		      int br_flag
+void prach_procedures(PHY_VARS_eNB *eNB,
+		      int br_flag);
+#else
+void prach_procedures(PHY_VARS_eNB *eNB);
 #endif
-		      );
+
+/*! \brief Function to compute subframe Number(DL and S) as a function of Frame type and TDD Configuration
+  @param frame_parms Pointer to DL frame parameter descriptor
+  @returns Subframe Number (DL,S)
+*/
+int subframe_num(LTE_DL_FRAME_PARMS *frame_parms);
+
 /*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index.
   @param frame_parms Pointer to DL frame parameter descriptor
   @param subframe Subframe index
diff --git a/openair1/SCHED/extern.h b/openair1/SCHED/extern.h
index 2c5ac12ca554bd1220996a1f8e5d3b904e317adb..b1e8df67ef86a5bb11c9cf9bb2d5dd57374d2eee 100644
--- a/openair1/SCHED/extern.h
+++ b/openair1/SCHED/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -24,40 +24,6 @@
 #ifndef __SCHED_EXTERN_H__
 #define __SCHED_EXTERN_H__
 
-#ifndef USER_MODE
-#define __NO_VERSION__
-
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/types.h>
-
-#include <asm/io.h>
-#include <asm/bitops.h>
-
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-
-
-
-
-#ifdef RTAI_ENABLED
-#include <rtai.h>
-//#include <rtai_posix.h>
-#include <rtai_fifos.h>
-#include <rtai_sched.h>
-#include <rtai_sem.h>
-//#include "rt_compat.h"
-
-#else
-#include <unistd.h>
-#endif
-
-#endif  /* USER_MODE */
-
 #include "defs.h"
 //#include "dlc_engine.h"
 
@@ -71,11 +37,5 @@ extern int synch_wait_cnt;
 
 extern int16_t hundred_times_delta_TF[100];
 extern uint16_t hundred_times_log10_NPRB[100];
-/*
-#ifdef EMOS
-extern fifo_dump_emos_UE emos_dump_UE;
-extern fifo_dump_emos_eNB emos_dump_eNB;
-#endif
-*/
 
 #endif /*__SCHED_EXTERN_H__ */
diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c
index 11cd85d57d35af1c3614c37dfdb44cccc1be70e1..df01fad13622307d0c14c65fbd302744d23453e2 100644
--- a/openair1/SCHED/fapi_l1.c
+++ b/openair1/SCHED/fapi_l1.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -37,20 +37,33 @@
 #include "nfapi_interface.h"
 #include "fapi_l1.h"
 
+int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req);
+int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req);
+int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req);
+int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req);
+
+extern uint8_t nfapi_mode;
+
+
 void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,
+                             int frame, int subframe,
                              eNB_rxtx_proc_t *proc,
                              nfapi_dl_config_request_pdu_t *dl_config_pdu)
 {
-  int idx                         = proc->subframe_tx&1;
+  int idx                         = subframe&1;
   LTE_eNB_PDCCH *pdcch_vars       = &eNB->pdcch_vars[idx];
   nfapi_dl_config_dci_dl_pdu *pdu = &dl_config_pdu->dci_dl_pdu;
 
-  LOG_D(PHY,"Frame %d, Subframe %d: DCI processing\n",proc->frame_tx,proc->subframe_tx);
+  LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populating pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",frame,subframe, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci);
 
   // copy dci configuration into eNB structure
-  fill_dci_and_dlsch(eNB,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci],pdu);
+  fill_dci_and_dlsch(eNB,frame,subframe,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci],pdu);
+
+  LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populated pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",proc->frame_tx,proc->subframe_tx, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci);
 }
 
+#ifdef Rel14
+
 void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB,
                              eNB_rxtx_proc_t *proc,
                              nfapi_dl_config_request_pdu_t *dl_config_pdu)
@@ -65,26 +78,32 @@ void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB,
   fill_mdci_and_dlsch(eNB,proc,&mpdcch_vars->mdci_alloc[mpdcch_vars->num_dci],pdu);
 }
 
-void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
+#endif
+
+void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
                                   nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu)
 {
-  int idx                         = proc->subframe_tx&1;
+  int idx                         = subframe&1;
   LTE_eNB_PDCCH *pdcch_vars       = &eNB->pdcch_vars[idx];
+
+  //LOG_D(PHY,"%s() SFN/SF:%04d%d Before num_dci:%d\n", __FUNCTION__,frame,subframe,pdcch_vars->num_dci);
+
   // copy dci configuration in to eNB structure
-  fill_dci0(eNB,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->dci_pdu);
+  fill_dci0(eNB,frame,subframe,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->dci_pdu);
 }
 
-void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
+void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
                                  nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu)
 {
-  LTE_eNB_PHICH *phich           = &eNB->phich_vars[proc->subframe_tx&1];
+  LTE_eNB_PHICH *phich = &eNB->phich_vars[subframe&1];
 
   // copy dci configuration in to eNB structure
-  LOG_D(PHY,"Received HI PDU which value %d (rbstart %d,cshift %d)\n",
+  LOG_D(PHY,"Received HI PDU with value %d (rbstart %d,cshift %d)\n",
         hi_dci0_config_pdu->hi_pdu.hi_pdu_rel8.hi_value,
         hi_dci0_config_pdu->hi_pdu.hi_pdu_rel8.resource_block_start,
         hi_dci0_config_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms);
 
+  // DJP - TODO FIXME - transmission power ignored
   phich->config[phich->num_hi].hi       = hi_dci0_config_pdu->hi_pdu.hi_pdu_rel8.hi_value;
   phich->config[phich->num_hi].first_rb = hi_dci0_config_pdu->hi_pdu.hi_pdu_rel8.resource_block_start;
   phich->config[phich->num_hi].n_DMRS   = hi_dci0_config_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms;
@@ -100,7 +119,7 @@ void handle_nfapi_bch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
 
   AssertFatal(rel8->length == 3, "BCH PDU has length %d != 3\n",rel8->length);
 
-  LOG_D(PHY,"bch_pdu: %x,%x,%x\n",sdu[0],sdu[1],sdu[2]);
+  //LOG_D(PHY,"bch_pdu: %x,%x,%x\n",sdu[0],sdu[1],sdu[2]);
   eNB->pbch_pdu[0] = sdu[2];
   eNB->pbch_pdu[1] = sdu[1];
   eNB->pbch_pdu[2] = sdu[0];
@@ -119,7 +138,7 @@ extern uint32_t localRIV2alloc_LUT100_2[6000];
 extern uint32_t localRIV2alloc_LUT100_3[6000];
 #endif
 
-void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
+void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
                             nfapi_dl_config_request_pdu_t *dl_config_pdu,
                             uint8_t codeword_index,
                             uint8_t *sdu)
@@ -144,11 +163,25 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
   dlsch1 = eNB->dlsch[UE_id][1];
 
 #ifdef Rel14
-  if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[proc->subframe_tx] = 0;
+  if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[subframe] = 0;
 #endif
 
-  harq_pid        = dlsch0->harq_ids[proc->subframe_tx];
-  AssertFatal((harq_pid>=0) && (harq_pid<8),"harq_pid %d not in 0...7\n",harq_pid);
+  harq_pid        = dlsch0->harq_ids[subframe];
+  AssertFatal((harq_pid>=0) && (harq_pid<8),"harq_pid %d not in 0...7 frame:%d subframe:%d subframe(TX):%d rnti:%x UE_id:%d dlsch0[harq_ids:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d]\n",
+      harq_pid,
+      frame,subframe,
+      proc->subframe_tx,rel8->rnti,UE_id,
+      dlsch0->harq_ids[0],
+      dlsch0->harq_ids[1],
+      dlsch0->harq_ids[2],
+      dlsch0->harq_ids[3],
+      dlsch0->harq_ids[4],
+      dlsch0->harq_ids[5],
+      dlsch0->harq_ids[6],
+      dlsch0->harq_ids[7],
+      dlsch0->harq_ids[8],
+      dlsch0->harq_ids[9]
+      );
   dlsch0_harq     = dlsch0->harq_processes[harq_pid];
   dlsch1_harq     = dlsch1->harq_processes[harq_pid];
   AssertFatal(dlsch0_harq!=NULL,"dlsch_harq is null\n");
@@ -157,28 +190,29 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
   eNB->pdsch_config_dedicated[UE_id].p_a = rel8->pa;
 
   if (dlsch0->active){
-    computeRhoA_eNB(&eNB->pdsch_config_dedicated[UE_id], dlsch0,dlsch0_harq->dl_power_off, eNB->frame_parms.nb_antenna_ports_eNB);
-    computeRhoB_eNB(&eNB->pdsch_config_dedicated[UE_id],&(eNB->frame_parms.pdsch_config_common),eNB->frame_parms.nb_antenna_ports_eNB,dlsch0,dlsch0_harq->dl_power_off);
+    computeRhoA_eNB(rel8->pa, dlsch0,dlsch0_harq->dl_power_off, eNB->frame_parms.nb_antenna_ports_eNB);
+    computeRhoB_eNB(rel8->pa,eNB->frame_parms.pdsch_config_common.p_b,eNB->frame_parms.nb_antenna_ports_eNB,dlsch0,dlsch0_harq->dl_power_off);
   }
   if (dlsch1->active){
-    computeRhoA_eNB(&eNB->pdsch_config_dedicated[UE_id], dlsch1,dlsch1_harq->dl_power_off, eNB->frame_parms.nb_antenna_ports_eNB);
-    computeRhoB_eNB(&eNB->pdsch_config_dedicated[UE_id],&(eNB->frame_parms.pdsch_config_common),eNB->frame_parms.nb_antenna_ports_eNB,dlsch1,dlsch1_harq->dl_power_off);
+    computeRhoA_eNB(rel8->pa, dlsch1,dlsch1_harq->dl_power_off, eNB->frame_parms.nb_antenna_ports_eNB);
+    computeRhoB_eNB(rel8->pa,eNB->frame_parms.pdsch_config_common.p_b,eNB->frame_parms.nb_antenna_ports_eNB,dlsch1,dlsch1_harq->dl_power_off);
   }
 
-  dlsch0_harq->pdsch_start = eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols;
+  dlsch0_harq->pdsch_start = eNB->pdcch_vars[subframe & 1].num_pdcch_symbols;
 
   if (dlsch0_harq->round==0) {  //get pointer to SDU if this a new SDU
-    AssertFatal(sdu!=NULL,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d : sdu is null for pdu_index %d\n",
+    AssertFatal(sdu!=NULL,"NFAPI: SFN/SF:%04d%d proc:TX:[frame %d subframe %d]: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d : sdu is null for pdu_index %d dlsch0_harq[round:%d SFN/SF:%d%d pdu:%p mcs:%d ndi:%d pdschstart:%d]\n",
+                frame,subframe,
                 proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid,
-                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
-    if (rel8->rnti != 0xFFFF) LOG_D(PHY,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d\n",
-                                    proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid);
+                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index,dlsch0_harq->round,dlsch0_harq->frame,dlsch0_harq->subframe,dlsch0_harq->pdu,dlsch0_harq->mcs,dlsch0_harq->ndi,dlsch0_harq->pdsch_start);
+    if (rel8->rnti != 0xFFFF) LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:[frame %d, subframe %d]: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d\n",
+                                    frame,subframe,proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid);
     if (codeword_index == 0) dlsch0_harq->pdu                    = sdu;
     else                     dlsch1_harq->pdu                    = sdu;
   }
   else {
-    if (rel8->rnti != 0xFFFF) LOG_D(PHY,"NFAPI: frame %d, subframe %d: programming dlsch for round %d, rnti %x, UE_id %d, harq_pid %d\n",
-                                    proc->frame_tx,proc->subframe_tx,dlsch0_harq->round,
+    if (rel8->rnti != 0xFFFF) LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:[frame %d, subframe %d]: programming dlsch for round %d, rnti %x, UE_id %d, harq_pid %d\n",
+                                    frame,subframe,proc->frame_tx,proc->subframe_tx,dlsch0_harq->round,
                                     rel8->rnti,UE_id,harq_pid);
   }
 
@@ -190,8 +224,6 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
     dlsch0->Kmimo            = 1;
     dlsch0->Mdlharq          = 4;
     dlsch0->Nsoft            = 25344;
-    dlsch0->i0               = rel13->initial_transmission_sf_io;
-    dlsch0_harq->pdsch_start = rel10->pdsch_start;
 
     if (rel13->pdsch_payload_type == 0) dlsch0->sib1_br_flag=1;
 
@@ -233,10 +265,22 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
     dlsch0_harq->TBS                = rel8->length<<3;
     dlsch0_harq->Qm                 = rel8->modulation;
     dlsch0_harq->codeword           = 0;
+    dlsch0_harq->pdsch_start        = rel10->pdsch_start;
   }
-  else {
-    dlsch0->i0               = 0xFFFF;
-  }
+  dlsch0->i0               = rel13->initial_transmission_sf_io;
+#endif
+
+#ifdef Rel14
+  LOG_D(PHY,"dlsch->i0:%04x dlsch0_harq[pdsch_start:%d nb_rb:%d vrb_type:%d rvidx:%d Nl:%d mimo_mode:%d dl_power_off:%d round:%d status:%d TBS:%d Qm:%d codeword:%d rb_alloc:%d] rel8[length:%d]\n", 
+      dlsch0->i0, 
+      dlsch0_harq->pdsch_start, dlsch0_harq->nb_rb, dlsch0_harq->vrb_type, dlsch0_harq->rvidx, dlsch0_harq->Nl, dlsch0_harq->mimo_mode, dlsch0_harq->dl_power_off, dlsch0_harq->round, dlsch0_harq->status, dlsch0_harq->TBS, dlsch0_harq->Qm, dlsch0_harq->codeword, dlsch0_harq->rb_alloc[0],
+      rel8->length
+      );
+#else
+  LOG_D(PHY,"dlsch0_harq[pdsch_start:%d nb_rb:%d vrb_type:%d rvidx:%d Nl:%d mimo_mode:%d dl_power_off:%d round:%d status:%d TBS:%d Qm:%d codeword:%d rb_alloc:%d] rel8[length:%d]\n", 
+      dlsch0_harq->pdsch_start, dlsch0_harq->nb_rb, dlsch0_harq->vrb_type, dlsch0_harq->rvidx, dlsch0_harq->Nl, dlsch0_harq->mimo_mode, dlsch0_harq->dl_power_off, dlsch0_harq->round, dlsch0_harq->status, dlsch0_harq->TBS, dlsch0_harq->Qm, dlsch0_harq->codeword, dlsch0_harq->rb_alloc[0],
+      rel8->length
+      );
 #endif
 }
 
@@ -493,8 +537,7 @@ void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
   if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) {
     AssertFatal((UE_id = find_ulsch(ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0,
                 "No existing UE ULSCH for rnti %x\n",rel8->rnti);
-    LOG_D(PHY,"Applying UL config for UE %d, rnti %x for frame %d, subframe %d\n",
-          UE_id,rel8->rnti,frame,subframe);
+    LOG_D(PHY,"Applying UL config for UE %d, rnti %x for frame %d, subframe %d, modulation %d, rvidx %d\n", UE_id,rel8->rnti,frame,subframe,rel8->modulation_type,rel8->redundancy_version);
 
     fill_ulsch(eNB,&ul_config_pdu->ulsch_pdu,frame,subframe);
 
@@ -571,7 +614,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
   frame_t                   frame        = Sched_INFO->frame;
   sub_frame_t               subframe     = Sched_INFO->subframe;
   LTE_DL_FRAME_PARMS        *fp;
-  int                       ul_subframe;
+  uint8_t                   ul_subframe;
   int                       ul_frame;
   int                       harq_pid;
   LTE_UL_eNB_HARQ_t         *ulsch_harq;
@@ -580,18 +623,27 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
   AssertFatal(RC.eNB[Mod_id]!=NULL,"RC.eNB[%d] is null\n",Mod_id);
   AssertFatal(RC.eNB[Mod_id][CC_id]!=NULL,"RC.eNB[%d][%d] is null\n",Mod_id,CC_id);
 
+
+
   eNB         = RC.eNB[Mod_id][CC_id];
   fp          = &eNB->frame_parms;
   proc        = &eNB->proc.proc_rxtx[0];
+
+  /* TODO: check that following line is correct - in the meantime it is disabled */
+  //if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
+
   ul_subframe = pdcch_alloc2ul_subframe(fp,subframe);
   ul_frame    = pdcch_alloc2ul_frame(fp,frame,subframe);
 
-  AssertFatal(proc->subframe_tx == subframe, "Current subframe %d != NFAPI subframe %d\n",proc->subframe_tx,subframe);
-  AssertFatal(proc->frame_tx == frame, "Current frame %d != NFAPI frame %d\n",proc->frame_tx,frame);
+  // DJP - subframe assert will fail - not sure why yet
+  // DJP - AssertFatal(proc->subframe_tx == subframe, "Current subframe %d != NFAPI subframe %d\n",proc->subframe_tx,subframe);
+  // DJP - AssertFatal(proc->subframe_tx == subframe, "Current frame %d != NFAPI frame %d\n",proc->frame_tx,frame);
+
+  uint8_t number_pdcch_ofdm_symbols = DL_req->dl_config_request_body.number_pdcch_ofdm_symbols;
 
   uint8_t number_dl_pdu             = DL_req->dl_config_request_body.number_pdu;
   uint8_t number_hi_dci0_pdu        = HI_DCI0_req->hi_dci0_request_body.number_of_dci+HI_DCI0_req->hi_dci0_request_body.number_of_hi;
-  uint8_t number_ul_pdu             = UL_req->ul_config_request_body.number_of_pdus;
+  uint8_t number_ul_pdu             = UL_req!=NULL ? UL_req->ul_config_request_body.number_of_pdus : 0;
 
   nfapi_dl_config_request_pdu_t *dl_config_pdu;
   nfapi_hi_dci0_request_pdu_t   *hi_dci0_req_pdu;
@@ -599,16 +651,26 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
 
   int i;
 
-  eNB->pdcch_vars[subframe&1].num_pdcch_symbols = DL_req->dl_config_request_body.number_pdcch_ofdm_symbols;
+  eNB->pdcch_vars[subframe&1].num_pdcch_symbols = number_pdcch_ofdm_symbols;
   eNB->pdcch_vars[subframe&1].num_dci           = 0;
   eNB->phich_vars[subframe&1].num_hi            = 0;
 
-  LOG_D(PHY,"NFAPI: Frame %d, Subframe %d: received %d dl_pdu, %d tx_req, %d hi_dci0_config_req, %d UL_config \n",
-        frame,subframe,number_dl_pdu,TX_req->tx_request_body.number_of_pdus,number_hi_dci0_pdu,number_ul_pdu);
-
-
-  if ((subframe_select(fp,ul_subframe)==SF_UL) ||
-      (fp->frame_type == FDD)) {
+  LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SF:%04d%d DL_req:SFN/SF:%04d%d:dl_pdu:%d tx_req:SFN/SF:%04d%d:pdus:%d hi_dci0:SFN/SF:%04d%d:pdus:%d ul_cfg:SFN/SF:%04d%d:pdus:%d num_pdcch_symbols:%d\n",
+        frame,subframe,
+        NFAPI_SFNSF2SFN(DL_req->sfn_sf),NFAPI_SFNSF2SF(DL_req->sfn_sf),number_dl_pdu,
+        NFAPI_SFNSF2SFN(TX_req->sfn_sf),NFAPI_SFNSF2SF(TX_req->sfn_sf),TX_req->tx_request_body.number_of_pdus,
+        NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),number_hi_dci0_pdu,
+        NFAPI_SFNSF2SFN(UL_req->sfn_sf),NFAPI_SFNSF2SF(UL_req->sfn_sf),number_ul_pdu, 
+        eNB->pdcch_vars[subframe&1].num_pdcch_symbols);
+
+  int do_oai =0;
+  int dont_send =0;
+  /* TODO: check the following test - in the meantime it is put back as it was before */
+  //if ((ul_subframe<10)&&
+  //    (subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is an ul_subframe that can be configured here
+  if (ul_subframe<10) { // This means that there is an ul_subframe that can be configured here
+    LOG_D(PHY,"NFAPI: Clearing dci allocations for potential UL subframe %d\n",ul_subframe);
+  
     harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe);
 
     // clear DCI allocation maps for new subframe
@@ -623,11 +685,13 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
   }
   for (i=0;i<number_dl_pdu;i++) {
     dl_config_pdu = &DL_req->dl_config_request_body.dl_config_pdu_list[i];
-    LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_config_pdu->pdu_type);
+    //LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_config_pdu->pdu_type);
     switch (dl_config_pdu->pdu_type) {
     case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
-      handle_nfapi_dci_dl_pdu(eNB,proc,dl_config_pdu);
-      eNB->pdcch_vars[subframe&1].num_dci++;
+      handle_nfapi_dci_dl_pdu(eNB,NFAPI_SFNSF2SFN(DL_req->sfn_sf),NFAPI_SFNSF2SF(DL_req->sfn_sf),proc,dl_config_pdu);
+      eNB->pdcch_vars[NFAPI_SFNSF2SF(DL_req->sfn_sf)&1].num_dci++;
+      //LOG_E(PHY,"Incremented num_dci:%d but already set??? dl_config:num_dci:%d\n", eNB->pdcch_vars[subframe&1].num_dci, number_dci);
+      do_oai=1;
       break;
     case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
       AssertFatal(dl_config_pdu->bch_pdu.bch_pdu_rel8.pdu_index<TX_req->tx_request_body.number_of_pdus,
@@ -635,6 +699,11 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
                   dl_config_pdu->bch_pdu.bch_pdu_rel8.pdu_index,
                   TX_req->tx_request_body.number_of_pdus);
       eNB->pbch_configured=1;
+      do_oai=1;
+      //LOG_D(PHY,"%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE TX:%d/%d RX:%d/%d TXREQ:%d/%d\n", 
+          //__FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, NFAPI_SFNSF2SFN(TX_req->sfn_sf), NFAPI_SFNSF2SF(TX_req->sfn_sf));
+
+
       handle_nfapi_bch_pdu(eNB,proc,dl_config_pdu,
                            TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->bch_pdu.bch_pdu_rel8.pdu_index].segments[0].segment_data);
       break;
@@ -642,22 +711,48 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
       //      handle_nfapi_mch_dl_pdu(eNB,dl_config_pdu);
       break;
     case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
+      {
+        nfapi_dl_config_dlsch_pdu_rel8_t *dlsch_pdu_rel8 = &dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8;
+        uint16_t pdu_index = dlsch_pdu_rel8->pdu_index;
+        uint16_t tx_pdus = TX_req->tx_request_body.number_of_pdus;
+        uint16_t invalid_pdu = pdu_index == -1;
+        uint8_t *sdu = invalid_pdu ? NULL : pdu_index >= tx_pdus ? NULL : TX_req->tx_request_body.tx_pdu_list[pdu_index].segments[0].segment_data;
+
+        LOG_D(PHY,"%s() [PDU:%d] NFAPI_DL_CONFIG_DLSCH_PDU_TYPE SFN/SF:%04d%d TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d sdu:%p\n", 
+            __FUNCTION__, i, 
+            NFAPI_SFNSF2SFN(DL_req->sfn_sf),NFAPI_SFNSF2SF(DL_req->sfn_sf),
+            proc->frame_tx, proc->subframe_tx, 
+            proc->frame_rx, proc->subframe_rx, 
+            dlsch_pdu_rel8->transport_blocks, pdu_index, sdu);
+
       /*
       AssertFatal(dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index<TX_req->tx_request_body.number_of_pdus,
                   "dlsch_pdu_rel8.pdu_index>=TX_req->number_of_pdus (%d>%d)\n",
                   dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index,
                   TX_req->tx_request_body.number_of_pdus);
       */
-      AssertFatal((dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks<3) &&
-                  (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks>0),
-                  "dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = %d not in [1,2]\n",
-                  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks);
-      handle_nfapi_dlsch_pdu(eNB,proc,dl_config_pdu,
-                             dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks-1,
-                             dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index == -1 ? NULL
-                               : TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data);
+      AssertFatal((dlsch_pdu_rel8->transport_blocks<3) &&
+                  (dlsch_pdu_rel8->transport_blocks>0),
+                  "dlsch_pdu_rel8->transport_blocks = %d not in [1,2]\n",
+                  dlsch_pdu_rel8->transport_blocks);
+      if (1)//sdu != NULL)
+      {
+        handle_nfapi_dlsch_pdu(eNB,NFAPI_SFNSF2SFN(DL_req->sfn_sf),NFAPI_SFNSF2SF(DL_req->sfn_sf),proc,dl_config_pdu, dlsch_pdu_rel8->transport_blocks-1, sdu);
+      }
+      else
+      {
+        dont_send=1;
+
+        LOG_E(MAC,"%s() NFAPI_DL_CONFIG_DLSCH_PDU_TYPE sdu is NULL DL_CFG:SFN/SF:%d:pdu_index:%d TX_REQ:SFN/SF:%d:pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(DL_req->sfn_sf), pdu_index, NFAPI_SFNSF2DEC(TX_req->sfn_sf), tx_pdus);
+      }
+
+      // Send the data first so that the DL_CONFIG can just pluck it out of the buffer
+      // DJP - OAI was here - moved to bottom
+      do_oai=1;
+
       /*
       if (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti == eNB->preamble_list[0].preamble_rel8.rnti) {// is RAR pdu
+
         LOG_D(PHY,"Frame %d, Subframe %d: Received LTE RAR pdu, programming based on UL Grant\n",frame,subframe);
         generate_eNB_ulsch_params_from_rar(eNB,
                                            TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data,
@@ -665,6 +760,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
                                            subframe);
 
                                            }        */
+      }
       break;
     case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
       //      handle_nfapi_pch_pdu(eNB,dl_config_pdu);
@@ -678,12 +774,28 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
     case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
       //      handle_nfapi_epdcch_pdu(eNB,dl_config_pdu);
       break;
+#ifdef Rel14
     case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
+#ifdef Rel14
       handle_nfapi_mpdcch_pdu(eNB,proc,dl_config_pdu);
       eNB->mpdcch_vars[subframe&1].num_dci++;
+#endif
       break;
+#endif    
     }
   }
+  
+  if (nfapi_mode && do_oai && !dont_send) {
+    oai_nfapi_tx_req(Sched_INFO->TX_req);
+
+    oai_nfapi_dl_config_req(Sched_INFO->DL_req); // DJP - .dl_config_request_body.dl_config_pdu_list[0]); // DJP - FIXME TODO - yuk - only copes with 1 pdu
+  }
+
+  if (nfapi_mode && number_hi_dci0_pdu!=0) {
+    oai_nfapi_hi_dci0_req(HI_DCI0_req);
+    eNB->pdcch_vars[NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf)&1].num_dci=0;
+    eNB->pdcch_vars[NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf)&1].num_pdcch_symbols=0;
+  }
 
   for (i=0;i<number_hi_dci0_pdu;i++) {
 
@@ -693,31 +805,42 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
 
     switch (hi_dci0_req_pdu->pdu_type) {
 
+      case NFAPI_HI_DCI0_DCI_PDU_TYPE:
 
-    case NFAPI_HI_DCI0_DCI_PDU_TYPE:
-      handle_nfapi_hi_dci0_dci_pdu(eNB,proc,hi_dci0_req_pdu);
-      eNB->pdcch_vars[subframe&1].num_dci++;
-      break;
+        handle_nfapi_hi_dci0_dci_pdu(eNB,NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),proc,hi_dci0_req_pdu);
 
-    case NFAPI_HI_DCI0_HI_PDU_TYPE:
-      handle_nfapi_hi_dci0_hi_pdu(eNB,proc,hi_dci0_req_pdu);
+        eNB->pdcch_vars[NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf)&1].num_dci++;
+        break;
 
-      break;
+      case NFAPI_HI_DCI0_HI_PDU_TYPE:
+        handle_nfapi_hi_dci0_hi_pdu(eNB,NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),proc,hi_dci0_req_pdu);
+        break;
     }
   }
 
-  for (i=0;i<number_ul_pdu;i++) {
-    ul_config_pdu = &UL_req->ul_config_request_body.ul_config_pdu_list[i];
-    LOG_D(PHY,"NFAPI: ul_pdu %d : type %d\n",i,ul_config_pdu->pdu_type);
-    AssertFatal(ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE ||
-                ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE ||
-                ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE ||
-                ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE ||
-                ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE ||
-                ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE ||
-                ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE
-                ,
-                "Optional UL_PDU type %d not supported\n",ul_config_pdu->pdu_type);
-    handle_nfapi_ul_pdu(eNB,proc,ul_config_pdu,UL_req->sfn_sf>>4,UL_req->sfn_sf&0xf,UL_req->ul_config_request_body.srs_present);
+  if (nfapi_mode) {
+    if (number_ul_pdu>0)
+    {
+      //LOG_D(PHY, "UL_CONFIG to send to PNF\n");
+      oai_nfapi_ul_config_req(UL_req);
+      UL_req->ul_config_request_body.number_of_pdus=0;
+      number_ul_pdu=0;
+    }
+  }
+  else {
+    for (i=0;i<number_ul_pdu;i++) {
+      ul_config_pdu = &UL_req->ul_config_request_body.ul_config_pdu_list[i];
+      LOG_D(PHY,"NFAPI: ul_pdu %d : type %d\n",i,ul_config_pdu->pdu_type);
+      AssertFatal(ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE ||
+          ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE ||
+          ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE ||
+          ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE ||
+          ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE ||
+          ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE ||
+          ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE
+          ,
+          "Optional UL_PDU type %d not supported\n",ul_config_pdu->pdu_type);
+      handle_nfapi_ul_pdu(eNB,proc,ul_config_pdu,UL_req->sfn_sf>>4,UL_req->sfn_sf&0xf,UL_req->ul_config_request_body.srs_present);
+    }
   }
 }
diff --git a/openair1/SCHED/fapi_l1.h b/openair1/SCHED/fapi_l1.h
index 3f4267c7f2139061ecb7bde4f05774b49b503a10..f04e8581dba863b9ede033cae45810df1ede99ea 100644
--- a/openair1/SCHED/fapi_l1.h
+++ b/openair1/SCHED/fapi_l1.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -42,13 +42,13 @@ void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe
 void fill_sr_indication(PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,uint32_t stat);
 void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe);
 void fill_crc_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t crc_flag);
-void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_dl_config_request_pdu_t *dl_config_pdu);
+void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,nfapi_dl_config_request_pdu_t *dl_config_pdu);
 void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_dl_config_request_pdu_t *dl_config_pdu);
-void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
+void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
 				  nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu);
-void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
+void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
 				 nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu);
-void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,  
+void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
 			    nfapi_dl_config_request_pdu_t *dl_config_pdu,
 			    uint8_t codeword_index,
 			    uint8_t *sdu);
diff --git a/openair1/SCHED/phy_mac_stub.c b/openair1/SCHED/phy_mac_stub.c
index 835066748dabecbc7f4b87a578ec5a2686675b6b..664791f7c459632d51541e413ef844384e6c8ab1 100644
--- a/openair1/SCHED/phy_mac_stub.c
+++ b/openair1/SCHED/phy_mac_stub.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,10 +36,6 @@
 #include "SCHED/extern.h"
 #include "LAYER2/MAC/extern.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
-
 /* SYRTEM */
 uint8_t dci_ndi_toggle_even[8] = {0, 0, 0, 0, 0, 0, 0, 0};
 uint8_t dci_ndi_toggle_odd[8]  = {0, 0, 0, 0, 0, 0, 0, 0};
@@ -733,181 +729,3 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
   }
   */
 }
-
-void fill_dci_emos(DCI_PDU *DCI_pdu, uint8_t subframe, PHY_VARS_eNB *eNB)
-{
-
-  //uint8_t cooperation_flag = eNB->cooperation_flag;
-  uint8_t transmission_mode = eNB->transmission_mode[0];
-
-  //uint32_t rballoc = 0x00F0;
-  //uint32_t rballoc2 = 0x000F;
-  /*
-    uint32_t rand = taus();
-    if ((subframe==8) || (subframe==9) || (subframe==0))
-    rand = (rand%5)+5;
-    else
-    rand = (rand%4)+5;
-  */
-
-  DCI_pdu->Num_dci = 0;
-
-  switch (subframe) {
-  case 5:
-    DCI_pdu->Num_dci = 1;
-
-    if (transmission_mode<3) {
-      //user 1
-      DCI_pdu->dci_alloc[0].dci_length   = sizeof_DCI1_5MHz_TDD_t;
-      DCI_pdu->dci_alloc[0].L            = 2;
-      DCI_pdu->dci_alloc[0].rnti         = 0x1235;
-      DCI_pdu->dci_alloc[0].format       = format1;
-      DCI_pdu->dci_alloc[0].ra_flag      = 0;
-      DCI_pdu->dci_alloc[0].search_space = DCI_UE_SPACE;
-
-      DLSCH_alloc_pdu.rballoc          = eNB->ue_dl_rb_alloc;
-      DLSCH_alloc_pdu.TPC              = 0;
-      DLSCH_alloc_pdu.dai              = 0;
-      DLSCH_alloc_pdu.harq_pid         = 1;
-      DLSCH_alloc_pdu.mcs              = eNB->target_ue_dl_mcs;
-      DLSCH_alloc_pdu.ndi              = 1;
-      DLSCH_alloc_pdu.rv               = 0;
-      memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu,sizeof(DCI1_5MHz_TDD_t));
-
-      /*
-      //user2
-      DCI_pdu->dci_alloc[1].dci_length   = sizeof_DCI1_5MHz_TDD_t;
-      DCI_pdu->dci_alloc[1].L            = 2;
-      DCI_pdu->dci_alloc[1].rnti         = 0x1236;
-      DCI_pdu->dci_alloc[1].format       = format1;
-      DCI_pdu->dci_alloc[1].ra_flag      = 0;
-      DCI_pdu->dci_alloc[1].search_space = DCI_UE_SPACE;
-
-      DLSCH_alloc_pdu.rballoc          = rballoc2;
-      DLSCH_alloc_pdu.TPC              = 0;
-      DLSCH_alloc_pdu.dai              = 0;
-      DLSCH_alloc_pdu.harq_pid         = 1;
-      DLSCH_alloc_pdu.mcs              = eNB->target_ue_dl_mcs;
-      DLSCH_alloc_pdu.ndi              = 1;
-      DLSCH_alloc_pdu.rv               = 0;
-      memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu,sizeof(DCI1_5MHz_TDD_t));
-      */
-    } else if (transmission_mode==5) {
-      DCI_pdu->Num_dci = 2;
-      // user 1
-      DCI_pdu->dci_alloc[0].dci_length   = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
-      DCI_pdu->dci_alloc[0].L            = 2;
-      DCI_pdu->dci_alloc[0].rnti         = 0x1235;
-      DCI_pdu->dci_alloc[0].format       = format1E_2A_M10PRB;
-      DCI_pdu->dci_alloc[0].ra_flag      = 0;
-      DCI_pdu->dci_alloc[0].search_space = DCI_UE_SPACE;
-
-      DLSCH_alloc_pdu1E.tpmi             = 5; //5=use feedback
-      DLSCH_alloc_pdu1E.rv               = 0;
-      DLSCH_alloc_pdu1E.ndi              = 1;
-      DLSCH_alloc_pdu1E.mcs              = eNB->target_ue_dl_mcs;
-      DLSCH_alloc_pdu1E.harq_pid         = 1;
-      DLSCH_alloc_pdu1E.dai              = 0;
-      DLSCH_alloc_pdu1E.TPC              = 0;
-      DLSCH_alloc_pdu1E.rballoc          = eNB->ue_dl_rb_alloc;
-      DLSCH_alloc_pdu1E.rah              = 0;
-      DLSCH_alloc_pdu1E.dl_power_off     = 0; //0=second user present
-      memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
-
-      //user 2
-      DCI_pdu->dci_alloc[1].dci_length   = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
-      DCI_pdu->dci_alloc[1].L            = 2;
-      DCI_pdu->dci_alloc[1].rnti         = 0x1236;
-      DCI_pdu->dci_alloc[1].format       = format1E_2A_M10PRB;
-      DCI_pdu->dci_alloc[1].ra_flag      = 0;
-      DCI_pdu->dci_alloc[1].search_space = DCI_UE_SPACE;
-
-      memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
-
-      // set the precoder of the second UE orthogonal to the first
-      eNB->UE_stats[1].DL_pmi_single = (eNB->UE_stats[0].DL_pmi_single ^ 0x1555);
-    }
-
-    break;
-
-  case 7:
-    DCI_pdu->Num_dci = 1;
-    DCI_pdu->dci_alloc[0].dci_length   = sizeof_DCI1A_5MHz_TDD_1_6_t;
-    DCI_pdu->dci_alloc[0].L            = 2;
-    DCI_pdu->dci_alloc[0].rnti         = 0xbeef;
-    DCI_pdu->dci_alloc[0].format       = format1A;
-    DCI_pdu->dci_alloc[0].ra_flag      = 1;
-    DCI_pdu->dci_alloc[0].search_space = DCI_COMMON_SPACE;
-
-    RA_alloc_pdu.type                = 1;
-    RA_alloc_pdu.vrb_type            = 0;
-    RA_alloc_pdu.rballoc             = computeRIV(25,12,3);
-    RA_alloc_pdu.ndi      = 1;
-    RA_alloc_pdu.rv       = 1;
-    RA_alloc_pdu.mcs      = 4;
-    RA_alloc_pdu.harq_pid = 0;
-    RA_alloc_pdu.TPC      = 1;
-
-    memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&RA_alloc_pdu,sizeof(DCI1A_5MHz_TDD_1_6_t));
-    break;
-
-  case 9:
-    DCI_pdu->Num_dci = 1;
-
-    //user 1
-    DCI_pdu->dci_alloc[0].dci_length   = sizeof_DCI0_5MHz_TDD_1_6_t ;
-    DCI_pdu->dci_alloc[0].L            = 2;
-    DCI_pdu->dci_alloc[0].rnti         = 0x1235;
-    DCI_pdu->dci_alloc[0].format       = format0;
-    DCI_pdu->dci_alloc[0].ra_flag      = 0;
-    DCI_pdu->dci_alloc[0].search_space = DCI_UE_SPACE;
-
-    UL_alloc_pdu.type    = 0;
-    UL_alloc_pdu.hopping = 0;
-    UL_alloc_pdu.rballoc = computeRIV(25,0,eNB->ue_ul_nb_rb);
-    UL_alloc_pdu.mcs     = eNB->target_ue_ul_mcs;
-    UL_alloc_pdu.ndi     = 1;
-    UL_alloc_pdu.TPC     = 0;
-    UL_alloc_pdu.cshift  = 0;
-    UL_alloc_pdu.dai     = 0;
-    UL_alloc_pdu.cqi_req = 1;
-    memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
-
-    /*
-    //user 2
-    DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI0_5MHz_TDD_1_6_t ;
-    DCI_pdu->dci_alloc[1].L          = 2;
-    DCI_pdu->dci_alloc[1].rnti       = 0x1236;
-    DCI_pdu->dci_alloc[1].format     = format0;
-    DCI_pdu->dci_alloc[1].ra_flag    = 0;
-
-    UL_alloc_pdu.type    = 0;
-    UL_alloc_pdu.hopping = 0;
-    if (cooperation_flag==0)
-    UL_alloc_pdu.rballoc = computeRIV(25,2+eNB->ue_ul_nb_rb,eNB->ue_ul_nb_rb);
-    else
-    UL_alloc_pdu.rballoc = computeRIV(25,0,eNB->ue_ul_nb_rb);
-    UL_alloc_pdu.mcs     = eNB->target_ue_ul_mcs;
-    UL_alloc_pdu.ndi     = 1;
-    UL_alloc_pdu.TPC     = 0;
-    if ((cooperation_flag==0) || (cooperation_flag==1))
-    UL_alloc_pdu.cshift  = 0;
-    else
-    UL_alloc_pdu.cshift  = 1;
-    UL_alloc_pdu.dai     = 0;
-    UL_alloc_pdu.cqi_req = 1;
-    memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
-    */
-    break;
-
-  default:
-    break;
-  }
-  /*
-  DCI_pdu->nCCE = 0;
-
-  for (i=0; i<DCI_pdu->Num_dci; i++) {
-    DCI_pdu->nCCE += (1<<(DCI_pdu->dci_alloc[i].L));
-  }
-  */
-}
diff --git a/openair1/SCHED/phy_procedures_emos.h b/openair1/SCHED/phy_procedures_emos.h
deleted file mode 100644
index 567ec7ec80eb9e2778f6fe47cedc21f370b30632..0000000000000000000000000000000000000000
--- a/openair1/SCHED/phy_procedures_emos.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#ifndef __PHY_PROCEDURES_EMOS_H__
-#define __PHY_PROCEDURES_EMOS_H__
-
-/*
-#ifndef RTAI
-typedef uint64_t RTIME;
-#else
-*/
-#ifdef RTAI
-#include <rtai.h>
-#include <rtai_fifos.h>
-#endif
-
-//#include "PHY/TOOLS/defs.h"
-#include "PHY/defs.h"
-#define CHANSOUNDER_FIFO_SIZE 10485760 // 10 Mbytes FIFO
-//#define CHANSOUNDER_FIFO_SIZE 20971520  // 20 Mbytes FIFO
-#define CHANSOUNDER_FIFO_MINOR 4               // minor of the FIFO device - this is /dev/rtf3
-#define CHANSOUNDER_FIFO_DEV "/dev/rtf4"
-
-#define NUMBER_OF_OFDM_CARRIERS_EMOS 512 // the number of OFDM carriers used for channel sounding
-#define NUMBER_OF_USEFUL_CARRIERS_EMOS 300    // the number of OFDM carriers that contain data
-
-#define N_RB_UL_EMOS 25
-#define N_PILOTS_DL_EMOS 2  // ofdm symbols with pilots per slot
-#define N_PILOTS_UL_EMOS 2  // ofdm symbols with pilots per subframe
-#define N_SLOTS_DL_EMOS 2     // we take slots 14,15
-#define N_SUBFRAMES_UL_EMOS 1     // we take subframes 4
-#define NB_ANTENNAS_TX_EMOS 2
-#define NB_ANTENNAS_RX_EMOS 2
-
-struct fifo_dump_emos_struct_UE {
-  // RX
-  uint64_t              timestamp;              //! Timestamp of the receiver
-  unsigned int     frame_tx;               //! Framenumber of the TX (encoded in the BCH)
-  unsigned int     frame_rx;               //! Framenumber of the RX
-  UE_MODE_t        UE_mode;
-  PHY_MEASUREMENTS PHY_measurements;       //! Structure holding all PHY measurements (one for every slot)
-  unsigned int     pbch_errors;                        /// Total number of errors on PBCH
-  unsigned int     pbch_errors_last;                   /// Total number of errors on PBCH 100 frames ago
-  unsigned int     pbch_errors_conseq;                 /// Total number of consecutive errors on PBCH
-  unsigned int     pbch_fer;                           /// PBCH FER (in percent)
-  unsigned int     dlsch_errors;                       /// Total number of error on the DLSCH (data)
-  unsigned int     dlsch_errors_last;
-  unsigned int     dlsch_received;
-  unsigned int     dlsch_received_last;
-  unsigned int     dlsch_fer;
-  unsigned int     dlsch_cntl_errors;                  /// Total number of error on the DLSCH (control)
-  unsigned int     dlsch_ra_errors;                    /// Total number of error on the DLSCH (random access)
-  unsigned int     total_TBS;
-  unsigned int     total_TBS_last;
-  unsigned int     bitrate;
-  unsigned int     total_received_bits;
-  int              timing_offset;                      /// Timing offset
-  int              timing_advance;                     /// Timing advance
-  int              freq_offset;                        /// Frequency offset
-  int              use_ia_receiver;
-  unsigned short   pmi_saved;
-  unsigned short   mcs;
-  unsigned int     rx_total_gain_dB;                   /// Total gain
-  unsigned char    eNb_id;                             /// eNb_id UE is synched to
-  unsigned char    mimo_mode;                          /// Transmission mode
-#ifdef EMOS_CHANNEL
-  int              channel[NB_ANTENNAS_RX_EMOS][NB_ANTENNAS_TX_EMOS][NUMBER_OF_OFDM_CARRIERS_EMOS*N_PILOTS_DL_EMOS*N_SLOTS_DL_EMOS];
-#endif
-};
-
-typedef struct  fifo_dump_emos_struct_UE fifo_dump_emos_UE;
-
-
-struct fifo_dump_emos_struct_eNB {
-  // TX
-  uint64_t              timestamp;              //! Timestamp of the receiver
-  unsigned int     frame_tx;               //! Framenumber of the TX
-  unsigned char    mimo_mode;              /// Transmission mode
-  // RX
-  PHY_MEASUREMENTS_eNB PHY_measurements_eNB;            /// UL measurements
-  LTE_eNB_UE_stats eNB_UE_stats[NUMBER_OF_UE_MAX]; /// Contains received feedback
-  unsigned int     rx_total_gain_dB;       /// Total gain
-#ifdef EMOS_CHANNEL
-  int              channel[NB_ANTENNAS_RX_EMOS][N_RB_UL_EMOS*12*N_PILOTS_UL_EMOS*N_SUBFRAMES_UL_EMOS]; ///UL channel estimate
-#endif
-};
-
-typedef struct  fifo_dump_emos_struct_eNB fifo_dump_emos_eNB;
-
-#endif
diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c
index 66e43b6960d4249801ead781653113fa0d9bf180..bbb6986ce9c7c3ac375e79eb170e5c4c77b2ab72 100644
--- a/openair1/SCHED/phy_procedures_lte_common.c
+++ b/openair1/SCHED/phy_procedures_lte_common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -709,6 +709,26 @@ uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1)
     return(Np[0+plus1]);
 }
 
+int subframe_num(LTE_DL_FRAME_PARMS *frame_parms){
+    if (frame_parms->frame_type == FDD)
+        return 10;
+
+    switch (frame_parms->tdd_config) {
+    case 1:
+        return 6;
+    case 3:
+        return 7;
+    case 4:
+        return 8;
+    case 5:
+        return 9;
+    default:
+      LOG_E(PHY,"Unsupported TDD configuration %d\n",frame_parms->tdd_config);
+      AssertFatal(frame_parms->tdd_config==1 || frame_parms->tdd_config==3 || frame_parms->tdd_config==4 || frame_parms->tdd_config==5,"subframe x Unsupported TDD configuration");
+      return(255);
+    }
+}
+
 lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe)
 {
 
@@ -918,7 +938,7 @@ int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subf
   if(frame_parms->soundingrs_ul_config_common.enabled_flag)
   {
 
-    LOG_D(PHY," SRS SUBFRAMECONFIG: %d\n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig);
+    //LOG_D(PHY," SRS SUBFRAMECONFIG: %d\n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig);
 
       uint8_t  TSFC;
       uint16_t deltaTSFC; // bitmap
@@ -951,7 +971,7 @@ int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subf
       }
       LOG_D(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d.%d\n", frame_parms->frame_type, TSFC, deltaTSFC, frame_tx, subframe_tx);
   }
-  LOG_D(PHY," isSubframeSRS %d\n", isSubframeSRS);
+  //LOG_D(PHY," isSubframeSRS %d\n", isSubframeSRS);
   return(isSubframeSRS);
 }
 
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index c7d975d85fe2654cb4796043404493fe2108b242..b1927b1bd9409d690f35b8a45059e02c1b71456f 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -50,6 +50,8 @@
 #   include "intertask_interface.h"
 #endif
 
+extern uint8_t nfapi_mode;
+int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
 
 
 
@@ -137,15 +139,13 @@ void pmch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,PHY_VARS_RN *rn,rel
 #endif
 }
 
-void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
+void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
 
   LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
   int **txdataF = eNB->common_vars.txdataF;
   uint8_t *pbch_pdu=&eNB->pbch_pdu[0];
-  int subframe = proc->subframe_tx;
-  int frame = proc->frame_tx;
 
-  LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe); 
+  //LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d fdd:%s dir:%s\n",frame,subframe,fp->frame_type == FDD?"FDD":"TDD", subframe_select(fp,subframe) == SF_DL?"DL":"UL?"); 
 
   // generate Cell-Specific Reference Signals for both slots
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
@@ -196,7 +196,8 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
 
     /// generate PBCH
     if ((frame&3)==0) {
-      AssertFatal(eNB->pbch_configured==1,"PBCH was not configured by MAC\n");
+      //AssertFatal(eNB->pbch_configured==1,"PBCH was not configured by MAC\n");
+      if (eNB->pbch_configured!=1) return;
       eNB->pbch_configured=0;
     }
     generate_pbch(&eNB->pbch,
@@ -272,7 +273,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
 
   if (dlsch->rnti == 0x02) {//frame < 200) {
 
-    LOG_I(PHY,
+    LOG_D(PHY,
 	  "[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", pdsch_start %d, G %d, nb_rb %"PRIu16", rb0 %x, rb1 %x, TBS %"PRIu16", pmi_alloc %"PRIx64", rv %"PRIu8" (round %"PRIu8")\n",
 	  eNB->Mod_id, dlsch->rnti,harq_pid,
 	  frame, subframe, input_buffer_length, dlsch_harq->pdsch_start,
@@ -332,12 +333,19 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
   }
 
 
-  LOG_D(PHY,"Generating DLSCH/PDSCH %d\n",ra_flag);
+  LOG_D(PHY,"Generating DLSCH/PDSCH pdu:%p pdsch_start:%d frame:%d subframe:%d nb_rb:%d rb_alloc:%d Qm:%d Nl:%d round:%d\n",
+      dlsch_harq->pdu,dlsch_harq->pdsch_start,frame,subframe,dlsch_harq->nb_rb,dlsch_harq->rb_alloc[0],dlsch_harq->Qm,dlsch_harq->Nl,dlsch_harq->round);
   // 36-212 
-  start_meas(&eNB->dlsch_encoding_stats);
-  AssertFatal(dlsch_harq->pdu!=NULL,"dlsch_harq->pdu == NULL (rnti %x)\n",dlsch->rnti);
+  if (nfapi_mode == 0 || nfapi_mode == 1) { // monolthic OR PNF - do not need turbo encoding on VNF
+
+    if (dlsch_harq->pdu==NULL){
+        LOG_E(PHY,"dlsch_harq->pdu == NULL SFN/SF:%04d%d dlsch[rnti:%x] dlsch_harq[pdu:%p pdsch_start:%d Qm:%d Nl:%d round:%d nb_rb:%d rb_alloc[0]:%d]\n", frame,subframe,dlsch->rnti, dlsch_harq->pdu,dlsch_harq->pdsch_start,dlsch_harq->Qm,dlsch_harq->Nl,dlsch_harq->round,dlsch_harq->nb_rb,dlsch_harq->rb_alloc[0]);
+      return;
+    }
 
-  eNB->te(eNB,
+    start_meas(&eNB->dlsch_encoding_stats);
+
+    eNB->te(eNB,
 	  dlsch_harq->pdu,
 	  dlsch_harq->pdsch_start,
 	  dlsch,
@@ -350,30 +358,30 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
       &eNB->dlsch_turbo_encoding_wakeup_stats0,
       &eNB->dlsch_turbo_encoding_wakeup_stats1,
 	  &eNB->dlsch_interleaving_stats);
-  stop_meas(&eNB->dlsch_encoding_stats);
+    stop_meas(&eNB->dlsch_encoding_stats);
   // 36-211
-  start_meas(&eNB->dlsch_scrambling_stats);
-  dlsch_scrambling(fp,
-		   0,
-		   dlsch,
-		   harq_pid,
-		   get_G(fp,
-			 dlsch_harq->nb_rb,
-			 dlsch_harq->rb_alloc,
-			 dlsch_harq->Qm,
-			 dlsch_harq->Nl,
-			 dlsch_harq->pdsch_start,
-			 frame,subframe,
-			 0),
-		   0,
-		   frame,
-		   subframe<<1);
-  stop_meas(&eNB->dlsch_scrambling_stats);
-  
-  start_meas(&eNB->dlsch_modulation_stats);
-  
+    start_meas(&eNB->dlsch_scrambling_stats);
+    dlsch_scrambling(fp,
+        0,
+        dlsch,
+        harq_pid,
+        get_G(fp,
+          dlsch_harq->nb_rb,
+          dlsch_harq->rb_alloc,
+          dlsch_harq->Qm,
+          dlsch_harq->Nl,
+          dlsch_harq->pdsch_start,
+          frame,subframe,
+          0),
+        0,
+        frame,
+        subframe<<1);
+    stop_meas(&eNB->dlsch_scrambling_stats);
+
+    start_meas(&eNB->dlsch_modulation_stats);
+
   
-  dlsch_modulation(eNB,
+    dlsch_modulation(eNB,
 		   eNB->common_vars.txdataF,
 		   AMP,
 		   subframe,
@@ -381,14 +389,18 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
 		   dlsch,
 		   dlsch1);
   
-  stop_meas(&eNB->dlsch_modulation_stats);
+    stop_meas(&eNB->dlsch_modulation_stats);
+  }
 
   dlsch->active = 0;
   dlsch_harq->round++;
+
+  LOG_D(PHY,"Generating DLSCH/PDSCH dlsch_harq[round:%d]\n",dlsch_harq->round);
 }
 
 
 
+
 void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
 			   eNB_rxtx_proc_t *proc,
                            relaying_type_t r_type,
@@ -410,6 +422,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
 
   int offset = eNB->CC_id;//proc == &eNB->proc.proc_rxtx[0] ? 0 : 1;
 
+
   if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1);
@@ -422,14 +435,18 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
   }
   
 
-  if (is_pmch_subframe(frame,subframe,fp)) {
-    pmch_procedures(eNB,proc,rn,r_type);
-  }
-  else {
-    // this is not a pmch subframe, so generate PSS/SSS/PBCH
-    common_signal_procedures(eNB,proc);
+
+  if (nfapi_mode == 0 || nfapi_mode == 1) {
+    if (is_pmch_subframe(frame,subframe,fp)) {
+      pmch_procedures(eNB,proc,rn,r_type);
+    }
+    else {
+      // this is not a pmch subframe, so generate PSS/SSS/PBCH
+      common_signal_procedures(eNB,proc->frame_tx, proc->subframe_tx);
+    }
   }
 
+
   // clear existing ulsch dci allocations before applying info from MAC  (this is table
   ul_subframe = pdcch_alloc2ul_subframe(fp,subframe);
   ul_frame = pdcch_alloc2ul_frame(fp,frame,subframe);
@@ -443,33 +460,36 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
   }
 
   /* save old HARQ information needed for PHICH generation */
-  for (i=0; i<NUMBER_OF_UE_MAX; i++) {
-    harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe);
-    if (eNB->ulsch[i]) {
-      ulsch_harq = eNB->ulsch[i]->harq_processes[harq_pid];
-
-      /* Store first_rb and n_DMRS for correct PHICH generation below.
-       * For PHICH generation we need "old" values of last scheduling
-       * for this HARQ process. 'generate_eNB_dlsch_params' below will
-       * overwrite first_rb and n_DMRS and 'generate_phich_top', done
-       * after 'generate_eNB_dlsch_params', would use the "new" values
-       * instead of the "old" ones.
-       *
-       * This has been tested for FDD only, may be wrong for TDD.
-       *
-       * TODO: maybe we should restructure the code to be sure it
-       *       is done correctly. The main concern is if the code
-       *       changes and first_rb and n_DMRS are modified before
-       *       we reach here, then the PHICH processing will be wrong,
-       *       using wrong first_rb and n_DMRS values to compute
-       *       ngroup_PHICH and nseq_PHICH.
-       *
-       * TODO: check if that works with TDD.
-       */
-      if ((subframe_select(fp,ul_subframe)==SF_UL) ||
-          (fp->frame_type == FDD)) {
-        ulsch_harq->previous_first_rb = ulsch_harq->first_rb;
-        ulsch_harq->previous_n_DMRS   = ulsch_harq->n_DMRS;
+  /* TODO: check the following test - in the meantime it is put back as it was before */
+  //if ((ul_subframe < 10)&&
+  //    (subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is a potential UL subframe that will be scheduled here
+  if (ul_subframe < 10) { // This means that there is a potential UL subframe that will be scheduled here
+    for (i=0; i<NUMBER_OF_UE_MAX; i++) {
+      harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe);
+      if (eNB->ulsch[i]) {
+	ulsch_harq = eNB->ulsch[i]->harq_processes[harq_pid];
+	
+	/* Store first_rb and n_DMRS for correct PHICH generation below.
+	 * For PHICH generation we need "old" values of last scheduling
+	 * for this HARQ process. 'generate_eNB_dlsch_params' below will
+	 * overwrite first_rb and n_DMRS and 'generate_phich_top', done
+	 * after 'generate_eNB_dlsch_params', would use the "new" values
+	 * instead of the "old" ones.
+	 *
+	 * This has been tested for FDD only, may be wrong for TDD.
+	 *
+	 * TODO: maybe we should restructure the code to be sure it
+	 *       is done correctly. The main concern is if the code
+	 *       changes and first_rb and n_DMRS are modified before
+	 *       we reach here, then the PHICH processing will be wrong,
+	 *       using wrong first_rb and n_DMRS values to compute
+	 *       ngroup_PHICH and nseq_PHICH.
+	 *
+	 * TODO: check if that works with TDD.
+	 */
+	ulsch_harq->previous_first_rb = ulsch_harq->first_rb;
+	ulsch_harq->previous_n_DMRS   = ulsch_harq->n_DMRS;
+	
       }
     }
   }
@@ -481,30 +501,34 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
   num_dci           = eNB->pdcch_vars[subframe&1].num_dci;
   //  LOG_D(PHY,"num_pdcch_symbols %"PRIu8",(dci common %"PRIu8", dci uespec %"PRIu8"\n",num_pdcch_symbols,
   //        DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
-  LOG_D(PHY,"num_pdcch_symbols %"PRIu8",(number dci %"PRIu8"\n",num_pdcch_symbols,
-	num_dci);
+  LOG_D(PHY,"num_pdcch_symbols %"PRIu8",number dci %"PRIu8"\n",num_pdcch_symbols, num_dci);
   VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,num_pdcch_symbols);
 
 
   VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,(frame*10)+subframe);
 
   if (num_dci > 0)
-    LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (num_dci %"PRIu8")\n",eNB->Mod_id,frame, subframe,
-	  num_dci);
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,1);    
-  generate_dci_top(num_pdcch_symbols,
-		   num_dci,
-		   &eNB->pdcch_vars[subframe&1].dci_alloc[0],
-		   0,
-		   AMP,
-		   fp,
-		   eNB->common_vars.txdataF,
-		   subframe);
-  
+    LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (num_dci %"PRIu8") num_pdcch_symbols:%d\n",eNB->Mod_id,frame, subframe, num_dci, num_pdcch_symbols);
+
+  //LOG_D(PHY,"Before generate_dci_top num_pdcch_symbols:%d num_dci:%d dci_alloc:dci_length:%d\n", num_pdcch_symbols, num_dci, eNB->pdcch_vars[subframe&1].dci_alloc[0].dci_length);
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,1);
+
+  if (nfapi_mode == 0 || nfapi_mode == 1) {
+    generate_dci_top(num_pdcch_symbols,
+        num_dci,
+        &eNB->pdcch_vars[subframe&1].dci_alloc[0],
+        0,
+        AMP,
+        fp,
+        eNB->common_vars.txdataF,
+        subframe);
+  }
+
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
   // Now scan UE specific DLSCH
   LTE_eNB_DLSCH_t *dlsch0,*dlsch1;
   for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++)
@@ -518,36 +542,45 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
 
 	// get harq_pid
 	harq_pid = dlsch0->harq_ids[subframe];
-	if ((harq_pid>=0) && (harq_pid<8)) {
-	// generate pdsch
-	pdsch_procedures(eNB,
-			 proc,
-			 harq_pid,
-			 dlsch0,
-			 dlsch1,
-			 &eNB->UE_stats[(uint32_t)UE_id],
-			 0);
-	} else {
-	LOG_E(PHY,"harq_pid %d is not valid, not generating PDSCH\n",harq_pid);
-	}
+	AssertFatal(harq_pid>=0,"harq_pid is negative\n");
+
+        if (harq_pid>=8)
+        {
+          LOG_E(PHY,"harq_pid:%d corrupt must be 0-7 UE_id:%d frame:%d subframe:%d rnti:%x\n", harq_pid,UE_id,frame,subframe,dlsch0->rnti);
+        }
+        else
+        {
+          // generate pdsch
+          pdsch_procedures(eNB,
+              proc,
+              harq_pid,
+              dlsch0,
+              dlsch1,
+              &eNB->UE_stats[(uint32_t)UE_id],
+              0);
+        }
+
 
       }
 
 
       else if ((dlsch0)&&
-	       (dlsch0->rnti>0)&&
-	       (dlsch0->active == 0)) {
+          (dlsch0->rnti>0)&&
+          (dlsch0->active == 0)) {
 
-	// clear subframe TX flag since UE is not scheduled for PDSCH in this subframe (so that we don't look for PUCCH later)
-	dlsch0->subframe_tx[subframe]=0;
+        // clear subframe TX flag since UE is not scheduled for PDSCH in this subframe (so that we don't look for PUCCH later)
+        dlsch0->subframe_tx[subframe]=0;
       }
     }
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
 
 
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,1);
   generate_phich_top(eNB,
 		     proc,
 		     AMP);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,0);
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,0);
   if (do_meas==1) stop_meas(&eNB->phy_proc_tx);
@@ -555,179 +588,6 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
 }
 
 
-void prach_procedures(PHY_VARS_eNB *eNB,
-#ifdef Rel14
-		      int br_flag
-#endif
-		      ) {
-  uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
-  uint16_t i;
-  int frame,subframe;
-  LTE_eNB_PRACH *prach_vars=NULL;
-
-#ifdef Rel14
-  if (br_flag==1) {
-    subframe = eNB->proc.subframe_prach_br;
-    frame = eNB->proc.frame_prach_br;
-    pthread_mutex_lock(&eNB->UL_INFO_mutex);
-    eNB->UL_INFO.rach_ind_br.number_of_preambles=0;
-    pthread_mutex_unlock(&eNB->UL_INFO_mutex);
-  }
-  else
-#endif
-    {
-      pthread_mutex_lock(&eNB->UL_INFO_mutex);
-      eNB->UL_INFO.rach_ind.number_of_preambles=0;
-      pthread_mutex_unlock(&eNB->UL_INFO_mutex);
-      subframe = eNB->proc.subframe_prach;
-      frame = eNB->proc.frame_prach;
-    }
-  RU_t *ru;
-  int aa=0;
-  int ru_aa;
-
- 
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
-
-
-
-  for (i=0;i<eNB->num_RU;i++) {
-    ru=eNB->RU_list[i];
-    for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
-      eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[ru_aa];
-#ifdef Rel14
-      int ce_level;
-
-      if (br_flag==1)
-	for (ce_level=0;ce_level<4;ce_level++) eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[i]->prach_rxsigF_br[ce_level][ru_aa];
-#endif
-    }
-  }
-
-  rx_prach(eNB,
-	   eNB->RU_list[0],
-	   &max_preamble[0],
-	   &max_preamble_energy[0],
-	   &max_preamble_delay[0],
-	   frame,
-	   0
-#ifdef Rel14
-	   ,br_flag
-#endif
-	   );
-
-  //#ifdef DEBUG_PHY_PROC
-  LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d\n",
-        frame,subframe,
-	max_preamble[0],
-        max_preamble_energy[0]/10,
-        max_preamble_delay[0]);
-  //q#endif
-
-#ifdef Rel14
-  if (br_flag==1) {
-
-    prach_vars = &eNB->prach_vars_br;
-    int prach_mask;
-      
-    prach_mask = is_prach_subframe(&eNB->frame_parms,eNB->proc.frame_prach_br,eNB->proc.subframe_prach_br);
-    
-    eNB->UL_INFO.rach_ind_br.preamble_list                              = eNB->preamble_list_br;
-    int ind=0;
-    int ce_level=0;
-    /* Save for later, it doesn't work    
-    for (int ind=0,ce_level=0;ce_level<4;ce_level++) {
-      
-      if ((eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[ce_level]==1)&&
-	  (prach_mask&(1<<(1+ce_level)) > 0) && // prach is active and CE level has finished its repetitions
-	  (eNB->prach_vars_br.repetition_number[ce_level]==
-	   eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level])) {
-    */ 
-    if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]==1){ 
-      if (max_preamble_energy[0] > 350) {
-	eNB->UL_INFO.rach_ind_br.number_of_preambles++;
-	
-	eNB->preamble_list_br[ind].preamble_rel8.timing_advance        = max_preamble_delay[ind];//
-	eNB->preamble_list_br[ind].preamble_rel8.preamble              = max_preamble[ind];
-	// note: fid is implicitly 0 here, this is the rule for eMTC RA-RNTI from 36.321, Section 5.1.4
-	eNB->preamble_list_br[ind].preamble_rel8.rnti                  = 1+subframe+(eNB->prach_vars_br.first_frame[ce_level]%40);  
-	eNB->preamble_list_br[ind].instance_length                     = 0; //don't know exactly what this is
-	eNB->preamble_list_br[ind].preamble_rel13.rach_resource_type   = 1+ce_level;  // CE Level
-	LOG_D(PHY,"Filling NFAPI indication for RACH %d CELevel %d (mask %x) : TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
-	      ind,
-	      ce_level,
-	      prach_mask,
-	      eNB->preamble_list_br[ind].preamble_rel8.timing_advance,
-	      eNB->preamble_list_br[ind].preamble_rel8.preamble,
-	      eNB->preamble_list_br[ind].preamble_rel8.rnti,
-	      eNB->preamble_list_br[ind].preamble_rel13.rach_resource_type);
-      }
-      /*
-	ind++;
-      }
-      } */// ce_level
-    }
-  }
-  else
-#endif
-
-    {
-      if (max_preamble_energy[0] > 350) {
-
-	LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
-	      eNB->Mod_id,
-	      eNB->CC_id,
-	      frame,
-	      subframe,
-	      max_preamble[0],
-	      max_preamble_energy[0]/10,
-	      max_preamble_energy[0]%10,
-	      max_preamble_delay[0]);
-	
-	    T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
-	      T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
-	    
-	    prach_vars = &eNB->prach_vars;
-	    
-	    
-	    pthread_mutex_lock(&eNB->UL_INFO_mutex);
-	    
-	    eNB->UL_INFO.rach_ind.number_of_preambles                 = 1;
-	    eNB->UL_INFO.rach_ind.preamble_list                       = eNB->preamble_list;
-	    
-	    eNB->preamble_list[0].preamble_rel8.timing_advance        = max_preamble_delay[0];
-	    eNB->preamble_list[0].preamble_rel8.preamble              = max_preamble[0];
-	    eNB->preamble_list[0].preamble_rel8.rnti                  = 1+subframe;  // note: fid is implicitly 0 here
-	    eNB->preamble_list[0].preamble_rel13.rach_resource_type   = 0;
-	    eNB->preamble_list[0].instance_length                     = 0; //don't know exactly what this is
-	    
-	    LOG_D(PHY,"Filling NFAPI indication for RACH : TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
-		  eNB->preamble_list[0].preamble_rel8.timing_advance,
-		  eNB->preamble_list[0].preamble_rel8.preamble,
-		  eNB->preamble_list[0].preamble_rel8.rnti,
-		  eNB->preamble_list[0].preamble_rel13.rach_resource_type);	    
-	    pthread_mutex_unlock(&eNB->UL_INFO_mutex);
-      
-      } // max_preamble_energy > 350
-    } // else br_flag
-      /*
-	mac_xface->initiate_ra_proc(eNB->Mod_id,
-	eNB->CC_id,
-	frame,
-	preamble_max,
-	preamble_delay_list[preamble_max]*update_TA/update_TA2,
-	0,subframe,0);*/
-      
-    
-    /*  } else {
-    MSC_LOG_EVENT(MSC_PHY_ENB, "0 RA Failed add user, too many");
-    LOG_I(PHY,"[eNB %d][RAPROC] frame %d, subframe %d: Unable to add user, max user count reached\n",
-	  eNB->Mod_id,frame, subframe);
-	  }*/
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
-}
-
 void srs_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
 
   LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
@@ -763,21 +623,31 @@ void srs_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
 void fill_sr_indication(PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,uint32_t stat) {
   
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
-  nfapi_sr_indication_pdu_t *pdu =   &eNB->UL_INFO.sr_ind.sr_pdu_list[eNB->UL_INFO.sr_ind.number_of_srs];
+  nfapi_sr_indication_t       *sr_ind =         &eNB->UL_INFO.sr_ind;
+  nfapi_sr_indication_body_t  *sr_ind_body =    &sr_ind->sr_indication_body;
+  nfapi_sr_indication_pdu_t *pdu =   &sr_ind_body->sr_pdu_list[sr_ind_body->number_of_srs];
+
+  sr_ind->sfn_sf = frame<<4|subframe;
+  sr_ind->header.message_id = NFAPI_RX_SR_INDICATION;
+
+  sr_ind_body->tl.tag = NFAPI_SR_INDICATION_BODY_TAG;
 
   pdu->instance_length                                = 0; // don't know what to do with this
   //  pdu->rx_ue_information.handle                       = handle;
+  pdu->rx_ue_information.tl.tag                       = NFAPI_RX_UE_INFORMATION_TAG;
   pdu->rx_ue_information.rnti                         = rnti;
 
   int SNRtimes10 = dB_fixed_times10(stat) - 200;//(10*eNB->measurements.n0_power_dB[0]);
 
 
+  pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
+
   if      (SNRtimes10 < -640) pdu->ul_cqi_information.ul_cqi=0;
   else if (SNRtimes10 >  635) pdu->ul_cqi_information.ul_cqi=255;
   else                        pdu->ul_cqi_information.ul_cqi=(640+SNRtimes10)/5;
   pdu->ul_cqi_information.channel = 0;
 
-  eNB->UL_INFO.sr_ind.number_of_srs++;
+  sr_ind_body->number_of_srs++;
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);
 }
 
@@ -785,7 +655,7 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
 {
   LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
   uint8_t SR_payload = 0,pucch_b0b1[4][2]= {{0,0},{0,0},{0,0},{0,0}},harq_ack[4]={0,0,0,0};
-  int32_t metric[4]={0,0,0,0},metric_SR=0,max_metric;
+  int32_t metric[4]={0,0,0,0},metric_SR=0,max_metric=0;
   const int subframe = proc->subframe_rx;
   const int frame = proc->frame_rx;
   int i;
@@ -855,10 +725,10 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
 	if (uci->type == SR) {
 	  if (SR_payload == 1) {
 	    fill_sr_indication(eNB,uci->rnti,frame,subframe,metric_SR);
-	    return;
+        continue;
 	  }
 	  else {
-	    return;
+        continue;
 	  }
 	}
       case HARQ:
@@ -1032,7 +902,7 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
 	      harq_ack[0] = 4; // DTX
 	      harq_ack[1] = 6; // NACK/DTX
 	      harq_ack[2] = 6; // NACK/DTX
-	      
+              max_metric = 0;
 	    } 
 	    else {
 	      
@@ -1103,7 +973,7 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
 		}
 	      }
             uci->stat = max_metric;
-            fill_uci_harq_indication(eNB,uci,frame,subframe,harq_ack,1,tdd_multiplexing_mask); // multiplexing mode
+	    fill_uci_harq_indication(eNB,uci,frame,subframe,harq_ack,1,tdd_multiplexing_mask); // multiplexing mode
 	    }
 	  } //else if ((uci->tdd_bundling == 0) && (res==3)) 
 	  else if ((uci->tdd_bundling == 0) && (uci->num_pucch_resources==4)){ // multiplexing + no SR, implement Table 10.1.3-7 (Rel14) for multiplexing with M=4
@@ -1115,7 +985,7 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
 	      harq_ack[1] = 6; // NACK/DTX
 	      harq_ack[2] = 6; // NACK/DTX
 	      harq_ack[3] = 6; // NACK/DTX
-		
+              max_metric = 0;
 	    } else {
 
 	      max_metric = max(metric[0],max(metric[1],max(metric[2],metric[3])));
@@ -1291,78 +1161,74 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
 
   const int subframe = proc->subframe_rx;
   const int frame    = proc->frame_rx;
-
+  
   if (fp->frame_type == FDD) harq_pid = ((10*frame) + subframe)&7;
   else                       harq_pid = subframe%10;
 
   for (i=0; i<NUMBER_OF_UE_MAX; i++) {
     ulsch = eNB->ulsch[i];
     ulsch_harq = ulsch->harq_processes[harq_pid];
-    if (ulsch->rnti>0) LOG_D(PHY,"Frame %d, subframe %d: PUSCH procedures, harq_pid %d, UE %d/%x, status %d, harq_frame %d, harq_subframe %d ulsch_handled %d\n",
-                             frame,subframe,harq_pid,i,ulsch->rnti,ulsch_harq->status,ulsch_harq->frame,ulsch_harq->subframe, ulsch_harq->handled);
-
+    if (ulsch->rnti>0) LOG_D(PHY,"eNB->ulsch[%d]->harq_processes[harq_pid:%d] SFN/SF:%04d%d: PUSCH procedures, UE %d/%x ulsch_harq[status:%d SFN/SF:%04d%d handled:%d]\n",
+			     i, harq_pid, frame,subframe,i,ulsch->rnti,
+                             ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled);
+    
     if ((ulsch) &&
         (ulsch->rnti>0) &&
         (ulsch_harq->status == ACTIVE) &&
-            (ulsch_harq->frame == frame) &&
-            (ulsch_harq->subframe == subframe) &&
+	    (ulsch_harq->frame == frame) &&
+	    (ulsch_harq->subframe == subframe) &&
         (ulsch_harq->handled == 0)) {
-
+      
       // UE has ULSCH scheduling
       for (int rb=0;
            rb<=ulsch_harq->nb_rb;
-           rb++) {
-        int rb2 = rb+ulsch_harq->first_rb;
-        eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
+	   rb++) {
+	int rb2 = rb+ulsch_harq->first_rb;
+	eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
       }
 
-      LOG_D(PHY,"[eNB %d] frame %d, subframe %d: Scheduling ULSCH Reception for UE %d \n",
-            eNB->Mod_id,
-            frame,
-            subframe,
-            i);
+      LOG_D(PHY,"[eNB %d] frame %d, subframe %d: Scheduling ULSCH Reception for UE %d \n", eNB->Mod_id, frame, subframe, i);
 
       nPRS = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1];
 
       ulsch->cyclicShift = (ulsch_harq->n_DMRS2 +
-                            fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
-                            nPRS)%12;
+          fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
+          nPRS)%12;
 
       LOG_D(PHY,
-            "[eNB %d][PUSCH %d] Frame %d Subframe %d Demodulating PUSCH: dci_alloc %d, rar_alloc %d, round %d, first_rb %d, nb_rb %d, Qm %d, TBS %d, rv %d, cyclic_shift %d (n_DMRS2 %d, cyclicShift_common %d, nprs %d), O_ACK %d, beta_cqi %d \n",
-            eNB->Mod_id,harq_pid,frame,subframe,
-            ulsch_harq->dci_alloc,
-            ulsch_harq->rar_alloc,
-            ulsch_harq->round,
-            ulsch_harq->first_rb,
-            ulsch_harq->nb_rb,
-            ulsch_harq->Qm,
-            ulsch_harq->TBS,
-            ulsch_harq->rvidx,
-            ulsch->cyclicShift,
-            ulsch_harq->n_DMRS2,
-            fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift,
-            nPRS,
-            ulsch_harq->O_ACK,
-            ulsch->beta_offset_cqi_times8);
-
-      start_meas(&eNB->ulsch_demodulation_stats);
-
-      rx_ulsch(eNB,proc, i);
-
-      stop_meas(&eNB->ulsch_demodulation_stats);
-
-      start_meas(&eNB->ulsch_decoding_stats);
-
-      ret = ulsch_decoding(eNB,proc,
-                           i,
-                           0, // control_only_flag
-                           ulsch_harq->V_UL_DAI,
-                           ulsch_harq->nb_rb>20 ? 1 : 0);
+          "[eNB %d][PUSCH %d] Frame %d Subframe %d Demodulating PUSCH: dci_alloc %d, rar_alloc %d, round %d, first_rb %d, nb_rb %d, Qm %d, TBS %d, rv %d, cyclic_shift %d (n_DMRS2 %d, cyclicShift_common %d, ), O_ACK %d, beta_cqi %d \n",
+          eNB->Mod_id,harq_pid,frame,subframe,
+          ulsch_harq->dci_alloc,
+          ulsch_harq->rar_alloc,
+          ulsch_harq->round,
+          ulsch_harq->first_rb,
+          ulsch_harq->nb_rb,
+          ulsch_harq->Qm,
+          ulsch_harq->TBS,
+          ulsch_harq->rvidx,
+          ulsch->cyclicShift,
+          ulsch_harq->n_DMRS2,
+          fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift,
+          ulsch_harq->O_ACK,
+          ulsch->beta_offset_cqi_times8);
+
+        start_meas(&eNB->ulsch_demodulation_stats);
+
+	rx_ulsch(eNB,proc, i);
+
+        stop_meas(&eNB->ulsch_demodulation_stats);
+
+        start_meas(&eNB->ulsch_decoding_stats);
+
+        ret = ulsch_decoding(eNB,proc,
+            i,
+            0, // control_only_flag
+            ulsch_harq->V_UL_DAI,
+            ulsch_harq->nb_rb>20 ? 1 : 0);
 
-      stop_meas(&eNB->ulsch_decoding_stats);
+        stop_meas(&eNB->ulsch_decoding_stats);
 
-      LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
+        LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d ulsch_harq->cqi_crc_status:%d ackBits:%d ulsch_decoding_stats[t:%lld max:%lld]\n",
             eNB->Mod_id,harq_pid,
             frame,subframe,
             ulsch->rnti,
@@ -1372,51 +1238,55 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
             20,//eNB->measurements.n0_power_dB[1],
             ulsch_harq->o_ACK[0],
             ulsch_harq->o_ACK[1],
-            ret);
+            ret,
+            ulsch_harq->cqi_crc_status,
+            ulsch_harq->O_ACK,
+            eNB->ulsch_decoding_stats.diff_now, eNB->ulsch_decoding_stats.max);
 
-      //compute the expected ULSCH RX power (for the stats)
-      ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered
+        //compute the expected ULSCH RX power (for the stats)
+        ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered
 
-      if (ulsch_harq->cqi_crc_status == 1) {
+        if (ulsch_harq->cqi_crc_status == 1) {
 #ifdef DEBUG_PHY_PROC
-        //if (((frame%10) == 0) || (frame < 50))
-        print_CQI(ulsch_harq->o,ulsch_harq->uci_format,0,fp->N_RB_DL);
+          //if (((frame%10) == 0) || (frame < 50))
+          print_CQI(ulsch_harq->o,ulsch_harq->uci_format,0,fp->N_RB_DL);
 #endif
 
-        fill_ulsch_cqi_indication(eNB,frame,subframe,
-                                  ulsch_harq,
-                                  ulsch->rnti);
+	fill_ulsch_cqi_indication(eNB,frame,subframe,
+				  ulsch_harq,
+				  ulsch->rnti);
       }
-
+      
       if (ret == (1+MAX_TURBO_ITERATIONS)) {
         T(T_ENB_PHY_ULSCH_UE_NACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(ulsch->rnti),
           T_INT(harq_pid));
 
-        fill_crc_indication(eNB,i,frame,subframe,1); // indicate NAK to MAC
-        fill_rx_indication(eNB,i,frame,subframe);  // indicate SDU to MAC
+	fill_crc_indication(eNB,i,frame,subframe,1); // indicate NAK to MAC
+	fill_rx_indication(eNB,i,frame,subframe);  // indicate SDU to MAC
+
+	LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n",
+	      eNB->Mod_id,harq_pid,
+	      frame,subframe, i,
+	      ulsch_harq->round,
+	      ulsch->Mlimit,
+	      ulsch_harq->o_ACK[0],
+	      ulsch_harq->o_ACK[1]);
 
-        LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n",
-              eNB->Mod_id,harq_pid,
-              frame,subframe, i,
-              ulsch_harq->round-1,
-              ulsch->Mlimit,
-              ulsch_harq->o_ACK[0],
-              ulsch_harq->o_ACK[1]);
         if (ulsch_harq->round >= 3)  {
            ulsch_harq->status  = SCH_IDLE;
            ulsch_harq->handled = 0;
            ulsch->harq_mask   &= ~(1 << harq_pid);
            ulsch_harq->round   = 0;
-        } 
+	  }
 #if defined(MESSAGE_CHART_GENERATOR_PHY)
         MSC_LOG_RX_DISCARDED_MESSAGE(
-                                     MSC_PHY_ENB,MSC_PHY_UE,
-                                     NULL,0,
-                                     "%05u:%02u ULSCH received rnti %x harq id %u round %d",
-                                     frame,subframe,
-                                     ulsch->rnti,harq_pid,
-                                     ulsch_harq->round-1
-                                     );
+            MSC_PHY_ENB,MSC_PHY_UE,
+            NULL,0,
+            "%05u:%02u ULSCH received rnti %x harq id %u round %d",
+            frame,subframe,
+            ulsch->rnti,harq_pid,
+            ulsch_harq->round-1
+            );
 #endif
 
         /* Mark the HARQ process to release it later if max transmission reached
@@ -1427,8 +1297,8 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
         ulsch_harq->handled = 1;
       }  // ulsch in error
       else {
-        fill_crc_indication(eNB,i,frame,subframe,0); // indicate ACK to MAC
-        fill_rx_indication(eNB,i,frame,subframe);  // indicate SDU to MAC
+	fill_crc_indication(eNB,i,frame,subframe,0); // indicate ACK to MAC
+	fill_rx_indication(eNB,i,frame,subframe);  // indicate SDU to MAC
 
         ulsch_harq->status = SCH_IDLE;
         ulsch->harq_mask   &= ~(1 << harq_pid);
@@ -1437,27 +1307,27 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
           T_INT(harq_pid));
 
 #if defined(MESSAGE_CHART_GENERATOR_PHY)
-        MSC_LOG_RX_MESSAGE(
-                           MSC_PHY_ENB,MSC_PHY_UE,
-                           NULL,0,
-                           "%05u:%02u ULSCH received rnti %x harq id %u",
-                           frame,subframe,
-                           ulsch->rnti,harq_pid
-                           );
+          MSC_LOG_RX_MESSAGE(
+              MSC_PHY_ENB,MSC_PHY_UE,
+              NULL,0,
+              "%05u:%02u ULSCH received rnti %x harq id %u",
+              frame,subframe,
+              ulsch->rnti,harq_pid
+              );
 #endif
 
 #ifdef DEBUG_PHY_PROC
 #ifdef DEBUG_ULSCH
-        LOG_D(PHY,"[eNB] Frame %d, Subframe %d : ULSCH SDU (RX harq_pid %d) %d bytes:",frame,subframe,
-                harq_pid,ulsch_harq->TBS>>3);
+          LOG_D(PHY,"[eNB] Frame %d, Subframe %d : ULSCH SDU (RX harq_pid %d) %d bytes:",frame,subframe,
+              harq_pid,ulsch_harq->TBS>>3);
 
-        for (j=0; j<ulsch_harq->TBS>>3; j++)
-          LOG_T(PHY,"%x.",ulsch->harq_processes[harq_pid]->b[j]);
+          for (j=0; j<ulsch_harq->TBS>>3; j++)
+            LOG_T(PHY,"%x.",ulsch->harq_processes[harq_pid]->b[j]);
 
-        LOG_T(PHY,"\n");
+          LOG_T(PHY,"\n");
 #endif
 #endif
-      }  // ulsch not in error
+        }  // ulsch not in error
 
       if (ulsch_harq->O_ACK>0) fill_ulsch_harq_indication(eNB,ulsch_harq,ulsch->rnti,frame,subframe,ulsch->bundling);
 
@@ -1480,14 +1350,14 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
              (ulsch_harq->frame == frame) &&
              (ulsch_harq->subframe == subframe) &&
              (ulsch_harq->handled == 1)) {
-      // this harq process is stale, kill it, this 1024 frames later (10s), consider reducing that
-      ulsch_harq->status = SCH_IDLE;
+          // this harq process is stale, kill it, this 1024 frames later (10s), consider reducing that
+           ulsch_harq->status = SCH_IDLE;
       ulsch_harq->handled = 0;
       ulsch->harq_mask   &= ~(1 << harq_pid);
       LOG_W(PHY,"Removing stale ULSCH config for UE %x harq_pid %d (harq_mask is now 0x%2.2x)\n",
             ulsch->rnti, harq_pid, ulsch->harq_mask);
     }
-  }   //   for (i=0; i<NUMBER_OF_UE_MAX; i++) {
+  }   //   for (i=0; i<NUMBER_OF_UE_MAX; i++)
 }
 
 extern int oai_exit;
@@ -1559,19 +1429,25 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe)
   int sync_pos;
 
   uint32_t harq_pid = subframe2harq_pid(&eNB->frame_parms,
-                                        frame,subframe);
+					frame,subframe);
 
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
-  pdu                                    = &eNB->UL_INFO.rx_ind.rx_pdu_list[eNB->UL_INFO.rx_ind.number_of_pdus];
+
+  eNB->UL_INFO.rx_ind.sfn_sf                    = frame<<4| subframe;
+  eNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
+
+  pdu                                    = &eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
 
   //  pdu->rx_ue_information.handle          = eNB->ulsch[UE_id]->handle;
+  pdu->rx_ue_information.tl.tag          = NFAPI_RX_UE_INFORMATION_TAG;
   pdu->rx_ue_information.rnti            = eNB->ulsch[UE_id]->rnti;
+  pdu->rx_indication_rel8.tl.tag         = NFAPI_RX_INDICATION_REL8_TAG;
   pdu->rx_indication_rel8.length         = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3;
-  pdu->rx_indication_rel8.offset         = 0;  // filled in at the end of the UL_INFO formation
-  pdu->data                              = eNB->ulsch[UE_id]->harq_processes[harq_pid]->b;
+  pdu->rx_indication_rel8.offset         = 1;   // DJP - I dont understand - but broken unless 1 ????  0;  // filled in at the end of the UL_INFO formation
+  pdu->data                              = eNB->ulsch[UE_id]->harq_processes[harq_pid]->b;  
   // estimate timing advance for MAC
   sync_pos                               = lte_est_timing_advance_pusch(eNB,UE_id);
-  timing_advance_update                  = sync_pos - eNB->frame_parms.nb_prefix_samples/4; //to check
+  timing_advance_update                  = sync_pos; // - eNB->frame_parms.nb_prefix_samples/4; //to check
 
   //  if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);}
   //  if (timing_advance_update < -10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);}
@@ -1597,11 +1473,12 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe)
   else if (SNRtimes10 >  635) pdu->rx_indication_rel8.ul_cqi=255;
   else                        pdu->rx_indication_rel8.ul_cqi=(640+SNRtimes10)/5;
 
-  LOG_D(PHY,"[PUSCH %d] Filling RX_indication with SNR %d (%d), timing_advance %d (update %d)\n",
-        harq_pid,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,pdu->rx_indication_rel8.timing_advance,
-        timing_advance_update);
+  LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d), timing_advance %d (update %d)\n",
+	harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,pdu->rx_indication_rel8.timing_advance,
+	timing_advance_update);
 
-  eNB->UL_INFO.rx_ind.number_of_pdus++;
+  eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++;
+  eNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | subframe;
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);
 }
 
@@ -1696,11 +1573,13 @@ void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe
   nfapi_cqi_indication_pdu_t *pdu         = &eNB->UL_INFO.cqi_ind.cqi_pdu_list[eNB->UL_INFO.cqi_ind.number_of_cqis];
   nfapi_cqi_indication_raw_pdu_t *raw_pdu = &eNB->UL_INFO.cqi_ind.cqi_raw_pdu_list[eNB->UL_INFO.cqi_ind.number_of_cqis];
 
+  pdu->rx_ue_information.tl.tag          = NFAPI_RX_UE_INFORMATION_TAG;
   pdu->rx_ue_information.rnti = rnti;
   if (ulsch_harq->cqi_crc_status != 1) pdu->cqi_indication_rel9.data_offset = 0;
   else               pdu->cqi_indication_rel9.data_offset = 1; // fill in after all cqi_indications have been generated when non-zero
 
   // by default set O to rank 1 value
+  pdu->cqi_indication_rel9.tl.tag = NFAPI_CQI_INDICATION_REL9_TAG;
   pdu->cqi_indication_rel9.length = (ulsch_harq->Or1>>3) + ((ulsch_harq->Or1&7) > 0 ? 1 : 0);
   pdu->cqi_indication_rel9.ri[0]  = 0;
 
@@ -1715,6 +1594,8 @@ void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe
   pdu->ul_cqi_information.channel = 1; // PUSCH
   memcpy((void*)raw_pdu->pdu,ulsch_harq->o,pdu->cqi_indication_rel9.length);
   eNB->UL_INFO.cqi_ind.number_of_cqis++;
+  LOG_D(PHY,"eNB->UL_INFO.cqi_ind.number_of_cqis:%d\n", eNB->UL_INFO.cqi_ind.number_of_cqis);
+
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);
 
 }
@@ -1722,18 +1603,33 @@ void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe
 void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,uint16_t rnti, int frame,int subframe,int bundling)
 {
   int UE_id = find_dlsch(rnti,eNB,SEARCH_EXIST);
-  AssertFatal(UE_id>=0,"UE_id doesn't exist\n");
+  //AssertFatal(UE_id>=0,"UE_id doesn't exist\n");
+
+  if (UE_id < 0)
+  {
+    LOG_E(PHY,"%s(eNB, ulsch_harq, rnti:%04x, frame:%d, subframe:%d, bundling:%d) harq_pdus:%d - Could not find rnti - abort fill of ulsch harq ind\n", __FUNCTION__, rnti, frame, subframe, bundling,eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs);
+    return;
+  }
+
+  LOG_D(PHY,"%s(eNB, ulsch_harq, rnti:%04x, frame:%d, subframe:%d, bundling:%d) harq_pdus:%d O_ACK:%d\n", __FUNCTION__, rnti, frame, subframe, bundling,eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs,ulsch_harq->O_ACK);
 
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
-  nfapi_harq_indication_pdu_t *pdu =   &eNB->UL_INFO.harq_ind.harq_pdu_list[eNB->UL_INFO.harq_ind.number_of_harqs];
+  nfapi_harq_indication_pdu_t *pdu =   &eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs];
   int M;
   int i;
 
+  eNB->UL_INFO.harq_ind.header.message_id = NFAPI_HARQ_INDICATION;
+  eNB->UL_INFO.harq_ind.sfn_sf = frame<<4|subframe;
+
+  eNB->UL_INFO.harq_ind.harq_indication_body.tl.tag = NFAPI_HARQ_INDICATION_BODY_TAG;
+
   pdu->instance_length                                = 0; // don't know what to do with this
   //  pdu->rx_ue_information.handle                       = handle;
+  pdu->rx_ue_information.tl.tag                       = NFAPI_RX_UE_INFORMATION_TAG;
   pdu->rx_ue_information.rnti                         = rnti;
 
   if (eNB->frame_parms.frame_type == FDD) {
+    pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
     pdu->harq_indication_fdd_rel13.mode = 0;
     pdu->harq_indication_fdd_rel13.number_of_ack_nack = ulsch_harq->O_ACK;
 
@@ -1759,8 +1655,9 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
     M=ul_ACK_subframe2_M(&eNB->frame_parms,
 			 subframe);
 
-    pdu->harq_indication_fdd_rel13.mode = 1-bundling;
-    pdu->harq_indication_fdd_rel13.number_of_ack_nack = ulsch_harq->O_ACK;
+    pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
+    pdu->harq_indication_tdd_rel13.mode = 1-bundling;
+    pdu->harq_indication_tdd_rel13.number_of_ack_nack = ulsch_harq->O_ACK;
 
     for (i=0;i<ulsch_harq->O_ACK;i++) {
       AssertFatal(ulsch_harq->o_ACK[i] == 0 || ulsch_harq->o_ACK[i] == 1, "harq_ack[%d] is %d, should be 1,2 or 4\n",i,ulsch_harq->o_ACK[i]);
@@ -1778,7 +1675,9 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
     }	
   }
 
-  eNB->UL_INFO.harq_ind.number_of_harqs++;
+  //LOG_E(PHY,"eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs:%d\n", eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs);
+  eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs++;
+
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);
 }
 
@@ -1791,17 +1690,30 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
 			      uint16_t tdd_multiplexing_mask) {
 
   int UE_id=find_dlsch(uci->rnti,eNB,SEARCH_EXIST);
-  AssertFatal(UE_id>=0,"UE_id doesn't exist\n");
-
+  //AssertFatal(UE_id>=0,"UE_id doesn't exist rnti:%x\n", uci->rnti);
+  if (UE_id < 0) {
+    LOG_E(PHY,"SFN/SF:%04d%d Unable to find rnti:%x do not send HARQ\n", frame, subframe, uci->rnti);
+    return;
+  }
 
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
-  nfapi_harq_indication_pdu_t *pdu =   &eNB->UL_INFO.harq_ind.harq_pdu_list[eNB->UL_INFO.harq_ind.number_of_harqs];
 
+  nfapi_harq_indication_t *ind       = &eNB->UL_INFO.harq_ind;
+  nfapi_harq_indication_body_t *body = &ind->harq_indication_body;
+  nfapi_harq_indication_pdu_t *pdu   = &body->harq_pdu_list[eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs];
+
+  ind->sfn_sf = frame<<4|subframe;
+  ind->header.message_id = NFAPI_HARQ_INDICATION;
+
+  body->tl.tag = NFAPI_HARQ_INDICATION_BODY_TAG;
+ 
   pdu->instance_length                                = 0; // don't know what to do with this
   //  pdu->rx_ue_information.handle                       = handle;
+  pdu->rx_ue_information.tl.tag                       = NFAPI_RX_UE_INFORMATION_TAG;
   pdu->rx_ue_information.rnti                         = uci->rnti;
 
   // estimate UL_CQI for MAC (from antenna port 0 only)
+  pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
   int SNRtimes10 = dB_fixed_times10(uci->stat) - 200;//(10*eNB->measurements.n0_power_dB[0]);
 
   if (SNRtimes10 < -100) LOG_I(PHY,"uci->stat %d \n",uci->stat);
@@ -1813,6 +1725,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
 
   if (eNB->frame_parms.frame_type == FDD) {
     if (uci->pucch_fmt == pucch_format1a) {
+      pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
       pdu->harq_indication_fdd_rel13.mode = 0;  
       pdu->harq_indication_fdd_rel13.number_of_ack_nack = 1;
       
@@ -1831,6 +1744,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
 #endif
     }
     else if (uci->pucch_fmt == pucch_format1b) {
+      pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
       pdu->harq_indication_fdd_rel13.mode = 0;  
       pdu->harq_indication_fdd_rel13.number_of_ack_nack = 2;
       AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]);
@@ -1848,12 +1762,14 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
     AssertFatal(tdd_mapping_mode==0 || tdd_mapping_mode==1 || tdd_mapping_mode==2,
 		"Illegal tdd_mapping_mode %d\n",tdd_mapping_mode);
 
+    pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
     pdu->harq_indication_tdd_rel13.mode = tdd_mapping_mode;  
 
     switch (tdd_mapping_mode) {
     case 0: // bundling
 
       if (uci->pucch_fmt == pucch_format1a) {
+        pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
 	pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1;	
 	AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]);
 	pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0];
@@ -1864,6 +1780,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
 	pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2;
 	AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]);
 	AssertFatal(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]);
+        pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
 	pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0];
 	pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1]; 
 	// release all DLSCH if needed
@@ -1875,6 +1792,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
       AssertFatal(uci->pucch_fmt == pucch_format1b,"uci->pucch_format %d is not format1b\n",uci->pucch_fmt);
       
       if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1a) {
+        pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
 	pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1;	
 	AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]);
 	pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0];
@@ -1882,6 +1800,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
 	if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
       }
       else if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1b) {
+        pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
 	pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2;
 	AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]);
 	AssertFatal(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]);
@@ -1892,6 +1811,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
 	if (harq_ack[1] == 1) release_harq(eNB,UE_id,1,frame,subframe,0xffff);
       }
       else { // num_pucch_resources (M) > 1
+        pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
 	pdu->harq_indication_tdd_rel13.number_of_ack_nack = uci->num_pucch_resources;
 
 	pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0];
@@ -1904,6 +1824,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
       }
       break;
     case 2: // special bundling (SR collision)
+      pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
       pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1;
       int tdd_config5_sf2scheds=0;
       if (eNB->frame_parms.tdd_config==5) tdd_config5_sf2scheds = getM(eNB,frame,subframe);
@@ -1939,7 +1860,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
   } //TDD
 
 
-  eNB->UL_INFO.harq_ind.number_of_harqs++;
+  eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs++;
+  LOG_D(PHY,"Incremented eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs:%d\n", eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs);
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);  
 
 }
@@ -1948,14 +1870,23 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
 void fill_crc_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t crc_flag) {
 
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
-  nfapi_crc_indication_pdu_t *pdu =   &eNB->UL_INFO.crc_ind.crc_pdu_list[eNB->UL_INFO.crc_ind.number_of_crcs];
+  nfapi_crc_indication_pdu_t *pdu =   &eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
+
+  eNB->UL_INFO.crc_ind.sfn_sf                         = frame<<4 | subframe;
+  eNB->UL_INFO.crc_ind.header.message_id              = NFAPI_CRC_INDICATION;
+  eNB->UL_INFO.crc_ind.crc_indication_body.tl.tag     = NFAPI_CRC_INDICATION_BODY_TAG;
 
   pdu->instance_length                                = 0; // don't know what to do with this
   //  pdu->rx_ue_information.handle                       = handle;
+  pdu->rx_ue_information.tl.tag                       = NFAPI_RX_UE_INFORMATION_TAG;
   pdu->rx_ue_information.rnti                         = eNB->ulsch[UE_id]->rnti;
+  pdu->crc_indication_rel8.tl.tag                     = NFAPI_CRC_INDICATION_REL8_TAG;
   pdu->crc_indication_rel8.crc_flag                   = crc_flag;
 
-  eNB->UL_INFO.crc_ind.number_of_crcs++;
+  eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs++;
+
+  //LOG_D(PHY, "%s() rnti:%04x crcs:%d crc_flag:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, crc_flag);
+
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);
 }
 
@@ -1986,30 +1917,38 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
   eNB->rb_mask_ul[3]=0;
 
   // Fix me here, these should be locked
-  eNB->UL_INFO.rx_ind.number_of_pdus  = 0;
-  eNB->UL_INFO.crc_ind.number_of_crcs = 0;
+  eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus  = 0;
+  eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs = 0;
 
   // Call SRS first since all others depend on presence of SRS or lack thereof
   srs_procedures(eNB,proc);
 
-  lte_eNB_I0_measurements(eNB,
-			  subframe,
-			  0,
-			  eNB->first_run_I0_measurements);
   eNB->first_run_I0_measurements = 0;
 
   uci_procedures(eNB,proc);
 
-  pusch_procedures(eNB,proc);
+  if (nfapi_mode == 0 || nfapi_mode == 1) { // If PNF or monolithic
+    pusch_procedures(eNB,proc);
+  }
 
+  lte_eNB_I0_measurements(eNB,
+                          subframe,
+                          0,
+                          eNB->first_run_I0_measurements);
+
+  int min_I0=1000,max_I0=0;
+  if ((frame==0) && (subframe==4)) { 
+    for (int i=0;i<eNB->frame_parms.N_RB_UL;i++) {
+      if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
+ 
+      if (eNB->measurements.n0_subband_power_tot_dB[i]<min_I0) min_I0 = eNB->measurements.n0_subband_power_tot_dB[i];
+      if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) max_I0 = eNB->measurements.n0_subband_power_tot_dB[i];
+    }
+    LOG_I(PHY,"max_I0 %d, min_I0 %d\n",max_I0,min_I0);
+  }
 
-  
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 );
 
   stop_meas(&eNB->phy_proc_rx);
 
 }
-
-
-
-
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index ff2287fb1b59a3048f18d3f61e406e933dc57822..2635649589643575b027439581079c63b1527ba9 100644
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -51,10 +51,6 @@
 #include "LAYER2/MAC/defs.h"
 #include "UTIL/LOG/log.h"
 
-#ifdef EMOS
-fifo_dump_emos_UE emos_dump_UE;
-#endif
-
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
 
@@ -68,6 +64,8 @@ fifo_dump_emos_UE emos_dump_UE;
 
 #include "T.h"
 
+#include "PHY/TOOLS/defs.h"
+
 #define DLSCH_RB_ALLOC 0x1fbf  // skip DC RB (total 23/25 RBs)
 #define DLSCH_RB_ALLOC_12 0x0aaa  // skip DC RB (total 23/25 RBs)
 
@@ -75,13 +73,15 @@ fifo_dump_emos_UE emos_dump_UE;
 
 extern double cpuf;
 
-
+void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id);
+void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id);
 
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
 extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
 #endif
 
 
+#define UE_DEBUG_TRACE 1
 
 void dump_dlsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid)
 {
@@ -1192,38 +1192,6 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue,
 }
 
 
-#ifdef EMOS
-/*
-  void phy_procedures_emos_UE_TX(uint8_t next_slot,uint8_t eNB_id) {
-  uint8_t harq_pid;
-
-
-  if (next_slot%2==0) {
-  // get harq_pid from subframe relationship
-  harq_pid = subframe2harq_pid(&ue->frame_parms,ue->frame,(next_slot>>1));
-  if (harq_pid==255) {
-  LOG_E(PHY,"[UE%d] Frame %d : FATAL ERROR: illegal harq_pid, returning\n",
-  0,ue->frame);
-  return;
-  }
-
-  if (ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) {
-  emos_dump_UE.uci_cnt[next_slot>>1] = 1;
-  memcpy(emos_dump_UE.UCI_data[0][next_slot>>1].o,ulsch[eNB_id]->o,MAX_CQI_BITS*sizeof(char));
-  emos_dump_UE.UCI_data[0][next_slot>>1].O = ulsch[eNB_id]->O;
-  memcpy(emos_dump_UE.UCI_data[0][next_slot>>1].o_RI,ulsch[eNB_id]->o_RI,2*sizeof(char));
-  emos_dump_UE.UCI_data[0][next_slot>>1].O_RI = ulsch[eNB_id]->O_RI;
-  memcpy(emos_dump_UE.UCI_data[0][next_slot>>1].o_ACK,ulsch[eNB_id]->o_ACK,4*sizeof(char));
-  emos_dump_UE.UCI_data[0][next_slot>>1].O_ACK = ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK;
-  }
-  else {
-  emos_dump_UE.uci_cnt[next_slot>>1] = 0;
-  }
-  }
-  }
-*/
-#endif
-
 void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empty_subframe) {
 
   int aa;
@@ -1298,7 +1266,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
   }
 //#endif
 
-  if ((frame_tx%100) == 0)
+//  if ((frame_tx%100) == 0)
     LOG_D(PHY,"[UE %d] Frame %d, subframe %d: ulsch_start = %d (rxoff %d, HW TA %d, timing advance %d, TA_offset %d\n",
     ue->Mod_id,frame_tx,subframe_tx,
     ulsch_start,
@@ -1320,16 +1288,25 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
        nsymb,
        frame_parms->nb_prefix_samples,
        CYCLIC_PREFIX);
-    else
+    else {
       normal_prefix_mod(&ue->common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
-      dummy_tx_buffer,
+			dummy_tx_buffer,
 #else
-      &ue->common_vars.txdata[aa][ulsch_start],
+			&ue->common_vars.txdata[aa][ulsch_start],
 #endif
-      nsymb,
-      &ue->frame_parms);
+			nsymb>>1,
+			&ue->frame_parms);
 
+      normal_prefix_mod(&ue->common_vars.txdataF[aa][((subframe_tx*nsymb)+(nsymb>>1))*frame_parms->ofdm_symbol_size],
+#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
+			dummy_tx_buffer+(frame_parms->samples_per_tti>>1),
+#else
+			&ue->common_vars.txdata[aa][ulsch_start+(frame_parms->samples_per_tti>>1)],
+#endif
+			nsymb>>1,
+			&ue->frame_parms);
+      }
 
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
     apply_7_5_kHz(ue,dummy_tx_buffer,0);
@@ -1405,7 +1382,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
   if (ue->mac_enabled==1){
     // ask L2 for RACH transport
     if ((mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) && (mode != no_L2_connect) ) {
-      LOG_D(PHY,"Getting PRACH resources\n");
+      //LOG_D(PHY,"Getting PRACH resources\n");
 
       ue->prach_resources[eNB_id] = ue_get_rach(ue->Mod_id,
 						ue->CC_id,
@@ -1423,9 +1400,6 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
     ue->prach_cnt=0;
 #ifdef SMBV
     ue->prach_resources[eNB_id]->ra_PreambleIndex = 19;
-#endif
-#ifdef OAI_EMU
-    ue->prach_PreambleIndex=ue->prach_resources[eNB_id]->ra_PreambleIndex;
 #endif
     LOG_I(PHY,"mode %d\n",mode);
     
@@ -1480,38 +1454,36 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
 	  ue->tx_power_dBm[subframe_tx],
 	  dB_fixed(prach_power),
 	  ue->prach_vars[eNB_id]->amp);
-  } else {
-    UE_transport_info[ue->Mod_id][ue->CC_id].cntl.prach_flag=1;
-    UE_transport_info[ue->Mod_id][ue->CC_id].cntl.prach_id=ue->prach_resources[eNB_id]->ra_PreambleIndex;
-  }
+   
 
-  if (ue->mac_enabled==1){
-    Msg1_transmitted(ue->Mod_id,
-		     ue->CC_id,
-		     frame_tx,
-		     eNB_id);
-  }
-
-  LOG_I(PHY,"[UE  %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n",
-	ue->Mod_id,frame_tx,subframe_tx,eNB_id,
-	ue->prach_resources[eNB_id]->ra_PreambleIndex,
-	ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id),
-	get_PL(ue->Mod_id,ue->CC_id,eNB_id));
-  
 
+    if (ue->mac_enabled==1){
+      Msg1_transmitted(ue->Mod_id,
+		       ue->CC_id,
+		       frame_tx,
+		       eNB_id);
+    }
+    
+    LOG_I(PHY,"[UE  %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n",
+	  ue->Mod_id,frame_tx,subframe_tx,eNB_id,
+	  ue->prach_resources[eNB_id]->ra_PreambleIndex,
+	  ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id),
+	  get_PL(ue->Mod_id,ue->CC_id,eNB_id));
+    
+    
+    
+    // if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue
+    if (mode == calib_prach_tx)
+      ue->prach_resources[eNB_id]=NULL;
 
-  // if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue
-  if (mode == calib_prach_tx)
-    ue->prach_resources[eNB_id]=NULL;
-
-  LOG_D(PHY,"[UE %d] frame %d subframe %d : generate_prach %d, prach_cnt %d\n",
-  ue->Mod_id,frame_tx,subframe_tx,ue->generate_prach,ue->prach_cnt);
-
-  ue->prach_cnt++;
+    LOG_D(PHY,"[UE %d] frame %d subframe %d : generate_prach %d, prach_cnt %d\n",
+	  ue->Mod_id,frame_tx,subframe_tx,ue->generate_prach,ue->prach_cnt);
 
-  if (ue->prach_cnt==3)
-    ue->generate_prach=0;
+    ue->prach_cnt++;
 
+    if (ue->prach_cnt==3)
+      ue->generate_prach=0;
+  }
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT);
 }
 
@@ -1543,18 +1515,21 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
              frame_tx,
              subframe_tx);
 
+  LOG_D(PHY,"Frame %d, Subframe %d : ue_uespec_procedures, harq_pid %d => subframe_scheduling %d\n",
+	frame_tx,subframe_tx,harq_pid,
+	ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag);
 
   if (ue->mac_enabled == 1) {
-    if ((ue->ulsch_Msg3_active[eNB_id] == 1) &&
-  (ue->ulsch_Msg3_frame[eNB_id] == frame_tx) &&
-  (ue->ulsch_Msg3_subframe[eNB_id] == subframe_tx)) { // Initial Transmission of Msg3
+    if ((ue->ulsch_Msg3_active[eNB_id] == 1)       &&
+	(ue->ulsch_Msg3_frame[eNB_id] == frame_tx) &&
+	(ue->ulsch_Msg3_subframe[eNB_id] == subframe_tx)) { // Initial Transmission of Msg3
 
       ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
 
       if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round==0)
-  generate_ue_ulsch_params_from_rar(ue,
-            proc,
-            eNB_id);
+	generate_ue_ulsch_params_from_rar(ue,
+					  proc,
+					  eNB_id);
 
       ue->ulsch[eNB_id]->power_offset = 14;
       LOG_D(PHY,"[UE  %d][RAPROC] Frame %d: Setting Msg3_flag in subframe %d, for harq_pid %d\n",
@@ -1624,7 +1599,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
     LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,ue->ulsch[eNB_id]->Mlimit);
     if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (ue->ulsch[eNB_id]->Mlimit - 1))
     {
-        LOG_D(PHY,"PUSCH MAX Retransmission achieved ==> send last pusch\n");
+      //        LOG_D(PHY,"PUSCH MAX Retransmission achieved ==> send last pusch\n");
         ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
         ue->ulsch[eNB_id]->harq_processes[harq_pid]->round  = 0;
     }
@@ -1697,7 +1672,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
 
 
 #ifdef UE_DEBUG_TRACE
-        LOG_I(PHY,
+        LOG_D(PHY,
               "[UE  %d][PUSCH %d] AbsSubframe %d.%d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, "
               "cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, ack_status_cw0 %d ack_status_cw1 %d bundling %d, Nbundled %d, CQI %d, RI %d\n",
           Mod_id,harq_pid,frame_tx%1024,subframe_tx,
@@ -1756,7 +1731,6 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
       stop_meas(&ue->phy_proc_tx);
       printf("------FULL TX PROC : %5.2f ------\n",ue->phy_proc_tx.p_time/(cpuf*1000.0));
 #endif
-	  return;
 
 #if UE_TIMING_TRACE
       stop_meas(&ue->ulsch_encoding_stats);
@@ -1833,12 +1807,6 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
 	}
       }
       
-#ifdef PHY_ABSTRACTION
-      else {
-        ulsch_encoding_emul(ulsch_input_buffer,ue,eNB_id,proc->subframe_rx,harq_pid,0);
-      }
-      
-#endif
 #if UE_TIMING_TRACE
       stop_meas(&ue->ulsch_encoding_stats);
 #endif
@@ -1867,7 +1835,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
       T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb));
 
 #ifdef UE_DEBUG_TRACE
-    LOG_I(PHY,"[UE  %d][PUSCH %d] AbsSubFrame %d.%d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n",
+    LOG_D(PHY,"[UE  %d][PUSCH %d] AbsSubFrame %d.%d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n",
 	  Mod_id,harq_pid,frame_tx%1024,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp);
 #endif
 #if UE_TIMING_TRACE
@@ -1892,6 +1860,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
 #if UE_TIMING_TRACE
     stop_meas(&ue->ulsch_modulation_stats);
 #endif
+
     }
     
     if (abstraction_flag==1) {
@@ -2110,10 +2079,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
       (bundling_flag==bundling)    ||
       ((frame_parms->frame_type==TDD)&&(frame_parms->tdd_config==1)&&((subframe_tx!=2)||(subframe_tx!=7)))) {
     format = pucch_format1a;
-    LOG_D(PHY,"[UE] PUCCH 1a\n");
+    //    LOG_D(PHY,"[UE] PUCCH 1a\n");
   } else {
     format = pucch_format1b;
-    LOG_D(PHY,"[UE] PUCCH 1b\n");
+    //    LOG_D(PHY,"[UE] PUCCH 1b\n");
   }
 
   // Part - I
@@ -2228,20 +2197,20 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
 
 #ifdef UE_DEBUG_TRACE
       if(format == pucch_format1)
-      {
-          LOG_I(PHY,"[UE  %d][SR %x] AbsSubframe %d.%d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n",
-                  Mod_id,
-                  ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti,
-                  frame_tx%1024, subframe_tx,
-                  frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
-                  isShortenPucch,
-                  ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
-                  Po_PUCCH);
+	{
+          LOG_D(PHY,"[UE  %d][SR %x] AbsSubframe %d.%d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n",
+		Mod_id,
+		ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti,
+		frame_tx%1024, subframe_tx,
+		frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission,
+		isShortenPucch,
+		ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
+		Po_PUCCH);
       }
       else
       {
           if (SR_payload>0) {
-              LOG_I(PHY,"[UE  %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n",
+              LOG_D(PHY,"[UE  %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n",
                       Mod_id,
                       ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti,
                       frame_tx % 1024, subframe_tx,
@@ -2254,7 +2223,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
                               Po_PUCCH,
                               tx_amp);
           } else {
-              LOG_I(PHY,"[UE  %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n",
+              LOG_D(PHY,"[UE  %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n",
                       Mod_id,
                       ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti,
                       frame_tx%1024, subframe_tx,ue->rx_offset_diff,
@@ -2321,7 +2290,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
               T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
 #endif
 #ifdef UE_DEBUG_TRACE
-      LOG_I(PHY,"[UE  %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI or CQI), Po_PUCCH %d, isShortenPucch %d, amp %d\n",
+      LOG_D(PHY,"[UE  %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI or CQI), Po_PUCCH %d, isShortenPucch %d, amp %d\n",
               Mod_id,
               ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti,
               frame_tx%1024, subframe_tx,
@@ -2389,10 +2358,6 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
   start_meas(&ue->phy_proc_tx);
 #endif
 
-#ifdef EMOS
-  //phy_procedures_emos_UE_TX(next_slot);
-#endif
-
   ue->tx_power_dBm[subframe_tx]=-127;
 
       
@@ -2411,6 +2376,8 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
 
     ue_ulsch_uespec_procedures(ue,proc,eNB_id,abstraction_flag);
 
+    LOG_D(PHY,"ULPOWERS After ulsch_uespec_procedures : ue->tx_power_dBm[%d]=%d, NPRB %d\n",
+	  subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_total_RE[subframe_tx]);
   }
 
   if (ue->UE_mode[eNB_id] == PUSCH) {
@@ -2673,11 +2640,6 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
 			  ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0);
     }
 
-#ifdef EMOS
-    //emos_dump_UE.frame_tx = frame_tx;
-    //emos_dump_UE.mimo_mode = ue->pbch_vars[eNB_id]->decoded_output[1];
-#endif
-
     if (first_run) {
       first_run = 0;
 
@@ -2934,24 +2896,24 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
 	// we received a CRNTI, so we're in PUSCH
 	if (ue->UE_mode[eNB_id] != PUSCH) {
 #ifdef DEBUG_PHY_PROC
-	  LOG_I(PHY,"[UE  %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti);
+	  LOG_D(PHY,"[UE  %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti);
 #endif
 	  
 	  //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
 	  ue->UE_mode[eNB_id] = PUSCH;
-	  
-	} else {
+	}
+      } else {
 	  LOG_E(PHY,"[UE  %d] Frame %d, subframe %d: Problem in DCI!\n",ue->Mod_id,frame_rx,subframe_rx);
 	  dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
 	}
-      }
+    }
       
       else if ((dci_alloc_rx[i].rnti == SI_RNTI) &&
 	       ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) {
 
 
 #ifdef DEBUG_PHY_PROC
-	LOG_I(PHY,"[UE  %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i);
+	LOG_D(PHY,"[UE  %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i);
 #endif
 	
 	if (generate_ue_dlsch_params_from_dci(frame_rx,
@@ -2972,18 +2934,17 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
 	  
 	  ue->dlsch_SI_received[eNB_id]++;
 	  
-	  LOG_I(PHY,"[UE  %d] Frame %d, subframe %d : Generate UE DLSCH SI_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C");
+	  LOG_D(PHY,"[UE  %d] Frame %d, subframe %d : Generate UE DLSCH SI_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C");
 	  //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
 	
 	}
       }
-    }
 
     else if ((dci_alloc_rx[i].rnti == P_RNTI) &&
        ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) {
 
 #ifdef DEBUG_PHY_PROC
-      LOG_I(PHY,"[UE  %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i);
+      LOG_D(PHY,"[UE  %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i);
 #endif
 
 
@@ -3015,7 +2976,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
        (dci_alloc_rx[i].format == format1A)) {
 
 #ifdef DEBUG_PHY_PROC
-      LOG_I(PHY,"[UE  %d][RAPROC] subframe %d: Found RA rnti %x, format 1A, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,i);
+      LOG_D(PHY,"[UE  %d][RAPROC] subframe %d: Found RA rnti %x, format 1A, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,i);
 #endif
 
 
@@ -3081,7 +3042,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
       T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS));
 #endif
 #ifdef DEBUG_PHY_PROC
-  LOG_D(PHY,"[UE  %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx);
+      LOG_D(PHY,"[UE  %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx);
 #endif
 
       }
@@ -3124,7 +3085,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
 
     else {
 #ifdef DEBUG_PHY_PROC
-      LOG_I(PHY,"[UE  %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",ue->Mod_id,frame_rx,subframe_rx,i,dci_alloc_rx[i].rnti,
+      LOG_D(PHY,"[UE  %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",ue->Mod_id,frame_rx,subframe_rx,i,dci_alloc_rx[i].rnti,
 	    ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti,
 	    ue->ulsch[eNB_id]->cba_rnti[0],
 	    dci_alloc_rx[i].format);
@@ -3156,7 +3117,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs
   int ret=0;
 
   if (is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms)) {
-    LOG_D(PHY,"ue calling pmch subframe ..\n ");
+    // LOG_D(PHY,"ue calling pmch subframe ..\n ");
 
     LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation\n",
     ue->Mod_id,(subframe_rx==9?-1:0)+frame_rx,subframe_rx);
@@ -3583,7 +3544,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
       }
     }
     
-    if (abstraction_flag == 0) {
       
       // start turbo decode for CW 0
       dlsch0->harq_processes[harq_pid]->G = get_G(&ue->frame_parms,
@@ -3720,17 +3680,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
 	}
       
       LOG_D(PHY," ------ end turbo decoder for AbsSubframe %d.%d ------  \n", frame_rx, subframe_rx);
-    }
     
-    else {
-      LOG_D(PHY,"Calling dlsch_decoding_emul ...\n");
-#ifdef PHY_ABSTRACTION
-      ret = dlsch_decoding_emul(ue,
-				subframe_rx,
-				pdsch,
-				eNB_id);
-#endif
-    }
     
 
     // Check CRC for CW 0
@@ -3823,7 +3773,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
     if(is_cw1_active)
       {
         if (ret1 == (1+dlsch0->max_turbo_iterations)) {
-	  LOG_I(PHY,"[UE  %d][PDSCH %x/%d] Frame %d subframe %d DLSCH CW1 in error (rv %d,mcs %d,TBS %d)\n",
+	  LOG_D(PHY,"[UE  %d][PDSCH %x/%d] Frame %d subframe %d DLSCH CW1 in error (rv %d,mcs %d,TBS %d)\n",
 		ue->Mod_id,dlsch0->rnti,
 		harq_pid,frame_rx,subframe_rx,
 		dlsch0->harq_processes[harq_pid]->rvidx,
@@ -3831,7 +3781,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
 		dlsch0->harq_processes[harq_pid]->TBS);
 	  
         } else {
-	  LOG_I(PHY,"[UE  %d][PDSCH %x/%d] Frame %d subframe %d: Received DLSCH CW1 (rv %d,mcs %d,TBS %d)\n",
+	  LOG_D(PHY,"[UE  %d][PDSCH %x/%d] Frame %d subframe %d: Received DLSCH CW1 (rv %d,mcs %d,TBS %d)\n",
 		ue->Mod_id,dlsch0->rnti,
 		harq_pid,frame_rx,subframe_rx,
 		dlsch0->harq_processes[harq_pid]->rvidx,
@@ -4213,7 +4163,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *pr
 
     // start timers
 #ifdef UE_DEBUG_TRACE
-    LOG_I(PHY," ****** start RX-Chain for AbsSubframe %d.%d ******  \n", frame_rx%1024, subframe_rx);
+    LOG_D(PHY," ****** start RX-Chain for AbsSubframe %d.%d ******  \n", frame_rx%1024, subframe_rx);
 #endif
 
 #if UE_TIMING_TRACE
@@ -4687,11 +4637,6 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *pr
 
     }
 
-#ifdef EMOS
-    phy_procedures_emos_UE_RX(ue,slot,eNB_id);
-#endif
-
-
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
 
 #if UE_TIMING_TRACE
@@ -5171,11 +5116,6 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,
   printf("after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0));
 #endif
 
-#ifdef EMOS
-  phy_procedures_emos_UE_RX(ue,slot,eNB_id);
-#endif
-
-
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
 
 #if UE_TIMING_TRACE
diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c
new file mode 100644
index 0000000000000000000000000000000000000000..4730eed613198c04a2ced09ae6e6b6d3fc947fcc
--- /dev/null
+++ b/openair1/SCHED/prach_procedures.c
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file phy_procedures_lte_eNB.c
+ * \brief Implementation of eNB procedures from 36.213 LTE specifications
+ * \author R. Knopp, F. Kaltenberger, N. Nikaein, X. Foukas
+ * \date 2011
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr, x.foukas@sms.ed.ac.uk
+ * \note
+ * \warning
+ */
+
+#include "PHY/defs.h"
+#include "PHY/extern.h"
+#include "SCHED/defs.h"
+#include "SCHED/extern.h"
+#include "nfapi_interface.h"
+#include "fapi_l1.h"
+#include "nfapi_pnf.h"
+#include "UTIL/LOG/log.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
+
+#include "T.h"
+
+#include "assertions.h"
+#include "msc.h"
+
+#include <time.h>
+
+#if defined(ENABLE_ITTI)
+#   include "intertask_interface.h"
+#endif
+
+extern uint32_t nfapi_mode;
+
+extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
+
+void prach_procedures(PHY_VARS_eNB *eNB
+#ifdef Rel14
+                      ,
+		      int br_flag
+#endif
+		      ) {
+  uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
+  uint16_t i;
+  int frame,subframe;
+
+#ifdef Rel14
+  if (br_flag==1) {
+    subframe = eNB->proc.subframe_prach_br;
+    frame = eNB->proc.frame_prach_br;
+    pthread_mutex_lock(&eNB->UL_INFO_mutex);
+    eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles=0;
+    pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+  }
+  else
+#endif
+    {
+      pthread_mutex_lock(&eNB->UL_INFO_mutex);
+      eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles=0;
+      pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+      subframe = eNB->proc.subframe_prach;
+      frame = eNB->proc.frame_prach;
+    }
+  RU_t *ru;
+  int aa=0;
+  int ru_aa;
+
+ 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
+
+
+
+  for (i=0;i<eNB->num_RU;i++) {
+    ru=eNB->RU_list[i];
+    for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
+      eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[ru_aa];
+#ifdef Rel14
+      int ce_level;
+
+      if (br_flag==1)
+	for (ce_level=0;ce_level<4;ce_level++) eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[i]->prach_rxsigF_br[ce_level][ru_aa];
+#endif
+    }
+  }
+
+  rx_prach(eNB,
+	   eNB->RU_list[0],
+	   &max_preamble[0],
+	   &max_preamble_energy[0],
+	   &max_preamble_delay[0],
+	   frame,
+	   0
+#ifdef Rel14
+	   ,br_flag
+#endif
+	   );
+
+  LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
+        frame,subframe,
+        max_preamble[0],
+        max_preamble_energy[0]/10,
+        max_preamble_delay[0],
+	eNB->prach_energy_counter);
+
+#ifdef Rel14
+  if (br_flag==1) {
+
+    int prach_mask;
+      
+    prach_mask = is_prach_subframe(&eNB->frame_parms,eNB->proc.frame_prach_br,eNB->proc.subframe_prach_br);
+    
+    eNB->UL_INFO.rach_ind_br.rach_indication_body.preamble_list                              = eNB->preamble_list_br;
+    int ind=0;
+    int ce_level=0;
+    /* Save for later, it doesn't work    
+    for (int ind=0,ce_level=0;ce_level<4;ce_level++) {
+      
+      if ((eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[ce_level]==1)&&
+	  (prach_mask&(1<<(1+ce_level)) > 0) && // prach is active and CE level has finished its repetitions
+	  (eNB->prach_vars_br.repetition_number[ce_level]==
+	   eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level])) {
+    */ 
+    if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]==1){ 
+      if ((eNB->prach_energy_counter == 100) && 
+          (max_preamble_energy[0] > eNB->measurements.prach_I0 + 100)) {
+	eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles++;
+	
+	eNB->preamble_list_br[ind].preamble_rel8.timing_advance        = max_preamble_delay[ind];//
+	eNB->preamble_list_br[ind].preamble_rel8.preamble              = max_preamble[ind];
+	// note: fid is implicitly 0 here, this is the rule for eMTC RA-RNTI from 36.321, Section 5.1.4
+	eNB->preamble_list_br[ind].preamble_rel8.rnti                  = 1+subframe+(eNB->prach_vars_br.first_frame[ce_level]%40);  
+	eNB->preamble_list_br[ind].instance_length                     = 0; //don't know exactly what this is
+	eNB->preamble_list_br[ind].preamble_rel13.rach_resource_type   = 1+ce_level;  // CE Level
+	LOG_D(PHY,"Filling NFAPI indication for RACH %d CELevel %d (mask %x) : TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
+	      ind,
+	      ce_level,
+	      prach_mask,
+	      eNB->preamble_list_br[ind].preamble_rel8.timing_advance,
+	      eNB->preamble_list_br[ind].preamble_rel8.preamble,
+	      eNB->preamble_list_br[ind].preamble_rel8.rnti,
+	      eNB->preamble_list_br[ind].preamble_rel13.rach_resource_type);
+      }
+      /*
+	ind++;
+      }
+      } */// ce_level
+    }
+  }
+  else
+#endif
+
+    {
+      if ((eNB->prach_energy_counter == 100) && 
+          (max_preamble_energy[0] > eNB->measurements.prach_I0+100)) {
+
+	LOG_I(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
+	      eNB->Mod_id,
+	      eNB->CC_id,
+	      frame,
+	      subframe,
+	      max_preamble[0],
+	      max_preamble_energy[0]/10,
+	      max_preamble_energy[0]%10,
+	      max_preamble_delay[0]);
+	
+	    T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
+	      T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
+	    
+	    pthread_mutex_lock(&eNB->UL_INFO_mutex);
+	    
+	    eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles  = 1;
+	    eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list        = &eNB->preamble_list[0];
+	    eNB->UL_INFO.rach_ind.rach_indication_body.tl.tag               = NFAPI_RACH_INDICATION_BODY_TAG;
+            eNB->UL_INFO.rach_ind.header.message_id                         = NFAPI_RACH_INDICATION;
+            eNB->UL_INFO.rach_ind.sfn_sf                                    = frame<<4 | subframe;
+	    
+	    eNB->preamble_list[0].preamble_rel8.tl.tag                = NFAPI_PREAMBLE_REL8_TAG;
+	    eNB->preamble_list[0].preamble_rel8.timing_advance        = max_preamble_delay[0];
+	    eNB->preamble_list[0].preamble_rel8.preamble              = max_preamble[0];
+	    eNB->preamble_list[0].preamble_rel8.rnti                  = 1+subframe;  // note: fid is implicitly 0 here
+	    eNB->preamble_list[0].preamble_rel13.rach_resource_type   = 0;
+	    eNB->preamble_list[0].instance_length                     = 0; //don't know exactly what this is
+	    
+            if (nfapi_mode == 1) {  // If NFAPI PNF then we need to send the message to the VNF
+
+              LOG_D(PHY,"Filling NFAPI indication for RACH : SFN_SF:%d TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
+                  NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf),
+                  eNB->preamble_list[0].preamble_rel8.timing_advance,
+                  eNB->preamble_list[0].preamble_rel8.preamble,
+                  eNB->preamble_list[0].preamble_rel8.rnti,
+                  eNB->preamble_list[0].preamble_rel13.rach_resource_type);	    
+
+              oai_nfapi_rach_ind(&eNB->UL_INFO.rach_ind);
+
+              eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 0;
+            }
+
+	    pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+      
+      } // max_preamble_energy > prach_I0 + 100 
+      else {
+         eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10); 
+         if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
+         if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++;
+      }
+    } // else br_flag
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
+}
diff --git a/openair1/SCHED/pucch_pc.c b/openair1/SCHED/pucch_pc.c
index 510d9a1401547ab1ae1106318d52f17ff818ff1e..f01d0d96dd7df5ddbc65cc8270d0ea4d760e5b43 100644
--- a/openair1/SCHED/pucch_pc.c
+++ b/openair1/SCHED/pucch_pc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SCHED/pusch_pc.c b/openair1/SCHED/pusch_pc.c
index 8b2e19eef186416ed6e2c6a780168cd734266dba..caef13162726849dd38948a8079adaca4982bcc9 100644
--- a/openair1/SCHED/pusch_pc.c
+++ b/openair1/SCHED/pusch_pc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SCHED/rt_compat.h b/openair1/SCHED/rt_compat.h
deleted file mode 100644
index b220d6f06a97b505602082b3e8f6871f700297c0..0000000000000000000000000000000000000000
--- a/openair1/SCHED/rt_compat.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/* Header file for making PLATON work on both RTLinux and RTAI using pthreads
-*  Copyright Frank Wartena, 2004
-*  Version: 0.1 January 28th, 2004 ## First version for scheduling test
-*     0.2 February 20th, 2004 ## All PLATON functions added
-*  It is mostly a conversion from RTLinux to RTAI, because PLATON was written
-*  for RTLinux.
-*  Not all necessary conversions can be done in this header file, other
-*  adjustments in the code are also necessary.
-*/
-
-#ifndef _RT_COMPAT_H_
-#define _RT_COMPAT_H_
-
-#ifdef RTAI_ENABLED
-//the conversions from RTLinux to RTAI
-
-//variable for containing times
-#define hrtime_t RTIME
-
-//function for making a thread periodic
-#define pthread_make_periodic_np(x,y,z) rt_task_make_periodic(x,rt_get_time(),nano2count(z))
-
-//function for printing to the kernel log
-#define rtl_printf printk
-
-//function for determining the current cpu
-#define rtl_getcpuid hard_cpu_id
-
-//function for initialising a mutex
-#define pthread_mutex_init pthread_mutex_init_rt
-
-//function for initialising a mutex attribute
-#define pthread_mutexattr_init pthread_mutexattr_init_rt
-
-//function for setting a mutex protocol, does not exist in RTAI
-#define pthread_mutexattr_setprotocol(x,y);
-
-//function for locking a mutex
-#define pthread_mutex_lock pthread_mutex_lock_rt
-
-//function for unlocking a mutex
-#define pthread_mutex_unlock pthread_mutex_unlock_rt
-
-//function for destroying a mutex
-#define pthread_mutex_destroy pthread_mutex_destroy_rt
-
-//function for getting the current time
-#define clock_gethrtime(x) rt_get_time_ns()
-#define gethrtime          rt_get_time_ns
-
-//function for initialising a condition
-#define pthread_cond_init pthread_cond_init_rt
-
-//function for waiting on a condition
-#define pthread_cond_wait pthread_cond_wait_rt
-
-//function for signalling a condition
-#define pthread_cond_signal pthread_cond_signal_rt
-
-//function for destroying a condition
-#define pthread_cond_destroy pthread_cond_destroy_rt
-
-//function for waking up a thread
-#define pthread_wakeup_np rt_task_resume
-
-//function for getting the current thread
-#define pthread_self rt_whoami
-
-//function for initialising an attribute
-#define pthread_attr_init pthread_attr_init_rt
-
-//function for setting a schedparam
-#define pthread_attr_setschedparam pthread_attr_setschedparam_rt
-
-//funcion for setting a schedpolicy
-#define pthread_attr_setschedpolicy pthread_attr_setschedpolicy_rt
-
-//function for creating a thread
-#define pthread_create pthread_create_rt
-
-//function for cancelling a thread
-#define pthread_cancel pthread_cancel_rt
-
-//function for deleting a thread, in RTAI both by calling cancel
-#define pthread_delete_np pthread_cancel_rt
-
-//testing if a cpuid exists
-#define rtl_cpu_exists(x) x<NR_RT_CPUS
-
-//function for flushing a fifo does not exist in RTAI
-#define rtf_flush(x);
-
-//function for setting the stacksize
-#define pthread_attr_setstacksize pthread_attr_setstacksize_rt
-
-//function for sleeping the indicated amount in nanoseconds
-//#define rtl_delay(x) rt_sleep(nano2count(x))
-//#define udelay(x) rt_sleep(nano2count(1000*x))
-//#define usleep(x) rt_sleep(nano2count(1000*x))
-
-#define pthread_exit pthread_exit_rt
-
-//function for indicating that a thread uses the FPU
-#define pthread_setfp_np rt_task_use_fpu
-
-//function for freeing a soft irq
-#define rtl_free_soft_irq(x) rt_free_linux_irq(x,NULL)
-
-//function for triggering a soft irq
-#define rtl_global_pend_irq rt_pend_linux_irq
-
-//function for setting the thread scheduling, does not exist in RTAI
-#define pthread_setschedparam(x,y,z);
-
-#endif /* RTAI_ENABLED */
-
-#endif /* _RT_COMPAT_H_ */
diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c
index ea5d221d4c92bda02dfaf119ac522fe8e2f1e92c..257fef6e31150f2cd21d4c4a2c6880c39b622359 100644
--- a/openair1/SCHED/ru_procedures.c
+++ b/openair1/SCHED/ru_procedures.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -38,10 +38,6 @@
 #include "PHY/LTE_TRANSPORT/if4_tools.h"
 #include "PHY/LTE_TRANSPORT/if5_tools.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
-
 #include "LAYER2/MAC/extern.h"
 #include "LAYER2/MAC/defs.h"
 #include "UTIL/LOG/log.h"
@@ -69,16 +65,17 @@ void feptx0(RU_t *ru,int slot) {
   //int dummy_tx_b[7680*2] __attribute__((aligned(32)));
 
   unsigned int aa,slot_offset;
-  int i,j, tx_offset;
+  int i, tx_offset;
   int slot_sizeF = (fp->ofdm_symbol_size)*
                    ((fp->Ncp==1) ? 6 : 7);
-  int len,len2;
-  int16_t *txdata;
   int subframe = ru->proc.subframe_tx;
 
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 1 );
+
   slot_offset = subframe*fp->samples_per_tti + (slot*(fp->samples_per_tti>>1));
 
-  //    LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot);
+  //LOG_D(PHY,"SFN/SF:RU:TX:%d/%d Generating slot %d\n",ru->proc.frame_tx, ru->proc.subframe_tx,slot);
 
   for (aa=0; aa<ru->nb_tx; aa++) {
     if (fp->Ncp == EXTENDED) PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot*slot_sizeF],
@@ -134,6 +131,7 @@ void feptx0(RU_t *ru,int slot) {
       }
     }
   }
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 0);
 }
 
 static void *feptx_thread(void *param) {
@@ -189,6 +187,8 @@ void feptx_ofdm_2thread(RU_t *ru) {
 
   if (subframe_select(fp,subframe) == SF_UL) return;
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 );
+
   if (subframe_select(fp,subframe)==SF_DL) {
     // If this is not an S-subframe
     if (pthread_mutex_timedlock(&proc->mutex_feptx,&wait) != 0) {
@@ -227,6 +227,8 @@ void feptx_ofdm_2thread(RU_t *ru) {
     printf("delay in feptx wait on codition in frame_rx: %d  subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx);
   }*/
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 );
+
   stop_meas(&ru->ofdm_mod_stats);
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 );
 
@@ -322,11 +324,11 @@ void feptx_ofdm(RU_t *ru) {
 	}
 	txdata = (int16_t*)&ru->common.txdata[aa][0];
 	for (j=0; i<(len<<1); i++,j++) {
-	  txdata[j++] = ((int16_t*)dummy_tx_b)[i];
+          txdata[j++] = ((int16_t*)dummy_tx_b)[i];
 	}
       }
       else {
-	LOG_D(PHY,"feptx_ofdm: Writing to position %d\n",slot_offset);
+	//LOG_D(PHY,"feptx_ofdm: Writing to position %d\n",slot_offset);
 	tx_offset = (int)slot_offset;
 	txdata = (int16_t*)&ru->common.txdata[aa][tx_offset];
 
@@ -345,9 +347,9 @@ void feptx_ofdm(RU_t *ru) {
       */
      if ((fp->frame_type == TDD) && 
          ((fp->tdd_config==0) ||
-	      (fp->tdd_config==1) ||
-	      (fp->tdd_config==2) ||
-	      (fp->tdd_config==6)) && 
+	   (fp->tdd_config==1) ||
+	   (fp->tdd_config==2) ||
+	   (fp->tdd_config==6)) && 
 	     ((subframe==0) || (subframe==5))) {
        // turn on tx switch N_TA_offset before
        //LOG_D(HW,"subframe %d, time to switch to tx (N_TA_offset %d, slot_offset %d) \n",subframe,ru->N_TA_offset,slot_offset);
@@ -383,10 +385,14 @@ void feptx_prec(RU_t *ru) {
     eNB = eNB_list[0];
     fp  = &eNB->frame_parms;
     
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1);
+
     for (aa=0;aa<ru->nb_tx;aa++)
       memcpy((void*)ru->common.txdataF_BF[aa],
 	     (void*)&eNB->common_vars.txdataF[aa][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size],
 	     fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t));
+
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0);
   }
   else {
     for (i=0;i<ru->num_eNB;i++) {
@@ -405,9 +411,11 @@ void feptx_prec(RU_t *ru) {
 			 aa);
 	}
       }
+#if 0
       LOG_D(PHY,"feptx_prec: frame %d, subframe %d: txp (freq) %d dB\n",
 	    ru->proc.frame_tx,subframe,
 	    dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[0],2*fp->symbols_per_tti*fp->ofdm_symbol_size)));
+#endif
     }
   }
 }
@@ -420,6 +428,8 @@ void fep0(RU_t *ru,int slot) {
 
   //  printf("fep0: slot %d\n",slot);
 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+slot, 1);
+
   remove_7_5_kHz(ru,(slot&1)+(proc->subframe_rx<<1));
   for (l=0; l<fp->symbols_per_tti/2; l++) {
     slot_fep_ul(ru,
@@ -428,6 +438,7 @@ void fep0(RU_t *ru,int slot) {
 		0
 		);
   }
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+slot, 0);
 }
 
 
@@ -505,6 +516,13 @@ void ru_fep_full_2thread(RU_t *ru) {
 
   struct timespec wait;
 
+  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+
+  if ((fp->frame_type == TDD) &&
+     (subframe_select(fp,proc->subframe_rx) != SF_UL)) return;
+
+  if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 );
+
   wait.tv_sec=0;
   wait.tv_nsec=5000000L;
 
@@ -559,11 +577,15 @@ void fep_full(RU_t *ru) {
   int l;
   LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
 
-  start_meas(&ru->ofdm_demod_stats);
+  if ((fp->frame_type == TDD) && 
+     (subframe_select(fp,proc->subframe_rx) != SF_UL)) return;
 
+  start_meas(&ru->ofdm_demod_stats);
+  if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 );
 
   remove_7_5_kHz(ru,proc->subframe_rx<<1);
   remove_7_5_kHz(ru,1+(proc->subframe_rx<<1));
+
   for (l=0; l<fp->symbols_per_tti/2; l++) {
     slot_fep_ul(ru,
 		l,
@@ -576,6 +598,7 @@ void fep_full(RU_t *ru) {
 		0
 		);
   }
+  if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 );
   stop_meas(&ru->ofdm_demod_stats);
   
   
@@ -621,4 +644,3 @@ void do_prach_ru(RU_t *ru) {
   }
 
 }
-
diff --git a/openair1/SCHED/srs_pc.c b/openair1/SCHED/srs_pc.c
index 98049b2ed0cd09a9e1c32da5e8dfad4254970242..04dacecc25a5aa59e6feb2ea35811dbe913082fc 100644
--- a/openair1/SCHED/srs_pc.c
+++ b/openair1/SCHED/srs_pc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SCHED/vars.h b/openair1/SCHED/vars.h
index 39eaf7f1188b8f8d20831d9854bf16f3b3889f80..4dac375f18d0973167228192c7371f75b89d5eea 100644
--- a/openair1/SCHED/vars.h
+++ b/openair1/SCHED/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
index c7815b087db9c3ddaaa46849e7b5bd2a08dcff26..e96db24521f8772a19ce1a7e0d202219604c42dd 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -38,10 +38,7 @@
 #include "UTIL/OCG/OCG_extern.h"
 #include "UTIL/LOG/log.h"
 
-#ifdef USER_MODE
-# include "multicast_link.h"
-# include "pgm_link.h"
-#endif
+#include "multicast_link.h"
 
 char rx_bufferP[BYPASS_RX_BUFFER_SIZE];
 unsigned int num_bytesP = 0;
@@ -51,10 +48,6 @@ static unsigned int byte_tx_count;
 unsigned int Master_list_rx;
 static uint64_t seq_num_tx = 0;
 
-#if defined(ENABLE_PGM_TRANSPORT)
-extern unsigned int pgm_would_block;
-#endif
-
 mapping transport_names[] = {
   {"WAIT PM TRANSPORT INFO", EMU_TRANSPORT_INFO_WAIT_PM},
   {"WAIT SM TRANSPORT INFO", EMU_TRANSPORT_INFO_WAIT_SM},
@@ -62,9 +55,6 @@ mapping transport_names[] = {
   {"ENB_TRANSPORT INFO", EMU_TRANSPORT_INFO_ENB},
   {"UE TRANSPORT INFO", EMU_TRANSPORT_INFO_UE},
   {"RELEASE TRANSPORT INFO", EMU_TRANSPORT_INFO_RELEASE},
-#if defined(ENABLE_PGM_TRANSPORT)
-  {"NACK TRANSPORT INFO", EMU_TRANSPORT_NACK},
-#endif
   {NULL, -1}
 };
 
@@ -79,9 +69,6 @@ void init_bypass (void)
   pthread_mutex_init (&emul_low_mutex, NULL);
   pthread_cond_init (&emul_low_cond, NULL);
   emul_low_mutex_var = 1;
-#endif
-#if defined(ENABLE_PGM_TRANSPORT)
-  pgm_oai_init(oai_emulation.info.multicast_ifname);
 #endif
   bypass_init (emul_tx_handler, emul_rx_handler);
 }
@@ -90,10 +77,8 @@ void init_bypass (void)
 void bypass_init (tx_handler_t tx_handlerP, rx_handler_t rx_handlerP)
 {
   /***************************************************************************/
-#if defined(USER_MODE)
   multicast_link_start (bypass_rx_handler, oai_emulation.info.multicast_group,
                         oai_emulation.info.multicast_ifname);
-#endif //USER_MODE
   tx_handler = tx_handlerP;
   rx_handler = rx_handlerP;
   Master_list_rx=0;
@@ -322,20 +307,12 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
         frame, next_slot, is_master);
 
 #if defined(ENABLE_NEW_MULTICAST)
-# if defined(ENABLE_PGM_TRANSPORT)
-  num_bytesP = pgm_recv_msg(oai_emulation.info.multicast_group,
-                            (uint8_t *)&rx_bufferP[0], sizeof(rx_bufferP),
-                            frame, next_slot);
-
-  DevCheck(num_bytesP > 0, num_bytesP, 0, 0);
-# else
 
   if (multicast_link_read_data_from_sock(is_master) == 1) {
     /* We got a timeout */
     return -1;
   }
 
-# endif
 #else
   pthread_mutex_lock(&emul_low_mutex);
 
@@ -363,10 +340,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
           num_bytesP, map_int_to_str(transport_names, messg->Message_type),
           messg->master_id,
           messg->seq_num);
-#if defined(ENABLE_PGM_TRANSPORT)
-
-    if (messg->Message_type != EMU_TRANSPORT_NACK)
-#endif
       DevCheck4((messg->frame == frame) && (messg->subframe == (next_slot>>1)),
                 messg->frame, frame, messg->subframe, next_slot>>1);
 
@@ -409,20 +382,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
       Master_list_rx = oai_emulation.info.master_list;
       LOG_E(EMU, "RX EMU_TRANSPORT_INFO_RELEASE\n");
       break;
-#if defined(ENABLE_PGM_TRANSPORT)
-
-    case EMU_TRANSPORT_NACK:
-      if (messg->failing_master_id == oai_emulation.info.master_id) {
-        /* We simply re-send the last message */
-        pgm_link_send_msg(oai_emulation.info.multicast_group,
-                          (uint8_t *)bypass_tx_buffer, byte_tx_count);
-      } else {
-        /* Sleep awhile till other peers have recovered data */
-        usleep(500);
-      }
-
-      break;
-#endif
 
     default:
       LOG_E(EMU, "[MAC][BYPASS] ERROR RX UNKNOWN MESSAGE\n");
@@ -448,35 +407,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
 return bytes_read;
 }
 
-/******************************************************************************************************/
-#ifndef USER_MODE
-int bypass_rx_handler(unsigned int fifo, int rw)
-{
-  /******************************************************************************************************/
-  int bytes_read;
-  int bytes_processed=0;
-  int header_bytes; //, elapsed_time;
-  //printk("[BYPASS] BYPASS_RX_HANDLER IN...\n");
-  header_bytes= rtf_get(fifo_bypass_phy_user2kern, rx_bufferP,
-                        sizeof(bypass_proto2multicast_header_t) );
-
-  if (header_bytes> 0) {
-    bytes_read = rtf_get(fifo_bypass_phy_user2kern, &rx_bufferP[header_bytes],
-                         ((bypass_proto2multicast_header_t *) (&rx_bufferP[0]))->size);
-
-    // printk("BYTES_READ=%d\n",bytes_read);
-    if (bytes_read > 0) {
-      num_bytesP=header_bytes+bytes_read;
-      emul_low_mutex_var=0;
-      //printk("BYPASS_PHY SIGNAL MAC_LOW...\n");
-      pthread_cond_signal(&emul_low_cond);
-    }
-  }
-
-  // }
-  return 0;
-}
-#else //USER_MODE
 /******************************************************************************************************/
 void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer)
 {
@@ -503,7 +433,6 @@ void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer)
 #endif
   }
 }
-#endif //USER_MODE
 
 /******************************************************************************************************/
 void  bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
@@ -511,57 +440,12 @@ void  bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
 {
   /******************************************************************************************************/
   if (Master_list_rx != oai_emulation.info.master_list) {
-#ifndef USER_MODE
-    rtf_put(fifo_mac_bypass, &tt, 1);
-    /* the Rx window is still opened  (Re)signal bypass_phy (emulate MAC signal) */
-#endif
     bypass_rx_data(frame, last_slot, next_slot, is_master);
   } else {
     Master_list_rx = 0;
   }
 }
 
-#ifndef USER_MODE
-/***************************************************************************/
-int multicast_link_write_sock (int groupP, char *dataP, unsigned int sizeP)
-{
-  /***************************************************************************/
-  int             tx_bytes=0;
-
-  pthread_mutex_lock(&Tx_mutex);
-
-  while(!Tx_mutex_var) {
-    pthread_cond_wait(&Tx_cond,&Tx_mutex);
-  }
-
-  Tx_mutex_var=0;
-  N_P=(int)((sizeP-sizeof (bypass_proto2multicast_header_t))/1000)+2;
-  tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes],
-                       sizeof (bypass_proto2multicast_header_t));
-
-  while(tx_bytes<sizeP) {
-    if(sizeP-tx_bytes<=1000) {
-      tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes],
-                           sizeP-tx_bytes);
-    } else {
-      tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes],1000);
-    }
-  }
-
-  //RG_tx_mutex_var=0;
-  pthread_mutex_unlock(&Tx_mutex);
-
-  return tx_bytes;
-}
-#endif
-
-#if defined(ENABLE_PGM_TRANSPORT)
-void bypass_tx_nack(unsigned int frame, unsigned int next_slot)
-{
-  bypass_tx_data(NACK_TRANSPORT, frame, next_slot);
-}
-#endif
-
 /***************************************************************************/
 void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int next_slot)
 {
@@ -591,26 +475,6 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
   byte_tx_count = sizeof (bypass_msg_header_t) + sizeof (
                     bypass_proto2multicast_header_t);
 
-#if defined(ENABLE_PGM_TRANSPORT)
-
-  if (Type == NACK_TRANSPORT) {
-    int i;
-    messg->Message_type = EMU_TRANSPORT_NACK;
-
-    for (i = 0; i < oai_emulation.info.nb_master; i++) {
-      /* Skip our id */
-      if (i == oai_emulation.info.master_id)
-        continue;
-
-      if ((Master_list_rx & (1 << i)) == 0) {
-        messg->failing_master_id = i;
-        break;
-      }
-    }
-
-    LOG_T(EMU,"[TX_DATA] NACK TRANSPORT\n");
-  } else
-#endif
     if (Type == WAIT_PM_TRANSPORT) {
       messg->Message_type = EMU_TRANSPORT_INFO_WAIT_PM;
       LOG_T(EMU,"[TX_DATA] WAIT SYNC PM TRANSPORT\n");
@@ -702,32 +566,11 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
   ((bypass_proto2multicast_header_t *) bypass_tx_buffer)->size = byte_tx_count -
       sizeof (bypass_proto2multicast_header_t);
 
-#if defined(ENABLE_PGM_TRANSPORT)
-  pgm_link_send_msg(oai_emulation.info.multicast_group,
-                    (uint8_t *)bypass_tx_buffer, byte_tx_count);
-#else
   multicast_link_write_sock(oai_emulation.info.multicast_group,
                             bypass_tx_buffer, byte_tx_count);
-#endif
 
   LOG_D(EMU, "Frame %d, subframe %d (%d): Sent %d bytes [%s] with master_id %d and seq %"PRIuMAX"\n",
         frame, next_slot>>1, next_slot,byte_tx_count, map_int_to_str(transport_names, Type),
         messg->master_id, messg->seq_num);
 }
 
-#ifndef USER_MODE
-/*********************************************************************************************************************/
-int bypass_tx_handler(unsigned int fifo, int rw)
-{
-  /***************************************************************************/
-  if(++N_R==N_P) {
-    rtf_reset(fifo_bypass_phy_kern2user);
-
-    Tx_mutex_var=1;
-    N_R=0;
-
-    pthread_cond_signal(&Tx_cond);
-  }
-}
-#endif
-
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/defs.h b/openair1/SIMULATION/ETH_TRANSPORT/defs.h
index 48531a2da660de4629bb9acdf72eabe74a7149d7..5cd961b61a2cb6479622355617ba6f613be40f0e 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/defs.h
+++ b/openair1/SIMULATION/ETH_TRANSPORT/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -41,9 +41,6 @@ typedef enum emu_transport_info_e {
   EMU_TRANSPORT_INFO_ENB,
   EMU_TRANSPORT_INFO_UE,
   EMU_TRANSPORT_INFO_RELEASE
-#if defined(ENABLE_PGM_TRANSPORT)
-  ,EMU_TRANSPORT_NACK
-#endif
 } emu_transport_info_t;
 
 #define WAIT_PM_TRANSPORT 1
@@ -52,9 +49,6 @@ typedef enum emu_transport_info_e {
 #define ENB_TRANSPORT 4
 #define UE_TRANSPORT 5
 #define RELEASE_TRANSPORT 6
-#if defined(ENABLE_PGM_TRANSPORT)
-# define NACK_TRANSPORT 7
-#endif
 
 #define WAIT_SYNC_TRANSPORT 1
 #define SYNCED_TRANSPORT 2
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
index 5f34e0e0233e6cc13fbab64f79d29f99914a9714..f71a8ee11727b06e7cd9379475afebe45739a99f 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,49 +40,17 @@
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 
-#include "pgm_link.h"
-
 extern unsigned int Master_list_rx;
 
 extern unsigned char NB_INST;
 //#define DEBUG_CONTROL 1
 //#define DEBUG_EMU   1
 
-#if defined(ENABLE_PGM_TRANSPORT)
-extern unsigned int pgm_would_block;
-#endif
-
 void emu_transport_sync(void)
 {
   LOG_D(EMU, "Entering EMU transport SYNC is primary master %d\n",
         oai_emulation.info.is_primary_master);
 
-#if defined(ENABLE_PGM_TRANSPORT)
-
-  if (oai_emulation.info.is_primary_master == 0) {
-    bypass_tx_data(WAIT_SM_TRANSPORT,0,0);
-    // just wait to recieve the  master 0 msg
-    Master_list_rx = oai_emulation.info.master_list - 1;
-    bypass_rx_data(0,0,0,1);
-  } else {
-    bypass_rx_data(0,0,0,0);
-    bypass_tx_data(WAIT_PM_TRANSPORT,0,0);
-  }
-
-  if (oai_emulation.info.master_list != 0) {
-    bypass_tx_data(SYNC_TRANSPORT,0,0);
-    bypass_rx_data(0,0,0,0);
-
-    // i received the sync from all secondary masters
-    if (emu_rx_status == SYNCED_TRANSPORT) {
-      emu_tx_status = SYNCED_TRANSPORT;
-    }
-
-    LOG_D(EMU,"TX secondary master SYNC_TRANSPORT state \n");
-  }
-
-#else
-
   if (oai_emulation.info.is_primary_master == 0) {
 retry:
     bypass_tx_data(WAIT_SM_TRANSPORT,0,0);
@@ -115,8 +83,6 @@ retry2:
     LOG_D(EMU,"TX secondary master SYNC_TRANSPORT state \n");
   }
 
-#endif
-
   LOG_D(EMU, "Leaving EMU transport SYNC is primary master %d\n",
         oai_emulation.info.is_primary_master);
 }
@@ -154,9 +120,6 @@ void emu_transport(unsigned int frame, unsigned int last_slot,
     }
   }
 
-#if defined(ENABLE_PGM_TRANSPORT)
-  pgm_would_block = 0;
-#endif
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(
     VCD_SIGNAL_DUMPER_FUNCTIONS_EMU_TRANSPORT, VCD_FUNCTION_OUT);
 }
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/extern.h b/openair1/SIMULATION/ETH_TRANSPORT/extern.h
index 89cf38f15b82b7af95deae3f4afcecb5d5b62bfb..c01b5584e23f70b44f7820ef15832e94760118ed 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/extern.h
+++ b/openair1/SIMULATION/ETH_TRANSPORT/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -31,11 +31,7 @@
 #ifndef __BYPASS_SESSION_LAYER_EXTERN_H__
 #    define __BYPASS_SESSION_LAYER_EXTERN_H__
 
-#ifndef USER_MODE
-#include <rtai_posix.h>
-#else
 #include <pthread.h>
-#endif //RTAI_ENABLED
 
 extern unsigned char Emulation_status;
 extern unsigned char emu_tx_status;
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
index d161da6a74d13ce32e7518f84e428d1ed69a751e..1ba724976fabdd87b82c623ee50ea9b43cb8cbfb 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -54,9 +54,7 @@
 #include "socket.h"
 #include "multicast_link.h"
 
-#ifdef USER_MODE
-# include "UTIL/LOG/log.h"
-#endif //USER_MODE
+#include "UTIL/LOG/log.h"
 
 extern unsigned short Master_id;
 
@@ -316,9 +314,7 @@ void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
   LOG_I(EMU, "[MULTICAST] LINK START on interface=%s for group=%d: handler=%p\n",
         (multicast_if == NULL) ? "not specified" : multicast_if, multicast_group,
         rx_handler);
-#if !defined(ENABLE_PGM_TRANSPORT)
   multicast_link_init ();
-#endif
 #if ! defined(ENABLE_NEW_MULTICAST)
   LOG_D(EMU, "[MULTICAST] multicast link start thread\n");
 
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h
index d4071e7ff2bd8c47ec768c87587dda09c2011224..3c072e0e3c8911cbed63a09bb3e198fd41ac1b3f 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h
+++ b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
index b0c01706fd23606aed73e41835525bfcd8de28de..b578721a1a0ffed4b79f7956551d8ae3fe49c00c 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c b/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c
deleted file mode 100644
index 9feeeca45786298d67c04eadf748e0540b49186c..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file pgm_link.c
- *  \brief implementation a warpper for openpgm for reliable multicast transmission
- *  \author Navid Nikaein and S. Roux
- *  \date 2013 - 2014
- *  \version 1.0
- *  \company Eurecom
- *  \email: navid.nikaein@eurecom.fr
- */
-
-#include <pthread.h>
-#include <stdint.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <arpa/inet.h>
-
-#if defined(ENABLE_PGM_TRANSPORT)
-
-#include <pgm/pgm.h>
-
-#include "assertions.h"
-
-#include "pgm_link.h"
-#include "multicast_link.h"
-
-#include "UTIL/OCG/OCG.h"
-#include "UTIL/OCG/OCG_extern.h"
-
-#include "UTIL/LOG/log.h"
-
-// #define ENABLE_PGM_DEBUG
-
-typedef struct {
-  pgm_sock_t *sock;
-  uint16_t port;
-  uint8_t  rx_buffer[40000];
-} pgm_multicast_group_t;
-
-pgm_multicast_group_t pgm_multicast_group[MULTICAST_LINK_NUM_GROUPS];
-
-static
-int pgm_create_socket(int index, const char *if_addr);
-
-unsigned int pgm_would_block = 1;
-
-#if defined(ENABLE_PGM_DEBUG)
-static void
-log_handler (
-  const int         log_level,
-  const char*       message,
-  void*             closure
-)
-{
-  printf("%s\n", message);
-}
-#endif
-
-int pgm_oai_init(char *if_addr)
-{
-  pgm_error_t* pgm_err = NULL;
-
-  memset(pgm_multicast_group, 0,
-         MULTICAST_LINK_NUM_GROUPS * sizeof(pgm_multicast_group_t));
-
-#if defined(ENABLE_PGM_DEBUG)
-  pgm_messages_init();
-  pgm_min_log_level = PGM_LOG_LEVEL_DEBUG;
-  pgm_log_mask = 0xFFF;
-
-  pgm_log_set_handler(log_handler, NULL);
-#endif
-
-  if (!pgm_init(&pgm_err)) {
-    LOG_E(EMU, "Unable to start PGM engine: %s\n", pgm_err->message);
-    pgm_error_free (pgm_err);
-    exit(EXIT_FAILURE);
-  }
-
-  return pgm_create_socket(oai_emulation.info.multicast_group, if_addr);
-}
-
-int pgm_recv_msg(int group, uint8_t *buffer, uint32_t length,
-                 unsigned int frame, unsigned int next_slot)
-{
-  size_t                num_bytes = 0;
-  int                   status    = 0;
-  pgm_error_t*          pgm_err   = NULL;
-  struct pgm_sockaddr_t from;
-  socklen_t             fromlen   = sizeof(from);
-  uint32_t              timeout   = 0;
-  int                   flags     = 0;
-
-  if (pgm_would_block == 0) {
-    flags = MSG_DONTWAIT;
-  }
-
-  DevCheck((group <= MULTICAST_LINK_NUM_GROUPS) && (group >= 0),
-           group, MULTICAST_LINK_NUM_GROUPS, 0);
-
-#ifdef DEBUG_EMU
-  LOG_I(EMU, "[PGM] Entering recv function for group %d\n", group);
-#endif
-
-  do {
-    status = pgm_recvfrom(pgm_multicast_group[group].sock,
-                          buffer,
-                          length,
-                          flags,
-                          &num_bytes,
-                          &from,
-                          &fromlen,
-                          &pgm_err);
-
-    if (PGM_IO_STATUS_NORMAL == status) {
-#ifdef DEBUG_EMU
-      LOG_D(EMU, "[PGM] Received %d bytes for group %d\n", num_bytes, group);
-#endif
-      return num_bytes;
-    } else if (PGM_IO_STATUS_TIMER_PENDING == status) {
-      if (pgm_would_block == 0) {
-        /* We sleep for 50 usec */
-        usleep(50);
-
-        timeout ++;
-
-        if (timeout == (1000000 / 50)) {
-          LOG_W(EMU, "[PGM] A packet has been lost -> ask for retransmit\n");
-          /* If we do not receive a packet after 10000usec
-          * -> send a NACK */
-          bypass_tx_nack(frame, next_slot);
-          timeout = 0;
-        }
-      }
-    } else if (PGM_IO_STATUS_RESET == status) {
-      LOG_W(EMU, "[PGM] Got session reset\n");
-    } else {
-#ifdef DEBUG_EMU
-      LOG_D(EMU, "[PGM] Got status %d\n", status);
-#endif
-
-      if (pgm_err) {
-        LOG_E(EMU, "[PGM] recvform failed: %s", pgm_err->message);
-        pgm_error_free (pgm_err);
-        pgm_err = NULL;
-      }
-    }
-  } while(status != PGM_IO_STATUS_NORMAL);
-
-  return -1;
-}
-
-int pgm_link_send_msg(int group, uint8_t *data, uint32_t len)
-{
-  int status;
-  size_t bytes_written = 0;
-
-  do {
-    status = pgm_send(pgm_multicast_group[group].sock, data, len, &bytes_written);
-  } while(status == PGM_IO_STATUS_WOULD_BLOCK);
-
-  if (status != PGM_IO_STATUS_NORMAL) {
-    return -1;
-  }
-
-  return bytes_written;
-}
-
-static
-int pgm_create_socket(int index, const char *if_addr)
-{
-  struct pgm_addrinfo_t* res = NULL;
-  pgm_error_t*          pgm_err        = NULL;
-  sa_family_t           sa_family      = AF_INET;
-  int                   udp_encap_port = 46014 + index;
-  int                   max_tpdu       = 1500;
-  int                   sqns           = 100;
-  int                   port           = 0;
-  struct pgm_sockaddr_t addr;
-  int                   blocking       = 1;
-  int                   multicast_loop = 0;
-  int                   multicast_hops = 0;
-  int                   dscp, i;
-
-  port = udp_encap_port;
-
-  /* Use PGM */
-  udp_encap_port = 0;
-
-  LOG_D(EMU, "[PGM] Preparing socket for group %d and address %s\n",
-        index, if_addr);
-
-  if (!pgm_getaddrinfo(if_addr, NULL, &res, &pgm_err)) {
-    LOG_E(EMU, "Parsing network parameter: %s\n", pgm_err->message);
-    goto err_abort;
-  }
-
-  if (udp_encap_port) {
-    LOG_I(EMU, "[PGM] Creating PGM/UDP socket for encapsulated port %d\n",
-          udp_encap_port);
-
-    if (!pgm_socket (&pgm_multicast_group[index].sock, sa_family,
-                     SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) {
-      LOG_E(EMU, "[PGM] Socket: %s\n", pgm_err->message);
-      goto err_abort;
-    }
-
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_UDP_ENCAP_UCAST_PORT, &udp_encap_port,
-                   sizeof(udp_encap_port));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_UDP_ENCAP_MCAST_PORT, &udp_encap_port,
-                   sizeof(udp_encap_port));
-  } else {
-    LOG_I(EMU, "[PGM] Creating PGM/IP socket\n");
-
-    if (!pgm_socket(&pgm_multicast_group[index].sock, sa_family,
-                    SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) {
-      LOG_E(EMU, "Creating PGM/IP socket: %s\n", pgm_err->message);
-      goto err_abort;
-    }
-  }
-
-  {
-    /* Use RFC 2113 tagging for PGM Router Assist */
-    const int no_router_assist = 0;
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_IP_ROUTER_ALERT, &no_router_assist,
-                   sizeof(no_router_assist));
-  }
-
-  //     pgm_drop_superuser();
-
-  {
-    /* set PGM parameters */
-    const int recv_only = 0,
-              passive = 0,
-              peer_expiry = pgm_secs (300),
-              spmr_expiry = pgm_msecs (250),
-              nak_bo_ivl = pgm_msecs (10),
-              nak_rpt_ivl = pgm_secs (2),
-              nak_rdata_ivl = pgm_secs (2),
-              nak_data_retries = 50,
-              nak_ncf_retries = 50,
-              ambient_spm = pgm_secs(30);
-    const int heartbeat_spm[] = {
-      pgm_msecs (100),
-      pgm_msecs (100),
-      pgm_msecs (100),
-      pgm_msecs (100),
-      pgm_msecs (1300),
-      pgm_secs  (7),
-      pgm_secs  (16),
-      pgm_secs  (25),
-      pgm_secs  (30)
-    };
-
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_RECV_ONLY, &recv_only, sizeof(recv_only));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_PASSIVE, &passive, sizeof(passive));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_MTU, &max_tpdu, sizeof(max_tpdu));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_RXW_SQNS, &sqns, sizeof(sqns));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm));
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_TXW_SQNS, &sqns, sizeof(sqns));
-  }
-
-  /* create global session identifier */
-  memset (&addr, 0, sizeof(addr));
-  /* sa_port should be in host byte order */
-  addr.sa_port = port;
-  addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT + index;
-
-  if (!pgm_gsi_create_from_hostname(&addr.sa_addr.gsi, &pgm_err)) {
-    LOG_E(EMU, "[PGM] Creating GSI: %s\n", pgm_err->message);
-    goto err_abort;
-  }
-
-  LOG_D(EMU, "[PGM] Created GSI %s\n", pgm_tsi_print(&addr.sa_addr));
-
-  /* assign socket to specified address */
-  {
-    struct pgm_interface_req_t if_req;
-    memset (&if_req, 0, sizeof(if_req));
-    if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface;
-    if_req.ir_scope_id  = 0;
-
-    if (AF_INET6 == sa_family) {
-      struct sockaddr_in6 sa6;
-      memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6));
-      if_req.ir_scope_id = sa6.sin6_scope_id;
-    }
-
-    if (!pgm_bind3(pgm_multicast_group[index].sock, &addr, sizeof(addr),
-                   &if_req, sizeof(if_req),        /* tx interface */
-                   &if_req, sizeof(if_req),        /* rx interface */
-                   &pgm_err)) {
-      LOG_E(EMU, "[PGM] Error: %s\n", pgm_err->message);
-      goto err_abort;
-    }
-  }
-
-  /* join IP multicast groups */
-  {
-    struct group_req req;
-    struct sockaddr_in addr_in;
-
-    memset(&req, 0, sizeof(req));
-
-    /* Interface index */
-    req.gr_interface = res->ai_recv_addrs[0].gsr_interface;
-
-    addr_in.sin_family = AF_INET;
-    addr_in.sin_port = htons(port);
-
-    for (i = 0; i < MULTICAST_LINK_NUM_GROUPS; i++) {
-      addr_in.sin_addr.s_addr = inet_addr(multicast_group_list[i]);
-      memcpy(&req.gr_group, &addr_in, sizeof(addr_in));
-
-      pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                     PGM_JOIN_GROUP, &req,
-                     sizeof(struct group_req));
-    }
-
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                   PGM_SEND_GROUP, &req,
-                   sizeof(struct group_req));
-  }
-
-  pgm_freeaddrinfo(res);
-  res = NULL;
-
-  /* set IP parameters */
-  multicast_hops = 64;
-  dscp = 0x2e << 2;             /* Expedited Forwarding PHB for network elements, no ECN. */
-
-  pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                 PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop));
-  pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM,
-                 PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops));
-
-  if (AF_INET6 != sa_family)
-    pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, PGM_TOS,
-                   &dscp, sizeof(dscp));
-
-  pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, PGM_NOBLOCK,
-                 &blocking, sizeof(blocking));
-
-  if (!pgm_connect(pgm_multicast_group[index].sock, &pgm_err)) {
-    LOG_E(EMU, "[PGM] Connecting socket: %s\n", pgm_err->message);
-    goto err_abort;
-  }
-
-  return 0;
-
-err_abort:
-
-  if (NULL != pgm_multicast_group[index].sock) {
-    pgm_close(pgm_multicast_group[index].sock, FALSE);
-    pgm_multicast_group[index].sock = NULL;
-  }
-
-  if (NULL != res) {
-    pgm_freeaddrinfo(res);
-    res = NULL;
-  }
-
-  if (NULL != pgm_err) {
-    pgm_error_free(pgm_err);
-    pgm_err = NULL;
-  }
-
-  exit(EXIT_FAILURE);
-}
-
-#endif
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/proto.h b/openair1/SIMULATION/ETH_TRANSPORT/proto.h
index 5b43c8621771f9a4fdae2713a62b26cb2b07803b..25b3265757d74b9ff471021211afefc31c7790e0 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/proto.h
+++ b/openair1/SIMULATION/ETH_TRANSPORT/proto.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -39,14 +39,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
                    unsigned int next_slot, uint8_t is_master);
 void  bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
                             unsigned int next_slot, uint8_t is_master);
-#ifndef USER_MODE
-int multicast_link_write_sock (int groupP, char *dataP, unsigned int sizeP);
-int bypass_tx_handler(unsigned int fifo, int rw);
-int bypass_rx_handler(unsigned int fifo, int rw);
-#else
-void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer);
-#endif
-
 void bypass_tx_data (emu_transport_info_t Type, unsigned int frame, unsigned int next_slot);
 
 void emulation_tx_rx(void);
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/socket.c b/openair1/SIMULATION/ETH_TRANSPORT/socket.c
index d8dd81ffdc56e76e78294d07420d0edc16541572..2b28a6617032adf2bb0eca4f93f192e81d681326 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/socket.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/socket.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -41,9 +41,7 @@
 //#include "openair_defs.h"
 #include "socket.h"
 
-#ifdef USER_MODE
 #define msg printf
-#endif
 //------------------------------------------------------------------------------
 void
 socket_setnonblocking (int sockP)
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/socket.h b/openair1/SIMULATION/ETH_TRANSPORT/socket.h
index ede14f8db150b97f00f520ca03b33ac368169a64..c7a2224375e8f9d797c0ad9c6bf515dc1f90f9e1 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/socket.h
+++ b/openair1/SIMULATION/ETH_TRANSPORT/socket.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/vars.h b/openair1/SIMULATION/ETH_TRANSPORT/vars.h
index 09d9c94295a340fdfaea18283fff6c3af789387a..f49678642ed19458f41b349034a5688de544161d 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/vars.h
+++ b/openair1/SIMULATION/ETH_TRANSPORT/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,11 +28,7 @@
 * \email: navid.nikaein@eurecom.fr
 */
 
-#ifndef USER_MODE
-#include <rtai_posix.h>
-#else
 #include <pthread.h>
-#endif
 #include "defs.h"
 
 #ifndef __BYPASS_SESSION_LAYER_VARS_H__
diff --git a/openair1/SIMULATION/LTE_PHY/LTE_Configuration.c b/openair1/SIMULATION/LTE_PHY/LTE_Configuration.c
index 6507a656a1e775f3a1fa3381d1e02064fe214e8a..c894e49e909e378760ce4a493bfdd3917bcc74db 100644
--- a/openair1/SIMULATION/LTE_PHY/LTE_Configuration.c
+++ b/openair1/SIMULATION/LTE_PHY/LTE_Configuration.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/LTE_Configuration.h b/openair1/SIMULATION/LTE_PHY/LTE_Configuration.h
index ce8a3b994f19f227465dbe315ca17a3d92e4aee2..06b93650e7e0f02a502810337e09adda8606ec5a 100644
--- a/openair1/SIMULATION/LTE_PHY/LTE_Configuration.h
+++ b/openair1/SIMULATION/LTE_PHY/LTE_Configuration.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/Makefile b/openair1/SIMULATION/LTE_PHY/Makefile
deleted file mode 100644
index 713bfba3706fc0b3d086f6df1ae7bc61fd2db489..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/LTE_PHY/Makefile
+++ /dev/null
@@ -1,202 +0,0 @@
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-
-COMMON_UTILS_DIR = $(OPENAIR_DIR)/common/utils
-TOP_DIR = $(OPENAIR1_DIR)
-OPENAIR1_TOP = $(OPENAIR1_DIR)
-OPENAIR2_TOP = $(OPENAIR2_DIR)
-OPENAIR3 = $(OPENAIR3_DIR)
-
-CFLAGS += -DMAX_NUM_CCs=1 -Wall -DPHYSIM -DNODE_RG -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO -DLOG_NO_THREAD # -Wno-packed-bitfield-compat
-
-# enable C99 mode
-CFLAGS += -std=gnu99
-
-# DCI Debug
-# CFLAGS += -DDEBUG_DCI_ENCODING
-# TODO: only for framegen
-#CFLAGS += -DOPENAIR2
-#CFLAGS += -DDEBUG_PHY_PROC
-#CFLAGS += -DDEBUG_GROUPHOP
-
-ifdef OMP
-CFLAGS += -DOMP -fopenmp
-endif
-ifdef LLR8
-CFLAGS += -DLLR8
-endif
-CFLAGS += -DNEW_FFT
-
-LFLAGS = -lm -lblas -lxml2 -lrt -lpthread $(LFDS_DIR)/bin/liblfds611.a
-
-ifdef GPIB
-LFLAGS += -lgpib
-endif
-
-CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH #-DIFFT_FPGA -DIFFT_FPGA_UE
-#CFLAGS += -DTBS_FIX
-CFLAGS += -DCELLULAR
-
-ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
-
-ifdef EMOS
-CFLAGS += -DEMOS
-endif
-
-ifdef DEBUG_PHY
-CFLAGS += -DDEBUG_PHY
-endif
-
-ifdef MeNBMUE
-CFLAGS += -DMeNBMUE
-endif
-
-ifdef MU_RECEIVER
-CFLAGS += -DMU_RECEIVER
-endif
-
-ifdef ZBF_ENABLED
-CFLAGS += -DNULL_SHAPE_BF_ENABLED
-endif
-
-ifdef RANDOM_BF
-CFLAGS += -DRANDOM_BF
-endif
-
-ifdef PBS_SIM
-CFLAGS += -DPBS_SIM
-endif
-
-ifdef XFORMS
-CFLAGS += -DXFORMS
-LFLAGS += -lforms
-endif
-
-ifdef SMBV
-CFLAGS += -DSMBV
-endif
-
-ifdef PERFECT_CE
-CFLAGS += -DPERFECT_CE
-endif
-
-ifdef BIT8_TX
-CFLAGS += -DBIT8_TX
-endif
-
-CFLAGS += -DNO_RRM -DOPENAIR1 -DPHY_ABSTRACTION #-DOPENAIR2
-
-CFLAGS += -I/usr/include/X11 -I/usr/X11R6/include
-
-ifdef RTAI
-CFLAGS += -DRTAI_ENABLED  -D__IN_RTAI__ $(shell rtai-config --lxrt-cflags)
-LFLAGS += $(shell rtai-config --lxrt-ldflags) -llxrt
-endif
-
-include $(COMMON_UTILS_DIR)/Makefile.inc
-include $(TOP_DIR)/PHY/Makefile.inc
-include $(TOP_DIR)/SCHED/Makefile.inc
-include $(TOP_DIR)/SIMULATION/Makefile.inc
-include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
-include $(OPENAIR2_DIR)/UTIL/Makefile.inc
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-#LOG_OBJS +=  $(LOG_DIR)/vcd_signal_dumper.o
-
-CFLAGS += $(L2_incl) -I$(ASN1_MSG_INC) -I$(TOP_DIR) -I$(OPENAIR2_DIR) -I$(OPENAIR3) $(UTIL_incl) $(UTILS_incl)
-# EXTRA_CFLAGS = 
-
-#STATS_OBJS += $(TOP_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_proc.o
-
-#LAYER2_OBJ += $(OPENAIR2_DIR)/LAYER2/MAC/rar_tools.o
-#LAYER2_OBJ = $(OPENAIR2_DIR)/LAYER2/MAC/lte_transport_init.o
-
-OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(LAYER2_OBJ) $(LOG_OBJS) $(ITTI_DIR)/backtrace.o
-ifdef GPIB
-OBJ += LTE_Configuration.o
-endif
-#OBJ2 = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS)  
-
-ifdef XFORMS
-OBJ += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
-endif
-
-ifdef STATIC
-LFLAGS += -static -L/usr/lib/libblas
-endif
-
-all: dlsim pbchsim pdcchsim ulsim pucchsim prachsim mbmssim scansim
-
-$(LFDS_DIR)/bin/liblfds611.a:
-	$(MAKE) -C $(LFDS_DIR) -f makefile.linux
-
-test: $(SIMULATION_OBJS) $(TOOLS_OBJS) $(TOP_DIR)/PHY/INIT/lte_init.o test.c
-	$(CC)  test.c -I$(TOP_DIR) -o test $(CFLAGS) $(SIMULATION_OBJS) $(TOOLS_OBJS) -lm 
-
-OBJ += $(LIST_OBJ) 
-OBJ += $(MEM_OBJ)
-$(OBJ) : %.o : %.c
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) -o $@ $<
-
-dlsim : $(OBJ) dlsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling dlsim.c ..."
-	@$(CC) dlsim.c  -o dlsim $(CFLAGS) $(OBJ) $(LFLAGS)
-
-dlsim2 : $(OBJ) dlsim2.c
-	@echo "Compiling dlsim2.c ..."
-	@$(CC) dlsim2.c  -o dlsim2 $(CFLAGS) $(OBJ) $(LFLAGS)
-
-framegen: $(OBJ) framegen.c
-	@echo "Compiling framegen.c"
-	@$(CC) framegen.c -o framegen $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-pbchsim : $(OBJ) pbchsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling pbchsim.c"
-	@$(CC) pbchsim.c  -o pbchsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-scansim : $(OBJ) scansim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling scansim.c"
-	@$(CC) scansim.c -o scansim $(CFLAGS) $(OBJ) $(LFLAGS)
-
-mbmssim : $(OBJ) mbmssim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling mbmssim.c"
-	@$(CC) mbmssim.c  -o mbmssim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-pdcchsim : $(OBJ) pdcchsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling pdcchsim.c"
-	@$(CC) pdcchsim.c  -o pdcchsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-pucchsim : $(OBJ) pucchsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling pucchsim.c"
-	@$(CC) pucchsim.c  -o pucchsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-prachsim : $(OBJ) prachsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling prachsim.c"
-	@$(CC) prachsim.c  -o prachsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-ulsim : $(OBJ) ulsim.c $(LFDS_DIR)/bin/liblfds611.a #ulsim_form.c
-	@echo "Compiling [ulsim.c]"
-	@$(CC) ulsim.c -o ulsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-syncsim : $(OBJ) syncsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling syncsim.c"
-	@$(CC) syncsim.c  -o syncsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-clean :
-	rm -f $(OBJ)
-	rm -f *.o
-
-cleanall : clean
-	rm -f dlsim pbchsim pdcchsim ulsim pucchsim mbmssim prachsim 
-	rm -f *.exe*
-
-showflags :
-	@echo $(CFLAGS)
-	@echo $(LFLAGS)
-
-showobj:
-	@echo $(SCHED_OBJS)
-
-cppcheck:
-	@echo "cppcheck ..."
-	cppcheck $(INCLUDES) ${OBJ:.o=.c} ${OAISIM_OBJS,.o=.c} ${ASN1_RRC_MSG_OBJS1,.o=.c}
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index 02591dcc8f3ecd608372bae441b6d598c8e6cdd9..885d29cc4e1c8caee548a5f376c8f7b4daa8632e 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -54,8 +54,9 @@
 
 #include "PHY/TOOLS/lte_phy_scope.h"
 
-PHY_VARS_eNB *eNB;
-PHY_VARS_UE *UE;
+#include "dummy_functions.c"
+
+
 
 double cpuf;
 
@@ -123,7 +124,7 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
 
 }
 
-void DL_channel(PHY_VARS_eNB *eNB,PHY_VARS_UE *UE,int subframe,int awgn_flag,double SNR, int tx_lev,int hold_channel,int abstx, int num_rounds, int trials, int round, channel_desc_t *eNB2UE[4],
+void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR, int tx_lev,int hold_channel,int abstx, int num_rounds, int trials, int round, channel_desc_t *eNB2UE[4],
 		double *s_re[2],double *s_im[2],double *r_re[2],double *r_im[2],FILE *csv_fd) {
 
   int i,u;
@@ -134,18 +135,18 @@ void DL_channel(PHY_VARS_eNB *eNB,PHY_VARS_UE *UE,int subframe,int awgn_flag,dou
 
   //    printf("Copying tx ..., nsymb %d (n_tx %d), awgn %d\n",nsymb,eNB->frame_parms.nb_antennas_tx,awgn_flag);
   for (i=0; i<2*UE->frame_parms.samples_per_tti; i++) {
-    for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
+    for (aa=0; aa<ru->frame_parms.nb_antennas_tx; aa++) {
       if (awgn_flag == 0) {
-	s_re[aa][i] = ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) + (i<<1)]);
-	s_im[aa][i] = ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
+	s_re[aa][i] = ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) + (i<<1)]);
+	s_im[aa][i] = ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
       } else {
 	for (aarx=0; aarx<UE->frame_parms.nb_antennas_rx; aarx++) {
 	  if (aa==0) {
-	    r_re[aarx][i] = ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)]);
-	    r_im[aarx][i] = ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
+	    r_re[aarx][i] = ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)]);
+	    r_im[aarx][i] = ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
 	  } else {
-	    r_re[aarx][i] += ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)]);
-	    r_im[aarx][i] += ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
+	    r_re[aarx][i] += ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)]);
+	    r_im[aarx][i] += ((double)(((short *)ru->common.txdata[aa]))[(2*subframe*UE->frame_parms.samples_per_tti) +(i<<1)+1]);
 	  }
 
 	}
@@ -180,11 +181,11 @@ void DL_channel(PHY_VARS_eNB *eNB,PHY_VARS_UE *UE,int subframe,int awgn_flag,dou
   if(abstx) {
     if (trials==0 && round==0) {
       // calculate freq domain representation to compute SINR
-      freq_channel(eNB2UE[0], eNB->frame_parms.N_RB_DL,2*eNB->frame_parms.N_RB_DL + 1);
+      freq_channel(eNB2UE[0], ru->frame_parms.N_RB_DL,2*ru->frame_parms.N_RB_DL + 1);
       // snr=pow(10.0,.1*SNR);
       fprintf(csv_fd,"%f,",SNR);
 
-      for (u=0; u<2*eNB->frame_parms.N_RB_DL; u++) {
+      for (u=0; u<2*ru->frame_parms.N_RB_DL; u++) {
 	for (aarx=0; aarx<eNB2UE[0]->nb_rx; aarx++) {
 	  for (aatx=0; aatx<eNB2UE[0]->nb_tx; aatx++) {
 	    channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].x;
@@ -195,9 +196,9 @@ void DL_channel(PHY_VARS_eNB *eNB,PHY_VARS_UE *UE,int subframe,int awgn_flag,dou
       }
 
       if(num_rounds>1) {
-	freq_channel(eNB2UE[1], eNB->frame_parms.N_RB_DL,2*eNB->frame_parms.N_RB_DL + 1);
+	freq_channel(eNB2UE[1], ru->frame_parms.N_RB_DL,2*ru->frame_parms.N_RB_DL + 1);
 
-	for (u=0; u<2*eNB->frame_parms.N_RB_DL; u++) {
+	for (u=0; u<2*ru->frame_parms.N_RB_DL; u++) {
 	  for (aarx=0; aarx<eNB2UE[1]->nb_rx; aarx++) {
 	    for (aatx=0; aatx<eNB2UE[1]->nb_tx; aatx++) {
 	      channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].x;
@@ -207,9 +208,9 @@ void DL_channel(PHY_VARS_eNB *eNB,PHY_VARS_UE *UE,int subframe,int awgn_flag,dou
 	  }
 	}
 
-	freq_channel(eNB2UE[2], eNB->frame_parms.N_RB_DL,2*eNB->frame_parms.N_RB_DL + 1);
+	freq_channel(eNB2UE[2], ru->frame_parms.N_RB_DL,2*ru->frame_parms.N_RB_DL + 1);
 
-	for (u=0; u<2*eNB->frame_parms.N_RB_DL; u++) {
+	for (u=0; u<2*ru->frame_parms.N_RB_DL; u++) {
 	  for (aarx=0; aarx<eNB2UE[2]->nb_rx; aarx++) {
 	    for (aatx=0; aatx<eNB2UE[2]->nb_tx; aatx++) {
 	      channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].x;
@@ -219,9 +220,9 @@ void DL_channel(PHY_VARS_eNB *eNB,PHY_VARS_UE *UE,int subframe,int awgn_flag,dou
 	  }
 	}
 
-	freq_channel(eNB2UE[3], eNB->frame_parms.N_RB_DL,2*eNB->frame_parms.N_RB_DL + 1);
+	freq_channel(eNB2UE[3], ru->frame_parms.N_RB_DL,2*ru->frame_parms.N_RB_DL + 1);
 
-	for (u=0; u<2*eNB->frame_parms.N_RB_DL; u++) {
+	for (u=0; u<2*ru->frame_parms.N_RB_DL; u++) {
 	  for (aarx=0; aarx<eNB2UE[3]->nb_rx; aarx++) {
 	    for (aatx=0; aatx<eNB2UE[3]->nb_tx; aatx++) {
 	      channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].x;
@@ -237,11 +238,11 @@ void DL_channel(PHY_VARS_eNB *eNB,PHY_VARS_UE *UE,int subframe,int awgn_flag,dou
   //AWGN
   // tx_lev is the average energy over the whole subframe
   // but SNR should be better defined wrt the energy in the reference symbols
-  sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)eNB->frame_parms.ofdm_symbol_size/(double)(eNB->frame_parms.N_RB_DL*12)) - SNR;
+  sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)ru->frame_parms.ofdm_symbol_size/(double)(ru->frame_parms.N_RB_DL*12)) - SNR;
   sigma2 = pow(10,sigma2_dB/10);
 
   for (i=0; i<2*UE->frame_parms.samples_per_tti; i++) {
-    for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
+    for (aa=0; aa<UE->frame_parms.nb_antennas_rx; aa++) {
       //printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]);
       ((short*) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i] =
 	(short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
@@ -251,28 +252,118 @@ void DL_channel(PHY_VARS_eNB *eNB,PHY_VARS_UE *UE,int subframe,int awgn_flag,dou
   }
 }
 
+uint16_t
+fill_tx_req(nfapi_tx_request_body_t *tx_req_body,
+	    uint16_t                absSF,
+	    uint16_t                pdu_length,
+	    uint16_t                pdu_index,
+	    uint8_t                 *pdu)
+{
+  nfapi_tx_request_pdu_t *TX_req = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus];
+  LOG_D(MAC, "Filling TX_req %d for pdu length %d\n",
+	tx_req_body->number_of_pdus, pdu_length);
+
+  TX_req->pdu_length                 = pdu_length;
+  TX_req->pdu_index                  = pdu_index;
+  TX_req->num_segments               = 1;
+  TX_req->segments[0].segment_length = pdu_length;
+  TX_req->segments[0].segment_data   = pdu;
+  tx_req_body->tl.tag                = NFAPI_TX_REQUEST_BODY_TAG;
+  tx_req_body->number_of_pdus++;
+
+  return (((absSF / 10) << 4) + (absSF % 10));
+}
+
+void
+fill_dlsch_config(nfapi_dl_config_request_body_t * dl_req,
+		  uint16_t length,
+		  uint16_t pdu_index,
+		  uint16_t rnti,
+		  uint8_t resource_allocation_type,
+		  uint8_t virtual_resource_block_assignment_flag,
+		  uint16_t resource_block_coding,
+		  uint8_t modulation,
+		  uint8_t redundancy_version,
+		  uint8_t transport_blocks,
+		  uint8_t transport_block_to_codeword_swap_flag,
+		  uint8_t transmission_scheme,
+		  uint8_t number_of_layers,
+		  uint8_t number_of_subbands,
+		  //                             uint8_t codebook_index,
+		  uint8_t ue_category_capacity,
+		  uint8_t pa,
+		  uint8_t delta_power_offset_index,
+		  uint8_t ngap,
+		  uint8_t nprb,
+		  uint8_t transmission_mode,
+		  uint8_t num_bf_prb_per_subband,
+		  uint8_t num_bf_vector)
+{
+  nfapi_dl_config_request_pdu_t *dl_config_pdu =
+    &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+  memset((void *) dl_config_pdu, 0,
+	 sizeof(nfapi_dl_config_request_pdu_t));
+
+  dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+  dl_config_pdu->pdu_size                                                        = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag                                 = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length                                 = length;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = pdu_index;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = rnti;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = resource_allocation_type;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = virtual_resource_block_assignment_flag;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = resource_block_coding;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = modulation;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = redundancy_version;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = transport_blocks;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = transport_block_to_codeword_swap_flag;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = transmission_scheme;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = number_of_layers;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = number_of_subbands;
+  //  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = codebook_index;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = ue_category_capacity;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = pa;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = delta_power_offset_index;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = ngap;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = nprb;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = transmission_mode;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = num_bf_prb_per_subband;
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = num_bf_vector;
+  dl_req->number_pdu++;
+}
 
 void fill_DCI(PHY_VARS_eNB *eNB,
-	      DCI_ALLOC_t *dci_alloc,
+	      int frame,
 	      int subframe,
+	      Sched_Rsp_t *sched_resp,
+	      uint8_t input_buffer[NUMBER_OF_UE_MAX][20000],
 	      int n_rnti,
 	      int n_users,
 	      int transmission_mode,
+	      int retrans,
 	      int common_flag,
+	      int NB_RB,
 	      int DLSCH_RB_ALLOC,
 	      int TPC,
 	      int mcs1,
 	      int mcs2,
 	      int ndi,
 	      int rv,
+	      int pa,
 	      int *num_common_dci,
 	      int *num_ue_spec_dci,
 	      int *num_dci) {
 
   int k;
-  int dci_length = -1,dci_length_bytes = -1;
 
-  //  printf("Generating DCIs for %d users, TM %d, mcs1 %d\n",n_users,transmission_mode,mcs1);
+  nfapi_dl_config_request_body_t *dl_req=&sched_resp->DL_req->dl_config_request_body;
+  nfapi_dl_config_request_pdu_t  *dl_config_pdu;
+  nfapi_tx_request_body_t        *TX_req=&sched_resp->TX_req->tx_request_body;
+
+  dl_req->number_dci=0;
+  dl_req->number_pdu=0;
+  TX_req->number_of_pdus=0;
+
   for(k=0; k<n_users; k++) {
     switch(transmission_mode) {
     case 1:
@@ -282,903 +373,106 @@ void fill_DCI(PHY_VARS_eNB *eNB,
     case 7:
       if (common_flag == 0) {
 
-	if (eNB->frame_parms.frame_type == TDD) {
-
-	  switch (eNB->frame_parms.N_RB_DL) {
-	  case 6:
-	    dci_length = sizeof_DCI1_1_5MHz_TDD_t;
-	    dci_length_bytes = sizeof(DCI1_1_5MHz_TDD_t);
-	    ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-	    ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-	    ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-	    ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-	    ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-	    ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-	    ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = ndi;
-	    ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = rv;
-	    break;
-
-	  case 25:
-	    dci_length = sizeof_DCI1_5MHz_TDD_t;
-	    dci_length_bytes = sizeof(DCI1_5MHz_TDD_t);
-	    ((DCI1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-	    ((DCI1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-	    ((DCI1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-	    ((DCI1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-	    ((DCI1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-	    ((DCI1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-	    ((DCI1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = ndi;
-	    ((DCI1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = rv;
-	    break;
-
-	  case 50:
-	    dci_length = sizeof_DCI1_10MHz_TDD_t;
-	    dci_length_bytes = sizeof(DCI1_10MHz_TDD_t);
-	    ((DCI1_10MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-              ((DCI1_10MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-              ((DCI1_10MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-              ((DCI1_10MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1_10MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1_10MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1_10MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = ndi;
-              ((DCI1_10MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = rv;
-              break;
-
-            case 100:
-              ((DCI1_20MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-              ((DCI1_20MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-              ((DCI1_20MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-              ((DCI1_20MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1_20MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1_20MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1_20MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = ndi;
-              ((DCI1_20MHz_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = rv;
-              dci_length = sizeof_DCI1_20MHz_TDD_t;
-              dci_length_bytes = sizeof(DCI1_20MHz_TDD_t);
-              break;
-            }
-          } else {
-            switch (eNB->frame_parms.N_RB_DL) {
-            case 6:
-              dci_length = sizeof_DCI1_1_5MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1_1_5MHz_FDD_t);
-              ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-              ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-              ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-              ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = ndi;
-              ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = rv;
-              break;
-
-            case 25:
-              dci_length = sizeof_DCI1_5MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1_5MHz_FDD_t);
-              ((DCI1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-              ((DCI1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-              ((DCI1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-              ((DCI1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = ndi;
-              ((DCI1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = rv;
-              break;
-
-            case 50:
-              dci_length = sizeof_DCI1_10MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1_10MHz_FDD_t);
-              ((DCI1_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-              ((DCI1_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-              ((DCI1_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-              ((DCI1_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = ndi;
-              ((DCI1_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = rv;
-              break;
-
-            case 100:
-              dci_length = sizeof_DCI1_20MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1_20MHz_FDD_t);
-              ((DCI1_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-              ((DCI1_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-              ((DCI1_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-              ((DCI1_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = ndi;
-              ((DCI1_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = rv;
-              break;
-            }
-          }
+	dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+	memset((void *) dl_config_pdu, 0,
+	       sizeof(nfapi_dl_config_request_pdu_t));
+	dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
+	dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = 4;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = n_rnti+k;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1;	// CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000;	// equal to RS power
+
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = TPC;	// dont adjust power when retransmitting
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = ndi;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs1;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = rv;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = DLSCH_RB_ALLOC;
+	//deactivate second codeword
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = 0;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = 1;
+
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = 0;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = 0;
+
+	dl_req->number_dci++;
+	dl_req->number_pdu++;
+	dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+
+	fill_dlsch_config(dl_req,
+			  get_TBS_DL(mcs1,NB_RB),
+			  (retrans > 0) ? -1 : 0, /* retransmission, no pdu_index */
+			  n_rnti,
+			  0,	// type 0 allocation from 7.1.6 in 36.213
+			  0,	// virtual_resource_block_assignment_flag, unused here
+			  DLSCH_RB_ALLOC,	// resource_block_coding,
+			  get_Qm(mcs1),
+			  rv,	// redundancy version
+			  1,	// transport blocks
+			  0,	// transport block to codeword swap flag
+			  transmission_mode == 1 ? 0 : 1,	// transmission_scheme
+			  1,	// number of layers
+			  1,	// number of subbands
+				//                      uint8_t codebook_index,
+			  4,	// UE category capacity
+			  pa,    // pa
+			  0,	// delta_power_offset for TM5
+			  0,	// ngap
+			  0,	// nprb
+			  transmission_mode,
+			  0,	//number of PRBs treated as one subband, not used here
+			  0	// number of beamforming vectors, not used here
+			  );
+	fill_tx_req(TX_req,
+		    (frame * 10) + subframe,
+		    get_TBS_DL(mcs1,NB_RB),
+		    0,
+		    input_buffer[k]);
+      }
+      else {
 
-          memcpy(&dci_alloc[*num_dci].dci_pdu[0],&DLSCH_alloc_pdu_1[k],dci_length_bytes);
-          dci_alloc[*num_dci].dci_length   = dci_length;
-          dci_alloc[*num_dci].L            = 1;
-          dci_alloc[*num_dci].rnti         = n_rnti+k;
-          dci_alloc[*num_dci].format       = format1;
-          dci_alloc[*num_dci].search_space = DCI_UE_SPACE;
-          dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
-
-	  //          printf("Generating dlsch params for user %d\n",k);
-          generate_eNB_dlsch_params_from_dci(0,
-					     subframe,
-                                             &DLSCH_alloc_pdu_1[0],
-                                             n_rnti+k,
-                                             format1,
-                                             eNB->dlsch[0],
-                                             &eNB->frame_parms,
-                                             eNB->pdsch_config_dedicated,
-                                             SI_RNTI,
-                                             0,
-                                             P_RNTI,
-                                             eNB->UE_stats[0].DL_pmi_single,
-					     transmission_mode>=7?transmission_mode:0);
-
-          *num_dci = *num_dci+1;
-          *num_ue_spec_dci = *num_ue_spec_dci+1;
-        } else {
-          if (eNB->frame_parms.frame_type == TDD) {
-
-            switch (eNB->frame_parms.N_RB_DL) {
-            case 6:
-              dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 25:
-              dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_5MHz_TDD_1_6_t);
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 50:
-              dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_10MHz_TDD_1_6_t);
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 100:
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_20MHz_TDD_1_6_t);
-              break;
-            }
-          } else {
-            switch (eNB->frame_parms.N_RB_DL) {
-            case 6:
-              dci_length = sizeof_DCI1A_1_5MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_1_5MHz_FDD_t);
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 25:
-              dci_length = sizeof_DCI1A_5MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_5MHz_FDD_t);
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 50:
-              dci_length = sizeof_DCI1A_10MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_10MHz_FDD_t);
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 100:
-              dci_length = sizeof_DCI1A_20MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_20MHz_FDD_t);
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-            }
-          }
+      }
 
-          memcpy(&dci_alloc[*num_dci].dci_pdu[0],&DLSCH_alloc_pdu_1[k],dci_length_bytes);
-          dci_alloc[*num_dci].dci_length   = dci_length;
-          dci_alloc[*num_dci].L            = 1;
-          dci_alloc[*num_dci].rnti         = SI_RNTI;
-          dci_alloc[*num_dci].format       = format1A;
-          dci_alloc[*num_dci].firstCCE     = 0;
-          dci_alloc[*num_dci].search_space = DCI_COMMON_SPACE;
-          dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
-
-          printf("Generating dlsch params for user %d\n",k);
-          generate_eNB_dlsch_params_from_dci(0,
-					     subframe,
-                                             &DLSCH_alloc_pdu_1[0],
-                                             SI_RNTI,
-                                             format1A,
-                                             eNB->dlsch[0],
-                                             &eNB->frame_parms,
-                                             eNB->pdsch_config_dedicated,
-                                             SI_RNTI,
-                                             0,
-                                             P_RNTI,
-                                             eNB->UE_stats[0].DL_pmi_single,
-					     transmission_mode>=7?transmission_mode:0);
-
-          *num_common_dci=*num_common_dci+1;
-          *num_dci = *num_dci + 1;
+      break;
 
-        }
+    case 3:
+      if (common_flag == 0) {
 
-        break;
+	if (eNB->frame_parms.nb_antennas_tx == 2) {
 
-      case 3:
-        if (common_flag == 0) {
-
-          if (eNB->frame_parms.nb_antennas_tx == 2) {
-
-            if (eNB->frame_parms.frame_type == TDD) {
-
-              switch (eNB->frame_parms.N_RB_DL) {
-              case 6:
-                dci_length = sizeof_DCI2A_1_5MHz_2A_TDD_t;
-                dci_length_bytes = sizeof(DCI2A_1_5MHz_2A_TDD_t);
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2A_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 25:
-                dci_length = sizeof_DCI2A_5MHz_2A_TDD_t;
-                dci_length_bytes = sizeof(DCI2A_5MHz_2A_TDD_t);
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2A_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 50:
-                dci_length = sizeof_DCI2A_10MHz_2A_TDD_t;
-                dci_length_bytes = sizeof(DCI2A_10MHz_2A_TDD_t);
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2A_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 100:
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2A_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                dci_length = sizeof_DCI2A_20MHz_2A_TDD_t;
-                dci_length_bytes = sizeof(DCI2A_20MHz_2A_TDD_t);
-                break;
-              }
-            }
+	  if (eNB->frame_parms.frame_type == TDD) {
 
-            else {
-              switch (eNB->frame_parms.N_RB_DL) {
-              case 6:
-                dci_length = sizeof_DCI2A_1_5MHz_2A_FDD_t;
-                dci_length_bytes = sizeof(DCI2A_1_5MHz_2A_FDD_t);
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2A_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 25:
-                dci_length = sizeof_DCI2A_5MHz_2A_FDD_t;
-                dci_length_bytes = sizeof(DCI2A_5MHz_2A_FDD_t);
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2A_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 50:
-                dci_length = sizeof_DCI2A_10MHz_2A_FDD_t;
-                dci_length_bytes = sizeof(DCI2A_10MHz_2A_FDD_t);
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2A_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 100:
-                dci_length = sizeof_DCI2A_20MHz_2A_FDD_t;
-                dci_length_bytes = sizeof(DCI2A_20MHz_2A_FDD_t);
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2A_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-              }
-            }
-          } else if (eNB->frame_parms.nb_antennas_tx == 4) {
+	  }
+	  else {
 
-          }
+	  }
+	}
+      }
+      break;
 
-          memcpy(&dci_alloc[*num_dci].dci_pdu[0],&DLSCH_alloc_pdu_1[k],dci_length_bytes);
-          dci_alloc[*num_dci].dci_length   = dci_length;
-          dci_alloc[*num_dci].L            = 1;
-          dci_alloc[*num_dci].rnti         = n_rnti+k;
-          dci_alloc[*num_dci].format       = format2A;
-          dci_alloc[*num_dci].search_space = DCI_UE_SPACE;
-          dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
-
-          //printf("Generating dlsch params for user %d / format 2A (%d)\n",k,format2A);
-          generate_eNB_dlsch_params_from_dci(0,
-					     subframe,
-                                             &DLSCH_alloc_pdu_1[0],
-                                             n_rnti+k,
-                                             format2A,
-                                             eNB->dlsch[0],
-                                             &eNB->frame_parms,
-                                             eNB->pdsch_config_dedicated,
-                                             SI_RNTI,
-                                             0,
-                                             P_RNTI,
-                                             eNB->UE_stats[0].DL_pmi_single,
-					     transmission_mode>=7?transmission_mode:0);
-
-          *num_dci = *num_dci + 1;
-          *num_ue_spec_dci = *num_ue_spec_dci + 1;
-        } else {
-          if (eNB->frame_parms.frame_type == TDD) {
-
-            switch (eNB->frame_parms.N_RB_DL) {
-            case 6:
-              dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 25:
-              dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_5MHz_TDD_1_6_t);
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 50:
-              dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_10MHz_TDD_1_6_t);
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 100:
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_20MHz_TDD_1_6_t);
-              break;
-            }
-          } else {
-            switch (eNB->frame_parms.N_RB_DL) {
-            case 6:
-              dci_length = sizeof_DCI1A_1_5MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_1_5MHz_FDD_t);
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 25:
-              dci_length = sizeof_DCI1A_5MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_5MHz_FDD_t);
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 50:
-              dci_length = sizeof_DCI1A_10MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_10MHz_FDD_t);
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 100:
-              dci_length = sizeof_DCI1A_20MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_20MHz_FDD_t);
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-            }
-          }
+    case 4:
+      if (common_flag == 0) {
 
-          memcpy(&dci_alloc[*num_dci].dci_pdu[0],&DLSCH_alloc_pdu_1[k],dci_length_bytes);
-          dci_alloc[*num_dci].dci_length   = dci_length;
-          dci_alloc[*num_dci].L            = 1;
-          dci_alloc[*num_dci].rnti         = SI_RNTI;
-          dci_alloc[*num_dci].format       = format1A;
-          dci_alloc[*num_dci].firstCCE     = 0;
-          dci_alloc[*num_dci].search_space = DCI_COMMON_SPACE;
-          dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
-
-          //printf("Generating dlsch params for user %d\n",k);
-          generate_eNB_dlsch_params_from_dci(0,
-					     subframe,
-                                             &DLSCH_alloc_pdu_1[0],
-                                             SI_RNTI,
-                                             format1A,
-                                             eNB->dlsch[0],
-                                             &eNB->frame_parms,
-                                             eNB->pdsch_config_dedicated,
-                                             SI_RNTI,
-                                             0,
-                                             P_RNTI,
-                                             eNB->UE_stats[0].DL_pmi_single,
-					     transmission_mode>=7?transmission_mode:0);
-
-          *num_common_dci = *num_common_dci + 1;
-          *num_dci = *num_dci + 1;
+	if (eNB->frame_parms.nb_antennas_tx == 2) {
 
-        }
+	  if (eNB->frame_parms.frame_type == TDD) {
 
-        //printf("Generated DCI format 2A (Transmission Mode 3)\n");
-        break;
 
-      case 4:
-        if (common_flag == 0) {
-
-          if (eNB->frame_parms.nb_antennas_tx == 2) {
-
-            if (eNB->frame_parms.frame_type == TDD) {
-
-              switch (eNB->frame_parms.N_RB_DL) {
-              case 6:
-                dci_length = sizeof_DCI2_1_5MHz_2A_TDD_t;
-                dci_length_bytes = sizeof(DCI2_1_5MHz_2A_TDD_t);
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 25:
-                dci_length = sizeof_DCI2_5MHz_2A_TDD_t;
-                dci_length_bytes = sizeof(DCI2_5MHz_2A_TDD_t);
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 50:
-                dci_length = sizeof_DCI2_10MHz_2A_TDD_t;
-                dci_length_bytes = sizeof(DCI2_10MHz_2A_TDD_t);
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 100:
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                dci_length = sizeof_DCI2_20MHz_2A_TDD_t;
-                dci_length_bytes = sizeof(DCI2_20MHz_2A_TDD_t);
-                break;
-              }
-            }
+	  }
 
-            else {
-              switch (eNB->frame_parms.N_RB_DL) {
-              case 6:
-                dci_length = sizeof_DCI2_1_5MHz_2A_FDD_t;
-                dci_length_bytes = sizeof(DCI2_1_5MHz_2A_FDD_t);
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 25:
-                dci_length = sizeof_DCI2_5MHz_2A_FDD_t;
-                dci_length_bytes = sizeof(DCI2_5MHz_2A_FDD_t);
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 50:
-                dci_length = sizeof_DCI2_10MHz_2A_FDD_t;
-                dci_length_bytes = sizeof(DCI2_10MHz_2A_FDD_t);
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-
-              case 100:
-                dci_length = sizeof_DCI2_20MHz_2A_FDD_t;
-                dci_length_bytes = sizeof(DCI2_20MHz_2A_FDD_t);
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rah              = 0;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = DLSCH_RB_ALLOC;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = 0;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1             = mcs1;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1             = ndi;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv1              = rv;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2             = mcs2;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2             = ndi;
-                ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv2              = rv;
-                break;
-              }
-            }
-          } else if (eNB->frame_parms.nb_antennas_tx == 4) {
+	  else {
 
-          }
+	  }
+	} else if (eNB->frame_parms.nb_antennas_tx == 4) {
 
-          memcpy(&dci_alloc[*num_dci].dci_pdu[0],&DLSCH_alloc_pdu_1[k],dci_length_bytes);
-          dci_alloc[*num_dci].dci_length   = dci_length;
-          dci_alloc[*num_dci].L            = 1;
-          dci_alloc[*num_dci].rnti         = n_rnti+k;
-          dci_alloc[*num_dci].format       = format2;
-          dci_alloc[*num_dci].search_space = DCI_UE_SPACE;
-          dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
-
-          printf("Generating dlsch params for user %d\n",k);
-          generate_eNB_dlsch_params_from_dci(0,
-					     subframe,
-                                             &DLSCH_alloc_pdu_1[0],
-                                             n_rnti+k,
-                                             format2,
-                                             eNB->dlsch[0],
-                                             &eNB->frame_parms,
-                                             eNB->pdsch_config_dedicated,
-                                             SI_RNTI,
-                                             0,
-                                             P_RNTI,
-                                             eNB->UE_stats[0].DL_pmi_single,
-					     transmission_mode>=7?transmission_mode:0);
-
-          *num_dci = *num_dci + 1;
-          *num_ue_spec_dci = *num_ue_spec_dci + 1;
-        } else {
-          if (eNB->frame_parms.frame_type == TDD) {
-
-            switch (eNB->frame_parms.N_RB_DL) {
-            case 6:
-              dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_1_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 25:
-              dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_5MHz_TDD_1_6_t);
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_5MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 50:
-              dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_10MHz_TDD_1_6_t);
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_10MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 100:
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->dai              = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_20MHz_TDD_1_6_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t;
-              dci_length_bytes = sizeof(DCI1A_20MHz_TDD_1_6_t);
-              break;
-            }
-          } else {
-            switch (eNB->frame_parms.N_RB_DL) {
-            case 6:
-              dci_length = sizeof_DCI1A_1_5MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_1_5MHz_FDD_t);
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 25:
-              dci_length = sizeof_DCI1A_5MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_5MHz_FDD_t);
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 50:
-              dci_length = sizeof_DCI1A_10MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_10MHz_FDD_t);
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_10MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-
-            case 100:
-              dci_length = sizeof_DCI1A_20MHz_FDD_t;
-              dci_length_bytes = sizeof(DCI1A_20MHz_FDD_t);
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->type             = 1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->vrb_type         = 1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc          = computeRIV(eNB->frame_parms.N_RB_DL,0,9);
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->TPC              = TPC;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid         = 0;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->mcs             = mcs1;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->ndi             = 0;
-              ((DCI1A_20MHz_FDD_t *)&DLSCH_alloc_pdu_1[k])->rv              = 0;
-              break;
-            }
-          }
+	}
 
-          memcpy(&dci_alloc[*num_dci].dci_pdu[0],&DLSCH_alloc_pdu_1[k],dci_length_bytes);
-          dci_alloc[*num_dci].dci_length   = dci_length;
-          dci_alloc[*num_dci].L            = 1;
-          dci_alloc[*num_dci].rnti         = SI_RNTI;
-          dci_alloc[*num_dci].format       = format1A;
-          dci_alloc[*num_dci].firstCCE     = 0;
-          dci_alloc[*num_dci].search_space = DCI_COMMON_SPACE;
-          dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
-
-          printf("Generating dlsch params for user %d\n",k);
-          generate_eNB_dlsch_params_from_dci(0,
-					     subframe,
-                                             &DLSCH_alloc_pdu_1[0],
-                                             SI_RNTI,
-                                             format1A,
-                                             eNB->dlsch[0],
-                                             &eNB->frame_parms,
-                                             eNB->pdsch_config_dedicated,
-                                             SI_RNTI,
-                                             0,
-                                             P_RNTI,
-                                             eNB->UE_stats[0].DL_pmi_single,
-					     transmission_mode>=7?transmission_mode:0);
-
-          *num_common_dci = *num_common_dci + 1;
-          *num_dci = *num_dci + 1;
+      }
+      else {
 
         }
 
@@ -1186,90 +480,31 @@ void fill_DCI(PHY_VARS_eNB *eNB,
 
       case 5:
       case 6:
-        memcpy(&dci_alloc[*num_dci].dci_pdu[0],&DLSCH_alloc_pdu2_1E[k],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
-        dci_alloc[*num_dci].dci_length   = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
-        dci_alloc[*num_dci].L            = 1;
-        dci_alloc[*num_dci].rnti         = n_rnti+k;
-        dci_alloc[*num_dci].format       = format1E_2A_M10PRB;
-        dci_alloc[*num_dci].firstCCE     = 4*k;
-        dci_alloc[*num_dci].search_space = DCI_UE_SPACE;
-        printf("Generating dlsch params for user %d\n",k);
-        generate_eNB_dlsch_params_from_dci(0,
-					   subframe,
-                                           &DLSCH_alloc_pdu2_1E[k],
-                                           n_rnti+k,
-                                           format1E_2A_M10PRB,
-                                           eNB->dlsch[k],
-                                           &eNB->frame_parms,
-                                           eNB->pdsch_config_dedicated,
-                                           SI_RNTI,
-                                           0,
-                                           P_RNTI,
-                                           eNB->UE_stats[k].DL_pmi_single,
-					   transmission_mode>=7?transmission_mode:0);
-
-        dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
-        *num_ue_spec_dci = *num_ue_spec_dci + 1;
-        *num_dci = *num_dci + 1;
 
         break;
 
-      default:
-        printf("Unsupported Transmission Mode!!!");
-        exit(-1);
-        break;
-      }
+    default:
+      printf("Unsupported Transmission Mode %d!!!\n",transmission_mode);
+      exit(-1);
+      break;
     }
+  }
+  *num_dci         = dl_req->number_dci;
+  *num_ue_spec_dci = dl_req->number_dci;
+  *num_common_dci  = 0;
 }
 
 int n_users = 1;
 sub_frame_t subframe=7;
-DCI_PDU DCI_pdu;
 int num_common_dci=0,num_ue_spec_dci=0,num_dci=0,num_pdcch_symbols=1;
-
-
-DCI_PDU *get_dci_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subframeP) {
-
-  if (subframeP == subframe) {
-    DCI_pdu.Num_dci   = num_ue_spec_dci + num_common_dci;
-    DCI_pdu.num_pdcch_symbols = num_pdcch_symbols;
-  } else {
-    DCI_pdu.Num_dci   = 0;
-    DCI_pdu.num_pdcch_symbols = num_pdcch_symbols;
-  }
-
-  return &DCI_pdu;
-}
-
-void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP) {
-
-  return;
-}
-
 uint16_t n_rnti=0x1234;
-unsigned char *input_buffer0[2],*input_buffer1[2];
-unsigned short input_buffer_length0,input_buffer_length1;
-
-uint8_t *get_dlsch_sdu(module_id_t module_idP,int CC_id,frame_t frameP,rnti_t rnti,uint8_t TBindex) {
-
-  int k;
-
-  for (k=0;k<n_users;k++)
-    if (rnti == n_rnti+k)
-      break;
-  if (k<n_users)
-    return(TBindex==0 ? input_buffer0[k] : input_buffer1[k]);
-  else {
-    printf("RNTI not found,exiting\n");
-    exit(-1);
-  }
-}
+  int nfapi_mode=0;
 
 int main(int argc, char **argv)
 {
 
   int c;
-  int k,i,aa;
+  int k,i,j,aa;
   int re;
 
   int s,Kr,Kr_bytes;
@@ -1300,12 +535,19 @@ int main(int argc, char **argv)
   SCM_t channel_model=Rayleigh1;
   //  unsigned char *input_data,*decoded_output;
 
-  DCI_ALLOC_t *dci_alloc = &DCI_pdu.dci_alloc[0];
+  DCI_ALLOC_t da;
+  DCI_ALLOC_t *dci_alloc = &da;
 
   unsigned int ret;
   unsigned int coded_bits_per_codeword=0,nsymb; //,tbs=0;
 
-  unsigned int tx_lev=0,tx_lev_dB=0,trials,errs[4]= {0,0,0,0},errs2[4]= {0,0,0,0},round_trials[4]= {0,0,0,0},dci_errors[4]={0,0,0,0};//,num_layers;
+  unsigned int tx_lev=0,tx_lev_dB=0,trials;
+  unsigned int errs[4],errs2[4],round_trials[4],dci_errors[4];//,num_layers;
+  memset(errs,0,4*sizeof(unsigned int));
+  memset(errs2,0,4*sizeof(unsigned int));
+  memset(round_trials,0,4*sizeof(unsigned int));
+  memset(dci_errors,0,4*sizeof(unsigned int));
+
   //int re_allocated;
   char fname[32],vname[32];
   FILE *bler_fd;
@@ -1392,6 +634,7 @@ int main(int argc, char **argv)
 
   int threequarter_fs=0;
 
+
   opp_enabled=1; // to enable the time meas
 
   FILE *csv_fd=NULL;
@@ -1402,6 +645,17 @@ int main(int argc, char **argv)
 
   int log_level = LOG_ERR;
   int dci_received;
+  PHY_VARS_eNB *eNB;
+  RU_t *ru;
+  PHY_VARS_UE *UE;
+  nfapi_dl_config_request_t DL_req;
+  nfapi_ul_config_request_t UL_req;
+  nfapi_hi_dci0_request_t HI_DCI0_req;
+  nfapi_dl_config_request_pdu_t dl_config_pdu_list[MAX_NUM_DL_PDU];
+  nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU];
+  nfapi_tx_request_t TX_req;
+  Sched_Rsp_t sched_resp;
+  int pa=dB0;
 
 #if defined(__arm__)
   FILE    *proc_fd = NULL;
@@ -1420,6 +674,18 @@ int main(int argc, char **argv)
   cpu_freq_GHz = get_cpu_freq_GHz();
 #endif
   printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
+  memset((void*)&sched_resp,0,sizeof(sched_resp));
+  sched_resp.DL_req = &DL_req;
+  sched_resp.UL_req = &UL_req;
+  sched_resp.HI_DCI0_req = &HI_DCI0_req;
+  sched_resp.TX_req = &TX_req;
+  memset((void*)&DL_req,0,sizeof(DL_req));
+  memset((void*)&UL_req,0,sizeof(UL_req));
+  memset((void*)&HI_DCI0_req,0,sizeof(HI_DCI0_req));
+  memset((void*)&TX_req,0,sizeof(TX_req));
+
+  DL_req.dl_config_request_body.dl_config_pdu_list = dl_config_pdu_list;
+  TX_req.tx_request_body.tx_pdu_list = tx_pdu_list;
 
   cpuf = cpu_freq_GHz;
 
@@ -1612,7 +878,7 @@ int main(int argc, char **argv)
         channel_model=AWGN;
         break;
       default:
-        msg("Unsupported channel model!\n");
+        printf("Unsupported channel model!\n");
         exit(-1);
       }
 
@@ -1634,7 +900,7 @@ int main(int argc, char **argv)
       UE->use_ia_receiver = 1;
 
       if ((n_tx_port!=2) || (transmission_mode!=5)) {
-        msg("IA receiver only supported for TM5!");
+        printf("IA receiver only supported for TM5!");
         exit(-1);
       }
 
@@ -1644,7 +910,7 @@ int main(int argc, char **argv)
       i_mod = atoi(optarg);
 
       if (i_mod!=2 && i_mod!=4 && i_mod!=6) {
-        msg("Wrong i_mod %d, should be 2,4 or 6\n",i_mod);
+        printf("Wrong i_mod %d, should be 2,4 or 6\n",i_mod);
         exit(-1);
       }
 
@@ -1658,7 +924,7 @@ int main(int argc, char **argv)
       n_tx_port=atoi(optarg);
 
       if ((n_tx_port==0) || ((n_tx_port>2))) {
-        msg("Unsupported number of cell specific antennas ports %d\n",n_tx_port);
+        printf("Unsupported number of cell specific antennas ports %d\n",n_tx_port);
         exit(-1);
       }
 
@@ -1675,7 +941,7 @@ int main(int argc, char **argv)
           (transmission_mode!=5) &&
           (transmission_mode!=6) &&
           (transmission_mode!=7)) {
-        msg("Unsupported transmission mode %d\n",transmission_mode);
+        printf("Unsupported transmission mode %d\n",transmission_mode);
         exit(-1);
       }
 
@@ -1689,17 +955,17 @@ int main(int argc, char **argv)
       n_tx_phy=atoi(optarg);
 
       if (n_tx_phy < n_tx_port) {
-        msg("n_tx_phy mush not be smaller than n_tx_port");
+        printf("n_tx_phy mush not be smaller than n_tx_port");
         exit(-1);
       }
 
       if ((transmission_mode>1 && transmission_mode<7) && n_tx_port<2) {
-        msg("n_tx_port must be >1 for transmission_mode %d\n",transmission_mode);
+        printf("n_tx_port must be >1 for transmission_mode %d\n",transmission_mode);
         exit(-1);
       }
 
       if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) {
-        msg("Physical number of antennas not supported for TM7.\n");
+        printf("Physical number of antennas not supported for TM7.\n");
         exit(-1);
       }
 
@@ -1718,7 +984,7 @@ int main(int argc, char **argv)
       n_rx=atoi(optarg);
 
       if ((n_rx==0) || (n_rx>2)) {
-        msg("Unsupported number of rx antennas %d\n",n_rx);
+        printf("Unsupported number of rx antennas %d\n",n_rx);
         exit(-1);
       }
 
@@ -1770,9 +1036,14 @@ int main(int argc, char **argv)
     }
   }
 
+  if (transmission_mode>1) pa=dBm3;
+  printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa);
+
+  AssertFatal(load_configmodule(argc,argv) != NULL,
+	      "cannot load configuration module, exiting\n");
   logInit();
   // enable these lines if you need debug info
-  set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1);
+  set_comp_log(PHY,LOG_INFO,LOG_HIGH,1);
   set_glog(log_level,LOG_HIGH);
   // moreover you need to init itti with the following line
   // however itti will catch all signals, so ctrl-c won't work anymore
@@ -1822,30 +1093,40 @@ int main(int argc, char **argv)
     n_users = 2;
     printf("dual_stream_UE=%d\n", dual_stream_UE);
   }
+  RC.nb_L1_inst = 1;
+  RC.nb_RU = 1;
 
-  lte_param_init(n_tx_port,
+  lte_param_init(&eNB,&UE,&ru,
+		 n_tx_port,
 		 n_tx_phy,
-		 n_rx,
+		 1,
+                 n_rx,
 		 transmission_mode,
 		 extended_prefix_flag,
 		 frame_type,
 		 Nid_cell,
 		 tdd_config,
 		 N_RB_DL,
+		 pa,
 		 threequarter_fs,
 		 osf,
 		 perfect_ce);
-
+  RC.eNB = (PHY_VARS_eNB ***)malloc(sizeof(PHY_VARS_eNB **));
+  RC.eNB[0] = (PHY_VARS_eNB **)malloc(sizeof(PHY_VARS_eNB *));
+  RC.ru = (RU_t **)malloc(sizeof(RC.ru));
+  RC.eNB[0][0] = eNB;
+  RC.ru[0] = ru;
+  printf("lte_param_init done\n");
   if ((transmission_mode==1) || (transmission_mode==7)) {
-    for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++)
-     for (re=0; re<eNB->frame_parms.ofdm_symbol_size; re++)
-       eNB->common_vars.beam_weights[0][0][aa][re] = 0x00007fff/eNB->frame_parms.nb_antennas_tx;
+    for (aa=0; aa<ru->nb_tx; aa++)
+     for (re=0; re<ru->frame_parms.ofdm_symbol_size; re++)
+       ru->beam_weights[0][0][aa][re] = 0x00007fff/eNB->frame_parms.nb_antennas_tx;
   }
 
   if (transmission_mode<7)
-     eNB->do_precoding=0;
+     ru->do_precoding=0;
   else
-     eNB->do_precoding=1;
+     ru->do_precoding=1;
 
   eNB->mac_enabled=1;
   if (two_thread_flag == 0) {
@@ -1860,9 +1141,6 @@ int main(int argc, char **argv)
   }
 
   // callback functions required for phy_procedures_tx
-  mac_xface->get_dci_sdu = get_dci_sdu;
-  mac_xface->get_dlsch_sdu = get_dlsch_sdu;
-  mac_xface->eNB_dlsch_ulsch_scheduler = eNB_dlsch_ulsch_scheduler;
 
   //  eNB_id_i = UE->n_connected_eNB;
 
@@ -1875,7 +1153,10 @@ int main(int argc, char **argv)
   snr1 = snr0+snr_int;
   printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
 
+  uint8_t input_buffer[NUMBER_OF_UE_MAX][20000];
 
+  for (i=0;i<n_users;i++)
+    for (j=0;j<20000;j++) input_buffer[i][j] = (uint8_t)((taus())&255);
 
   frame_parms = &eNB->frame_parms;
 
@@ -2024,48 +1305,7 @@ int main(int argc, char **argv)
 
   UE->pdcch_vars[UE->current_thread_id[subframe]][0]->crnti = n_rnti;
 
-  // Fill in UL_alloc
-  UL_alloc_pdu.type    = 0;
-  UL_alloc_pdu.hopping = 0;
-  UL_alloc_pdu.rballoc = UL_RB_ALLOC;
-  UL_alloc_pdu.mcs     = 1;
-  UL_alloc_pdu.ndi     = 1;
-  UL_alloc_pdu.TPC     = 0;
-  UL_alloc_pdu.cqi_req = 1;
-
-  CCCH_alloc_pdu.type               = 0;
-  CCCH_alloc_pdu.vrb_type           = 0;
-  CCCH_alloc_pdu.rballoc            = CCCH_RB_ALLOC;
-  CCCH_alloc_pdu.ndi      = 1;
-  CCCH_alloc_pdu.mcs      = 1;
-  CCCH_alloc_pdu.harq_pid = 0;
-
-  DLSCH_alloc_pdu2_1E[0].rah              = 0;
-  DLSCH_alloc_pdu2_1E[0].rballoc          = DLSCH_RB_ALLOC;
-  DLSCH_alloc_pdu2_1E[0].TPC              = 0;
-  DLSCH_alloc_pdu2_1E[0].dai              = 0;
-  DLSCH_alloc_pdu2_1E[0].harq_pid         = 0;
-  //DLSCH_alloc_pdu2_1E[0].tb_swap          = 0;
-  DLSCH_alloc_pdu2_1E[0].mcs             = mcs1;
-  DLSCH_alloc_pdu2_1E[0].ndi             = 1;
-  DLSCH_alloc_pdu2_1E[0].rv              = 0;
-  // Forget second codeword
-  DLSCH_alloc_pdu2_1E[0].tpmi             = (transmission_mode>=5 ? 5 : 0);  // precoding
-  DLSCH_alloc_pdu2_1E[0].dl_power_off     = (transmission_mode==5 ? 0 : 1);
-
-  DLSCH_alloc_pdu2_1E[1].rah              = 0;
-  DLSCH_alloc_pdu2_1E[1].rballoc          = DLSCH_RB_ALLOC;
-  DLSCH_alloc_pdu2_1E[1].TPC              = 0;
-  DLSCH_alloc_pdu2_1E[1].dai              = 0;
-  DLSCH_alloc_pdu2_1E[1].harq_pid         = 0;
-  //DLSCH_alloc_pdu2_1E[1].tb_swap          = 0;
-  DLSCH_alloc_pdu2_1E[1].mcs             = mcs_i;
-  DLSCH_alloc_pdu2_1E[1].ndi             = 1;
-  DLSCH_alloc_pdu2_1E[1].rv              = 0;
-  // Forget second codeword
-  DLSCH_alloc_pdu2_1E[1].tpmi             = (transmission_mode>=5 ? 5 : 0) ;  // precoding
-  DLSCH_alloc_pdu2_1E[1].dl_power_off     = (transmission_mode==5 ? 0 : 1);
-
+  printf("Allocating %dx%d eNB->UE channel descriptor\n",eNB->frame_parms.nb_antennas_tx,UE->frame_parms.nb_antennas_rx);
   eNB2UE[0] = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
                                    UE->frame_parms.nb_antennas_rx,
                                    channel_model,
@@ -2088,7 +1328,7 @@ int main(int argc, char **argv)
   }
 
   if (eNB2UE[0]==NULL) {
-    msg("Problem generating channel model. Exiting.\n");
+    printf("Problem generating channel model. Exiting.\n");
     exit(-1);
   }
 
@@ -2114,7 +1354,7 @@ int main(int argc, char **argv)
     break;
   }
 
-  for (k=0; k<n_users; k++) {
+  for (k=0; k<NUMBER_OF_UE_MAX; k++) {
     // Create transport channel structures for 2 transport blocks (MIMO)
     for (i=0; i<2; i++) {
       eNB->dlsch[k][i] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0,&eNB->frame_parms);
@@ -2166,24 +1406,31 @@ int main(int argc, char **argv)
       eNB->UE_stats[1].DL_pmi_single = 0;
   }
 
+  eNB_rxtx_proc_t *proc_eNB = &eNB->proc.proc_rxtx[0];//UE->current_thread_id[subframe]];
 
   if (input_fd==NULL) {
 
-
+    DL_req.dl_config_request_body.number_pdcch_ofdm_symbols = num_pdcch_symbols;
+    DL_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+    TX_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
     // UE specific DCI
     fill_DCI(eNB,
-	     &dci_alloc[0],
-	     subframe,
+	     proc_eNB->frame_tx,subframe,
+	     &sched_resp,
+	     input_buffer,
 	     n_rnti,
 	     n_users,
 	     transmission_mode,
+	     0,
 	     common_flag,
+	     NB_RB,
 	     DLSCH_RB_ALLOC,
 	     TPC,
 	     mcs1,
 	     mcs2,
 	     1,
 	     0,
+	     pa,
 	     &num_common_dci,
 	     &num_ue_spec_dci,
 	     &num_dci);
@@ -2194,65 +1441,8 @@ int main(int argc, char **argv)
 
 
 
-
-    for (k=0; k<n_users; k++) {
-
-      input_buffer_length0 = eNB->dlsch[k][0]->harq_processes[0]->TBS/8;
-      input_buffer0[k] = (unsigned char *)malloc(input_buffer_length0+4);
-      memset(input_buffer0[k],0,input_buffer_length0+4);
-      input_buffer_length1 = eNB->dlsch[k][1]->harq_processes[0]->TBS/8;
-      input_buffer1[k] = (unsigned char *)malloc(input_buffer_length1+4);
-      memset(input_buffer1[k],0,input_buffer_length1+4);
-
-      if (input_trch_file==0) {
-        for (i=0; i<input_buffer_length0; i++) {
-          //input_buffer0[k][i] = (unsigned char)(i&0xff);
-          input_buffer0[k][i] = (unsigned char)(taus()&0xff);
-        }
-
-        for (i=0; i<input_buffer_length1; i++) {
-          input_buffer1[k][i]= (unsigned char)(taus()&0xff);
-        }
-      }
-
-      else {
-        i=0;
-
-        while ((!feof(input_trch_fd)) && (i<input_buffer_length0<<3)) {
-          ret=fscanf(input_trch_fd,"%s",input_trch_val);
-          if (ret != 1) printf("ERROR: error reading file\n");
-
-          if (input_trch_val[0] == '1')
-            input_buffer0[k][i>>3]+=(1<<(7-(i&7)));
-
-          if (i<16)
-            printf("input_trch_val %d : %c\n",i,input_trch_val[0]);
-
-          i++;
-
-          if (((i%8) == 0) && (i<17))
-            printf("%x\n",input_buffer0[k][(i-1)>>3]);
-        }
-
-        printf("Read in %d bits\n",i);
-      }
-    }
   }
 
-  // this is for user 0 only
-  coded_bits_per_codeword = get_G(&eNB->frame_parms,
-                                  eNB->dlsch[0][0]->harq_processes[0]->nb_rb,
-                                  eNB->dlsch[0][0]->harq_processes[0]->rb_alloc,
-                                  get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs),
-                                  eNB->dlsch[0][0]->harq_processes[0]->Nl,
-                                  num_pdcch_symbols,
-                                  0,
-				  subframe,
-				  transmission_mode>=7?transmission_mode:0);
-
-  uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword);
-  printf("uncoded_ber_bit=%p\n",uncoded_ber_bit);
-
   snr_step = input_snr_step;
   UE->high_speed_flag = 1;
   UE->ch_est_alpha=0;
@@ -2332,7 +1522,7 @@ int main(int argc, char **argv)
       struct list time_vector_rx_dec;
       initialize(&time_vector_rx_dec);
 
-      eNB_rxtx_proc_t *proc_eNB = &eNB->proc.proc_rxtx[UE->current_thread_id[subframe]];
+
 
       for (trials = 0; trials<n_frames; trials++) {
 	//printf("Trial %d\n",trials);
@@ -2365,7 +1555,7 @@ int main(int argc, char **argv)
 
           //  printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback);
           for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
-            memset(&eNB->common_vars.txdataF[eNB_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
+            memset(&eNB->common_vars.txdataF[aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
           }
 
           if (input_fd==NULL) {
@@ -2383,108 +1573,73 @@ int main(int argc, char **argv)
                 TB0_active = 1;
 
                 eNB->dlsch[0][0]->harq_processes[0]->rvidx = round&3;
-
-		fill_DCI(eNB,&dci_alloc[0],subframe,n_rnti,n_users,transmission_mode,common_flag,DLSCH_RB_ALLOC,TPC,
-			 mcs1,mcs2,!(trials&1),round&3,&num_common_dci,&num_ue_spec_dci,&num_dci);
+		DL_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+		TX_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+		fill_DCI(eNB,proc_eNB->frame_tx,subframe,&sched_resp,input_buffer,n_rnti,n_users,transmission_mode,0,common_flag,NB_RB,DLSCH_RB_ALLOC,TPC,
+			 mcs1,mcs2,!(trials&1),round&3,pa,&num_common_dci,&num_ue_spec_dci,&num_dci);
 	      }
 	      else {
-		fill_DCI(eNB,&dci_alloc[0],subframe,n_rnti,n_users,transmission_mode,common_flag,DLSCH_RB_ALLOC,TPC,
-			 (TB0_active==1)?mcs1:0,mcs2,!(trials&1),(TB0_active==1)?round&3:0,&num_common_dci,&num_ue_spec_dci,&num_dci);
+		DL_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+		TX_req.sfn_sf = (proc_eNB->frame_tx<<4)+subframe;
+		fill_DCI(eNB,proc_eNB->frame_tx,subframe,&sched_resp,input_buffer,n_rnti,n_users,transmission_mode,1,common_flag,NB_RB,DLSCH_RB_ALLOC,TPC,
+			 (TB0_active==1)?mcs1:0,mcs2,!(trials&1),(TB0_active==1)?round&3:0,pa,&num_common_dci,&num_ue_spec_dci,&num_dci);
 	      }
-	      for (i=num_common_dci; i<num_dci; i++) {
-
-		dci_alloc[i].firstCCE = get_nCCE_offset_l1(CCE_table,
-							   1<<dci_alloc[i].L,
-							   numCCE,
-							   (dci_alloc[i].rnti==SI_RNTI)? 1 : 0,
-							   dci_alloc[i].rnti,
-							   subframe);
-
-		if (dci_alloc[i].firstCCE < 0) {
-		  printf("firstCCE <0 !! dci %d: rnti %x, format %d : nCCE %d/%d\n",i,dci_alloc[i].rnti, dci_alloc[i].format,
-			 dci_alloc[i].firstCCE,numCCE);
-		  exit(-1);
-		}
-		if (n_frames==1)
-		  printf("dci %d: rnti %x, format %d : nCCE %d/%d\n",i,dci_alloc[i].rnti, dci_alloc[i].format,
-			 dci_alloc[i].firstCCE,numCCE);
-	      }
-
-	    } // common_flag == 0
-
-
-
-          /*
-            else {  // Read signal from file
-            i=0;
-            while (!feof(input_fd)) {
-            fscanf(input_fd,"%s %s",input_val_str,input_val_str2);
-
-            if ((i%4)==0) {
-            ((short*)txdata[0])[i/2] = (short)((1<<15)*strtod(input_val_str,NULL));
-            ((short*)txdata[0])[(i/2)+1] = (short)((1<<15)*strtod(input_val_str2,NULL));
-            if ((i/4)<100)
-            printf("sample %d => %e + j%e (%d +j%d)\n",i/4,strtod(input_val_str,NULL),strtod(input_val_str2,NULL),((short*)txdata[0])[i/4],((short*)txdata[0])[(i/4)+1]);//1,input_val2,);
-            }
-            i++;
-            if (i>(FRAME_LENGTH_SAMPLES))
-            break;
-            }
-            printf("Read in %d samples\n",i/4);
-            write_output("txsig0.m","txs0", txdata[0],2*frame_parms->samples_per_tti,1,1);
-            //    write_output("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
-            tx_lev = signal_energy(&txdata[0][0],
-            OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
-            tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
-            }
-          */
-
+	    }
 
 	    proc_eNB->subframe_tx = subframe;
-	    eNB->abstraction_flag=0;
-
-	    phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,1,dci_flag);
+	    sched_resp.subframe=subframe;
+	    sched_resp.frame=proc_eNB->frame_tx;
 
+	    eNB->abstraction_flag=0;
+	    schedule_response(&sched_resp);
+	    phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,1);
+
+	    if (uncoded_ber_bit == NULL) {
+	      // this is for user 0 only
+	      printf("nb_rb %d, rb_alloc %x, mcs %d\n",
+		     eNB->dlsch[0][0]->harq_processes[0]->nb_rb,
+		     eNB->dlsch[0][0]->harq_processes[0]->rb_alloc,
+		     eNB->dlsch[0][0]->harq_processes[0]->mcs);
+
+	      coded_bits_per_codeword = get_G(&eNB->frame_parms,
+					      eNB->dlsch[0][0]->harq_processes[0]->nb_rb,
+					      eNB->dlsch[0][0]->harq_processes[0]->rb_alloc,
+					      get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs),
+					      eNB->dlsch[0][0]->harq_processes[0]->Nl,
+					      num_pdcch_symbols,
+					      0,
+					      subframe,
+					      transmission_mode>=7?transmission_mode:0);
+
+	      uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword);
+	      printf("uncoded_ber_bit=%p\n",uncoded_ber_bit);
+	    }
 
 	    start_meas(&eNB->ofdm_mod_stats);
 
-            /*
-	    do_OFDM_mod_l(eNB->common_vars.txdataF[eNB_id],
-			  eNB->common_vars.txdata[eNB_id],
-			  (subframe*2),
-			  &eNB->frame_parms);
-
-	    do_OFDM_mod_l(eNB->common_vars.txdataF[eNB_id],
-			  eNB->common_vars.txdata[eNB_id],
-			  (subframe*2)+1,
-			  &eNB->frame_parms);
-	    */
+	    ru->proc.subframe_tx=subframe;
+	    memcpy((void*)&ru->frame_parms,(void*)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
+	    feptx_prec(ru);
+	    feptx_ofdm(ru);
 
-            do_OFDM_mod_symbol(&eNB->common_vars,
-                               eNB_id,
-                               (subframe*2),
-                               &eNB->frame_parms,
-			       eNB->do_precoding);
-
-            do_OFDM_mod_symbol(&eNB->common_vars,
-                               eNB_id,
-                               (subframe*2)+1,
-                               &eNB->frame_parms,
-			       eNB->do_precoding);
+	    stop_meas(&eNB->ofdm_mod_stats);
 
 
-	    stop_meas(&eNB->ofdm_mod_stats);
 
 	    // generate next subframe for channel estimation
 
+	    DL_req.dl_config_request_body.number_dci=0;
+	    DL_req.dl_config_request_body.number_pdu=0;
+	    TX_req.tx_request_body.number_of_pdus=0;
 	    proc_eNB->subframe_tx = subframe+1;
+	    sched_resp.subframe=subframe+1;
+	    schedule_response(&sched_resp);
+	    phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,0);
 
-	    phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,0,dci_flag);
 
-	    do_OFDM_mod_l(eNB->common_vars.txdataF[eNB_id],
-			  eNB->common_vars.txdata[eNB_id],
-			  (subframe*2)+2,
-			  &eNB->frame_parms);
+	    ru->proc.subframe_tx=(subframe+1)%10;
+	    feptx_prec(ru);
+	    feptx_ofdm(ru);
 
 
 	    proc_eNB->frame_tx++;
@@ -2492,7 +1647,7 @@ int main(int argc, char **argv)
             tx_lev = 0;
 
             for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
-              tx_lev += signal_energy(&eNB->common_vars.txdata[eNB_id][aa]
+              tx_lev += signal_energy(&ru->common.txdata[aa]
                                       [subframe*eNB->frame_parms.samples_per_tti],
                                       eNB->frame_parms.samples_per_tti);
             }
@@ -2500,21 +1655,22 @@ int main(int argc, char **argv)
             tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
 
 
+
             if (n_frames==1) {
               printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB);
 
-              write_output("txsig0.m","txs0", &eNB->common_vars.txdata[eNB_id][0][subframe* eNB->frame_parms.samples_per_tti], eNB->frame_parms.samples_per_tti,1,1);
+              write_output("txsig0.m","txs0", &ru->common.txdata[0][subframe* eNB->frame_parms.samples_per_tti], eNB->frame_parms.samples_per_tti,1,1);
 
               if (transmission_mode<7) {
-	        write_output("txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB_id][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
+	        write_output("txsigF0.m","txsF0x", &ru->common.txdataF_BF[0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
               } else if (transmission_mode == 7) {
-                write_output("txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB_id][5][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
-                write_output("txsigF0_BF.m","txsF0_BF", &eNB->common_vars.txdataF_BF[eNB_id][0][0],eNB->frame_parms.ofdm_symbol_size,1,1);
+                write_output("txsigF0.m","txsF0", &ru->common.txdataF_BF[5][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
+                write_output("txsigF0_BF.m","txsF0_BF", &ru->common.txdataF_BF[0][0],eNB->frame_parms.ofdm_symbol_size,1,1);
               }
             }
 	  }
 
-	  DL_channel(eNB,UE,subframe,awgn_flag,SNR,tx_lev,hold_channel,abstx,num_rounds,trials,round,eNB2UE,s_re,s_im,r_re,r_im,csv_fd);
+	  DL_channel(ru,UE,subframe,awgn_flag,SNR,tx_lev,hold_channel,abstx,num_rounds,trials,round,eNB2UE,s_re,s_im,r_re,r_im,csv_fd);
 
 
 	  UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[UE->current_thread_id[subframe]];
@@ -2532,6 +1688,8 @@ int main(int argc, char **argv)
 	  if (n_frames==1) printf("Running phy_procedures_UE_RX\n");
 
 	  if (dci_flag==0) {
+	    memcpy(dci_alloc,eNB->pdcch_vars[subframe&1].dci_alloc,num_dci*sizeof(DCI_ALLOC_t));
+	    UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id]->num_pdcch_symbols = num_pdcch_symbols;
 	    if (n_frames==1)
 	      printf("bypassing PDCCH/DCI detection\n");
 	    if  (generate_ue_dlsch_params_from_dci(proc->frame_rx,
@@ -2541,7 +1699,7 @@ int main(int argc, char **argv)
 						   dci_alloc[0].format,
 						   UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id],
 						   UE->pdsch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id],
-                           UE->dlsch[UE->current_thread_id[proc->subframe_rx]][0],
+						   UE->dlsch[UE->current_thread_id[proc->subframe_rx]][0],
 						   &UE->frame_parms,
 						   UE->pdsch_config_dedicated,
 						   SI_RNTI,
@@ -2570,26 +1728,50 @@ int main(int argc, char **argv)
 	  dci_received = dci_received - UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id]->dci_received;
 
 	  if (dci_flag && (dci_received == 0)) {
-	    //printf("DCI not received\n");
+	    printf("DCI not received\n");
 	    dci_errors[round]++;
 
-	    /*
-	    write_output("pdcchF0_ext.m","pdcchF_ext", UE->pdcch_vars[eNB_id]->rxdataF_ext[0],2*3*UE->frame_parms.ofdm_symbol_size,1,1);
-	    write_output("pdcch00_ch0_ext.m","pdcch00_ch0_ext",UE->pdcch_vars[eNB_id]->dl_ch_estimates_ext[0],12*UE->frame_parms.N_RB_DL*3,1,1);
+	    write_output("pdcchF0_ext.m","pdcchF_ext", UE->pdcch_vars[0][eNB_id]->rxdataF_ext[0],2*3*UE->frame_parms.ofdm_symbol_size,1,1);
+	    write_output("pdcch00_ch0_ext.m","pdcch00_ch0_ext",UE->pdcch_vars[0][eNB_id]->dl_ch_estimates_ext[0],300*3,1,1);
 
-	    write_output("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",UE->pdcch_vars[eNB_id]->rxdataF_comp[0],4*12*UE->frame_parms.N_RB_DL,1,1);
-	    write_output("pdcch_rxF_llr.m","pdcch_llr",UE->pdcch_vars[eNB_id]->llr,12*UE->frame_parms.N_RB_DL*4*2,1,4);
-	    write_output("txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB_id][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],
-			 nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
+	    write_output("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",UE->pdcch_vars[0][eNB_id]->rxdataF_comp[0],4*300,1,1);
+	    write_output("pdcch_rxF_llr.m","pdcch_llr",UE->pdcch_vars[0][eNB_id]->llr,2400,1,4);
 
 	    write_output("rxsig0.m","rxs0", &UE->common_vars.rxdata[0][0],10*UE->frame_parms.samples_per_tti,1,1);
-	    write_output("rxsigF0.m","rxsF0", &UE->common_vars.rxdataF[0][0],UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+	    write_output("rxsigF0.m","rxsF0", &UE->common_vars.common_vars_rx_data_per_thread[UE->current_thread_id[subframe]].rxdataF[0][0],UE->frame_parms.ofdm_symbol_size*nsymb,1,1);
+
 
 	    exit(-1);
-	    */
+
 	  }
 
+	  int bit_errors=0;
 	  if ((test_perf ==0 ) && (n_frames==1)) {
+
+	    dlsch_unscrambling(&eNB->frame_parms,
+			       0,
+			       UE->dlsch[UE->current_thread_id[subframe]][0][0],
+			       coded_bits_per_codeword,
+			       UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0],
+			       0,
+			       subframe<<1);
+	    for (i=0;i<coded_bits_per_codeword;i++)
+	      if ((eNB->dlsch[0][0]->harq_processes[0]->e[i]==1 && UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0][i] > 0)||
+		  (eNB->dlsch[0][0]->harq_processes[0]->e[i]==0 && UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0][i] < 0)) {
+		uncoded_ber_bit[bit_errors++] = 1;
+		printf("error in pos %d : %d => %d\n",i,
+		       eNB->dlsch[0][0]->harq_processes[0]->e[i],
+		       UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0][i]);
+	      }
+	      else {
+		/*
+		printf("no error in pos %d : %d => %d\n",i,
+		       eNB->dlsch[0][0]->harq_processes[0]->e[i],
+		       UE->pdsch_vars[UE->current_thread_id[subframe]][0]->llr[0][i]);
+		*/
+	      }
+
+	    write_output("dlsch_ber_bit.m","ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0);
 	    write_output("ch0.m","ch0",eNB2UE[0]->ch[0],eNB2UE[0]->channel_length,1,8);
 
 	    if (eNB->frame_parms.nb_antennas_tx>1)
@@ -2625,6 +1807,7 @@ int main(int argc, char **argv)
 			   UE->frame_parms.ofdm_symbol_size*nsymb/2,1,1);
 
 	    //pdsch_vars
+	    printf("coded_bits_per_codeword %d\n",coded_bits_per_codeword);
 
 	    dump_dlsch2(UE,eNB_id,subframe,&coded_bits_per_codeword,round, UE->dlsch[UE->current_thread_id[subframe]][0][0]->current_harq_pid);
 
@@ -2648,7 +1831,7 @@ int main(int argc, char **argv)
             iter_trials++;
 
             if (n_frames==1)
-              printf("No DLSCH errors found (round %d),uncoded ber %f\n",round,uncoded_ber);
+              printf("No DLSCH errors found (round %d),uncoded ber %f\n",round,(double)bit_errors/coded_bits_per_codeword);
 
             UE->total_TBS[eNB_id] =  UE->total_TBS[eNB_id] + UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->harq_processes[UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->current_harq_pid]->TBS;
             TB0_active = 0;
@@ -2662,8 +1845,10 @@ int main(int argc, char **argv)
             iter_trials++;
 
             if (n_frames==1) {
+
+
               //if ((n_frames==1) || (SNR>=30)) {
-              printf("DLSCH errors found (round %d), uncoded ber %f\n",round,uncoded_ber);
+              printf("DLSCH errors found (round %d), uncoded ber %f\n",round,(double)bit_errors/coded_bits_per_codeword);
 
               for (s=0; s<UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->C; s++) {
                 if (s<UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Cminus)
@@ -3292,13 +2477,6 @@ int main(int argc, char **argv)
 
   uncoded_ber_bit = NULL;
 
-  for (k=0; k<n_users; k++) {
-    free(input_buffer0[k]);
-    free(input_buffer1[k]);
-    input_buffer0[k]=NULL;
-    input_buffer1[k]=NULL;
-  }
-
   printf("Freeing dlsch structures\n");
 
   for (i=0; i<2; i++) {
@@ -3310,7 +2488,7 @@ int main(int argc, char **argv)
 
   if (test_perf && !test_passed)
     return(-1);
-  else 
+  else
     return(0);
 }
 
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
index f493336e988aa453a525609ad845d2570476c4fe..90ba1ec8044e81b6491e98a82e26a14c3909ad73 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
index b257b1561b533b104a05fe76d704e66a46b4167c..3c4b3d0cd308cf8ea52667ff25f8ade505607f88 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/dummy_functions.c b/openair1/SIMULATION/LTE_PHY/dummy_functions.c
new file mode 100644
index 0000000000000000000000000000000000000000..dc86e76113aa7c5dd32c79b0146f1f2596cd8aa3
--- /dev/null
+++ b/openair1/SIMULATION/LTE_PHY/dummy_functions.c
@@ -0,0 +1,84 @@
+
+PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
+			       frame_t frameP, uint8_t new_Msg3,
+			       sub_frame_t subframe){ return(NULL);}
+
+void ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
+		sub_frame_t subframe, uint8_t eNB_index,
+		uint8_t * ulsch_buffer, uint16_t buflen,
+		uint8_t * access_mode){}
+
+void Msg1_transmitted(module_id_t module_idP, uint8_t CC_id,
+		      frame_t frameP, uint8_t eNB_id){}
+
+void Msg3_transmitted(module_id_t module_idP, uint8_t CC_id,
+		      frame_t frameP, uint8_t eNB_id){}
+
+uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
+		   uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe){ return(0);}
+
+void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index)
+{}
+
+UE_L2_STATE_t ue_scheduler(const module_id_t module_idP,
+			   const frame_t rxFrameP,
+			   const sub_frame_t rxSubframe,
+			   const frame_t txFrameP,
+			   const sub_frame_t txSubframe,
+			   const lte_subframe_t direction,
+			   const uint8_t eNB_index, const int CC_id){ return(0);}
+
+void ue_decode_p(module_id_t module_idP, int CC_id, frame_t frame,
+		 uint8_t CH_index, void *pdu, uint16_t len){}
+
+void ue_decode_si(module_id_t module_idP, int CC_id, frame_t frame,
+		  uint8_t CH_index, void *pdu, uint16_t len){}
+
+void ue_send_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frame,
+		 sub_frame_t subframe, uint8_t * sdu, uint16_t sdu_len,
+		 uint8_t CH_index){}
+
+uint16_t
+ue_process_rar(const module_id_t module_idP,
+	       const int CC_id,
+	       const frame_t frameP,
+	       const rnti_t ra_rnti,
+	       uint8_t * const dlsch_buffer,
+	       rnti_t * const t_crnti,
+	       const uint8_t preamble_index,
+	       uint8_t * selected_rar_buffer){ return(0);}
+
+void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
+		     uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index,
+		     uint8_t sync_area){}
+
+int ue_query_mch(uint8_t Mod_id, uint8_t CC_id, uint32_t frame,
+		 sub_frame_t subframe, uint8_t eNB_index,
+		 uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
+
+void dl_phy_sync_success(module_id_t module_idP,
+			 frame_t frameP,
+			 unsigned char eNB_index, uint8_t first_sync){}
+
+uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn) { return(0);}
+
+int32_t get_uldl_offset(int eutra_bandP) { return(0);}
+
+IF_Module_t *IF_Module_init(int Mod_id) { return(NULL);}
+
+int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id) { return(0);}
+
+int8_t get_deltaP_rampup(module_id_t module_idP, uint8_t CC_id) { return(0);}
+
+void thread_top_init(char *thread_name,
+                     int affinity,
+                     uint64_t runtime,
+                     uint64_t deadline,
+                     uint64_t period) {}
+
+int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0);}
+int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
+
+int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
+
+int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
diff --git a/openair1/SIMULATION/LTE_PHY/framegen.c b/openair1/SIMULATION/LTE_PHY/framegen.c
index 9719aeb9e52c0be1cc4544325d5d59b81ea4984f..0adc07ff97f8fccb4928c4fa4725069f447ec56b 100644
--- a/openair1/SIMULATION/LTE_PHY/framegen.c
+++ b/openair1/SIMULATION/LTE_PHY/framegen.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/gpib_send.c b/openair1/SIMULATION/LTE_PHY/gpib_send.c
index 40bcfa87221601899c4015d4858498048e181104..a8ae48cdfae32fb22fd476d5e9610ba7a3d0560f 100644
--- a/openair1/SIMULATION/LTE_PHY/gpib_send.c
+++ b/openair1/SIMULATION/LTE_PHY/gpib_send.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/gpib_send.h b/openair1/SIMULATION/LTE_PHY/gpib_send.h
index 1f1f14e9560398a7682cdfad6340a9505cbece5d..b83026296ac0a20243f48fb4f55064c1c2a1c618 100644
--- a/openair1/SIMULATION/LTE_PHY/gpib_send.h
+++ b/openair1/SIMULATION/LTE_PHY/gpib_send.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c
index 69de4aee9f000337292bff2f6d5c2e5b9f9d3822..fbe75fed16980180a53120747da823c7d296a849 100644
--- a/openair1/SIMULATION/LTE_PHY/mbmssim.c
+++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -31,9 +31,6 @@
 #include "PHY/types.h"
 #include "PHY/defs.h"
 #include "PHY/vars.h"
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
diff --git a/openair1/SIMULATION/LTE_PHY/pbchsim.c b/openair1/SIMULATION/LTE_PHY/pbchsim.c
index 687e7219e82b55cd1c01863fa69a4667ad99c924..d1e25da5c3c6b9a6bbac62ecc5df498680c1dc6f 100644
--- a/openair1/SIMULATION/LTE_PHY/pbchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pbchsim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -32,9 +32,6 @@
 #include "PHY/defs.h"
 #include "PHY/vars.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
@@ -91,9 +88,6 @@ int main(int argc, char **argv)
   uint8_t extended_prefix_flag=0;
   int8_t interf1=-21,interf2=-21;
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
 
   FILE *input_fd=NULL,*pbch_file_fd=NULL;
   char input_val_str[50],input_val_str2[50];
diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
index 1102d4be3800ba2515669dfb2020aab0604741ab..ef0e22149141a2f3de879d8ae01e5e74acd05d61 100644
--- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,9 +28,6 @@
 #include "PHY/defs.h"
 #include "PHY/vars.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
diff --git a/openair1/SIMULATION/LTE_PHY/prachsim.c b/openair1/SIMULATION/LTE_PHY/prachsim.c
index 52339cdc5d585c1a20f6276bc680283d6bb46afa..58f89bd65bd5dba83d41b897045e9888e8f6bc88 100644
--- a/openair1/SIMULATION/LTE_PHY/prachsim.c
+++ b/openair1/SIMULATION/LTE_PHY/prachsim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -27,9 +27,6 @@
 #include "PHY/types.h"
 #include "PHY/defs.h"
 #include "PHY/vars.h"
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
@@ -76,10 +73,6 @@ int main(int argc, char **argv)
   uint8_t extended_prefix_flag=0;
   //  int8_t interf1=-19,interf2=-19;
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
-
 
   SCM_t channel_model=Rayleigh1;
 
diff --git a/openair1/SIMULATION/LTE_PHY/pucchsignalgegerator.h b/openair1/SIMULATION/LTE_PHY/pucchsignalgegerator.h
index a17d708747a78cefd408fa60eae29797b7cabc43..779b9ed423028422357a4b378529e33b0784c6ef 100644
--- a/openair1/SIMULATION/LTE_PHY/pucchsignalgegerator.h
+++ b/openair1/SIMULATION/LTE_PHY/pucchsignalgegerator.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/pucchsignalgenerator.c b/openair1/SIMULATION/LTE_PHY/pucchsignalgenerator.c
index 20f044eb930d83516d1ac17b1fa6df80e3869f06..cf8e0b6d4a882b50bc36afb01369bd4eeb28f453 100644
--- a/openair1/SIMULATION/LTE_PHY/pucchsignalgenerator.c
+++ b/openair1/SIMULATION/LTE_PHY/pucchsignalgenerator.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c
index 9deff20d350dcfc11f876486bb0b7e5306cd42ee..d49367c4db4be34db1d797eee23f1850de2bc686 100644
--- a/openair1/SIMULATION/LTE_PHY/pucchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -27,9 +27,6 @@
 #include "PHY/types.h"
 #include "PHY/defs.h"
 #include "PHY/vars.h"
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
@@ -77,9 +74,6 @@ int main(int argc, char **argv)
   uint8_t extended_prefix_flag=0;
 
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
 
   SCM_t channel_model=Rayleigh1_corr;
 
diff --git a/openair1/SIMULATION/LTE_PHY/scansim.c b/openair1/SIMULATION/LTE_PHY/scansim.c
index ba355bbbebb113131761b93eaedb75288a811188..69aee01b32b472db4be2d149b6453cb27aaa0064 100644
--- a/openair1/SIMULATION/LTE_PHY/scansim.c
+++ b/openair1/SIMULATION/LTE_PHY/scansim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,9 +33,6 @@
 #include "PHY/vars.h"
 #include "MAC_INTERFACE/vars.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
@@ -91,9 +88,6 @@ int main(int argc, char **argv)
   uint32_t nsymb,tx_lev,tx_lev1,tx_lev2;
   uint8_t extended_prefix_flag=0;
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
 
   FILE *input_fd=NULL,*pbch_file_fd=NULL;
   char input_val_str[50],input_val_str2[50];
diff --git a/openair1/SIMULATION/LTE_PHY/signalanalyzer.c b/openair1/SIMULATION/LTE_PHY/signalanalyzer.c
index cf63bd831211e64c7fddc10eeab719a221282061..62b0f9362414159b4d9593c4264cfbe8f9125e6d 100644
--- a/openair1/SIMULATION/LTE_PHY/signalanalyzer.c
+++ b/openair1/SIMULATION/LTE_PHY/signalanalyzer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/signalanalyzer.h b/openair1/SIMULATION/LTE_PHY/signalanalyzer.h
index 8be2f1b6cbf47e4fad5431ee39d3853954deca97..e8aaddb493755532efacb009b9c3378158f5dc22 100644
--- a/openair1/SIMULATION/LTE_PHY/signalanalyzer.h
+++ b/openair1/SIMULATION/LTE_PHY/signalanalyzer.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/syncsim.c b/openair1/SIMULATION/LTE_PHY/syncsim.c
index 58e96a9abef054cdb198e7ec5bd8824349a0cc02..e491944ccf555e55797d42b6a114d77e8e3fd8b6 100644
--- a/openair1/SIMULATION/LTE_PHY/syncsim.c
+++ b/openair1/SIMULATION/LTE_PHY/syncsim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -30,11 +30,6 @@
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 
-#ifdef RTAI_ENABLED
-#include <rtai_mbx.h>
-#include <rtai_msg.h>
-#endif
-
 #include "SIMULATION/TOOLS/defs.h"
 #include "SIMULATION/RF/defs.h"
 #include "PHY/types.h"
@@ -44,9 +39,6 @@
 #ifdef IFFT_FPGA
 #include "PHY/LTE_REFSIG/mod_table.h"
 #endif
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "ARCH/CBMIMO1/DEVICE_DRIVER/vars.h"
@@ -381,9 +373,6 @@ int main(int argc, char **argv)
   uint8_t extended_prefix_flag=0,frame_type=1;
   int8_t interf1=-21,interf2=-21;
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
 
   FILE *input_fd=NULL,*pbch_file_fd=NULL;
   char input_val_str[50],input_val_str2[50];
@@ -430,13 +419,6 @@ int main(int argc, char **argv)
 
   int rx_offset_mod;
 
-#ifdef RTAI_ENABLED
-  int period;
-  RTIME expected;
-  RT_TASK *task;
-#define PERIOD 1000000000
-#endif
-
   logInit();
 
   number_of_cards = 1;
@@ -694,23 +676,6 @@ int main(int argc, char **argv)
     }
   }
 
-#ifdef RTAI_ENABLED
-
-  if (!(task = rt_task_init_schmod(nam2num("SYNCSIM"), 0, 0, 0, SCHED_FIFO, 0xF))) {
-    printf("CANNOT INIT MASTER TASK\n");
-    exit(1);
-  }
-
-  rt_set_periodic_mode();
-
-  period = start_rt_timer(nano2count(PERIOD));
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  rt_make_hard_real_time();
-  rt_task_make_periodic(task, expected = rt_get_time() + 10*period, period);
-#endif
-
 #ifdef XFORMS
 
   if (do_forms==1) {
@@ -1374,11 +1339,6 @@ int main(int argc, char **argv)
 
       for (trial=0; trial<n_frames; trial++) {
 
-#ifdef RTAI_ENABLED
-        ret = rt_task_wait_period();
-        printf("rt_task_wait_period() returns %d, time %llu\n",ret, rt_get_time());
-#endif
-
         if (oai_hw_input == 0) {
 
           if (awgn_flag == 0) {
@@ -1752,11 +1712,6 @@ int main(int argc, char **argv)
     ioctl(openair_fd,openair_START_TX_SIG,(void *)NULL);
   }
 
-#ifdef RTAI_ENABLED
-  rt_make_soft_real_time();
-  rt_task_delete(task);
-#endif
-
 #ifdef XFORMS
 
   if (do_forms==1) {
diff --git a/openair1/SIMULATION/LTE_PHY/test.c b/openair1/SIMULATION/LTE_PHY/test.c
index 16a7b636f5b3054dd0c86fec2259ddd9b359ae8f..b7781ce6908d2eb430c78e56d32eecfb16c936ef 100644
--- a/openair1/SIMULATION/LTE_PHY/test.c
+++ b/openair1/SIMULATION/LTE_PHY/test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/ulsignalgenerator.c b/openair1/SIMULATION/LTE_PHY/ulsignalgenerator.c
index 7c46d057e0258074c056123c98652d9a608411e1..70bbda151ca7d8d562a624f78a85491ed46770a7 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsignalgenerator.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsignalgenerator.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/ulsignalgenerator.h b/openair1/SIMULATION/LTE_PHY/ulsignalgenerator.h
index 0a676be00f5745e88e8420fe274e7e9f1a8a4327..81777ff9582275da0e298f61ff05f6b0543be9a0 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsignalgenerator.h
+++ b/openair1/SIMULATION/LTE_PHY/ulsignalgenerator.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 03c736ecd3f3475bfcbd7a1c22f899701235795c..fc782be07a05db17d3a78dbe2464bd6a10a3e0b5 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -47,9 +47,7 @@
 #include "unitary_defs.h"
 
 #include "PHY/TOOLS/lte_phy_scope.h"
-
-PHY_VARS_eNB *eNB;
-PHY_VARS_UE *UE;
+#include "dummy_functions.c"
 
 double cpuf;
 
@@ -78,9 +76,112 @@ double t_tx_min = 1000000000; /*!< \brief initial min process time for tx */
 double t_rx_min = 1000000000; /*!< \brief initial min process time for tx */
 int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
 int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
+int nfapi_mode = 0;
+
+extern void fep_full(RU_t *ru);
+extern void ru_fep_full_2thread(RU_t *ru);
+
+nfapi_dl_config_request_t DL_req;
+nfapi_ul_config_request_t UL_req;
+nfapi_hi_dci0_request_t HI_DCI0_req;
+nfapi_ul_config_request_pdu_t ul_config_pdu_list[MAX_NUM_DL_PDU];
+nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU];
+nfapi_tx_request_t TX_req;
+Sched_Rsp_t sched_resp;
+
+void
+fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu,
+				uint8_t                        cqi_req,
+				uint8_t                        p_eNB,
+				uint8_t                        cqi_ReportModeAperiodic,
+				uint8_t                        betaOffset_CQI_Index,
+				uint8_t                        betaOffset_RI_Index,
+				uint8_t                        dl_cqi_pmi_size,
+				uint8_t                        tmode,
+				uint32_t                       handle,
+				uint16_t                       rnti,
+				uint8_t                        resource_block_start,
+				uint8_t                        number_of_resource_blocks,
+				uint8_t                        modulation_type,
+				uint8_t                        cyclic_shift_2_for_drms,
+				uint8_t                        frequency_hopping_enabled_flag,
+				uint8_t                        frequency_hopping_bits,
+				uint8_t                        new_data_indication,
+				uint8_t                        redundancy_version,
+				uint8_t                        harq_process_number,
+				uint8_t                        ul_tx_mode,
+				uint8_t                        current_tx_nb,
+				uint8_t                        n_srs,
+				uint16_t                       size)
+{
+  memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t));
+
+  //  printf("filling ul_config_pdu: modulation type %d, rvidx %d\n",modulation_type,redundancy_version);
+
+  ul_config_pdu->pdu_type                                                    = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
+  ul_config_pdu->pdu_size                                                    = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_pdu));
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.tl.tag                             = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle                             = handle;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti                               = rnti;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start               = resource_block_start;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks          = number_of_resource_blocks;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type                    = modulation_type;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms            = cyclic_shift_2_for_drms;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag     = frequency_hopping_enabled_flag;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits             = frequency_hopping_bits;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication                = new_data_indication;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version                 = redundancy_version;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number                = harq_process_number;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode                         = ul_tx_mode;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb                      = current_tx_nb;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs                              = n_srs;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size                               = size;
+
+  if (cqi_req == 1) {
+    // Add CQI portion
+    ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE;
+    ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_cqi_ri_pdu));
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG;
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type = 1;
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.number_of_cc = 1;
+    LOG_D(MAC, "report_type %d\n",ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type);
+
+    if (p_eNB <= 2
+	&& (tmode == 3 || tmode == 4 || tmode == 8 || tmode == 9 || tmode == 10))
+      ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 1;
+    else if (p_eNB <= 2) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 0;
+    else if (p_eNB == 4) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 2;
+
+    for (int ri = 0;
+	 ri <  (1 << ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size);
+	 ri++)
+      ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri] =	dl_cqi_pmi_size;
+
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi = betaOffset_CQI_Index;
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri  = betaOffset_RI_Index;
+  }
+}
 
-
-void fill_ulsch_dci(PHY_VARS_eNB *eNB,void *UL_dci,int first_rb,int nb_rb,int mcs,int ndi,int cqi_flag) {
+void fill_ulsch_dci(PHY_VARS_eNB *eNB,
+		    int frame,
+		    int subframe,
+		    Sched_Rsp_t *sched_resp,
+		    uint16_t rnti,
+		    void *UL_dci,
+		    int first_rb,
+		    int nb_rb,
+		    int mcs,
+		    int modulation_type,
+		    int ndi,
+		    int cqi_flag,
+		    uint8_t beta_CQI,
+		    uint8_t beta_RI,
+		    uint8_t cqi_size) {
+
+  nfapi_ul_config_request_body_t *ul_req=&sched_resp->UL_req->ul_config_request_body;
+  int harq_pid = ((frame*10)+subframe)&7;
+
+  //  printf("ulsch in frame %d, subframe %d => harq_pid %d, mcs %d, ndi %d\n",frame,subframe,harq_pid,mcs,ndi);
 
   switch (eNB->frame_parms.N_RB_UL) {
   case 6:
@@ -162,6 +263,36 @@ void fill_ulsch_dci(PHY_VARS_eNB *eNB,void *UL_dci,int first_rb,int nb_rb,int mc
     break;
   }
 
+  fill_nfapi_ulsch_config_request(&ul_req->ul_config_pdu_list[0],
+				  cqi_flag&1,
+				  1,  // p_eNB
+				  0,  // reportmode Aperiodic
+				  beta_CQI,
+				  beta_RI,
+				  cqi_size,
+				  //cc,
+				  //UE_template->physicalConfigDedicated,
+				  1,
+				  0,
+				  14,     // rnti
+				  first_rb,	// resource_block_start
+				  nb_rb,	// number_of_resource_blocks
+				  modulation_type,
+				  0,	// cyclic_shift_2_for_drms
+				  0,	// frequency_hopping_enabled_flag
+				  0,	// frequency_hopping_bits
+				  ndi,	// new_data_indication
+				  mcs>28?(mcs-28):0,	// redundancy_version
+				  harq_pid,	// harq_process_number
+				  0,	// ul_tx_mode
+				  0,	// current_tx_nb
+				  0,	// n_srs
+				  get_TBS_UL(mcs,nb_rb));
+
+  sched_resp->UL_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
+  ul_req->number_of_pdus=1;
+  ul_req->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+
 }
 
 extern void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
@@ -172,22 +303,26 @@ int main(int argc, char **argv)
 
   char c;
   int i,j,aa,u;
-
+  PHY_VARS_eNB *eNB;
+  PHY_VARS_UE *UE;
+  RU_t *ru;
   int aarx,aatx;
   double channelx,channely;
   double sigma2, sigma2_dB=10,SNR,SNR2=0,snr0=-2.0,snr1,SNRmeas,rate,saving_bler=0;
   double input_snr_step=.2,snr_int=30;
   double blerr;
-
+  int rvidx[8]={0,2,3,1,0,2,3,1};
   int **txdata;
 
   LTE_DL_FRAME_PARMS *frame_parms;
   double s_re0[30720],s_im0[30720],r_re0[30720],r_im0[30720];
   double s_re1[30720],s_im1[30720],r_re1[30720],r_im1[30720];
+  double r_re2[30720],r_im2[30720];
+  double r_re3[30720],r_im3[30720];
   double *s_re[2]={s_re0,s_re1};
   double *s_im[2]={s_im0,s_im1};
-  double *r_re[2]={r_re0,r_re1};
-  double *r_im[2]={r_im0,r_im1};
+  double *r_re[4]={r_re0,r_re1,r_re2,r_re3};
+  double *r_im[4]={r_im0,r_im1,r_im2,r_im3};
   double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel
   double iqim=0.0;
   uint8_t extended_prefix_flag=0;
@@ -254,8 +389,7 @@ int main(int argc, char **argv)
   uint8_t N_RB_DL=25,osf=1;
 
   //uint8_t cyclic_shift = 0;
-  uint8_t cooperation_flag = 0; //0 no cooperation, 1 delay diversity, 2 Alamouti
-  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
+  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2,cqi_size=11;
   uint8_t tdd_config=3,frame_type=FDD;
 
   uint8_t N0=30;
@@ -282,10 +416,24 @@ int main(int argc, char **argv)
 
   opp_enabled=1; // to enable the time meas
 
+  sched_resp.DL_req = &DL_req;
+  sched_resp.UL_req = &UL_req;
+  sched_resp.HI_DCI0_req = &HI_DCI0_req;
+  sched_resp.TX_req = &TX_req;
+  memset((void*)&DL_req,0,sizeof(DL_req));
+  memset((void*)&UL_req,0,sizeof(UL_req));
+  memset((void*)&HI_DCI0_req,0,sizeof(HI_DCI0_req));
+  memset((void*)&TX_req,0,sizeof(TX_req));
+
+  UL_req.ul_config_request_body.ul_config_pdu_list = ul_config_pdu_list;
+  TX_req.tx_request_body.tx_pdu_list = tx_pdu_list;
+
   cpu_freq_GHz = (double)get_cpu_freq_GHz();
   cpuf = cpu_freq_GHz;
 
   printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
+  AssertFatal(load_configmodule(argc,argv) != NULL,
+	      "cannot load configuration module, exiting\n");
 
   logInit();
   /*
@@ -565,20 +713,44 @@ int main(int argc, char **argv)
       break;
     }
   }
+  RC.nb_L1_inst = 1;
+  RC.nb_RU = 1;
 
-  lte_param_init(1,
-                 1, 
+  lte_param_init(&eNB,&UE,&ru,
+		 1,
+		 1,
 		 n_rx,
+                 1,
 		 1,
 		 extended_prefix_flag,
 		 frame_type,
 		 0,
 		 tdd_config,
 		 N_RB_DL,
+		 4,
 		 threequarter_fs,
 		 osf,
 		 0);
 
+  RC.eNB = (PHY_VARS_eNB ***)malloc(sizeof(PHY_VARS_eNB **));
+  RC.eNB[0] = (PHY_VARS_eNB **)malloc(sizeof(PHY_VARS_eNB *));
+  RC.ru = (RU_t **)malloc(sizeof(RC.ru));
+  RC.eNB[0][0] = eNB;
+  RC.ru[0] = ru;
+  for (int k=0;k<eNB->RU_list[0]->nb_rx;k++) eNB->common_vars.rxdataF[k]     =  eNB->RU_list[0]->common.rxdataF[k];
+
+  memset((void*)&eNB->UL_INFO,0,sizeof(eNB->UL_INFO));
+
+  printf("Setting indication lists\n");
+  eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list   = eNB->rx_pdu_list;
+  eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list = eNB->crc_pdu_list;
+  eNB->UL_INFO.sr_ind.sr_indication_body.sr_pdu_list = eNB->sr_pdu_list;
+  eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list;
+  eNB->UL_INFO.cqi_ind.cqi_pdu_list = eNB->cqi_pdu_list;
+  eNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = eNB->cqi_raw_pdu_list;
+
+  printf("lte_param_init done\n");
+
   // for a call to phy_reset_ue later we need PHY_vars_UE_g allocated and pointing to UE
   PHY_vars_UE_g = (PHY_VARS_UE***)malloc(sizeof(PHY_VARS_UE**));
   PHY_vars_UE_g[0] = (PHY_VARS_UE**) malloc(sizeof(PHY_VARS_UE*));
@@ -587,7 +759,7 @@ int main(int argc, char **argv)
   if (nb_rb_set == 0)
     nb_rb = eNB->frame_parms.N_RB_UL;
 
-  printf("1 . rxdataF_comp[0] %p\n",eNB->pusch_vars[0]->rxdataF_comp[0][0]);
+  printf("1 . rxdataF_comp[0] %p\n",eNB->pusch_vars[0]->rxdataF_comp[0]);
   printf("Setting mcs = %d\n",mcs);
   printf("n_frames = %d\n", n_frames);
 
@@ -670,7 +842,6 @@ int main(int argc, char **argv)
   eNB->soundingrs_ul_config_dedicated[UE_id].freqDomainPosition = 0;
   eNB->soundingrs_ul_config_dedicated[UE_id].cyclicShift = 0;
 
-  eNB->cooperation_flag = cooperation_flag;
 
   eNB->pusch_config_dedicated[UE_id].betaOffset_ACK_Index = beta_ACK;
   eNB->pusch_config_dedicated[UE_id].betaOffset_RI_Index  = beta_RI;
@@ -688,8 +859,8 @@ int main(int argc, char **argv)
 
   printf("PUSCH Beta : ACK %f, RI %f, CQI %f\n",(double)beta_ack[beta_ACK]/8,(double)beta_ri[beta_RI]/8,(double)beta_cqi[beta_CQI]/8);
 
-  UE2eNB = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
-                                UE->frame_parms.nb_antennas_rx,
+  UE2eNB = new_channel_desc_scm(1,
+                                n_rx,
                                 channel_model,
 				N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
 				N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
@@ -700,7 +871,7 @@ int main(int argc, char **argv)
   UE2eNB->max_Doppler = maxDoppler;
 
   // NN: N_RB_UL has to be defined in ulsim
-  eNB->ulsch[0] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0);
+  for (int k=0;k<NUMBER_OF_UE_MAX;k++) eNB->ulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0);
   UE->ulsch[0]   = new_ue_ulsch(N_RB_DL,0);
 
   if (parallel_flag == 1) {
@@ -751,7 +922,7 @@ int main(int argc, char **argv)
 
 
   UE->mac_enabled=0;
-  
+
   eNB_rxtx_proc_t *proc_rxtx   = &eNB->proc.proc_rxtx[subframe&1];
   UE_rxtx_proc_t *proc_rxtx_ue = &UE->proc.proc_rxtx[subframe&1];
   proc_rxtx->frame_rx=1;
@@ -761,9 +932,9 @@ int main(int argc, char **argv)
   proc_rxtx->subframe_tx=pdcch_alloc2ul_subframe(&eNB->frame_parms,subframe);
 
   proc_rxtx_ue->frame_tx = proc_rxtx->frame_rx;
-  proc_rxtx_ue->frame_rx = proc_rxtx->frame_tx;
+  proc_rxtx_ue->frame_rx = (subframe<4)?(proc_rxtx->frame_tx-1):(proc_rxtx->frame_tx);
   proc_rxtx_ue->subframe_tx = proc_rxtx->subframe_rx;
-  proc_rxtx_ue->subframe_rx = proc_rxtx->subframe_tx;
+  proc_rxtx_ue->subframe_rx = (proc_rxtx->subframe_tx+6)%10;
 
   printf("Init UL hopping UE\n");
   init_ul_hopping(&UE->frame_parms);
@@ -915,7 +1086,6 @@ int main(int argc, char **argv)
       reset_meas(&UE->ulsch_multiplexing_stats);
 
       reset_meas(&eNB->phy_proc_rx);
-      reset_meas(&eNB->ofdm_demod_stats);
       reset_meas(&eNB->ulsch_channel_estimation_stats);
       reset_meas(&eNB->ulsch_freq_offset_estimation_stats);
       reset_meas(&eNB->rx_dft_stats);
@@ -932,7 +1102,7 @@ int main(int argc, char **argv)
       reset_meas(&eNB->ulsch_tc_intl1_stats);
       reset_meas(&eNB->ulsch_tc_intl2_stats);
 
-      // initialization 
+      // initialization
       struct list time_vector_tx;
       initialize(&time_vector_tx);
       struct list time_vector_tx_ifft;
@@ -965,19 +1135,38 @@ int main(int argc, char **argv)
         round=0;
 
         while (round < 4) {
+	  proc_rxtx->frame_rx=1;
+	  proc_rxtx->subframe_rx=subframe;
+
+	  proc_rxtx->frame_tx=pdcch_alloc2ul_frame(&eNB->frame_parms,1,subframe);
+	  proc_rxtx->subframe_tx=pdcch_alloc2ul_subframe(&eNB->frame_parms,subframe);
+
+	  proc_rxtx_ue->frame_tx = proc_rxtx->frame_rx;
+	  proc_rxtx_ue->frame_rx = (subframe<4)?(proc_rxtx->frame_tx-1):(proc_rxtx->frame_tx);
+	  proc_rxtx_ue->subframe_tx = proc_rxtx->subframe_rx;
+	  proc_rxtx_ue->subframe_rx = (proc_rxtx->subframe_tx+6)%10;
+
           eNB->ulsch[0]->harq_processes[harq_pid]->round=round;
           UE->ulsch[0]->harq_processes[harq_pid]->round=round;
-	  //	  printf("Trial %d : Round %d (subframe %d, frame %d)\n",trials,round,proc_rxtx_ue->subframe_rx,proc_rxtx_ue->frame_rx);
+	  if (n_frames==1) printf("filling ulsch: Trial %d : Round %d (subframe %d, frame %d)\n",trials,round,proc_rxtx_ue->subframe_tx,proc_rxtx_ue->frame_tx);
           round_trials[round]++;
 
+	  UL_req.sfn_sf = (1<<4)+subframe;
+	  if (n_frames==1) printf("filling ulsch: eNB prog frame %d, subframe %d (%d,%d)\n",proc_rxtx->frame_rx,subframe,sched_resp.frame,sched_resp.subframe);
 
-	  fill_ulsch_dci(eNB,(void*)&UL_alloc_pdu,first_rb,nb_rb,mcs,ndi,cqi_flag);
+	  int modulation_type;
+	  if (mcs < 11)      modulation_type = 2;
+	  else if (mcs < 21) modulation_type = 4;
+	  else if (mcs < 29) modulation_type = 6;
+
+	  fill_ulsch_dci(eNB,proc_rxtx->frame_rx,subframe,&sched_resp,14,(void*)&UL_alloc_pdu,first_rb,nb_rb,(round==0)?mcs:(28+rvidx[round]),modulation_type,ndi,cqi_flag,beta_CQI,beta_RI,cqi_size);
 
 	  UE->ulsch_Msg3_active[eNB_id] = 0;
 	  UE->ul_power_control_dedicated[eNB_id].accumulationEnabled=1;
+	  if (n_frames==1) printf("filling ulsch: ue prog SFN/SF %d/%d\n",proc_rxtx_ue->frame_rx,proc_rxtx_ue->subframe_rx);
 	  generate_ue_ulsch_params_from_dci((void *)&UL_alloc_pdu,
 					    14,
-					    proc_rxtx->subframe_tx,
+					    (subframe+6)%10,
 					    format0,
 					    UE,
 					    proc_rxtx_ue,
@@ -988,17 +1177,11 @@ int main(int argc, char **argv)
 					    0,
 					    srs_flag);
 
-	  generate_eNB_ulsch_params_from_dci(eNB,proc_rxtx,
-					     (void *)&UL_alloc_pdu,
-					     14,
-					     format0,
-					     0,
-					     SI_RNTI,
-					     0,
-					     P_RNTI,
-					     CBA_RNTI,
-					     srs_flag);
-	  eNB->ulsch[0]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
+	  sched_resp.subframe=(subframe+6)%10;
+	  sched_resp.frame=(1024+eNB->proc.frame_rx+((subframe<4)?-1:0))&1023;
+
+	  schedule_response(&sched_resp);
+
 
           /////////////////////
           if (abstx) {
@@ -1020,6 +1203,9 @@ int main(int argc, char **argv)
 
 	    eNB->proc.frame_rx = 1;
 	    eNB->proc.subframe_rx = subframe;
+	    ru->proc.frame_rx = 1;
+	    ru->proc.subframe_rx = subframe;
+
 	    proc_rxtx_ue->frame_tx = proc_rxtx->frame_rx;
 	    proc_rxtx_ue->frame_rx = proc_rxtx->frame_tx;
 	    proc_rxtx_ue->subframe_tx = proc_rxtx->subframe_rx;
@@ -1027,83 +1213,19 @@ int main(int argc, char **argv)
 
 	    phy_procedures_UE_TX(UE,proc_rxtx_ue,0,0,normal_txrx,no_relay);
 
-	    /*
-            if (srs_flag)
-              generate_srs_tx(UE,0,AMP,subframe);
-
-            generate_drs_pusch(UE,proc_rxtx_ue,0,
-                               AMP,subframe,
-                               UE->ulsch[0]->harq_processes[harq_pid]->first_rb,
-                               UE->ulsch[0]->harq_processes[harq_pid]->nb_rb,
-                               0);
-
-            if ((cqi_flag == 1) && (n_frames == 1) ) {
-              printf("CQI information (O %d) %d %d\n",UE->ulsch[0]->O,
-                     UE->ulsch[0]->o[0],UE->ulsch[0]->o[1]);
-              print_CQI(UE->ulsch[0]->o,UE->ulsch[0]->uci_format,UE->frame_parms.N_RB_DL,0);
-            }
-
-            UE->ulsch[0]->o_ACK[0] = taus()&1;
-
-            start_meas(&UE->ulsch_encoding_stats);
-
-            if (ulsch_encoding(input_buffer,
-                               UE,
-                               harq_pid,
-                               eNB_id,
-                               2, // transmission mode
-                               control_only_flag,
-                               1// Nbundled
-                              )==-1) {
-              printf("ulsim.c Problem with ulsch_encoding\n");
-              exit(-1);
-            }
-
-            stop_meas(&UE->ulsch_encoding_stats);
-
-            start_meas(&UE->ulsch_modulation_stats);
-            ulsch_modulation(UE->common_vars.txdataF,AMP,
-                             proc_rxtx_ue->frame_tx,subframe,&UE->frame_parms,
-                             UE->ulsch[0]);
-            stop_meas(&UE->ulsch_modulation_stats);
-	    */
-
-
-
-
-	    /*
-	    for (aa=0; aa<1; aa++) {
-              if (frame_parms->Ncp == EXTENDED)
-                PHY_ofdm_mod(&UE->common_vars.txdataF[aa][subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX],        // input
-                             &txdata[aa][eNB->frame_parms.samples_per_tti*subframe],         // output
-                             UE->frame_parms.ofdm_symbol_size,
-                             nsymb,                 // number of symbols
-                             UE->frame_parms.nb_prefix_samples,               // number of prefix samples
-                             CYCLIC_PREFIX);
-              else
-                normal_prefix_mod(&UE->common_vars.txdataF[aa][subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX],
-                                  &txdata[aa][eNB->frame_parms.samples_per_tti*subframe],
-                                  nsymb,
-                                  frame_parms);
-
-
-              apply_7_5_kHz(UE,UE->common_vars.txdata[aa],subframe<<1);
-              apply_7_5_kHz(UE,UE->common_vars.txdata[aa],1+(subframe<<1));
-
-*/
 
 	    tx_lev = signal_energy(&UE->common_vars.txdata[0][eNB->frame_parms.samples_per_tti*subframe],
 				   eNB->frame_parms.samples_per_tti);
-	    
-	    
+
+
             if (n_frames==1) {
               write_output("txsigF0UL.m","txsF0", &UE->common_vars.txdataF[0][eNB->frame_parms.ofdm_symbol_size*nsymb*subframe],eNB->frame_parms.ofdm_symbol_size*nsymb,1,
                            1);
               //write_output("txsigF1.m","txsF1", UE->common_vars.txdataF[0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
             }
-	    
+
 	  }  // input_fd == NULL
-	  
+
           tx_lev_dB = (unsigned int) dB_fixed_times10(tx_lev);
 
           if (n_frames==1) {
@@ -1113,11 +1235,11 @@ int main(int argc, char **argv)
 
           //AWGN
           //Set target wideband RX noise level to N0
-          sigma2_dB = N0;//10*log10((double)tx_lev)  +10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12)) - SNR;
+          sigma2_dB = N0;//-10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12));//10*log10((double)tx_lev)  +10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12)) - SNR;
           sigma2 = pow(10,sigma2_dB/10);
 
           // compute tx_gain to achieve target SNR (per resource element!)
-          tx_gain = sqrt(pow(10.0,.1*(N0+SNR))*(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev);
+          tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);//*(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev);
 
 
 	  if (n_frames==1)
@@ -1128,8 +1250,8 @@ int main(int argc, char **argv)
           for (i=0; i<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
             for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
 
-              ((short*) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
-              ((short*) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
+              ((short*) &ru->common.rxdata[aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
+              ((short*) &ru->common.rxdata[aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
             }
           }
 
@@ -1186,37 +1308,37 @@ int main(int argc, char **argv)
 
           for (i=0; i<eNB->frame_parms.samples_per_tti; i++) {
             for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
-              ((short*) &eNB->common_vars.rxdata[0][aa][eNB->frame_parms.samples_per_tti*subframe])[2*i] = (short) ((tx_gain*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
-              ((short*) &eNB->common_vars.rxdata[0][aa][eNB->frame_parms.samples_per_tti*subframe])[2*i+1] = (short) ((tx_gain*r_im[aa][i]) + (iqim*tx_gain*r_re[aa][i]) + sqrt(
+              ((short*) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*subframe])[2*i] = (short) ((tx_gain*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
+              ((short*) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*subframe])[2*i+1] = (short) ((tx_gain*r_im[aa][i]) + (iqim*tx_gain*r_re[aa][i]) + sqrt(
                     sigma2/2)*gaussdouble(0.0,1.0));
             }
           }
 
-          if (n_frames==1) {
+          if (n_frames<=10) {
             printf("rx_level Null symbol %f\n",10*log10((double)signal_energy((int*)
-                   &eNB->common_vars.rxdata[0][0][(eNB->frame_parms.samples_per_tti<<1) -eNB->frame_parms.ofdm_symbol_size],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2)));
-            printf("rx_level data symbol %f\n",10*log10(signal_energy((int*)&eNB->common_vars.rxdata[0][0][160+(eNB->frame_parms.samples_per_tti*subframe)],
+                   &ru->common.rxdata[0][(eNB->frame_parms.samples_per_tti<<1) -eNB->frame_parms.ofdm_symbol_size],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2)));
+            printf("rx_level data symbol %f\n",10*log10(signal_energy((int*)&ru->common.rxdata[0][160+(eNB->frame_parms.samples_per_tti*subframe)],
                    OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2)));
           }
 
-          SNRmeas = 10*log10(((double)signal_energy((int*)&eNB->common_vars.rxdata[0][0][160+(eNB->frame_parms.samples_per_tti*subframe)],
+          SNRmeas = 10*log10(((double)signal_energy((int*)&ru->common.rxdata[0][160+(eNB->frame_parms.samples_per_tti*subframe)],
                               OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2))/((double)signal_energy((int*)
-                                  &eNB->common_vars.rxdata[0][0][(eNB->frame_parms.samples_per_tti<<1) -eNB->frame_parms.ofdm_symbol_size],
+                                  &ru->common.rxdata[0][(eNB->frame_parms.samples_per_tti<<1) -eNB->frame_parms.ofdm_symbol_size],
                                   OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2)) - 1)+10*log10(eNB->frame_parms.N_RB_UL/nb_rb);
 
-          if (n_frames==1) {
+          if (n_frames<=10) {
             printf("SNRmeas %f\n",SNRmeas);
 
-            //    write_output("rxsig0UL.m","rxs0", &eNB->common_vars.rxdata[0][0][eNB->frame_parms.samples_per_tti*subframe],eNB->frame_parms.samples_per_tti,1,1);
-            //write_output("rxsig1UL.m","rxs1", &eNB->common_vars.rxdata[0][0][eNB->frame_parms.samples_per_tti*subframe],eNB->frame_parms.samples_per_tti,1,1);
+	    write_output("rxsig0UL.m","rxs0", &ru->common.rxdata[0][eNB->frame_parms.samples_per_tti*subframe],eNB->frame_parms.samples_per_tti,1,1);
+	    if (eNB->frame_parms.nb_antennas_rx>1) write_output("rxsig1UL.m","rxs1", &ru->common.rxdata[1][eNB->frame_parms.samples_per_tti*subframe],eNB->frame_parms.samples_per_tti,1,1);
           }
 
 
-	  eNB->fep = (parallel_flag == 1) ? eNB_fep_full_2thread        : eNB_fep_full;
+	  ru->feprx = (parallel_flag == 1) ? ru_fep_full_2thread        : fep_full;
 	  eNB->td  = (parallel_flag == 1) ? ulsch_decoding_data_2thread : ulsch_decoding_data;
-	  eNB->do_prach = NULL;
 
-	  phy_procedures_eNB_common_RX(eNB,proc_rxtx);
+
+	  ru->feprx(ru);
 	  phy_procedures_eNB_uespec_RX(eNB,proc_rxtx,no_relay);
 
 
@@ -1249,10 +1371,10 @@ int main(int argc, char **argv)
 
           //    printf("ulsch_coding: O[%d] %d\n",i,o_flip[i]);
 
-	  
+
 	  //          if (ret <= eNB->ulsch[0]->max_turbo_iterations) {
-	  
-	  if (eNB->ulsch[0]->harq_processes[harq_pid]->round == 0) {
+
+	  if (eNB->ulsch[0]->harq_processes[harq_pid]->status == SCH_IDLE) {
 
 	    //  avg_iter += ret;
 	    iter_trials++;
@@ -1264,7 +1386,7 @@ int main(int argc, char **argv)
                 print_CQI(eNB->ulsch[0]->harq_processes[harq_pid]->o,
                           eNB->ulsch[0]->harq_processes[harq_pid]->uci_format,0,eNB->frame_parms.N_RB_DL);
 
-              dump_ulsch(eNB,proc_rxtx,0);
+              dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
               exit(-1);
             }
 
@@ -1293,18 +1415,17 @@ int main(int argc, char **argv)
                          eNB->ulsch[0]->harq_processes[harq_pid]->c[s][i]^UE->ulsch[0]->harq_processes[harq_pid]->c[s][i]);
               }
 
-              dump_ulsch(eNB,proc_rxtx,0);
-              exit(-1);
+              dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
+              if (round == 4) exit(-1);
             }
 
-            //      printf("round %d errors %d/%d\n",round,errs[round],trials);
+	    if (n_frames==1) printf("round %d errors %d/%d\n",round,errs[round],trials);
             round++;
 
             if (n_frames==1) {
               printf("ULSCH in error in round %d\n",round);
             }
           }  // ulsch error
-	  
 
         } // round
 
@@ -1324,7 +1445,7 @@ int main(int argc, char **argv)
 
 
         double t_rx = (double)eNB->phy_proc_rx.p_time/cpu_freq_GHz/1000.0;
-        double t_rx_fft = (double)eNB->ofdm_demod_stats.p_time/cpu_freq_GHz/1000.0;
+        double t_rx_fft = (double)ru->ofdm_demod_stats.p_time/cpu_freq_GHz/1000.0;
         double t_rx_demod = (double)eNB->ulsch_demodulation_stats.p_time/cpu_freq_GHz/1000.0;
         double t_rx_dec = (double)eNB->ulsch_decoding_stats.p_time/cpu_freq_GHz/1000.0;
 
@@ -1449,12 +1570,12 @@ int main(int argc, char **argv)
              tx_lev_dB,
              20*log10(tx_gain),
              (double)N0,
-             eNB->measurements[0].n0_power_tot_dB,
+             eNB->measurements.n0_power_tot_dB,
              get_hundred_times_delta_IF(UE,eNB_id,harq_pid) ,
              dB_fixed(eNB->pusch_vars[0]->ulsch_power[0]),
              dB_fixed(eNB->pusch_vars[0]->ulsch_power[1]),
-             eNB->measurements->n0_power_dB[0],
-             eNB->measurements->n0_power_dB[1]);
+             eNB->measurements.n0_power_dB[0],
+             eNB->measurements.n0_power_dB[1]);
 
       effective_rate = ((double)(round_trials[0])/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3]));
 
@@ -1548,10 +1669,10 @@ int main(int argc, char **argv)
         printf("Total PHY proc rx                  :%f us (%d trials)\n",(double)eNB->phy_proc_rx.diff/eNB->phy_proc_rx.trials/cpu_freq_GHz/1000.0,eNB->phy_proc_rx.trials);
         printf("|__ Statistcs                           std: %fus max: %fus min: %fus median %fus q1 %fus q3 %fus n_dropped: %d packet \n", std_phy_proc_rx, t_rx_max, t_rx_min, rx_median, rx_q1, rx_q3,
                n_rx_dropped);
-        std_phy_proc_rx_fft = sqrt((double)eNB->ofdm_demod_stats.diff_square/pow(cpu_freq_GHz,2)/pow(1000,
-                                   2)/eNB->ofdm_demod_stats.trials - pow((double)eNB->ofdm_demod_stats.diff/eNB->ofdm_demod_stats.trials/cpu_freq_GHz/1000,2));
-        printf("OFDM_demod time                   :%f us (%d trials)\n",(double)eNB->ofdm_demod_stats.diff/eNB->ofdm_demod_stats.trials/cpu_freq_GHz/1000.0,
-               eNB->ofdm_demod_stats.trials);
+        std_phy_proc_rx_fft = sqrt((double)ru->ofdm_demod_stats.diff_square/pow(cpu_freq_GHz,2)/pow(1000,
+                                   2)/ru->ofdm_demod_stats.trials - pow((double)ru->ofdm_demod_stats.diff/ru->ofdm_demod_stats.trials/cpu_freq_GHz/1000,2));
+        printf("OFDM_demod time                   :%f us (%d trials)\n",(double)ru->ofdm_demod_stats.diff/ru->ofdm_demod_stats.trials/cpu_freq_GHz/1000.0,
+               ru->ofdm_demod_stats.trials);
         printf("|__ Statistcs                           std: %fus median %fus q1 %fus q3 %fus \n", std_phy_proc_rx_fft, rx_fft_median, rx_fft_q1, rx_fft_q3);
         std_phy_proc_rx_demod = sqrt((double)eNB->ulsch_demodulation_stats.diff_square/pow(cpu_freq_GHz,2)/pow(1000,
                                      2)/eNB->ulsch_demodulation_stats.trials - pow((double)eNB->ulsch_demodulation_stats.diff/eNB->ulsch_demodulation_stats.trials/cpu_freq_GHz/1000,2));
@@ -1672,7 +1793,7 @@ int main(int argc, char **argv)
                 UE->ulsch_modulation_stats.trials,
                 UE->ulsch_encoding_stats.trials,
                 eNB->phy_proc_rx.trials,
-                eNB->ofdm_demod_stats.trials,
+                ru->ofdm_demod_stats.trials,
                 eNB->ulsch_demodulation_stats.trials,
                 eNB->ulsch_decoding_stats.trials
                );
@@ -1682,7 +1803,7 @@ int main(int argc, char **argv)
                 get_time_meas_us(&UE->ulsch_modulation_stats),
                 get_time_meas_us(&UE->ulsch_encoding_stats),
                 get_time_meas_us(&eNB->phy_proc_rx),
-                get_time_meas_us(&eNB->ofdm_demod_stats),
+                get_time_meas_us(&ru->ofdm_demod_stats),
                 get_time_meas_us(&eNB->ulsch_demodulation_stats),
                 get_time_meas_us(&eNB->ulsch_decoding_stats)
                );
@@ -1733,7 +1854,7 @@ int main(int argc, char **argv)
 
 
   oai_exit=1;
-  pthread_cond_signal(&eNB->proc.cond_fep);
+  pthread_cond_signal(&ru->proc.cond_fep);
 
   if (abstx) { // ABSTRACTION
     fprintf(csv_fdUL,"];");
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim2.c b/openair1/SIMULATION/LTE_PHY/ulsim2.c
index 26cec52187427ccde561705eaa5ad452ff2a66b7..6a474332e8b4d760a33f01be987c6dd39a756952 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim2.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -30,9 +30,6 @@
 #ifdef IFFT_FPGA
 #include "PHY/LTE_REFSIG/mod_table.h"
 #endif
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 
 #define BW 10.0
 #define Td 1.0
@@ -69,12 +66,6 @@ int main(int argc, char **argv)
   double ip =0.0;
   double N0W, path_loss, path_loss_dB;
 
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
-
-
-
   if (argc>1)
     sigma2_dB = atoi(argv[1]);
 
diff --git a/openair1/SIMULATION/LTE_PHY/unitary_defs.h b/openair1/SIMULATION/LTE_PHY/unitary_defs.h
index 73d0bc0900ddddb7ad674e07619e9be13f4f0504..c33b72f64990f20cba9ae4abe817509366c4fef0 100644
--- a/openair1/SIMULATION/LTE_PHY/unitary_defs.h
+++ b/openair1/SIMULATION/LTE_PHY/unitary_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/RF/Makefile b/openair1/SIMULATION/RF/Makefile
index 5b713b1d947967778658b23e3889393d44be5cc5..c6c03ad8d59f14a908ac70bc9015f3c0b0225ab3 100644
--- a/openair1/SIMULATION/RF/Makefile
+++ b/openair1/SIMULATION/RF/Makefile
@@ -1,6 +1,6 @@
 include $(OPENAIR_DIR)/common/utils/Makefile.inc
 OBJS = rf.o ../../PHY/TOOLS/file_output.o ../TOOLS/rangen_double.o
-CFLAGS += -DRF_MAIN -DUSER_MODE -DDEBUG_PHY 
+CFLAGS += -DRF_MAIN -DDEBUG_PHY 
 
 all: $(OBJS)
 	gcc -o rf $(OBJS) -lm 
diff --git a/openair1/SIMULATION/RF/adc.c b/openair1/SIMULATION/RF/adc.c
index 8bb32778fee0748c8791a768df32b08cced99345..3bf70a203a4432b620cbc4bc7bbf961a25394d51 100644
--- a/openair1/SIMULATION/RF/adc.c
+++ b/openair1/SIMULATION/RF/adc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/RF/dac.c b/openair1/SIMULATION/RF/dac.c
index 4822a4d26d08d0271eaa6dcd65fa428932a04b7f..8cf6b496231d630df17437b3712fd0f617eb218a 100644
--- a/openair1/SIMULATION/RF/dac.c
+++ b/openair1/SIMULATION/RF/dac.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/RF/defs.h b/openair1/SIMULATION/RF/defs.h
index 74bca6350bb33e5afab6f2b53c48ae8236de093b..05e74647a06c0f6c4ac17d61369eb76fdb56c841 100644
--- a/openair1/SIMULATION/RF/defs.h
+++ b/openair1/SIMULATION/RF/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/RF/rf.c b/openair1/SIMULATION/RF/rf.c
index cb2af3836714fad929dcc1088fd1644081cc1e26..3cf770ac7cf8c1a0f3038626807dedf18fccdef2 100644
--- a/openair1/SIMULATION/RF/rf.c
+++ b/openair1/SIMULATION/RF/rf.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/abstraction.c b/openair1/SIMULATION/TOOLS/abstraction.c
index 88b3ce6406bfbf72272d75f155f69edefb1704b4..7e99371c3736dae18f92ac18c2b6536347506087 100644
--- a/openair1/SIMULATION/TOOLS/abstraction.c
+++ b/openair1/SIMULATION/TOOLS/abstraction.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/ch_desc_proto.c b/openair1/SIMULATION/TOOLS/ch_desc_proto.c
index e47ac81440e52b04e318c62f558ca5a00589e5ff..8b07a596a925774c1c6cdc4a9296bcec2e8673be 100644
--- a/openair1/SIMULATION/TOOLS/ch_desc_proto.c
+++ b/openair1/SIMULATION/TOOLS/ch_desc_proto.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/defs.h b/openair1/SIMULATION/TOOLS/defs.h
index 4378ca2da309c1002a7e99408dbbd74ac4a74519..a958c6b4ebcfb2737c58f30fff63d6475d8446d3 100644
--- a/openair1/SIMULATION/TOOLS/defs.h
+++ b/openair1/SIMULATION/TOOLS/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/gauss.c b/openair1/SIMULATION/TOOLS/gauss.c
index ff3ff14e247ef6077e622899a16e8339e6deb2ea..f69748270b0cc8a4baf23e54ae8fc0259159913e 100644
--- a/openair1/SIMULATION/TOOLS/gauss.c
+++ b/openair1/SIMULATION/TOOLS/gauss.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/llr_quantization.c b/openair1/SIMULATION/TOOLS/llr_quantization.c
index 3cb221e6755b0627ce355a585f269c94a3aa18fe..57cb61e007d126a2f5ba421b3f9e2327d595d917 100644
--- a/openair1/SIMULATION/TOOLS/llr_quantization.c
+++ b/openair1/SIMULATION/TOOLS/llr_quantization.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/multipath_channel.c b/openair1/SIMULATION/TOOLS/multipath_channel.c
index 43af2efb874b18cd1f3aca86744ae00395ff48f3..757d5023de214d5ae8a823b3a3dd03e6ca045b9e 100644
--- a/openair1/SIMULATION/TOOLS/multipath_channel.c
+++ b/openair1/SIMULATION/TOOLS/multipath_channel.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/multipath_tv_channel.c b/openair1/SIMULATION/TOOLS/multipath_tv_channel.c
index a75d432120dc03340ac7b97d2aacad505433431b..c2078b91d478763895c25771f24fe109260e4eb6 100644
--- a/openair1/SIMULATION/TOOLS/multipath_tv_channel.c
+++ b/openair1/SIMULATION/TOOLS/multipath_tv_channel.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c
index b8ab133d12fc477c47d4d83b6b849cadd17cebb5..222a196e20b9c0e171ecd3ac5c5177a88138e889 100644
--- a/openair1/SIMULATION/TOOLS/random_channel.c
+++ b/openair1/SIMULATION/TOOLS/random_channel.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/rangen_double.c b/openair1/SIMULATION/TOOLS/rangen_double.c
index 2d1de80197da131dc75fa2c71f00699f250fa26d..0fc01a8d3132233ff34502b71466e4a3886adb3a 100644
--- a/openair1/SIMULATION/TOOLS/rangen_double.c
+++ b/openair1/SIMULATION/TOOLS/rangen_double.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,12 +19,10 @@
  *      contact@openairinterface.org
  */
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
 #include <time.h>
-#endif
 
 #include  "defs.h"
 
diff --git a/openair1/SIMULATION/TOOLS/scm_corrmat.h b/openair1/SIMULATION/TOOLS/scm_corrmat.h
index ff89b2f33e355f0d41c180c71f84d54d121ab38b..6ee6567ce9a77d8dd76c5027d61a9818fd7aa929 100644
--- a/openair1/SIMULATION/TOOLS/scm_corrmat.h
+++ b/openair1/SIMULATION/TOOLS/scm_corrmat.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair1/SIMULATION/TOOLS/taus.c b/openair1/SIMULATION/TOOLS/taus.c
index e8a13da0768048b32bb7e59eb96813c1a841d9b9..0be7952da71c4fa017e13c7a76a4f8a25342497d 100644
--- a/openair1/SIMULATION/TOOLS/taus.c
+++ b/openair1/SIMULATION/TOOLS/taus.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,18 +19,8 @@
  *      contact@openairinterface.org
  */
 
-#ifdef USER_MODE
 #include <time.h>
 #include <stdlib.h>
-#else
-#include <asm/io.h>
-#include <asm/rtai.h>
-#endif
-#ifdef RTAI_ENABLED
-#include <rtai.h>
-#include <rtai_sched.h>
-#define time(x) (unsigned int)(rt_get_time_ns())
-#endif
 
 unsigned int s0, s1, s2, b;
 
@@ -55,21 +45,14 @@ unsigned int taus(void)
 void set_taus_seed(unsigned int seed_init)
 {
 
-#ifdef USER_MODE
   struct drand48_data buffer;
   unsigned long result = 0;
-#endif
 
   if (seed_init == 0) {
     s0 = (unsigned int)time(NULL);
     s1 = (unsigned int)time(NULL);
     s2 = (unsigned int)time(NULL);
   } else {
-#ifndef USER_MODE
-    s0 = (unsigned int)0x1e23d852;
-    s1 = (unsigned int)0x81f38a1c;
-    s2 = (unsigned int)0xfe1a133e;
-#else
     /* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
     srand48_r((long int)seed_init, &buffer);
     mrand48_r(&buffer, (long int *)&result);
@@ -78,7 +61,6 @@ void set_taus_seed(unsigned int seed_init)
     s1 = result;
     mrand48_r(&buffer, (long int *)&result);
     s2 = result;
-#endif
   }
 }
 #endif
@@ -87,10 +69,8 @@ void set_taus_seed(unsigned int seed_init)
  void set_taus_seed(unsigned int seed_init)
 {
 
-#ifdef USER_MODE
   struct drand48_data buffer;
   unsigned long result = 0;
-#endif
     s0 = (unsigned int)0x1e23d852;
     s1 = (unsigned int)0x81f38a1c;
     s2 = (unsigned int)0xfe1a133e;
@@ -102,11 +82,6 @@ void set_taus_seed(unsigned int seed_init)
     s1 = (unsigned int)time(NULL);
     s2 = (unsigned int)time(NULL);
   } else {
-#ifndef USER_MODE
-    s0 = (unsigned int)0x1e23d852;
-    s1 = (unsigned int)0x81f38a1c;
-    s2 = (unsigned int)0xfe1a133e;
-#else
    // Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
     srand48_r((long int)seed_init, &buffer);
     mrand48_r(&buffer, (long int *)&result);
@@ -115,7 +90,6 @@ void set_taus_seed(unsigned int seed_init)
     s1 = result;
     mrand48_r(&buffer, (long int *)&result);
     s2 = result;
-#endif
   }
 }
 #endif
diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h
index acc9ae6ba11f466fe95ef90b3a10d0ad2a0ea05c..829c3c9e33a203aeac0d21f24a612224f874697a 100644
--- a/openair2/COMMON/as_message.h
+++ b/openair2/COMMON/as_message.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/commonDef.h b/openair2/COMMON/commonDef.h
index 37d05f3fda8a858737384a3627c6a6306a2d7bbc..b37230cdd45ffbd9154556bb4ed5aa46d7185af6 100644
--- a/openair2/COMMON/commonDef.h
+++ b/openair2/COMMON/commonDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/gtpv1_u_messages_def.h b/openair2/COMMON/gtpv1_u_messages_def.h
index 4abbbf85b4b22aa32c128f073ae3de1ae22b63b4..9cc41a70eaa3d456a512cf475f7dcfc828c80431 100644
--- a/openair2/COMMON/gtpv1_u_messages_def.h
+++ b/openair2/COMMON/gtpv1_u_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h
index c791b25cf7f55c66167a550520f2b789b7c09ca5..c3c9c6b7c78f0ead0447ea8ac239b4876d7a43da 100644
--- a/openair2/COMMON/gtpv1_u_messages_types.h
+++ b/openair2/COMMON/gtpv1_u_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/intertask_interface_conf.h b/openair2/COMMON/intertask_interface_conf.h
index 2d4bebdee8c20e46b6d103b4c815734fd5f94034..9c108f87e08395753404665293f67ca282751f3f 100644
--- a/openair2/COMMON/intertask_interface_conf.h
+++ b/openair2/COMMON/intertask_interface_conf.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/mac_messages_def.h b/openair2/COMMON/mac_messages_def.h
index 0aa9a6f90991a964b8dd433aee5f2c28e78d62e1..fcb45431491b940a8646600b2bccec82626b4951 100644
--- a/openair2/COMMON/mac_messages_def.h
+++ b/openair2/COMMON/mac_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,3 +40,5 @@ MESSAGE_DEF(RRC_MAC_CCCH_DATA_IND,      MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchDat
 
 MESSAGE_DEF(RRC_MAC_MCCH_DATA_REQ,      MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataReq,           rrc_mac_mcch_data_req)
 MESSAGE_DEF(RRC_MAC_MCCH_DATA_IND,      MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataInd,           rrc_mac_mcch_data_ind)
+
+MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ,      MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDataReq,           rrc_mac_pcch_data_req)
diff --git a/openair2/COMMON/mac_messages_types.h b/openair2/COMMON/mac_messages_types.h
index 91c06b847ada04fd6315139cd7686ed8bd35d3c0..d7fd44f072a35d0de25c04777ba62e7b7d6ca96e 100644
--- a/openair2/COMMON/mac_messages_types.h
+++ b/openair2/COMMON/mac_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -43,11 +43,13 @@
 
 #define RRC_MAC_MCCH_DATA_REQ(mSGpTR)           (mSGpTR)->ittiMsg.rrc_mac_mcch_data_req
 #define RRC_MAC_MCCH_DATA_IND(mSGpTR)           (mSGpTR)->ittiMsg.rrc_mac_mcch_data_ind
+#define RRC_MAC_PCCH_DATA_REQ(mSGpTR)           (mSGpTR)->ittiMsg.rrc_mac_pcch_data_req
 
 // Some constants from "LAYER2/MAC/defs.h"
 #define BCCH_SDU_SIZE                           (512)
 #define CCCH_SDU_SIZE                           (512)
 #define MCCH_SDU_SIZE                           (512)
+#define PCCH_SDU_SIZE                           (512)
 
 //-------------------------------------------------------------------------------------------//
 // Messages between RRC and MAC layers
@@ -114,4 +116,10 @@ typedef struct RrcMacMcchDataInd_s {
   uint8_t   mbsfn_sync_area;
 } RrcMacMcchDataInd;
 
+typedef struct RrcMacPcchDataReq_s {
+  uint32_t  frame;
+  uint32_t  sdu_size;
+  uint8_t   sdu[PCCH_SDU_SIZE];
+  uint8_t   enb_index;
+} RrcMacPcchDataReq;
 #endif /* MAC_MESSAGES_TYPES_H_ */
diff --git a/openair2/COMMON/mac_primitives.h b/openair2/COMMON/mac_primitives.h
index aa6bbd6cae1f331ec03dccd5dc066dcfed1a8455..c901722d5d7b67622791abeb8cd04126176f92d5 100644
--- a/openair2/COMMON/mac_primitives.h
+++ b/openair2/COMMON/mac_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/mac_rlc_primitives.h b/openair2/COMMON/mac_rlc_primitives.h
index 0033e2449985b704cea5acec0d14f2aec74b5a1e..4e3e22781c5fbb9494c23f271ddfe543bae2be2f 100644
--- a/openair2/COMMON/mac_rlc_primitives.h
+++ b/openair2/COMMON/mac_rlc_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h
index 49d22a8ceb0256c18d0ebf2dcca9c4174b58c23c..3a73000e505aa5452bd53543669bf3bec0e0ec8e 100644
--- a/openair2/COMMON/mac_rrc_primitives.h
+++ b/openair2/COMMON/mac_rrc_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -244,9 +244,7 @@ typedef struct {
   LCHAN_DESC  Lchan_desc[2];  /*!< \brief Logical Channel QoS Descriptor (MAC component) */
   uint8_t L3_info_type;
   uint8_t L3_info[16];
-  //#ifndef CELLULAR
   unsigned short UE_eNB_index;
-  //#endif
 } __attribute__ ((__packed__))  MAC_CONFIG_REQ;
 #define MAC_CONFIG_REQ_SIZE sizeof(MAC_CONFIG_REQ)
 
@@ -314,18 +312,12 @@ typedef struct {
 
 #ifndef OPENAIR2_IN
 
-#ifndef CELLULAR
-//#include "L3_rrc_defs.h"
-#endif
-
 typedef struct {  //RRC_INTERFACE_FUNCTIONS
   unsigned int Frame_index;
   unsigned short UE_index[NB_MODULES_MAX][NB_SIG_CNX_UE];
   uint8_t  eNB_id[NB_MODULES_MAX][NB_CNX_UE];
-#ifndef CELLULAR
   //  L2_ID UE_id[NB_MODULES_MAX][NB_CNX_CH];
   uint8_t UE_id[NB_MODULES_MAX][NB_CNX_CH][5];
-#endif
   void (*openair_rrc_top_init)(void);
   char (*openair_rrc_eNB_init)(uint8_t );
   char (*openair_rrc_UE_init)(uint8_t, uint8_t);
diff --git a/openair2/COMMON/messages_def.h b/openair2/COMMON/messages_def.h
index fd3a4e9ea1e1f1a3ffee730022001a1cde65158d..2434d157767bb2369c53eaf4aa2cb5fe07f5588b 100644
--- a/openair2/COMMON/messages_def.h
+++ b/openair2/COMMON/messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/messages_types.h b/openair2/COMMON/messages_types.h
index a8bb0d8d7e6f42065be15abfc79f04b690c3bddc..5e5fdadd2adb4e7e3316454a69e802197fde3c1c 100644
--- a/openair2/COMMON/messages_types.h
+++ b/openair2/COMMON/messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/nas_messages_def.h b/openair2/COMMON/nas_messages_def.h
index db766fe99ce4ad81544e68851f60cbea3918ac34..34d6d64a1fbd736c63851658a7dfa7135c7d3976 100644
--- a/openair2/COMMON/nas_messages_def.h
+++ b/openair2/COMMON/nas_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/nas_messages_types.h b/openair2/COMMON/nas_messages_types.h
index 6d433241961ad799bc7d134a5de4ffaca5fe0b89..5cb1927aca782c5dc1a1f5eff27e7b86d6171c27 100644
--- a/openair2/COMMON/nas_messages_types.h
+++ b/openair2/COMMON/nas_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/networkDef.h b/openair2/COMMON/networkDef.h
index 42c812baada0127cc8c15c2ad014863f7bbc5523..89f8d5fc44f3eddc64abcd2b70352af6f7323dc3 100644
--- a/openair2/COMMON/networkDef.h
+++ b/openair2/COMMON/networkDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/openair_defs.h b/openair2/COMMON/openair_defs.h
index 58be0e58e9a77eb9003c9cab49fddbadb743d7ea..4d8d50606c814a6e6ccc77ebbfbba93686c19042 100644
--- a/openair2/COMMON/openair_defs.h
+++ b/openair2/COMMON/openair_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -22,12 +22,6 @@
 #ifndef __openair_DEFS_H__
 #define __openair_DEFS_H__
 
-#ifndef USER_MODE
-#include <linux/kernel.h>
-#endif //USER_MODE
-
-
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
 #if !defined (msg)
@@ -49,44 +43,7 @@
 #define PAGE_MASK 0xfffff000
 #define virt_to_phys(x) (x)
 
-#else // USER_MODE
-#include <rtai.h>
-#define msg rt_printk
-
-#ifdef BIGPHYSAREA
-
-#define bigmalloc(x) (bigphys_malloc(x))
-#define bigmalloc16(x) (bigphys_malloc(x))
-
-#define malloc16(x) (bigphys_malloc(x))
-#define free16(y,x)
-
-#define bigfree(y,x)
-
-#else // BIGPHYSAREA
-
-#define bigmalloc(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0))
-#define bigmalloc16(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0))
-#define bigfree(y,x) (dma_free_coherent(pdev[0],(x),(void *)(y),dummy_dma_ptr))
-#define malloc16(x) (kmalloc(x,GFP_KERNEL))
-#define free16(y,x) (kfree(y))
-
-#endif // BIGPHYSAREA
-
-
-#ifdef CBMIMO1
-#define openair_get_mbox() (*(unsigned int *)mbox)
-#else //CBMIMO1
-#define openair_get_mbox() (*(unsigned int *)PHY_vars->mbox>>1)
-#endif //CBMIMO1
-
-
-#endif // USERMODE
-
-// #define bzero(s,n) (memset((s),0,(n)))
-
 #define cmax(a,b)  ((a>b) ? (a) : (b))
 #define cmin(a,b)  ((a<b) ? (a) : (b))
 #endif // /*__openair_DEFS_H__ */
 
-
diff --git a/openair2/COMMON/pdcp_messages_def.h b/openair2/COMMON/pdcp_messages_def.h
index 9ac1e4e95a53d7322e33eb9a67fd5d24b374fd58..c4be4b2957416ed4fcc96ee17f16514b683129a6 100644
--- a/openair2/COMMON/pdcp_messages_def.h
+++ b/openair2/COMMON/pdcp_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -30,3 +30,4 @@
 // Messages between RRC and PDCP layers
 MESSAGE_DEF(RRC_DCCH_DATA_REQ,          MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataReq,              rrc_dcch_data_req)
 MESSAGE_DEF(RRC_DCCH_DATA_IND,          MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataInd,              rrc_dcch_data_ind)
+MESSAGE_DEF(RRC_PCCH_DATA_REQ,          MESSAGE_PRIORITY_MED_PLUS, RrcPcchDataReq,              rrc_pcch_data_req)
diff --git a/openair2/COMMON/pdcp_messages_types.h b/openair2/COMMON/pdcp_messages_types.h
index ca5af05b1860077f3a0775e6b1f895ad067e3ac8..c90490b0fd36077c99f1c023ec33655244b01ca0 100644
--- a/openair2/COMMON/pdcp_messages_types.h
+++ b/openair2/COMMON/pdcp_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,6 +33,7 @@
 // Defines to access message fields.
 #define RRC_DCCH_DATA_REQ(mSGpTR)               (mSGpTR)->ittiMsg.rrc_dcch_data_req
 #define RRC_DCCH_DATA_IND(mSGpTR)               (mSGpTR)->ittiMsg.rrc_dcch_data_ind
+#define RRC_PCCH_DATA_REQ(mSGpTR)               (mSGpTR)->ittiMsg.rrc_pcch_data_req
 
 //-------------------------------------------------------------------------------------------//
 // Messages between RRC and PDCP layers
@@ -60,4 +61,13 @@ typedef struct RrcDcchDataInd_s {
   uint8_t      eNB_index; // LG: needed in UE
 } RrcDcchDataInd;
 
+typedef struct RrcPcchDataReq_s {
+  uint32_t     sdu_size;
+  uint8_t      *sdu_p;
+  uint8_t      mode;
+  uint16_t     rnti;
+  uint8_t      ue_index;
+  uint8_t      CC_id;
+} RrcPcchDataReq;
+
 #endif /* PDCP_MESSAGES_TYPES_H_ */
diff --git a/openair2/COMMON/phy_messages_def.h b/openair2/COMMON/phy_messages_def.h
index d0e2b83e3a1c774f33725bec6f95e944d6a7a59a..a2f16e64c8a5e8258029589793db916b7ea35094 100644
--- a/openair2/COMMON/phy_messages_def.h
+++ b/openair2/COMMON/phy_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/phy_messages_types.h b/openair2/COMMON/phy_messages_types.h
index 1742fac8d4fabb35b7a7e1cc481ac5fc96aeec5a..c425efa89cb38b88fe08c804ecbcc11bf0e29ecb 100644
--- a/openair2/COMMON/phy_messages_types.h
+++ b/openair2/COMMON/phy_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h
index 377773b642a4c28dc43e73d77c5bf478e0e0de9e..4debccc7b05075ce37e830420336551a29c6c323 100644
--- a/openair2/COMMON/platform_constants.h
+++ b/openair2/COMMON/platform_constants.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -43,7 +43,6 @@
 #define NL_MAX_PAYLOAD 9000  /* this should cover the max mtu size*/
 #endif
 
-#ifdef USER_MODE
 #ifdef LARGE_SCALE
 #    define NB_MODULES_MAX 128
 #    define NB_NODE_MAX    128
@@ -51,11 +50,6 @@
 #    define NB_MODULES_MAX 32
 #    define NB_NODE_MAX    32
 #endif
-#else
-#    define NB_MODULES_MAX 1
-#    define NB_NODE_MAX    1
-#endif //PHY_EMUL
-
 
 #ifdef JUMBO_FRAME
 #    define MAX_IP_PACKET_SIZE         10000 // 9000
@@ -83,6 +77,10 @@
 
 #define MAX_MANAGED_ENB_PER_MOBILE  2
 
+///NB-IOT
+#define NB_RB_MAX_NB_IOT  (maxDRB_NB_r13 + 3) //MP: NB_IoT --> 2(DRB)+3(SRBs - 2 is not used) = 5
+
+
 #define DEFAULT_RAB_ID 1
 
 #define NB_RB_MAX      (maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */
@@ -132,9 +130,7 @@
 #define  UNUSED_PARAM_MBMS_SESSION_ID  0
 #define  UNUSED_PARAM_MBMS_SERVICE_ID  0
 
-#ifdef USER_MODE
 #define printk printf
-#endif
 
 #define UNUSED_VARIABLE(vARIABLE)   (void)(vARIABLE)
 
diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h
index 45d7774afad0bf382481a644c4fbb4536f243a2a..0ab8d9670145ceab059356b9d6675e94b786b2b7 100644
--- a/openair2/COMMON/platform_types.h
+++ b/openair2/COMMON/platform_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -30,7 +30,7 @@
 #ifndef __PLATFORM_TYPES_H__
 #    define __PLATFORM_TYPES_H__
 
-#ifdef USER_MODE
+#if !defined(NAS_NETLINK)
 #include <stdint.h>
 #endif
 
@@ -69,6 +69,7 @@ typedef uint32_t              frame_t;
 typedef int32_t               sframe_t;
 typedef uint32_t              sub_frame_t;
 typedef uint8_t               module_id_t;
+typedef uint8_t               slice_id_t;
 typedef uint8_t               eNB_index_t;
 typedef uint16_t              ue_id_t;
 typedef int16_t               smodule_id_t;
@@ -99,6 +100,15 @@ typedef enum rb_type_e {
   RADIO_ACCESS_BEARER         = 2
 } rb_type_t;
 
+typedef enum {
+    CR_ROUND = 0,
+    CR_SRB12 = 1,
+    CR_HOL   = 2,
+    CR_LC    = 3,
+    CR_CQI   = 4,
+    CR_NUM   = 5
+} sorting_criterion_t;
+
 //-----------------------------------------------------------------------------
 // PHY TYPES
 //-----------------------------------------------------------------------------
@@ -271,29 +281,5 @@ typedef struct protocol_ctxt_s {
     (CTXT_Pp)->module_id, \
     (CTXT_Pp)->rnti
 
-#ifdef OAI_EMU
-#define CHECK_CTXT_ARGS(CTXT_Pp) \
-    if ((CTXT_Pp)->enb_flag) {\
-        AssertFatal (((CTXT_Pp)->module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),\
-                     "eNB module id is too low (%u/%d/%d)!\n",\
-                     (CTXT_Pp)->module_id,\
-                     oai_emulation.info.first_enb_local,\
-                     oai_emulation.info.nb_enb_local);\
-        AssertFatal (((CTXT_Pp)->module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),\
-                     "eNB module id is too high (%u/%d)!\n",\
-                     (CTXT_Pp)->module_id,\
-                     oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);\
-    } else {\
-        AssertFatal ((CTXT_Pp)->module_id  < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),\
-                     "UE module id is too high (%u/%d)!\n",\
-                     (CTXT_Pp)->module_id,\
-                     oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);\
-        AssertFatal ((CTXT_Pp)->module_id  >= oai_emulation.info.first_ue_local,\
-                     "UE module id is too low (%u/%d)!\n",\
-                     (CTXT_Pp)->module_id,\
-                     oai_emulation.info.first_ue_local);\
-    }
-#else
 #define CHECK_CTXT_ARGS(CTXT_Pp)
 #endif
-#endif
diff --git a/openair2/COMMON/ral_messages_def.h b/openair2/COMMON/ral_messages_def.h
index b10c6453622c00c7faf37c82eee5c8d1fdbef058..7dd41b5db395eb5213b2cc4d385417bb72fd6559 100644
--- a/openair2/COMMON/ral_messages_def.h
+++ b/openair2/COMMON/ral_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/ral_messages_types.h b/openair2/COMMON/ral_messages_types.h
index a9817a55509bc2c0d283213756c43eb571feebb0..22e3b5143f53fd0f662e61dcf1eb02eedb078970 100644
--- a/openair2/COMMON/ral_messages_types.h
+++ b/openair2/COMMON/ral_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/rlc_messages_def.h b/openair2/COMMON/rlc_messages_def.h
index 36ec94a773cb6a83b1890beb3f20cd3ec2a1f565..af78f2d098df5a8601d77acb873b42f083e7b732 100644
--- a/openair2/COMMON/rlc_messages_def.h
+++ b/openair2/COMMON/rlc_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/rlc_messages_types.h b/openair2/COMMON/rlc_messages_types.h
index 127b686cf7b2bcef5a35614957d26ab476327552..fe4614f3bc7ffb7a9800f00ed13303652fb320c9 100644
--- a/openair2/COMMON/rlc_messages_types.h
+++ b/openair2/COMMON/rlc_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h
index 04b1182482a137f9db97e3855163b97e4507c4aa..08ea93f427add5aa6dbd032e54180848cb3e85da 100644
--- a/openair2/COMMON/rrc_messages_def.h
+++ b/openair2/COMMON/rrc_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -54,6 +54,7 @@ MESSAGE_DEF(RRC_STATE_IND,              MESSAGE_PRIORITY_MED,       RrcStateInd,
 //-------------------------------------------------------------------------------------------//
 // eNB: ENB_APP -> RRC messages
 MESSAGE_DEF(RRC_CONFIGURATION_REQ,      MESSAGE_PRIORITY_MED,       RrcConfigurationReq,        rrc_configuration_req)
+MESSAGE_DEF(NBIOTRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED,       NbIoTRrcConfigurationReq,   nbiotrrc_configuration_req)
 
 // UE: NAS -> RRC messages
 MESSAGE_DEF(NAS_KENB_REFRESH_REQ,       MESSAGE_PRIORITY_MED,       NasKenbRefreshReq,          nas_kenb_refresh_req)
diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h
index cd8b533dd3aab92a5a1f0817a2e1204f2f77598e..9bd25d3b3aa52075eaf3acf5f5c51b0f9f7581b5 100644
--- a/openair2/COMMON/rrc_messages_types.h
+++ b/openair2/COMMON/rrc_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -62,6 +62,8 @@ typedef UL_DCCH_Message_t       RrcUlDcchMessage;
 
 #define RRC_CONFIGURATION_REQ(mSGpTR)   (mSGpTR)->ittiMsg.rrc_configuration_req
 
+#define NBIOTRRC_CONFIGURATION_REQ(mSGpTR)   (mSGpTR)->ittiMsg.nbiotrrc_configuration_req
+
 #define NAS_KENB_REFRESH_REQ(mSGpTR)    (mSGpTR)->ittiMsg.nas_kenb_refresh_req
 #define NAS_CELL_SELECTION_REQ(mSGpTR)  (mSGpTR)->ittiMsg.nas_cell_selection_req
 #define NAS_CONN_ESTABLI_REQ(mSGpTR)    (mSGpTR)->ittiMsg.nas_conn_establi_req
@@ -167,6 +169,77 @@ typedef struct RrcConfigurationReq_s {
   long                    ue_TimersAndConstants_n311[MAX_NUM_CCs];
   long                    ue_TransmissionMode[MAX_NUM_CCs];
 } RrcConfigurationReq;
+#define MAX_NUM_NBIOT_CELEVELS    3
+typedef struct NbIoTRrcConfigurationReq_s {
+  uint32_t            cell_identity;
+
+  uint16_t            tac;
+
+  uint16_t	      mcc;
+  uint16_t	      mnc;
+  uint8_t	      mnc_digit_length;
+  lte_frame_type_t	  frame_type;
+  uint8_t                 tdd_config;
+  uint8_t                 tdd_config_s;
+  lte_prefix_type_t       prefix_type;
+  lte_prefix_type_t	  prefix_type_UL;
+  int16_t                 eutra_band;
+  uint32_t                downlink_frequency;
+  int32_t                 uplink_frequency_offset;
+  int16_t                 Nid_cell;// for testing, change later
+  int16_t                 N_RB_DL;// for testing, change later
+  //RACH
+  long					  rach_raResponseWindowSize_NB;
+  long					  rach_macContentionResolutionTimer_NB;
+  long					  rach_powerRampingStep_NB;
+  long					  rach_preambleInitialReceivedTargetPower_NB;
+  long					  rach_preambleTransMax_CE_NB;
+  //BCCH
+  long					  bcch_modificationPeriodCoeff_NB;
+  //PCCH
+  long					  pcch_defaultPagingCycle_NB;
+  long					  pcch_nB_NB;
+  long					  pcch_npdcch_NumRepetitionPaging_NB;
+  //NPRACH
+  long					  nprach_CP_Length;
+  long					  nprach_rsrp_range;
+  long					  nprach_Periodicity[MAX_NUM_NBIOT_CELEVELS];
+  long					  nprach_StartTime[MAX_NUM_NBIOT_CELEVELS];
+  long					  nprach_SubcarrierOffset[MAX_NUM_NBIOT_CELEVELS];
+  long					  nprach_NumSubcarriers[MAX_NUM_NBIOT_CELEVELS];
+  long					  numRepetitionsPerPreambleAttempt_NB[MAX_NUM_NBIOT_CELEVELS];
+  long					  nprach_SubcarrierMSG3_RangeStart;
+  long					  maxNumPreambleAttemptCE_NB;
+  long					  npdcch_NumRepetitions_RA[MAX_NUM_NBIOT_CELEVELS];
+  long					  npdcch_StartSF_CSS_RA[MAX_NUM_NBIOT_CELEVELS];
+  long					  npdcch_Offset_RA[MAX_NUM_NBIOT_CELEVELS];
+  //NPDSCH
+  long					  npdsch_nrs_Power;
+  //NPUSCH
+  long					  npusch_ack_nack_numRepetitions_NB;
+  long					  npusch_srs_SubframeConfig_NB;
+  long					  npusch_threeTone_CyclicShift_r13;
+  long					  npusch_sixTone_CyclicShift_r13;
+  BOOLEAN_t				  npusch_groupHoppingEnabled;
+  long					  npusch_groupAssignmentNPUSCH_r13;
+
+  //DL_GapConfig
+  long					  dl_GapThreshold_NB;
+  long	 				  dl_GapPeriodicity_NB;
+  long	 				  dl_GapDurationCoeff_NB;
+  //Uplink power control Common
+  long					  npusch_p0_NominalNPUSCH;
+  long					  npusch_alpha;
+  long					  deltaPreambleMsg3;
+  //UE timers and constants
+  long					  ue_TimersAndConstants_t300_NB;
+  long					  ue_TimersAndConstants_t301_NB;
+  long					  ue_TimersAndConstants_t310_NB;
+  long					  ue_TimersAndConstants_t311_NB;
+  long					  ue_TimersAndConstants_n310_NB;
+  long					  ue_TimersAndConstants_n311_NB;
+} NbIoTRrcConfigurationReq;
+
 
 // UE: NAS -> RRC messages
 typedef kenb_refresh_req_t      NasKenbRefreshReq;
diff --git a/openair2/COMMON/rrm_config_structs.h b/openair2/COMMON/rrm_config_structs.h
index 73f5997932f96bf93a448d75ae30ecf8ae3e0e6e..9d060d102d1b3718349d9371f2aa4fda8384ce5c 100644
--- a/openair2/COMMON/rrm_config_structs.h
+++ b/openair2/COMMON/rrm_config_structs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/rrm_constants.h b/openair2/COMMON/rrm_constants.h
index 9fe3a28d9b74e6b097addc8e952b0a24ecf5507e..5da8f773c339d582854d8d5293774f732b3d0ffb 100644
--- a/openair2/COMMON/rrm_constants.h
+++ b/openair2/COMMON/rrm_constants.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/rtos_header.h b/openair2/COMMON/rtos_header.h
index ed10ef4a10bd968ce96e5ed7bd70d586d60bb5aa..05fc33463d6454abb7249fe217fab838f58c414a 100644
--- a/openair2/COMMON/rtos_header.h
+++ b/openair2/COMMON/rtos_header.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -20,45 +20,13 @@
  */
 
 #ifndef _RTOS_HEADER_H_
-#    define _RTOS_HEADER_H_
-#    if defined(RTAI) && !defined(USER_MODE)
-//       CONVERSION BETWEEN POSIX PTHREAD AND RTAI FUNCTIONS
-/*
-#        define pthread_mutex_init             pthread_mutex_init_rt
-#        define pthread_mutexattr_init         pthread_mutexattr_init_rt
-#        define pthread_mutex_lock             pthread_mutex_lock_rt
-#        define pthread_mutex_unlock           pthread_mutex_unlock_rt
-#        define pthread_mutex_destroy          pthread_mutex_destroy_rt
-#        define pthread_cond_init              pthread_cond_init_rt
-#        define pthread_cond_wait              pthread_cond_wait_rt
-#        define pthread_cond_signal            pthread_cond_signal_rt
-#        define pthread_cond_destroy           pthread_cond_destroy_rt
-#        define pthread_attr_init              pthread_attr_init_rt
-#        define pthread_attr_setschedparam     pthread_attr_setschedparam_rt
-#        define pthread_create                 pthread_create_rt
-#        define pthread_cancel                 pthread_cancel_rt
-#        define pthread_delete_np              pthread_cancel_rt
-#        define pthread_attr_setstacksize      pthread_attr_setstacksize_rt
-#        define pthread_self                   rt_whoami
-*/
-#        include <asm/rtai.h>
-#        include <rtai.h>
-#        include <rtai_posix.h>
-#        include <rtai_fifos.h>
-#        include <rtai_sched.h>
-#        ifdef CONFIG_PROC_FS
-#            include <rtai_proc_fs.h>
-#        endif
-#    else
-#        ifdef USER_MODE
-#            include <stdio.h>
-#            include <stdlib.h>
-#            include <string.h>
-#            include <math.h>
-#            include <pthread.h>
-#            include <assert.h>
-#            define rtf_get    read
-#            define rtf_put    write
-#        endif
-#    endif
+#define _RTOS_HEADER_H_
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <pthread.h>
+#include <assert.h>
+#define rtf_get    read
+#define rtf_put    write
 #endif
diff --git a/openair2/COMMON/s1ap_messages_def.h b/openair2/COMMON/s1ap_messages_def.h
index 10c70439d26c67e864632d957894f121a9ffc215..a39953d8f77e777ca79b1e4644be41690ae3f799 100644
--- a/openair2/COMMON/s1ap_messages_def.h
+++ b/openair2/COMMON/s1ap_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,6 +33,11 @@ MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgT
 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)
+MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQUEST_LOG     , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_e_rab_modify_request_log)
+MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESPONSE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_e_rab_modify_response_log)
+MESSAGE_DEF(S1AP_PAGING_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_paging_log)
+MESSAGE_DEF(S1AP_E_RAB_RELEASE_REQUEST_LOG   , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_e_rab_release_request_log)
+MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE_LOG  , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_e_rab_release_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)
@@ -54,6 +59,8 @@ MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_
 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)
+MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESP          , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_resp_t          , s1ap_e_rab_modify_resp)
+MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE    , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_resp_t        , s1ap_e_rab_release_resp)
 
 /* S1AP -> RRC messages */
 MESSAGE_DEF(S1AP_DOWNLINK_NAS              , MESSAGE_PRIORITY_MED, s1ap_downlink_nas_t              , s1ap_downlink_nas )
@@ -61,6 +68,8 @@ MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_initial_
 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_E_RAB_MODIFY_REQ           , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_req_t        , s1ap_e_rab_modify_req )
+MESSAGE_DEF(S1AP_E_RAB_RELEASE_COMMAND     , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_command_t     , s1ap_e_rab_release_command)
 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 4fc043f28111246ebc1f91819f084b2d21b60936..4a5f492b0baa3f4685c8de48f342ff6075e02d8f 100644
--- a/openair2/COMMON/s1ap_messages_types.h
+++ b/openair2/COMMON/s1ap_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -41,6 +41,7 @@
 #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_E_RAB_MODIFY_RESP(mSGpTR)           (mSGpTR)->ittiMsg.s1ap_e_rab_modify_resp
 
 #define S1AP_DOWNLINK_NAS(mSGpTR)               (mSGpTR)->ittiMsg.s1ap_downlink_nas
 #define S1AP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR)  (mSGpTR)->ittiMsg.s1ap_initial_context_setup_req
@@ -48,9 +49,12 @@
 #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_E_RAB_MODIFY_REQ(mSGpTR)              (mSGpTR)->ittiMsg.s1ap_e_rab_modify_req
+#define S1AP_PAGING_IND(mSGpTR)                 (mSGpTR)->ittiMsg.s1ap_paging_ind
 
 #define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR)     (mSGpTR)->ittiMsg.s1ap_ue_release_req
+#define S1AP_E_RAB_RELEASE_COMMAND(mSGpTR)      (mSGpTR)->ittiMsg.s1ap_e_rab_release_command
+#define S1AP_E_RAB_RELEASE_RESPONSE(mSGpTR)     (mSGpTR)->ittiMsg.s1ap_e_rab_release_resp
 
 //-------------------------------------------------------------------------------------------//
 /* Maximum number of e-rabs to be setup/deleted in a single message.
@@ -175,6 +179,11 @@ typedef struct s1ap_gummei_s {
   uint16_t mme_group_id;
 } s1ap_gummei_t;
 
+typedef struct s1ap_imsi_s {
+  uint8_t  buffer[S1AP_IMSI_LENGTH];
+  uint8_t  length;
+} s1ap_imsi_t;
+
 typedef struct s_tmsi_s {
   uint8_t  mme_code;
   uint32_t m_tmsi;
@@ -189,7 +198,7 @@ typedef enum ue_paging_identity_presenceMask_e {
 typedef struct ue_paging_identity_s {
   ue_paging_identity_presenceMask_t presenceMask;
   union {
-    char     imsi[S1AP_IMSI_LENGTH];
+    s1ap_imsi_t  imsi;
     s_tmsi_t s_tmsi;
   } choice;
 } ue_paging_identity_t;
@@ -260,11 +269,29 @@ typedef struct e_rab_setup_s {
   uint32_t gtp_teid;
 } e_rab_setup_t;
 
+typedef struct e_rab_modify_s {
+  /* Unique e_rab_id for the UE. */
+  uint8_t e_rab_id;
+} e_rab_modify_t;
+
+typedef enum S1ap_Cause_e {
+  S1AP_CAUSE_NOTHING,  /* No components present */
+  S1AP_CAUSE_RADIO_NETWORK,
+  S1AP_CAUSE_TRANSPORT,
+  S1AP_CAUSE_NAS,
+  S1AP_CAUSE_PROTOCOL,
+  S1AP_CAUSE_MISC,
+  /* Extensions may appear below */
+
+} s1ap_Cause_t;
+
 typedef struct e_rab_failed_s {
   /* Unique e_rab_id for the UE. */
   uint8_t e_rab_id;
   /* Cause of the failure */
   //     cause_t cause;
+  s1ap_Cause_t cause;
+  uint8_t cause_value;
 } e_rab_failed_t;
 
 typedef enum s1ap_ue_ctxt_modification_present_s {
@@ -460,6 +487,12 @@ typedef struct s1ap_initial_context_setup_req_s {
   e_rab_t  e_rab_param[S1AP_MAX_E_RAB];
 } s1ap_initial_context_setup_req_t;
 
+typedef struct tai_plmn_identity_s {
+  uint16_t mcc;
+  uint16_t mnc;
+  uint8_t  mnc_digit_length;
+} plmn_identity_t;
+
 typedef struct s1ap_paging_ind_s {
   /* UE identity index value.
    * Specified in 3GPP TS 36.304
@@ -472,6 +505,15 @@ typedef struct s1ap_paging_ind_s {
   /* Indicates origin of paging */
   cn_domain_t cn_domain;
 
+  /* PLMN_identity in TAI of Paging*/
+  plmn_identity_t plmn_identity[256];
+
+  /* TAC in TAIList of Paging*/
+  int16_t tac[256];
+
+  /* size of TAIList*/
+  int16_t tai_size;
+
   /* Optional fields */
   paging_drx_t paging_drx;
 
@@ -520,16 +562,6 @@ typedef struct s1ap_ue_release_command_s {
 
 
 //-------------------------------------------------------------------------------------------//
-typedef enum S1ap_Cause_e {
-  S1AP_CAUSE_NOTHING,  /* No components present */
-  S1AP_CAUSE_RADIO_NETWORK,
-  S1AP_CAUSE_TRANSPORT,
-  S1AP_CAUSE_NAS,
-  S1AP_CAUSE_PROTOCOL,
-  S1AP_CAUSE_MISC,
-  /* Extensions may appear below */
-
-} s1ap_Cause_t;
 // S1AP <-- RRC messages
 typedef struct s1ap_ue_release_req_s {
   unsigned      eNB_ue_s1ap_id:24;
@@ -537,4 +569,78 @@ typedef struct s1ap_ue_release_req_s {
   long          cause_value;
 } s1ap_ue_release_req_t, s1ap_ue_release_resp_t;
 
+typedef struct s1ap_e_rab_modify_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 modify in the list */
+  uint8_t nb_e_rabs_tomodify;
+
+  /* E RAB modify request */
+  e_rab_t e_rab_modify_params[S1AP_MAX_E_RAB];
+} s1ap_e_rab_modify_req_t;
+
+typedef struct s1ap_e_rab_modify_resp_s {
+  unsigned  eNB_ue_s1ap_id:24;
+
+  /* Number of e_rab modify-ed in the list */
+  uint8_t       nb_of_e_rabs;
+  /* list of e_rab modify-ed by RRC layers */
+  e_rab_modify_t e_rabs[S1AP_MAX_E_RAB];
+
+  /* Number of e_rab failed to be modify in list */
+  uint8_t        nb_of_e_rabs_failed;
+  /* list of e_rabs that failed to be modify */
+  e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB];
+} s1ap_e_rab_modify_resp_t;
+
+typedef struct e_rab_release_s {
+  /* Unique e_rab_id for the UE. */
+  uint8_t                     e_rab_id;
+} e_rab_release_t;
+
+typedef struct s1ap_e_rab_release_command_s {
+  /* MME UE id  */
+  uint16_t mme_ue_s1ap_id;
+
+  /* eNB ue s1ap id as initialized by S1AP layer */
+  unsigned eNB_ue_s1ap_id:24;
+
+  /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
+  nas_pdu_t                   nas_pdu;
+
+  /* Number of e_rab to be released in the list */
+  uint8_t nb_e_rabs_torelease;
+
+  /* E RAB release command */
+  e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB];
+
+} s1ap_e_rab_release_command_t;
+
+typedef struct s1ap_e_rab_release_resp_s {
+  /* 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 released in the list */
+  uint8_t       nb_of_e_rabs_released;
+
+  /* list of e_rabs released */
+  e_rab_release_t e_rab_release[S1AP_MAX_E_RAB];
+
+  /* Number of e_rab failed to be released in list */
+  uint8_t        nb_of_e_rabs_failed;
+  /* list of e_rabs that failed to be released */
+  e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB];
+
+} s1ap_e_rab_release_resp_t;
+
 #endif /* S1AP_MESSAGES_TYPES_H_ */
diff --git a/openair2/COMMON/sctp_messages_def.h b/openair2/COMMON/sctp_messages_def.h
index ffe13bae56412a038c259a83cafb6c439b26fee2..d4248b7bc342edc307081d61aa43c572ebe5e924 100644
--- a/openair2/COMMON/sctp_messages_def.h
+++ b/openair2/COMMON/sctp_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/sctp_messages_types.h b/openair2/COMMON/sctp_messages_types.h
index 57e0f37e71cbb54f5f58beeb1e75b35713a5db75..184e951acb3b8732c2e7b056d6204d20fddba0d8 100644
--- a/openair2/COMMON/sctp_messages_types.h
+++ b/openair2/COMMON/sctp_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h
index c9e210fd1f4bc27a1a0e55d85a27088d4a697750..92d1ff4128fb5413dbd71de4e98eed9157eac15b 100644
--- a/openair2/COMMON/tasks_def.h
+++ b/openair2/COMMON/tasks_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,6 +40,10 @@ SUB_TASK_DEF(TASK_L2L1,     TASK_PDCP_ENB,              200)
 
 ///   Radio Resource Control task
 TASK_DEF(TASK_RRC_ENB,  TASK_PRIORITY_MED,          200)
+
+// Define here for now
+TASK_DEF(TASK_RRC_ENB_NB_IoT,  TASK_PRIORITY_MED,          200)
+
 ///   S1ap task
 /// RAL task for ENB
 TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200)
diff --git a/openair2/COMMON/udp_messages_def.h b/openair2/COMMON/udp_messages_def.h
index 41b5e8aa52b551c52f3bfdd8d97e1c82922e4001..35322f2450cd270f417a66de1c170427dad75ea7 100644
--- a/openair2/COMMON/udp_messages_def.h
+++ b/openair2/COMMON/udp_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/udp_messages_types.h b/openair2/COMMON/udp_messages_types.h
index 1ec878782a23fb292fd6ef524253d49b61e75d8b..7825a924d1cb5e1fc2600aecbbcd97a8d7a46e80 100644
--- a/openair2/COMMON/udp_messages_types.h
+++ b/openair2/COMMON/udp_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/x2ap_messages_def.h b/openair2/COMMON/x2ap_messages_def.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair2/COMMON/x2ap_messages_def.h
+++ b/openair2/COMMON/x2ap_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair2/COMMON/x2ap_messages_types.h
+++ b/openair2/COMMON/x2ap_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/DOCS/TEMPLATES/CODE/example_doxy.h b/openair2/DOCS/TEMPLATES/CODE/example_doxy.h
index 27691f46f1d2b79cee3f0df8d9a38e85a6ba6e7b..c51bdbccabc2ea6bb007b728567e7c8b62f9ac05 100644
--- a/openair2/DOCS/TEMPLATES/CODE/example_doxy.h
+++ b/openair2/DOCS/TEMPLATES/CODE/example_doxy.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/DOCS/TEMPLATES/README/Readme.doxy b/openair2/DOCS/TEMPLATES/README/Readme.doxy
index 099c51cdf4761292266cec4bf1440ef97f6abe14..c87289d678c8c64d7d6f5794bbcf661be5dfeafc 100644
--- a/openair2/DOCS/TEMPLATES/README/Readme.doxy
+++ b/openair2/DOCS/TEMPLATES/README/Readme.doxy
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/DOCS/TEMPLATES/README/readme.txt b/openair2/DOCS/TEMPLATES/README/readme.txt
index 23ecdd5e913fc64d77491fbea5b5d658c50c4601..f31f7cd30e98b7d2867d8a310ea4ecfeb1769a77 100644
--- a/openair2/DOCS/TEMPLATES/README/readme.txt
+++ b/openair2/DOCS/TEMPLATES/README/readme.txt
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
index 1a43f203df6b918888981298cda34684e770914e..6cb79efb11ce90b8410bb2d14e7659711b5d0b2f 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -17,7 +17,7 @@
  *-------------------------------------------------------------------------------
  * For more information about the OpenAirInterface (OAI) Software Alliance:
  *      contact@openairinterface.org
- */ 
+ */
 
 /*! \file flexran_agent_mac.c
  * \brief FlexRAN agent message handler for MAC layer
@@ -31,16 +31,15 @@
 #include "flexran_agent_common.h"
 #include "flexran_agent_mac_internal.h"
 #include "flexran_agent_net_comm.h"
+#include "flexran_agent_timer.h"
+#include "flexran_agent_ran_api.h"
 
 #include "LAYER2/MAC/proto.h"
-#include "LAYER2/MAC/flexran_agent_mac_proto.h"
-#include "LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h"
 
 #include "liblfds700.h"
 
 #include "log.h"
 
-
 /*Flags showing if a mac agent has already been registered*/
 unsigned int mac_agent_registered[NUM_MAX_ENB];
 
@@ -54,683 +53,595 @@ struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB];
 struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB];
 
 
-int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){
-
-  // TODO: Must deal with sanitization of input
-  // TODO: Must check if RNTIs and cell ids of the request actually exist
-  // TODO: Must resolve conflicts among stats requests
+int flexran_agent_mac_stats_reply(mid_t mod_id,
+          const report_config_t *report_config,
+           Protocol__FlexUeStatsReport **ue_report,
+           Protocol__FlexCellStatsReport **cell_report) {
 
-  int i;
-  err_code_t err_code;
-  xid_t xid;
-  uint32_t usec_interval, sec_interval;
 
-  //TODO: We do not deal with multiple CCs at the moment and eNB id is 0
+  // Protocol__FlexHeader *header;
+  int i, j, k;
+  int cc_id = 0;
   int enb_id = mod_id;
 
-  //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id];
-  //UE_list_t *eNB_UE_list=  &eNB->UE_list;
-
-  report_config_t report_config;
-
-  uint32_t ue_flags = 0;
-  uint32_t c_flags = 0;
-
-  Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
-
-  Protocol__FlexStatsRequest *stats_req = input->stats_request_msg;
-  xid = (stats_req->header)->xid;
-
-  // Check the type of request that is made
-  switch(stats_req->body_case) {
-  case PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ;
-    Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request;
-    if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) {
-      /*Disable both periodic and continuous updates*/
-      flexran_agent_disable_cont_mac_stats_update(mod_id);
-      flexran_agent_destroy_timer_by_task_id(xid);
-      *msg = NULL;
-      return 0;
-    } else { //One-off, periodical or continuous reporting
-      //Set the proper flags
-      ue_flags = comp_req->ue_report_flags;
-      c_flags = comp_req->cell_report_flags;
-      //Create a list of all eNB RNTIs and cells
-
-      //Set the number of UEs and create list with their RNTIs stats configs
-      report_config.nr_ue = flexran_get_num_ues(mod_id); //eNB_UE_list->num_UEs
-      report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
-      if (report_config.ue_report_type == NULL) {
-	// TODO: Add appropriate error code
-	err_code = -100;
-	goto error;
-      }
-      for (i = 0; i < report_config.nr_ue; i++) {
-	report_config.ue_report_type[i].ue_rnti = flexran_get_ue_crnti(enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti;
-	report_config.ue_report_type[i].ue_report_flags = ue_flags;
-      }
-      //Set the number of CCs and create a list with the cell stats configs
-      report_config.nr_cc = MAX_NUM_CCs;
-      report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
-      if (report_config.cc_report_type == NULL) {
-	// TODO: Add appropriate error code
-	err_code = -100;
-	goto error;
-      }
-      for (i = 0; i < report_config.nr_cc; i++) {
-	//TODO: Must fill in the proper cell ids
-	report_config.cc_report_type[i].cc_id = i;
-	report_config.cc_report_type[i].cc_report_flags = c_flags;
-      }
-      /* Check if request was periodical */
-      if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL) {
-	/* Create a one off flexran message as an argument for the periodical task */
-	Protocol__FlexranMessage *timer_msg;
-	stats_request_config_t request_config;
-	request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS;
-	request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE;
-	request_config.period = 0;
-	/* Need to make sure that the ue flags are saved (Bug) */
-	if (report_config.nr_ue == 0) {
-	  report_config.nr_ue = 1;
-	  report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
-	   if (report_config.ue_report_type == NULL) {
-	     // TODO: Add appropriate error code
-	     err_code = -100;
-	     goto error;
-	   }
-	   report_config.ue_report_type[0].ue_rnti = 0; // Dummy value
-	   report_config.ue_report_type[0].ue_report_flags = ue_flags;
-	}
-	request_config.config = &report_config;
-	flexran_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg);
-	/* Create a timer */
-	long timer_id = 0;
-	flexran_agent_timer_args_t *timer_args;
-	timer_args = malloc(sizeof(flexran_agent_timer_args_t));
-	memset (timer_args, 0, sizeof(flexran_agent_timer_args_t));
-	timer_args->mod_id = enb_id;
-	timer_args->msg = timer_msg;
-	/*Convert subframes to usec time*/
-	usec_interval = 1000*comp_req->sf;
-	sec_interval = 0;
-	/*add seconds if required*/
-	if (usec_interval >= 1000*1000) {
-	  sec_interval = usec_interval/(1000*1000);
-	  usec_interval = usec_interval%(1000*1000);
-	}
-	flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, flexran_agent_handle_timed_task,(void*) timer_args, &timer_id);
-      } else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) {
-	/*If request was for continuous updates, disable the previous configuration and
-	  set up a new one*/
-	flexran_agent_disable_cont_mac_stats_update(mod_id);
-	stats_request_config_t request_config;
-	request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS;
-	request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE;
-	request_config.period = 0;
-	/* Need to make sure that the ue flags are saved (Bug) */
-	if (report_config.nr_ue == 0) {
-	  report_config.nr_ue = 1;
-	  report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
-	  if (report_config.ue_report_type == NULL) {
-	    // TODO: Add appropriate error code
-	    err_code = -100;
-	    goto error;
-	  }
-	  report_config.ue_report_type[0].ue_rnti = 0; // Dummy value
-	  report_config.ue_report_type[0].ue_report_flags = ue_flags;
-	}
-	request_config.config = &report_config;
-	flexran_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config);
-      }
-    }
-    break;
-  case PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST:;
-    Protocol__FlexCellStatsRequest *cell_req = stats_req->cell_stats_request;
-    // UE report config will be blank
-    report_config.nr_ue = 0;
-    report_config.ue_report_type = NULL;
-    report_config.nr_cc = cell_req->n_cell;
-    report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
-    if (report_config.cc_report_type == NULL) {
-      // TODO: Add appropriate error code
-      err_code = -100;
-      goto error;
-    }
-    for (i = 0; i < report_config.nr_cc; i++) {
-	//TODO: Must fill in the proper cell ids
-      report_config.cc_report_type[i].cc_id = cell_req->cell[i];
-      report_config.cc_report_type[i].cc_report_flags = cell_req->flags;
-    }
-    break;
-  case PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST:;
-    Protocol__FlexUeStatsRequest *ue_req = stats_req->ue_stats_request;
-    // Cell report config will be blank
-    report_config.nr_cc = 0;
-    report_config.cc_report_type = NULL;
-    report_config.nr_ue = ue_req->n_rnti;
-    report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
-    if (report_config.ue_report_type == NULL) {
-      // TODO: Add appropriate error code
-      err_code = -100;
-      goto error;
-    }
-    for (i = 0; i < report_config.nr_ue; i++) {
-      report_config.ue_report_type[i].ue_rnti = ue_req->rnti[i];
-      report_config.ue_report_type[i].ue_report_flags = ue_req->flags;
-    }
-    break;
-  default:
-    //TODO: Add appropriate error code
-    err_code = -100;
-    goto error;
-  }
+  /* Allocate memory for list of UE reports */
+  if (report_config->nr_ue > 0) {
 
-  if (flexran_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){
-    err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
-    goto error;
-  }
 
-  free(report_config.ue_report_type);
-  free(report_config.cc_report_type);
+          for (i = 0; i < report_config->nr_ue; i++) {
+
+                ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti;
+                ue_report[i]->has_rnti = 1;
+
+                /* Check flag for creation of buffer status report */
+                if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) {
+                      //TODO should be automated
+                        ue_report[i]->n_bsr = 4;
+                        uint32_t *elem;
+                        elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr);
+                        if (elem == NULL)
+                               goto error;
+                        for (j = 0; j < ue_report[i]->n_bsr; j++) {
+                                // NN: we need to know the cc_id here, consider the first one
+                                elem[j] = flexran_get_ue_bsr_ul_buffer_info (enb_id, i, j);
+                        }
+
+                        ue_report[i]->bsr = elem;
+                }
+
+                /* Check flag for creation of PHR report */
+                if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) {
+                        ue_report[i]->phr = flexran_get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info;
+                        ue_report[i]->has_phr = 1;
+
+                }
+
+                /* Check flag for creation of RLC buffer status report */
+                if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) {
+                        ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE. This needs to be generalized for for LCs
+                        Protocol__FlexRlcBsr ** rlc_reports;
+                        rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report);
+                        if (rlc_reports == NULL)
+                              goto error;
+
+                        // NN: see LAYER2/openair2_proc.c for rlc status
+                        for (j = 0; j < ue_report[i]->n_rlc_report; j++) {
+
+                              rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr));
+                              if (rlc_reports[j] == NULL)
+                                 goto error;
+                              protocol__flex_rlc_bsr__init(rlc_reports[j]);
+                              rlc_reports[j]->lc_id = j+1;
+                              rlc_reports[j]->has_lc_id = 1;
+                              rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id, i, j + 1);
+                              rlc_reports[j]->has_tx_queue_size = 1;
+
+                              //TODO:Set tx queue head of line delay in ms
+                              rlc_reports[j]->tx_queue_hol_delay = flexran_get_hol_delay(enb_id, i, j + 1);
+                              rlc_reports[j]->has_tx_queue_hol_delay = 1;
+                              //TODO:Set retransmission queue size in bytes
+                              rlc_reports[j]->retransmission_queue_size = 10;
+                              rlc_reports[j]->has_retransmission_queue_size = 0;
+                              //TODO:Set retransmission queue head of line delay in ms
+                              rlc_reports[j]->retransmission_queue_hol_delay = 100;
+                              rlc_reports[j]->has_retransmission_queue_hol_delay = 0;
+                              //TODO DONE:Set current size of the pending message in bytes
+                              rlc_reports[j]->status_pdu_size = flexran_get_num_pdus_buffer(enb_id , i, j + 1);
+                              rlc_reports[j]->has_status_pdu_size = 1;
+
+                        }
+                        // Add RLC buffer status reports to the full report
+                        if (ue_report[i]->n_rlc_report > 0)
+                            ue_report[i]->rlc_report = rlc_reports;
+
+
+                }
+
+                /* Check flag for creation of MAC CE buffer status report */
+                if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) {
+                        // TODO: Fill in the actual MAC CE buffer status report
+                        ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15;
+                                      // Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the
+                                       // PROTOCOL__FLEX_CE_TYPE__FLPCET_ values
+                                       // found in stats_common.pb-c.h. See
+                                       // flex_ce_type in FlexRAN specification
+                        ue_report[i]->has_pending_mac_ces = 1;
+
+                }
+
+                /* Check flag for creation of DL CQI report */
+                if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) {
+                        // TODO: Fill in the actual DL CQI report for the UE based on its configuration
+                        Protocol__FlexDlCqiReport * dl_report;
+                        dl_report = malloc(sizeof(Protocol__FlexDlCqiReport));
+                        if (dl_report == NULL)
+                          goto error;
+                        protocol__flex_dl_cqi_report__init(dl_report);
+
+                        dl_report->sfn_sn = flexran_get_sfn_sf(enb_id);
+                        dl_report->has_sfn_sn = 1;
+                        //Set the number of DL CQI reports for this UE. One for each CC
+                        dl_report->n_csi_report = flexran_get_active_CC(enb_id,i);
+                        dl_report->n_csi_report = 1 ;
+                        //Create the actual CSI reports.
+                        Protocol__FlexDlCsi **csi_reports;
+                        csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report);
+                        if (csi_reports == NULL)
+                          goto error;
+                        for (j = 0; j < dl_report->n_csi_report; j++) {
+
+                              csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi));
+                              if (csi_reports[j] == NULL)
+                                goto error;
+                              protocol__flex_dl_csi__init(csi_reports[j]);
+                              //The servCellIndex for this report
+                              csi_reports[j]->serv_cell_index = j;
+                              csi_reports[j]->has_serv_cell_index = 1;
+                              //The rank indicator value for this cc
+                              csi_reports[j]->ri = flexran_get_current_RI(enb_id,i,j);
+                              csi_reports[j]->has_ri = 1;
+                              //TODO: the type of CSI report based on the configuration of the UE
+                              //For now we only support type P10, which only needs a wideband value
+                              //The full set of types can be found in stats_common.pb-c.h and
+                              //in the FlexRAN specifications
+                              csi_reports[j]->type =  PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10;
+                              csi_reports[j]->has_type = 1;
+                              csi_reports[j]->report_case = PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI;
 
-  return 0;
+                              if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI){
 
- error :
-  LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code);
-  return err_code;
-}
+                                    Protocol__FlexCsiP10 *csi10;
+                                    csi10 = malloc(sizeof(Protocol__FlexCsiP10));
+                                    if (csi10 == NULL)
+                                    goto error;
+                                    protocol__flex_csi_p10__init(csi10);
+                                    //TODO: set the wideband value
+                                    // NN: this is also depends on cc_id
+                                    csi10->wb_cqi = flexran_get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi;
+                                    csi10->has_wb_cqi = 1;
+                                    //Add the type of measurements to the csi report in the proper union type
+                                    csi_reports[j]->p10csi = csi10;
+                              }
 
-int flexran_agent_mac_stats_request(mid_t mod_id,
-				    xid_t xid,
-				    const stats_request_config_t *report_config,
-				    Protocol__FlexranMessage **msg) {
-  Protocol__FlexHeader *header;
-  int i;
+                              else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI){
 
-  Protocol__FlexStatsRequest *stats_request_msg;
-  stats_request_msg = malloc(sizeof(Protocol__FlexStatsRequest));
-  if(stats_request_msg == NULL)
-    goto error;
-  protocol__flex_stats_request__init(stats_request_msg);
 
-  if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0)
-    goto error;
+                                    Protocol__FlexCsiP11 *csi11;
+                                    csi11 = malloc(sizeof(Protocol__FlexCsiP11));
+                                    if (csi11 == NULL)
+                                    goto error;
+                                    protocol__flex_csi_p11__init(csi11);
 
-  stats_request_msg->header = header;
+                                    csi11->wb_cqi = malloc(sizeof(csi11->wb_cqi));
+				    csi11->n_wb_cqi = 1;
+				    csi11->wb_cqi[0] = flexran_get_ue_wcqi (enb_id, i);
+                                    // According To spec 36.213
 
-  stats_request_msg->type = report_config->report_type;
-  stats_request_msg->has_type = 1;
+                                    if (flexran_get_antenna_ports(enb_id, j) == 2 && csi_reports[j]->ri == 1) {
+                                        // TODO PMI
+                                        csi11->wb_pmi = flexran_get_ue_wpmi(enb_id, i, 0);
+                                        csi11->has_wb_pmi = 1;
 
-  switch (report_config->report_type) {
-  case PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS:
-    stats_request_msg->body_case =  PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST;
-    Protocol__FlexCompleteStatsRequest *complete_stats;
-    complete_stats = malloc(sizeof(Protocol__FlexCompleteStatsRequest));
-    if(complete_stats == NULL)
-      goto error;
-    protocol__flex_complete_stats_request__init(complete_stats);
-    complete_stats->report_frequency = report_config->report_frequency;
-    complete_stats->has_report_frequency = 1;
-    complete_stats->sf = report_config->period;
-    complete_stats->has_sf = 1;
-    complete_stats->has_cell_report_flags = 1;
-    complete_stats->has_ue_report_flags = 1;
-    if (report_config->config->nr_cc > 0) {
-      complete_stats->cell_report_flags = report_config->config->cc_report_type[0].cc_report_flags;
-    }
-    if (report_config->config->nr_ue > 0) {
-      complete_stats->ue_report_flags = report_config->config->ue_report_type[0].ue_report_flags;
-    }
-    stats_request_msg->complete_stats_request = complete_stats;
-    break;
-  case  PROTOCOL__FLEX_STATS_TYPE__FLST_CELL_STATS:
-    stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST;
-     Protocol__FlexCellStatsRequest *cell_stats;
-     cell_stats = malloc(sizeof(Protocol__FlexCellStatsRequest));
-    if(cell_stats == NULL)
-      goto error;
-    protocol__flex_cell_stats_request__init(cell_stats);
-    cell_stats->n_cell = report_config->config->nr_cc;
-    cell_stats->has_flags = 1;
-    if (cell_stats->n_cell > 0) {
-      uint32_t *cells;
-      cells = (uint32_t *) malloc(sizeof(uint32_t)*cell_stats->n_cell);
-      for (i = 0; i < cell_stats->n_cell; i++) {
-	cells[i] = report_config->config->cc_report_type[i].cc_id;
-      }
-      cell_stats->cell = cells;
-      cell_stats->flags = report_config->config->cc_report_type[i].cc_report_flags;
-    }
-    stats_request_msg->cell_stats_request = cell_stats;
-    break;
-  case PROTOCOL__FLEX_STATS_TYPE__FLST_UE_STATS:
-    stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST;
-     Protocol__FlexUeStatsRequest *ue_stats;
-     ue_stats = malloc(sizeof(Protocol__FlexUeStatsRequest));
-    if(ue_stats == NULL)
-      goto error;
-    protocol__flex_ue_stats_request__init(ue_stats);
-    ue_stats->n_rnti = report_config->config->nr_ue;
-    ue_stats->has_flags = 1;
-    if (ue_stats->n_rnti > 0) {
-      uint32_t *ues;
-      ues = (uint32_t *) malloc(sizeof(uint32_t)*ue_stats->n_rnti);
-      for (i = 0; i < ue_stats->n_rnti; i++) {
-	ues[i] = report_config->config->ue_report_type[i].ue_rnti;
-      }
-      ue_stats->rnti = ues;
-      ue_stats->flags = report_config->config->ue_report_type[i].ue_report_flags;
-    }
-    stats_request_msg->ue_stats_request = ue_stats;
-    break;
-  default:
-    goto error;
-  }
-  *msg = malloc(sizeof(Protocol__FlexranMessage));
-  if(*msg == NULL)
-    goto error;
-  protocol__flexran_message__init(*msg);
-  (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG;
-  (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
-  (*msg)->stats_request_msg = stats_request_msg;
-  return 0;
+                                       }
 
- error:
-  // TODO: Need to make proper error handling
-  if (header != NULL)
-    free(header);
-  if (stats_request_msg != NULL)
-    free(stats_request_msg);
-  if(*msg != NULL)
-    free(*msg);
-  //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
-  return -1;
-}
+                                      else if (flexran_get_antenna_ports(enb_id, j) == 2 && csi_reports[j]->ri == 2){
+                                        // TODO PMI
+                                        csi11->wb_pmi = flexran_get_ue_wpmi(enb_id, i, 0);
+                                        csi11->has_wb_pmi = 1;
 
-int flexran_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) {
-   if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG)
-    goto error;
-  free(msg->stats_request_msg->header);
-  if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST) {
-    free(msg->stats_request_msg->cell_stats_request->cell);
-  }
-  if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST) {
-    free(msg->stats_request_msg->ue_stats_request->rnti);
-  }
-  free(msg->stats_request_msg);
-  free(msg);
-  return 0;
+                                      }
 
- error:
-  //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
-  return -1;
-}
+                                      else if (flexran_get_antenna_ports(enb_id, j) == 4 && csi_reports[j]->ri == 2){
+                                        // TODO PMI
+                                        csi11->wb_pmi = flexran_get_ue_wpmi(enb_id, i, 0);
+                                        csi11->has_wb_pmi = 1;
 
-int flexran_agent_mac_stats_reply(mid_t mod_id,
-				  xid_t xid,
-				  const report_config_t *report_config,
-				  Protocol__FlexranMessage **msg) {
-  Protocol__FlexHeader *header;
-  int i, j, k;
-  int enb_id = mod_id;
-  //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id];
-  //UE_list_t *eNB_UE_list=  &eNB->UE_list;
 
-  Protocol__FlexStatsReply *stats_reply_msg;
-  stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply));
-  if (stats_reply_msg == NULL)
-    goto error;
-  protocol__flex_stats_reply__init(stats_reply_msg);
+                                      }
 
-  if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0)
-    goto error;
+                                      csi11->has_wb_pmi = 0;
 
-  stats_reply_msg->header = header;
+                                      csi_reports[j]->p11csi = csi11;
 
-  stats_reply_msg->n_ue_report = report_config->nr_ue;
-  stats_reply_msg->n_cell_report = report_config->nr_cc;
+                               }
 
-  Protocol__FlexUeStatsReport **ue_report;
-  Protocol__FlexCellStatsReport **cell_report;
 
 
-  /* Allocate memory for list of UE reports */
-  if (report_config->nr_ue > 0) {
-    ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue);
-    if (ue_report == NULL)
-      goto error;
-    for (i = 0; i < report_config->nr_ue; i++) {
-      ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport));
-      protocol__flex_ue_stats_report__init(ue_report[i]);
-      ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti;
-      ue_report[i]->has_rnti = 1;
-      ue_report[i]->flags = report_config->ue_report_type[i].ue_report_flags;
-      ue_report[i]->has_flags = 1;
-      /* Check the types of reports that need to be constructed based on flag values */
-
-      /* Check flag for creation of buffer status report */
-      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) {
-	ue_report[i]->n_bsr = 4;
-	uint32_t *elem;
-	elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr);
-	if (elem == NULL)
-	  goto error;
-	for (j = 0; j < ue_report[i]->n_bsr; j++) {
-	  // NN: we need to know the cc_id here, consider the first one
-	  elem[j] = flexran_get_ue_bsr (enb_id, i, j); 
-	}
-	ue_report[i]->bsr = elem;
-      }
 
-      /* Check flag for creation of PRH report */
-      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) {
-	ue_report[i]->phr = flexran_get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info;
-	ue_report[i]->has_phr = 1;
-      }
 
-      /* Check flag for creation of RLC buffer status report */
-      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) {
-	ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE. This needs to be generalized for for LCs
-	Protocol__FlexRlcBsr ** rlc_reports;
-	rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report);
-	if (rlc_reports == NULL)
-	  goto error;
-
-	// NN: see LAYER2/openair2_proc.c for rlc status
-	for (j = 0; j < ue_report[i]->n_rlc_report; j++) {
-	  rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr));
-	  if (rlc_reports[j] == NULL)
-	    goto error;
-	  protocol__flex_rlc_bsr__init(rlc_reports[j]);
-	  rlc_reports[j]->lc_id = j + 1;
-	  rlc_reports[j]->has_lc_id = 1;
-	  rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id,i,j + 1);
-	  rlc_reports[j]->has_tx_queue_size = 1;
-	  
-	  //TODO:Set tx queue head of line delay in ms
-	  rlc_reports[j]->tx_queue_hol_delay = flexran_get_hol_delay(enb_id, i, j+1);
-	  rlc_reports[j]->has_tx_queue_hol_delay = 1;
-	  //TODO:Set retransmission queue size in bytes
-	  rlc_reports[j]->retransmission_queue_size = 10;
-	  rlc_reports[j]->has_retransmission_queue_size = 0;
-	  //TODO:Set retransmission queue head of line delay in ms
-	  rlc_reports[j]->retransmission_queue_hol_delay = 100;
-	  rlc_reports[j]->has_retransmission_queue_hol_delay = 0;
-	  //TODO:Set current size of the pending message in bytes
-	  rlc_reports[j]->status_pdu_size = 100;
-	  rlc_reports[j]->has_status_pdu_size = 0;
-	}
-	// Add RLC buffer status reports to the full report
-	if (ue_report[i]->n_rlc_report > 0)
-	  ue_report[i]->rlc_report = rlc_reports;
-      }
+                              else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI){
 
-      /* Check flag for creation of MAC CE buffer status report */
-      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) {
-	// TODO: Fill in the actual MAC CE buffer status report
-	ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15;  /* Use as bitmap. Set one or more of the
-					       PROTOCOL__FLEX_CE_TYPE__FLPCET_ values
-					       found in stats_common.pb-c.h. See
-					       flex_ce_type in FlexRAN specification */
-	ue_report[i]->has_pending_mac_ces = 1;
-      }
+                                    Protocol__FlexCsiP20 *csi20;
+                                    csi20 = malloc(sizeof(Protocol__FlexCsiP20));
+                                    if (csi20 == NULL)
+                                    goto error;
+                                    protocol__flex_csi_p20__init(csi20);
 
-      /* Check flag for creation of DL CQI report */
-      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) {
-	// TODO: Fill in the actual DL CQI report for the UE based on its configuration
-	Protocol__FlexDlCqiReport * dl_report;
-	dl_report = malloc(sizeof(Protocol__FlexDlCqiReport));
-	if (dl_report == NULL)
-	  goto error;
-	protocol__flex_dl_cqi_report__init(dl_report);
-
-	dl_report->sfn_sn = flexran_get_sfn_sf(enb_id);
-	dl_report->has_sfn_sn = 1;
-	//Set the number of DL CQI reports for this UE. One for each CC
-	dl_report->n_csi_report = flexran_get_active_CC(enb_id,i);
-
-	//Create the actual CSI reports.
-	Protocol__FlexDlCsi **csi_reports;
-	csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report);
-	if (csi_reports == NULL)
-	  goto error;
-	for (j = 0; j < dl_report->n_csi_report; j++) {
-	  csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi));
-	  if (csi_reports[j] == NULL)
-	    goto error;
-	  protocol__flex_dl_csi__init(csi_reports[j]);
-	  //The servCellIndex for this report
-	  csi_reports[j]->serv_cell_index = j;
-	  csi_reports[j]->has_serv_cell_index = 1;
-	  //The rank indicator value for this cc
-	  csi_reports[j]->ri = flexran_get_current_RI(enb_id,i,j);
-	  csi_reports[j]->has_ri = 1;
-	  //TODO: the type of CSI report based on the configuration of the UE
-	  //For now we only support type P10, which only needs a wideband value
-	  //The full set of types can be found in stats_common.pb-c.h and
-	  //in the FlexRAN specifications
-    csi_reports[j]->type =  PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10;
-		  csi_reports[j]->has_type = 1;
-		  csi_reports[j]->report_case = PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI;
-		  if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI){
-			  Protocol__FlexCsiP10 *csi10;
-			  csi10 = malloc(sizeof(Protocol__FlexCsiP10));
-			  if (csi10 == NULL)
-				goto error;
-			  protocol__flex_csi_p10__init(csi10);
-			  //TODO: set the wideband value
-			  // NN: this is also depends on cc_id
-			  csi10->wb_cqi = flexran_get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi;
-			  csi10->has_wb_cqi = 1;
-			  //Add the type of measurements to the csi report in the proper union type
-			  csi_reports[j]->p10csi = csi10;
-		  }
-		  else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI){
-
-		  }
-		  else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI){
-
-		  }
-		  else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI){
-
-		  }
-		  else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI){
-
-		  }
-		  else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI){
-
-		  }
-		  else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI){
-
-		  }
-		  else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI){
-
-		  }
-		  else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI){
-
-		  }
-		}
-	//Add the csi reports to the full DL CQI report
-	dl_report->csi_report = csi_reports;
-	//Add the DL CQI report to the stats report
-	ue_report[i]->dl_cqi_report = dl_report;
-      }
+                                    csi20->wb_cqi = flexran_get_ue_wcqi (enb_id, i);
+                                    csi20->has_wb_cqi = 1;
 
-      /* Check flag for creation of paging buffer status report */
-      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) {
-	//TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI
-	//set in the report must be a P-RNTI
-	Protocol__FlexPagingBufferReport *paging_report;
-	paging_report = malloc(sizeof(Protocol__FlexPagingBufferReport));
-	if (paging_report == NULL)
-	  goto error;
-	protocol__flex_paging_buffer_report__init(paging_report);
-	//Set the number of pending paging messages
-	paging_report->n_paging_info = 1;
-	//Provide a report for each pending paging message
-	Protocol__FlexPagingInfo **p_info;
-	p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info);
-	if (p_info == NULL)
-	  goto error;
-	for (j = 0; j < paging_report->n_paging_info; j++) {
-	  p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo));
-	  if(p_info[j] == NULL)
-	    goto error;
-	  protocol__flex_paging_info__init(p_info[j]);
-	  //TODO: Set paging index. This index is the same that will be used for the scheduling of the
-	  //paging message by the controller
-	  p_info[j]->paging_index = 10;
-	  p_info[j]->has_paging_index = 0;
-	  //TODO:Set the paging message size
-	  p_info[j]->paging_message_size = 100;
-	  p_info[j]->has_paging_message_size = 0;
-	  //TODO: Set the paging subframe
-	  p_info[j]->paging_subframe = 10;
-	  p_info[j]->has_paging_subframe = 0;
-	  //TODO: Set the carrier index for the pending paging message
-	  p_info[j]->carrier_index = 0;
-	  p_info[j]->has_carrier_index = 0;
-	}
-	//Add all paging info to the paging buffer rerport
-	paging_report->paging_info = p_info;
-	//Add the paging report to the UE report
-	ue_report[i]->pbr = paging_report;
-      }
 
-      /* Check flag for creation of UL CQI report */
-      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) {
-	//Fill in the full UL CQI report of the UE
-	Protocol__FlexUlCqiReport *full_ul_report;
-	full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport));
-	if(full_ul_report == NULL)
-	  goto error;
-	protocol__flex_ul_cqi_report__init(full_ul_report);
-	//TODO:Set the SFN and SF of the generated report
-	full_ul_report->sfn_sn = flexran_get_sfn_sf(enb_id);
-	full_ul_report->has_sfn_sn = 1;
-	//TODO:Set the number of UL measurement reports based on the types of measurements
-	//configured for this UE and on the servCellIndex
-	full_ul_report->n_cqi_meas = 1;
-	Protocol__FlexUlCqi **ul_report;
-	ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas);
-	if(ul_report == NULL)
-	  goto error;
-	//Fill each UL report of the UE for each of the configured report types
-	for(j = 0; j < full_ul_report->n_cqi_meas; j++) {
-	  ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi));
-	  if(ul_report[j] == NULL)
-	  goto error;
-	  protocol__flex_ul_cqi__init(ul_report[j]);
-	  //TODO: Set the type of the UL report. As an example set it to SRS UL report
-	  // See enum flex_ul_cqi_type in FlexRAN specification for more details
-	  ul_report[j]->type = PROTOCOL__FLEX_UL_CQI_TYPE__FLUCT_SRS;
-	  ul_report[j]->has_type = 1;
-	  //TODO:Set the number of SINR measurements based on the report type
-	  //See struct flex_ul_cqi in FlexRAN specification for more details
-	  ul_report[j]->n_sinr = 0;
-	  uint32_t *sinr_meas;
-	  sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr);
-	  if (sinr_meas == NULL)
-	    goto error;
-	  //TODO:Set the SINR measurements for the specified type
-	  for (k = 0; k < ul_report[j]->n_sinr; k++) {
-	    sinr_meas[k] = 10;
-	  }
-	  ul_report[j]->sinr = sinr_meas;
-	  //TODO: Set the servCellIndex for this report
-	  ul_report[j]->serv_cell_index = 0;
-	  ul_report[j]->has_serv_cell_index = 1;
-	  
-	  //Set the list of UL reports of this UE to the full UL report
-	  full_ul_report->cqi_meas = ul_report;
-
-	  full_ul_report->n_pucch_dbm = MAX_NUM_CCs;
-	  full_ul_report->pucch_dbm = malloc(sizeof(Protocol__FlexPucchDbm *) * full_ul_report->n_pucch_dbm);
-
-	  for (j = 0; j < MAX_NUM_CCs; j++) {
-	    full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__FlexPucchDbm));
-	    protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]);
-	    full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1;
-	    full_ul_report->pucch_dbm[j]->serv_cell_index = j;
-	    if(flexran_get_p0_pucch_dbm(enb_id,i, j) != -1){
-	      full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(enb_id,i,j);
-	      full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1;
-	    }
-	    full_ul_report->pucch_dbm[j]->has_p0_pucch_updated = 1;
-	    full_ul_report->pucch_dbm[j]->p0_pucch_updated = flexran_get_p0_pucch_status(enb_id, i, j);
-	  }
+                                    csi20->bandwidth_part_index = 1 ;//TODO
+                                    csi20->has_bandwidth_part_index = 1;
 
-	  //Add full UL CQI report to the UE report
-	  ue_report[i]->ul_cqi_report = full_ul_report;
-	}
-      }
-    }
-    /* Add list of all UE reports to the message */
-    stats_reply_msg->ue_report = ue_report;
-  }
+                                    csi20->sb_index = 1 ;//TODO
+                                    csi20->has_sb_index = 1 ;
+
+
+                                    csi_reports[j]->p20csi = csi20;
+
+
+                              }
+
+                              else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI){
+
+                                  // Protocol__FlexCsiP21 *csi21;
+                                  // csi21 = malloc(sizeof(Protocol__FlexCsiP21));
+                                  // if (csi21 == NULL)
+                                  // goto error;
+                                  // protocol__flex_csi_p21__init(csi21);
+
+                                  // csi21->wb_cqi = flexran_get_ue_wcqi (enb_id, i);
+
+
+                                  // csi21->wb_pmi = flexran_get_ue_pmi(enb_id); //TDO inside
+                                  // csi21->has_wb_pmi = 1;
+
+                                  // csi21->sb_cqi = 1; // TODO
+
+                                  // csi21->bandwidth_part_index = 1 ; //TDO inside
+                                  // csi21->has_bandwidth_part_index = 1 ;
+
+                                  // csi21->sb_index = 1 ;//TODO
+                                  // csi21->has_sb_index = 1 ;
+
+
+                                  // csi_reports[j]->p20csi = csi21;
+
+                              }
+
+                              else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI){
+
+
+                                  // Protocol__FlexCsiA12 *csi12;
+                                  // csi12 = malloc(sizeof(Protocol__FlexCsiA12));
+                                  // if (csi12 == NULL)
+                                  // goto error;
+                                  // protocol__flex_csi_a12__init(csi12);
+
+                                  // csi12->wb_cqi = flexran_get_ue_wcqi (enb_id, i);
+
+                                  // csi12->sb_pmi = 1 ; //TODO inside
+
+                                  // TODO continou
+                              }
+
+                              else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI){
+
+                                    // Protocol__FlexCsiA22 *csi22;
+                                    // csi22 = malloc(sizeof(Protocol__FlexCsiA22));
+                                    // if (csi22 == NULL)
+                                    // goto error;
+                                    // protocol__flex_csi_a22__init(csi22);
+
+                                    // csi22->wb_cqi = flexran_get_ue_wcqi (enb_id, i);
+
+                                    // csi22->sb_cqi = 1 ; //TODO inside
+
+                                    // csi22->wb_pmi = flexran_get_ue_wcqi (enb_id, i);
+                                    // csi22->has_wb_pmi = 1;
+
+                                    // csi22->sb_pmi = 1 ; //TODO inside
+                                    // csi22->has_wb_pmi = 1;
+
+                                    // csi22->sb_list = flexran_get_ue_wcqi (enb_id, i);
+
+
+                                }
+
+                                else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI){
+
+                                    // Protocol__FlexCsiA20 *csi20;
+                                    // csi20 = malloc(sizeof(Protocol__FlexCsiA20));
+                                    // if (csi20 == NULL)
+                                    // goto error;
+                                    // protocol__flex_csi_a20__init(csi20);
+
+                                    // csi20->wb_cqi = flexran_get_ue_wcqi (enb_id, i);
+                                    // csi20->has_wb_cqi = 1;
+
+                                    // csi20>sb_cqi = 1 ; //TODO inside
+                                    // csi20>has_sb_cqi = 1 ;
+
+                                    // csi20->sb_list = 1; // TODO inside
+
+
+                                }
+
+                                else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI){
+
+                                }
+
+                                else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI){
+
+                                }
+
+                        }
+                     //Add the csi reports to the full DL CQI report
+                    dl_report->csi_report = csi_reports;
+                    //Add the DL CQI report to the stats report
+                     ue_report[i]->dl_cqi_report = dl_report;
+
+                }
+
+                /* Check flag for creation of paging buffer status report */
+                if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) {
+                            //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI
+                            //set in the report must be a P-RNTI
+                            Protocol__FlexPagingBufferReport *paging_report;
+                            paging_report = malloc(sizeof(Protocol__FlexPagingBufferReport));
+                            if (paging_report == NULL)
+                              goto error;
+                            protocol__flex_paging_buffer_report__init(paging_report);
+                            //Set the number of pending paging messages
+                            paging_report->n_paging_info = 1;
+                            //Provide a report for each pending paging message
+                            Protocol__FlexPagingInfo **p_info;
+                            p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info);
+                            if (p_info == NULL)
+                              goto error;
+
+                            for (j = 0; j < paging_report->n_paging_info; j++) {
+
+                                    p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo));
+                                    if(p_info[j] == NULL)
+                                      goto error;
+                                    protocol__flex_paging_info__init(p_info[j]);
+                                    //TODO: Set paging index. This index is the same that will be used for the scheduling of the
+                                    //paging message by the controller
+                                    p_info[j]->paging_index = 10;
+                                    p_info[j]->has_paging_index = 1;
+                                    //TODO:Set the paging message size
+                                    p_info[j]->paging_message_size = 100;
+                                    p_info[j]->has_paging_message_size = 1;
+                                    //TODO: Set the paging subframe
+                                    p_info[j]->paging_subframe = 10;
+                                    p_info[j]->has_paging_subframe = 1;
+                                    //TODO: Set the carrier index for the pending paging message
+                                    p_info[j]->carrier_index = 0;
+                                    p_info[j]->has_carrier_index = 1;
+
+                            }
+                            //Add all paging info to the paging buffer rerport
+                            paging_report->paging_info = p_info;
+                            //Add the paging report to the UE report
+                            ue_report[i]->pbr = paging_report;
+                }
+
+                  /* Check flag for creation of UL CQI report */
+                if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) {
+
+                      //Fill in the full UL CQI report of the UE
+                      Protocol__FlexUlCqiReport *full_ul_report;
+                      full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport));
+                      if(full_ul_report == NULL)
+                        goto error;
+                      protocol__flex_ul_cqi_report__init(full_ul_report);
+                      //TODO:Set the SFN and SF of the generated report
+                      full_ul_report->sfn_sn = flexran_get_sfn_sf(enb_id);
+                      full_ul_report->has_sfn_sn = 1;
+                      //TODO:Set the number of UL measurement reports based on the types of measurements
+                      //configured for this UE and on the servCellIndex
+                      full_ul_report->n_cqi_meas = 1;
+                      Protocol__FlexUlCqi **ul_report;
+                      ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas);
+                      if(ul_report == NULL)
+                        goto error;
+                      //Fill each UL report of the UE for each of the configured report types
+                      for(j = 0; j < full_ul_report->n_cqi_meas; j++) {
+
+                              ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi));
+                              if(ul_report[j] == NULL)
+                              goto error;
+                              protocol__flex_ul_cqi__init(ul_report[j]);
+                              //TODO: Set the type of the UL report. As an example set it to SRS UL report
+                              // See enum flex_ul_cqi_type in FlexRAN specification for more details
+                              ul_report[j]->type = PROTOCOL__FLEX_UL_CQI_TYPE__FLUCT_SRS;
+                              ul_report[j]->has_type = 1;
+                              //TODO:Set the number of SINR measurements based on the report type
+                              //See struct flex_ul_cqi in FlexRAN specification for more details
+                              ul_report[j]->n_sinr = 0;
+                              uint32_t *sinr_meas;
+                              sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr);
+                              if (sinr_meas == NULL)
+                                goto error;
+                              //TODO:Set the SINR measurements for the specified type
+                              for (k = 0; k < ul_report[j]->n_sinr; k++) {
+                                      sinr_meas[k] = 10;
+                              }
+                              ul_report[j]->sinr = sinr_meas;
+                              //TODO: Set the servCellIndex for this report
+                              ul_report[j]->serv_cell_index = 0;
+                              ul_report[j]->has_serv_cell_index = 1;
+
+                              //Set the list of UL reports of this UE to the full UL report
+                              full_ul_report->cqi_meas = ul_report;
+
+                              full_ul_report->n_pucch_dbm = MAX_NUM_CCs;
+                              full_ul_report->pucch_dbm = malloc(sizeof(Protocol__FlexPucchDbm *) * full_ul_report->n_pucch_dbm);
+
+                              for (j = 0; j < MAX_NUM_CCs; j++) {
+
+                                      full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__FlexPucchDbm));
+                                      protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]);
+                                      full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1;
+                                      full_ul_report->pucch_dbm[j]->serv_cell_index = j;
+
+                                      if(flexran_get_p0_pucch_dbm(enb_id,i, j) != -1){
+                                        full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(enb_id,i,j);
+                                        full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1;
+                                      }
+                              }
+
+
+                          }
+                        //  Add full UL CQI report to the UE report
+                        ue_report[i]->ul_cqi_report = full_ul_report;
+
+
+                     }
+                      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) {
+
+                            Protocol__FlexMacStats *macstats;
+                            macstats = malloc(sizeof(Protocol__FlexMacStats));
+                            if (macstats == NULL)
+                              goto error;
+                            protocol__flex_mac_stats__init(macstats);
+
+
+                            macstats->total_bytes_sdus_dl = flexran_get_total_size_dl_mac_sdus(mod_id, i, cc_id);
+                            macstats->has_total_bytes_sdus_dl = 1;
+
+                            macstats->total_bytes_sdus_ul = flexran_get_total_size_ul_mac_sdus(mod_id, i, cc_id);
+                            macstats->has_total_bytes_sdus_ul = 1;
+
+                            macstats->tbs_dl = flexran_get_TBS_dl(mod_id, i, cc_id);
+                            macstats->has_tbs_dl = 1;
+
+                            macstats->tbs_ul = flexran_get_TBS_ul(mod_id, i, cc_id);
+                            macstats->has_tbs_ul = 1;
+
+                            macstats->prb_retx_dl = flexran_get_num_prb_retx_dl_per_ue(mod_id, i, cc_id);
+                            macstats->has_prb_retx_dl = 1;
+
+                            macstats->prb_retx_ul = flexran_get_num_prb_retx_ul_per_ue(mod_id, i, cc_id);
+                            macstats->has_prb_retx_ul = 1;
+
+                            macstats->prb_dl = flexran_get_num_prb_dl_tx_per_ue(mod_id, i, cc_id);
+                            macstats->has_prb_dl = 1;
+
+                            macstats->prb_ul = flexran_get_num_prb_ul_rx_per_ue(mod_id, i, cc_id);
+                            macstats->has_prb_ul = 1;
+
+                            macstats->mcs1_dl = flexran_get_mcs1_dl(mod_id, i, cc_id);
+                            macstats->has_mcs1_dl = 1;
+
+                            macstats->mcs2_dl = flexran_get_mcs2_dl(mod_id, i, cc_id);
+                            macstats->has_mcs2_dl = 1;
+
+                            macstats->mcs1_ul = flexran_get_mcs1_ul(mod_id, i, cc_id);
+                            macstats->has_mcs1_ul = 1;
+
+                            macstats->mcs2_ul = flexran_get_mcs2_ul(mod_id, i, cc_id);
+                            macstats->has_mcs2_ul = 1;
+
+                            macstats->total_prb_dl = flexran_get_total_prb_dl_tx_per_ue(mod_id, i, cc_id);
+                            macstats->has_total_prb_dl = 1;
+
+                            macstats->total_prb_ul = flexran_get_total_prb_ul_rx_per_ue(mod_id, i, cc_id);
+                            macstats->has_total_prb_ul = 1;
+
+                            macstats->total_pdu_dl = flexran_get_total_num_pdu_dl(mod_id, i, cc_id);
+                            macstats->has_total_pdu_dl = 1;
+
+                            macstats->total_pdu_ul = flexran_get_total_num_pdu_ul(mod_id, i, cc_id);
+                            macstats->has_total_pdu_ul = 1;
+
+                            macstats->total_tbs_dl = flexran_get_total_TBS_dl(mod_id, i, cc_id);
+                            macstats->has_total_tbs_dl = 1;
+
+                            macstats->total_tbs_ul = flexran_get_total_TBS_ul(mod_id, i, cc_id);
+                            macstats->has_total_tbs_ul = 1;
+
+                            macstats->harq_round = flexran_get_harq_round(mod_id, cc_id, i);
+                            macstats->has_harq_round = 1;
+
+                            Protocol__FlexMacSdusDl ** mac_sdus;
+                            mac_sdus = malloc(sizeof(Protocol__FlexMacSdusDl) * flexran_get_num_mac_sdu_tx(mod_id, i, cc_id));
+                            if (mac_sdus == NULL)
+                                goto error;
+
+                            macstats->n_mac_sdus_dl = flexran_get_num_mac_sdu_tx(mod_id, i, cc_id);
+
+                            for (j = 0; j < macstats->n_mac_sdus_dl; j++){
+
+
+                                mac_sdus[j] = malloc(sizeof(Protocol__FlexMacSdusDl));
+                                protocol__flex_mac_sdus_dl__init(mac_sdus[j]);
+
+                                mac_sdus[j]->lcid = flexran_get_mac_sdu_lcid_index(mod_id, i, cc_id, j);
+                                mac_sdus[j]->has_lcid = 1;
+
+                                mac_sdus[j]->sdu_length = flexran_get_mac_sdu_size(mod_id, i, cc_id, mac_sdus[j]->lcid);
+                                mac_sdus[j]->has_sdu_length = 1;
+
+
+                            }
+
+
+                            macstats->mac_sdus_dl = mac_sdus;
+
+
+                        ue_report[i]->mac_stats = macstats;
+
+               }
+
+
+
+
+             }
+
+
+
+
+     }
 
   /* Allocate memory for list of cell reports */
   if (report_config->nr_cc > 0) {
-    cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc);
-    if (cell_report == NULL)
-      goto error;
-    // Fill in the Cell reports
-    for (i = 0; i < report_config->nr_cc; i++) {
-      cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport));
-      if(cell_report[i] == NULL)
-	goto error;
-      protocol__flex_cell_stats_report__init(cell_report[i]);
-      cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id;
-      cell_report[i]->has_carrier_index = 1;
-      cell_report[i]->flags = report_config->cc_report_type[i].cc_report_flags;
-      cell_report[i]->has_flags = 1;
-
-      /* Check flag for creation of noise and interference report */
-      if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) {
-	// TODO: Fill in the actual noise and interference report for this cell
-	Protocol__FlexNoiseInterferenceReport *ni_report;
-	ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport));
-	if(ni_report == NULL)
-	  goto error;
-	protocol__flex_noise_interference_report__init(ni_report);
-	// Current frame and subframe number
-	ni_report->sfn_sf = flexran_get_sfn_sf(enb_id);
-	ni_report->has_sfn_sf = 1;
-	//TODO:Received interference power in dbm
-	ni_report->rip = 0;
-	ni_report->has_rip = 0;
-	//TODO:Thermal noise power in dbm
-	ni_report->tnp = 0;
-	ni_report->has_tnp = 0;
-
-	ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0);
-	ni_report->has_p0_nominal_pucch = 1;
-	cell_report[i]->noise_inter_report = ni_report;
-      }
-    }
-    /* Add list of all cell reports to the message */
-    stats_reply_msg->cell_report = cell_report;
+
+
+            // Fill in the Cell reports
+            for (i = 0; i < report_config->nr_cc; i++) {
+
+
+                      /* Check flag for creation of noise and interference report */
+                      if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) {
+                            // TODO: Fill in the actual noise and interference report for this cell
+                            Protocol__FlexNoiseInterferenceReport *ni_report;
+                            ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport));
+                            if(ni_report == NULL)
+                              goto error;
+                            protocol__flex_noise_interference_report__init(ni_report);
+                            // Current frame and subframe number
+                            ni_report->sfn_sf = flexran_get_sfn_sf(enb_id);
+                            ni_report->has_sfn_sf = 1;
+                            //TODO:Received interference power in dbm
+                            ni_report->rip = 0;
+                            ni_report->has_rip = 1;
+                            //TODO:Thermal noise power in dbm
+                            ni_report->tnp = 0;
+                            ni_report->has_tnp = 1;
+
+                            ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0);
+                            ni_report->has_p0_nominal_pucch = 1;
+                            cell_report[i]->noise_inter_report = ni_report;
+                      }
+            }
+
+
+
+
   }
 
-  *msg = malloc(sizeof(Protocol__FlexranMessage));
-  if(*msg == NULL)
-    goto error;
-  protocol__flexran_message__init(*msg);
-  (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG;
-  (*msg)->msg_dir =  PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME;
-  (*msg)->stats_reply_msg = stats_reply_msg;
   return 0;
 
  error:
-  // TODO: Need to make proper error handling
-  if (header != NULL)
-    free(header);
-  if (stats_reply_msg != NULL)
-    free(stats_reply_msg);
-  if(*msg != NULL)
-    free(*msg);
-  //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+
+  if (cell_report != NULL)
+        free(cell_report);
+  if (ue_report != NULL)
+        free(ue_report);
+
   return -1;
 }
 
@@ -854,7 +765,7 @@ int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) {
 }
 
 int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
-  Protocol__FlexHeader *header;
+  Protocol__FlexHeader *header = NULL;
   int i;
   const int xid = *((int *)params);
 
@@ -922,11 +833,11 @@ int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) {
 }
 
 int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
-  Protocol__FlexHeader *header;
+  Protocol__FlexHeader *header = NULL;
   int i, j, UE_id;
-  
+
   int available_harq[NUMBER_OF_UE_MAX];
-  
+
   const int xid = *((int *)params);
 
 
@@ -948,12 +859,12 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
   }
 
   int ahead_of_time = 0;
-  
+
   frame = (frame_t) flexran_get_current_system_frame_num(mod_id);
   subframe = (sub_frame_t) flexran_get_current_subframe(mod_id);
 
   subframe = ((subframe + ahead_of_time) % 10);
-  
+
   if (subframe < flexran_get_current_subframe(mod_id)) {
     frame = (frame + 1) % 1024;
   }
@@ -969,14 +880,14 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
 
   for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
     for (j = 0; j < 8; j++) {
-      if (harq_pid_updated[i][j] == 1) {
+      if (RC.mac && RC.mac[mod_id] && RC.mac[mod_id]->UE_list.eNB_UE_stats[UE_PCCID(mod_id,i)][i].harq_pid == 1) {
 	available_harq[i] = j;
 	sf_trigger_msg->n_dl_info++;
 	break;
       }
     }
   }
-  
+
 
   //  LOG_I(FLEXRAN_AGENT, "Sending subframe trigger for frame %d and subframe %d\n", flexran_get_current_frame(mod_id), (flexran_get_current_subframe(mod_id) + 1) % 10);
 
@@ -1009,17 +920,18 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
       //      uint8_t harq_id;
       //uint8_t harq_status;
       //      flexran_get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status);
-      
-      
+
+
       dl_info[i]->harq_process_id = available_harq[UE_id];
-      harq_pid_updated[UE_id][available_harq[UE_id]] = 0;
+      if (RC.mac && RC.mac[mod_id])
+        RC.mac[mod_id]->UE_list.eNB_UE_stats[UE_PCCID(mod_id,i)][UE_id].harq_pid = 0;
       dl_info[i]->has_harq_process_id = 1;
       /* Fill in the status of the HARQ process (2 TBs)*/
       dl_info[i]->n_harq_status = 2;
       dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status);
       for (j = 0; j < dl_info[i]->n_harq_status; j++) {
-	dl_info[i]->harq_status[j] = harq_pid_round[UE_id][available_harq[UE_id]];
-	// TODO: This should be different per TB
+        dl_info[i]->harq_status[j] = RC.mac[mod_id]->UE_list.UE_sched_ctrl[i].round[UE_PCCID(mod_id,i)][j];
+        // TODO: This should be different per TB
       }
       //      LOG_I(FLEXRAN_AGENT, "Sending subframe trigger for frame %d and subframe %d and harq %d (round %d)\n", flexran_get_current_frame(mod_id), (flexran_get_current_subframe(mod_id) + 1) % 10, dl_info[i]->harq_process_id, dl_info[i]->harq_status[0]);
       if(dl_info[i]->harq_status[0] > 0) {
@@ -1052,13 +964,16 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
       protocol__flex_ul_info__init(ul_info[i]);
       ul_info[i]->rnti = flexran_get_ue_crnti(mod_id, i);
       ul_info[i]->has_rnti = 1;
-      /*Fill in the Tx power control command for this UE (if available)*/
-      if(flexran_get_tpc(mod_id,i) != 1){
-    	  ul_info[i]->tpc = flexran_get_tpc(mod_id,i);
+      /* Fill in the Tx power control command for this UE (if available),
+       * primary carrier */
+      if(flexran_get_tpc(mod_id, i, 0) != 1){
+          /* assume primary carrier */
+          ul_info[i]->tpc = flexran_get_tpc(mod_id, i, 0);
           ul_info[i]->has_tpc = 1;
       }
       else{
-    	  ul_info[i]->tpc = flexran_get_tpc(mod_id,i);
+          /* assume primary carrier */
+          ul_info[i]->tpc = flexran_get_tpc(mod_id, i, 0);
     	  ul_info[i]->has_tpc = 0;
       }
       /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the
@@ -1095,7 +1010,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
     for (i = 0; i < sf_trigger_msg->n_dl_info; i++) {
       free(sf_trigger_msg->dl_info[i]->harq_status);
     }
-    free(sf_trigger_msg->dl_info);    
+    free(sf_trigger_msg->dl_info);
     free(sf_trigger_msg->ul_info);
     free(sf_trigger_msg);
   }
@@ -1134,7 +1049,7 @@ int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) {
 int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg) {
 
   int xid = 0;
-  Protocol__FlexHeader *header;
+  Protocol__FlexHeader *header = NULL;
   if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0)
     goto error;
 
@@ -1226,13 +1141,85 @@ int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) {
   return -1;
 }
 
+int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMessage **msg) {
+
+  int xid = 0;
+  Protocol__FlexHeader *header = NULL;
+  if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_MAC_CONFIG, &header) != 0)
+    goto error;
+
+  Protocol__FlexUlMacConfig *ul_mac_config_msg;
+  ul_mac_config_msg = malloc(sizeof(Protocol__FlexUlMacConfig));
+  if (ul_mac_config_msg == NULL) {
+    goto error;
+  }
+  protocol__flex_ul_mac_config__init(ul_mac_config_msg);
+
+  ul_mac_config_msg->header = header;
+  ul_mac_config_msg->has_sfn_sf = 1;
+  ul_mac_config_msg->sfn_sf = flexran_get_sfn_sf(mod_id);
+
+  *msg = malloc(sizeof(Protocol__FlexranMessage));
+  if(*msg == NULL)
+    goto error;
+  protocol__flexran_message__init(*msg);
+  (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_MAC_CONFIG_MSG;
+  (*msg)->msg_dir =  PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
+  (*msg)->ul_mac_config_msg = ul_mac_config_msg;
+
+  return 0;
+
+ error:
+  return -1;
+}
+
+
+int flexran_agent_mac_destroy_ul_config(Protocol__FlexranMessage *msg) {
+  int i; //,j, k;
+  if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_MAC_CONFIG_MSG)
+    goto error;
+
+  // Protocol__FlexUlDci *ul_dci;
+
+  free(msg->ul_mac_config_msg->header);
+  for (i = 0; i < msg->ul_mac_config_msg->n_ul_ue_data; i++) {
+    // TODO  uplink rlc ...
+    // free(msg->ul_mac_config_msg->dl_ue_data[i]->ce_bitmap);
+  //   for (j = 0; j < msg->ul_mac_config_msg->ul_ue_data[i]->n_rlc_pdu; j++) {
+  //     for (k = 0; k <  msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu[j]->n_rlc_pdu_tb; k++) {
+  // free(msg->ul_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb[k]);
+  //     }
+  //     free(msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb);
+  //     free(msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu[j]);
+  //   }
+    // free(msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu);
+    // ul_dci = msg->ul_mac_config_msg->ul_ue_data[i]->ul_dci;
+    // free(dl_dci->tbs_size);
+    // free(ul_dci->mcs);
+    // free(ul_dci->ndi);
+    // free(ul_dci->rv);
+    // free(ul_dci);
+    // free(msg->ul_mac_config_msg->ul_ue_data[i]);
+  }
+  free(msg->ul_mac_config_msg->ul_ue_data);
+
+  free(msg->ul_mac_config_msg);
+  free(msg);
+
+  return 0;
+
+ error:
+  return -1;
+}
+
+
 void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) {
 
   struct lfds700_misc_prng_state ls;
-  
+
   LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
   lfds700_misc_prng_init(&ls);
-  
+
   if (lfds700_ringbuffer_read(&ringbuffer_state[mod_id], NULL, (void **) msg, &ls) == 0) {
     *msg = NULL;
   }
@@ -1243,10 +1230,10 @@ int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Pro
   struct lfds700_misc_prng_state ls;
   enum lfds700_misc_flag overwrite_occurred_flag;
   Protocol__FlexranMessage *overwritten_dl_config;
-   
+
   LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
   lfds700_misc_prng_init(&ls);
-  
+
   lfds700_ringbuffer_write( &ringbuffer_state[mod_id],
 			    NULL,
 			    (void *) params,
@@ -1277,7 +1264,8 @@ void flexran_agent_init_mac_agent(mid_t mod_id) {
   lfds700_ringbuffer_init_valid_on_current_logical_core( &ringbuffer_state[mod_id], dl_mac_config_array[mod_id], num_elements, &ps[mod_id], NULL );
   for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
     for (j = 0; j < 8; j++) {
-      harq_pid_updated[i][j] = 0;
+      if (RC.mac && RC.mac[mod_id])
+        RC.mac[mod_id]->UE_list.eNB_UE_stats[UE_PCCID(mod_id,i)][i].harq_pid = 0;
     }
   }
 }
@@ -1346,58 +1334,7 @@ void flexran_agent_send_sf_trigger(mid_t mod_id) {
   LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n");
 }
 
-void flexran_agent_send_update_mac_stats(mid_t mod_id) {
-
-  Protocol__FlexranMessage *current_report = NULL;
-  void *data;
-  int size;
-  err_code_t err_code;
-  int priority = 0;
-  
-  if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) {
-    goto error;
-  }
-
-  if (mac_stats_context[mod_id].cont_update == 1) {
-  
-    /*Create a fresh report with the required flags*/
-    err_code = flexran_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, &current_report);
-    if (err_code < 0) {
-      goto error;
-    }
-  }
-  /* /\*TODO:Check if a previous reports exists and if yes, generate a report */
-  /*  *that is the diff between the old and the new report, */
-  /*  *respecting the thresholds. Otherwise send the new report*\/ */
-  /* if (mac_stats_context[mod_id].prev_stats_reply != NULL) { */
-
-  /*   msg = flexran_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */
-
-  /*   /\*Destroy the old stats*\/ */
-  /*    flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */
-  /* } */
-  /* /\*Use the current report for future comparissons*\/ */
-  /* mac_stats_context[mod_id].prev_stats_reply = current_report; */
-
-
-  if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) {
-    goto error;
-  }
-
-  if (current_report != NULL){
-    data=flexran_agent_pack_message(current_report, &size);
-    /*Send any stats updates using the MAC channel of the eNB*/
-    if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) {
-      err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
-      goto error;
-    }
 
-    LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
-    return;
-  }
- error:
-  LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n");
-}
 
 int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
   if (mac_agent_registered[mod_id]) {
@@ -1408,14 +1345,11 @@ int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
   //xface->agent_ctxt = &shared_ctxt[mod_id];
   xface->flexran_agent_send_sr_info = flexran_agent_send_sr_info;
   xface->flexran_agent_send_sf_trigger = flexran_agent_send_sf_trigger;
-  xface->flexran_agent_send_update_mac_stats = flexran_agent_send_update_mac_stats;
-  xface->flexran_agent_schedule_ue_spec = flexran_schedule_ue_spec_default;
-  //xface->flexran_agent_schedule_ue_spec = flexran_schedule_ue_spec_remote;
+  //xface->flexran_agent_send_update_mac_stats = flexran_agent_send_update_mac_stats;
   xface->flexran_agent_get_pending_dl_mac_config = flexran_agent_get_pending_dl_mac_config;
-  xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change;
-  
-  xface->dl_scheduler_loaded_lib = NULL;
 
+  xface->dl_scheduler_loaded_lib = NULL;
+  xface->ul_scheduler_loaded_lib = NULL;
   mac_agent_registered[mod_id] = 1;
   agent_mac_xface[mod_id] = xface;
 
@@ -1427,13 +1361,11 @@ int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
   //xface->agent_ctxt = NULL;
   xface->flexran_agent_send_sr_info = NULL;
   xface->flexran_agent_send_sf_trigger = NULL;
-  xface->flexran_agent_send_update_mac_stats = NULL;
-  xface->flexran_agent_schedule_ue_spec = NULL;
+  //xface->flexran_agent_send_update_mac_stats = NULL;
   xface->flexran_agent_get_pending_dl_mac_config = NULL;
-  xface->flexran_agent_notify_ue_state_change = NULL;
 
   xface->dl_scheduler_loaded_lib = NULL;
-
+  xface->ul_scheduler_loaded_lib = NULL;
   mac_agent_registered[mod_id] = 0;
   agent_mac_xface[mod_id] = NULL;
 
@@ -1441,89 +1373,7 @@ int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
 }
 
 
-/******************************************************
- *Implementations of flexran_agent_mac_internal.h functions
- ******************************************************/
-
-err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id) {
-
-  /*Initialize the Mac stats update structure*/
-  /*Initially the continuous update is set to false*/
-  mac_stats_context[mod_id].cont_update = 0;
-  mac_stats_context[mod_id].is_initialized = 1;
-  mac_stats_context[mod_id].stats_req = NULL;
-  mac_stats_context[mod_id].prev_stats_reply = NULL;
-  mac_stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t));
-  if (mac_stats_context[mod_id].mutex == NULL)
-    goto error;
-  if (pthread_mutex_init(mac_stats_context[mod_id].mutex, NULL))
-    goto error;;
-
-  return 0;
-
- error:
-  return -1;
-}
-
-err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id) {
-  /*Disable the continuous updates for the MAC*/
-  mac_stats_context[mod_id].cont_update = 0;
-  mac_stats_context[mod_id].is_initialized = 0;
-  flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req);
-  flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply);
-  free(mac_stats_context[mod_id].mutex);
-
-  mac_agent_registered[mod_id] = 0;
-  return 1;
-}
-
-
-err_code_t flexran_agent_enable_cont_mac_stats_update(mid_t mod_id,
-						      xid_t xid, stats_request_config_t *stats_req) {
-  /*Enable the continuous updates for the MAC*/
-  if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) {
-    goto error;
-  }
-
-  Protocol__FlexranMessage *req_msg;
-
-  flexran_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg);
-  mac_stats_context[mod_id].stats_req = req_msg;
-  mac_stats_context[mod_id].prev_stats_reply = NULL;
-
-  mac_stats_context[mod_id].cont_update = 1;
-  mac_stats_context[mod_id].xid = xid;
-
-  if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) {
-    goto error;
-  }
-  return 0;
 
- error:
-  LOG_E(FLEXRAN_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id);
-  return -1;
-}
 
-err_code_t flexran_agent_disable_cont_mac_stats_update(mid_t mod_id) {
-  /*Disable the continuous updates for the MAC*/
-  if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) {
-    goto error;
-  }
-  mac_stats_context[mod_id].cont_update = 0;
-  mac_stats_context[mod_id].xid = 0;
-  if (mac_stats_context[mod_id].stats_req != NULL) {
-    flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req);
-  }
-  if (mac_stats_context[mod_id].prev_stats_reply != NULL) {
-    flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply);
-  }
-  if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) {
-    goto error;
-  }
-  return 0;
 
- error:
-  LOG_E(FLEXRAN_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id);
-  return -1;
 
-}
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h
index e2378e93119264517ab2a1c2815e3eddb242d918..03e7def95e04610e57503917c38dbafe9e6fb3d4 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -37,50 +37,10 @@
 #include "flexran_agent_common.h"
 #include "flexran_agent_extern.h"
 
-/* These types will be used to give
-   instructions for the type of stats reports
-   we need to create */
-typedef struct {
-  uint16_t ue_rnti;
-  uint32_t ue_report_flags; /* Indicates the report elements
-			       required for this UE id. See
-			       FlexRAN specification 1.2.4.2 */
-} ue_report_type_t;
-
-typedef struct {
-  uint16_t cc_id;
-  uint32_t cc_report_flags; /* Indicates the report elements
-			      required for this CC index. See
-			      FlexRAN specification 1.2.4.3 */
-} cc_report_type_t;
-
-typedef struct {
-  int nr_ue;
-  ue_report_type_t *ue_report_type;
-  int nr_cc;
-  cc_report_type_t *cc_report_type;
-} report_config_t;
-
-typedef struct stats_request_config_s{
-  uint8_t report_type;
-  uint8_t report_frequency;
-  uint16_t period; /*In number of subframes*/
-  report_config_t *config;
-} stats_request_config_t;
 
 /* Initialization function for the agent structures etc */
 void flexran_agent_init_mac_agent(mid_t mod_id);
 
-int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
-
-/* Statistics request protocol message constructor and destructor */
-int flexran_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg);
-int flexran_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg);
-
-/* Statistics reply protocol message constructor and destructor */
-int flexran_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg);
-int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg);
-
 /* Scheduling request information protocol message constructor and estructor */
 int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
 int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg);
@@ -89,10 +49,18 @@ int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg);
 int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
 int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg);
 
+/* Statistics reply protocol message constructor and destructor */
+int flexran_agent_mac_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report);
+int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg);
+
 /* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ 
 int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg);
 int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg);
 
+/* UL MAC scheduling decision protocol message constructor (empty command) and destructor */ 
+int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMessage **msg);
+int flexran_agent_mac_destroy_ul_config(Protocol__FlexranMessage *msg);
+
 int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
 
 
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h
index 9ec8594f88e567643f566145bb4dc2a0268a616c..5c1fc1379c6454406b22f2e7fde198433819e965 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -48,26 +48,20 @@ typedef struct {
 
   /// Send to the controller all the mac stat updates that occured during this subframe
   /// based on the stats request configuration
-  void (*flexran_agent_send_update_mac_stats)(mid_t mod_id);
+  // void (*flexran_agent_send_update_mac_stats)(mid_t mod_id);
 
   /// Provide to the scheduler a pending dl_mac_config message
   void (*flexran_agent_get_pending_dl_mac_config)(mid_t mod_id,
 						  Protocol__FlexranMessage **msg);
   
-  /// Run the UE DL scheduler and fill the Protocol__FlexranMessage. Assumes that
-  /// dl_info is already initialized as flex_dl_mac_config and fills the
-  /// flex_dl_data part of it
-  void (*flexran_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe,
-					 int *mbsfn_flag, Protocol__FlexranMessage **dl_info);
-  
-
   /// Notify the controller for a state change of a particular UE, by sending the proper
   /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
-  int (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
-					       uint8_t state_change);
+  // int (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
+		// 			       uint8_t state_change);
   
   
   void *dl_scheduler_loaded_lib;
+  void *ul_scheduler_loaded_lib;
   /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/
 
 } AGENT_MAC_xface;
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
index 1fa9852487d6922ba211be4e7affddcedbf3339a..2acee0686f62165881d256e96eb09500274d0a30 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -101,7 +101,7 @@ Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol
   if (n_cell_report > 0 || n_ue_report > 0) {
     /*Create header*/
     int xid = old_report->header->xid;
-    Protocol__FlexHeader *header;
+    Protocol__FlexHeader *header = NULL;
     if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) {
     goto error;
     }
@@ -180,10 +180,12 @@ Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport *
     }
   }
 
-  if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) {
-    copy->has_phr = original->has_phr;
-    copy->phr = original->phr;
-  }
+  
+
+   if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) { 
+     copy->has_phr = original->has_phr;
+     copy->phr = original->phr;
+   }
 
   if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) {
     copy->n_rlc_report = original->n_rlc_report; 
@@ -605,7 +607,10 @@ int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) {
       } else if (strcmp((char *) event.data.scalar.value, "ul_scheduler") == 0) {
 	// Call the proper handler
 	LOG_D(ENB_APP, "This is for the ul_scheduler subsystem\n");
-	goto error;
+	if (parse_ul_scheduler_config(mod_id, parser) == -1) {
+    LOG_D(ENB_APP, "An error occured\n");
+    goto error;
+  }
 	// TODO
       } else if (strcmp((char *) event.data.scalar.value, "ra_scheduler") == 0) {
 	// Call the proper handler
@@ -698,6 +703,56 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) {
   return -1;
 }
 
+int parse_ul_scheduler_config(mid_t mod_id, yaml_parser_t *parser) {
+  
+  yaml_event_t event;
+
+  int done = 0;
+  int mapping_started = 0;
+
+  while (!done) {
+    
+    if (!yaml_parser_parse(parser, &event))
+      goto error;
+
+    switch (event.type) {
+      // We are expecting a mapping (behavior and parameters)
+    case YAML_MAPPING_START_EVENT:
+      LOG_D(ENB_APP, "The mapping of the subsystem started\n");
+      mapping_started = 1;
+      break;
+    case YAML_MAPPING_END_EVENT:
+      LOG_D(ENB_APP, "The mapping of the subsystem ended\n");
+      mapping_started = 0;
+      break;
+    case YAML_SCALAR_EVENT:
+      if (!mapping_started) {
+  goto error;
+      }
+      // Check what key needs to be set
+      if (strcmp((char *) event.data.scalar.value, "parameters") == 0) {
+  LOG_D(ENB_APP, "Now it is time to set the parameters for this subsystem\n");
+  if (parse_ul_scheduler_parameters(mod_id, parser) == -1) {
+    goto error;
+  }
+      }
+      break;
+    default:
+      goto error;
+    }
+
+    done = (event.type == YAML_MAPPING_END_EVENT);
+    yaml_event_delete(&event);
+  }
+
+  return 0;
+
+ error:
+  yaml_event_delete(&event);
+  return -1;
+}
+
+
 int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
   yaml_event_t event;
   
@@ -753,13 +808,68 @@ int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
   return -1;
 }
 
+int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
+  yaml_event_t event;
+  
+  void *param;
+  
+  int done = 0;
+  int mapping_started = 0;
+
+  while (!done) {
+    
+    if (!yaml_parser_parse(parser, &event))
+      goto error;
+
+    switch (event.type) {
+      // We are expecting a mapping of parameters
+    case YAML_MAPPING_START_EVENT:
+      LOG_D(ENB_APP, "The mapping of the parameters started\n");
+      mapping_started = 1;
+      break;
+    case YAML_MAPPING_END_EVENT:
+      LOG_D(ENB_APP, "The mapping of the parameters ended\n");
+      mapping_started = 0;
+      break;
+    case YAML_SCALAR_EVENT:
+      if (!mapping_started) {
+  goto error;
+      }
+      // Check what key needs to be set
+      if (mac_agent_registered[mod_id]) {
+  LOG_D(ENB_APP, "Setting parameter %s\n", event.data.scalar.value);
+  param = dlsym(agent_mac_xface[mod_id]->ul_scheduler_loaded_lib,
+          (char *) event.data.scalar.value);
+  if (param == NULL) {
+    goto error;
+  }
+  apply_parameter_modification(param, parser);
+      } else {
+  goto error;
+      }
+      break;
+    default:
+      goto error;
+    }
+
+    done = (event.type == YAML_MAPPING_END_EVENT);
+    yaml_event_delete(&event);
+  }
+
+  return 0;
+  
+ error:
+  yaml_event_delete(&event);
+  return -1;
+}
+
 int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
   void *lib;
 
   char lib_name[120];
   char target[512];
   snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name);
-  strcpy(target, local_cache);
+  strcpy(target, RC.flexran[mod_id]->cache_name);
   strcat(target, lib_name);
   
   LOG_I(FLEXRAN_AGENT, "Opening pushed code: %s\n", target);
@@ -773,7 +883,6 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
   void *loaded_scheduler = dlsym(lib, function_name);
   if (loaded_scheduler) {
     if (mac_agent_registered[mod_id]) {
-      agent_mac_xface[mod_id]->flexran_agent_schedule_ue_spec = loaded_scheduler;
       if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) {
 	dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib);
       }
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h
index 9a7d4a8555b070fde7f389e30b46d256f84bc278..f69e2cde4098ad5d035a522c9815632bffb37312 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -101,6 +101,10 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser);
 
 int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser);
 
+int parse_ul_scheduler_config(mid_t mod_id, yaml_parser_t *parser);
+
+int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser);
+
 int load_dl_scheduler_function(mid_t mod_id, const char *function_name);
 
 #endif /*FLEXRAN_AGENT_MAC_INTERNAL_H_*/
diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c
new file mode 100644
index 0000000000000000000000000000000000000000..43455fa32a4043edeac6eda7c869b0fe2c783348
--- /dev/null
+++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+/*! \file flexran_agent_pdcp.c
+ * \brief FlexRAN agent Control Module PDCP 
+ * \author Navid Nikaein and shahab SHARIAT BAGHERI
+ * \date 2017
+ * \version 0.1
+ */
+
+#include "flexran_agent_pdcp.h"
+
+
+/*Trigger boolean for PDCP measurement*/
+bool triggered_pdcp = false;
+/*Flags showing if a pdcp agent has already been registered*/
+unsigned int pdcp_agent_registered[NUM_MAX_ENB];
+
+/*Array containing the Agent-PDCP interfaces*/
+AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB];
+
+// NUMBER_OF_UE_MAX
+
+void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id,
+					const mid_t ue_id,
+					Protocol__FlexPdcpStats *pdcp_aggr_stats){
+
+  int lcid=0;
+  /* only calculate the DRBs */ 
+  //LOG_I(FLEXRAN_AGENT, "enb %d ue %d \n", mod_id, ue_id);
+  
+  for (lcid=NUM_MAX_SRB ; lcid < NUM_MAX_SRB + NUM_MAX_DRB; lcid++){
+    
+    pdcp_aggr_stats->pkt_tx += flexran_get_pdcp_tx(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_tx_bytes += flexran_get_pdcp_tx_bytes(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_tx_w += flexran_get_pdcp_tx_w(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_tx_bytes_w += flexran_get_pdcp_tx_bytes_w(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_tx_aiat += flexran_get_pdcp_tx_aiat(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_tx_aiat_w += flexran_get_pdcp_tx_aiat_w(mod_id,ue_id,lcid);
+    
+      
+    pdcp_aggr_stats->pkt_rx += flexran_get_pdcp_rx(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_rx_bytes += flexran_get_pdcp_rx_bytes(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_rx_w += flexran_get_pdcp_rx_w(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_rx_bytes_w += flexran_get_pdcp_rx_bytes_w(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_rx_aiat += flexran_get_pdcp_rx_aiat(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_rx_aiat_w += flexran_get_pdcp_rx_aiat_w(mod_id,ue_id,lcid);
+    pdcp_aggr_stats->pkt_rx_oo += flexran_get_pdcp_rx_oo(mod_id,ue_id,lcid);
+    
+  }
+  
+}
+
+
+int flexran_agent_pdcp_stats_reply(mid_t mod_id,       
+				   const report_config_t *report_config,
+				   Protocol__FlexUeStatsReport **ue_report,
+				   Protocol__FlexCellStatsReport **cell_report) {
+  
+  
+  // Protocol__FlexHeader *header;
+  int i;
+  // int cc_id = 0;
+ 
+  
+  /* Allocate memory for list of UE reports */
+  if (report_config->nr_ue > 0) {
+    
+    for (i = 0; i < report_config->nr_ue; i++) {
+
+      /* Check flag for creation of buffer status report */
+      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS) {
+	
+	Protocol__FlexPdcpStats *pdcp_aggr_stats;
+	pdcp_aggr_stats = malloc(sizeof(Protocol__FlexPdcpStats));
+	if (pdcp_aggr_stats == NULL)
+	  goto error;
+	protocol__flex_pdcp_stats__init(pdcp_aggr_stats);
+	
+	flexran_agent_pdcp_aggregate_stats(mod_id, i, pdcp_aggr_stats);
+
+	pdcp_aggr_stats->has_pkt_tx=1;
+	pdcp_aggr_stats->has_pkt_tx_bytes =1;
+	pdcp_aggr_stats->has_pkt_tx_w=1; 
+	pdcp_aggr_stats->has_pkt_tx_bytes_w =1;
+	pdcp_aggr_stats->has_pkt_tx_aiat =1; 
+	pdcp_aggr_stats->has_pkt_tx_aiat_w =1;
+
+	pdcp_aggr_stats->pkt_tx_sn = flexran_get_pdcp_tx_sn(mod_id, i, DEFAULT_DRB);
+	pdcp_aggr_stats->has_pkt_tx_sn =1;
+	
+	pdcp_aggr_stats->has_pkt_rx =1;
+	pdcp_aggr_stats->has_pkt_rx_bytes =1; 
+	pdcp_aggr_stats->has_pkt_rx_w =1;
+	pdcp_aggr_stats->has_pkt_rx_bytes_w =1;
+	pdcp_aggr_stats->has_pkt_rx_aiat =1;
+	pdcp_aggr_stats->has_pkt_rx_aiat_w =1;
+	pdcp_aggr_stats->has_pkt_rx_oo =1;
+
+	pdcp_aggr_stats->pkt_rx_sn = flexran_get_pdcp_rx_sn(mod_id, i, DEFAULT_DRB);
+	pdcp_aggr_stats->has_pkt_rx_sn =1;
+
+	pdcp_aggr_stats->sfn = flexran_get_pdcp_sfn(mod_id);
+	pdcp_aggr_stats->has_sfn =1;
+
+	ue_report[i]->pdcp_stats = pdcp_aggr_stats;
+
+      }
+    }
+  }  else {
+    LOG_D(FLEXRAN_AGENT, "no UE\n");
+  }     
+  
+  return 0;
+  
+ error:
+  LOG_W(FLEXRAN_AGENT, "Can't allocate PDCP stats\n");
+  
+  /* if (cell_report != NULL)
+        free(cell_report);
+  if (ue_report != NULL)
+        free(ue_report);
+  */
+  return -1;
+}
+
+
+
+int flexran_agent_register_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface) {
+  if (pdcp_agent_registered[mod_id]) {
+    LOG_E(PDCP, "PDCP agent for eNB %d is already registered\n", mod_id);
+    return -1;
+  }
+
+  //xface->flexran_pdcp_stats_measurement = NULL;
+
+  pdcp_agent_registered[mod_id] = 1;
+  agent_pdcp_xface[mod_id] = xface;
+
+  return 0;
+}
+
+int flexran_agent_unregister_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface) {
+
+  //xface->agent_ctxt = NULL;
+  //xface->flexran_pdcp_stats_measurement = NULL;
+
+  
+  pdcp_agent_registered[mod_id] = 0;
+  agent_pdcp_xface[mod_id] = NULL;
+
+  return 0;
+}
diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h
new file mode 100644
index 0000000000000000000000000000000000000000..83aac45406e17b5f5526898e45a5212475cd2e9b
--- /dev/null
+++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+/*! \file flexran_agent_pdcp.h
+ * \brief FlexRAN agent Control Module PDCP header
+ * \author shahab SHARIAT BAGHERI 
+ * \date 2017
+ * \version 0.1
+ */
+
+#ifndef FLEXRAN_AGENT_PDCP_H_
+#define FLEXRAN_AGENT_PDCP_H_
+
+#include "header.pb-c.h"
+#include "flexran.pb-c.h"
+#include "stats_messages.pb-c.h"
+#include "stats_common.pb-c.h"
+
+
+#include "flexran_agent_common.h"
+#include "flexran_agent_defs.h"
+#include "flexran_agent_pdcp_defs.h"
+#include "flexran_agent_ran_api.h"
+
+/**********************************
+ * FlexRAN agent - technology PDCP API
+ **********************************/
+
+/* Send to the controller all the pdcp stat updates that occured during this subframe*/
+int flexran_agent_pdcp_stats_reply(mid_t mod_id,       
+          const report_config_t *report_config,
+           Protocol__FlexUeStatsReport **ue_report,
+           Protocol__FlexCellStatsReport **cell_report);
+
+/* Get the stats from RAN API and aggregate them per USER*/
+void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id,
+					const mid_t ue_id,
+					Protocol__FlexPdcpStats *pdcp_aggr_stats);
+
+/*Register technology specific interface callbacks*/
+int flexran_agent_register_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface);
+
+/*Unregister technology specific callbacks*/
+int flexran_agent_unregister_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface*xface);
+
+#endif
diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp_defs.h b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp_defs.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2da72545af810f801ff8d65b5b9f8579a5f8184
--- /dev/null
+++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp_defs.h
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+#ifndef __FLEXRAN_AGENT_PDCP_PRIMITIVES_H__
+#define __FLEXRAN_AGENT_PDCP_PRIMITIVES_H__
+
+#include "flexran_agent_defs.h"
+#include "flexran.pb-c.h"
+#include "header.pb-c.h"
+
+ /*PDCP aggregated Packet stats  */
+/*
+typedef struct  pdcp_aggr_stats_s {
+  int32_t rnti; 
+
+  int32_t pkt_tx;
+  int32_t pkt_tx_bytes;
+  int32_t pkt_tx_sn;
+  int32_t pkt_tx_rate_s;
+  int32_t pkt_tx_throughput_s;
+  int32_t pkt_tx_aiat;
+  int32_t pkt_tx_aiat_s;
+
+  int32_t pkt_rx;
+  int32_t pkt_rx_bytes;
+  int32_t pkt_rx_sn;
+  int32_t pkt_rx_rate_s;
+  int32_t pkt_rx_goodput_s;
+  int32_t pkt_rx_aiat;
+  int32_t pkt_rx_aiat_s;
+  int32_t pkt_rx_oo;
+
+  
+} pdcp_aggr_stats_t;
+*/
+
+/* FLEXRAN AGENT-PDCP Interface */
+typedef struct {
+  
+  
+  // PDCP statistics
+  void (*flexran_pdcp_stats_measurement)(mid_t mod_id, uint16_t rnti, uint16_t seq_num,  uint32_t size);
+  
+} AGENT_PDCP_xface;
+
+#endif
diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
new file mode 100644
index 0000000000000000000000000000000000000000..43951ee95afb6adfb2dfd8febb70aa4326198f5e
--- /dev/null
+++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
@@ -0,0 +1,673 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+/*! \file flexran_agent_mac.c
+ * \brief FlexRAN agent Control Module RRC 
+ * \author shahab SHARIAT BAGHERI
+ * \date 2017
+ * \version 0.1
+ */
+
+#include "flexran_agent_rrc.h"
+
+
+#include "liblfds700.h"
+
+#include "log.h"
+
+/*Trigger boolean for RRC measurement*/
+bool triggered_rrc = false;
+
+/*Flags showing if an rrc agent has already been registered*/
+unsigned int rrc_agent_registered[NUM_MAX_ENB];
+
+/*Array containing the Agent-RRC interfaces*/
+AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
+
+
+void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) {
+  int size;
+  Protocol__FlexranMessage *msg = NULL;
+  Protocol__FlexHeader *header = NULL;
+  void *data;
+  int priority = 0;
+  err_code_t err_code;
+
+  int xid = 0;
+
+  if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0)
+    goto error;
+
+  Protocol__FlexUeStateChange *ue_state_change_msg;
+  ue_state_change_msg = malloc(sizeof(Protocol__FlexUeStateChange));
+  if(ue_state_change_msg == NULL) {
+    goto error;
+  }
+  protocol__flex_ue_state_change__init(ue_state_change_msg);
+  ue_state_change_msg->has_type = 1;
+  ue_state_change_msg->type = state_change;
+
+  Protocol__FlexUeConfig *config;
+  config = malloc(sizeof(Protocol__FlexUeConfig));
+  if (config == NULL) {
+    goto error;
+  }
+  protocol__flex_ue_config__init(config);
+  if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED) {
+    // Simply set the rnti of the UE
+    config->has_rnti = 1;
+    config->rnti = rnti;
+  } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED
+       || state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED) {
+        int i = find_UE_id(mod_id, rnti);
+      config->has_rnti = 1;
+      config->rnti = rnti;
+        if(flexran_get_time_alignment_timer(mod_id,i) != -1) {
+          config->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i);
+          config->has_time_alignment_timer = 1;
+        }
+        if(flexran_get_meas_gap_config(mod_id,i) != -1){
+          config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i);
+            config->has_meas_gap_config_pattern = 1;
+        }
+        if(config->has_meas_gap_config_pattern == 1 &&
+         config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) {
+        config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i);
+        config->has_meas_gap_config_sf_offset = 1;
+        }
+        //TODO: Set the SPS configuration (Optional)
+        //Not supported for now, so we do not set it
+
+        //TODO: Set the SR configuration (Optional)
+        //We do not set it for now
+
+        //TODO: Set the CQI configuration (Optional)
+        //We do not set it for now
+      
+      if(flexran_get_ue_transmission_mode(mod_id,i) != -1) {
+          config->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i);
+          config->has_transmission_mode = 1;
+        }
+
+      config->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i);
+        config->has_ue_aggregated_max_bitrate_ul = 1;
+
+      config->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i);
+        config->has_ue_aggregated_max_bitrate_dl = 1;
+
+        //TODO: Set the UE capabilities
+        Protocol__FlexUeCapabilities *c_capabilities;
+        c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities));
+        protocol__flex_ue_capabilities__init(c_capabilities);
+        //TODO: Set half duplex (FDD operation)
+        c_capabilities->has_half_duplex = 0;
+        c_capabilities->half_duplex = 1;//flexran_get_half_duplex(i);
+        //TODO: Set intra-frame hopping flag
+        c_capabilities->has_intra_sf_hopping = 0;
+        c_capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i);
+        //TODO: Set support for type 2 hopping with n_sb > 1
+        c_capabilities->has_type2_sb_1 = 0;
+        c_capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i);
+        //TODO: Set ue category
+        c_capabilities->has_ue_category = 0;
+        c_capabilities->ue_category = 1;//flexran_get_ue_category(i);
+        //TODO: Set UE support for resource allocation type 1
+        c_capabilities->has_res_alloc_type1 = 0;
+        c_capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i);
+        //Set the capabilites to the message
+        config->capabilities = c_capabilities;
+      
+        if(flexran_get_ue_transmission_antenna(mod_id,i) != -1) {
+        config->has_ue_transmission_antenna = 1;
+        config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i);
+        }
+
+        if(flexran_get_tti_bundling(mod_id,i) != -1) {
+        config->has_tti_bundling = 1;
+        config->tti_bundling = flexran_get_tti_bundling(mod_id,i);
+        }
+
+        if(flexran_get_maxHARQ_TX(mod_id,i) != -1){
+        config->has_max_harq_tx = 1;
+        config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i);
+        }
+
+        if(flexran_get_beta_offset_ack_index(mod_id,i) != -1) {
+        config->has_beta_offset_ack_index = 1;
+        config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i);
+        }
+
+        if(flexran_get_beta_offset_ri_index(mod_id,i) != -1) {
+        config->has_beta_offset_ri_index = 1;
+        config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i);
+        }
+
+        if(flexran_get_beta_offset_cqi_index(mod_id,i) != -1) {
+        config->has_beta_offset_cqi_index = 1;
+        config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i);
+        }
+
+        /* assume primary carrier */
+        if(flexran_get_ack_nack_simultaneous_trans(mod_id,i,0) != -1) {
+        config->has_ack_nack_simultaneous_trans = 1;
+        config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i,0);
+        }
+
+        if(flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) {
+        config->has_simultaneous_ack_nack_cqi = 1;
+        config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i);
+        }
+
+        if(flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) {
+        config->has_aperiodic_cqi_rep_mode = 1;
+        int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i);
+        if (mode > 4) {
+          config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE;
+        } else {
+          config->aperiodic_cqi_rep_mode = mode;
+        }
+        }
+
+        if(flexran_get_tdd_ack_nack_feedback_mode(mod_id, i) != -1) {
+        config->has_tdd_ack_nack_feedback = 1;
+        config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id,i);
+        }
+
+        if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) {
+        config->has_ack_nack_repetition_factor = 1;
+        config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i);
+        }
+
+        if(flexran_get_extended_bsr_size(mod_id, i) != -1) {
+        config->has_extended_bsr_size = 1;
+        config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i);
+        }
+
+      config->has_pcell_carrier_index = 1;
+      config->pcell_carrier_index = UE_PCCID(mod_id, i);
+        //TODO: Set carrier aggregation support (boolean)
+        config->has_ca_support = 0;
+        config->ca_support = 0;
+        if(config->has_ca_support){
+        //TODO: Set cross carrier scheduling support (boolean)
+        config->has_cross_carrier_sched_support = 1;
+        config->cross_carrier_sched_support = 0;
+        //TODO: Set secondary cells configuration
+        // We do not set it for now. No carrier aggregation support
+        
+        //TODO: Set deactivation timer for secondary cell
+        config->has_scell_deactivation_timer = 0;
+        config->scell_deactivation_timer = 0;
+        }
+  } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) {
+    // TODO: Not supported for now. Leave blank
+  }
+
+  ue_state_change_msg->config = config;
+  msg = malloc(sizeof(Protocol__FlexranMessage));
+  if (msg == NULL) {
+    goto error;
+  }
+  protocol__flexran_message__init(msg);
+  msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG;
+  msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
+  msg->ue_state_change_msg = ue_state_change_msg;
+
+  data = flexran_agent_pack_message(msg, &size);
+  /*Send sr info using the MAC channel of the eNB*/
+  if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
+    err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
+    goto error;
+  }
+
+  LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
+  return;
+ error:
+  LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d \n",err_code);
+}
+
+
+
+int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) {
+  if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG)
+    goto error;
+  free(msg->ue_state_change_msg->header);
+  //TODO: Free the contents of the UE config structure
+  free(msg->ue_state_change_msg);
+  free(msg);
+  return 0;
+
+ error:
+  //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+  return -1;
+}
+
+/* this is called by RRC as a part of rrc xface  . The controller previously requested  this*/ 
+void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t*  measResults) {
+
+  int i;
+  // int                   priority = 0; // Warning Preventing
+  // void                  *data;
+  // int                   size;
+  // err_code_t             err_code = -100;
+  triggered_rrc = true;
+  int num;
+
+  num = flexran_get_num_ues (mod_id);
+
+  meas_stats = malloc(sizeof(rrc_meas_stats) * num); 
+
+  for (i = 0; i < num; i++){
+    meas_stats[i].rnti = flexran_get_ue_crnti(mod_id, i);
+    meas_stats[i].meas_id = flexran_get_rrc_pcell_measid(mod_id,i);
+    meas_stats[i].rsrp =  flexran_get_rrc_pcell_rsrp(mod_id,i) - 140;
+    // measResults->measResultPCell.rsrpResult - 140;
+    meas_stats[i].rsrq =  flexran_get_rrc_pcell_rsrq(mod_id,i)/2 - 20;
+    // (measResults->measResultPCell.rsrqResult)/2 - 20;                          
+    
+  }
+    // repl->neigh_meas = NULL;
+
+  // if (meas->measResultNeighCells != NULL) {
+  //   /*
+  //   * Neighboring cells measurements performed by UE.
+  //   */
+  //   NeighCellsMeasurements *neigh_meas;
+  //   neigh_meas = malloc(sizeof(NeighCellsMeasurements));
+  //   if (neigh_meas == NULL)
+  //     goto error;
+  //   neigh_cells_measurements__init(neigh_meas);
+
+  //   /* EUTRAN RRC Measurements. */
+  //   if (meas->measResultNeighCells->present ==
+  //         MeasResults__measResultNeighCells_PR_measResultListEUTRA) {
+
+  //     MeasResultListEUTRA_t meas_list = meas->measResultNeighCells->
+  //                         choice.measResultListEUTRA;
+  //     /* Set the number of EUTRAN measurements present in report. */
+  //     neigh_meas->n_eutra_meas = meas_list.list.count;
+  //     if (neigh_meas->n_eutra_meas > 0) {
+  //       /* Initialize EUTRAN measurements. */
+  //       EUTRAMeasurements **eutra_meas;
+  //       eutra_meas = malloc(sizeof(EUTRAMeasurements *) *
+  //                         neigh_meas->n_eutra_meas);
+  //       for (i = 0; i < neigh_meas->n_eutra_meas; i++) {
+  //         eutra_meas[i] = malloc(sizeof(EUTRAMeasurements));
+  //         eutra_measurements__init(eutra_meas[i]);
+  //         /* Fill in the physical cell identifier. */
+  //         eutra_meas[i]->has_phys_cell_id = 1;
+  //         eutra_meas[i]->phys_cell_id = meas_list.list.array[i]->
+  //                                 physCellId;
+  //         // log_i(agent,"PCI of Target %d", eutra_meas[i]->phys_cell_id);
+  //         /* Check for Reference signal measurements. */
+  //         if (&(meas_list.list.array[i]->measResult)) {
+  //           /* Initialize Ref. signal measurements. */
+  //           EUTRARefSignalMeas *meas_result;
+  //           meas_result = malloc(sizeof(EUTRARefSignalMeas));
+  //           eutra_ref_signal_meas__init(meas_result);
+
+  //           if (meas_list.list.array[i]->measResult.rsrpResult) {
+  //             meas_result->has_rsrp = 1;
+  //             meas_result->rsrp = RSRP_meas_mapping[*(meas_list.
+  //                   list.array[i]->measResult.rsrpResult)];
+  //             // log_i(agent,"RSRP of Target %d", meas_result->rsrp);
+  //           }
+
+  //           if (meas_list.list.array[i]->measResult.rsrqResult) {
+  //             meas_result->has_rsrq = 1;
+  //             meas_result->rsrq = RSRQ_meas_mapping[*(meas_list.
+  //                   list.array[i]->measResult.rsrqResult)];
+  //             // log_i(agent,"RSRQ of Target %d", meas_result->rsrq);
+  //           }
+  //           eutra_meas[i]->meas_result = meas_result;
+  //         }
+  //         /* Check for CGI measurements. */
+  //         if (meas_list.list.array[i]->cgi_Info) {
+  //           /* Initialize CGI measurements. */
+  //           EUTRACgiMeasurements *cgi_meas;
+  //           cgi_meas = malloc(sizeof(EUTRACgiMeasurements));
+  //           eutra_cgi_measurements__init(cgi_meas);
+
+  //           /* EUTRA Cell Global Identity (CGI). */
+  //           CellGlobalIdEUTRA *cgi;
+  //           cgi = malloc(sizeof(CellGlobalIdEUTRA));
+  //           cell_global_id__eutra__init(cgi);
+
+  //           cgi->has_cell_id = 1;
+  //           CellIdentity_t cId = meas_list.list.array[i]->
+  //                     cgi_Info->cellGlobalId.cellIdentity;
+  //           cgi->cell_id = (cId.buf[0] << 20) + (cId.buf[1] << 12) +
+  //                   (cId.buf[2] << 4) + (cId.buf[3] >> 4);
+
+  //           /* Public land mobile network identifier of neighbor
+  //            * cell.
+  //            */
+  //           PlmnIdentity *plmn_id;
+  //           plmn_id = malloc(sizeof(PlmnIdentity));
+  //           plmn_identity__init(plmn_id);
+
+  //           MNC_t mnc = meas_list.list.array[i]->
+  //                 cgi_Info->cellGlobalId.plmn_Identity.mnc;
+
+  //           plmn_id->has_mnc = 1;
+  //           plmn_id->mnc = 0;
+  //           for (m = 0; m < mnc.list.count; m++) {
+  //             plmn_id->mnc += *mnc.list.array[m] *
+  //               ((uint32_t) pow(10, mnc.list.count - m - 1));
+  //           }
+
+  //           MCC_t *mcc = meas_list.list.array[i]->
+  //                 cgi_Info->cellGlobalId.plmn_Identity.mcc;
+
+  //           plmn_id->has_mcc = 1;
+  //           plmn_id->mcc = 0;
+  //           for (m = 0; m < mcc->list.count; m++) {
+  //             plmn_id->mcc += *mcc->list.array[m] *
+  //               ((uint32_t) pow(10, mcc->list.count - m - 1));
+  //           }
+
+  //           TrackingAreaCode_t tac = meas_list.list.array[i]->
+  //                         cgi_Info->trackingAreaCode;
+
+  //           cgi_meas->has_tracking_area_code = 1;
+  //           cgi_meas->tracking_area_code = (tac.buf[0] << 8) +
+  //                               (tac.buf[1]);
+
+  //           PLMN_IdentityList2_t *plmn_l = meas_list.list.array[i]->
+  //                         cgi_Info->plmn_IdentityList;
+
+  //           cgi_meas->n_plmn_id = plmn_l->list.count;
+  //           /* Set the PLMN ID list in CGI measurements. */
+  //           PlmnIdentity **plmn_id_l;
+  //           plmn_id_l = malloc(sizeof(PlmnIdentity *) *
+  //                           cgi_meas->n_plmn_id);
+
+  //           MNC_t mnc2;
+  //           MCC_t *mcc2;
+  //           for (m = 0; m < cgi_meas->n_plmn_id; m++) {
+  //             plmn_id_l[m] = malloc(sizeof(PlmnIdentity));
+  //             plmn_identity__init(plmn_id_l[m]);
+
+  //             mnc2 = plmn_l->list.array[m]->mnc;
+  //             plmn_id_l[m]->has_mnc = 1;
+  //             plmn_id_l[m]->mnc = 0;
+  //             for (k = 0; k < mnc2.list.count; k++) {
+  //               plmn_id_l[m]->mnc += *mnc2.list.array[k] *
+  //               ((uint32_t) pow(10, mnc2.list.count - k - 1));
+  //             }
+
+  //             mcc2 = plmn_l->list.array[m]->mcc;
+  //             plmn_id_l[m]->has_mcc = 1;
+  //             plmn_id_l[m]->mcc = 0;
+  //             for (k = 0; k < mcc2->list.count; k++) {
+  //               plmn_id_l[m]->mcc += *mcc2->list.array[k] *
+  //               ((uint32_t) pow(10, mcc2->list.count - k - 1));
+  //             }
+  //           }
+  //           cgi_meas->plmn_id = plmn_id_l;
+  //           eutra_meas[i]->cgi_meas = cgi_meas;
+  //         }
+  //       }
+  //       neigh_meas->eutra_meas = eutra_meas;
+  //     }
+  //   }
+  //   repl->neigh_meas = neigh_meas;
+  // }
+  /* Attach the RRC measurement reply message to RRC measurements message. */
+  // mrrc_meas->repl = repl;
+  /* Attach RRC measurement message to triggered event message. */
+  // te->mrrc_meas = mrrc_meas;
+  // te->has_action = 0;
+  /* Attach the triggered event message to main message. */
+  // reply->te = te;
+
+  /* Send the report to controller. */
+  // if (flexran_agent_msg_send(b_id, reply) < 0) {
+  //   goto error;
+  // }
+
+  /* Free the measurement report received from UE. */
+  // ASN_STRUCT_FREE(asn_DEF_MeasResults, p->meas);
+  /* Free the params. */
+  // free(p);
+
+
+  // stats_reply_msg->cell_report = cell_report;
+    
+  // stats_reply_msg->ue_report = ue_report;
+  
+  // msg = malloc(sizeof(Protocol__FlexranMessage));
+  // if(msg == NULL)
+  //   goto error;
+  // protocol__flexran_message__init(msg);
+  // msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG;
+  // msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME;
+  // msg->stats_reply_msg = stats_reply_msg;
+  
+  // data = flexran_agent_pack_message(msg, &size);
+  
+  
+  // if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
+  
+  //   err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
+  //   goto error;
+  // }
+  
+  //  LOG_I(FLEXRAN_AGENT,"RRC Trigger is done  \n");
+
+  return;
+
+  // error:
+
+    // LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d \n",err_code);
+    /* Free the measurement report received from UE. */
+    // ASN_STRUCT_FREE(asn_DEF_MeasResults, p->meas);
+    /* Free the params. */
+    // free(p);
+    // return -1;
+}
+
+
+int flexran_agent_rrc_stats_reply(mid_t mod_id,       
+          const report_config_t *report_config,
+           Protocol__FlexUeStatsReport **ue_report,
+           Protocol__FlexCellStatsReport **cell_report) {
+
+
+  // Protocol__FlexHeader *header;
+  int i,j;
+
+  /* Allocate memory for list of UE reports */
+  if (report_config->nr_ue > 0) {
+
+    for (i = 0; i < report_config->nr_ue; i++) {
+      
+      /* Check flag for creation of buffer status report */
+      if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS) {
+      	
+        /*Source Cell*/
+        Protocol__FlexRrcMeasurements *rrc_measurements;
+      	rrc_measurements = malloc(sizeof(Protocol__FlexRrcMeasurements));
+      	if (rrc_measurements == NULL)
+      	  goto error;
+      	protocol__flex_rrc_measurements__init(rrc_measurements);
+      	
+      	rrc_measurements->measid = flexran_get_rrc_pcell_measid(mod_id,i);
+      	rrc_measurements->has_measid = 1;
+      	
+      	rrc_measurements->pcell_rsrp = flexran_get_rrc_pcell_rsrp(mod_id,i);
+      	rrc_measurements->has_pcell_rsrp = 1;
+      	
+      	rrc_measurements->pcell_rsrq = flexran_get_rrc_pcell_rsrq(mod_id,i);
+      	rrc_measurements->has_pcell_rsrq = 1 ;
+
+        
+        /* Target Cell, Neghibouring*/
+        Protocol__FlexNeighCellsMeasurements *neigh_meas;
+        neigh_meas = malloc(sizeof(Protocol__FlexNeighCellsMeasurements));
+        if (neigh_meas == NULL)
+          goto error;
+        protocol__flex_neigh_cells_measurements__init(neigh_meas);
+         
+        
+        neigh_meas->n_eutra_meas = flexran_get_rrc_num_ncell(mod_id, i);
+
+        Protocol__FlexEutraMeasurements **eutra_meas = NULL;
+
+        if (neigh_meas->n_eutra_meas > 0){
+          
+          eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas);
+          if (eutra_meas == NULL)
+            goto error;
+          
+          for (j = 0; j < neigh_meas->n_eutra_meas; j++ ){
+
+              eutra_meas[j] = malloc(sizeof(Protocol__FlexEutraMeasurements));
+              if (eutra_meas[j] == NULL)
+                goto error;
+
+              protocol__flex_eutra_measurements__init(eutra_meas[j]);
+
+              eutra_meas[j]->phys_cell_id = flexran_get_rrc_neigh_phy_cell_id(mod_id, i, j);
+              eutra_meas[j]->has_phys_cell_id = 1;
+
+
+              /*TODO: Extend for CGI and PLMNID*/
+
+              Protocol__FlexEutraRefSignalMeas *meas_result;
+              meas_result = malloc(sizeof(Protocol__FlexEutraRefSignalMeas));
+
+              protocol__flex_eutra_ref_signal_meas__init(meas_result);     
+
+              meas_result->rsrp = flexran_get_rrc_neigh_rsrp(mod_id, i, eutra_meas[j]->phys_cell_id);
+              meas_result->has_rsrp = 1;
+
+              meas_result->rsrq = flexran_get_rrc_neigh_rsrq(mod_id, i, eutra_meas[j]->phys_cell_id);
+              meas_result->has_rsrq = 1;
+
+              eutra_meas[j]->meas_result = meas_result;
+             
+          }    
+
+           neigh_meas->eutra_meas = eutra_meas;   
+
+           rrc_measurements->neigh_meas = neigh_meas;
+       
+        }
+
+      	 ue_report[i]->rrc_measurements = rrc_measurements;
+      	
+      }
+
+    } 
+
+  }
+
+  /* To be considered for RRC signaling of cell*/ 
+  // if (report_config->nr_cc > 0) { 
+    
+            
+  //           // Fill in the Cell reports
+  //           for (i = 0; i < report_config->nr_cc; i++) {
+
+
+  //                     /* Check flag for creation of noise and interference report */
+  //                     if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) {
+  //                           // TODO: Fill in the actual noise and interference report for this cell
+  //                           Protocol__FlexNoiseInterferenceReport *ni_report;
+  //                           ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport));
+  //                           if(ni_report == NULL)
+  //                             goto error;
+  //                           protocol__flex_noise_interference_report__init(ni_report);
+  //                           // Current frame and subframe number
+  //                           ni_report->sfn_sf = flexran_get_sfn_sf(enb_id);
+  //                           ni_report->has_sfn_sf = 1;
+  //                           //TODO:Received interference power in dbm
+  //                           ni_report->rip = 0;
+  //                           ni_report->has_rip = 1;
+  //                           //TODO:Thermal noise power in dbm
+  //                           ni_report->tnp = 0;
+  //                           ni_report->has_tnp = 1;
+
+  //                           ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0);
+  //                           ni_report->has_p0_nominal_pucch = 1;
+  //                           cell_report[i]->noise_inter_report = ni_report;
+  //                     }
+  //           }
+            
+
+      
+            
+  // }
+
+  return 0;
+
+ error:
+
+  for (i = 0; i < report_config->nr_ue; i++){
+
+      if (ue_report[i]->rrc_measurements->neigh_meas != NULL){
+          for (j = 0; j < flexran_get_rrc_num_ncell(mod_id, i); j++){
+
+             free(ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]);
+        }
+        free(ue_report[i]->rrc_measurements->neigh_meas);
+      }
+  }
+
+  if (cell_report != NULL)
+        free(cell_report);
+  if (ue_report != NULL)
+        free(ue_report);
+
+  return -1;
+}
+
+
+int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) {
+  if (rrc_agent_registered[mod_id]) {
+    LOG_E(RRC, "RRC agent for eNB %d is already registered\n", mod_id);
+    return -1;
+  }
+
+//  xface->flexran_agent_send_update_rrc_stats = flexran_agent_send_update_rrc_stats;
+  
+  xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change;
+  xface->flexran_trigger_rrc_measurements = flexran_trigger_rrc_measurements;
+
+  rrc_agent_registered[mod_id] = 1;
+  agent_rrc_xface[mod_id] = xface;
+
+  return 0;
+}
+
+int flexran_agent_unregister_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) {
+
+  //xface->agent_ctxt = NULL;
+//  xface->flexran_agent_send_update_rrc_stats = NULL;
+
+  xface->flexran_agent_notify_ue_state_change = NULL;
+  xface->flexran_trigger_rrc_measurements = NULL;
+  rrc_agent_registered[mod_id] = 0;
+  agent_rrc_xface[mod_id] = NULL;
+
+  return 0;
+}
diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h
new file mode 100644
index 0000000000000000000000000000000000000000..780976893e575f32c22edcf8066191e47d981ed3
--- /dev/null
+++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+/*! \file flexran_agent_rrc.h
+ * \brief FlexRAN agent Control Module RRC header
+ * \author shahab SHARIAT BAGHERI 
+ * \date 2017
+ * \version 0.1
+ */
+
+#ifndef FLEXRAN_AGENT_RRC_H_
+#define FLEXRAN_AGENT_RRC_H_
+
+#include "header.pb-c.h"
+#include "flexran.pb-c.h"
+#include "stats_messages.pb-c.h"
+#include "stats_common.pb-c.h"
+
+
+#include "flexran_agent_common.h"
+#include "flexran_agent_rrc_defs.h"
+
+
+/* Initialization function for the agent structures etc */
+void flexran_agent_init_rrc_agent(mid_t mod_id);
+
+/* UE state change message constructor and destructor */
+void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change);
+int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg);
+
+
+/**********************************
+ * FlexRAN agent - technology RRC API
+ **********************************/
+
+/* Send to the controller all the rrc stat updates that occured during this subframe*/
+// void flexran_agent_send_update_rrc_stats(mid_t mod_id);
+
+/* this is called by RRC as a part of rrc xface  . The controller previously requested  this*/ 
+void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t *);
+
+/* Statistics reply protocol message constructor and destructor */
+int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report);
+int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexranMessage *msg);
+
+/*Register technology specific interface callbacks*/
+int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface);
+
+/*Unregister technology specific callbacks*/
+int flexran_agent_unregister_rrc_xface(mid_t mod_id, AGENT_RRC_xface*xface);
+
+#endif
diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h
new file mode 100644
index 0000000000000000000000000000000000000000..8c336abef1a54e3acf3e2f571251d697a595a373
--- /dev/null
+++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+
+/*! \file flexran_agent_rrc_defs.h
+ * \brief FlexRAN agent - RRC interface primitives
+ * \author shahab SHARIAT BAGHERI
+ * \date 2017
+ * \version 0.1
+ * \mail 
+ */
+
+#ifndef __FLEXRAN_AGENT_RRC_PRIMITIVES_H__
+#define __FLEXRAN_AGENT_RRC_PRIMITIVES_H__
+
+#include "flexran_agent_defs.h"
+#include "flexran.pb-c.h"
+#include "header.pb-c.h"
+#include "MeasResults.h"
+
+#define RINGBUFFER_SIZE 100
+
+
+typedef struct 
+{
+   int32_t rnti; 
+   int32_t meas_id;
+   int32_t rsrp;
+   int32_t rsrq;
+
+   /*To Be Extended*/
+}rrc_meas_stats;
+
+/* RRC CMI statistics */
+rrc_meas_stats * meas_stats;
+
+
+/* FLEXRAN AGENT-RRC Interface */
+typedef struct {
+  
+  
+   /// Notify the controller for a state change of a particular UE, by sending the proper
+  /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
+  void (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
+                 uint8_t state_change);
+
+  void (*flexran_trigger_rrc_measurements)(mid_t mod_id, MeasResults_t*  measResults);
+  
+} AGENT_RRC_xface;
+
+#endif
diff --git a/openair2/ENB_APP/L1_paramdef.h b/openair2/ENB_APP/L1_paramdef.h
new file mode 100644
index 0000000000000000000000000000000000000000..b062235ff69b6aaefb5cc40bff392419df524df3
--- /dev/null
+++ b/openair2/ENB_APP/L1_paramdef.h
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file openair2/ENB_APP/L1_paramdef.f
+ * \brief definition of configuration parameters for all eNodeB modules 
+ * \author Francois TABURET
+ * \date 2017
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+
+
+/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+
+
+/* L1 configuration parameters names   */
+#define CONFIG_STRING_L1_CC                                "num_cc"
+#define CONFIG_STRING_L1_LOCAL_N_IF_NAME                   "local_n_if_name"
+#define CONFIG_STRING_L1_LOCAL_N_ADDRESS                   "local_n_address"
+#define CONFIG_STRING_L1_REMOTE_N_ADDRESS                  "remote_n_address"
+#define CONFIG_STRING_L1_LOCAL_N_PORTC                     "local_n_portc"
+#define CONFIG_STRING_L1_REMOTE_N_PORTC                    "remote_n_portc"
+#define CONFIG_STRING_L1_LOCAL_N_PORTD                     "local_n_portd"
+#define CONFIG_STRING_L1_REMOTE_N_PORTD                    "remote_n_portd"
+#define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE            "tr_n_preference"
+
+/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                            L1 configuration parameters                                                                             */
+/*   optname                                         helpstr   paramflags    XXXptr              defXXXval                  type           numelt     */
+/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
+#define L1PARAMS_DESC { \
+{CONFIG_STRING_L1_CC,                                NULL,      0,         uptr:NULL,           defintval:1,               TYPE_UINT,     0},         \
+{CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE,            NULL,      0,         strptr:NULL,         defstrval:"local_mac",     TYPE_STRING,   0},         \
+{CONFIG_STRING_L1_LOCAL_N_IF_NAME,                   NULL,      0,         strptr:NULL,         defstrval:"lo",            TYPE_STRING,   0},         \
+{CONFIG_STRING_L1_LOCAL_N_ADDRESS,                   NULL,      0,         strptr:NULL,         defstrval:"127.0.0.1",     TYPE_STRING,   0},         \
+{CONFIG_STRING_L1_REMOTE_N_ADDRESS,                  NULL,      0,         strptr:NULL,         defstrval:"127.0.0.2",     TYPE_STRING,   0},         \
+{CONFIG_STRING_L1_LOCAL_N_PORTC,                     NULL,      0,         uptr:NULL,           defintval:50030,           TYPE_UINT,     0},         \
+{CONFIG_STRING_L1_REMOTE_N_PORTC,                    NULL,      0,         uptr:NULL,           defintval:50030,           TYPE_UINT,     0},         \
+{CONFIG_STRING_L1_LOCAL_N_PORTD,                     NULL,      0,         uptr:NULL,           defintval:50031,           TYPE_UINT,     0},         \
+{CONFIG_STRING_L1_REMOTE_N_PORTD,                    NULL,      0,         uptr:NULL,           defintval:50031,           TYPE_UINT,     0},         \
+}
+#define L1_CC_IDX                                          0
+#define L1_TRANSPORT_N_PREFERENCE_IDX                      1
+#define L1_LOCAL_N_IF_NAME_IDX                             2
+#define L1_LOCAL_N_ADDRESS_IDX                             3
+#define L1_REMOTE_N_ADDRESS_IDX                            4
+#define L1_LOCAL_N_PORTC_IDX                               5
+#define L1_REMOTE_N_PORTC_IDX                              6
+#define L1_LOCAL_N_PORTD_IDX                               7
+#define L1_REMOTE_N_PORTD_IDX                              8
+
+/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
diff --git a/openair2/ENB_APP/MACRLC_paramdef.h b/openair2/ENB_APP/MACRLC_paramdef.h
new file mode 100644
index 0000000000000000000000000000000000000000..4e732fe942bee9528bf6bde32e60e4b2cd2cbba6
--- /dev/null
+++ b/openair2/ENB_APP/MACRLC_paramdef.h
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file openair2/ENB_APP/MACRLC_paramdef.f
+ * \brief definition of configuration parameters for all eNodeB modules 
+ * \author Francois TABURET
+ * \date 2017
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
+
+
+/* MACRLC configuration parameters names   */
+#define CONFIG_STRING_MACRLC_CC                            "num_cc"
+#define CONFIG_STRING_MACRLC_TRANSPORT_N_PREFERENCE        "tr_n_preference"
+#define CONFIG_STRING_MACRLC_LOCAL_N_IF_NAME               "local_n_if_name"
+#define CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS               "local_n_address"
+#define CONFIG_STRING_MACRLC_REMOTE_N_ADDRESS              "remote_n_address"
+#define CONFIG_STRING_MACRLC_LOCAL_N_PORTC                 "local_n_portc"
+#define CONFIG_STRING_MACRLC_REMOTE_N_PORTC                "remote_n_portc"
+#define CONFIG_STRING_MACRLC_LOCAL_N_PORTD                 "local_n_portd"
+#define CONFIG_STRING_MACRLC_REMOTE_N_PORTD                "remote_n_portd"
+#define CONFIG_STRING_MACRLC_TRANSPORT_S_PREFERENCE        "tr_s_preference"
+#define CONFIG_STRING_MACRLC_LOCAL_S_IF_NAME               "local_s_if_name"
+#define CONFIG_STRING_MACRLC_LOCAL_S_ADDRESS               "local_s_address"
+#define CONFIG_STRING_MACRLC_REMOTE_S_ADDRESS              "remote_s_address"
+#define CONFIG_STRING_MACRLC_LOCAL_S_PORTC                 "local_s_portc"
+#define CONFIG_STRING_MACRLC_REMOTE_S_PORTC                "remote_s_portc"
+#define CONFIG_STRING_MACRLC_LOCAL_S_PORTD                 "local_s_portd"
+#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD                "remote_s_portd"
+
+
+/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                            MacRLC  configuration parameters                                                                           */
+/*   optname                                            helpstr   paramflags    XXXptr              defXXXval                  type           numelt     */
+/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
+#define MACRLCPARAMS_DESC { \
+{CONFIG_STRING_MACRLC_CC,                                NULL,     0,          uptr:NULL,           defintval:50011,           TYPE_UINT,     0},        \
+{CONFIG_STRING_MACRLC_TRANSPORT_N_PREFERENCE,            NULL,     0,          strptr:NULL,         defstrval:"local_L1",      TYPE_STRING,   0},        \
+{CONFIG_STRING_MACRLC_LOCAL_N_IF_NAME,                   NULL,     0,          strptr:NULL,         defstrval:"lo",            TYPE_STRING,   0},        \
+{CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS,                   NULL,     0,          strptr:NULL,         defstrval:"127.0.0.1",     TYPE_STRING,   0},        \
+{CONFIG_STRING_MACRLC_REMOTE_N_ADDRESS,                  NULL,     0,          uptr:NULL,           defstrval:"127.0.0.2",     TYPE_STRING,   0},        \
+{CONFIG_STRING_MACRLC_LOCAL_N_PORTC,                     NULL,     0,          uptr:NULL,           defintval:50010,           TYPE_UINT,     0},        \
+{CONFIG_STRING_MACRLC_REMOTE_N_PORTC,                    NULL,     0,          uptr:NULL,           defintval:50010,           TYPE_UINT,     0},        \
+{CONFIG_STRING_MACRLC_LOCAL_N_PORTD,                     NULL,     0,          uptr:NULL,           defintval:50011,           TYPE_UINT,     0},        \
+{CONFIG_STRING_MACRLC_REMOTE_N_PORTD,                    NULL,     0,          uptr:NULL,           defintval:50011,           TYPE_UINT,     0},        \
+{CONFIG_STRING_MACRLC_TRANSPORT_S_PREFERENCE,            NULL,     0,          strptr:NULL,         defstrval:"local_RRC",     TYPE_STRING,   0},        \
+{CONFIG_STRING_MACRLC_LOCAL_S_IF_NAME,                   NULL,     0,          strptr:NULL,         defstrval:"lo",            TYPE_STRING,   0},        \
+{CONFIG_STRING_MACRLC_LOCAL_S_ADDRESS,                   NULL,     0,          uptr:NULL,           defstrval:"127.0.0.1",     TYPE_STRING,   0},        \
+{CONFIG_STRING_MACRLC_REMOTE_S_ADDRESS,                  NULL,     0,          uptr:NULL,           defstrval:"127.0.0.2",     TYPE_STRING,   0},        \
+{CONFIG_STRING_MACRLC_LOCAL_S_PORTC,                     NULL,     0,          uptr:NULL,           defintval:50020,           TYPE_UINT,     0},        \
+{CONFIG_STRING_MACRLC_REMOTE_S_PORTC,                    NULL,     0,          uptr:NULL,           defintval:50020,           TYPE_UINT,     0},        \
+{CONFIG_STRING_MACRLC_LOCAL_S_PORTD,                     NULL,     0,          uptr:NULL,           defintval:50021,           TYPE_UINT,     0},        \
+{CONFIG_STRING_MACRLC_REMOTE_S_PORTD,                    NULL,     0,          uptr:NULL,           defintval:50021,           TYPE_UINT,     0},        \
+}
+#define MACRLC_CC_IDX                                          0
+#define MACRLC_TRANSPORT_N_PREFERENCE_IDX                      1
+#define MACRLC_LOCAL_N_IF_NAME_IDX                             2
+#define MACRLC_LOCAL_N_ADDRESS_IDX                             3
+#define MACRLC_REMOTE_N_ADDRESS_IDX                            4
+#define MACRLC_LOCAL_N_PORTC_IDX                               5
+#define MACRLC_REMOTE_N_PORTC_IDX                              6
+#define MACRLC_LOCAL_N_PORTD_IDX                               7
+#define MACRLC_REMOTE_N_PORTD_IDX                              8
+#define MACRLC_TRANSPORT_S_PREFERENCE_IDX                      9
+#define MACRLC_LOCAL_S_IF_NAME_IDX                             10
+#define MACRLC_LOCAL_S_ADDRESS_IDX                             11
+#define MACRLC_REMOTE_S_ADDRESS_IDX                            12
+#define MACRLC_LOCAL_S_PORTC_IDX                               13
+#define MACRLC_REMOTE_S_PORTC_IDX                              14
+#define MACRLC_LOCAL_S_PORTD_IDX                               15
+#define MACRLC_REMOTE_S_PORTD_IDX                              16
+/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto
index ac939b828cc13399511a808a92159919285b7d39..f734686f011dcb1899a3bb95a52a92f4c6076572 100644
--- a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto
@@ -38,6 +38,11 @@ message flex_cell_config {
 	optional uint32 srs_mac_up_pts = 32;		// Boolean value. See TS 36.211, section 5.5.3.2. TDD only
 	optional uint32 enable_64QAM = 33;		// One of the FLEQ_* enum values
 	optional uint32 carrier_index = 34;		// Carrier component index
+	optional uint32 dl_freq = 35;        // operating downlink frequency
+	optional uint32 ul_freq = 36;       // operating uplink frequency 
+	optional uint32 eutra_band= 37;       // operating band 
+	optional int32 dl_pdsch_power = 38;       // operating downlink power 
+	optional int32 ul_pusch_power = 39;       // operating uplink power
 }
 
 message flex_ue_config {
@@ -76,6 +81,7 @@ message flex_ue_config {
 	optional uint32 pcell_carrier_index = 27;     // Index of primary cell
 	repeated flex_scell_config scell_config = 28;  // Secondary cells configuration
 	optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell
+	optional uint64 imsi = 30;
 }
 
 message flex_lc_ue_config {
diff --git a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto
index 0f7e34de156599a448265e2846b9b69c83aea5c6..ef0eea3bd2eb9ed7062ec11195e6856d246a806c 100644
--- a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto
@@ -3,4 +3,4 @@ package protocol;
 
 enum flex_control_delegation_type {
      FLCDT_MAC_DL_UE_SCHEDULER = 1;		// DL UE scheduler delegation
-}
\ No newline at end of file
+}
diff --git a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto
index c92f171b0ee9e21d163633b86c021e74aa47b641..29e072383550fce0fc6dbabc2265fd79e1e62ed5 100644
--- a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto
@@ -16,6 +16,12 @@ message flex_dl_data {
 	optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA
 }
 
+
+message flex_ul_data {
+        optional uint32 rnti = 1;
+        optional flex_ul_dci ul_dci = 2;
+}
+
 //
 // Body of the RAR scheduler configuration
 //
@@ -56,4 +62,4 @@ message flex_pdcch_ofdm_sym_count {
 enum flex_broadcast_type {
      FLBT_BCCH = 0;
      FLBT_PCCH = 1;
-}
\ No newline at end of file
+}
diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto
index 8c0c300efea152c1b5a3943807504d5d1295bfaf..b54fc171c6acb831466726e40ec33ed3e941bb17 100644
--- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto
@@ -8,6 +8,7 @@ import "config_messages.proto";
 import "controller_commands.proto";
 import "control_delegation.proto";
 
+
 message flexran_message {
        optional flexran_direction msg_dir = 100;
 	oneof msg {
@@ -28,6 +29,8 @@ message flexran_message {
 	      flex_ue_state_change ue_state_change_msg = 15;
 	      flex_control_delegation control_delegation_msg = 16;
 	      flex_agent_reconfiguration agent_reconfiguration_msg = 17;
+	      flex_rrc_triggering rrc_triggering = 18;
+	      flex_ul_mac_config ul_mac_config_msg = 19;
 	}
 }
 
@@ -130,6 +133,7 @@ message flex_enb_config_reply {
 	optional flex_header header = 1;
 	optional uint32 eNB_id = 2;		// Unique id to distinguish the eNB
 	repeated flex_cell_config cell_config = 3;
+        optional uint32 device_spec = 4;
 }
 
 message flex_ue_config_request {
@@ -163,6 +167,18 @@ message flex_dl_mac_config {
 	repeated flex_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC
 }
 
+message flex_ul_mac_config {
+	optional flex_header header = 1;
+ 	optional uint32 sfn_sf = 2;
+	repeated flex_ul_data ul_ue_data = 3;
+}
+
+message flex_rrc_triggering {
+
+	optional flex_header header = 1;
+	optional string rrc_trigger = 2;	
+}
+
 //
 // UE state change message
 //
@@ -190,7 +206,7 @@ message flex_control_delegation {
 
 message flex_agent_reconfiguration {
 	optional flex_header header = 1;
-	optional string policy = 2;		// The policy changes using YAML syntax in string format
+	optional string policy = 2;		// The policy changes using YAML syntax in string format    
 }
 
 // Extensions of the echo request and reply
diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto
index 939429f51fe134c644d14dce5097154bea17e280..8900b934920eca605cce1746c2aa014ef8564bce 100644
--- a/openair2/ENB_APP/MESSAGES/V2/header.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/header.proto
@@ -40,5 +40,7 @@ enum flex_type {
      // Control delegation messages
      FLPT_DELEGATE_CONTROL = 15;
      FLPT_RECONFIGURE_AGENT = 16;
+     FLPT_RRC_TRIGGERING = 17;
+     FLPT_UL_MAC_CONFIG = 18;
 }
 
diff --git a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto
index 89b8f0e380605a12077aae640728b7fbf25fcc47..bd2b9cbe509a887b83f29fbfca13c2e29bf1bf2a 100644
--- a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto
@@ -36,6 +36,39 @@ message flex_dl_dci {
 	optional uint32 cif = 27;     		// CIF for cross-carrier scheduling
 }
 
+message flex_ul_dci {
+        optional uint32 rnti = 1;
+        optional uint32 rb_start = 2;           // The start RB allocated to the UE 
+        optional uint32 rb_len = 3;             // The number of RBs allocated to the UE
+        optional uint32 mcs = 4;                // Modulation and coding scheme
+        optional uint32 cyclic_shift2 = 5;      //  match DCI format 0/4 PDU 
+        optional uint32 freq_hop_flag = 6;      // 0 no hopping, 1 hoppping
+        optional uint32 freq_hop_map = 7;       // Frequency hopping bits (0..4) 
+        optional uint32 ndi = 8;                // New data indicator
+        optional uint32 rv = 9;                 // Redundancy version
+        optional uint32 harq_pid = 10;          //  The harq process id
+        optional uint32 ultx_mode = 11;         //  A FLULM_* value
+        optional uint32 tbs_size = 12;          // The size of each TBS
+        optional uint32 n_srs = 13;             // Overlap indication with srs
+        optional uint32 res_alloc = 14;         // Type of resource allocation
+        optional uint32 size = 15;    // Size of the ULSCH PDU in bytes for UL Grant.
+
+        optional uint32 dai = 16;               // TDD only
+
+//      optional uint32 tb_swap = 17;           // Boolean. TB to codeword swap flag
+
+//      optional uint32 pdcch_order = 19;
+//      optional uint32 preamble_index = 20;    // Only valid if pdcch_order = 1
+//      optional uint32 prach_mask_index = 21;  // Only valid if pdcch_order = 1
+
+//      optional uint32 tbs_idx = 23;           // The TBS index for Format 1A
+
+
+
+
+}
+
+
 //
 // Messages related to the creation of RLC PDUs
 //
@@ -74,4 +107,4 @@ enum flex_vrb_format {
 enum flex_ngap_val {
      FLNGV_1 = 0;
      FLNGV_2 = 1;
-}
\ No newline at end of file
+}
diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto
index fa985bf9cc4af4cdfa8318d640239364aac58af2..ee286981f52f89bf4fe979d1b165fb220b7efa4e 100644
--- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto
@@ -182,3 +182,126 @@ message flex_noise_interference_report {
 	optional int32 p0_nominal_pucch = 4;
 }
 
+//
+// RRC Measurements Primitives
+//
+
+
+message flex_rrc_measurements {
+	// Measurement identifier.
+	optional int32 measid = 1;
+	// Primary Cell Reference Signal Received Power (RSRP).
+	optional int32 pcell_rsrp = 2;
+	// Primary Cell Reference Signal Received Quality (RSRQ).
+	optional int32 pcell_rsrq = 3;
+	// Neighboring cells measurements performed by UE.
+	optional flex_neigh_cells_measurements neigh_meas = 4;
+}
+
+message flex_neigh_cells_measurements {
+	// Neighboring EUTRA cells measurements.
+	repeated flex_eutra_measurements eutra_meas = 1;
+}
+
+message flex_eutra_measurements {
+	// Physical Cell identifier.
+	optional int32 phys_cell_id = 1;
+	// EUTRA Cell Global Identity (CGI) measurement.
+	optional flex_eutra_cgi_measurements cgi_meas = 2;
+	// EUTRA nearby cell reference signal measurement.
+	optional flex_eutra_ref_signal_meas meas_result = 3;
+}
+
+message flex_eutra_cgi_measurements {
+	// EUTRA Cell Global Identity (CGI).
+	optional flex_cell_global_eutra_id cgi = 1;
+	// Tracking area code of the neighbor cell.
+	optional uint32 tracking_area_code = 2;
+	// Public land mobile network identifiers of neighbor cell.
+	repeated flex_plmn_identity plmn_id = 3;
+}
+
+message flex_cell_global_eutra_id {
+	// Public land mobile network identifier of neighbor cell.
+	optional flex_plmn_identity plmn_id = 1;
+	// Cell identifier of neighbor cell.
+	optional uint32 cell_id = 2;
+}
+
+message flex_plmn_identity {
+	// Mobile Network Code (MNC).
+	repeated uint32 mnc = 1;
+	// Mobile Country Code (MCC).
+	repeated uint32 mcc = 2;
+	// tracking area code 
+	repeated uint32 tac = 3;
+}
+
+message flex_eutra_ref_signal_meas {
+	// Neighboring Cell RSRP
+	optional int32 rsrp = 1;
+	// Neighboring Cell RSRQ	
+	optional int32 rsrq = 2;
+}
+
+//
+// PDCP Statistics
+//
+
+message flex_pdcp_stats {
+
+	optional uint32 pkt_tx = 1;
+	optional uint32 pkt_tx_bytes = 2;
+	optional uint32 pkt_tx_sn = 3;
+	optional uint32 pkt_tx_w = 4;
+	optional uint32 pkt_tx_bytes_w = 5;
+	optional uint32 pkt_tx_aiat = 7;
+	optional uint32 pkt_tx_aiat_w = 8;
+	
+	optional uint32 pkt_rx = 9;
+	optional uint32 pkt_rx_bytes = 10;
+	optional uint32 pkt_rx_sn = 11;
+	optional uint32 pkt_rx_w = 12;
+	optional uint32 pkt_rx_bytes_w = 13;
+	optional uint32 pkt_rx_aiat = 14;
+	optional uint32 pkt_rx_aiat_w = 15;
+	optional uint32 pkt_rx_oo = 16;
+
+	optional uint64 sfn=17;
+}
+
+//
+// MAC Stats
+//
+
+message flex_mac_stats {
+
+    optional uint32 tbs_dl = 1;
+    optional uint32 tbs_ul = 2;
+    optional uint32 prb_retx_dl = 3;
+    optional uint32 prb_retx_ul = 4;
+    optional uint32 prb_dl = 5;
+    optional uint32 prb_ul = 6;
+    optional uint32 mcs1_dl = 7;
+    optional uint32 mcs2_dl = 8;
+    optional uint32 mcs1_ul = 9;
+    optional uint32 mcs2_ul = 10;
+    optional uint32 total_bytes_sdus_ul = 11;
+    optional uint32 total_bytes_sdus_dl = 12;
+    optional uint32 total_prb_retx_dl = 13;
+    optional uint32 total_prb_retx_ul = 14;
+    optional uint32 total_prb_dl = 15;
+    optional uint32 total_prb_ul = 16;
+    optional uint32 total_pdu_dl = 17;
+    optional uint32 total_pdu_ul = 18;
+    optional uint32 total_tbs_dl = 19;
+    optional uint32 total_tbs_ul = 20;
+    repeated flex_mac_sdus_dl mac_sdus_dl = 21;
+    optional uint32 harq_round = 22;
+}
+
+message flex_mac_sdus_dl {
+    
+    optional uint32 sdu_length = 1; 
+    optional uint32 lcid = 2;
+}
diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto
index d8c0651fa16962a0f26e9c2c922cf0e9dbbd02c9..8eb6510de3ca0c78a3a90bdec955616a29924875 100644
--- a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto
@@ -47,6 +47,9 @@ message flex_ue_stats_report {
 	optional flex_dl_cqi_report dl_cqi_report = 7;
 	optional flex_paging_buffer_report pbr = 8;
 	optional flex_ul_cqi_report ul_cqi_report = 9;
+	optional flex_rrc_measurements rrc_measurements = 10;
+        optional flex_pdcp_stats pdcp_stats = 11;
+        optional flex_mac_stats mac_stats = 12;
 }
 
 //
@@ -77,11 +80,17 @@ enum flex_cell_stats_type {
 // Flags for UE-related statistics
 enum flex_ue_stats_type {
      FLUST_BSR = 1;
-     FLUST_PRH = 2;
+     FLUST_PHR = 2;
      FLUST_RLC_BS = 4;
      FLUST_MAC_CE_BS = 8;
      FLUST_DL_CQI = 16;
      FLUST_PBS = 32;
      FLUST_UL_CQI = 64;
+     FLUST_MAC_STATS = 128;
+
+     FLUST_PDCP_STATS = 1024;     
+     FLUST_RRC_MEASUREMENTS = 65536;
      // To be extended with more types of stats
-}
\ No newline at end of file
+
+
+}
diff --git a/openair2/ENB_APP/MESSAGES/V2/time_common.proto b/openair2/ENB_APP/MESSAGES/V2/time_common.proto
index 8bd2497443daaed136dc55b39740c66776d95795..6c0affbe51e676a8b725de582098af960ad2ca87 100644
--- a/openair2/ENB_APP/MESSAGES/V2/time_common.proto
+++ b/openair2/ENB_APP/MESSAGES/V2/time_common.proto
@@ -25,6 +25,7 @@ message flex_ul_info {
 	repeated uint32 ul_reception = 2;
 	optional uint32 reception_status = 3;
 	optional uint32 tpc = 4;
-	optional uint32 serv_cell_index = 5; 
+	optional uint32 serv_cell_index = 5;
+	optional uint32 rssi = 6;
 }
 
diff --git a/openair2/ENB_APP/NB_IoT_config.c b/openair2/ENB_APP/NB_IoT_config.c
new file mode 100644
index 0000000000000000000000000000000000000000..09e22ef8457b17578be6f03b9a17e4d3b8988607
--- /dev/null
+++ b/openair2/ENB_APP/NB_IoT_config.c
@@ -0,0 +1,286 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*
+  nbiot_config.c
+  -------------------
+  AUTHOR  : Francois Taburet
+  COMPANY : NOKIA
+  EMAIL   : francois.taburet@nokia-bell-labs.com
+*/
+
+#include <string.h>
+#include <inttypes.h>
+
+#include "log.h"
+#include "log_extern.h"
+#include "assertions.h"
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+# if defined(ENABLE_USE_MME)
+#   include "s1ap_eNB.h"
+#   include "sctp_eNB_task.h"
+# endif
+#endif
+#include "SystemInformationBlockType2.h"
+
+#include "PHY/extern.h"
+#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
+#include "common/config/config_userapi.h"
+#include "RRC_config_tools.h"
+#include "RRC_paramsvalues.h"
+#include "NB_IoT_paramdef.h"
+#include "L1_paramdef.h"
+#include "MACRLC_paramdef.h"
+#include "LAYER2/MAC/proto_NB_IoT.h"
+
+
+void RCconfig_NbIoTL1(void) {
+  paramdef_t NbIoT_L1_Params[] = L1PARAMS_DESC;
+  paramlist_def_t NbIoT_L1_ParamList = {NBIOT_L1LIST_CONFIG_STRING,NULL,0};
+
+/* No component carrier for NbIoT, ignore number of CC */
+//  NbIoT_L1_Params[L1_CC_IDX ].paramflags = PARAMFLAG_DONOTREAD;
+
+  config_getlist( &NbIoT_L1_ParamList,NbIoT_L1_Params,sizeof(NbIoT_L1_Params)/sizeof(paramdef_t), NULL);    
+  if (NbIoT_L1_ParamList.numelt > 0) {
+    if (RC.L1_NB_IoT == NULL) {
+      RC.L1_NB_IoT                         = (PHY_VARS_eNB_NB_IoT **)malloc(RC.nb_nb_iot_L1_inst*sizeof(PHY_VARS_eNB_NB_IoT *));
+      LOG_I(PHY,"RC.L1_NB_IoT = %p\n",RC.L1_NB_IoT);
+      memset(RC.L1_NB_IoT,0,RC.nb_nb_iot_L1_inst*sizeof(PHY_VARS_eNB_NB_IoT *));
+    }
+
+
+  for(int j = 0; j <NbIoT_L1_ParamList.numelt ; j++) {
+      if (RC.L1_NB_IoT[j] == NULL) {
+	RC.L1_NB_IoT[j]                       = (PHY_VARS_eNB_NB_IoT *)malloc(sizeof(PHY_VARS_eNB_NB_IoT));
+	LOG_I(PHY,"RC.L1_NB_IoT[%d] = %p\n",j,RC.L1_NB_IoT[j]);
+	memset(RC.L1_NB_IoT[j],0,sizeof(PHY_VARS_eNB_NB_IoT));
+      }
+      if (strcmp(*(NbIoT_L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
+
+      }
+      else if (strcmp(*(NbIoT_L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
+	RC.L1_NB_IoT[j]->eth_params_n.local_if_name	       = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
+	RC.L1_NB_IoT[j]->eth_params_n.my_addr		      = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
+	RC.L1_NB_IoT[j]->eth_params_n.remote_addr	      = strdup(*(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
+	RC.L1_NB_IoT[j]->eth_params_n.my_portc  	      = *(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
+	RC.L1_NB_IoT[j]->eth_params_n.remote_portc	      = *(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
+	RC.L1_NB_IoT[j]->eth_params_n.my_portd  	      = *(NbIoT_L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
+	RC.L1_NB_IoT[j]->eth_params_n.remote_portd	      = *(NbIoT_L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
+	RC.L1_NB_IoT[j]->eth_params_n.transp_preference       = ETH_UDP_MODE;
+      }
+      
+      else { // other midhaul
+      }	
+    }// j=0..num_inst
+    printf("Initializing northbound interface for NB-IoT L1\n");
+    l1_north_init_NB_IoT();
+  } else {
+    LOG_I(PHY,"No " NBIOT_L1LIST_CONFIG_STRING " configuration found");    
+  }
+}
+
+void RCconfig_NbIoTmacrlc(void) {
+ 
+
+
+  paramdef_t NbIoT_MacRLC_Params[] = MACRLCPARAMS_DESC;
+  paramlist_def_t NbIoT_MacRLC_ParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0};
+
+
+/* No component carrier for NbIoT, ignore number of CC */
+//  NbIoT_MacRLC_Params[MACRLC_CC_IDX ].paramflags = PARAMFLAG_DONOTREAD;
+
+  config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t), NULL);    
+  
+
+  if ( NbIoT_MacRLC_ParamList.numelt > 0) {
+    mac_top_init_eNB_NB_IoT();
+    for (int j=0;j<RC.nb_nb_iot_macrlc_inst;j++) {
+
+      if (strcmp(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
+	// check number of instances is same as RRC/PDCP
+	
+      } else if (strcmp(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) {
+	RC.nb_iot_mac[j]->eth_params_n.local_if_name            = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
+	RC.nb_iot_mac[j]->eth_params_n.my_addr                  = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
+	RC.nb_iot_mac[j]->eth_params_n.remote_addr              = strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
+	RC.nb_iot_mac[j]->eth_params_n.my_portc                 = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
+	RC.nb_iot_mac[j]->eth_params_n.remote_portc             = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
+	RC.nb_iot_mac[j]->eth_params_n.my_portd                 = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
+	RC.nb_iot_mac[j]->eth_params_n.remote_portd             = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);;
+	RC.nb_iot_mac[j]->eth_params_n.transp_preference        = ETH_UDP_MODE;
+      } else { // other midhaul
+	AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr));
+      }	
+
+      if (strcmp(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_L1") == 0) {
+
+	
+      } else if (strcmp(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "nfapi") == 0) {
+	RC.nb_iot_mac[j]->eth_params_s.local_if_name		= strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_IF_NAME_IDX].strptr));
+	RC.nb_iot_mac[j]->eth_params_s.my_addr  		= strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr));
+	RC.nb_iot_mac[j]->eth_params_s.remote_addr		= strdup(*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr));
+	RC.nb_iot_mac[j]->eth_params_s.my_portc 		= *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
+	RC.nb_iot_mac[j]->eth_params_s.remote_portc             = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
+	RC.nb_iot_mac[j]->eth_params_s.my_portd                 = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
+	RC.nb_iot_mac[j]->eth_params_s.remote_portd             = *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
+	RC.nb_iot_mac[j]->eth_params_s.transp_preference        = ETH_UDP_MODE;
+      } else { // other midhaul
+	AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
+      }	
+    }// j=0..num_inst */
+  } else {// MacRLC_ParamList.numelt > 0
+	  AssertFatal (0,
+		       "No " NBIOT_MACRLCLIST_CONFIG_STRING " configuration found");     
+  }
+}
+
+
+
+	       
+int RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nbiotrrc) {
+
+
+  char instprefix[MAX_OPTNAME_SIZE*3 + 32];
+  
+ 
+  checkedparam_t NBIoTCheckParams[] = NBIOT_RRCPARAMS_CHECK_DESC;
+  paramdef_t     NBIoTParams[]      = NBIOTRRCPARAMS_DESC;
+
+  paramdef_t     NBIoTPrachParams[]      = NBIOTRRC_NPRACH_PARAMS_DESC;
+  checkedparam_t NBIoTPrachCheckParams[] = NBIOT_RRCLIST_NPRACHPARAMSCHECK_DESC;
+
+  paramdef_t     NBIoTRRCRefParams[]      = NBIOTRRCPARAMS_RRCREF_DESC;
+
+  paramdef_t     NBIoTLteCCParams[] = NBIOT_LTECCPARAMS_DESC;
+  checkedparam_t NBIoTLteCCCheckParams[] = NBIOT_LTECCPARAMS_CHECK_DESC;
+/* map parameter checking array instances to parameter definition array instances */
+  for (int i=0; (i<sizeof(NBIoTParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTCheckParams)/sizeof(checkedparam_t)); i++ ) {
+     NBIoTParams[i].chkPptr = &(NBIoTCheckParams[i]); 
+  } 
+  for (int i=0; (i<sizeof(NBIoTPrachParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTPrachCheckParams)/sizeof(checkedparam_t)); i++ ) {
+     NBIoTPrachParams[i].chkPptr = &(NBIoTPrachCheckParams[i]);
+  }
+
+/* brut force itti message fields assignment, to be redesigned with itti replacement */
+  NBIoTParams[NBIOT_RACH_RARESPONSEWINDOWSIZE_NB_IDX].uptr               = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_raResponseWindowSize_NB);
+  NBIoTParams[NBIOT_RACH_MACCONTENTIONRESOLUTIONTIMER_NB_IDX].uptr       = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_macContentionResolutionTimer_NB);
+  NBIoTParams[NBIOT_RACH_POWERRAMPINGSTEP_NB_IDX].uptr                   = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_powerRampingStep_NB);		     		   
+  NBIoTParams[NBIOT_RACH_PREAMBLEINITIALRECEIVEDTARGETPOWER_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_preambleInitialReceivedTargetPower_NB);
+  NBIoTParams[NBIOT_RACH_PREAMBLETRANSMAX_CE_NB_IDX].uptr                = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax_CE_NB);				    
+  NBIoTParams[NBIOT_BCCH_MODIFICATIONPERIODCOEFF_NB_IDX].uptr            = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff_NB);	 
+  NBIoTParams[NBIOT_PCCH_DEFAULTPAGINGCYCLE_NB_IDX].uptr                 = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle_NB);	 
+  NBIoTParams[NBIOT_NPRACH_CP_LENGTH_IDX].uptr                           = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_CP_Length);  		 
+  NBIoTParams[NBIOT_NPRACH_RSRP_RANGE_IDX].uptr                          = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_rsrp_range); 		       
+
+  
+  
+  NBIoTParams[NBIOT_MAXNUMPREAMBLEATTEMPTCE_NB_IDX].uptr                 = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).maxNumPreambleAttemptCE_NB);
+
+  NBIoTParams[NBIOT_NPDSCH_NRS_POWER_IDX].uptr  			 = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdsch_nrs_Power);       
+  NBIoTParams[NBIOT_NPUSCH_ACK_NACK_NUMREPETITIONS_NB_IDX].uptr 	 = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p). npusch_ack_nack_numRepetitions_NB);
+  NBIoTParams[NBIOT_NPUSCH_SRS_SUBFRAMECONFIG_NB_IDX].uptr		 = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p). npusch_srs_SubframeConfig_NB);
+  NBIoTParams[NBIOT_NPUSCH_THREETONE_CYCLICSHIFT_R13_IDX].uptr 	         = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_threeTone_CyclicShift_r13);
+  NBIoTParams[NBIOT_NPUSCH_SIXTONE_CYCLICSHIFT_R13_IDX].uptr             = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_sixTone_CyclicShift_r13);
+  
+  NBIoTParams[NBIOT_NPUSCH_GROUPASSIGNMENTNPUSCH_R13_IDX].uptr           = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_groupAssignmentNPUSCH_r13);
+  NBIoTParams[NBIOT_DL_GAPTHRESHOLD_NB_IDX].uptr                         = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapThreshold_NB);	 
+  NBIoTParams[NBIOT_DL_GAPPERIODICITY_NB_IDX].uptr                       = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapPeriodicity_NB);	 
+  
+  NBIoTParams[NBIOT_NPUSCH_P0_NOMINALNPUSCH_IDX].uptr                    = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_p0_NominalNPUSCH);	  
+  		  
+  NBIoTParams[NBIOT_DELTAPREAMBLEMSG3_IDX].uptr                          = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).deltaPreambleMsg3); 	  
+  NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T300_NB_IDX].uptr              = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300_NB);						 
+  NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T301_NB_IDX].uptr              = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301_NB);
+  NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T310_NB_IDX].uptr              = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310_NB);						
+  NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_T311_NB_IDX].uptr              = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311_NB);						
+  NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_N310_NB_IDX].uptr              = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310_NB);						
+  NBIoTParams[NBIOT_UE_TIMERSANDCONSTANTS_N311_NB_IDX].uptr              = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311_NB);
+
+  sprintf(instprefix, NBIOT_RRCLIST_CONFIG_STRING ".[%i]",nbiotrrc_id);
+  config_get( NBIoTParams,sizeof(NBIoTParams)/sizeof(paramdef_t),instprefix); 
+
+  NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_SubcarrierMSG3_RangeStart    = config_get_processedint( &(NBIoTParams[NBIOT_NPRACH_SUBCARRIERMSG3_RANGESTART_IDX]) );
+  NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_groupHoppingEnabled          = config_get_processedint( &(NBIoTParams[NBIOT_NPUSCH_GROUPHOPPINGENABLED_IDX]      ) ); 
+  NBIOTRRC_CONFIGURATION_REQ (msg_p).dl_GapDurationCoeff_NB              = config_get_processedint( &(NBIoTParams[NBIOT_DL_GAPDURATIONCOEFF_NB_IDX]          ) ); 	 
+  NBIOTRRC_CONFIGURATION_REQ (msg_p).npusch_alpha                        = config_get_processedint( &(NBIoTParams[NBIOT_NPUSCH_ALPHA_IDX]                    ) );
+  for (int i=0; i<MAX_NUM_NBIOT_CELEVELS; i++) {
+       char *tmpptr=NULL;
+       NBIoTPrachParams[NBIOT_NPRACH_PERIODICITY_IDX ].uptr	            = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_Periodicity[i]);		
+       NBIoTPrachParams[NBIOT_NPRACH_STARTTIME_IDX].uptr  	            = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_StartTime[i]);			
+       NBIoTPrachParams[NBIOT_NPRACH_SUBCARRIEROFFSET_IDX].uptr	            = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_SubcarrierOffset[i]);		
+       NBIoTPrachParams[NBIOT_NPRACH_NUMSUBCARRIERS_IDX].uptr	            = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).nprach_NumSubcarriers[i]);		
+       NBIoTPrachParams[NBIOT_NUMREPETITIONSPERPREAMBLEATTEMPT_NB_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).numRepetitionsPerPreambleAttempt_NB[i]);
+       NBIoTParams[NBIOT_NPDCCH_NUMREPETITIONS_RA_IDX].uptr                 = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_NumRepetitions_RA[i]);
+       NBIoTParams[NBIOT_NPDCCH_STARTSF_CSS_RA_IDX].uptr	            = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_StartSF_CSS_RA[i]);
+       NBIoTParams[NBIOT_NPDCCH_OFFSET_RA_IDX].strptr			    = &tmpptr;
+       sprintf(instprefix, "%s.[%i].%s.[%i]",NBIOT_RRCLIST_CONFIG_STRING, nbiotrrc_id,NBIOT_RRCLIST_NPRACHPARAMS_CONFIG_STRING,i);
+       config_get( NBIoTPrachParams,sizeof(NBIoTPrachParams)/sizeof(paramdef_t),instprefix); 
+       NBIOTRRC_CONFIGURATION_REQ (msg_p).npdcch_Offset_RA[i] = config_get_processedint( &(NBIoTPrachParams[NBIOT_NPDCCH_OFFSET_RA_IDX]) ); 
+  }
+/* get the LTE RRC and CC this NB-IoT RRC instance is attached to */
+  sprintf(instprefix, NBIOT_RRCLIST_CONFIG_STRING ".[%i]." NBIOT_LTERRCREF_CONFIG_STRING, nbiotrrc_id );
+  config_get( NBIoTRRCRefParams,sizeof(NBIoTRRCRefParams)/sizeof(paramdef_t),instprefix); 
+
+/* read SIB1 parameters in the LTE RRC and CC sections */
+  sprintf(instprefix, ENB_CONFIG_STRING_ENB_LIST ".[%i]."  ENB_CONFIG_STRING_COMPONENT_CARRIERS ".[%i]",
+          *(NBIoTRRCRefParams[NBIOT_RRCINST_IDX].uptr), *(NBIoTRRCRefParams[NBIOT_CCINST_IDX].uptr)); 
+
+  NBIoTLteCCParams[LTECCPARAMS_TDD_CONFIG_IDX  ].uptr	         = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).tdd_config);
+  NBIoTLteCCParams[LTECCPARAMS_TDD_CONFIG_S_IDX].uptr	         = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).tdd_config_s);
+  NBIoTLteCCParams[LTECCPARAMS_EUTRA_BAND_IDX ].uptr	         = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).eutra_band);             
+  NBIoTLteCCParams[LTECCPARAMS_DOWNLINK_FREQUENCY_IDX].uptr      = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).downlink_frequency);      
+  NBIoTLteCCParams[LTECCPARAMS_UPLINK_FREQUENCY_OFFSET_IDX].uptr = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset);
+  NBIoTLteCCParams[LTECCPARAMS_NID_CELL_IDX].uptr	         = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).Nid_cell);                 
+  NBIoTLteCCParams[LTECCPARAMS_N_RB_DL_IDX].uptr	         = (uint32_t *)&(NBIOTRRC_CONFIGURATION_REQ (msg_p).N_RB_DL);                   
+
+  for (int i=0; (i<sizeof(NBIoTLteCCParams)/sizeof(paramdef_t)) && (i<sizeof(NBIoTLteCCCheckParams)/sizeof(checkedparam_t)); i++ ) {
+     NBIoTLteCCParams[i].chkPptr = &(NBIoTLteCCCheckParams[i]);
+  }
+  config_get( NBIoTLteCCParams,sizeof(NBIoTLteCCParams)/sizeof(paramdef_t),instprefix); 
+  NBIOTRRC_CONFIGURATION_REQ (msg_p).frame_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_FRAME_TYPE_IDX]) ); 
+  NBIOTRRC_CONFIGURATION_REQ (msg_p).prefix_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_PREFIX_TYPE_IDX]) );
+  NBIOTRRC_CONFIGURATION_REQ (msg_p).prefix_type = config_get_processedint( &(NBIoTLteCCParams[LTECCPARAMS_PREFIX_TYPE_UL_IDX]) );
+return 0;
+}
+
+void RCConfig_NbIoT(RAN_CONTEXT_t *RC) {
+
+  paramlist_def_t NbIoT_MACRLCParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0};
+  paramlist_def_t NbIoT_L1ParamList = {NBIOT_L1LIST_CONFIG_STRING,NULL,0};
+  paramlist_def_t NbIoT_ParamList = {NBIOT_RRCLIST_CONFIG_STRING,NULL,0};
+    
+  
+  config_getlist( &NbIoT_ParamList,NULL,0,NULL);
+  RC->nb_nb_iot_rrc_inst = NbIoT_ParamList.numelt;
+
+
+    
+ 
+    config_getlist( &NbIoT_MACRLCParamList,NULL,0, NULL);
+    RC->nb_nb_iot_macrlc_inst  = NbIoT_MACRLCParamList.numelt;
+    // Get num L1 instances
+    config_getlist( &NbIoT_L1ParamList,NULL,0, NULL);
+    RC->nb_nb_iot_L1_inst = NbIoT_L1ParamList.numelt;
+
+}
diff --git a/openair2/RRC/LITE/MESSAGES/rtai_mem.h b/openair2/ENB_APP/NB_IoT_config.h
similarity index 66%
rename from openair2/RRC/LITE/MESSAGES/rtai_mem.h
rename to openair2/ENB_APP/NB_IoT_config.h
index 19ed4c1a69fa742ea639ede3143173b54ef331f5..314fca81802124b8258e99af1616e1455a840607 100644
--- a/openair2/RRC/LITE/MESSAGES/rtai_mem.h
+++ b/openair2/ENB_APP/NB_IoT_config.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,26 +19,19 @@
  *      contact@openairinterface.org
  */
 
-/*! \file rtai_mem.h
-* \brief a wrapper for Unified RTAI real-time memory management.
-* \author Florian Kaltenberger
-* \date 2011-04-06
-* \version 0.1
-* \company Eurecom
-* \email: florian.kaltenberger@eurecom.fr
-* \note
-* \bug
-* \warning
-*/
-
 /*
-void* rt_alloc_wrapper(int size);
-
-int rt_free_wrapper(void* ptr);
-
-void* rt_realloc_wrapper(void* oldptr, int size);
+  nbiot_config.h
+  -------------------
+  AUTHOR  : Francois Taburet
+  COMPANY : NOKIA
+  EMAIL   : francois.taburet@nokia-bell-labs.com
 */
+#ifndef INCLUDE_NBIOT_CONFIG_H
+#define INCLUDE_NBIOT_CONFIG_H
 
-void* rt_realloc(void* oldptr, int size);
 
-void* rt_calloc(int nmemb, int size);
+extern void RCconfig_NbIoTL1(void) ;
+extern void RCconfig_NbIoTmacrlc(void);
+extern int  RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nbiotrrc);
+extern void RCConfig_NbIoT(RAN_CONTEXT_t *RC);
+#endif
diff --git a/targets/RT/USER/msg_many.h b/openair2/ENB_APP/NB_IoT_interface.c
similarity index 53%
rename from targets/RT/USER/msg_many.h
rename to openair2/ENB_APP/NB_IoT_interface.c
index ca5fd85b51da12c8a52df339e83a633d25ad584b..30ffbb3bb550f6fdcb1cc19075e120df2dac5d9b 100644
--- a/targets/RT/USER/msg_many.h
+++ b/openair2/ENB_APP/NB_IoT_interface.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -19,35 +19,40 @@
  *      contact@openairinterface.org
  */
 
-#ifndef __MSG_MANY_H__
-#define __MSG_MANY_H__
-#include <stdint.h>
-
-#define PERIOD 500000 /* in nano seconds */
-#define THRESHOLD 1000000
-#define THREAD_NAME_PREFIX "TK"
-#define NUM_THREADS 10
-
-#define TM_WORKER_FULL_ERROR 1
-#define TM_WORKER_ERROR 2
-
-typedef struct run_info {
-  RT_TASK *sender;
-  uint8_t *exit_condition;
-  long long period;
-  SEM *update_sem; /* protect the task array */
-  int used; /* counter of used slots in worker */
-  RT_TASK *(*worker)[]; /* declare worker as pointer to array of pointer to RT_TASK */
-} run_info_t;
-
-typedef struct thread_info {
-  run_info_t *ri;
-  uint8_t thread_num;
-} thread_info_t;
-
-int tm_add_task(RT_TASK *task, run_info_t *ri);
-int tm_del_task(int task_index, run_info_t *ri);
-inline int tm_get_next_task_index(int old_index, run_info_t *ri);
-
-#endif
+/*! \file openair2/ENB_APP/NB_IoT_interface.c
+ * \brief: load library implementing coding/decoding algorithms
+ * \date 2018
+ * \version 0.1
+ * \note
+ * \warning
+ */
+#define _GNU_SOURCE 
+#include <sys/types.h>
+
+
+#include "openair1/PHY/extern.h"
+#include "common/utils/load_module_shlib.h" 
+#define NBIOT_INTERFACE_SOURCE
+#include "NB_IoT_interface.h"
+
+
+
+
+int load_NB_IoT(void) {
+ int ret;
+ RCConfig_NbIoT_f_t RCConfig;
+ loader_shlibfunc_t shlib_fdesc[]=NBIOT_INTERFACE_FLIST; 
+
+     ret=load_module_shlib(NBIOT_MODULENAME,shlib_fdesc,sizeof(shlib_fdesc)/sizeof(loader_shlibfunc_t));
+     if (ret) {
+        return ret;
+     }
+     RCConfig = get_shlibmodule_fptr(NBIOT_MODULENAME,NBIOT_RCCONFIG_FNAME );
+     if (RCConfig == NULL) {
+        return -1;
+     } 
+ 
+     RCConfig(&RC);
+return 0;
+}
 
diff --git a/openair2/ENB_APP/NB_IoT_interface.h b/openair2/ENB_APP/NB_IoT_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..b3454b077bc1cc64aa514c5abed78c7a8c53138e
--- /dev/null
+++ b/openair2/ENB_APP/NB_IoT_interface.h
@@ -0,0 +1,50 @@
+/*
+ *Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file openair2/ENB_APP/NB_IoT_interface.h
+ * \brief: api interface for nb-iot application
+ * \date 2018
+ * \version 0.1
+ * \note
+ * \warning
+ */
+#ifndef NBIOT_INTERFACE_H
+#define NBIOT_INTERFACE_H
+
+
+#define NBIOT_MODULENAME "NB_IoT"
+
+typedef void(*RCConfig_NbIoT_f_t)(RAN_CONTEXT_t *RC);
+#define NBIOT_RCCONFIG_FNAME "RCConfig_NbIoT"
+
+#ifdef NBIOT_INTERFACE_SOURCE
+
+#define NBIOT_INTERFACE_FLIST {\
+{NBIOT_RCCONFIG_FNAME,NULL},\
+}
+
+#else /* NBIOT_INTERFACE_SOURCE */
+
+extern int load_NB_IoT(void); 
+
+#endif
+
+#endif
diff --git a/openair2/ENB_APP/NB_IoT_paramdef.h b/openair2/ENB_APP/NB_IoT_paramdef.h
new file mode 100644
index 0000000000000000000000000000000000000000..6409fe63ee56479b9cc1fca486b9d63bd77f8bda
--- /dev/null
+++ b/openair2/ENB_APP/NB_IoT_paramdef.h
@@ -0,0 +1,400 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file openair2/ENB_APP/enb_paramdef.f
+ * \brief definition of configuration parameters for all eNodeB modules 
+ * \author Francois TABURET
+ * \date 2017
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+
+#include "common/config/config_paramdesc.h"
+#include "SystemInformationBlockType2.h"
+#include "DL-GapConfig-NB-r13.h"
+#include "NPRACH-Parameters-NB-r13.h"
+#include "PowerRampingParameters.h"		  
+#include "BCCH-Config-NB-r13.h"
+#include "PCCH-Config-NB-r13.h"
+#include "ACK-NACK-NumRepetitions-NB-r13.h"
+#include "TDD-Config.h"
+
+
+
+
+ 
+/*
+  int16_t                 eutra_band;
+  uint32_t                downlink_frequency;
+  int32_t                 uplink_frequency_offset;
+  int16_t                 Nid_cell;// for testing, change later
+  int16_t                 N_RB_DL;// for testing, change later
+*/
+/*-------------------------------------------------------------------------------------------------------------------*/
+/* SIB1 parameters possibly coming  from LTE RRC (in band deployment)                                                */
+/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                     component carriers configuration parameters                                                                                                                   */
+/*   optname                                                   helpstr   paramflags    XXXptr                                        defXXXval                    type         numelt  checked_param */
+/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+#define NBIOT_LTECCPARAMS_CHECK_DESC { \
+             { .s3a= { config_checkstr_assign_integer,  FRAMETYPE_OKVALUES, FRAMETYPE_MODVALUES,2}} ,     \
+             { .s2=  { config_check_intrange,           TDDCONFIG_OKRANGE}},                              \
+             { .s2=  { config_check_intrange,           TDDCONFIGS_OKRANGE}},                             \
+             { .s3a= { config_checkstr_assign_integer,  PREFIX_OKVALUES,    PREFIX_MODVALUES,2}} ,        \
+             { .s3a= { config_checkstr_assign_integer,  PREFIXUL_OKVALUES,  PREFIXUL_MODVALUES,2}} ,      \
+             { .s5= {NULL }} ,						                                  \
+             { .s5= {NULL }} ,						                                  \
+             { .s5= {NULL }} ,						                                  \
+             { .s5= {NULL }} ,						                                  \
+             { .s1= { config_check_intval,              NRBDL_OKVALUES,6}} ,                              \
+}
+
+
+#define NBIOT_LTECCPARAMS_DESC { \
+{ENB_CONFIG_STRING_FRAME_TYPE,                        NULL,   0,	   strptr:NULL,       defstrval:"FDD",  	 TYPE_STRING,	  0},  \
+{ENB_CONFIG_STRING_TDD_CONFIG,                        NULL,   0,	   iptr:NULL,	      defintval:3,		 TYPE_UINT,	  0},  \
+{ENB_CONFIG_STRING_TDD_CONFIG_S,                      NULL,   0,	   iptr:NULL,	      defintval:0,		 TYPE_UINT,	  0},  \
+{ENB_CONFIG_STRING_PREFIX_TYPE,                       NULL,   0,	   strptr:NULL,       defstrval:"NORMAL",	 TYPE_STRING,	  0},  \
+{ENB_CONFIG_STRING_PREFIX_TYPE_UL,                    NULL,   0,	   strptr:NULL,       defstrval:"NORMAL",	 TYPE_STRING,	  0},  \
+{ENB_CONFIG_STRING_EUTRA_BAND,                        NULL,   0,	   iptr:NULL,	      defintval:7,		 TYPE_UINT,	  0},  \
+{ENB_CONFIG_STRING_DOWNLINK_FREQUENCY,                NULL,   0,	   i64ptr:NULL,       defint64val:2680000000,	 TYPE_UINT64,	  0},  \
+{ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET,           NULL,   0,	   iptr:NULL,	      defintval:-120000000,	 TYPE_INT,	  0},  \
+{ENB_CONFIG_STRING_NID_CELL,                          NULL,   0,	   iptr:NULL,	      defintval:0,		 TYPE_UINT,	  0},  \
+{ENB_CONFIG_STRING_N_RB_DL,                           NULL,   0,	   iptr:NULL,	      defintval:25,		 TYPE_UINT,	  0},  \
+}
+#define LTECCPARAMS_FRAME_TYPE_IDX                  0
+#define LTECCPARAMS_TDD_CONFIG_IDX                  1
+#define LTECCPARAMS_TDD_CONFIG_S_IDX                2
+#define LTECCPARAMS_PREFIX_TYPE_IDX                 3
+#define LTECCPARAMS_PREFIX_TYPE_UL_IDX              4
+#define LTECCPARAMS_EUTRA_BAND_IDX                  5
+#define LTECCPARAMS_DOWNLINK_FREQUENCY_IDX          6
+#define LTECCPARAMS_UPLINK_FREQUENCY_OFFSET_IDX     7
+#define LTECCPARAMS_NID_CELL_IDX                    8
+#define LTECCPARAMS_N_RB_DL_IDX                     9
+
+
+/*-------------------------------------------------------------------------------------------------------------------*/
+
+/* NB-Iot RRC list section name */		
+#define NBIOT_RRCLIST_CONFIG_STRING          "NB-IoT_RRCs"		 
+
+
+#define RACH_RARESPONSEWINDOWSIZE_NB_OKVALUES                   {20,50,80,120,180,240,320,400}
+#define PREF1(A)                                                 RACH_CE_LevelInfo_r13__ra_ResponseWindowSize_r13_ ## A
+#define RACH_RARESPONSEWINDOWSIZE_NB_MODVALUES                  { PREF1(sf20),PREF1(sf50),PREF1(sf80),PREF1(sf120),    \
+                                                                  PREF1(sf180),PREF1(sf240),PREF1(sf320),PREF1(sf400) }
+
+
+#define RACH_MACCONTENTIONRESOLUTIONTIMER_NB_OKVALUES           {80,100,120,160,200,240,480,960} 
+#define PREF2(A)                                                 RACH_CE_LevelInfo_r13__mac_ContentionResolutionTimer_r13_ ## A 
+#define RACH_MACCONTENTIONRESOLUTIONTIMER_NB_MODVALUES          { PREF2(sf80),PREF2(sf100),PREF2(sf120),PREF2(sf160),    \
+                                                                  PREF2(sf200),PREF2(sf240),PREF2(sf480),PREF2(sf960) }
+
+
+#define RACH_POWERRAMPINGSTEP_NB_OKVALUES                       {0,2,4,6}
+#define PREF3(A)                                                 PowerRampingParameters__powerRampingStep_ ## A
+#define RACH_POWERRAMPINGSTEP_NB_MODVALUES                      { PREF3(dB0),PREF3(dB2),PREF3(dB4),PREF3(dB6) }
+
+
+#define RACH_PREAMBLEINITIALRECEIVEDTARGETPOWER_NB_OKRANGE      {-120, -90}
+
+#define RACH_PREAMBLETRANSMAX_CE_NB_OKVALUES                    {3,4,5,6,7,8,10,20,50,100,200}
+#define PREF4(A)                                                PreambleTransMax_ ## A 
+#define RACH_PREAMBLETRANSMAX_CE_NB_MODVALUES                   { PREF4(n3), PREF4(n4), PREF4(n5), PREF4(n6),  PREF4(n7), PREF4(n8), \
+                                                                  PREF4(n10),PREF4(n20),PREF4(n50),PREF4(n100),PREF4(n200) }
+
+#define BCCH_MODIFICATIONPERIODCOEFF_NB_OKVALUES                {16,32,64,128}
+#define PREF5(A)                                                BCCH_Config_NB_r13__modificationPeriodCoeff_r13_ ## A 
+#define BCCH_MODIFICATIONPERIODCOEFF_NB_MODVALUES              { PREF5(n16), PREF5(n32), PREF5(n64),PREF5(n128) }
+
+#define PCCH_DEFAULTPAGINGCYCLE_NB_OKVALUES                     {128,256,512,1024}
+#define PREF6(A)                                                PCCH_Config_NB_r13__defaultPagingCycle_r13_ ## A 
+#define PCCH_DEFAULTPAGINGCYCLE_NB_MODVALUES                    { PREF6(rf128), PREF6(rf256), PREF6(rf512), PREF6(rf1024) }
+
+#define NPRACH_CP_LENGTH_OKVALUES                               {0,1}
+#define NPRACH_RSRP_RANGE_OKVALUES                              {0,96}
+
+#define MSG3RANGESTART_OKVALUES                                 {"zero","oneThird","twoThird","one"}
+#define MSG3RANGESTART_MODVALUES {NPRACH_Parameters_NB_r13__nprach_SubcarrierMSG3_RangeStart_r13_zero,     NPRACH_Parameters_NB_r13__nprach_SubcarrierMSG3_RangeStart_r13_oneThird, \
+                                  NPRACH_Parameters_NB_r13__nprach_SubcarrierMSG3_RangeStart_r13_twoThird, NPRACH_Parameters_NB_r13__nprach_SubcarrierMSG3_RangeStart_r13_one}
+
+
+#define MAXNUMPREAMBLEATTEMPTCE_OKVALUES    {3,4,5,6,7,8,10}
+#define MAXNUMPREAMBLEATTEMPTCE_MODVALUES   {  NPRACH_Parameters_NB_r13__maxNumPreambleAttemptCE_r13_n3, NPRACH_Parameters_NB_r13__maxNumPreambleAttemptCE_r13_n4, \
+                                               NPRACH_Parameters_NB_r13__maxNumPreambleAttemptCE_r13_n5, NPRACH_Parameters_NB_r13__maxNumPreambleAttemptCE_r13_n6, \
+                                               NPRACH_Parameters_NB_r13__maxNumPreambleAttemptCE_r13_n7, NPRACH_Parameters_NB_r13__maxNumPreambleAttemptCE_r13_n8, \
+                                               NPRACH_Parameters_NB_r13__maxNumPreambleAttemptCE_r13_n10 }
+
+#define NPDSCH_NRS_POWER_OKRANGE                                {-60,50}
+
+#define NPUSCH_ACK_NACK_NUMREPETITIONS_NB_OKVALUES              {1,2,4,8,16,32,64,128}
+#define PREF9(A)                                                ACK_NACK_NumRepetitions_NB_r13_ ## A 
+#define NPUSCH_ACK_NACK_NUMREPETITIONS_NB_MODVALUES             { PREF9(r1),   PREF9(r2),   PREF9(r4),   PREF9(r8), \
+                                                                  PREF9(r16),  PREF9(r32),  PREF9(r64),  PREF9(r128) }
+
+#define NPUSCH_SRS_SUBFRAMECONFIG_NB_OKRANGE                    {0,15}
+#define NPUSCH_THREETONE_CYCLICSHIFT_R13_OKRANGE                {0,2}
+#define NPUSCH_SIXTONE_CYCLICSHIFT_R13_OKRANGE                  {0,3}
+
+#define NPUSCH_GROUPHOPPINGENABLED_OKVALUES                     {"enable","disable"}
+#define NPUSCH_GROUPHOPPINGENABLED_MODVALUES                    {1,0}
+
+#define NPUSCH_GROUPASSIGNMENTNPUSCH_R13_OKRANGE                {0,29}
+
+#define DLGAPTHRESHOLD_OKVALUES	       {32,64,128,256}
+#define DLGAPTHRESHOLD_MODVALUES       { DL_GapConfig_NB_r13__dl_GapThreshold_r13_n32,  DL_GapConfig_NB_r13__dl_GapThreshold_r13_n64,  \
+                                         DL_GapConfig_NB_r13__dl_GapThreshold_r13_n128, DL_GapConfig_NB_r13__dl_GapThreshold_r13_n256} \
+
+#define DLGAPPERIODICITY_OKVALUES      {64,128,256,512}
+#define DLGAPPERIODICITY_MODVALUES     { DL_GapConfig_NB_r13__dl_GapPeriodicity_r13_sf64, DL_GapConfig_NB_r13__dl_GapPeriodicity_r13_sf128, \
+          		 	       DL_GapConfig_NB_r13__dl_GapPeriodicity_r13_sf256,DL_GapConfig_NB_r13__dl_GapPeriodicity_r13_sf512}
+
+#define DLGAPDURATION_OKVALUES         {"oneEighth","oneFourth","threeEighth","oneHalf"}
+#define DLGAPDURATION_MODVALUES        {DL_GapConfig_NB_r13__dl_GapDurationCoeff_r13_oneEighth,   DL_GapConfig_NB_r13__dl_GapDurationCoeff_r13_oneFourth, \
+                                        DL_GapConfig_NB_r13__dl_GapDurationCoeff_r13_threeEighth, DL_GapConfig_NB_r13__dl_GapDurationCoeff_r13_oneHalf}
+
+#define NPUSCH_P0_NOMINALNPUSCH_OKRANGE                         {-126,24}
+
+#define NPUSCH_ALPHA_OKVALUES                                    {"AL0","AL04","AL05","AL06","AL07","AL08","AL09","AL1"} 
+#define NPUSCH_ALPHA_MODVALUES                                   { Alpha_r12_al0, Alpha_r12_al04,  Alpha_r12_al05,  Alpha_r12_al06, \
+                                                                   Alpha_r12_al07, Alpha_r12_al08,  Alpha_r12_al09,  Alpha_r12_al1}
+
+#define DELTAPREAMBLEMSG3_OKRANGE                               {-1,6}	
+
+
+
+
+
+#define NBIOT_RRCPARAMS_CHECK_DESC { \
+             { .s1a= { config_check_modify_integer,     RACH_RARESPONSEWINDOWSIZE_NB_OKVALUES,          RACH_RARESPONSEWINDOWSIZE_NB_MODVALUES,          8}}, 	 \
+             { .s1a= { config_check_modify_integer,     RACH_MACCONTENTIONRESOLUTIONTIMER_NB_OKVALUES,  RACH_MACCONTENTIONRESOLUTIONTIMER_NB_MODVALUES,  8}},	 \
+             { .s1a= { config_check_modify_integer,     RACH_POWERRAMPINGSTEP_NB_OKVALUES,              RACH_POWERRAMPINGSTEP_NB_MODVALUES,              4}} ,    \
+             { .s2=  { config_check_intrange,           RACH_PREAMBLEINITIALRECEIVEDTARGETPOWER_NB_OKRANGE}},   	    	  \
+             { .s1a= { config_check_modify_integer,     RACH_PREAMBLETRANSMAX_CE_NB_OKVALUES,           RACH_PREAMBLETRANSMAX_CE_NB_MODVALUES,          11}} ,    \
+             { .s1a= { config_check_modify_integer,     BCCH_MODIFICATIONPERIODCOEFF_NB_OKVALUES,       BCCH_MODIFICATIONPERIODCOEFF_NB_MODVALUES,       4}} ,    \
+             { .s1a= { config_check_modify_integer,     PCCH_DEFAULTPAGINGCYCLE_NB_OKVALUES,            PCCH_DEFAULTPAGINGCYCLE_NB_MODVALUES,            4}} ,    \
+             { .s1=  { NULL,		           NPRACH_CP_LENGTH_OKVALUES ,4}} ,			     	    	  \
+             { .s2=  { config_check_intrange,	        NPRACH_RSRP_RANGE_OKVALUES}} ,			     	    	  \
+             { .s3a= { config_checkstr_assign_integer,  MSG3RANGESTART_OKVALUES,                        MSG3RANGESTART_MODVALUES,                       4}} ,    \
+             { .s1a= { config_check_modify_integer,     MAXNUMPREAMBLEATTEMPTCE_OKVALUES,               MAXNUMPREAMBLEATTEMPTCE_MODVALUES,              7}} ,    \
+             { .s1=  { config_check_intval,             NPDSCH_NRS_POWER_OKRANGE,4}} ,			     	     	  \
+             { .s1a= { config_check_modify_integer,     NPUSCH_ACK_NACK_NUMREPETITIONS_NB_OKVALUES,     NPUSCH_ACK_NACK_NUMREPETITIONS_NB_MODVALUES,    8}} ,    \
+             { .s2=  { config_check_intrange,           NPUSCH_SRS_SUBFRAMECONFIG_NB_OKRANGE}} , 	             	     	  \
+             { .s2=  { config_check_intrange,           NPUSCH_THREETONE_CYCLICSHIFT_R13_OKRANGE}} ,	     	     	  \
+             { .s2=  { config_check_intrange,           NPUSCH_SIXTONE_CYCLICSHIFT_R13_OKRANGE}} ,	             	     	  \
+             { .s3a= { config_checkstr_assign_integer,  NPUSCH_GROUPHOPPINGENABLED_OKVALUES,          NPUSCH_GROUPHOPPINGENABLED_MODVALUES,            2}} ,    \
+             { .s2=  { config_check_intrange,           NPUSCH_GROUPASSIGNMENTNPUSCH_R13_OKRANGE}} ,	     	     	  \
+             { .s1a= { config_check_modify_integer,     DLGAPTHRESHOLD_OKVALUES,                       DLGAPTHRESHOLD_MODVALUES,                        4}} ,    \
+             { .s1a= { config_check_modify_integer,     DLGAPPERIODICITY_OKVALUES,                     DLGAPPERIODICITY_MODVALUES,                      4}} ,    \
+             { .s3a= { config_checkstr_assign_integer,  DLGAPDURATION_OKVALUES,                        DLGAPDURATION_MODVALUES ,                        4}} ,    \
+             { .s2=  { config_check_intrange,           NPUSCH_P0_NOMINALNPUSCH_OKRANGE}} ,		     	     	  \
+             { .s3a= { config_checkstr_assign_integer,  NPUSCH_ALPHA_OKVALUES,                        NPUSCH_ALPHA_MODVALUES,                          8}} ,    \
+             { .s2=  { config_check_intrange,           DELTAPREAMBLEMSG3_OKRANGE}} ,			     	     	  \
+             { .s1a= { config_check_modify_integer,    UETIMER_T300_OKVALUES, UETIMER_T300_MODVALUES,8}} ,	     \
+             { .s1a= { config_check_modify_integer,    UETIMER_T301_OKVALUES, UETIMER_T301_MODVALUES,8}} ,	     \
+             { .s1a= { config_check_modify_integer,    UETIMER_T310_OKVALUES, UETIMER_T310_MODVALUES,7}} ,	     \
+             { .s1a= { config_check_modify_integer,    UETIMER_T311_OKVALUES, UETIMER_T311_MODVALUES,7}} ,	     \
+             { .s1a= { config_check_modify_integer,    UETIMER_N310_OKVALUES, UETIMER_N310_MODVALUES,8}} ,	     \
+             { .s1a= { config_check_modify_integer,    UETIMER_N311_OKVALUES, UETIMER_N311_MODVALUES,8}} ,	     \
+}
+/*-----------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                                           NB-IoT RRC  configuration parameters                                          */
+/*   optname                                       helpstr   paramflags    XXXptr	 defXXXval		      type	   numelt  */
+/*-----------------------------------------------------------------------------------------------------------------------------------------*/
+#define NBIOTRRCPARAMS_DESC { \
+{"rach_raResponseWindowSize_NB",                   NULL,   0,		   uptr:NULL,	 defintval:20,  	TYPE_UINT,	 0},  \
+{"rach_macContentionResolutionTimer_NB",           NULL,   0,		   uptr:NULL,	 defintval:80,  	TYPE_UINT,	 0},  \
+{"rach_powerRampingStep_NB",                       NULL,   0,		   uptr:NULL,	 defintval:0,		TYPE_UINT,	 0},  \
+{"rach_preambleInitialReceivedTargetPower_NB",     NULL,   0,		   iptr:NULL,	 defintval:-112,	TYPE_INT32,	 0},  \
+{"rach_preambleTransMax_CE_NB",                    NULL,   0,		   uptr:NULL,	 defintval:3,		TYPE_UINT,	 0},  \
+{"bcch_modificationPeriodCoeff_NB",                NULL,   0,		   uptr:NULL,	 defintval:16,		TYPE_UINT,	 0},  \
+{"pcch_defaultPagingCycle_NB",                     NULL,   0,		   uptr:NULL,	 defintval:256,		TYPE_UINT,	 0},  \
+{"nprach_CP_Length",                               NULL,   0,		   uptr:NULL,	 defintval:0,		TYPE_UINT,	 0},  \
+{"nprach_rsrp_range",                              NULL,   0,		   uptr:NULL,	 defintval:0,		TYPE_UINT,	 0},  \
+{"nprach_SubcarrierMSG3_RangeStart",               NULL,   0,		   strptr:NULL,  defstrval:"one",	TYPE_STRING,	 0},  \
+{"maxNumPreambleAttemptCE_NB",                     NULL,   0,		   uptr:NULL,	 defintval:10,  	TYPE_UINT,	 0},  \
+{"npdsch_nrs_Power",                               NULL,   0,		   iptr:NULL,	 defintval:0,		TYPE_INT,	 0},  \
+{"npusch_ack_nack_numRepetitions_NB",              NULL,   0,		   uptr:NULL,	 defintval:1,		TYPE_UINT,	 0},  \
+{"npusch_srs_SubframeConfig_NB",                   NULL,   0,		   uptr:NULL,	 defintval:0,		TYPE_UINT,	 0},  \
+{"npusch_threeTone_CyclicShift_r13",               NULL,   0,		   uptr:NULL,	 defintval:0,		TYPE_UINT,	 0},  \
+{"npusch_sixTone_CyclicShift_r13",                 NULL,   0,		   uptr:NULL,	 defintval:0,		TYPE_UINT,	 0},  \
+{"npusch_groupHoppingEnabled",                     NULL,   0,              strptr:NULL,	 defstrval:"disable",	TYPE_STRING,	 0},  \
+{"npusch_groupAssignmentNPUSCH_r13",               NULL,   0,		   uptr:NULL,	 defintval:0,		TYPE_UINT,	 0},  \
+{"dl_GapThreshold_NB",                             NULL,   0,		   uptr:NULL,	 defintval:32,  	TYPE_UINT,	 0},  \
+{"dl_GapPeriodicity_NB",                           NULL,   0,		   uptr:NULL,	 defintval:64,  	TYPE_UINT,	 0},  \
+{"dl_GapDurationCoeff_NB",                         NULL,   0,		   strptr:NULL,  defstrval:"oneEighth", TYPE_STRING,	 0},  \
+{"npusch_p0_NominalNPUSCH",                        NULL,   0,		   iptr:NULL,	 defintval:0,		TYPE_INT32,	 0},  \
+{"npusch_alpha",                                   NULL,   0,		   strptr:NULL,	 defstrval:"AL0",  	TYPE_STRING,	 0},  \
+{"deltaPreambleMsg3",                              NULL,   0,		   iptr:NULL,	 defintval:0,		TYPE_INT32,	 0},  \
+{"ue_TimersAndConstants_t300_NB",                  NULL,   0,		   uptr:NULL,	 defintval:1000,	TYPE_UINT,	 0},  \
+{"ue_TimersAndConstants_t301_NB",                  NULL,   0,		   uptr:NULL,	 defintval:1000,	TYPE_UINT,	 0},  \
+{"ue_TimersAndConstants_t310_NB",                  NULL,   0,		   uptr:NULL,	 defintval:1000,	TYPE_UINT,	 0},  \
+{"ue_TimersAndConstants_t311_NB",                  NULL,   0,		   uptr:NULL,	 defintval:10000,	TYPE_UINT,	 0},  \
+{"ue_TimersAndConstants_n310_NB",                  NULL,   0,		   uptr:NULL,	 defintval:20,  	TYPE_UINT,	 0},  \
+{"ue_TimersAndConstants_n311_NB",                  NULL,   0,		   uptr:NULL,	 defintval:1,		TYPE_UINT,	 0},  \
+}								    
+
+#define NBIOT_RACH_RARESPONSEWINDOWSIZE_NB_IDX                         0	   
+#define NBIOT_RACH_MACCONTENTIONRESOLUTIONTIMER_NB_IDX                 1
+#define NBIOT_RACH_POWERRAMPINGSTEP_NB_IDX                             2
+#define NBIOT_RACH_PREAMBLEINITIALRECEIVEDTARGETPOWER_NB_IDX           3
+#define NBIOT_RACH_PREAMBLETRANSMAX_CE_NB_IDX                          4		   
+#define NBIOT_BCCH_MODIFICATIONPERIODCOEFF_NB_IDX                      5
+#define NBIOT_PCCH_DEFAULTPAGINGCYCLE_NB_IDX                           6
+#define NBIOT_NPRACH_CP_LENGTH_IDX                                     7
+#define NBIOT_NPRACH_RSRP_RANGE_IDX                                    8
+#define NBIOT_NPRACH_SUBCARRIERMSG3_RANGESTART_IDX                     9
+#define NBIOT_MAXNUMPREAMBLEATTEMPTCE_NB_IDX                           10
+#define NBIOT_NPDSCH_NRS_POWER_IDX                                     11
+#define NBIOT_NPUSCH_ACK_NACK_NUMREPETITIONS_NB_IDX                    12
+#define NBIOT_NPUSCH_SRS_SUBFRAMECONFIG_NB_IDX                         13
+#define NBIOT_NPUSCH_THREETONE_CYCLICSHIFT_R13_IDX                     14
+#define NBIOT_NPUSCH_SIXTONE_CYCLICSHIFT_R13_IDX                       15
+#define NBIOT_NPUSCH_GROUPHOPPINGENABLED_IDX                           16
+#define NBIOT_NPUSCH_GROUPASSIGNMENTNPUSCH_R13_IDX                     17
+#define NBIOT_DL_GAPTHRESHOLD_NB_IDX                                   18
+#define NBIOT_DL_GAPPERIODICITY_NB_IDX                                 19
+#define NBIOT_DL_GAPDURATIONCOEFF_NB_IDX                               20
+#define NBIOT_NPUSCH_P0_NOMINALNPUSCH_IDX                              21
+#define NBIOT_NPUSCH_ALPHA_IDX                                         22
+#define NBIOT_DELTAPREAMBLEMSG3_IDX                                    23
+#define NBIOT_UE_TIMERSANDCONSTANTS_T300_NB_IDX                        24
+#define NBIOT_UE_TIMERSANDCONSTANTS_T301_NB_IDX                        25
+#define NBIOT_UE_TIMERSANDCONSTANTS_T310_NB_IDX                        26
+#define NBIOT_UE_TIMERSANDCONSTANTS_T311_NB_IDX                        27
+#define NBIOT_UE_TIMERSANDCONSTANTS_N310_NB_IDX                        28
+#define NBIOT_UE_TIMERSANDCONSTANTS_N311_NB_IDX                        29
+
+/* NB-Iot RRC: link to LTE RRC section name */		
+#define NBIOT_LTERRCREF_CONFIG_STRING          "LTERRC_Ref"
+/*---------------------------------------------------------------------------------------------------------------*/
+/*          NB-IoT RRC configuration parameters to link to a LTE RRC instance (in-guard, in-band)                */
+/*   optname                        helpstr   paramflags    XXXptr	 defXXXval	   type	         numelt  */
+/*---------------------------------------------------------------------------------------------------------------*/
+#define NBIOTRRCPARAMS_RRCREF_DESC { \
+{"RRC_inst",                         NULL,   0,            uptr:NULL,     defintval:0,	  TYPE_UINT,	   0},  \
+{"CC_inst",                          NULL,   0,            uptr:NULL,     defintval:0, 	  TYPE_UINT,	   0},  \
+}
+/*--------------------------------------------------------------------------------------------------------------*/
+#define NBIOT_RRCINST_IDX             0
+#define NBIOT_CCINST_IDX              1
+
+#define NBIOT_RRCLIST_NPRACHPARAMS_CONFIG_STRING        "NPRACH-NB-r13"
+
+
+#define  NPRACH_PERIODICITY_OKVALUES   {40,80,160,240,320,640,1280,2560}
+#define  NPRACH_PERIODICITY_MODVALUES  { NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms40,   NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms80,  \
+                                         NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms160,  NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms240, \
+                                         NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms320,  NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms640, \
+                                         NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms1280, NPRACH_Parameters_NB_r13__nprach_Periodicity_r13_ms2560 }
+
+#define  NPRACH_STARTTIME_OKVALUES   {8,16,32,64,128,256,512,1024}
+#define  NPRACH_STARTTIME_MODVALUES  {  NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms8,   NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms16,        \
+                                        NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms32,  NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms64,        \
+                                        NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms128, NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms256,       \
+                                        NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms512, NPRACH_Parameters_NB_r13__nprach_StartTime_r13_ms1024 }
+    
+#define  NPRACH_SUBCARRIEROFFSET_OKVALUES      {0,12,24,36,2,18,34}
+#define  NPRACH_SUBCARRIEROFFSET_MODVALUES     {  NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n0,  NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n12, \
+                                                  NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n24, NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n36, \
+                                                  NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n2,  NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n18, \
+                                                  NPRACH_Parameters_NB_r13__nprach_SubcarrierOffset_r13_n34 }
+
+#define  NPRACH_NUMSUBCARRIERS_OKVALUES      {12,24,36,48}
+#define  NPRACH_NUMSUBCARRIERS_MODVALUES     {  NPRACH_Parameters_NB_r13__nprach_NumSubcarriers_r13_n12, NPRACH_Parameters_NB_r13__nprach_NumSubcarriers_r13_n24, \
+                                                NPRACH_Parameters_NB_r13__nprach_NumSubcarriers_r13_n36, NPRACH_Parameters_NB_r13__nprach_NumSubcarriers_r13_n48 }
+
+
+#define  NUMREPETITIONSPERPREAMBLEATTEMPT_OKVALUES  {1,2,4,8,16,32,64,128}
+#define  NUMREPETITIONSPERPREAMBLEATTEMPT_MODVALUES {  NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n1,  NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n2,   \
+                                                       NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n4,  NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n8,   \
+                                                       NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n16, NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n32,  \
+                                                       NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n64, NPRACH_Parameters_NB_r13__numRepetitionsPerPreambleAttempt_r13_n128} 
+
+#define  NPDCCHNUMREPETITIONSRA_OKVALUES  {1,2,4,8,16,32,64,128,256,512,1024,2048}
+#define  NPDCCHNUMREPETITIONSRA_MODVALUES {  NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r1,   NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r2,	\
+                                    	     NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r4,   NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r8,	\
+                                    	     NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r16,  NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r32,	\
+                                    	     NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r64,  NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r128,  \
+                                    	     NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r256, NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r512,  \
+                                    	     NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r1024,NPRACH_Parameters_NB_r13__npdcch_NumRepetitions_RA_r13_r2048}
+
+#define  NPDCCHSTARTSFCSSRA_OKVALUES  {1,2,4,8,16,32,48,64}
+#define  NPDCCHSTARTSFCSSRA_MODVALUES {  NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v1dot5,  NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v2,	\
+                                         NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v4,      NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v8,   \
+                                         NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v16,     NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v32,  \
+                                         NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v48,     NPRACH_Parameters_NB_r13__npdcch_StartSF_CSS_RA_r13_v64}
+
+#define  NPDCCHOFFSETRA_OKVALUES    {"zero","oneEighth","oneFourth","threeEighth"}
+#define  NPDCCHOFFSETRA_MODVALUES   { NPRACH_Parameters_NB_r13__npdcch_Offset_RA_r13_zero,	NPRACH_Parameters_NB_r13__npdcch_Offset_RA_r13_oneEighth,     \
+                                      NPRACH_Parameters_NB_r13__npdcch_Offset_RA_r13_oneFourth, NPRACH_Parameters_NB_r13__npdcch_Offset_RA_r13_threeEighth}
+
+
+
+#define NBIOT_RRCLIST_NPRACHPARAMSCHECK_DESC { \
+             { .s1a= { config_check_modify_integer,    NPRACH_PERIODICITY_OKVALUES,		  NPRACH_PERIODICITY_MODVALUES, 	     8 }},	\
+             { .s1a= { config_check_modify_integer,    NPRACH_STARTTIME_OKVALUES,		  NPRACH_STARTTIME_MODVALUES,  	             8 }},	\
+             { .s1a= { config_check_modify_integer,    NPRACH_SUBCARRIEROFFSET_OKVALUES,	  NPRACH_SUBCARRIEROFFSET_MODVALUES,	     7 }},	\
+             { .s1a= { config_check_modify_integer,    NPRACH_NUMSUBCARRIERS_OKVALUES,  	  NPRACH_NUMSUBCARRIERS_MODVALUES,	     4 }},	\
+             { .s1a= { config_check_modify_integer,    NUMREPETITIONSPERPREAMBLEATTEMPT_OKVALUES, NUMREPETITIONSPERPREAMBLEATTEMPT_MODVALUES,8 }},	\
+             { .s1a= { config_check_modify_integer,    NPDCCHNUMREPETITIONSRA_OKVALUES, 	  NPDCCHNUMREPETITIONSRA_MODVALUES,	     12}},	\
+             { .s1a= { config_check_modify_integer,    NPDCCHSTARTSFCSSRA_OKVALUES,		  NPDCCHSTARTSFCSSRA_MODVALUES,	             8 }},	\
+             { .s3a= { config_checkstr_assign_integer, NPDCCHOFFSETRA_OKVALUES,                   NPDCCHOFFSETRA_MODVALUES,                  4 }},	\
+}
+
+
+
+/*------------------------------------------------------------------------------------------------------------------------------*/
+/* NB-IoT NPrach parameters, there will be three ocuurences of these parameters in each RRC instance                            */
+ /*   optname                                helpstr   paramflags    XXXptr	 defXXXval		  type	        numelt  */
+/*------------------------------------------------------------------------------------------------------------------------------*/
+#define NBIOTRRC_NPRACH_PARAMS_DESC { \
+{"nprach_Periodicity",                        NULL,   0,            uptr:NULL,     defintval:320,	  TYPE_UINT,	   0},  \
+{"nprach_StartTime",                          NULL,   0,            uptr:NULL,     defintval:8, 	  TYPE_UINT,	   0},  \
+{"nprach_SubcarrierOffset",                   NULL,   0,            uptr:NULL,     defintval:0, 	  TYPE_UINT,	   0},  \
+{"nprach_NumSubcarriers",                     NULL,   0,            uptr:NULL,     defintval:12,	  TYPE_UINT,	   0},  \
+{"numRepetitionsPerPreambleAttempt",          NULL,   0,            uptr:NULL,     defintval:2, 	  TYPE_UINT,	   0},  \
+{"npdcch_NumRepetitions_RA",                  NULL,   0,            uptr:NULL,     defintval:16,	  TYPE_UINT,	   0},  \
+{"npdcch_StartSF_CSS_RA",                     NULL,   0,            uptr:NULL,     defintval:2,	          TYPE_UINT,       0},  \
+{"npdcch_Offset_RA",                          NULL,   0,            strptr:NULL,   defstrval:"zero",      TYPE_STRING,     0},  \
+}
+
+#define NBIOT_NPRACH_PERIODICITY_IDX                                   0
+#define NBIOT_NPRACH_STARTTIME_IDX                                     1
+#define NBIOT_NPRACH_SUBCARRIEROFFSET_IDX                              2
+#define NBIOT_NPRACH_NUMSUBCARRIERS_IDX                                3
+#define NBIOT_NUMREPETITIONSPERPREAMBLEATTEMPT_NB_IDX                  4
+#define NBIOT_NPDCCH_NUMREPETITIONS_RA_IDX                             5
+#define NBIOT_NPDCCH_STARTSF_CSS_RA_IDX                                6
+#define NBIOT_NPDCCH_OFFSET_RA_IDX                                     7
+
+/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+/* NB IoT MACRLC configuration list section name   */
+#define NBIOT_MACRLCLIST_CONFIG_STRING                          "NB-IoT_MACRLCs"
+
+
+/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+/* NB IoT L1 configuration list section name   */
+#define NBIOT_L1LIST_CONFIG_STRING                          "NB-IoT_L1s"
diff --git a/openair2/ENB_APP/RRC_config_tools.c b/openair2/ENB_APP/RRC_config_tools.c
new file mode 100644
index 0000000000000000000000000000000000000000..17fbad1e18c542a38fe72c0b8f68f4a7078116c0
--- /dev/null
+++ b/openair2/ENB_APP/RRC_config_tools.c
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*
+  RRC_config_tools.c
+  -------------------
+  AUTHOR  : Francois TABURET
+  COMPANY : NOKIA BellLabs France
+  EMAIL   : francois.taburet@nokia-bell-labs.com 
+
+*/
+
+#include <string.h>
+#include <inttypes.h>
+
+#include "log.h"
+#include "log_extern.h"
+#include "assertions.h"
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+# if defined(ENABLE_USE_MME)
+#   include "s1ap_eNB.h"
+#   include "sctp_eNB_task.h"
+# endif
+#endif
+#include "SystemInformationBlockType2.h"
+#include "common/config/config_userapi.h"
+#include "RRC_config_tools.h"
+#include "DL-GapConfig-NB-r13.h"
+#include "NPRACH-Parameters-NB-r13.h"
+
+static const eutra_band_t eutra_bands[] = {
+  { 1, 1920    * MHz, 1980    * MHz, 2110    * MHz, 2170    * MHz, FDD},
+  { 2, 1850    * MHz, 1910    * MHz, 1930    * MHz, 1990    * MHz, FDD},
+  { 3, 1710    * MHz, 1785    * MHz, 1805    * MHz, 1880    * MHz, FDD},
+  { 4, 1710    * MHz, 1755    * MHz, 2110    * MHz, 2155    * MHz, FDD},
+  { 5,  824    * MHz,  849    * MHz,  869    * MHz,  894    * MHz, FDD},
+  { 6,  830    * MHz,  840    * MHz,  875    * MHz,  885    * MHz, FDD},
+  { 7, 2500    * MHz, 2570    * MHz, 2620    * MHz, 2690    * MHz, FDD},
+  { 8,  880    * MHz,  915    * MHz,  925    * MHz,  960    * MHz, FDD},
+  { 9, 1749900 * KHz, 1784900 * KHz, 1844900 * KHz, 1879900 * KHz, FDD},
+  {10, 1710    * MHz, 1770    * MHz, 2110    * MHz, 2170    * MHz, FDD},
+  {11, 1427900 * KHz, 1452900 * KHz, 1475900 * KHz, 1500900 * KHz, FDD},
+  {12,  698    * MHz,  716    * MHz,  728    * MHz,  746    * MHz, FDD},
+  {13,  777    * MHz,  787    * MHz,  746    * MHz,  756    * MHz, FDD},
+  {14,  788    * MHz,  798    * MHz,  758    * MHz,  768    * MHz, FDD},
+
+  {17,  704    * MHz,  716    * MHz,  734    * MHz,  746    * MHz, FDD},
+  {20,  832    * MHz,  862    * MHz,  791    * MHz,  821    * MHz, FDD},
+  {33, 1900    * MHz, 1920    * MHz, 1900    * MHz, 1920    * MHz, TDD},
+  {33, 1900    * MHz, 1920    * MHz, 1900    * MHz, 1920    * MHz, TDD},
+  {34, 2010    * MHz, 2025    * MHz, 2010    * MHz, 2025    * MHz, TDD},
+  {35, 1850    * MHz, 1910    * MHz, 1850    * MHz, 1910    * MHz, TDD},
+  {36, 1930    * MHz, 1990    * MHz, 1930    * MHz, 1990    * MHz, TDD},
+  {37, 1910    * MHz, 1930    * MHz, 1910    * MHz, 1930    * MHz, TDD},
+  {38, 2570    * MHz, 2620    * MHz, 2570    * MHz, 2630    * MHz, TDD},
+  {39, 1880    * MHz, 1920    * MHz, 1880    * MHz, 1920    * MHz, TDD},
+  {40, 2300    * MHz, 2400    * MHz, 2300    * MHz, 2400    * MHz, TDD},
+  {41, 2496    * MHz, 2690    * MHz, 2496    * MHz, 2690    * MHz, TDD},
+  {42, 3400    * MHz, 3600    * MHz, 3400    * MHz, 3600    * MHz, TDD},
+  {43, 3600    * MHz, 3800    * MHz, 3600    * MHz, 3800    * MHz, TDD},
+  {44, 703    * MHz, 803    * MHz, 703    * MHz, 803    * MHz, TDD},
+};
+
+
+int config_check_band_frequencies(    int ind,
+                                      int16_t band,
+                                      uint32_t downlink_frequency,
+                                      int32_t uplink_frequency_offset,
+                                      uint32_t  frame_type)
+{
+  int errors = 0;
+
+  if (band > 0) {
+    int band_index;
+
+    for (band_index = 0; band_index < sizeof (eutra_bands) / sizeof (eutra_bands[0]); band_index++) {
+      if (band == eutra_bands[band_index].band) {
+        uint32_t uplink_frequency = downlink_frequency + uplink_frequency_offset;
+
+        AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++,
+                     "enb %d downlink frequency %u too low (%u) for band %d!",
+                     ind, downlink_frequency, eutra_bands[band_index].dl_min, band);
+        AssertError (downlink_frequency < eutra_bands[band_index].dl_max, errors ++,
+                     "enb %d downlink frequency %u too high (%u) for band %d!",
+                     ind, downlink_frequency, eutra_bands[band_index].dl_max, band);
+
+        AssertError (eutra_bands[band_index].ul_min < uplink_frequency, errors ++,
+                     "enb %d uplink frequency %u too low (%u) for band %d!",
+                     ind, uplink_frequency, eutra_bands[band_index].ul_min, band);
+        AssertError (uplink_frequency < eutra_bands[band_index].ul_max, errors ++,
+                     "enb %d uplink frequency %u too high (%u) for band %d!",
+                     ind, uplink_frequency, eutra_bands[band_index].ul_max, band);
+
+        AssertError (eutra_bands[band_index].frame_type == frame_type, errors ++,
+                     "enb %d invalid frame type (%d/%d) for band %d!",
+                     ind, eutra_bands[band_index].frame_type, frame_type, band);
+      }
+    }
+  }
+
+
+  return errors;
+}
+
diff --git a/openair2/ENB_APP/RRC_config_tools.h b/openair2/ENB_APP/RRC_config_tools.h
new file mode 100644
index 0000000000000000000000000000000000000000..a44da1f90c5d93a706f7a29e575cedd2989645ff
--- /dev/null
+++ b/openair2/ENB_APP/RRC_config_tools.h
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*
+  RRC_config_tools.h
+  -------------------
+  AUTHOR  : Francois TABURET
+  COMPANY : NOKIA BellLabs France
+  EMAIL   : francois.taburet@nokia-bell-labs.com
+*/
+#ifndef RRC_CONFIG_TOOLS_H_
+#define RRC_CONFIG_TOOLS_H_
+
+#define KHz (1000UL)
+#define MHz (1000 * KHz)
+
+typedef struct eutra_band_s {
+  int16_t             band;
+  uint32_t            ul_min;
+  uint32_t            ul_max;
+  uint32_t            dl_min;
+  uint32_t            dl_max;
+  lte_frame_type_t    frame_type;
+} eutra_band_t;
+
+
+extern int config_check_band_frequencies(int ind, int16_t band, uint32_t downlink_frequency, 
+                                         int32_t uplink_frequency_offset, uint32_t  frame_type);
+
+extern int config_check_assign_DLGap_NB(paramdef_t *param);
+extern int config_check_assign_rach_NB(paramdef_t *param);
+#endif
diff --git a/openair2/ENB_APP/RRC_paramsvalues.h b/openair2/ENB_APP/RRC_paramsvalues.h
new file mode 100644
index 0000000000000000000000000000000000000000..06fee0e172515ed105adb6dc54fa5d808af07491
--- /dev/null
+++ b/openair2/ENB_APP/RRC_paramsvalues.h
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file openair2/ENB_APP/RRC_paramsvalues.h
+ * \brief macro definitions for RRC authorized and asn1 parameters values, to be used in paramdef_t/chechedparam_t structure initializations 
+ * \author Francois TABURET
+ * \date 2017
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+#ifndef __RRC_PARAMSVALUES__H__
+#define __RRC_PARAMSVALUES__H__
+/*    cell configuration section name */
+#define ENB_CONFIG_STRING_ENB_LIST                      "eNBs"
+/* component carriers configuration section name */		
+#define ENB_CONFIG_STRING_COMPONENT_CARRIERS                            "component_carriers"		 
+
+#define ENB_CONFIG_STRING_FRAME_TYPE                                    "frame_type"
+#define ENB_CONFIG_STRING_PBCH_REPETITION                               "pbch_repetition"
+#define ENB_CONFIG_STRING_TDD_CONFIG                                    "tdd_config"
+#define ENB_CONFIG_STRING_TDD_CONFIG_S                                  "tdd_config_s"
+#define ENB_CONFIG_STRING_PREFIX_TYPE                                   "prefix_type"
+#define ENB_CONFIG_STRING_PREFIX_TYPE_UL                                "prefix_type_UL"
+#define ENB_CONFIG_STRING_EUTRA_BAND                                    "eutra_band"
+#define ENB_CONFIG_STRING_DOWNLINK_FREQUENCY                            "downlink_frequency"
+#define ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET                       "uplink_frequency_offset"
+#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 FRAMETYPE_OKVALUES                                      {"FDD","TDD"}
+#define FRAMETYPE_MODVALUES                                     { FDD, TDD} 
+
+#define TDDCFG(A)                                               TDD_Config__subframeAssignment_ ## A
+#define TDDCONFIG_OKRANGE                                       { TDDCFG(sa0), TDDCFG(sa6)}   
+
+#define TDDCFGS(A)                                              TDD_Config__specialSubframePatterns_ ## A
+#define TDDCONFIGS_OKRANGE                                      { TDDCFGS(ssp0), TDDCFGS(ssp8)}   
+
+#define PREFIX_OKVALUES                                         {"NORMAL","EXTENDED"}
+#define PREFIX_MODVALUES                                        { NORMAL, EXTENDED} 
+
+#define PREFIXUL_OKVALUES                                       {"NORMAL","EXTENDED"}
+#define PREFIXUL_MODVALUES                                      { NORMAL, EXTENDED} 
+
+#define NRBDL_OKVALUES                                          {6,15,25,50,75,100}
+
+#define UETIMER_T300_OKVALUES                                   {100,200,300,400,600,1000,1500,2000}
+#define UETT300(A)                                              UE_TimersAndConstants__t300_ ## A
+#define UETIMER_T300_MODVALUES                                  { UETT300(ms100), UETT300(ms200),UETT300(ms300),UETT300(ms400),UETT300(ms600),UETT300(ms1000),UETT300(ms1500),UETT300(ms2000)}           		
+
+#define UETIMER_T301_OKVALUES                                   {100,200,300,400,600,1000,1500,2000}
+#define UETT301(A)                                              UE_TimersAndConstants__t301_ ## A
+#define UETIMER_T301_MODVALUES                                  { UETT301(ms100), UETT301(ms200),UETT301(ms300),UETT301(ms400),UETT301(ms600),UETT301(ms1000),UETT301(ms1500),UETT301(ms2000)}
+
+#define UETIMER_T310_OKVALUES                                   {0,50,100,200,500,1000,2000}
+#define UETT310(A)                                              UE_TimersAndConstants__t310_ ## A
+#define UETIMER_T310_MODVALUES                                  { UETT310(ms0), UETT310(ms50),UETT310(ms100),UETT310(ms200),UETT310(ms500),UETT310(ms1000),UETT310(ms2000)}
+
+#define UETIMER_T311_OKVALUES                                   {1000,3110,5000,10000,15000,20000,31100}
+#define UETT311(A)                                              UE_TimersAndConstants__t311_ ## A
+#define UETIMER_T311_MODVALUES                                  { UETT311(ms1000), UETT311(ms3000),UETT311(ms5000),UETT311(ms10000),UETT311(ms15000),UETT311(ms20000),UETT311(ms30000)}
+
+#define UETIMER_N310_OKVALUES                                   {1,2,3,4,6,8,10,20}
+#define UETN310(A)                                              UE_TimersAndConstants__n310_ ## A
+#define UETIMER_N310_MODVALUES                                  { UETN310(n1), UETN310(n2),UETN310(n3),UETN310(n4),UETN310(n6),UETN310(n8),UETN310(n10),UETN310(n20)}
+
+#define UETIMER_N311_OKVALUES                                   {1,2,3,4,5,6,8,10}
+#define UETN311(A)                                              UE_TimersAndConstants__n311_ ## A
+#define UETIMER_N311_MODVALUES                                  { UETN311(n1), UETN311(n2),UETN311(n3),UETN311(n4),UETN311(n5),UETN311(n6),UETN311(n8),UETN311(n10)}
+
+#endif
diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index 0ca8616fd9a8e88dcb3e683e16aa96d79e247f4e..481bfaa521e961ce08466ff427be69c58e6a259d 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,10 +36,6 @@
 #include "common/ran_context.h"
 
 #include "log.h"
-#if defined(OAI_EMU)
-# include "OCG.h"
-# include "OCG_extern.h"
-#endif
 
 #if defined(ENABLE_ITTI)
 # include "intertask_interface.h"
@@ -50,10 +46,6 @@
 #   include "gtpv1u_eNB_task.h"
 # endif
 
-#if defined(FLEXRAN_AGENT_SB_IF)
-#   include "flexran_agent.h"
-#endif
-
 extern unsigned char NB_eNB_INST;
 #endif
 
@@ -102,102 +94,6 @@ static void configure_rrc(uint32_t enb_id)
   if (RC.rrc[enb_id]) {
     RCconfig_RRC(msg_p,enb_id, RC.rrc[enb_id]);
     
-  /*
-  RRC_CONFIGURATION_REQ (msg_p).cell_identity =   enb_properties->properties[enb_id]->eNB_id;
-  RRC_CONFIGURATION_REQ (msg_p).tac =             enb_properties->properties[enb_id]->tac;
-  RRC_CONFIGURATION_REQ (msg_p).mcc =             enb_properties->properties[enb_id]->mcc;
-  RRC_CONFIGURATION_REQ (msg_p).mnc =             enb_properties->properties[enb_id]->mnc;
-  RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length;
-
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    RRC_CONFIGURATION_REQ (msg_p).frame_type[CC_id]                               = enb_properties->properties[enb_id]->frame_type[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).tdd_config[CC_id]                               = enb_properties->properties[enb_id]->tdd_config[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[CC_id]                             = enb_properties->properties[enb_id]->tdd_config_s[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).eutra_band[CC_id]                               = enb_properties->properties[enb_id]->eutra_band[CC_id];
-
-    // RACH-Config
-    RRC_CONFIGURATION_REQ (msg_p).rach_numberOfRA_Preambles[CC_id]                = enb_properties->properties[enb_id]->rach_numberOfRA_Preambles[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_preamblesGroupAConfig[CC_id]               = enb_properties->properties[enb_id]->rach_preamblesGroupAConfig[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_sizeOfRA_PreamblesGroupA[CC_id]            = enb_properties->properties[enb_id]->rach_sizeOfRA_PreamblesGroupA[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[CC_id]                   = enb_properties->properties[enb_id]->rach_messageSizeGroupA[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[CC_id]            = enb_properties->properties[enb_id]->rach_messagePowerOffsetGroupB[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_powerRampingStep[CC_id]                    = enb_properties->properties[enb_id]->rach_powerRampingStep[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_preambleInitialReceivedTargetPower[CC_id]  = enb_properties->properties[enb_id]->rach_preambleInitialReceivedTargetPower[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[CC_id]                    = enb_properties->properties[enb_id]->rach_preambleTransMax[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_raResponseWindowSize[CC_id]                = enb_properties->properties[enb_id]->rach_raResponseWindowSize[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_macContentionResolutionTimer[CC_id]        = enb_properties->properties[enb_id]->rach_macContentionResolutionTimer[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).rach_maxHARQ_Msg3Tx[CC_id]                      = enb_properties->properties[enb_id]->rach_maxHARQ_Msg3Tx[CC_id];
-
-    // BCCH-Config
-    RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[CC_id]             = enb_properties->properties[enb_id]->bcch_modificationPeriodCoeff[CC_id];
-
-    // PCCH-Config
-    RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[CC_id]                  = enb_properties->properties[enb_id]->pcch_defaultPagingCycle[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pcch_nB[CC_id]                                  = enb_properties->properties[enb_id]->pcch_nB[CC_id];
-
-    // PRACH-Config
-    RRC_CONFIGURATION_REQ (msg_p).prach_root[CC_id]                               = enb_properties->properties[enb_id]->prach_root[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).prach_config_index[CC_id]                       = enb_properties->properties[enb_id]->prach_config_index[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[CC_id]                         = enb_properties->properties[enb_id]->prach_high_speed[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).prach_zero_correlation[CC_id]                   = enb_properties->properties[enb_id]->prach_zero_correlation[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[CC_id]                        = enb_properties->properties[enb_id]->prach_freq_offset[CC_id];
-
-    // PDSCH-Config
-    RRC_CONFIGURATION_REQ (msg_p).pdsch_referenceSignalPower[CC_id]               = enb_properties->properties[enb_id]->pdsch_referenceSignalPower[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pdsch_p_b[CC_id]                                = enb_properties->properties[enb_id]->pdsch_p_b[CC_id];
-
-    // PUSCH-Config
-    RRC_CONFIGURATION_REQ (msg_p).pusch_n_SB[CC_id]                               = enb_properties->properties[enb_id]->pusch_n_SB[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[CC_id]                        = enb_properties->properties[enb_id]->pusch_hoppingMode[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingOffset[CC_id]                      = enb_properties->properties[enb_id]->pusch_hoppingOffset[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pusch_enable64QAM[CC_id]                        = enb_properties->properties[enb_id]->pusch_enable64QAM[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pusch_groupHoppingEnabled[CC_id]                = enb_properties->properties[enb_id]->pusch_groupHoppingEnabled[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pusch_groupAssignment[CC_id]                    = enb_properties->properties[enb_id]->pusch_groupAssignment[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pusch_sequenceHoppingEnabled[CC_id]             = enb_properties->properties[enb_id]->pusch_sequenceHoppingEnabled[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pusch_nDMRS1[CC_id]                             = enb_properties->properties[enb_id]->pusch_nDMRS1[CC_id];
-
-    // PUCCH-Config
-
-    RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[CC_id]                        = enb_properties->properties[enb_id]->pucch_delta_shift[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pucch_nRB_CQI[CC_id]                            = enb_properties->properties[enb_id]->pucch_nRB_CQI[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pucch_nCS_AN[CC_id]                             = enb_properties->properties[enb_id]->pucch_nCS_AN[CC_id];
-#if !defined(Rel10) && !defined(Rel14)
-    RRC_CONFIGURATION_REQ (msg_p).pucch_n1_AN[CC_id]                              = enb_properties->properties[enb_id]->pucch_n1_AN[CC_id];
-#endif
-
-    // SRS Config
-    RRC_CONFIGURATION_REQ (msg_p).srs_enable[CC_id]                               = enb_properties->properties[enb_id]->srs_enable[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).srs_BandwidthConfig[CC_id]                      = enb_properties->properties[enb_id]->srs_BandwidthConfig[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).srs_SubframeConfig[CC_id]                       = enb_properties->properties[enb_id]->srs_SubframeConfig[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).srs_ackNackST[CC_id]                            = enb_properties->properties[enb_id]->srs_ackNackST[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).srs_MaxUpPts[CC_id]                             = enb_properties->properties[enb_id]->srs_MaxUpPts[CC_id];
-
-    // uplinkPowerControlCommon
-
-    RRC_CONFIGURATION_REQ (msg_p).pusch_p0_Nominal[CC_id]                         = enb_properties->properties[enb_id]->pusch_p0_Nominal[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pucch_p0_Nominal[CC_id]                         = enb_properties->properties[enb_id]->pucch_p0_Nominal[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[CC_id]                              = enb_properties->properties[enb_id]->pusch_alpha[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[CC_id]                     = enb_properties->properties[enb_id]->pucch_deltaF_Format1[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[CC_id]                    = enb_properties->properties[enb_id]->pucch_deltaF_Format1b[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[CC_id]                     = enb_properties->properties[enb_id]->pucch_deltaF_Format2[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[CC_id]                    = enb_properties->properties[enb_id]->pucch_deltaF_Format2a[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[CC_id]                    = enb_properties->properties[enb_id]->pucch_deltaF_Format2b[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).msg3_delta_Preamble[CC_id]                      = enb_properties->properties[enb_id]->msg3_delta_Preamble[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).ul_CyclicPrefixLength[CC_id]                    = enb_properties->properties[enb_id]->ul_CyclicPrefixLength[CC_id];
-
-    // UE Timers and Constants
-
-    RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[CC_id]               = enb_properties->properties[enb_id]->ue_TimersAndConstants_t300[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[CC_id]               = enb_properties->properties[enb_id]->ue_TimersAndConstants_t301[CC_id];
-    RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[CC_id]               = enb_properties->properties[enb_id]->ue_TimersAndConstants_t310[CC_id];
-    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];
-
-  }
-  */
 
     LOG_I(ENB_APP,"Sending configuration message to RRC task\n");
     itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
@@ -211,21 +107,10 @@ static void configure_rrc(uint32_t enb_id)
 static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, const Enb_properties_array_t *enb_properties)
 {
   uint32_t         enb_id;
-  uint32_t         mme_id;
   MessageDef      *msg_p;
   uint32_t         register_enb_pending = 0;
-  char            *str                  = NULL;
-  struct in_addr   addr;
-
-#   if defined(OAI_EMU)
-
-#   endif
 
   for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
-#   if defined(OAI_EMU)
-
-    if (oai_emulation.info.cli_start_enb[enb_id] == 1)
-#   endif
     {
       s1ap_register_enb_req_t *s1ap_register_eNB;
 
@@ -239,44 +124,6 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//,
       s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p);
       LOG_I(ENB_APP,"default drx %d\n",s1ap_register_eNB->default_drx);
 
-      /*
-   
-      s1ap_register_eNB->eNB_id           = enb_properties->properties[enb_id]->eNB_id;
-      s1ap_register_eNB->cell_type        = enb_properties->properties[enb_id]->cell_type;
-      s1ap_register_eNB->eNB_name         = enb_properties->properties[enb_id]->eNB_name;
-      s1ap_register_eNB->tac              = enb_properties->properties[enb_id]->tac;
-      s1ap_register_eNB->mcc              = enb_properties->properties[enb_id]->mcc;
-      s1ap_register_eNB->mnc              = enb_properties->properties[enb_id]->mnc;
-      s1ap_register_eNB->mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length;
-      s1ap_register_eNB->default_drx      = enb_properties->properties[enb_id]->pcch_defaultPagingCycle[0];
-
-      s1ap_register_eNB->nb_mme =         enb_properties->properties[enb_id]->nb_mme;
-
-      AssertFatal (s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, "Too many MME for eNB %d (%d/%d)!", enb_id, s1ap_register_eNB->nb_mme,
-                   S1AP_MAX_NB_MME_IP_ADDRESS);
-
-      for (mme_id = 0; mme_id < s1ap_register_eNB->nb_mme; mme_id++) {
-        s1ap_register_eNB->mme_ip_address[mme_id].ipv4 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4;
-        s1ap_register_eNB->mme_ip_address[mme_id].ipv6 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6;
-        strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv4_address,
-                 enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4_address,
-                 sizeof(s1ap_register_eNB->mme_ip_address[0].ipv4_address));
-        strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv6_address,
-                 enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6_address,
-                 sizeof(s1ap_register_eNB->mme_ip_address[0].ipv6_address));
-      }
-
-      s1ap_register_eNB->sctp_in_streams       = enb_properties->properties[enb_id]->sctp_in_streams;
-      s1ap_register_eNB->sctp_out_streams      = enb_properties->properties[enb_id]->sctp_out_streams;
-
-
-      s1ap_register_eNB->enb_ip_address.ipv6 = 0;
-      s1ap_register_eNB->enb_ip_address.ipv4 = 1;
-      addr.s_addr = enb_properties->properties[enb_id]->enb_ipv4_address_for_S1_MME;
-      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);
@@ -303,34 +150,24 @@ void *eNB_app_task(void *args_p)
   long                            enb_register_retry_timer_id;
 # endif
   uint32_t                        enb_id;
-  MessageDef                      *msg_p           = NULL;
-  const char                      *msg_name        = NULL;
+  MessageDef                     *msg_p           = NULL;
+  const char                     *msg_name        = NULL;
   instance_t                      instance;
   int                             result;
-  int                             j;
   /* for no gcc warnings */
   (void)instance;
 
   itti_mark_task_ready (TASK_ENB_APP);
 
+  LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__);
+
   RCconfig_L1();
 
   RCconfig_macrlc();
 
-  if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n");
-
-  # if defined(ENABLE_ITTI)
-#   if defined(OAI_EMU)
-  enb_nb =        oai_emulation.info.nb_enb_local;
-  enb_id_start =  oai_emulation.info.first_enb_local;
-  enb_id_end =    oai_emulation.info.first_enb_local + enb_nb;
-
-  AssertFatal (enb_id_end <= NUMBER_OF_eNB_MAX,
-               "Last eNB index is greater or equal to maximum eNB index (%d/%d)!",
-               enb_id_end, NUMBER_OF_eNB_MAX);
-#   endif
-  # endif
+  LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst);
 
+  if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n");
 
   AssertFatal (enb_nb <= RC.nb_inst,
                "Number of eNB is greater than eNB defined in configuration file (%d/%d)!",
@@ -339,22 +176,14 @@ void *eNB_app_task(void *args_p)
   LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst);
 
   RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *));
+  LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc);
 
   for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
     RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST));
+    LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end);
     memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST));
     configure_rrc(enb_id);
   }
-  
-#if defined (FLEXRAN_AGENT_SB_IF)
-  
-  for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
-    printf("\n start enb agent %d\n", enb_id);
-    flexran_agent_start(enb_id, enb_properties_p);
-  }
-#endif 
-  
-
 
 # if defined(ENABLE_USE_MME)
   /* Try to register each eNB */
@@ -375,6 +204,7 @@ void *eNB_app_task(void *args_p)
 
     switch (ITTI_MSG_ID(msg_p)) {
     case TERMINATE_MESSAGE:
+      LOG_W(ENB_APP, " *** Exiting ENB_APP thread\n");
       itti_exit_task ();
       break;
 
@@ -405,16 +235,6 @@ void *eNB_app_task(void *args_p)
           msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE);
           itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p);
 
-#   if defined(OAI_EMU)
-
-          /* Also inform all NAS UE tasks */
-          for (instance = NB_eNB_INST + oai_emulation.info.first_ue_local;
-               instance < (NB_eNB_INST + oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); instance ++) {
-            msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE);
-            itti_send_msg_to_task (TASK_NAS_UE, instance, msg_init_p);
-          }
-
-#   endif
         } else {
           uint32_t not_associated = enb_nb - registered_enb;
 
diff --git a/openair2/ENB_APP/enb_app.h b/openair2/ENB_APP/enb_app.h
index 8e3c28760b98d3b7df1f7c119eb9cd6723aa256c..4dfea72eefbbbf6bc951f562b17f91b869e3ed4a 100644
--- a/openair2/ENB_APP/enb_app.h
+++ b/openair2/ENB_APP/enb_app.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -30,8 +30,12 @@
 #ifndef ENB_APP_H_
 #define ENB_APP_H_
 
+#include <stdint.h>
 
 
 void *eNB_app_task(void *args_p);
 
+/* needed for flexran: start PHY and RRC when restarting */
+void enb_app_start_phy_rrc(uint32_t enb_id_start, uint32_t enb_id_end);
+
 #endif /* ENB_APP_H_ */
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 8e8483d6068b9ddc49f11e1261a66f838b062139..da595a97a6bd2f1d3a2f0c9c1c4ba017b5c21f38 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,10 +36,6 @@
 #include "enb_config.h"
 #include "UTIL/OTG/otg.h"
 #include "UTIL/OTG/otg_externs.h"
-#if defined(OAI_EMU)
-# include "OCG.h"
-# include "OCG_extern.h"
-#endif
 #if defined(ENABLE_ITTI)
 # include "intertask_interface.h"
 # if defined(ENABLE_USE_MME)
@@ -50,235 +46,95 @@
 #include "sctp_default_values.h"
 #include "SystemInformationBlockType2.h"
 #include "LAYER2/MAC/extern.h"
+#include "LAYER2/MAC/proto.h"
 #include "PHY/extern.h"
 #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
-#include "enb_paramdef.h"
-#include "common/config/config_userapi.h"
+#include "nfapi_vnf.h"
+#include "nfapi_pnf.h"
 
+#include "L1_paramdef.h"
+#include "MACRLC_paramdef.h"
+#include "common/config/config_userapi.h"
+#include "RRC_config_tools.h"
+#include "enb_paramdef.h"
 
-int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc);
-int RCconfig_S1(MessageDef *msg_p, uint32_t i);
+extern uint16_t sf_ahead;
 
 
-static int enb_check_band_frequencies(char* lib_config_file_name_pP,
-                                      int ind,
-                                      int16_t band,
-                                      uint32_t downlink_frequency,
-                                      int32_t uplink_frequency_offset,
-                                      lte_frame_type_t frame_type)
+void RCconfig_flexran()
 {
-  int errors = 0;
-
-  if (band > 0) {
-    int band_index;
-
-    for (band_index = 0; band_index < sizeof (eutra_bands) / sizeof (eutra_bands[0]); band_index++) {
-      if (band == eutra_bands[band_index].band) {
-        uint32_t uplink_frequency = downlink_frequency + uplink_frequency_offset;
-
-        AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++,
-                     "Failed to parse eNB configuration file %s, enb %d downlink frequency %u too low (%u) for band %d!",
-                     lib_config_file_name_pP, ind, downlink_frequency, eutra_bands[band_index].dl_min, band);
-        AssertError (downlink_frequency < eutra_bands[band_index].dl_max, errors ++,
-                     "Failed to parse eNB configuration file %s, enb %d downlink frequency %u too high (%u) for band %d!",
-                     lib_config_file_name_pP, ind, downlink_frequency, eutra_bands[band_index].dl_max, band);
-
-        AssertError (eutra_bands[band_index].ul_min < uplink_frequency, errors ++,
-                     "Failed to parse eNB configuration file %s, enb %d uplink frequency %u too low (%u) for band %d!",
-                     lib_config_file_name_pP, ind, uplink_frequency, eutra_bands[band_index].ul_min, band);
-        AssertError (uplink_frequency < eutra_bands[band_index].ul_max, errors ++,
-                     "Failed to parse eNB configuration file %s, enb %d uplink frequency %u too high (%u) for band %d!",
-                     lib_config_file_name_pP, ind, uplink_frequency, eutra_bands[band_index].ul_max, band);
-
-        AssertError (eutra_bands[band_index].frame_type == frame_type, errors ++,
-                     "Failed to parse eNB configuration file %s, enb %d invalid frame type (%d/%d) for band %d!",
-                     lib_config_file_name_pP, ind, eutra_bands[band_index].frame_type, frame_type, band);
-      }
-    }
-  }
-
-
-  return errors;
-}
-
-
-
-
-
-
-
-/* --------------------------------------------------------*/
-/* from here function to use configuration module          */
-void RCconfig_RU(void) {
-  
-  int               j                             = 0;
-  int               i                             = 0;
-
-  
-  paramdef_t RUParams[] = RUPARAMS_DESC;
-  paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
-
+  int i;
 
-  config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);  
+  paramdef_t flexranParams[] = FLEXRANPARAMS_DESC;
+  config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
 
-  
-  if ( RUParamList.numelt > 0) {
-
-
-    RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
-   
-
-
-
-    RC.ru_mask=(1<<NB_RU) - 1;
-    printf("Set RU mask to %lx\n",RC.ru_mask);
-
-    for (j = 0; j < RC.nb_RU; j++) {
-
-      RC.ru[j]                                    = (RU_t*)malloc(sizeof(RU_t));
-      memset((void*)RC.ru[j],0,sizeof(RU_t));
-      RC.ru[j]->idx                                 = j;
-
-      RC.ru[j]->if_timing                           = synch_to_ext_device;
-      if (RC.nb_L1_inst >0)
-        RC.ru[j]->num_eNB                           = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt;
-      else
-	    RC.ru[j]->num_eNB                           = 0;
-      for (i=0;i<RC.ru[j]->num_eNB;i++) RC.ru[j]->eNB_list[i] = RC.eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0];     
-
-
-      if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
-	if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
-	  RC.ru[j]->if_south                        = LOCAL_RF;
-	  RC.ru[j]->function                        = eNodeB_3GPP;
-	  printf("Setting function for RU %d to eNodeB_3GPP\n",j);
-        }
-        else { 
-          RC.ru[j]->eth_params.local_if_name            = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));    
-          RC.ru[j]->eth_params.my_addr                  = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); 
-          RC.ru[j]->eth_params.remote_addr              = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
-          RC.ru[j]->eth_params.my_portc                 = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
-          RC.ru[j]->eth_params.remote_portc             = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
-          RC.ru[j]->eth_params.my_portd                 = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
-          RC.ru[j]->eth_params.remote_portd             = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
-
-	  if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
-	    RC.ru[j]->if_south                        = LOCAL_RF;
-	    RC.ru[j]->function                        = NGFI_RRU_IF5;
-	    RC.ru[j]->eth_params.transp_preference    = ETH_UDP_MODE;
-	    printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j);
-	  } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
-	    RC.ru[j]->if_south                        = LOCAL_RF;
-	    RC.ru[j]->function                        = NGFI_RRU_IF5;
-	    RC.ru[j]->eth_params.transp_preference    = ETH_RAW_MODE;
-	    printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j);
-	  } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
-	    RC.ru[j]->if_south                        = LOCAL_RF;
-	    RC.ru[j]->function                        = NGFI_RRU_IF4p5;
-	    RC.ru[j]->eth_params.transp_preference    = ETH_UDP_IF4p5_MODE;
-	    printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j);
-	  } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
-	    RC.ru[j]->if_south                        = LOCAL_RF;
-	    RC.ru[j]->function                        = NGFI_RRU_IF4p5;
-	    RC.ru[j]->eth_params.transp_preference    = ETH_RAW_IF4p5_MODE;
-	    printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j);
-	  }
-	}
-	RC.ru[j]->max_pdschReferenceSignalPower     = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
-	RC.ru[j]->max_rxgain                        = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
-	RC.ru[j]->num_bands                         = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
-	for (i=0;i<RC.ru[j]->num_bands;i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; 
-      } //strcmp(local_rf, "yes") == 0
-      else {
-	printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr));
-
-        RC.ru[j]->eth_params.local_if_name	      = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));    
-        RC.ru[j]->eth_params.my_addr		      = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); 
-        RC.ru[j]->eth_params.remote_addr	      = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
-        RC.ru[j]->eth_params.my_portc		      = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
-        RC.ru[j]->eth_params.remote_portc	      = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
-        RC.ru[j]->eth_params.my_portd		      = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
-        RC.ru[j]->eth_params.remote_portd	      = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
-	if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
-	  RC.ru[j]->if_south                     = REMOTE_IF5;
-	  RC.ru[j]->function                     = NGFI_RAU_IF5;
-	  RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE;
-	} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
-	  RC.ru[j]->if_south                     = REMOTE_IF5;
-	  RC.ru[j]->function                     = NGFI_RAU_IF5;
-	  RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE;
-	} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
-	  RC.ru[j]->if_south                     = REMOTE_IF4p5;
-	  RC.ru[j]->function                     = NGFI_RAU_IF4p5;
-	  RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
-	} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
-	  RC.ru[j]->if_south                     = REMOTE_IF4p5;
-	  RC.ru[j]->function                     = NGFI_RAU_IF4p5;
-	  RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
-	} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if5_mobipass") == 0) {
-	  RC.ru[j]->if_south                     = REMOTE_IF5;
-	  RC.ru[j]->function                     = NGFI_RAU_IF5;
-	  RC.ru[j]->if_timing                    = synch_to_other;
-	  RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS;
-	}
-	RC.ru[j]->att_tx                         = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); 
-	RC.ru[j]->att_rx                         = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); 
-      }  /* strcmp(local_rf, "yes") != 0 */
-
-      RC.ru[j]->nb_tx                             = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
-      RC.ru[j]->nb_rx                             = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
-      
-    }// j=0..num_rus
-  } else {
-    RC.nb_RU = 0;	    
-  } // setting != NULL
+  if (!RC.flexran) {
+    RC.flexran = calloc(RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
+    AssertFatal(RC.flexran != NULL,
+                "can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n",
+                RC.nb_L1_inst * sizeof(flexran_agent_info_t*),
+                RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
+  }
 
-  return;
-  
+  /* For all agent instance, fill in the same controller configuration. */
+  for (i = 0; i < RC.nb_L1_inst; i++) {
+    RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t));
+    AssertFatal(RC.flexran[i] != NULL,
+                "can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n",
+                sizeof(flexran_agent_info_t), i + 1, RC.nb_L1_inst);
+    /* if config says "yes", enable Agent, in all other cases it's like "no" */
+    RC.flexran[i]->enabled          = strcmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0;
+    RC.flexran[i]->interface_name   = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr));
+    //inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
+    RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr));
+    RC.flexran[i]->remote_port      = *(flexranParams[FLEXRAN_PORT_IDX].uptr);
+    RC.flexran[i]->cache_name       = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr));
+    RC.flexran[i]->node_ctrl_state  = strcmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION;
+    RC.flexran[i]->enb_id           = i;
+  }
 }
 
-void RCconfig_L1() {
+void RCconfig_L1(void) {
   int               i,j;
   paramdef_t L1_Params[] = L1PARAMS_DESC;
   paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0};
 
 
-  config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);    
-  if (L1_ParamList.numelt > 0) {
+  if (RC.eNB == NULL) {
+    RC.eNB                       = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB**));
+    LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
+    memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB**));
+    RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
+  }
 
-    if (RC.eNB == NULL) {
-      RC.eNB                               = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
-      LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
-      memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
-      RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
-    }
+  config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
+  if (L1_ParamList.numelt > 0) {
 
     for (j = 0; j < RC.nb_L1_inst; j++) {
       RC.nb_L1_CC[j] = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr);
 
-
       if (RC.eNB[j] == NULL) {
-	RC.eNB[j]                       = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**));
+	RC.eNB[j]                       = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB*));
 	LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]);
-	memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***));
+	memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB*));
       }
 
-
       for (i=0;i<RC.nb_L1_CC[j];i++) {
-	if (RC.eNB[j][i] == NULL) {
-	  RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
-	  memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
-	  LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
-	  RC.eNB[j][i]->Mod_id  = j;
-	  RC.eNB[j][i]->CC_id   = i;
-	}
+        if (RC.eNB[j][i] == NULL) {
+          RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
+          memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
+          LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
+          RC.eNB[j][i]->Mod_id  = j;
+          RC.eNB[j][i]->CC_id   = i;
+        }
       }
 
       if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
 
+        sf_ahead = 4; // Need 4 subframe gap between RX and TX
       }
       else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
-	RC.eNB[j][0]->eth_params_n.local_if_name            = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
+        RC.eNB[j][0]->eth_params_n.local_if_name            = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
 	RC.eNB[j][0]->eth_params_n.my_addr                  = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
 	RC.eNB[j][0]->eth_params_n.remote_addr              = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
 	RC.eNB[j][0]->eth_params_n.my_portc                 = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
@@ -286,8 +142,25 @@ void RCconfig_L1() {
 	RC.eNB[j][0]->eth_params_n.my_portd                 = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
 	RC.eNB[j][0]->eth_params_n.remote_portd             = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
 	RC.eNB[j][0]->eth_params_n.transp_preference        = ETH_UDP_MODE;
+
+        sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
+
+        RC.nb_macrlc_inst = 1;  // This is used by mac_top_init_eNB()
+
+        // This is used by init_eNB_afterRU()
+        RC.nb_CC = (int *)malloc((1+RC.nb_inst)*sizeof(int));
+        RC.nb_CC[0]=1;
+
+        RC.nb_inst =1; // DJP - feptx_prec uses num_eNB but phy_init_RU uses nb_inst
+
+        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_inst=1 this is because phy_init_RU() uses that to index and not RC.num_eNB - why the 2 similar variables?\n", __FUNCTION__);
+        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_CC[0]=%d for init_eNB_afterRU()\n", __FUNCTION__, RC.nb_CC[0]);
+        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_macrlc_inst:%d because used by mac_top_init_eNB()\n", __FUNCTION__, RC.nb_macrlc_inst);
+
+        mac_top_init_eNB();
+
+        configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd, RC.eNB[j][0]->eth_params_n     .remote_portd);
       }
-      
       else { // other midhaul
       }	
     }// j=0..num_inst
@@ -295,6 +168,30 @@ void RCconfig_L1() {
     l1_north_init_eNB();
   } else {
     LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found");    
+
+    // DJP need to create some structures for VNF
+
+    j = 0;
+
+    RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int)); // DJP - 1 lot then???
+
+    RC.nb_L1_CC[j]=1; // DJP - hmmm
+
+    if (RC.eNB[j] == NULL) {
+      RC.eNB[j]                       = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**));
+      LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]);
+      memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***));
+    }
+
+    for (i=0;i<RC.nb_L1_CC[j];i++) {
+      if (RC.eNB[j][i] == NULL) {
+        RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
+        memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
+        LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
+        RC.eNB[j][i]->Mod_id  = j;
+        RC.eNB[j][i]->CC_id   = i;
+      }
+    }
   }
 }
 
@@ -307,7 +204,6 @@ void RCconfig_macrlc() {
 
   config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);    
   
-
   if ( MacRLC_ParamList.numelt > 0) {
 
     RC.nb_macrlc_inst=MacRLC_ParamList.numelt; 
@@ -345,6 +241,12 @@ void RCconfig_macrlc() {
 	RC.mac[j]->eth_params_s.my_portd                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
 	RC.mac[j]->eth_params_s.remote_portd             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
 	RC.mac[j]->eth_params_s.transp_preference        = ETH_UDP_MODE;
+
+        sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
+
+        printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
+        configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
+        printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
       } else { // other midhaul
 	AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
       }	
@@ -427,7 +329,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
   int32_t     rach_powerRampingStep         = 0;
   int32_t     rach_preambleInitialReceivedTargetPower    = 0;
   int32_t     rach_preambleTransMax         = 0;
-  int32_t     rach_raResponseWindowSize     = 0;
+  int32_t     rach_raResponseWindowSize     = 10;
   int32_t     rach_macContentionResolutionTimer = 0;
   int32_t     rach_maxHARQ_Msg3Tx           = 0;
   int32_t     pcch_defaultPagingCycle       = 0;
@@ -454,10 +356,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
 
   
 /* 
-  char*             flexran_agent_interface_name      = NULL;
-  char*             flexran_agent_ipv4_address        = NULL;
-  int32_t     flexran_agent_port                = 0;
-  char*             flexran_agent_cache               = NULL;
   int32_t     otg_ue_id                     = 0;
   char*             otg_app_type                  = NULL;
   char*             otg_bg_traffic                = NULL;
@@ -488,14 +386,16 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
   paramdef_t ENBParams[]  = ENBPARAMS_DESC;
   paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0};  
 
+  checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
   paramdef_t CCsParams[] = CCPARAMS_DESC;
   paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0};
   
   paramdef_t SRB1Params[] = SRB1PARAMS_DESC;  
 
-  
-
-
+/* map parameter checking array instances to parameter definition array instances */
+  for (int I=0; I< ( sizeof(CCsParams)/ sizeof(paramdef_t)  ) ; I++) {
+     CCsParams[I].chkPptr = &(config_check_CCparams[I]);  
+  }
 /* get global parameters, defined outside any section in the config file */
   
   config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); 
@@ -630,43 +530,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
 		    
 
 	      nb_cc++;
-	      /*
-		if (strcmp(cc_node_function, "eNodeB_3GPP") == 0) {
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = eNodeB_3GPP;
-		} else if (strcmp(cc_node_function, "eNodeB_3GPP_BBU") == 0) {
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = eNodeB_3GPP_BBU;
-		} else if (strcmp(cc_node_function, "NGFI_RCC_IF4p5") == 0) {
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = NGFI_RCC_IF4p5;
-		} else if (strcmp(cc_node_function, "NGFI_RAU_IF4p5") == 0) {
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = NGFI_RAU_IF4p5;
-		} else if (strcmp(cc_node_function, "NGFI_RRU_IF4p5") == 0) {
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = NGFI_RRU_IF4p5;
-		} else if (strcmp(cc_node_function, "NGFI_RRU_IF5") == 0) {
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = NGFI_RRU_IF5;
-		} else {
-		AssertError (0, parse_errors ++,
-		"Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for node_function choice: eNodeB_3GPP or eNodeB_3GPP_BBU or NGFI_IF4_RCC or NGFI_IF4_RRU or NGFI_IF5_RRU !\n",
-		lib_config_file_name_pP, i, cc_node_function);
-		}
-		
-		if (strcmp(cc_node_timing, "synch_to_ext_device") == 0) {
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_timing[j] = synch_to_ext_device;
-		} else if (strcmp(cc_node_timing, "synch_to_other") == 0) {
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_timing[j] = synch_to_other;
-		} else {
-		AssertError (0, parse_errors ++,
-		"Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for node_function choice: SYNCH_TO_DEVICE or SYNCH_TO_OTHER !\n",
-		lib_config_file_name_pP, i, cc_node_timing);
-		}
-		
-		if ((cc_node_synch_ref >= -1) && (cc_node_synch_ref < num_component_carriers)) {  
-		enb_properties_loc.properties[enb_properties_loc_index]->cc_node_synch_ref[j] = (int16_t) cc_node_synch_ref; 
-		} else {
-		AssertError (0, parse_errors ++,
-		"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for node_synch_ref choice: valid CC_id or -1 !\n",
-		lib_config_file_name_pP, i, cc_node_synch_ref);
-		}
-	      */
+
 	      
 	      RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config;
 	      
@@ -778,8 +642,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
 	      
 	      RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset;
 	      
-	      if (enb_check_band_frequencies(RC.config_file_name,
-					     j,
+	      if (config_check_band_frequencies(j,
 					     RRC_CONFIGURATION_REQ (msg_p).eutra_band[j],
 					     RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j],
 					     RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j],
@@ -1453,244 +1316,13 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
 		  break;
 		}
 
-
-		switch (ue_TimersAndConstants_t300) {
-		case 100:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms100;
-		  break;
-
-		case 200:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms200;
-		  break;
-
-		case 300:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms300;
-		  break;
-
-		case 400:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms400;
-		  break;
-
-		case 600:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms600;
-		  break;
-
-		case 1000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms1000;
-		  break;
-
-		case 1500:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms1500;
-		  break;
-
-		case 2000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms2000;
-		  break;
-
-		default:
-		  AssertFatal (0,
-			       "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t300 choice: 100,200,300,400,600,1000,1500,2000 ",
-			       RC.config_file_name, i, ue_TimersAndConstants_t300);
-		  break;
-
-		}
-
-		switch (ue_TimersAndConstants_t301) {
-		case 100:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms100;
-		  break;
-
-		case 200:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms200;
-		  break;
-
-		case 300:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms300;
-		  break;
-
-		case 400:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms400;
-		  break;
-
-		case 600:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms600;
-		  break;
-
-		case 1000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms1000;
-		  break;
-
-		case 1500:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms1500;
-		  break;
-
-		case 2000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms2000;
-		  break;
-
-		default:
-		  AssertFatal (0,
-			       "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t301 choice: 100,200,300,400,600,1000,1500,2000 ",
-			       RC.config_file_name, i, ue_TimersAndConstants_t301);
-		  break;
-
-		}
-
-		switch (ue_TimersAndConstants_t310) {
-		case 0:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms0;
-		  break;
-
-		case 50:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms50;
-		  break;
-
-		case 100:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms100;
-		  break;
-
-		case 200:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms200;
-		  break;
-
-		case 500:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms500;
-		  break;
-
-		case 1000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms1000;
-		  break;
-
-		case 2000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms2000;
-		  break;
-
-		default:
-		  AssertFatal (0,
-			       "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t310 choice: 0,50,100,200,500,1000,1500,2000 ",
-			       RC.config_file_name, i, ue_TimersAndConstants_t310);
-		  break;
-
-		}
-
-		switch (ue_TimersAndConstants_t311) {
-		case 1000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms1000;
-		  break;
-
-		case 3110:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms3000;
-		  break;
-
-		case 5000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms5000;
-		  break;
-
-		case 10000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms10000;
-		  break;
-
-		case 15000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms15000;
-		  break;
-
-		case 20000:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms20000;
-		  break;
-
-		case 31100:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms30000;
-		  break;
-
-		default:
-		  AssertFatal (0,
-			       "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t311 choice: 1000,3000,5000,10000,150000,20000,30000",
-			       RC.config_file_name, i, ue_TimersAndConstants_t311);
-		  break;
-
-		}
-
-		switch (ue_TimersAndConstants_n310) {
-		case 1:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n1;
-		  break;
-
-		case 2:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n2;
-		  break;
-
-		case 3:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n3;
-		  break;
-
-		case 4:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n4;
-		  break;
-
-		case 6:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n6;
-		  break;
-
-		case 8:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n8;
-		  break;
-
-		case 10:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n10;
-		  break;
-
-		case 20:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n20;
-		  break;
-
-		default:
-		  AssertFatal (0,
-			       "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_n310 choice: 1,2,3,4,6,6,8,10,20",
-			       RC.config_file_name, i, ue_TimersAndConstants_n311);
-		  break;
-
-		}
-
-		switch (ue_TimersAndConstants_n311) {
-		case 1:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n1;
-		  break;
-
-		case 2:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n2;
-		  break;
-
-		case 3:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n3;
-		  break;
-
-		case 4:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n4;
-		  break;
-
-		case 5:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n5;
-		  break;
-
-		case 6:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n6;
-		  break;
-
-		case 8:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n8;
-		  break;
-
-		case 10:
-		  RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n10;
-		  break;
-
-		default:
-		  AssertFatal (0,
-			       "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t311 choice: 1,2,3,4,5,6,8,10",
-			       RC.config_file_name, i, ue_TimersAndConstants_t311);
-		  break;
-
-		}
+                
+                RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = ue_TimersAndConstants_t300;
+                RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = ue_TimersAndConstants_t301;
+                RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = ue_TimersAndConstants_t310;
+                RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = ue_TimersAndConstants_t311;
+                RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = ue_TimersAndConstants_n310;
+                RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = ue_TimersAndConstants_n311;
 
 		switch (ue_TransmissionMode) {
 		case 1:
@@ -2031,6 +1663,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
 	      rrc->srb1_poll_byte             = PollByte_kBinfinity;
 	      rrc->srb1_max_retx_threshold    = UL_AM_RLC__maxRetxThreshold_t8;
 	    }
+
 	    /*
 	    // Network Controller 
 	    subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
@@ -2059,279 +1692,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
 		enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_cache = strdup(flexran_agent_cache);
 	      }
 	    }
-	    */	  
-
-	    /*
-	    // OTG _CONFIG
-	    setting_otg = config_setting_get_member (setting_enb, ENB_CONF_STRING_OTG_CONFIG);
-
-	    if (setting_otg != NULL) {
-	      num_otg_elements  = config_setting_length(setting_otg);
-	      printf("num otg elements %d \n", num_otg_elements);
-	      enb_properties_loc.properties[enb_properties_loc_index]->num_otg_elements = 0;
-
-	      for (j = 0; j < num_otg_elements; j++) {
-		subsetting_otg=config_setting_get_elem(setting_otg, j);
-
-		if (config_setting_lookup_int(subsetting_otg, ENB_CONF_STRING_OTG_UE_ID, &otg_ue_id)) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->otg_ue_id[j] = otg_ue_id;
-		} else {
-		  enb_properties_loc.properties[enb_properties_loc_index]->otg_ue_id[j] = 1;
-		}
-
-		if (config_setting_lookup_string(subsetting_otg, ENB_CONF_STRING_OTG_APP_TYPE, (const char **)&otg_app_type)) {
-		  if ((enb_properties_loc.properties[enb_properties_loc_index]->otg_app_type[j] = map_str_to_int(otg_app_type_names,otg_app_type))== -1) {
-		    enb_properties_loc.properties[enb_properties_loc_index]->otg_app_type[j] = BCBR;
-		  }
-		} else {
-		  enb_properties_loc.properties[enb_properties_loc_index]->otg_app_type[j] = NO_PREDEFINED_TRAFFIC; // 0
-		}
-
-		if (config_setting_lookup_string(subsetting_otg, ENB_CONF_STRING_OTG_BG_TRAFFIC, (const char **)&otg_bg_traffic)) {
-
-		  if ((enb_properties_loc.properties[enb_properties_loc_index]->otg_bg_traffic[j] = map_str_to_int(switch_names,otg_bg_traffic)) == -1) {
-		    enb_properties_loc.properties[enb_properties_loc_index]->otg_bg_traffic[j]=0;
-		  }
-		} else {
-		  enb_properties_loc.properties[enb_properties_loc_index]->otg_bg_traffic[j] = 0;
-		  printf("otg bg %s\n", otg_bg_traffic);
-		}
-
-		enb_properties_loc.properties[enb_properties_loc_index]->num_otg_elements+=1;
-
-	      }
-	    }
-
-	    // log_config
-	    subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_LOG_CONFIG);
-
-	    if (subsetting != NULL) {
-	      // global
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GLOBAL_LOG_LEVEL, (const char **)  &glog_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->glog_level = map_str_to_int(log_level_names, glog_level)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->glog_level = LOG_INFO;
-		}
-
-		//printf( "\tGlobal log level :\t%s->%d\n",glog_level, enb_properties_loc.properties[enb_properties_loc_index]->glog_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->glog_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,(const char **)  &glog_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity = map_str_to_int(log_verbosity_names, glog_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity = LOG_MED;
-		}
-
-		//printf( "\tGlobal log verbosity:\t%s->%d\n",glog_verbosity, enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity = LOG_MED;
-	      }
-
-	      // HW
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_HW_LOG_LEVEL, (const char **) &hw_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level = map_str_to_int(log_level_names,hw_log_level)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level = LOG_INFO;
-		}
-
-		//printf( "\tHW log level :\t%s->%d\n",hw_log_level,enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_HW_LOG_VERBOSITY, (const char **) &hw_log_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity = map_str_to_int(log_verbosity_names,hw_log_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity = LOG_MED;
-		}
-
-		//printf( "\tHW log verbosity:\t%s->%d\n",hw_log_verbosity, enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity = LOG_MED;
-	      }
-
-	      // phy
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PHY_LOG_LEVEL,(const char **) &phy_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level = map_str_to_int(log_level_names,phy_log_level)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level = LOG_INFO;
-		}
-
-		//printf( "\tPHY log level :\t%s->%d\n",phy_log_level,enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PHY_LOG_VERBOSITY, (const char **)&phy_log_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity = map_str_to_int(log_verbosity_names,phy_log_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity = LOG_MED;
-		}
-
-		//printf( "\tPHY log verbosity:\t%s->%d\n",phy_log_level,enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity = LOG_MED;
-	      }
-
-	      //mac
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_MAC_LOG_LEVEL, (const char **)&mac_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level = map_str_to_int(log_level_names,mac_log_level)) == -1 ) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level = LOG_INFO;
-		}
-
-		//printf( "\tMAC log level :\t%s->%d\n",mac_log_level,enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_MAC_LOG_VERBOSITY, (const char **)&mac_log_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity = map_str_to_int(log_verbosity_names,mac_log_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity = LOG_MED;
-		}
-
-		//printf( "\tMAC log verbosity:\t%s->%d\n",mac_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity = LOG_MED;
-	      }
-
-	      //rlc
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RLC_LOG_LEVEL, (const char **)&rlc_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level = map_str_to_int(log_level_names,rlc_log_level)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level = LOG_INFO;
-		}
-
-		//printf( "\tRLC log level :\t%s->%d\n",rlc_log_level, enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RLC_LOG_VERBOSITY, (const char **)&rlc_log_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity = map_str_to_int(log_verbosity_names,rlc_log_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity = LOG_MED;
-		}
-
-		//printf( "\tRLC log verbosity:\t%s->%d\n",rlc_log_verbosity, enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity = LOG_MED;
-	      }
-
-	      //pdcp
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PDCP_LOG_LEVEL, (const char **)&pdcp_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level = map_str_to_int(log_level_names,pdcp_log_level)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level = LOG_INFO;
-		}
-
-		//printf( "\tPDCP log level :\t%s->%d\n",pdcp_log_level, enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PDCP_LOG_VERBOSITY, (const char **)&pdcp_log_verbosity)) {
-		enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_verbosity = map_str_to_int(log_verbosity_names,pdcp_log_verbosity);
-		//printf( "\tPDCP log verbosity:\t%s->%d\n",pdcp_log_verbosity, enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_verbosity = LOG_MED;
-	      }
-
-	      //rrc
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RRC_LOG_LEVEL, (const char **)&rrc_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level = map_str_to_int(log_level_names,rrc_log_level)) == -1 ) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level = LOG_INFO;
-		}
-
-		//printf( "\tRRC log level :\t%s->%d\n",rrc_log_level,enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RRC_LOG_VERBOSITY, (const char **)&rrc_log_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity = map_str_to_int(log_verbosity_names,rrc_log_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity = LOG_MED;
-		}
-
-		//printf( "\tRRC log verbosity:\t%s->%d\n",rrc_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity = LOG_MED;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GTPU_LOG_LEVEL, (const char **)&gtpu_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level = map_str_to_int(log_level_names,gtpu_log_level)) == -1 ) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level = LOG_INFO;
-		}
-
-		//printf( "\tGTPU log level :\t%s->%d\n",gtpu_log_level,enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GTPU_LOG_VERBOSITY, (const char **)&gtpu_log_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity = map_str_to_int(log_verbosity_names,gtpu_log_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity = LOG_MED;
-		}
-
-		//printf( "\tGTPU log verbosity:\t%s->%d\n",gtpu_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity = LOG_MED;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_UDP_LOG_LEVEL, (const char **)&udp_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level = map_str_to_int(log_level_names,udp_log_level)) == -1 ) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level = LOG_INFO;
-		}
-
-		//printf( "\tUDP log level :\t%s->%d\n",udp_log_level,enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_UDP_LOG_VERBOSITY, (const char **)&udp_log_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->udp_log_verbosity = map_str_to_int(log_verbosity_names,udp_log_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->udp_log_verbosity = LOG_MED;
-		}
-
-		//printf( "\tUDP log verbosity:\t%s->%d\n",udp_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->udp_log_verbosity = LOG_MED;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_OSA_LOG_LEVEL, (const char **)&osa_log_level)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level = map_str_to_int(log_level_names,osa_log_level)) == -1 ) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level = LOG_INFO;
-		}
-
-		//printf( "\tOSA log level :\t%s->%d\n",osa_log_level,enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level = LOG_INFO;
-	      }
-
-	      if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_OSA_LOG_VERBOSITY, (const char **)&osa_log_verbosity)) {
-		if ((enb_properties_loc.properties[enb_properties_loc_index]->osa_log_verbosity = map_str_to_int(log_verbosity_names,osa_log_verbosity)) == -1) {
-		  enb_properties_loc.properties[enb_properties_loc_index]->osa_log_verbosity = LOG_MED;
-		}
-
-		//printf( "\tOSA log verbosity:\t%s->%d\n",osa_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->gosa_log_verbosity);
-	      } else {
-		enb_properties_loc.properties[enb_properties_loc_index]->osa_log_verbosity = LOG_MED;
-	      }
-
-	    } else { // not configuration is given
-	      enb_properties_loc.properties[enb_properties_loc_index]->glog_level         = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity     = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level       = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity   = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level      = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity  = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level      = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity  = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level      = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity  = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level     = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_verbosity = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level      = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity  = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level     = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level      = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->udp_log_verbosity  = LOG_MED;
-	      enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level      = LOG_INFO;
-	      enb_properties_loc.properties[enb_properties_loc_index]->osa_log_verbosity  = LOG_MED;
-	    }
 	    */
 	    break;
 	}
@@ -2595,7 +1955,9 @@ void RCConfig(void) {
 
 
 /* get global parameters, defined outside any section in the config file */
-  
+ 
+  printf("Getting ENBSParams\n");
+ 
   config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); 
   RC.nb_inst = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
  
diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h
index b41545bcecea1036cb271d9ac27947e6af8de079..42bef9c4e990c0746aeb027c950394d5faee0c0f 100644
--- a/openair2/ENB_APP/enb_config.h
+++ b/openair2/ENB_APP/enb_config.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -46,6 +46,8 @@
 #else
 #include "RRC/LITE/MESSAGES/SystemInformationBlockType2.h"
 #endif
+#include "intertask_interface_types.h"
+#include "RRC/LITE/defs.h"
 
 #define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
             struct in_addr inp;\
@@ -92,6 +94,7 @@ typedef struct ru_config_s {
 } ru_config_t;
 
 extern void RCconfig_RU(void);
+extern void RCconfig_flexran(void);
 extern void RCconfig_L1(void);
 extern void RCconfig_macrlc(void);
 extern int  RCconfig_gtpu(void );
@@ -100,5 +103,8 @@ extern void RCConfig(void);
 void                          enb_config_display(void);
 void                          ru_config_display(void);
 
+int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc);
+int RCconfig_S1(MessageDef *msg_p, uint32_t i);
+
 #endif /* ENB_CONFIG_H_ */
 /** @} */
diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h
index 3fef026961b3c9a4e5d5276a99a37f1f73c6ddd3..fe2b5a8515c164681841375b1b00576255fcc59e 100755
--- a/openair2/ENB_APP/enb_paramdef.h
+++ b/openair2/ENB_APP/enb_paramdef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -31,7 +31,7 @@
  */
 
 #include "common/config/config_paramdesc.h"
-
+#include "RRC_paramsvalues.h"
 
 
 
@@ -56,52 +56,6 @@
 
 
 
-#define KHz (1000UL)
-#define MHz (1000 * KHz)
-
-typedef struct eutra_band_s {
-  int16_t             band;
-  uint32_t            ul_min;
-  uint32_t            ul_max;
-  uint32_t            dl_min;
-  uint32_t            dl_max;
-  lte_frame_type_t    frame_type;
-} eutra_band_t;
-
-static const eutra_band_t eutra_bands[] = {
-  { 1, 1920    * MHz, 1980    * MHz, 2110    * MHz, 2170    * MHz, FDD},
-  { 2, 1850    * MHz, 1910    * MHz, 1930    * MHz, 1990    * MHz, FDD},
-  { 3, 1710    * MHz, 1785    * MHz, 1805    * MHz, 1880    * MHz, FDD},
-  { 4, 1710    * MHz, 1755    * MHz, 2110    * MHz, 2155    * MHz, FDD},
-  { 5,  824    * MHz,  849    * MHz,  869    * MHz,  894    * MHz, FDD},
-  { 6,  830    * MHz,  840    * MHz,  875    * MHz,  885    * MHz, FDD},
-  { 7, 2500    * MHz, 2570    * MHz, 2620    * MHz, 2690    * MHz, FDD},
-  { 8,  880    * MHz,  915    * MHz,  925    * MHz,  960    * MHz, FDD},
-  { 9, 1749900 * KHz, 1784900 * KHz, 1844900 * KHz, 1879900 * KHz, FDD},
-  {10, 1710    * MHz, 1770    * MHz, 2110    * MHz, 2170    * MHz, FDD},
-  {11, 1427900 * KHz, 1452900 * KHz, 1475900 * KHz, 1500900 * KHz, FDD},
-  {12,  698    * MHz,  716    * MHz,  728    * MHz,  746    * MHz, FDD},
-  {13,  777    * MHz,  787    * MHz,  746    * MHz,  756    * MHz, FDD},
-  {14,  788    * MHz,  798    * MHz,  758    * MHz,  768    * MHz, FDD},
-
-  {17,  704    * MHz,  716    * MHz,  734    * MHz,  746    * MHz, FDD},
-  {20,  832    * MHz,  862    * MHz,  791    * MHz,  821    * MHz, FDD},
-  {33, 1900    * MHz, 1920    * MHz, 1900    * MHz, 1920    * MHz, TDD},
-  {33, 1900    * MHz, 1920    * MHz, 1900    * MHz, 1920    * MHz, TDD},
-  {34, 2010    * MHz, 2025    * MHz, 2010    * MHz, 2025    * MHz, TDD},
-  {35, 1850    * MHz, 1910    * MHz, 1850    * MHz, 1910    * MHz, TDD},
-  {36, 1930    * MHz, 1990    * MHz, 1930    * MHz, 1990    * MHz, TDD},
-  {37, 1910    * MHz, 1930    * MHz, 1910    * MHz, 1930    * MHz, TDD},
-  {38, 2570    * MHz, 2620    * MHz, 2570    * MHz, 2630    * MHz, TDD},
-  {39, 1880    * MHz, 1920    * MHz, 1880    * MHz, 1920    * MHz, TDD},
-  {40, 2300    * MHz, 2400    * MHz, 2300    * MHz, 2400    * MHz, TDD},
-  {41, 2496    * MHz, 2690    * MHz, 2496    * MHz, 2690    * MHz, TDD},
-  {42, 3400    * MHz, 3600    * MHz, 3400    * MHz, 3600    * MHz, TDD},
-  {43, 3600    * MHz, 3800    * MHz, 3600    * MHz, 3800    * MHz, TDD},
-  {44, 703    * MHz, 803    * MHz, 703    * MHz, 803    * MHz, TDD},
-};
-
-
 
 
 
@@ -152,7 +106,7 @@ typedef enum {
 #define CONFIG_STRING_RU_MAX_RS_EPRE              "max_pdschReferenceSignalPower"
 #define CONFIG_STRING_RU_MAX_RXGAIN               "max_rxgain"
 #define CONFIG_STRING_RU_IF_COMPRESSION           "if_compression"
-
+#define CONFIG_STRING_RU_NBIOTRRC_LIST            "NbIoT_RRC_instances"
 
 #define RU_LOCAL_IF_NAME_IDX          0
 #define RU_LOCAL_ADDRESS_IDX          1
@@ -171,14 +125,10 @@ typedef enum {
 #define RU_ENB_LIST_IDX               14
 #define RU_ATT_TX_IDX                 15
 #define RU_ATT_RX_IDX                 16
+#define RU_NBIOTRRC_LIST_IDX          17
 
 
 
-
-static int DEFBANDS[] = {7};
-static int DEFENBS[] = {0};
-
-
 /*-----------------------------------------------------------------------------------------------------------------------------------------*/
 /*                                            RU configuration parameters                                                                  */
 /*   optname                                   helpstr   paramflags    XXXptr        defXXXval                   type           numelt     */
@@ -200,7 +150,8 @@ static int DEFENBS[] = {0};
 {CONFIG_STRING_RU_BAND_LIST,                	 NULL,       0,       uptr:NULL,       defintarrayval:DEFBANDS, TYPE_INTARRAY,    1}, \
 {CONFIG_STRING_RU_ENB_LIST,                 	 NULL,       0,       uptr:NULL,       defintarrayval:DEFENBS,  TYPE_INTARRAY,    1}, \
 {CONFIG_STRING_RU_ATT_TX,                   	 NULL,       0,       uptr:NULL,       defintval:0,		TYPE_UINT,	  0}, \
-{CONFIG_STRING_RU_ATT_RX,                   	 NULL,       0,       uptr:NULL,       defintval:0,		TYPE_UINT,	  0}  \
+{CONFIG_STRING_RU_ATT_RX,                   	 NULL,       0,       uptr:NULL,       defintval:0,		TYPE_UINT,	  0}, \
+{CONFIG_STRING_RU_NBIOTRRC_LIST,                 NULL,       0,       uptr:NULL,       defintarrayval:DEFENBS,  TYPE_INTARRAY,    1}, \
 }
 
 /*---------------------------------------------------------------------------------------------------------------------------------------*/
@@ -237,8 +188,7 @@ static int DEFENBS[] = {0};
 
 /*------------------------------------------------------------------------------------------------------------------------------------------*/
 /*------------------------------------------------------------------------------------------------------------------------------------------*/
-/*    cell configuration section name */
-#define ENB_CONFIG_STRING_ENB_LIST                      "eNBs"
+
 
 /* cell configuration parameters names */
 #define ENB_CONFIG_STRING_ENB_ID                        "eNB_ID"
@@ -293,21 +243,9 @@ static int DEFENBS[] = {0};
 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/
 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/		  
 
-/* component carriers configuration section name */		
-#define ENB_CONFIG_STRING_COMPONENT_CARRIERS                            "component_carriers"		 
 
 /* component carries configuration parameters name */
-#define ENB_CONFIG_STRING_FRAME_TYPE                                    "frame_type"
-#define ENB_CONFIG_STRING_PBCH_REPETITION                               "pbch_repetition"
-#define ENB_CONFIG_STRING_TDD_CONFIG                                    "tdd_config"
-#define ENB_CONFIG_STRING_TDD_CONFIG_S                                  "tdd_config_s"
-#define ENB_CONFIG_STRING_PREFIX_TYPE                                   "prefix_type"
-#define ENB_CONFIG_STRING_EUTRA_BAND                                    "eutra_band"
-#define ENB_CONFIG_STRING_DOWNLINK_FREQUENCY                            "downlink_frequency"
-#define ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET                       "uplink_frequency_offset"
-#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"
@@ -371,11 +309,83 @@ static int DEFENBS[] = {0};
 #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"
-		
-/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
-/*                                     component carriers configuration parameters                                                                                                     */
-/*   optname                                                   helpstr   paramflags    XXXptr                                        defXXXval                    type         numelt  */
-/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+
+/* init for checkedparam_t structure */
+
+#define CCPARAMS_CHECK                 {                                     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s5= {NULL }} ,						     \
+             { .s1a= { config_check_modify_integer, UETIMER_T300_OKVALUES, UETIMER_T300_MODVALUES,8}} ,						     \
+             { .s1a= { config_check_modify_integer, UETIMER_T301_OKVALUES, UETIMER_T301_MODVALUES,8}} ,						     \
+             { .s1a= { config_check_modify_integer, UETIMER_T310_OKVALUES, UETIMER_T310_MODVALUES,7}} ,						     \
+             { .s1a= { config_check_modify_integer, UETIMER_T311_OKVALUES, UETIMER_T311_MODVALUES,7}} ,						     \
+             { .s1a= { config_check_modify_integer, UETIMER_N310_OKVALUES, UETIMER_N310_MODVALUES,8}} , 					      \
+             { .s1a= { config_check_modify_integer, UETIMER_N311_OKVALUES, UETIMER_N311_MODVALUES,8}} , 					      \
+             { .s5= {NULL }} ,						     \
+}
+/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                     component carriers configuration parameters                                                                                                                   */
+/*   optname                                                   helpstr   paramflags    XXXptr                                        defXXXval                    type         numelt  checked_param */
+/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 #define CCPARAMS_DESC { \
 {ENB_CONFIG_STRING_FRAME_TYPE,                                   NULL,   0,           strptr:&frame_type,                             defstrval:"FDD",           TYPE_STRING,     0},  \
 {ENB_CONFIG_STRING_TDD_CONFIG,                                   NULL,   0,           iptr:&tdd_config,                               defintval:3,               TYPE_UINT,       0},  \
@@ -447,6 +457,75 @@ static int DEFENBS[] = {0};
 {ENB_CONFIG_STRING_UE_TRANSMISSION_MODE,                         NULL,   0,           iptr:&ue_TransmissionMode,                      defintval:1,               TYPE_UINT,       0}   \
 }
 
+#define ENB_CONFIG_FRAME_TYPE_IDX                            0  			     
+#define ENB_CONFIG_TDD_CONFIG_IDX                            1  			     
+#define ENB_CONFIG_TDD_CONFIG_S_IDX			     2
+#define ENB_CONFIG_PREFIX_TYPE_IDX 			     3
+#define ENB_CONFIG_PBCH_REPETITION_IDX			     4
+#define ENB_CONFIG_EUTRA_BAND_IDX  			     5
+#define ENB_CONFIG_DOWNLINK_FREQUENCY_IDX  		     6
+#define ENB_CONFIG_UPLINK_FREQUENCY_OFFSET_IDX		     7
+#define ENB_CONFIG_NID_CELL_IDX				     8
+#define ENB_CONFIG_N_RB_DL_IDX				     9
+#define ENB_CONFIG_CELL_MBSFN_IDX  			     10
+#define ENB_CONFIG_NB_ANT_PORTS_IDX			     11
+#define ENB_CONFIG_PRACH_ROOT_IDX  			     12
+#define ENB_CONFIG_PRACH_CONFIG_INDEX_IDX  		     13
+#define ENB_CONFIG_PRACH_HIGH_SPEED_IDX			     14
+#define ENB_CONFIG_PRACH_ZERO_CORRELATION_IDX		     15
+#define ENB_CONFIG_PRACH_FREQ_OFFSET_IDX	             16     
+#define ENB_CONFIG_PUCCH_DELTA_SHIFT_IDX		     17     
+#define ENB_CONFIG_PUCCH_NRB_CQI_IDX			     18
+#define ENB_CONFIG_PUCCH_NCS_AN_IDX			     19
+#define ENB_CONFIG_PUCCH_N1_AN_IDX 			     20
+#define ENB_CONFIG_PDSCH_RS_EPRE_IDX			     21
+#define ENB_CONFIG_PDSCH_PB_IDX				     22
+#define ENB_CONFIG_PUSCH_N_SB_IDX  			     23
+#define ENB_CONFIG_PUSCH_HOPPINGMODE_IDX		     24     
+#define ENB_CONFIG_PUSCH_HOPPINGOFFSET_IDX 		     25
+#define ENB_CONFIG_PUSCH_ENABLE64QAM_IDX		     26     
+#define ENB_CONFIG_PUSCH_GROUP_HOPPING_EN_IDX		     27
+#define ENB_CONFIG_PUSCH_GROUP_ASSIGNMENT_IDX		     28
+#define ENB_CONFIG_PUSCH_SEQUENCE_HOPPING_EN_IDX	     29     
+#define ENB_CONFIG_PUSCH_NDMRS1_IDX			     30
+#define ENB_CONFIG_PHICH_DURATION_IDX			     31
+#define ENB_CONFIG_PHICH_RESOURCE_IDX			     32
+#define ENB_CONFIG_SRS_ENABLE_IDX  			     33
+#define ENB_CONFIG_SRS_BANDWIDTH_CONFIG_IDX		     34
+#define ENB_CONFIG_SRS_SUBFRAME_CONFIG_IDX 		     35
+#define ENB_CONFIG_SRS_ACKNACKST_CONFIG_IDX		     36
+#define ENB_CONFIG_SRS_MAXUPPTS_IDX			     37
+#define ENB_CONFIG_PUSCH_PO_NOMINAL_IDX			     38
+#define ENB_CONFIG_PUSCH_ALPHA_IDX 			     39
+#define ENB_CONFIG_PUCCH_PO_NOMINAL_IDX			     40
+#define ENB_CONFIG_MSG3_DELTA_PREAMBLE_IDX 		     41
+#define ENB_CONFIG_PUCCH_DELTAF_FORMAT1_IDX		     42
+#define ENB_CONFIG_PUCCH_DELTAF_FORMAT1b_IDX		     43
+#define ENB_CONFIG_PUCCH_DELTAF_FORMAT2_IDX		     44
+#define ENB_CONFIG_PUCCH_DELTAF_FORMAT2A_IDX		     45
+#define ENB_CONFIG_PUCCH_DELTAF_FORMAT2B_IDX		     46
+#define ENB_CONFIG_RACH_NUM_RA_PREAMBLES_IDX		     47
+#define ENB_CONFIG_RACH_PREAMBLESGROUPACONFIG_IDX  	     48
+#define ENB_CONFIG_RACH_SIZEOFRA_PREAMBLESGROUPA_IDX	     49
+#define ENB_CONFIG_RACH_MESSAGESIZEGROUPA_IDX		     50
+#define ENB_CONFIG_RACH_MESSAGEPOWEROFFSETGROUPB_IDX	     51
+#define ENB_CONFIG_RACH_POWERRAMPINGSTEP_IDX		     52
+#define ENB_CONFIG_RACH_PREAMBLEINITIALRECEIVEDTARGETPOWER_IDX 53 
+#define ENB_CONFIG_RACH_PREAMBLETRANSMAX_IDX		     54
+#define ENB_CONFIG_RACH_RARESPONSEWINDOWSIZE_IDX	     55     
+#define ENB_CONFIG_RACH_MACCONTENTIONRESOLUTIONTIMER_IDX     56	     
+#define ENB_CONFIG_RACH_MAXHARQMSG3TX_IDX  		     57
+#define ENB_CONFIG_PCCH_DEFAULT_PAGING_CYCLE_IDX	     58     
+#define ENB_CONFIG_PCCH_NB_IDX				     59
+#define ENB_CONFIG_BCCH_MODIFICATIONPERIODCOEFF_IDX	     60
+#define ENB_CONFIG_UETIMERS_T300_IDX			     61
+#define ENB_CONFIG_UETIMERS_T301_IDX			     62
+#define ENB_CONFIG_UETIMERS_T310_IDX			     63
+#define ENB_CONFIG_UETIMERS_T311_IDX			     64
+#define ENB_CONFIG_UETIMERS_N310_IDX			     65
+#define ENB_CONFIG_UETIMERS_N311_IDX			     66
+#define ENB_CONFIG_UE_TRANSMISSION_MODE_IDX		     67
+
 /*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 /*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 /* SRB1 configuration parameters section name */
@@ -573,56 +652,32 @@ static int DEFENBS[] = {0};
 
 
 
-/* L1 configuration parameters names   */
-#define CONFIG_STRING_L1_CC                                "num_cc"
-#define CONFIG_STRING_L1_LOCAL_N_IF_NAME                   "local_n_if_name"
-#define CONFIG_STRING_L1_LOCAL_N_ADDRESS                   "local_n_address"
-#define CONFIG_STRING_L1_REMOTE_N_ADDRESS                  "remote_n_address"
-#define CONFIG_STRING_L1_LOCAL_N_PORTC                     "local_n_portc"
-#define CONFIG_STRING_L1_REMOTE_N_PORTC                    "remote_n_portc"
-#define CONFIG_STRING_L1_LOCAL_N_PORTD                     "local_n_portd"
-#define CONFIG_STRING_L1_REMOTE_N_PORTD                    "remote_n_portd"
-#define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE            "tr_n_preference"
-
 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
-/*                                            L1 configuration parameters                                                                             */
-/*   optname                                         helpstr   paramflags    XXXptr              defXXXval                  type           numelt     */
-/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
-#define L1PARAMS_DESC { \
-{CONFIG_STRING_L1_CC,                                NULL,      0,         uptr:NULL,           defintval:1,               TYPE_UINT,     0},         \
-{CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE,            NULL,      0,         strptr:NULL,         defstrval:"local_mac",     TYPE_STRING,   0},         \
-{CONFIG_STRING_L1_LOCAL_N_IF_NAME,                   NULL,      0,         strptr:NULL,         defstrval:"lo",            TYPE_STRING,   0},         \
-{CONFIG_STRING_L1_LOCAL_N_ADDRESS,                   NULL,      0,         strptr:NULL,         defstrval:"127.0.0.1",     TYPE_STRING,   0},         \
-{CONFIG_STRING_L1_REMOTE_N_ADDRESS,                  NULL,      0,         strptr:NULL,         defstrval:"127.0.0.2",     TYPE_STRING,   0},         \
-{CONFIG_STRING_L1_LOCAL_N_PORTC,                     NULL,      0,         uptr:NULL,           defintval:50030,           TYPE_UINT,     0},         \
-{CONFIG_STRING_L1_REMOTE_N_PORTC,                    NULL,      0,         uptr:NULL,           defintval:50030,           TYPE_UINT,     0},         \
-{CONFIG_STRING_L1_LOCAL_N_PORTD,                     NULL,      0,         uptr:NULL,           defintval:50031,           TYPE_UINT,     0},         \
-{CONFIG_STRING_L1_REMOTE_N_PORTD,                    NULL,      0,         uptr:NULL,           defintval:50031,           TYPE_UINT,     0},         \
-}
-#define L1_CC_IDX                                          0
-#define L1_TRANSPORT_N_PREFERENCE_IDX                      1
-#define L1_LOCAL_N_IF_NAME_IDX                             2
-#define L1_LOCAL_N_ADDRESS_IDX                             3
-#define L1_REMOTE_N_ADDRESS_IDX                            4
-#define L1_LOCAL_N_PORTC_IDX                               5
-#define L1_REMOTE_N_PORTC_IDX                              6
-#define L1_LOCAL_N_PORTD_IDX                               7
-#define L1_REMOTE_N_PORTD_IDX                              8
 
 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
-/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
-#define ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG         "NETWORK_CONTROLLER"
-
-#define ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME      "FLEXRAN_AGENT_INTERFACE_NAME"
-#define ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS        "FLEXRAN_AGENT_IPV4_ADDRESS"
-#define ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT                "FLEXRAN_AGENT_PORT"
-#define ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE               "FLEXRAN_AGENT_CACHE"
+#define CONFIG_STRING_NETWORK_CONTROLLER_CONFIG         "NETWORK_CONTROLLER"
+
+#define CONFIG_STRING_FLEXRAN_ENABLED             "FLEXRAN_ENABLED"
+#define CONFIG_STRING_FLEXRAN_INTERFACE_NAME      "FLEXRAN_INTERFACE_NAME"
+#define CONFIG_STRING_FLEXRAN_IPV4_ADDRESS        "FLEXRAN_IPV4_ADDRESS"
+#define CONFIG_STRING_FLEXRAN_PORT                "FLEXRAN_PORT"
+#define CONFIG_STRING_FLEXRAN_CACHE               "FLEXRAN_CACHE"
+#define CONFIG_STRING_FLEXRAN_AWAIT_RECONF        "FLEXRAN_AWAIT_RECONF"
+
+#define FLEXRAN_ENABLED                               0
+#define FLEXRAN_INTERFACE_NAME_IDX                    1
+#define FLEXRAN_IPV4_ADDRESS_IDX                      2
+#define FLEXRAN_PORT_IDX                              3
+#define FLEXRAN_CACHE_IDX                             4
+#define FLEXRAN_AWAIT_RECONF_IDX                      5
 
 #define FLEXRANPARAMS_DESC { \
-{ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME,         NULL,   0,   uptr:NULL,   defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE,   TYPE_STRING,   0},           \
-{ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS,           NULL,   0,   uptr:NULL,   defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE,   TYPE_STRING,   0},           \
-{ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT,                   NULL,   0,   uptr:NULL,   defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE,   TYPE_STRING,   0},           \
-{ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE,                  NULL,   0,   uptr:NULL,   defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE,   TYPE_STRING,   0}            \
+{CONFIG_STRING_FLEXRAN_ENABLED,                NULL,   0,   strptr:NULL,   defstrval:"no",                    TYPE_STRING,   0},           \
+{CONFIG_STRING_FLEXRAN_INTERFACE_NAME,         NULL,   0,   strptr:NULL,   defstrval:"lo",                    TYPE_STRING,   0},           \
+{CONFIG_STRING_FLEXRAN_IPV4_ADDRESS,           NULL,   0,   strptr:NULL,   defstrval:"127.0.0.1",             TYPE_STRING,   0},           \
+{CONFIG_STRING_FLEXRAN_PORT,                   NULL,   0,   uptr:NULL,     defintval:2210,                    TYPE_UINT,     0},           \
+{CONFIG_STRING_FLEXRAN_CACHE,                  NULL,   0,   strptr:NULL,   defstrval:"/mnt/oai_agent_cache",  TYPE_STRING,   0},           \
+{CONFIG_STRING_FLEXRAN_AWAIT_RECONF,           NULL,   0,   strptr:NULL,   defstrval:"no",                    TYPE_STRING,   0}            \
 }
 
 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -653,30 +708,6 @@ static int DEFENBS[] = {0};
 #define CONFIG_STRING_MACRLC_PHY_TEST_MODE                 "phy_test_mode"
 
 
-/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
-/*                                            MacRLC  configuration parameters                                                                           */
-/*   optname                                            helpstr   paramflags    XXXptr              defXXXval                  type           numelt     */
-/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
-#define MACRLCPARAMS_DESC { \
-{CONFIG_STRING_MACRLC_CC,                                NULL,     0,          uptr:NULL,           defintval:50011,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_TRANSPORT_N_PREFERENCE,            NULL,     0,          strptr:NULL,         defstrval:"local_L1",      TYPE_STRING,   0},        \
-{CONFIG_STRING_MACRLC_LOCAL_N_IF_NAME,                   NULL,     0,          strptr:NULL,         defstrval:"lo",            TYPE_STRING,   0},        \
-{CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS,                   NULL,     0,          strptr:NULL,         defstrval:"127.0.0.1",     TYPE_STRING,   0},        \
-{CONFIG_STRING_MACRLC_REMOTE_N_ADDRESS,                  NULL,     0,          uptr:NULL,           defstrval:"127.0.0.2",     TYPE_STRING,   0},        \
-{CONFIG_STRING_MACRLC_LOCAL_N_PORTC,                     NULL,     0,          uptr:NULL,           defintval:50010,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_REMOTE_N_PORTC,                    NULL,     0,          uptr:NULL,           defintval:50010,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_LOCAL_N_PORTD,                     NULL,     0,          uptr:NULL,           defintval:50011,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_REMOTE_N_PORTD,                    NULL,     0,          uptr:NULL,           defintval:50011,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_TRANSPORT_S_PREFERENCE,            NULL,     0,          strptr:NULL,         defstrval:"local_RRC",     TYPE_STRING,   0},        \
-{CONFIG_STRING_MACRLC_LOCAL_S_IF_NAME,                   NULL,     0,          strptr:NULL,         defstrval:"lo",            TYPE_STRING,   0},        \
-{CONFIG_STRING_MACRLC_LOCAL_S_ADDRESS,                   NULL,     0,          uptr:NULL,           defstrval:"127.0.0.1",     TYPE_STRING,   0},        \
-{CONFIG_STRING_MACRLC_REMOTE_S_ADDRESS,                  NULL,     0,          uptr:NULL,           defstrval:"127.0.0.2",     TYPE_STRING,   0},        \
-{CONFIG_STRING_MACRLC_LOCAL_S_PORTC,                     NULL,     0,          uptr:NULL,           defintval:50020,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_REMOTE_S_PORTC,                    NULL,     0,          uptr:NULL,           defintval:50020,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_LOCAL_S_PORTD,                     NULL,     0,          uptr:NULL,           defintval:50021,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_REMOTE_S_PORTD,                    NULL,     0,          uptr:NULL,           defintval:50021,           TYPE_UINT,     0},        \
-{CONFIG_STRING_MACRLC_PHY_TEST_MODE,                     NULL,     0,          uptr:NULL,           defintval:1,               TYPE_UINT,     0}   \
-}
 #define MACRLC_CC_IDX                                          0
 #define MACRLC_TRANSPORT_N_PREFERENCE_IDX                      1
 #define MACRLC_LOCAL_N_IF_NAME_IDX                             2
diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c
index 0dcacd4b81a6d64da85524cb42619c4937330583..bd46ecc49d246f9e81b7d3d2942f42158d30f0a4 100644
--- a/openair2/ENB_APP/flexran_agent.c
+++ b/openair2/ENB_APP/flexran_agent.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,35 +21,15 @@
 
 /*! \file flexran_agent.h
  * \brief top level flexran agent receive thread and itti task
- * \author Xenofon Foukas and Navid Nikaein
- * \date 2016
+ * \author Xenofon Foukas and Navid Nikaein and shahab SHARIAT BAGHERI
+ * \date 2017
  * \version 0.1
  */
 
-#include "flexran_agent_common.h"
-#include "log.h"
 #include "flexran_agent.h"
-#include "flexran_agent_mac_defs.h"
-#include "flexran_agent_mac.h"
-#include "flexran_agent_mac_internal.h"
-
-#include "flexran_agent_extern.h"
-
-#include "assertions.h"
-
-#include "flexran_agent_net_comm.h"
-#include "flexran_agent_async.h"
 
 #include <arpa/inet.h>
 
-//#define TEST_TIMER
-
-flexran_agent_instance_t flexran_agent[NUM_MAX_ENB];
-
-char in_ip[40];
-static uint16_t in_port;
-char local_cache[40];
-
 void *send_thread(void *args);
 void *receive_thread(void *args);
 pthread_t new_thread(void *(*f)(void *), void *b);
@@ -63,7 +43,7 @@ int agent_task_created = 0;
 */
 void *flexran_agent_task(void *args){
 
-  //flexran_agent_instance_t         *d = (flexran_agent_instance_t *) args;
+  //flexran_agent_info_t         *d = (flexran_agent_info_t *) args;
   Protocol__FlexranMessage *msg;
   void *data;
   int size;
@@ -85,6 +65,7 @@ void *flexran_agent_task(void *args){
 
     switch (ITTI_MSG_ID(msg_p)) {
     case TERMINATE_MESSAGE:
+      LOG_W(FLEXRAN_AGENT, " *** Exiting FLEXRAN thread\n");
       itti_exit_task ();
       break;
 
@@ -123,7 +104,7 @@ void *flexran_agent_task(void *args){
 
 void *receive_thread(void *args) {
 
-  flexran_agent_instance_t         *d = args;
+  flexran_agent_info_t  *d = args;
   void                  *data;
   int                   size;
   int                   priority;
@@ -197,38 +178,25 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
 }
 
 int channel_container_init = 0;
-int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
-  
+int flexran_agent_start(mid_t mod_id)
+{
+  flexran_agent_info_t *flexran = RC.flexran[mod_id];
   int channel_id;
-  
-  flexran_set_enb_vars(mod_id, RAN_LTE_OAI);
-  flexran_agent[mod_id].enb_id = mod_id;
-  
-  /* 
-   * check the configuration
-   */ 
-  if (enb_properties->properties[mod_id]->flexran_agent_cache != NULL) {
-    strncpy(local_cache, enb_properties->properties[mod_id]->flexran_agent_cache, sizeof(local_cache));
-    local_cache[sizeof(local_cache) - 1] = 0;
-  } else {
-    strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE);
-  }
-  
-  if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != 0) {
-    inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
-  } else {
-    strcpy(in_ip, DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS ); 
+  char *in_ip = flexran->remote_ipv4_addr;
+  uint16_t in_port = flexran->remote_port;
+
+  /* if this agent is disabled, return and don't do anything */
+  if (!flexran->enabled) {
+    LOG_I(FLEXRAN_AGENT, "FlexRAN Agent for eNB %d is DISABLED\n", mod_id);
+    return 100;
   }
   
-  if (enb_properties->properties[mod_id]->flexran_agent_port != 0 ) {
-    in_port = enb_properties->properties[mod_id]->flexran_agent_port;
-  } else {
-    in_port = DEFAULT_FLEXRAN_AGENT_PORT ;
-  }
-  LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",  
-	flexran_agent[mod_id].enb_id,
-	in_ip,
-	in_port);
+  flexran->enb_id = mod_id;
+  /* assume for the moment the monolithic case, i.e. agent can provide
+   * information for all layers */
+  flexran->capability_mask = FLEXRAN_CAP_LOL1 | FLEXRAN_CAP_HIL1
+                           | FLEXRAN_CAP_LOL2 | FLEXRAN_CAP_HIL2
+                           | FLEXRAN_CAP_PDCP | FLEXRAN_CAP_RRC;
 
   /*
    * Initialize the channel container
@@ -264,10 +232,10 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
    *flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC);
    */
 
-  /*Initialize the continuous MAC stats update mechanism*/
-  flexran_agent_init_cont_mac_stats_update(mod_id);
+  /*Initialize the continuous stats update mechanism*/
+  flexran_agent_init_cont_stats_update(mod_id);
   
-  new_thread(receive_thread, &flexran_agent[mod_id]);
+  new_thread(receive_thread, flexran);
 
   /*Initialize and register the mac xface. Must be modified later
    *for more flexibility in agent management */
@@ -275,6 +243,12 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
   AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface));
   flexran_agent_register_mac_xface(mod_id, mac_agent_xface);
   
+  AGENT_RRC_xface *rrc_agent_xface = (AGENT_RRC_xface *) malloc(sizeof(AGENT_RRC_xface));
+  flexran_agent_register_rrc_xface(mod_id, rrc_agent_xface);
+
+  AGENT_PDCP_xface *pdcp_agent_xface = (AGENT_PDCP_xface *) malloc(sizeof(AGENT_PDCP_xface));
+  flexran_agent_register_pdcp_xface(mod_id, pdcp_agent_xface);
+
   /* 
    * initilize a timer 
    */ 
@@ -290,14 +264,34 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
    * start the enb agent task for tx and interaction with the underlying network function
    */ 
   if (!agent_task_created) {
-    if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, (void *) &flexran_agent[mod_id]) < 0) {
+    if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, flexran) < 0) {
       LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n");
       return -1;
     }
     agent_task_created = 1;
   }
-  
-  LOG_I(FLEXRAN_AGENT,"client ends\n");
+
+  pthread_mutex_init(&flexran->mutex_node_ctrl, NULL);
+  pthread_cond_init(&flexran->cond_node_ctrl, NULL);
+
+  if (flexran->node_ctrl_state == ENB_WAIT) {
+    /* wait three seconds before showing message and waiting "for real".
+     * This way, the message is (hopefully...) the last one and the user knows
+     * what is happening. If the controller sends a reconfiguration message in
+     * the meantime, the softmodem will never wait */
+    sleep(3);
+    LOG_I(ENB_APP, " * eNB %d: Waiting for FlexRAN RTController command *\n", mod_id);
+    pthread_mutex_lock(&flexran->mutex_node_ctrl);
+    while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state)
+      pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl);
+    pthread_mutex_unlock(&flexran->mutex_node_ctrl);
+
+    /* reconfigure RRC again, the agent might have changed the configuration */
+    MessageDef *msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
+    RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[mod_id]->configuration;
+    itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg_p);
+  }
+
   return 0;
 
 error:
diff --git a/openair2/ENB_APP/flexran_agent.h b/openair2/ENB_APP/flexran_agent.h
index 21ea21aafcf336551b9c276ef51d0e9976a34b8e..aed8f9eb60dc386700e74fbd1eeb7e7fddd5f96b 100644
--- a/openair2/ENB_APP/flexran_agent.h
+++ b/openair2/ENB_APP/flexran_agent.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -22,20 +22,28 @@
 /*! \file flexran_agent.h
  * \brief top level flexran agent  
  * \author Navid Nikaein and Xenofon Foukas
- * \date 2016
+ * \date 2017
  * \version 0.1
  */
 
 #ifndef FLEXRAN_AGENT_H_
 #define FLEXRAN_AGENT_H_
 
-#include "enb_config.h" // for enb properties
 #include "flexran_agent_common.h"
+#include "flexran_agent_async.h"
+#include "flexran_agent_extern.h"
+#include "flexran_agent_timer.h"
+#include "flexran_agent_defs.h"
+#include "flexran_agent_net_comm.h"
+#include "flexran_agent_ran_api.h"
+#include "flexran_agent_mac.h"
+#include "flexran_agent_rrc.h"
+#include "flexran_agent_pdcp.h"
+#include "log.h"
+#include "assertions.h"
 
-
-/* Initiation and termination of the eNodeB agent */
-int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties);
-int flexran_agent_stop(mid_t mod_id);
+/* Initiation of the eNodeB agent */
+int flexran_agent_start(mid_t mod_id);
 
 /* 
  * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller 
diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c
index 978b44929d7607b0b1a384447255d506e6de10c1..9e099fc21c31dd1b2ecaf39fc389f46e5770c90f 100644
--- a/openair2/ENB_APP/flexran_agent_async.c
+++ b/openair2/ENB_APP/flexran_agent_async.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -68,12 +68,12 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c
 
  error:
   LOG_I(FLEXRAN_AGENT,"there was an error\n");
-  return 1;
+  return NULL;
 }
 
 int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info) {
   flexran_agent_async_channel_t *channel;
-  channel = (flexran_agent_channel_t *)channel_info;
+  channel = (flexran_agent_async_channel_t *)channel_info;
 
   return message_put(channel->send_queue, data, size, priority);
 }
diff --git a/openair2/ENB_APP/flexran_agent_async.h b/openair2/ENB_APP/flexran_agent_async.h
index b097b15c2590885648a32d010e8287626022f562..03aebd0058fc6c3293baa664119124e6921f6ef2 100644
--- a/openair2/ENB_APP/flexran_agent_async.h
+++ b/openair2/ENB_APP/flexran_agent_async.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c
index 073bb8029cfca92266973a5b172f028001c08900..6d32aeedbb152facec421b7cfc4d176177320a6e 100644
--- a/openair2/ENB_APP/flexran_agent_common.c
+++ b/openair2/ENB_APP/flexran_agent_common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,18 +21,20 @@
 
 /*! \file flexran_agent_common.c
  * \brief common primitives for all agents 
- * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein
- * \date 2016
+ * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein, shahab SHARIAT BAGHERI
+ * \date 2017
  * \version 0.1
  */
 
-#include<stdio.h>
+#include <stdio.h>
 #include <time.h>
+#include <sys/stat.h>
 
 #include "flexran_agent_common.h"
 #include "flexran_agent_common_internal.h"
 #include "flexran_agent_extern.h"
 #include "flexran_agent_net_comm.h"
+#include "flexran_agent_ran_api.h"
 #include "PHY/extern.h"
 #include "log.h"
 
@@ -41,10 +43,6 @@
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
 #include "rrc_eNB_UE_context.h"
 
-void * enb[NUM_MAX_ENB];
-void * enb_ue[NUM_MAX_ENB];
-void * enb_rrc[NUM_MAX_ENB];
-
 /*
  * message primitives
  */
@@ -108,7 +106,7 @@ int flexran_create_header(xid_t xid, Protocol__FlexType type,  Protocol__FlexHea
 
 int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
  
-  Protocol__FlexHeader *header;
+  Protocol__FlexHeader *header = NULL;
   /*TODO: Need to set random xid or xid from received hello message*/
   xid_t xid = 1;
 
@@ -163,7 +161,7 @@ int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) {
 
 
 int flexran_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) {
-  Protocol__FlexHeader *header;
+  Protocol__FlexHeader *header = NULL;
   /*TODO: Need to set a random xid*/
   xid_t xid = 1;
 
@@ -218,6 +216,7 @@ int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg) {
 int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
   
   xid_t xid;
+  Protocol__FlexHeader *header = NULL;
   Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
   Protocol__FlexEchoRequest *echo_req = input->echo_request_msg;
   xid = (echo_req->header)->xid;
@@ -228,7 +227,6 @@ int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__Flexran
     goto error;
   protocol__flex_echo_reply__init(echo_reply_msg);
 
-  Protocol__FlexHeader *header;
   if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0)
     goto error;
 
@@ -344,19 +342,6 @@ int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) {
   return -1;
 }
 
-int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) {
-  if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG)
-    goto error;
-  free(msg->ue_state_change_msg->header);
-  //TODO: Free the contents of the UE config structure
-  free(msg->ue_state_change_msg);
-  free(msg);
-  return 0;
-
- error:
-  //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
-  return -1;
-}
 
 int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) {
   if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG)
@@ -402,14 +387,13 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
   Protocol__FlexControlDelegation *control_delegation_msg = input->control_delegation_msg;
 
   //  struct timespec vartime = timer_start();
-  
   //Write the payload lib into a file in the cache and load the lib
   char lib_name[120];
   char target[512];
   snprintf(lib_name, sizeof(lib_name), "/%s.so", control_delegation_msg->name);
-  strcpy(target, local_cache);
+  strcpy(target, RC.flexran[mod_id]->cache_name);
   strcat(target, lib_name);
-
+  
   FILE *f;
   f = fopen(target, "wb");
   fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f);
@@ -442,1088 +426,10 @@ int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) {
 }
 
 
-/*
- * get generic info from RAN
- */
-
-void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran){
-
-  switch (ran){
-  case RAN_LTE_OAI :
-    enb[mod_id] =  (void *)&eNB_mac_inst[mod_id];
-    enb_ue[mod_id] = (void *)&eNB_mac_inst[mod_id].UE_list;
-    enb_rrc[mod_id] = (void *)&eNB_rrc_inst[mod_id];
-    break;
-  default :
-    goto error;
-  }
-
-  return; 
-
- error:
-  LOG_E(FLEXRAN_AGENT, "unknown RAN name %d\n", ran);
-}
-
-int flexran_get_current_time_ms (mid_t mod_id, int subframe_flag){
-
-  if (subframe_flag == 1){
-    return ((eNB_MAC_INST *)enb[mod_id])->frame*10 + ((eNB_MAC_INST *)enb[mod_id])->subframe;
-  }else {
-    return ((eNB_MAC_INST *)enb[mod_id])->frame*10;
-  }
-   
-}
-
-unsigned int flexran_get_current_frame (mid_t mod_id) {
-
-  //  #warning "SFN will not be in [0-1023] when oaisim is used"
-  return ((eNB_MAC_INST *)enb[mod_id])->frame;
-  
-}
-
-unsigned int flexran_get_current_system_frame_num(mid_t mod_id) {
-  return (flexran_get_current_frame(mod_id) %1024);
-}
-
-unsigned int flexran_get_current_subframe (mid_t mod_id) {
-
-  return ((eNB_MAC_INST *)enb[mod_id])->subframe;
-  
-}
-
-uint16_t flexran_get_sfn_sf (mid_t mod_id) {
-  
-  frame_t frame;
-  sub_frame_t subframe;
-  uint16_t sfn_sf, frame_mask, sf_mask;
-  
-  frame = (frame_t) flexran_get_current_system_frame_num(mod_id);
-  subframe = (sub_frame_t) flexran_get_current_subframe(mod_id);
-  frame_mask = ((1<<12) - 1);
-  sf_mask = ((1<<4) - 1);
-  sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4);
-  
-  return sfn_sf;
-}
-
-uint16_t flexran_get_future_sfn_sf (mid_t mod_id, int ahead_of_time) {
-  
-  frame_t frame;
-  sub_frame_t subframe;
-  uint16_t sfn_sf, frame_mask, sf_mask;
-  
-  frame = (frame_t) flexran_get_current_system_frame_num(mod_id);
-  subframe = (sub_frame_t) flexran_get_current_subframe(mod_id);
-
-  subframe = ((subframe + ahead_of_time) % 10);
-  
-  if (subframe < flexran_get_current_subframe(mod_id)) {
-    frame = (frame + 1) % 1024;
-  }
-  
-  int additional_frames = ahead_of_time / 10;
-  frame = (frame + additional_frames) % 1024;
-  
-  frame_mask = ((1<<12) - 1);
-  sf_mask = ((1<<4) - 1);
-  sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4);
-  
-  return sfn_sf;
-}
-
-int flexran_get_num_ues (mid_t mod_id){
-
-  return  ((UE_list_t *)enb_ue[mod_id])->num_UEs;
-}
-
-int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id) {
-
-  return  UE_RNTI(mod_id, ue_id);
-}
-
-int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) {
-
-  return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].bsr_info[lcid];
-}
-
-int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id) {
-
-  return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].phr_info;
-}
-
-int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id) {
-  LTE_eNB_UE_stats     *eNB_UE_stats     = NULL;
-  eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, 0, UE_RNTI(mod_id, ue_id));
-  return eNB_UE_stats->DL_cqi[0];
-
-  //  return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi;
-}
-
-int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) {
-  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
-  uint16_t frame = (uint16_t) flexran_get_current_frame(mod_id);
-  uint16_t subframe = (uint16_t) flexran_get_current_subframe(mod_id);
-  mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,subframe,ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0);
-  return rlc_status.bytes_in_buffer;
-}
-
-int flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) {
-  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
-  uint16_t frame = (uint16_t) flexran_get_current_frame(mod_id);
-  uint16_t subframe = (uint16_t) flexran_get_current_subframe(mod_id);
-  mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, subframe, ENB_FLAG_YES, MBMS_FLAG_NO, channel_id, 0);
-  return rlc_status.head_sdu_creation_time;
-}
-
-short flexran_get_TA(mid_t mod_id, mid_t ue_id, int CC_id) {
-  
-  UE_list_t *UE_list=&eNB_mac_inst[mod_id].UE_list;
-  int rnti;
-
-  rnti = flexran_get_ue_crnti(mod_id, ue_id);
-
-  LTE_eNB_UE_stats		*eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
-  //ue_sched_ctl->ta_timer		      = 20;	// wait 20 subframes before taking TA measurement from PHY                                         
-  switch (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RB_DL) {
-  case 6:
-    return eNB_UE_stats->timing_advance_update;
-  case 15:
-    return eNB_UE_stats->timing_advance_update/2;
-  case 25:
-    return eNB_UE_stats->timing_advance_update/4;
-  case 50:
-    return eNB_UE_stats->timing_advance_update/8;
-  case 75:
-    return eNB_UE_stats->timing_advance_update/12;
-  case 100:
-    if (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.threequarter_fs == 0) {
-      return eNB_UE_stats->timing_advance_update/16;
-    } else {
-      return eNB_UE_stats->timing_advance_update/12;
-    }
-  default:
-    return 0;
-  }
-}
-
-void flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id) {
-  
-  UE_list_t *UE_list=&eNB_mac_inst[mod_id].UE_list;
-  UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id];
-
-  if (ue_sched_ctl->ta_timer == 0) {
-    
-    // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ...                                                                         
-    //    LTE_eNB_UE_stats		*eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
-    //ue_sched_ctl->ta_timer		      = 20;	// wait 20 subframes before taking TA measurement from PHY                                         
-    ue_sched_ctl->ta_update = flexran_get_TA(mod_id, ue_id, CC_id);
-
-    // clear the update in case PHY does not have a new measurement after timer expiry                                               
-    //    eNB_UE_stats->timing_advance_update	      = 0;
-  } else {
-    ue_sched_ctl->ta_timer--;
-    ue_sched_ctl->ta_update		      = 0;	// don't trigger a timing advance command      
-  }
-}
-
-int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) {
-  
-  UE_list_t			*UE_list      = &eNB_mac_inst[mod_id].UE_list;
-
-  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
-  LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
-  
-  if (eNB_UE_stats == NULL) {
-    return 0;
-  }
-
-  if (flexran_get_TA(mod_id, ue_id, CC_id) != 0) {
-    return PROTOCOL__FLEX_CE_TYPE__FLPCET_TA;
-  } else {
-    return 0;
-  }
-
-}
-
-int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) {
-	return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id];
-}
-
-int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) {
-	LTE_eNB_UE_stats	*eNB_UE_stats = NULL;
-
-	rnti_t			 rnti	      = flexran_get_ue_crnti(mod_id,ue_id);
-
-	eNB_UE_stats			      = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
-	
-	if (eNB_UE_stats == NULL) {
-	  return 0;
-	}
-
-	return eNB_UE_stats[CC_id].rank;
-}
-
-int flexran_get_tpc(mid_t mod_id, mid_t ue_id) {
-	LTE_eNB_UE_stats	*eNB_UE_stats = NULL;
-	int32_t			 normalized_rx_power, target_rx_power;
-	int			 tpc	      = 1;
-
-	int			 pCCid	      = UE_PCCID(mod_id,ue_id);
-	rnti_t			 rnti	      = flexran_get_ue_crnti(mod_id,ue_id);
-
-	eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti);
-
-	target_rx_power = mac_xface->get_target_pusch_rx_power(mod_id,pCCid);
-
-	if (eNB_UE_stats == NULL) {
-	  normalized_rx_power = target_rx_power;
-	} else if (eNB_UE_stats->UL_rssi != NULL) {
-	  normalized_rx_power = eNB_UE_stats->UL_rssi[0];
-	} else {
-	  normalized_rx_power = target_rx_power;
-	}
-
-	if (normalized_rx_power>(target_rx_power+1)) {
-		tpc = 0;	//-1
-	} else if (normalized_rx_power<(target_rx_power-1)) {
-		tpc = 2;	//+1
-	} else {
-		tpc = 1;	//0
-	}
-	return tpc;
-}
-
-int flexran_get_harq(const mid_t mod_id, 
-		     const uint8_t CC_id, 
-		     const mid_t ue_id, 
-		     const int frame, 
-		     const uint8_t subframe, 
-		     uint8_t *id, 
-		     uint8_t *round)	{ //flag_id_status = 0 then id, else status
-	/*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in
-	 * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add
-	 * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/
-
-  uint8_t harq_pid;
-  uint8_t harq_round;
-  
-
-  uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
-
-  mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&harq_round,openair_harq_DL);
-
-  *id = harq_pid;
-  *round = harq_round;
-  /* if (round > 0) { */
-  /*   *status = 1; */
-  /* } else { */
-  /*   *status = 0; */
-  /* } */
-
-  /* return 0; */
-  return *round;
-}
-
-int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) {
-  LTE_eNB_UE_stats *eNB_UE_stats = NULL;
-  uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  eNB_UE_stats =  mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
-  
-  if (eNB_UE_stats == NULL) {
-    return -1;
-  }
-  
-  //	if(eNB_UE_stats->Po_PUCCH_update == 1) {
-  return eNB_UE_stats->Po_PUCCH_dBm;
-  //}
-  //else
-  //  return -1;
-}
-
-int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id) {
-  int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id);
-  return pucch_rx_received;
-}
-
-int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id) {
-  LTE_eNB_UE_stats *eNB_UE_stats = NULL;
-  uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  eNB_UE_stats =  mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
-  return eNB_UE_stats->Po_PUCCH_update;
-}
-
-int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id) {
-  LTE_eNB_UE_stats *eNB_UE_stats = NULL;
-  uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  eNB_UE_stats =  mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
-  eNB_UE_stats->Po_PUCCH_update = 0;
-  
-  return 0;
-}
-
-
-/*
- * ************************************
- * Get Messages for eNB Configuration Reply
- * ************************************
- */
-
-int flexran_get_hopping_offset(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->pusch_config_common.pusch_HoppingOffset;
-}
-
-int flexran_get_hopping_mode(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->pusch_config_common.hoppingMode;
-}
-
-int flexran_get_n_SB(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->pusch_config_common.n_SB;
-}
-
-int flexran_get_enable64QAM(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->pusch_config_common.enable64QAM;
-}
-
-int flexran_get_phich_duration(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->phich_config_common.phich_duration;
-}
-
-int flexran_get_phich_resource(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	if(frame_parms->phich_config_common.phich_resource == oneSixth)
-		return 0;
-	else if(frame_parms->phich_config_common.phich_resource == half)
-		return 1;
-	else if(frame_parms->phich_config_common.phich_resource == one)
-		return 2;
-	else if(frame_parms->phich_config_common.phich_resource == two)
-		return 3;
-
-	return -1;
-}
-
-int flexran_get_n1pucch_an(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->pucch_config_common.n1PUCCH_AN;
-}
-
-int flexran_get_nRB_CQI(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->pucch_config_common.nRB_CQI;
-}
-
-int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->pucch_config_common.deltaPUCCH_Shift;
-}
-
-int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
-}
-
-int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset;
-}
-
-int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->maxHARQ_Msg3Tx;
-}
-
-int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->Ncp_UL;
-}
-
-int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->Ncp;
-}
-
-int flexran_get_cell_id(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->Nid_cell;
-}
-
-int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig;
-}
-
-int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->soundingrs_ul_config_common.srs_SubframeConfig;
-}
-
-int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->soundingrs_ul_config_common.srs_MaxUpPts;
-}
-
-int flexran_get_N_RB_DL(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->N_RB_DL;
-}
-
-int flexran_get_N_RB_UL(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->N_RB_UL;
-}
-
-int flexran_get_N_RBG(mid_t mod_id, int CC_id) {
-  	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->N_RBG;
-}
-
-int flexran_get_subframe_assignment(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->tdd_config;
-}
-
-int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	return frame_parms->tdd_config_S;
-}
-
-int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) {
-  return enb_config_get()->properties[mod_id]->rach_raResponseWindowSize[CC_id];
-}
-
-int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) {
-  return enb_config_get()->properties[mod_id]->rach_macContentionResolutionTimer[CC_id];
-}
-
-int flexran_get_duplex_mode(mid_t mod_id, int CC_id) {
-	LTE_DL_FRAME_PARMS   *frame_parms;
-
-	frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-	if(frame_parms->frame_type == TDD)
-		return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD;
-	else if (frame_parms->frame_type == FDD)
-		return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD;
-
-	return -1;
-}
-
-long flexran_get_si_window_length(mid_t mod_id, int CC_id) {
-	return  ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sib1->si_WindowLength;
-}
-
-int flexran_get_sib1_length(mid_t mod_id, int CC_id) {
-	return  ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sizeof_SIB1;
-}
-
-int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id) {
-  /* TODO: This should return the number of PDCCH symbols initially used by the cell CC_id */
-  return 0;
-  //(PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols);
-}
-
-
-
-/*
- * ************************************
- * Get Messages for UE Configuration Reply
- * ************************************
- */
-
-
-int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.mac_MainConfig != NULL) {
-      return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated;
-    } else {
-      return -1;
-    }
-  } else {
-    return -1;
-  }
-}
-
-int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.measGapConfig != NULL) {
-      if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) {
-	if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) {
-	  return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1;
-	} else if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) {
-	  return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP2;
-	} else {
-	  return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF;
-	}
-      }
-    }
-  }
-  return -1;
-}
-
-
-int flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.measGapConfig != NULL){
-      if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) {
-	if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) {
-	  return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0;
-	} else if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) {
-	  return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0;
-	} 
-      }
-    }
-  }
-  return -1;
-}
-
-int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) {
-	return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL;
-}
-
-int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) {
-	return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL;
-}
-
-int flexran_get_half_duplex(mid_t ue_id) {
-  // TODO
-	//int halfduplex = 0;
-	//int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count;
-	//for (int i =0; i < bands_to_scan; i++){
-		//if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.array[i]->halfDuplex > 0)
-		//	halfduplex = 1;
-	//}
-	//return halfduplex;
-  return 0;
-}
-
-int flexran_get_intra_sf_hopping(mid_t ue_id) {
-	//TODO:Get proper value
-	//temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf);
-	//return (0 & ( 1 << (31)));
-  return 0;
-}
-
-int flexran_get_type2_sb_1(mid_t ue_id) {
-	//TODO:Get proper value
-	//uint8_t temp = 0;
-	//temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf);
-	//return (temp & ( 1 << (11)));
-  return 0;
-}
-
-int flexran_get_ue_category(mid_t ue_id) {
-	//TODO:Get proper value
-	//return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category);
-  return 0;
-}
-
-int flexran_get_res_alloc_type1(mid_t ue_id) {
-	//TODO:Get proper value
-	//uint8_t temp = 0;
-	//temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf);
-	//return (temp & ( 1 << (30)));
-  return 0;
-}
-
-int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
-      return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode;
-    } else {
-      return -1;
-    }
-  } else {
-    return -1;
-  }
-}
-
-int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.mac_MainConfig != NULL){
-      return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling;
-    } else {
-      return -1;
-    }
-  }
-  else {
-    return -1;
-  }
-}
-
-int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.mac_MainConfig != NULL){
-      return *ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx;
-    }
-  }
-  return -1;
-}
-
-int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
-      return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index;
-    } else {
-      return -1;
-    } 
-  } else {
-    return -1;
-  }
-}
-
-int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
-      return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
-    } else {
-      return -1;
-    }
-  } else {
-    return -1;
-  }
-}
-
-int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
-      return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
-    } else {
-      return -1;
-    }
-  }
-  else {
-    return -1;
-  }
-}
-
-int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
-      if (ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic != NULL) {
-	return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI;
-      }
-    }
-  }
-  return -1;
-}
-
-int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) {
-	return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
-}
-
-int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
-      return *ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic;
-    }
-  }
-  return -1;
-}
-
-int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) {
-  // TODO: This needs fixing
-  return -1;
-
-  /* struct rrc_eNB_ue_context_s* ue_context_p = NULL; */
-  /* uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); */
-  
-  /* ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); */
-  
-  /* if(ue_context_p != NULL) { */
-  /*   if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ */
-  /*     return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode; */
-  /*   } else { */
-  /*     return -1; */
-  /*   } */
-  /* } else { */
-  /*   return -1; */
-  /* } */
-}
-
-int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
-      return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor;
-    } else {
-      return -1;
-    }
-  } else {
-    return -1;
-  }
-}
-
-int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id) {
-  //TODO: need to double check
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.mac_MainConfig != NULL){
-      if(ue_context_p->ue_context.mac_MainConfig->ext2 != NULL){
-	long val = (*(ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10));
-	if (val > 0) {
-	  return 1;
-	}
-      }
-    }
-  }
-  return -1;
-}
-
-int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) {
-  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
-  uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
-  
-  ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
-  
-  if(ue_context_p != NULL) {
-    if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
-      if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) {
-	return 2;
-      } else if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) {
-	return 1;
-      } else {
-	return 0;
-      }
-    } else {
-      return -1;
-    }
-  } else {
-    return -1;
-  }
-}
-
-int flexran_get_lcg(mid_t ue_id, mid_t lc_id) {
-  if (UE_mac_inst == NULL) {
-    return -1;
-  }
-  if(UE_mac_inst[ue_id].logicalChannelConfig[lc_id] != NULL) {
-    return *UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup;
-  } else {
-    return -1;
-  }
-}
-
-int flexran_get_direction(mid_t ue_id, mid_t lc_id) {
-	/*TODO: fill with the value for the rest of LCID*/
-  if(lc_id == DCCH || lc_id == DCCH1) {
-    return 2;
-  } else if(lc_id == DTCH) {
-    return 1;
-  } else {
-    return -1;
-  }
-}
-
-int flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) {
-  int size;
-  Protocol__FlexranMessage *msg;
-  Protocol__FlexHeader *header;
-  void *data;
-  int priority = 0;
-
-  int xid = 0;
-
-  if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0)
-    goto error;
-
-  Protocol__FlexUeStateChange *ue_state_change_msg;
-  ue_state_change_msg = malloc(sizeof(Protocol__FlexUeStateChange));
-  if(ue_state_change_msg == NULL) {
-    goto error;
-  }
-  protocol__flex_ue_state_change__init(ue_state_change_msg);
-  ue_state_change_msg->has_type = 1;
-  ue_state_change_msg->type = state_change;
-
-  Protocol__FlexUeConfig *config;
-  config = malloc(sizeof(Protocol__FlexUeConfig));
-  if (config == NULL) {
-    goto error;
-  }
-  protocol__flex_ue_config__init(config);
-  if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED) {
-    // Simply set the rnti of the UE
-    config->has_rnti = 1;
-    config->rnti = rnti;
-  } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED
-	     || state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED) {
-	  	  int i = find_UE_id(mod_id, rnti);
-		  config->has_rnti = 1;
-		  config->rnti = rnti;
-	  	  if(flexran_get_time_alignment_timer(mod_id,i) != -1) {
-	  		  config->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i);
-	  		  config->has_time_alignment_timer = 1;
-	  	  }
-	  	  if(flexran_get_meas_gap_config(mod_id,i) != -1){
-	  		  config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i);
-	  	  	  config->has_meas_gap_config_pattern = 1;
-	  	  }
-	  	  if(config->has_meas_gap_config_pattern == 1 &&
-		     config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) {
-		    config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i);
-		    config->has_meas_gap_config_sf_offset = 1;
-	  	  }
-	  	  //TODO: Set the SPS configuration (Optional)
-	  	  //Not supported for now, so we do not set it
-
-	  	  //TODO: Set the SR configuration (Optional)
-	  	  //We do not set it for now
-
-	  	  //TODO: Set the CQI configuration (Optional)
-	  	  //We do not set it for now
-		  
-		  if(flexran_get_ue_transmission_mode(mod_id,i) != -1) {
-	  		  config->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i);
-	  		  config->has_transmission_mode = 1;
-	  	  }
-
-		  config->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i);
-	  	  config->has_ue_aggregated_max_bitrate_ul = 1;
-
-		  config->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i);
-	  	  config->has_ue_aggregated_max_bitrate_dl = 1;
-
-	  	  //TODO: Set the UE capabilities
-	  	  Protocol__FlexUeCapabilities *c_capabilities;
-	  	  c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities));
-	  	  protocol__flex_ue_capabilities__init(c_capabilities);
-	  	  //TODO: Set half duplex (FDD operation)
-	  	  c_capabilities->has_half_duplex = 0;
-	  	  c_capabilities->half_duplex = 1;//flexran_get_half_duplex(i);
-	  	  //TODO: Set intra-frame hopping flag
-	  	  c_capabilities->has_intra_sf_hopping = 0;
-	  	  c_capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i);
-	  	  //TODO: Set support for type 2 hopping with n_sb > 1
-	  	  c_capabilities->has_type2_sb_1 = 0;
-	  	  c_capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i);
-	  	  //TODO: Set ue category
-	  	  c_capabilities->has_ue_category = 0;
-	  	  c_capabilities->ue_category = 1;//flexran_get_ue_category(i);
-	  	  //TODO: Set UE support for resource allocation type 1
-	  	  c_capabilities->has_res_alloc_type1 = 0;
-	  	  c_capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i);
-	  	  //Set the capabilites to the message
-	  	  config->capabilities = c_capabilities;
-		  
-	  	  if(flexran_get_ue_transmission_antenna(mod_id,i) != -1) {
-		    config->has_ue_transmission_antenna = 1;
-		    config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_tti_bundling(mod_id,i) != -1) {
-		    config->has_tti_bundling = 1;
-		    config->tti_bundling = flexran_get_tti_bundling(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_maxHARQ_TX(mod_id,i) != -1){
-		    config->has_max_harq_tx = 1;
-		    config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_beta_offset_ack_index(mod_id,i) != -1) {
-		    config->has_beta_offset_ack_index = 1;
-		    config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_beta_offset_ri_index(mod_id,i) != -1) {
-		    config->has_beta_offset_ri_index = 1;
-		    config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_beta_offset_cqi_index(mod_id,i) != -1) {
-		    config->has_beta_offset_cqi_index = 1;
-		    config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_ack_nack_simultaneous_trans(mod_id,i) != -1) {
-		    config->has_ack_nack_simultaneous_trans = 1;
-		    config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) {
-		    config->has_simultaneous_ack_nack_cqi = 1;
-		    config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) {
-		    config->has_aperiodic_cqi_rep_mode = 1;
-		    int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i);
-		    if (mode > 4) {
-		      config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE;
-		    } else {
-		      config->aperiodic_cqi_rep_mode = mode;
-		    }
-	  	  }
-
-	  	  if(flexran_get_tdd_ack_nack_feedback(mod_id, i) != -1) {
-		    config->has_tdd_ack_nack_feedback = 1;
-		    config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) {
-		    config->has_ack_nack_repetition_factor = 1;
-		    config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i);
-	  	  }
-
-	  	  if(flexran_get_extended_bsr_size(mod_id, i) != -1) {
-		    config->has_extended_bsr_size = 1;
-		    config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i);
-	  	  }
-
-		  config->has_pcell_carrier_index = 1;
-		  config->pcell_carrier_index = UE_PCCID(mod_id, i);
-	  	  //TODO: Set carrier aggregation support (boolean)
-	  	  config->has_ca_support = 0;
-	  	  config->ca_support = 0;
-	  	  if(config->has_ca_support){
-		    //TODO: Set cross carrier scheduling support (boolean)
-		    config->has_cross_carrier_sched_support = 1;
-		    config->cross_carrier_sched_support = 0;
-		    //TODO: Set secondary cells configuration
-		    // We do not set it for now. No carrier aggregation support
-		    
-		    //TODO: Set deactivation timer for secondary cell
-		    config->has_scell_deactivation_timer = 0;
-		    config->scell_deactivation_timer = 0;
-	  	  }
-  } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) {
-    // TODO: Not supported for now. Leave blank
-  }
-
-  ue_state_change_msg->config = config;
-  msg = malloc(sizeof(Protocol__FlexranMessage));
-  if (msg == NULL) {
-    goto error;
-  }
-  protocol__flexran_message__init(msg);
-  msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG;
-  msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
-  msg->ue_state_change_msg = ue_state_change_msg;
-
-  data = flexran_agent_pack_message(msg, &size);
-  /*Send sr info using the MAC channel of the eNB*/
-  if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
-    goto error;
-  }
-
-  LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
-  return 0;
- error:
-  LOG_D(FLEXRAN_AGENT, "Could not send UE state message\n");
-  return -1;
-}
-
-
-
 int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
 
   xid_t xid;
+  Protocol__FlexHeader *header = NULL;
   Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
   Protocol__FlexLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg;
   xid = (lc_config_request_msg->header)->xid;
@@ -1536,7 +442,6 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl
     goto error;
   protocol__flex_lc_config_reply__init(lc_config_reply_msg);
 
-  Protocol__FlexHeader *header;
   if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0)
     goto error;
 
@@ -1562,6 +467,7 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl
       //Set this according to the current state of the UE. This is only a temporary fix
       int status = 0;
       status = mac_eNB_get_rrc_status(mod_id, flexran_get_ue_crnti(mod_id, i));
+      /* TODO needs to be revised and appropriate API to be implemented */
       if (status < RRC_CONNECTED) {
 	lc_ue_config[i]->n_lc_config = 0;
       } else if (status == RRC_CONNECTED) {
@@ -1583,10 +489,10 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl
 	  lc_config[j]->has_lcid = 1;
 	  lc_config[j]->lcid = j+1;
 	 
-	  int lcg = flexran_get_lcg(i, j+1);
+	  int lcg = flexran_get_lcg(mod_id, i, j+1);
 	  if (lcg >= 0 && lcg <= 3) {
 	    lc_config[j]->has_lcg = 1;
-	    lc_config[j]->lcg = flexran_get_lcg(i,j+1);
+	    lc_config[j]->lcg = flexran_get_lcg(mod_id, i,j+1);
 	  }
 	 
 	  lc_config[j]->has_direction = 1;
@@ -1600,6 +506,7 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl
 	  lc_config[j]->has_qci = 1;
 	  lc_config[j]->qci = 1;
 	  if (lc_config[j]->direction == PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_GBR) {
+            /* TODO all of the need to be taken from API */
 	    //TODO: Set the max bitrate (UL)
 	    lc_config[j]->has_e_rab_max_bitrate_ul = 0;
 	    lc_config[j]->e_rab_max_bitrate_ul = 0;
@@ -1650,6 +557,7 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl
 int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
 
   xid_t xid;
+  Protocol__FlexHeader *header = NULL;
   Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
   Protocol__FlexUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg;
   xid = (ue_config_request_msg->header)->xid;
@@ -1662,7 +570,6 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl
     goto error;
   protocol__flex_ue_config_reply__init(ue_config_reply_msg);
 
-  Protocol__FlexHeader *header;
   if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0)
     goto error;
 
@@ -1682,6 +589,8 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl
 
       ue_config[i]->rnti = flexran_get_ue_crnti(mod_id,i);
       ue_config[i]->has_rnti = 1;
+      ue_config[i]->imsi = flexran_get_ue_imsi(mod_id, i);
+      ue_config[i]->has_imsi = 1;
       //TODO: Set the DRX configuration (optional)
       //Not supported for now, so we do not set it
 
@@ -1723,21 +632,16 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl
       Protocol__FlexUeCapabilities *capabilities;
       capabilities = malloc(sizeof(Protocol__FlexUeCapabilities));
       protocol__flex_ue_capabilities__init(capabilities);
-      //TODO: Set half duplex (FDD operation)
-      capabilities->has_half_duplex = 0;
-      capabilities->half_duplex = 0;//flexran_get_half_duplex(i);
-      //TODO: Set intra-frame hopping flag
-      capabilities->has_intra_sf_hopping = 0;
-      capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i);
-      //TODO: Set support for type 2 hopping with n_sb > 1
-      capabilities->has_type2_sb_1 = 0;
-      capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i);
-      //TODO: Set ue category
-      capabilities->has_ue_category = 0;
-      capabilities->ue_category = 1;//flexran_get_ue_category(i);
-      //TODO: Set UE support for resource allocation type 1
-      capabilities->has_res_alloc_type1 = 0;
-      capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i);
+      capabilities->has_half_duplex = 1;
+      capabilities->half_duplex = flexran_get_half_duplex(mod_id, i);
+      capabilities->has_intra_sf_hopping = 1;
+      capabilities->intra_sf_hopping = flexran_get_intra_sf_hopping(mod_id, i);
+      capabilities->has_type2_sb_1 = 1;
+      capabilities->type2_sb_1 = flexran_get_type2_sb_1(mod_id, i);
+      capabilities->has_ue_category = 1;
+      capabilities->ue_category = flexran_get_ue_category(mod_id, i);
+      capabilities->has_res_alloc_type1 = 1;
+      capabilities->res_alloc_type1 = flexran_get_res_alloc_type1(mod_id, i);
       //Set the capabilites to the message
       ue_config[i]->capabilities = capabilities;
 
@@ -1771,9 +675,10 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl
 	ue_config[i]->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i);
       }
       
-      if (flexran_get_ack_nack_simultaneous_trans(mod_id,i) != -1) {
+      /* assume primary carrier */
+      if (flexran_get_ack_nack_simultaneous_trans(mod_id, i, 0) != -1) {
 	ue_config[i]->has_ack_nack_simultaneous_trans = 1;
-	ue_config[i]->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i);
+	ue_config[i]->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id, i, 0);
       }
       
       if (flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) {
@@ -1791,9 +696,9 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl
 	}
       }
       
-      if (flexran_get_tdd_ack_nack_feedback(mod_id, i) != -1) {
+      if (flexran_get_tdd_ack_nack_feedback_mode(mod_id, i) != -1) {
 	ue_config[i]->has_tdd_ack_nack_feedback = 1;
-	ue_config[i]->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback(mod_id,i);
+	ue_config[i]->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id,i);
       }
       
       if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) {
@@ -1854,7 +759,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl
 
 int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) {
 
-	Protocol__FlexHeader *header;
+	Protocol__FlexHeader *header = NULL;
 	xid_t xid = 1;
 
 	Protocol__FlexEnbConfigRequest *enb_config_request_msg;
@@ -1893,6 +798,7 @@ int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol_
 int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
 
   xid_t xid;
+  Protocol__FlexHeader *header = NULL;
   Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
   Protocol__FlexEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg;
   xid = (enb_config_req_msg->header)->xid;
@@ -1906,7 +812,6 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
     goto error;
   protocol__flex_enb_config_reply__init(enb_config_reply_msg);
 
-  Protocol__FlexHeader *header;
   if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0)
     goto error;
   
@@ -2105,6 +1010,22 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
       cell_conf[i]->srs_mac_up_pts = flexran_get_srs_MaxUpPts(enb_id,i);
       cell_conf[i]->has_srs_mac_up_pts = 1;
 
+      cell_conf[i]->dl_freq = flexran_agent_get_operating_dl_freq (enb_id,i);
+      cell_conf[i]->has_dl_freq = 1;
+
+      cell_conf[i]->ul_freq = flexran_agent_get_operating_ul_freq (enb_id, i);
+      cell_conf[i]->has_ul_freq = 1;
+
+      cell_conf[i]->eutra_band = flexran_agent_get_operating_eutra_band (enb_id,i);
+      cell_conf[i]->has_eutra_band = 1;
+
+      cell_conf[i]->dl_pdsch_power = flexran_agent_get_operating_pdsch_refpower(enb_id, i);
+      cell_conf[i]->has_dl_pdsch_power = 1;
+
+      cell_conf[i]->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (enb_id,i);
+      cell_conf[i]->has_ul_pusch_power = 1;
+ 
+
       if (flexran_get_enable64QAM(enb_id,i) == 0) {
 	cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM;
       } else if(flexran_get_enable64QAM(enb_id,i) == 1) {
@@ -2140,191 +1061,39 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
 }
 
 
+int flexran_agent_rrc_measurement(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
 
-/*
- * timer primitives
- */
+  protocol_ctxt_t  ctxt;
+
+  Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
+  Protocol__FlexRrcTriggering *triggering = input->rrc_triggering;
 
-//struct flexran_agent_map agent_map;
-flexran_agent_timer_instance_t timer_instance;
-int agent_timer_init = 0;
-err_code_t flexran_agent_init_timer(void){
+  agent_reconf_rrc *reconf_param = malloc(sizeof(agent_reconf_rrc));
   
-  LOG_I(FLEXRAN_AGENT, "init RB tree\n");
-  if (!agent_timer_init) {
-    RB_INIT(&timer_instance.flexran_agent_head);
-    agent_timer_init = 1;
-  }
- 
- return PROTOCOL__FLEXRAN_ERR__NO_ERR;
-}
 
-RB_GENERATE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
+  reconf_param->trigger_policy = triggering->rrc_trigger;
 
-/* The timer_id might not be the best choice for the comparison */
-int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b){
+  struct rrc_eNB_ue_context_s   *ue_context_p = NULL;
 
-  if (a->timer_id < b->timer_id) return -1;
-  if (a->timer_id > b->timer_id) return 1;
+  RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[mod_id]->rrc_ue_head)){
 
-  // equal timers
-  return 0;
-}
 
-err_code_t flexran_agent_create_timer(uint32_t interval_sec,
-				      uint32_t interval_usec,
-				      agent_id_t     agent_id,
-				      instance_t     instance,
-				      uint32_t timer_type,
-				      xid_t xid,
-				      flexran_agent_timer_callback_t cb,
-				      void*    timer_args,
-				      long *timer_id){
-  
-  struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e));
-  DevAssert(e != NULL);
-  
-//uint32_t timer_id;
-  int ret=-1;
+  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, ue_context_p->ue_context.rnti, flexran_get_current_frame(mod_id), flexran_get_current_subframe (mod_id), mod_id);
   
-  if ((interval_sec == 0) && (interval_usec == 0 ))
-    return TIMER_NULL;
-  
-  if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX)
-    return TIMER_TYPE_INVALIDE;
-  
-  if (timer_type  ==   FLEXRAN_AGENT_TIMER_TYPE_ONESHOT){ 
-    ret = timer_setup(interval_sec, 
-		      interval_usec, 
-		      TASK_FLEXRAN_AGENT, 
-		      instance, 
-		      TIMER_ONE_SHOT,
-		      timer_args,
-		      timer_id);
-    
-    e->type = TIMER_ONE_SHOT;
-  }
-  else if (timer_type  ==   FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ){
-    ret = timer_setup(interval_sec, 
-		      interval_usec, 
-		      TASK_FLEXRAN_AGENT, 
-		      instance, 
-		      TIMER_PERIODIC,
-		      timer_args,
-		      timer_id);
-    
-    e->type = TIMER_PERIODIC;
-  }
-  
-  if (ret < 0 ) {
-    return TIMER_SETUP_FAILED; 
-  }
-
-  e->agent_id = agent_id;
-  e->instance = instance;
-  e->state = FLEXRAN_AGENT_TIMER_STATE_ACTIVE;
-  e->timer_id = *timer_id;
-  e->xid = xid;
-  e->timer_args = timer_args; 
-  e->cb = cb;
-  /*element should be a real pointer*/
-  RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e); 
-  
-  LOG_I(FLEXRAN_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n",
-	e->timer_id, e->agent_id, e->instance);
-  
-  return 0; 
-}
+  flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt, ue_context_p, 0, reconf_param);  
 
-err_code_t flexran_agent_destroy_timer(long timer_id){
-  
-  struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id);
-
-  if (e != NULL ) {
-    RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
-    flexran_agent_destroy_flexran_message(e->timer_args->msg);
-    free(e);
   }
   
-  if (timer_remove(timer_id) < 0 ) 
-    goto error;
   
+  *msg = NULL;
   return 0;
-
- error:
-  LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
-  return TIMER_REMOVED_FAILED ;
-}
-
-err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid) {
-  struct flexran_agent_timer_element_s *e = NULL;
-  long timer_id;
-  RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
-    if (e->xid == xid) {
-      timer_id = e->timer_id;
-      RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
-      flexran_agent_destroy_flexran_message(e->timer_args->msg);
-      free(e);
-      if (timer_remove(timer_id) < 0 ) { 
-	goto error;
-      }
-    }
-  }
-  return 0;
-
- error:
-  LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
-  return TIMER_REMOVED_FAILED ;
 }
 
-err_code_t flexran_agent_destroy_timers(void){
-  
-  struct flexran_agent_timer_element_s *e = NULL;
-  
-  RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
-    RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
-    timer_remove(e->timer_id);
-    flexran_agent_destroy_flexran_message(e->timer_args->msg);
-    free(e);
-  }  
 
+int flexran_agent_destroy_rrc_measurement(Protocol__FlexranMessage *msg){
+  // TODO
   return 0;
-
 }
 
-void flexran_agent_sleep_until(struct timespec *ts, int delay) {
-  ts->tv_nsec += delay;
-  if(ts->tv_nsec >= 1000*1000*1000){
-    ts->tv_nsec -= 1000*1000*1000;
-    ts->tv_sec++;
-  }
-  clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts,  NULL);
-}
-
-
-err_code_t flexran_agent_stop_timer(long timer_id){
-  
-  struct flexran_agent_timer_element_s *e=NULL;
-  struct flexran_agent_timer_element_s search;
-  memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
-  search.timer_id = timer_id;
 
-  e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
 
-  if (e != NULL ) {
-    e->state =  FLEXRAN_AGENT_TIMER_STATE_STOPPED;
-  }
-  
-  timer_remove(timer_id);
-  
-  return 0;
-}
-
-struct flexran_agent_timer_element_s * get_timer_entry(long timer_id) {
-  
-  struct flexran_agent_timer_element_s search;
-  memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
-  search.timer_id = timer_id;
-
-  return  RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search); 
-}
diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h
index abe5a05b447fe206e7f0bc857c82019806037277..242cb55ca86364db4254f250a6a97657ad73e71d 100644
--- a/openair2/ENB_APP/flexran_agent_common.h
+++ b/openair2/ENB_APP/flexran_agent_common.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,8 +21,8 @@
 
 /*! \file flexran_agent_common.h
  * \brief common message primitves and utilities 
- * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein
- * \date 2016
+ * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein and shahab SHARIAT BAGHERI
+ * \date 2017
  * \version 0.1
  */
 
@@ -37,7 +37,8 @@
 #include "flexran.pb-c.h"
 #include "stats_messages.pb-c.h"
 #include "stats_common.pb-c.h"
-
+#include "flexran_agent_ran_api.h"
+#include "flexran_agent_net_comm.h"
 #include "flexran_agent_defs.h"
 #include "enb_config.h"
 
@@ -60,6 +61,19 @@ typedef int (*flexran_agent_message_destruction_callback)(
 	Protocol__FlexranMessage *msg
 );
 
+typedef struct {
+ 
+  uint8_t is_initialized;
+  volatile uint8_t cont_update;
+  xid_t xid;
+  Protocol__FlexranMessage *stats_req;
+  Protocol__FlexranMessage *prev_stats_reply;
+
+  pthread_mutex_t *mutex;
+} stats_updates_context_t;
+
+stats_updates_context_t stats_context[NUM_MAX_ENB];
+
 /**********************************
  * FlexRAN protocol messages helper 
  * functions and generic handlers
@@ -116,10 +130,6 @@ int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg);
 /* TODO: Need to define and implement destructor */
 int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg);
 
-/* UE state change message constructor and destructor */
-int flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change);
-int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg);
-
 /* Control delegation message constructor and destructor */
 int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
 int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg);
@@ -128,6 +138,11 @@ int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg);
 int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
 int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg);
 
+/* rrc triggering measurement message constructor and destructor */
+int flexran_agent_rrc_measurement(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
+int flexran_agent_destroy_rrc_measurement(Protocol__FlexranMessage *msg);
+
+
 /* FlexRAN protocol message dispatcher function */
 Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, 
 						    uint8_t *data, 
@@ -136,367 +151,21 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
 /* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */
 Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args);
 
+/*Top level Statistics hanlder*/
+int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
 
+/* Function to be used to handle reply message . */
+int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg);
 
+/* Top level Statistics request protocol message constructor and destructor */
+int flexran_agent_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg);
+int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg);
 
-/****************************
- * get generic info from RAN
- ****************************/
-
-void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran);
-
-int flexran_get_current_time_ms (mid_t mod_id, int subframe_flag);
-
-/*Return the current frame number
- *Could be using implementation specific numbering of frames
- */
-unsigned int flexran_get_current_frame(mid_t mod_id);
-
-/*Return the current SFN (0-1023)*/ 
-unsigned int flexran_get_current_system_frame_num(mid_t mod_id);
-
-unsigned int flexran_get_current_subframe(mid_t mod_id);
-
-/*Return the frame and subframe number in compact 16-bit format.
-  Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/
-uint16_t flexran_get_sfn_sf (mid_t mod_id);
-
-/* Return a future frame and subframe number that is ahead_of_time
-   subframes later in compact 16-bit format. Bits 0-3 subframe,
-   rest for frame */
-uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
-
-/* Return the number of attached UEs */
-int flexran_get_num_ues(mid_t mod_id);
-
-/* Get the rnti of a UE with id ue_id */
-int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id);
-
-/* Get the RLC buffer status report of a ue for a designated
-   logical channel id */
-int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid);
-
-/* Get power headroom of UE with id ue_id */
-int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id);
-
-/* Get the UE wideband CQI */
-int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id);
-
-/* Get the transmission queue size for a UE with a channel_id logical channel id */
-int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
-
-/* Get the head of line delay for a UE with a channel_id logical channel id */
-int flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
-
-/* Check the status of the timing advance for a UE */
-short flexran_get_TA(mid_t mod_id, mid_t ue_id, int CC_id);
-
-/* Update the timing advance status (find out whether a timing advance command is required) */
-void flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id);
-
-/* Return timing advance MAC control element for a designated cell and UE */
-int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id);
-
-/* Get the number of active component carriers for a specific UE */
-int flexran_get_active_CC(mid_t mod_id, mid_t ue_id);
-
-/* Get the rank indicator for a designated cell and UE */
-int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id);
-
-/* See TS 36.213, section 10.1 */
-int flexran_get_n1pucch_an(mid_t mod_id, int CC_id);
-
-/* See TS 36.211, section 5.4 */
-int flexran_get_nRB_CQI(mid_t mod_id, int CC_id);
-
-/* See TS 36.211, section 5.4 */
-int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id);
-
-/* See TS 36.211, section 5.7.1 */
-int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id);
-
-/* See TS 36.211, section 5.7.1 */
-int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id);
-
-/* See TS 36.321 */
-int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id);
-
-/* Get the length of the UL cyclic prefix */
-int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id);
-
-/* Get the length of the DL cyclic prefix */
-int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id);
-
-/* Get the physical cell id of a cell */
-int flexran_get_cell_id(mid_t mod_id, int CC_id);
-
-/* See TS 36.211, section 5.5.3.2 */
-int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id);
-
-/* See TS 36.211, table 5.5.3.3-1 and 2 */
-int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id);
-
-/* Boolean value. See TS 36.211,
-   section 5.5.3.2. TDD only */
-int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id);
-
-/* Get number of DL resource blocks */
-int flexran_get_N_RB_DL(mid_t mod_id, int CC_id);
-
-/* Get number of UL resource blocks */
-int flexran_get_N_RB_UL(mid_t mod_id, int CC_id);
-
-/* Get number of resource block groups */
-int flexran_get_N_RBG(mid_t mod_id, int CC_id);
-
-/* Get DL/UL subframe assignment. TDD only */
-int flexran_get_subframe_assignment(mid_t mod_id, int CC_id);
-
-/* TDD only. See TS 36.211, table 4.2.1 */
-int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id);
-
-/* Get the duration of the random access response window in subframes */
-int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id);
-
-/* Get timer used for random access */
-int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id);
-
-/* Get type of duplex mode (FDD/TDD) */
-int flexran_get_duplex_mode(mid_t mod_id, int CC_id);
-
-/* Get the SI window length */
-long flexran_get_si_window_length(mid_t mod_id, int CC_id);
-
-/* Get the number of PDCCH symbols configured for the cell */
-int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id);
-
-/* See TS 36.213, sec 5.1.1.1 */
-int flexran_get_tpc(mid_t mod_id, mid_t ue_id);
-
-/* Get the first available HARQ process for a specific cell and UE during 
-   a designated frame and subframe. Returns 0 for success. The id and the 
-   status of the HARQ process are stored in id and status respectively */
-int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id,
-		     const int frame, const uint8_t subframe, unsigned char *id, unsigned char *round);
-
-/* Uplink power control management*/
-int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id);
-
-int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id);
-
-int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id);
-
-int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id);
-
-
-/*
- * ************************************
- * Get Messages for UE Configuration Reply
- * ************************************
- */
-
-/* Get timer in subframes. Controls the synchronization
-   status of the UE, not the actual timing 
-   advance procedure. See TS 36.321 */
-int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id);
-
-/* Get measurement gap configuration. See TS 36.133 */
-int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id);
-
-/* Get measurement gap configuration offset if applicable */
-int flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id);
-
-/* DL aggregated bit-rate of non-gbr bearer
-   per UE. See TS 36.413 */
-int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id);
-
-/* UL aggregated bit-rate of non-gbr bearer
-   per UE. See TS 36.413 */
-int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id);
-
-/* Only half-duplex support. FDD
-   operation. Boolean value */
-int flexran_get_half_duplex(mid_t ue_id);
-
-/* Support of intra-subframe hopping.
-   Boolean value */
-int flexran_get_intra_sf_hopping(mid_t ue_id);
-
-/* UE support for type 2 hopping with
-   n_sb>1 */
-int flexran_get_type2_sb_1(mid_t ue_id);
-
-/* Get the UE category */
-int flexran_get_ue_category(mid_t ue_id);
-
-/* UE support for resource allocation
-   type 1 */
-int flexran_get_res_alloc_type1(mid_t ue_id);
-
-/* Get UE transmission mode */
-int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id);
-
-/* Boolean value. See TS 36.321 */
-int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id);
-
-/* The max HARQ retransmission for UL.
-   See TS 36.321 */
-int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id);
-
-/* See TS 36.213 */
-int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id);
-
-/* See TS 36.213 */
-int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id);
-
-/* See TS 36.213 */
-int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id);
-
-/* Boolean. See TS36.213, Section 10.1 */
-int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id);
-
-/* Boolean. See TS 36.213, Section 8.2 */
-int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id);
-
-/* Get aperiodic CQI report mode */
-int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id);
-
-/* Get ACK/NACK feedback mode. TDD only */
-int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id);
-
-/* See TS36.213, section 10.1 */
-int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id);
-
-/* Boolean. Extended buffer status report size */
-int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
-
-/* Get number of UE transmission antennas */
-int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id);
-
-/* Get logical channel group of a channel with id lc_id */
-int flexran_get_lcg(mid_t ue_id, mid_t lc_id);
-
-/* Get direction of logical channel with id lc_id */
-int flexran_get_direction(mid_t ue_id, mid_t lc_id);
-
-/*******************
- * timer primitves
- *******************/
-
-#define TIMER_NULL                 -1 
-#define TIMER_TYPE_INVALIDE        -2
-#define	TIMER_SETUP_FAILED         -3
-#define	TIMER_REMOVED_FAILED       -4
-#define	TIMER_ELEMENT_NOT_FOUND    -5
-
-
-/* Type of the callback executed when the timer expired */
-typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*);
-
-typedef enum {
-  /* oneshot timer:  */
-  FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0x0,
-
-  /* periodic timer  */
-  FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 0x1,
-
-  /* Inactive state: initial state for any timer. */
-  FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2,
-  
-  /* Max number of states available */
-  FLEXRAN_AGENT_TIMER_TYPE_MAX,
-} flexran_agent_timer_type_t;
-
-typedef enum {
-  /* Inactive state: initial state for any timer. */
-  FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0,
-
-  /* Inactive state: initial state for any timer. */
-  FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1,
-
-  /* Inactive state: initial state for any timer. */
-  FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2,
-  
-  /* Max number of states available */
-  FLEXRAN_AGENT_TIMER_STATE_MAX,
-} flexran_agent_timer_state_t;
-
-typedef struct flexran_agent_timer_args_s{
-  mid_t            mod_id;
-  Protocol__FlexranMessage *msg;
-} flexran_agent_timer_args_t;
-
-
-
-typedef struct flexran_agent_timer_element_s{
-  RB_ENTRY(flexran_agent_timer_element_s) entry;
-
-  agent_id_t             agent_id;
-  instance_t       instance;
-  
-  flexran_agent_timer_type_t  type;
-  flexran_agent_timer_state_t state;
-
-  uint32_t interval_sec;
-  uint32_t interval_usec;
-
-  long timer_id;  /* Timer id returned by the timer API*/
-  xid_t xid; /*The id of the task as received by the controller
-	       message*/
-  
-  flexran_agent_timer_callback_t cb;
-  flexran_agent_timer_args_t *timer_args;
-  
-} flexran_agent_timer_element_t;
-
-typedef struct flexran_agent_timer_instance_s{
-  RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head;
-}flexran_agent_timer_instance_t;
-
-
-err_code_t flexran_agent_init_timer(void);
-
-/* Create a timer for some agent related event with id xid. Will store the id 
-   of the generated timer in timer_id */
-err_code_t flexran_agent_create_timer(uint32_t interval_sec,
-				  uint32_t interval_usec,
-				  agent_id_t     agent_id,
-				  instance_t     instance,
-				  uint32_t timer_type,
-				  xid_t xid,
-				  flexran_agent_timer_callback_t cb,
-				  void*    timer_args,
-				  long *timer_id);
-
-/* Destroy all existing timers */
-err_code_t flexran_agent_destroy_timers(void);
-
-/* Destroy the timer with the given timer_id */
-err_code_t flexran_agent_destroy_timer(long timer_id);
-
-/* Destroy the timer for task with id xid */
-err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid);
-
-/* Stop a timer */
-err_code_t flexran_agent_stop_timer(long timer_id);
-
-/* Restart the given timer */
-err_code_t flexran_agent_restart_timer(long *timer_id);
-
-/* Find the timer with the given timer_id */
-struct flexran_agent_timer_element_s * get_timer_entry(long timer_id);
-
-/* Obtain the protocol message stored in the given expired timer */
-Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args);
-
-/* Comparator function comparing two timers. Decides the ordering of the timers */
-int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b);
-
-/*Specify a delay in nanoseconds to timespec and sleep until then*/
-void flexran_agent_sleep_until(struct timespec *ts, int delay);
+err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id);
 
-/* RB_PROTOTYPE is for .h files */
-RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
+void flexran_agent_send_update_stats(mid_t mod_id);
 
+err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id, xid_t xid, stats_request_config_t *stats_req) ;
+err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id);
 
 #endif
diff --git a/openair2/ENB_APP/flexran_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c
index e735b2748b955c98c4666fe68828360229d1fc89..8874a0f64852f06ac619ba4eed39e7d02fe292ec 100644
--- a/openair2/ENB_APP/flexran_agent_common_internal.c
+++ b/openair2/ENB_APP/flexran_agent_common_internal.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,8 +21,8 @@
 
 /*! \file flexran_agent_common_internal.c
  * \brief internal functions for common message primitves and utilities 
- * \author Xenofon Foukas
- * \date 2016
+ * \author Xenofon Foukas and N. Nikaein
+ * \date 2017
  * \version 0.1
  */
 
@@ -32,6 +32,57 @@
 #include "flexran_agent_common_internal.h"
 #include "flexran_agent_mac_internal.h"
 
+/* needed to soft-restart the lte-softmodem */
+#include "targets/RT/USER/lte-softmodem.h"
+
+void handle_reconfiguration(mid_t mod_id)
+{
+  struct timespec start, end;
+  clock_gettime(CLOCK_MONOTONIC, &start);
+  flexran_agent_info_t *flexran = RC.flexran[mod_id];
+
+  if (ENB_WAIT == flexran->node_ctrl_state) {
+    /* this is already waiting, just release */
+    pthread_mutex_lock(&flexran->mutex_node_ctrl);
+    flexran->node_ctrl_state = ENB_NORMAL_OPERATION;
+    pthread_mutex_unlock(&flexran->mutex_node_ctrl);
+    pthread_cond_signal(&flexran->cond_node_ctrl);
+    return;
+  }
+
+  if (stop_L1L2(mod_id) < 0) {
+    LOG_E(ENB_APP, "can not stop lte-softmodem, aborting restart\n");
+    return;
+  }
+
+  /* node_ctrl_state should have value ENB_MAKE_WAIT only if this method is not
+   * executed by the FlexRAN thread */
+  if (ENB_MAKE_WAIT == flexran->node_ctrl_state) {
+    LOG_I(ENB_APP, " * eNB %d: Waiting for FlexRAN RTController command *\n", mod_id);
+    pthread_mutex_lock(&flexran->mutex_node_ctrl);
+    flexran->node_ctrl_state = ENB_WAIT;
+    while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state)
+      pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl);
+    pthread_mutex_unlock(&flexran->mutex_node_ctrl);
+  }
+
+  if (restart_L1L2(mod_id) < 0) {
+    LOG_F(ENB_APP, "can not restart, killing lte-softmodem\n");
+    itti_terminate_tasks(TASK_PHY_ENB);
+    return;
+  }
+
+  clock_gettime(CLOCK_MONOTONIC, &end);
+  end.tv_sec -= start.tv_sec;
+  if (end.tv_nsec >= start.tv_nsec) {
+    end.tv_nsec -= start.tv_nsec;
+  } else {
+    end.tv_sec -= 1;
+    end.tv_nsec = end.tv_nsec - start.tv_nsec + 1000000000;
+  }
+  LOG_I(ENB_APP, "lte-softmodem restart succeeded in %ld.%ld s\n", end.tv_sec, end.tv_nsec / 1000000);
+}
+
 int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) {
 
   yaml_parser_t parser;
@@ -64,7 +115,17 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
       break;
     case YAML_SCALAR_EVENT:
       // Check the system name and call the proper handler
-      if (strcmp((char *) event.data.scalar.value, "mac") == 0) {
+      // Check the system name and call the proper handler
+      if (strcmp((char *) event.data.scalar.value, "enb") == 0) {
+	LOG_I(ENB_APP, "This is intended for the enb system\n");
+	// Call the enb handler
+	if (parse_enb_id(mod_id, &parser) == -1) {
+          LOG_E(ENB_APP, "cannot parse data for eNB\n");
+	  goto error;
+	} else { // succeful parse and setting 
+          handle_reconfiguration(mod_id);
+	}
+      } else if (strcmp((char *) event.data.scalar.value, "mac") == 0) {
 	LOG_D(ENB_APP, "This is intended for the mac system\n");
 	// Call the mac handler
 	if (parse_mac_config(mod_id, &parser) == -1) {
@@ -90,8 +151,8 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
 	// TODO : Just skip it for now
 	if (skip_system_section(&parser) == -1) {
 	  goto error;
-	}
-      } else {
+	} 
+      } else { 
 	goto error;
       }
       break;
@@ -115,6 +176,145 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
 
 }
 
+int parse_enb_id(mid_t mod_id, yaml_parser_t *parser) {
+  yaml_event_t event;
+  
+  char *endptr;
+  // int is_array;
+  
+  int done = 0;
+  int mapping_started = 0;
+
+  while (!done) {
+    
+    if (!yaml_parser_parse(parser, &event))
+      goto error;
+
+    switch (event.type) {
+      // We are expecting a mapping of parameters
+    case YAML_SEQUENCE_START_EVENT:
+      // is_array = 1;
+      break;
+    case YAML_MAPPING_START_EVENT:
+      LOG_D(ENB_APP, "The mapping of the parameters started\n");
+      mapping_started = 1;
+      break;
+    case YAML_MAPPING_END_EVENT:
+      LOG_D(ENB_APP, "The mapping of the parameters ended\n");
+      mapping_started = 0;
+      break;
+    case YAML_SCALAR_EVENT:
+      if (!mapping_started) {
+	goto error;
+      }
+      // Check what key needs to be set
+      // use eNB egistered
+      if (mac_agent_registered[mod_id]) {
+	LOG_I(ENB_APP, "Setting parameter for eNB %s\n", event.data.scalar.value);
+	if (strcmp((char *) event.data.scalar.tag, YAML_INT_TAG) == 0) { // if int 
+	  if ((strtol((char *) event.data.scalar.value, &endptr, 10))== mod_id ) { // enb_id == mod_id: right enb instance to be configured
+	    if (parse_enb_config_parameters(mod_id, parser) == -1) {
+	      goto error;
+	    } 
+	  }
+	  else{
+	    goto error; // not the expected type
+	  }
+	}
+      }
+      break;
+    default:
+      goto error;
+    }
+
+    done = (event.type == YAML_MAPPING_END_EVENT);
+    yaml_event_delete(&event);
+  }
+
+  return 0;
+  
+ error:
+  yaml_event_delete(&event);
+  return -1;
+}
+
+int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) {
+  yaml_event_t event;
+  
+  char *endptr;
+  
+  int done = 0;
+  int mapping_started = 0;
+
+  while (!done) {
+    
+    if (!yaml_parser_parse(parser, &event))
+      goto error;
+
+    switch (event.type) {
+      // We are expecting a mapping of parameters
+    case YAML_MAPPING_START_EVENT:
+      LOG_D(ENB_APP, "The mapping of the parameters started\n");
+      mapping_started = 1;
+      break;
+    case YAML_MAPPING_END_EVENT:
+      LOG_D(ENB_APP, "The mapping of the parameters ended\n");
+      mapping_started = 0;
+      break;
+    case YAML_SCALAR_EVENT:
+      if (!mapping_started) {
+	goto error;
+      }
+      // Check what key needs to be set
+      if (strcmp((char *) event.data.scalar.value, "dl_freq") == 0) {
+        if (!yaml_parser_parse(parser, &event))
+          goto error;
+	flexran_agent_set_operating_dl_freq(mod_id,
+					    0,
+					    strtol((char *) event.data.scalar.value, &endptr, 10));
+        LOG_I(ENB_APP, "Setting dl_freq to %s\n", event.data.scalar.value);
+      } else if (strcmp((char *) event.data.scalar.value, "ul_freq_offset") == 0) {
+        if (!yaml_parser_parse(parser, &event))
+          goto error;
+        flexran_agent_set_operating_ul_freq(mod_id,
+                                            0,
+                                            strtol((char *) event.data.scalar.value, &endptr, 10));
+        LOG_I(ENB_APP, "Setting ul_freq_offset to %s\n", event.data.scalar.value);
+      } else if (strcmp((char *) event.data.scalar.value, "bandwidth") == 0) {
+        if (!yaml_parser_parse(parser, &event))
+          goto error;
+	flexran_agent_set_operating_bandwidth(mod_id,
+					    0,
+					    strtol((char *) event.data.scalar.value, &endptr, 10));
+        LOG_I(ENB_APP, "Setting bandwidth to %s\n", event.data.scalar.value);
+      } else if (strcmp((char *) event.data.scalar.value, "frame_type") == 0) {
+        if (!yaml_parser_parse(parser, &event))
+          goto error;
+	flexran_agent_set_operating_frame_type (mod_id,
+					    0,
+					    strtol((char *) event.data.scalar.value, &endptr, 10));
+        LOG_I(ENB_APP, "Setting frame_type to %s\n", event.data.scalar.value);
+      }else { // not supported tag  
+        LOG_E(FLEXRAN_AGENT, "Unsupported tag %s\n", event.data.scalar.value);
+	goto error;
+      }
+      
+      break;
+    default:
+      goto error;
+    }
+
+    done = (event.type == YAML_MAPPING_END_EVENT);
+    yaml_event_delete(&event);
+  }
+
+  return 0;
+  
+ error:
+  yaml_event_delete(&event);
+  return -1;
+}
+
 int skip_system_section(yaml_parser_t *parser) {
   yaml_event_t event;
   
diff --git a/openair2/ENB_APP/flexran_agent_common_internal.h b/openair2/ENB_APP/flexran_agent_common_internal.h
index c8f78aafe90a251c37911b398faaf457aa245c58..bf908ac13232b8743c72411481a8be649d884519 100644
--- a/openair2/ENB_APP/flexran_agent_common_internal.h
+++ b/openair2/ENB_APP/flexran_agent_common_internal.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,8 +21,8 @@
 
 /*! \file flexran_agent_common_internal.h
  * \brief internal agent functions for common message primitves and utilities
- * \author Xenofon Foukas
- * \date 2016
+ * \author Xenofon Foukas and N. Nikaein
+ * \date 2017
  * \version 0.1
  */
 
@@ -37,6 +37,10 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
 
 int apply_parameter_modification(void *parameter, yaml_parser_t *parser);
 
+int parse_enb_id(mid_t mod_id, yaml_parser_t *parser);
+int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) ;
+
+
 // This can be used when parsing for a specific system that is not yet implmeneted
 // in order to skip its configuration, without affecting the rest
 int skip_system_section(yaml_parser_t *parser);
diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h
index d60510b0c782bbf39fc17a3b650bc4aa9edc2a03..6364bc628191ec7f9c22bdfa98150170b6dbe101 100644
--- a/openair2/ENB_APP/flexran_agent_defs.h
+++ b/openair2/ENB_APP/flexran_agent_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,8 +21,8 @@
 
 /*! \file flexran_agent_defs.h
  * \brief FlexRAN agent common definitions 
- * \author Navid Nikaein and Xenofon Foukas
- * \date 2016
+ * \author Navid Nikaein and Xenofon Foukas and shahab SHARIAT BAGHERI
+ * \date 2017
  * \version 0.1
  */
 #ifndef FLEXRAN_AGENT_DEFS_H_
@@ -32,11 +32,16 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include <string.h>
+#include <stdbool.h>
+#include <time.h>
 
 #include "link_manager.h"
 
 #define NUM_MAX_ENB 2
+#define NUM_MAX_DRB 8
+#define NUM_MAX_SRB 3
 #define NUM_MAX_UE 2048
+#define DEFAULT_DRB 3
 #define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1"
 #define DEFAULT_FLEXRAN_AGENT_PORT          2210
 #define DEFAULT_FLEXRAN_AGENT_CACHE        "/mnt/oai_agent_cache"
@@ -102,10 +107,66 @@ typedef uint8_t lcid_t;
 typedef int32_t  err_code_t; 
 
 
+/*---------Timer Enums --------- */
+
+typedef enum {
+  /* oneshot timer:  */
+  FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0,
+
+  /* periodic timer  */
+  FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 1,
+
+  /* Inactive state: initial state for any timer. */
+  FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 2,
+  
+  /* Max number of states available */
+  FLEXRAN_AGENT_TIMER_TYPE_MAX,
+} flexran_agent_timer_type_t;
+
+
+typedef enum {
+  /* Inactive state: initial state for any timer. */
+  FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0,
+
+  /* Inactive state: initial state for any timer. */
+  FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1,
+
+  /* Inactive state: initial state for any timer. */
+  FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2,
+  
+  /* Max number of states available */
+  FLEXRAN_AGENT_TIMER_STATE_MAX,
+} flexran_agent_timer_state_t;
+
+#define FLEXRAN_CAP_LOL1 0x1
+#define FLEXRAN_CAP_HIL1 0x2
+#define FLEXRAN_CAP_LOL2 0x4   // is: MAC
+#define FLEXRAN_CAP_HIL2 0x8   // is: RLC
+#define FLEXRAN_CAP_PDCP 0x16
+#define FLEXRAN_CAP_RRC  0x32
+
+typedef enum {
+  ENB_NORMAL_OPERATION = 0x0,
+  ENB_WAIT             = 0x1,
+  ENB_MAKE_WAIT        = 0x2,
+} flexran_enb_state_t;
 
 typedef struct {
   /* general info */ 
- 
+  int      enabled;
+  char    *interface_name;
+  char    *remote_ipv4_addr;
+  uint16_t remote_port;
+  char    *cache_name;
+
+  int      enb_id;
+  uint8_t  capability_mask;
+
+  /* lock for waiting before starting or soft-restart */
+  pthread_cond_t      cond_node_ctrl;
+  pthread_mutex_t     mutex_node_ctrl;
+  flexran_enb_state_t node_ctrl_state;
+
   /* stats */
 
   uint32_t total_rx_msg;
@@ -116,10 +177,51 @@ typedef struct {
 
 } flexran_agent_info_t;
 
+
+/*
+rrc triggering
+ */
+
+
 typedef struct {
-  mid_t enb_id;
-  flexran_agent_info_t agent_info;
-  
-} flexran_agent_instance_t;
+   char   * trigger_policy;
+   uint32_t report_interval;
+   uint32_t report_amount;
+
+} agent_reconf_rrc;
+
+
+/* These structs will be used to give
+   instructions for the type of stats reports
+   we need to create */
+
+
+typedef struct {
+  uint16_t ue_rnti;
+  uint32_t ue_report_flags; /* Indicates the report elements
+             required for this UE id. See
+             FlexRAN specification 1.2.4.2 */
+} ue_report_type_t;
+
+typedef struct {
+  uint16_t cc_id;
+  uint32_t cc_report_flags; /* Indicates the report elements
+            required for this CC index. See
+            FlexRAN specification 1.2.4.3 */
+} cc_report_type_t;
+
+typedef struct {
+  int nr_ue;
+  ue_report_type_t *ue_report_type;
+  int nr_cc;
+  cc_report_type_t *cc_report_type;
+} report_config_t;
+
+typedef struct stats_request_config_s{
+  uint8_t report_type;
+  uint8_t report_frequency;
+  uint16_t period; /*In number of subframes*/
+  report_config_t *config;
+} stats_request_config_t;
 
 #endif 
diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h
index 4a04d5d3a670b290ab8009e6a61adb79a168b27a..ae77e9227aa960afa13823ff9fe67996253d356a 100644
--- a/openair2/ENB_APP/flexran_agent_extern.h
+++ b/openair2/ENB_APP/flexran_agent_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -20,9 +20,9 @@
  */ 
 
 /*! \file ENB_APP/extern.h
- * \brief FlexRAN agent - mac interface primitives
- * \author Xenofon Foukas
- * \date 2016
+ * \brief FlexRAN agent - Extern VSF xfaces
+ * \author Xenofon Foukas and shahab SHARIAT BAGHERI
+ * \date 2017
  * \version 0.1
  * \mail x.foukas@sms.ed.ac.uk
  */
@@ -32,12 +32,8 @@
 
 #include "flexran_agent_defs.h"
 #include "flexran_agent_mac_defs.h"
-
-
-//extern msg_context_t shared_ctxt[NUM_MAX_ENB][FLEXRAN_AGENT_MAX];
-
-/* full path of the local cache for storing VSFs */
-extern char local_cache[40];
+#include "flexran_agent_rrc_defs.h"
+#include "flexran_agent_pdcp_defs.h"
 
 /* Control module interface for the communication of the MAC Control Module with the agent */
 extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
@@ -45,8 +41,20 @@ extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
 /* Flag indicating whether the VSFs for the MAC control module have been registered */
 extern unsigned int mac_agent_registered[NUM_MAX_ENB];
 
+/* Control module interface for the communication of the RRC Control Module with the agent */
+extern AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
+
+/* Flag indicating whether the VSFs for the RRC control module have been registered */
+extern unsigned int rrc_agent_registered[NUM_MAX_ENB];
+
+/* Control module interface for the communication of the RRC Control Module with the agent */
+extern AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB];
+
+/* Flag indicating whether the VSFs for the RRC control module have been registered */
+extern unsigned int pdcp_agent_registered[NUM_MAX_ENB];
+
 /* Requried to know which UEs had a harq updated over some subframe */
-extern int harq_pid_updated[NUMBER_OF_UE_MAX][8];
-extern int harq_pid_round[NUMBER_OF_UE_MAX][8];
+extern int harq_pid_updated[NUM_MAX_UE][8];
+extern int harq_pid_round[NUM_MAX_UE][8];
 
 #endif
diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c
index 29a1c1000c369c33fc2de403e277310133fdc976..6c20c635a19365df6e6541306c88b2ab0fbe57c2 100644
--- a/openair2/ENB_APP/flexran_agent_handler.c
+++ b/openair2/ENB_APP/flexran_agent_handler.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,14 +21,18 @@
 
 /*! \file flexran_agent_handler.c
  * \brief FlexRAN agent tx and rx message handler 
- * \author Xenofon Foukas and Navid Nikaein
- * \date 2016
+ * \author Xenofon Foukas and Navid Nikaein and shahab SHARIAT BAGHERI
+ * \date 2017
  * \version 0.1
  */
 
-
+#include "flexran_agent_defs.h"
 #include "flexran_agent_common.h"
 #include "flexran_agent_mac.h"
+#include "flexran_agent_rrc.h"
+#include "flexran_agent_pdcp.h"
+#include "flexran_agent_timer.h"
+#include "flexran_agent_ran_api.h"
 #include "log.h"
 
 #include "assertions.h"
@@ -37,7 +41,7 @@ flexran_agent_message_decoded_callback agent_messages_callback[][3] = {
   {flexran_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/
   {flexran_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/
   {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply
-  {flexran_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
+  {flexran_agent_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
   {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/
   {0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/
   {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/
@@ -51,13 +55,14 @@ flexran_agent_message_decoded_callback agent_messages_callback[][3] = {
   {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/
   {flexran_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/
   {flexran_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/
+  {flexran_agent_rrc_measurement, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_RRC_TRIGGERING_MSG*/
 };
 
 flexran_agent_message_destruction_callback message_destruction_callback[] = {
   flexran_agent_destroy_hello,
   flexran_agent_destroy_echo_request,
   flexran_agent_destroy_echo_reply,
-  flexran_agent_mac_destroy_stats_request,
+  flexran_agent_destroy_stats_request,
   flexran_agent_mac_destroy_stats_reply,
   flexran_agent_mac_destroy_sf_trigger,
   flexran_agent_mac_destroy_sr_info,
@@ -93,7 +98,6 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
     err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING;
     goto error; 
   }
-  
   if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3 * sizeof(flexran_agent_message_decoded_callback))) || 
       (decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){
     err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED;
@@ -139,7 +143,7 @@ void * flexran_agent_pack_message(Protocol__FlexranMessage *msg,
   
   DevAssert(buffer !=NULL);
   
-  LOG_D(FLEXRAN_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size);
+  LOG_D(FLEXRAN_AGENT,"Serilized the eNB-UE stats reply (size %d)\n", *size);
   
   return buffer;
   
@@ -187,3 +191,587 @@ Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* tim
 err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) {
   return ((*message_destruction_callback[msg->msg_case-1])(msg));
 }
+
+
+/* 
+  Top Level Statistics Report
+
+ */
+
+
+
+int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){
+
+  // TODO: Must deal with sanitization of input
+  // TODO: Must check if RNTIs and cell ids of the request actually exist
+  // TODO: Must resolve conflicts among stats requests
+
+  int i;
+  err_code_t err_code;
+  xid_t xid;
+  uint32_t usec_interval, sec_interval;
+
+  //TODO: We do not deal with multiple CCs at the moment and eNB id is 0
+  int enb_id = mod_id;
+
+  //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id];
+  //UE_list_t *eNB_UE_list=  &eNB->UE_list;
+
+  report_config_t report_config;
+
+  uint32_t ue_flags = 0;
+  uint32_t c_flags = 0;
+
+  Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
+
+  Protocol__FlexStatsRequest *stats_req = input->stats_request_msg;
+  xid = (stats_req->header)->xid;
+
+  // Check the type of request that is made
+  switch(stats_req->body_case) {
+  case PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ;
+    Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request;
+    if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) {
+      /*Disable both periodic and continuous updates*/
+      // flexran_agent_disable_cont_stats_update(mod_id);
+      flexran_agent_destroy_timer_by_task_id(xid);
+      *msg = NULL;
+      return 0;
+    } else { //One-off, periodical or continuous reporting
+      //Set the proper flags
+      ue_flags = comp_req->ue_report_flags;
+      c_flags = comp_req->cell_report_flags;
+      //Create a list of all eNB RNTIs and cells
+
+      //Set the number of UEs and create list with their RNTIs stats configs
+      report_config.nr_ue = flexran_get_num_ues(mod_id); //eNB_UE_list->num_UEs
+      report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
+      if (report_config.ue_report_type == NULL) {
+  // TODO: Add appropriate error code
+  err_code = -100;
+  goto error;
+      }
+      for (i = 0; i < report_config.nr_ue; i++) {
+  report_config.ue_report_type[i].ue_rnti = flexran_get_ue_crnti(enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti;
+  report_config.ue_report_type[i].ue_report_flags = ue_flags;
+      }
+      //Set the number of CCs and create a list with the cell stats configs
+      report_config.nr_cc = MAX_NUM_CCs;
+      report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
+      if (report_config.cc_report_type == NULL) {
+  // TODO: Add appropriate error code
+  err_code = -100;
+  goto error;
+      }
+      for (i = 0; i < report_config.nr_cc; i++) {
+  //TODO: Must fill in the proper cell ids
+  report_config.cc_report_type[i].cc_id = i;
+  report_config.cc_report_type[i].cc_report_flags = c_flags;
+      }
+      /* Check if request was periodical */
+      if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL) {
+  /* Create a one off flexran message as an argument for the periodical task */
+  Protocol__FlexranMessage *timer_msg;
+  stats_request_config_t request_config;
+  request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS;
+  request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE;
+  request_config.period = 0;
+  /* Need to make sure that the ue flags are saved (Bug) */
+  if (report_config.nr_ue == 0) {
+    report_config.nr_ue = 1;
+    report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
+     if (report_config.ue_report_type == NULL) {
+       // TODO: Add appropriate error code
+       err_code = -100;
+       goto error;
+     }
+     report_config.ue_report_type[0].ue_rnti = 0; // Dummy value
+     report_config.ue_report_type[0].ue_report_flags = ue_flags;
+  }
+  request_config.config = &report_config;
+  flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg);
+  /* Create a timer */
+  long timer_id = 0;
+  flexran_agent_timer_args_t *timer_args;
+  timer_args = malloc(sizeof(flexran_agent_timer_args_t));
+  memset (timer_args, 0, sizeof(flexran_agent_timer_args_t));
+  timer_args->mod_id = enb_id;
+  timer_args->msg = timer_msg;
+  /*Convert subframes to usec time*/
+  usec_interval = 1000*comp_req->sf;
+  sec_interval = 0;
+  /*add seconds if required*/
+  if (usec_interval >= 1000*1000) {
+    sec_interval = usec_interval/(1000*1000);
+    usec_interval = usec_interval%(1000*1000);
+  }
+  flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, flexran_agent_handle_timed_task,(void*) timer_args, &timer_id);
+      } else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) {
+  /*If request was for continuous updates, disable the previous configuration and
+    set up a new one*/
+  flexran_agent_disable_cont_stats_update(mod_id);
+  stats_request_config_t request_config;
+  request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS;
+  request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE;
+  request_config.period = 0;
+  /* Need to make sure that the ue flags are saved (Bug) */
+  if (report_config.nr_ue == 0) {
+    report_config.nr_ue = 1;
+    report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
+    if (report_config.ue_report_type == NULL) {
+      // TODO: Add appropriate error code
+      err_code = -100;
+      goto error;
+    }
+    report_config.ue_report_type[0].ue_rnti = 0; // Dummy value
+    report_config.ue_report_type[0].ue_report_flags = ue_flags;
+  }
+  request_config.config = &report_config;
+  flexran_agent_enable_cont_stats_update(enb_id, xid, &request_config);
+      }
+    }
+    break;
+  case PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST:;
+    Protocol__FlexCellStatsRequest *cell_req = stats_req->cell_stats_request;
+    // UE report config will be blank
+    report_config.nr_ue = 0;
+    report_config.ue_report_type = NULL;
+    report_config.nr_cc = cell_req->n_cell;
+    report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
+    if (report_config.cc_report_type == NULL) {
+      // TODO: Add appropriate error code
+      err_code = -100;
+      goto error;
+    }
+    for (i = 0; i < report_config.nr_cc; i++) {
+  //TODO: Must fill in the proper cell ids
+      report_config.cc_report_type[i].cc_id = cell_req->cell[i];
+      report_config.cc_report_type[i].cc_report_flags = cell_req->flags;
+    }
+    break;
+  case PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST:;
+    Protocol__FlexUeStatsRequest *ue_req = stats_req->ue_stats_request;
+    // Cell report config will be blank
+    report_config.nr_cc = 0;
+    report_config.cc_report_type = NULL;
+    report_config.nr_ue = ue_req->n_rnti;
+    report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
+    if (report_config.ue_report_type == NULL) {
+      // TODO: Add appropriate error code
+      err_code = -100;
+      goto error;
+    }
+    for (i = 0; i < report_config.nr_ue; i++) {
+      report_config.ue_report_type[i].ue_rnti = ue_req->rnti[i];
+      report_config.ue_report_type[i].ue_report_flags = ue_req->flags;
+    }
+    break;
+  default:
+    //TODO: Add appropriate error code
+    err_code = -100;
+    goto error;
+  }
+
+   if (flexran_agent_stats_reply(enb_id, xid, &report_config, msg )){  
+      err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
+      goto error;
+    }
+
+  free(report_config.ue_report_type);
+  free(report_config.cc_report_type);
+
+  return 0;
+
+ error :
+  LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code);
+  return err_code;
+}
+
+/*
+  Top level reply 
+ */
+
+int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg){
+
+  Protocol__FlexHeader *header = NULL;
+  err_code_t err_code;
+  int i;
+
+  if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0)
+    goto error;
+
+  
+  Protocol__FlexStatsReply *stats_reply_msg;
+
+  stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply));
+
+  if (stats_reply_msg == NULL)
+    goto error;
+
+  protocol__flex_stats_reply__init(stats_reply_msg);
+  stats_reply_msg->header = header;
+
+  stats_reply_msg->n_ue_report = report_config->nr_ue;
+  stats_reply_msg->n_cell_report = report_config->nr_cc;
+
+  // UE report
+
+  Protocol__FlexUeStatsReport **ue_report;
+  
+
+  ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue);
+          if (ue_report == NULL)
+            goto error;
+  
+  for (i = 0; i < report_config->nr_ue; i++) {
+
+      ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport));
+      protocol__flex_ue_stats_report__init(ue_report[i]);
+      ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti;
+      ue_report[i]->has_rnti = 1;
+      ue_report[i]->flags = report_config->ue_report_type[i].ue_report_flags;
+      ue_report[i]->has_flags = 1;
+  
+  }
+
+  // cell rpoert 
+
+  Protocol__FlexCellStatsReport **cell_report;
+
+  
+  cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc);
+  if (cell_report == NULL)
+    goto error;
+  
+  for (i = 0; i < report_config->nr_cc; i++) {
+
+      cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport));
+      if(cell_report[i] == NULL)
+          goto error;
+
+      protocol__flex_cell_stats_report__init(cell_report[i]);
+      cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id;
+      cell_report[i]->has_carrier_index = 1;
+      cell_report[i]->flags = report_config->cc_report_type[i].cc_report_flags;
+      cell_report[i]->has_flags = 1;
+
+  }
+
+      /*
+      MAC reply split
+     */
+
+
+    if (flexran_agent_mac_stats_reply(enb_id, report_config,  ue_report, cell_report) < 0 ) {
+        err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
+        goto error;
+    }
+
+    /*
+      RRC reply split
+     */
+
+    if (flexran_agent_rrc_stats_reply(enb_id, report_config,  ue_report, cell_report) < 0 ) {
+        err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
+        goto error;
+    }
+   
+
+    /*
+      PDCP reply split
+    */
+    
+    if (flexran_agent_pdcp_stats_reply(enb_id, report_config,  ue_report, cell_report) < 0 ) {
+      err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
+      goto error;
+    }
+
+       
+  stats_reply_msg->cell_report = cell_report;
+  stats_reply_msg->ue_report = ue_report;
+
+ *msg = malloc(sizeof(Protocol__FlexranMessage));
+  if(*msg == NULL)
+    goto error;
+  protocol__flexran_message__init(*msg);
+  (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG;
+  (*msg)->msg_dir =  PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME;
+  (*msg)->stats_reply_msg = stats_reply_msg;
+
+  return 0;
+
+error :
+  LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code);
+  return err_code;
+
+}
+
+/*
+  Top Level Request 
+ */
+
+int flexran_agent_stats_request(mid_t mod_id,
+            xid_t xid,
+            const stats_request_config_t *report_config,
+            Protocol__FlexranMessage **msg) {
+  Protocol__FlexHeader *header = NULL;
+  int i;
+
+  Protocol__FlexStatsRequest *stats_request_msg;
+  stats_request_msg = malloc(sizeof(Protocol__FlexStatsRequest));
+  if(stats_request_msg == NULL)
+    goto error;
+  protocol__flex_stats_request__init(stats_request_msg);
+
+  if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0)
+    goto error;
+
+  stats_request_msg->header = header;
+
+  stats_request_msg->type = report_config->report_type;
+  stats_request_msg->has_type = 1;
+
+  switch (report_config->report_type) {
+  case PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS:
+    stats_request_msg->body_case =  PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST;
+    Protocol__FlexCompleteStatsRequest *complete_stats;
+    complete_stats = malloc(sizeof(Protocol__FlexCompleteStatsRequest));
+    if(complete_stats == NULL)
+      goto error;
+    protocol__flex_complete_stats_request__init(complete_stats);
+    complete_stats->report_frequency = report_config->report_frequency;
+    complete_stats->has_report_frequency = 1;
+    complete_stats->sf = report_config->period;
+    complete_stats->has_sf = 1;
+    complete_stats->has_cell_report_flags = 1;
+    complete_stats->has_ue_report_flags = 1;
+    if (report_config->config->nr_cc > 0) {
+      complete_stats->cell_report_flags = report_config->config->cc_report_type[0].cc_report_flags;
+    }
+    if (report_config->config->nr_ue > 0) {
+      complete_stats->ue_report_flags = report_config->config->ue_report_type[0].ue_report_flags;
+    }
+    stats_request_msg->complete_stats_request = complete_stats;
+    break;
+  case  PROTOCOL__FLEX_STATS_TYPE__FLST_CELL_STATS:
+    stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST;
+     Protocol__FlexCellStatsRequest *cell_stats;
+     cell_stats = malloc(sizeof(Protocol__FlexCellStatsRequest));
+    if(cell_stats == NULL)
+      goto error;
+    protocol__flex_cell_stats_request__init(cell_stats);
+    cell_stats->n_cell = report_config->config->nr_cc;
+    cell_stats->has_flags = 1;
+    if (cell_stats->n_cell > 0) {
+      uint32_t *cells;
+      cells = (uint32_t *) malloc(sizeof(uint32_t)*cell_stats->n_cell);
+      for (i = 0; i < cell_stats->n_cell; i++) {
+  cells[i] = report_config->config->cc_report_type[i].cc_id;
+      }
+      cell_stats->cell = cells;
+      cell_stats->flags = report_config->config->cc_report_type[i].cc_report_flags;
+    }
+    stats_request_msg->cell_stats_request = cell_stats;
+    break;
+  case PROTOCOL__FLEX_STATS_TYPE__FLST_UE_STATS:
+    stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST;
+     Protocol__FlexUeStatsRequest *ue_stats;
+     ue_stats = malloc(sizeof(Protocol__FlexUeStatsRequest));
+    if(ue_stats == NULL)
+      goto error;
+    protocol__flex_ue_stats_request__init(ue_stats);
+    ue_stats->n_rnti = report_config->config->nr_ue;
+    ue_stats->has_flags = 1;
+    if (ue_stats->n_rnti > 0) {
+      uint32_t *ues;
+      ues = (uint32_t *) malloc(sizeof(uint32_t)*ue_stats->n_rnti);
+      for (i = 0; i < ue_stats->n_rnti; i++) {
+  ues[i] = report_config->config->ue_report_type[i].ue_rnti;
+      }
+      ue_stats->rnti = ues;
+      ue_stats->flags = report_config->config->ue_report_type[i].ue_report_flags;
+    }
+    stats_request_msg->ue_stats_request = ue_stats;
+    break;
+  default:
+    goto error;
+  }
+  *msg = malloc(sizeof(Protocol__FlexranMessage));
+  if(*msg == NULL)
+    goto error;
+  protocol__flexran_message__init(*msg);
+  (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG;
+  (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
+  (*msg)->stats_request_msg = stats_request_msg;
+  return 0;
+
+ error:
+  // TODO: Need to make proper error handling
+  if (header != NULL)
+    free(header);
+  if (stats_request_msg != NULL)
+    free(stats_request_msg);
+  if(*msg != NULL)
+    free(*msg);
+  //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+  return -1;
+}
+
+int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg) {
+   if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG)
+    goto error;
+  free(msg->stats_request_msg->header);
+  if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST) {
+    free(msg->stats_request_msg->cell_stats_request->cell);
+  }
+  if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST) {
+    free(msg->stats_request_msg->ue_stats_request->rnti);
+  }
+  free(msg->stats_request_msg);
+  free(msg);
+  return 0;
+
+ error:
+  //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
+  return -1;
+}
+
+/*
+  Top Level Update 
+ */
+
+void flexran_agent_send_update_stats(mid_t mod_id) {
+
+  Protocol__FlexranMessage *current_report = NULL;
+  void *data;
+  int size;
+  err_code_t err_code;
+  int priority = 0;
+  
+  if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
+    goto error;
+  }
+
+  if (stats_context[mod_id].cont_update == 1) {
+  
+    /*Create a fresh report with the required flags*/
+    err_code = flexran_agent_handle_stats(mod_id, (void *) stats_context[mod_id].stats_req, &current_report);
+    if (err_code < 0) {
+      goto error;
+    }
+  }
+  /* /\*TODO:Check if a previous reports exists and if yes, generate a report */
+  /*  *that is the diff between the old and the new report, */
+  /*  *respecting the thresholds. Otherwise send the new report*\/ */
+  /* if (stats_context[mod_id].prev_stats_reply != NULL) { */
+
+  /*   msg = flexran_agent_generate_diff_mac_stats_report(current_report, stats_context[mod_id].prev_stats_reply); */
+
+  /*   /\*Destroy the old stats*\/ */
+  /*    flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply); */
+  /* } */
+  /* /\*Use the current report for future comparissons*\/ */
+  /* stats_context[mod_id].prev_stats_reply = current_report; */
+
+
+  if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
+    goto error;
+  }
+
+  if (current_report != NULL){
+    data=flexran_agent_pack_message(current_report, &size);
+    /*Send any stats updates using the MAC channel of the eNB*/
+    if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) {
+      err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
+      goto error;
+    }
+
+    LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
+    return;
+  }
+ error:
+  LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n");
+}
+
+err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id) {
+  /*Disable the continuous updates for the MAC*/
+  if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
+    goto error;
+  }
+  stats_context[mod_id].cont_update = 0;
+  stats_context[mod_id].xid = 0;
+  if (stats_context[mod_id].stats_req != NULL) {
+    flexran_agent_destroy_flexran_message(stats_context[mod_id].stats_req);
+  }
+  if (stats_context[mod_id].prev_stats_reply != NULL) {
+    flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply);
+  }
+  if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
+    goto error;
+  }
+  return 0;
+
+ error:
+  LOG_E(FLEXRAN_AGENT, "stats_context for eNB %d is not initialized\n", mod_id);
+  return -1;
+
+}
+
+err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id,
+                  xid_t xid, stats_request_config_t *stats_req) {
+  
+  if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
+    goto error;
+  }
+
+  Protocol__FlexranMessage *req_msg;
+
+  flexran_agent_stats_request(mod_id, xid, stats_req, &req_msg);
+  stats_context[mod_id].stats_req = req_msg;
+  stats_context[mod_id].prev_stats_reply = NULL;
+
+  stats_context[mod_id].cont_update = 1;
+  stats_context[mod_id].xid = xid;
+
+  if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
+    goto error;
+  }
+  return 0;
+
+ error:
+  LOG_E(FLEXRAN_AGENT, "stats_context for eNB %d is not initialized\n", mod_id);
+  return -1;
+}
+
+
+err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id) {
+
+  
+  /*Initially the continuous update is set to false*/
+  stats_context[mod_id].cont_update = 0;
+  stats_context[mod_id].is_initialized = 1;
+  stats_context[mod_id].stats_req = NULL;
+  stats_context[mod_id].prev_stats_reply = NULL;
+  stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t));
+  if (stats_context[mod_id].mutex == NULL)
+    goto error;
+  if (pthread_mutex_init(stats_context[mod_id].mutex, NULL))
+    goto error;
+
+  return 0;
+
+ error:
+  return -1;
+}
+
+err_code_t flexran_agent_destroy_cont_stats_update(mid_t mod_id) {
+  
+  stats_context[mod_id].cont_update = 0;
+  stats_context[mod_id].is_initialized = 0;
+  flexran_agent_destroy_flexran_message(stats_context[mod_id].stats_req);
+  flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply);
+  free(stats_context[mod_id].mutex);
+
+  // mac_agent_registered[mod_id] = 0;
+  return 1;
+}
diff --git a/openair2/ENB_APP/flexran_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c
index 6e39d6089f2fbb261c0bd5e71693a8aaf2db9a6f..6971c2975048fae72be383fa2a9ab38d00fe7579 100644
--- a/openair2/ENB_APP/flexran_agent_net_comm.c
+++ b/openair2/ENB_APP/flexran_agent_net_comm.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -118,7 +118,7 @@ int flexran_agent_create_channel(void *channel_info,
   /*element should be a real pointer*/
   RB_INSERT(flexran_agent_channel_map, &channel_instance.flexran_agent_head, channel); 
   
-  LOG_I(FLEXRAN_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id);
+  LOG_I(FLEXRAN_AGENT,"Created a new channel with id %d \n", channel->channel_id);
  
   return channel_id; 
 }
@@ -141,9 +141,9 @@ int flexran_agent_destroy_channel(int channel_id) {
   for (i = 0; i < NUM_MAX_ENB; i++) {
     for (j = 0; j < FLEXRAN_AGENT_MAX; j++) {
       if (agent_channel[i][j] != NULL) {
-	if (agent_channel[i][j]->channel_id == e->channel_id) {
-	  agent_channel[i][j] == NULL;
-	}
+        if (agent_channel[i][j]->channel_id == e->channel_id) {
+            free(agent_channel[i][j]);
+        }
       }
     }
   }
@@ -164,7 +164,9 @@ err_code_t flexran_agent_init_channel_container(void) {
   
   for (i = 0; i < NUM_MAX_ENB; i++) {
     for (j = 0; j < FLEXRAN_AGENT_MAX; j++) {
-    agent_channel[i][j] == NULL;
+      agent_channel[i][j] = malloc(sizeof(flexran_agent_channel_t));
+      if (!agent_channel[i][j])
+        return -1;
     }
   }
 
diff --git a/openair2/ENB_APP/flexran_agent_net_comm.h b/openair2/ENB_APP/flexran_agent_net_comm.h
index e4aa854c70c9f0cbb454662eaaac89de752a49c6..2f59b0f7a379f90659e127ac2244cbba935b4919 100644
--- a/openair2/ENB_APP/flexran_agent_net_comm.h
+++ b/openair2/ENB_APP/flexran_agent_net_comm.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c
new file mode 100644
index 0000000000000000000000000000000000000000..3200f55f16fa1100e75140b87c98b6f257786701
--- /dev/null
+++ b/openair2/ENB_APP/flexran_agent_ran_api.c
@@ -0,0 +1,1383 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+/*! \file flexran_agent_ran_api.c
+ * \brief FlexRAN RAN API abstraction 
+ * \author N. Nikaein, X. Foukas, S. SHARIAT BAGHERI and R. Schmidt
+ * \date 2017
+ * \version 0.1
+ */
+
+#include "flexran_agent_ran_api.h"
+
+static inline int phy_is_present(mid_t mod_id, uint8_t cc_id)
+{
+  return RC.eNB && RC.eNB[mod_id] && RC.eNB[mod_id][cc_id];
+}
+
+static inline int mac_is_present(mid_t mod_id)
+{
+  return RC.mac && RC.mac[mod_id];
+}
+
+static inline int rrc_is_present(mid_t mod_id)
+{
+  return RC.rrc && RC.rrc[mod_id];
+}
+
+uint32_t flexran_get_current_time_ms(mid_t mod_id, int subframe_flag)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  if (subframe_flag == 1)
+    return RC.mac[mod_id]->frame*10 + RC.mac[mod_id]->subframe;
+  else
+    return RC.mac[mod_id]->frame*10;
+}
+
+frame_t flexran_get_current_frame(mid_t mod_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  //  #warning "SFN will not be in [0-1023] when oaisim is used"
+  return RC.mac[mod_id]->frame;
+}
+
+frame_t flexran_get_current_system_frame_num(mid_t mod_id)
+{
+  return flexran_get_current_frame(mod_id) % 1024;
+}
+
+sub_frame_t flexran_get_current_subframe(mid_t mod_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->subframe;
+}
+
+/* Why uint16_t, frame_t and sub_frame_t are defined as uint32_t? */
+uint16_t flexran_get_sfn_sf(mid_t mod_id)
+{
+  frame_t frame = flexran_get_current_system_frame_num(mod_id);
+  sub_frame_t subframe = flexran_get_current_subframe(mod_id);
+  uint16_t sfn_sf, frame_mask, sf_mask;
+
+  frame_mask = (1 << 12) - 1;
+  sf_mask = (1 << 4) - 1;
+  sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4);
+
+  return sfn_sf;
+}
+
+uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time)
+{
+  frame_t frame = flexran_get_current_system_frame_num(mod_id);
+  sub_frame_t subframe = flexran_get_current_subframe(mod_id);
+  uint16_t sfn_sf, frame_mask, sf_mask;
+  int additional_frames;
+
+  subframe = (subframe + ahead_of_time) % 10;
+
+  if (subframe < flexran_get_current_subframe(mod_id))
+    frame = (frame + 1) % 1024;
+
+  additional_frames = ahead_of_time / 10;
+  frame = (frame + additional_frames) % 1024;
+
+  frame_mask = (1 << 12) - 1;
+  sf_mask = (1 << 4) - 1;
+  sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4);
+
+  return sfn_sf;
+}
+
+int flexran_get_num_ues(mid_t mod_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.num_UEs;
+}
+
+rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id)
+{
+  return UE_RNTI(mod_id, ue_id);
+}
+
+int flexran_get_ue_bsr_ul_buffer_info(mid_t mod_id, mid_t ue_id, lcid_t lcid)
+{
+  if (!mac_is_present(mod_id)) return -1;
+  return RC.mac[mod_id]->UE_list.UE_template[UE_PCCID(mod_id, ue_id)][ue_id].ul_buffer_info[lcid];
+}
+
+int8_t flexran_get_ue_phr(mid_t mod_id, mid_t ue_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.UE_template[UE_PCCID(mod_id, ue_id)][ue_id].phr_info;
+}
+
+uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.UE_sched_ctrl[ue_id].dl_cqi[0];
+}
+
+rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id)
+{
+  rnti_t rnti = flexran_get_ue_crnti(mod_id, ue_id);
+  frame_t frame = flexran_get_current_frame(mod_id);
+  sub_frame_t subframe = flexran_get_current_subframe(mod_id);
+  mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0);
+  return rlc_status.bytes_in_buffer;
+}
+
+rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id)
+{
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  frame_t frame = flexran_get_current_frame(mod_id);
+  sub_frame_t subframe = flexran_get_current_subframe(mod_id);
+  mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0);
+  return rlc_status.pdus_in_buffer;
+}
+
+frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id)
+{
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  frame_t frame = flexran_get_current_frame(mod_id);
+  sub_frame_t subframe = flexran_get_current_subframe(mod_id);
+  mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, subframe, ENB_FLAG_YES, MBMS_FLAG_NO, channel_id, 0);
+  return rlc_status.head_sdu_creation_time;
+}
+
+int32_t flexran_get_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+
+  int32_t tau = RC.eNB[mod_id][cc_id]->UE_stats[ue_id].timing_advance_update;
+  switch (flexran_get_N_RB_DL(mod_id, cc_id)) {
+  case 6:
+    return tau;
+  case 15:
+    return tau / 2;
+  case 25:
+    return tau / 4;
+  case 50:
+    return tau / 8;
+  case 75:
+    return tau / 12;
+  case 100:
+    if (flexran_get_threequarter_fs(mod_id, cc_id) == 0)
+      return tau / 16;
+    else
+      return tau / 12;
+  default:
+    return 0;
+  }
+}
+
+uint32_t flexran_get_total_size_dl_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_sdu_bytes;
+}
+
+uint32_t flexran_get_total_size_ul_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->eNB_stats[cc_id].total_ulsch_bytes_rx;
+}
+
+uint32_t flexran_get_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].TBS;
+}
+
+uint32_t flexran_get_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].ulsch_TBS;
+}
+
+uint16_t flexran_get_num_prb_retx_dl_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].rbs_used_retx;
+}
+
+uint32_t flexran_get_num_prb_retx_ul_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].rbs_used_retx_rx;
+}
+
+uint16_t flexran_get_num_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].rbs_used;
+}
+
+uint16_t flexran_get_num_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].rbs_used_rx;
+}
+
+uint8_t flexran_get_ue_wpmi(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.UE_sched_ctrl[ue_id].periodic_wideband_pmi[cc_id];
+}
+
+uint8_t flexran_get_mcs1_dl(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].dlsch_mcs1;
+}
+
+uint8_t flexran_get_mcs2_dl(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].dlsch_mcs2;
+}
+
+uint8_t flexran_get_mcs1_ul(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].ulsch_mcs1;
+}
+
+uint8_t flexran_get_mcs2_ul(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].ulsch_mcs2;
+}
+
+uint32_t flexran_get_total_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_rbs_used;
+}
+
+uint32_t flexran_get_total_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_rbs_used_rx;
+}
+
+uint32_t flexran_get_total_num_pdu_dl(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_num_pdus;
+}
+
+uint32_t flexran_get_total_num_pdu_ul(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_num_pdus_rx;
+}
+
+uint64_t flexran_get_total_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_pdu_bytes;
+}
+
+uint64_t flexran_get_total_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_ulsch_TBS;
+}
+
+int flexran_get_harq_round(mid_t mod_id, uint8_t cc_id, mid_t ue_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].harq_round;
+}
+
+uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].num_mac_sdu_tx;
+}
+
+unsigned char flexran_get_mac_sdu_lcid_index(mid_t mod_id, mid_t ue_id, int cc_id, int index)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].lcid_sdu[index];
+}
+
+uint32_t flexran_get_mac_sdu_size(mid_t mod_id, mid_t ue_id, int cc_id, int lcid)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].sdu_length_tx[lcid];
+}
+
+
+/* TODO needs to be revised */
+void flexran_update_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+/*
+  UE_list_t *UE_list=&eNB_mac_inst[mod_id].UE_list;
+  UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id];
+
+  if (ue_sched_ctl->ta_timer == 0) {
+    
+    // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ...                                                                         
+    //    LTE_eNB_UE_stats		*eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
+    //ue_sched_ctl->ta_timer		      = 20;	// wait 20 subframes before taking TA measurement from PHY                                         
+    ue_sched_ctl->ta_update = flexran_get_TA(mod_id, ue_id, CC_id);
+
+    // clear the update in case PHY does not have a new measurement after timer expiry                                               
+    //    eNB_UE_stats->timing_advance_update	      = 0;
+  } else {
+    ue_sched_ctl->ta_timer--;
+    ue_sched_ctl->ta_update		      = 0;	// don't trigger a timing advance command      
+  }
+*/
+#warning "Implement flexran_update_TA() in RAN API"
+}
+
+/* TODO needs to be revised, looks suspicious: why do we need UE stats? */
+int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+#warning "Implement flexran_get_MAC_CE_bitmap_TA() in RAN API"
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+
+  /* UE_stats can not be null, they are an array in RC
+  LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
+  
+  if (eNB_UE_stats == NULL) {
+    return 0;
+  }
+  */
+
+  if (flexran_get_TA(mod_id, ue_id, cc_id) != 0) {
+    return PROTOCOL__FLEX_CE_TYPE__FLPCET_TA;
+  } else {
+    return 0;
+  }
+}
+
+int flexran_get_active_CC(mid_t mod_id, mid_t ue_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.numactiveCCs[ue_id];
+}
+
+uint8_t flexran_get_current_RI(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->UE_stats[ue_id].rank;
+}
+
+int flexran_get_tpc(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+
+  /* before: tested that UL_rssi != NULL and set parameter ([0]), but it is a
+   * static array -> target_rx_power is useless in old ifs?! */
+  int pCCid = UE_PCCID(mod_id,ue_id);
+  int32_t target_rx_power = RC.eNB[mod_id][pCCid]->frame_parms.ul_power_control_config_common.p0_NominalPUSCH;
+  int32_t normalized_rx_power = RC.eNB[mod_id][cc_id]->UE_stats[ue_id].UL_rssi[0];
+
+  int tpc;
+  if (normalized_rx_power > target_rx_power + 1)
+    tpc = 0;	//-1
+  else if (normalized_rx_power < target_rx_power - 1)
+    tpc = 2;	//+1
+  else
+    tpc = 1;	//0
+  return tpc;
+}
+
+int flexran_get_harq(mid_t       mod_id,
+                     uint8_t     cc_id,
+                     mid_t       ue_id,
+                     frame_t     frame,
+                     sub_frame_t subframe,
+                     uint8_t    *pid,
+                     uint8_t    *round,
+                     uint8_t     harq_flag)
+{
+  /* TODO: Add int TB in function parameters to get the status of the second
+   * TB. This can be done to by editing in get_ue_active_harq_pid function in
+   * line 272 file: phy_procedures_lte_eNB.c to add DLSCH_ptr =
+   * PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/
+
+  /* TODO IMPLEMENT */
+  /*
+  uint8_t harq_pid;
+  uint8_t harq_round;
+  
+  if (mac_xface_not_ready()) return 0 ;
+
+  uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  if (harq_flag == openair_harq_DL){
+
+      mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&harq_round,openair_harq_DL);
+
+   } else if (harq_flag == openair_harq_UL){
+
+     mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,round,openair_harq_UL);    
+   }
+   else {
+
+      LOG_W(FLEXRAN_AGENT,"harq_flag is not recongnized");
+   }
+
+
+  *pid = harq_pid;
+  *round = harq_round;*/
+  /* if (round > 0) { */
+  /*   *status = 1; */
+  /* } else { */
+  /*   *status = 0; */
+  /* } */
+  /*return *round;*/
+#warning "Implement flexran_get_harq() in RAN API"
+  return 0;
+}
+
+int32_t flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->UE_stats[ue_id].Po_PUCCH_dBm;
+}
+
+int8_t flexran_get_p0_nominal_pucch(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.ul_power_control_config_common.p0_NominalPUCCH;
+}
+
+int32_t flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->UE_stats[ue_id].Po_PUCCH_update;
+}
+
+int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  RC.eNB[mod_id][cc_id]->UE_stats[ue_id].Po_PUCCH_update = 0;
+  return 0;
+}
+
+
+/*
+ * ************************************
+ * Get Messages for eNB Configuration Reply
+ * ************************************
+ */
+uint8_t flexran_get_threequarter_fs(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.threequarter_fs;
+}
+
+
+uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.pusch_HoppingOffset;
+}
+
+PUSCH_HOPPING_t flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.hoppingMode;
+}
+
+uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.n_SB;
+}
+
+uint8_t flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.enable64QAM;
+}
+
+PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_duration;
+}
+
+int flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  switch (RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_resource) {
+  case oneSixth:
+    return 0;
+  case half:
+    return 1;
+  case one:
+    return 2;
+  case two:
+    return 3;
+  default:
+    return -1;
+  }
+}
+
+uint16_t flexran_get_n1pucch_an(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.pucch_config_common.n1PUCCH_AN;
+}
+
+uint8_t flexran_get_nRB_CQI(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.pucch_config_common.nRB_CQI;
+}
+
+uint8_t flexran_get_deltaPUCCH_Shift(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.pucch_config_common.deltaPUCCH_Shift;
+}
+
+uint8_t flexran_get_prach_ConfigIndex(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
+}
+
+uint8_t flexran_get_prach_FreqOffset(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
+}
+
+uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.maxHARQ_Msg3Tx;
+}
+
+lte_prefix_type_t flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.Ncp_UL;
+}
+
+lte_prefix_type_t flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.Ncp;
+}
+
+uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.Nid_cell;
+}
+
+uint8_t flexran_get_srs_BandwidthConfig(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.soundingrs_ul_config_common.srs_BandwidthConfig;
+}
+
+uint8_t flexran_get_srs_SubframeConfig(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.soundingrs_ul_config_common.srs_SubframeConfig;
+}
+
+uint8_t flexran_get_srs_MaxUpPts(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.soundingrs_ul_config_common.srs_MaxUpPts;
+}
+
+uint8_t flexran_get_N_RB_DL(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.N_RB_DL;
+}
+
+uint8_t flexran_get_N_RB_UL(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.N_RB_UL;
+}
+
+uint8_t flexran_get_N_RBG(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.N_RBG;
+}
+
+uint8_t flexran_get_subframe_assignment(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.tdd_config;
+}
+
+uint8_t flexran_get_special_subframe_assignment(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.tdd_config_S;
+}
+
+long flexran_get_ra_ResponseWindowSize(mid_t mod_id, uint8_t cc_id)
+{
+  if (!rrc_is_present(mod_id)) return 0;
+  return RC.rrc[mod_id]->configuration.rach_raResponseWindowSize[cc_id];
+}
+
+long flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, uint8_t cc_id)
+{
+  if (!rrc_is_present(mod_id)) return 0;
+  return RC.rrc[mod_id]->configuration.rach_macContentionResolutionTimer[cc_id];
+}
+
+Protocol__FlexDuplexMode flexran_get_duplex_mode(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  switch (RC.eNB[mod_id][cc_id]->frame_parms.frame_type) {
+  case TDD:
+    return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD;
+  case FDD:
+    return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD;
+  default:
+    return -1;
+  }
+}
+
+long flexran_get_si_window_length(mid_t mod_id, uint8_t cc_id)
+{
+  if (!rrc_is_present(mod_id) || !RC.rrc[mod_id]->carrier[cc_id].sib1) return 0;
+  return RC.rrc[mod_id]->carrier[cc_id].sib1->si_WindowLength;
+}
+
+uint8_t flexran_get_sib1_length(mid_t mod_id, uint8_t cc_id)
+{
+  if (!rrc_is_present(mod_id)) return 0;
+  return RC.rrc[mod_id]->carrier[cc_id].sizeof_SIB1;
+}
+
+uint8_t flexran_get_num_pdcch_symb(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->pdcch_vars[0].num_pdcch_symbols;
+}
+
+
+
+/*
+ * ************************************
+ * Get Messages for UE Configuration Reply
+ * ************************************
+ */
+
+
+TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.mac_MainConfig) return -1;
+  return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated;
+}
+
+Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.measGapConfig) return -1;
+  if (ue_context_p->ue_context.measGapConfig->present != MeasGapConfig_PR_setup) return -1;
+  switch (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present) {
+  case MeasGapConfig__setup__gapOffset_PR_gp0:
+    return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1;
+  case MeasGapConfig__setup__gapOffset_PR_gp1:
+    return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP2;
+  default:
+    return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF;
+  }
+}
+
+
+long flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.measGapConfig) return -1;
+  if (ue_context_p->ue_context.measGapConfig->present != MeasGapConfig_PR_setup) return -1;
+  switch (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present) {
+  case MeasGapConfig__setup__gapOffset_PR_gp0:
+    return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0;
+  case MeasGapConfig__setup__gapOffset_PR_gp1:
+    return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp1;
+  default:
+    return -1;
+  }
+}
+
+uint8_t flexran_get_rrc_status(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return 0;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id, ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return RRC_INACTIVE;
+  return ue_context_p->ue_context.Status;
+}
+
+uint64_t flexran_get_ue_aggregated_max_bitrate_dl(mid_t mod_id, mid_t ue_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL;
+}
+
+uint64_t flexran_get_ue_aggregated_max_bitrate_ul(mid_t mod_id, mid_t ue_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL;
+}
+
+int flexran_get_half_duplex(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.UE_Capability) return -1;
+  SupportedBandListEUTRA_t *bands = &ue_context_p->ue_context.UE_Capability->rf_Parameters.supportedBandListEUTRA;
+  for (int i = 0; i < bands->list.count; i++) {
+    if (bands->list.array[i]->halfDuplex > 0) return 1;
+  }
+  return 0;
+}
+
+int flexran_get_intra_sf_hopping(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.UE_Capability) return -1;
+  if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1;
+  /* According to TS 36.331 Annex B.1, Intra SF Hopping is bit 1 (leftmost bit)
+   * in this bitmap, i.e. the eighth bit (from right) in the first bye (from
+   * left) */
+  BIT_STRING_t *fgi = ue_context_p->ue_context.UE_Capability->featureGroupIndicators;
+  uint8_t buf = fgi->buf[0];
+  return (buf >> 7) & 1;
+}
+
+int flexran_get_type2_sb_1(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.UE_Capability) return -1;
+  if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1;
+  /* According to TS 36.331 Annex B.1, Predefined intra- and inter-sf or
+   * predfined inter-sf frequency hopping for PUSCH with N_sb>1 is bit 21 (bit
+   * 1 is leftmost bit) in this bitmap, i.e. the fourth bit (from right) in the
+   * third byte (from left) */
+  BIT_STRING_t *fgi = ue_context_p->ue_context.UE_Capability->featureGroupIndicators;
+  uint8_t buf = fgi->buf[2];
+  return (buf >> 3) & 1;
+}
+
+long flexran_get_ue_category(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.UE_Capability) return -1;
+  return ue_context_p->ue_context.UE_Capability->ue_Category;
+}
+
+int flexran_get_res_alloc_type1(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.UE_Capability) return -1;
+  if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1;
+  /* According to TS 36.331 Annex B.1, Resource allocation type 1 for PDSCH is
+   * bit 2 (bit 1 is leftmost bit) in this bitmap, i.e. the seventh bit (from
+   * right) in the first byte (from left) */
+  BIT_STRING_t *fgi = ue_context_p->ue_context.UE_Capability->featureGroupIndicators;
+  uint8_t buf = fgi->buf[0];
+  return (buf >> 6) & 1;
+}
+
+long flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->antennaInfo) return -1;
+  return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode;
+}
+
+BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.mac_MainConfig) return -1;
+  if (!ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config) return -1;
+  return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling;
+}
+
+long flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.mac_MainConfig) return -1;
+  if (!ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config) return -1;
+  return *(ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx);
+}
+
+long flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1;
+  return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index;
+}
+
+long flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1;
+  return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
+}
+
+long flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1;
+  return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
+}
+
+BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) return -1;
+  return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI;
+}
+
+BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+  if (!RC.rrc[mod_id]->carrier[cc_id].sib2) return -1;
+  return RC.rrc[mod_id]->carrier[cc_id].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
+}
+
+CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig) return -1;
+  return *ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic;
+}
+
+long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode) return -1;
+  return *(ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode);
+}
+
+long flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated) return -1;
+  return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor;
+}
+
+long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.mac_MainConfig) return -1;
+  if (!ue_context_p->ue_context.mac_MainConfig->ext2) return -1;
+  if (!ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020) return -1;
+  return *(ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10);
+}
+
+int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated) return -1;
+  if (!ue_context_p->ue_context.physicalConfigDedicated->antennaInfo) return -1;
+  switch (ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup) {
+  case AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop:
+    return 2;
+  case AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop:
+    return 1;
+  default:
+    return 0;
+  }
+}
+
+uint64_t flexran_get_ue_imsi(mid_t mod_id, mid_t ue_id)
+{
+  uint64_t imsi;
+  if (!rrc_is_present(mod_id)) return 0;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return 0;
+
+  imsi  = ue_context_p->ue_context.imsi.digit15;
+  imsi += ue_context_p->ue_context.imsi.digit14 * 10;              // pow(10, 1)
+  imsi += ue_context_p->ue_context.imsi.digit13 * 100;             // pow(10, 2)
+  imsi += ue_context_p->ue_context.imsi.digit12 * 1000;            // pow(10, 3)
+  imsi += ue_context_p->ue_context.imsi.digit11 * 10000;           // pow(10, 4)
+  imsi += ue_context_p->ue_context.imsi.digit10 * 100000;          // pow(10, 5)
+  imsi += ue_context_p->ue_context.imsi.digit9  * 1000000;         // pow(10, 6)
+  imsi += ue_context_p->ue_context.imsi.digit8  * 10000000;        // pow(10, 7)
+  imsi += ue_context_p->ue_context.imsi.digit7  * 100000000;       // pow(10, 8)
+  imsi += ue_context_p->ue_context.imsi.digit6  * 1000000000;      // pow(10, 9)
+  imsi += ue_context_p->ue_context.imsi.digit5  * 10000000000;     // pow(10, 10)
+  imsi += ue_context_p->ue_context.imsi.digit4  * 100000000000;    // pow(10, 11)
+  imsi += ue_context_p->ue_context.imsi.digit3  * 1000000000000;   // pow(10, 12)
+  imsi += ue_context_p->ue_context.imsi.digit2  * 10000000000000;  // pow(10, 13)
+  imsi += ue_context_p->ue_context.imsi.digit1  * 100000000000000; // pow(10, 14)
+  return imsi;
+}
+
+long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id)
+{
+  if (!mac_is_present(mod_id)) return 0;
+  return RC.mac[mod_id]->UE_list.UE_template[UE_PCCID(mod_id, ue_id)][ue_id].lcgidmap[lc_id];
+}
+
+/* TODO Navid: needs to be revised */
+int flexran_get_direction(mid_t ue_id, mid_t lc_id)
+{
+  switch (lc_id) {
+  case DCCH:
+  case DCCH1:
+    return 2;
+  case DTCH:
+    return 1;
+  default:
+    return -1;
+  }
+}
+
+uint8_t flexran_get_antenna_ports(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.nb_antenna_ports_eNB;
+}
+
+uint32_t flexran_agent_get_operating_dl_freq(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.dl_CarrierFreq / 1000000;
+}
+
+uint32_t flexran_agent_get_operating_ul_freq(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.ul_CarrierFreq / 1000000;
+}
+
+uint8_t flexran_agent_get_operating_eutra_band(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.eutra_band;
+}
+
+int8_t flexran_agent_get_operating_pdsch_refpower(mid_t mod_id, uint8_t cc_id)
+{
+  if (!phy_is_present(mod_id, cc_id)) return 0;
+  return RC.eNB[mod_id][cc_id]->frame_parms.pdsch_config_common.referenceSignalPower;
+}
+
+long flexran_agent_get_operating_pusch_p0(mid_t mod_id, uint8_t cc_id)
+{
+  if (!rrc_is_present(mod_id)) return 0;
+  return RC.rrc[mod_id]->configuration.pusch_p0_Nominal[cc_id];
+}
+
+void flexran_agent_set_operating_dl_freq(mid_t mod_id, uint8_t cc_id, uint32_t dl_freq_mhz)
+{
+  if (phy_is_present(mod_id, cc_id)) {
+    RC.eNB[mod_id][cc_id]->frame_parms.dl_CarrierFreq = dl_freq_mhz * 1000000;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set dl_CarrierFreq to %d MHz in PHY: PHY is not present\n", dl_freq_mhz);
+  }
+  if (rrc_is_present(mod_id)) {
+    RC.rrc[mod_id]->configuration.downlink_frequency[cc_id] = dl_freq_mhz * 1000000;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set downlink_frequency to %d MHz in RRC: RRC is not present\n", dl_freq_mhz);
+  }
+}
+
+void flexran_agent_set_operating_ul_freq(mid_t mod_id, uint8_t cc_id, int32_t ul_freq_mhz_offset)
+{
+  if (phy_is_present(mod_id, cc_id)) {
+    uint32_t new_ul_freq_mhz = flexran_agent_get_operating_dl_freq(mod_id, cc_id) + ul_freq_mhz_offset;
+    RC.eNB[mod_id][cc_id]->frame_parms.ul_CarrierFreq = new_ul_freq_mhz * 1000000;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set ul_CarrierFreq using offset %d MHz in PHY: PHY is not present\n", ul_freq_mhz_offset);
+  }
+  if (rrc_is_present(mod_id)) {
+    RC.rrc[mod_id]->configuration.uplink_frequency_offset[cc_id] = ul_freq_mhz_offset;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set uplink_frequency_offset to %d MHz in RRC: RRC is not present\n", ul_freq_mhz_offset);
+  }
+}
+
+void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t eutra_band)
+{
+  if (phy_is_present(mod_id, cc_id)) {
+    RC.eNB[mod_id][cc_id]->frame_parms.eutra_band = eutra_band;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set eutra_band to %d in PHY: PHY is not present\n", eutra_band);
+  }
+  if (rrc_is_present(mod_id)) {
+    RC.rrc[mod_id]->configuration.eutra_band[cc_id] = eutra_band;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set eutra_band to %d in RRC: RRC is not present\n", eutra_band);
+  }
+}
+
+/* Sets both DL/UL */
+void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB)
+{
+  if (phy_is_present(mod_id, cc_id)) {
+    RC.eNB[mod_id][cc_id]->frame_parms.N_RB_DL = N_RB;
+    RC.eNB[mod_id][cc_id]->frame_parms.N_RB_UL = N_RB;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set N_RB_DL and N_RB_UL to %d in PHY: PHY is not present\n", N_RB);
+  }
+  if (rrc_is_present(mod_id)) {
+    RC.rrc[mod_id]->configuration.N_RB_DL[cc_id] = N_RB;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set N_RB_DL to %d in RRC: RRC is not present\n", N_RB);
+  }
+}
+
+void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type)
+{
+  if (phy_is_present(mod_id, cc_id)) {
+    RC.eNB[mod_id][cc_id]->frame_parms.frame_type = frame_type;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set frame_type to %d in PHY: PHY is not present\n", frame_type);
+  }
+  if (rrc_is_present(mod_id)) {
+    RC.rrc[mod_id]->configuration.frame_type[cc_id] = frame_type;
+  } else {
+    LOG_E(FLEXRAN_AGENT, "can not set frame_type to %d in RRC: RRC is not present\n", frame_type);
+  }
+}
+
+/*********** PDCP  *************/
+/*PDCP super frame counter flexRAN*/
+uint32_t flexran_get_pdcp_sfn(const mid_t mod_id){
+  return pdcp_enb[mod_id].sfn;
+}
+
+/*PDCP super frame counter flexRAN*/
+void flexran_set_pdcp_tx_stat_window(const mid_t mod_id, const mid_t ue_id, uint16_t obs_window){
+  if (obs_window > 0 ){
+    Pdcp_stats_tx_window_ms[mod_id][ue_id]=obs_window;
+  }
+  else{
+    Pdcp_stats_tx_window_ms[mod_id][ue_id]=1000;
+  }
+}
+
+/*PDCP super frame counter flexRAN*/
+void flexran_set_pdcp_rx_stat_window(const mid_t mod_id, const mid_t ue_id, uint16_t obs_window){
+  if (obs_window > 0 ){
+    Pdcp_stats_rx_window_ms[mod_id][ue_id]=obs_window;
+  }
+  else{
+    Pdcp_stats_rx_window_ms[mod_id][ue_id]=1000;
+  }
+}
+
+/*PDCP num tx pdu status flexRAN*/
+uint32_t flexran_get_pdcp_tx(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  if (mod_id <0 || mod_id> MAX_NUM_CCs || ue_id<0 || ue_id> NUMBER_OF_UE_MAX || lcid<0 || lcid>NB_RB_MAX)
+    return -1;
+  return Pdcp_stats_tx[mod_id][ue_id][lcid];
+}
+
+/*PDCP num tx bytes status flexRAN*/
+uint32_t flexran_get_pdcp_tx_bytes(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_tx_bytes[mod_id][ue_id][lcid];
+}
+
+/*PDCP number of transmit packet / second status flexRAN*/
+uint32_t flexran_get_pdcp_tx_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_tx_w[mod_id][ue_id][lcid];
+}
+
+/*PDCP throughput (bit/s) status flexRAN*/
+uint32_t flexran_get_pdcp_tx_bytes_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_tx_bytes_w[mod_id][ue_id][lcid];
+}
+
+/*PDCP tx sequence number flexRAN*/
+uint32_t flexran_get_pdcp_tx_sn(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_tx_sn[mod_id][ue_id][lcid];
+}
+
+/*PDCP tx aggregated packet arrival  flexRAN*/
+uint32_t flexran_get_pdcp_tx_aiat(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_tx_aiat[mod_id][ue_id][lcid];
+}
+
+/*PDCP tx aggregated packet arrival  flexRAN*/
+uint32_t flexran_get_pdcp_tx_aiat_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_tx_aiat_w[mod_id][ue_id][lcid];
+}
+
+
+/*PDCP num rx pdu status flexRAN*/
+uint32_t flexran_get_pdcp_rx(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_rx[mod_id][ue_id][lcid];
+}
+
+/*PDCP num rx bytes status flexRAN*/
+uint32_t flexran_get_pdcp_rx_bytes(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_rx_bytes[mod_id][ue_id][lcid];
+}
+
+/*PDCP number of received packet / second  flexRAN*/
+uint32_t flexran_get_pdcp_rx_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_rx_w[mod_id][ue_id][lcid];
+}
+
+/*PDCP gootput (bit/s) status flexRAN*/
+uint32_t flexran_get_pdcp_rx_bytes_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_rx_bytes_w[mod_id][ue_id][lcid];
+}
+
+/*PDCP rx sequence number flexRAN*/
+uint32_t flexran_get_pdcp_rx_sn(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_rx_sn[mod_id][ue_id][lcid];
+}
+
+/*PDCP rx aggregated packet arrival  flexRAN*/
+uint32_t flexran_get_pdcp_rx_aiat(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_rx_aiat[mod_id][ue_id][lcid];
+}
+
+/*PDCP rx aggregated packet arrival  flexRAN*/
+uint32_t flexran_get_pdcp_rx_aiat_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_rx_aiat_w[mod_id][ue_id][lcid];
+}
+
+/*PDCP num of received outoforder pdu status flexRAN*/
+uint32_t flexran_get_pdcp_rx_oo(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid){
+  return Pdcp_stats_rx_outoforder[mod_id][ue_id][lcid];
+}
+
+/******************** RRC *****************************/
+
+MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.measResults) return -1;
+  return ue_context_p->ue_context.measResults->measId;
+}
+
+float flexran_get_rrc_pcell_rsrp(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.measResults) return -1;
+  return RSRP_meas_mapping[ue_context_p->ue_context.measResults->measResultPCell.rsrpResult];
+}
+
+float flexran_get_rrc_pcell_rsrq(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.measResults) return -1;
+  return RSRQ_meas_mapping[ue_context_p->ue_context.measResults->measResultPCell.rsrqResult];
+}
+
+/*Number of neighbouring cells for specific UE*/
+int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id)
+{
+  if (!rrc_is_present(mod_id)) return 0;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return 0;
+  if (!ue_context_p->ue_context.measResults) return 0;
+  if (!ue_context_p->ue_context.measResults->measResultNeighCells) return 0;
+  if (ue_context_p->ue_context.measResults->measResultNeighCells->present != MeasResults__measResultNeighCells_PR_measResultListEUTRA) return 0;
+  return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count;
+}
+
+PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.measResults) return -1;
+  if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1;
+  if (ue_context_p->ue_context.measResults->measResultNeighCells->present != MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1;
+  if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]) return -1;
+  return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->physCellId;
+}
+
+float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.measResults) return -1;
+  if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1;
+  if (ue_context_p->ue_context.measResults->measResultNeighCells->present != MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1;
+  if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]) return -1;
+  if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrpResult) return 0;
+  return RSRP_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrpResult)];
+}
+
+float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id)
+{
+  if (!rrc_is_present(mod_id)) return -1;
+
+  rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
+  struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
+
+  if (!ue_context_p) return -1;
+  if (!ue_context_p->ue_context.measResults) return -1;
+  if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1;
+  if (ue_context_p->ue_context.measResults->measResultNeighCells->present != MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1;
+  if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult) return 0;
+  return RSRQ_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult)];
+}
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..4e5f214af00f133cc2d2485589b17650f7af0712
--- /dev/null
+++ b/openair2/ENB_APP/flexran_agent_ran_api.h
@@ -0,0 +1,507 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+/*! \file flexran_agent_ran_api.h
+ * \brief FlexRAN RAN API abstraction header 
+ * \author N. Nikaein, X. Foukas and S. SHARIAT BAGHERI
+ * \date 2017
+ * \version 0.1
+ */
+
+#include <stdio.h>
+#include <time.h>
+
+#include "flexran_agent_common.h"
+#include "flexran_agent_common_internal.h"
+#include "flexran_agent_extern.h"
+#include "flexran_agent_defs.h"
+
+
+#include "enb_config.h"
+#include "LAYER2/MAC/extern.h"
+#include "LAYER2/RLC/rlc.h"
+#include "SCHED/defs.h"
+#include "pdcp.h"
+#include "RRC/LITE/extern.h"
+#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
+#include "RRC/LITE/rrc_eNB_UE_context.h"
+#include "PHY/extern.h"
+#include "log.h"
+
+/****************************
+ * get generic info from RAN
+ ****************************/
+
+uint32_t flexran_get_current_time_ms(mid_t mod_id, int subframe_flag);
+
+/*Return the current frame number
+ *Could be using implementation specific numbering of frames
+ */
+frame_t flexran_get_current_frame(mid_t mod_id);
+
+/*Return the current SFN (0-1023)*/ 
+frame_t flexran_get_current_system_frame_num(mid_t mod_id);
+
+sub_frame_t flexran_get_current_subframe(mid_t mod_id);
+
+/*Return the frame and subframe number in compact 16-bit format.
+  Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/
+uint16_t flexran_get_sfn_sf(mid_t mod_id);
+
+/* Return a future frame and subframe number that is ahead_of_time
+   subframes later in compact 16-bit format. Bits 0-3 subframe,
+   rest for frame */
+uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
+
+/* Return the number of attached UEs */
+int flexran_get_num_ues(mid_t mod_id);
+
+/* Get the rnti of a UE with id ue_id */
+rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id);
+
+/* Get the RLC buffer status report in bytes of a ue for a designated
+ * logical channel id */
+int flexran_get_ue_bsr_ul_buffer_info(mid_t mod_id, mid_t ue_id, lcid_t lcid);
+
+/* Get power headroom of UE with id ue_id */
+int8_t flexran_get_ue_phr(mid_t mod_id, mid_t ue_id);
+
+/* Get the UE wideband CQI */
+uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id);
+
+/* Get the transmission queue size for a UE with a channel_id logical channel id */
+rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
+
+/*Get number of pdus in RLC buffer*/
+rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
+
+/* Get the head of line delay for a UE with a channel_id logical channel id */
+frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
+
+/* Check the status of the timing advance for a UE */
+int32_t flexran_get_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+/* Update the timing advance status(find out whether a timing advance command is required) */
+/* currently broken
+void flexran_update_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id); */
+
+/* Return timing advance MAC control element for a designated cell and UE */
+/* this function is broken */
+int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+/*Get number of mac SDU DL*/
+uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Return the MAC sdu size got from logical channel lcid */
+uint32_t flexran_get_mac_sdu_size(mid_t mod_id, mid_t ue_id, int cc_id, int lcid);
+
+/*Return number of MAC SDUs obtained in MAC layer*/
+uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get mac sdu lcid index*/
+unsigned char flexran_get_mac_sdu_lcid_index(mid_t mod_id, mid_t ue_id, int cc_id, int index);
+
+/*Get MAC size sdus length dl*/
+uint32_t flexran_get_size_dl_mac_sdus(mid_t mod_id, int cc_id);
+
+/*Get MAC size sdus length ul */
+uint32_t flexran_get_size_ul_mac_sdus(mid_t mod_id, int cc_id);
+
+/*Get total size DL MAC SDUS*/
+uint32_t flexran_get_total_size_dl_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get total size of UL mac SDUS*/
+uint32_t flexran_get_total_size_ul_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get total number of PDU DL*/
+uint32_t flexran_get_total_num_pdu_dl(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get total number of PDU UL*/
+uint32_t flexran_get_total_num_pdu_ul(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get total PRB dl TODO Should be changed*/
+uint32_t flexran_get_total_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get total PRB ul TODO Should be changed*/
+uint32_t flexran_get_total_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get number of prb for tx per UE DL*/
+uint16_t flexran_get_num_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get number of prb for rx per UE UL*/
+uint16_t flexran_get_num_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get number of prb for retx per UE UL*/
+uint32_t flexran_get_num_prb_retx_ul_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get number of prb for retx per UE*/
+uint16_t flexran_get_num_prb_retx_dl_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*MCS before rate adaptation DL*/
+uint8_t flexran_get_mcs1_dl(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*MCS after rate adaptation DL*/
+uint8_t flexran_get_mcs2_dl(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*MCS before rate adaptation UL*/
+uint8_t flexran_get_mcs1_ul(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*MCS after rate adaptation UL*/
+uint8_t flexran_get_mcs2_ul(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get downlink TBS*/
+uint32_t flexran_get_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get uplink TBS */
+uint32_t flexran_get_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get total TBS DL*/
+uint64_t flexran_get_total_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/*Get total TBS DL*/
+uint64_t flexran_get_total_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id);
+
+/* Get the current HARQ round for UE ue_id */
+int flexran_get_harq_round(mid_t mod_id, uint8_t cc_id, mid_t ue_id);
+
+/* Get the number of active component carriers for a specific UE */
+int flexran_get_active_CC(mid_t mod_id, mid_t ue_id);
+
+/* Get the rank indicator for a designated cell and UE */
+uint8_t flexran_get_current_RI(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+/* See TS 36.213, section 10.1 */
+uint16_t flexran_get_n1pucch_an(mid_t mod_id, uint8_t cc_id);
+
+/* See TS 36.211, section 5.4 */
+uint8_t flexran_get_nRB_CQI(mid_t mod_id, uint8_t cc_id);
+
+/* See TS 36.211, section 5.4 */
+uint8_t flexran_get_deltaPUCCH_Shift(mid_t mod_id, uint8_t cc_id);
+
+/* See TS 36.211, section 5.7.1 */
+uint8_t flexran_get_prach_ConfigIndex(mid_t mod_id, uint8_t cc_id);
+
+/* See TS 36.211, section 5.7.1 */
+uint8_t flexran_get_prach_FreqOffset(mid_t mod_id, uint8_t cc_id);
+
+/* See TS 36.321 */
+uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id);
+
+/* Get the length of the UL cyclic prefix */
+lte_prefix_type_t flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
+
+/* Get the length of the DL cyclic prefix */
+lte_prefix_type_t flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
+
+/* Get the physical cell id of a cell */
+uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id);
+
+/* See TS 36.211, section 5.5.3.2 */
+uint8_t flexran_get_srs_BandwidthConfig(mid_t mod_id, uint8_t cc_id);
+
+/* See TS 36.211, table 5.5.3.3-1 and 2 */
+uint8_t flexran_get_srs_SubframeConfig(mid_t mod_id, uint8_t cc_id);
+
+/* Boolean value. See TS 36.211,
+   section 5.5.3.2. TDD only */
+uint8_t flexran_get_srs_MaxUpPts(mid_t mod_id, uint8_t cc_id);
+
+/* Get number of DL resource blocks */
+uint8_t flexran_get_N_RB_DL(mid_t mod_id, uint8_t cc_id);
+
+/* Get number of UL resource blocks */
+uint8_t flexran_get_N_RB_UL(mid_t mod_id, uint8_t cc_id);
+
+/* Get number of resource block groups */
+uint8_t flexran_get_N_RBG(mid_t mod_id, uint8_t cc_id);
+
+/* Get DL/UL subframe assignment. TDD only */
+uint8_t flexran_get_subframe_assignment(mid_t mod_id, uint8_t cc_id);
+
+/* TDD only. See TS 36.211, table 4.2.1 */
+uint8_t flexran_get_special_subframe_assignment(mid_t mod_id, uint8_t cc_id);
+
+/* Get the duration of the random access response window in subframes */
+long flexran_get_ra_ResponseWindowSize(mid_t mod_id, uint8_t cc_id);
+
+/* Get timer used for random access */
+long flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, uint8_t cc_id);
+
+/* Get type of duplex mode(FDD/TDD) */
+Protocol__FlexDuplexMode flexran_get_duplex_mode(mid_t mod_id, uint8_t cc_id);
+
+/* Get the SI window length */
+long flexran_get_si_window_length(mid_t mod_id, uint8_t cc_id);
+
+/* Get length of SystemInformationBlock1 */
+uint8_t flexran_get_sib1_length(mid_t mod_id, uint8_t cc_id);
+
+/* Get the number of PDCCH symbols configured for the cell */
+uint8_t flexran_get_num_pdcch_symb(mid_t mod_id, uint8_t cc_id);
+
+uint8_t flexran_get_antenna_ports(mid_t mod_id, uint8_t cc_id);
+
+/* See TS 36.213, sec 5.1.1.1 */
+int flexran_get_tpc(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+uint8_t flexran_get_ue_wpmi(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+/* Get the first available HARQ process for a specific cell and UE during 
+   a designated frame and subframe. Returns 0 for success. The id and the 
+   status of the HARQ process are stored in id and status respectively */
+/* currently broken
+int flexran_get_harq(mid_t mod_id, uint8_t cc_id, mid_t ue_id, frame_t frame,
+                     sub_frame_t subframe, unsigned char *id, unsigned char *round,
+                     uint8_t harq_flag); */
+
+/* Uplink power control management*/
+int32_t flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+int8_t flexran_get_p0_nominal_pucch(mid_t mod_id, uint8_t cc_id);
+
+int32_t flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+uint8_t flexran_get_threequarter_fs(mid_t mod_id, uint8_t cc_id);
+
+PUSCH_HOPPING_t flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id);
+
+uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id);
+
+uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id);
+
+int flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id);
+
+uint8_t flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id);
+
+PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id);
+
+/*
+ * ************************************
+ * Get Messages for UE Configuration Reply
+ * ************************************
+ */
+
+/* Get timer in subframes. Controls the synchronization
+   status of the UE, not the actual timing 
+   advance procedure. See TS 36.321 */
+TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id);
+
+/* Get measurement gap configuration. See TS 36.133 */
+Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id);
+
+/* Get measurement gap configuration offset if applicable */
+long flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id);
+
+/* DL aggregated bit-rate of non-gbr bearer
+   per UE. See TS 36.413 */
+uint64_t flexran_get_ue_aggregated_max_bitrate_dl(mid_t mod_id, mid_t ue_id);
+
+/* UL aggregated bit-rate of non-gbr bearer
+   per UE. See TS 36.413 */
+uint64_t flexran_get_ue_aggregated_max_bitrate_ul(mid_t mod_id, mid_t ue_id);
+
+/* Only half-duplex support. FDD operation. Boolean value */
+int flexran_get_half_duplex(mid_t mod_id, mid_t ue_id);
+
+/* Support of intra-subframe hopping.  Boolean value */
+int flexran_get_intra_sf_hopping(mid_t mod_id, mid_t ue_id);
+
+/* UE support for type 2 hopping with n_sb>1 */
+int flexran_get_type2_sb_1(mid_t mod_id, mid_t ue_id);
+
+/* Get the UE category */
+long flexran_get_ue_category(mid_t mod_id, mid_t ue_id);
+
+/* UE support for resource allocation type 1 */
+int flexran_get_res_alloc_type1(mid_t mod_id, mid_t ue_id);
+
+/* Get UE transmission mode */
+long flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id);
+
+/* Boolean value. See TS 36.321 */
+BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id);
+
+/* The max HARQ retransmission for UL.
+   See TS 36.321 */
+long flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id);
+
+/* See TS 36.213 */
+long flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id);
+
+/* See TS 36.213 */
+long flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id);
+
+/* See TS 36.213 */
+long flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id);
+
+/* Boolean. See TS36.213, Section 10.1 */
+BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id);
+
+/* Boolean. See TS 36.213, Section 8.2 */
+BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
+
+/* Get aperiodic CQI report mode */
+CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id);
+
+/* Get ACK/NACK feedback mode. TDD only */
+long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, mid_t ue_id);
+
+/* See TS36.213, section 10.1 */
+long flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id);
+
+/* Boolean. Extended buffer status report size */
+long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
+
+/* Get number of UE transmission antennas */
+int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id);
+
+/* Get the IMSI of UE */
+uint64_t flexran_get_ue_imsi(mid_t mod_id, mid_t ue_id);
+
+/* Get logical channel group of a channel with id lc_id */
+long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id);
+
+/* Get direction of logical channel with id lc_id */
+int flexran_get_direction(mid_t ue_id, mid_t lc_id);
+
+/*Get downlink frequency*/
+uint32_t flexran_agent_get_operating_dl_freq(mid_t mod_id, uint8_t cc_id);
+
+/*Get uplink frequency*/
+uint32_t flexran_agent_get_operating_ul_freq(mid_t mod_id, uint8_t cc_id);
+
+/*Get eutra band*/
+uint8_t flexran_agent_get_operating_eutra_band(mid_t mod_id, uint8_t cc_id);
+
+/*Get downlink ref signal power*/
+int8_t flexran_agent_get_operating_pdsch_refpower(mid_t mod_id, uint8_t cc_id);
+
+/*Get uplink power*/
+long flexran_agent_get_operating_pusch_p0(mid_t mod_id, uint8_t cc_id);
+
+/*set the dl freq */
+void flexran_agent_set_operating_dl_freq(mid_t mod_id, uint8_t cc_id, uint32_t dl_freq_mhz);
+
+/* set the ul freq */
+void flexran_agent_set_operating_ul_freq(mid_t mod_id, uint8_t cc_id, int32_t ul_freq_mhz_offset);
+
+/*set the the band */
+void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t eutra_band);
+
+/* set the bandwidth (in RB) */
+void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB);
+
+/*set frame type*/
+void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type);
+
+/*RRC status flexRAN*/
+uint8_t flexran_get_rrc_status(mid_t mod_id, mid_t ue_id);
+
+
+/***************************** PDCP ***********************/
+
+/*PDCP superframe numberflexRAN*/
+uint32_t flexran_get_pdcp_sfn(const mid_t mod_id);
+
+/*PDCP pdcp tx stats window*/
+void flexran_set_pdcp_tx_stat_window(const mid_t mod_id, const mid_t ue_id, uint16_t obs_window);
+
+/*PDCP pdcp rx stats window*/
+void flexran_set_pdcp_rx_stat_window(const mid_t mod_id, const mid_t ue_id, uint16_t obs_window);
+
+/*PDCP num tx pdu status flexRAN*/
+uint32_t flexran_get_pdcp_tx(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP num tx bytes status flexRAN*/
+uint32_t flexran_get_pdcp_tx_bytes(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP number of transmit packet / second status flexRAN*/
+uint32_t flexran_get_pdcp_tx_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP pdcp tx bytes in a given window flexRAN*/
+uint32_t flexran_get_pdcp_tx_bytes_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP tx sequence number flexRAN*/
+uint32_t flexran_get_pdcp_tx_sn(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP tx aggregated packet arrival  flexRAN*/
+uint32_t flexran_get_pdcp_tx_aiat(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP tx aggregated packet arrival per second flexRAN*/
+uint32_t flexran_get_pdcp_tx_aiat_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+
+/*PDCP num rx pdu status flexRAN*/
+uint32_t flexran_get_pdcp_rx(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP num rx bytes status flexRAN*/
+uint32_t flexran_get_pdcp_rx_bytes(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP number of received packet / second  flexRAN*/
+uint32_t flexran_get_pdcp_rx_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP gootput (bit/s) status flexRAN*/
+uint32_t flexran_get_pdcp_rx_bytes_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP rx sequence number flexRAN*/
+uint32_t flexran_get_pdcp_rx_sn(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP rx aggregated packet arrival  flexRAN*/
+uint32_t flexran_get_pdcp_rx_aiat(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP rx aggregated packet arrival per second flexRAN*/
+uint32_t flexran_get_pdcp_rx_aiat_w(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*PDCP num of received outoforder pdu status flexRAN*/
+uint32_t flexran_get_pdcp_rx_oo(const mid_t mod_id,  const mid_t ue_id, const lcid_t lcid);
+
+/*********************RRC**********************/
+/*Get primary cell measuremeant id flexRAN*/
+MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id);
+
+/*Get primary cell RSRP measurement flexRAN*/  
+float flexran_get_rrc_pcell_rsrp(mid_t mod_id, mid_t ue_id);
+
+/*Get primary cell RSRQ measurement flexRAN*/
+float flexran_get_rrc_pcell_rsrq(mid_t mod_id, mid_t ue_id);
+
+/* Get RRC neighbouring measurement */
+int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id);
+
+/*Get physical cell id*/
+PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id);
+
+/*Get RSRP of neighbouring Cell*/
+float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id);
+
+/*Get RSRQ of neighbouring Cell*/
+float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id);
+
+/*Get MCC PLMN identity neighbouring Cell*/
+/* currently not implemented
+int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, mid_t ue_id, int cell_id); */
+
+/*Get MNC PLMN identity neighbouring Cell*/
+/* currently not implemented
+int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, mid_t ue_id, int cell_id); */
diff --git a/openair2/ENB_APP/flexran_agent_task_manager.c b/openair2/ENB_APP/flexran_agent_task_manager.c
index eaa6a58af8d0cfcf2f6019f3674bcfa964df6c5f..088ec618c7b3ba7b270faf84c1b90c28e486ed28 100644
--- a/openair2/ENB_APP/flexran_agent_task_manager.c
+++ b/openair2/ENB_APP/flexran_agent_task_manager.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/ENB_APP/flexran_agent_task_manager.h b/openair2/ENB_APP/flexran_agent_task_manager.h
index 1b14f1f6f6754d6e45d5201a40650f54146a8eac..165b9dda1c54c86521636564b3449f77a49296e1 100644
--- a/openair2/ENB_APP/flexran_agent_task_manager.h
+++ b/openair2/ENB_APP/flexran_agent_task_manager.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/ENB_APP/flexran_agent_timer.c b/openair2/ENB_APP/flexran_agent_timer.c
new file mode 100644
index 0000000000000000000000000000000000000000..dda302735388ce56f5ce57d9e39de10a5cd712b8
--- /dev/null
+++ b/openair2/ENB_APP/flexran_agent_timer.c
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+/*! \file flexran_agent_timer.c
+ * \brief FlexRAN Timer  
+ * \author shahab SHARIAT BAGHERI
+ * \date 2017
+ * \version 0.1
+ */
+
+/*
+ * timer primitives
+ */
+
+#include "flexran_agent_timer.h"
+
+//struct flexran_agent_map agent_map;
+flexran_agent_timer_instance_t timer_instance;
+int agent_timer_init = 0;
+err_code_t flexran_agent_init_timer(void){
+  
+  LOG_I(FLEXRAN_AGENT, "init RB tree\n");
+  if (!agent_timer_init) {
+    RB_INIT(&timer_instance.flexran_agent_head);
+    agent_timer_init = 1;
+  }
+ 
+ return PROTOCOL__FLEXRAN_ERR__NO_ERR;
+}
+
+RB_GENERATE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
+
+/* The timer_id might not be the best choice for the comparison */
+int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b){
+
+  if (a->timer_id < b->timer_id) return -1;
+  if (a->timer_id > b->timer_id) return 1;
+
+  // equal timers
+  return 0;
+}
+
+err_code_t flexran_agent_create_timer(uint32_t interval_sec,
+				      uint32_t interval_usec,
+				      agent_id_t     agent_id,
+				      instance_t     instance,
+				      uint32_t timer_type,
+				      xid_t xid,
+				      flexran_agent_timer_callback_t cb,
+				      void*    timer_args,
+				      long *timer_id){
+  
+  struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e));
+  DevAssert(e != NULL);
+  
+//uint32_t timer_id;
+  int ret=-1;
+  
+  if ((interval_sec == 0) && (interval_usec == 0 ))
+    return TIMER_NULL;
+  
+  if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX)
+    return TIMER_TYPE_INVALIDE;
+  
+  if (timer_type  ==   FLEXRAN_AGENT_TIMER_TYPE_ONESHOT){ 
+    ret = timer_setup(interval_sec, 
+		      interval_usec, 
+		      TASK_FLEXRAN_AGENT, 
+		      instance, 
+		      TIMER_ONE_SHOT,
+		      timer_args,
+		      timer_id);
+    
+    e->type = TIMER_ONE_SHOT;
+  }
+  else if (timer_type  ==   FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ){
+    ret = timer_setup(interval_sec, 
+		      interval_usec, 
+		      TASK_FLEXRAN_AGENT, 
+		      instance, 
+		      TIMER_PERIODIC,
+		      timer_args,
+		      timer_id);
+    
+    e->type = TIMER_PERIODIC;
+  }
+  
+  if (ret < 0 ) {
+    return TIMER_SETUP_FAILED; 
+  }
+
+  e->agent_id = agent_id;
+  e->instance = instance;
+  e->state = FLEXRAN_AGENT_TIMER_STATE_ACTIVE;
+  e->timer_id = *timer_id;
+  e->xid = xid;
+  e->timer_args = timer_args; 
+  e->cb = cb;
+  /*element should be a real pointer*/
+  RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e); 
+  
+  LOG_I(FLEXRAN_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n",
+	e->timer_id, e->agent_id, e->instance);
+  
+  return 0; 
+}
+
+err_code_t flexran_agent_destroy_timer(long timer_id){
+  
+  struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id);
+
+  if (e != NULL ) {
+    RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
+    flexran_agent_destroy_flexran_message(e->timer_args->msg);
+    free(e);
+  }
+  
+  if (timer_remove(timer_id) < 0 ) 
+    goto error;
+  
+  return 0;
+
+ error:
+  LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
+  return TIMER_REMOVED_FAILED ;
+}
+
+err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid) {
+  struct flexran_agent_timer_element_s *e = NULL;
+  long timer_id;
+  RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
+    if (e->xid == xid) {
+      timer_id = e->timer_id;
+      RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
+      flexran_agent_destroy_flexran_message(e->timer_args->msg);
+      free(e);
+      if (timer_remove(timer_id) < 0 ) { 
+	goto error;
+      }
+    }
+  }
+  return 0;
+
+ error:
+  LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
+  return TIMER_REMOVED_FAILED ;
+}
+
+err_code_t flexran_agent_destroy_timers(void){
+  
+  struct flexran_agent_timer_element_s *e = NULL;
+  
+  RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
+    RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
+    timer_remove(e->timer_id);
+    flexran_agent_destroy_flexran_message(e->timer_args->msg);
+    free(e);
+  }  
+
+  return 0;
+
+}
+
+void flexran_agent_sleep_until(struct timespec *ts, int delay) {
+  ts->tv_nsec += delay;
+  if(ts->tv_nsec >= 1000*1000*1000){
+    ts->tv_nsec -= 1000*1000*1000;
+    ts->tv_sec++;
+  }
+  clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts,  NULL);
+}
+
+
+err_code_t flexran_agent_stop_timer(long timer_id){
+  
+  struct flexran_agent_timer_element_s *e=NULL;
+  struct flexran_agent_timer_element_s search;
+  memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
+  search.timer_id = timer_id;
+
+  e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
+
+  if (e != NULL ) {
+    e->state =  FLEXRAN_AGENT_TIMER_STATE_STOPPED;
+  }
+  
+  timer_remove(timer_id);
+  
+  return 0;
+}
+
+struct flexran_agent_timer_element_s * get_timer_entry(long timer_id) {
+  
+  struct flexran_agent_timer_element_s search;
+  memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
+  search.timer_id = timer_id;
+
+  return  RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search); 
+}
diff --git a/openair2/ENB_APP/flexran_agent_timer.h b/openair2/ENB_APP/flexran_agent_timer.h
new file mode 100644
index 0000000000000000000000000000000000000000..98d83c78a950d7db533316f297e3f3e4ac4c9704
--- /dev/null
+++ b/openair2/ENB_APP/flexran_agent_timer.h
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */ 
+
+/*! \file flexran_agent_timer.h
+ * \brief FlexRAN Timer  header
+ * \author shahab SHARIAT BAGHERI
+ * \date 2017
+ * \version 0.1
+ */
+
+#include <stdio.h>
+#include <time.h>
+
+#include "flexran_agent_common.h"
+#include "flexran_agent_common_internal.h"
+#include "flexran_agent_extern.h"
+#include "flexran_agent_defs.h"
+
+
+# include "tree.h"
+# include "intertask_interface.h"
+# include "timer.h"
+
+
+
+/*******************
+ * timer primitves
+ *******************/
+
+#define TIMER_NULL                 -1 
+#define TIMER_TYPE_INVALIDE        -2
+#define	TIMER_SETUP_FAILED         -3
+#define	TIMER_REMOVED_FAILED       -4
+#define	TIMER_ELEMENT_NOT_FOUND    -5
+
+
+/* Type of the callback executed when the timer expired */
+typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*);
+
+
+typedef struct flexran_agent_timer_args_s{
+  mid_t            mod_id;
+  Protocol__FlexranMessage *msg;
+} flexran_agent_timer_args_t;
+
+
+typedef struct flexran_agent_timer_element_s{
+  RB_ENTRY(flexran_agent_timer_element_s) entry;
+
+  agent_id_t             agent_id;
+  instance_t       instance;
+  
+  flexran_agent_timer_type_t  type;
+  flexran_agent_timer_state_t state;
+
+  uint32_t interval_sec;
+  uint32_t interval_usec;
+
+  long timer_id;  /* Timer id returned by the timer API*/
+  xid_t xid; /*The id of the task as received by the controller
+	       message*/
+  
+  flexran_agent_timer_callback_t cb;
+  flexran_agent_timer_args_t *timer_args;
+  
+} flexran_agent_timer_element_t;
+
+typedef struct flexran_agent_timer_instance_s{
+  RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head;
+}flexran_agent_timer_instance_t;
+
+
+err_code_t flexran_agent_init_timer(void);
+
+/* Create a timer for some agent related event with id xid. Will store the id 
+   of the generated timer in timer_id */
+err_code_t flexran_agent_create_timer(uint32_t interval_sec,
+				  uint32_t interval_usec,
+				  agent_id_t     agent_id,
+				  instance_t     instance,
+				  uint32_t timer_type,
+				  xid_t xid,
+				  flexran_agent_timer_callback_t cb,
+				  void*    timer_args,
+				  long *timer_id);
+
+/* Destroy all existing timers */
+err_code_t flexran_agent_destroy_timers(void);
+
+/* Destroy the timer with the given timer_id */
+err_code_t flexran_agent_destroy_timer(long timer_id);
+
+/* Destroy the timer for task with id xid */
+err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid);
+
+/* Stop a timer */
+err_code_t flexran_agent_stop_timer(long timer_id);
+
+/* Restart the given timer */
+err_code_t flexran_agent_restart_timer(long *timer_id);
+
+/* Find the timer with the given timer_id */
+struct flexran_agent_timer_element_s * get_timer_entry(long timer_id);
+
+/* Obtain the protocol message stored in the given expired timer */
+Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args);
+
+/* Comparator function comparing two timers. Decides the ordering of the timers */
+int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b);
+
+/*Specify a delay in nanoseconds to timespec and sleep until then*/
+void flexran_agent_sleep_until(struct timespec *ts, int delay);
+
+/* RB_PROTOTYPE is for .h files */
+RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index d74955438f3c8f5b7f9661f999d28de9b6f982ff..42ed105f23b3c507416b0508e292fd6efcb9c8c5 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -4,7 +4,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -32,6 +32,7 @@
 
 #include "COMMON/platform_types.h"
 #include "COMMON/platform_constants.h"
+#include "SCHED/defs.h"
 #include "SystemInformationBlockType2.h"
 //#include "RadioResourceConfigCommonSIB.h"
 #include "RadioResourceConfigDedicated.h"
@@ -57,93 +58,63 @@
 #endif
 
 extern RAN_CONTEXT_t RC;
+extern int l2_init_eNB(void);
+extern void mac_top_init_eNB(void);
+extern void mac_init_cell_params(int Mod_idP,int CC_idP);
 
-/* sec 5.9, 36.321: MAC Reset Procedure */
-void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index)
-{
-
-  //Resetting Bj
-  UE_mac_inst[module_idP].scheduling_info.Bj[0] = 0;
-  UE_mac_inst[module_idP].scheduling_info.Bj[1] = 0;
-  UE_mac_inst[module_idP].scheduling_info.Bj[2] = 0;
-
-  //Stopping all timers
-
-  //timeAlignmentTimer expires
-
-  // PHY changes for UE MAC reset
-  phy_reset_ue(module_idP,0,eNB_index);
-
-  // notify RRC to relase PUCCH/SRS
-  // cancel all pending SRs
-  UE_mac_inst[module_idP].scheduling_info.SR_pending=0;
-  UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0;
-
-//Set BSR Trigger Bmp and remove timer flags
-  UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
-
-  // stop ongoing RACH procedure
-
-  // discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
-  UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex  = 0; // check!
-  UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
-
-
-  ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure
-
-}
+extern uint8_t nfapi_mode;
 
 int32_t **rxdata;
 int32_t **txdata;
 
 
 typedef struct eutra_bandentry_s {
-    int16_t band;
-    uint32_t ul_min;
-    uint32_t ul_max;
-    uint32_t dl_min;
-    uint32_t dl_max;
-    uint32_t N_OFFs_DL;
+  int16_t band;
+  uint32_t ul_min;
+  uint32_t ul_max;
+  uint32_t dl_min;
+  uint32_t dl_max;
+  uint32_t N_OFFs_DL;
 } eutra_bandentry_t;
 
 typedef struct band_info_s {
-    int nbands;
-    eutra_bandentry_t band_info[100];
+  int nbands;
+  eutra_bandentry_t band_info[100];
 } band_info_t;
 
 
 
 static const eutra_bandentry_t eutra_bandtable[] = {
-  { 1, 19200, 19800, 21100, 21700, 0},
-  { 2, 18500, 19100, 19300, 19900, 6000},
-  { 3, 17100, 17850, 18050, 18800, 12000},
-  { 4, 17100, 17550, 21100, 21550, 19500},
-  { 5,  8240,  8490,  8690,  8940, 24000},
-  { 6,  8300,  8400,  8750,  8850, 26500},
-  { 7, 25000, 25700, 26200, 26900, 27500},
-  { 8,  8800, 9150 ,  9250,  9600, 34500},
-  { 9, 17499, 17849, 18449, 18799, 38000},
+  {1, 19200, 19800, 21100, 21700, 0},
+  {2, 18500, 19100, 19300, 19900, 6000},
+  {3, 17100, 17850, 18050, 18800, 12000},
+  {4, 17100, 17550, 21100, 21550, 19500},
+  {5, 8240, 8490, 8690, 8940, 24000},
+  {6, 8300, 8400, 8750, 8850, 26500},
+  {7, 25000, 25700, 26200, 26900, 27500},
+  {8, 8800, 9150, 9250, 9600, 34500},
+  {9, 17499, 17849, 18449, 18799, 38000},
   {10, 17100, 17700, 21100, 21700, 41500},
   {11, 14279, 14529, 14759, 15009, 47500},
-  {12,  6980,  7160,  7280,  7460, 50100},
-  {13,  7770,  7870,  7460,  7560, 51800},
-  {14,  7880,  7980,  7580,  7680, 52800},
-  {17,  7040,  7160,  7340,  7460, 57300},
-  {18,  8150,  9650,  8600, 10100, 58500},
-  {19,  8300,  8450,  8750,  8900, 60000},
-  {20,  8320,  8620,  7910,  8210, 61500},
+  {12, 6980, 7160, 7280, 7460, 50100},
+  {13, 7770, 7870, 7460, 7560, 51800},
+  {14, 7880, 7980, 7580, 7680, 52800},
+  {17, 7040, 7160, 7340, 7460, 57300},
+  {18, 8150, 9650, 8600, 10100, 58500},
+  {19, 8300, 8450, 8750, 8900, 60000},
+  {20, 8320, 8620, 7910, 8210, 61500},
   {21, 14479, 14629, 14959, 15109, 64500},
   {22, 34100, 34900, 35100, 35900, 66000},
   {23, 20000, 20200, 21800, 22000, 75000},
   {24, 16126, 16605, 15250, 15590, 77000},
   {25, 18500, 19150, 19300, 19950, 80400},
-  {26, 8140 ,  8490,  8590,  8940, 86900},
-  {27, 8070 ,  8240,  8520,  8690, 90400},
-  {28, 7030 ,  7580,  7580,  8130, 92100},
-  {29, 0    ,  0   ,  7170,  7280, 96600},
+  {26, 8140, 8490, 8590, 8940, 86900},
+  {27, 8070, 8240, 8520, 8690, 90400},
+  {28, 7030, 7580, 7580, 8130, 92100},
+  {29, 0, 0, 7170, 7280, 96600},
   {30, 23050, 23250, 23500, 23600, 97700},
   {31, 45250, 34900, 46250, 35900, 98700},
-  {32, 0    , 0    , 14520, 14960, 99200},
+  {32, 0, 0, 14520, 14960, 99200},
   {33, 19000, 19200, 19000, 19200, 36000},
   {34, 20100, 20250, 20100, 20250, 36200},
   {35, 18500, 19100, 18500, 19100, 36350},
@@ -155,51 +126,60 @@ static const eutra_bandentry_t eutra_bandtable[] = {
   {41, 24960, 26900, 24960, 26900, 39650},
   {42, 34000, 36000, 34000, 36000, 41590},
   {43, 36000, 38000, 36000, 38000, 43590},
-  {44, 7030 ,  8030,  7030,  8030, 45590},
+  {44, 7030, 8030, 7030, 8030, 45590},
   {45, 14470, 14670, 14470, 14670, 46590},
   {46, 51500, 59250, 51500, 59250, 46790},
   {65, 19200, 20100, 21100, 22000, 65536},
   {66, 17100, 18000, 21100, 22000, 66436},
-  {67, 0    , 0    ,  7380,  7580, 67336},
-  {68, 6980 , 7280 ,  7530,  7830, 67536}};
+  {67, 0, 0, 7380, 7580, 67336},
+  {68, 6980, 7280, 7530, 7830, 67536}
+};
 
-uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw) {
+uint32_t to_earfcn(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw)
+{
 
-  uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq/100000;
-  int bw_by_100                   = bw/100;
+  uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq / 100000;
+  int bw_by_100 = bw / 100;
 
   int i;
 
-  AssertFatal(eutra_bandP < 69,"eutra_band %d > 68\n",eutra_bandP);
-  for (i=0;i<69 && eutra_bandtable[i].band!=eutra_bandP;i++);
+  AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP);
+  for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
 
-  AssertFatal(dl_CarrierFreq_by_100k>=eutra_bandtable[i].dl_min,
+  AssertFatal(dl_CarrierFreq_by_100k >= eutra_bandtable[i].dl_min,
 	      "Band %d, bw %u : DL carrier frequency %u Hz < %u\n",
-	      eutra_bandP,bw,dl_CarrierFreq,eutra_bandtable[i].dl_min);
-  AssertFatal(dl_CarrierFreq_by_100k<=(eutra_bandtable[i].dl_max-bw_by_100),
+	      eutra_bandP, bw, dl_CarrierFreq,
+	      eutra_bandtable[i].dl_min);
+  AssertFatal(dl_CarrierFreq_by_100k <=
+	      (eutra_bandtable[i].dl_max - bw_by_100),
 	      "Band %d, bw %u: DL carrier frequency %u Hz > %d\n",
-	      eutra_bandP,bw,dl_CarrierFreq,eutra_bandtable[i].dl_max-bw_by_100);
+	      eutra_bandP, bw, dl_CarrierFreq,
+	      eutra_bandtable[i].dl_max - bw_by_100);
 
 
-  return(dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min + (eutra_bandtable[i].N_OFFs_DL/10));
+  return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min +
+	  (eutra_bandtable[i].N_OFFs_DL / 10));
 }
 
-uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn) {
+uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn)
+{
 
   int i;
 
-  AssertFatal(eutra_bandP < 69,"eutra_band %d > 68\n",eutra_bandP);
-  for (i=0;i<69 && eutra_bandtable[i].band!=eutra_bandP;i++);
+  AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP);
+  for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
 
-  return(eutra_bandtable[i].dl_min + (dl_earfcn-(eutra_bandtable[i].N_OFFs_DL/10)))*100000;
+  return (eutra_bandtable[i].dl_min +
+	  (dl_earfcn - (eutra_bandtable[i].N_OFFs_DL / 10))) * 100000;
 }
 
 
-int32_t get_uldl_offset(int eutra_bandP) {
+int32_t get_uldl_offset(int eutra_bandP)
+{
   int i;
 
-  for (i=0;i<69 && eutra_bandtable[i].band!=eutra_bandP;i++);
-  return(eutra_bandtable[i].dl_min - eutra_bandtable[i].ul_min);
+  for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
+  return (eutra_bandtable[i].dl_min - eutra_bandtable[i].ul_min);
 }
 
 uint32_t bw_table[6] = {6*180,15*180,25*180,50*180,75*180,100*180};
@@ -213,200 +193,459 @@ void config_mib(int                 Mod_idP,
 		int                 NcpP,
 		int                 p_eNBP,
 		uint32_t            dl_CarrierFreqP,
-		uint32_t            ul_CarrierFreqP,
-		uint32_t            pbch_repetitionP) {
+		uint32_t            ul_CarrierFreqP
+#ifdef Rel14
+                ,
+		uint32_t            pbch_repetitionP
+#endif
+                ) {
 
   nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP];
+
+  cfg->num_tlv=0;
 		
   cfg->subframe_config.pcfich_power_offset.value   = 6000;  // 0dB
+  cfg->subframe_config.pcfich_power_offset.tl.tag = NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG;
+  cfg->num_tlv++;
+
   cfg->subframe_config.dl_cyclic_prefix_type.value = NcpP;
+  cfg->subframe_config.dl_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG;
+  cfg->num_tlv++;
+
   cfg->subframe_config.ul_cyclic_prefix_type.value = NcpP;
+  cfg->subframe_config.ul_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG;
+  cfg->num_tlv++;
  
-  LOG_I(MAC,"Ncp %d,p_eNB %d\n",NcpP,p_eNBP);
+  cfg->rf_config.dl_channel_bandwidth.value        = to_prb(dl_BandwidthP);
+  cfg->rf_config.dl_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG;
+  cfg->num_tlv++;
+  LOG_E(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, dl_BandwidthP);
+
+  cfg->rf_config.ul_channel_bandwidth.value        = to_prb(dl_BandwidthP);
+  cfg->rf_config.ul_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG;
+  cfg->num_tlv++;
 
-  cfg->rf_config.dl_channel_bandwidth.value        = dl_BandwidthP;
-  cfg->rf_config.ul_channel_bandwidth.value        = dl_BandwidthP;
   cfg->rf_config.tx_antenna_ports.value            = p_eNBP;
+  cfg->rf_config.tx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG;
+  cfg->num_tlv++;
+
   cfg->rf_config.rx_antenna_ports.value            = 2;
+  cfg->rf_config.rx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG;
+  cfg->num_tlv++;
 
   cfg->nfapi_config.earfcn.value                   = to_earfcn(eutra_bandP,dl_CarrierFreqP,bw_table[dl_BandwidthP]/100);
+  cfg->nfapi_config.earfcn.tl.tag = NFAPI_NFAPI_EARFCN_TAG;
+  cfg->num_tlv++;
+
   cfg->nfapi_config.rf_bands.number_rf_bands       = 1;
   cfg->nfapi_config.rf_bands.rf_band[0]            = eutra_bandP;  
+  cfg->nfapi_config.rf_bands.tl.tag = NFAPI_PHY_RF_BANDS_TAG;
+  cfg->num_tlv++;
+
   cfg->phich_config.phich_resource.value           = phich_configP->phich_Resource;
+  cfg->phich_config.phich_resource.tl.tag = NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG;
+  cfg->num_tlv++;
+
   cfg->phich_config.phich_duration.value           = phich_configP->phich_Duration;
+  cfg->phich_config.phich_duration.tl.tag = NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG;
+  cfg->num_tlv++;
+
   cfg->phich_config.phich_power_offset.value       = 6000;  // 0dB
+  cfg->phich_config.phich_power_offset.tl.tag = NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG;
+  cfg->num_tlv++;
 
   cfg->sch_config.primary_synchronization_signal_epre_eprers.value   = 6000; // 0dB
+  cfg->sch_config.primary_synchronization_signal_epre_eprers.tl.tag = NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG;
+  cfg->num_tlv++;
+
   cfg->sch_config.secondary_synchronization_signal_epre_eprers.value = 6000; // 0dB
+  cfg->sch_config.secondary_synchronization_signal_epre_eprers.tl.tag = NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG;
+  cfg->num_tlv++;
+
   cfg->sch_config.physical_cell_id.value                             = Nid_cellP;
+  cfg->sch_config.physical_cell_id.tl.tag = NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG;
+  cfg->num_tlv++;
 
 #ifdef Rel14
   cfg->emtc_config.pbch_repetitions_enable_r13.value                 = pbch_repetitionP;
+  cfg->emtc_config.pbch_repetitions_enable_r13.tl.tag = NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG;
+  cfg->num_tlv++;
+#endif  
+  LOG_I(MAC,
+	"%s() NFAPI_CONFIG_REQUEST(num_tlv:%u) DL_BW:%u UL_BW:%u Ncp %d,p_eNB %d,earfcn %d,band %d,phich_resource %u phich_duration %u phich_power_offset %u PSS %d SSS %d PCI %d"
+#ifdef Rel14
+	
+	" PBCH repetition %d"
 #endif  
+	"\n"
+	,__FUNCTION__
+	,cfg->num_tlv
+	,cfg->rf_config.dl_channel_bandwidth.value
+	,cfg->rf_config.ul_channel_bandwidth.value
+	,NcpP,p_eNBP
+	,cfg->nfapi_config.earfcn.value
+	,cfg->nfapi_config.rf_bands.rf_band[0]
+	,cfg->phich_config.phich_resource.value
+	,cfg->phich_config.phich_duration.value
+	,cfg->phich_config.phich_power_offset.value
+	,cfg->sch_config.primary_synchronization_signal_epre_eprers.value
+	,cfg->sch_config.secondary_synchronization_signal_epre_eprers.value
+	,cfg->sch_config.physical_cell_id.value
+#ifdef Rel14
+	,cfg->emtc_config.pbch_repetitions_enable_r13.value
+#endif  
+      );
 }
 
-void config_sib1(int Mod_idP,
-		 int CC_idP,
-		 TDD_Config_t *tdd_ConfigP) {
+void config_sib1(int Mod_idP, int CC_idP, TDD_Config_t * tdd_ConfigP)
+{
+
 
   nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP];
 
   if (tdd_ConfigP)   { //TDD
     cfg->subframe_config.duplex_mode.value                          = 0;
+    cfg->subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG;
+    cfg->num_tlv++;
+
     cfg->tdd_frame_structure_config.subframe_assignment.value       = tdd_ConfigP->subframeAssignment;
+    cfg->tdd_frame_structure_config.subframe_assignment.tl.tag = NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG;
+    cfg->num_tlv++;
+
     cfg->tdd_frame_structure_config.special_subframe_patterns.value = tdd_ConfigP->specialSubframePatterns;
+    cfg->tdd_frame_structure_config.special_subframe_patterns.tl.tag = NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG;
+    cfg->num_tlv++;
   }
   else { // FDD
     cfg->subframe_config.duplex_mode.value                          = 1;
+    cfg->subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG;
+    cfg->num_tlv++;
     // Note no half-duplex here
   }
-
-  
 }
 
-int power_off_dB[6] = {78,118,140,170,188,200};
+int power_off_dB[6] = { 78, 118, 140, 170, 188, 200 };
 
-void config_sib2(int Mod_idP, 
-		 int CC_idP, 
-		 RadioResourceConfigCommonSIB_t   *radioResourceConfigCommonP,
+void
+config_sib2(int Mod_idP,
+	    int CC_idP,
+	    RadioResourceConfigCommonSIB_t * radioResourceConfigCommonP,
 #ifdef Rel14
-		 RadioResourceConfigCommonSIB_t   *radioResourceConfigCommon_BRP,
+	    RadioResourceConfigCommonSIB_t * radioResourceConfigCommon_BRP,
 #endif
-		 ARFCN_ValueEUTRA_t *ul_CArrierFreqP,
-		 long *ul_BandwidthP,
-		 AdditionalSpectrumEmission_t *additionalSpectrumEmissionP,
-		 struct MBSFN_SubframeConfigList  *mbsfn_SubframeConfigListP) {
+            ARFCN_ValueEUTRA_t *ul_CArrierFreqP,
+            long *ul_BandwidthP,
+            AdditionalSpectrumEmission_t *additionalSpectrumEmissionP,
+            struct MBSFN_SubframeConfigList  *mbsfn_SubframeConfigListP) {
 
   nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP];
 
   cfg->subframe_config.pb.value               = radioResourceConfigCommonP->pdsch_ConfigCommon.p_b;
+  cfg->subframe_config.pb.tl.tag = NFAPI_SUBFRAME_CONFIG_PB_TAG;
+  cfg->num_tlv++;
+
   cfg->rf_config.reference_signal_power.value = radioResourceConfigCommonP->pdsch_ConfigCommon.referenceSignalPower;
+  cfg->rf_config.reference_signal_power.tl.tag = NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG;
+  cfg->num_tlv++;
+
   cfg->nfapi_config.max_transmit_power.value  = cfg->rf_config.reference_signal_power.value + power_off_dB[cfg->rf_config.dl_channel_bandwidth.value];
+  cfg->nfapi_config.max_transmit_power.tl.tag = NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG;
+  cfg->num_tlv++;
 
   cfg->prach_config.configuration_index.value                 = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
+  cfg->prach_config.configuration_index.tl.tag = NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG;
+  cfg->num_tlv++;
+
   cfg->prach_config.root_sequence_index.value                 = radioResourceConfigCommonP->prach_Config.rootSequenceIndex;
+  cfg->prach_config.root_sequence_index.tl.tag = NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG;
+  cfg->num_tlv++;
+
   cfg->prach_config.zero_correlation_zone_configuration.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
+  cfg->prach_config.zero_correlation_zone_configuration.tl.tag = NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG;
+  cfg->num_tlv++;
+
   cfg->prach_config.high_speed_flag.value                     = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.highSpeedFlag;
+  cfg->prach_config.high_speed_flag.tl.tag = NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG;
+  cfg->num_tlv++;
+
   cfg->prach_config.frequency_offset.value                    = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_FreqOffset;
+  cfg->prach_config.frequency_offset.tl.tag = NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG;
+  cfg->num_tlv++;
+
 
   cfg->pusch_config.hopping_mode.value                        = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
+  cfg->pusch_config.hopping_mode.tl.tag = NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG;
+  cfg->num_tlv++;
+
   cfg->pusch_config.number_of_subbands.value                  = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
-  cfg->pusch_config.hopping_offset.value                      = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
+  cfg->pusch_config.number_of_subbands.tl.tag = NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG;
+  cfg->num_tlv++;
 
+  cfg->pusch_config.hopping_offset.value                      = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
+  cfg->pusch_config.hopping_offset.tl.tag = NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG;
+  cfg->num_tlv++;
 
-		
   cfg->pucch_config.delta_pucch_shift.value                         = radioResourceConfigCommonP->pucch_ConfigCommon.deltaPUCCH_Shift;
+  cfg->pucch_config.delta_pucch_shift.tl.tag = NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG;
+  cfg->num_tlv++;
+
   cfg->pucch_config.n_cqi_rb.value                                  = radioResourceConfigCommonP->pucch_ConfigCommon.nRB_CQI;
+  cfg->pucch_config.n_cqi_rb.tl.tag = NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG;
+  cfg->num_tlv++;
+
   cfg->pucch_config.n_an_cs.value                                   = radioResourceConfigCommonP->pucch_ConfigCommon.nCS_AN;
+  cfg->pucch_config.n_an_cs.tl.tag = NFAPI_PUCCH_CONFIG_N_AN_CS_TAG;
+  cfg->num_tlv++;
+
   cfg->pucch_config.n1_pucch_an.value                               = radioResourceConfigCommonP->pucch_ConfigCommon.n1PUCCH_AN;
+  cfg->pucch_config.n1_pucch_an.tl.tag = NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG;
+  cfg->num_tlv++;
 
-  if (radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == true)
+  if (radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == true) {
     cfg->uplink_reference_signal_config.uplink_rs_hopping.value     = 1;
-  else if (radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled == true)
+  }
+  else if (radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled == true) {
     cfg->uplink_reference_signal_config.uplink_rs_hopping.value     = 2;
-  else // No hopping
+  }
+  else {
     cfg->uplink_reference_signal_config.uplink_rs_hopping.value     = 0;
+  }
+  cfg->uplink_reference_signal_config.uplink_rs_hopping.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG;
+  cfg->num_tlv++;
 
   cfg->uplink_reference_signal_config.group_assignment.value        = radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
+  cfg->uplink_reference_signal_config.group_assignment.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG;
+  cfg->num_tlv++;
+
   cfg->uplink_reference_signal_config.cyclic_shift_1_for_drms.value = radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift;
+  cfg->uplink_reference_signal_config.cyclic_shift_1_for_drms.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG;
+  cfg->num_tlv++;
+
 
   // how to enable/disable SRS?
   if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) {
     cfg->srs_config.bandwidth_configuration.value                       = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
+    cfg->srs_config.bandwidth_configuration.tl.tag = NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG;
+    cfg->num_tlv++;
+
     cfg->srs_config.srs_subframe_configuration.value                    = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
-    cfg->srs_config.srs_acknack_srs_simultaneous_transmission.value     = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
+    cfg->srs_config.srs_subframe_configuration.tl.tag = NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG;
+    cfg->num_tlv++;
 
-    if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
+    cfg->srs_config.srs_acknack_srs_simultaneous_transmission.value     = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
+    cfg->srs_config.srs_acknack_srs_simultaneous_transmission.tl.tag = NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG;
+    cfg->num_tlv++;
+    
+    if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts) {
        cfg->srs_config.max_up_pts.value                                 = 1;
-    else
+    }
+    else {
        cfg->srs_config.max_up_pts.value                                 = 0;
+    }
+    cfg->srs_config.max_up_pts.tl.tag = NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG;
+    cfg->num_tlv++;
   }
 
 #ifdef Rel14
-  if (RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.schedulingInfoSIB1_BR_r13>0) {
-    AssertFatal(radioResourceConfigCommon_BRP!=NULL,"radioResource rou is missing\n");
-    AssertFatal(radioResourceConfigCommon_BRP->ext4!=NULL,"ext4 is missing\n");
-    cfg->emtc_config.prach_catm_root_sequence_index.value                 = radioResourceConfigCommon_BRP->prach_Config.rootSequenceIndex;
+  if (RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.schedulingInfoSIB1_BR_r13 > 0) {
+    AssertFatal(radioResourceConfigCommon_BRP != NULL, "radioResource rou is missing\n");
+    AssertFatal(radioResourceConfigCommon_BRP->ext4 != NULL, "ext4 is missing\n");
+    cfg->emtc_config.prach_catm_root_sequence_index.value = radioResourceConfigCommon_BRP->prach_Config.rootSequenceIndex;
+    cfg->emtc_config.prach_catm_root_sequence_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG;
+    cfg->num_tlv++;
+
     cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.value = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
-    cfg->emtc_config.prach_catm_high_speed_flag.value                     = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.highSpeedFlag;
- 
-    struct PRACH_ConfigSIB_v1310 *ext4_prach=radioResourceConfigCommon_BRP->ext4->prach_ConfigCommon_v1310; 
+    cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG;
+    cfg->num_tlv++;
+
+    cfg->emtc_config.prach_catm_high_speed_flag.value = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.highSpeedFlag;
+    cfg->emtc_config.prach_catm_high_speed_flag.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG;
+    cfg->num_tlv++;
 
-    PRACH_ParametersListCE_r13_t	 *prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+    struct PRACH_ConfigSIB_v1310 *ext4_prach = radioResourceConfigCommon_BRP->ext4->prach_ConfigCommon_v1310;
+
+    PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
 
     PRACH_ParametersCE_r13_t *p;
-    cfg->emtc_config.prach_ce_level_0_enable.value=0;
-    cfg->emtc_config.prach_ce_level_1_enable.value=0;
-    cfg->emtc_config.prach_ce_level_2_enable.value=0;
-    cfg->emtc_config.prach_ce_level_3_enable.value=0;
+    cfg->emtc_config.prach_ce_level_0_enable.value = 0;
+    cfg->emtc_config.prach_ce_level_0_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG;
+    cfg->num_tlv++;
+
+    cfg->emtc_config.prach_ce_level_1_enable.value = 0;
+    cfg->emtc_config.prach_ce_level_1_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG;
+    cfg->num_tlv++;
+
+    cfg->emtc_config.prach_ce_level_2_enable.value = 0;
+    cfg->emtc_config.prach_ce_level_2_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG;
+    cfg->num_tlv++;
+
+    cfg->emtc_config.prach_ce_level_3_enable.value = 0;
+    cfg->emtc_config.prach_ce_level_3_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG;
+    cfg->num_tlv++;
+
     switch (prach_ParametersListCE_r13->list.count) {
     case 4:
-      p=prach_ParametersListCE_r13->list.array[3];
-      cfg->emtc_config.prach_ce_level_3_enable.value                            = 1;
+      p = prach_ParametersListCE_r13->list.array[3];
+      cfg->emtc_config.prach_ce_level_3_enable.value = 1;
+      cfg->emtc_config.prach_ce_level_3_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_3_configuration_index.value               = p->prach_ConfigIndex_r13;
+      cfg->emtc_config.prach_ce_level_3_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_3_frequency_offset.value                  = p->prach_FreqOffset_r13;
+      cfg->emtc_config.prach_ce_level_3_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13;
-      if (p->prach_StartingSubframe_r13) 
+      cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+      cfg->num_tlv++;
+
+      if (p->prach_StartingSubframe_r13) {
 	cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.value   = *p->prach_StartingSubframe_r13;
+        cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.tl.tag  = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG;
+        cfg->num_tlv++;
+      }
+
       cfg->emtc_config.prach_ce_level_3_hopping_enable.value                    = p->prach_HoppingConfig_r13;
-      cfg->emtc_config.prach_ce_level_3_hopping_offset.value                    = cfg->rf_config.ul_channel_bandwidth.value-6;
+      cfg->emtc_config.prach_ce_level_3_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG;
+      cfg->num_tlv++;
+
+      cfg->emtc_config.prach_ce_level_3_hopping_offset.value                    = cfg->rf_config.ul_channel_bandwidth.value - 6;
+      cfg->emtc_config.prach_ce_level_3_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG;
+      cfg->num_tlv++;
+
     case 3:
-      p=prach_ParametersListCE_r13->list.array[2];
-      cfg->emtc_config.prach_ce_level_2_enable.value                            = 1;
+      p = prach_ParametersListCE_r13->list.array[2];
+      cfg->emtc_config.prach_ce_level_2_enable.value = 1;
+      cfg->emtc_config.prach_ce_level_2_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_2_configuration_index.value               = p->prach_ConfigIndex_r13;
+      cfg->emtc_config.prach_ce_level_2_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_2_frequency_offset.value                  = p->prach_FreqOffset_r13;
+      cfg->emtc_config.prach_ce_level_2_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13;
-      if (p->prach_StartingSubframe_r13) 
+      cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+      cfg->num_tlv++;
+
+      if (p->prach_StartingSubframe_r13) {
 	cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.value   = *p->prach_StartingSubframe_r13;
+        cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.tl.tag  = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG;
+        cfg->num_tlv++;
+      }
+
       cfg->emtc_config.prach_ce_level_2_hopping_enable.value                    = p->prach_HoppingConfig_r13;
-      cfg->emtc_config.prach_ce_level_2_hopping_offset.value                    = cfg->rf_config.ul_channel_bandwidth.value-6;
+      cfg->emtc_config.prach_ce_level_2_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG;
+      cfg->num_tlv++;
+
+      cfg->emtc_config.prach_ce_level_2_hopping_offset.value                    = cfg->rf_config.ul_channel_bandwidth.value - 6;
+      cfg->emtc_config.prach_ce_level_2_hopping_offset.tl.tag                   = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG;
+      cfg->num_tlv++;
+
     case 2:
-      p=prach_ParametersListCE_r13->list.array[1];
-      cfg->emtc_config.prach_ce_level_1_enable.value                            = 1;
+      p = prach_ParametersListCE_r13->list.array[1];
+      cfg->emtc_config.prach_ce_level_1_enable.value = 1;
+      cfg->emtc_config.prach_ce_level_1_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_1_configuration_index.value               = p->prach_ConfigIndex_r13;
+      cfg->emtc_config.prach_ce_level_1_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_1_frequency_offset.value                  = p->prach_FreqOffset_r13;
+      cfg->emtc_config.prach_ce_level_1_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13;
-      if (p->prach_StartingSubframe_r13) 
+      cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+      cfg->num_tlv++;
+
+      if (p->prach_StartingSubframe_r13) {
 	cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.value   = *p->prach_StartingSubframe_r13;
+        cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.tl.tag  = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG;
+        cfg->num_tlv++;
+      }
+
       cfg->emtc_config.prach_ce_level_1_hopping_enable.value                    = p->prach_HoppingConfig_r13;
-      cfg->emtc_config.prach_ce_level_1_hopping_offset.value                    = cfg->rf_config.ul_channel_bandwidth.value-6;
+      cfg->emtc_config.prach_ce_level_1_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG;
+      cfg->num_tlv++;
+
+      cfg->emtc_config.prach_ce_level_1_hopping_offset.value                    = cfg->rf_config.ul_channel_bandwidth.value - 6;
+      cfg->emtc_config.prach_ce_level_1_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG;
+      cfg->num_tlv++;
+
     case 1:
-      p=prach_ParametersListCE_r13->list.array[0];
+      p = prach_ParametersListCE_r13->list.array[0];
       cfg->emtc_config.prach_ce_level_0_enable.value                            = 1;
+      cfg->emtc_config.prach_ce_level_0_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_0_configuration_index.value               = p->prach_ConfigIndex_r13;
+      cfg->emtc_config.prach_ce_level_0_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_0_frequency_offset.value                  = p->prach_FreqOffset_r13;
+      cfg->emtc_config.prach_ce_level_0_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG;
+      cfg->num_tlv++;
+
       cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13;
-      if (p->prach_StartingSubframe_r13) 
+      cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+      cfg->num_tlv++;
+
+      if (p->prach_StartingSubframe_r13) {
 	cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value   = *p->prach_StartingSubframe_r13;
+        cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.tl.tag  = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG;
+        cfg->num_tlv++;
+      }
+
       cfg->emtc_config.prach_ce_level_0_hopping_enable.value                    = p->prach_HoppingConfig_r13;
-      cfg->emtc_config.prach_ce_level_0_hopping_offset.value                    = cfg->rf_config.ul_channel_bandwidth.value-6;
+      cfg->emtc_config.prach_ce_level_0_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG;
+      cfg->num_tlv++;
+
+      cfg->emtc_config.prach_ce_level_0_hopping_offset.value                    = cfg->rf_config.ul_channel_bandwidth.value - 6;
+      cfg->emtc_config.prach_ce_level_0_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG;
+      cfg->num_tlv++;
     }
 
     struct FreqHoppingParameters_r13 *ext4_freqHoppingParameters = radioResourceConfigCommonP->ext4->freqHoppingParameters_r13;
-    if ((ext4_freqHoppingParameters) && 
-	(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13)){
+    if ((ext4_freqHoppingParameters) &&
+        (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13)){
       switch(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->present) {
-      case 	FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_NOTHING:	/* No components present */
-	break;
+      case      FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_NOTHING:  /* No components present */
+        break;
       case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_FDD_r13:
-	cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->choice.interval_FDD_r13;
-	break;
+        cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->choice.interval_FDD_r13;
+        cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG;
+        cfg->num_tlv++;
+        break;
       case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_TDD_r13:
-	cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->choice.interval_TDD_r13;
-	break;
+        cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->choice.interval_TDD_r13;
+        cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG;
+        cfg->num_tlv++;
+        break;
       }
     }
-    if ((ext4_freqHoppingParameters) && 
-	(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13)){
+    if ((ext4_freqHoppingParameters) &&
+        (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13)){
       switch(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->present) {
-      case 	FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_NOTHING:	/* No components present */
-	break;
+      case      FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_NOTHING:  /* No components present */
+        break;
       case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_FDD_r13:
-	cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->choice.interval_FDD_r13;
-	break;
+        cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->choice.interval_FDD_r13;
+        cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG;
+        cfg->num_tlv++;
+        break;
       case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_TDD_r13:
-	cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->choice.interval_TDD_r13;
-	break;
+        cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->choice.interval_TDD_r13;
+        cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG;
+        cfg->num_tlv++;
+        break;
       }
     }
   }
@@ -414,62 +653,72 @@ void config_sib2(int Mod_idP,
 
 }
 
-void config_dedicated(int Mod_idP, 
-		      int CC_idP, 
-		      uint16_t rnti, 
-		      struct PhysicalConfigDedicated  *physicalConfigDedicated) {
+void
+config_dedicated(int Mod_idP,
+		 int CC_idP,
+		 uint16_t rnti,
+		 struct PhysicalConfigDedicated *physicalConfigDedicated)
+{
 
 }
 
-void config_dedicated_scell(int Mod_idP, 
-			    uint16_t rnti, 
-			    SCellToAddMod_r10_t *sCellToAddMod_r10) {
+void
+config_dedicated_scell(int Mod_idP,
+		       uint16_t rnti,
+		       SCellToAddMod_r10_t * sCellToAddMod_r10)
+{
 
 }
 
-int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
-			   int                              CC_idP,
-			   int                              physCellId,
-			   int                              p_eNB,
-			   int                              Ncp,
-			   int                              eutra_band,
-			   uint32_t                         dl_CarrierFreq,
+
+int
+rrc_mac_config_req_eNB(module_id_t Mod_idP,
+		       int CC_idP,
+		       int physCellId,
+		       int p_eNB,
+		       int Ncp, int eutra_band, uint32_t dl_CarrierFreq,
 #ifdef Rel14
-                           int                              pbch_repetition,
+		       int pbch_repetition,
 #endif
-			   rnti_t                           rntiP,
-			   BCCH_BCH_Message_t               *mib,
-			   RadioResourceConfigCommonSIB_t   *radioResourceConfigCommon,
+		       rnti_t rntiP,
+		       BCCH_BCH_Message_t * mib,
+		       RadioResourceConfigCommonSIB_t *
+		       radioResourceConfigCommon,
 #ifdef Rel14
-			   RadioResourceConfigCommonSIB_t   *radioResourceConfigCommon_BR,
+		       RadioResourceConfigCommonSIB_t *
+		       radioResourceConfigCommon_BR,
 #endif
-			   struct PhysicalConfigDedicated  *physicalConfigDedicated,
+		       struct PhysicalConfigDedicated
+		       *physicalConfigDedicated,
 #if defined(Rel10) || defined(Rel14)
-			   SCellToAddMod_r10_t *sCellToAddMod_r10,
-			   //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+		       SCellToAddMod_r10_t * sCellToAddMod_r10,
+		       //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
 #endif
-			   MeasObjectToAddMod_t                    **measObj,
-			   MAC_MainConfig_t                        *mac_MainConfig,
-			   long                                    logicalChannelIdentity,
-			   LogicalChannelConfig_t                  *logicalChannelConfig,
-			   MeasGapConfig_t                         *measGapConfig,
-			   TDD_Config_t                            *tdd_Config,
-			   MobilityControlInfo_t                   *mobilityControlInfo,
-			   SchedulingInfoList_t                    *schedulingInfoList,
-			   uint32_t                                ul_CarrierFreq,
-			   long                                    *ul_Bandwidth,
-			   AdditionalSpectrumEmission_t            *additionalSpectrumEmission,
-			   struct MBSFN_SubframeConfigList         *mbsfn_SubframeConfigList
+		       MeasObjectToAddMod_t ** measObj,
+		       MAC_MainConfig_t * mac_MainConfig,
+		       long logicalChannelIdentity,
+		       LogicalChannelConfig_t * logicalChannelConfig,
+		       MeasGapConfig_t * measGapConfig,
+		       TDD_Config_t * tdd_Config,
+		       MobilityControlInfo_t * mobilityControlInfo,
+		       SchedulingInfoList_t * schedulingInfoList,
+		       uint32_t ul_CarrierFreq,
+		       long *ul_Bandwidth,
+		       AdditionalSpectrumEmission_t *
+		       additionalSpectrumEmission,
+		       struct MBSFN_SubframeConfigList
+		       *mbsfn_SubframeConfigList
 #if defined(Rel10) || defined(Rel14)
-			   ,uint8_t                                MBMS_Flag,
-			   MBSFN_AreaInfoList_r9_t                 *mbsfn_AreaInfoList,
-			   PMCH_InfoList_r9_t                      *pmch_InfoList
+		       , uint8_t MBMS_Flag,
+		       MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList,
+		       PMCH_InfoList_r9_t * pmch_InfoList
 #endif
 #ifdef Rel14
-			   ,
-			   SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext
+		       ,
+		       SystemInformationBlockType1_v1310_IEs_t *
+		       sib1_v13ext
 #endif
-			   ) {
+                       ) {
 			   
   int i;
 
@@ -479,18 +728,20 @@ int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
 
-  
-  if (mib!=NULL) {
-    if (RC.mac == NULL) l2_init_eNB();
+  LOG_E(MAC, "RC.mac:%p mib:%p\n", RC.mac, mib);
+
+  if (mib != NULL) {
+    if (RC.mac == NULL)
+      l2_init_eNB();
 
     mac_top_init_eNB();
 
-    RC.mac[Mod_idP]->common_channels[CC_idP].mib             = mib;
-    RC.mac[Mod_idP]->common_channels[CC_idP].physCellId      = physCellId;
-    RC.mac[Mod_idP]->common_channels[CC_idP].p_eNB           = p_eNB;
-    RC.mac[Mod_idP]->common_channels[CC_idP].Ncp             = Ncp;
-    RC.mac[Mod_idP]->common_channels[CC_idP].eutra_band      = eutra_band;
-    RC.mac[Mod_idP]->common_channels[CC_idP].dl_CarrierFreq  = dl_CarrierFreq;
+    RC.mac[Mod_idP]->common_channels[CC_idP].mib = mib;
+    RC.mac[Mod_idP]->common_channels[CC_idP].physCellId = physCellId;
+    RC.mac[Mod_idP]->common_channels[CC_idP].p_eNB = p_eNB;
+    RC.mac[Mod_idP]->common_channels[CC_idP].Ncp = Ncp;
+    RC.mac[Mod_idP]->common_channels[CC_idP].eutra_band = eutra_band;
+    RC.mac[Mod_idP]->common_channels[CC_idP].dl_CarrierFreq = dl_CarrierFreq;
 
     LOG_I(MAC,
 	  "Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
@@ -514,78 +765,116 @@ int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
 	       dl_CarrierFreq,
 	       ul_CarrierFreq
 #ifdef Rel14
-	       ,pbch_repetition
+	       , pbch_repetition
 #endif
 	       );
 
     mac_init_cell_params(Mod_idP,CC_idP);
-  }
-  if (schedulingInfoList!=NULL)  {
-    RC.mac[Mod_idP]->common_channels[CC_idP].tdd_Config         = tdd_Config;    
-    RC.mac[Mod_idP]->common_channels[CC_idP].schedulingInfoList = schedulingInfoList;    
-    config_sib1(Mod_idP,CC_idP,tdd_Config);
-  }
+
+    if (schedulingInfoList!=NULL)  {
+      RC.mac[Mod_idP]->common_channels[CC_idP].tdd_Config         = tdd_Config;    
+      RC.mac[Mod_idP]->common_channels[CC_idP].schedulingInfoList = schedulingInfoList;    
+      config_sib1(Mod_idP,CC_idP,tdd_Config);
+    }
 #ifdef Rel14
-  if (sib1_v13ext != NULL) {
-    RC.mac[Mod_idP]->common_channels[CC_idP].sib1_v13ext        = sib1_v13ext;    
-  }
+    if (sib1_v13ext != NULL) {
+      RC.mac[Mod_idP]->common_channels[CC_idP].sib1_v13ext = sib1_v13ext;
+    }
 #endif
-  if (radioResourceConfigCommon!=NULL) {
-      LOG_I(MAC,"[CONFIG]SIB2/3 Contents (partial)\n");
-      LOG_I(MAC,"[CONFIG]pusch_config_common.n_SB = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB);
-      LOG_I(MAC,"[CONFIG]pusch_config_common.hoppingMode = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode);
-      LOG_I(MAC,"[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n",  radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset);
-      LOG_I(MAC,"[CONFIG]pusch_config_common.enable64QAM = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM);
-      LOG_I(MAC,"[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
-      LOG_I(MAC,"[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
-      LOG_I(MAC,"[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
-      LOG_I(MAC,"[CONFIG]pusch_config_common.cyclicShift  = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift);
-
-      AssertFatal(radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx > 0,
+    if (radioResourceConfigCommon != NULL) {
+      LOG_I(MAC, "[CONFIG]SIB2/3 Contents (partial)\n");
+      LOG_I(MAC, "[CONFIG]pusch_config_common.n_SB = %ld\n",
+	    radioResourceConfigCommon->
+	    pusch_ConfigCommon.pusch_ConfigBasic.n_SB);
+      LOG_I(MAC, "[CONFIG]pusch_config_common.hoppingMode = %ld\n",
+	    radioResourceConfigCommon->
+	    pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode);
+      LOG_I(MAC,
+	    "[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n",
+	    radioResourceConfigCommon->
+	    pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset);
+      LOG_I(MAC, "[CONFIG]pusch_config_common.enable64QAM = %d\n",
+	    radioResourceConfigCommon->
+	    pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM);
+      LOG_I(MAC,
+	    "[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n",
+	    radioResourceConfigCommon->
+	    pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.
+	    groupHoppingEnabled);
+      LOG_I(MAC,
+	    "[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n",
+	    radioResourceConfigCommon->
+	    pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.
+	    groupAssignmentPUSCH);
+      LOG_I(MAC,
+	    "[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n",
+	    radioResourceConfigCommon->
+	    pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.
+	    sequenceHoppingEnabled);
+      LOG_I(MAC, "[CONFIG]pusch_config_common.cyclicShift  = %ld\n",
+	    radioResourceConfigCommon->
+	    pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift);
+
+      AssertFatal(radioResourceConfigCommon->
+		  rach_ConfigCommon.maxHARQ_Msg3Tx > 0,
 		  "radioResourceconfigCommon %d == 0\n",
-		  (int)radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
-
-      RC.mac[Mod_idP]->common_channels[CC_idP].radioResourceConfigCommon = radioResourceConfigCommon;
-      if (ul_CarrierFreq>0) RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq          = ul_CarrierFreq;
-      if (ul_Bandwidth) RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth                = *ul_Bandwidth;
-      else RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth                             = RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.dl_Bandwidth;
+		  (int) radioResourceConfigCommon->
+		  rach_ConfigCommon.maxHARQ_Msg3Tx);
+
+      RC.mac[Mod_idP]->common_channels[CC_idP].
+	radioResourceConfigCommon = radioResourceConfigCommon;
+      if (ul_CarrierFreq > 0)
+	RC.mac[Mod_idP]->common_channels[CC_idP].ul_CarrierFreq =
+	  ul_CarrierFreq;
+      if (ul_Bandwidth)
+	RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth =
+	  *ul_Bandwidth;
+      else
+	RC.mac[Mod_idP]->common_channels[CC_idP].ul_Bandwidth =
+	  RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.
+	  dl_Bandwidth;
 
-      config_sib2(Mod_idP, CC_idP, 
-		  radioResourceConfigCommon, 
+      config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon,
 #ifdef Rel14
-		  radioResourceConfigCommon_BR, 
+		  radioResourceConfigCommon_BR,
 #endif
-		  NULL, ul_Bandwidth, additionalSpectrumEmission, mbsfn_SubframeConfigList);
-
+		  NULL, ul_Bandwidth, additionalSpectrumEmission,
+		  mbsfn_SubframeConfigList);
 
-  }
 
+    }
+  } // mib != NULL
 
   // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup
-  if (logicalChannelConfig!= NULL) { // check for eMTC specific things
+  if (logicalChannelConfig != NULL) {	// check for eMTC specific things
     UE_id = find_UE_id(Mod_idP, rntiP);
 
     if (UE_id == -1) {
-      LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
+      LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__,
+	    __LINE__, __FUNCTION__);
     } else {
       if (logicalChannelConfig)
-	UE_list->UE_template[CC_idP][UE_id].lcgidmap[logicalChannelIdentity] = *logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup;
+        UE_list->
+          UE_template[CC_idP][UE_id].lcgidmap
+          [logicalChannelIdentity] =
+          *logicalChannelConfig->
+	  ul_SpecificParameters->logicalChannelGroup;
       else
-	UE_list->UE_template[CC_idP][UE_id].lcgidmap[logicalChannelIdentity] = 0;
+        UE_list->
+          UE_template[CC_idP][UE_id].lcgidmap
+          [logicalChannelIdentity] = 0;
     }
   }
-  
+
 
   if (physicalConfigDedicated != NULL) {
     UE_id = find_UE_id(Mod_idP, rntiP);
 
     if (UE_id == -1)
-      LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
+      LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
     else
-      UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated=physicalConfigDedicated;
-  } 
-
-
+      UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated = physicalConfigDedicated;
+  }
 
 
 #if defined(Rel10) || defined(Rel14)
@@ -593,36 +882,42 @@ int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
   if (sCellToAddMod_r10 != NULL) {
     UE_id = find_UE_id(Mod_idP, rntiP);
     if (UE_id == -1)
-      LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
+      LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n", __FILE__,
+	    __LINE__, __FUNCTION__);
     else
-      config_dedicated_scell(Mod_idP,rntiP,sCellToAddMod_r10);
-    
+      config_dedicated_scell(Mod_idP, rntiP, sCellToAddMod_r10);
   }
-
 #endif
 
 
 
 
   if (mbsfn_SubframeConfigList != NULL) {
-    LOG_I(MAC,"[eNB %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", Mod_idP, mbsfn_SubframeConfigList->list.count);
-    RC.mac[Mod_idP]->common_channels[0].num_sf_allocation_pattern= mbsfn_SubframeConfigList->list.count;
-    
-    for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
-      RC.mac[Mod_idP]->common_channels[0].mbsfn_SubframeConfig[i] = mbsfn_SubframeConfigList->list.array[i];
-      LOG_I(MAC, "[eNB %d][CONFIG] MBSFN_SubframeConfig[%d] pattern is  %x\n", Mod_idP, i,
-	    RC.mac[Mod_idP]->common_channels[0].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
+    LOG_I(MAC,
+	  "[eNB %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n",
+	  Mod_idP, mbsfn_SubframeConfigList->list.count);
+    RC.mac[Mod_idP]->common_channels[0].num_sf_allocation_pattern =
+      mbsfn_SubframeConfigList->list.count;
+
+    for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) {
+      RC.mac[Mod_idP]->common_channels[0].mbsfn_SubframeConfig[i] =
+	mbsfn_SubframeConfigList->list.array[i];
+      LOG_I(MAC,
+	    "[eNB %d][CONFIG] MBSFN_SubframeConfig[%d] pattern is  %x\n",
+	    Mod_idP, i,
+	    RC.mac[Mod_idP]->
+	    common_channels[0].mbsfn_SubframeConfig[i]->
+	    subframeAllocation.choice.oneFrame.buf[0]);
     }
-    
+
 #ifdef Rel10
     RC.mac[Mod_idP]->common_channels[0].MBMS_flag = MBMS_Flag;
 #endif
   }
-
 #if defined(Rel10) || defined(Rel14)
 
   if (mbsfn_AreaInfoList != NULL) {
-      // One eNB could be part of multiple mbsfn syc area, this could change over time so reset each time
+    // One eNB could be part of multiple mbsfn syc area, this could change over time so reset each time
     LOG_I(MAC,"[eNB %d][CONFIG] Received %d MBSFN Area Info\n", Mod_idP, mbsfn_AreaInfoList->list.count);
     RC.mac[Mod_idP]->common_channels[0].num_active_mbsfn_area = mbsfn_AreaInfoList->list.count;
     
@@ -635,393 +930,64 @@ int rrc_mac_config_req_eNB(module_id_t                      Mod_idP,
   } 
 
   if (pmch_InfoList != NULL) {
-
+    
     //    LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
-
-    LOG_I(MAC, "[CONFIG] Number of PMCH in this MBSFN Area %d\n", pmch_InfoList->list.count);
     
-    for (i =0; i< pmch_InfoList->list.count; i++) {
-      RC.mac[Mod_idP]->common_channels[0].pmch_Config[i] = &pmch_InfoList->list.array[i]->pmch_Config_r9;
+    LOG_I(MAC, "[CONFIG] Number of PMCH in this MBSFN Area %d\n",
+	  pmch_InfoList->list.count);
+    
+    for (i = 0; i < pmch_InfoList->list.count; i++) {
+      RC.mac[Mod_idP]->common_channels[0].pmch_Config[i] =
+	&pmch_InfoList->list.array[i]->pmch_Config_r9;
       
-      LOG_I(MAC, "[CONFIG] PMCH[%d]: This PMCH stop (sf_AllocEnd_r9) at subframe  %ldth\n", i,
-	    RC.mac[Mod_idP]->common_channels[0].pmch_Config[i]->sf_AllocEnd_r9);
-      LOG_I(MAC, "[CONFIG] PMCH[%d]: mch_Scheduling_Period = %ld\n", i,
-	    RC.mac[Mod_idP]->common_channels[0].pmch_Config[i]->mch_SchedulingPeriod_r9);
+      LOG_I(MAC,
+	    "[CONFIG] PMCH[%d]: This PMCH stop (sf_AllocEnd_r9) at subframe  %ldth\n",
+	    i,
+	    RC.mac[Mod_idP]->common_channels[0].
+	    pmch_Config[i]->sf_AllocEnd_r9);
+      LOG_I(MAC, "[CONFIG] PMCH[%d]: mch_Scheduling_Period = %ld\n",
+	    i,
+	    RC.mac[Mod_idP]->common_channels[0].
+	    pmch_Config[i]->mch_SchedulingPeriod_r9);
       LOG_I(MAC, "[CONFIG] PMCH[%d]: dataMCS = %ld\n", i,
-	    RC.mac[Mod_idP]->common_channels[0].pmch_Config[i]->dataMCS_r9);
+	    RC.mac[Mod_idP]->common_channels[0].
+	    pmch_Config[i]->dataMCS_r9);
       
       // MBMS session info list in each MCH
-      RC.mac[Mod_idP]->common_channels[0].mbms_SessionList[i] = &pmch_InfoList->list.array[i]->mbms_SessionInfoList_r9;
-      LOG_I(MAC, "PMCH[%d] Number of session (MTCH) is: %d\n",i, RC.mac[Mod_idP]->common_channels[0].mbms_SessionList[i]->list.count);
+      RC.mac[Mod_idP]->common_channels[0].mbms_SessionList[i] =
+	&pmch_InfoList->list.array[i]->mbms_SessionInfoList_r9;
+      LOG_I(MAC, "PMCH[%d] Number of session (MTCH) is: %d\n", i,
+	    RC.mac[Mod_idP]->common_channels[0].
+	    mbms_SessionList[i]->list.count);
     }
   }
-
-#endif
-
-  if (radioResourceConfigCommon!=NULL) {
-    AssertFatal(RC.mac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
-    PHY_Config_t phycfg;
-    phycfg.Mod_id = Mod_idP;
-    phycfg.CC_id  = CC_idP;
-    phycfg.cfg    = &RC.mac[Mod_idP]->config[CC_idP];
-    
-    if (RC.mac[Mod_idP]->if_inst->PHY_config_req) RC.mac[Mod_idP]->if_inst->PHY_config_req(&phycfg); 
-  }
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
   
-  return(0);			     
-}
-
-int
-rrc_mac_config_req_ue(
-  module_id_t                      Mod_idP,
-  int                              CC_idP,
-  uint8_t                          eNB_index,
-  RadioResourceConfigCommonSIB_t  *radioResourceConfigCommon,
-  struct PhysicalConfigDedicated  *physicalConfigDedicated,
-#if defined(Rel10) || defined(Rel14)
-  SCellToAddMod_r10_t *sCellToAddMod_r10,
-  //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
-#endif
-  MeasObjectToAddMod_t           **measObj,
-  MAC_MainConfig_t                *mac_MainConfig,
-  long                             logicalChannelIdentity,
-  LogicalChannelConfig_t          *logicalChannelConfig,
-  MeasGapConfig_t                 *measGapConfig,
-  TDD_Config_t                    *tdd_Config,
-  MobilityControlInfo_t           *mobilityControlInfo,
-  uint8_t                              *SIwindowsize,
-  uint16_t                             *SIperiod,
-  ARFCN_ValueEUTRA_t              *ul_CarrierFreq,
-  long                            *ul_Bandwidth,
-  AdditionalSpectrumEmission_t    *additionalSpectrumEmission,
-  struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
-#if defined(Rel10) || defined(Rel14)
-  ,uint8_t                              MBMS_Flag,
-  MBSFN_AreaInfoList_r9_t         *mbsfn_AreaInfoList,
-  PMCH_InfoList_r9_t              *pmch_InfoList
-#endif
-#ifdef CBA
-  ,uint8_t                              num_active_cba_groups,
-  uint16_t                              cba_rnti
-#endif
-                      )
-{
-
-  int i;
-
-  int UE_id = -1;
- 
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
-
-  LOG_I(MAC,"[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n",Mod_idP,eNB_index);
-  
-  if (tdd_Config != NULL) {
-    UE_mac_inst[Mod_idP].tdd_Config = tdd_Config;
-  }
- 
-
-  if (tdd_Config && SIwindowsize && SIperiod) {
-    phy_config_sib1_ue(Mod_idP,0,eNB_index,tdd_Config,*SIwindowsize,*SIperiod);
-  }
-
-  if (radioResourceConfigCommon!=NULL) {
-    UE_mac_inst[Mod_idP].radioResourceConfigCommon = radioResourceConfigCommon;
-    phy_config_sib2_ue(Mod_idP,0,eNB_index,radioResourceConfigCommon,ul_CarrierFreq,ul_Bandwidth,additionalSpectrumEmission,mbsfn_SubframeConfigList);
-  }
-
-  // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup
-  if (logicalChannelConfig!= NULL) {
-    LOG_I(MAC,"[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n",Mod_idP,eNB_index);
-    UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity]=logicalChannelConfig;
-    UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity]=0; // initilize the bucket for this lcid
-    
-    AssertFatal(logicalChannelConfig->ul_SpecificParameters!=NULL,
-		"[UE %d] LCID %ld NULL ul_SpecificParameters\n",
-		Mod_idP,logicalChannelIdentity);
-    UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity]=logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate *
-      logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size
-    if (logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup != NULL) {
-      UE_mac_inst[Mod_idP].scheduling_info.LCGID[logicalChannelIdentity]=*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup;
-      LOG_D(MAC,"[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n",Mod_idP,logicalChannelIdentity,*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup);
-    }
-    else {
-      UE_mac_inst[Mod_idP].scheduling_info.LCGID[logicalChannelIdentity] = MAX_NUM_LCGID;
-    }
-    UE_mac_inst[Mod_idP].scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0;
-  }
-
-  if (mac_MainConfig != NULL) {
-    LOG_I(MAC,"[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n",Mod_idP,eNB_index);
-    UE_mac_inst[Mod_idP].macConfig=mac_MainConfig;
-    UE_mac_inst[Mod_idP].measGapConfig=measGapConfig;
-    
-    if (mac_MainConfig->ul_SCH_Config) {
-      
-      if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) {
-	UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = (uint16_t) *mac_MainConfig->ul_SCH_Config->periodicBSR_Timer;
-      } else {
-	UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = 
-#ifndef Rel14
-	  (uint16_t) MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity
-#else
-	  (uint16_t) PeriodicBSR_Timer_r12_infinity;
-#endif
-	  ;
-      }
-      
-      if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) {
-	UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx     = (uint16_t) *mac_MainConfig->ul_SCH_Config->maxHARQ_Tx;
-      } else {
-	UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx     = (uint16_t) MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
-      }
-      phy_config_harq_ue(Mod_idP,0,eNB_index,UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx);
-      
-      if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) {
-	UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer     = (uint16_t) mac_MainConfig->ul_SCH_Config->retxBSR_Timer;
-      } else {
-#ifndef Rel14
-	UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer     = (uint16_t)MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
-#else
-	UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer     = (uint16_t)RetxBSR_Timer_r12_sf2560;
 #endif
-      }
-    }
-
-
-#if defined(Rel10) || defined(Rel14)
-    
-    if (mac_MainConfig->ext1 && mac_MainConfig->ext1->sr_ProhibitTimer_r9) {
-      UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer  = (uint16_t) *mac_MainConfig->ext1->sr_ProhibitTimer_r9;
-    } else {
-      UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer  = 0;
-    }
     
-    if (mac_MainConfig->ext2 && mac_MainConfig->ext2->mac_MainConfig_v1020) {
-      if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10) {
-	UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10;
-      } else {
-	UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0;
+    LOG_E(MAC, "%s() %s:%d RC.mac[Mod_idP]->if_inst->PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.mac[Mod_idP]->if_inst->PHY_config_req);
+
+    // if in nFAPI mode 
+    if (
+        (nfapi_mode == 1 || nfapi_mode == 2) &&
+        (RC.mac[Mod_idP]->if_inst->PHY_config_req == NULL)
+       ) {
+      while(RC.mac[Mod_idP]->if_inst->PHY_config_req == NULL) {
+        // DJP AssertFatal(RC.mac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
+        usleep(100 * 1000);
+        printf("Waiting for PHY_config_req\n");
       }
-      if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10) {
-	UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10;
-      } else {
-	UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0;
-      }
-    } else {
-      UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0;
-      UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0;
-    }
-#endif
-    UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF  = MAC_UE_BSR_TIMER_NOT_RUNNING;
-    UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF     = MAC_UE_BSR_TIMER_NOT_RUNNING;
-    
-    UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
-    
-    LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n",
-	  Mod_idP,
-	  UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF,
-	  UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF);
-    
-    UE_mac_inst[Mod_idP].scheduling_info.drx_config     = mac_MainConfig->drx_Config;
-    UE_mac_inst[Mod_idP].scheduling_info.phr_config     = mac_MainConfig->phr_Config;
-    
-    if (mac_MainConfig->phr_Config) {
-      UE_mac_inst[Mod_idP].PHR_state = mac_MainConfig->phr_Config->present;
-      UE_mac_inst[Mod_idP].PHR_reconfigured = 1;
-      UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer;
-      UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer;
-      UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange;
-    } else {
-      UE_mac_inst[Mod_idP].PHR_reconfigured = 0;
-      UE_mac_inst[Mod_idP].PHR_state = MAC_MainConfig__phr_Config_PR_setup;
-      UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
-      UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
-      UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
     }
-    
-    UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF =  get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer);
-    UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF =  get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer);
-    UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db =  get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].scheduling_info.PathlossChange);
-    UE_mac_inst[Mod_idP].PHR_reporting_active = 0;
-    LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF)  pathlosschange %d (db) \n",
-	  Mod_idP,
-	  (mac_MainConfig->phr_Config)?mac_MainConfig->phr_Config->present:-1,
-	  UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF,
-	  UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF,
-	  UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db);
-  }
-
-
-  if (physicalConfigDedicated != NULL) {
-    phy_config_dedicated_ue(Mod_idP,0,eNB_index,physicalConfigDedicated);
-    UE_mac_inst[Mod_idP].physicalConfigDedicated=physicalConfigDedicated; // for SR proc
-  }
-
-#if defined(Rel10) || defined(Rel14)
 
-  if (sCellToAddMod_r10 != NULL) {
-
-
-    phy_config_dedicated_scell_ue(Mod_idP,eNB_index,sCellToAddMod_r10,1);
-    UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0
-  }
-  
-
-#endif
-
-  if (measObj!= NULL) {
-    if (measObj[0]!= NULL) {
-      UE_mac_inst[Mod_idP].n_adj_cells = measObj[0]->measObject.choice.measObjectEUTRA.cellsToAddModList->list.count;
-      LOG_I(MAC,"Number of adjacent cells %d\n",UE_mac_inst[Mod_idP].n_adj_cells);
+    if (radioResourceConfigCommon != NULL) {
+      PHY_Config_t phycfg;
+      phycfg.Mod_id = Mod_idP;
+      phycfg.CC_id  = CC_idP;
+      phycfg.cfg    = &RC.mac[Mod_idP]->config[CC_idP];
       
-      for (i=0; i<UE_mac_inst[Mod_idP].n_adj_cells; i++) {
-	UE_mac_inst[Mod_idP].adj_cell_id[i] = measObj[0]->measObject.choice.measObjectEUTRA.cellsToAddModList->list.array[i]->physCellId;
-	LOG_I(MAC,"Cell %d : Nid_cell %d\n",i,UE_mac_inst[Mod_idP].adj_cell_id[i]);
-      }
+      if (RC.mac[Mod_idP]->if_inst->PHY_config_req) RC.mac[Mod_idP]->if_inst->PHY_config_req(&phycfg); 
       
-      phy_config_meas_ue(Mod_idP,0,eNB_index,UE_mac_inst[Mod_idP].n_adj_cells,UE_mac_inst[Mod_idP].adj_cell_id);
-    }
-  }
-
-
-  if(mobilityControlInfo != NULL) {
-    
-    LOG_D(MAC,"[UE%d] MAC Reset procedure triggered by RRC eNB %d \n",Mod_idP,eNB_index);
-    ue_mac_reset(Mod_idP,eNB_index);
-    
-    if(mobilityControlInfo->radioResourceConfigCommon.rach_ConfigCommon) {
-      memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->rach_ConfigCommon,
-	     (void *)mobilityControlInfo->radioResourceConfigCommon.rach_ConfigCommon,
-	     sizeof(RACH_ConfigCommon_t));
-    }
-    
-    memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->prach_Config.prach_ConfigInfo,
-	   (void *)mobilityControlInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
-	   sizeof(PRACH_ConfigInfo_t));
-    UE_mac_inst[Mod_idP].radioResourceConfigCommon->prach_Config.rootSequenceIndex = mobilityControlInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex;
-    
-    if(mobilityControlInfo->radioResourceConfigCommon.pdsch_ConfigCommon) {
-      memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->pdsch_ConfigCommon,
-	     (void *)mobilityControlInfo->radioResourceConfigCommon.pdsch_ConfigCommon,
-	     sizeof(PDSCH_ConfigCommon_t));
+      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
     }
     
-    // not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon
-    memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->pusch_ConfigCommon,
-	   (void *)&mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon,
-	   sizeof(PUSCH_ConfigCommon_t));
-    
-    if(mobilityControlInfo->radioResourceConfigCommon.phich_Config) {
-      /* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config,
-	 (void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config,
-	 sizeof(PHICH_Config_t)); */
-    }
-    
-    if(mobilityControlInfo->radioResourceConfigCommon.pucch_ConfigCommon) {
-      memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->pucch_ConfigCommon,
-	     (void *)mobilityControlInfo->radioResourceConfigCommon.pucch_ConfigCommon,
-	     sizeof(PUCCH_ConfigCommon_t));
-    }
-    
-    if(mobilityControlInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon) {
-      memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->soundingRS_UL_ConfigCommon,
-	     (void *)mobilityControlInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
-	     sizeof(SoundingRS_UL_ConfigCommon_t));
-    }
-    
-    if(mobilityControlInfo->radioResourceConfigCommon.uplinkPowerControlCommon) {
-      memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->uplinkPowerControlCommon,
-	     (void *)mobilityControlInfo->radioResourceConfigCommon.uplinkPowerControlCommon,
-	     sizeof(UplinkPowerControlCommon_t));
-    }
-    
-    //configure antennaInfoCommon somewhere here..
-    if(mobilityControlInfo->radioResourceConfigCommon.p_Max) {
-      //to be configured
-    }
-    
-    if(mobilityControlInfo->radioResourceConfigCommon.tdd_Config) {
-      UE_mac_inst[Mod_idP].tdd_Config = mobilityControlInfo->radioResourceConfigCommon.tdd_Config;
-    }
-    
-    if(mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength) {
-      memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->ul_CyclicPrefixLength,
-	     (void *)mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength,
-	     sizeof(UL_CyclicPrefixLength_t));
-    }
-    
-    // store the previous rnti in case of failure, and set thenew rnti
-    UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti;
-    UE_mac_inst[Mod_idP].crnti = ((mobilityControlInfo->newUE_Identity.buf[0])|(mobilityControlInfo->newUE_Identity.buf[1]<<8));
-    LOG_I(MAC,"[UE %d] Received new identity %x from %d\n", Mod_idP, UE_mac_inst[Mod_idP].crnti, eNB_index);
-    UE_mac_inst[Mod_idP].rach_ConfigDedicated = malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated));
-    
-    if (mobilityControlInfo->rach_ConfigDedicated) {
-      memcpy((void*)UE_mac_inst[Mod_idP].rach_ConfigDedicated,
-	     (void*)mobilityControlInfo->rach_ConfigDedicated,
-	     sizeof(*mobilityControlInfo->rach_ConfigDedicated));
-    }
-    
-    phy_config_afterHO_ue(Mod_idP,0,eNB_index,mobilityControlInfo,0);
-  }
-
-
-  if (mbsfn_SubframeConfigList != NULL) {
-    LOG_I(MAC,"[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", Mod_idP, mbsfn_SubframeConfigList->list.count);
-    UE_mac_inst[Mod_idP].num_sf_allocation_pattern= mbsfn_SubframeConfigList->list.count;
-    
-    for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
-      LOG_I(MAC, "[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n", Mod_idP, i);
-      UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] = mbsfn_SubframeConfigList->list.array[i];
-      //  LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is  %ld\n", Mod_idP,
-      //    UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
-    }
-  }
-  
-
-#if defined(Rel10) || defined(Rel14)
-
-  if (mbsfn_AreaInfoList != NULL) {
-    LOG_I(MAC,"[UE %d][CONFIG] Received %d MBSFN Area Info\n", Mod_idP, mbsfn_AreaInfoList->list.count);
-    UE_mac_inst[Mod_idP].num_active_mbsfn_area = mbsfn_AreaInfoList->list.count;
-    
-    for (i =0; i< mbsfn_AreaInfoList->list.count; i++) {
-      UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] = mbsfn_AreaInfoList->list.array[i];
-      LOG_I(MAC,"[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n",Mod_idP, i,
-	    UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
-      phy_config_sib13_ue(Mod_idP,0,eNB_index,i,UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
-    }
-  }
-  
-  if (pmch_InfoList != NULL) {
-    
-    //    LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
-
-    LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n",Mod_idP);
-    
-    for (i =0; i< pmch_InfoList->list.count; i++) {
-      UE_mac_inst[Mod_idP].pmch_Config[i] = &pmch_InfoList->list.array[i]->pmch_Config_r9;
-      LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n", Mod_idP, i,
-	    UE_mac_inst[Mod_idP].pmch_Config[i]->mch_SchedulingPeriod_r9);
-    }
-    
-    UE_mac_inst[Mod_idP].mcch_status = 1;
-  }
-
-
-#endif
-#ifdef CBA
-
-  if (cba_rnti) {
-    UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups-1] = cba_rnti;
-    LOG_D(MAC,"[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n",
-	  Mod_idP,Mod_idP%num_active_cba_groups, cba_rnti,eNB_index,num_active_cba_groups);
-    phy_config_cba_rnti(Mod_idP,CC_idP,eNB_flagP,eNB_index,cba_rnti,num_active_cba_groups-1, num_active_cba_groups);
-  }
-#endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
-
-  return(0);
+    return(0);			   
 }
-
diff --git a/openair2/LAYER2/MAC/config_NB_IoT.h b/openair2/LAYER2/MAC/config_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..0e497e3b0f407b9c3da8fd7d357375a5596f8422
--- /dev/null
+++ b/openair2/LAYER2/MAC/config_NB_IoT.h
@@ -0,0 +1,301 @@
+
+/*! \file config_NB_IoT.h
+ * \brief configured structures used by scheduler
+ * \author  NTUST BMW Lab./
+ * \date 2017
+ * \email: 
+ * \version 1.0
+ *
+ */
+
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
+//#include "NB_IoT_Message_definitions.h"
+
+#define NUMBER_OF_SIBS_MAX_NB_IoT 6
+
+///MIB
+typedef enum operationModeInf{
+    iNB_IoTand_SamePCI_r13          = 1,
+    iNB_IoTand_DifferentPCI_r13     = 2,
+    guardband_r13               = 3,
+    standalone_r13              = 4
+}operationModeInf_t;
+
+///SIB1_SchedulingInfo_NB_IoT_r13
+typedef enum si_Periodicity{
+    si_Periodicity_rf64=640,
+    si_Periodicity_rf128=1280,
+    si_Periodicity_rf256=2560,
+    si_Periodicity_rf512=5120,
+    si_Periodicity_rf1024=10240,
+    si_Periodicity_rf2048=20480,
+    si_Periodicity_rf4096=40960
+}si_Periodicity_NB_IoT;
+
+typedef enum si_RepetitionPattern{
+    si_RepetitionPattern_every2ndRF=0,
+    si_RepetitionPattern_every4thRF,
+    si_RepetitionPattern_every8thRF,
+    si_RepetitionPattern_every16thRF
+}si_RepetitionPattern_NB_IoT;
+
+typedef enum sib_MappingInfo{
+    sib2_v=0x1,
+    sib3_v=0x2,
+    sib4_v=0x4,
+    sib5_v=0x8,
+    sib14_v=0x10,
+    sib16_v=0x20
+}sib_MappingInfo_NB_IoT;
+
+typedef enum si_TB{
+    si_TB_56=2,
+    si_TB_120=2,
+    si_TB_208=8,
+    si_TB_256=8,
+    si_TB_328=8,
+    si_TB_440=8,
+    si_TB_552=8,
+    si_TB_680=8
+}si_TB_NB_IoT;
+
+///RACH_ConfigCommon configuration
+
+typedef enum ra_ResponseWindowSize{
+    ra_ResponseWindowSize_pp2=2,
+    ra_ResponseWindowSize_pp3=3,
+    ra_ResponseWindowSize_pp4=4,
+    ra_ResponseWindowSize_pp5=5,
+    ra_ResponseWindowSize_pp6=6,
+    ra_ResponseWindowSize_pp7=7,
+    ra_ResponseWindowSize_pp8=8,
+    ra_ResponseWindowSize_pp10=10
+}ra_ResponseWindowSize_NB_IoT;
+
+typedef enum mac_ContentionResolutionTimer{
+    mac_ContentionResolutionTimer_pp1=1,
+    mac_ContentionResolutionTimer_pp2=2,
+    mac_ContentionResolutionTimer_pp3=3,
+    mac_ContentionResolutionTimer_pp4=4,
+    mac_ContentionResolutionTimer_pp8=8,
+    mac_ContentionResolutionTimer_pp16=16,
+    mac_ContentionResolutionTimer_pp32=32,
+    mac_ContentionResolutionTimer_pp64=64
+}mac_ContentionResolutionTimer_NB_IoT;
+
+///NPRACH_ConfigSIB configuration
+
+typedef enum nprach_Periodicity{
+    nprach_Periodicity_ms40=40,
+    nprach_Periodicity_ms80=80,
+    nprach_Periodicity_ms160=160,
+    nprach_Periodicity_ms240=240,
+	nprach_Periodicity_ms320=320,
+    nprach_Periodicity_ms640=640,
+    nprach_Periodicity_ms1280=1280,
+    nprach_Periodicity_ms2560=2560
+}nprach_Periodicity_NB_IoT;
+
+typedef enum nprach_StartTime{
+    nprach_StartTime_ms8=8,
+    nprach_StartTime_ms16=16,
+    nprach_StartTime_ms32=32,
+    nprach_StartTime_ms64=64,
+    nprach_StartTime_ms128=128,
+    nprach_StartTime_ms256=256,
+    nprach_StartTime_ms512=512,
+    nprach_StartTime_ms1024=1024
+}nprach_StartTime_NB_IoT;
+
+typedef enum nprach_SubcarrierOffset{
+    nprach_SubcarrierOffset_n0=0,
+    nprach_SubcarrierOffset_n12=12,
+    nprach_SubcarrierOffset_n24=24,
+    nprach_SubcarrierOffset_n36=36,
+    nprach_SubcarrierOffset_n2=2,
+    nprach_SubcarrierOffset_n18=18,
+    nprach_SubcarrierOffset_n34=34
+}nprach_SubcarrierOffset_NB_IoT;
+
+typedef enum nprach_NumSubcarriers{
+    nprach_NumSubcarriers_n12=12,
+    nprach_NumSubcarriers_n24=24,
+    nprach_NumSubcarriers_n36=36,
+    nprach_NumSubcarriers_n48=48
+}nprach_NumSubcarriers_NB_IoT;
+
+typedef enum nprach_SubcarrierMSG3_RangeStart{
+    nprach_SubcarrierMSG3_RangeStart_zero=0,
+    nprach_SubcarrierMSG3_RangeStart_oneThird=1/3,
+    nprach_SubcarrierMSG3_RangeStart_twoThird=2/3,
+    nprach_SubcarrierMSG3_RangeStart_one=1
+}nprach_SubcarrierMSG3_RangeStart_NB_IoT;
+
+typedef enum maxNumPreambleAttemptCE{
+    maxNumPreambleAttemptCE_n3=3,
+    maxNumPreambleAttemptCE_n4=4,
+    maxNumPreambleAttemptCE_n5=5,
+    maxNumPreambleAttemptCE_n6=6,
+    maxNumPreambleAttemptCE_n7=7,
+    maxNumPreambleAttemptCE_n8=8,
+    maxNumPreambleAttemptCE_n10=10
+}maxNumPreambleAttemptCE_NB_IoT;
+
+typedef enum numRepetitionsPerPreambleAttempt{
+    numRepetitionsPerPreambleAttempt_n1=1,
+    numRepetitionsPerPreambleAttempt_n2=2,
+    numRepetitionsPerPreambleAttempt_n4=4,
+    numRepetitionsPerPreambleAttempt_n8=8,
+    numRepetitionsPerPreambleAttempt_n16=16,
+    numRepetitionsPerPreambleAttempt_n32=32,
+    numRepetitionsPerPreambleAttempt_n64=64,
+    numRepetitionsPerPreambleAttempt_n128=128
+}numRepetitionsPerPreambleAttempt_NB_IoT;
+
+typedef enum npdcch_NumRepetitions_RA{
+    npdcch_NumRepetitions_RA_r1=1,
+    npdcch_NumRepetitions_RA_r2=2,
+    npdcch_NumRepetitions_RA_r4=4,
+    npdcch_NumRepetitions_RA_r8=8,
+    npdcch_NumRepetitions_RA_r16=16,
+    npdcch_NumRepetitions_RA_r32=32,
+    npdcch_NumRepetitions_RA_r64=64,
+    npdcch_NumRepetitions_RA_r128=128,
+    npdcch_NumRepetitions_RA_r256=256,
+    npdcch_NumRepetitions_RA_r512=512,
+    npdcch_NumRepetitions_RA_r1024=1024,
+    npdcch_NumRepetitions_RA_r2048=2048
+}npdcch_NumRepetitions_RA_NB_IoT;
+
+typedef enum npdcch_StartSF_CSS_RA{
+    npdcch_StartSF_CSS_RA_v1dot5=3/2,
+    npdcch_StartSF_CSS_RA_v2=2,
+    npdcch_StartSF_CSS_RA_v4=4,
+    npdcch_StartSF_CSS_RA_v8=8,
+    npdcch_StartSF_CSS_RA_v16=16,
+    npdcch_StartSF_CSS_RA_v32=32,
+    npdcch_StartSF_CSS_RA_v48=48,
+    npdcch_StartSF_CSS_RA_v64=64
+}npdcch_StartSF_CSS_RA_NB_IoT;
+
+typedef enum npdcch_Offset_RA{
+    zero=0,
+    oneEighth=1/8,
+    oneFourth=1/4,
+    threeEighth=3/8
+}npdcch_Offset_RA_NB_IoT;
+
+typedef enum si_window_length_e{
+    ms160=160,
+    ms320=320,
+    ms480=480,
+    ms640=640,
+    ms960=960,
+    ms1280=1280,
+    ms1600=1600
+}si_window_length_t;
+
+typedef enum si_periodicity_e{
+    rf64=640,
+    rf128=1280,
+    rf256=2560,
+    rf512=5120,
+	rf1024=10240,
+    rf2048=20480,
+    rf4096=40960
+}si_periodicity_t;
+
+typedef enum si_repetition_pattern_e{
+    every2ndRF=20,
+    every4thRF=40,
+	every8thRF=80,
+    every16thRF=160
+}si_repetition_pattern_t;
+
+typedef enum si_tb_e{
+    b56=2,
+    b120=2,
+    b208=8,
+    b256=8,
+    b328=8,
+    b440=8,
+    b552=8,
+    b680=8
+}si_tb_t;
+
+
+typedef struct sibs_NB_IoT_sched_s{
+	si_periodicity_t si_periodicity;
+    si_repetition_pattern_t si_repetition_pattern;
+    sib_MappingInfo_NB_IoT sib_mapping_info;   //bit vector
+    si_tb_t si_tb;
+
+}sibs_NB_IoT_sched_t;
+
+
+///-------------------------------------------------------MAC--------------------------------------------------------------------///
+typedef struct sib1_NB_IoT_sched_s{
+    int repetitions;    //  4, 8, 16
+    int starting_rf;
+}sib1_NB_IoT_sched_t;
+
+typedef struct {
+
+    uint32_t    mac_ra_ResponseWindowSize_NB_IoT;
+    uint32_t    mac_ContentionResolutionTimer_NB_IoT;
+
+}mac_RACH_ConfigCommon_NB_IoT;
+
+typedef struct {
+
+    uint32_t    mac_nprach_Periodicity_NB_IoT;
+    uint32_t    mac_nprach_StartTime_NB_IoT;
+    uint32_t    mac_nprach_SubcarrierOffset_NB_IoT;
+    uint32_t    mac_nprach_NumSubcarriers_NB_IoT;
+    uint32_t    mac_nprach_SubcarrierMSG3_RangeStart_NB_IoT;
+    uint32_t    mac_maxNumPreambleAttemptCE_NB_IoT;
+    uint32_t    mac_numRepetitionsPerPreambleAttempt_NB_IoT;
+	//	css
+    uint32_t    mac_npdcch_NumRepetitions_RA_NB_IoT;		//	rmax
+    uint32_t    mac_npdcch_StartSF_CSS_RA_NB_IoT;			//	G
+    uint32_t    mac_npdcch_Offset_RA_NB_IoT;				//	alpha offset
+
+}mac_NPRACH_ConfigSIB_NB_IoT;
+
+typedef struct{
+    //npdcch-NumRepetitions-r13
+    uint32_t R_max;
+    //npdcch-StartSF-USS-r13
+    double G;
+    //npdcch-Offset-USS-r13
+    double a_offset;
+}npdcch_ConfigDedicated_NB_IoT;
+
+typedef struct rrc_config_NB_IoT_s{
+
+    ///MIB
+    uint16_t schedulingInfoSIB1_NB_IoT;
+
+    ///SIB1
+    uint32_t cellIdentity_NB_IoT;
+
+	sib1_NB_IoT_sched_t sib1_NB_IoT_sched_config;
+	///SIBS
+	sibs_NB_IoT_sched_t sibs_NB_IoT_sched[NUMBER_OF_SIBS_MAX_NB_IoT];
+	si_window_length_t si_window_length;
+	uint32_t si_radio_frame_offset;
+
+    ///SIB2 mac_RACH_ConfigCommon_NB_IoT
+    mac_RACH_ConfigCommon_NB_IoT mac_RACH_ConfigCommon[3];
+
+    ///SIB2 mac_NPRACH_ConfigSIB_NB_IoT
+    mac_NPRACH_ConfigSIB_NB_IoT mac_NPRACH_ConfigSIB[3];
+
+    ///NPDCCH Dedicated config
+    npdcch_ConfigDedicated_NB_IoT npdcch_ConfigDedicated[3];
+
+}rrc_config_NB_IoT_t;
+
+#endif
diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c
new file mode 100644
index 0000000000000000000000000000000000000000..5ef18f5bdad0c2b4917d943824c9cae3f1c90430
--- /dev/null
+++ b/openair2/LAYER2/MAC/config_ue.c
@@ -0,0 +1,584 @@
+
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file config.c
+ * \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures
+ * \author  Navid Nikaein and Raymond Knopp
+ * \date 2010 - 2014
+ * \version 0.1
+ * \email: navid.nikaein@eurecom.fr
+ * @ingroup _mac
+
+ */
+
+#include "COMMON/platform_types.h"
+#include "COMMON/platform_constants.h"
+#include "SCHED/defs.h"
+#include "SystemInformationBlockType2.h"
+//#include "RadioResourceConfigCommonSIB.h"
+#include "RadioResourceConfigDedicated.h"
+#ifdef Rel14
+#include "PRACH-ConfigSIB-v1310.h"
+#endif
+#include "MeasGapConfig.h"
+#include "MeasObjectToAddModList.h"
+#include "TDD-Config.h"
+#include "MAC-MainConfig.h"
+#include "defs.h"
+#include "proto.h"
+#include "extern.h"
+#include "UTIL/LOG/log.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
+
+#include "common/ran_context.h"
+#if defined(Rel10) || defined(Rel14)
+#include "MBSFN-AreaInfoList-r9.h"
+#include "MBSFN-AreaInfo-r9.h"
+#include "MBSFN-SubframeConfigList.h"
+#include "PMCH-InfoList-r9.h"
+#endif
+
+extern void mac_init_cell_params(int Mod_idP,int CC_idP);
+extern void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
+
+
+/* sec 5.9, 36.321: MAC Reset Procedure */
+void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index)
+{
+
+  //Resetting Bj
+  UE_mac_inst[module_idP].scheduling_info.Bj[0] = 0;
+  UE_mac_inst[module_idP].scheduling_info.Bj[1] = 0;
+  UE_mac_inst[module_idP].scheduling_info.Bj[2] = 0;
+
+  //Stopping all timers
+
+  //timeAlignmentTimer expires
+
+  // PHY changes for UE MAC reset
+  phy_reset_ue(module_idP, 0, eNB_index);
+
+  // notify RRC to relase PUCCH/SRS
+  // cancel all pending SRs
+  UE_mac_inst[module_idP].scheduling_info.SR_pending = 0;
+  UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0;
+
+  //Set BSR Trigger Bmp and remove timer flags
+  UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
+
+  // stop ongoing RACH procedure
+
+  // discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
+  UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = 0;	// check!
+  UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
+
+
+  ue_init_mac(module_idP);	//This will hopefully do the rest of the MAC reset procedure
+
+}
+
+int32_t **rxdata;
+int32_t **txdata;
+
+
+int
+rrc_mac_config_req_ue(module_id_t Mod_idP,
+		      int CC_idP,
+		      uint8_t eNB_index,
+		      RadioResourceConfigCommonSIB_t *
+		      radioResourceConfigCommon,
+		      struct PhysicalConfigDedicated
+		      *physicalConfigDedicated,
+#if defined(Rel10) || defined(Rel14)
+		      SCellToAddMod_r10_t * sCellToAddMod_r10,
+		      //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+#endif
+		      MeasObjectToAddMod_t ** measObj,
+		      MAC_MainConfig_t * mac_MainConfig,
+		      long logicalChannelIdentity,
+		      LogicalChannelConfig_t * logicalChannelConfig,
+		      MeasGapConfig_t * measGapConfig,
+		      TDD_Config_t * tdd_Config,
+		      MobilityControlInfo_t * mobilityControlInfo,
+		      uint8_t * SIwindowsize,
+		      uint16_t * SIperiod,
+		      ARFCN_ValueEUTRA_t * ul_CarrierFreq,
+		      long *ul_Bandwidth,
+		      AdditionalSpectrumEmission_t *
+		      additionalSpectrumEmission,
+		      struct MBSFN_SubframeConfigList
+		      *mbsfn_SubframeConfigList
+#if defined(Rel10) || defined(Rel14)
+		      , uint8_t MBMS_Flag,
+		      MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList,
+		      PMCH_InfoList_r9_t * pmch_InfoList
+#endif
+#ifdef CBA
+		      , uint8_t num_active_cba_groups, uint16_t cba_rnti
+#endif
+		      )
+{
+
+  int i;
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+    (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
+
+  LOG_I(MAC, "[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n",
+	Mod_idP, eNB_index);
+
+  if (tdd_Config != NULL) {
+    UE_mac_inst[Mod_idP].tdd_Config = tdd_Config;
+  }
+
+
+  if (tdd_Config && SIwindowsize && SIperiod) {
+    phy_config_sib1_ue(Mod_idP, 0, eNB_index, tdd_Config,
+		       *SIwindowsize, *SIperiod);
+  }
+
+  if (radioResourceConfigCommon != NULL) {
+    UE_mac_inst[Mod_idP].radioResourceConfigCommon =
+      radioResourceConfigCommon;
+    phy_config_sib2_ue(Mod_idP, 0, eNB_index,
+		       radioResourceConfigCommon, ul_CarrierFreq,
+		       ul_Bandwidth, additionalSpectrumEmission,
+		       mbsfn_SubframeConfigList);
+  }
+  // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup
+  if (logicalChannelConfig != NULL) {
+    LOG_I(MAC,
+	  "[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n",
+	  Mod_idP, eNB_index);
+    UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity] =
+      logicalChannelConfig;
+    UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity] = 0;	// initilize the bucket for this lcid
+
+    AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL,
+		"[UE %d] LCID %ld NULL ul_SpecificParameters\n",
+		Mod_idP, logicalChannelIdentity);
+    UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate * logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration;	// set the max bucket size
+    if (logicalChannelConfig->ul_SpecificParameters->
+	logicalChannelGroup != NULL) {
+      UE_mac_inst[Mod_idP].scheduling_info.
+	LCGID[logicalChannelIdentity] =
+	*logicalChannelConfig->ul_SpecificParameters->
+	logicalChannelGroup;
+      LOG_D(MAC,
+	    "[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n",
+	    Mod_idP, logicalChannelIdentity,
+	    *logicalChannelConfig->
+	    ul_SpecificParameters->logicalChannelGroup);
+    } else {
+      UE_mac_inst[Mod_idP].scheduling_info.
+	LCGID[logicalChannelIdentity] = MAX_NUM_LCGID;
+    }
+    UE_mac_inst[Mod_idP].
+      scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0;
+  }
+
+  if (mac_MainConfig != NULL) {
+    LOG_I(MAC,
+	  "[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n",
+	  Mod_idP, eNB_index);
+    UE_mac_inst[Mod_idP].macConfig = mac_MainConfig;
+    UE_mac_inst[Mod_idP].measGapConfig = measGapConfig;
+
+    if (mac_MainConfig->ul_SCH_Config) {
+
+      if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) {
+	UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer =
+	  (uint16_t) *
+	  mac_MainConfig->ul_SCH_Config->periodicBSR_Timer;
+      } else {
+	UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer =
+#ifndef Rel14
+	  (uint16_t)
+	  MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity
+#else
+	  (uint16_t) PeriodicBSR_Timer_r12_infinity;
+#endif
+	;
+      }
+
+      if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) {
+	UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx =
+	  (uint16_t) * mac_MainConfig->ul_SCH_Config->maxHARQ_Tx;
+      } else {
+	UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx =
+	  (uint16_t)
+	  MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
+      }
+      phy_config_harq_ue(Mod_idP, 0, eNB_index,
+			 UE_mac_inst[Mod_idP].
+			 scheduling_info.maxHARQ_Tx);
+
+      if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) {
+	UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
+	  (uint16_t) mac_MainConfig->ul_SCH_Config->
+	  retxBSR_Timer;
+      } else {
+#ifndef Rel14
+	UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
+	  (uint16_t)
+	  MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
+#else
+	UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
+	  (uint16_t) RetxBSR_Timer_r12_sf2560;
+#endif
+      }
+    }
+#if defined(Rel10) || defined(Rel14)
+
+    if (mac_MainConfig->ext1
+	&& mac_MainConfig->ext1->sr_ProhibitTimer_r9) {
+      UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer =
+	(uint16_t) * mac_MainConfig->ext1->sr_ProhibitTimer_r9;
+    } else {
+      UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0;
+    }
+
+    if (mac_MainConfig->ext2
+	&& mac_MainConfig->ext2->mac_MainConfig_v1020) {
+      if (mac_MainConfig->ext2->
+	  mac_MainConfig_v1020->extendedBSR_Sizes_r10) {
+	UE_mac_inst[Mod_idP].scheduling_info.
+	  extendedBSR_Sizes_r10 =
+	  (uint16_t) *
+	  mac_MainConfig->ext2->
+	  mac_MainConfig_v1020->extendedBSR_Sizes_r10;
+      } else {
+	UE_mac_inst[Mod_idP].scheduling_info.
+	  extendedBSR_Sizes_r10 = (uint16_t) 0;
+      }
+      if (mac_MainConfig->ext2->mac_MainConfig_v1020->
+	  extendedPHR_r10) {
+	UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
+	  (uint16_t) *
+	  mac_MainConfig->ext2->mac_MainConfig_v1020->
+	  extendedPHR_r10;
+      } else {
+	UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
+	  (uint16_t) 0;
+      }
+    } else {
+      UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 =
+	(uint16_t) 0;
+      UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
+	(uint16_t) 0;
+    }
+#endif
+    UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF =
+      MAC_UE_BSR_TIMER_NOT_RUNNING;
+    UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF =
+      MAC_UE_BSR_TIMER_NOT_RUNNING;
+
+    UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
+
+    LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n",
+	  Mod_idP,
+	  UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF,
+	  UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF);
+
+    UE_mac_inst[Mod_idP].scheduling_info.drx_config =
+      mac_MainConfig->drx_Config;
+    UE_mac_inst[Mod_idP].scheduling_info.phr_config =
+      mac_MainConfig->phr_Config;
+
+    if (mac_MainConfig->phr_Config) {
+      UE_mac_inst[Mod_idP].PHR_state =
+	mac_MainConfig->phr_Config->present;
+      UE_mac_inst[Mod_idP].PHR_reconfigured = 1;
+      UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer =
+	mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer;
+      UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer =
+	mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer;
+      UE_mac_inst[Mod_idP].scheduling_info.PathlossChange =
+	mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange;
+    } else {
+      UE_mac_inst[Mod_idP].PHR_reconfigured = 0;
+      UE_mac_inst[Mod_idP].PHR_state =
+	MAC_MainConfig__phr_Config_PR_setup;
+      UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer =
+	MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
+      UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer =
+	MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
+      UE_mac_inst[Mod_idP].scheduling_info.PathlossChange =
+	MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
+    }
+
+    UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF =
+      get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].
+				scheduling_info.periodicPHR_Timer);
+    UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF =
+      get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].
+			       scheduling_info.prohibitPHR_Timer);
+    UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db =
+      get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].
+			       scheduling_info.PathlossChange);
+    UE_mac_inst[Mod_idP].PHR_reporting_active = 0;
+    LOG_D(MAC,
+	  "[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF)  pathlosschange %d (db) \n",
+	  Mod_idP,
+	  (mac_MainConfig->phr_Config) ? mac_MainConfig->
+	  phr_Config->present : -1,
+	  UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF,
+	  UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF,
+	  UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db);
+  }
+
+
+  if (physicalConfigDedicated != NULL) {
+    phy_config_dedicated_ue(Mod_idP, 0, eNB_index,
+			    physicalConfigDedicated);
+    UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated;	// for SR proc
+  }
+#if defined(Rel10) || defined(Rel14)
+
+  if (sCellToAddMod_r10 != NULL) {
+
+
+    phy_config_dedicated_scell_ue(Mod_idP, eNB_index,
+				  sCellToAddMod_r10, 1);
+    UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10;	// using SCell index 0
+  }
+#endif
+
+  if (measObj != NULL) {
+    if (measObj[0] != NULL) {
+      UE_mac_inst[Mod_idP].n_adj_cells =
+	measObj[0]->measObject.choice.
+	measObjectEUTRA.cellsToAddModList->list.count;
+      LOG_I(MAC, "Number of adjacent cells %d\n",
+	    UE_mac_inst[Mod_idP].n_adj_cells);
+
+      for (i = 0; i < UE_mac_inst[Mod_idP].n_adj_cells; i++) {
+	UE_mac_inst[Mod_idP].adj_cell_id[i] =
+	  measObj[0]->measObject.choice.
+	  measObjectEUTRA.cellsToAddModList->list.array[i]->
+	  physCellId;
+	LOG_I(MAC, "Cell %d : Nid_cell %d\n", i,
+	      UE_mac_inst[Mod_idP].adj_cell_id[i]);
+      }
+
+      phy_config_meas_ue(Mod_idP, 0, eNB_index,
+			 UE_mac_inst[Mod_idP].n_adj_cells,
+			 UE_mac_inst[Mod_idP].adj_cell_id);
+    }
+  }
+
+
+  if (mobilityControlInfo != NULL) {
+
+    LOG_D(MAC, "[UE%d] MAC Reset procedure triggered by RRC eNB %d \n",
+	  Mod_idP, eNB_index);
+    ue_mac_reset(Mod_idP, eNB_index);
+
+    if (mobilityControlInfo->radioResourceConfigCommon.
+	rach_ConfigCommon) {
+      memcpy((void *)
+	     &UE_mac_inst[Mod_idP].radioResourceConfigCommon->
+	     rach_ConfigCommon,
+	     (void *) mobilityControlInfo->
+	     radioResourceConfigCommon.rach_ConfigCommon,
+	     sizeof(RACH_ConfigCommon_t));
+    }
+
+    memcpy((void *) &UE_mac_inst[Mod_idP].
+	   radioResourceConfigCommon->prach_Config.prach_ConfigInfo,
+	   (void *) mobilityControlInfo->
+	   radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
+	   sizeof(PRACH_ConfigInfo_t));
+    UE_mac_inst[Mod_idP].radioResourceConfigCommon->
+      prach_Config.rootSequenceIndex =
+      mobilityControlInfo->radioResourceConfigCommon.
+      prach_Config.rootSequenceIndex;
+
+    if (mobilityControlInfo->radioResourceConfigCommon.
+	pdsch_ConfigCommon) {
+      memcpy((void *)
+	     &UE_mac_inst[Mod_idP].radioResourceConfigCommon->
+	     pdsch_ConfigCommon,
+	     (void *) mobilityControlInfo->
+	     radioResourceConfigCommon.pdsch_ConfigCommon,
+	     sizeof(PDSCH_ConfigCommon_t));
+    }
+    // not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon
+    memcpy((void *) &UE_mac_inst[Mod_idP].
+	   radioResourceConfigCommon->pusch_ConfigCommon,
+	   (void *) &mobilityControlInfo->
+	   radioResourceConfigCommon.pusch_ConfigCommon,
+	   sizeof(PUSCH_ConfigCommon_t));
+
+    if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) {
+      /* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config,
+	 (void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config,
+	 sizeof(PHICH_Config_t)); */
+    }
+
+    if (mobilityControlInfo->radioResourceConfigCommon.
+	pucch_ConfigCommon) {
+      memcpy((void *)
+	     &UE_mac_inst[Mod_idP].radioResourceConfigCommon->
+	     pucch_ConfigCommon,
+	     (void *) mobilityControlInfo->
+	     radioResourceConfigCommon.pucch_ConfigCommon,
+	     sizeof(PUCCH_ConfigCommon_t));
+    }
+
+    if (mobilityControlInfo->
+	radioResourceConfigCommon.soundingRS_UL_ConfigCommon) {
+      memcpy((void *)
+	     &UE_mac_inst[Mod_idP].radioResourceConfigCommon->
+	     soundingRS_UL_ConfigCommon,
+	     (void *) mobilityControlInfo->
+	     radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
+	     sizeof(SoundingRS_UL_ConfigCommon_t));
+    }
+
+    if (mobilityControlInfo->
+	radioResourceConfigCommon.uplinkPowerControlCommon) {
+      memcpy((void *)
+	     &UE_mac_inst[Mod_idP].radioResourceConfigCommon->
+	     uplinkPowerControlCommon,
+	     (void *) mobilityControlInfo->
+	     radioResourceConfigCommon.uplinkPowerControlCommon,
+	     sizeof(UplinkPowerControlCommon_t));
+    }
+    //configure antennaInfoCommon somewhere here..
+    if (mobilityControlInfo->radioResourceConfigCommon.p_Max) {
+      //to be configured
+    }
+
+    if (mobilityControlInfo->radioResourceConfigCommon.tdd_Config) {
+      UE_mac_inst[Mod_idP].tdd_Config =
+	mobilityControlInfo->radioResourceConfigCommon.tdd_Config;
+    }
+
+    if (mobilityControlInfo->
+	radioResourceConfigCommon.ul_CyclicPrefixLength) {
+      memcpy((void *)
+	     &UE_mac_inst[Mod_idP].radioResourceConfigCommon->
+	     ul_CyclicPrefixLength,
+	     (void *) mobilityControlInfo->
+	     radioResourceConfigCommon.ul_CyclicPrefixLength,
+	     sizeof(UL_CyclicPrefixLength_t));
+    }
+    // store the previous rnti in case of failure, and set thenew rnti
+    UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti;
+    UE_mac_inst[Mod_idP].crnti =
+      ((mobilityControlInfo->
+	newUE_Identity.buf[0]) | (mobilityControlInfo->
+				  newUE_Identity.buf[1] << 8));
+    LOG_I(MAC, "[UE %d] Received new identity %x from %d\n", Mod_idP,
+	  UE_mac_inst[Mod_idP].crnti, eNB_index);
+    UE_mac_inst[Mod_idP].rach_ConfigDedicated =
+      malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated));
+
+    if (mobilityControlInfo->rach_ConfigDedicated) {
+      memcpy((void *) UE_mac_inst[Mod_idP].rach_ConfigDedicated,
+	     (void *) mobilityControlInfo->rach_ConfigDedicated,
+	     sizeof(*mobilityControlInfo->rach_ConfigDedicated));
+    }
+
+    phy_config_afterHO_ue(Mod_idP, 0, eNB_index, mobilityControlInfo,
+			  0);
+  }
+
+
+  if (mbsfn_SubframeConfigList != NULL) {
+    LOG_I(MAC,
+	  "[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n",
+	  Mod_idP, mbsfn_SubframeConfigList->list.count);
+    UE_mac_inst[Mod_idP].num_sf_allocation_pattern =
+      mbsfn_SubframeConfigList->list.count;
+
+    for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) {
+      LOG_I(MAC,
+	    "[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n",
+	    Mod_idP, i);
+      UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] =
+	mbsfn_SubframeConfigList->list.array[i];
+      //  LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is  %ld\n", Mod_idP,
+      //    UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
+    }
+  }
+#if defined(Rel10) || defined(Rel14)
+
+  if (mbsfn_AreaInfoList != NULL) {
+    LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n",
+	  Mod_idP, mbsfn_AreaInfoList->list.count);
+    UE_mac_inst[Mod_idP].num_active_mbsfn_area =
+      mbsfn_AreaInfoList->list.count;
+
+    for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) {
+      UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] =
+	mbsfn_AreaInfoList->list.array[i];
+      LOG_I(MAC,
+	    "[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n",
+	    Mod_idP, i,
+	    UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]->
+	    mcch_Config_r9.mcch_RepetitionPeriod_r9);
+      phy_config_sib13_ue(Mod_idP, 0, eNB_index, i,
+			  UE_mac_inst[Mod_idP].
+			  mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
+    }
+  }
+
+  if (pmch_InfoList != NULL) {
+
+    //    LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
+
+    LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n",
+	  Mod_idP);
+
+    for (i = 0; i < pmch_InfoList->list.count; i++) {
+      UE_mac_inst[Mod_idP].pmch_Config[i] =
+	&pmch_InfoList->list.array[i]->pmch_Config_r9;
+      LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n",
+	    Mod_idP, i,
+	    UE_mac_inst[Mod_idP].
+	    pmch_Config[i]->mch_SchedulingPeriod_r9);
+    }
+
+    UE_mac_inst[Mod_idP].mcch_status = 1;
+  }
+#endif
+#ifdef CBA
+
+  if (cba_rnti) {
+    UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups - 1] =
+      cba_rnti;
+    LOG_D(MAC,
+	  "[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n",
+	  Mod_idP, Mod_idP % num_active_cba_groups, cba_rnti,
+	  eNB_index, num_active_cba_groups);
+    phy_config_cba_rnti(Mod_idP, CC_idP, eNB_flagP, eNB_index,
+			cba_rnti, num_active_cba_groups - 1,
+			num_active_cba_groups);
+  }
+#endif
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+    (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
+
+  return (0);
+}
diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h
index b0d7dffa209fea9f4393d80b12fb7807db2abcf2..107483b35a071e65a5a8118127b08b483ff78cf2 100644
--- a/openair2/LAYER2/MAC/defs.h
+++ b/openair2/LAYER2/MAC/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -39,15 +39,9 @@
 
 
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#endif
-
-//#include "COMMON/openair_defs.h"
-
-
 
 #include "PHY/defs.h"
 #include "PHY/LTE_TRANSPORT/defs.h"
@@ -90,12 +84,12 @@
 #if defined(Rel10) || defined(Rel14)
 
 // Mask for identifying subframe for MBMS
-#define MBSFN_TDD_SF3 0x80// for TDD
+#define MBSFN_TDD_SF3 0x80	// for TDD
 #define MBSFN_TDD_SF4 0x40
 #define MBSFN_TDD_SF7 0x20
 #define MBSFN_TDD_SF8 0x10
 #define MBSFN_TDD_SF9 0x08
-#define MBSFN_FDD_SF1 0x80// for FDD
+#define MBSFN_FDD_SF1 0x80	// for FDD
 #define MBSFN_FDD_SF2 0x40
 #define MBSFN_FDD_SF3 0x20
 #define MBSFN_FDD_SF6 0x10
@@ -109,9 +103,7 @@
 //#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high
 #endif
 
-#ifdef USER_MODE
 #define printk printf
-#endif //USER_MODE
 
 /*!\brief Maximum number of logical channl group IDs */
 #define MAX_NUM_LCGID 4
@@ -128,21 +120,25 @@
 /*!\brief Maximum number od control elemenets */
 #define MAX_NUM_CE 5
 /*!\brief Maximum number of random access process */
+#if defined(USRP_REC_PLAY)
+#define NB_RA_PROC_MAX 1
+#else
 #define NB_RA_PROC_MAX 4
+#endif
 /*!\brief size of buffer status report table */
 #define BSR_TABLE_SIZE 64
 /*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */
-#define PHR_MAPPING_OFFSET 23  // if ( x>= -23 ) val = floor (x + 23) 
+#define PHR_MAPPING_OFFSET 23	// if ( x>= -23 ) val = floor (x + 23)
 /*!\brief maximum number of resource block groups */
-#define N_RBG_MAX 25 // for 20MHz channel BW
+#define N_RBG_MAX 25		// for 20MHz channel BW
 /*!\brief minimum value for channel quality indicator */
 #define MIN_CQI_VALUE  0
 /*!\brief maximum value for channel quality indicator */
 #define MAX_CQI_VALUE  15
 /*!\briefmaximum number of supported bandwidth (1.4, 5, 10, 20 MHz) */
-#define MAX_SUPPORTED_BW  4  
+#define MAX_SUPPORTED_BW  4
 /*!\brief CQI values range from 1 to 15 (4 bits) */
-#define CQI_VALUE_RANGE 16 
+#define CQI_VALUE_RANGE 16
 
 /*!\brief value for indicating BSR Timer is not running */
 #define MAC_UE_BSR_TIMER_NOT_RUNNING   (0xFFFF)
@@ -157,30 +153,32 @@
 #define MIN_MAC_HDR_RLC_SIZE    (1 + MIN_RLC_PDU_SIZE)
 
 /*!\brief maximum number of slices / groups */
-#define MAX_NUM_SLICES 4 
+#define MAX_NUM_SLICES 4
 
-/* 
- * eNB part 
- */ 
+#define U_PLANE_INACTIVITY_VALUE 6000
+
+/*
+ * eNB part
+ */
 
 
-/* 
- * UE/ENB common part 
- */ 
+/*
+ * UE/ENB common part
+ */
 /*!\brief MAC header of Random Access Response for Random access preamble identifier (RAPID) */
 typedef struct {
-  uint8_t RAPID:6;
-  uint8_t T:1;
-  uint8_t E:1;
-} __attribute__((__packed__))RA_HEADER_RAPID;
+    uint8_t RAPID:6;
+    uint8_t T:1;
+    uint8_t E:1;
+} __attribute__ ((__packed__)) RA_HEADER_RAPID;
 
 /*!\brief  MAC header of Random Access Response for backoff indicator (BI)*/
 typedef struct {
-  uint8_t BI:4;
-  uint8_t R:2;
-  uint8_t T:1;
-  uint8_t E:1;
-} __attribute__((__packed__))RA_HEADER_BI;
+    uint8_t BI:4;
+    uint8_t R:2;
+    uint8_t T:1;
+    uint8_t E:1;
+} __attribute__ ((__packed__)) RA_HEADER_BI;
 /*
 typedef struct {
   uint64_t padding:16;
@@ -212,124 +210,124 @@ typedef struct {
 */
 /*!\brief  MAC subheader short with 7bit Length field */
 typedef struct {
-  uint8_t LCID:5;  // octet 1 LSB
-  uint8_t E:1;
-  uint8_t R:2;     // octet 1 MSB
-  uint8_t L:7;     // octet 2 LSB
-  uint8_t F:1;     // octet 2 MSB
-} __attribute__((__packed__))SCH_SUBHEADER_SHORT;
+    uint8_t LCID:5;		// octet 1 LSB
+    uint8_t E:1;
+    uint8_t R:2;		// octet 1 MSB
+    uint8_t L:7;		// octet 2 LSB
+    uint8_t F:1;		// octet 2 MSB
+} __attribute__ ((__packed__)) SCH_SUBHEADER_SHORT;
 /*!\brief  MAC subheader long  with 15bit Length field */
 typedef struct {
-  uint8_t LCID:5;   // octet 1 LSB
-  uint8_t E:1;
-  uint8_t R:2;      // octet 1 MSB
-  uint8_t L_MSB:7;
-  uint8_t F:1;      // octet 2 MSB
-  uint8_t L_LSB:8;
-  uint8_t padding;
-} __attribute__((__packed__))SCH_SUBHEADER_LONG;
+    uint8_t LCID:5;		// octet 1 LSB
+    uint8_t E:1;
+    uint8_t R:2;		// octet 1 MSB
+    uint8_t L_MSB:7;
+    uint8_t F:1;		// octet 2 MSB
+    uint8_t L_LSB:8;
+    uint8_t padding;
+} __attribute__ ((__packed__)) SCH_SUBHEADER_LONG;
 /*!\brief MAC subheader short without length field */
 typedef struct {
-  uint8_t LCID:5;
-  uint8_t E:1;
-  uint8_t R:2;
-} __attribute__((__packed__))SCH_SUBHEADER_FIXED;
+    uint8_t LCID:5;
+    uint8_t E:1;
+    uint8_t R:2;
+} __attribute__ ((__packed__)) SCH_SUBHEADER_FIXED;
 
 /*!\brief  mac control element: short buffer status report for a specific logical channel group ID*/
 typedef struct {
-  uint8_t Buffer_size:6;  // octet 1 LSB
-  uint8_t LCGID:2;        // octet 1 MSB
-} __attribute__((__packed__))BSR_SHORT;
+    uint8_t Buffer_size:6;	// octet 1 LSB
+    uint8_t LCGID:2;		// octet 1 MSB
+} __attribute__ ((__packed__)) BSR_SHORT;
 
 typedef BSR_SHORT BSR_TRUNCATED;
 /*!\brief  mac control element: long buffer status report for all logical channel group ID*/
 typedef struct {
-  uint8_t Buffer_size3:6;
-  uint8_t Buffer_size2:6;
-  uint8_t Buffer_size1:6;
-  uint8_t Buffer_size0:6;
-} __attribute__((__packed__))BSR_LONG;
+    uint8_t Buffer_size3:6;
+    uint8_t Buffer_size2:6;
+    uint8_t Buffer_size1:6;
+    uint8_t Buffer_size0:6;
+} __attribute__ ((__packed__)) BSR_LONG;
 
 #define BSR_LONG_SIZE  (sizeof(BSR_LONG))
 /*!\brief  mac control element: timing advance  */
 typedef struct {
-  uint8_t TA:6;
-  uint8_t R:2;
-} __attribute__((__packed__))TIMING_ADVANCE_CMD;
+    uint8_t TA:6;
+    uint8_t R:2;
+} __attribute__ ((__packed__)) TIMING_ADVANCE_CMD;
 /*!\brief  mac control element: power headroom report  */
 typedef struct {
-  uint8_t PH:6;
-  uint8_t R:2;
-} __attribute__((__packed__))POWER_HEADROOM_CMD;
+    uint8_t PH:6;
+    uint8_t R:2;
+} __attribute__ ((__packed__)) POWER_HEADROOM_CMD;
 
 /*! \brief MIB payload */
 typedef struct {
-  uint8_t payload[3] ;
-} __attribute__((__packed__))MIB_PDU;
+    uint8_t payload[3];
+} __attribute__ ((__packed__)) MIB_PDU;
 /*! \brief CCCH payload */
 typedef struct {
-  uint8_t payload[CCCH_PAYLOAD_SIZE_MAX] ;
-} __attribute__((__packed__))CCCH_PDU;
+    uint8_t payload[CCCH_PAYLOAD_SIZE_MAX];
+} __attribute__ ((__packed__)) CCCH_PDU;
 /*! \brief BCCH payload */
 typedef struct {
-  uint8_t payload[BCCH_PAYLOAD_SIZE_MAX] ;
-} __attribute__((__packed__))BCCH_PDU;
+    uint8_t payload[BCCH_PAYLOAD_SIZE_MAX];
+} __attribute__ ((__packed__)) BCCH_PDU;
 /*! \brief RAR payload */
 typedef struct {
-  uint8_t payload[RAR_PAYLOAD_SIZE_MAX];
+    uint8_t payload[RAR_PAYLOAD_SIZE_MAX];
 } __attribute__ ((__packed__)) RAR_PDU;
 /*! \brief BCCH payload */
 typedef struct {
-  uint8_t payload[PCCH_PAYLOAD_SIZE_MAX] ;
-} __attribute__((__packed__))PCCH_PDU;
+    uint8_t payload[PCCH_PAYLOAD_SIZE_MAX];
+} __attribute__ ((__packed__)) PCCH_PDU;
 
 #if defined(Rel10) || defined(Rel14)
 /*! \brief MCCH payload */
 typedef struct {
-  uint8_t payload[MCCH_PAYLOAD_SIZE_MAX] ;
-} __attribute__((__packed__))MCCH_PDU;
+    uint8_t payload[MCCH_PAYLOAD_SIZE_MAX];
+} __attribute__ ((__packed__)) MCCH_PDU;
 /*!< \brief MAC control element for activation and deactivation of component carriers */
 typedef struct {
-  uint8_t C7:1;/*!< \brief Component carrier 7 */
-  uint8_t C6:1;/*!< \brief Component carrier 6 */
-  uint8_t C5:1;/*!< \brief Component carrier 5 */
-  uint8_t C4:1;/*!< \brief Component carrier 4 */
-  uint8_t C3:1;/*!< \brief Component carrier 3 */
-  uint8_t C2:1;/*!< \brief Component carrier 2 */
-  uint8_t C1:1;/*!< \brief Component carrier 1 */
-  uint8_t R:1;/*!< \brief Reserved  */
-} __attribute__((__packed__))CC_ELEMENT;
+    uint8_t C7:1;		/*!< \brief Component carrier 7 */
+    uint8_t C6:1;		/*!< \brief Component carrier 6 */
+    uint8_t C5:1;		/*!< \brief Component carrier 5 */
+    uint8_t C4:1;		/*!< \brief Component carrier 4 */
+    uint8_t C3:1;		/*!< \brief Component carrier 3 */
+    uint8_t C2:1;		/*!< \brief Component carrier 2 */
+    uint8_t C1:1;		/*!< \brief Component carrier 1 */
+    uint8_t R:1;		/*!< \brief Reserved  */
+} __attribute__ ((__packed__)) CC_ELEMENT;
 /*! \brief MAC control element: MCH Scheduling Information */
 typedef struct {
-  uint8_t stop_sf_MSB:3; // octet 1 LSB
-  uint8_t lcid:5;        // octet 2 MSB
-  uint8_t stop_sf_LSB:8;
-} __attribute__((__packed__))MSI_ELEMENT;
+    uint8_t stop_sf_MSB:3;	// octet 1 LSB
+    uint8_t lcid:5;		// octet 2 MSB
+    uint8_t stop_sf_LSB:8;
+} __attribute__ ((__packed__)) MSI_ELEMENT;
 #endif
-/*! \brief Values of CCCH LCID for DLSCH */ 
+/*! \brief Values of CCCH LCID for DLSCH */
 #define CCCH_LCHANID 0
 /*!\brief Values of BCCH logical channel (fake)*/
-#define BCCH 3  // SI 
+#define BCCH 3			// SI
 /*!\brief Values of PCCH logical channel (fake)*/
-#define PCCH 4  // Paging 
+#define PCCH 4			// Paging
 /*!\brief Values of PCCH logical channel (fake) */
-#define MIBCH 5  // MIB 
+#define MIBCH 5			// MIB
 /*!\brief Values of BCCH SIB1_BR logical channel (fake) */
-#define BCCH_SIB1_BR 6  // SIB1_BR 
+#define BCCH_SIB1_BR 6		// SIB1_BR
 /*!\brief Values of BCCH SIB_BR logical channel (fake) */
-#define BCCH_SI_BR 7  // SI-BR 
+#define BCCH_SI_BR 7		// SI-BR
 /*!\brief Value of CCCH / SRB0 logical channel */
-#define CCCH 0  // srb0
+#define CCCH 0			// srb0
 /*!\brief DCCH / SRB1 logical channel */
-#define DCCH 1  // srb1
+#define DCCH 1			// srb1
 /*!\brief DCCH1 / SRB2  logical channel */
-#define DCCH1 2 // srb2
+#define DCCH1 2			// srb2
 /*!\brief DTCH DRB1  logical channel */
-#define DTCH 3 // LCID
+#define DTCH 3			// LCID
 /*!\brief MCCH logical channel */
-#define MCCH 4 
+#define MCCH 4
 /*!\brief MTCH logical channel */
-#define MTCH 1 
+#define MTCH 1
 // DLSCH LCHAN ID
 /*!\brief LCID of UE contention resolution identity for DLSCH*/
 #define UE_CONT_RES 28
@@ -364,974 +362,1001 @@ typedef struct {
 /*!\brief LCID of long BSR for ULSCH */
 #define LONG_BSR 30
 /*!\bitmaps for BSR Triggers */
-#define	BSR_TRIGGER_NONE		(0)			/* No BSR Trigger */
-#define	BSR_TRIGGER_REGULAR		(1)			/* For Regular and ReTxBSR Expiry Triggers */
-#define	BSR_TRIGGER_PERIODIC	(2)			/* For BSR Periodic Timer Expiry Trigger */
-#define	BSR_TRIGGER_PADDING		(4)			/* For Padding BSR Trigger */
+#define	BSR_TRIGGER_NONE		(0)	/* No BSR Trigger */
+#define	BSR_TRIGGER_REGULAR		(1)	/* For Regular and ReTxBSR Expiry Triggers */
+#define	BSR_TRIGGER_PERIODIC	(2)	/* For BSR Periodic Timer Expiry Trigger */
+#define	BSR_TRIGGER_PADDING		(4)	/* For Padding BSR Trigger */
 
 
 /*! \brief Downlink SCH PDU Structure */
 typedef struct {
-  uint8_t payload[8][SCH_PAYLOAD_SIZE_MAX];
-  uint16_t Pdu_size[8];
+    uint8_t payload[8][SCH_PAYLOAD_SIZE_MAX];
+    uint16_t Pdu_size[8];
 } __attribute__ ((__packed__)) DLSCH_PDU;
 
 
 /*! \brief MCH PDU Structure */
 typedef struct {
-  int8_t payload[SCH_PAYLOAD_SIZE_MAX];
-  uint16_t Pdu_size;
-  uint8_t mcs;
-  uint8_t sync_area;
-  uint8_t msi_active;
-  uint8_t mcch_active;
-  uint8_t mtch_active;
+    int8_t payload[SCH_PAYLOAD_SIZE_MAX];
+    uint16_t Pdu_size;
+    uint8_t mcs;
+    uint8_t sync_area;
+    uint8_t msi_active;
+    uint8_t mcch_active;
+    uint8_t mtch_active;
 } __attribute__ ((__packed__)) MCH_PDU;
 
 /*! \brief Uplink SCH PDU Structure */
 typedef struct {
-  int8_t payload[SCH_PAYLOAD_SIZE_MAX];         /*!< \brief SACH payload */
-  uint16_t Pdu_size;
+    int8_t payload[SCH_PAYLOAD_SIZE_MAX];	/*!< \brief SACH payload */
+    uint16_t Pdu_size;
 } __attribute__ ((__packed__)) ULSCH_PDU;
 
 #include "PHY/impl_defs_top.h"
 
+/*!\brief RA process state*/
+typedef enum {
+    IDLE = 0,
+    MSG2,
+    WAITMSG3,
+    MSG4,
+    WAITMSG4ACK
+} RA_state;
+
 /*!\brief  UE ULSCH scheduling states*/
 typedef enum {
-  S_UL_NONE =0,
-  S_UL_WAITING,
-  S_UL_SCHEDULED,
-  S_UL_BUFFERED,
-  S_UL_NUM_STATUS
+    S_UL_NONE = 0,
+    S_UL_WAITING,
+    S_UL_SCHEDULED,
+    S_UL_BUFFERED,
+    S_UL_NUM_STATUS
 } UE_ULSCH_STATUS;
 
 /*!\brief  UE DLSCH scheduling states*/
 typedef enum {
-  S_DL_NONE =0,
-  S_DL_WAITING,
-  S_DL_SCHEDULED,
-  S_DL_BUFFERED,
-  S_DL_NUM_STATUS
+    S_DL_NONE = 0,
+    S_DL_WAITING,
+    S_DL_SCHEDULED,
+    S_DL_BUFFERED,
+    S_DL_NUM_STATUS
 } UE_DLSCH_STATUS;
 
 /*!\brief  scheduling policy for the contention-based access */
 typedef enum {
-  CBA_ES=0, /// equal share of RB among groups w
-  CBA_ES_S,  /// equal share of RB among groups with small allocation
-  CBA_PF, /// proportional fair (kind of)
-  CBA_PF_S,  /// proportional fair (kind of) with small RB allocation
-  CBA_RS /// random allocation
+    CBA_ES = 0,			/// equal share of RB among groups w
+    CBA_ES_S,			/// equal share of RB among groups with small allocation
+    CBA_PF,			/// proportional fair (kind of)
+    CBA_PF_S,			/// proportional fair (kind of) with small RB allocation
+    CBA_RS			/// random allocation
 } CBA_POLICY;
 
 
 /*! \brief temporary struct for ULSCH sched */
 typedef struct {
-  rnti_t rnti;
-  uint16_t subframe;
-  uint16_t serving_num;
-  UE_ULSCH_STATUS status;
+    rnti_t rnti;
+    uint16_t subframe;
+    uint16_t serving_num;
+    UE_ULSCH_STATUS status;
 } eNB_ULSCH_INFO;
 /*! \brief temp struct for DLSCH sched */
 typedef struct {
-  rnti_t rnti;
-  uint16_t weight;
-  uint16_t subframe;
-  uint16_t serving_num;
-  UE_DLSCH_STATUS status;
+    rnti_t rnti;
+    uint16_t weight;
+    uint16_t subframe;
+    uint16_t serving_num;
+    UE_DLSCH_STATUS status;
 } eNB_DLSCH_INFO;
 /*! \brief eNB overall statistics */
 typedef struct {
-  /// num BCCH PDU per CC 
-  uint32_t total_num_bcch_pdu;
-  /// BCCH buffer size  
-  uint32_t bcch_buffer;
-  /// total BCCH buffer size  
-  uint32_t total_bcch_buffer;
-  /// BCCH MCS
-  uint32_t bcch_mcs;
-
-  /// num CCCH PDU per CC 
-  uint32_t total_num_ccch_pdu;
-  /// BCCH buffer size  
-  uint32_t ccch_buffer;
-  /// total BCCH buffer size  
-  uint32_t total_ccch_buffer;
+    /// num BCCH PDU per CC
+    uint32_t total_num_bcch_pdu;
+    /// BCCH buffer size
+    uint32_t bcch_buffer;
+    /// total BCCH buffer size
+    uint32_t total_bcch_buffer;
+    /// BCCH MCS
+    uint32_t bcch_mcs;
+
+    /// num CCCH PDU per CC
+    uint32_t total_num_ccch_pdu;
+    /// BCCH buffer size
+    uint32_t ccch_buffer;
+    /// total BCCH buffer size
+    uint32_t total_ccch_buffer;
+    /// BCCH MCS
+    uint32_t ccch_mcs;
+
+  /// num PCCH PDU per CC
+  uint32_t total_num_pcch_pdu;
+  /// PCCH buffer size
+  uint32_t pcch_buffer;
+  /// total PCCH buffer size
+  uint32_t total_pcch_buffer;
   /// BCCH MCS
-  uint32_t ccch_mcs;
+  uint32_t pcch_mcs;
 
 /// num active users
-  uint16_t num_dlactive_UEs;
-  ///  available number of PRBs for a give SF
-  uint16_t available_prbs;
-  /// total number of PRB available for the user plane
-  uint32_t total_available_prbs;
-  /// aggregation
-  /// total avilable nccc : num control channel element
-  uint16_t available_ncces;
-  // only for a new transmission, should be extended for retransmission
-  // current dlsch  bit rate for all transport channels
-  uint32_t dlsch_bitrate;
-  //
-  uint32_t dlsch_bytes_tx;
-  //
-  uint32_t dlsch_pdus_tx;
-  //
-  uint32_t total_dlsch_bitrate;
-  //
-  uint32_t total_dlsch_bytes_tx;
-  //
-  uint32_t total_dlsch_pdus_tx;
-  
-  // here for RX
-  //
-  uint32_t ulsch_bitrate;
-  //
-  uint32_t ulsch_bytes_rx;
-  //
-  uint64_t ulsch_pdus_rx; 
-
-  uint32_t total_ulsch_bitrate;
-  //
-  uint32_t total_ulsch_bytes_rx;
-  //
-  uint32_t total_ulsch_pdus_rx;
-  
-  
-  /// MAC agent-related stats
-  /// total number of scheduling decisions
-  int sched_decisions;
-  /// missed deadlines
-  int missed_deadlines;
+    uint16_t num_dlactive_UEs;
+    ///  available number of PRBs for a give SF
+    uint16_t available_prbs;
+    /// total number of PRB available for the user plane
+    uint32_t total_available_prbs;
+    /// aggregation
+    /// total avilable nccc : num control channel element
+    uint16_t available_ncces;
+    // only for a new transmission, should be extended for retransmission
+    // current dlsch  bit rate for all transport channels
+    uint32_t dlsch_bitrate;
+    //
+    uint32_t dlsch_bytes_tx;
+    //
+    uint32_t dlsch_pdus_tx;
+    //
+    uint32_t total_dlsch_bitrate;
+    //
+    uint32_t total_dlsch_bytes_tx;
+    //
+    uint32_t total_dlsch_pdus_tx;
+
+    // here for RX
+    //
+    uint32_t ulsch_bitrate;
+    //
+    uint32_t ulsch_bytes_rx;
+    //
+    uint64_t ulsch_pdus_rx;
+
+    uint32_t total_ulsch_bitrate;
+    //
+    uint32_t total_ulsch_bytes_rx;
+    //
+    uint32_t total_ulsch_pdus_rx;
+
+
+    /// MAC agent-related stats
+    /// total number of scheduling decisions
+    int sched_decisions;
+    /// missed deadlines
+    int missed_deadlines;
 
 } eNB_STATS;
 /*! \brief eNB statistics for the connected UEs*/
 typedef struct {
 
-  /// CRNTI of UE
-  rnti_t crnti; ///user id (rnti) of connected UEs
-  // rrc status
-  uint8_t rrc_status;
-  /// harq pid
-  uint8_t harq_pid;
-  /// harq rounf
-  uint8_t harq_round;
-  /// total available number of PRBs for a new transmission
-  uint16_t rbs_used;
-  /// total available number of PRBs for a retransmission
-  uint16_t rbs_used_retx;
-  /// total nccc used for a new transmission: num control channel element
-  uint16_t ncce_used;
-  /// total avilable nccc for a retransmission: num control channel element
-  uint16_t ncce_used_retx;
-
-  // mcs1 before the rate adaptaion
-  uint8_t dlsch_mcs1;
-  /// Target mcs2 after rate-adaptation
-  uint8_t dlsch_mcs2;
-  //  current TBS with mcs2
-  uint32_t TBS;
-  //  total TBS with mcs2
-  //  uint32_t total_TBS;
-  //  total rb used for a new transmission
-  uint32_t total_rbs_used;
-  //  total rb used for retransmission
-  uint32_t total_rbs_used_retx;
-
-   /// TX
-  /// Num pkt
-  uint32_t num_pdu_tx[NB_RB_MAX];
-  /// num bytes
-  uint32_t num_bytes_tx[NB_RB_MAX];
-  /// num retransmission / harq
-  uint32_t num_retransmission;
-  /// instantaneous tx throughput for each TTI
-  //  uint32_t tti_throughput[NB_RB_MAX];
-
-  /// overall
-  //
-  uint32_t  dlsch_bitrate;
-  //total
-  uint32_t  total_dlsch_bitrate;
-  /// headers+ CE +  padding bytes for a MAC PDU
-  uint64_t overhead_bytes;
-  /// headers+ CE +  padding bytes for a MAC PDU
-  uint64_t total_overhead_bytes;
-  /// headers+ CE +  padding bytes for a MAC PDU
-  uint64_t avg_overhead_bytes;
-  // MAC multiplexed payload
-  uint64_t total_sdu_bytes;
-  // total MAC pdu bytes
-  uint64_t total_pdu_bytes;
-
-  // total num pdu
-  uint32_t total_num_pdus;
-  //
-  //  uint32_t avg_pdu_size;
-
-  /// RX
-
-  /// PUCCH1a/b power (dBm)
-  int32_t Po_PUCCH_dBm;
-  /// Indicator that Po_PUCCH has been updated by PHY
-  int32_t Po_PUCCH_update;
-  /// Uplink measured RSSI
-  int32_t UL_rssi;
-  /// preassigned mcs after rate adaptation
-  uint8_t ulsch_mcs1;
-  /// adjusted mcs
-  uint8_t ulsch_mcs2;
-
-  /// estimated average pdu inter-departure time
-  uint32_t avg_pdu_idt;
-  /// estimated average pdu size
-  uint32_t avg_pdu_ps;
-  ///
-  uint32_t aggregated_pdu_size;
-  uint32_t aggregated_pdu_arrival;
-
-  ///  uplink transport block size
-  uint32_t ulsch_TBS;
-
-  ///  total rb used for a new uplink transmission
-  uint32_t num_retransmission_rx;
-  ///  total rb used for a new uplink transmission
-  uint32_t rbs_used_rx;
-   ///  total rb used for a new uplink retransmission
-  uint32_t rbs_used_retx_rx;
-  ///  total rb used for a new uplink transmission
-  uint32_t total_rbs_used_rx;
-  /// normalized rx power 
-  int32_t      normalized_rx_power;
-   /// target rx power 
-  int32_t    target_rx_power;
-
-  /// num rx pdu
-  uint32_t num_pdu_rx[NB_RB_MAX];
-  /// num bytes rx
-  uint32_t num_bytes_rx[NB_RB_MAX];
-  /// instantaneous rx throughput for each TTI
-  //  uint32_t tti_goodput[NB_RB_MAX];
-  /// errors
-  uint32_t num_errors_rx;
-  
-  uint64_t overhead_bytes_rx;
-  /// headers+ CE +  padding bytes for a MAC PDU
-  uint64_t total_overhead_bytes_rx;
-  /// headers+ CE +  padding bytes for a MAC PDU
-  uint64_t avg_overhead_bytes_rx;
- //
-  uint32_t  ulsch_bitrate;
-  //total
-  uint32_t  total_ulsch_bitrate;
-  /// overall
-  ///  MAC pdu bytes
-  uint64_t pdu_bytes_rx;
-  /// total MAC pdu bytes
-  uint64_t total_pdu_bytes_rx;
-  /// total num pdu
-  uint32_t total_num_pdus_rx;
-  /// num of error pdus
-  uint32_t total_num_errors_rx;
+    /// CRNTI of UE
+    rnti_t crnti;		///user id (rnti) of connected UEs
+    // rrc status
+    uint8_t rrc_status;
+    /// harq pid
+    uint8_t harq_pid;
+    /// harq rounf
+    uint8_t harq_round;
+    /// total available number of PRBs for a new transmission
+    uint16_t rbs_used;
+    /// total available number of PRBs for a retransmission
+    uint16_t rbs_used_retx;
+    /// total nccc used for a new transmission: num control channel element
+    uint16_t ncce_used;
+    /// total avilable nccc for a retransmission: num control channel element
+    uint16_t ncce_used_retx;
+
+    // mcs1 before the rate adaptaion
+    uint8_t dlsch_mcs1;
+    /// Target mcs2 after rate-adaptation
+    uint8_t dlsch_mcs2;
+    //  current TBS with mcs2
+    uint32_t TBS;
+    //  total TBS with mcs2
+    //  uint32_t total_TBS;
+    //  total rb used for a new transmission
+    uint32_t total_rbs_used;
+    //  total rb used for retransmission
+    uint32_t total_rbs_used_retx;
+
+    /// TX
+    /// Num pkt
+    uint32_t num_pdu_tx[NB_RB_MAX];
+    /// num bytes
+    uint32_t num_bytes_tx[NB_RB_MAX];
+    /// num retransmission / harq
+    uint32_t num_retransmission;
+    /// instantaneous tx throughput for each TTI
+    //  uint32_t tti_throughput[NB_RB_MAX];
+    // Number of received MAC SDU
+    uint32_t num_mac_sdu_tx;
+    // LCID related to SDU
+    unsigned char lcid_sdu[NB_RB_MAX];
+    // Length of SDU Got from LC DL
+    uint32_t sdu_length_tx[NB_RB_MAX];
+
+
+    /// overall
+    //
+    uint32_t dlsch_bitrate;
+    //total
+    uint32_t total_dlsch_bitrate;
+    /// headers+ CE +  padding bytes for a MAC PDU
+    uint64_t overhead_bytes;
+    /// headers+ CE +  padding bytes for a MAC PDU
+    uint64_t total_overhead_bytes;
+    /// headers+ CE +  padding bytes for a MAC PDU
+    uint64_t avg_overhead_bytes;
+    // MAC multiplexed payload
+    uint64_t total_sdu_bytes;
+    // total MAC pdu bytes
+    uint64_t total_pdu_bytes;
+
+    // total num pdu
+    uint32_t total_num_pdus;
+    //
+    //  uint32_t avg_pdu_size;
+
+    /// RX
+
+    /// PUCCH1a/b power (dBm)
+    int32_t Po_PUCCH_dBm;
+    /// Indicator that Po_PUCCH has been updated by PHY
+    int32_t Po_PUCCH_update;
+    /// Uplink measured RSSI
+    int32_t UL_rssi;
+    /// preassigned mcs after rate adaptation
+    uint8_t ulsch_mcs1;
+    /// adjusted mcs
+    uint8_t ulsch_mcs2;
+
+    /// estimated average pdu inter-departure time
+    uint32_t avg_pdu_idt;
+    /// estimated average pdu size
+    uint32_t avg_pdu_ps;
+    ///
+    uint32_t aggregated_pdu_size;
+    uint32_t aggregated_pdu_arrival;
+
+    ///  uplink transport block size
+    uint32_t ulsch_TBS;
+
+    uint32_t total_ulsch_TBS;
+
+    ///  total rb used for a new uplink transmission
+    uint32_t num_retransmission_rx;
+    ///  total rb used for a new uplink transmission
+    uint32_t rbs_used_rx;
+    ///  total rb used for a new uplink retransmission
+    uint32_t rbs_used_retx_rx;
+    ///  total rb used for a new uplink transmission
+    uint32_t total_rbs_used_rx;
+    /// normalized rx power
+    int32_t normalized_rx_power;
+    /// target rx power
+    int32_t target_rx_power;
+
+    /// num rx pdu
+    uint32_t num_pdu_rx[NB_RB_MAX];
+    /// num bytes rx
+    uint32_t num_bytes_rx[NB_RB_MAX];
+    /// instantaneous rx throughput for each TTI
+    //  uint32_t tti_goodput[NB_RB_MAX];
+    /// errors
+    uint32_t num_errors_rx;
+
+    uint64_t overhead_bytes_rx;
+    /// headers+ CE +  padding bytes for a MAC PDU
+    uint64_t total_overhead_bytes_rx;
+    /// headers+ CE +  padding bytes for a MAC PDU
+    uint64_t avg_overhead_bytes_rx;
+    //
+    uint32_t ulsch_bitrate;
+    //total
+    uint32_t total_ulsch_bitrate;
+    /// overall
+    ///  MAC pdu bytes
+    uint64_t pdu_bytes_rx;
+    /// total MAC pdu bytes
+    uint64_t total_pdu_bytes_rx;
+    /// total num pdu
+    uint32_t total_num_pdus_rx;
+    /// num of error pdus
+    uint32_t total_num_errors_rx;
+    // Number of error PDUS
+    uint32_t num_mac_sdu_rx;
+    // Length of SDU Got from LC UL - Size array can be refined
+    uint32_t      sdu_length_rx[NB_RB_MAX];
 
 } eNB_UE_STATS;
 /*! \brief eNB template for UE context information  */
 typedef struct {
-  /// C-RNTI of UE
-  rnti_t rnti;
-  /// NDI from last scheduling
-  uint8_t oldNDI[8];
-  /// mcs1 from last scheduling
-  uint8_t oldmcs1[8];
-  /// mcs2 from last scheduling
-  uint8_t oldmcs2[8];
-  /// NDI from last UL scheduling
-  uint8_t oldNDI_UL[8];
-  /// mcs from last UL scheduling
-  uint8_t mcs_UL[8];
-  /// TBS from last UL scheduling
-  uint8_t TBS_UL[8];
-  /// Flag to indicate UL has been scheduled at least once
-  boolean_t ul_active;
-  /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
-  boolean_t configured;
-
-  /// MCS from last scheduling
-  uint8_t mcs[8];
-
-  /// TPC from last scheduling
-  uint8_t oldTPC[8];
-
-  // PHY interface info
-
-  /// Number of Allocated RBs for DL after scheduling (prior to frequency allocation)
-  uint16_t nb_rb[8]; // num_max_harq
-
-  /// Number of Allocated RBs for UL after scheduling
-  uint16_t nb_rb_ul[8]; // num_max_harq
-
-  /// Number of Allocated RBs for UL after scheduling
-  uint16_t first_rb_ul[8]; // num_max_harq
-
-  /// Cyclic shift for DMRS after scheduling
-  uint16_t cshift[8]; // num_max_harq
-
-  /// Number of Allocated RBs by the ulsch preprocessor
-  uint8_t pre_allocated_nb_rb_ul;
-
-  /// index of Allocated RBs by the ulsch preprocessor
-  int8_t pre_allocated_rb_table_index_ul;
-
-  /// total allocated RBs
-  int8_t total_allocated_rbs;
-
-  /// pre-assigned MCS by the ulsch preprocessor
-  uint8_t pre_assigned_mcs_ul;
-
-  /// assigned MCS by the ulsch scheduler
-  uint8_t assigned_mcs_ul;
-
-  /// DL DAI
-  uint8_t DAI;
-
-  /// UL DAI
-  uint8_t DAI_ul[10];
-
-  /// UL Scheduling Request Received
-  uint8_t ul_SR;
-
-  ///Resource Block indication for each sub-band in MU-MIMO
-  uint8_t rballoc_subband[8][50];
-
-  // Logical channel info for link with RLC
-
-  /// Last received UE BSR info for each logical channel group id
-  uint8_t bsr_info[MAX_NUM_LCGID];
-
-  /// LCGID mapping
-  long lcgidmap[11];
-
-  /// phr information
-  int8_t phr_info;
-
-  /// phr information
-  int8_t phr_info_configured;
-
-  ///dl buffer info
-  uint32_t dl_buffer_info[MAX_NUM_LCID];
-  /// total downlink buffer info
-  uint32_t dl_buffer_total;
-  /// total downlink pdus
-  uint32_t dl_pdus_total;
-  /// downlink pdus for each LCID
-  uint32_t dl_pdus_in_buffer[MAX_NUM_LCID];
-  /// creation time of the downlink buffer head for each LCID
-  uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID];
-  /// maximum creation time of the downlink buffer head across all LCID
-  uint32_t  dl_buffer_head_sdu_creation_time_max;
-  /// a flag indicating that the downlink head SDU is segmented  
-  uint8_t    dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID];
-  /// size of remaining size to send for the downlink head SDU
-  uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
-
-  /// total uplink buffer size 
-  uint32_t ul_total_buffer;
-  /// uplink buffer creation time for each LCID
-  uint32_t ul_buffer_creation_time[MAX_NUM_LCGID];
-  /// maximum uplink buffer creation time across all the LCIDs
-  uint32_t ul_buffer_creation_time_max;
-  /// uplink buffer size per LCID
-  uint32_t ul_buffer_info[MAX_NUM_LCGID];
-
-  /// UE tx power
-  int32_t ue_tx_power;
+    /// C-RNTI of UE
+    rnti_t rnti;
+    /// NDI from last scheduling
+    uint8_t oldNDI[8];
+    /// mcs1 from last scheduling
+    uint8_t oldmcs1[8];
+    /// mcs2 from last scheduling
+    uint8_t oldmcs2[8];
+    /// NDI from last UL scheduling
+    uint8_t oldNDI_UL[8];
+    /// mcs from last UL scheduling
+    uint8_t mcs_UL[8];
+    /// TBS from last UL scheduling
+    int TBS_UL[8];
+    /// Flag to indicate UL has been scheduled at least once
+    boolean_t ul_active;
+    /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
+    boolean_t configured;
+
+    /// MCS from last scheduling
+    uint8_t mcs[8];
+
+    /// TPC from last scheduling
+    uint8_t oldTPC[8];
+
+    // PHY interface info
+
+    /// Number of Allocated RBs for DL after scheduling (prior to frequency allocation)
+    uint16_t nb_rb[8];		// num_max_harq
+
+    /// Number of Allocated RBs for UL after scheduling
+    uint16_t nb_rb_ul[8];	// num_max_harq
+
+    /// Number of Allocated RBs for UL after scheduling
+    uint16_t first_rb_ul[8];	// num_max_harq
+
+    /// Cyclic shift for DMRS after scheduling
+    uint16_t cshift[8];		// num_max_harq
+
+    /// Number of Allocated RBs by the ulsch preprocessor
+    uint8_t pre_allocated_nb_rb_ul[MAX_NUM_SLICES];
+
+    /// index of Allocated RBs by the ulsch preprocessor
+    int8_t pre_allocated_rb_table_index_ul;
+
+    /// total allocated RBs
+    int8_t total_allocated_rbs;
+
+    /// pre-assigned MCS by the ulsch preprocessor
+    uint8_t pre_assigned_mcs_ul;
+
+    /// assigned MCS by the ulsch scheduler
+    uint8_t assigned_mcs_ul;
+
+    /// DL DAI
+    uint8_t DAI;
+
+    /// UL DAI
+    uint8_t DAI_ul[10];
+
+    /// UL Scheduling Request Received
+    uint8_t ul_SR;
+
+    ///Resource Block indication for each sub-band in MU-MIMO
+    uint8_t rballoc_subband[8][50];
+
+    // Logical channel info for link with RLC
+
+    /// LCGID mapping
+    long lcgidmap[11];
+
+    /// phr information
+    int8_t phr_info;
+
+    /// phr information
+    int8_t phr_info_configured;
+
+    ///dl buffer info
+    uint32_t dl_buffer_info[MAX_NUM_LCID];
+    /// total downlink buffer info
+    uint32_t dl_buffer_total;
+    /// total downlink pdus
+    uint32_t dl_pdus_total;
+    /// downlink pdus for each LCID
+    uint32_t dl_pdus_in_buffer[MAX_NUM_LCID];
+    /// creation time of the downlink buffer head for each LCID
+    uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID];
+    /// maximum creation time of the downlink buffer head across all LCID
+    uint32_t dl_buffer_head_sdu_creation_time_max;
+    /// a flag indicating that the downlink head SDU is segmented
+    uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID];
+    /// size of remaining size to send for the downlink head SDU
+    uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
+
+    /// uplink buffer creation time for each LCID
+    uint32_t ul_buffer_creation_time[MAX_NUM_LCGID];
+    /// maximum uplink buffer creation time across all the LCIDs
+    uint32_t ul_buffer_creation_time_max;
+    /// uplink buffer size per LCID
+    uint32_t ul_buffer_info[MAX_NUM_LCGID];
+
+    /// uplink bytes that are currently scheduled
+    int scheduled_ul_bytes;
+    /// estimation of the UL buffer size
+    int estimated_ul_buffer;
+
+    /// UE tx power
+    int32_t ue_tx_power;
 
-  /// stores the frame where the last TPC was transmitted
-  uint32_t pusch_tpc_tx_frame;
-  uint32_t pusch_tpc_tx_subframe;
-  uint32_t pucch_tpc_tx_frame;
-  uint32_t pucch_tpc_tx_subframe;
+    /// stores the frame where the last TPC was transmitted
+    uint32_t pusch_tpc_tx_frame;
+    uint32_t pusch_tpc_tx_subframe;
+    uint32_t pucch_tpc_tx_frame;
+    uint32_t pucch_tpc_tx_subframe;
 
 #ifdef LOCALIZATION
-  eNB_UE_estimated_distances distance;
+    eNB_UE_estimated_distances distance;
 #endif
 
 #ifdef Rel14
-  uint8_t rach_resource_type;
-  uint16_t mpdcch_repetition_cnt;
-  frame_t Msg2_frame;
+    uint8_t rach_resource_type;
+    uint16_t mpdcch_repetition_cnt;
+    frame_t Msg2_frame;
 #endif
-  sub_frame_t Msg2_subframe;
+    sub_frame_t Msg2_subframe;
 
-  PhysicalConfigDedicated_t  *physicalConfigDedicated;
+    PhysicalConfigDedicated_t *physicalConfigDedicated;
 
 } UE_TEMPLATE;
 
 /*! \brief scheduling control information set through an API (not used)*/
 typedef struct {
-  ///UL transmission bandwidth in RBs
-  uint8_t ul_bandwidth[MAX_NUM_LCID];
-  ///DL transmission bandwidth in RBs
-  uint8_t dl_bandwidth[MAX_NUM_LCID];
-
-  //To do GBR bearer
-  uint8_t min_ul_bandwidth[MAX_NUM_LCID];
-
-  uint8_t min_dl_bandwidth[MAX_NUM_LCID];
-
-  ///aggregated bit rate of non-gbr bearer per UE
-  uint64_t  ue_AggregatedMaximumBitrateDL;
-  ///aggregated bit rate of non-gbr bearer per UE
-  uint64_t  ue_AggregatedMaximumBitrateUL;
-  ///CQI scheduling interval in subframes.
-  uint16_t cqiSchedInterval;
-  ///Contention resolution timer used during random access
-  uint8_t mac_ContentionResolutionTimer;
-
-  uint16_t max_allowed_rbs[MAX_NUM_LCID];
-
-  uint8_t max_mcs[MAX_NUM_LCID];
-
-  uint16_t priority[MAX_NUM_LCID];
-
-  // resource scheduling information
-  
-  /// Current DL harq round per harq_pid on each CC
-  uint8_t       round[MAX_NUM_CCs][10];
-  /// Current Active TBs per harq_pid on each CC
-  uint8_t       tbcnt[MAX_NUM_CCs][10];
-  /// Current UL harq round per harq_pid on each CC
-  uint8_t       round_UL[MAX_NUM_CCs][8];
-  uint8_t       dl_pow_off[MAX_NUM_CCs];
-  uint16_t      pre_nb_available_rbs[MAX_NUM_CCs];
-  unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX];
-  uint16_t      ta_timer;
-  int16_t       ta_update;
-  uint16_t      ul_consecutive_errors;
-  int32_t       context_active_timer;
-  int32_t       cqi_req_timer;
-  int32_t       ul_inactivity_timer;
-  int32_t       ul_failure_timer; 
-  int32_t       ul_scheduled;
-  int32_t       ra_pdcch_order_sent;
-  int32_t       ul_out_of_sync;
-  int32_t       phr_received;
-  uint8_t       periodic_ri_received[NFAPI_CC_MAX];
-  uint8_t       aperiodic_ri_received[NFAPI_CC_MAX];
-  uint8_t       pucch1_cqi_update[NFAPI_CC_MAX];
-  uint8_t       pucch1_snr[NFAPI_CC_MAX];
-  uint8_t       pucch2_cqi_update[NFAPI_CC_MAX];
-  uint8_t       pucch2_snr[NFAPI_CC_MAX];
-  uint8_t       pucch3_cqi_update[NFAPI_CC_MAX];
-  uint8_t       pucch3_snr[NFAPI_CC_MAX];
-  uint8_t       pusch_snr[NFAPI_CC_MAX];
-  uint16_t      feedback_cnt[NFAPI_CC_MAX];
-  uint16_t      timing_advance;
-  uint16_t      timing_advance_r9;
-  uint8_t       periodic_wideband_cqi[NFAPI_CC_MAX];
-  uint8_t       periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX];
-  uint8_t       periodic_wideband_pmi[NFAPI_CC_MAX];
-  uint8_t       periodic_subband_cqi[NFAPI_CC_MAX][16];
-  uint8_t       periodic_subband_spatial_diffcqi[NFAPI_CC_MAX][16];
-  uint8_t       aperiodic_subband_cqi0[NFAPI_CC_MAX][25];
-  uint8_t       aperiodic_subband_pmi[NFAPI_CC_MAX][25];
-  uint8_t       aperiodic_subband_diffcqi0[NFAPI_CC_MAX][25];
-  uint8_t       aperiodic_subband_cqi1[NFAPI_CC_MAX][25];
-  uint8_t       aperiodic_subband_diffcqi1[NFAPI_CC_MAX][25];
-  uint8_t       aperiodic_wideband_cqi0[NFAPI_CC_MAX];
-  uint8_t       aperiodic_wideband_pmi[NFAPI_CC_MAX];
-  uint8_t       aperiodic_wideband_cqi1[NFAPI_CC_MAX];
-  uint8_t       aperiodic_wideband_pmi1[NFAPI_CC_MAX];
-  uint8_t       dl_cqi[NFAPI_CC_MAX];
+    ///UL transmission bandwidth in RBs
+    uint8_t ul_bandwidth[MAX_NUM_LCID];
+    ///DL transmission bandwidth in RBs
+    uint8_t dl_bandwidth[MAX_NUM_LCID];
+
+    //To do GBR bearer
+    uint8_t min_ul_bandwidth[MAX_NUM_LCID];
+
+    uint8_t min_dl_bandwidth[MAX_NUM_LCID];
+
+    ///aggregated bit rate of non-gbr bearer per UE
+    uint64_t ue_AggregatedMaximumBitrateDL;
+    ///aggregated bit rate of non-gbr bearer per UE
+    uint64_t ue_AggregatedMaximumBitrateUL;
+    ///CQI scheduling interval in subframes.
+    uint16_t cqiSchedInterval;
+    ///Contention resolution timer used during random access
+    uint8_t mac_ContentionResolutionTimer;
+
+    uint16_t max_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES];
+    uint16_t max_rbs_allowed_slice_uplink[MAX_NUM_CCs][MAX_NUM_SLICES];
+
+    uint8_t max_mcs[MAX_NUM_LCID];
+
+    uint16_t priority[MAX_NUM_LCID];
+
+    // resource scheduling information
+
+    /// Current DL harq round per harq_pid on each CC
+    uint8_t round[MAX_NUM_CCs][10];
+    /// Current Active TBs per harq_pid on each CC
+    uint8_t tbcnt[MAX_NUM_CCs][10];
+    /// Current UL harq round per harq_pid on each CC
+    uint8_t round_UL[MAX_NUM_CCs][8];
+    uint8_t dl_pow_off[MAX_NUM_CCs];
+    uint16_t pre_nb_available_rbs[MAX_NUM_CCs];
+    unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX];
+    uint16_t ta_timer;
+    int16_t ta_update;
+    uint16_t ul_consecutive_errors;
+    int32_t context_active_timer;
+    int32_t cqi_req_timer;
+    int32_t ul_inactivity_timer;
+    int32_t ul_failure_timer;
+    uint32_t ue_reestablishment_reject_timer;
+    uint32_t ue_reestablishment_reject_timer_thres;
+    int32_t ul_scheduled;
+    int32_t ra_pdcch_order_sent;
+    int32_t ul_out_of_sync;
+    int32_t phr_received;
+    uint8_t periodic_ri_received[NFAPI_CC_MAX];
+    uint8_t aperiodic_ri_received[NFAPI_CC_MAX];
+    uint8_t pucch1_cqi_update[NFAPI_CC_MAX];
+    uint8_t pucch1_snr[NFAPI_CC_MAX];
+    uint8_t pucch2_cqi_update[NFAPI_CC_MAX];
+    uint8_t pucch2_snr[NFAPI_CC_MAX];
+    uint8_t pucch3_cqi_update[NFAPI_CC_MAX];
+    uint8_t pucch3_snr[NFAPI_CC_MAX];
+    uint8_t pusch_snr[NFAPI_CC_MAX];
+    uint16_t feedback_cnt[NFAPI_CC_MAX];
+    uint16_t timing_advance;
+    uint16_t timing_advance_r9;
+    uint8_t periodic_wideband_cqi[NFAPI_CC_MAX];
+    uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX];
+    uint8_t periodic_wideband_pmi[NFAPI_CC_MAX];
+    uint8_t periodic_subband_cqi[NFAPI_CC_MAX][16];
+    uint8_t periodic_subband_spatial_diffcqi[NFAPI_CC_MAX][16];
+    uint8_t aperiodic_subband_cqi0[NFAPI_CC_MAX][25];
+    uint8_t aperiodic_subband_pmi[NFAPI_CC_MAX][25];
+    uint8_t aperiodic_subband_diffcqi0[NFAPI_CC_MAX][25];
+    uint8_t aperiodic_subband_cqi1[NFAPI_CC_MAX][25];
+    uint8_t aperiodic_subband_diffcqi1[NFAPI_CC_MAX][25];
+    uint8_t aperiodic_wideband_cqi0[NFAPI_CC_MAX];
+    uint8_t aperiodic_wideband_pmi[NFAPI_CC_MAX];
+    uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX];
+    uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX];
+    uint8_t dl_cqi[NFAPI_CC_MAX];
+    int32_t       uplane_inactivity_timer;
 } UE_sched_ctrl;
 /*! \brief eNB template for the Random access information */
 typedef struct {
-  /// Flag to indicate this process is active
-  boolean_t RA_active;
-  /// Size of DCI for RA-Response (bytes)
-  uint8_t RA_dci_size_bytes1;
-  /// Size of DCI for RA-Response (bits)
-  uint8_t RA_dci_size_bits1;
-  /// Actual DCI to transmit for RA-Response
-  uint8_t RA_alloc_pdu1[(MAX_DCI_SIZE_BITS>>3)+1];
-  /// DCI format for RA-Response (should be 1A)
-  uint8_t RA_dci_fmt1;
-  /// Size of DCI for Msg4/ContRes (bytes)
-  uint8_t RA_dci_size_bytes2;
-  /// Size of DCI for Msg4/ContRes (bits)
-  uint8_t RA_dci_size_bits2;
-  /// Actual DCI to transmit for Msg4/ContRes
-  uint8_t RA_alloc_pdu2[(MAX_DCI_SIZE_BITS>>3)+1];
-  /// DCI format for Msg4/ContRes (should be 1A)
-  uint8_t RA_dci_fmt2;
-  /// Flag to indicate the eNB should generate RAR.  This is triggered by detection of PRACH
-  uint8_t generate_rar;
-  /// Subframe where preamble was received
-  uint8_t preamble_subframe;
-  /// Subframe where Msg2 is to be sent
-  uint8_t Msg2_subframe;
-  /// Frame where Msg2 is to be sent
-  frame_t Msg2_frame;
-  /// Subframe where Msg3 is to be sent
-  sub_frame_t Msg3_subframe;
-  /// Frame where Msg3 is to be sent
-  frame_t Msg3_frame;
-  /// Subframe where Msg4 is to be sent
-  sub_frame_t Msg4_subframe;
-  /// Frame where Msg4 is to be sent
-  frame_t Msg4_frame;
-  /// Flag to indicate the eNB should generate Msg4 upon reception of SDU from RRC.  This is triggered by first ULSCH reception at eNB for new user.
-  uint8_t generate_Msg4;
-  /// Flag to indicate that eNB is waiting for ACK that UE has received Msg3.
-  uint8_t wait_ack_Msg4;
-  /// harq_pid used for Msg4 transmission
-  uint8_t harq_pid;
-  /// UE RNTI allocated during RAR
-  rnti_t rnti;
-  /// RA RNTI allocated from received PRACH
-  uint16_t RA_rnti;
-  /// Received preamble_index
-  uint8_t preamble_index;
-  /// Received UE Contention Resolution Identifier
-  uint8_t cont_res_id[6];
-  /// Timing offset indicated by PHY
-  int16_t timing_offset;
-  /// Timeout for RRC connection
-  int16_t RRC_timer;
-  /// Msg3 first RB
-  uint8_t msg3_first_rb;
-  /// Msg3 number of RB
-  uint8_t msg3_nb_rb;
-  /// Msg3 MCS
-  uint8_t msg3_mcs;
-  /// Msg3 TPC command
-  uint8_t msg3_TPC;
-  /// Msg3 ULdelay command
-  uint8_t msg3_ULdelay;
-  /// Msg3 cqireq command
-  uint8_t msg3_cqireq;
-  /// Round of Msg3 HARQ
-  uint8_t msg3_round;
-  /// TBS used for Msg4
-  int msg4_TBsize;
-  /// MCS used for Msg4
-  int msg4_mcs;
+    /// Flag to indicate this process is active
+    RA_state state;
+    /// Subframe where preamble was received
+    uint8_t preamble_subframe;
+    /// Subframe where Msg2 is to be sent
+    uint8_t Msg2_subframe;
+    /// Frame where Msg2 is to be sent
+    frame_t Msg2_frame;
+    /// Subframe where Msg3 is to be sent
+    sub_frame_t Msg3_subframe;
+    /// Frame where Msg3 is to be sent
+    frame_t Msg3_frame;
+    /// Subframe where Msg4 is to be sent
+    sub_frame_t Msg4_subframe;
+    /// Frame where Msg4 is to be sent
+    frame_t Msg4_frame;
+    /// harq_pid used for Msg4 transmission
+    uint8_t harq_pid;
+    /// UE RNTI allocated during RAR
+    rnti_t rnti;
+    /// RA RNTI allocated from received PRACH
+    uint16_t RA_rnti;
+    /// Received preamble_index
+    uint8_t preamble_index;
+    /// Received UE Contention Resolution Identifier
+    uint8_t cont_res_id[6];
+    /// Timing offset indicated by PHY
+    int16_t timing_offset;
+    /// Timeout for RRC connection
+    int16_t RRC_timer;
+    /// Msg3 first RB
+    uint8_t msg3_first_rb;
+    /// Msg3 number of RB
+    uint8_t msg3_nb_rb;
+    /// Msg3 MCS
+    uint8_t msg3_mcs;
+    /// Msg3 TPC command
+    uint8_t msg3_TPC;
+    /// Msg3 ULdelay command
+    uint8_t msg3_ULdelay;
+    /// Msg3 cqireq command
+    uint8_t msg3_cqireq;
+    /// Round of Msg3 HARQ
+    uint8_t msg3_round;
+    /// TBS used for Msg4
+    int msg4_TBsize;
+    /// MCS used for Msg4
+    int msg4_mcs;
 #ifdef Rel14
-  uint8_t rach_resource_type;
-  uint8_t msg2_mpdcch_repetition_cnt;
-  uint8_t msg4_mpdcch_repetition_cnt;
-  uint8_t msg2_narrowband;
-  uint8_t msg34_narrowband;
+    uint8_t rach_resource_type;
+    uint8_t msg2_mpdcch_repetition_cnt;
+    uint8_t msg4_mpdcch_repetition_cnt;
+    uint8_t msg2_narrowband;
+    uint8_t msg34_narrowband;
 #endif
-} RA_TEMPLATE;
+} RA_t;
 
 
 /*! \brief subband bitmap confguration (for ALU icic algo purpose), in test phase */
 typedef struct {
-  uint8_t sbmap[NUMBER_OF_SUBBANDS_MAX]; //13 = number of SB MAX for 100 PRB
-  uint8_t periodicity;
-  uint8_t first_subframe;
-  uint8_t sb_size;
-  uint8_t nb_active_sb;
+    uint8_t sbmap[NUMBER_OF_SUBBANDS_MAX];	//13 = number of SB MAX for 100 PRB
+    uint8_t periodicity;
+    uint8_t first_subframe;
+    uint8_t sb_size;
+    uint8_t nb_active_sb;
 } SBMAP_CONF;
-/*! \brief UE list used by eNB to order UEs/CC for scheduling*/ 
+/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
 typedef struct {
-  /// Dedicated information for UEs
-  struct PhysicalConfigDedicated  *physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  /// DLSCH pdu 
-  DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX];
-  /// DCI template and MAC connection parameters for UEs
-  UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  /// DCI template and MAC connection for RA processes
-  int pCC_id[NUMBER_OF_UE_MAX];
-  /// sorted downlink component carrier for the scheduler 
-  int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  /// number of downlink active component carrier 
-  int numactiveCCs[NUMBER_OF_UE_MAX];
-  /// sorted uplink component carrier for the scheduler 
-  int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  /// number of uplink active component carrier 
-  int numactiveULCCs[NUMBER_OF_UE_MAX];
-  /// number of downlink active component carrier 
-  uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX];
-  /// eNB to UE statistics
-  eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  /// scheduling control info
-  UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX];
-  int next[NUMBER_OF_UE_MAX];
-  int head;
-  int next_ul[NUMBER_OF_UE_MAX];
-  int head_ul;
-  int avail;
-  int num_UEs;
-  boolean_t active[NUMBER_OF_UE_MAX];
+    /// Dedicated information for UEs
+    struct PhysicalConfigDedicated
+	*physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+    /// DLSCH pdu
+    DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX];
+    /// DCI template and MAC connection parameters for UEs
+    UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+    /// DCI template and MAC connection for RA processes
+    int pCC_id[NUMBER_OF_UE_MAX];
+    /// sorted downlink component carrier for the scheduler
+    int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+    /// number of downlink active component carrier
+    int numactiveCCs[NUMBER_OF_UE_MAX];
+    /// sorted uplink component carrier for the scheduler
+    int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+    /// number of uplink active component carrier
+    int numactiveULCCs[NUMBER_OF_UE_MAX];
+    /// number of downlink active component carrier
+    uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX];
+    /// eNB to UE statistics
+    eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+    /// scheduling control info
+    UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX];
+    int next[NUMBER_OF_UE_MAX];
+    int head;
+    int next_ul[NUMBER_OF_UE_MAX];
+    int head_ul;
+    int avail;
+    int num_UEs;
+    boolean_t active[NUMBER_OF_UE_MAX];
+
+    /// Sorting criteria for the UE list in the MAC preprocessor
+    uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM];
+
 } UE_list_t;
 
-/*! \brief eNB common channels */ 
+/*! \brief eNB common channels */
 typedef struct {
-  int                              physCellId;
-  int                              p_eNB;
-  int                              Ncp;
-  int                              eutra_band;
-  uint32_t                         dl_CarrierFreq;
-  BCCH_BCH_Message_t               *mib;
-  RadioResourceConfigCommonSIB_t   *radioResourceConfigCommon;
+    int physCellId;
+    int p_eNB;
+    int Ncp;
+    int eutra_band;
+    uint32_t dl_CarrierFreq;
+    BCCH_BCH_Message_t *mib;
+    RadioResourceConfigCommonSIB_t *radioResourceConfigCommon;
 #ifdef Rel14
-  RadioResourceConfigCommonSIB_t   *radioResourceConfigCommon_BR;  
+    RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR;
 #endif
-  TDD_Config_t                     *tdd_Config;
-  SchedulingInfoList_t             *schedulingInfoList;
-  ARFCN_ValueEUTRA_t               ul_CarrierFreq;
-  long                             ul_Bandwidth;
-  /// Outgoing MIB PDU for PHY
-  MIB_PDU MIB_pdu;
-  /// Outgoing BCCH pdu for PHY
-  BCCH_PDU BCCH_pdu;
-  /// Outgoing BCCH DCI allocation
-  uint32_t BCCH_alloc_pdu;
-  /// Outgoing CCCH pdu for PHY
-  CCCH_PDU CCCH_pdu;
-  /// Outgoing RAR pdu for PHY
-  RAR_PDU RAR_pdu;
-  /// Template for RA computations
-  RA_TEMPLATE RA_template[NB_RA_PROC_MAX];
-  /// VRB map for common channels
-  uint8_t vrb_map[100];
-  /// VRB map for common channels and retransmissions by PHICH
-  uint8_t vrb_map_UL[100];
-  /// MBSFN SubframeConfig
-  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8];
-  /// number of subframe allocation pattern available for MBSFN sync area
-  uint8_t num_sf_allocation_pattern;
+    TDD_Config_t *tdd_Config;
+    SchedulingInfoList_t *schedulingInfoList;
+    ARFCN_ValueEUTRA_t ul_CarrierFreq;
+    long ul_Bandwidth;
+    /// Outgoing MIB PDU for PHY
+    MIB_PDU MIB_pdu;
+    /// Outgoing BCCH pdu for PHY
+    BCCH_PDU BCCH_pdu;
+    /// Outgoing BCCH DCI allocation
+    uint32_t BCCH_alloc_pdu;
+    /// Outgoing CCCH pdu for PHY
+    CCCH_PDU CCCH_pdu;
+    /// Outgoing PCCH DCI allocation
+    uint32_t PCCH_alloc_pdu;
+    /// Outgoing PCCH pdu for PHY
+    PCCH_PDU PCCH_pdu;
+    /// Outgoing RAR pdu for PHY
+    RAR_PDU RAR_pdu;
+    /// Template for RA computations
+    RA_t ra[NB_RA_PROC_MAX];
+    /// VRB map for common channels
+    uint8_t vrb_map[100];
+    /// VRB map for common channels and retransmissions by PHICH
+    uint8_t vrb_map_UL[100];
+    /// MBSFN SubframeConfig
+    struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8];
+    /// number of subframe allocation pattern available for MBSFN sync area
+    uint8_t num_sf_allocation_pattern;
 #if defined(Rel10) || defined(Rel14)
-  /// MBMS Flag
-  uint8_t MBMS_flag;
-  /// Outgoing MCCH pdu for PHY
-  MCCH_PDU MCCH_pdu;
-  /// MCCH active flag
-  uint8_t msi_active;
-  /// MCCH active flag
-  uint8_t mcch_active;
-  /// MTCH active flag
-  uint8_t mtch_active;
-  /// number of active MBSFN area
-  uint8_t num_active_mbsfn_area;
-  /// MBSFN Area Info
-  struct  MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA];
-  /// PMCH Config
-  struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN];
-  /// MBMS session info list
-  struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN];
-  /// Outgoing MCH pdu for PHY
-  MCH_PDU MCH_pdu;
+    /// MBMS Flag
+    uint8_t MBMS_flag;
+    /// Outgoing MCCH pdu for PHY
+    MCCH_PDU MCCH_pdu;
+    /// MCCH active flag
+    uint8_t msi_active;
+    /// MCCH active flag
+    uint8_t mcch_active;
+    /// MTCH active flag
+    uint8_t mtch_active;
+    /// number of active MBSFN area
+    uint8_t num_active_mbsfn_area;
+    /// MBSFN Area Info
+    struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA];
+    /// PMCH Config
+    struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN];
+    /// MBMS session info list
+    struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN];
+    /// Outgoing MCH pdu for PHY
+    MCH_PDU MCH_pdu;
 #endif
 #ifdef Rel14
-  /// Rel13 parameters from SIB1
-  SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext;
-  /// Counter for SIB1-BR scheduling
-  int SIB1_BR_cnt;
-  /// Outgoing BCCH-BR pdu for PHY
-  BCCH_PDU BCCH_BR_pdu[20];
+    /// Rel13 parameters from SIB1
+    SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext;
+    /// Counter for SIB1-BR scheduling
+    int SIB1_BR_cnt;
+    /// Outgoing BCCH-BR pdu for PHY
+    BCCH_PDU BCCH_BR_pdu[20];
 #endif
 } COMMON_channels_t;
-/*! \brief top level eNB MAC structure */ 
+/*! \brief top level eNB MAC structure */
 typedef struct eNB_MAC_INST_s {
-  /// Ethernet parameters for northbound midhaul interface
-  eth_params_t         eth_params_n;
-  /// Ethernet parameters for fronthaul interface
-  eth_params_t         eth_params_s;
-  ///
-  module_id_t Mod_id;
-  /// frame counter
-  frame_t frame;
-  /// subframe counter
-  sub_frame_t subframe;
-  /// Pointer to IF module instance for PHY
-  IF_Module_t *if_inst;
-  /// Common cell resources
-  COMMON_channels_t common_channels[MAX_NUM_CCs];
-  /// current PDU index (BCH,MCH,DLSCH)
-  uint16_t pdu_index[MAX_NUM_CCs];
-  /// flag to enable phy-test (disables the scheduler)
-  uint16_t phy_test;
-
-  /// NFAPI Config Request Structure
-  nfapi_config_request_t config[MAX_NUM_CCs];
-  /// Preallocated DL pdu list
-  nfapi_dl_config_request_pdu_t dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU];
-  /// NFAPI DL Config Request Structure
-  nfapi_dl_config_request_t DL_req[MAX_NUM_CCs];
-  /// Preallocated UL pdu list
-  nfapi_ul_config_request_pdu_t ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU];
-  /// Preallocated UL pdu list for ULSCH (n+k delay)
-  nfapi_ul_config_request_pdu_t ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU];
-  /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place
-  nfapi_ul_config_request_t UL_req[MAX_NUM_CCs];
-  /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests
-  nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10];
-  /// Preallocated HI_DCI0 pdu list 
-  nfapi_hi_dci0_request_pdu_t hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU];
-  /// NFAPI HI/DCI0 Config Request Structure
-  nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs];
-  /// Prealocated TX pdu list
-  nfapi_tx_request_pdu_t tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU];
-  /// NFAPI DL PDU structure
-  nfapi_tx_request_t TX_req[MAX_NUM_CCs];
-  /// UL handle
-  uint32_t ul_handle;
-  UE_list_t UE_list;
-
-  ///subband bitmap configuration
-  SBMAP_CONF sbmap_conf;
-  /// 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];
-  /// eNB stats
-  eNB_STATS eNB_stats[MAX_NUM_CCs];
-  // MAC function execution peformance profiler
-  /// processing time of eNB scheduler 
-  time_stats_t eNB_scheduler;
-  /// processing time of eNB scheduler for SI 
-  time_stats_t schedule_si;
-  /// processing time of eNB scheduler for Random access
-  time_stats_t schedule_ra;
-  /// processing time of eNB ULSCH scheduler 
-  time_stats_t schedule_ulsch;
-  /// processing time of eNB DCI generation
-  time_stats_t fill_DLSCH_dci;
-  /// processing time of eNB MAC preprocessor
-  time_stats_t schedule_dlsch_preprocessor;
-  /// processing time of eNB DLSCH scheduler 
-  time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor
-  /// processing time of eNB MCH scheduler 
-  time_stats_t schedule_mch;
-  /// processing time of eNB ULSCH reception
-  time_stats_t rx_ulsch_sdu; // include rlc_data_ind
+    /// Ethernet parameters for northbound midhaul interface
+    eth_params_t eth_params_n;
+    /// Ethernet parameters for fronthaul interface
+    eth_params_t eth_params_s;
+    ///
+    module_id_t Mod_id;
+    /// frame counter
+    frame_t frame;
+    /// subframe counter
+    sub_frame_t subframe;
+    /// Pointer to IF module instance for PHY
+    IF_Module_t *if_inst;
+    /// Common cell resources
+    COMMON_channels_t common_channels[MAX_NUM_CCs];
+    /// current PDU index (BCH,MCH,DLSCH)
+    uint16_t pdu_index[MAX_NUM_CCs];
+    /// flag to enable phy-test (disables the scheduler)
+    uint16_t phy_test;
+
+    /// NFAPI Config Request Structure
+    nfapi_config_request_t config[MAX_NUM_CCs];
+    /// Preallocated DL pdu list
+    nfapi_dl_config_request_pdu_t
+	dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU];
+    /// NFAPI DL Config Request Structure
+    nfapi_dl_config_request_t DL_req[MAX_NUM_CCs];
+    /// Preallocated UL pdu list
+    nfapi_ul_config_request_pdu_t
+	ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU];
+    /// Preallocated UL pdu list for ULSCH (n+k delay)
+    nfapi_ul_config_request_pdu_t
+	ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU];
+    /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place
+    nfapi_ul_config_request_t UL_req[MAX_NUM_CCs];
+    /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests
+    nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10];
+    /// Preallocated HI_DCI0 pdu list
+    nfapi_hi_dci0_request_pdu_t
+	hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU];
+    /// NFAPI HI/DCI0 Config Request Structure
+    nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs];
+    /// Prealocated TX pdu list
+    nfapi_tx_request_pdu_t
+	tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU];
+    /// NFAPI DL PDU structure
+    nfapi_tx_request_t TX_req[MAX_NUM_CCs];
+    /// UL handle
+    uint32_t ul_handle;
+    UE_list_t UE_list;
+
+    ///subband bitmap configuration
+    SBMAP_CONF sbmap_conf;
+    /// 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];
+    /// eNB stats
+    eNB_STATS eNB_stats[MAX_NUM_CCs];
+    // MAC function execution peformance profiler
+    /// processing time of eNB scheduler
+    time_stats_t eNB_scheduler;
+    /// processing time of eNB scheduler for SI
+    time_stats_t schedule_si;
+    /// processing time of eNB scheduler for Random access
+    time_stats_t schedule_ra;
+    /// processing time of eNB ULSCH scheduler
+    time_stats_t schedule_ulsch;
+    /// processing time of eNB DCI generation
+    time_stats_t fill_DLSCH_dci;
+    /// processing time of eNB MAC preprocessor
+    time_stats_t schedule_dlsch_preprocessor;
+    /// processing time of eNB DLSCH scheduler
+    time_stats_t schedule_dlsch;	// include rlc_data_req + MAC header + preprocessor
+    /// processing time of eNB MCH scheduler
+    time_stats_t schedule_mch;
+    /// processing time of eNB ULSCH reception
+    time_stats_t rx_ulsch_sdu;	// include rlc_data_ind
+    /// processing time of eNB PCH scheduler
+    time_stats_t schedule_pch;
 } eNB_MAC_INST;
 
-/* 
- * UE part 
- */ 
+/*
+ * UE part
+ */
 
 typedef enum {
-  TYPE0,
-  TYPE1,
-  TYPE1A,
-  TYPE2,
-  TYPE2A,
-  TYPEUESPEC
+    TYPE0,
+    TYPE1,
+    TYPE1A,
+    TYPE2,
+    TYPE2A,
+    TYPEUESPEC
 } MPDCCH_TYPES_t;
 
 /*!\brief UE layer 2 status */
 typedef enum {
-  CONNECTION_OK=0,
-  CONNECTION_LOST,
-  PHY_RESYNCH,
-  PHY_HO_PRACH
+    CONNECTION_OK = 0,
+    CONNECTION_LOST,
+    PHY_RESYNCH,
+    PHY_HO_PRACH
 } UE_L2_STATE_t;
 
 /*!\brief UE scheduling info */
 typedef struct {
-  /// buffer status for each lcgid
-  uint8_t  BSR[MAX_NUM_LCGID]; // should be more for mesh topology
-  /// keep the number of bytes in rlc buffer for each lcgid
-  int32_t  BSR_bytes[MAX_NUM_LCGID];
-  /// after multiplexing buffer remain for each lcid
-  int32_t  LCID_buffer_remain[MAX_NUM_LCID];
-  /// sum of all lcid buffer size
-  uint16_t  All_lcid_buffer_size_lastTTI;
-  /// buffer status for each lcid
-  uint8_t  LCID_status[MAX_NUM_LCID];
-  /// SR pending as defined in 36.321
-  uint8_t  SR_pending;
-  /// SR_COUNTER as defined in 36.321
-  uint16_t SR_COUNTER;
-  /// logical channel group ide for each LCID
-  uint8_t  LCGID[MAX_NUM_LCID];
-  /// retxBSR-Timer, default value is sf2560
-  uint16_t retxBSR_Timer;
-  /// retxBSR_SF, number of subframe before triggering a regular BSR
-  uint16_t retxBSR_SF;
-  /// periodicBSR-Timer, default to infinity
-  uint16_t periodicBSR_Timer;
-  /// periodicBSR_SF, number of subframe before triggering a periodic BSR
-  uint16_t periodicBSR_SF;
-  /// default value is 0: not configured
-  uint16_t sr_ProhibitTimer;
-  /// sr ProhibitTime running
-  uint8_t sr_ProhibitTimer_Running;
-  ///  default value to n5
-  uint16_t maxHARQ_Tx;
-  /// default value is false
-  uint16_t ttiBundling;
-  /// default value is release
-  struct DRX_Config *drx_config;
-  /// default value is release
-  struct MAC_MainConfig__phr_Config *phr_config;
-  ///timer before triggering a periodic PHR
-  uint16_t periodicPHR_Timer;
-  ///timer before triggering a prohibit PHR
-  uint16_t prohibitPHR_Timer;
-  ///DL Pathloss change value
-  uint16_t PathlossChange;
-  ///number of subframe before triggering a periodic PHR
-  int16_t periodicPHR_SF;
-  ///number of subframe before triggering a prohibit PHR
-  int16_t prohibitPHR_SF;
-  ///DL Pathloss Change in db
-  uint16_t PathlossChange_db;
-
-  /// default value is false
-  uint16_t extendedBSR_Sizes_r10;
-  /// default value is false
-  uint16_t extendedPHR_r10;
-
-  //Bj bucket usage per  lcid
-  int16_t Bj[MAX_NUM_LCID];
-  // Bucket size per lcid
-  int16_t bucket_size[MAX_NUM_LCID];
+    /// buffer status for each lcgid
+    uint8_t BSR[MAX_NUM_LCGID];	// should be more for mesh topology
+    /// keep the number of bytes in rlc buffer for each lcgid
+    int32_t BSR_bytes[MAX_NUM_LCGID];
+    /// after multiplexing buffer remain for each lcid
+    int32_t LCID_buffer_remain[MAX_NUM_LCID];
+    /// sum of all lcid buffer size
+    uint16_t All_lcid_buffer_size_lastTTI;
+    /// buffer status for each lcid
+    uint8_t LCID_status[MAX_NUM_LCID];
+    /// SR pending as defined in 36.321
+    uint8_t SR_pending;
+    /// SR_COUNTER as defined in 36.321
+    uint16_t SR_COUNTER;
+    /// logical channel group ide for each LCID
+    uint8_t LCGID[MAX_NUM_LCID];
+    /// retxBSR-Timer, default value is sf2560
+    uint16_t retxBSR_Timer;
+    /// retxBSR_SF, number of subframe before triggering a regular BSR
+    uint16_t retxBSR_SF;
+    /// periodicBSR-Timer, default to infinity
+    uint16_t periodicBSR_Timer;
+    /// periodicBSR_SF, number of subframe before triggering a periodic BSR
+    uint16_t periodicBSR_SF;
+    /// default value is 0: not configured
+    uint16_t sr_ProhibitTimer;
+    /// sr ProhibitTime running
+    uint8_t sr_ProhibitTimer_Running;
+    ///  default value to n5
+    uint16_t maxHARQ_Tx;
+    /// default value is false
+    uint16_t ttiBundling;
+    /// default value is release
+    struct DRX_Config *drx_config;
+    /// default value is release
+    struct MAC_MainConfig__phr_Config *phr_config;
+    ///timer before triggering a periodic PHR
+    uint16_t periodicPHR_Timer;
+    ///timer before triggering a prohibit PHR
+    uint16_t prohibitPHR_Timer;
+    ///DL Pathloss change value
+    uint16_t PathlossChange;
+    ///number of subframe before triggering a periodic PHR
+    int16_t periodicPHR_SF;
+    ///number of subframe before triggering a prohibit PHR
+    int16_t prohibitPHR_SF;
+    ///DL Pathloss Change in db
+    uint16_t PathlossChange_db;
+
+    /// default value is false
+    uint16_t extendedBSR_Sizes_r10;
+    /// default value is false
+    uint16_t extendedPHR_r10;
+
+    //Bj bucket usage per  lcid
+    int16_t Bj[MAX_NUM_LCID];
+    // Bucket size per lcid
+    int16_t bucket_size[MAX_NUM_LCID];
 } UE_SCHEDULING_INFO;
 /*!\brief Top level UE MAC structure */
 typedef struct {
-  uint16_t Node_id;
-  /// RX frame counter
-  frame_t     rxFrame;
-  /// RX subframe counter
-  sub_frame_t rxSubframe;
-  /// TX frame counter
-  frame_t     txFrame;
-  /// TX subframe counter
-  sub_frame_t txSubframe;
-  /// C-RNTI of UE
-  uint16_t crnti;
-  /// C-RNTI of UE before HO
-  rnti_t crnti_before_ho; ///user id (rnti) of connected UEs
-  /// uplink active flag
-  uint8_t ul_active;
-  /// pointer to RRC PHY configuration
-  RadioResourceConfigCommonSIB_t *radioResourceConfigCommon;
-  /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry)
-  struct RACH_ConfigDedicated *rach_ConfigDedicated;
-  /// pointer to RRC PHY configuration
-  struct PhysicalConfigDedicated *physicalConfigDedicated;
+    uint16_t Node_id;
+    /// RX frame counter
+    frame_t rxFrame;
+    /// RX subframe counter
+    sub_frame_t rxSubframe;
+    /// TX frame counter
+    frame_t txFrame;
+    /// TX subframe counter
+    sub_frame_t txSubframe;
+    /// C-RNTI of UE
+    uint16_t crnti;
+    /// C-RNTI of UE before HO
+    rnti_t crnti_before_ho;	///user id (rnti) of connected UEs
+    /// uplink active flag
+    uint8_t ul_active;
+    /// pointer to RRC PHY configuration
+    RadioResourceConfigCommonSIB_t *radioResourceConfigCommon;
+    /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry)
+    struct RACH_ConfigDedicated *rach_ConfigDedicated;
+    /// pointer to RRC PHY configuration
+    struct PhysicalConfigDedicated *physicalConfigDedicated;
 #if defined(Rel10) || defined(Rel14)
-  /// pointer to RRC PHY configuration SCEll
-  struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10;
+    /// pointer to RRC PHY configuration SCEll
+    struct PhysicalConfigDedicatedSCell_r10
+	*physicalConfigDedicatedSCell_r10;
 #endif
-  /// pointer to TDD Configuration (NULL for FDD)
-  TDD_Config_t *tdd_Config;
-  /// Number of adjacent cells to measure
-  uint8_t  n_adj_cells;
-  /// Array of adjacent physical cell ids
-  uint32_t adj_cell_id[6];
-  /// Pointer to RRC MAC configuration
-  MAC_MainConfig_t *macConfig;
-  /// Pointer to RRC Measurement gap configuration
-  MeasGapConfig_t  *measGapConfig;
-  /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive.
-  LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID];
-  /// Scheduling Information
-  UE_SCHEDULING_INFO scheduling_info;
-  /// Outgoing CCCH pdu for PHY
-  CCCH_PDU CCCH_pdu;
-  /// Outgoing RAR pdu for PHY
-  RAR_PDU RAR_pdu;
-  /// Incoming DLSCH pdu for PHY
-  DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2];
-  /// number of attempt for rach
-  uint8_t RA_attempt_number;
-  /// Random-access procedure flag
-  uint8_t RA_active;
-  /// Random-access window counter
-  int8_t RA_window_cnt;
-  /// Random-access Msg3 size in bytes
-  uint8_t RA_Msg3_size;
-  /// Random-access prachMaskIndex
-  uint8_t RA_prachMaskIndex;
-  /// Flag indicating Preamble set (A,B) used for first Msg3 transmission
-  uint8_t RA_usedGroupA;
-  /// Random-access Resources
-  PRACH_RESOURCES_t RA_prach_resources;
-  /// Random-access PREAMBLE_TRANSMISSION_COUNTER
-  uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER;
-  /// Random-access backoff counter
-  int16_t RA_backoff_cnt;
-  /// Random-access variable for window calculation (frame of last change in window counter)
-  uint32_t RA_tx_frame;
-  /// Random-access variable for window calculation (subframe of last change in window counter)
-  uint8_t RA_tx_subframe;
-  /// Random-access Group B maximum path-loss
-  /// Random-access variable for backoff (frame of last change in backoff counter)
-  uint32_t RA_backoff_frame;
-  /// Random-access variable for backoff (subframe of last change in backoff counter)
-  uint8_t RA_backoff_subframe;
-  /// Random-access Group B maximum path-loss
-  uint16_t RA_maxPL;
-  /// Random-access Contention Resolution Timer active flag
-  uint8_t RA_contention_resolution_timer_active;
-  /// Random-access Contention Resolution Timer count value
-  uint8_t RA_contention_resolution_cnt;
-  /// power headroom reporitng reconfigured
-  uint8_t PHR_reconfigured;
-  /// power headroom state as configured by the higher layers
-  uint8_t PHR_state;
-  /// power backoff due to power management (as allowed by P-MPRc) for this cell
-  uint8_t PHR_reporting_active;
-  /// power backoff due to power management (as allowed by P-MPRc) for this cell
-  uint8_t power_backoff_db[NUMBER_OF_eNB_MAX];
-  /// BSR report falg management
-  uint8_t BSR_reporting_active;
-  /// retxBSR-Timer expires flag
-  uint8_t retxBSRTimer_expires_flag;
-  /// periodBSR-Timer expires flag
-  uint8_t periodBSRTimer_expires_flag;
-
-  /// MBSFN_Subframe Configuration
-  struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA?
-  /// number of subframe allocation pattern available for MBSFN sync area
-  uint8_t num_sf_allocation_pattern;
+    /// pointer to TDD Configuration (NULL for FDD)
+    TDD_Config_t *tdd_Config;
+    /// Number of adjacent cells to measure
+    uint8_t n_adj_cells;
+    /// Array of adjacent physical cell ids
+    uint32_t adj_cell_id[6];
+    /// Pointer to RRC MAC configuration
+    MAC_MainConfig_t *macConfig;
+    /// Pointer to RRC Measurement gap configuration
+    MeasGapConfig_t *measGapConfig;
+    /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive.
+    LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID];
+    /// Scheduling Information
+    UE_SCHEDULING_INFO scheduling_info;
+    /// Outgoing CCCH pdu for PHY
+    CCCH_PDU CCCH_pdu;
+    /// Outgoing RAR pdu for PHY
+    RAR_PDU RAR_pdu;
+    /// Incoming DLSCH pdu for PHY
+    DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2];
+    /// number of attempt for rach
+    uint8_t RA_attempt_number;
+    /// Random-access procedure flag
+    uint8_t RA_active;
+    /// Random-access window counter
+    int8_t RA_window_cnt;
+    /// Random-access Msg3 size in bytes
+    uint8_t RA_Msg3_size;
+    /// Random-access prachMaskIndex
+    uint8_t RA_prachMaskIndex;
+    /// Flag indicating Preamble set (A,B) used for first Msg3 transmission
+    uint8_t RA_usedGroupA;
+    /// Random-access Resources
+    PRACH_RESOURCES_t RA_prach_resources;
+    /// Random-access PREAMBLE_TRANSMISSION_COUNTER
+    uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER;
+    /// Random-access backoff counter
+    int16_t RA_backoff_cnt;
+    /// Random-access variable for window calculation (frame of last change in window counter)
+    uint32_t RA_tx_frame;
+    /// Random-access variable for window calculation (subframe of last change in window counter)
+    uint8_t RA_tx_subframe;
+    /// Random-access Group B maximum path-loss
+    /// Random-access variable for backoff (frame of last change in backoff counter)
+    uint32_t RA_backoff_frame;
+    /// Random-access variable for backoff (subframe of last change in backoff counter)
+    uint8_t RA_backoff_subframe;
+    /// Random-access Group B maximum path-loss
+    uint16_t RA_maxPL;
+    /// Random-access Contention Resolution Timer active flag
+    uint8_t RA_contention_resolution_timer_active;
+    /// Random-access Contention Resolution Timer count value
+    uint8_t RA_contention_resolution_cnt;
+    /// power headroom reporitng reconfigured
+    uint8_t PHR_reconfigured;
+    /// power headroom state as configured by the higher layers
+    uint8_t PHR_state;
+    /// power backoff due to power management (as allowed by P-MPRc) for this cell
+    uint8_t PHR_reporting_active;
+    /// power backoff due to power management (as allowed by P-MPRc) for this cell
+    uint8_t power_backoff_db[NUMBER_OF_eNB_MAX];
+    /// BSR report falg management
+    uint8_t BSR_reporting_active;
+    /// retxBSR-Timer expires flag
+    uint8_t retxBSRTimer_expires_flag;
+    /// periodBSR-Timer expires flag
+    uint8_t periodBSRTimer_expires_flag;
+
+    /// MBSFN_Subframe Configuration
+    struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8];	// FIXME replace 8 by MAX_MBSFN_AREA?
+    /// number of subframe allocation pattern available for MBSFN sync area
+    uint8_t num_sf_allocation_pattern;
 #if defined(Rel10) || defined(Rel14)
-  /// number of active MBSFN area
-  uint8_t num_active_mbsfn_area;
-  /// MBSFN Area Info
-  struct  MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA];
-  /// PMCH Config
-  struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN];
-  /// MCCH status
-  uint8_t mcch_status;
-  /// MSI status
-  uint8_t msi_status;// could be an array if there are >1 MCH in one MBSFN area
+    /// number of active MBSFN area
+    uint8_t num_active_mbsfn_area;
+    /// MBSFN Area Info
+    struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA];
+    /// PMCH Config
+    struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN];
+    /// MCCH status
+    uint8_t mcch_status;
+    /// MSI status
+    uint8_t msi_status;		// could be an array if there are >1 MCH in one MBSFN area
 #endif
-  //#ifdef CBA
-  /// CBA RNTI for each group 
-  uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
-  /// last SFN for CBA channel access 
-  uint8_t cba_last_access[NUM_MAX_CBA_GROUP];
-  //#endif
-  /// total UE scheduler processing time 
-  time_stats_t ue_scheduler; // total
-  /// UE ULSCH tx  processing time inlcuding RLC interface (rlc_data_req) and mac header generation 
-  time_stats_t tx_ulsch_sdu;  
-  /// UE DLSCH rx  processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser
-  time_stats_t rx_dlsch_sdu ; 
-  /// UE query for MCH subframe processing time 
-  time_stats_t ue_query_mch;
-  /// UE MCH rx processing time 
-  time_stats_t rx_mch_sdu;
-  /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind) 
-  time_stats_t rx_si; 
-  /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind) 
-  time_stats_t rx_p; 
+    //#ifdef CBA
+    /// CBA RNTI for each group
+    uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
+    /// last SFN for CBA channel access
+    uint8_t cba_last_access[NUM_MAX_CBA_GROUP];
+    //#endif
+    /// total UE scheduler processing time
+    time_stats_t ue_scheduler;	// total
+    /// UE ULSCH tx  processing time inlcuding RLC interface (rlc_data_req) and mac header generation
+    time_stats_t tx_ulsch_sdu;
+    /// UE DLSCH rx  processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser
+    time_stats_t rx_dlsch_sdu;
+    /// UE query for MCH subframe processing time
+    time_stats_t ue_query_mch;
+    /// UE MCH rx processing time
+    time_stats_t rx_mch_sdu;
+    /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind)
+    time_stats_t rx_si;
+    /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind)
+    time_stats_t rx_p;
 } UE_MAC_INST;
 /*! \brief ID of the neighboring cells used for HO*/
 typedef struct {
-  uint16_t cell_ids[6];
-  uint8_t n_adj_cells;
+    uint16_t cell_ids[6];
+    uint8_t n_adj_cells;
 } neigh_cell_id_t;
 
 #include "proto.h"
 /*@}*/
 #endif /*__LAYER2_MAC_DEFS_H__ */
-
-
-
diff --git a/openair2/LAYER2/MAC/defs_NB_IoT.h b/openair2/LAYER2/MAC/defs_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..77c0828b283076bd4edce975379dfe99f4bbd321
--- /dev/null
+++ b/openair2/LAYER2/MAC/defs_NB_IoT.h
@@ -0,0 +1,543 @@
+
+/*! \file defs_NB_IoT.c
+ * \brief MAC layer structures
+ * \author  NTUST BMW Lab./
+ * \date 2017
+ * \email: 
+ * \version 1.0
+ *
+ */
+#ifndef __LAYER2_MAC_DEFS_NB_IOT_H__
+#define __LAYER2_MAC_DEFS_NB_IOT_H__
+#ifdef USER_MODE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#endif
+//#include "COMMON/openair_defs.h"
+#include "COMMON/platform_constants.h"
+#include "COMMON/mac_rrc_primitives.h"
+#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
+//#include "PHY/defs.h"
+#include "PHY/defs_L1_NB_IoT.h"
+#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
+#include "config_NB_IoT.h"
+//  MAC definition
+#define MAX_FRAME 0xfffff
+#define NUM_FRAME 0x100000
+#define MAX_SUBFRAME 10485760
+
+#define MAX(a, b) (((a)>(b))?(a):(b))
+
+//  RA-RNTI: 1+SFN_id>>2
+#define RA_RNTI_LOW   0x0001  //  SFN_id = 0
+#define RA_RNTI_HIGH  0x0100  //  SFN_id = 1023
+#define C_RNTI_LOW  0x0101
+#define C_RNTI_HIGH 
+
+// ULSCH LCHAN IDs
+/*!\brief LCID of extended power headroom for ULSCH */
+#define EXTENDED_POWER_HEADROOM 25
+/*!\brief LCID of power headroom for ULSCH */
+#define POWER_HEADROOM 26
+/*!\brief LCID of CRNTI for ULSCH */
+#define CRNTI 27
+/*!\brief LCID of truncated BSR for ULSCH */
+#define TRUNCATED_BSR 28
+/*!\brief LCID of short BSR for ULSCH */
+#define SHORT_BSR 29
+/*!\brief LCID of long BSR for ULSCH */
+#define LONG_BSR 30
+/*! \brief Values of CCCH LCID for DLSCH */ 
+#define CCCH_LCHANID 0
+/*!\brief Values of BCCH logical channel */
+#define BCCH 3  // SI 
+/*!\brief Values of PCCH logical channel */
+#define PCCH 4  // Paging 
+/*!\brief Value of CCCH / SRB0 logical channel */
+#define CCCH 0  // srb0
+/*!\brief DCCH / SRB1 logical channel */
+#define DCCH 1  // srb1
+/*!\brief DCCH1 / SRB2  logical channel */
+#define DCCH1 2 // srb2
+/*!\brief DTCH DRB1  logical channel */
+#define DTCH 3 // LCID
+/*!\brief MCCH logical channel */
+#define MCCH 4 
+/*!\brief MTCH logical channel */
+#define MTCH 1 
+// DLSCH LCHAN ID
+/*!\brief LCID of UE contention resolution identity for DLSCH*/
+#define UE_CONT_RES 28
+/*!\brief LCID of timing advance for DLSCH */
+#define TIMING_ADV_CMD 29
+/*!\brief LCID of discontinous reception mode for DLSCH */
+#define DRX_CMD 30
+/*!\brief LCID of padding LCID for DLSCH */
+#define SHORT_PADDING 31
+
+
+typedef enum tone_type_e
+{
+  sixtone = 0,
+  threetone,
+  singletone1,
+  singletone2,
+  singletone3
+}tone_type_t;
+
+typedef enum channel_NB_IoT_e
+{
+  NPDCCH = 0,
+  NPUSCH,
+  NPDSCH
+}channel_NB_IoT_t;
+
+typedef enum{
+  UL = 0,
+  DL
+}message_direction_t;
+
+#define MAX_NUMBER_OF_UE_MAX_NB_IoT 20
+#define SCH_PAYLOAD_SIZE_MAX_NB_IoT 320
+#define MAX_NUMBER_OF_SIBs_NB_IoT 16
+
+/*!\brief Values of BCCH0 logical channel for MIB*/
+#define BCCH0_NB_IoT 11 // MIB-NB_IoT
+/*!\brief Values of BCCH1 logical channel for SIBs */
+#define BCCH1_NB_IoT 12 // SI-SIB-NB_IoTs
+/*!\brief Values of PCCH logical channel */
+#define PCCH_NB_IoT 13  // Paging XXX not used for the moment
+#define MCCH_NB_IoT 14
+/*!\brief Value of CCCH / SRB0 logical channel */
+#define CCCH_NB_IoT 0  // srb0 ---> XXX exactly the same as in LTE (commented for compilation purposes)
+/*!\brief DCCH0 / SRB1bis logical channel */
+#define DCCH0_NB_IoT 3  // srb1bis
+/*!\brief DCCH1 / SRB1  logical channel */
+#define DCCH1_NB_IoT 1 // srb1 //XXX we redefine it for the SRB1
+/*!\brief DTCH0 DRB0  logical channel */
+#define DTCH0_NB_IoT 4 // DRB0
+/*!\brief DTCH1 DRB1  logical channel */
+#define DTCH1_NB_IoT 5 // DRB1
+/*Index of UE contention resoulution logical channel*/
+#define UE_CONTENTION_RESOLUTION 28
+/*Index of TIMING_ADVANCE logical channel*/
+#define TIMING_ADVANCE 29
+/*Index of DRX_COMMAND logical channel*/
+#define DRX_COMMAND 30
+/*Index of PADDING logical channel*/
+#define PADDING 31
+
+
+/// NPRACH-ParametersList-NB_IoT-r13 from 36.331 RRC spec defined in PHY
+/*typedef struct NPRACH_Parameters_NB_IoT{
+
+    /// the period time for nprach
+    int nprach_Periodicity;
+    /// for the start time for the NPRACH resource from 40ms-2560ms
+    int nprach_StartTime;
+    /// for the subcarrier of set to the NPRACH preamble from n0 - n34
+    int nprach_SubcarrierOffset;
+    ///number of subcarriers in a NPRACH resource allowed values (n12,n24,n36,n48)
+    int nprach_NumSubcarriers;
+    /// where is the region that in NPRACH resource to indicate if this UE support MSG3 for multi-tone or not. from 0 - 1
+    int nprach_SubcarrierMSG3_RangeStart;
+    /// The max preamble transmission attempt for the CE level from 1 - 128
+    int maxNumPreambleAttemptCE;
+    /// Number of NPRACH repetitions per attempt for each NPRACH resource
+    int numRepetitionsPerPreambleAttempt;
+    /// The number of the repetition for DCI use in RAR/MSG3/MSG4 from 1 - 2048 (Rmax)
+    int npdcch_NumRepetitions_RA;
+    /// Starting subframe for NPDCCH Common searching space for (RAR/MSG3/MSG4)
+    int npdcch_StartSF_CSS_RA;
+    /// Fractional period offset of starting subframe for NPDCCH common search space
+    int npdcch_Offset_RA;
+
+} nprach_parameters_NB_IoT_t;*/
+
+/*! \brief Downlink SCH PDU Structure */
+typedef struct {
+  uint8_t payload[SCH_PAYLOAD_SIZE_MAX_NB_IoT];
+  uint32_t pdu_size;
+} __attribute__ ((__packed__)) DLSCH_PDU_NB_IoT;
+
+/*! \brief eNB template for UE context information  */
+typedef struct {
+    // C-RNTI of UE
+  rnti_t rnti;
+  // UE CE level
+  int CE_level;
+  // Direction of transmission(DL:0\UL:1\NONE:-1)
+  int32_t direction;
+  // DCI Reptition
+  uint32_t R_dci;
+  // MAX repetition
+  uint32_t R_max;
+
+  // HARQ round
+  uint32_t HARQ_round;
+  /*Downlink information*/
+
+  /// DLSCH pdu
+  DLSCH_PDU_NB_IoT DLSCH_pdu;
+  // PDU size
+  uint32_t DLSCH_pdu_size;
+  // Data Reptition
+  uint32_t R_dl;
+  // MCS index
+  uint32_t I_mcs_dl;
+  // total downlink buffer DCCH0_NB_IoT
+  uint32_t dl_buffer_DCCH0_NB_IoT;
+  // NDI
+  int oldNDI_DL;
+  //HARQ ACK/NACK repetition
+  uint32_t R_harq;
+
+  /*Uplink information*/
+  int oldNDI_UL;
+  // Uplink data repeat, now just follow the rach repeat number
+  uint32_t R_ul;
+  // PHR value (0-3)
+  uint32_t PHR;
+  // The uplink data size from BSR or DVI
+  uint32_t ul_total_buffer;
+  // Determine if this UE support multi-tone transmission or not
+  int multi_tone;
+  // Next UE_template ID
+  int next;
+  // Previous UE_template ID
+  int prev;
+  // MSG4 complete
+  int RRC_connected;
+  // UE active flag
+  int active;
+
+} UE_TEMPLATE_NB_IoT;
+
+/*36331 NPDCCH-ConfigDedicated-NB_IoT*/
+typedef struct{
+  //npdcch-NumRepetitions-r13
+  uint32_t R_max;
+  //npdcch-StartSF-USS-r13
+  double G;
+  //npdcch-Offset-USS-r13
+  double a_offset;
+  //NPDCCH period
+  uint32_t T;
+  //Starting subfrane of Search Space which is mod T
+  uint32_t ss_start_uss;
+}NPDCCH_config_dedicated_NB_IoT_t;
+
+
+/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
+typedef struct {
+
+  /// DCI template and MAC connection parameters for UEs
+  UE_TEMPLATE_NB_IoT UE_template_NB_IoT[MAX_NUMBER_OF_UE_MAX_NB_IoT];
+
+  /// NPDCCH Period and searching space info
+  NPDCCH_config_dedicated_NB_IoT_t NPDCCH_config_dedicated;
+  //int next[MAX_NUMBER_OF_UE_MAX_NB_IoT];
+  // -1:No UE in list
+  int head;
+  // -1:No UE in list
+  int tail;
+  int num_UEs;
+  //boolean_t active[MAX_NUMBER_OF_UE_MAX_NB_IoT];
+
+} UE_list_NB_IoT_t;
+
+
+typedef struct{
+
+  // flag to indicate scheduing MIB-NB_IoT
+  uint8_t flag_MIB;
+  // flag to indicate scheduling SIB1-NB_IoT
+  uint8_t flag_SIB1;
+  // flag to indicate scheduling SIBs-NB_IoT
+  uint8_t flag_SIBs[MAX_NUMBER_OF_SIBs_NB_IoT];
+  // flag to indicate scheduling type2 NPDCCH CSS with different CE level
+  uint8_t flag_type2_css[3];
+  // flag to indicate scheduling type1 NPDCCH CSS with different CE level
+  uint8_t flag_type1_css[3];
+  // flag to indicate scheduling NPDCCH USS with UE list
+  uint8_t flag_uss[MAX_NUMBER_OF_UE_MAX_NB_IoT];
+  // flag to indicate scheduling sib1/MIB
+  uint8_t flag_fix_scheduling;
+  // number of the type2 css to schedule in this period
+  uint8_t num_type2_css_run;
+  // number of the type1 css to schedule in this period
+  uint8_t num_type1_css_run;
+  // number of the uss to schedule in this period
+  uint8_t num_uss_run;
+
+}scheduling_flag_t;
+
+typedef struct available_resource_UL_s{
+
+    ///Resource start subframe
+    uint32_t start_subframe;
+    ///Resource end subframe
+    uint32_t end_subframe;
+    // pointer to next node
+    struct available_resource_UL_s *next, *prev;
+
+}available_resource_UL_t;
+
+typedef struct available_resource_DL_s{
+  uint32_t start_subframe;
+  uint32_t end_subframe;
+
+  struct available_resource_DL_s *next, *prev;
+}available_resource_DL_t;
+
+/*Structure used for scheduling*/
+typedef struct{
+  //resource position info.
+  uint32_t sf_end,sf_start;
+  //resource position info. separate by HyperSF, Frame, Subframe
+  uint32_t start_h, end_h;
+  uint32_t start_f, end_f;
+  uint32_t start_sf, end_sf;
+  //whcih available resource node is used
+  available_resource_DL_t *node;
+}sched_temp_DL_NB_IoT_t;
+
+/*!\brief  MAC subheader short with 7bit Length field */
+typedef struct {
+  uint8_t LCID:5;  // octet 1 LSB
+  uint8_t E:1;
+  uint8_t F2:1;
+  uint8_t R:1;     // octet 1 MSB
+  uint8_t L:7;     // octet 2 LSB
+  uint8_t F:1;     // octet 2 MSB
+} __attribute__((__packed__))SCH_SUBHEADER_SHORT_NB_IoT;
+typedef struct {
+  uint8_t LCID:5;   // octet 1 LSB
+  uint8_t E:1;
+  uint8_t F2:1;
+  uint8_t R:1;      // octet 1 MSB
+  uint8_t L_MSB:7;
+  uint8_t F:1;      // octet 2 MSB
+  uint8_t L_LSB:8;
+} __attribute__((__packed__))SCH_SUBHEADER_LONG_NB_IoT;
+typedef struct {
+  uint8_t LCID:5;   // octet 1 LSB
+  uint8_t E:1;
+  uint8_t F2:1;
+  uint8_t R:1;      // octet 1 MSB
+  uint8_t L_MSB:8;      // octet 2 MSB
+  uint8_t L_LSB:8;
+} __attribute__((__packed__))SCH_SUBHEADER_LONG_EXTEND_NB_IoT;
+/*!\brief MAC subheader short without length field */
+typedef struct {
+  uint8_t LCID:5;
+  uint8_t F2:1;
+  uint8_t E:1;
+  uint8_t R:1;
+} __attribute__((__packed__))SCH_SUBHEADER_FIXED_NB_IoT;
+
+
+/*! \brief Uplink SCH PDU Structure */
+typedef struct {
+  int8_t payload[SCH_PAYLOAD_SIZE_MAX_NB_IoT];         /*!< \brief SACH payload */
+  uint16_t Pdu_size;
+} __attribute__ ((__packed__)) ULSCH_PDU_NB_IoT;
+
+typedef struct {
+  uint8_t PH:6;
+  uint8_t R:2;
+} __attribute__((__packed__))POWER_HEADROOM_CMD_NB_IoT;
+
+typedef struct {
+  uint8_t RAPID:6;
+  uint8_t T:1;
+  uint8_t E:1;
+} __attribute__((__packed__))RA_HEADER_RAPID_NB_IoT;
+
+/*Structure used for UL scheduling*/
+typedef struct{
+  //resource position info.
+  uint32_t sf_end, sf_start;
+  //resource position info. separate by HyperSF, Frame, Subframe
+  //uint32_t start_h, end_h;
+  //uint32_t start_f, end_f;
+  //uint32_t start_sf, end_sf;
+  // information for allocating the resource
+  int tone;
+  int scheduling_delay;
+  int subcarrier_indication;
+  int ACK_NACK_resource_field;
+  available_resource_UL_t *node;
+}sched_temp_UL_NB_IoT_t;
+
+typedef struct Available_available_resource_DL{
+
+    ///Available Resoruce for sixtone
+    available_resource_UL_t *sixtone_Head;//, *sixtone_npusch_frame;
+  uint32_t sixtone_end_subframe;
+    ///Available Resoruce for threetone
+    available_resource_UL_t *threetone_Head;//, *threetone_npusch_frame;
+  uint32_t threetone_end_subframe;
+    ///Available Resoruce for singletone1
+    available_resource_UL_t *singletone1_Head;//, *singletone1_npusch_frame;
+  uint32_t singletone1_end_subframe;
+    ///Available Resoruce for singletone2
+    available_resource_UL_t *singletone2_Head;//, *singletone2_npusch_frame;
+    uint32_t singletone2_end_subframe;
+  ///Available Resoruce for singletone3
+    available_resource_UL_t *singletone3_Head;//, *singletone3_npusch_frame;
+  uint32_t singletone3_end_subframe;
+  
+}available_resource_tones_UL_t;
+
+typedef struct schedule_result{
+  // The subframe read by output handler
+  uint32_t output_subframe;
+  // SDU length
+  uint32_t sdu_length;
+  // MAC PDU
+  uint8_t *DLSCH_pdu;
+  // The data direction indicated by this DCI
+  uint8_t direction;
+  // pointer to DCI
+  void *DCI_pdu;
+  // when all the procedure related to this DCI, enable this flag
+  boolean_t DCI_release;
+  // Indicate the channel which to transmit
+  channel_NB_IoT_t channel;
+  // rnti
+  rnti_t rnti;
+  // 0 = TC-RNTI , 1 = RA-RNTI, 2 = P-RNTI, 3 = others
+  uint8_t rnti_type;
+  // 0 = data, 1 = ACK/NACK
+  uint8_t npusch_format;
+  //HARQ ACK/NACK repetition
+  uint32_t R_harq;
+  // pointer to next node
+  struct schedule_result *next;
+
+  uint32_t end_subframe;
+  
+  uint8_t *rar_buffer;
+
+}schedule_result_t;
+
+/*Flag structure used for trigger each scheduler*/
+typedef struct{
+  scheduling_flag_t scheduling_flag;
+  //sched_temp_DL_NB_IoT_t sched_result_DL;
+  //resource grid for Uplink
+  available_resource_tones_UL_t *UL_resource;
+  //scheduling result read by output handler
+  schedule_result_t *schedule_result_list_UL;
+  schedule_result_t *schedule_result_list_DL;
+}SCHEDULE_NB_IoT_t;
+
+typedef struct{
+  uint32_t num_dlsf_per_period;
+  uint16_t *sf_to_dlsf_table;
+  uint16_t *dlsf_to_sf_table;
+}DLSF_INFO_t;
+
+typedef enum ce_level_e{
+  ce0=0,
+  ce1,
+  ce2,
+  ce_level_total
+}ce_level_t;
+
+
+
+/*! \brief eNB template for the Random access information */
+typedef struct RA_TEMPLATE_NB_IoT_s{
+
+  boolean_t active;
+  uint32_t msg3_retransmit_count;
+  uint32_t msg4_retransmit_count;
+  uint16_t ta;
+  uint8_t preamble_index;
+  ce_level_t ce_level;
+  rnti_t ue_rnti;
+  rnti_t ra_rnti;
+  struct RA_TEMPLATE_NB_IoT_s *next, *prev;
+  boolean_t wait_msg4_ack;
+  boolean_t wait_msg3_ack;
+  uint8_t rar_buffer[7];
+
+} RA_TEMPLATE_NB_IoT;
+
+typedef struct RA_template_list_s{
+  RA_TEMPLATE_NB_IoT *head;
+  RA_TEMPLATE_NB_IoT *tail;
+}RA_template_list_t;
+
+
+/*! \brief top level eNB MAC structure */
+typedef struct eNB_MAC_INST_NB_IoT_s {
+  /// Ethernet parameters for northbound midhaul interface
+  eth_params_t         eth_params_n;
+  /// Ethernet parameters for fronthaul interface
+  eth_params_t         eth_params_s;
+
+  uint8_t Mod_id;
+  //  System
+  uint32_t hyper_system_frame;
+  uint32_t system_frame;
+  uint32_t sub_frame;
+
+  uint32_t current_subframe;
+  /// Pointer to IF module instance for PHY
+  IF_Module_t *if_inst;
+  //  RA
+  RA_template_list_t RA_msg2_list;
+  RA_template_list_t RA_msg3_list;
+  RA_template_list_t RA_msg4_list;
+
+  RA_TEMPLATE_NB_IoT RA_template[MAX_NUMBER_OF_UE_MAX_NB_IoT];
+
+  //int32_t last_tx_subframe;
+
+  //  for tool
+  int32_t sib1_flag[64];
+  int32_t sib1_count[64];
+  int32_t sib1_period;
+  uint16_t dlsf_table[64];
+  int32_t sibs_table[256];
+
+  //  channel config
+
+  //USS list
+  //Number of USS period is used
+  int num_uss_list;
+  UE_list_NB_IoT_t *UE_list_spec;
+
+  scheduling_flag_t scheduling_flag;
+
+  uint32_t schedule_subframe_DL;
+  uint32_t schedule_subframe_UL;
+
+  rrc_config_NB_IoT_t rrc_config;
+
+  nfapi_config_request_t config;
+
+   IF_Module_NB_IoT_t            *if_inst_NB_IoT;
+} eNB_MAC_INST_NB_IoT;
+
+// actually not here, but for now put it here
+typedef  struct {
+  uint32_t       bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */
+  uint32_t       pdus_in_buffer;  /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */
+  uint32_t       head_sdu_creation_time;           /*!< \brief Head SDU creation time. */
+  uint32_t       head_sdu_remaining_size_to_send;  /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */
+  boolean_t      head_sdu_is_segmented;     /*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */
+} mac_rlc_status_resp_NB_IoT_t;
+
+// global variables
+
+nprach_parameters_NB_IoT_t nprach_list[3];
+
+//DLSF Table
+DLSF_INFO_t DLSF_information;
+
+#endif /*__LAYER2_MAC_DEFS_NB_IoT_H__ */
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index 1910d644448967f3c3248ddd18610eb9c2e0ad53..05067f43a6d0bae3854badea0f1633c78836dd97 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -52,15 +52,12 @@
 //#include "LAYER2/MAC/pre_processor.c"
 #include "pdcp.h"
 
-#if defined(FLEXRAN_AGENT_SB_IF)
 //Agent-related headers
 #include "flexran_agent_extern.h"
 #include "flexran_agent_mac.h"
-#include "flexran_agent_mac_proto.h"
-#endif
 
 #if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+#include "intertask_interface.h"
 #endif
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
@@ -69,449 +66,571 @@
 extern RAN_CONTEXT_t RC;
 extern int phy_test;
 
-uint16_t pdcch_order_table[6] = {31,31,511,2047,2047,8191};
+uint16_t pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
 
 
-void schedule_SRS(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
+void
+schedule_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 {
-  eNB_MAC_INST                   *eNB            = RC.mac[module_idP];
-  UE_list_t                      *UE_list        = &eNB->UE_list;
-  nfapi_ul_config_request_body_t *ul_req;
-  int CC_id,UE_id;
-  COMMON_channels_t                   *cc        = RC.mac[module_idP]->common_channels;
-  SoundingRS_UL_ConfigCommon_t      *soundingRS_UL_ConfigCommon;
-  struct SoundingRS_UL_ConfigDedicated     *soundingRS_UL_ConfigDedicated;
-  uint8_t  TSFC;
-  uint16_t deltaTSFC; // bitmap
-  uint8_t  srs_SubframeConfig;
-
-  // table for TSFC (Period) and deltaSFC (offset)
-  const uint16_t deltaTSFCTabType1[15][2] = { {1,1},{1,2},{2,2},{1,5},{2,5},{4,5},{8,5},{3,5},{12,5},{1,10},{2,10},{4,10},{8,10},{351,10},{383,10} };      // Table 5.5.3.3-2 3GPP 36.211 FDD
-  const uint16_t deltaTSFCTabType2[14][2] = { {2,5},{6,5},{10,5},{18,5},{14,5},{22,5},{26,5},{30,5},{70,10},{74,10},{194,10},{326,10},{586,10},{210,10} }; // Table 5.5.3.3-2 3GPP 36.211 TDD
 
-  uint16_t srsPeriodicity,srsOffset;
 
-  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+  UE_list_t *UE_list = &eNB->UE_list;
+  nfapi_ul_config_request_body_t *ul_req;
+  int CC_id, UE_id;
+  COMMON_channels_t *cc = RC.mac[module_idP]->common_channels;
+  SoundingRS_UL_ConfigCommon_t *soundingRS_UL_ConfigCommon;
+  struct SoundingRS_UL_ConfigDedicated *soundingRS_UL_ConfigDedicated;
+  uint8_t TSFC;
+  uint16_t deltaTSFC;		// bitmap
+  uint8_t srs_SubframeConfig;
+  
+  // table for TSFC (Period) and deltaSFC (offset)
+  const uint16_t deltaTSFCTabType1[15][2] = { {1, 1}, {1, 2}, {2, 2}, {1, 5}, {2, 5}, {4, 5}, {8, 5}, {3, 5}, {12, 5}, {1, 10}, {2, 10}, {4, 10}, {8, 10}, {351, 10}, {383, 10} };	// Table 5.5.3.3-2 3GPP 36.211 FDD
+  const uint16_t deltaTSFCTabType2[14][2] = { {2, 5}, {6, 5}, {10, 5}, {18, 5}, {14, 5}, {22, 5}, {26, 5}, {30, 5}, {70, 10}, {74, 10}, {194, 10}, {326, 10}, {586, 10}, {210, 10} };	// Table 5.5.3.3-2 3GPP 36.211 TDD
+  
+  uint16_t srsPeriodicity, srsOffset;
+  
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
     soundingRS_UL_ConfigCommon = &cc[CC_id].radioResourceConfigCommon->soundingRS_UL_ConfigCommon;
     // check if SRS is enabled in this frame/subframe
     if (soundingRS_UL_ConfigCommon) {
       srs_SubframeConfig = soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig;
-      if (cc[CC_id].tdd_Config == NULL) { // FDD
+      if (cc[CC_id].tdd_Config == NULL) {	// FDD
 	deltaTSFC = deltaTSFCTabType1[srs_SubframeConfig][0];
-	TSFC      = deltaTSFCTabType1[srs_SubframeConfig][1];
-      }
-      else { // TDD
+	TSFC = deltaTSFCTabType1[srs_SubframeConfig][1];
+      } else {		// TDD
 	deltaTSFC = deltaTSFCTabType2[srs_SubframeConfig][0];
-	TSFC      = deltaTSFCTabType2[srs_SubframeConfig][1];
+	TSFC = deltaTSFCTabType2[srs_SubframeConfig][1];
       }
       // Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC
-      uint16_t tmp = (subframeP %  TSFC);
-
-      if((1<<tmp) & deltaTSFC) {
+      uint16_t tmp = (subframeP % TSFC);
+      
+      if ((1 << tmp) & deltaTSFC) {
 	// This is an SRS subframe, loop over UEs
-	for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
-	  if (RC.mac[module_idP]->UE_list.active[UE_id]!=TRUE) continue;
-	  ul_req        = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body;
-
-
-          // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
-          if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED) continue;
-
-	  AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id);
-
-	  if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated)!=NULL) {
+	for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+	  if (RC.mac[module_idP]->UE_list.active[UE_id] != TRUE)
+	    continue;
+	  ul_req = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body;
+	  // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
+	  if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) continue;
+	  
+	  AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL,
+		      "physicalConfigDedicated is null for UE %d\n",
+		      UE_id);
+	  
+	  if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated) != NULL) {
 	    if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
-	      get_srs_pos(&cc[CC_id], soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex, &srsPeriodicity, &srsOffset);
-	      if (((10*frameP+subframeP) % srsPeriodicity) == srsOffset) {
-		// Prorgram SRS
-		ul_req->srs_present                                                 = 1;
-		nfapi_ul_config_request_pdu_t* ul_config_pdu                        = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
-		memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
-		ul_config_pdu->pdu_type                                             = NFAPI_UL_CONFIG_SRS_PDU_TYPE;
-		ul_config_pdu->pdu_size                                             = 2+(uint8_t)(2+sizeof(nfapi_ul_config_srs_pdu));
-		ul_config_pdu->srs_pdu.srs_pdu_rel8.size                            = (uint8_t)sizeof(nfapi_ul_config_srs_pdu);;
-		ul_config_pdu->srs_pdu.srs_pdu_rel8.rnti                            = UE_list->UE_template[CC_id][UE_id].rnti;
-		ul_config_pdu->srs_pdu.srs_pdu_rel8.srs_bandwidth                   = soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth;
-		ul_config_pdu->srs_pdu.srs_pdu_rel8.frequency_domain_position       = soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition;
-		ul_config_pdu->srs_pdu.srs_pdu_rel8.srs_hopping_bandwidth           = soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;;
-		ul_config_pdu->srs_pdu.srs_pdu_rel8.transmission_comb               = soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
-		ul_config_pdu->srs_pdu.srs_pdu_rel8.i_srs                           = soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
-		ul_config_pdu->srs_pdu.srs_pdu_rel8.sounding_reference_cyclic_shift = soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift;
-		//		ul_config_pdu->srs_pdu.srs_pdu_rel10.antenna_port                   = ;//
-		//		ul_config_pdu->srs_pdu.srs_pdu_rel13.number_of_combs                = ;//
-		RC.mac[module_idP]->UL_req[CC_id].sfn_sf = (frameP<<4)+subframeP;
+	      get_srs_pos(&cc[CC_id],
+			  soundingRS_UL_ConfigDedicated->choice.
+			  setup.srs_ConfigIndex,
+			  &srsPeriodicity, &srsOffset);
+	      if (((10 * frameP + subframeP) % srsPeriodicity) == srsOffset) {
+		// Program SRS
+		ul_req->srs_present = 1;
+		nfapi_ul_config_request_pdu_t * ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
+		memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t));
+		ul_config_pdu->pdu_type =  NFAPI_UL_CONFIG_SRS_PDU_TYPE;
+		ul_config_pdu->pdu_size =  2 + (uint8_t) (2 + sizeof(nfapi_ul_config_srs_pdu));
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG;
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.size = (uint8_t)sizeof(nfapi_ul_config_srs_pdu);
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.rnti = UE_list->UE_template[CC_id][UE_id].rnti;
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.srs_bandwidth = soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth;
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.frequency_domain_position = soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition;
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.srs_hopping_bandwidth = soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;;
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.transmission_comb = soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.i_srs = soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
+		ul_config_pdu->srs_pdu.srs_pdu_rel8.sounding_reference_cyclic_shift = soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift;		//              ul_config_pdu->srs_pdu.srs_pdu_rel10.antenna_port                   = ;//
+		//              ul_config_pdu->srs_pdu.srs_pdu_rel13.number_of_combs                = ;//
+		RC.mac[module_idP]->UL_req[CC_id].sfn_sf = (frameP << 4) + subframeP;
+		RC.mac[module_idP]->UL_req[CC_id].header.message_id = NFAPI_UL_CONFIG_REQUEST;
 		ul_req->number_of_pdus++;
-	      } // if (((10*frameP+subframeP) % srsPeriodicity) == srsOffset)
-	    } // if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup)
-	  } // if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated)!=NULL)
-	} // for (UE_id ...
-      } // if((1<<tmp) & deltaTSFC)
-
-    }// SRS config
+	      }	// if (((10*frameP+subframeP) % srsPeriodicity) == srsOffset)
+	    }	// if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup)
+	  }		// if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated)!=NULL)
+	}		// for (UE_id ...
+      }			// if((1<<tmp) & deltaTSFC)
+      
+    }			// SRS config
   }
 }
 
-void schedule_CSI(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
+void
+schedule_CSI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 {
-  eNB_MAC_INST                   *eNB          = RC.mac[module_idP];
-  UE_list_t                      *UE_list      = &eNB->UE_list;
+  eNB_MAC_INST                   *eNB = RC.mac[module_idP];
+  UE_list_t                      *UE_list = &eNB->UE_list;
   COMMON_channels_t              *cc;
   nfapi_ul_config_request_body_t *ul_req;
-  int CC_id,UE_id;
-  struct CQI_ReportPeriodic *cqi_ReportPeriodic;
-  uint16_t Npd,N_OFFSET_CQI;
-  int H;
+  int                            CC_id, UE_id;
+  struct CQI_ReportPeriodic      *cqi_ReportPeriodic;
+  uint16_t                       Npd, N_OFFSET_CQI;
+  int                            H;
 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
 
     cc = &eNB->common_channels[CC_id];
-    for (UE_id=0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
-      if (UE_list->active[UE_id] != TRUE) continue;
+    for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+      if (UE_list->active[UE_id] != TRUE)
+	continue;
 
-      ul_req        = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body;
+      ul_req = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body;
 
       // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
-      if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED) continue;
+      if (mac_eNB_get_rrc_status(module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) continue;
 
-      AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id);
+      AssertFatal(UE_list->
+		  UE_template[CC_id][UE_id].physicalConfigDedicated
+		  != NULL,
+		  "physicalConfigDedicated is null for UE %d\n",
+		  UE_id);
 
       if (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->cqi_ReportConfig) {
-	if ((cqi_ReportPeriodic = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic)!=NULL &&
-	    (cqi_ReportPeriodic->present!=CQI_ReportPeriodic_PR_release)) {
+	if ((cqi_ReportPeriodic = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) != NULL
+	    && (cqi_ReportPeriodic->present != CQI_ReportPeriodic_PR_release)) {
 	  //Rel8 Periodic CQI/PMI/RI reporting
 
-	  get_csi_params(cc,cqi_ReportPeriodic,&Npd,&N_OFFSET_CQI,&H);
+	  get_csi_params(cc, cqi_ReportPeriodic, &Npd,
+			 &N_OFFSET_CQI, &H);
 
-	  if ((((frameP*10)+subframeP)%Npd) == N_OFFSET_CQI) {  // CQI opportunity
-	    UE_list->UE_sched_ctrl[UE_id].feedback_cnt[CC_id]=(((frameP*10)+subframeP)/Npd)%H;
+	  if ((((frameP * 10) + subframeP) % Npd) == N_OFFSET_CQI) {	// CQI opportunity
+	    UE_list->UE_sched_ctrl[UE_id].feedback_cnt[CC_id] = (((frameP * 10) + subframeP) / Npd) % H;
 	    // Program CQI
-	    nfapi_ul_config_request_pdu_t* ul_config_pdu                                     = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
-	    memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
+	    nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
+	    memset((void *) ul_config_pdu, 0,
+		   sizeof(nfapi_ul_config_request_pdu_t));
 	    ul_config_pdu->pdu_type                                                          = NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE;
-	    ul_config_pdu->pdu_size                                                          = 2+(uint8_t)(2+sizeof(nfapi_ul_config_uci_cqi_pdu));
+	    ul_config_pdu->pdu_size                                                          = 2 + (uint8_t) (2 + sizeof(nfapi_ul_config_uci_cqi_pdu));
+	    ul_config_pdu->uci_cqi_pdu.ue_information.ue_information_rel8.tl.tag             = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
 	    ul_config_pdu->uci_cqi_pdu.ue_information.ue_information_rel8.rnti               = UE_list->UE_template[CC_id][UE_id].rnti;
+	    ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.tl.tag           = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG;
 	    ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.pucch_index      = cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
-	    ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.dl_cqi_pmi_size  = get_rel8_dl_cqi_pmi_size(&UE_list->UE_sched_ctrl[UE_id],
-															CC_id,
-															cc,
-															get_tmode(module_idP,CC_id,UE_id),
+	    ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.dl_cqi_pmi_size  = get_rel8_dl_cqi_pmi_size(&UE_list->UE_sched_ctrl[UE_id], CC_id, cc,
+															get_tmode(module_idP, CC_id, UE_id),
 															cqi_ReportPeriodic);
 	    ul_req->number_of_pdus++;
+	    ul_req->tl.tag                                                                   = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
 
 #if defined(Rel10) || defined(Rel14)
 	    // PUT rel10-13 UCI options here
 #endif
-	  }
-	  else if ((cqi_ReportPeriodic->choice.setup.ri_ConfigIndex) &&
-		   ((((frameP*10)+subframeP)%((H*Npd)<<(*cqi_ReportPeriodic->choice.setup.ri_ConfigIndex/161)))==
-		    N_OFFSET_CQI + (*cqi_ReportPeriodic->choice.setup.ri_ConfigIndex%161))) {  // RI opportunity
-	    // Program RI
-	    nfapi_ul_config_request_pdu_t* ul_config_pdu                                     = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
-	    memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
-	    ul_config_pdu->pdu_type                                                          = NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE;
-	    ul_config_pdu->pdu_size                                                          = 2+(uint8_t)(2+sizeof(nfapi_ul_config_uci_cqi_pdu));
-	    ul_config_pdu->uci_cqi_pdu.ue_information.ue_information_rel8.rnti               = UE_list->UE_template[CC_id][UE_id].rnti;
-	    ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.pucch_index      = cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
-	    ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.dl_cqi_pmi_size  = (cc->p_eNB==2)?1:2;
-	    RC.mac[module_idP]->UL_req[CC_id].sfn_sf = (frameP<<4)+subframeP;
-	    ul_req->number_of_pdus++;
-	  }
-
-	} // if ((cqi_ReportPeriodic = cqi_ReportConfig->cqi_ReportPeriodic)!=NULL) {
-      } // if (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->cqi_ReportConfig)
-    } // for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
-  } // for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+	  } else
+	    if ((cqi_ReportPeriodic->choice.setup.ri_ConfigIndex)
+		&& ((((frameP * 10) + subframeP) % ((H * Npd) << (*cqi_ReportPeriodic->choice.setup.ri_ConfigIndex / 161))) == N_OFFSET_CQI + (*cqi_ReportPeriodic->choice.setup.ri_ConfigIndex % 161))) {	// RI opportunity
+	      // Program RI
+	      nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
+	      memset((void *) ul_config_pdu, 0,
+		     sizeof(nfapi_ul_config_request_pdu_t));
+	      ul_config_pdu->pdu_type                                                          = NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE;
+	      ul_config_pdu->pdu_size                                                          = 2 + (uint8_t) (2 + sizeof(nfapi_ul_config_uci_cqi_pdu));
+	      ul_config_pdu->uci_cqi_pdu.ue_information.ue_information_rel8.tl.tag             = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+	      ul_config_pdu->uci_cqi_pdu.ue_information.ue_information_rel8.rnti               = UE_list->UE_template[CC_id][UE_id].rnti;
+	      ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.tl.tag           = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG;
+	      ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.pucch_index      = cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
+	      ul_config_pdu->uci_cqi_pdu.cqi_information.cqi_information_rel8.dl_cqi_pmi_size  = (cc->p_eNB == 2) ? 1 : 2;
+	      RC.mac[module_idP]->UL_req[CC_id].sfn_sf                                         = (frameP << 4) + subframeP;
+	      ul_req->number_of_pdus++;
+	      ul_req->tl.tag                                                                   = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+	    }
+	}		// if ((cqi_ReportPeriodic = cqi_ReportConfig->cqi_ReportPeriodic)!=NULL) {
+      }			// if (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->cqi_ReportConfig)
+    }			// for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
+  }				// for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
 }
 
-void schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
+void
+schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 {
-  eNB_MAC_INST                   *eNB        = RC.mac[module_idP];
-  UE_list_t                      *UE_list    = &eNB->UE_list;
-  nfapi_ul_config_request_body_t *ul_req;
-  int                             CC_id;
-  int                             UE_id;
+  eNB_MAC_INST                   *eNB = RC.mac[module_idP];
+  UE_list_t                      *UE_list = &eNB->UE_list;
+  nfapi_ul_config_request_t      *ul_req;
+  nfapi_ul_config_request_body_t *ul_req_body;
+  int                            CC_id;
+  int                            UE_id;
   SchedulingRequestConfig_t      *SRconfig;
-  int                             skip_ue;
-  int                             is_harq;
-  nfapi_ul_config_sr_information  sr;
-  int                             i;
+  int                            skip_ue;
+  int                            is_harq;
+  nfapi_ul_config_sr_information sr;
+  int                            i;
 
   for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
     RC.mac[module_idP]->UL_req[CC_id].sfn_sf = (frameP << 4) + subframeP;
 
-    for (UE_id = 0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
-      if (RC.mac[module_idP]->UE_list.active[UE_id]!=TRUE) continue;
+    for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+      if (RC.mac[module_idP]->UE_list.active[UE_id] != TRUE) continue;
 
-      ul_req        = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body;
-
-      AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id);
+      ul_req        = &RC.mac[module_idP]->UL_req[CC_id];
+      ul_req_body   = &ul_req->ul_config_request_body;
 
       // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
-      if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED) continue;
-
-      if ((SRconfig = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig)!=NULL) {
-        if (SRconfig->present == SchedulingRequestConfig_PR_setup) {
-          if (SRconfig->choice.setup.sr_ConfigIndex <= 4) {        // 5 ms SR period
-            if ((subframeP%5) != SRconfig->choice.setup.sr_ConfigIndex)
-              continue;
-          } else if (SRconfig->choice.setup.sr_ConfigIndex <= 14) { // 10 ms SR period
-            if (subframeP!=(SRconfig->choice.setup.sr_ConfigIndex-5))
-              continue;
-          } else if (SRconfig->choice.setup.sr_ConfigIndex <= 34) { // 20 ms SR period
-            if ((10*(frameP&1)+subframeP) != (SRconfig->choice.setup.sr_ConfigIndex-15))
-              continue;
-          } else if (SRconfig->choice.setup.sr_ConfigIndex <= 74) { // 40 ms SR period
-            if ((10*(frameP&3)+subframeP) != (SRconfig->choice.setup.sr_ConfigIndex-35))
-              continue;
-          } else if (SRconfig->choice.setup.sr_ConfigIndex <= 154) { // 80 ms SR period
-            if ((10*(frameP&7)+subframeP) != (SRconfig->choice.setup.sr_ConfigIndex-75))
-              continue;
-          }
-        } // SRconfig->present == SchedulingRequestConfig_PR_setup)
-      } // SRconfig = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig)!=NULL)
+      if (mac_eNB_get_rrc_status(module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) continue;
+
+      AssertFatal(UE_list->
+		  UE_template[CC_id][UE_id].physicalConfigDedicated!= NULL,
+		  "physicalConfigDedicated is null for UE %d\n",
+		  UE_id);
+
+      if ((SRconfig = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig) != NULL) {
+	if (SRconfig->present == SchedulingRequestConfig_PR_setup) {
+	  if (SRconfig->choice.setup.sr_ConfigIndex <= 4) {	// 5 ms SR period
+	    if ((subframeP % 5) != SRconfig->choice.setup.sr_ConfigIndex) continue;
+	  } else if (SRconfig->choice.setup.sr_ConfigIndex <= 14) {	// 10 ms SR period
+	    if (subframeP != (SRconfig->choice.setup.sr_ConfigIndex - 5)) continue;
+	  } else if (SRconfig->choice.setup.sr_ConfigIndex <= 34) {	// 20 ms SR period
+	    if ((10 * (frameP & 1) + subframeP) != (SRconfig->choice.setup.sr_ConfigIndex - 15)) continue;
+	  } else if (SRconfig->choice.setup.sr_ConfigIndex <= 74) {	// 40 ms SR period
+	    if ((10 * (frameP & 3) + subframeP) != (SRconfig->choice.setup.sr_ConfigIndex - 35)) continue;
+	  } else if (SRconfig->choice.setup.sr_ConfigIndex <= 154) {	// 80 ms SR period
+	    if ((10 * (frameP & 7) + subframeP) != (SRconfig->choice.setup.sr_ConfigIndex - 75)) continue;
+	  }
+	}		// SRconfig->present == SchedulingRequestConfig_PR_setup)
+      }			// SRconfig = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig)!=NULL)
 
       // if we get here there is some PUCCH1 reception to schedule for SR
 
-      skip_ue=0;
+      skip_ue = 0;
       is_harq = 0;
       // check that there is no existing UL grant for ULSCH which overrides the SR
-      for (i = 0; i < ul_req->number_of_pdus; i++) {
-        if (((ul_req->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE)||
-             (ul_req->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE)||
-             (ul_req->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE)||
-             (ul_req->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE))&&
-            (ul_req->ul_config_pdu_list[i].ulsch_pdu.ulsch_pdu_rel8.rnti == UE_list->UE_template[CC_id][UE_id].rnti)) {
-            skip_ue=1;
-            break;
-        }
-        /* if there is already an HARQ pdu, convert to SR_HARQ */
-        else if ((ul_req->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE)&&
-                 (ul_req->ul_config_pdu_list[i].uci_harq_pdu.ue_information.ue_information_rel8.rnti == UE_list->UE_template[CC_id][UE_id].rnti)) {
-          is_harq = 1;
-          break;
-        }
+      for (i = 0; i < ul_req_body->number_of_pdus; i++) {
+	if (((ul_req_body->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) || 
+	     (ul_req_body->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) || 
+	     (ul_req_body->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE) || 
+	     (ul_req_body->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE)) && 
+	    (ul_req_body->ul_config_pdu_list[i].ulsch_pdu.ulsch_pdu_rel8.rnti == UE_list->UE_template[CC_id][UE_id].rnti)) {
+	  skip_ue = 1;
+	  break;
+	}
+	/* if there is already an HARQ pdu, convert to SR_HARQ */
+	else if ((ul_req_body->ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE) && 
+		 (ul_req_body->ul_config_pdu_list[i].uci_harq_pdu.ue_information.ue_information_rel8.rnti == UE_list->UE_template[CC_id][UE_id].rnti)) {
+	  is_harq = 1;
+	  break;
+	}
       }
 
       // drop the allocation because ULSCH with handle it with BSR
-      if (skip_ue==1) continue;
+      if (skip_ue == 1) continue;
 
-      LOG_D(MAC,"Frame %d, Subframe %d : Scheduling SR for UE %d/%x\n",frameP,subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].rnti);
+      LOG_D(MAC,"Frame %d, Subframe %d : Scheduling SR for UE %d/%x is_harq:%d\n",frameP,subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].rnti, is_harq);
 
       // check Rel10 or Rel8 SR
 #if defined(Rel10) || defined(Rel14)
-      if ((UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2) &&
-          (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2->schedulingRequestConfig_v1020)&&
-          (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2->schedulingRequestConfig_v1020)) {
-        sr.sr_information_rel10.number_of_pucch_resources = 1;
-        sr.sr_information_rel10.pucch_index_p1 = *UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2->schedulingRequestConfig_v1020->sr_PUCCH_ResourceIndexP1_r10;
+      if ((UE_list-> UE_template[CC_id][UE_id].physicalConfigDedicated->ext2)
+	  && (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2->schedulingRequestConfig_v1020)
+	  && (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2->schedulingRequestConfig_v1020)) {
+	sr.sr_information_rel10.tl.tag                    = NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG;
+	sr.sr_information_rel10.number_of_pucch_resources = 1;
+	sr.sr_information_rel10.pucch_index_p1            = *UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2->schedulingRequestConfig_v1020->sr_PUCCH_ResourceIndexP1_r10;
+	LOG_D(MAC,"REL10 PUCCH INDEX P1:%d\n", sr.sr_information_rel10.pucch_index_p1);
       } else
 #endif
-      {
-        sr.sr_information_rel8.pucch_index = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex;
-      }
+	{
+	  sr.sr_information_rel8.tl.tag                   = NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG;
+	  sr.sr_information_rel8.pucch_index              = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex;
+	  LOG_D(MAC,"REL8 PUCCH INDEX:%d\n", sr.sr_information_rel8.pucch_index);
+	}
 
       /* if there is already an HARQ pdu, convert to SR_HARQ */
       if (is_harq) {
-        nfapi_ul_config_harq_information h = ul_req->ul_config_pdu_list[i].uci_harq_pdu.harq_information;
-        ul_req->ul_config_pdu_list[i].pdu_type                         = NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE;
-        ul_req->ul_config_pdu_list[i].uci_sr_harq_pdu.sr_information   = sr;
-        ul_req->ul_config_pdu_list[i].uci_sr_harq_pdu.harq_information = h;
+	nfapi_ul_config_harq_information h                                                                                 = ul_req_body->ul_config_pdu_list[i].uci_harq_pdu.harq_information;
+	ul_req_body->ul_config_pdu_list[i].pdu_type                                                                        = NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE;
+	ul_req_body->ul_config_pdu_list[i].uci_sr_harq_pdu.sr_information                                                  = sr;
+	ul_req_body->ul_config_pdu_list[i].uci_sr_harq_pdu.harq_information                                                = h;
       } else {
-        ul_req->ul_config_pdu_list[ul_req->number_of_pdus].pdu_type                                           = NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE;
-        ul_req->ul_config_pdu_list[ul_req->number_of_pdus].uci_sr_pdu.ue_information.ue_information_rel8.rnti = UE_list->UE_template[CC_id][UE_id].rnti;
-        ul_req->ul_config_pdu_list[ul_req->number_of_pdus].uci_sr_pdu.sr_information                          = sr;
-        ul_req->number_of_pdus++;
-      } /* if (is_harq) */
-    } // for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id])
-  } // for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
+	ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus].pdu_type                                              = NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE;
+	ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus].uci_sr_pdu.ue_information.ue_information_rel8.tl.tag  = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+	ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus].uci_sr_pdu.ue_information.ue_information_rel8.rnti    = UE_list->UE_template[CC_id][UE_id].rnti;
+	ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus].uci_sr_pdu.ue_information.ue_information_rel11.tl.tag = 0;
+	ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus].uci_sr_pdu.ue_information.ue_information_rel13.tl.tag = 0;
+	ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus].uci_sr_pdu.sr_information                             = sr;
+	ul_req_body->number_of_pdus++;
+      }			/* if (is_harq) */
+      ul_req_body->tl.tag                                                                                                  = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+    }			// for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id])
+  }				// for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
 }
 
-void check_ul_failure(module_id_t module_idP,int CC_id,int UE_id,
-		      frame_t frameP, sub_frame_t subframeP)
+extern uint8_t nfapi_mode;
+
+void
+check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
+		 frame_t frameP, sub_frame_t subframeP)
 {
-  UE_list_t                           *UE_list      = &RC.mac[module_idP]->UE_list;
-  nfapi_dl_config_request_t           *DL_req       = &RC.mac[module_idP]->DL_req[0];
-  uint16_t                            rnti          = UE_RNTI(module_idP,UE_id);
-  COMMON_channels_t                   *cc           = RC.mac[module_idP]->common_channels;
+  UE_list_t                 *UE_list = &RC.mac[module_idP]->UE_list;
+  nfapi_dl_config_request_t  *DL_req = &RC.mac[module_idP]->DL_req[0];
+  uint16_t                      rnti = UE_RNTI(module_idP, UE_id);
+  COMMON_channels_t              *cc = RC.mac[module_idP]->common_channels;
 
   // check uplink failure
-  if ((UE_list->UE_sched_ctrl[UE_id].ul_failure_timer>0)&&
-      (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync==0)) {
-    LOG_I(MAC,"UE %d rnti %x: UL Failure timer %d \n",UE_id,rnti,UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
-    if (UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent==0) {
-      UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent=1;
+  if ((UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 0) &&
+      (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 0)) {
+    LOG_I(MAC, "UE %d rnti %x: UL Failure timer %d \n", UE_id, rnti,
+	  UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
+    if (UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent == 0) {
+      UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent = 1;
 
       // add a format 1A dci for this UE to request an RA procedure (only one UE per subframe)
-      nfapi_dl_config_request_pdu_t* dl_config_pdu                    = &DL_req[CC_id].dl_config_request_body.dl_config_pdu_list[DL_req[CC_id].dl_config_request_body.number_pdu];
-      memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
+      nfapi_dl_config_request_pdu_t *dl_config_pdu                    = &DL_req[CC_id].dl_config_request_body.dl_config_pdu_list[DL_req[CC_id].dl_config_request_body.number_pdu];
+      memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_config_request_pdu_t));
       dl_config_pdu->pdu_type                                         = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
-      dl_config_pdu->pdu_size                                         = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
+      dl_config_pdu->pdu_size                                         = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag                = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
       dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format            = NFAPI_DL_DCI_FORMAT_1A;
-      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level     = get_aggregation(get_bw_index(module_idP,CC_id),UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format1A);
+      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level     = get_aggregation(get_bw_index(module_idP, CC_id),
+											UE_list->UE_sched_ctrl[UE_id].
+											dl_cqi[CC_id], format1A);
       dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti                  = rnti;
-      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type             = 1;    // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
-      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power    = 6000; // equal to RS power
+      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type             = 1;	// CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
+      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power    = 6000;	// equal to RS power
 
-      AssertFatal((cc[CC_id].mib->message.dl_Bandwidth >=0) && (cc[CC_id].mib->message.dl_Bandwidth<6),
-		  "illegal dl_Bandwidth %d\n",(int)cc[CC_id].mib->message.dl_Bandwidth);
+      AssertFatal((cc[CC_id].mib->message.dl_Bandwidth >= 0) && (cc[CC_id].mib->message.dl_Bandwidth < 6),
+		  "illegal dl_Bandwidth %d\n",
+		  (int) cc[CC_id].mib->message.dl_Bandwidth);
       dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = pdcch_order_table[cc[CC_id].mib->message.dl_Bandwidth];
       DL_req[CC_id].dl_config_request_body.number_dci++;
       DL_req[CC_id].dl_config_request_body.number_pdu++;
-      LOG_I(MAC,"UE %d rnti %x: sending PDCCH order for RAPROC (failure timer %d), resource_block_coding %d \n",UE_id,rnti,UE_list->UE_sched_ctrl[UE_id].ul_failure_timer,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding);
-    }
-    else { // ra_pdcch_sent==1
-      LOG_I(MAC,"UE %d rnti %x: sent PDCCH order for RAPROC waiting (failure timer %d) \n",UE_id,rnti,UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
-      if ((UE_list->UE_sched_ctrl[UE_id].ul_failure_timer % 40) == 0)
-	UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent=0; // resend every 4 frames
+      DL_req[CC_id].dl_config_request_body.tl.tag                      = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+      LOG_I(MAC,
+	    "UE %d rnti %x: sending PDCCH order for RAPROC (failure timer %d), resource_block_coding %d \n",
+	    UE_id, rnti,
+	    UE_list->UE_sched_ctrl[UE_id].ul_failure_timer,
+	    dl_config_pdu->dci_dl_pdu.
+	    dci_dl_pdu_rel8.resource_block_coding);
+    } else {		// ra_pdcch_sent==1
+      LOG_I(MAC,
+	    "UE %d rnti %x: sent PDCCH order for RAPROC waiting (failure timer %d) \n",
+	    UE_id, rnti,
+	    UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
+      if ((UE_list->UE_sched_ctrl[UE_id].ul_failure_timer % 40) == 0) UE_list->UE_sched_ctrl[UE_id].ra_pdcch_order_sent = 0;	// resend every 4 frames
     }
 
     UE_list->UE_sched_ctrl[UE_id].ul_failure_timer++;
     // check threshold
-    if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 200) {
+    if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 20000) {
       // inform RRC of failure and clear timer
-      LOG_I(MAC,"UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti);
-      mac_eNB_rrc_ul_failure(module_idP,CC_id,frameP,subframeP,rnti);
-      UE_list->UE_sched_ctrl[UE_id].ul_failure_timer=0;
-      UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync=1;
+      LOG_I(MAC,
+	    "UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",
+	    UE_id, rnti);
+      mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti);
+      UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
+      UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync   = 1;
+
+      //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future
+      if (rrc_agent_registered[module_idP]) {
+        LOG_W(MAC, "notify flexran Agent of UE state change\n");
+        agent_rrc_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP,
+            rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+      }
     }
-  } // ul_failure_timer>0
-
+  }				// ul_failure_timer>0
+
+  UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer++;
+  if(UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer > (U_PLANE_INACTIVITY_VALUE*subframe_num(&RC.eNB[module_idP][CC_id]->frame_parms))){
+    LOG_D(MAC,"UE %d rnti %x: U-Plane Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti); 
+    mac_eNB_rrc_uplane_failure(module_idP,CC_id,frameP,subframeP,rnti);
+    UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer  = 0;
+  }// time > 60s
 }
 
-void clear_nfapi_information(eNB_MAC_INST *eNB,int CC_idP,frame_t frameP,sub_frame_t subframeP)
+void
+clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP,
+			frame_t frameP, sub_frame_t subframeP)
 {
-  nfapi_dl_config_request_t *DL_req         = &eNB->DL_req[0];
-  nfapi_ul_config_request_t *UL_req         = &eNB->UL_req[0];
-  nfapi_hi_dci0_request_t   *HI_DCI0_req    = &eNB->HI_DCI0_req[0];
-  nfapi_tx_request_t        *TX_req         = &eNB->TX_req[0];
+  nfapi_dl_config_request_t      *DL_req = &eNB->DL_req[0];
+  nfapi_ul_config_request_t      *UL_req = &eNB->UL_req[0];
+  nfapi_hi_dci0_request_t   *HI_DCI0_req = &eNB->HI_DCI0_req[0];
+  nfapi_tx_request_t             *TX_req = &eNB->TX_req[0];
 
+  eNB->pdu_index[CC_idP] = 0;
 
-  eNB->pdu_index[CC_idP]                                     = 0;
-  DL_req[CC_idP].dl_config_request_body.number_pdcch_ofdm_symbols           = 1;
-  DL_req[CC_idP].dl_config_request_body.number_dci                          = 0;
-  DL_req[CC_idP].dl_config_request_body.number_pdu                          = 0;
-  DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti                   = 0;
-  DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich           = 6000;
+  if (nfapi_mode==0 || nfapi_mode == 1) { // monolithic or PNF
 
-  HI_DCI0_req[CC_idP].hi_dci0_request_body.sfnsf                            = subframeP + (frameP<<4);
-  HI_DCI0_req[CC_idP].hi_dci0_request_body.number_of_dci                    = 0;
+    DL_req[CC_idP].dl_config_request_body.number_pdcch_ofdm_symbols           = 1;
+    DL_req[CC_idP].dl_config_request_body.number_dci                          = 0;
+    DL_req[CC_idP].dl_config_request_body.number_pdu                          = 0;
+    DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti                   = 0;
+    DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich           = 6000;
 
+    HI_DCI0_req[CC_idP].hi_dci0_request_body.sfnsf                            = subframeP + (frameP<<4);
+    HI_DCI0_req[CC_idP].hi_dci0_request_body.number_of_dci                    = 0;
 
-  UL_req[CC_idP].ul_config_request_body.number_of_pdus                      = 0;
-  UL_req[CC_idP].ul_config_request_body.rach_prach_frequency_resources      = 0; // ignored, handled by PHY for now
-  UL_req[CC_idP].ul_config_request_body.srs_present                         = 0; // ignored, handled by PHY for now
 
+    UL_req[CC_idP].ul_config_request_body.number_of_pdus                      = 0;
+    UL_req[CC_idP].ul_config_request_body.rach_prach_frequency_resources      = 0; // ignored, handled by PHY for now
+    UL_req[CC_idP].ul_config_request_body.srs_present                         = 0; // ignored, handled by PHY for now
 
-  TX_req[CC_idP].tx_request_body.number_of_pdus                 = 0;
-
+    TX_req[CC_idP].tx_request_body.number_of_pdus                 = 0;
 
+  }
 }
 
-void copy_ulreq(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP)
+void
+copy_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 {
   int CC_id;
-  eNB_MAC_INST *eNB;
-  nfapi_ul_config_request_body_t *ul_req_tmp;
-  nfapi_ul_config_request_body_t *ul_req;
+  eNB_MAC_INST *mac = RC.mac[module_idP];
 
-  eNB = RC.mac[module_idP];
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
 
-  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
+    nfapi_ul_config_request_t *ul_req_tmp             = &mac->UL_req_tmp[CC_id][subframeP];
+    nfapi_ul_config_request_t *ul_req                 = &mac->UL_req[CC_id];
+    nfapi_ul_config_request_pdu_t *ul_req_pdu         = ul_req->ul_config_request_body.ul_config_pdu_list;
 
-    ul_req_tmp       = &eNB->UL_req_tmp[CC_id][subframeP].ul_config_request_body;
-    ul_req           = &eNB->UL_req[CC_id].ul_config_request_body;
+    *ul_req = *ul_req_tmp;
 
-    eNB->UL_req[CC_id].sfn_sf   = (frameP<<4) + subframeP;
-    ul_req->number_of_pdus                     = ul_req_tmp->number_of_pdus;
-    ul_req_tmp->number_of_pdus = 0;
+    // Restore the pointer
+    ul_req->ul_config_request_body.ul_config_pdu_list = ul_req_pdu;
+    ul_req->sfn_sf                                    = (frameP<<4) + subframeP;
+    ul_req_tmp->ul_config_request_body.number_of_pdus = 0;
 
-    memcpy((void*)ul_req->ul_config_pdu_list,
-	   (void*)ul_req_tmp->ul_config_pdu_list,
-	   ul_req->number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t));
+    if (ul_req->ul_config_request_body.number_of_pdus>0)
+      {
+        LOG_D(PHY, "%s() active NOW (frameP:%d subframeP:%d) pdus:%d\n", __FUNCTION__, frameP, subframeP, ul_req->ul_config_request_body.number_of_pdus);
+      }
 
+    memcpy((void*)ul_req->ul_config_request_body.ul_config_pdu_list,
+	   (void*)ul_req_tmp->ul_config_request_body.ul_config_pdu_list,
+	   ul_req->ul_config_request_body.number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t));
   }
 }
 
-void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
+void
+eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
+			  sub_frame_t subframeP)
 {
 
-  int mbsfn_status[MAX_NUM_CCs];
+  int               mbsfn_status[MAX_NUM_CCs];
   protocol_ctxt_t   ctxt;
 
-  int CC_id,i; //,next_i;
-  UE_list_t *UE_list=&RC.mac[module_idP]->UE_list;
-  rnti_t rnti;
-
-  COMMON_channels_t         *cc             = RC.mac[module_idP]->common_channels;
-
-#if defined(FLEXRAN_AGENT_SB_IF)
-  Protocol__FlexranMessage *msg;
-#endif
+  int               CC_id, i = -1;
+  UE_list_t         *UE_list = &RC.mac[module_idP]->UE_list;
+  rnti_t            rnti;
 
+  COMMON_channels_t *cc      = RC.mac[module_idP]->common_channels;
 
   start_meas(&RC.mac[module_idP]->eNB_scheduler);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+    (VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
+     VCD_FUNCTION_IN);
+
+  RC.mac[module_idP]->frame    = frameP;
+  RC.mac[module_idP]->subframe = subframeP;
 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    mbsfn_status[CC_id]=0;
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    mbsfn_status[CC_id] = 0;
 
     // clear vrb_maps
-    memset(cc[CC_id].vrb_map,0,100);
-    memset(cc[CC_id].vrb_map_UL,0,100);
+    memset(cc[CC_id].vrb_map, 0, 100);
+    memset(cc[CC_id].vrb_map_UL, 0, 100);
 
 
 #if defined(Rel10) || defined(Rel14)
-    cc[CC_id].mcch_active =0;
+    cc[CC_id].mcch_active        = 0;
 #endif
-    RC.mac[module_idP]->frame    = frameP;
-    RC.mac[module_idP]->subframe = subframeP;
 
-    clear_nfapi_information(RC.mac[module_idP],CC_id,frameP,subframeP);
+    clear_nfapi_information(RC.mac[module_idP], CC_id, frameP, subframeP);
   }
 
   // refresh UE list based on UEs dropped by PHY in previous subframe
   for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
-    if (UE_list->active[i] != TRUE) continue;
-
-    rnti         = UE_RNTI(module_idP, i);
-    CC_id        = UE_PCCID(module_idP, i);
-
-    if ((frameP==0)&&(subframeP==0)) {
-      LOG_I(MAC,"UE  rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n", rnti,
-            UE_list->UE_sched_ctrl[i].ul_out_of_sync==0 ? "in synch" : "out of sync",
+    if (UE_list->active[i] != TRUE)
+      continue;
+
+    rnti = UE_RNTI(module_idP, i);
+    CC_id = UE_PCCID(module_idP, i);
+
+    if ((frameP == 0) && (subframeP == 0)) {
+      LOG_I(MAC,
+            "UE  rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n",
+            rnti,
+            UE_list->UE_sched_ctrl[i].ul_out_of_sync ==
+            0 ? "in synch" : "out of sync",
             UE_list->UE_template[CC_id][i].phr_info,
             UE_list->UE_sched_ctrl[i].dl_cqi[CC_id],
-	    (UE_list->UE_sched_ctrl[i].pusch_snr[CC_id]-128)/2,
-	    (UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id]-128)/2);
+            (UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2,
+            (UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
     }
 
-    RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP*10)+subframeP]=-63;
-    if (i==UE_list->head)
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP*10)+subframeP]);
+    RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) +
+						  subframeP] = -63;
+    if (i == UE_list->head)
+      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
+	(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,
+	 RC.eNB[module_idP][CC_id]->
+	 pusch_stats_bsr[i][(frameP * 10) + subframeP]);
     // increment this, it is cleared when we receive an sdu
     RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++;
-
+    
     RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++;
-    LOG_D(MAC,"UE %d/%x : ul_inactivity %d, cqi_req %d\n",i,rnti,
-	  RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer,
+    LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n", i, rnti,
+	  RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].
+	  ul_inactivity_timer,
 	  RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer);
-    check_ul_failure(module_idP,CC_id,i,frameP,subframeP);
-
+    check_ul_failure(module_idP, CC_id, i, frameP, subframeP);
+    
+    if (RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) {
+      RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++;
+      if(RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >=
+	 RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) {
+	RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0;
+	for (int ue_id_l = 0; ue_id_l < NUMBER_OF_UE_MAX; ue_id_l++) {
+	  if (reestablish_rnti_map[ue_id_l][0] == rnti) {
+	    // clear currentC-RNTI from map
+	    reestablish_rnti_map[ue_id_l][0] = 0;
+	    reestablish_rnti_map[ue_id_l][1] = 0;
+	    break;
+	  }
+	}
+	for (int ii=0; ii<NUMBER_OF_UE_MAX; ii++) {
+	  LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii];
+	  if((ulsch != NULL) && (ulsch->rnti == rnti)){
+	    LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti);
+	    clean_eNb_ulsch(ulsch);
+	  }
+	}
+	for (int ii=0; ii<NUMBER_OF_UE_MAX; ii++) {
+	  LTE_eNB_DLSCH_t *dlsch = RC.eNB[module_idP][CC_id]->dlsch[ii][0];
+	  if((dlsch != NULL) && (dlsch->rnti == rnti)){
+	    LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti);
+	    clean_eNb_dlsch(dlsch);
+	  }
+	}
+	
+	for(int j = 0; j < 10; j++){
+	  nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
+	  ul_req_tmp = &RC.mac[module_idP]->UL_req_tmp[CC_id][j].ul_config_request_body;
+	  if(ul_req_tmp){
+	    int pdu_number = ul_req_tmp->number_of_pdus;
+	    for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
+	      if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){
+		LOG_I(MAC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number);
+		if(pdu_index < pdu_number -1){
+		  memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
+		}
+		ul_req_tmp->number_of_pdus--;
+	      }
+	    }
+	  }
+	}
+	rrc_mac_remove_ue(module_idP,rnti);
+      }
+    }
   }
 
-  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, subframeP,module_idP);
+  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,
+				 NOT_A_RNTI, frameP, subframeP,
+				 module_idP);
   pdcp_run(&ctxt);
 
-  rrc_rx_tx(&ctxt,
-            0, // eNB index, unused in eNB
-            CC_id);
+
+  rrc_rx_tx(&ctxt, CC_id);
 
 #if defined(Rel10) || defined(Rel14)
 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    if (cc[CC_id].MBMS_flag >0) {
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    if (cc[CC_id].MBMS_flag > 0) {
       start_meas(&RC.mac[module_idP]->schedule_mch);
-      mbsfn_status[CC_id] = schedule_MBMS(module_idP,CC_id,frameP,subframeP);
+      mbsfn_status[CC_id] = schedule_MBMS(module_idP, CC_id, frameP, subframeP);
       stop_meas(&RC.mac[module_idP]->schedule_mch);
     }
   }
@@ -519,37 +638,44 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame
 #endif
 
   // This schedules MIB
-  if ((subframeP==0) && (frameP&3) == 0) schedule_mib(module_idP,frameP,subframeP);
-  if (phy_test==0) {
+
+  if ((subframeP == 0) && (frameP & 3) == 0)
+      schedule_mib(module_idP, frameP, subframeP);
+  if (phy_test == 0){
     // This schedules SI for legacy LTE and eMTC starting in subframeP
-    schedule_SI(module_idP,frameP,subframeP);
+    schedule_SI(module_idP, frameP, subframeP);
+    // This schedules Paging in subframeP
+    schedule_PCH(module_idP,frameP,subframeP);
     // This schedules Random-Access for legacy LTE and eMTC starting in subframeP
-    schedule_RA(module_idP,frameP,subframeP);
+    schedule_RA(module_idP, frameP, subframeP);
     // copy previously scheduled UL resources (ULSCH + HARQ)
-    copy_ulreq(module_idP,frameP,subframeP);
+    copy_ulreq(module_idP, frameP, subframeP);
     // This schedules SRS in subframeP
-    schedule_SRS(module_idP,frameP,subframeP);
+    schedule_SRS(module_idP, frameP, subframeP);
     // This schedules ULSCH in subframeP (dci0)
-    schedule_ulsch(module_idP,frameP,subframeP);
+    schedule_ulsch(module_idP, frameP, subframeP);
     // This schedules UCI_SR in subframeP
-    schedule_SR(module_idP,frameP,subframeP);
+    schedule_SR(module_idP, frameP, subframeP);
     // This schedules UCI_CSI in subframeP
     schedule_CSI(module_idP, frameP, subframeP);
-    
     // This schedules DLSCH in subframeP
-    schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status);
+    schedule_dlsch(module_idP, frameP, subframeP, mbsfn_status);
   }
-  else {
+  else{
     schedule_ulsch_phy_test(module_idP,frameP,subframeP);
     schedule_ue_spec_phy_test(module_idP,frameP,subframeP,mbsfn_status);
   }
 
-  // Allocate CCEs for good after scheduling is done
-
-  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) allocate_CCEs(module_idP,CC_id,subframeP,0);
+  if (RC.flexran[module_idP]->enabled)
+    flexran_agent_send_update_stats(module_idP);
   
+  // Allocate CCEs for good after scheduling is done
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
+      allocate_CCEs(module_idP, CC_id, subframeP, 0);
 
   stop_meas(&RC.mac[module_idP]->eNB_scheduler);
 
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+      (VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
+      VCD_FUNCTION_OUT);
 }
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index eb26e55d59c167851308bb03a6a8a21fa6745eb9..3005ecf464233f379d856c22441608f6ea1ca182 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,6 +29,9 @@
 
  */
 
+/* indented with: indent -kr eNB_scheduler_RA.c */
+
+
 #include "assertions.h"
 #include "platform_types.h"
 #include "PHY/defs.h"
@@ -55,439 +58,552 @@
 #include "pdcp.h"
 
 #if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+#include "intertask_interface.h"
 #endif
 
-#include "SIMULATION/TOOLS/defs.h" // for taus
+#include "SIMULATION/TOOLS/defs.h"	// for taus
 
 #include "T.h"
 
-void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_t frameP, sub_frame_t subframeP) {
+extern uint8_t nfapi_mode;
+extern int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req);
 
-  eNB_MAC_INST                    *eNB = RC.mac[module_idP];
-  COMMON_channels_t               *cc  = &eNB->common_channels[CC_id];
-  uint8_t                         j;
-  nfapi_ul_config_request_t      *ul_req;
-  nfapi_ul_config_request_pdu_t  *ul_config_pdu;
-  nfapi_ul_config_request_body_t *ul_req_body;
-  nfapi_hi_dci0_request_body_t   *hi_dci0_req;
-  nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu;
+void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset)
+{
+    *frameP    = (*frameP + ((*subframeP + offset) / 10)) % 1024;
 
-  uint8_t rvseq[4] = {0,2,3,1};
+    *subframeP = ((*subframeP + offset) % 10);
+}
 
+uint16_t sfnsf_add_subframe(uint16_t frameP, uint16_t subframeP, int offset)
+{
+  add_subframe(&frameP, &subframeP, offset);
+  return frameP<<4|subframeP;
+}
 
-  hi_dci0_req   = &eNB->HI_DCI0_req[CC_id].hi_dci0_request_body;
-  ul_req        = &eNB->UL_req_tmp[CC_id][RA_template->Msg3_subframe];
-  ul_req_body   = &ul_req->ul_config_request_body;
-  AssertFatal(RA_template->RA_active == TRUE,"RA is not active for RA %X\n",RA_template->rnti);
+void subtract_subframe(uint16_t *frameP, uint16_t *subframeP, int offset)
+{
+  if (*subframeP < offset)
+  {
+    *frameP = (*frameP+1024-1)%1024;
+  }
+  *subframeP = (*subframeP+10-offset)%10;
+}
+
+uint16_t sfnsf_subtract_subframe(uint16_t frameP, uint16_t subframeP, int offset)
+{
+  subtract_subframe(&frameP, &subframeP, offset);
+  return frameP<<4|subframeP;
+}
+
+void
+add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
+	 sub_frame_t subframeP)
+{
+    eNB_MAC_INST *mac = RC.mac[module_idP];
+    COMMON_channels_t *cc = &mac->common_channels[CC_id];
+    uint8_t j;
+    nfapi_ul_config_request_t *ul_req;
+    nfapi_ul_config_request_body_t *ul_req_body;
+    nfapi_ul_config_request_pdu_t *ul_config_pdu;
+    nfapi_hi_dci0_request_t        *hi_dci0_req = &mac->HI_DCI0_req[CC_id];
+    nfapi_hi_dci0_request_body_t   *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
+    nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu;
+
+    uint8_t rvseq[4] = { 0, 2, 3, 1 };
+
+
+    ul_req = &mac->UL_req_tmp[CC_id][ra->Msg3_subframe];
+    ul_req_body = &ul_req->ul_config_request_body;
+    AssertFatal(ra->state != IDLE, "RA is not active for RA %X\n",
+		ra->rnti);
 
 #ifdef Rel14
-  if (RA_template->rach_resource_type>0) {
-    LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d CE level %d is active, Msg3 in (%d,%d)\n",
-	  module_idP,frameP,subframeP,CC_id,RA_template->rach_resource_type-1,
-	  RA_template->Msg3_frame,RA_template->Msg3_subframe);
-    LOG_D(MAC,"Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d)\n",
-	  frameP,subframeP,RA_template->Msg3_frame,RA_template->Msg3_subframe,RA_template->msg3_nb_rb,RA_template->msg3_round);
-
-    ul_config_pdu                                                                  = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus]; 
-    
-    memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
-    ul_config_pdu->pdu_type                                                        = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE; 
-    ul_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_ul_config_ulsch_pdu));
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle                                 = eNB->ul_handle++;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti                                   = RA_template->rnti;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start                   = narrowband_to_first_rb(cc,RA_template->msg34_narrowband)+RA_template->msg3_first_rb;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks              = RA_template->msg3_nb_rb;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type                        = 2;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms                = 0;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag         = 0;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits                 = 0;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication                    = 0;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version                     = rvseq[RA_template->msg3_round];
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number                    = ((10*RA_template->Msg3_frame)+RA_template->Msg3_subframe)&7;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode                             = 0;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb                          = 0;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs                                  = 1;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size                                   = get_TBS_UL(RA_template->msg3_mcs,
-												RA_template->msg3_nb_rb);
-    // Re13 fields
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type                               = RA_template->rach_resource_type>2 ? 2 : 1;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions           = 1;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number                     = 1;
-    ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io            = (RA_template->Msg3_frame*10)+RA_template->Msg3_subframe;
-    ul_req_body->number_of_pdus++;
-  } //  if (RA_template->rach_resource_type>0) {	 
-  else
+    if (ra->rach_resource_type > 0) {
+	LOG_D(MAC,
+	      "[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d CE level %d is active, Msg3 in (%d,%d)\n",
+	      module_idP, frameP, subframeP, CC_id,
+	      ra->rach_resource_type - 1, ra->Msg3_frame,
+	      ra->Msg3_subframe);
+	LOG_D(MAC,
+	      "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d)\n",
+	      frameP, subframeP, ra->Msg3_frame, ra->Msg3_subframe,
+	      ra->msg3_nb_rb, ra->msg3_round);
+
+	ul_config_pdu =
+	    &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
+
+	memset((void *) ul_config_pdu, 0,
+	       sizeof(nfapi_ul_config_request_pdu_t));
+	ul_config_pdu->pdu_type                                                = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
+	ul_config_pdu->pdu_size                                                = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_pdu));
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle                         = mac->ul_handle++;
+        ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.tl.tag                         = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti                           = ra->rnti;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start           = narrowband_to_first_rb(cc,
+													ra->msg34_narrowband) + ra->msg3_first_rb;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks      = ra->msg3_nb_rb;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type                = 2;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms        = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits         = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication            = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version             = rvseq[ra->msg3_round];
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number            = ((10 * ra->Msg3_frame) + ra->Msg3_subframe) & 7;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode                     = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb                  = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs                          = 1;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size                           = get_TBS_UL(ra->msg3_mcs, ra->msg3_nb_rb);
+	// Re13 fields
+        ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.tl.tag                        = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type                       = ra->rach_resource_type > 2 ? 2 : 1;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions   = 1;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number             = 1;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io    = (ra->Msg3_frame * 10) + ra->Msg3_subframe;
+	ul_req_body->number_of_pdus++;
+        ul_req_body->tl.tag                                                    = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+        ul_req->sfn_sf                                                         = ra->Msg3_frame<<4|ra->Msg3_subframe;
+        ul_req->header.message_id                                              = NFAPI_UL_CONFIG_REQUEST;
+    }				//  if (ra->rach_resource_type>0) {  
+    else
 #endif
     {
-      LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n",
-	    module_idP,frameP,subframeP,CC_id,RA_template->Msg3_frame,RA_template->Msg3_subframe);
-	    
-      LOG_D(MAC,"Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d)\n",
-	    frameP,subframeP,RA_template->Msg3_frame,RA_template->Msg3_subframe,
-	    RA_template->msg3_nb_rb,RA_template->msg3_first_rb,RA_template->msg3_round);
-      
-      ul_config_pdu                                                                  = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus]; 
-      
-      memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
-      ul_config_pdu->pdu_type                                                        = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE; 
-      ul_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_ul_config_ulsch_pdu));
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle                                 = eNB->ul_handle++;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti                                   = RA_template->rnti;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start                   = RA_template->msg3_first_rb;
-      AssertFatal(RA_template->msg3_nb_rb > 0, "nb_rb = 0\n");
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks              = RA_template->msg3_nb_rb;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type                        = 2;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms                = 0;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag         = 0;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits                 = 0;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication                    = 0;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version                     = rvseq[RA_template->msg3_round];
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number                    = subframe2harqpid(cc,RA_template->Msg3_frame,RA_template->Msg3_subframe);
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode                             = 0;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb                          = 0;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs                                  = 1;
-      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size                                   = get_TBS_UL(10,RA_template->msg3_nb_rb);
-      ul_req_body->number_of_pdus++;
-      // save UL scheduling information for preprocessor
-      for (j=0;j<RA_template->msg3_nb_rb;j++) cc->vrb_map_UL[RA_template->msg3_first_rb+j]=1;
-      
-      
-      if (RA_template->msg3_round != 0) { // program HI too
-	hi_dci0_pdu                                                         = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi]; 	
-	memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
-	hi_dci0_pdu->pdu_type                                               = NFAPI_HI_DCI0_HI_PDU_TYPE; 
-	hi_dci0_pdu->pdu_size                                               = 2+sizeof(nfapi_hi_dci0_hi_pdu);
-	hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start                = RA_template->msg3_first_rb; 
-	hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms             = 0;
-	hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value                            = 0;
-	hi_dci0_req->number_of_hi++;
+	LOG_D(MAC,
+	      "[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n",
+	      module_idP, frameP, subframeP, CC_id, ra->Msg3_frame,
+	      ra->Msg3_subframe);
+
+	LOG_D(MAC,
+	      "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d)\n",
+	      frameP, subframeP, ra->Msg3_frame, ra->Msg3_subframe,
+	      ra->msg3_nb_rb, ra->msg3_first_rb, ra->msg3_round);
+
+	ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
+
+	memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t));
+	ul_config_pdu->pdu_type                                                = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
+	ul_config_pdu->pdu_size                                                = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_pdu));
+        ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.tl.tag                         = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle                         = mac->ul_handle++;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti                           = ra->rnti;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start           = ra->msg3_first_rb;
+	AssertFatal(ra->msg3_nb_rb > 0, "nb_rb = 0\n");
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks      = ra->msg3_nb_rb;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type                = 2;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms        = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits         = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication            = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version             = rvseq[ra->msg3_round];
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number            = subframe2harqpid(cc, ra->Msg3_frame, ra->Msg3_subframe);
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode                     = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb                  = 0;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs                          = 1;
+	ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size                           = get_TBS_UL(10, ra->msg3_nb_rb);
+	ul_req_body->number_of_pdus++;
+        ul_req_body->tl.tag                                                    = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+        ul_req->sfn_sf                                                         = ra->Msg3_frame<<4|ra->Msg3_subframe;
+        ul_req->header.message_id                                              = NFAPI_UL_CONFIG_REQUEST;
 	// save UL scheduling information for preprocessor
-	for (j=0;j<RA_template->msg3_nb_rb;j++) cc->vrb_map_UL[RA_template->msg3_first_rb+j]=1;
-	
-	LOG_D(MAC,"[eNB %d][PUSCH-RA %x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) RA (mcs %d, first rb %d, nb_rb %d,round %d)\n",
-	      module_idP,RA_template->rnti,CC_id,frameP,subframeP,10,
-	      1,1,
-	      RA_template->msg3_round-1);
-      } //       if (RA_template->msg3_round != 0) { // program HI too
-    } // non-BL/CE UE case
+	for (j = 0; j < ra->msg3_nb_rb; j++)
+	    cc->vrb_map_UL[ra->msg3_first_rb + j] = 1;
+
+        LOG_D(MAC, "MSG3: UL_CONFIG SFN/SF:%d number_of_pdus:%d ra->msg3_round:%d\n", NFAPI_SFNSF2DEC(ul_req->sfn_sf), ul_req_body->number_of_pdus, ra->msg3_round);
+
+	if (ra->msg3_round != 0) {	// program HI too
+	    hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
+	    memset((void *) hi_dci0_pdu, 0,
+		   sizeof(nfapi_hi_dci0_request_pdu_t));
+	    hi_dci0_pdu->pdu_type                                   = NFAPI_HI_DCI0_HI_PDU_TYPE;
+	    hi_dci0_pdu->pdu_size                                   = 2 + sizeof(nfapi_hi_dci0_hi_pdu);
+            hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag                  = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
+	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start    = ra->msg3_first_rb;
+	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = 0;
+	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value                = 0;
+	    hi_dci0_req_body->number_of_hi++;
+
+            hi_dci0_req_body->sfnsf                                 = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 0);
+            hi_dci0_req_body->tl.tag                                = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
+
+            hi_dci0_req->sfn_sf                                     = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 4);
+            hi_dci0_req->header.message_id                          = NFAPI_HI_DCI0_REQUEST;
+
+            if (nfapi_mode) {
+              oai_nfapi_hi_dci0_req(hi_dci0_req);
+              hi_dci0_req_body->number_of_hi=0;
+            }
+
+            LOG_D(MAC, "MSG3: HI_DCI0 SFN/SF:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req_body->number_of_dci, hi_dci0_req_body->number_of_hi);
+
+	    // save UL scheduling information for preprocessor
+	    for (j = 0; j < ra->msg3_nb_rb; j++)
+		cc->vrb_map_UL[ra->msg3_first_rb + j] = 1;
+
+	    LOG_D(MAC,
+		  "[eNB %d][PUSCH-RA %x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) RA (mcs %d, first rb %d, nb_rb %d,round %d)\n",
+		  module_idP, ra->rnti, CC_id, frameP, subframeP, 10, 1, 1,
+		  ra->msg3_round - 1);
+	}			//       if (ra->msg3_round != 0) { // program HI too
+    }				// non-BL/CE UE case
 }
 
-void generate_Msg2(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t subframeP,RA_TEMPLATE *RA_template) {
+void
+generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
+	      sub_frame_t subframeP, RA_t * ra)
+{
+
+    eNB_MAC_INST *mac = RC.mac[module_idP];
+    COMMON_channels_t *cc = mac->common_channels;
 
-  eNB_MAC_INST                    *eNB = RC.mac[module_idP];
-  COMMON_channels_t               *cc  = eNB->common_channels;
- 
-  uint8_t                         *vrb_map;
-  int                             first_rb;
-  int                             N_RB_DL;
-  nfapi_dl_config_request_pdu_t   *dl_config_pdu;
-  nfapi_tx_request_pdu_t          *TX_req;
-  nfapi_dl_config_request_body_t *dl_req;
+    uint8_t *vrb_map;
+    int first_rb;
+    int N_RB_DL;
+    nfapi_dl_config_request_pdu_t *dl_config_pdu;
+    nfapi_tx_request_pdu_t *TX_req;
+    nfapi_dl_config_request_body_t *dl_req;
 
-  vrb_map       = cc[CC_idP].vrb_map;
-  dl_req        = &eNB->DL_req[CC_idP].dl_config_request_body;
-  dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-  N_RB_DL       = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);  
+    vrb_map = cc[CC_idP].vrb_map;
+    dl_req = &mac->DL_req[CC_idP].dl_config_request_body;
+    dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+    N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
 
 #ifdef Rel14
-  int rmax            = 0;
-  int rep             = 0; 
-  int reps            = 0;
-  int num_nb          = 0;
-
-  first_rb        = 0;
-  struct PRACH_ConfigSIB_v1310 *ext4_prach;
-  PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
-  PRACH_ParametersCE_r13_t *p[4]={NULL,NULL,NULL,NULL};
-
-  uint16_t absSF      = (10*frameP)+subframeP;
-  uint16_t absSF_Msg2 = (10*RA_template->Msg2_frame)+RA_template->Msg2_subframe;
-
-  if (absSF>absSF_Msg2) return; // we're not ready yet, need to be to start ==  
-  
-  if (cc[CC_idP].radioResourceConfigCommon_BR) {
-
-    ext4_prach                 = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
-    prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
-        
-    switch (prach_ParametersListCE_r13->list.count) {
-    case 4:
-      p[3]=prach_ParametersListCE_r13->list.array[3];
-    case 3:
-      p[2]=prach_ParametersListCE_r13->list.array[2];
-    case 2:
-      p[1]=prach_ParametersListCE_r13->list.array[1];
-    case 1:
-      p[0]=prach_ParametersListCE_r13->list.array[0];
-      break;
-    default:
-      AssertFatal(1==0,"Illegal count for prach_ParametersListCE_r13 %d\n",(int)prach_ParametersListCE_r13->list.count);
-      break;
+    int rmax = 0;
+    int rep = 0;
+    int reps = 0;
+    int num_nb = 0;
+
+    first_rb = 0;
+    struct PRACH_ConfigSIB_v1310 *ext4_prach;
+    PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
+    PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL };
+
+    uint16_t absSF = (10 * frameP) + subframeP;
+    uint16_t absSF_Msg2 = (10 * ra->Msg2_frame) + ra->Msg2_subframe;
+
+    LOG_D(MAC,"absSF:%d absSF_Msg2:%d ra->rach_resource_type:%d\n",absSF,absSF_Msg2,ra->rach_resource_type);
+
+    if (absSF > absSF_Msg2)
+	return;			// we're not ready yet, need to be to start ==  
+
+    if (cc[CC_idP].radioResourceConfigCommon_BR) {
+
+	ext4_prach                 = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+	prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+
+	switch (prach_ParametersListCE_r13->list.count) {
+	case 4:
+	    p[3] = prach_ParametersListCE_r13->list.array[3];
+	case 3:
+	    p[2] = prach_ParametersListCE_r13->list.array[2];
+	case 2:
+	    p[1] = prach_ParametersListCE_r13->list.array[1];
+	case 1:
+	    p[0] = prach_ParametersListCE_r13->list.array[0];
+	    break;
+	default:
+	    AssertFatal(1 == 0,
+			"Illegal count for prach_ParametersListCE_r13 %d\n",
+			(int) prach_ParametersListCE_r13->list.count);
+	    break;
+	}
     }
-  }
 
-  if (RA_template->rach_resource_type > 0) {
-    
-    // This uses an MPDCCH Type 2 common allocation according to Section 9.1.5 36-213
-    // Parameters:
-    //    p=2+4 PRB set (number of PRB pairs 3)
-    //    rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3
-    //    if CELevel = 0,1 => Table 9.1.5-1b for MPDCCH candidates
-    //    if CELevel = 2,3 => Table 9.1.5-2b for MPDCCH candidates
-    //    distributed transmission
-    
-    // rmax from SIB2 information
-    AssertFatal(rmax<9,"rmax>8!\n");
-    rmax           = 1<<p[RA_template->rach_resource_type-1]->mpdcch_NumRepetition_RA_r13;
-    // choose r1 by default for RAR (Table 9.1.5-5)
-    rep            = 0; 
-    // get actual repetition count from Table 9.1.5-3
-    reps           = (rmax<=8)?(1<<rep):(rmax>>(3-rep));
-    // get narrowband according to higher-layer config 
-    num_nb = p[RA_template->rach_resource_type-1]->mpdcch_NarrowbandsToMonitor_r13.list.count;
-    RA_template->msg2_narrowband = *p[RA_template->rach_resource_type-1]->mpdcch_NarrowbandsToMonitor_r13.list.array[RA_template->preamble_index%num_nb];
-    first_rb = narrowband_to_first_rb(&cc[CC_idP],RA_template->msg2_narrowband);
-    
-    if ((RA_template->msg2_mpdcch_repetition_cnt == 0) &&
-	(mpdcch_sf_condition(eNB,CC_idP,frameP,subframeP,rmax,TYPE2,-1)>0)){
-      // MPDCCH configuration for RAR
-      LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming MPDCCH %d repetitions\n",
-	    module_idP,frameP,subframeP,reps);
-      
-      
-      memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-      dl_config_pdu->pdu_type                                                                  = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE; 
-      dl_config_pdu->pdu_size                                                                  = (uint8_t)(2+sizeof(nfapi_dl_config_mpdcch_pdu));
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format                                    = (RA_template->rach_resource_type > 1) ? 11 : 10;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band                            = RA_template->msg2_narrowband;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs                           = 6;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment                     = 0; // Note: this can be dynamic
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type                       = 1; // imposed (9.1.5 in 213) for Type 2 Common search space  
-      AssertFatal(cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13!=NULL,
-		  "cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol                                  = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index                                    = 0;  // Note: this should be dynamic
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level                             = 16; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type                                     = 2;  // RA-RNTI
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti                                          = RA_template->RA_rnti;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode                                       = (RA_template->rach_resource_type < 3) ? 1 : 2;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init                          = cc[CC_idP].physCellId;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io                    = (frameP*10)+subframeP;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power                            = 6000; // 0dB
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding                         = getRIV(6,0,6);  // Note: still to be checked if it should not be (getRIV(N_RB_DL,first_rb,6)) : Check nFAPI specifications and what is done L1 with this parameter
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs                                           = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels                        = 4; // fix to 4 for now
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version                            = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator                            = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process                                  = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length                                   = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi                                          = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag                                      = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi                                           = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset                          = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number                = rep; 
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc                                           = 1;// N1A_PRB=3 (36.212); => 208 bits for mcs=4, choose mcs according t message size TBD
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length              = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index                     = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag                           = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index                                = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index                              = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level                             = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request                                   = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag    = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity         = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag                = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication                             = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding            = 0; // this is not needed by OAI L1, but should be filled in
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports                    = 1;
-      RA_template->msg2_mpdcch_repetition_cnt++;
-      dl_req->number_pdu++;
-      RA_template->Msg2_subframe = (RA_template->Msg2_subframe+9)%10;
-
-    } //repetition_count==0 && SF condition met
-    if (RA_template->msg2_mpdcch_repetition_cnt>0) { // we're in a stream of repetitions
-      LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, MPDCCH repetition %d\n",
-	    module_idP,frameP,subframeP,RA_template->msg2_mpdcch_repetition_cnt);
-
-      if (RA_template->msg2_mpdcch_repetition_cnt==reps) { // this is the last mpdcch repetition
-	if (cc[CC_idP].tdd_Config==NULL) { // FDD case
-	  // wait 2 subframes for PDSCH transmission
-	  if (subframeP>7) RA_template->Msg2_frame = (frameP+1)&1023;
-	  else             RA_template->Msg2_frame = frameP;
-	  RA_template->Msg2_subframe               = (subframeP+2)%10; // +2 is the "n+x" from Section 7.1.11  in 36.213
-	}
-	else {
-	  AssertFatal(1==0,"TDD case not done yet\n");
+    if (ra->rach_resource_type > 0) {
+
+	// This uses an MPDCCH Type 2 common allocation according to Section 9.1.5 36-213
+	// Parameters:
+	//    p=2+4 PRB set (number of PRB pairs 3)
+	//    rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3
+	//    if CELevel = 0,1 => Table 9.1.5-1b for MPDCCH candidates
+	//    if CELevel = 2,3 => Table 9.1.5-2b for MPDCCH candidates
+	//    distributed transmission
+
+	// rmax from SIB2 information
+	AssertFatal(rmax < 9, "rmax>8!\n");
+	rmax = 1 << p[ra->rach_resource_type-1]->mpdcch_NumRepetition_RA_r13;
+	// choose r1 by default for RAR (Table 9.1.5-5)
+	rep = 0;
+	// get actual repetition count from Table 9.1.5-3
+	reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
+	// get narrowband according to higher-layer config 
+	num_nb = p[ra->rach_resource_type-1]->mpdcch_NarrowbandsToMonitor_r13.list.count;
+	ra->msg2_narrowband = *p[ra->rach_resource_type - 1]->mpdcch_NarrowbandsToMonitor_r13.list.array[ra->preamble_index % num_nb];
+	first_rb = narrowband_to_first_rb(&cc[CC_idP], ra->msg2_narrowband);
+
+	if ((ra->msg2_mpdcch_repetition_cnt == 0) &&
+	    (mpdcch_sf_condition(mac, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) {
+	    // MPDCCH configuration for RAR
+	    LOG_D(MAC,
+		  "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming MPDCCH %d repetitions\n",
+		  module_idP, frameP, subframeP, reps);
+
+
+	    memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_config_request_pdu_t));
+	    dl_config_pdu->pdu_type                                                                  = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
+	    dl_config_pdu->pdu_size                                                                  = (uint8_t) (2 + sizeof(nfapi_dl_config_mpdcch_pdu));
+            dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tl.tag                                        = NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format                                    = (ra->rach_resource_type > 1) ? 11 : 10;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band                            = ra->msg2_narrowband;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs                           = 6;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment                     = 0;	// Note: this can be dynamic
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type                       = 1;	// imposed (9.1.5 in 213) for Type 2 Common search space  
+	    AssertFatal(cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13!= NULL,
+			"cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol                                  = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index                                    = 0;	// Note: this should be dynamic
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level                             = 16;	// OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type                                     = 2;	// RA-RNTI
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti                                          = ra->RA_rnti;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode                                       = (ra->rach_resource_type < 3) ? 1 : 2;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init                          = cc[CC_idP].physCellId;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io                    = (frameP * 10) + subframeP;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power                            = 6000;	// 0dB
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding                         = getRIV(6, 0, 6);	// Note: still to be checked if it should not be (getRIV(N_RB_DL,first_rb,6)) : Check nFAPI specifications and what is done L1 with this parameter
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4;	// adjust according to size of RAR, 208 bits with N1A_PRB=3
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels                        = 4;	// fix to 4 for now
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version                            = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator                            = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process                                  = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length                                   = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi                                          = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag                                      = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi                                           = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset                          = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number                = rep;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc                                           = 1;	// N1A_PRB=3 (36.212); => 208 bits for mcs=4, choose mcs according t message size TBD
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length              = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index                     = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag                           = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index                                = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index                              = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level                             = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request                                   = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag    = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity         = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag                = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication                             = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding            = 0;	// this is not needed by OAI L1, but should be filled in
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports                    = 1;
+	    ra->msg2_mpdcch_repetition_cnt++;
+	    dl_req->number_pdu++;
+            dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+	    ra->Msg2_subframe = (ra->Msg2_subframe + 9) % 10;
+
+            mac->DL_req[CC_idP].sfn_sf = sfnsf_add_subframe(ra->Msg2_frame, ra->Msg2_subframe, 4);	// nFAPI is runnning at TX SFN/SF - ie 4 ahead
+            mac->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
+	}			//repetition_count==0 && SF condition met
+	if (ra->msg2_mpdcch_repetition_cnt > 0) {	// we're in a stream of repetitions
+	    LOG_D(MAC,
+		  "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, MPDCCH repetition %d\n",
+		  module_idP, frameP, subframeP,
+		  ra->msg2_mpdcch_repetition_cnt);
+
+	    if (ra->msg2_mpdcch_repetition_cnt == reps) {	// this is the last mpdcch repetition
+		if (cc[CC_idP].tdd_Config == NULL) {	// FDD case
+		    // wait 2 subframes for PDSCH transmission
+		    if (subframeP > 7)
+			ra->Msg2_frame = (frameP + 1) & 1023;
+		    else
+			ra->Msg2_frame = frameP;
+		    ra->Msg2_subframe = (subframeP + 2) % 10;	// +2 is the "n+x" from Section 7.1.11  in 36.213
+		} else {
+		    AssertFatal(1 == 0, "TDD case not done yet\n");
+		}
+	    }			// mpdcch_repetition_count == reps
+	    ra->msg2_mpdcch_repetition_cnt++;
+
+	    if ((ra->Msg2_frame == frameP)
+		&& (ra->Msg2_subframe == subframeP)) {
+		// Program PDSCH
+		LOG_D(MAC,
+		      "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming PDSCH\n",
+		      module_idP, frameP, subframeP);
+		ra->state = WAITMSG3;
+                LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG3\n", module_idP, frameP, subframeP);
+
+		dl_config_pdu =  &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+		memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_config_request_pdu_t));
+		dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+		dl_config_pdu->pdu_size                                                        = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag                                 = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = mac->pdu_index[CC_idP];
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = ra->RA_rnti;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;	// localized
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL, first_rb, 6);
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2;	//QPSK
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;	// first block
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB == 1) ? 0 : 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
+		//      dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4;	// 0 dB
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth);	// ignored
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB == 1) ? 1 : 2;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
+		//      dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
+
+		// Rel10 fields
+                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag                                = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start                           = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+		// Rel13 fields
+                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag                                = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type                               = (ra->rach_resource_type < 3) ? 1 : 2;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 2;	// not SI message
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = (10 * frameP) + subframeP;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag                       = 0;
+		dl_req->number_pdu++;
+
+                mac->DL_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
+                mac->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
+
+                LOG_D(MAC,"DL_CONFIG SFN/SF:%d/%d MESSAGE2\n", frameP, subframeP);
+
+		// Program UL processing for Msg3, same as regular LTE
+		get_Msg3alloc(&cc[CC_idP], subframeP, frameP,
+			      &ra->Msg3_frame, &ra->Msg3_subframe);
+		add_msg3(module_idP, CC_idP, ra, frameP, subframeP);
+		fill_rar_br(mac, CC_idP, ra, frameP, subframeP,
+			    cc[CC_idP].RAR_pdu.payload,
+			    ra->rach_resource_type - 1);
+		// DL request
+                mac->TX_req[CC_idP].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+                mac->TX_req[CC_idP].header.message_id = NFAPI_TX_REQUEST;
+		mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
+		TX_req =
+		    &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
+		TX_req->pdu_length = 7;	// This should be changed if we have more than 1 preamble 
+		TX_req->pdu_index = mac->pdu_index[CC_idP]++;
+		TX_req->num_segments = 1;
+		TX_req->segments[0].segment_length = 7;
+		TX_req->segments[0].segment_data = cc[CC_idP].RAR_pdu.payload;
+		mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
+	    }
 	}
-      }// mpdcch_repetition_count == reps
-      RA_template->msg2_mpdcch_repetition_cnt++;	      
-
-      if ((RA_template->Msg2_frame == frameP) && (RA_template->Msg2_subframe == subframeP)) {
-	// Program PDSCH
-	LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming PDSCH\n",
-	      module_idP,frameP,subframeP);
-	RA_template->generate_rar = 0;	      
-	
-	dl_config_pdu                                                                  = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-	memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; 
-	dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = eNB->pdu_index[CC_idP];
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = RA_template->RA_rnti;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;   
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;   // localized
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL,first_rb,6);
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2; //QPSK
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = 0;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;// first block
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB==1 ) ? 0 : 1;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
-	//	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4; // 0 dB
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB==1 ) ? 1 : 2;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
-	//	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
-
-	// Rel10 fields
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start                           = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
-	// Rel13 fields
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type                               = (RA_template->rach_resource_type < 3) ? 1 : 2;;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 2;  // not SI message
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = (10*frameP)+subframeP;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag                       = 0;
-	dl_req->number_pdu++;
-	
-	// Program UL processing for Msg3, same as regular LTE
-	get_Msg3alloc(&cc[CC_idP],subframeP,frameP,&RA_template->Msg3_frame,&RA_template->Msg3_subframe);
-	add_msg3(module_idP,CC_idP, RA_template,frameP,subframeP);
-	fill_rar_br(eNB,CC_idP,RA_template,frameP,subframeP,cc[CC_idP].RAR_pdu.payload,RA_template->rach_resource_type-1);
-	// DL request
-	eNB->TX_req[CC_idP].sfn_sf                                            = (frameP<<4)+subframeP;
-	TX_req                                                                = &eNB->TX_req[CC_idP].tx_request_body.tx_pdu_list[eNB->TX_req[CC_idP].tx_request_body.number_of_pdus]; 		     
-	TX_req->pdu_length                                                    = 7;  // This should be changed if we have more than 1 preamble 
-	TX_req->pdu_index                                                     = eNB->pdu_index[CC_idP]++;
-	TX_req->num_segments                                                  = 1;
-	TX_req->segments[0].segment_length                                    = 7;
-	TX_req->segments[0].segment_data                                      = cc[CC_idP].RAR_pdu.payload;
-	eNB->TX_req[CC_idP].tx_request_body.number_of_pdus++;
-      }
-    }      
-    
-  }		
-  else
+
+    } else
 #endif
     {
 
-      if ((RA_template->Msg2_frame == frameP) && (RA_template->Msg2_subframe == subframeP)) {
-	LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, RA_active %d format 1A (%d,%d))\n",
-	      module_idP, CC_idP, frameP, subframeP,
-	      RA_template->RA_active,
-	      
-	      RA_template->RA_dci_fmt1,
-	      RA_template->RA_dci_size_bits1);
-
-	// Allocate 4 PRBS starting in RB 0
-	first_rb = 0;
-	vrb_map[first_rb] = 1;
-	vrb_map[first_rb+1] = 1;
-	vrb_map[first_rb+2] = 1;
-	vrb_map[first_rb+3] = 1;
-	
-	memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	dl_config_pdu->pdu_type                                                          = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; 
-	dl_config_pdu->pdu_size                                                          = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format                             = NFAPI_DL_DCI_FORMAT_1A;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level                      = 4;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti                                   = RA_template->RA_rnti;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type                              = 2;    // RA-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power                     = 6000; // equal to RS power
-	
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process                           = 0;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc                                    = 1; // no TPC
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1                   = 1;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1                                  = 0;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1                   = 0;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = 0;
-	
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL,first_rb,4);      
-
-	// This checks if the above DCI allocation is feasible in current subframe
-	if (!CCE_allocation_infeasible(module_idP,CC_idP,0,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,RA_template->RA_rnti)) {
-	  LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for RA_RNTI %x\n",
-		frameP,subframeP,RA_template->RA_rnti);
-	  dl_req->number_dci++;
-	  dl_req->number_pdu++;
-	  
-	  dl_config_pdu                                                                  = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-	  memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	  dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; 
-	  dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = eNB->pdu_index[CC_idP];
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = RA_template->RA_rnti;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;   // format 1A/1B/1D
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;   // localized
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL,first_rb,4);
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2; //QPSK
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = 0;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;// first block
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB==1 ) ? 0 : 1;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
-	  //	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4; // 0 dB
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB==1 ) ? 1 : 2;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
-	  //	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
-	  dl_req->number_pdu++;
-	  
-	  // Program UL processing for Msg3
-	  get_Msg3alloc(&cc[CC_idP],subframeP,frameP,&RA_template->Msg3_frame,&RA_template->Msg3_subframe);
-
-	  LOG_D(MAC,"Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n",
-		frameP,subframeP,RA_template->Msg3_frame,RA_template->Msg3_subframe);
-	  
-	  fill_rar(module_idP,CC_idP,frameP,cc[CC_idP].RAR_pdu.payload,N_RB_DL,7);
-	  add_msg3(module_idP,CC_idP, RA_template,frameP,subframeP);
-
-	  // DL request
-	  eNB->TX_req[CC_idP].sfn_sf                                             = (frameP<<4)+subframeP;
-	  TX_req                                                                = &eNB->TX_req[CC_idP].tx_request_body.tx_pdu_list[eNB->TX_req[CC_idP].tx_request_body.number_of_pdus]; 		     
-	  TX_req->pdu_length                                                    = 7;  // This should be changed if we have more than 1 preamble 
-	  TX_req->pdu_index                                                     = eNB->pdu_index[CC_idP]++;
-	  TX_req->num_segments                                                  = 1;
-	  TX_req->segments[0].segment_length                                    = 7;
-	  TX_req->segments[0].segment_data                                      = cc[CC_idP].RAR_pdu.payload;
-	  eNB->TX_req[CC_idP].tx_request_body.number_of_pdus++;
-	} // PDCCH CCE allocation is feasible
-      } // Msg2 frame/subframe condition
-    } // else BL/CE
+	if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) {
+	    LOG_D(MAC,
+		  "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %d\n",
+		  module_idP, CC_idP, frameP, subframeP, ra->state);
+
+	    // Allocate 4 PRBS starting in RB 0
+	    first_rb = 0;
+	    vrb_map[first_rb] = 1;
+	    vrb_map[first_rb + 1] = 1;
+	    vrb_map[first_rb + 2] = 1;
+	    vrb_map[first_rb + 3] = 1;
+
+	    memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+	    dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
+	    dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1A;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = 4;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = ra->RA_rnti;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2;	// RA-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000;	// equal to RS power
+
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1;	// no TPC
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = 0;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = 0;
+
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4);
+
+	    // This checks if the above DCI allocation is feasible in current subframe
+	    if (!CCE_allocation_infeasible(module_idP, CC_idP, 0, subframeP,
+		 dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, ra->RA_rnti)) {
+		LOG_D(MAC,
+		      "Frame %d: Subframe %d : Adding common DCI for RA_RNTI %x\n",
+		      frameP, subframeP, ra->RA_rnti);
+		dl_req->number_dci++;
+		dl_req->number_pdu++;
+
+		dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+		memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+		dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+		dl_config_pdu->pdu_size                                                        = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag                                 = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = mac->pdu_index[CC_idP];
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = ra->RA_rnti;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;	// format 1A/1B/1D
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;	// localized
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL, first_rb, 4);
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2;	//QPSK
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;	// first block
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB == 1) ? 0 : 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
+		//    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4;	// 0 dB
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth);	// ignored
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB == 1) ? 1 : 2;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
+		//    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
+		dl_req->number_pdu++;
+                mac->DL_req[CC_idP].sfn_sf = frameP<<4 | subframeP;
+
+		// Program UL processing for Msg3
+		get_Msg3alloc(&cc[CC_idP], subframeP, frameP,&ra->Msg3_frame, &ra->Msg3_subframe);
+
+		LOG_D(MAC,
+		      "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n",
+		      frameP, subframeP, ra->Msg3_frame,
+		      ra->Msg3_subframe);
+
+		fill_rar(module_idP, CC_idP, ra, frameP, cc[CC_idP].RAR_pdu.payload, N_RB_DL, 7);
+		add_msg3(module_idP, CC_idP, ra, frameP, subframeP);
+		ra->state = WAITMSG3;
+                LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG3\n", module_idP, frameP, subframeP);
+
+		// DL request
+		mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
+		TX_req =
+		    &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
+		TX_req->pdu_length = 7;	// This should be changed if we have more than 1 preamble 
+		TX_req->pdu_index = mac->pdu_index[CC_idP]++;
+		TX_req->num_segments = 1;
+		TX_req->segments[0].segment_length = 7;
+		TX_req->segments[0].segment_data =
+		    cc[CC_idP].RAR_pdu.payload;
+		mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
+	    }			// PDCCH CCE allocation is feasible
+	}			// Msg2 frame/subframe condition
+    }				// else BL/CE
 }
-
-void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t subframeP,RA_TEMPLATE *RA_template){
+void
+generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
+	      sub_frame_t subframeP, RA_t * ra)
+{
 
 
-  eNB_MAC_INST                    *eNB = RC.mac[module_idP];
-  COMMON_channels_t               *cc  = eNB->common_channels;
-  int16_t                         rrc_sdu_length;
-  int                             UE_id           = -1;
-  uint16_t                        msg4_padding;
-  uint16_t                        msg4_post_padding;
-  uint16_t                        msg4_header;
+    eNB_MAC_INST *mac = RC.mac[module_idP];
+    COMMON_channels_t *cc = mac->common_channels;
+    int16_t rrc_sdu_length;
+    int UE_id = -1;
+    uint16_t msg4_padding;
+    uint16_t msg4_post_padding;
+    uint16_t msg4_header;
 
   uint8_t                         *vrb_map;
   int                             first_rb;
@@ -495,800 +611,940 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
   nfapi_dl_config_request_pdu_t   *dl_config_pdu;
   nfapi_ul_config_request_pdu_t   *ul_config_pdu;
   nfapi_tx_request_pdu_t          *TX_req;
-  UE_list_t                       *UE_list=&eNB->UE_list;
-  nfapi_dl_config_request_body_t *dl_req;
-  nfapi_ul_config_request_body_t *ul_req;
+  UE_list_t                       *UE_list=&mac->UE_list;
+  nfapi_dl_config_request_t      *dl_req;
+  nfapi_dl_config_request_body_t *dl_req_body;
+  nfapi_ul_config_request_body_t *ul_req_body;
+  nfapi_ul_config_request_t      *ul_req;
   uint8_t                         lcid;
   uint8_t                         offset;
 
 
 #ifdef Rel14
-  int rmax            = 0;
-  int rep             = 0; 
-  int reps            = 0;
-
-
-  first_rb        = 0;
-  struct PRACH_ConfigSIB_v1310 *ext4_prach;
-  struct PUCCH_ConfigCommon_v1310 *ext4_pucch;
-  PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
-  struct N1PUCCH_AN_InfoList_r13 *pucch_N1PUCCH_AN_InfoList_r13;
-  PRACH_ParametersCE_r13_t *p[4]={NULL,NULL,NULL,NULL};
-  int pucchreps[4]={1,1,1,1};
-  int n1pucchan[4]={0,0,0,0};
-
-  if (cc[CC_idP].radioResourceConfigCommon_BR) {
-
-    ext4_prach                    = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
-    ext4_pucch                    = cc[CC_idP].radioResourceConfigCommon_BR->ext4->pucch_ConfigCommon_v1310;
-    prach_ParametersListCE_r13    = &ext4_prach->prach_ParametersListCE_r13;
-    pucch_N1PUCCH_AN_InfoList_r13 = ext4_pucch->n1PUCCH_AN_InfoList_r13;
-    AssertFatal(prach_ParametersListCE_r13!=NULL,"prach_ParametersListCE_r13 is null\n");
-    AssertFatal(pucch_N1PUCCH_AN_InfoList_r13!=NULL,"pucch_N1PUCCH_AN_InfoList_r13 is null\n");
-    // check to verify CE-Level compatibility in SIB2_BR
-    AssertFatal(prach_ParametersListCE_r13->list.count == pucch_N1PUCCH_AN_InfoList_r13->list.count,
-		"prach_ParametersListCE_r13->list.count!= pucch_N1PUCCH_AN_InfoList_r13->list.count\n");
-
-    switch (prach_ParametersListCE_r13->list.count) {
-    case 4:
-      p[3]         = prach_ParametersListCE_r13->list.array[3];
-      n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3]; 
-      AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13!=NULL,"pucch_NumRepetitionCE_Msg4_Level3 shouldn't be NULL\n");
-      pucchreps[3] = (int)(4<<*ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
-      
-    case 3:
-      p[2]         = prach_ParametersListCE_r13->list.array[2];
-      n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2]; 
-      AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13!=NULL,"pucch_NumRepetitionCE_Msg4_Level2 shouldn't be NULL\n");
-      pucchreps[2] = (int)(4<<*ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
-    case 2:
-      p[1]         =prach_ParametersListCE_r13->list.array[1];
-      n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1]; 
-      AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13!=NULL,"pucch_NumRepetitionCE_Msg4_Level1 shouldn't be NULL\n");
-      pucchreps[1] = (int)(1<<*ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
-    case 1:
-      p[0]         = prach_ParametersListCE_r13->list.array[0];
-      n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0]; 
-      AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13!=NULL,"pucch_NumRepetitionCE_Msg4_Level0 shouldn't be NULL\n");
-      pucchreps[0] = (int)(1<<*ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
-    default:
-      AssertFatal(1==0,"Illegal count for prach_ParametersListCE_r13 %d\n",prach_ParametersListCE_r13->list.count);
+    int rmax = 0;
+    int rep = 0;
+    int reps = 0;
+
+
+    first_rb = 0;
+    struct PRACH_ConfigSIB_v1310 *ext4_prach;
+    struct PUCCH_ConfigCommon_v1310 *ext4_pucch;
+    PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
+    struct N1PUCCH_AN_InfoList_r13 *pucch_N1PUCCH_AN_InfoList_r13;
+    PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL };
+    int pucchreps[4] = { 1, 1, 1, 1 };
+    int n1pucchan[4] = { 0, 0, 0, 0 };
+
+    if (cc[CC_idP].radioResourceConfigCommon_BR) {
+
+	ext4_prach = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+	ext4_pucch = cc[CC_idP].radioResourceConfigCommon_BR->ext4->pucch_ConfigCommon_v1310;
+	prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+	pucch_N1PUCCH_AN_InfoList_r13 = ext4_pucch->n1PUCCH_AN_InfoList_r13;
+	AssertFatal(prach_ParametersListCE_r13 != NULL,"prach_ParametersListCE_r13 is null\n");
+	AssertFatal(pucch_N1PUCCH_AN_InfoList_r13 != NULL,"pucch_N1PUCCH_AN_InfoList_r13 is null\n");
+	// check to verify CE-Level compatibility in SIB2_BR
+	AssertFatal(prach_ParametersListCE_r13->list.count == pucch_N1PUCCH_AN_InfoList_r13->list.count,
+		    "prach_ParametersListCE_r13->list.count!= pucch_N1PUCCH_AN_InfoList_r13->list.count\n");
+
+	switch (prach_ParametersListCE_r13->list.count) {
+	case 4:
+	    p[3] = prach_ParametersListCE_r13->list.array[3];
+	    n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3];
+	    AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13 != NULL,
+			"pucch_NumRepetitionCE_Msg4_Level3 shouldn't be NULL\n");
+	    pucchreps[3] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
+
+	case 3:
+	    p[2] = prach_ParametersListCE_r13->list.array[2];
+	    n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2];
+	    AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13!= NULL,
+			"pucch_NumRepetitionCE_Msg4_Level2 shouldn't be NULL\n");
+	    pucchreps[2] =(int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
+	case 2:
+	    p[1] = prach_ParametersListCE_r13->list.array[1];
+	    n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1];
+	    AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL,
+			"pucch_NumRepetitionCE_Msg4_Level1 shouldn't be NULL\n");
+	    pucchreps[1] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
+	case 1:
+	    p[0] = prach_ParametersListCE_r13->list.array[0];
+	    n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0];
+	    AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL,
+			"pucch_NumRepetitionCE_Msg4_Level0 shouldn't be NULL\n");
+	    pucchreps[0] =(int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
+	default:
+	    AssertFatal(1 == 0,
+			"Illegal count for prach_ParametersListCE_r13 %d\n",
+			prach_ParametersListCE_r13->list.count);
+	}
     }
-  }
 #endif
 
-  vrb_map       = cc[CC_idP].vrb_map;
-  
-  dl_req        = &eNB->DL_req[CC_idP].dl_config_request_body;
-  dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-  N_RB_DL       = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
-
-  UE_id = find_UE_id(module_idP,RA_template->rnti);
-  AssertFatal(UE_id>=0,"Can't find UE for t-crnti\n");
-  
-  // set HARQ process round to 0 for this UE
-  
-  if (cc->tdd_Config) RA_template->harq_pid = ((frameP*10)+subframeP)%10;
-  else RA_template->harq_pid = ((frameP*10)+subframeP)&7;
-
-  
-  // Get RRCConnectionSetup for Piggyback
-  rrc_sdu_length = mac_rrc_data_req(module_idP,
-				    CC_idP,
-				    frameP,
-				    CCCH,
-				    1, // 1 transport block
-				    &cc[CC_idP].CCCH_pdu.payload[0],
-				    ENB_FLAG_YES,
-				    module_idP,
-				    0); // not used in this case
-  
-  AssertFatal(rrc_sdu_length>0,
-	      "[MAC][eNB Scheduler] CCCH not allocated\n");
-  
-  
-  LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n",
-	module_idP, CC_idP, frameP, subframeP,UE_id, rrc_sdu_length);
-  
-  
-#ifdef Rel14
-  if (RA_template->rach_resource_type>0) {
-    
-    // Generate DCI + repetitions first
-    // This uses an MPDCCH Type 2 allocation according to Section 9.1.5 36-213, Type2 common allocation according to Table 7.1-8 (36-213)
-    // Parameters:
-    //    p=2+4 PRB set (number of PRB pairs 6)
-    //    rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3
-    //    if CELevel = 0,1 => Table 9.1.5-1b for MPDCCH candidates
-    //    if CELevel = 2,3 => Table 9.1.5-2b for MPDCCH candidates
-    //    distributed transmission
-    
-    // rmax from SIB2 information
-    rmax           = p[RA_template->rach_resource_type-1]->mpdcch_NumRepetition_RA_r13;
-    AssertFatal(rmax>=4,"choose rmax>=4 for enough repeititions, or reduce rep to 1 or 2\n");
-
-    // choose r3 by default for Msg4 (this is ok from table 9.1.5-3 for rmax = >=4, if we choose rmax <4 it has to be less
-    rep            = 2; 
-    // get actual repetition count from Table 9.1.5-3
-    reps           = (rmax<=8)?(1<<rep):(rmax>>(3-rep));
-    // get first narrowband
-    first_rb = narrowband_to_first_rb(&cc[CC_idP],RA_template->msg34_narrowband);
-
-    if ((RA_template->msg4_mpdcch_repetition_cnt == 0) &&
-    (mpdcch_sf_condition(eNB,CC_idP,frameP,subframeP,rmax,TYPE2,-1)>0)){
-      // MPDCCH configuration for RAR
-      
-      memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-      dl_config_pdu->pdu_type                                                                  = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE; 
-      dl_config_pdu->pdu_size                                                                  = (uint8_t)(2+sizeof(nfapi_dl_config_mpdcch_pdu));
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format                                    = (RA_template->rach_resource_type > 1) ? 11 : 10;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band                            = RA_template->msg34_narrowband;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs                           = 6;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment                     = 0; // Note: this can be dynamic
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type                       = 1;
-      AssertFatal(cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13!=NULL,
-		  "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol                                  = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index                                    = 0;  // Note: this should be dynamic
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level                             = 16; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type                                     = 0;  // t-C-RNTI
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti                                          = RA_template->RA_rnti;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode                                       = (RA_template->rach_resource_type < 3) ? 1 : 2;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init                          = cc[CC_idP].physCellId;  /// Check this is still N_id_cell for type2 common
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io                    = (frameP*10)+subframeP;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power                            = 6000; // 0dB
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding                         = getRIV(6,0,6);// check if not getRIV(N_RB_DL,first_rb,6);
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs                                           = 4; // adjust according to size of Msg4, 208 bits with N1A_PRB=3
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels                        = 4; // fix to 4 for now
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version                            = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator                            = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process                                  = RA_template->harq_pid;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length                                   = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi                                          = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag                                      = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi                                           = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset                          = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number                = rep; 
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc                                           = 1;// N1A_PRB=3; => 208 bits
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length              = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index                     = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag                           = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index                                = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index                              = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level                             = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request                                   = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag    = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity         = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag                = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication                             = 0;
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding            = 0; // this is not needed by OAI L1, but should be filled in
-      dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports                    = 1;
-      RA_template->msg4_mpdcch_repetition_cnt++;
-      dl_req->number_pdu++;
-      
-    } //repetition_count==0 && SF condition met
-    else if (RA_template->msg4_mpdcch_repetition_cnt>0) { // we're in a stream of repetitions
-      RA_template->msg4_mpdcch_repetition_cnt++;	      
-      if (RA_template->msg4_mpdcch_repetition_cnt==reps) { // this is the last mpdcch repetition
-	if (cc[CC_idP].tdd_Config==NULL) { // FDD case
-	  // wait 2 subframes for PDSCH transmission
-	  if (subframeP>7) RA_template->Msg4_frame = (frameP+1)&1023;
-	  else             RA_template->Msg4_frame = frameP;
-	  RA_template->Msg4_subframe               = (subframeP+2)%10; 
-	}
-	else {
-	  AssertFatal(1==0,"TDD case not done yet\n");
-	}
-      } // mpdcch_repetition_count == reps
-      if ((RA_template->Msg4_frame == frameP) && (RA_template->Msg4_subframe == subframeP)) {
-	
-	// Program PDSCH
-	
-	LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 BR with RRC Piggyback (ce_level %d RNTI %x)\n",
-	      module_idP, CC_idP, frameP, subframeP,RA_template->rach_resource_type-1,RA_template->rnti);
-
-	AssertFatal(1==0,"Msg4 generation not finished for BL/CE UE\n");
-	dl_config_pdu                                                                  = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-	memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; 
-	dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = eNB->pdu_index[CC_idP];
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = RA_template->rnti;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;   // format 1A/1B/1D
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;   // localized
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL,first_rb,6);  // check that this isn't getRIV(6,0,6)
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2; //QPSK
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = 0;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;// first block
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB==1 ) ? 0 : 1;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
-	//	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4; // 0 dB
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB==1 ) ? 1 : 2;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
-	//	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
-
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start                           = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
-	
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type                               = (RA_template->rach_resource_type < 3) ? 1 : 2;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 2;  // not SI message
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = (10*frameP)+subframeP;
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag                       = 0;
-	dl_req->number_pdu++;
-	
-	RA_template->generate_Msg4=0;
-	RA_template->wait_ack_Msg4=1;
+    vrb_map = cc[CC_idP].vrb_map;
 
-	lcid=0;
-	
-	UE_list->UE_sched_ctrl[UE_id].round[CC_idP][RA_template->harq_pid] = 0;
-	msg4_header = 1+6+1;  // CR header, CR CE, SDU header
-	
-	if ((RA_template->msg4_TBsize - rrc_sdu_length - msg4_header) <= 2) {
-	  msg4_padding = RA_template->msg4_TBsize - rrc_sdu_length - msg4_header;
-	  msg4_post_padding = 0;
-	} else {
-	  msg4_padding = 0;
-	  msg4_post_padding = RA_template->msg4_TBsize - rrc_sdu_length - msg4_header -1;
-	}
-	
-	LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
-	      module_idP,CC_idP,frameP,subframeP,RA_template->msg4_TBsize,rrc_sdu_length,msg4_header,msg4_padding,msg4_post_padding);
-	DevAssert( UE_id != UE_INDEX_INVALID ); // FIXME not sure how to gracefully return
-	// CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0]
-	offset = generate_dlsch_header((unsigned char*)eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0],
-				       1,                           //num_sdus
-				       (unsigned short*)&rrc_sdu_length,             //
-				       &lcid,                       // sdu_lcid
-				       255,                         // no drx
-				       31,                          // no timing advance
-				       RA_template->cont_res_id,    // contention res id
-				       msg4_padding,                // no padding
-				       msg4_post_padding);
-	
-	memcpy((void*)&eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0][(unsigned char)offset],
-	       &cc[CC_idP].CCCH_pdu.payload[0],
-	       rrc_sdu_length);
-	
-	// DL request
-	eNB->TX_req[CC_idP].sfn_sf                                             = (frameP<<4)+subframeP;
-	TX_req                                                                = &eNB->TX_req[CC_idP].tx_request_body.tx_pdu_list[eNB->TX_req[CC_idP].tx_request_body.number_of_pdus]; 		     	      
-	TX_req->pdu_length                                                    = rrc_sdu_length;
-	TX_req->pdu_index                                                     = eNB->pdu_index[CC_idP]++;
-	TX_req->num_segments                                                  = 1;
-	TX_req->segments[0].segment_length                                    = rrc_sdu_length;
-	TX_req->segments[0].segment_data                                      = eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0];
-	eNB->TX_req[CC_idP].tx_request_body.number_of_pdus++;
-
-	// Program ACK/NAK for Msg4 PDSCH
-	int absSF = (RA_template->Msg3_frame*10)+RA_template->Msg3_subframe;
-	// see Section 10.2 from 36.213
-	int ackNAK_absSF = absSF + reps + 4;
-	AssertFatal(reps>2,"Have to handle programming of ACK when PDSCH repetitions is > 2\n");
-	ul_req        = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF%10].ul_config_request_body;
-	ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus]; 
-
-	ul_config_pdu->pdu_type                                                                     = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE; 
-	ul_config_pdu->pdu_size                                                                     = (uint8_t)(2+sizeof(nfapi_ul_config_uci_harq_pdu));
-	ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle                       = 0; // don't know how to use this
-	ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti                         = RA_template->rnti;
-	ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type                     = (RA_template->rach_resource_type < 3) ? 1 : 2;
-	ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols               = 0;
-	ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[RA_template->rach_resource_type-1];
-	ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.repetition_number           = 0;
-	// Note need to keep sending this across reptitions!!!! Not really for PUCCH, to ask small-cell forum, we'll see for the other messages, maybe parameters change across repetitions and FAPI has to provide for that
-	if (cc[CC_idP].tdd_Config==NULL) { // FDD case
-	  ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.n_pucch_1_0   = n1pucchan[RA_template->rach_resource_type-1];
-	  // NOTE: How to fill in the rest of the n_pucch_1_0 information 213 Section 10.1.2.1 in the general case
-	  // = N_ECCE_q + Delta_ARO + n1pucchan[ce_level]
-	  // higher in the MPDCCH configuration, N_ECCE_q is hard-coded to 0, and harq resource offset to 0 =>
-	  // Delta_ARO = 0 from Table 10.1.2.1-1
-	  ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.harq_size     = 1;  // 1-bit ACK/NAK
-	}
-	else {
-	  AssertFatal(1==0,"PUCCH configuration for ACK/NAK not handled yet for TDD BL/CE case\n");
-	}
-	ul_req->number_of_pdus++;
-	T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_idP), 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_idP][0][UE_id].payload[0], RA_template->msg4_TBsize));
+    dl_req        = &mac->DL_req[CC_idP];
+    dl_req_body   = &dl_req->dl_config_request_body;
+    dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
+    N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
+
+    UE_id = find_UE_id(module_idP, ra->rnti);
+    AssertFatal(UE_id >= 0, "Can't find UE for t-crnti\n");
+
+    // set HARQ process round to 0 for this UE
+
+    if (cc->tdd_Config)
+	ra->harq_pid = ((frameP * 10) + subframeP) % 10;
+    else
+	ra->harq_pid = ((frameP * 10) + subframeP) & 7;
+
+    // Get RRCConnectionSetup for Piggyback
+    rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1,	// 1 transport block
+				      &cc[CC_idP].CCCH_pdu.payload[0], 0);	// not used in this case
+
+    AssertFatal(rrc_sdu_length > 0,
+		"[MAC][eNB Scheduler] CCCH not allocated\n");
+
+
+    LOG_D(MAC,
+	  "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n",
+	  module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length);
+
+
+#ifdef Rel14
+    if (ra->rach_resource_type > 0) {
+
+	// Generate DCI + repetitions first
+	// This uses an MPDCCH Type 2 allocation according to Section 9.1.5 36-213, Type2 common allocation according to Table 7.1-8 (36-213)
+	// Parameters:
+	//    p=2+4 PRB set (number of PRB pairs 6)
+	//    rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3
+	//    if CELevel = 0,1 => Table 9.1.5-1b for MPDCCH candidates
+	//    if CELevel = 2,3 => Table 9.1.5-2b for MPDCCH candidates
+	//    distributed transmission
+
+	// rmax from SIB2 information
+	rmax = p[ra->rach_resource_type - 1]->mpdcch_NumRepetition_RA_r13;
+	AssertFatal(rmax >= 4,
+		    "choose rmax>=4 for enough repeititions, or reduce rep to 1 or 2\n");
+
+	// choose r3 by default for Msg4 (this is ok from table 9.1.5-3 for rmax = >=4, if we choose rmax <4 it has to be less
+	rep = 2;
+	// get actual repetition count from Table 9.1.5-3
+	reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
+	// get first narrowband
+	first_rb =
+	    narrowband_to_first_rb(&cc[CC_idP], ra->msg34_narrowband);
+
+	if ((ra->msg4_mpdcch_repetition_cnt == 0) &&
+	    (mpdcch_sf_condition
+	     (mac, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) {
+	    // MPDCCH configuration for RAR
+
+	    memset((void *) dl_config_pdu, 0,
+		   sizeof(nfapi_dl_config_request_pdu_t));
+	    dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
+	    dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_mpdcch_pdu));
+            dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (ra->rach_resource_type > 1) ? 11 : 10;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = ra->msg34_narrowband;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0;	// Note: this can be dynamic
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1;
+	    AssertFatal(cc[CC_idP].
+			sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13
+			!= NULL,
+			"cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0;	// Note: this should be dynamic
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 16;	// OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 0;	// t-C-RNTI
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = ra->RA_rnti;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (ra->rach_resource_type < 3) ? 1 : 2;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId;	/// Check this is still N_id_cell for type2 common
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000;	// 0dB
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV(6, 0, 6);	// check if not getRIV(N_RB_DL,first_rb,6);
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4;	// adjust according to size of Msg4, 208 bits with N1A_PRB=3
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 4;	// fix to 4 for now
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = ra->harq_pid;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1;	// N1A_PRB=3; => 208 bits
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0;	// this is not needed by OAI L1, but should be filled in
+	    dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
+	    ra->msg4_mpdcch_repetition_cnt++;
+	    dl_req_body->number_pdu++;
+            dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+            dl_req->sfn_sf = (ra->Msg4_frame<<4)+ra->Msg4_subframe;
+            dl_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
+
+	}			//repetition_count==0 && SF condition met
+	else if (ra->msg4_mpdcch_repetition_cnt > 0) {	// we're in a stream of repetitions
+	    ra->msg4_mpdcch_repetition_cnt++;
+	    if (ra->msg4_mpdcch_repetition_cnt == reps) {	// this is the last mpdcch repetition
+		if (cc[CC_idP].tdd_Config == NULL) {	// FDD case
+		    // wait 2 subframes for PDSCH transmission
+		    if (subframeP > 7)
+			ra->Msg4_frame = (frameP + 1) & 1023;
+		    else
+			ra->Msg4_frame = frameP;
+		    ra->Msg4_subframe = (subframeP + 2) % 10;
+		} else {
+		    AssertFatal(1 == 0, "TDD case not done yet\n");
+		}
+	    }			// mpdcch_repetition_count == reps
+	    if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
+
+		// Program PDSCH
+
+		LOG_D(MAC,
+		      "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 BR with RRC Piggyback (ce_level %d RNTI %x)\n",
+		      module_idP, CC_idP, frameP, subframeP,
+		      ra->rach_resource_type - 1, ra->rnti);
+
+		AssertFatal(1 == 0,
+			    "Msg4 generation not finished for BL/CE UE\n");
+		dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
+		memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+		dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+		dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index =  mac->pdu_index[CC_idP];
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = ra->rnti;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2;	// format 1A/1B/1D
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;	// localized
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);	// check that this isn't getRIV(6,0,6)
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2;	//QPSK
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;	// first block
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+		//      dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4;	// 0 dB
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth);	// ignored
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+		//      dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
+
+                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+
+                dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2;	// not SI message
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
+		dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
+		dl_req_body->number_pdu++;
+                dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+                mac->DL_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
+                mac->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
 	
-	if (opt_enabled==1) {
-	  trace_pdu(1, (uint8_t *)eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0],
-		    rrc_sdu_length, UE_id, 3, UE_RNTI(module_idP, UE_id),
-		    eNB->frame, eNB->subframe,0,0);
-	  LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n",
-		module_idP, CC_idP, frameP, UE_RNTI(module_idP,UE_id), rrc_sdu_length);
-	}
-      } // Msg4 frame/subframe
-    } // msg4_mpdcch_repetition_count
-  } // rach_resource_type > 0 
-  else
+		ra->state = WAITMSG4ACK;
+                LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG4ACK\n", module_idP, frameP, subframeP);
+
+		lcid = 0;
+
+		UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] = 0;
+		msg4_header = 1 + 6 + 1;	// CR header, CR CE, SDU header
+
+		if ((ra->msg4_TBsize - rrc_sdu_length - msg4_header) <= 2) {
+		    msg4_padding = ra->msg4_TBsize - rrc_sdu_length - msg4_header;
+		    msg4_post_padding = 0;
+		} else {
+		    msg4_padding = 0;
+		    msg4_post_padding = ra->msg4_TBsize - rrc_sdu_length - msg4_header - 1;
+		}
+
+		LOG_D(MAC,
+		      "[eNB %d][RAPROC] CC_id %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
+		      module_idP, CC_idP, frameP, subframeP,
+		      ra->msg4_TBsize, rrc_sdu_length, msg4_header,
+		      msg4_padding, msg4_post_padding);
+		DevAssert(UE_id != UE_INDEX_INVALID);	// FIXME not sure how to gracefully return
+		// CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0]
+		offset = generate_dlsch_header((unsigned char *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], 1,	//num_sdus
+					       (unsigned short *) &rrc_sdu_length,	//
+					       &lcid,	// sdu_lcid
+					       255,	// no drx
+					       31,	// no timing advance
+					       ra->cont_res_id,	// contention res id
+					       msg4_padding,	// no padding
+					       msg4_post_padding);
+
+		memcpy((void *) &mac->UE_list.
+		       DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0][(unsigned char)offset],
+		       &cc[CC_idP].CCCH_pdu.payload[0], rrc_sdu_length);
+
+		// DL request
+		mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
+                mac->TX_req[CC_idP].tx_request_body.tl.tag  = NFAPI_TX_REQUEST_BODY_TAG;
+                mac->TX_req[CC_idP].header.message_id 	    = NFAPI_TX_REQUEST;
+
+		TX_req =
+		    &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
+		TX_req->pdu_length = rrc_sdu_length;
+		TX_req->pdu_index = mac->pdu_index[CC_idP]++;
+		TX_req->num_segments = 1;
+		TX_req->segments[0].segment_length = rrc_sdu_length;
+		TX_req->segments[0].segment_data = mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0];
+		mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
+
+		// Program ACK/NAK for Msg4 PDSCH
+		int absSF = (ra->Msg3_frame * 10) + ra->Msg3_subframe;
+		// see Section 10.2 from 36.213
+		int ackNAK_absSF = absSF + reps + 4;
+		AssertFatal(reps > 2,
+			    "Have to handle programming of ACK when PDSCH repetitions is > 2\n");
+		ul_req = &mac->UL_req_tmp[CC_idP][ackNAK_absSF % 10];
+		ul_req_body = &ul_req->ul_config_request_body;
+		ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
+
+		ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
+		ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_ul_config_uci_harq_pdu));
+                ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+		ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0;	// don't know how to use this
+		ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = ra->rnti;
+                ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
+		ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
+		ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols = 0;
+		ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[ra->rach_resource_type - 1];
+		ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.repetition_number = 0;
+
+                ul_req_body->tl.tag                                                                         = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+                ul_req->sfn_sf  									    = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 4);
+                ul_req->header.message_id  								    = NFAPI_UL_CONFIG_REQUEST;
+                LOG_D(MAC,"UL_req_tmp[CC_idP:%d][ackNAK_absSF mod 10:%d] ra->Msg3_frame:%d ra->Msg3_subframe:%d + 4 sfn_sf:%d\n", CC_idP, ackNAK_absSF%10, ra->Msg3_frame, ra->Msg3_subframe, NFAPI_SFNSF2DEC(ul_req->sfn_sf));
+
+		// Note need to keep sending this across reptitions!!!! Not really for PUCCH, to ask small-cell forum, we'll see for the other messages, maybe parameters change across repetitions and FAPI has to provide for that
+		if (cc[CC_idP].tdd_Config == NULL) {	// FDD case
+                  ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG;
+		    ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.n_pucch_1_0 = n1pucchan[ra->rach_resource_type - 1];
+		    // NOTE: How to fill in the rest of the n_pucch_1_0 information 213 Section 10.1.2.1 in the general case
+		    // = N_ECCE_q + Delta_ARO + n1pucchan[ce_level]
+		    // higher in the MPDCCH configuration, N_ECCE_q is hard-coded to 0, and harq resource offset to 0 =>
+		    // Delta_ARO = 0 from Table 10.1.2.1-1
+		    ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.harq_size = 1;	// 1-bit ACK/NAK
+		} else {
+		    AssertFatal(1 == 0,
+				"PUCCH configuration for ACK/NAK not handled yet for TDD BL/CE case\n");
+		}
+		ul_req_body->number_of_pdus++;
+		T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP),
+		  T_INT(CC_idP), T_INT(ra->rnti), T_INT(frameP),
+		  T_INT(subframeP), T_INT(0 /*harq_pid always 0? */ ),
+		  T_BUFFER(&mac->UE_list.DLSCH_pdu[CC_idP][0][UE_id].
+			   payload[0], ra->msg4_TBsize));
+
+		if (opt_enabled == 1) {
+		    trace_pdu(1,
+			      (uint8_t *) mac->
+			      UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0], rrc_sdu_length, UE_id, 3,
+			      UE_RNTI(module_idP, UE_id), mac->frame,
+			      mac->subframe, 0, 0);
+		    LOG_D(OPT,
+			  "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n",
+			  module_idP, CC_idP, frameP, UE_RNTI(module_idP,UE_id),
+			  rrc_sdu_length);
+		}
+	    }			// Msg4 frame/subframe
+	}			// msg4_mpdcch_repetition_count
+    }				// rach_resource_type > 0 
+    else
 #endif
-    { // This is normal LTE case
-      if ((RA_template->Msg4_frame == frameP) && (RA_template->Msg4_subframe == subframeP)) {	      
-	LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
-	      module_idP, CC_idP, frameP, subframeP,RA_template->rnti);
-	
-	/// Choose first 4 RBs for Msg4, should really check that these are free!
-	first_rb=0;
-	
-	vrb_map[first_rb] = 1;
-	vrb_map[first_rb+1] = 1;
-	vrb_map[first_rb+2] = 1;
-	vrb_map[first_rb+3] = 1;
-	
-	
-	// Compute MCS/TBS for 3 PRB (coded on 4 vrb)
-	msg4_header = 1+6+1;  // CR header, CR CE, SDU header
-	
-	if ((rrc_sdu_length+msg4_header) <= 22) {
-	  RA_template->msg4_mcs                       = 4;
-	  RA_template->msg4_TBsize = 22;
-	} else if ((rrc_sdu_length+msg4_header) <= 28) {
-	  RA_template->msg4_mcs                       = 5;
-	  RA_template->msg4_TBsize = 28;
-	} else if ((rrc_sdu_length+msg4_header) <= 32) {
-	  RA_template->msg4_mcs                       = 6;
-	  RA_template->msg4_TBsize = 32;
-	} else if ((rrc_sdu_length+msg4_header) <= 41) {
-	  RA_template->msg4_mcs                       = 7;
-	  RA_template->msg4_TBsize = 41;
-	} else if ((rrc_sdu_length+msg4_header) <= 49) {
-	  RA_template->msg4_mcs                       = 8;
-	  RA_template->msg4_TBsize = 49;
-	} else if ((rrc_sdu_length+msg4_header) <= 57) {
-	  RA_template->msg4_mcs    = 9;
-	  RA_template->msg4_TBsize = 57;
-	}
-
-	fill_nfapi_dl_dci_1A(dl_config_pdu,
-			     4,                           // aggregation_level
-			     RA_template->rnti,           // rnti
-			     1,                           // rnti_type, CRNTI
-			     RA_template->harq_pid,       // harq_process
-			     1,                           // tpc, none
-			     getRIV(N_RB_DL,first_rb,4),  // resource_block_coding
-			     RA_template->msg4_mcs,       // mcs
-			     1,                           // ndi
-			     0,                           // rv
-			     0);                          // vrb_flag
-    LOG_D(MAC,"Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n",
-		  frameP,
-	      subframeP,
-          dl_req->number_pdu,
-          dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
-          dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type,
-          dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process,
-          &dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding,
-          dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding);
-    AssertFatal(dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding < 8192,
-				"resource_block_coding %u < 8192\n",
-                dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding);	
-	if (!CCE_allocation_infeasible(module_idP,CC_idP,1,
-				       subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-				       RA_template->rnti)) {
-	  dl_req->number_dci++;
-	  dl_req->number_pdu++;
-	  
-	  RA_template->generate_Msg4=0;
-	  RA_template->wait_ack_Msg4=1;
-	  
-	  // increment Absolute subframe by 8 for Msg4 retransmission
-	  LOG_D(MAC,"Frame %d, Subframe %d: Preparing for Msg4 retransmission currently %d.%d\n",
-		frameP,subframeP,RA_template->Msg4_frame,RA_template->Msg4_subframe);
-	  if (RA_template->Msg4_subframe > 1) RA_template->Msg4_frame++;
-	  RA_template->Msg4_frame&=1023;
-	  RA_template->Msg4_subframe = (RA_template->Msg4_subframe+8)%10;
-	  LOG_D(MAC,"Frame %d, Subframe %d: Msg4 retransmission in %d.%d\n",
-		frameP,subframeP,RA_template->Msg4_frame,RA_template->Msg4_subframe);
-	  lcid=0;
-	  
-	  // put HARQ process round to 0
-	  if (cc->tdd_Config) RA_template->harq_pid = ((frameP*10)+subframeP)%10;
-	  else RA_template->harq_pid = ((frameP*10)+subframeP)&7;
-	  UE_list->UE_sched_ctrl[UE_id].round[CC_idP][RA_template->harq_pid] = 0;
-	  
-	  if ((RA_template->msg4_TBsize - rrc_sdu_length - msg4_header) <= 2) {
-	    msg4_padding = RA_template->msg4_TBsize - rrc_sdu_length - msg4_header;
-	    msg4_post_padding = 0;
-	  } else {
-	    msg4_padding = 0;
-	    msg4_post_padding = RA_template->msg4_TBsize - rrc_sdu_length - msg4_header -1;
-	  }
-	  
-	  LOG_D(MAC,"[eNB %d][RAPROC] CC_idP %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
-		module_idP,CC_idP,frameP,subframeP,RA_template->msg4_TBsize,rrc_sdu_length,msg4_header,msg4_padding,msg4_post_padding);
-	  DevAssert( UE_id != UE_INDEX_INVALID ); // FIXME not sure how to gracefully return
-	  // CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0]
-	  offset = generate_dlsch_header((unsigned char*)eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0],
-					 1,                           //num_sdus
-					 (unsigned short*)&rrc_sdu_length,             //
-					 &lcid,                       // sdu_lcid
-					 255,                         // no drx
-					 31,                          // no timing advance
-					 RA_template->cont_res_id,    // contention res id
-					 msg4_padding,                // no padding
-					 msg4_post_padding);
-	  
-	  memcpy((void*)&eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0][(unsigned char)offset],
-		 &cc[CC_idP].CCCH_pdu.payload[0],
-		 rrc_sdu_length);
-	  
-	  // DLSCH Config
-	  fill_nfapi_dlsch_config(eNB,
-				  dl_req,
-				  RA_template->msg4_TBsize,
-				  eNB->pdu_index[CC_idP],
-				  RA_template->rnti,
-				  2,                           // resource_allocation_type : format 1A/1B/1D
-				  0,                           // virtual_resource_block_assignment_flag : localized
-				  getRIV(N_RB_DL,first_rb,4),  // resource_block_coding : RIV, 4 PRB
-				  2,                           // modulation: QPSK
-				  0,                           // redundancy version
-				  1,                           // transport_blocks
-				  0,                           // transport_block_to_codeword_swap_flag (0)
-				  (cc->p_eNB==1 ) ? 0 : 1,     // transmission_scheme
-				  1,                           // number of layers
-				  1,                           // number of subbands
-				  //0,                         // codebook index 
-				  1,                           // ue_category_capacity
-				  4,                           // pa: 0 dB
-				  0,                           // delta_power_offset_index
-				  0,                           // ngap
-				  1,                           // NPRB = 3 like in DCI
-				  (cc->p_eNB==1 ) ? 1 : 2,     // transmission mode
-				  1,                           // num_bf_prb_per_subband
-				  1);                          // num_bf_vector
-      LOG_D(MAC,"Filled DLSCH config, pdu number %d, non-dci pdu_index %d\n",dl_req->number_pdu,eNB->pdu_index[CC_idP]);
-
-	  // DL request
-	  eNB->TX_req[CC_idP].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_idP].tx_request_body,
-							 (frameP*10)+subframeP,
-							 rrc_sdu_length,
-							 eNB->pdu_index[CC_idP],
-							 eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0]); 
-	  eNB->pdu_index[CC_idP]++;
-
-	  LOG_D(MAC,"Filling UCI ACK/NAK information, cce_idx %d\n",dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
-	  // Program PUCCH1a for ACK/NAK
-	  // Program ACK/NAK for Msg4 PDSCH
-	  fill_nfapi_uci_acknak(module_idP,
-				CC_idP,
-				RA_template->rnti,
-				(frameP*10)+subframeP,
-				dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
-
-	  
-	  T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_idP), 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_idP][0][UE_id].payload[0], RA_template->msg4_TBsize));
-	  
-	  if (opt_enabled==1) {
-	    trace_pdu(1, (uint8_t *)eNB->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0],
-		      rrc_sdu_length, UE_id, 3, UE_RNTI(module_idP, UE_id),
-		      eNB->frame, eNB->subframe,0,0);
-	    LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n",
-		  module_idP, CC_idP, frameP, UE_RNTI(module_idP,UE_id), rrc_sdu_length);
-	  }
-	  
-	} // CCE Allocation feasible
-      } // msg4 frame/subframe
-    } // else rach_resource_type
+    {				// This is normal LTE case
+	if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
+	    LOG_D(MAC,
+		  "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
+		  module_idP, CC_idP, frameP, subframeP, ra->rnti);
+
+	    /// Choose first 4 RBs for Msg4, should really check that these are free!
+	    first_rb = 0;
+
+	    vrb_map[first_rb] = 1;
+	    vrb_map[first_rb + 1] = 1;
+	    vrb_map[first_rb + 2] = 1;
+	    vrb_map[first_rb + 3] = 1;
+
+
+	    // Compute MCS/TBS for 3 PRB (coded on 4 vrb)
+	    msg4_header = 1 + 6 + 1;	// CR header, CR CE, SDU header
+
+	    if ((rrc_sdu_length + msg4_header) <= 22) {
+		ra->msg4_mcs = 4;
+		ra->msg4_TBsize = 22;
+	    } else if ((rrc_sdu_length + msg4_header) <= 28) {
+		ra->msg4_mcs = 5;
+		ra->msg4_TBsize = 28;
+	    } else if ((rrc_sdu_length + msg4_header) <= 32) {
+		ra->msg4_mcs = 6;
+		ra->msg4_TBsize = 32;
+	    } else if ((rrc_sdu_length + msg4_header) <= 41) {
+		ra->msg4_mcs = 7;
+		ra->msg4_TBsize = 41;
+	    } else if ((rrc_sdu_length + msg4_header) <= 49) {
+		ra->msg4_mcs = 8;
+		ra->msg4_TBsize = 49;
+	    } else if ((rrc_sdu_length + msg4_header) <= 57) {
+		ra->msg4_mcs = 9;
+		ra->msg4_TBsize = 57;
+	    }
+
+	    fill_nfapi_dl_dci_1A(dl_config_pdu, 4,	// aggregation_level
+				 ra->rnti,	// rnti
+				 1,	// rnti_type, CRNTI
+				 ra->harq_pid,	// harq_process
+				 1,	// tpc, none
+				 getRIV(N_RB_DL, first_rb, 4),	// resource_block_coding
+				 ra->msg4_mcs,	// mcs
+				 1,	// ndi
+				 0,	// rv
+				 0);	// vrb_flag
+
+	    LOG_D(MAC,
+		  "Frame %d, subframe %d: Msg4 DCI pdu_num %d (rnti %x,rnti_type %d,harq_pid %d, resource_block_coding (%p) %d\n",
+		  frameP, subframeP, dl_req_body->number_pdu,
+		  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
+		  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type,
+		  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process,
+		  &dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding,
+		  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding);
+	    AssertFatal(dl_config_pdu->dci_dl_pdu.
+			dci_dl_pdu_rel8.resource_block_coding < 8192,
+			"resource_block_coding %u < 8192\n",
+			dl_config_pdu->dci_dl_pdu.
+			dci_dl_pdu_rel8.resource_block_coding);
+	    if (!CCE_allocation_infeasible(module_idP, CC_idP, 1, subframeP,
+		 dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, ra->rnti)) {
+		dl_req_body->number_dci++;
+		dl_req_body->number_pdu++;
+
+		ra->state = WAITMSG4ACK;
+                LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG4ACK\n", module_idP, frameP, subframeP);
+
+		// increment Absolute subframe by 8 for Msg4 retransmission
+		LOG_D(MAC,
+		      "Frame %d, Subframe %d: Preparing for Msg4 retransmission currently %d.%d\n",
+		      frameP, subframeP, ra->Msg4_frame,
+		      ra->Msg4_subframe);
+		if (ra->Msg4_subframe > 1)
+		    ra->Msg4_frame++;
+		ra->Msg4_frame &= 1023;
+		ra->Msg4_subframe = (ra->Msg4_subframe + 8) % 10;
+		LOG_D(MAC,
+		      "Frame %d, Subframe %d: Msg4 retransmission in %d.%d\n",
+		      frameP, subframeP, ra->Msg4_frame,
+		      ra->Msg4_subframe);
+		lcid = 0;
+
+		// put HARQ process round to 0
+		if (cc->tdd_Config) ra->harq_pid = ((frameP * 10) + subframeP) % 10;
+		else
+		  ra->harq_pid = ((frameP * 10) + subframeP) & 7;
+		UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] = 0;
+
+		if ((ra->msg4_TBsize - rrc_sdu_length - msg4_header) <= 2) {
+		    msg4_padding = ra->msg4_TBsize - rrc_sdu_length - msg4_header;
+		    msg4_post_padding = 0;
+		} else {
+		    msg4_padding = 0;
+		    msg4_post_padding = ra->msg4_TBsize - rrc_sdu_length - msg4_header - 1;
+		}
+
+		LOG_D(MAC,
+		      "[eNB %d][RAPROC] CC_idP %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
+		      module_idP, CC_idP, frameP, subframeP,
+		      ra->msg4_TBsize, rrc_sdu_length, msg4_header,
+		      msg4_padding, msg4_post_padding);
+		DevAssert(UE_id != UE_INDEX_INVALID);	// FIXME not sure how to gracefully return
+		// CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0]
+		offset = generate_dlsch_header((unsigned char *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], 1,	//num_sdus
+					       (unsigned short *) &rrc_sdu_length,	//
+					       &lcid,	// sdu_lcid
+					       255,	// no drx
+					       31,	// no timing advance
+					       ra->cont_res_id,	// contention res id
+					       msg4_padding,	// no padding
+					       msg4_post_padding);
+
+		memcpy((void *) &mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0][(unsigned char)offset],
+		       &cc[CC_idP].CCCH_pdu.payload[0], rrc_sdu_length);
+
+		// DLSCH Config
+		fill_nfapi_dlsch_config(mac, dl_req_body, ra->msg4_TBsize, mac->pdu_index[CC_idP], ra->rnti, 2,	// resource_allocation_type : format 1A/1B/1D
+					0,	// virtual_resource_block_assignment_flag : localized
+					getRIV(N_RB_DL, first_rb, 4),	// resource_block_coding : RIV, 4 PRB
+					2,	// modulation: QPSK
+					0,	// redundancy version
+					1,	// transport_blocks
+					0,	// transport_block_to_codeword_swap_flag (0)
+					(cc->p_eNB == 1) ? 0 : 1,	// transmission_scheme
+					1,	// number of layers
+					1,	// number of subbands
+					//0,                         // codebook index 
+					1,	// ue_category_capacity
+					4,	// pa: 0 dB
+					0,	// delta_power_offset_index
+					0,	// ngap
+					1,	// NPRB = 3 like in DCI
+					(cc->p_eNB == 1) ? 1 : 2,	// transmission mode
+					1,	// num_bf_prb_per_subband
+					1);	// num_bf_vector
+		LOG_D(MAC,
+		      "Filled DLSCH config, pdu number %d, non-dci pdu_index %d\n",
+		      dl_req_body->number_pdu, mac->pdu_index[CC_idP]);
+
+		// Tx request
+		mac->TX_req[CC_idP].sfn_sf =
+		    fill_nfapi_tx_req(&mac->TX_req[CC_idP].tx_request_body,
+				      (frameP * 10) + subframeP,
+				      rrc_sdu_length,
+				      mac->pdu_index[CC_idP],
+				      mac->UE_list.
+				      DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0]);
+		mac->pdu_index[CC_idP]++;
+
+                dl_req->sfn_sf = mac->TX_req[CC_idP].sfn_sf;
+
+		LOG_D(MAC, "Filling UCI ACK/NAK information, cce_idx %d\n",
+		      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
+		// Program PUCCH1a for ACK/NAK
+		// Program ACK/NAK for Msg4 PDSCH
+		fill_nfapi_uci_acknak(module_idP,
+				      CC_idP,
+				      ra->rnti,
+				      (frameP * 10) + subframeP,
+				      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
+
+
+		T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP),
+		  T_INT(CC_idP), T_INT(ra->rnti), T_INT(frameP),
+		  T_INT(subframeP), T_INT(0 /*harq_pid always 0? */ ),
+		  T_BUFFER(&mac->UE_list.DLSCH_pdu[CC_idP][0][UE_id].
+			   payload[0], ra->msg4_TBsize));
+
+		if (opt_enabled == 1) {
+		    trace_pdu(1,
+			      (uint8_t *) mac->
+			      UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0], rrc_sdu_length, UE_id, 3,
+			      UE_RNTI(module_idP, UE_id), mac->frame,
+			      mac->subframe, 0, 0);
+		    LOG_D(OPT,
+			  "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n",
+			  module_idP, CC_idP, frameP, UE_RNTI(module_idP,
+							      UE_id),
+			  rrc_sdu_length);
+		}
+
+	    }			// CCE Allocation feasible
+	}			// msg4 frame/subframe
+    }				// else rach_resource_type
 }
 
-void check_Msg4_retransmission(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t subframeP,RA_TEMPLATE *RA_template) {
- 
-  eNB_MAC_INST                    *eNB = RC.mac[module_idP];
-  COMMON_channels_t               *cc  = eNB->common_channels;
-  int                             UE_id           = -1;
-  uint8_t                         *vrb_map;
-  int                             first_rb;
-  int                             N_RB_DL;
-  nfapi_dl_config_request_pdu_t   *dl_config_pdu;
-  UE_list_t                       *UE_list=&eNB->UE_list;
-  nfapi_dl_config_request_body_t *dl_req;
+void
+check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
+			  frame_t frameP, sub_frame_t subframeP, RA_t * ra)
+{
+
+    eNB_MAC_INST *mac = RC.mac[module_idP];
+    COMMON_channels_t *cc = mac->common_channels;
+    int UE_id = -1;
+    uint8_t *vrb_map;
+    int first_rb;
+    int N_RB_DL;
+    nfapi_dl_config_request_pdu_t *dl_config_pdu;
+    UE_list_t *UE_list = &mac->UE_list;
+    nfapi_dl_config_request_t *dl_req;
+    nfapi_dl_config_request_body_t *dl_req_body;
+
+    int round;
+    /*
+       #ifdef Rel14
+       COMMON_channels_t               *cc  = mac->common_channels;
+
+       int rmax            = 0;
+       int rep             = 0; 
+       int reps            = 0;
+
+       first_rb        = 0;
+       struct PRACH_ConfigSIB_v1310 *ext4_prach;
+       PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
+       PRACH_ParametersCE_r13_t *p[4];
+
+       if (cc[CC_idP].radioResourceConfigCommon_BR) {
+
+       ext4_prach                 = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+       prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+
+       switch (prach_ParametersListCE_r13->list.count) {
+       case 4:
+       p[3]=prach_ParametersListCE_r13->list.array[3];
+       case 3:
+       p[2]=prach_ParametersListCE_r13->list.array[2];
+       case 2:
+       p[1]=prach_ParametersListCE_r13->list.array[1];
+       case 1:
+       p[0]=prach_ParametersListCE_r13->list.array[0];
+       default:
+       AssertFatal(1==0,"Illegal count for prach_ParametersListCE_r13 %d\n",prach_ParametersListCE_r13->list.count);
+       }
+       }
+       #endif
+     */
+
+    // check HARQ status and retransmit if necessary
+
+
+    UE_id = find_UE_id(module_idP, ra->rnti);
+    AssertFatal(UE_id >= 0, "Can't find UE for t-crnti\n");
+
+    round = UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid];
+    vrb_map = cc[CC_idP].vrb_map;
+
+    dl_req = &mac->DL_req[CC_idP];
+    dl_req_body = &dl_req->dl_config_request_body;
+    dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
+    N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
+
+    LOG_D(MAC,
+	  "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Checking if Msg4 for harq_pid %d was acknowledged (round %d)\n",
+	  module_idP, CC_idP, frameP, subframeP, ra->harq_pid, round);
+
+    if (round != 8) {
 
-  int                             round;
-  /*
 #ifdef Rel14
-  COMMON_channels_t               *cc  = eNB->common_channels;
-
-  int rmax            = 0;
-  int rep             = 0; 
-  int reps            = 0;
-
-  first_rb        = 0;
-  struct PRACH_ConfigSIB_v1310 *ext4_prach;
-  PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
-  PRACH_ParametersCE_r13_t *p[4];
-
-  if (cc[CC_idP].radioResourceConfigCommon_BR) {
-
-    ext4_prach                 = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
-    prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
-        
-    switch (prach_ParametersListCE_r13->list.count) {
-    case 4:
-      p[3]=prach_ParametersListCE_r13->list.array[3];
-    case 3:
-      p[2]=prach_ParametersListCE_r13->list.array[2];
-    case 2:
-      p[1]=prach_ParametersListCE_r13->list.array[1];
-    case 1:
-      p[0]=prach_ParametersListCE_r13->list.array[0];
-    default:
-      AssertFatal(1==0,"Illegal count for prach_ParametersListCE_r13 %d\n",prach_ParametersListCE_r13->list.count);
-    }
-  }
+	if (ra->rach_resource_type > 0) {
+	    AssertFatal(1 == 0,
+			"Msg4 Retransmissions not handled yet for BL/CE UEs\n");
+	} else
 #endif
-  */
-
-  // check HARQ status and retransmit if necessary
-
-  
-  UE_id = find_UE_id(module_idP,RA_template->rnti);
-  AssertFatal(UE_id>=0,"Can't find UE for t-crnti\n");
-
-  round = UE_list->UE_sched_ctrl[UE_id].round[CC_idP][RA_template->harq_pid];
-  vrb_map       = cc[CC_idP].vrb_map;
-  
-  dl_req        = &eNB->DL_req[CC_idP].dl_config_request_body;
-  dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-  N_RB_DL       = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
-  
-  LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Checking if Msg4 for harq_pid %d was acknowledged (round %d)\n",
-	module_idP,CC_idP,frameP,subframeP,RA_template->harq_pid,round);
-
-  if (round!=8) {
-    
-#ifdef Rel14
-    if (RA_template->rach_resource_type>0) {
-      AssertFatal(1==0,"Msg4 Retransmissions not handled yet for BL/CE UEs\n");
+	{
+	    if ((ra->Msg4_frame == frameP)
+		&& (ra->Msg4_subframe == subframeP)) {
+
+		//ra->wait_ack_Msg4++;
+		// we have to schedule a retransmission
+
+                dl_req->sfn_sf = frameP<<4 | subframeP;
+
+		first_rb = 0;
+		vrb_map[first_rb] = 1;
+		vrb_map[first_rb + 1] = 1;
+		vrb_map[first_rb + 2] = 1;
+		vrb_map[first_rb + 3] = 1;
+
+		fill_nfapi_dl_dci_1A(dl_config_pdu, 4,	// aggregation_level
+				     ra->rnti,	// rnti
+				     1,	// rnti_type, CRNTI
+				     ra->harq_pid,	// harq_process
+				     1,	// tpc, none
+				     getRIV(N_RB_DL, first_rb, 4),	// resource_block_coding
+				     ra->msg4_mcs,	// mcs
+				     1,	// ndi
+				     round & 3,	// rv
+				     0);	// vrb_flag
+
+		if (!CCE_allocation_infeasible
+		    (module_idP, CC_idP, 1, subframeP,
+		     dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.
+		     aggregation_level, ra->rnti)) {
+		    dl_req_body->number_dci++;
+		    dl_req_body->number_pdu++;
+                    dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+		    LOG_D(MAC,
+			  "msg4 retransmission for rnti %x (round %d) fsf %d/%d\n",
+			  ra->rnti, round, frameP, subframeP);
+		    // DLSCH Config
+                    //DJP - fix this pdu_index = -1
+		    fill_nfapi_dlsch_config(mac, dl_req_body, ra->msg4_TBsize,
+					    -1
+					    /* retransmission, no pdu_index */
+					    , ra->rnti, 2,	// resource_allocation_type : format 1A/1B/1D
+					    0,	// virtual_resource_block_assignment_flag : localized
+					    getRIV(N_RB_DL, first_rb, 4),	// resource_block_coding : RIV, 4 PRB
+					    2,	// modulation: QPSK
+					    round & 3,	// redundancy version
+					    1,	// transport_blocks
+					    0,	// transport_block_to_codeword_swap_flag (0)
+					    (cc->p_eNB == 1) ? 0 : 1,	// transmission_scheme
+					    1,	// number of layers
+					    1,	// number of subbands
+					    //0,                         // codebook index 
+					    1,	// ue_category_capacity
+					    4,	// pa: 0 dB
+					    0,	// delta_power_offset_index
+					    0,	// ngap
+					    1,	// NPRB = 3 like in DCI
+					    (cc->p_eNB == 1) ? 1 : 2,	// transmission mode
+					    1,	// num_bf_prb_per_subband
+					    1);	// num_bf_vector
+		} else
+		    LOG_D(MAC,
+			  "msg4 retransmission for rnti %x (round %d) fsf %d/%d CCE allocation failed!\n",
+			  ra->rnti, round, frameP, subframeP);
+
+
+		// Program PUCCH1a for ACK/NAK
+
+
+		fill_nfapi_uci_acknak(module_idP, CC_idP,
+				      ra->rnti,
+				      (frameP * 10) + subframeP,
+				      dl_config_pdu->dci_dl_pdu.
+				      dci_dl_pdu_rel8.cce_idx);
+
+		// prepare frame for retransmission
+		if (ra->Msg4_subframe > 1)
+		    ra->Msg4_frame++;
+		ra->Msg4_frame &= 1023;
+		ra->Msg4_subframe = (ra->Msg4_subframe + 8) % 10;
+
+		LOG_W(MAC,
+		      "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Msg4 not acknowledged, adding ue specific dci (rnti %x) for RA (Msg4 Retransmission round %d in %d.%d)\n",
+		      module_idP, CC_idP, frameP, subframeP, ra->rnti,
+		      round, ra->Msg4_frame, ra->Msg4_subframe);
+
+	    }			// Msg4 frame/subframe
+	}			// regular LTE case
+    } else {
+	LOG_D(MAC,
+	      "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n",
+	      module_idP, CC_idP, frameP, subframeP);
+	ra->state = IDLE;
+        LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:IDLE\n", module_idP, frameP, subframeP);
+	UE_id = find_UE_id(module_idP, ra->rnti);
+	DevAssert(UE_id != -1);
+	mac->UE_list.UE_template[UE_PCCID(module_idP, UE_id)][UE_id].configured = TRUE;
     }
-    else
-#endif 
-      {
-	if ( (RA_template->Msg4_frame == frameP) && (RA_template->Msg4_subframe == subframeP)) {	       
-	  
-	  //RA_template->wait_ack_Msg4++;
-	  // we have to schedule a retransmission
-	  
-	  first_rb=0;
-	  vrb_map[first_rb] = 1;
-	  vrb_map[first_rb+1] = 1;
-	  vrb_map[first_rb+2] = 1;
-	  vrb_map[first_rb+3] = 1;
-	  
-	  fill_nfapi_dl_dci_1A(dl_config_pdu,
-			       4,                           // aggregation_level
-			       RA_template->rnti,           // rnti
-			       1,                           // rnti_type, CRNTI
-			       RA_template->harq_pid,       // harq_process
-			       1,                           // tpc, none
-			       getRIV(N_RB_DL,first_rb,4),  // resource_block_coding
-			       RA_template->msg4_mcs,       // mcs
-			       1,                           // ndi
-			       round&3,                       // rv
-			       0);                          // vrb_flag
-	  
-	  if (!CCE_allocation_infeasible(module_idP,CC_idP,1,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,RA_template->rnti)) {
-	    dl_req->number_dci++;
-	    dl_req->number_pdu++;
-	    
-	    LOG_D(MAC,"msg4 retransmission for rnti %x (round %d) fsf %d/%d\n", RA_template->rnti, round, frameP, subframeP);
-	    	  // DLSCH Config
-	    fill_nfapi_dlsch_config(eNB,
-				    dl_req,
-				    RA_template->msg4_TBsize,
-				    -1                           /* retransmission, no pdu_index */,
-				    RA_template->rnti,
-				    2,                           // resource_allocation_type : format 1A/1B/1D
-				    0,                           // virtual_resource_block_assignment_flag : localized
-				    getRIV(N_RB_DL,first_rb,4),  // resource_block_coding : RIV, 4 PRB
-				    2,                           // modulation: QPSK
-				    round&3,                     // redundancy version
-				    1,                           // transport_blocks
-				    0,                           // transport_block_to_codeword_swap_flag (0)
-				    (cc->p_eNB==1 ) ? 0 : 1,     // transmission_scheme
-				    1,                           // number of layers
-				    1,                           // number of subbands
-				    //0,                         // codebook index 
-				    1,                           // ue_category_capacity
-				    4,                           // pa: 0 dB
-				    0,                           // delta_power_offset_index
-				    0,                           // ngap
-				    1,                           // NPRB = 3 like in DCI
-				    (cc->p_eNB==1 ) ? 1 : 2,     // transmission mode
-				    1,                           // num_bf_prb_per_subband
-				    1);                          // num_bf_vector
-	  }
-	  else
-	    LOG_D(MAC,"msg4 retransmission for rnti %x (round %d) fsf %d/%d CCE allocation failed!\n", RA_template->rnti, round, frameP, subframeP);
-	  
-	  
-	  // Program PUCCH1a for ACK/NAK
-	  
-
-	  fill_nfapi_uci_acknak(module_idP,CC_idP,
-				RA_template->rnti,
-				(frameP*10)+subframeP,
-				dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
-	  
-	  // prepare frame for retransmission
-	  if (RA_template->Msg4_subframe>1) RA_template->Msg4_frame++;
-	  RA_template->Msg4_frame&=1023;
-	  RA_template->Msg4_subframe=(RA_template->Msg4_subframe+8)%10;
-
-	  LOG_W(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Msg4 not acknowledged, adding ue specific dci (rnti %x) for RA (Msg4 Retransmission round %d in %d.%d)\n",
-		module_idP,CC_idP,frameP,subframeP,RA_template->rnti,round,RA_template->Msg4_frame,RA_template->Msg4_subframe);
-
-	} // Msg4 frame/subframe
-      } // regular LTE case
-  } else {
-    LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n",module_idP,CC_idP,frameP,subframeP);
-    RA_template->wait_ack_Msg4=0;
-    RA_template->RA_active=FALSE;
-    UE_id = find_UE_id(module_idP,RA_template->rnti);
-    DevAssert( UE_id != -1 );
-    eNB->UE_list.UE_template[UE_PCCID(module_idP,UE_id)][UE_id].configured=TRUE;
-  }
-} 
+}
 
-void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP)
+void
+schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 {
 
-  int                             CC_id;
-  eNB_MAC_INST                    *eNB = RC.mac[module_idP];
-  COMMON_channels_t               *cc  = eNB->common_channels;
-  RA_TEMPLATE                     *RA_template;
-  uint8_t                         i;
+    int CC_id;
+    eNB_MAC_INST *mac = RC.mac[module_idP];
+    COMMON_channels_t *cc = mac->common_channels;
+    RA_t *ra;
+    uint8_t i;
 
-  start_meas(&eNB->schedule_ra);
+    start_meas(&mac->schedule_ra);
 
 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    // skip UL component carriers if TDD
-    if (is_UL_sf(&cc[CC_id],subframeP)==1) continue;
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+	// skip UL component carriers if TDD
+	if (is_UL_sf(&cc[CC_id], subframeP) == 1)
+	    continue;
 
 
-    for (i=0; i<NB_RA_PROC_MAX; i++) {
+	for (i = 0; i < NB_RA_PROC_MAX; i++) {
 
-      RA_template = (RA_TEMPLATE *)&cc[CC_id].RA_template[i];
+	    ra = (RA_t *) & cc[CC_id].ra[i];
 
-      if (RA_template->RA_active == TRUE) {
+            //LOG_D(MAC,"RA[state:%d]\n",ra->state);
 
-        LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA %d is active (generate RAR %d, generate_Msg4 %d, wait_ack_Msg4 %d, rnti %x)\n",
-              module_idP,frameP,subframeP,CC_id,i,RA_template->generate_rar,RA_template->generate_Msg4,RA_template->wait_ack_Msg4, RA_template->rnti);
+	    if (ra->state == MSG2)
+		generate_Msg2(module_idP, CC_id, frameP, subframeP, ra);
+	    else if (ra->state == MSG4)
+		generate_Msg4(module_idP, CC_id, frameP, subframeP, ra);
+	    else if (ra->state == WAITMSG4ACK)
+		check_Msg4_retransmission(module_idP, CC_id, frameP,
+					  subframeP, ra);
 
-        if      (RA_template->generate_rar == 1)  generate_Msg2(module_idP,CC_id,frameP,subframeP,RA_template);
-	else if (RA_template->generate_Msg4 == 1) generate_Msg4(module_idP,CC_id,frameP,subframeP,RA_template);
- 	else if (RA_template->wait_ack_Msg4==1)   check_Msg4_retransmission(module_idP,CC_id,frameP,subframeP,RA_template);
+	}			// for i=0 .. N_RA_PROC-1 
+    }				// CC_id
 
-
-      } // RA_active == TRUE
-    } // for i=0 .. N_RA_PROC-1 
-  } // CC_id
-  
-  stop_meas(&eNB->schedule_ra);
+    stop_meas(&mac->schedule_ra);
 }
 
 
 // handles the event of MSG1 reception
-void initiate_ra_proc(module_id_t module_idP, 
-		      int CC_id,
-		      frame_t frameP, 
-		      sub_frame_t subframeP,
-		      uint16_t preamble_index,
-		      int16_t timing_offset,
-		      uint16_t ra_rnti
+void
+initiate_ra_proc(module_id_t module_idP,
+		 int CC_id,
+		 frame_t frameP,
+		 sub_frame_t subframeP,
+		 uint16_t preamble_index,
+		 int16_t timing_offset, uint16_t ra_rnti
 #ifdef Rel14
-		      ,
-		      uint8_t rach_resource_type
+		 , uint8_t rach_resource_type
 #endif
-		      )
+    )
 {
 
-  uint8_t i;
+    uint8_t i;
+
+    COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
+    RA_t *ra = &cc->ra[0];
 
-  COMMON_channels_t   *cc  = &RC.mac[module_idP]->common_channels[CC_id];
-  RA_TEMPLATE *RA_template = &cc->RA_template[0];
+#ifdef Rel14
 
-  struct PRACH_ConfigSIB_v1310 *ext4_prach = NULL;
-  PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL;
+    struct PRACH_ConfigSIB_v1310 *ext4_prach = NULL;
+    PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL;
 
-  if (cc->radioResourceConfigCommon_BR && cc->radioResourceConfigCommon_BR->ext4) {
-    ext4_prach=cc->radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
-    prach_ParametersListCE_r13= &ext4_prach->prach_ParametersListCE_r13;
-  }
-  LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d  Initiating RA procedure for preamble index %d\n",module_idP,CC_id,frameP,subframeP,preamble_index);
+    if (cc->radioResourceConfigCommon_BR
+	&& cc->radioResourceConfigCommon_BR->ext4) {
+	ext4_prach = cc->radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+	prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+    }
+
+#endif /* Rel14 */
+
+    LOG_D(MAC,
+	  "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d  Initiating RA procedure for preamble index %d\n",
+	  module_idP, CC_id, frameP, subframeP, preamble_index);
 #ifdef Rel14
-  LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d  PRACH resource type %d\n",module_idP,CC_id,frameP,subframeP,rach_resource_type);
+    LOG_D(MAC,
+	  "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d  PRACH resource type %d\n",
+	  module_idP, CC_id, frameP, subframeP, rach_resource_type);
 #endif
 
-  if (prach_ParametersListCE_r13 && 
-      prach_ParametersListCE_r13->list.count<rach_resource_type) {
-    LOG_E(MAC,"[eNB %d][RAPROC] CC_id %d Received impossible PRACH resource type %d, only %d CE levels configured\n",
-	  module_idP,CC_id,
-	  rach_resource_type,
-	  (int)prach_ParametersListCE_r13->list.count);
-    return;
-  }
+    uint16_t msg2_frame = frameP;
+    uint16_t msg2_subframe = subframeP;
+    int offset;
+
+#ifdef Rel14
+
+    if (prach_ParametersListCE_r13 &&
+	prach_ParametersListCE_r13->list.count < rach_resource_type) {
+	LOG_E(MAC,
+	      "[eNB %d][RAPROC] CC_id %d Received impossible PRACH resource type %d, only %d CE levels configured\n",
+	      module_idP, CC_id, rach_resource_type,
+	      (int) prach_ParametersListCE_r13->list.count);
+	return;
+    }
+
+#endif /* Rel14 */
+
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0);
 
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC,1);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC,0);
-
-  for (i=0; i<NB_RA_PROC_MAX; i++) {
-    if (RA_template[i].RA_active==FALSE &&
-        RA_template[i].wait_ack_Msg4 == 0) {
-      int loop = 0;
-      LOG_D(MAC,"Frame %d, Subframe %d: Activating RA process %d\n",frameP,subframeP,i);
-      RA_template[i].RA_active          = TRUE;
-      RA_template[i].generate_rar       = 1;
-      RA_template[i].generate_Msg4      = 0;
-      RA_template[i].wait_ack_Msg4      = 0;
-      RA_template[i].timing_offset      = timing_offset;
-      RA_template[i].preamble_subframe  = subframeP;
+    for (i = 0; i < NB_RA_PROC_MAX; i++) {
+	if (ra[i].state == IDLE) {
+	    int loop = 0;
+	    LOG_D(MAC, "Frame %d, Subframe %d: Activating RA process %d\n",
+		  frameP, subframeP, i);
+	    ra[i].state = MSG2;
+	    ra[i].timing_offset = timing_offset;
+	    ra[i].preamble_subframe = subframeP;
 #ifdef Rel14
-      RA_template[i].rach_resource_type = rach_resource_type;
-      RA_template[i].msg2_mpdcch_repetition_cnt = 0;		      
-      RA_template[i].msg4_mpdcch_repetition_cnt = 0;		      
+	    ra[i].rach_resource_type = rach_resource_type;
+	    ra[i].msg2_mpdcch_repetition_cnt = 0;
+	    ra[i].msg4_mpdcch_repetition_cnt = 0;
 #endif
-      RA_template[i].Msg2_frame         = frameP+((subframeP>5)?1:0);
-      RA_template[i].Msg2_subframe      = (subframeP+4)%10;
-      /* TODO: find better procedure to allocate RNTI */
-      do {
-        RA_template[i].rnti = taus();
-        loop++;
-      } while (loop != 100 &&
-               /* TODO: this is not correct, the rnti may be in use without
-                * being in the MAC yet. To be refined.
-                */
-               !(find_UE_id(module_idP, RA_template[i].rnti) == -1 &&
-                 /* 1024 and 60000 arbirarily chosen, not coming from standard */
-                 RA_template[i].rnti >= 1024 && RA_template[i].rnti < 60000));
-      if (loop == 100) { printf("%s:%d:%s: FATAL ERROR! contact the authors\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
-      RA_template[i].RA_rnti        = ra_rnti;
-      RA_template[i].preamble_index = preamble_index;
-      LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Activating RAR generation in Frame %d, subframe %d for process %d, rnti %x, RA_active %d\n",
-            module_idP,CC_id,frameP,
-	    RA_template[i].Msg2_frame,
-	    RA_template[i].Msg2_subframe,
-	    i,RA_template[i].rnti,
-            RA_template[i].RA_active);
-
-      return;
+
+            // DJP - this is because VNF is 2 subframes ahead of PNF and TX needs 4 subframes
+            if (nfapi_mode)
+              offset = 7;
+            else
+              offset = 5;
+
+            add_subframe(&msg2_frame, &msg2_subframe, offset);
+
+            ra[i].Msg2_frame         = msg2_frame;
+            ra[i].Msg2_subframe      = msg2_subframe;
+
+            LOG_D(MAC,"%s() Msg2[%04d%d] SFN/SF:%04d%d offset:%d\n", __FUNCTION__,ra[i].Msg2_frame,ra[i].Msg2_subframe,frameP,subframeP,offset);
+
+            ra[i].Msg2_subframe = (subframeP + offset) % 10;
+            /* TODO: find better procedure to allocate RNTI */
+	    do {
+#if defined(USRP_REC_PLAY) // deterministic rnti in usrp record/playback mode
+	        static int drnti[NUMBER_OF_UE_MAX] = { 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 };
+	        int j = 0;
+		int nb_ue = 0;
+		for (j = 0; j < NUMBER_OF_UE_MAX; j++) {
+		    if (UE_RNTI(module_idP, j) > 0) {
+		        nb_ue++;
+		    } else {
+		        break;
+		    }
+		}
+		if (nb_ue >= NUMBER_OF_UE_MAX) {
+		    printf("No more free RNTI available, increase NUMBER_OF_UE_MAX\n");
+		    abort();
+		}
+		ra[i].rnti = drnti[nb_ue];
+#else	
+		ra[i].rnti = taus();
+#endif
+		loop++;
+	    }
+	    while (loop != 100 &&
+		   /* TODO: this is not correct, the rnti may be in use without
+		    * being in the MAC yet. To be refined.
+		    */
+		   !(find_UE_id(module_idP, ra[i].rnti) == -1 &&
+		     /* 1024 and 60000 arbirarily chosen, not coming from standard */
+		     ra[i].rnti >= 1024 && ra[i].rnti < 60000));
+	    if (loop == 100) {
+		printf("%s:%d:%s: FATAL ERROR! contact the authors\n",
+		       __FILE__, __LINE__, __FUNCTION__);
+		abort();
+	    }
+	    ra[i].RA_rnti = ra_rnti;
+	    ra[i].preamble_index = preamble_index;
+	    LOG_D(MAC,
+		  "[eNB %d][RAPROC] CC_id %d Frame %d Activating RAR generation in Frame %d, subframe %d for process %d, rnti %x, state %d\n",
+		  module_idP, CC_id, frameP, ra[i].Msg2_frame,
+		  ra[i].Msg2_subframe, i, ra[i].rnti, ra[i].state);
+
+	    return;
+	}
     }
-  }
 
-  LOG_E(MAC,"[eNB %d][RAPROC] FAILURE: CC_id %d Frame %d Initiating RA procedure for preamble index %d\n",module_idP,CC_id,frameP,preamble_index);
+    LOG_E(MAC,
+	  "[eNB %d][RAPROC] FAILURE: CC_id %d Frame %d Initiating RA procedure for preamble index %d\n",
+	  module_idP, CC_id, frameP, preamble_index);
 }
 
-void cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, rnti_t rnti)
+void
+cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP,
+	       rnti_t rnti)
 {
-  unsigned char i;
-  RA_TEMPLATE *RA_template = (RA_TEMPLATE *)&RC.mac[module_idP]->common_channels[CC_id].RA_template[0];
-
-  MSC_LOG_EVENT(MSC_PHY_ENB, "RA Cancelling procedure ue %"PRIx16" ", rnti);
-  LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Cancelling RA procedure for UE rnti %x\n",module_idP,CC_id,frameP,rnti);
-
-  for (i=0; i<NB_RA_PROC_MAX; i++) {
-    if (rnti == RA_template[i].rnti) {
-      RA_template[i].RA_active=FALSE;
-      RA_template[i].generate_rar=0;
-      RA_template[i].generate_Msg4=0;
-      RA_template[i].wait_ack_Msg4=0;
-      RA_template[i].timing_offset=0;
-      RA_template[i].RRC_timer=20;
-      RA_template[i].rnti = 0;
-      RA_template[i].msg3_round = 0;
+    unsigned char i;
+    RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0];
+
+    MSC_LOG_EVENT(MSC_PHY_ENB, "RA Cancelling procedure ue %" PRIx16 " ",
+		  rnti);
+    LOG_D(MAC,
+	  "[eNB %d][RAPROC] CC_id %d Frame %d Cancelling RA procedure for UE rnti %x\n",
+	  module_idP, CC_id, frameP, rnti);
+
+    for (i = 0; i < NB_RA_PROC_MAX; i++) {
+	if (rnti == ra[i].rnti) {
+	  ra[i].state = IDLE;
+	  ra[i].timing_offset = 0;
+	  ra[i].RRC_timer = 20;
+	  ra[i].rnti = 0;
+	  ra[i].msg3_round = 0;
+	}
     }
-  }
 }
-
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index 3aa2ce38fe728b80b164df224af715e0b3051adf..de4641fac6dc499dd54cf9b77ca8fc121e76a451 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -52,7 +52,7 @@
 #include "pdcp.h"
 
 #if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+#include "intertask_interface.h"
 #endif
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
@@ -65,714 +65,738 @@
 #ifdef Rel14
 
 #define size_Sj25 2
-int Sj25[size_Sj25]={0,3};
+int Sj25[size_Sj25] = { 0, 3 };
+
 #define size_Sj50 6
-int Sj50[size_Sj50]={0,1,2,5,6,7};
+int Sj50[size_Sj50] = { 0, 1, 2, 5, 6, 7 };
+
 #define size_Sj75 10
-int Sj75[size_Sj75]={0,1,2,3,4,7,8,9,10,11};
+int Sj75[size_Sj75] = { 0, 1, 2, 3, 4, 7, 8, 9, 10, 11 };
+
 #define size_Sj100 14
-int Sj100[size_Sj100]={0,1,2,3,4,5,6,9,10,11,12,13,14,15};
+int Sj100[size_Sj100] = { 0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15 };
 
-int SIB1_BR_TBS_table[6] = {208,256,328,504,712,936};
+int SIB1_BR_TBS_table[6] = { 208, 256, 328, 504, 712, 936 };
 
 //------------------------------------------------------------------------------
 void
-schedule_SIB1_BR(
-		 module_id_t   module_idP,
-		 frame_t       frameP,
-		 sub_frame_t   subframeP)
-
+schedule_SIB1_BR(module_id_t module_idP,
+		 frame_t frameP, sub_frame_t subframeP)
 //------------------------------------------------------------------------------
 {
 
-  int8_t                         bcch_sdu_length;
-  int                            CC_id;
-  eNB_MAC_INST                   *eNB = RC.mac[module_idP];
-  COMMON_channels_t              *cc;
-  uint8_t                        *vrb_map;
-  int                            first_rb = -1;
-  int                            N_RB_DL;
-  nfapi_dl_config_request_pdu_t  *dl_config_pdu;
-  nfapi_tx_request_pdu_t         *TX_req;
-  nfapi_dl_config_request_body_t *dl_req;
-  int                            m,i,N_S_NB;
-  int                            *Sj;
-  int                            n_NB = 0;
-  int                            TBS;
-  int                            k=0,rvidx;
-
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-    cc              = &eNB->common_channels[CC_id];
-    vrb_map         = (void*)&cc->vrb_map;
-    N_RB_DL         = to_prb(cc->mib->message.dl_Bandwidth); 
-    dl_req          = &eNB->DL_req[CC_id].dl_config_request_body;
-
-    int foffset  = cc->physCellId&1;
-    int sfoffset = (cc->tdd_Config==NULL) ? 0 : 1;
-
-    // Time-domain scheduling
-    if (cc->mib->message.schedulingInfoSIB1_BR_r13==0) continue;
-    else 
-      switch ((cc->mib->message.schedulingInfoSIB1_BR_r13-1)%3) {
-	case 0: // repetition 4
-	  k = (frameP>>1)&3;
-	  if ((subframeP!=(4+sfoffset)) || ((frameP&1)!=foffset)) continue;
-	  break;
-	case 1: // repetition 8
-	  k = frameP&3;
-	  AssertFatal(N_RB_DL>15,"SIB1-BR repetition 8 not allowed for N_RB_DL= %d\n",N_RB_DL);
-	  if      ((foffset==0) && (subframeP!=(4+sfoffset))) continue;
-	  else if ((foffset==1) && (subframeP!=((9+sfoffset)%10))) continue;
-	  break;
-	case 2: // repetition 16
-	  k = ((10*frameP) + subframeP)&3;
-	  AssertFatal(N_RB_DL>15,"SIB1-BR repetition 16 not allowed for N_RB_DL= %d\n",N_RB_DL);
-	  if      ((sfoffset == 1) && ((subframeP!=0)||(subframeP!=5))) continue;
-	  else if ((sfoffset == 0) && (foffset==0) && (subframeP!=4) && (subframeP!=9)) continue;
-	  else if ((sfoffset == 0) && (foffset==1) && (subframeP!=0) && (subframeP!=9)) continue;
-	  break;
-      }
-    // if we get here we have to schedule SIB1_BR in this frame/subframe
-
-    // keep counter of SIB1_BR repetitions in 8 frame period to choose narrowband on which to transmit
-    if ((frameP&7) == 0) cc->SIB1_BR_cnt=0;
-    else                 cc->SIB1_BR_cnt++;
-
-    // Frequency-domain scheduling
-    switch (N_RB_DL) {
-    case 6:
-    case 15:
-    default:
-      m=1;
-      n_NB=0;
-      N_S_NB=0;
-      Sj=NULL;
-      break;
-    case 25:
-      m=2;
-      N_S_NB = 2;
-      Sj = Sj25;
-      break;
-    case 50:
-      m=2;
-      N_S_NB = 6;
-      Sj = Sj50; 
-      break;
-    case 75:
-      m=4;
-      N_S_NB = 10;
-      Sj = Sj75;
-      break;
-    case 100:
-      m=4;
-      N_S_NB = 14;
-      Sj = Sj100;
-      break;
-    }
-    // Note: definition of k above and rvidx from 36.321 section 5.3.1
-    rvidx = (((3*k)>>1) + (k&1))&3;
-    
-    i = cc->SIB1_BR_cnt & (m-1);
-    
-    n_NB =  Sj[((cc->physCellId % N_S_NB) + (i*N_S_NB/m))%N_S_NB];
-
-    
-    bcch_sdu_length = mac_rrc_data_req(module_idP,
-                                       CC_id,
-				       frameP,
-                                       BCCH_SIB1_BR,1,
-                                       &cc->BCCH_BR_pdu[0].payload[0],
-                                       1,
-                                       module_idP,
-                                       0); // not used in this case
-
-    AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13<19,"schedulingInfoSIB1_BR_r13 %d > 18\n",
-		(int)cc->mib->message.schedulingInfoSIB1_BR_r13);
-
-    AssertFatal(bcch_sdu_length>0,"RRC returned 0 bytes for SIB1-BR\n");
-
-    TBS = SIB1_BR_TBS_table[(cc->mib->message.schedulingInfoSIB1_BR_r13-1)/3]>>3;
-
-    AssertFatal(bcch_sdu_length <= TBS, "length returned by RRC %d is not compatible with the TBS %d from MIB\n",bcch_sdu_length,TBS);
-
-    if ((frameP&1023) < 200) LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SIB1_BR->DLSCH CC_id %d, Received %d bytes, scheduling on NB %d (i %d,m %d,N_S_NB %d)  rvidx %d\n",module_idP,frameP,subframeP,CC_id,bcch_sdu_length,n_NB,i,m,N_S_NB,rvidx);
-    
-    // allocate all 6 PRBs in narrowband for SIB1_BR
-
-    first_rb = narrowband_to_first_rb(cc,n_NB);
-
-    vrb_map[first_rb] = 1;
-    vrb_map[first_rb+1] = 1;
-    vrb_map[first_rb+2] = 1;
-    vrb_map[first_rb+3] = 1;
-    vrb_map[first_rb+4] = 1;
-    vrb_map[first_rb+5] = 1;
-    
-    dl_config_pdu                                                                  = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-    memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-    dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; 
-    dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length                                 = TBS;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = eNB->pdu_index[CC_id];
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = 0xFFFF;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;   // format 1A/1B/1D
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;   // localized
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL,first_rb,6);
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2; //QPSK
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = rvidx;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;// first block
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB==1 ) ? 0 : 1;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
-    //	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4; // 0 dB
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB==1 ) ? 1 : 2;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
-    // Rel10 fields
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start                           = 3;
-    // Rel13 fields
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type                               = 1; // CEModeA UE
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 0; // SIB1-BR
-    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = 0xFFFF; // absolute SFx
-    
-    //	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
-    dl_req->number_pdu++;
-    
-    // Program TX Request
-    TX_req                                                                = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; 
-    TX_req->pdu_length                                                    = bcch_sdu_length;
-    TX_req->pdu_index                                                     = eNB->pdu_index[CC_id]++;
-    TX_req->num_segments                                                  = 1;
-    TX_req->segments[0].segment_length                                    = bcch_sdu_length;
-    TX_req->segments[0].segment_data                                      = cc->BCCH_BR_pdu[0].payload;
-    eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
-    
-    
-    
-    if (opt_enabled == 1) {
-      trace_pdu(1,
-		&cc->BCCH_BR_pdu[0].payload[0],
-		bcch_sdu_length,
-		0xffff,
-		4,
-		0xffff,
-		eNB->frame,
-		eNB->subframe,
-		0,
-		0);
-      LOG_D(OPT,"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
-	    module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
-    }
-    if (cc->tdd_Config!=NULL) { //TDD
-      LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (TDD) for CC_id %d SIB1-BR %d bytes\n",
-	    frameP,
-	    CC_id,
-	    bcch_sdu_length);
-    } else {
-      LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (FDD) for CC_id %d SIB1-BR %d bytes\n",
-	    frameP,
-	    CC_id,
-	    bcch_sdu_length);
-    }
+    int8_t bcch_sdu_length;
+    int CC_id;
+    eNB_MAC_INST *eNB = RC.mac[module_idP];
+    COMMON_channels_t *cc;
+    uint8_t *vrb_map;
+    int first_rb = -1;
+    int N_RB_DL;
+    nfapi_dl_config_request_pdu_t *dl_config_pdu;
+    nfapi_tx_request_pdu_t *TX_req;
+    nfapi_dl_config_request_body_t *dl_req;
+    int m, i, N_S_NB;
+    int *Sj;
+    int n_NB = 0;
+    int TBS;
+    int k = 0, rvidx;
+    uint16_t sfn_sf = frameP<<4|subframeP;
+
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+
+	cc = &eNB->common_channels[CC_id];
+	vrb_map = (void *) &cc->vrb_map;
+	N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
+	dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
+
+	int foffset = cc->physCellId & 1;
+	int sfoffset = (cc->tdd_Config == NULL) ? 0 : 1;
+
+	// Time-domain scheduling
+	if (cc->mib->message.schedulingInfoSIB1_BR_r13 == 0)
+	    continue;
+	else
+	    switch ((cc->mib->message.schedulingInfoSIB1_BR_r13 - 1) % 3) {
+	    case 0:		// repetition 4
+		k = (frameP >> 1) & 3;
+		if ((subframeP != (4 + sfoffset))
+		    || ((frameP & 1) != foffset))
+		    continue;
+		break;
+	    case 1:		// repetition 8
+		k = frameP & 3;
+		AssertFatal(N_RB_DL > 15,
+			    "SIB1-BR repetition 8 not allowed for N_RB_DL= %d\n",
+			    N_RB_DL);
+		if ((foffset == 0) && (subframeP != (4 + sfoffset)))
+		    continue;
+		else if ((foffset == 1)
+			 && (subframeP != ((9 + sfoffset) % 10)))
+		    continue;
+		break;
+	    case 2:		// repetition 16
+		k = ((10 * frameP) + subframeP) & 3;
+		AssertFatal(N_RB_DL > 15,
+			    "SIB1-BR repetition 16 not allowed for N_RB_DL= %d\n",
+			    N_RB_DL);
+		if ((sfoffset == 1)
+		    && ((subframeP != 0) || (subframeP != 5)))
+		    continue;
+		else if ((sfoffset == 0) && (foffset == 0)
+			 && (subframeP != 4) && (subframeP != 9))
+		    continue;
+		else if ((sfoffset == 0) && (foffset == 1)
+			 && (subframeP != 0) && (subframeP != 9))
+		    continue;
+		break;
+	    }
+	// if we get here we have to schedule SIB1_BR in this frame/subframe
+
+	// keep counter of SIB1_BR repetitions in 8 frame period to choose narrowband on which to transmit
+	if ((frameP & 7) == 0)
+	    cc->SIB1_BR_cnt = 0;
+	else
+	    cc->SIB1_BR_cnt++;
+
+	// Frequency-domain scheduling
+	switch (N_RB_DL) {
+	case 6:
+	case 15:
+	default:
+	    m = 1;
+	    n_NB = 0;
+	    N_S_NB = 0;
+	    Sj = NULL;
+	    break;
+	case 25:
+	    m = 2;
+	    N_S_NB = 2;
+	    Sj = Sj25;
+	    break;
+	case 50:
+	    m = 2;
+	    N_S_NB = 6;
+	    Sj = Sj50;
+	    break;
+	case 75:
+	    m = 4;
+	    N_S_NB = 10;
+	    Sj = Sj75;
+	    break;
+	case 100:
+	    m = 4;
+	    N_S_NB = 14;
+	    Sj = Sj100;
+	    break;
+	}
+	// Note: definition of k above and rvidx from 36.321 section 5.3.1
+	rvidx = (((3 * k) >> 1) + (k & 1)) & 3;
+
+	i = cc->SIB1_BR_cnt & (m - 1);
+
+	n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB];
+
+
+	bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 0);	// not used in this case
 
-  }
+	AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19,
+		    "schedulingInfoSIB1_BR_r13 %d > 18\n",
+		    (int) cc->mib->message.schedulingInfoSIB1_BR_r13);
 
-  return;
+	AssertFatal(bcch_sdu_length > 0,
+		    "RRC returned 0 bytes for SIB1-BR\n");
+
+	TBS =
+	    SIB1_BR_TBS_table[(cc->mib->message.schedulingInfoSIB1_BR_r13 -
+			       1) / 3] >> 3;
+
+	AssertFatal(bcch_sdu_length <= TBS,
+		    "length returned by RRC %d is not compatible with the TBS %d from MIB\n",
+		    bcch_sdu_length, TBS);
+
+	if ((frameP & 1023) < 200)
+	    LOG_D(MAC,
+		  "[eNB %d] Frame %d Subframe %d: SIB1_BR->DLSCH CC_id %d, Received %d bytes, scheduling on NB %d (i %d,m %d,N_S_NB %d)  rvidx %d\n",
+		  module_idP, frameP, subframeP, CC_id, bcch_sdu_length,
+		  n_NB, i, m, N_S_NB, rvidx);
+
+	// allocate all 6 PRBs in narrowband for SIB1_BR
+
+	first_rb = narrowband_to_first_rb(cc, n_NB);
+
+	vrb_map[first_rb] = 1;
+	vrb_map[first_rb + 1] = 1;
+	vrb_map[first_rb + 2] = 1;
+	vrb_map[first_rb + 3] = 1;
+	vrb_map[first_rb + 4] = 1;
+	vrb_map[first_rb + 5] = 1;
+
+	dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+	memset((void *) dl_config_pdu, 0,
+	       sizeof(nfapi_dl_config_request_pdu_t));
+	dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+	dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+        dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = TBS;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2;	// format 1A/1B/1D
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;	// localized
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2;	//QPSK
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rvidx;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;	// first block
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+	//  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4;	// 0 dB
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth);	// ignored
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+	// Rel10 fields
+        dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3;
+	// Rel13 fields
+        dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1;	// CEModeA UE
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 0;	// SIB1-BR
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF;	// absolute SFx
+
+	//  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
+	dl_req->number_pdu++;
+        dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+	// Program TX Request
+	TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+	TX_req->pdu_length = bcch_sdu_length;
+	TX_req->pdu_index = eNB->pdu_index[CC_id]++;
+	TX_req->num_segments = 1;
+	TX_req->segments[0].segment_length = bcch_sdu_length;
+	TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[0].payload;
+        eNB->TX_req[CC_id].sfn_sf = sfn_sf;
+        eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+        eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+        eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
+
+	if (opt_enabled == 1) {
+	    trace_pdu(1,
+		      &cc->BCCH_BR_pdu[0].payload[0],
+		      bcch_sdu_length,
+		      0xffff, 4, 0xffff, eNB->frame, eNB->subframe, 0, 0);
+	    LOG_D(OPT,
+		  "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
+		  module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
+	}
+	if (cc->tdd_Config != NULL) {	//TDD
+	    LOG_D(MAC,
+		  "[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (TDD) for CC_id %d SIB1-BR %d bytes\n",
+		  frameP, CC_id, bcch_sdu_length);
+	} else {
+	    LOG_D(MAC,
+		  "[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (FDD) for CC_id %d SIB1-BR %d bytes\n",
+		  frameP, CC_id, bcch_sdu_length);
+	}
+    }
 }
 
-int si_WindowLength_BR_r13tab[SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_spare] = 
-  {20,40,60,80,120,160,200};
-int si_TBS_r13tab[SchedulingInfo_BR_r13__si_TBS_r13_b936+1] = {152,208,256,328,408,504,600,712,808,936};
+int si_WindowLength_BR_r13tab[SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_spare] = { 20, 40, 60, 80, 120, 160, 200 };
+int si_TBS_r13tab[SchedulingInfo_BR_r13__si_TBS_r13_b936 + 1] = { 152, 208, 256, 328, 408, 504, 600, 712, 808, 936 };
 
 //------------------------------------------------------------------------------
 void
-schedule_SI_BR(
-	       module_id_t   module_idP,
-	       frame_t       frameP,
-	       sub_frame_t   subframeP)
-  
+schedule_SI_BR(module_id_t module_idP, frame_t frameP,
+	       sub_frame_t subframeP)
 //------------------------------------------------------------------------------
 {
-
-  int8_t                                  bcch_sdu_length;
-  int                                     CC_id;
-  eNB_MAC_INST                            *eNB = RC.mac[module_idP];
-  COMMON_channels_t                       *cc;
-  uint8_t                                 *vrb_map;
-  int                                     first_rb = -1;
-  int                                     N_RB_DL;
-  nfapi_dl_config_request_pdu_t           *dl_config_pdu;
-  nfapi_tx_request_pdu_t                  *TX_req;
-  nfapi_dl_config_request_body_t          *dl_req;
-  int                                     i;
-  int                                     rvidx;
-  int                                     absSF = (frameP*10)+subframeP;
-
-
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-    cc              = &eNB->common_channels[CC_id];
-    vrb_map         = (void*)&cc->vrb_map;
-    N_RB_DL         = to_prb(cc->mib->message.dl_Bandwidth);
-    dl_req          = &eNB->DL_req[CC_id].dl_config_request_body;
-
-    // Time-domain scheduling
-    if (cc->mib->message.schedulingInfoSIB1_BR_r13==0) continue;
-    else  {
-
-
-      AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13!=NULL,
-		  "sib_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
-
-      SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13;
-      AssertFatal(schedulingInfoList_BR_r13!=NULL,
-		  "sib_v13ext->schedulingInfoList_BR_r13 is null\n");
-
-      SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList;
-      AssertFatal(schedulingInfoList_BR_r13->list.count==schedulingInfoList->list.count,
-		  "schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n",
-		  schedulingInfoList_BR_r13->list.count,schedulingInfoList->list.count); 
-
-      AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200,
-		  "si_WindowLength_BR_r13 %d > %d\n",
-		  (int)cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13,
-		  SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200);
-
-      // check that SI frequency-hopping is disabled
-      AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13==SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off,
-		  "Deactivate SI_HoppingConfigCommon_r13 in configuration file, not supported for now\n");
-      long si_WindowLength_BR_r13   = si_WindowLength_BR_r13tab[cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13];
-
-      long si_RepetitionPattern_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13;
-      AssertFatal(si_RepetitionPattern_r13<=SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF,
-		  "si_RepetitionPattern_r13 %d > %d\n",
-		  (int)si_RepetitionPattern_r13,
-		  SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF);
-      // cycle through SIB list
-
-      for (i=0;i<schedulingInfoList_BR_r13->list.count;i++) {
-	long si_Periodicity           = schedulingInfoList->list.array[i]->si_Periodicity;
-	long si_Narrowband_r13        = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
-	long si_TBS_r13               = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
-
-	// check if the SI is to be scheduled now
-	int period_in_sf              = 80<<si_Periodicity; // 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms
-	int sf_mod_period             = absSF%period_in_sf;
-	int k                         = sf_mod_period&3;
-	// Note: definition of k and rvidx from 36.321 section 5.3.1
-	rvidx = (((3*k)>>1) + (k&1))&3;
-	
-        if ((sf_mod_period < si_WindowLength_BR_r13) &&
-	    ((frameP&(((1<<si_RepetitionPattern_r13)-1)))==0)) { // this SIB is to be scheduled
-
-	  bcch_sdu_length = mac_rrc_data_req(module_idP,
-					     CC_id,
-					     frameP,
-					     BCCH_SI_BR+i,1,
-					     &cc->BCCH_BR_pdu[i+1].payload[0],
-					     1,
-					     module_idP,
-					     0); // not used in this case
-	  
-	  AssertFatal(bcch_sdu_length>0,"RRC returned 0 bytes for SI-BR %d\n",i);
-	  
-	  if (bcch_sdu_length > 0) {
-	    AssertFatal(bcch_sdu_length <= (si_TBS_r13>>3),
-			"RRC provided bcch with length %d > %d (si_TBS_r13 %d)\n",
-			bcch_sdu_length,(int)(si_TBS_r13>>3),(int)schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13);
-
-	    // allocate all 6 PRBs in narrowband for SIB1_BR
-
-	    // check that SIB1 didn't take this narrowband
-	    if (vrb_map[first_rb] > 0) continue;
-
-	    first_rb = narrowband_to_first_rb(cc,si_Narrowband_r13-1);
-	    vrb_map[first_rb]   = 1;
-	    vrb_map[first_rb+1] = 1;
-	    vrb_map[first_rb+2] = 1;
-	    vrb_map[first_rb+4] = 1;
-	    vrb_map[first_rb+5] = 1;
-
-	    if ((frameP&1023) < 200) LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
-					   module_idP,frameP,subframeP,CC_id,(int)si_Narrowband_r13-1,rvidx,
-					   sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13,
-					   bcch_sdu_length);	    
-
-
-
-	    
-	    dl_config_pdu                                                                  = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-	    memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	    dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; 
-	    dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length                                 = si_TBS_r13>>3;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = eNB->pdu_index[CC_id];
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = 0xFFFF;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;   // format 1A/1B/1D
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;   // localized
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL,first_rb,6);
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2; //QPSK
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = rvidx;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;// first block
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB==1 ) ? 0 : 1;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
-	    //	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4; // 0 dB
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB==1 ) ? 1 : 2;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
-	    // Rel10 fields (for PDSCH starting symbol)
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start                           = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
-	    // Rel13 fields
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type                               = 1; // CEModeA UE
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 1; // SI-BR
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = absSF - sf_mod_period; 
-	    
-	    //	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
-	    dl_req->number_pdu++;
-	    
-	    // Program TX Request
-	    TX_req                                                                = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; 
-	    TX_req->pdu_length                                                    = bcch_sdu_length;
-	    TX_req->pdu_index                                                     = eNB->pdu_index[CC_id]++;
-	    TX_req->num_segments                                                  = 1;
-	    TX_req->segments[0].segment_length                                    = bcch_sdu_length;
-	    TX_req->segments[0].segment_data                                      = cc->BCCH_BR_pdu[i+1].payload;
-	    eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
-	    
-	    if (opt_enabled == 1) {
-	      trace_pdu(1,
-			&cc->BCCH_BR_pdu[i+1].payload[0],
-			bcch_sdu_length,
-			0xffff,
-			4,
-			0xffff,
-			eNB->frame,
-			eNB->subframe,
-			0,
-			0);
-	      LOG_D(OPT,"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
-		    module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
-	    }
-	    if (cc->tdd_Config!=NULL) { //TDD
-	      LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n",
-		    frameP,i,
-		    CC_id,
-		    bcch_sdu_length);
-	    } else {
-	      LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (FDD) for CC_id %d SI-BR %d bytes\n",
-		    frameP,i,
-		    CC_id,
-		    bcch_sdu_length);
-	    }
-	  }
-	} // scheduling in current frame/subframe
-      } //for SI List
-    } // eMTC is activated
-  } // CC_id
-  return;
+    int8_t bcch_sdu_length;
+    int CC_id;
+    eNB_MAC_INST *eNB = RC.mac[module_idP];
+    COMMON_channels_t *cc;
+    uint8_t *vrb_map;
+    int first_rb = -1;
+    int N_RB_DL;
+    nfapi_dl_config_request_pdu_t *dl_config_pdu;
+    nfapi_tx_request_pdu_t *TX_req;
+    nfapi_dl_config_request_body_t *dl_req;
+    int i;
+    int rvidx;
+    int absSF = (frameP * 10) + subframeP;
+    uint16_t sfn_sf = frameP << 4 | subframeP;
+
+
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+
+	cc = &eNB->common_channels[CC_id];
+	vrb_map = (void *) &cc->vrb_map;
+	N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
+	dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
+
+	// Time-domain scheduling
+	if (cc->mib->message.schedulingInfoSIB1_BR_r13 == 0)
+	    continue;
+	else {
+	    AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL,
+			"sib_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
+
+	    SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13;
+	    AssertFatal(schedulingInfoList_BR_r13 != NULL,
+			"sib_v13ext->schedulingInfoList_BR_r13 is null\n");
+
+	    SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList;
+	    AssertFatal(schedulingInfoList_BR_r13->list.count == schedulingInfoList->list.count,
+			"schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n",
+			schedulingInfoList_BR_r13->list.count,
+			schedulingInfoList->list.count);
+
+	    AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200,
+			"si_WindowLength_BR_r13 %d > %d\n",
+			(int) cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13,
+			SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200);
+
+	    // check that SI frequency-hopping is disabled
+	    AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13 == SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off,
+			"Deactivate SI_HoppingConfigCommon_r13 in configuration file, not supported for now\n");
+	    long si_WindowLength_BR_r13 = si_WindowLength_BR_r13tab[cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13];
+
+	    long si_RepetitionPattern_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13;
+	    AssertFatal(si_RepetitionPattern_r13<=SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF,
+			"si_RepetitionPattern_r13 %d > %d\n",
+			(int) si_RepetitionPattern_r13,
+			SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF);
+	    // cycle through SIB list
+
+	    for (i = 0; i < schedulingInfoList_BR_r13->list.count; i++) {
+		long si_Periodicity = schedulingInfoList->list.array[i]->si_Periodicity;
+		long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
+		long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
+
+		// check if the SI is to be scheduled now
+		int period_in_sf = 80 << si_Periodicity;	// 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms
+		int sf_mod_period = absSF % period_in_sf;
+		int k = sf_mod_period & 3;
+		// Note: definition of k and rvidx from 36.321 section 5.3.1
+		rvidx = (((3 * k) >> 1) + (k & 1)) & 3;
+
+		if ((sf_mod_period < si_WindowLength_BR_r13)
+		    && ((frameP & (((1 << si_RepetitionPattern_r13) - 1))) == 0)) {	// this SIB is to be scheduled
+
+		    bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0);	// not used in this case
+
+		    AssertFatal(bcch_sdu_length > 0,
+				"RRC returned 0 bytes for SI-BR %d\n", i);
+
+		    if (bcch_sdu_length > 0) {
+			AssertFatal(bcch_sdu_length <= (si_TBS_r13 >> 3),
+				    "RRC provided bcch with length %d > %d (si_TBS_r13 %d)\n",
+				    bcch_sdu_length,
+				    (int) (si_TBS_r13 >> 3),
+				    (int) schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13);
+
+			// allocate all 6 PRBs in narrowband for SIB1_BR
+
+			// check that SIB1 didn't take this narrowband
+			if (vrb_map[first_rb] > 0) continue;
+
+			first_rb = narrowband_to_first_rb(cc,si_Narrowband_r13 - 1);
+			vrb_map[first_rb] = 1;
+			vrb_map[first_rb + 1] = 1;
+			vrb_map[first_rb + 2] = 1;
+			vrb_map[first_rb + 4] = 1;
+			vrb_map[first_rb + 5] = 1;
+
+			if ((frameP & 1023) < 200)
+			    LOG_D(MAC,
+				  "[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
+				  module_idP, frameP, subframeP, CC_id,
+				  (int) si_Narrowband_r13 - 1, rvidx,
+				  sf_mod_period,
+				  (int) si_WindowLength_BR_r13,
+				  (int) si_RepetitionPattern_r13,
+				  bcch_sdu_length);
+
+
+
+
+			dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+			memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+			dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+			dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+                        dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = si_TBS_r13 >> 3;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2;	// format 1A/1B/1D
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;	// localized
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2;	//QPSK
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rvidx;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;	// first block
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+			//  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4;	// 0 dB
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth);	// ignored
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+			// Rel10 fields (for PDSCH starting symbol)
+                        dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+			// Rel13 fields
+                        dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1;	// CEModeA UE
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1;	// SI-BR
+			dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
+
+			//  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
+			dl_req->number_pdu++;
+                        dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+			// Program TX Request
+			TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+			TX_req->pdu_length = bcch_sdu_length;
+			TX_req->pdu_index = eNB->pdu_index[CC_id]++;
+			TX_req->num_segments = 1;
+			TX_req->segments[0].segment_length = bcch_sdu_length;
+			TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[i + 1].payload;
+			eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+                        eNB->TX_req[CC_id].sfn_sf = sfn_sf;
+                        eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+                        eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
+
+			if (opt_enabled == 1) {
+			    trace_pdu(1,
+				      &cc->BCCH_BR_pdu[i + 1].payload[0],
+				      bcch_sdu_length,
+				      0xffff,
+				      4,
+				      0xffff, eNB->frame, eNB->subframe, 0,
+				      0);
+			    LOG_D(OPT,
+				  "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
+				  module_idP, frameP, CC_id, 0xffff,
+				  bcch_sdu_length);
+			}
+			if (cc->tdd_Config != NULL) {	//TDD
+			    LOG_D(MAC,
+				  "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n",
+				  frameP, i, CC_id, bcch_sdu_length);
+			} else {
+			    LOG_D(MAC,
+				  "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (FDD) for CC_id %d SI-BR %d bytes\n",
+				  frameP, i, CC_id, bcch_sdu_length);
+			}
+		    }
+		}		// scheduling in current frame/subframe
+	    }			//for SI List
+	}			// eMTC is activated
+    }				// CC_id
+    return;
 }
 #endif
 
-void schedule_mib(module_id_t   module_idP,
-		  frame_t       frameP,
-		  sub_frame_t   subframeP) {
-
-  eNB_MAC_INST                   *eNB = RC.mac[module_idP];
-  COMMON_channels_t              *cc;
-  nfapi_dl_config_request_pdu_t  *dl_config_pdu;
-  nfapi_tx_request_pdu_t         *TX_req;
-  int mib_sdu_length;
-  int CC_id;
-  nfapi_dl_config_request_body_t *dl_req;
-
-  AssertFatal(subframeP==0,"Subframe must be 0\n");
-  AssertFatal((frameP&3)==0,"Frame must be a multiple of 4\n");
-
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-    dl_req          = &eNB->DL_req[CC_id].dl_config_request_body;
-    cc              = &eNB->common_channels[CC_id];
-
-    mib_sdu_length = mac_rrc_data_req(module_idP,
-				      CC_id,
-				      frameP,
-				      MIBCH,1,
-				      &cc->MIB_pdu.payload[0],
-				      1,
-				      module_idP,
-				      0); // not used in this case
-
-    LOG_D(MAC,"Frame %d, subframe %d: BCH PDU length %d\n",
-	  frameP,subframeP,mib_sdu_length);
-
-    if (mib_sdu_length > 0) {
-
-      LOG_D(MAC,"Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n",
-	    frameP,subframeP,dl_req->number_pdu,mib_sdu_length);
-
-      if ((frameP&1023) < 40) LOG_D(MAC,"[eNB %d] Frame %d : MIB->BCH  CC_id %d, Received %d bytes (cc->mib->message.schedulingInfoSIB1_BR_r13 %d)\n",module_idP,frameP,CC_id,mib_sdu_length,(int)cc->mib->message.schedulingInfoSIB1_BR_r13);
-
-      dl_config_pdu                                                         = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-      memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-      dl_config_pdu->pdu_type                                               = NFAPI_DL_CONFIG_BCH_PDU_TYPE,
-      dl_config_pdu->pdu_size                                               = 2+sizeof(nfapi_dl_config_bch_pdu);
-      dl_config_pdu->bch_pdu.bch_pdu_rel8.length                            = mib_sdu_length;
-      dl_config_pdu->bch_pdu.bch_pdu_rel8.pdu_index                         = eNB->pdu_index[CC_id];
-      dl_config_pdu->bch_pdu.bch_pdu_rel8.transmission_power                = 6000;
-      dl_req->number_pdu++;
-
-      LOG_D(MAC,"eNB->DL_req[0].number_pdu %d (%p)\n",
-	    dl_req->number_pdu,&dl_req->number_pdu);
-      // DL request
-
-      TX_req                                                                = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; 
-      TX_req->pdu_length                                                    = 3;
-      TX_req->pdu_index                                                     = eNB->pdu_index[CC_id]++;
-      TX_req->num_segments                                                  = 1;
-      TX_req->segments[0].segment_length                                    = 0;
-      TX_req->segments[0].segment_data                                      = cc[CC_id].MIB_pdu.payload;
-      eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+void
+schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
+{
+
+    eNB_MAC_INST *eNB = RC.mac[module_idP];
+    COMMON_channels_t *cc;
+    nfapi_dl_config_request_pdu_t *dl_config_pdu;
+    nfapi_tx_request_pdu_t *TX_req;
+    int mib_sdu_length;
+    int CC_id;
+    nfapi_dl_config_request_t *dl_config_request;
+    nfapi_dl_config_request_body_t *dl_req;
+    uint16_t sfn_sf = frameP << 4 | subframeP;
+
+    AssertFatal(subframeP == 0, "Subframe must be 0\n");
+    AssertFatal((frameP & 3) == 0, "Frame must be a multiple of 4\n");
+
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+
+	dl_config_request = &eNB->DL_req[CC_id];
+	dl_req = &dl_config_request->dl_config_request_body;
+	cc = &eNB->common_channels[CC_id];
+
+	mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0], 0);	// not used in this case
+
+	LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length);
+
+	if (mib_sdu_length > 0) {
+
+	    LOG_D(MAC, "Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n", frameP, subframeP, dl_req->number_pdu, mib_sdu_length);
+
+	    if ((frameP & 1023) < 40)
+#ifdef Rel14
+		LOG_D(MAC,
+		      "[eNB %d] Frame %d : MIB->BCH  CC_id %d, Received %d bytes (cc->mib->message.schedulingInfoSIB1_BR_r13 %d)\n",
+		      module_idP, frameP, CC_id, mib_sdu_length,
+		      (int) cc->mib->message.schedulingInfoSIB1_BR_r13);
+#else
+		LOG_D(MAC,
+		      "[eNB %d] Frame %d : MIB->BCH  CC_id %d, Received %d bytes\n",
+		      module_idP, frameP, CC_id, mib_sdu_length);
+#endif
+
+	    dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+	    memset((void *) dl_config_pdu, 0,
+		   sizeof(nfapi_dl_config_request_pdu_t));
+	    dl_config_pdu->pdu_type                                = NFAPI_DL_CONFIG_BCH_PDU_TYPE, dl_config_pdu->pdu_size =
+		2 + sizeof(nfapi_dl_config_bch_pdu);
+            dl_config_pdu->bch_pdu.bch_pdu_rel8.tl.tag             = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
+	    dl_config_pdu->bch_pdu.bch_pdu_rel8.length             = mib_sdu_length;
+	    dl_config_pdu->bch_pdu.bch_pdu_rel8.pdu_index          = eNB->pdu_index[CC_id];
+	    dl_config_pdu->bch_pdu.bch_pdu_rel8.transmission_power = 6000;
+            dl_req->tl.tag                                         = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+	    dl_req->number_pdu++;
+
+            dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
+            dl_config_request->sfn_sf = sfn_sf;
+
+	    LOG_D(MAC, "eNB->DL_req[0].number_pdu %d (%p)\n", dl_req->number_pdu, &dl_req->number_pdu);
+	    // DL request
+
+	    TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+	    TX_req->pdu_length = 3;
+	    TX_req->pdu_index = eNB->pdu_index[CC_id]++;
+	    TX_req->num_segments = 1;
+	    TX_req->segments[0].segment_length = 3;
+	    TX_req->segments[0].segment_data = cc[CC_id].MIB_pdu.payload;
+	    eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+            eNB->TX_req[CC_id].sfn_sf = sfn_sf;
+            eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+            eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
+	}
     }
-  }
 }
 
 
 //------------------------------------------------------------------------------
 void
-schedule_SI(
-  module_id_t   module_idP,
-  frame_t       frameP,
-  sub_frame_t   subframeP)
-
+schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 //------------------------------------------------------------------------------
 {
 
-  int8_t                         bcch_sdu_length;
-  int                            mcs = -1;
-  int                            CC_id;
-  eNB_MAC_INST                   *eNB = RC.mac[module_idP];
-  COMMON_channels_t              *cc;
-  uint8_t                        *vrb_map;
-  int                            first_rb = -1;
-  int                            N_RB_DL;
-  nfapi_dl_config_request_pdu_t  *dl_config_pdu;
-  nfapi_tx_request_pdu_t         *TX_req;
-  nfapi_dl_config_request_body_t *dl_req;
-
-  start_meas(&eNB->schedule_si);
-  
-  // Only schedule LTE System Information in subframe 5
-  if (subframeP == 5) {
-
-    for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      
-      cc              = &eNB->common_channels[CC_id];
-      vrb_map         = (void*)&cc->vrb_map;
-      N_RB_DL         = to_prb(cc->mib->message.dl_Bandwidth); 
-      dl_req          = &eNB->DL_req[CC_id].dl_config_request_body;
-      
-      
-      bcch_sdu_length = mac_rrc_data_req(module_idP,
-					 CC_id,
-					 frameP,
-					 BCCH,1,
-					 &cc->BCCH_pdu.payload[0],
-					 1,
-					 module_idP,
-					 0); // not used in this case
-      
-      if (bcch_sdu_length > 0) {
-	LOG_D(MAC,"[eNB %d] Frame %d : BCCH->DLSCH CC_id %d, Received %d bytes \n",module_idP,frameP,CC_id,bcch_sdu_length);
-	
-	// Allocate 4 PRBs in a random location
-	/*
-	  while (1) {
-	  first_rb = (unsigned char)(taus()%(PHY_vars_eNB_g[module_idP][CC_id]->frame_parms.N_RB_DL-4));
-	  if ((vrb_map[first_rb] != 1) && 
-	  (vrb_map[first_rb+1] != 1) && 
-	  (vrb_map[first_rb+2] != 1) && 
-	  (vrb_map[first_rb+3] != 1))
-	  break;
-	  }
-	*/
-	switch (N_RB_DL) {
-	case 6:
-	  first_rb = 0;
-	  break;
-	case 15:
-	  first_rb = 6;
-	  break;
-	case 25:
-	  first_rb = 11;
-	  break;
-	case 50:
-	  first_rb = 23;
-	  break;
-	case 100:
-	  first_rb = 48;
-	  break;
-	}
-	
-	vrb_map[first_rb] = 1;
-	vrb_map[first_rb+1] = 1;
-	vrb_map[first_rb+2] = 1;
-	vrb_map[first_rb+3] = 1;
-	
-	// Get MCS for length of SI, 3 PRBs
-	if (bcch_sdu_length <= 7) {
-	  mcs=0;
-	} else if (bcch_sdu_length <= 11) {
-	  mcs=1;
-	} else if (bcch_sdu_length <= 18) {
-	  mcs=2;
-	} else if (bcch_sdu_length <= 22) {
-	  mcs=3;
-	} else if (bcch_sdu_length <= 26) {
-	  mcs=4;
-	} else if (bcch_sdu_length <= 28) {
-	  mcs=5;
-	} else if (bcch_sdu_length <= 32) {
-	  mcs=6;
-	} else if (bcch_sdu_length <= 41) {
-	  mcs=7;
-	} else if (bcch_sdu_length <= 49) {
-	  mcs=8;
-	}
-	
-	
-	dl_config_pdu                                                         = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-	memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	dl_config_pdu->pdu_type                                               = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; 
-	dl_config_pdu->pdu_size                                               = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format                  = NFAPI_DL_DCI_FORMAT_1A;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level           = 4;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti                        = 0xFFFF;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type                   = 2;    // S-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power          = 6000; // equal to RS power
-	
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process                = 0;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc                         = 1; // no TPC
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1        = 0;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1                       = mcs;
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1        = 0;
-	
-	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding       = getRIV(N_RB_DL,first_rb,4);      
+    int8_t bcch_sdu_length;
+    int mcs = -1;
+    int CC_id;
+    eNB_MAC_INST *eNB = RC.mac[module_idP];
+    COMMON_channels_t *cc;
+    uint8_t *vrb_map;
+    int first_rb = -1;
+    int N_RB_DL;
+    nfapi_dl_config_request_t      *dl_config_request;
+    nfapi_dl_config_request_pdu_t  *dl_config_pdu;
+    nfapi_tx_request_pdu_t *TX_req;
+    nfapi_dl_config_request_body_t *dl_req;
+    uint16_t sfn_sf = frameP << 4 | subframeP;
+
+    start_meas(&eNB->schedule_si);
+
+    // Only schedule LTE System Information in subframe 5
+    if (subframeP == 5) {
+
+	for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+
+	    cc = &eNB->common_channels[CC_id];
+	    vrb_map = (void *) &cc->vrb_map;
+	    N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
+            dl_config_request = &eNB->DL_req[CC_id];
+	    dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
+
+
+	    bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 1, &cc->BCCH_pdu.payload[0], 0);	// not used in this case
+
+	    if (bcch_sdu_length > 0) {
+		LOG_D(MAC, "[eNB %d] Frame %d : BCCH->DLSCH CC_id %d, Received %d bytes \n", module_idP, frameP, CC_id, bcch_sdu_length);
+
+		// Allocate 4 PRBs in a random location
+		/*
+		   while (1) {
+		   first_rb = (unsigned char)(taus()%(PHY_vars_eNB_g[module_idP][CC_id]->frame_parms.N_RB_DL-4));
+		   if ((vrb_map[first_rb] != 1) && 
+		   (vrb_map[first_rb+1] != 1) && 
+		   (vrb_map[first_rb+2] != 1) && 
+		   (vrb_map[first_rb+3] != 1))
+		   break;
+		   }
+		 */
+		switch (N_RB_DL) {
+		case 6:
+		    first_rb = 0;
+		    break;
+		case 15:
+		    first_rb = 6;
+		    break;
+		case 25:
+		    first_rb = 11;
+		    break;
+		case 50:
+		    first_rb = 23;
+		    break;
+		case 100:
+		    first_rb = 48;
+		    break;
+		}
+
+		vrb_map[first_rb] = 1;
+		vrb_map[first_rb + 1] = 1;
+		vrb_map[first_rb + 2] = 1;
+		vrb_map[first_rb + 3] = 1;
+
+		// Get MCS for length of SI, 3 PRBs
+		if (bcch_sdu_length <= 7) {
+		    mcs = 0;
+		} else if (bcch_sdu_length <= 11) {
+		    mcs = 1;
+		} else if (bcch_sdu_length <= 18) {
+		    mcs = 2;
+		} else if (bcch_sdu_length <= 22) {
+		    mcs = 3;
+		} else if (bcch_sdu_length <= 26) {
+		    mcs = 4;
+		} else if (bcch_sdu_length <= 28) {
+		    mcs = 5;
+		} else if (bcch_sdu_length <= 32) {
+		    mcs = 6;
+		} else if (bcch_sdu_length <= 41) {
+		    mcs = 7;
+		} else if (bcch_sdu_length <= 49) {
+		    mcs = 8;
+		}
+
+
+		dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+		memset((void *) dl_config_pdu, 0,
+		       sizeof(nfapi_dl_config_request_pdu_t));
+		dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
+		dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+                dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag                = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format            = NFAPI_DL_DCI_FORMAT_1A;
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level     = 4;
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti                  = 0xFFFF;
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type             = 2;	// S-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power    = 6000;	// equal to RS power
+
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process          = 0;
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc                   = 1;	// no TPC
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1  = 0;
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1                 = mcs;
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1  = 0;
+
+		dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4);
+                dl_config_request->sfn_sf = sfn_sf;
+
+		if (!CCE_allocation_infeasible(module_idP, CC_id, 0, subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, SI_RNTI)) {
+		    LOG_D(MAC, "Frame %d: Subframe %d : Adding common DCI for S_RNTI\n", frameP, subframeP);
+		    dl_req->number_dci++;
+		    dl_req->number_pdu++;
+		    dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+		    memset((void *) dl_config_pdu, 0,
+			   sizeof(nfapi_dl_config_request_pdu_t));
+		    dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+		    dl_config_pdu->pdu_size                                                        = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = eNB->pdu_index[CC_id];
+                    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag                                 = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length                                 = bcch_sdu_length;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = 0xFFFF;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;	// format 1A/1B/1D
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;	// localized
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL, first_rb, 4);
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2;	//QPSK
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = 0;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;	// first block
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB == 1) ? 0 : 1;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
+		    //    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4;	// 0 dB
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth);	// ignored
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB == 1) ? 1 : 2;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
+		    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
+		    //    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
+		    dl_req->number_pdu++;
+
+                    // Rel10 fields
+                    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag                                = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+                    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start                           = 3;
+                    // Rel13 fields
+                    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag                                = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
+                    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type                               = 0;   // regular UE
+                    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 2;        // not BR
+                    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = 0xFFFF;   // absolute SF
+
+                    dl_config_request->header.message_id                                           = NFAPI_DL_CONFIG_REQUEST;
+                    dl_config_request->sfn_sf                                                      = sfn_sf;
+
+		    // Program TX Request
+		    TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+		    TX_req->pdu_length = bcch_sdu_length;
+		    TX_req->pdu_index = eNB->pdu_index[CC_id]++;
+		    TX_req->num_segments = 1;
+		    TX_req->segments[0].segment_length = bcch_sdu_length;
+		    TX_req->segments[0].segment_data = cc->BCCH_pdu.payload;
+		    eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+                    eNB->TX_req[CC_id].sfn_sf = sfn_sf;
+                    eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+                    eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
+
+		} else {
+		    LOG_E(MAC,
+			  "[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A for SI\n",
+			  module_idP, CC_id, frameP, subframeP);
+		}
+
+		if (opt_enabled == 1) {
+		    trace_pdu(1,
+			      &cc->BCCH_pdu.payload[0],
+			      bcch_sdu_length,
+			      0xffff,
+			      4, 0xffff, eNB->frame, eNB->subframe, 0, 0);
+		    LOG_D(OPT,
+			  "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
+			  module_idP, frameP, CC_id, 0xffff,
+			  bcch_sdu_length);
+		}
+		if (cc->tdd_Config != NULL) {	//TDD
+		    LOG_D(MAC,
+			  "[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n",
+			  frameP, CC_id, bcch_sdu_length, mcs);
+		} else {
+		    LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", frameP, CC_id, bcch_sdu_length, mcs);
+		}
+
+
+		eNB->eNB_stats[CC_id].total_num_bcch_pdu += 1;
+		eNB->eNB_stats[CC_id].bcch_buffer = bcch_sdu_length;
+		eNB->eNB_stats[CC_id].total_bcch_buffer += bcch_sdu_length;
+		eNB->eNB_stats[CC_id].bcch_mcs = mcs;
+	    } else {
 
-	// Rel10 fields
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start                           = 3;
-	// Rel13 fields
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type                               = 0; // regular UE
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 2; // not BR
-	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = 0xFFFF; // absolute SF	
-
-	if (!CCE_allocation_infeasible(module_idP,CC_id,0,subframeP,
-				       dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,SI_RNTI)) {
-	  LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for S_RNTI\n",
-		frameP,subframeP);
-	  dl_req->number_dci++;
-	  dl_req->number_pdu++;
-	  dl_config_pdu                                                                  = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-	  memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	  dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; 
-	  dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = eNB->pdu_index[CC_id];
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = 0xFFFF;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;   // format 1A/1B/1D
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;   // localized
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(N_RB_DL,first_rb,4);
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2; //QPSK
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = 0;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;// first block
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB==1 ) ? 0 : 1;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
-	  //	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4; // 0 dB
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB==1 ) ? 1 : 2;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
-	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
-	  //	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ; 
-	  dl_req->number_pdu++;
-	  
-	  // Program TX Request
-	  TX_req                                                                = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; 
-	  TX_req->pdu_length                                                    = bcch_sdu_length;
-	  TX_req->pdu_index                                                     = eNB->pdu_index[CC_id]++;
-	  TX_req->num_segments                                                  = 1;
-	  TX_req->segments[0].segment_length                                    = bcch_sdu_length;
-	  TX_req->segments[0].segment_data                                      = cc->BCCH_pdu.payload;
-	  eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
-	  
-	}
-	else {
-	  LOG_E(MAC,"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A for SI\n",module_idP, CC_id,frameP,subframeP);
-	}
-	
-	if (opt_enabled == 1) {
-	  trace_pdu(1,
-		    &cc->BCCH_pdu.payload[0],
-		    bcch_sdu_length,
-		    0xffff,
-		    4,
-		    0xffff,
-		    eNB->frame,
-		    eNB->subframe,
-		    0,
-		    0);
-	  LOG_D(OPT,"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
-		module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
-	}
-	if (cc->tdd_Config!=NULL) { //TDD
-	  LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n",
-		frameP,
-		CC_id,
-		bcch_sdu_length,
-		mcs);
-	} else {
-	  LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n",
-		frameP,
-		CC_id,
-		bcch_sdu_length,
-		mcs);
+		//LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame);
+	    }
 	}
-	
-	
-	eNB->eNB_stats[CC_id].total_num_bcch_pdu+=1;
-	eNB->eNB_stats[CC_id].bcch_buffer=bcch_sdu_length;
-	eNB->eNB_stats[CC_id].total_bcch_buffer+=bcch_sdu_length;
-	eNB->eNB_stats[CC_id].bcch_mcs=mcs;
-      } else {
-	
-	//LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame);
-      }
     }
-  }
-
 #ifdef Rel14
-  schedule_SIB1_BR(module_idP,frameP,subframeP);
-  schedule_SI_BR(module_idP,frameP,subframeP);
+    schedule_SIB1_BR(module_idP, frameP, subframeP);
+    schedule_SI_BR(module_idP, frameP, subframeP);
 #endif
 
   stop_meas(&eNB->schedule_si);
-  return;
 }
- 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index 80c35adbcec04d06e805c2a56f9f569b5677a0c2..0729073eba3cc5e6ca1351603329d83c095497bc 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -51,35 +51,74 @@
 //#include "LAYER2/MAC/pre_processor.c"
 #include "pdcp.h"
 
-#include "SIMULATION/TOOLS/defs.h" // for taus
+#include "SIMULATION/TOOLS/defs.h"	// for taus
 
 #if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+#include "intertask_interface.h"
 #endif
 
+#include "ENB_APP/flexran_agent_defs.h"
+#include "flexran_agent_ran_api.h"
+#include "header.pb-c.h"
+#include "flexran.pb-c.h"
+#include <dlfcn.h>
+
 #include "T.h"
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
 //#define DEBUG_eNB_SCHEDULER 1
 
 extern RAN_CONTEXT_t RC;
+extern uint8_t nfapi_mode;
+
+
+// number of active slices for  past and current time
+int n_active_slices = 1;
+int n_active_slices_current = 1;
+
+// RB share for each slice for past and current time
+float avg_slice_percentage=0.25;
+float slice_percentage[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
+float slice_percentage_current[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
+float total_slice_percentage = 0;
+float total_slice_percentage_current = 0;
+
+// MAX MCS for each slice for past and current time
+int slice_maxmcs[MAX_NUM_SLICES] = { 28, 28, 28, 28 };
+int slice_maxmcs_current[MAX_NUM_SLICES] = { 28, 28, 28, 28 };
+
+int update_dl_scheduler[MAX_NUM_SLICES] = { 1, 1, 1, 1 };
+int update_dl_scheduler_current[MAX_NUM_SLICES] = { 1, 1, 1, 1 };
+
+// name of available scheduler
+char *dl_scheduler_type[MAX_NUM_SLICES] =
+  { "schedule_ue_spec",
+    "schedule_ue_spec",
+    "schedule_ue_spec",
+    "schedule_ue_spec"
+  };
+
+// The lists of criteria that enforce the sorting policies of the slices
+uint32_t sorting_policy[MAX_NUM_SLICES] = {0x01234, 0x01234, 0x01234, 0x01234};
+uint32_t sorting_policy_current[MAX_NUM_SLICES] = {0x01234, 0x01234, 0x01234, 0x01234};
+
+// pointer to the slice specific scheduler
+slice_scheduler_dl slice_sched_dl[MAX_NUM_SLICES] = {0};
 
 //------------------------------------------------------------------------------
 void
-add_ue_dlsch_info(
-  module_id_t module_idP,
-  int CC_id,
-  int UE_id,
-  sub_frame_t subframeP,
-  UE_DLSCH_STATUS status
-)
+add_ue_dlsch_info(module_id_t module_idP,
+		  int CC_id,
+		  int UE_id, sub_frame_t subframeP, UE_DLSCH_STATUS status)
 //------------------------------------------------------------------------------
 {
+  //LOG_D(MAC, "%s(module_idP:%d, CC_id:%d, UE_id:%d, subframeP:%d, status:%d) serving_num:%d rnti:%x\n", __FUNCTION__, module_idP, CC_id, UE_id, subframeP, status, eNB_dlsch_info[module_idP][CC_id][UE_id].serving_num, UE_RNTI(module_idP,UE_id));
 
-  eNB_dlsch_info[module_idP][CC_id][UE_id].rnti             = UE_RNTI(module_idP,UE_id);
+  eNB_dlsch_info[module_idP][CC_id][UE_id].rnti =
+    UE_RNTI(module_idP, UE_id);
   //  eNB_dlsch_info[module_idP][CC_id][ue_mod_idP].weight           = weight;
-  eNB_dlsch_info[module_idP][CC_id][UE_id].subframe         = subframeP;
-  eNB_dlsch_info[module_idP][CC_id][UE_id].status           = status;
+  eNB_dlsch_info[module_idP][CC_id][UE_id].subframe = subframeP;
+  eNB_dlsch_info[module_idP][CC_id][UE_id].status = status;
 
   eNB_dlsch_info[module_idP][CC_id][UE_id].serving_num++;
 
@@ -87,180 +126,178 @@ add_ue_dlsch_info(
 
 //------------------------------------------------------------------------------
 int
-schedule_next_dlue(
-  module_id_t module_idP,
-  int CC_id,
-  sub_frame_t subframeP
-)
+schedule_next_dlue(module_id_t module_idP, int CC_id,
+		   sub_frame_t subframeP)
 //------------------------------------------------------------------------------
 {
 
   int next_ue;
-  UE_list_t *UE_list=&RC.mac[module_idP]->UE_list;
+  UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
 
-  for (next_ue=UE_list->head; next_ue>=0; next_ue=UE_list->next[next_ue] ) {
-    if  (eNB_dlsch_info[module_idP][CC_id][next_ue].status == S_DL_WAITING) {
+  for (next_ue = UE_list->head; next_ue >= 0;
+       next_ue = UE_list->next[next_ue]) {
+    if (eNB_dlsch_info[module_idP][CC_id][next_ue].status ==
+	S_DL_WAITING) {
       return next_ue;
     }
   }
 
-  for (next_ue=UE_list->head; next_ue>=0; next_ue=UE_list->next[next_ue] ) {
-    if  (eNB_dlsch_info[module_idP][CC_id][next_ue].status == S_DL_BUFFERED) {
+  for (next_ue = UE_list->head; next_ue >= 0;
+       next_ue = UE_list->next[next_ue]) {
+    if (eNB_dlsch_info[module_idP][CC_id][next_ue].status == S_DL_BUFFERED) {
       eNB_dlsch_info[module_idP][CC_id][next_ue].status = S_DL_WAITING;
     }
   }
 
-  return(-1);//next_ue;
+  return (-1);		//next_ue;
 
 }
 
 //------------------------------------------------------------------------------
-unsigned char
-generate_dlsch_header(
-  unsigned char* mac_header,
-  unsigned char num_sdus,
-  unsigned short *sdu_lengths,
-  unsigned char *sdu_lcids,
-  unsigned char drx_cmd,
-  unsigned short timing_advance_cmd,
-  unsigned char *ue_cont_res_id,
-  unsigned char short_padding,
-  unsigned short post_padding
-)
+int
+generate_dlsch_header(unsigned char *mac_header,
+		      unsigned char num_sdus,
+		      unsigned short *sdu_lengths,
+		      unsigned char *sdu_lcids,
+		      unsigned char drx_cmd,
+		      unsigned short timing_advance_cmd,
+		      unsigned char *ue_cont_res_id,
+		      unsigned char short_padding,
+		      unsigned short post_padding)
 //------------------------------------------------------------------------------
 {
 
-  SCH_SUBHEADER_FIXED *mac_header_ptr = (SCH_SUBHEADER_FIXED *)mac_header;
-  uint8_t first_element=0,last_size=0,i;
-  uint8_t mac_header_control_elements[16],*ce_ptr;
+  SCH_SUBHEADER_FIXED *mac_header_ptr = (SCH_SUBHEADER_FIXED *) mac_header;
+  uint8_t first_element = 0, last_size = 0, i;
+  uint8_t mac_header_control_elements[16], *ce_ptr;
 
   ce_ptr = &mac_header_control_elements[0];
 
   // compute header components
 
   if ((short_padding == 1) || (short_padding == 2)) {
-    mac_header_ptr->R    = 0;
-    mac_header_ptr->E    = 0;
+    mac_header_ptr->R = 0;
+    mac_header_ptr->E = 0;
     mac_header_ptr->LCID = SHORT_PADDING;
-    first_element=1;
-    last_size=1;
+    first_element = 1;
+    last_size = 1;
   }
 
   if (short_padding == 2) {
     mac_header_ptr->E = 1;
     mac_header_ptr++;
     mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
+    mac_header_ptr->E = 0;
     mac_header_ptr->LCID = SHORT_PADDING;
-    last_size=1;
+    last_size = 1;
   }
 
   if (drx_cmd != 255) {
-    if (first_element>0) {
+    if (first_element > 0) {
       mac_header_ptr->E = 1;
       mac_header_ptr++;
     } else {
-      first_element=1;
+      first_element = 1;
     }
 
     mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
+    mac_header_ptr->E = 0;
     mac_header_ptr->LCID = DRX_CMD;
-    last_size=1;
+    last_size = 1;
   }
 
   if (timing_advance_cmd != 31) {
-    if (first_element>0) {
+    if (first_element > 0) {
       mac_header_ptr->E = 1;
       mac_header_ptr++;
     } else {
-      first_element=1;
+      first_element = 1;
     }
 
     mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
+    mac_header_ptr->E = 0;
     mac_header_ptr->LCID = TIMING_ADV_CMD;
-    last_size=1;
+    last_size = 1;
     //    msg("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr);
-    ((TIMING_ADVANCE_CMD *)ce_ptr)->R=0;
-    AssertFatal(timing_advance_cmd < 64,"timing_advance_cmd %d > 63\n",timing_advance_cmd);
-    ((TIMING_ADVANCE_CMD *)ce_ptr)->TA=timing_advance_cmd;//(timing_advance_cmd+31)&0x3f;
-    LOG_D(MAC,"timing advance =%d (%d)\n",timing_advance_cmd,((TIMING_ADVANCE_CMD *)ce_ptr)->TA);
-    ce_ptr+=sizeof(TIMING_ADVANCE_CMD);
+    ((TIMING_ADVANCE_CMD *) ce_ptr)->R = 0;
+    AssertFatal(timing_advance_cmd < 64,
+		"timing_advance_cmd %d > 63\n", timing_advance_cmd);
+    ((TIMING_ADVANCE_CMD *) ce_ptr)->TA = timing_advance_cmd;	//(timing_advance_cmd+31)&0x3f;
+    LOG_D(MAC, "timing advance =%d (%d)\n", timing_advance_cmd,
+	  ((TIMING_ADVANCE_CMD *) ce_ptr)->TA);
+    ce_ptr += sizeof(TIMING_ADVANCE_CMD);
     //msg("offset %d\n",ce_ptr-mac_header_control_elements);
   }
 
   if (ue_cont_res_id) {
-    if (first_element>0) {
+    if (first_element > 0) {
       mac_header_ptr->E = 1;
       /*
-      printf("[eNB][MAC] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
+	printf("[eNB][MAC] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
+	((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
+	((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
+	((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
       */
       mac_header_ptr++;
     } else {
-      first_element=1;
+      first_element = 1;
     }
 
     mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
+    mac_header_ptr->E = 0;
     mac_header_ptr->LCID = UE_CONT_RES;
-    last_size=1;
-
-    LOG_T(MAC,"[eNB ][RAPROC] Generate contention resolution msg: %x.%x.%x.%x.%x.%x\n",
-          ue_cont_res_id[0],
-          ue_cont_res_id[1],
-          ue_cont_res_id[2],
-          ue_cont_res_id[3],
-          ue_cont_res_id[4],
-          ue_cont_res_id[5]);
-
-    memcpy(ce_ptr,ue_cont_res_id,6);
-    ce_ptr+=6;
+    last_size = 1;
+
+    LOG_T(MAC,
+	  "[eNB ][RAPROC] Generate contention resolution msg: %x.%x.%x.%x.%x.%x\n",
+	  ue_cont_res_id[0], ue_cont_res_id[1], ue_cont_res_id[2],
+	  ue_cont_res_id[3], ue_cont_res_id[4], ue_cont_res_id[5]);
+
+    memcpy(ce_ptr, ue_cont_res_id, 6);
+    ce_ptr += 6;
     // msg("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
   }
-
   //msg("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr);
 
-  for (i=0; i<num_sdus; i++) {
-    LOG_T(MAC,"[eNB] Generate DLSCH header num sdu %d len sdu %d\n",num_sdus, sdu_lengths[i]);
+  for (i = 0; i < num_sdus; i++) {
+    LOG_T(MAC, "[eNB] Generate DLSCH header num sdu %d len sdu %d\n",
+	  num_sdus, sdu_lengths[i]);
 
-    if (first_element>0) {
+    if (first_element > 0) {
       mac_header_ptr->E = 1;
       /*msg("last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
+	((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
+	((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
+	((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
       */
-      mac_header_ptr+=last_size;
+      mac_header_ptr += last_size;
       //msg("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr);
     } else {
-      first_element=1;
+      first_element = 1;
     }
 
     if (sdu_lengths[i] < 128) {
-      ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R    = 0;
-      ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E    = 0;
-      ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F    = 0;
-      ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID = sdu_lcids[i];
-      ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L    = (unsigned char)sdu_lengths[i];
-      last_size=2;
+      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->R = 0;
+      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->E = 0;
+      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->F = 0;
+      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->LCID = sdu_lcids[i];
+      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L = (unsigned char) sdu_lengths[i];
+      last_size = 2;
     } else {
-      ((SCH_SUBHEADER_LONG *)mac_header_ptr)->R    = 0;
-      ((SCH_SUBHEADER_LONG *)mac_header_ptr)->E    = 0;
-      ((SCH_SUBHEADER_LONG *)mac_header_ptr)->F    = 1;
-      ((SCH_SUBHEADER_LONG *)mac_header_ptr)->LCID = sdu_lcids[i];
-      ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_MSB    = ((unsigned short) sdu_lengths[i]>>8)&0x7f;
-      ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_LSB    = (unsigned short) sdu_lengths[i]&0xff;
-      ((SCH_SUBHEADER_LONG *)mac_header_ptr)->padding   = 0x00;
-      last_size=3;
+      ((SCH_SUBHEADER_LONG *) mac_header_ptr)->R = 0;
+      ((SCH_SUBHEADER_LONG *) mac_header_ptr)->E = 0;
+      ((SCH_SUBHEADER_LONG *) mac_header_ptr)->F = 1;
+      ((SCH_SUBHEADER_LONG *) mac_header_ptr)->LCID = sdu_lcids[i];
+      ((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_MSB = ((unsigned short) sdu_lengths[i] >> 8) & 0x7f;
+      ((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_LSB = (unsigned short) sdu_lengths[i] & 0xff;
+      ((SCH_SUBHEADER_LONG *) mac_header_ptr)->padding = 0x00;
+      last_size = 3;
 #ifdef DEBUG_HEADER_PARSING
-      LOG_D(MAC,"[eNB] generate long sdu, size %x (MSB %x, LSB %x)\n",
-            sdu_lengths[i],
-            ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_MSB,
-            ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_LSB);
+      LOG_D(MAC,
+	    "[eNB] generate long sdu, size %x (MSB %x, LSB %x)\n",
+	    sdu_lengths[i],
+	    ((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_MSB,
+	    ((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_LSB);
 #endif
     }
   }
@@ -282,52 +319,49 @@ generate_dlsch_header(
     printf("F = 1, sdu len (L field) %d\n",(((SCH_SUBHEADER_LONG*)mac_header_ptr)->L));
     }
   */
-  if (post_padding>0) {// we have lots of padding at the end of the packet
+  if (post_padding > 0) {	// we have lots of padding at the end of the packet
     mac_header_ptr->E = 1;
-    mac_header_ptr+=last_size;
+    mac_header_ptr += last_size;
     // add a padding element
-    mac_header_ptr->R    = 0;
-    mac_header_ptr->E    = 0;
+    mac_header_ptr->R = 0;
+    mac_header_ptr->E = 0;
     mac_header_ptr->LCID = SHORT_PADDING;
     mac_header_ptr++;
-  } else { // no end of packet padding
+  } else {			// no end of packet padding
     // last SDU subhead is of fixed type (sdu length implicitly to be computed at UE)
     mac_header_ptr++;
   }
 
   //msg("After subheaders %d\n",(uint8_t*)mac_header_ptr - mac_header);
 
-  if ((ce_ptr-mac_header_control_elements) > 0) {
+  if ((ce_ptr - mac_header_control_elements) > 0) {
     // printf("Copying %d bytes for control elements\n",ce_ptr-mac_header_control_elements);
-    memcpy((void*)mac_header_ptr,mac_header_control_elements,ce_ptr-mac_header_control_elements);
-    mac_header_ptr+=(unsigned char)(ce_ptr-mac_header_control_elements);
+    memcpy((void *) mac_header_ptr, mac_header_control_elements,
+	   ce_ptr - mac_header_control_elements);
+    mac_header_ptr +=
+      (unsigned char) (ce_ptr - mac_header_control_elements);
   }
-
   //msg("After CEs %d\n",(uint8_t*)mac_header_ptr - mac_header);
 
-  return((unsigned char*)mac_header_ptr - mac_header);
-
+  return ((unsigned char *) mac_header_ptr - mac_header);
 }
 
 //------------------------------------------------------------------------------
 void
-set_ul_DAI(
-  int module_idP,
-  int UE_idP,
-  int CC_idP,
-  int frameP,
-  int subframeP
-) 
+set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP,
+	   int subframeP)
 //------------------------------------------------------------------------------
 {
 
-  eNB_MAC_INST         *eNB      = RC.mac[module_idP];
-  UE_list_t            *UE_list  = &eNB->UE_list;
-  unsigned char         DAI;
-  COMMON_channels_t    *cc       = &eNB->common_channels[CC_idP];
-  if (cc->tdd_Config != NULL) {  //TDD
-    DAI = (UE_list->UE_template[CC_idP][UE_idP].DAI-1)&3;
-    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframe %d: DAI %d for UE %d\n",module_idP,CC_idP,frameP,subframeP,DAI,UE_idP);
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+  UE_list_t *UE_list = &eNB->UE_list;
+  unsigned char DAI;
+  COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
+  if (cc->tdd_Config != NULL) {	//TDD
+    DAI = (UE_list->UE_template[CC_idP][UE_idP].DAI - 1) & 3;
+    LOG_D(MAC,
+	  "[eNB %d] CC_id %d Frame %d, subframe %d: DAI %d for UE %d\n",
+	  module_idP, CC_idP, frameP, subframeP, DAI, UE_idP);
     // Save DAI for Format 0 DCI
 
     switch (cc->tdd_Config->subframeAssignment) {
@@ -338,20 +372,20 @@ set_ul_DAI(
     case 1:
       switch (subframeP) {
       case 1:
-        UE_list->UE_template[CC_idP][UE_idP].DAI_ul[7] = DAI;
-        break;
+	UE_list->UE_template[CC_idP][UE_idP].DAI_ul[7] = DAI;
+	break;
 
       case 4:
-        UE_list->UE_template[CC_idP][UE_idP].DAI_ul[8] = DAI;
-        break;
+	UE_list->UE_template[CC_idP][UE_idP].DAI_ul[8] = DAI;
+	break;
 
       case 6:
-        UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI;
-        break;
+	UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI;
+	break;
 
       case 9:
-        UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI;
-        break;
+	UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI;
+	break;
       }
 
     case 2:
@@ -369,21 +403,21 @@ set_ul_DAI(
       case 5:
       case 6:
       case 1:
-        UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI;
-        break;
+	UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI;
+	break;
 
       case 7:
       case 8:
-        UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI;
-        break;
+	UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI;
+	break;
 
       case 9:
       case 0:
-        UE_list->UE_template[CC_idP][UE_idP].DAI_ul[4] = DAI;
-        break;
+	UE_list->UE_template[CC_idP][UE_idP].DAI_ul[4] = DAI;
+	break;
 
       default:
-        break;
+	break;
       }
 
       break;
@@ -409,64 +443,170 @@ set_ul_DAI(
   }
 }
 
+//------------------------------------------------------------------------------
+void
+schedule_dlsch(module_id_t module_idP,
+	        frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag)
+//------------------------------------------------------------------------------{
+{
+
+  int i = 0;
+
+  total_slice_percentage=0;
+  avg_slice_percentage=1.0/n_active_slices;
+
+  // reset the slice percentage for inactive slices
+  for (i = n_active_slices; i< MAX_NUM_SLICES; i++) {
+    slice_percentage[i]=0;
+  }
+  for (i = 0; i < n_active_slices; i++) {
+    if (slice_percentage[i] < 0 ){
+      LOG_W(MAC, "[eNB %d] frame %d subframe %d:invalid slice %d percentage %f. resetting to zero",
+	    module_idP, frameP, subframeP, i, slice_percentage[i]);
+      slice_percentage[i]=0;
+    }
+    total_slice_percentage+=slice_percentage[i];
+  }
+
+  for (i = 0; i < n_active_slices; i++) {
+
+    // Load any updated functions
+    if (update_dl_scheduler[i] > 0 ) {
+      slice_sched_dl[i] = dlsym(NULL, dl_scheduler_type[i]);
+      update_dl_scheduler[i] = 0 ;
+      update_dl_scheduler_current[i] = 0;
+      LOG_N(MAC,"update dl scheduler slice %d\n", i);
+    }
+
+    if (total_slice_percentage <= 1.0){ // the new total RB share is within the range
+
+      // check if the number of slices has changed, and log
+      if (n_active_slices_current != n_active_slices ){
+	if ((n_active_slices > 0) && (n_active_slices <= MAX_NUM_SLICES)) {
+	  LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active DL slices has changed: %d-->%d\n",
+		module_idP, frameP, subframeP, n_active_slices_current, n_active_slices);
+
+	  n_active_slices_current = n_active_slices;
+
+	} else {
+	  LOG_W(MAC,"invalid number of DL slices %d, revert to the previous value %d\n",n_active_slices, n_active_slices_current);
+	  n_active_slices = n_active_slices_current;
+	}
+      }
+
+      // check if the slice rb share has changed, and log the console
+      if (slice_percentage_current[i] != slice_percentage[i]){ // new slice percentage
+	LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: total percentage %f-->%f, slice RB percentage has changed: %f-->%f\n",
+	      module_idP, i, frameP, subframeP, total_slice_percentage_current, total_slice_percentage, slice_percentage_current[i], slice_percentage[i]);
+	total_slice_percentage_current= total_slice_percentage;
+	slice_percentage_current[i] = slice_percentage[i];
+
+      }
+
+      // check if the slice max MCS, and log the console
+      if (slice_maxmcs_current[i] != slice_maxmcs[i]){
+	if ((slice_maxmcs[i] >= 0) && (slice_maxmcs[i] < 29)){
+	  LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n",
+		module_idP, i, frameP, subframeP, slice_maxmcs_current[i], slice_maxmcs[i]);
+	  slice_maxmcs_current[i] = slice_maxmcs[i];
+	} else {
+	  LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid slice max mcs %d, revert the previous value %d\n",module_idP, i, slice_maxmcs[i],slice_maxmcs_current[i]);
+	  slice_maxmcs[i]= slice_maxmcs_current[i];
+	}
+      }
+
+      // check if a new scheduler, and log the console
+      if (update_dl_scheduler_current[i] != update_dl_scheduler[i]){
+	LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: DL scheduler for this slice is updated: %s \n",
+	      module_idP, i, frameP, subframeP, dl_scheduler_type[i]);
+	update_dl_scheduler_current[i] = update_dl_scheduler[i];
+      }
+
+    } else {
+      // here we can correct the values, e.g. reduce proportionally
+
+      if (n_active_slices == n_active_slices_current){
+	LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid total RB share (%f->%f), reduce proportionally the RB share by 0.1\n",
+	      module_idP, i, total_slice_percentage_current, total_slice_percentage);
+	if (slice_percentage[i] >= avg_slice_percentage){
+	  slice_percentage[i]-=0.1;
+	  total_slice_percentage-=0.1;
+	}
+      } else {
+	LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid total RB share (%f->%f), revert the number of slice to its previous value (%d->%d)\n",
+	      module_idP, i, total_slice_percentage_current, total_slice_percentage,
+	      n_active_slices, n_active_slices_current );
+	n_active_slices = n_active_slices_current;
+	slice_percentage[i] = slice_percentage_current[i];
+      }
+    }
+
+    // Check for new sorting policy
+    if (sorting_policy_current[i] != sorting_policy[i]) {
+      LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: UE sorting policy has changed (%x-->%x)\n",
+            module_idP, i, frameP, subframeP, sorting_policy_current[i], sorting_policy[i]);
+      sorting_policy_current[i] = sorting_policy[i];
+    }
+
+    // Run each enabled slice-specific schedulers one by one
+    slice_sched_dl[i](module_idP, i, frameP, subframeP, mbsfn_flag/*, dl_info*/);
+  }
+
+}
 
 // changes to pre-processor for eMTC
 
 //------------------------------------------------------------------------------
 void
-schedule_ue_spec(
-  module_id_t   module_idP,
-  frame_t       frameP,
-  sub_frame_t   subframeP,
-  int*          mbsfn_flag
-)
+schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
+		 frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag)
 //------------------------------------------------------------------------------
 {
-
-
-  uint8_t                        CC_id;
-  int                            UE_id;
-  unsigned char                  aggregation;
-  mac_rlc_status_resp_t          rlc_status;
-  unsigned char                  header_len_dcch=0, header_len_dcch_tmp=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,nb_available_rb;
-  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;
-  eNB_UE_STATS                   *eNB_UE_stats     = NULL;
-  uint16_t                       sdu_length_total = 0;
-
-  eNB_MAC_INST                   *eNB      = RC.mac[module_idP];
-  COMMON_channels_t              *cc       = eNB->common_channels;
-  UE_list_t                      *UE_list  = &eNB->UE_list;
-  int                            continue_flag=0;
-  int32_t                        normalized_rx_power, target_rx_power;
-  int32_t                        tpc=1;
-  static int32_t                 tpc_accumulated=0;
-  UE_sched_ctrl                  *ue_sched_ctl;
-  int                            mcs;
-  int                            i;
-  int                            min_rb_unit[MAX_NUM_CCs];
-  int                            N_RB_DL[MAX_NUM_CCs];
-  int                            total_nb_available_rb[MAX_NUM_CCs];
-  int                            N_RBG[MAX_NUM_CCs];
+  int CC_id;
+  int UE_id;
+  int aggregation;
+  mac_rlc_status_resp_t rlc_status;
+  int ta_len = 0;
+  unsigned char sdu_lcids[NB_RB_MAX];
+  int lcid, offset, num_sdus = 0;
+  int nb_rb, nb_rb_temp, nb_available_rb;
+  uint16_t sdu_lengths[NB_RB_MAX];
+  int TBS, j, rnti, padding = 0, post_padding = 0;
+  unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
+  int round = 0;
+  int harq_pid = 0;
+  eNB_UE_STATS *eNB_UE_stats = NULL;
+  int sdu_length_total = 0;
+
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+  COMMON_channels_t *cc = eNB->common_channels;
+  UE_list_t *UE_list = &eNB->UE_list;
+  int continue_flag = 0;
+  int32_t normalized_rx_power, target_rx_power;
+  int tpc = 1;
+  UE_sched_ctrl *ue_sched_ctl;
+  int mcs;
+  int i;
+  int min_rb_unit[MAX_NUM_CCs];
+  int N_RB_DL[MAX_NUM_CCs];
+  int total_nb_available_rb[MAX_NUM_CCs];
+  int N_RBG[MAX_NUM_CCs];
   nfapi_dl_config_request_body_t *dl_req;
-  nfapi_dl_config_request_pdu_t  *dl_config_pdu;
-  int                            tdd_sfa;
-  int                            ta_update;
+  nfapi_dl_config_request_pdu_t *dl_config_pdu;
+  int tdd_sfa;
+  int ta_update;
+  int header_length_last;
+  int header_length_total;
 
 #if 0
-  if (UE_list->head==-1) {
+  if (UE_list->head == -1) {
     return;
   }
 #endif
 
   start_meas(&eNB->schedule_dlsch);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+    (VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN);
 
 
   // for TDD: check that we have to act here, otherwise return
@@ -475,192 +615,209 @@ schedule_ue_spec(
     switch (subframeP) {
     case 0:
       // always continue
-       break;
+      break;
     case 1:
       return;
-	break;
+      break;
     case 2:
       return;
       break;
     case 3:
-      if ((tdd_sfa!=2) && (tdd_sfa!=5)) return;
+      if ((tdd_sfa != 2) && (tdd_sfa != 5))
+	return;
       break;
     case 4:
-      if ((tdd_sfa!=1)&&(tdd_sfa!=2)&&(tdd_sfa!=4)&&(tdd_sfa!=5)) return;
+      if ((tdd_sfa != 1) && (tdd_sfa != 2) && (tdd_sfa != 4)
+	  && (tdd_sfa != 5))
+	return;
       break;
     case 5:
       break;
     case 6:
     case 7:
-      if ((tdd_sfa!=1)&&(tdd_sfa!=2)&&(tdd_sfa!=4)&&(tdd_sfa!=5)) return;
+      if ((tdd_sfa != 1) && (tdd_sfa != 2) && (tdd_sfa != 4)
+	  && (tdd_sfa != 5))
+	return;
       break;
     case 8:
-      if ((tdd_sfa!=2)&&(tdd_sfa!=3)&&(tdd_sfa!=4)&&(tdd_sfa!=5)) return;
+      if ((tdd_sfa != 2) && (tdd_sfa != 3) && (tdd_sfa != 4)
+	  && (tdd_sfa != 5))
+	return;
       break;
     case 9:
-      if ((tdd_sfa!=1)&&(tdd_sfa!=3)&&(tdd_sfa!=4)&&(tdd_sfa!=6)) return;
+      if ((tdd_sfa != 1) && (tdd_sfa != 3) && (tdd_sfa != 4)
+	  && (tdd_sfa != 6))
+	return;
       break;
-   
+
     }
   }
-
   //weight = get_ue_weight(module_idP,UE_id);
-  aggregation = 2; 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+  aggregation = 2;
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
     N_RB_DL[CC_id] = to_prb(cc[CC_id].mib->message.dl_Bandwidth);
-    min_rb_unit[CC_id]=get_min_rb_unit(module_idP,CC_id);
+    min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id);
     // get number of PRBs less those used by common channels
     total_nb_available_rb[CC_id] = N_RB_DL[CC_id];
-    for (i=0;i<N_RB_DL[CC_id];i++)
-      if (cc[CC_id].vrb_map[i]!=0)
+    for (i = 0; i < N_RB_DL[CC_id]; i++)
+      if (cc[CC_id].vrb_map[i] != 0)
 	total_nb_available_rb[CC_id]--;
 
     N_RBG[CC_id] = to_rbg(cc[CC_id].mib->message.dl_Bandwidth);
 
     // store the global enb stats:
-    eNB->eNB_stats[CC_id].num_dlactive_UEs      =  UE_list->num_UEs;
-    eNB->eNB_stats[CC_id].available_prbs        =  total_nb_available_rb[CC_id];
-    eNB->eNB_stats[CC_id].total_available_prbs +=  total_nb_available_rb[CC_id];
-    eNB->eNB_stats[CC_id].dlsch_bytes_tx        = 0;
-    eNB->eNB_stats[CC_id].dlsch_pdus_tx         = 0;
+    eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs;
+    eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id];
+    eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id];
+    eNB->eNB_stats[CC_id].dlsch_bytes_tx = 0;
+    eNB->eNB_stats[CC_id].dlsch_pdus_tx = 0;
   }
 
   /// CALLING Pre_Processor for downlink scheduling (Returns estimation of RBs required by each UE and the allocation on sub-band)
 
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_IN);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+      (VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_IN);
   start_meas(&eNB->schedule_dlsch_preprocessor);
   dlsch_scheduler_pre_processor(module_idP,
+                                slice_idP,
                                 frameP,
                                 subframeP,
                                 N_RBG,
                                 mbsfn_flag);
   stop_meas(&eNB->schedule_dlsch_preprocessor);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+      (VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_OUT);
 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n",CC_id);
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n", CC_id);
 
-    dl_req        = &eNB->DL_req[CC_id].dl_config_request_body;
+    dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
 
-    if (mbsfn_flag[CC_id]>0)
+    if (mbsfn_flag[CC_id] > 0)
       continue;
 
-    for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
-      continue_flag=0; // reset the flag to allow allocation for the remaining UEs
-      rnti = UE_RNTI(module_idP,UE_id);
+    for (UE_id = UE_list->head; UE_id >= 0;
+	 UE_id = UE_list->next[UE_id]) {
+      continue_flag = 0;	// reset the flag to allow allocation for the remaining UEs
+      rnti = UE_RNTI(module_idP, UE_id);
       eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
       ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
 
 
-      if (rnti==NOT_A_RNTI) {
-        LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs);
-        continue_flag=1;
+      if (rnti == NOT_A_RNTI) {
+	LOG_D(MAC, "Cannot find rnti for UE_id %d (num_UEs %d)\n",
+	      UE_id, UE_list->num_UEs);
+	continue_flag = 1;
       }
 
-      if (eNB_UE_stats==NULL) {
-        LOG_D(MAC,"[eNB] Cannot find eNB_UE_stats\n");
-        continue_flag=1;
+      if (eNB_UE_stats == NULL) {
+          LOG_D(MAC, "[eNB] Cannot find eNB_UE_stats\n");
+          continue_flag = 1;
       }
-
-      if (continue_flag != 1){
-        switch(get_tmode(module_idP,CC_id,UE_id)){
-        case 1:
-        case 2:
-        case 7:
-	  aggregation = get_aggregation(get_bw_index(module_idP,CC_id), 
-					ue_sched_ctl->dl_cqi[CC_id],
-					format1);
+      if (!ue_slice_membership(UE_id, slice_idP))
+                  continue;
+
+      if (continue_flag != 1) {
+	switch (get_tmode(module_idP, CC_id, UE_id)) {
+	case 1:
+	case 2:
+	case 7:
+	  aggregation =
+	    get_aggregation(get_bw_index(module_idP, CC_id),
+			    ue_sched_ctl->dl_cqi[CC_id],
+			    format1);
 	  break;
-        case 3:
-	  aggregation = get_aggregation(get_bw_index(module_idP,CC_id), 
-					ue_sched_ctl->dl_cqi[CC_id],
-					format2A);
+	case 3:
+	  aggregation =
+	    get_aggregation(get_bw_index(module_idP, CC_id),
+			    ue_sched_ctl->dl_cqi[CC_id],
+			    format2A);
 	  break;
-        default:
-	  LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id));
+	default:
+	  LOG_W(MAC, "Unsupported transmission mode %d\n",
+		get_tmode(module_idP, CC_id, UE_id));
 	  aggregation = 2;
-        }
-      } /* if (continue_flag != 1 */
-
-      if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) ||  // no RBs allocated 
-	  CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,aggregation,rnti)
-	  ) {
-        LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n",
-              module_idP, frameP, UE_id, CC_id);
-        continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5
+	}
       }
-
-      if (cc[CC_id].tdd_Config != NULL) { //TDD
-        set_ue_dai (subframeP,
-                    UE_id,
-                    CC_id,
-		    cc[CC_id].tdd_Config->subframeAssignment,
-                    UE_list);
-        // update UL DAI after DLSCH scheduling
-        set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
+      /* if (continue_flag != 1 */
+      if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) ||	// no RBs allocated
+	  CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP,
+				    aggregation, rnti)) {
+	LOG_D(MAC,
+	      "[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n",
+	      module_idP, frameP, UE_id, CC_id);
+	continue_flag = 1;	//to next user (there might be rbs availiable for other UEs in TM5
       }
 
-      if (continue_flag == 1 ) {
-        add_ue_dlsch_info(module_idP,
-                          CC_id,
-                          UE_id,
-                          subframeP,
-                          S_DL_NONE);
-        continue;
+      if (cc[CC_id].tdd_Config != NULL) {	//TDD
+	set_ue_dai(subframeP,
+		   UE_id,
+		   CC_id,
+		   cc[CC_id].tdd_Config->subframeAssignment,
+		   UE_list);
+	// update UL DAI after DLSCH scheduling
+	set_ul_DAI(module_idP, UE_id, CC_id, frameP, subframeP);
       }
 
+      if (continue_flag == 1) {
+	add_ue_dlsch_info(module_idP,
+			  CC_id, UE_id, subframeP, S_DL_NONE);
+	continue;
+      }
 #warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed
 #if 0
       /* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */
       /* if we don't add it, next allocations may succeed but overall allocations may fail */
       /* will be removed at the end of this function */
-      add_ue_spec_dci(&eNB->common_channels[CC_id].DCI_pdu,
-                      &(char[]){0},
-                      rnti,
-                      1,
-                      aggregation,
-                      1,
-                      format1,
-                      0);
+      add_ue_spec_dci(&eNB->common_channels[CC_id].DCI_pdu, &(char[]) {
+	  0}, rnti, 1, aggregation, 1, format1, 0);
 #endif
 
       nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
 
-      if (cc->tdd_Config) harq_pid = ((frameP*10)+subframeP)%10;
-      else harq_pid = ((frameP*10)+subframeP)&7;
+      if (cc->tdd_Config) harq_pid = ((frameP * 10) + subframeP) % 10;
+      else            	  harq_pid = ((frameP * 10) + subframeP) & 7;
 
       round = ue_sched_ctl->round[CC_id][harq_pid];
 
-      UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti;
-      UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(module_idP,rnti);
-      UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; 
+      UE_list->eNB_UE_stats[CC_id][UE_id].crnti      = rnti;
+      UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status = mac_eNB_get_rrc_status(module_idP, rnti);
+      UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid   = harq_pid;
       UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
 
 
       if (UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status < RRC_CONNECTED) continue;
 
-      sdu_length_total=0;
-      num_sdus=0;
+      header_length_total = 0;
+      sdu_length_total = 0;
+      num_sdus = 0;
 
       /*
-      DevCheck(((eNB_UE_stats->dl_cqi < MIN_CQI_VALUE) || (eNB_UE_stats->dl_cqi > MAX_CQI_VALUE)),
-      eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE);
+	DevCheck(((eNB_UE_stats->dl_cqi < MIN_CQI_VALUE) || (eNB_UE_stats->dl_cqi > MAX_CQI_VALUE)),
+	eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE);
       */
-      eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]];
-      eNB_UE_stats->dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1;//cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
+      if (nfapi_mode) {
+		  eNB_UE_stats->dlsch_mcs1 = 10;//cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]];
+      }
+      else { // this operation is also done in the preprocessor
+		  eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, slice_maxmcs[slice_idP]);  //cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
+      }
+
 
 
       // store stats
       //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->dl_cqi;
 
       // initializing the rb allocation indicator for each UE
-      for(j=0; j<N_RBG[CC_id]; j++) {
-        UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0;
+      for (j = 0; j < N_RBG[CC_id]; j++) {
+	UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0;
       }
 
-      LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n",
-            module_idP, frameP, UE_id,CC_id,rnti,harq_pid, round,nb_available_rb,
-            ue_sched_ctl->dl_cqi[CC_id], eNB_UE_stats->dlsch_mcs1,
+      LOG_D(MAC,
+	    "[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n",
+	    module_idP, frameP, UE_id, CC_id, rnti, harq_pid, round,
+	    nb_available_rb, ue_sched_ctl->dl_cqi[CC_id],
+	    eNB_UE_stats->dlsch_mcs1,
 	    UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status);
 
 
@@ -669,742 +826,769 @@ schedule_ue_spec(
 
       if (round != 8) {
 
-        // get freq_allocation
-        nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
-	TBS = get_TBS_DL(UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid],nb_rb);
-
-        if (nb_rb <= nb_available_rb) {
-          if (cc[CC_id].tdd_Config != NULL) {
-            UE_list->UE_template[CC_id][UE_id].DAI++;
-            update_ul_dci(module_idP,CC_id,rnti,UE_list->UE_template[CC_id][UE_id].DAI);
-            LOG_D(MAC,"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", CC_id,subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI);
-          }
-
-          if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
-            for(j=0; j<N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band
-              UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
-            }
-          } else {
-            nb_rb_temp = nb_rb;
-            j = 0;
-
-            while((nb_rb_temp > 0) && (j<N_RBG[CC_id])) {
-              if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
-                if (UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]) printf("WARN: rballoc_subband not free for retrans?\n");
-                UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
-
-                if((j == N_RBG[CC_id]-1) &&
-                    ((N_RB_DL[CC_id] == 25)||
-                     (N_RB_DL[CC_id] == 50))) {
-                  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1;
-                } else {
-                  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
-                }
-              }
-
-              j = j+1;
-            }
-          }
-
-          nb_available_rb -= nb_rb;
+	// get freq_allocation
+	nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
+	TBS = get_TBS_DL(UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid],
+			 nb_rb);
+
+	if (nb_rb <= nb_available_rb) {
+	  if (cc[CC_id].tdd_Config != NULL) {
+	    UE_list->UE_template[CC_id][UE_id].DAI++;
+	    update_ul_dci(module_idP, CC_id, rnti,
+			  UE_list->UE_template[CC_id][UE_id].DAI);
+	    LOG_D(MAC,
+		  "DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n",
+		  CC_id, subframeP, UE_id,
+		  UE_list->UE_template[CC_id][UE_id].DAI);
+	  }
+
+	  if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
+	    for (j = 0; j < N_RBG[CC_id]; j++) {	// for indicating the rballoc for each sub-band
+	      UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
+	    }
+	  } else {
+	    nb_rb_temp = nb_rb;
+	    j = 0;
+
+	    while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) {
+	      if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
+		if (UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j])
+		  printf("WARN: rballoc_subband not free for retrans?\n");
+		UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
+
+		if ((j == N_RBG[CC_id] - 1) &&
+		    ((N_RB_DL[CC_id] == 25) ||
+		     (N_RB_DL[CC_id] == 50))) {
+		  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id] + 1;
+		} else {
+		  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
+		}
+	      }
+
+	      j = j + 1;
+	    }
+	  }
+
+	  nb_available_rb -= nb_rb;
 	  /*
-          eNB->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
-          eNB->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
+	    eNB->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
+	    eNB->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
 
-          for(j=0; j<N_RBG[CC_id]; j++) {
-            eNB->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
-          }
+	    for(j=0; j<N_RBG[CC_id]; j++) {
+	    eNB->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
+	    }
 	  */
 
-          switch (get_tmode(module_idP,CC_id,UE_id)) {
-          case 1:
-          case 2:
-          case 7:
-          default:
-	    dl_config_pdu                                                         = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-	    memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	    dl_config_pdu->pdu_type                                               = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; 
-	    dl_config_pdu->pdu_size                                               = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format                  = NFAPI_DL_DCI_FORMAT_1;
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level           = get_aggregation(get_bw_index(module_idP,CC_id),ue_sched_ctl->dl_cqi[CC_id],format1);
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti                        = rnti;
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type                   = 1;    // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power          = 6000; // equal to RS power
-
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process                = harq_pid;
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc                         = 1; // dont adjust power when retransmitting
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1        = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1                       = UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid];
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1        = round&3;
-
-	    if (cc[CC_id].tdd_Config != NULL) { //TDD
-	      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
-	      LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d, mcs %d\n",
-		    module_idP,CC_id,harq_pid,round,
-		    (UE_list->UE_template[CC_id][UE_id].DAI-1),
+	  switch (get_tmode(module_idP, CC_id, UE_id)) {
+	  case 1:
+	  case 2:
+	  case 7:
+	  default:
+	    LOG_D(MAC,"retransmission DL_REQ: rnti:%x\n",rnti);
+
+	    dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+	    memset((void *) dl_config_pdu, 0,
+		   sizeof(nfapi_dl_config_request_pdu_t));
+	    dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
+	    dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP, CC_id),
+											  ue_sched_ctl->dl_cqi[CC_id],
+											  format1);
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti      = rnti;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1;	// CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000;	// equal to RS power
+
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = harq_pid;
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1;	// dont adjust power when retransmitting
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid];
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = round & 3;
+
+	    if (cc[CC_id].tdd_Config != NULL) {	//TDD
+	      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = (UE_list->UE_template[CC_id][UE_id].DAI - 1) & 3;
+	      LOG_D(MAC,
+		    "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d, mcs %d\n",
+		    module_idP, CC_id, harq_pid, round,
+		    (UE_list->UE_template[CC_id][UE_id].DAI - 1),
 		    UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid]);
 	    } else {
-	      LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, mcs %d\n",
-		    module_idP,CC_id,harq_pid,round,
+	      LOG_D(MAC,
+		    "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, mcs %d\n",
+		    module_idP, CC_id, harq_pid, round,
 		    UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid]);
-	      
+
 	    }
-	    if (!CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,
-					   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-					   rnti)) {
+	    if (!CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP,
+					   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, rnti)) {
 	      dl_req->number_dci++;
 	      dl_req->number_pdu++;
-
-	      fill_nfapi_dlsch_config(eNB,dl_req,
-				      TBS,
-				      -1            /* retransmission, no pdu_index */,
-				      rnti,
-				      0, // type 0 allocation from 7.1.6 in 36.213
-				      0, // virtual_resource_block_assignment_flag, unused here
-				      0,          // resource_block_coding, to be filled in later
-				      getQm(UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid]),
-				      round&3   , // redundancy version
-				      1, // transport blocks
-				      0, // transport block to codeword swap flag
-				      cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme
-				      1, // number of layers
-				      1, // number of subbands
-			     //			     uint8_t codebook_index,
-				      4, // UE category capacity
-				      UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 
-				      0, // delta_power_offset for TM5
-				      0, // ngap
-				      0, // nprb
-				      cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode
-				      0, //number of PRBs treated as one subband, not used here
-				      0 // number of beamforming vectors, not used here
+	      dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+	      eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
+	      eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
+
+	      fill_nfapi_dlsch_config(eNB, dl_req, TBS, -1
+				      /* retransmission, no pdu_index */
+				      , rnti, 0,	// type 0 allocation from 7.1.6 in 36.213
+				      0,	// virtual_resource_block_assignment_flag, unused here
+				      0,	// resource_block_coding, to be filled in later
+				      getQm(UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid]), round & 3,	// redundancy version
+				      1,	// transport blocks
+				      0,	// transport block to codeword swap flag
+				      cc[CC_id].p_eNB == 1 ? 0 : 1,	// transmission_scheme
+				      1,	// number of layers
+				      1,	// number of subbands
+				      //                      uint8_t codebook_index,
+				      4,	// UE category capacity
+				      UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 0,	// delta_power_offset for TM5
+				      0,	// ngap
+				      0,	// nprb
+				      cc[CC_id].p_eNB == 1 ? 1 : 2,	// transmission mode
+				      0,	//number of PRBs treated as one subband, not used here
+				      0	// number of beamforming vectors, not used here
 				      );
 
-	      LOG_D(MAC,"Filled NFAPI configuration for DCI/DLSCH %d, retransmission round %d\n",eNB->pdu_index[CC_id],round);
+	      LOG_D(MAC,
+		    "Filled NFAPI configuration for DCI/DLSCH %d, retransmission round %d\n",
+		    eNB->pdu_index[CC_id], round);
 
-	      program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
+	      program_dlsch_acknak(module_idP, CC_id, UE_id,
+				   frameP, subframeP,
+				   dl_config_pdu->
+				   dci_dl_pdu.dci_dl_pdu_rel8.
+				   cce_idx);
 	      // No TX request for retransmission (check if null request for FAPI)
-	    }
-	    else {
-	      LOG_W(MAC,"Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d\%x, infeasible CCE allocation\n",
-		    frameP,subframeP,UE_id,rnti);
+	    } else {
+	      LOG_W(MAC,
+		    "Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d\%x, infeasible CCE allocation\n",
+		    frameP, subframeP, UE_id, rnti);
 	    }
 	  }
 
 
 	  add_ue_dlsch_info(module_idP,
-			    CC_id,
-			    UE_id,
-			    subframeP,
+			    CC_id, UE_id, subframeP,
 			    S_DL_SCHEDULED);
-	  
+
 	  //eNB_UE_stats->dlsch_trials[round]++;
-	  UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1;
-	  UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb;
-	  UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb;
-	  UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1;
-	  UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission += 1;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = nb_rb;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx += nb_rb;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = eNB_UE_stats->dlsch_mcs1;
 	} else {
-          LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n",
-                module_idP, frameP, CC_id, UE_id);
-        }
-      } else { /* This is a potentially new SDU opportunity */
-	
-        rlc_status.bytes_in_buffer = 0;
-        // Now check RLC information to compute number of required RBs
-        // get maximum TBS size for RLC request
-        TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb);
-        // check first for RLC data on DCCH
-        // add the length for  all the control elements (timing adv, drx, etc) : header + payload
-
-        if (ue_sched_ctl->ta_timer == 0) {
-          ta_update = ue_sched_ctl->ta_update;
-          /* if we send TA then set timer to not send it for a while */
-          if (ta_update != 31)
-            ue_sched_ctl->ta_timer = 20;
-          /* reset ta_update */
-          ue_sched_ctl->ta_update = 31;
-        } else {
-          ta_update = 31;
-        }
+	  LOG_D(MAC,
+		"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n",
+		module_idP, frameP, CC_id, UE_id);
+	}
+      } else {		/* This is a potentially new SDU opportunity */
+	rlc_status.bytes_in_buffer = 0;
+
+	// Now check RLC information to compute number of required RBs
+	// get maximum TBS size for RLC request
+	TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb);
 
-        ta_len = (ta_update != 31) ? 2 : 0;
-
-        header_len_dcch = 2; // 2 bytes DCCH SDU subheader
-
-        if ( TBS-ta_len-header_len_dcch > 0 ) {
-          rlc_status = mac_rlc_status_ind(
-                         module_idP,
-                         rnti,
-			 module_idP,
-                         frameP,
-			 subframeP,
-                         ENB_FLAG_YES,
-                         MBMS_FLAG_NO,
-                         DCCH,
-                         (TBS-ta_len-header_len_dcch)); // transport block set size
-
-          sdu_lengths[0]=0;
-
-          if (rlc_status.bytes_in_buffer > 0) {  // There is DCCH to transmit
-            LOG_D(MAC,"[eNB %d] Frame %d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
-                  module_idP,frameP,CC_id,TBS-header_len_dcch);
-            sdu_lengths[0] = mac_rlc_data_req(
-					      module_idP,
-					      rnti,
-					      module_idP,
-					      frameP,
-					      ENB_FLAG_YES,
-					      MBMS_FLAG_NO,
-					      DCCH,
-					      TBS, //not used
+	// add the length for  all the control elements (timing adv, drx, etc) : header + payload
+
+	if (ue_sched_ctl->ta_timer == 0) {
+	  ta_update = ue_sched_ctl->ta_update;
+	  /* if we send TA then set timer to not send it for a while */
+	  if (ta_update != 31) ue_sched_ctl->ta_timer = 20;
+	  /* reset ta_update */
+	  ue_sched_ctl->ta_update = 31;
+	} else {
+	  ta_update = 31;
+	}
+
+	ta_len = (ta_update != 31) ? 2 : 0;
+
+	// RLC data on DCCH
+	if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
+	  rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH,
+                                          TBS - ta_len - header_length_total - sdu_length_total - 3);
+
+	  sdu_lengths[0] = 0;
+
+	  if (rlc_status.bytes_in_buffer > 0) {
+	    LOG_D(MAC, "[eNB %d] SFN/SF %d.%d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
+		  module_idP, frameP, subframeP, CC_id,
+		  TBS - ta_len - header_length_total - sdu_length_total - 3);
+
+	    sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH,
+                                              TBS, //not used
 					      (char *)&dlsch_buffer[0]);
 
-            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), T_INT(sdu_lengths[0]));
+	    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),
+	      T_INT(sdu_lengths[0]));
+
+	    LOG_D(MAC, "[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",
+		  module_idP, CC_id, sdu_lengths[0]);
+
+	    sdu_length_total = sdu_lengths[0];
+	    sdu_lcids[0] = DCCH;
+            UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[0] = DCCH;
+            UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[DCCH] = sdu_lengths[0];
+	    UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1;
+	    UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[0];
+
+            header_length_last = 1 + 1 + (sdu_lengths[0] >= 128);
+            header_length_total += header_length_last;
+
+	    num_sdus = 1;
 
-            LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",module_idP,CC_id,sdu_lengths[0]);
-            sdu_length_total = sdu_lengths[0];
-            sdu_lcids[0] = DCCH;
-            UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH]+=1;
-            UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH]+=sdu_lengths[0];
-            num_sdus = 1;
 #ifdef DEBUG_eNB_SCHEDULER
-            LOG_T(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes :",module_idP,CC_id,sdu_lengths[0]);
+	    LOG_T(MAC,
+		  "[eNB %d][DCCH] CC_id %d Got %d bytes :",
+		  module_idP, CC_id, sdu_lengths[0]);
 
-            for (j=0; j<sdu_lengths[0]; j++) {
-              LOG_T(MAC,"%x ",dlsch_buffer[j]);
-            }
+	    for (j = 0; j < sdu_lengths[0]; j++) {
+	      LOG_T(MAC, "%x ", dlsch_buffer[j]);
+	    }
 
-            LOG_T(MAC,"\n");
+	    LOG_T(MAC, "\n");
 #endif
-          } else {
-            header_len_dcch = 0;
-            sdu_length_total = 0;
-          }
-        }
-	
-        // check for DCCH1 and update header information (assume 2 byte sub-header)
-        if (TBS-ta_len-header_len_dcch-sdu_length_total > 0 ) {
-          rlc_status = mac_rlc_status_ind(
-                         module_idP,
-                         rnti,
-			 module_idP,
-                         frameP,
-						 subframeP,
-                         ENB_FLAG_YES,
-                         MBMS_FLAG_NO,
-                         DCCH+1,
-                         (TBS-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and
-          // DCCH SDU
+	  }
+	}
+
+	// RLC data on DCCH1
+	if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
+	  rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1,
+                                          TBS - ta_len - header_length_total - sdu_length_total - 3);
+
+	  // DCCH SDU
 	  sdu_lengths[num_sdus] = 0;
 
-          if (rlc_status.bytes_in_buffer > 0) {
-            LOG_D(MAC,"[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
-                  module_idP,frameP,CC_id,TBS-header_len_dcch-sdu_length_total);
-            sdu_lengths[num_sdus] += mac_rlc_data_req(
-                                       module_idP,
-                                       rnti,
-				       module_idP,
-                                       frameP,
-                                       ENB_FLAG_YES,
-                                       MBMS_FLAG_NO,
-                                       DCCH+1,
-									   TBS, //not used
-                                       (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(DCCH+1), T_INT(sdu_lengths[num_sdus]));
-
-            sdu_lcids[num_sdus] = DCCH1;
-            sdu_length_total += sdu_lengths[num_sdus];
-            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];
+	  if (rlc_status.bytes_in_buffer > 0) {
+	    LOG_D(MAC, "[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
+		  module_idP, frameP, CC_id,
+		  TBS - ta_len - header_length_total - sdu_length_total - 3);
+
+	    sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1,
+                                                      TBS, //not used
+						      (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(DCCH + 1), T_INT(sdu_lengths[num_sdus]));
+
+	    sdu_lcids[num_sdus] = DCCH1;
+	    sdu_length_total += sdu_lengths[num_sdus];
+            UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = DCCH1;
+            UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[DCCH1] = sdu_lengths[num_sdus];
+	    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];
+
+            header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
+            header_length_total += header_length_last;
+
 	    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]);
+	    LOG_T(MAC,
+		  "[eNB %d][DCCH1] CC_id %d Got %d bytes :",
+		  module_idP, CC_id, sdu_lengths[num_sdus]);
 
-            for (j=0; j<sdu_lengths[num_sdus]; j++) {
-              LOG_T(MAC,"%x ",dlsch_buffer[j]);
-            }
+	    for (j = 0; j < sdu_lengths[num_sdus]; j++) {
+	      LOG_T(MAC, "%x ", dlsch_buffer[j]);
+	    }
 
-            LOG_T(MAC,"\n");
+	    LOG_T(MAC, "\n");
 #endif
-
 	  }
-        }
+	}
+
+	// TODO: lcid has to be sorted before the actual allocation (similar struct as ue_list).
+	for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
+	  // TODO: check if the lcid is active
 
-	// 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 ? 
+	  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_length_total - sdu_length_total - 3);
+
+	  if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) {
 	    rlc_status = mac_rlc_status_ind(module_idP,
 					    rnti,
 					    module_idP,
 					    frameP,
-						subframeP,
+					    subframeP,
 					    ENB_FLAG_YES,
 					    MBMS_FLAG_NO,
 					    lcid,
-					    TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
-	   
+					    TBS - ta_len - header_length_total - sdu_length_total - 3);
+
+
 
 	    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,
-							   TBS,	//not used
-						       (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);
+	      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 - ta_len - header_length_total - sdu_length_total - 3,
+		    lcid,
+		    header_length_total);
+
+	      sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid,
+                                                       TBS, //not used
+						       (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--;
-	      }
+	      UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]++;
+              UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = lcid;
+              UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[lcid] = sdu_lengths[num_sdus];
+	      UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[num_sdus];
+
+              header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
+              header_length_total += header_length_last;
+
 	      num_sdus++;
-	    } // no data for this LCID
-	    else {
-	      header_len_dtch-=3;
+
+	      UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
 	    }
-	  } // no TBS left
-	  else {
-	    header_len_dtch-=3;
-	    break; 
+	  } else {
+            // no TBS left
+	    break;
 	  }
 	}
-	if (header_len_dtch == 0 )
-	  header_len_dtch_last= 0;
-	// there is at least one SDU 
+
+        /* last header does not have length field */
+        if (header_length_total) {
+          header_length_total -= header_length_last;
+          header_length_total++;
+        }
+
+	// there is at least one SDU or TA command
 	// if (num_sdus > 0 ){
-	if ((sdu_length_total + header_len_dcch + header_len_dtch )> 0) {
-	  
+	if (ta_len + sdu_length_total + header_length_total > 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
+
+	  mcs = eNB_UE_stats->dlsch_mcs1;
+
+	  if (mcs == 0) {
+	    nb_rb = 4;	// don't let the TBS get too small
+	  } else {
+	    nb_rb = min_rb_unit[CC_id];
+	  }
+
+	  TBS = get_TBS_DL(mcs, nb_rb);
+
+	  while (TBS < sdu_length_total + header_length_total + ta_len) {
+	    nb_rb += min_rb_unit[CC_id];	//
+
+	    if (nb_rb > nb_available_rb) {	// if we've gone beyond the maximum number of RBs
+	      // (can happen if N_RB_DL is odd)
+	      TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb);
+	      nb_rb = nb_available_rb;
+	      break;
+	    }
+
+	    TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_rb);
+	  }
+
+	  if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
+	    for (j = 0; j < N_RBG[CC_id]; j++) {	// for indicating the rballoc for each sub-band
+	      UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] =	ue_sched_ctl->rballoc_sub_UE[CC_id][j];
+	    }
 	  } 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
+	    nb_rb_temp = nb_rb;
+	    j = 0;
+
+	    while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) {
+	      if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
+		UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
+
+		if ((j == N_RBG[CC_id] - 1) &&
+		    ((N_RB_DL[CC_id] == 25) ||
+		     (N_RB_DL[CC_id] == 50))) {
+		  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id] + 1;
+		} else {
+		  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
+		}
+	      }
+
+	      j = j + 1;
+	    }
 	  }
 
-          mcs = eNB_UE_stats->dlsch_mcs1;
-
-          if (mcs==0) {
-            nb_rb = 4;  // don't let the TBS get too small
-          } else {
-            nb_rb=min_rb_unit[CC_id];
-          }
-
-          TBS = get_TBS_DL(mcs,nb_rb);
-
-          while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len))  {
-            nb_rb += min_rb_unit[CC_id];  //
-
-            if (nb_rb>nb_available_rb) { // if we've gone beyond the maximum number of RBs
-              // (can happen if N_RB_DL is odd)
-              TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb);
-              nb_rb = nb_available_rb;
-              break;
-            }
-
-            TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rb);
-          }
-
-          if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
-            for(j=0; j<N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band
-              UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
-            }
-          } else {
-            nb_rb_temp = nb_rb;
-            j = 0;
-
-            while((nb_rb_temp > 0) && (j<N_RBG[CC_id])) {
-              if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
-                UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
-
-                if ((j == N_RBG[CC_id]-1) &&
-                    ((N_RB_DL[CC_id] == 25)||
-                     (N_RB_DL[CC_id] == 50))) {
-                  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1;
-                } else {
-                  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
-                }
-              }
-
-              j = j+1;
-            }
-          }
-
-          // decrease mcs until TBS falls below required length
-          while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs>0)) {
-            mcs--;
-            TBS = get_TBS_DL(mcs,nb_rb);
-          }
-
-          // if we have decreased too much or we don't have enough RBs, increase MCS
-          while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs<28))
-                 || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs<=15)))) {
-            mcs++;
-            TBS = get_TBS_DL(mcs,nb_rb);
-          }
-
-          LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n",eNB_UE_stats->dlsch_mcs1, mcs);
+	  // decrease mcs until TBS falls below required length
+	  while ((TBS > sdu_length_total + header_length_total + ta_len) && (mcs > 0)) {
+	    mcs--;
+	    TBS = get_TBS_DL(mcs, nb_rb);
+	  }
+
+	  // if we have decreased too much or we don't have enough RBs, increase MCS
+	  while ((TBS < sdu_length_total + header_length_total + ta_len)
+		 && (((ue_sched_ctl->dl_pow_off[CC_id] > 0)
+		      && (mcs < 28))
+		     || ((ue_sched_ctl->dl_pow_off[CC_id] == 0)
+			 && (mcs <= 15)))) {
+	    mcs++;
+	    TBS = get_TBS_DL(mcs, nb_rb);
+	  }
+
+	  LOG_D(MAC,
+		"dlsch_mcs before and after the rate matching = (%d, %d)\n",
+		eNB_UE_stats->dlsch_mcs1, mcs);
 
 #ifdef DEBUG_eNB_SCHEDULER
-          LOG_D(MAC,"[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n",
-                module_idP,CC_id,mcs,TBS,nb_rb);
-          // msg("[MAC][eNB ] Reminder of DLSCH with random data %d %d %d %d \n",
-          //  TBS, sdu_length_total, offset, TBS-sdu_length_total-offset);
+	  LOG_D(MAC,
+		"[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n",
+		module_idP, CC_id, mcs, TBS, nb_rb);
+	  // msg("[MAC][eNB ] Reminder of DLSCH with random data %d %d %d %d \n",
+	  //  TBS, sdu_length_total, offset, TBS-sdu_length_total-offset);
 #endif
 
-          if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) {
-            padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len);
-            post_padding = 0;
-          } else {
-            padding = 0;
-
-            // adjust the header len
-            if (header_len_dtch==0) {
-              header_len_dcch = header_len_dcch_tmp;
-            } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2)))
-              header_len_dtch = header_len_dtch_tmp;
-            }
-
-            post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header
-          }
-
-
-          offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
-                                         num_sdus,              //num_sdus
-                                         sdu_lengths,  //
-                                         sdu_lcids,
-                                         255,                                   // no drx
-                                         ta_update, // timing advance
-                                         NULL,                                  // contention res id
-                                         padding,
-                                         post_padding);
-
-          //#ifdef DEBUG_eNB_SCHEDULER
-          if (ta_update != 31) {
-            LOG_D(MAC,
-                  "[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,
-                  ta_update,padding,post_padding,mcs,TBS,nb_rb,header_len_dcch,header_len_dtch);
+	  if (TBS - header_length_total - sdu_length_total - ta_len <= 2) {
+	    padding = TBS - header_length_total - sdu_length_total - ta_len;
+	    post_padding = 0;
+	  } else {
+	    padding = 0;
+	    post_padding = 1;
 	  }
-          //#endif
+
+	  offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus,	//num_sdus
+					 sdu_lengths,	//
+					 sdu_lcids, 255,	// no drx
+					 ta_update,	// timing advance
+					 NULL,	// contention res id
+					 padding, post_padding);
+
+	  //#ifdef DEBUG_eNB_SCHEDULER
+	  if (ta_update != 31) {
+	    LOG_D(MAC,
+		  "[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_length %d\n",
+		  module_idP, frameP, UE_id, CC_id,
+		  sdu_length_total, num_sdus, sdu_lengths[0],
+		  sdu_lcids[0], offset, ta_update, padding,
+		  post_padding, mcs, TBS, nb_rb,
+		  header_length_total);
+	  }
+	  //#endif
 #ifdef DEBUG_eNB_SCHEDULER
-          LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n");
+	  LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n");
 
-          for (i=0; i<16; i++) {
-            LOG_T(MAC,"%x.",dlsch_buffer[i]);
-          }
+	  for (i = 0; i < 16; i++) {
+	    LOG_T(MAC, "%x.", dlsch_buffer[i]);
+	  }
 
-          LOG_T(MAC,"\n");
+	  LOG_T(MAC, "\n");
 #endif
 
-          // cycle through SDUs and place in dlsch_buffer
-          memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total);
-          // memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
-
-          // fill remainder of DLSCH with random data
-          for (j=0; j<(TBS-sdu_length_total-offset); j++) {
-            UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff);
-          }
+	  // cycle through SDUs and place in dlsch_buffer
+	  memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],
+		 dlsch_buffer, sdu_length_total);
+	  // memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
 
+#if 0
+	  // fill remainder of DLSCH with random data
+	  for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
+	    UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = (char) (taus() & 0xff);
+	  }
+#endif
+	  // fill remainder of DLSCH with 0
+	  for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
+	    UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = 0;
+	  }
 
-          if (opt_enabled == 1) {
-            trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
-                      TBS, module_idP, 3, UE_RNTI(module_idP,UE_id),
-                      eNB->frame, eNB->subframe,0,0);
-            LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d  rnti %x  with size %d\n",
-                  module_idP, CC_id, frameP, UE_RNTI(module_idP,UE_id), TBS);
-          }
+	  if (opt_enabled == 1) {
+	    trace_pdu(1, (uint8_t *)
+		      UE_list->DLSCH_pdu[CC_id][0][UE_id].
+		      payload[0], TBS, module_idP, 3,
+		      UE_RNTI(module_idP, UE_id), eNB->frame,
+		      eNB->subframe, 0, 0);
+	    LOG_D(OPT,
+		  "[eNB %d][DLSCH] CC_id %d Frame %d  rnti %x  with size %d\n",
+		  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));
+	  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));
 
 	  UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb;
 
-          add_ue_dlsch_info(module_idP,
-                            CC_id,
-                            UE_id,
-                            subframeP,
-                            S_DL_SCHEDULED);
-          // store stats
-          eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total;
-          eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1;
-
-          UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
-          UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
-          UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1;
-          UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=mcs;
-          UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS;
-
-          UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total;
-          UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total;
-          UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS;
-          UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1;
-
-          if (cc[CC_id].tdd_Config != NULL) { // TDD
-            UE_list->UE_template[CC_id][UE_id].DAI++;
-            update_ul_dci(module_idP,CC_id,rnti,UE_list->UE_template[CC_id][UE_id].DAI);
-          }
+	  add_ue_dlsch_info(module_idP,
+			    CC_id, UE_id, subframeP,
+			    S_DL_SCHEDULED);
+	  // store stats
+	  eNB->eNB_stats[CC_id].dlsch_bytes_tx += sdu_length_total;
+	  eNB->eNB_stats[CC_id].dlsch_pdus_tx += 1;
+
+	  UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
+          UE_list->eNB_UE_stats[CC_id][UE_id].num_mac_sdu_tx = num_sdus;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = mcs;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS;
+
+	  UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes = TBS - sdu_length_total;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes += sdu_length_total;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes += TBS;
+	  UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus += 1;
+
+	  if (cc[CC_id].tdd_Config != NULL) {	// TDD
+	    UE_list->UE_template[CC_id][UE_id].DAI++;
+	    update_ul_dci(module_idP, CC_id, rnti,
+			  UE_list->UE_template[CC_id][UE_id].
+			  DAI);
+	  }
 
 	  // do PUCCH power control
-          // this is the normalized RX power
-	  eNB_UE_stats =  &UE_list->eNB_UE_stats[CC_id][UE_id];
+	  // this is the normalized RX power
+	  eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
 
-          /* TODO: fix how we deal with power, unit is not dBm, it's special from nfapi */
+	  /* TODO: fix how we deal with power, unit is not dBm, it's special from nfapi */
 	  normalized_rx_power = ue_sched_ctl->pucch1_snr[CC_id];
 	  target_rx_power = 208;
-	    
-          // this assumes accumulated tpc
+
+	  // this assumes accumulated tpc
 	  // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
-	  int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
-          if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case
-	      ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around
-	    if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) { 
+	  int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame * 10 + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
+	  if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) ||	//normal case
+	      ((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10))))	//frame wrap-around
+	    if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) {
 	      ue_sched_ctl->pucch1_cqi_update[CC_id] = 0;
 
-	      UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP;
-	      UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframeP;
-	      
-	      if (normalized_rx_power>(target_rx_power+4)) {
-		tpc = 0; //-1
-		tpc_accumulated--;
-	      } else if (normalized_rx_power<(target_rx_power-4)) {
-		tpc = 2; //+1
-		tpc_accumulated++;
+	      UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frameP;
+	      UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframeP;
+
+	      if (normalized_rx_power > (target_rx_power + 4)) {
+		tpc = 0;	//-1
+	      } else if (normalized_rx_power < (target_rx_power - 4)) {
+		tpc = 2;	//+1
 	      } else {
-		tpc = 1; //0
+		tpc = 1;	//0
 	      }
-	      	      
-	      LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
-		    module_idP,frameP, subframeP,harq_pid,tpc,
-		    tpc_accumulated,normalized_rx_power,target_rx_power);
 
-	    } // Po_PUCCH has been updated 
+	      LOG_D(MAC,
+		    "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n",
+		    module_idP, frameP, subframeP, harq_pid, tpc,
+		    normalized_rx_power, target_rx_power);
+
+	    }	// Po_PUCCH has been updated
 	    else {
-	      tpc = 1; //0
-	    } // time to do TPC update 
+	      tpc = 1;	//0
+	    }	// time to do TPC update
 	  else {
-	    tpc = 1; //0
+	    tpc = 1;	//0
 	  }
 
-	  dl_config_pdu                                                         = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; 
-	  memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
-	  dl_config_pdu->pdu_type                                               = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; 
-	  dl_config_pdu->pdu_size                                               = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format                  = NFAPI_DL_DCI_FORMAT_1;
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level           = get_aggregation(get_bw_index(module_idP,CC_id),ue_sched_ctl->dl_cqi[CC_id],format1);
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti                        = rnti;
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type                   = 1;    // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power          = 6000; // equal to RS power
-	  
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process                = harq_pid;
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc                         = tpc; // dont adjust power when retransmitting
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1        = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1                       = mcs;
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1        = 0;
+	  dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+	  memset((void *) dl_config_pdu, 0,
+		 sizeof(nfapi_dl_config_request_pdu_t));
+	  dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
+	  dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1;
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP, CC_id),
+											ue_sched_ctl->dl_cqi[CC_id],
+											format1);
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti;
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1;	// CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000;	// equal to RS power
+
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = harq_pid;
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = tpc;	// dont adjust power when retransmitting
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs;
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0;
 	  //deactivate second codeword
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2                       = 0;
-	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2        = 1;
-	  if (cc[CC_id].tdd_Config != NULL) { //TDD
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
-	    LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, dai %d, mcs %d\n",
-		  module_idP,CC_id,harq_pid,
-		  (UE_list->UE_template[CC_id][UE_id].DAI-1),
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = 0;
+	  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = 1;
+	  if (cc[CC_id].tdd_Config != NULL) {	//TDD
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = (UE_list->UE_template[CC_id][UE_id].DAI - 1) & 3;
+	    LOG_D(MAC,
+		  "[eNB %d] Initial transmission CC_id %d : harq_pid %d, dai %d, mcs %d\n",
+		  module_idP, CC_id, harq_pid,
+		  (UE_list->UE_template[CC_id][UE_id].DAI - 1),
 		  mcs);
 	  } else {
-	    LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n",
-		  module_idP,CC_id,harq_pid,mcs);
-	    
+	    LOG_D(MAC,
+		  "[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n",
+		  module_idP, CC_id, harq_pid, mcs);
+
 	  }
-	  LOG_D(MAC,"Checking feasibility pdu %d (new sdu)\n",dl_req->number_pdu);
-	  if (!CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,rnti)) {
 
+	  LOG_D(MAC, "Checking feasibility pdu %d (new sdu)\n",
+		dl_req->number_pdu);
 
+	  if (!CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP,
+					 dl_config_pdu->dci_dl_pdu.
+					 dci_dl_pdu_rel8.aggregation_level, rnti)) {
 	    ue_sched_ctl->round[CC_id][harq_pid] = 0;
 	    dl_req->number_dci++;
 	    dl_req->number_pdu++;
-	    
+	    dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+
+	    eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
+	    eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
+
 	    // Toggle NDI for next time
-	    LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n",
-		  CC_id, frameP,subframeP,UE_id,
-		  rnti,harq_pid,UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]);
-	    
-	    UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
+	    LOG_D(MAC,
+		  "CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n",
+		  CC_id, frameP, subframeP, UE_id, rnti,
+		  harq_pid,
+		  UE_list->
+		  UE_template[CC_id][UE_id].oldNDI[harq_pid]);
+
+	    UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
 	    UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid] = mcs;
 	    UE_list->UE_template[CC_id][UE_id].oldmcs2[harq_pid] = 0;
-	    AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated is NULL\n");
-	    AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated!=NULL,"physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n");
-	    
-	    fill_nfapi_dlsch_config(eNB,dl_req,
-				    TBS,
-				    eNB->pdu_index[CC_id],
-				    rnti,
-				    0, // type 0 allocation from 7.1.6 in 36.213
-				    0, // virtual_resource_block_assignment_flag, unused here
-				    0, // resource_block_coding, to be filled in later
-				    getQm(mcs),
-				    0, // redundancy version
-				    1, // transport blocks
-				    0, // transport block to codeword swap flag
-				    cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme
-				    1, // number of layers
-				    1, // number of subbands
-				    //			     uint8_t codebook_index,
-				    4, // UE category capacity
-				    UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 
-				    0, // delta_power_offset for TM5
-				    0, // ngap
-				    0, // nprb
-				    cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode
-				    0, //number of PRBs treated as one subband, not used here
-				    0 // number of beamforming vectors, not used here
-				    );  
+	    AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL,
+			"physicalConfigDedicated is NULL\n");
+	    AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated != NULL,
+			"physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n");
+
+	    fill_nfapi_dlsch_config(eNB, dl_req, TBS, eNB->pdu_index[CC_id], rnti, 0,	// type 0 allocation from 7.1.6 in 36.213
+				    0,	// virtual_resource_block_assignment_flag, unused here
+				    0,	// resource_block_coding, to be filled in later
+				    getQm(mcs), 0,	// redundancy version
+				    1,	// transport blocks
+				    0,	// transport block to codeword swap flag
+				    cc[CC_id].p_eNB == 1 ? 0 : 1,	// transmission_scheme
+				    1,	// number of layers
+				    1,	// number of subbands
+				    //                       uint8_t codebook_index,
+				    4,	// UE category capacity
+				    UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 0,	// delta_power_offset for TM5
+				    0,	// ngap
+				    0,	// nprb
+				    cc[CC_id].p_eNB == 1 ? 1 : 2,	// transmission mode
+				    0,	//number of PRBs treated as one subband, not used here
+				    0	// number of beamforming vectors, not used here
+				    );
 	    eNB->TX_req[CC_id].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_id].tx_request_body,
-							  (frameP*10)+subframeP,
-							  TBS,
-							  eNB->pdu_index[CC_id],
-							  eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0]);
-	    
-	    LOG_D(MAC,"Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n",eNB->pdu_index[CC_id]);
+							  (frameP * 10) + subframeP,
+							  TBS, eNB->pdu_index[CC_id],
+							  eNB->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0]);
 
-	    eNB->pdu_index[CC_id]++;
-	    program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
+	    LOG_D(MAC,
+		  "Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n",
+		  eNB->pdu_index[CC_id]);
 
+	    eNB->pdu_index[CC_id]++;
+	    program_dlsch_acknak(module_idP, CC_id, UE_id,
+				 frameP, subframeP,
+				 dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
+	  } else {
+	    LOG_W(MAC,
+		  "Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n",
+		  frameP, subframeP, UE_id, rnti);
 	  }
-	  else {
-	    LOG_W(MAC,"Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n",
-		  frameP,subframeP,UE_id,rnti);
-	  }
-        } else {  // There is no data from RLC or MAC header, so don't schedule
+	} else {	// There is no data from RLC or MAC header, so don't schedule
 
-        }
+	}
       }
 
-      if (cc[CC_id].tdd_Config != NULL){ // TDD
-        set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
+      if (cc[CC_id].tdd_Config != NULL) {	// TDD
+	set_ul_DAI(module_idP, UE_id, CC_id, frameP, subframeP);
       }
 
-    } // UE_id loop
-  }  // CC_id loop
+    }			// UE_id loop
+  }				// CC_id loop
 
 
-     
-  fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_flag);
 
-  stop_meas(&eNB->schedule_dlsch);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT);
+  fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_flag);
 
+  stop_meas(&eNB->schedule_dlsch);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_OUT);
 }
 
 //------------------------------------------------------------------------------
 void
-fill_DLSCH_dci(
-	       module_id_t module_idP,
-	       frame_t frameP,
-	       sub_frame_t subframeP,
-	       int* mbsfn_flagP
-	       )
+fill_DLSCH_dci(module_id_t module_idP,
+	       frame_t frameP, sub_frame_t subframeP, int *mbsfn_flagP)
 //------------------------------------------------------------------------------
 {
 
   // loop over all allocated UEs and compute frequency allocations for PDSCH
-  int   UE_id = -1;
-  uint8_t            /* first_rb, */ nb_rb=3;
-  rnti_t        rnti;
+  int UE_id = -1;
+  uint8_t /* first_rb, */ nb_rb = 3;
+  rnti_t rnti;
   //unsigned char *vrb_map;
-  uint8_t            rballoc_sub[25];
+  uint8_t rballoc_sub[25];
   //uint8_t number_of_subbands=13;
 
   //unsigned char round;
-  unsigned char     harq_pid;
-  int               i;
-  int               CC_id;
-  eNB_MAC_INST      *eNB  =RC.mac[module_idP];
-  UE_list_t         *UE_list = &eNB->UE_list;
-  int               N_RBG;
-  int               N_RB_DL;
+  unsigned char harq_pid;
+  int i;
+  int CC_id;
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+  UE_list_t *UE_list = &eNB->UE_list;
+  int N_RBG;
+  int N_RB_DL;
   COMMON_channels_t *cc;
 
   start_meas(&eNB->fill_DLSCH_dci);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,VCD_FUNCTION_IN);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+    (VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI, VCD_FUNCTION_IN);
 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    LOG_D(MAC,"Doing fill DCI for CC_id %d\n",CC_id);
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    LOG_D(MAC, "Doing fill DCI for CC_id %d\n", CC_id);
 
-    if (mbsfn_flagP[CC_id]>0)
+    if (mbsfn_flagP[CC_id] > 0)
       continue;
 
-    cc              = &eNB->common_channels[CC_id];
-    N_RBG           = to_rbg(cc->mib->message.dl_Bandwidth);
-    N_RB_DL         = to_prb(cc->mib->message.dl_Bandwidth);
+    cc = &eNB->common_channels[CC_id];
+    N_RBG = to_rbg(cc->mib->message.dl_Bandwidth);
+    N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
 
     // UE specific DCIs
-    for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
-      LOG_T(MAC,"CC_id %d, UE_id: %d => status %d\n",CC_id,UE_id,eNB_dlsch_info[module_idP][CC_id][UE_id].status);
+    for (UE_id = UE_list->head; UE_id >= 0;
+	 UE_id = UE_list->next[UE_id]) {
+      LOG_T(MAC, "CC_id %d, UE_id: %d => status %d\n", CC_id, UE_id,
+	    eNB_dlsch_info[module_idP][CC_id][UE_id].status);
 
       if (eNB_dlsch_info[module_idP][CC_id][UE_id].status == S_DL_SCHEDULED) {
 
-        // clear scheduling flag
-        eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_WAITING;
-        rnti = UE_RNTI(module_idP,UE_id);
-	if (cc->tdd_Config) harq_pid = ((frameP*10)+subframeP)%10;
-	else harq_pid = ((frameP*10)+subframeP)&7;
-        nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
+	// clear scheduling flag
+	eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_WAITING;
+	rnti = UE_RNTI(module_idP, UE_id);
+	if (cc->tdd_Config) harq_pid = ((frameP * 10) + subframeP) % 10;
+	else          	    harq_pid = ((frameP * 10) + subframeP) & 7;
+	nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
 
+	/// Synchronizing rballoc with rballoc_sub
+	for (i = 0; i < N_RBG; i++) {
+	  rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i];
+	}
 
-	
-        /// Synchronizing rballoc with rballoc_sub
-        for(i=0; i<N_RBG; i++) {
-          rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i];
-        }
-
-	nfapi_dl_config_request_t      *DL_req         = &RC.mac[module_idP]->DL_req[0];
-	nfapi_dl_config_request_pdu_t* dl_config_pdu;
-
-	for (i=0;i<DL_req[CC_id].dl_config_request_body.number_pdu;i++) {
-	  dl_config_pdu                    = &DL_req[CC_id].dl_config_request_body.dl_config_pdu_list[i];
-	  if ((dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&&
-	      (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti == rnti) &&
-          (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format != 1)) {
-	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding    = allocate_prbs_sub(nb_rb,N_RB_DL,N_RBG,rballoc_sub);
+	nfapi_dl_config_request_t *DL_req = &RC.mac[module_idP]->DL_req[0];
+	nfapi_dl_config_request_pdu_t *dl_config_pdu;
+
+	for (i = 0;
+	     i < DL_req[CC_id].dl_config_request_body.number_pdu;
+	     i++) {
+	  dl_config_pdu = &DL_req[CC_id].dl_config_request_body.dl_config_pdu_list[i];
+	  if ((dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
+	      && (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti == rnti)
+	      && (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format != 1)) {
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG,rballoc_sub);
 	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = 0;
-	  }
-	  else if ((dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)&&
-		       (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti == rnti) &&
-               (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type==0)) {
-	    dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding    = allocate_prbs_sub(nb_rb,N_RB_DL,N_RBG,rballoc_sub);
-	  }
+	  } else
+	    if ((dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)
+		&& (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti == rnti)
+		&& (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type == 0)) {
+	      dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding =allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG,rballoc_sub);
+	    }
 	}
       }
     }
@@ -1412,37 +1596,43 @@ fill_DLSCH_dci(
   }
 
   stop_meas(&eNB->fill_DLSCH_dci);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,VCD_FUNCTION_OUT);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI, VCD_FUNCTION_OUT);
 }
 
 //------------------------------------------------------------------------------
-unsigned char*
-get_dlsch_sdu(
-  module_id_t module_idP,
-  int CC_id,
-  frame_t frameP,
-  rnti_t rntiP,
-  uint8_t TBindex
-)
+unsigned char *get_dlsch_sdu(module_id_t module_idP,
+			     int CC_id, frame_t frameP, rnti_t rntiP,
+			     uint8_t TBindex)
 //------------------------------------------------------------------------------
 {
 
   int UE_id;
-  eNB_MAC_INST *eNB=RC.mac[module_idP];
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+
+  if (rntiP == SI_RNTI) {
+    LOG_D(MAC, "[eNB %d] CC_id %d Frame %d Get DLSCH sdu for BCCH \n",
+	  module_idP, CC_id, frameP);
+
+    return ((unsigned char *) &eNB->common_channels[CC_id].BCCH_pdu.payload[0]);
+  }
 
-  if (rntiP==SI_RNTI) {
-    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d Get DLSCH sdu for BCCH \n", module_idP, CC_id, frameP);
+  if (rntiP==P_RNTI) {
+    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d Get PCH sdu for PCCH \n", module_idP, CC_id, frameP);
 
-    return((unsigned char *)&eNB->common_channels[CC_id].BCCH_pdu.payload[0]);
+    return((unsigned char *)&eNB->common_channels[CC_id].PCCH_pdu.payload[0]);
   }
 
   UE_id = find_UE_id(module_idP,rntiP);
 
   if (UE_id != -1) {
-    LOG_D(MAC,"[eNB %d] Frame %d:  CC_id %d Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,CC_id,rntiP,UE_id);
-    return((unsigned char *)&eNB->UE_list.DLSCH_pdu[CC_id][TBindex][UE_id].payload[0]);
+    LOG_D(MAC,
+	  "[eNB %d] Frame %d:  CC_id %d Get DLSCH sdu for rnti %x => UE_id %d\n",
+	  module_idP, frameP, CC_id, rntiP, UE_id);
+    return ((unsigned char *) &eNB->UE_list.DLSCH_pdu[CC_id][TBindex][UE_id].payload[0]);
   } else {
-    LOG_E(MAC,"[eNB %d] Frame %d: CC_id %d UE with RNTI %x does not exist\n", module_idP,frameP,CC_id,rntiP);
+    LOG_E(MAC,
+	  "[eNB %d] Frame %d: CC_id %d UE with RNTI %x does not exist\n",
+	  module_idP, frameP, CC_id, rntiP);
     return NULL;
   }
 
@@ -1450,86 +1640,89 @@ get_dlsch_sdu(
 
 
 //------------------------------------------------------------------------------
-void update_ul_dci(module_id_t module_idP,
-		   uint8_t CC_idP,
-		   rnti_t rntiP,
-		   uint8_t daiP)
+void
+update_ul_dci(module_id_t module_idP,
+	      uint8_t CC_idP, rnti_t rntiP, uint8_t daiP)
 //------------------------------------------------------------------------------
 {
 
-  nfapi_hi_dci0_request_t *HI_DCI0_req    = &RC.mac[module_idP]->HI_DCI0_req[CC_idP];
-  nfapi_hi_dci0_request_pdu_t  *hi_dci0_pdu    = &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[0];
-  COMMON_channels_t    *cc                     = &RC.mac[module_idP]->common_channels[CC_idP];
+  nfapi_hi_dci0_request_t *HI_DCI0_req =
+    &RC.mac[module_idP]->HI_DCI0_req[CC_idP];
+  nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
+    &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[0];
+  COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_idP];
   int i;
 
 
-  if (cc->tdd_Config != NULL) { // TDD 
-    for (i=0; i<HI_DCI0_req->hi_dci0_request_body.number_of_dci + HI_DCI0_req->hi_dci0_request_body.number_of_dci; i++) {
+  if (cc->tdd_Config != NULL) {	// TDD
+    for (i = 0;
+	 i <HI_DCI0_req->hi_dci0_request_body.number_of_dci + HI_DCI0_req->hi_dci0_request_body.number_of_dci;
+	 i++) {
 
-      if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE)  && 
+      if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) &&
 	  (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti == rntiP))
-        hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.dl_assignment_index = (daiP-1)&3;
-      
+	hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.dl_assignment_index = (daiP - 1) & 3;
+
     }
   }
 }
 
 
 //------------------------------------------------------------------------------
-void set_ue_dai(
-  sub_frame_t   subframeP,
-  int           UE_id,
-  uint8_t       CC_id,
-  uint8_t       tdd_config,
-  UE_list_t*    UE_list
-)
+void
+set_ue_dai(sub_frame_t subframeP,
+	   int UE_id, uint8_t CC_id, uint8_t tdd_config,
+	   UE_list_t * UE_list)
 //------------------------------------------------------------------------------
 {
   switch (tdd_config) {
   case 0:
-    if ((subframeP==0)||(subframeP==1)||(subframeP==3)||(subframeP==5)||(subframeP==6)||(subframeP==8)) {
+    if ((subframeP == 0) || (subframeP == 1) || (subframeP == 3)
+	|| (subframeP == 5) || (subframeP == 6) || (subframeP == 8)) {
       UE_list->UE_template[CC_id][UE_id].DAI = 0;
     }
 
     break;
 
   case 1:
-    if ((subframeP==0)||(subframeP==4)||(subframeP==5)||(subframeP==9)) {
+    if ((subframeP == 0) || (subframeP == 4) || (subframeP == 5)
+	|| (subframeP == 9)) {
       UE_list->UE_template[CC_id][UE_id].DAI = 0;
     }
 
     break;
 
   case 2:
-    if ((subframeP==4)||(subframeP==5)) {
+    if ((subframeP == 4) || (subframeP == 5)) {
       UE_list->UE_template[CC_id][UE_id].DAI = 0;
     }
 
     break;
 
   case 3:
-    if ((subframeP==5)||(subframeP==7)||(subframeP==9)) {
+    if ((subframeP == 5) || (subframeP == 7) || (subframeP == 9)) {
       UE_list->UE_template[CC_id][UE_id].DAI = 0;
     }
 
     break;
 
   case 4:
-    if ((subframeP==0)||(subframeP==6)) {
+    if ((subframeP == 0) || (subframeP == 6)) {
       UE_list->UE_template[CC_id][UE_id].DAI = 0;
     }
 
     break;
 
   case 5:
-    if (subframeP==9) {
+    if (subframeP == 9) {
       UE_list->UE_template[CC_id][UE_id].DAI = 0;
     }
 
     break;
 
   case 6:
-    if ((subframeP==0)||(subframeP==1)||(subframeP==5)||(subframeP==6)||(subframeP==9)) {
+    if ((subframeP == 0) || (subframeP == 1) || (subframeP == 5)
+	|| (subframeP == 6) || (subframeP == 9)) {
       UE_list->UE_template[CC_id][UE_id].DAI = 0;
     }
 
@@ -1537,7 +1730,353 @@ void set_ue_dai(
 
   default:
     UE_list->UE_template[CC_id][UE_id].DAI = 0;
-    LOG_N(MAC,"unknow TDD config %d\n",tdd_config);
+    LOG_N(MAC, "unknow TDD config %d\n", tdd_config);
     break;
   }
 }
+
+void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
+{
+  /* DCI:format 1A/1C P-RNTI:0xFFFE */
+  /* PDU:eNB_rrc_inst[Mod_idP].common_channels[CC_id].PCCH_pdu.payload */
+  uint16_t                       pcch_sdu_length;
+  int                            mcs = -1;
+  int                            CC_id;
+  eNB_MAC_INST                   *eNB      = RC.mac[module_idP];
+  COMMON_channels_t              *cc;
+  uint8_t                        *vrb_map;
+  int                            n_rb_dl;
+  int                            first_rb = -1;
+  nfapi_dl_config_request_pdu_t  *dl_config_pdu;
+  nfapi_tx_request_pdu_t         *TX_req;
+  nfapi_dl_config_request_body_t *dl_req;
+#ifdef FORMAT1C
+  int                            gap_index = 0;      /* indicate which gap(1st or 2nd) is used (0:1st) */
+  const int                      GAP_MAP [9][2] = {
+    {-1, 0},        /* N_RB_DL [6-10] -1: |N_RB/2| 0: N/A*/
+    {4, 0},         /* N_RB_DL [11] */
+    {8, 0},         /* N_RB_DL [12-19] */
+    {12, 0},        /* N_RB_DL [20-26] */
+    {18, 0},        /* N_RB_DL [27-44] */
+    {27, 0},        /* N_RB_DL [45-49] */
+    {27, 9},        /* N_RB_DL [50-63] */
+    {32, 16},       /* N_RB_DL [64-79] */
+    {48, 16}        /* N_RB_DL [80-110] */
+  };
+  uint8_t                        n_rb_step = 0;
+  uint8_t                        n_gap = 0;
+  uint8_t                        n_vrb_dl = 0;
+  uint8_t                        Lcrbs = 0;
+  uint16_t                       rb_bit    = 168;    /* RB bit number value is unsure */
+#endif
+
+  start_meas(&eNB->schedule_pch);
+
+  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+    cc              = &eNB->common_channels[CC_id];
+    vrb_map         = (void*)&cc->vrb_map;
+    n_rb_dl         = to_prb(cc->mib->message.dl_Bandwidth);
+    dl_req          = &eNB->DL_req[CC_id].dl_config_request_body;
+    for (uint16_t i = 0; i < NUMBER_OF_UE_MAX; i++) {
+      if (UE_PF_PO[CC_id][i].enable_flag != TRUE) {
+        continue;
+      }
+      if (frameP % UE_PF_PO[CC_id][i].T == UE_PF_PO[CC_id][i].PF_min && subframeP == UE_PF_PO[CC_id][i].PO) {
+	pcch_sdu_length = mac_rrc_data_req(module_idP,
+                                           CC_id,
+                                           frameP,
+                                           PCCH,1,
+                                           &cc->PCCH_pdu.payload[0],
+                                           i); // used for ue index
+	if (pcch_sdu_length == 0) {
+	  LOG_D(MAC,"[eNB %d] Frame %d subframe %d: PCCH not active(size = 0 byte)\n", module_idP,frameP, subframeP);
+	  continue;
+	}
+	LOG_D(MAC,"[eNB %d] Frame %d subframe %d: PCCH->PCH CC_id %d UE_id %d, Received %d bytes \n", module_idP, frameP, subframeP, CC_id,i, pcch_sdu_length);
+#ifdef FORMAT1C
+	//NO SIB
+	if ((subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
+	    (subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) {
+	  switch (n_rb_dl) {
+#if 0
+	  case 6:
+	    n_gap = n_rb_dl/2;  /* expect: 3 */
+	    n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));;  /* expect: 6 */
+	    first_rb = 0;
+	    break;
+	  case 15:
+	    n_gap = GAP_MAP[2][0];  /* expect: 8 */
+	    n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));  /* expect: 14 */
+	    first_rb = 6;
+	    break;
+#endif
+	  case 25:
+	    n_gap = GAP_MAP[3][0];  /* expect: 12 */
+	    n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));  /* expect: 24 */
+	    first_rb = 10;
+	    break;
+	  case 50:
+	    n_gap = GAP_MAP[6][gap_index];  /* expect: 27 or 9 */
+	    if (gap_index > 0) {
+	      n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap);  /* 36 */
+	    } else {
+	      n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));  /* expect: 46 */
+	    }
+	    first_rb = 24;
+	    break;
+	  case 100:
+	    n_gap = GAP_MAP[8][gap_index];  /* expect: 48 or 16 */
+	    if (gap_index > 0) {
+	      n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap);  /* expect: 96 */
+	    } else {
+	      n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));  /* expect: 96 */
+	    }
+	    first_rb = 48;
+	    break;
+	  }
+	} else if (subframeP == 5 && ((frameP % 2) == 0 || (frameP % 8) == 1)) {  // SIB + paging
+	  switch (n_rb_dl) {
+#if 0
+	  case 6:
+	    n_gap = n_rb_dl/2;  /* expect: 3 */
+	    n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));;  /* expect: 6 */
+	    first_rb = 0;
+	    break;
+	  case 15:
+	    n_gap = GAP_MAP[2][0];  /* expect: 8 */
+	    n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));  /* expect: 14 */
+	    first_rb = 10;
+	    break;
+#endif
+	  case 25:
+	    n_gap = GAP_MAP[3][0];  /* expect: 12 */
+	    n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));  /* expect: 24 */
+	    first_rb = 14;
+	    break;
+	  case 50:
+	    n_gap = GAP_MAP[6][gap_index];  /* expect: 27 or 9 */
+	    if (gap_index > 0) {
+	      n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap);  /* 36 */
+	    } else {
+	      n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));  /* expect: 46 */
+	    }
+	    first_rb = 28;
+	    break;
+	  case 100:
+	    n_gap = GAP_MAP[8][gap_index];  /* expect: 48 or 16 */
+	    if (gap_index > 0) {
+	      n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap);  /* expect: 96 */
+	    } else {
+	      n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));  /* expect: 96 */
+	    }
+	    first_rb = 52;
+	    break;
+	  }
+	}
+	/* Get MCS for length of PCH */
+	if (pcch_sdu_length <= TBStable1C[0]) {
+	  mcs=0;
+	} else if (pcch_sdu_length <= TBStable1C[1]) {
+	  mcs=1;
+	} else if (pcch_sdu_length <= TBStable1C[2]) {
+	  mcs=2;
+	} else if (pcch_sdu_length <= TBStable1C[3]) {
+	  mcs=3;
+	} else if (pcch_sdu_length <= TBStable1C[4]) {
+	  mcs=4;
+	} else if (pcch_sdu_length <= TBStable1C[5]) {
+	  mcs=5;
+	} else if (pcch_sdu_length <= TBStable1C[6]) {
+	  mcs=6;
+	} else if (pcch_sdu_length <= TBStable1C[7]) {
+	  mcs=7;
+	} else if (pcch_sdu_length <= TBStable1C[8]) {
+	  mcs=8;
+	} else if (pcch_sdu_length <= TBStable1C[9]) {
+	  mcs=9;
+	} else {
+	  /* unexpected: pcch sdb size is over max value*/
+	  LOG_E(MAC,"[eNB %d] Frame %d : PCCH->PCH CC_id %d, Received %d bytes is over max length(256) \n",
+		module_idP, frameP,CC_id, pcch_sdu_length);
+	  return;
+	}
+	rb_num = TBStable1C[mcs] / rb_bit + ( (TBStable1C[mcs] % rb_bit == 0)? 0: 1) + 1;
+	/* calculate N_RB_STEP and Lcrbs */
+	if (n_rb_dl < 50) {
+	  n_rb_step = 2;
+	  Lcrbs = rb_num / 2 + ((rb_num % 2 == 0) ? 0:2);
+	} else {
+	  n_rb_step = 4;
+	  Lcrbs = rb_num / 4 + ((rb_num % 4 == 0) ? 0:4);
+	}
+	for(i = 0;i < Lcrbs ;i++){
+	  vrb_map[first_rb+i] = 1;
+	}
+#else
+	//NO SIB
+	if ((subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
+	    (subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) {
+	  switch (n_rb_dl) {
+	  case 25:
+	    first_rb = 10;
+	    break;
+	  case 50:
+	    first_rb = 24;
+	    break;
+	  case 100:
+	    first_rb = 48;
+	    break;
+	  }
+	} else if (subframeP == 5 && ((frameP % 2) == 0 || (frameP % 8) == 1)) {  // SIB + paging
+	  switch (n_rb_dl) {
+	  case 25:
+	    first_rb = 14;
+	    break;
+	  case 50:
+	    first_rb = 28;
+	    break;
+	  case 100:
+	    first_rb = 52;
+	    break;
+	  }
+	}
+
+	vrb_map[first_rb] = 1;
+	vrb_map[first_rb+1] = 1;
+	vrb_map[first_rb+2] = 1;
+	vrb_map[first_rb+3] = 1;
+	/* Get MCS for length of PCH */
+	if (pcch_sdu_length <= get_TBS_DL(0,3)) {
+	  mcs=0;
+	} else if (pcch_sdu_length <= get_TBS_DL(1,3)) {
+	  mcs=1;
+	} else if (pcch_sdu_length <= get_TBS_DL(2,3)) {
+	  mcs=2;
+	} else if (pcch_sdu_length <= get_TBS_DL(3,3)) {
+	  mcs=3;
+	} else if (pcch_sdu_length <= get_TBS_DL(4,3)) {
+	  mcs=4;
+	} else if (pcch_sdu_length <= get_TBS_DL(5,3)) {
+	  mcs=5;
+	} else if (pcch_sdu_length <= get_TBS_DL(6,3)) {
+	  mcs=6;
+	} else if (pcch_sdu_length <= get_TBS_DL(7,3)) {
+	  mcs=7;
+	} else if (pcch_sdu_length <= get_TBS_DL(8,3)) {
+	  mcs=8;
+	} else if (pcch_sdu_length <= get_TBS_DL(9,3)) {
+	  mcs=9;
+	}
+#endif
+	dl_config_pdu                                                         = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+	memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
+	dl_config_pdu->pdu_type                                               = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
+	dl_config_pdu->pdu_size                                               = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
+#ifdef FORMAT1C
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format                  = NFAPI_DL_DCI_FORMAT_1C;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding       = getRIV(n_vrb_dl/n_rb_step, first_rb/n_rb_step, Lcrbs/n_rb_step);
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.ngap                        = n_gap;
+#else
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format                  = NFAPI_DL_DCI_FORMAT_1A;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process                = 0;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc                         = 1; // no TPC
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1        = 1;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1        = 1;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding       = getRIV(n_rb_dl,first_rb,4);
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = 0;
+#endif
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level           = 4;
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti                        = 0xFFFE; // P-RNTI
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type                   = 2;    // P-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power          = 6000; // equal to RS power
+	dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1                       = mcs;
+
+	// Rel10 fields
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start                           = 3;
+	// Rel13 fields
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type                               = 0; // regular UE
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type                    = 2; // not BR
+	dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io            = 0xFFFF;
+
+	if (!CCE_allocation_infeasible(module_idP, CC_id, 0, subframeP, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, P_RNTI)) {
+	  LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for P_RNTI\n", frameP,subframeP);
+	  dl_req->number_dci++;
+	  dl_req->number_pdu++;
+	  dl_config_pdu                                                                  = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+	  memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
+	  dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+	  dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = eNB->pdu_index[CC_id];
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = 0xFFFE;
+#ifdef FORMAT1C
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 3;   // format 1C
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(n_vrb_dl/n_rb_step, first_rb/n_rb_step, Lcrbs/n_rb_step);
+#else
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type               = 2;   // format 1A/1B/1D
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding                  = getRIV(n_rb_dl,first_rb,4);
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0;   // localized
+#endif
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation                             = 2; //QPSK
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version                     = 1;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks                       = 1;// first block
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag  = 0;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme                    = (cc->p_eNB==1 ) ? 0 : 1;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers                       = 1;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands                     = 1;
+	  // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index                         = ;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity                   = 1;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa                                     = 4; // 0 dB
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index               = 0;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap                                   = 0;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb                                   = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode                      = (cc->p_eNB==1 ) ? 1 : 2;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband                 = 1;
+	  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector                          = 1;
+	  // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector                    = ;
+	  dl_req->number_pdu++;
+
+	  eNB->TX_req[CC_id].sfn_sf                                                     = (frameP<<4)+subframeP;
+	  TX_req                                                                         = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+	  TX_req->pdu_length                                                             = pcch_sdu_length;
+	  TX_req->pdu_index                                                              = eNB->pdu_index[CC_id]++;
+	  TX_req->num_segments                                                           = 1;
+	  TX_req->segments[0].segment_length                                             = pcch_sdu_length;
+	  TX_req->segments[0].segment_data                                               = cc[CC_id].PCCH_pdu.payload;
+	  eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+	} else {
+	  LOG_E(MAC,"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A/1C for Paging\n",module_idP, CC_id, frameP, subframeP);
+	  continue;
+	}
+
+	if (opt_enabled == 1) {
+	  trace_pdu(1,
+		    &eNB->common_channels[CC_id].PCCH_pdu.payload[0],
+		    pcch_sdu_length,
+		    0xffff,
+		    PCCH,
+		    P_RNTI,
+		    eNB->frame,
+		    eNB->subframe,
+		    0,
+		    0);
+	  LOG_D(OPT,"[eNB %d][PCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
+		module_idP, frameP, CC_id, 0xffff, pcch_sdu_length);
+	}
+	eNB->eNB_stats[CC_id].total_num_pcch_pdu+=1;
+	eNB->eNB_stats[CC_id].pcch_buffer=pcch_sdu_length;
+	eNB->eNB_stats[CC_id].total_pcch_buffer+=pcch_sdu_length;
+	eNB->eNB_stats[CC_id].pcch_mcs=mcs;
+	//paging first_rb log
+	LOG_D(MAC,"[eNB %d] Frame %d subframe %d PCH: paging_ue_index %d pcch_sdu_length %d mcs %d first_rb %d\n",
+	      module_idP, frameP, subframeP, UE_PF_PO[CC_id][i].ue_index_value, pcch_sdu_length, mcs, first_rb);
+
+	pthread_mutex_lock(&ue_pf_po_mutex);
+	memset(&UE_PF_PO[CC_id][i], 0, sizeof(UE_PF_PO_t));
+	pthread_mutex_unlock(&ue_pf_po_mutex);
+      }
+    }
+  }
+  /* this might be misleading when pcch is inactive */
+  stop_meas(&eNB->schedule_pch);
+  return;
+}
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
index 67fba12ce720a70e6f99f2c03789f58b5f8be819..37b13d2de71936b52dec051274b91e4c73bdd3fe 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -52,10 +52,10 @@
 #include "pdcp.h"
 
 #if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+#include "intertask_interface.h"
 #endif
 
-#include "SIMULATION/TOOLS/defs.h" // for taus
+#include "SIMULATION/TOOLS/defs.h"	// for taus
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
 #define DEBUG_eNB_SCHEDULER 1
@@ -63,607 +63,745 @@
 extern RAN_CONTEXT_t RC;
 
 #if defined(Rel10) || defined(Rel14)
-int8_t get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t CC_id, uint8_t mbsfn_sync_area)
+int8_t
+get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id,
+		       uint8_t mbsfn_sync_area)
 {
-  // currently there is one-to-one mapping between sf allocation pattern and sync area
-  if (mbsfn_sync_area > MAX_MBSFN_AREA) {
-    LOG_W(MAC,"[eNB %d] CC_id %d MBSFN synchronization area %d out of range\n ", module_idP, CC_id, mbsfn_sync_area);
-    return -1;
-  } else if (RC.mac[module_idP]->common_channels[CC_id].mbsfn_SubframeConfig[mbsfn_sync_area] != NULL) {
-    return mbsfn_sync_area;
-  } else {
-    LOG_W(MAC,"[eNB %d] CC_id %d MBSFN Subframe Config pattern %d not found \n ", module_idP, CC_id, mbsfn_sync_area);
-    return -1;
-  }
+    // currently there is one-to-one mapping between sf allocation pattern and sync area
+    if (mbsfn_sync_area > MAX_MBSFN_AREA) {
+	LOG_W(MAC,
+	      "[eNB %d] CC_id %d MBSFN synchronization area %d out of range\n ",
+	      module_idP, CC_id, mbsfn_sync_area);
+	return -1;
+    } else if (RC.mac[module_idP]->
+	       common_channels[CC_id].mbsfn_SubframeConfig[mbsfn_sync_area]
+	       != NULL) {
+	return mbsfn_sync_area;
+    } else {
+	LOG_W(MAC,
+	      "[eNB %d] CC_id %d MBSFN Subframe Config pattern %d not found \n ",
+	      module_idP, CC_id, mbsfn_sync_area);
+	return -1;
+    }
 }
 
-int schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sub_frame_t subframeP)
+int
+schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
+	      sub_frame_t subframeP)
 {
 
-  int mcch_flag=0,mtch_flag=0, msi_flag=0;
-  int mbsfn_period =0;// 1<<(RC.mac[module_idP]->mbsfn_SubframeConfig[0]->radioframeAllocationPeriod);
-  int mcch_period = 0;//32<<(RC.mac[module_idP]->mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
-  int mch_scheduling_period = 8<<(RC.mac[module_idP]->common_channels[CC_id].pmch_Config[0]->mch_SchedulingPeriod_r9);
-  unsigned char mcch_sdu_length;
-  unsigned char header_len_mcch=0,header_len_msi=0,header_len_mtch=0, header_len_mtch_temp=0, header_len_mcch_temp=0, header_len_msi_temp=0;
-  int ii=0, msi_pos=0;
-  int mcch_mcs = -1;
-  uint16_t TBS,j=-1,padding=0,post_padding=0;
-  mac_rlc_status_resp_t rlc_status;
-  int num_mtch;
-  int msi_length,i,k;
-  unsigned char sdu_lcids[11], num_sdus=0, offset=0;
-  uint16_t sdu_lengths[11], sdu_length_total=0;
-  unsigned char mch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; // check the max value, this is for dlsch only
-
-  COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
-
-  cc->MCH_pdu.Pdu_size=0;
-
-  for (i=0;
-       i< cc->num_active_mbsfn_area;
-       i++ ) {
-    // assume, that there is always a mapping
-    if ((j=get_mbsfn_sf_alloction(module_idP,CC_id,i)) == -1) {
-      return 0;
-    }
-
-    mbsfn_period = 1<<(cc->mbsfn_SubframeConfig[j]->radioframeAllocationPeriod);
-    mcch_period = 32<<(cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
-    msi_pos=0;
-    ii=0;
-    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d : Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d)\n",
-          module_idP, CC_id, frameP, subframeP,i,cc->num_active_mbsfn_area,
-          j,cc->num_sf_allocation_pattern,mbsfn_period,mcch_period);
-
-
-    switch (cc->mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
-    case 0:
-      mcch_mcs = 2;
-      break;
-
-    case 1:
-      mcch_mcs = 7;
-      break;
-
-    case 2:
-      mcch_mcs = 13;
-      break;
-
-    case 3:
-      mcch_mcs = 19;
-      break;
-    }
-
-    // 1st: Check the MBSFN subframes from SIB2 info (SF allocation pattern i, max 8 non-overlapping patterns exist)
-    if (frameP %  mbsfn_period == cc->mbsfn_SubframeConfig[j]->radioframeAllocationOffset) { // MBSFN frameP
-      if (cc->mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { // one-frameP format
-
-        //  Find the first subframeP in this MCH to transmit MSI
-        if (frameP % mch_scheduling_period == cc->mbsfn_SubframeConfig[j]->radioframeAllocationOffset ) {
-          while (ii == 0) {
-            ii = cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & (0x80>>msi_pos);
-            msi_pos++;
-          }
-
-          LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d : sync area %d sf allocation pattern %d sf alloc %x msi pos is %d \n",
-                module_idP, CC_id, frameP, subframeP,i,j,
-                cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0], msi_pos);
-        }
-
-        // Check if the subframeP is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
-        switch (subframeP) {
-        case 1:
-          if (cc->tdd_Config == NULL) {
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
-              if (msi_pos == 1) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 2:
-          if (cc->tdd_Config == NULL) {
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) {
-              if (msi_pos == 2) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 3:
-          if (cc->tdd_Config != NULL) { // TDD
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) {
-              if (msi_pos == 1) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          } else { // FDD
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) {
-              if (msi_pos == 3) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 4:
-          if (cc->tdd_Config != NULL) {
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) {
-              if (msi_pos == 2) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 6:
-          if (cc->tdd_Config == NULL) {
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) {
-              if (msi_pos == 4) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 7:
-          if (cc->tdd_Config != NULL) { // TDD
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) {
-              if (msi_pos == 3) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          } else { // FDD
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
-              if (msi_pos == 5) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 8:
-          if (cc->tdd_Config != NULL) { //TDD
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) {
-              if (msi_pos == 4) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          } else { // FDD
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) {
-              if (msi_pos == 6) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 9:
-          if (cc->tdd_Config != NULL) {
-            if ((cc->mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) {
-              if (msi_pos == 5) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == cc->mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((cc->mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-        }// end switch
-
-        // sf allocation is non-overlapping
-        if ((msi_flag==1) || (mcch_flag==1) || (mtch_flag==1)) {
-          LOG_D(MAC,"[eNB %d] CC_id %d Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
-                module_idP, CC_id, frameP, subframeP,i,j,msi_flag,mcch_flag,mtch_flag);
-          break;
-        }
-      } else { // four-frameP format
-      }
+    int mcch_flag = 0, mtch_flag = 0, msi_flag = 0;
+    int mbsfn_period = 0;	// 1<<(RC.mac[module_idP]->mbsfn_SubframeConfig[0]->radioframeAllocationPeriod);
+    int mcch_period = 0;	//32<<(RC.mac[module_idP]->mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
+    int mch_scheduling_period =
+	8 << (RC.mac[module_idP]->common_channels[CC_id].
+	      pmch_Config[0]->mch_SchedulingPeriod_r9);
+    unsigned char mcch_sdu_length;
+    unsigned char header_len_mcch = 0, header_len_msi =
+	0, header_len_mtch = 0, header_len_mtch_temp =
+	0, header_len_mcch_temp = 0, header_len_msi_temp = 0;
+    int ii = 0, msi_pos = 0;
+    int mcch_mcs = -1;
+    uint16_t TBS, j = -1, padding = 0, post_padding = 0;
+    mac_rlc_status_resp_t rlc_status;
+    int num_mtch;
+    int msi_length, i, k;
+    unsigned char sdu_lcids[11], num_sdus = 0, offset = 0;
+    uint16_t sdu_lengths[11], sdu_length_total = 0;
+    unsigned char mch_buffer[MAX_DLSCH_PAYLOAD_BYTES];	// check the max value, this is for dlsch only
+
+    COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
+
+    cc->MCH_pdu.Pdu_size = 0;
+
+    for (i = 0; i < cc->num_active_mbsfn_area; i++) {
+	// assume, that there is always a mapping
+	if ((j = get_mbsfn_sf_alloction(module_idP, CC_id, i)) == -1) {
+	    return 0;
+	}
+
+	mbsfn_period =
+	    1 << (cc->mbsfn_SubframeConfig[j]->radioframeAllocationPeriod);
+	mcch_period =
+	    32 << (cc->mbsfn_AreaInfo[i]->
+		   mcch_Config_r9.mcch_RepetitionPeriod_r9);
+	msi_pos = 0;
+	ii = 0;
+	LOG_D(MAC,
+	      "[eNB %d] CC_id %d Frame %d subframeP %d : Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d)\n",
+	      module_idP, CC_id, frameP, subframeP, i,
+	      cc->num_active_mbsfn_area, j, cc->num_sf_allocation_pattern,
+	      mbsfn_period, mcch_period);
+
+
+	switch (cc->mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
+	case 0:
+	    mcch_mcs = 2;
+	    break;
+
+	case 1:
+	    mcch_mcs = 7;
+	    break;
+
+	case 2:
+	    mcch_mcs = 13;
+	    break;
+
+	case 3:
+	    mcch_mcs = 19;
+	    break;
+	}
+
+	// 1st: Check the MBSFN subframes from SIB2 info (SF allocation pattern i, max 8 non-overlapping patterns exist)
+	if (frameP % mbsfn_period == cc->mbsfn_SubframeConfig[j]->radioframeAllocationOffset) {	// MBSFN frameP
+	    if (cc->mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {	// one-frameP format
+
+		//  Find the first subframeP in this MCH to transmit MSI
+		if (frameP % mch_scheduling_period ==
+		    cc->mbsfn_SubframeConfig[j]->
+		    radioframeAllocationOffset) {
+		    while (ii == 0) {
+			ii = cc->
+			    mbsfn_SubframeConfig[j]->subframeAllocation.
+			    choice.oneFrame.buf[0] & (0x80 >> msi_pos);
+			msi_pos++;
+		    }
+
+		    LOG_D(MAC,
+			  "[eNB %d] CC_id %d Frame %d subframeP %d : sync area %d sf allocation pattern %d sf alloc %x msi pos is %d \n",
+			  module_idP, CC_id, frameP, subframeP, i, j,
+			  cc->mbsfn_SubframeConfig[j]->
+			  subframeAllocation.choice.oneFrame.buf[0],
+			  msi_pos);
+		}
+		// Check if the subframeP is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
+		switch (subframeP) {
+		case 1:
+		    if (cc->tdd_Config == NULL) {
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_FDD_SF1) ==
+			    MBSFN_FDD_SF1) {
+			    if (msi_pos == 1) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF1) ==
+				 MBSFN_FDD_SF1)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 2:
+		    if (cc->tdd_Config == NULL) {
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_FDD_SF2) ==
+			    MBSFN_FDD_SF2) {
+			    if (msi_pos == 2) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF2) ==
+				 MBSFN_FDD_SF2)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 3:
+		    if (cc->tdd_Config != NULL) {	// TDD
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_TDD_SF3) ==
+			    MBSFN_TDD_SF3) {
+			    if (msi_pos == 1) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF3) ==
+				 MBSFN_TDD_SF3)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    } else {	// FDD
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_FDD_SF3) ==
+			    MBSFN_FDD_SF3) {
+			    if (msi_pos == 3) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF3) ==
+				 MBSFN_FDD_SF3)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 4:
+		    if (cc->tdd_Config != NULL) {
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_TDD_SF4) ==
+			    MBSFN_TDD_SF4) {
+			    if (msi_pos == 2) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF4) ==
+				 MBSFN_TDD_SF4)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 6:
+		    if (cc->tdd_Config == NULL) {
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_FDD_SF6) ==
+			    MBSFN_FDD_SF6) {
+			    if (msi_pos == 4) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF6) ==
+				 MBSFN_FDD_SF6)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 7:
+		    if (cc->tdd_Config != NULL) {	// TDD
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_TDD_SF7) ==
+			    MBSFN_TDD_SF7) {
+			    if (msi_pos == 3) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF7) ==
+				 MBSFN_TDD_SF7)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    } else {	// FDD
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_FDD_SF7) ==
+			    MBSFN_FDD_SF7) {
+			    if (msi_pos == 5) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF7) ==
+				 MBSFN_FDD_SF7)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 8:
+		    if (cc->tdd_Config != NULL) {	//TDD
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_TDD_SF8) ==
+			    MBSFN_TDD_SF8) {
+			    if (msi_pos == 4) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF8) ==
+				 MBSFN_TDD_SF8)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    } else {	// FDD
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_FDD_SF8) ==
+			    MBSFN_FDD_SF8) {
+			    if (msi_pos == 6) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF8) ==
+				 MBSFN_FDD_SF8)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 9:
+		    if (cc->tdd_Config != NULL) {
+			if ((cc->
+			     mbsfn_SubframeConfig[j]->subframeAllocation.
+			     choice.oneFrame.buf[0] & MBSFN_TDD_SF9) ==
+			    MBSFN_TDD_SF9) {
+			    if (msi_pos == 5) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 cc->mbsfn_AreaInfo[i]->
+				 mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((cc->mbsfn_AreaInfo[i]->
+				  mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF9) ==
+				 MBSFN_TDD_SF9)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+		}		// end switch
+
+		// sf allocation is non-overlapping
+		if ((msi_flag == 1) || (mcch_flag == 1)
+		    || (mtch_flag == 1)) {
+		    LOG_D(MAC,
+			  "[eNB %d] CC_id %d Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
+			  module_idP, CC_id, frameP, subframeP, i, j,
+			  msi_flag, mcch_flag, mtch_flag);
+		    break;
+		}
+	    } else {		// four-frameP format
+	    }
+	}
+    }				// end of for loop
+
+    cc->msi_active = 0;
+    cc->mcch_active = 0;
+    cc->mtch_active = 0;
+
+    // Calculate the mcs
+    if ((msi_flag == 1) || (mcch_flag == 1)) {
+	cc->MCH_pdu.mcs = mcch_mcs;
+    } else if (mtch_flag == 1) {	// only MTCH in this subframeP
+	cc->MCH_pdu.mcs = cc->pmch_Config[0]->dataMCS_r9;
     }
-  } // end of for loop
-
-  cc->msi_active=0;
-  cc->mcch_active=0;
-  cc->mtch_active=0;
-
-  // Calculate the mcs
-  if ((msi_flag==1) || (mcch_flag==1)) {
-    cc->MCH_pdu.mcs = mcch_mcs;
-  } else if (mtch_flag == 1) { // only MTCH in this subframeP
-    cc->MCH_pdu.mcs = cc->pmch_Config[0]->dataMCS_r9;
-  }
-
-
-  // 2nd: Create MSI, get MCCH from RRC and MTCHs from RLC
-
-  // there is MSI (MCH Scheduling Info)
-  if (msi_flag == 1) {
-    // Create MSI here
-    uint16_t msi_control_element[29], *msi_ptr;
-
-    msi_ptr = &msi_control_element[0];
-    ((MSI_ELEMENT *) msi_ptr)->lcid = MCCH_LCHANID; //MCCH
-
-    if (mcch_flag==1) {
-      ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0;
-      ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0;
-    } else {                  // no mcch for this MSP
-      ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7;// stop value is 2047
-      ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xff;
+    // 2nd: Create MSI, get MCCH from RRC and MTCHs from RLC
+
+    // there is MSI (MCH Scheduling Info)
+    if (msi_flag == 1) {
+	// Create MSI here
+	uint16_t msi_control_element[29], *msi_ptr;
+
+	msi_ptr = &msi_control_element[0];
+	((MSI_ELEMENT *) msi_ptr)->lcid = MCCH_LCHANID;	//MCCH
+
+	if (mcch_flag == 1) {
+	    ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0;
+	    ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0;
+	} else {		// no mcch for this MSP
+	    ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7;	// stop value is 2047
+	    ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xff;
+	}
+
+	msi_ptr += sizeof(MSI_ELEMENT);
+
+	//Header for MTCHs
+	num_mtch = cc->mbms_SessionList[0]->list.count;
+
+	for (k = 0; k < num_mtch; k++) {	// loop for all session in this MCH (MCH[0]) at this moment
+	    ((MSI_ELEMENT *) msi_ptr)->lcid = cc->mbms_SessionList[0]->list.array[k]->logicalChannelIdentity_r9;	//mtch_lcid;
+	    ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0;	// last subframeP of this mtch (only one mtch now)
+	    ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xB;
+	    msi_ptr += sizeof(MSI_ELEMENT);
+	}
+
+	msi_length = msi_ptr - msi_control_element;
+
+	if (msi_length < 128) {
+	    header_len_msi = 2;
+	} else {
+	    header_len_msi = 3;
+	}
+
+	LOG_D(MAC,
+	      "[eNB %d] CC_id %d Frame %d : MSI->MCH, length of MSI is %d bytes \n",
+	      module_idP, CC_id, frameP, msi_length);
+	//LOG_D(MAC,"Scheduler: MSI is transmitted in this subframeP \n" );
+
+	//   LOG_D(MAC,"Scheduler: MSI length is %d bytes\n",msi_length);
+	// Store MSI data to mch_buffer[0]
+	memcpy((char *) &mch_buffer[sdu_length_total],
+	       msi_control_element, msi_length);
+
+	sdu_lcids[num_sdus] = MCH_SCHDL_INFO;
+	sdu_lengths[num_sdus] = msi_length;
+	sdu_length_total += sdu_lengths[num_sdus];
+	LOG_I(MAC, "[eNB %d] CC_id %d Create %d bytes for MSI\n",
+	      module_idP, CC_id, sdu_lengths[num_sdus]);
+	num_sdus++;
+	cc->msi_active = 1;
     }
-
-    msi_ptr+= sizeof(MSI_ELEMENT);
-
-    //Header for MTCHs
-    num_mtch = cc->mbms_SessionList[0]->list.count;
-
-    for (k=0; k<num_mtch; k++) { // loop for all session in this MCH (MCH[0]) at this moment
-      ((MSI_ELEMENT *) msi_ptr)->lcid = cc->mbms_SessionList[0]->list.array[k]->logicalChannelIdentity_r9;//mtch_lcid;
-      ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now)
-      ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xB;
-      msi_ptr+=sizeof(MSI_ELEMENT);
+    // there is MCCH
+    if (mcch_flag == 1) {
+	LOG_D(MAC,
+	      "[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n",
+	      module_idP, CC_id, frameP, subframeP, i, j);
+
+	mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 1, &cc->MCCH_pdu.payload[0], 
+					   i);	// this is the mbsfn sync area index
+
+	if (mcch_sdu_length > 0) {
+	    LOG_D(MAC,
+		  "[eNB %d] CC_id %d Frame %d subframeP %d : MCCH->MCH, Received %d bytes from RRC \n",
+		  module_idP, CC_id, frameP, subframeP, mcch_sdu_length);
+
+	    header_len_mcch = 2;
+
+	    if (cc->tdd_Config != NULL) {
+		LOG_D(MAC,
+		      "[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (TDD) for MCCH message %d bytes (mcs %d )\n",
+		      module_idP, CC_id, frameP, subframeP,
+		      mcch_sdu_length, mcch_mcs);
+	    } else {
+		LOG_I(MAC,
+		      "[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (FDD) for MCCH message %d bytes (mcs %d)\n",
+		      module_idP, CC_id, frameP, subframeP,
+		      mcch_sdu_length, mcch_mcs);
+	    }
+
+	    cc->mcch_active = 1;
+
+	    memcpy((char *) &mch_buffer[sdu_length_total],
+		   &cc->MCCH_pdu.payload[0], mcch_sdu_length);
+	    sdu_lcids[num_sdus] = MCCH_LCHANID;
+	    sdu_lengths[num_sdus] = mcch_sdu_length;
+
+	    if (sdu_lengths[num_sdus] > 128) {
+		header_len_mcch = 3;
+	    }
+
+	    sdu_length_total += sdu_lengths[num_sdus];
+	    LOG_D(MAC,
+		  "[eNB %d] CC_id %d Got %d bytes for MCCH from RRC \n",
+		  module_idP, CC_id, sdu_lengths[num_sdus]);
+	    num_sdus++;
+	}
     }
 
-    msi_length = msi_ptr-msi_control_element;
-
-    if (msi_length<128) {
-      header_len_msi = 2;
-    } else {
-      header_len_msi = 3;
-    }
-
-    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : MSI->MCH, length of MSI is %d bytes \n",
-          module_idP,CC_id,frameP,msi_length);
-    //LOG_D(MAC,"Scheduler: MSI is transmitted in this subframeP \n" );
-
-    //   LOG_D(MAC,"Scheduler: MSI length is %d bytes\n",msi_length);
-    // Store MSI data to mch_buffer[0]
-    memcpy((char *)&mch_buffer[sdu_length_total],
-           msi_control_element,
-           msi_length);
-
-    sdu_lcids[num_sdus] = MCH_SCHDL_INFO;
-    sdu_lengths[num_sdus] = msi_length;
-    sdu_length_total += sdu_lengths[num_sdus];
-    LOG_I(MAC,"[eNB %d] CC_id %d Create %d bytes for MSI\n", module_idP, CC_id, sdu_lengths[num_sdus]);
-    num_sdus++;
-    cc->msi_active=1;
-  }
-
-  // there is MCCH
-  if (mcch_flag == 1) {
-    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n",
-          module_idP, CC_id, frameP, subframeP, i, j);
-
-    mcch_sdu_length = mac_rrc_data_req(module_idP,
-                                       CC_id,
-                                       frameP,
-                                       MCCH,1,
-                                       &cc->MCCH_pdu.payload[0],
-                                       1,// this is eNB
-                                       module_idP, // index
-                                       i); // this is the mbsfn sync area index
-
-    if (mcch_sdu_length > 0) {
-      LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d : MCCH->MCH, Received %d bytes from RRC \n",
-            module_idP,CC_id,frameP,subframeP,mcch_sdu_length);
-
-      header_len_mcch = 2;
-
-      if (cc->tdd_Config != NULL) {
-        LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (TDD) for MCCH message %d bytes (mcs %d )\n",
-              module_idP, CC_id,
-              frameP,subframeP,
-              mcch_sdu_length,
-              mcch_mcs);
-      } else {
-        LOG_I(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Scheduling MCCH->MCH (FDD) for MCCH message %d bytes (mcs %d)\n",
-              module_idP, CC_id,
-              frameP, subframeP,
-              mcch_sdu_length,
-              mcch_mcs);
-      }
-
-      cc->mcch_active=1;
-
-      memcpy((char *)&mch_buffer[sdu_length_total],
-             &cc->MCCH_pdu.payload[0],
-             mcch_sdu_length);
-      sdu_lcids[num_sdus] = MCCH_LCHANID;
-      sdu_lengths[num_sdus] = mcch_sdu_length;
-
-      if (sdu_lengths[num_sdus]>128) {
-        header_len_mcch = 3;
-      }
-
-      sdu_length_total += sdu_lengths[num_sdus];
-      LOG_D(MAC,"[eNB %d] CC_id %d Got %d bytes for MCCH from RRC \n",module_idP,CC_id,sdu_lengths[num_sdus]);
-      num_sdus++;
-    }
-  }
-
-  TBS = get_TBS_DL(cc->MCH_pdu.mcs, to_prb(cc->mib->message.dl_Bandwidth));
+    TBS =
+	get_TBS_DL(cc->MCH_pdu.mcs, to_prb(cc->mib->message.dl_Bandwidth));
 #if defined(Rel10) || defined(Rel14)
-  // do not let mcch and mtch multiplexing when relaying is active
-  // for sync area 1, so not transmit data
-  //if ((i == 0) && ((RC.mac[module_idP]->MBMS_flag != multicast_relay) || (RC.mac[module_idP]->mcch_active==0))) {
+    // do not let mcch and mtch multiplexing when relaying is active
+    // for sync area 1, so not transmit data
+    //if ((i == 0) && ((RC.mac[module_idP]->MBMS_flag != multicast_relay) || (RC.mac[module_idP]->mcch_active==0))) {
 #endif
 
-  // there is MTCHs, loop if there are more than 1
-  if (mtch_flag == 1) {
-    // Calculate TBS
-    /* if ((msi_flag==1) || (mcch_flag==1)) {
-     TBS = mac_xface->get_TBS(mcch_mcs, mac_xface->frame_parms->N_RB_DL);
-     }
-     else { // only MTCH in this subframeP
-     TBS = mac_xface->get_TBS(RC.mac[module_idP]->pmch_Config[0]->dataMCS_r9, mac_xface->frame_parms->N_RB_DL);
-     }
-
-    // get MTCH data from RLC (like for DTCH)
-    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframe %d: Schedule MTCH (area %d, sfAlloc %d)\n",Mod_id,CC_id,frame,subframe,i,j);
-
-    header_len_mtch = 3;
-    LOG_D(MAC,"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
-    Mod_id,CC_id,frame,MTCH,TBS,
-    TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
-
-    rlc_status = mac_rlc_status_ind(Mod_id,frame,1,RLC_MBMS_YES,MTCH+ (maxDRB + 3) * MAX_MOBILES_PER_RG,
-          TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
-    printf("frame %d, subframe %d,  rlc_status.bytes_in_buffer is %d\n",frame,subframe, rlc_status.bytes_in_buffer);
-
-     */
-
-    // get MTCH data from RLC (like for DTCH)
-    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n",module_idP,CC_id,frameP,subframeP,i,j);
-
-    header_len_mtch = 3;
-    LOG_D(MAC,"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
-          module_idP,CC_id,frameP,MTCH,TBS,
-          TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
-
-    rlc_status = mac_rlc_status_ind(module_idP,0,frameP,subframeP,module_idP,ENB_FLAG_YES,MBMS_FLAG_YES,MTCH,
-                                    TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
-    LOG_D(MAC,"e-MBMS log channel %u frameP %d, subframeP %d,  rlc_status.bytes_in_buffer is %d\n",
-          MTCH,frameP,subframeP, rlc_status.bytes_in_buffer);
-
-    if (rlc_status.bytes_in_buffer >0) {
-      LOG_I(MAC,"[eNB %d][MBMS USER-PLANE], CC_id %d, Frame %d, MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d)\n",
-            module_idP,CC_id,frameP,TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch,header_len_mtch);
-
-      sdu_lengths[num_sdus] = mac_rlc_data_req(
-                                module_idP,
-                                0,
-				module_idP,
-                                frameP,
-                                ENB_FLAG_YES,
-                                MBMS_FLAG_YES,
-                                MTCH,
-								0,	//not used
-                                (char*)&mch_buffer[sdu_length_total]);
-      //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO,  MTCH+(MAX_NUM_RB*(NUMBER_OF_UE_MAX+1)), (char*)&mch_buffer[sdu_length_total]);
-      LOG_I(MAC,"[eNB %d][MBMS USER-PLANE] CC_id %d Got %d bytes for MTCH %d\n",module_idP,CC_id,sdu_lengths[num_sdus],MTCH);
-      cc->mtch_active=1;
-      sdu_lcids[num_sdus] = MTCH;
-      sdu_length_total += sdu_lengths[num_sdus];
-
-      if (sdu_lengths[num_sdus] < 128) {
-        header_len_mtch = 2;
-      }
-
-      num_sdus++;
-    } else {
-      header_len_mtch = 0;
+    // there is MTCHs, loop if there are more than 1
+    if (mtch_flag == 1) {
+	// Calculate TBS
+	/* if ((msi_flag==1) || (mcch_flag==1)) {
+	   TBS = mac_xface->get_TBS(mcch_mcs, mac_xface->frame_parms->N_RB_DL);
+	   }
+	   else { // only MTCH in this subframeP
+	   TBS = mac_xface->get_TBS(RC.mac[module_idP]->pmch_Config[0]->dataMCS_r9, mac_xface->frame_parms->N_RB_DL);
+	   }
+
+	   // get MTCH data from RLC (like for DTCH)
+	   LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframe %d: Schedule MTCH (area %d, sfAlloc %d)\n",Mod_id,CC_id,frame,subframe,i,j);
+
+	   header_len_mtch = 3;
+	   LOG_D(MAC,"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
+	   Mod_id,CC_id,frame,MTCH,TBS,
+	   TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
+
+	   rlc_status = mac_rlc_status_ind(Mod_id,frame,1,RLC_MBMS_YES,MTCH+ (maxDRB + 3) * MAX_MOBILES_PER_RG,
+	   TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
+	   printf("frame %d, subframe %d,  rlc_status.bytes_in_buffer is %d\n",frame,subframe, rlc_status.bytes_in_buffer);
+
+	 */
+
+	// get MTCH data from RLC (like for DTCH)
+	LOG_D(MAC,
+	      "[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n",
+	      module_idP, CC_id, frameP, subframeP, i, j);
+
+	header_len_mtch = 3;
+	LOG_D(MAC,
+	      "[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
+	      module_idP, CC_id, frameP, MTCH, TBS,
+	      TBS - header_len_mcch - header_len_msi - sdu_length_total -
+	      header_len_mtch);
+
+	rlc_status =
+	    mac_rlc_status_ind(module_idP, 0, frameP, subframeP,
+			       module_idP, ENB_FLAG_YES, MBMS_FLAG_YES,
+			       MTCH,
+			       TBS - header_len_mcch - header_len_msi -
+			       sdu_length_total - header_len_mtch);
+	LOG_D(MAC,
+	      "e-MBMS log channel %u frameP %d, subframeP %d,  rlc_status.bytes_in_buffer is %d\n",
+	      MTCH, frameP, subframeP, rlc_status.bytes_in_buffer);
+
+	if (rlc_status.bytes_in_buffer > 0) {
+	    LOG_I(MAC,
+		  "[eNB %d][MBMS USER-PLANE], CC_id %d, Frame %d, MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d)\n",
+		  module_idP, CC_id, frameP,
+		  TBS - header_len_mcch - header_len_msi -
+		  sdu_length_total - header_len_mtch, header_len_mtch);
+
+	    sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES, MTCH, 0,	//not used
+						     (char *)
+						     &mch_buffer
+						     [sdu_length_total]);
+	    //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO,  MTCH+(MAX_NUM_RB*(NUMBER_OF_UE_MAX+1)), (char*)&mch_buffer[sdu_length_total]);
+	    LOG_I(MAC,
+		  "[eNB %d][MBMS USER-PLANE] CC_id %d Got %d bytes for MTCH %d\n",
+		  module_idP, CC_id, sdu_lengths[num_sdus], MTCH);
+	    cc->mtch_active = 1;
+	    sdu_lcids[num_sdus] = MTCH;
+	    sdu_length_total += sdu_lengths[num_sdus];
+
+	    if (sdu_lengths[num_sdus] < 128) {
+		header_len_mtch = 2;
+	    }
+
+	    num_sdus++;
+	} else {
+	    header_len_mtch = 0;
+	}
     }
-  }
-
 #if defined(Rel10) || defined(Rel14)
-  //  }
+    //  }
 #endif
 
-  // FINAL STEP: Prepare and multiplexe MSI, MCCH and MTCHs
-  if ((sdu_length_total + header_len_msi + header_len_mcch + header_len_mtch) >0) {
-    // Adjust the last subheader
-    /*                                 if ((msi_flag==1) || (mcch_flag==1)) {
-                                       RC.mac[module_idP]->MCH_pdu.mcs = mcch_mcs;
-                                        }
-                                      else if (mtch_flag == 1) { // only MTCH in this subframeP
-                                     RC.mac[module_idP]->MCH_pdu.mcs = RC.mac[module_idP]->pmch_Config[0]->dataMCS_r9;
-                                        }
-     */
-    header_len_mtch_temp = header_len_mtch;
-    header_len_mcch_temp = header_len_mcch;
-    header_len_msi_temp = header_len_msi;
-
-    if (header_len_mtch>0) {
-      header_len_mtch=1;         // remove Length field in the  subheader for the last PDU
-    } else if (header_len_mcch>0) {
-      header_len_mcch=1;
+    // FINAL STEP: Prepare and multiplexe MSI, MCCH and MTCHs
+    if ((sdu_length_total + header_len_msi + header_len_mcch +
+	 header_len_mtch) > 0) {
+	// Adjust the last subheader
+	/*                                 if ((msi_flag==1) || (mcch_flag==1)) {
+	   RC.mac[module_idP]->MCH_pdu.mcs = mcch_mcs;
+	   }
+	   else if (mtch_flag == 1) { // only MTCH in this subframeP
+	   RC.mac[module_idP]->MCH_pdu.mcs = RC.mac[module_idP]->pmch_Config[0]->dataMCS_r9;
+	   }
+	 */
+	header_len_mtch_temp = header_len_mtch;
+	header_len_mcch_temp = header_len_mcch;
+	header_len_msi_temp = header_len_msi;
+
+	if (header_len_mtch > 0) {
+	    header_len_mtch = 1;	// remove Length field in the  subheader for the last PDU
+	} else if (header_len_mcch > 0) {
+	    header_len_mcch = 1;
+	} else {
+	    header_len_msi = 1;
+	}
+
+	// Calculate the padding
+	if ((TBS - header_len_mtch - header_len_mcch - header_len_msi -
+	     sdu_length_total) < 0) {
+	    LOG_E(MAC, "Error in building MAC PDU, TBS %d < PDU %d \n",
+		  TBS,
+		  header_len_mtch + header_len_mcch + header_len_msi +
+		  sdu_length_total);
+	    return 0;
+	} else
+	    if ((TBS - header_len_mtch - header_len_mcch - header_len_msi -
+		 sdu_length_total) <= 2) {
+	    padding =
+		(TBS - header_len_mtch - header_len_mcch - header_len_msi -
+		 sdu_length_total);
+	    post_padding = 0;
+	} else {		// using post_padding, give back the Length field of subheader  for the last PDU
+	    padding = 0;
+
+	    if (header_len_mtch > 0) {
+		header_len_mtch = header_len_mtch_temp;
+	    } else if (header_len_mcch > 0) {
+		header_len_mcch = header_len_mcch_temp;
+	    } else {
+		header_len_msi = header_len_msi_temp;
+	    }
+
+	    post_padding =
+		TBS - sdu_length_total - header_len_msi - header_len_mcch -
+		header_len_mtch;
+	}
+
+	// Generate the MAC Header for MCH
+	// here we use the function for DLSCH because DLSCH & MCH have the same Header structure
+	offset = generate_dlsch_header((unsigned char *) cc->MCH_pdu.payload, num_sdus, sdu_lengths, sdu_lcids, 255,	// no drx
+				       31,	// no timing advance
+				       NULL,	// no contention res id
+				       padding, post_padding);
+
+	cc->MCH_pdu.Pdu_size = TBS;
+	cc->MCH_pdu.sync_area = i;
+	cc->MCH_pdu.msi_active = cc->msi_active;
+	cc->MCH_pdu.mcch_active = cc->mcch_active;
+	cc->MCH_pdu.mtch_active = cc->mtch_active;
+	LOG_D(MAC,
+	      " MCS for this sf is %d (mcch active %d, mtch active %d)\n",
+	      cc->MCH_pdu.mcs, cc->MCH_pdu.mcch_active,
+	      cc->MCH_pdu.mtch_active);
+	LOG_I(MAC,
+	      "[eNB %d][MBMS USER-PLANE ] CC_id %d Generate header : sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,padding %d,post_padding %d (mcs %d, TBS %d), header MTCH %d, header MCCH %d, header MSI %d\n",
+	      module_idP, CC_id, sdu_length_total, num_sdus,
+	      sdu_lengths[0], sdu_lcids[0], offset, padding, post_padding,
+	      cc->MCH_pdu.mcs, TBS, header_len_mtch, header_len_mcch,
+	      header_len_msi);
+	// copy SDU to mch_pdu after the MAC Header
+	memcpy(&cc->MCH_pdu.payload[offset], mch_buffer, sdu_length_total);
+
+	// filling remainder of MCH with random data if necessery
+	for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
+	    cc->MCH_pdu.payload[offset + sdu_length_total + j] =
+		(char) (taus() & 0xff);
+	}
+
+	/* Tracing of PDU is done on UE side */
+	if (opt_enabled == 1) {
+	    trace_pdu(1, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, 6, 0xffff,	// M_RNTI = 6 in wirehsark
+		      RC.mac[module_idP]->frame,
+		      RC.mac[module_idP]->subframe, 0, 0);
+	    LOG_D(OPT,
+		  "[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n",
+		  module_idP, CC_id, frameP, TBS);
+	}
+
+	/*
+	   for (j=0;j<sdu_length_total;j++)
+	   printf("%2x.",RC.mac[module_idP]->MCH_pdu.payload[j+offset]);
+	   printf(" \n"); */
+	return 1;
     } else {
-      header_len_msi=1;
-    }
-
-    // Calculate the padding
-    if ((TBS - header_len_mtch - header_len_mcch - header_len_msi - sdu_length_total) < 0) {
-      LOG_E(MAC,"Error in building MAC PDU, TBS %d < PDU %d \n",
-            TBS, header_len_mtch + header_len_mcch + header_len_msi + sdu_length_total);
-      return 0;
-    } else if ((TBS - header_len_mtch - header_len_mcch - header_len_msi - sdu_length_total) <= 2) {
-      padding = (TBS - header_len_mtch - header_len_mcch - header_len_msi - sdu_length_total);
-      post_padding = 0;
-    } else { // using post_padding, give back the Length field of subheader  for the last PDU
-      padding = 0;
-
-      if (header_len_mtch>0) {
-        header_len_mtch = header_len_mtch_temp;
-      } else if (header_len_mcch>0) {
-        header_len_mcch = header_len_mcch_temp;
-      } else {
-        header_len_msi = header_len_msi_temp;
-      }
-
-      post_padding = TBS - sdu_length_total - header_len_msi - header_len_mcch - header_len_mtch;
-    }
-
-    // Generate the MAC Header for MCH
-    // here we use the function for DLSCH because DLSCH & MCH have the same Header structure
-    offset = generate_dlsch_header((unsigned char*)cc->MCH_pdu.payload,
-                                   num_sdus,
-                                   sdu_lengths,
-                                   sdu_lcids,
-                                   255,    // no drx
-                                   31,     // no timing advance
-                                   NULL,   // no contention res id
-                                   padding,
-                                   post_padding);
-
-    cc->MCH_pdu.Pdu_size=TBS;
-    cc->MCH_pdu.sync_area=i;
-    cc->MCH_pdu.msi_active= cc->msi_active;
-    cc->MCH_pdu.mcch_active= cc->mcch_active;
-    cc->MCH_pdu.mtch_active= cc->mtch_active;
-    LOG_D(MAC," MCS for this sf is %d (mcch active %d, mtch active %d)\n", cc->MCH_pdu.mcs,
-          cc->MCH_pdu.mcch_active,cc->MCH_pdu.mtch_active );
-    LOG_I(MAC,
-          "[eNB %d][MBMS USER-PLANE ] CC_id %d Generate header : sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,padding %d,post_padding %d (mcs %d, TBS %d), header MTCH %d, header MCCH %d, header MSI %d\n",
-          module_idP,CC_id,sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],offset,padding,post_padding,cc->MCH_pdu.mcs,TBS,
-          header_len_mtch, header_len_mcch, header_len_msi);
-    // copy SDU to mch_pdu after the MAC Header
-    memcpy(&cc->MCH_pdu.payload[offset],mch_buffer,sdu_length_total);
-
-    // filling remainder of MCH with random data if necessery
-    for (j=0; j<(TBS-sdu_length_total-offset); j++) {
-      cc->MCH_pdu.payload[offset+sdu_length_total+j] = (char)(taus()&0xff);
-    }
-
-    /* Tracing of PDU is done on UE side */
-    if (opt_enabled ==1 ) {
-      trace_pdu(1, (uint8_t *)cc->MCH_pdu.payload,
-                TBS, module_idP, 6, 0xffff,  // M_RNTI = 6 in wirehsark
-                RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe,0,0);
-      LOG_D(OPT,"[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n",
-            module_idP, CC_id, frameP, TBS);
+	cc->MCH_pdu.Pdu_size = 0;
+	cc->MCH_pdu.sync_area = 0;
+	cc->MCH_pdu.msi_active = 0;
+	cc->MCH_pdu.mcch_active = 0;
+	cc->MCH_pdu.mtch_active = 0;
+	// for testing purpose, fill with random data
+	//for (j=0;j<(TBS-sdu_length_total-offset);j++)
+	//  RC.mac[module_idP]->MCH_pdu.payload[offset+sdu_length_total+j] = (char)(taus()&0xff);
+	return 0;
     }
 
+    //this is for testing
     /*
-    for (j=0;j<sdu_length_total;j++)
-    printf("%2x.",RC.mac[module_idP]->MCH_pdu.payload[j+offset]);
-    printf(" \n");*/
-    return 1;
-  } else {
-    cc->MCH_pdu.Pdu_size=0;
-    cc->MCH_pdu.sync_area=0;
-    cc->MCH_pdu.msi_active=0;
-    cc->MCH_pdu.mcch_active=0;
-    cc->MCH_pdu.mtch_active=0;
-    // for testing purpose, fill with random data
-    //for (j=0;j<(TBS-sdu_length_total-offset);j++)
-    //  RC.mac[module_idP]->MCH_pdu.payload[offset+sdu_length_total+j] = (char)(taus()&0xff);
-    return 0;
-  }
-
-  //this is for testing
-  /*
-  if (mtch_flag == 1) {
-  //  LOG_D(MAC,"DUY: mch_buffer length so far is : %ld\n", &mch_buffer[sdu_length_total]-&mch_buffer[0]);
-  return 1;
-  }
-  else
-  return 0;
-   */
+       if (mtch_flag == 1) {
+       //  LOG_D(MAC,"DUY: mch_buffer length so far is : %ld\n", &mch_buffer[sdu_length_total]-&mch_buffer[0]);
+       return 1;
+       }
+       else
+       return 0;
+     */
 }
 
-MCH_PDU *get_mch_sdu(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t subframeP)
+MCH_PDU *get_mch_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
+		     sub_frame_t subframeP)
 {
-  //  RC.mac[module_idP]->MCH_pdu.mcs=0;
-  //LOG_D(MAC," MCH_pdu.mcs is %d\n", RC.mac[module_idP]->MCH_pdu.mcs);
+    //  RC.mac[module_idP]->MCH_pdu.mcs=0;
+    //LOG_D(MAC," MCH_pdu.mcs is %d\n", RC.mac[module_idP]->MCH_pdu.mcs);
 //#warning "MCH pdu should take the CC_id index"
-  return(&RC.mac[module_idP]->common_channels[CC_id].MCH_pdu);
+    return (&RC.mac[module_idP]->common_channels[CC_id].MCH_pdu);
 }
 
 #endif
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
index 3245b9e8f046ea05890e13b6bfc52d9ddd2357bb..e6258593245ea368c65d386e26dc6cc0aa5a362f 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
@@ -237,7 +237,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
 
       LOG_D(MAC,"Scheduling for frame %d, subframe %d => harq_pid %d\n",sched_frame,sched_subframe,harq_pid);
 
-      RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->ul_total_buffer;
+      RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->TBS_UL[harq_pid];
 
 	  
 
@@ -275,7 +275,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
 	  UE_sched_ctrl->ul_scheduled |= (1<<harq_pid);
 	    
 	  // adjust total UL buffer status by TBS, wait for UL sdus to do final update
-	  UE_template->ul_total_buffer = UE_template->TBS_UL[harq_pid];
+	  //UE_template->ul_total_buffer = UE_template->TBS_UL[harq_pid];
 	  // Cyclic shift for DM RS
 	  cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
 	  // save it for a potential retransmission
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 3097a0c094ccd680136fc35a2d2b464ed045b4b2..341db67934ecfed3ace6cd1ece1b83a0177f0593 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -53,7 +53,7 @@
 #include "pdcp.h"
 
 #if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+#include "intertask_interface.h"
 #endif
 
 #include "T.h"
@@ -61,138 +61,142 @@
 #define ENABLE_MAC_PAYLOAD_DEBUG
 #define DEBUG_eNB_SCHEDULER 1
 
-int choose(int n,int k)
+extern int n_active_slices;
+
+int choose(int n, int k)
 {
-  int res  = 1;
+  int res = 1;
   int res2 = 1;
   int i;
 
-  if (k>n) return(0);
-  if (n==k) return(1);
+  if (k > n)
+    return (0);
+  if (n == k)
+    return (1);
 
-  for (i=n;i>k;i--) res*=i;
-  for (i=2;i<=(n-k);i++) res2*=i;
+  for (i = n; i > k; i--)
+    res *= i;
+  for (i = 2; i <= (n - k); i++)
+    res2 *= i;
 
-  return(res/res2);
+  return (res / res2);
 }
 
 // Patented algorithm from Yang et al, US Patent 2009, "Channel Quality Indexing and Reverse Indexing"
-void reverse_index(int N,int M,int r,int *v)
+void reverse_index(int N, int M, int r, int *v)
 {
-  int BaseValue=0;
-  int IncreaseValue,ThresholdValue;
+  int BaseValue = 0;
+  int IncreaseValue, ThresholdValue;
   int sumV;
   int i;
 
-  r = choose(N,M) - 1 - r;
-  memset((void*)v,0,M*sizeof(int));
-
-  sumV=0;
-  i=M;
-  while (i>0 && r>0) {
-    IncreaseValue = choose(N-M+1-sumV-v[i-1]+i-2,i-1);
-    ThresholdValue = BaseValue+IncreaseValue;
-    if (r>=ThresholdValue) {
-      v[i-1]++;
-      BaseValue=ThresholdValue;
-    }
-    else {
-      r=r-BaseValue;
-      sumV+=v[i-1];
+  r = choose(N, M) - 1 - r;
+  memset((void *) v, 0, M * sizeof(int));
+
+  sumV = 0;
+  i = M;
+  while (i > 0 && r > 0) {
+    IncreaseValue = choose(N - M + 1 - sumV - v[i - 1] + i - 2, i - 1);
+    ThresholdValue = BaseValue + IncreaseValue;
+    if (r >= ThresholdValue) {
+      v[i - 1]++;
+      BaseValue = ThresholdValue;
+    } else {
+      r = r - BaseValue;
+      sumV += v[i - 1];
       i--;
-      BaseValue=0;
+      BaseValue = 0;
     }
   }
 }
 
 int to_prb(int dl_Bandwidth)
 {
-  int prbmap[6] = {6,15,25,50,75,100};
+  int prbmap[6] = { 6, 15, 25, 50, 75, 100 };
 
-  AssertFatal(dl_Bandwidth < 6,"dl_Bandwidth is 0..5\n");
-  return(prbmap[dl_Bandwidth]);
+  AssertFatal(dl_Bandwidth < 6, "dl_Bandwidth is 0..5\n");
+  return (prbmap[dl_Bandwidth]);
 }
 
 int to_rbg(int dl_Bandwidth)
 {
-  int rbgmap[6] = {6,8,13,17,19,25};
+  int rbgmap[6] = { 6, 8, 13, 17, 19, 25 };
 
-  AssertFatal(dl_Bandwidth < 6,"dl_Bandwidth is 0..5\n");
-  return(rbgmap[dl_Bandwidth]);
+  AssertFatal(dl_Bandwidth < 6, "dl_Bandwidth is 0..5\n");
+  return (rbgmap[dl_Bandwidth]);
 }
 
-int get_phich_resource_times6(COMMON_channels_t *cc)
+int get_phich_resource_times6(COMMON_channels_t * cc)
 {
-  int phichmap[4] = {1,3,6,12};
-  AssertFatal(cc!=NULL,"cc is null\n");
-  AssertFatal(cc->mib!=NULL,"cc->mib is null\n");
-  AssertFatal((cc->mib->message.phich_Config.phich_Resource>=0) &&
-              (cc->mib->message.phich_Config.phich_Resource<4),
-              "phich_Resource %d not in 0..3\n",(int)cc->mib->message.phich_Config.phich_Resource);
+  int phichmap[4] = { 1, 3, 6, 12 };
+  AssertFatal(cc != NULL, "cc is null\n");
+  AssertFatal(cc->mib != NULL, "cc->mib is null\n");
+  AssertFatal((cc->mib->message.phich_Config.phich_Resource >= 0) &&
+	      (cc->mib->message.phich_Config.phich_Resource < 4),
+	      "phich_Resource %d not in 0..3\n",
+	      (int) cc->mib->message.phich_Config.phich_Resource);
 
-  return(phichmap[cc->mib->message.phich_Config.phich_Resource]);
+  return (phichmap[cc->mib->message.phich_Config.phich_Resource]);
 }
 
-uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs)
+uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs)
 {
   uint16_t RIV;
 
-  if (Lcrbs<=(1+(N_RB_DL>>1)))
-    RIV = (N_RB_DL*(Lcrbs-1)) + RBstart;
-  else
-    RIV = (N_RB_DL*(N_RB_DL+1-Lcrbs)) + (N_RB_DL-1-RBstart);
+  if (Lcrbs <= (1 + (N_RB_DL >> 1))) RIV = (N_RB_DL * (Lcrbs - 1)) + RBstart;
+  else                               RIV = (N_RB_DL * (N_RB_DL + 1 - Lcrbs)) + (N_RB_DL - 1 - RBstart);
 
-  return(RIV);
+  return (RIV);
 }
 
 uint8_t getQm(uint8_t mcs)
 {
-  if (mcs<10) return(2);
-  else if (mcs<17) return(4);
-  else return (6);
+  if (mcs < 10)      return (2);
+  else if (mcs < 17) return (4);
+  else               return (6);
 }
 
-void get_Msg3alloc(COMMON_channels_t *cc,
-
-                   sub_frame_t current_subframe,
-                   frame_t current_frame,
-                   frame_t *frame,
-                   sub_frame_t *subframe)
+void
+get_Msg3alloc(COMMON_channels_t *cc,
+	      sub_frame_t       current_subframe,
+	      frame_t           current_frame, 
+	      frame_t           *frame,
+	      sub_frame_t       *subframe)
 {
   // Fill in other TDD Configuration!!!!
 
-  if (cc->tdd_Config==NULL) { // FDD
-    *subframe = current_subframe+6;
+  if (cc->tdd_Config == NULL) {	// FDD
+    *subframe = current_subframe + 6;
 
-    if (*subframe>9) {
-      *subframe = *subframe-10;
-      *frame = (current_frame+1) & 1023;
+    if (*subframe > 9) {
+      *subframe = *subframe - 10;
+      *frame = (current_frame + 1) & 1023;
     } else {
-      *frame=current_frame;
+      *frame = current_frame;
     }
-  } else { // TDD
+  } else {			// TDD
     if (cc->tdd_Config->subframeAssignment == 1) {
       switch (current_subframe) {
-
+	  
       case 0:
-        *subframe = 7;
-        *frame = current_frame;
-        break;
+	*subframe = 7;
+	*frame = current_frame;
+	break;
 
       case 4:
-        *subframe = 2;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 2;
+	*frame = (current_frame + 1) & 1023;
+	break;
 
       case 5:
-        *subframe = 2;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 2;
+	*frame = (current_frame + 1) & 1023;
+	break;
 
       case 9:
-        *subframe = 7;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 7;
+	*frame = (current_frame + 1) & 1023;
+	break;
       }
     } else if (cc->tdd_Config->subframeAssignment == 3) {
       switch (current_subframe) {
@@ -200,24 +204,24 @@ void get_Msg3alloc(COMMON_channels_t *cc,
       case 0:
       case 5:
       case 6:
-        *subframe = 2;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 2;
+	*frame = (current_frame + 1) & 1023;
+	break;
 
       case 7:
-        *subframe = 3;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 3;
+	*frame = (current_frame + 1) & 1023;
+	break;
 
       case 8:
-        *subframe = 4;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 4;
+	*frame = (current_frame + 1) & 1023;
+	break;
 
       case 9:
-        *subframe = 2;
-        *frame = (current_frame+2) & 1023;
-        break;
+	*subframe = 2;
+	*frame = (current_frame + 2) & 1023;
+	break;
       }
     } else if (cc->tdd_Config->subframeAssignment == 4) {
       switch (current_subframe) {
@@ -226,20 +230,20 @@ void get_Msg3alloc(COMMON_channels_t *cc,
       case 4:
       case 5:
       case 6:
-        *subframe = 2;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 2;
+	*frame = (current_frame + 1) & 1023;
+	break;
 
       case 7:
-        *subframe = 3;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 3;
+	*frame = (current_frame + 1) & 1023;
+	break;
 
       case 8:
       case 9:
-        *subframe = 2;
-        *frame = (current_frame+2) & 1023;
-        break;
+	*subframe = 2;
+	*frame = (current_frame + 2) & 1023;
+	break;
       }
     } else if (cc->tdd_Config->subframeAssignment == 5) {
       switch (current_subframe) {
@@ -248,16 +252,16 @@ void get_Msg3alloc(COMMON_channels_t *cc,
       case 4:
       case 5:
       case 6:
-        *subframe = 2;
-        *frame = (current_frame+1) & 1023;
-        break;
+	*subframe = 2;
+	*frame = (current_frame + 1) & 1023;
+	break;
 
       case 7:
       case 8:
       case 9:
-        *subframe = 2;
-        *frame = (current_frame+2) & 1023;
-        break;
+	*subframe = 2;
+	*frame = (current_frame + 2) & 1023;
+	break;
       }
     }
   }
@@ -265,13 +269,13 @@ void get_Msg3alloc(COMMON_channels_t *cc,
 
 
 
-void get_Msg3allocret(COMMON_channels_t *cc,
-                      sub_frame_t current_subframe,
-                      frame_t current_frame,
-                      frame_t *frame,
-                      sub_frame_t *subframe)
+void
+get_Msg3allocret(COMMON_channels_t * cc,
+		 sub_frame_t current_subframe,
+		 frame_t current_frame,
+		 frame_t * frame, sub_frame_t * subframe)
 {
-  if (cc->tdd_Config == NULL) { //FDD
+  if (cc->tdd_Config == NULL) {	//FDD
     /* always retransmit in n+8 */
     *subframe = current_subframe + 8;
 
@@ -287,139 +291,143 @@ void get_Msg3allocret(COMMON_channels_t *cc,
       // original PUSCH in 3, PHICH in 9, ret in 3
       // original PUSCH in 7, PHICH in 1 (S), ret in 7
       // original PUSCH in 8, PHICH in 4, ret in 8
-      *frame = (current_frame+1) & 1023;
+      *frame = (current_frame + 1) & 1023;
     } else if (cc->tdd_Config->subframeAssignment == 3) {
       // original PUSCH in 2, PHICH in 8, ret in 2 next frame
       // original PUSCH in 3, PHICH in 9, ret in 3 next frame
       // original PUSCH in 4, PHICH in 0, ret in 4 next frame
-      *frame=(current_frame+1) & 1023;
+      *frame = (current_frame + 1) & 1023;
     } else if (cc->tdd_Config->subframeAssignment == 4) {
-        // original PUSCH in 2, PHICH in 8, ret in 2 next frame
-        // original PUSCH in 3, PHICH in 9, ret in 3 next frame
-        *frame=(current_frame+1) & 1023;
+      // original PUSCH in 2, PHICH in 8, ret in 2 next frame
+      // original PUSCH in 3, PHICH in 9, ret in 3 next frame
+      *frame = (current_frame + 1) & 1023;
     } else if (cc->tdd_Config->subframeAssignment == 5) {
-        // original PUSCH in 2, PHICH in 8, ret in 2 next frame
-        *frame=(current_frame+1) & 1023;
+      // original PUSCH in 2, PHICH in 8, ret in 2 next frame
+      *frame = (current_frame + 1) & 1023;
     }
   }
 }
 
-uint8_t subframe2harqpid(COMMON_channels_t *cc,frame_t frame,sub_frame_t subframe)
+uint8_t
+subframe2harqpid(COMMON_channels_t * cc, frame_t frame,
+		 sub_frame_t subframe)
 {
   uint8_t ret = 255;
 
-  AssertFatal(cc!=NULL,"cc is null\n");
+  AssertFatal(cc != NULL, "cc is null\n");
 
-  if (cc->tdd_Config == NULL) { // FDD
-    ret = (((frame<<1)+subframe)&7);
+  if (cc->tdd_Config == NULL) {	// FDD
+    ret = (((frame << 1) + subframe) & 7);
   } else {
     switch (cc->tdd_Config->subframeAssignment) {
     case 1:
-      if ((subframe==2) ||
-          (subframe==3) ||
-          (subframe==7) ||
-          (subframe==8))
-        switch (subframe) {
-        case 2:
-        case 3:
-          ret = (subframe-2);
-          break;
-
-        case 7:
-        case 8:
-          ret = (subframe-5);
-          break;
-
-        default:
-          AssertFatal(1==0,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment);
-          break;
-        }
+      if ((subframe == 2) ||
+	  (subframe == 3) || (subframe == 7) || (subframe == 8))
+	switch (subframe) {
+	case 2:
+	case 3:
+	  ret = (subframe - 2);
+	  break;
+	case 7:
+	case 8:
+	  ret = (subframe - 5);
+	  break;
+	default:
+	  AssertFatal(1 == 0,
+		      "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		      subframe,
+		      (int) cc->tdd_Config->subframeAssignment);
+	  break;
+	}
 
       break;
 
     case 2:
-      AssertFatal((subframe==2) || (subframe==7),
-                  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment);
+      AssertFatal((subframe == 2) || (subframe == 7),
+		  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		  subframe,
+		  (int) cc->tdd_Config->subframeAssignment);
 
-      ret = (subframe/7);
+      ret = (subframe / 7);
       break;
 
     case 3:
-      AssertFatal((subframe>1) && (subframe<5),
-                  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment);
-      ret = (subframe-2);
+      AssertFatal((subframe > 1) && (subframe < 5),
+		  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		  subframe,
+		  (int) cc->tdd_Config->subframeAssignment);
+      ret = (subframe - 2);
       break;
 
     case 4:
-      AssertFatal((subframe>1) && (subframe<4),
-                  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment);
-      ret = (subframe-2);
+      AssertFatal((subframe > 1) && (subframe < 4),
+		  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		  subframe,
+		  (int) cc->tdd_Config->subframeAssignment);
+      ret = (subframe - 2);
       break;
 
     case 5:
-      AssertFatal(subframe==2,
-                  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment);
-      ret = (subframe-2);
+      AssertFatal(subframe == 2,
+		  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		  subframe,
+		  (int) cc->tdd_Config->subframeAssignment);
+      ret = (subframe - 2);
       break;
 
     default:
-      AssertFatal(1==0,"subframe2_harq_pid, Unsupported TDD mode %d\n",(int)cc->tdd_Config->subframeAssignment);
+      AssertFatal(1 == 0,
+		  "subframe2_harq_pid, Unsupported TDD mode %d\n",
+		  (int) cc->tdd_Config->subframeAssignment);
     }
   }
   return ret;
 }
 
-uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
-                        frame_t frame,
-                        sub_frame_t current_subframe)
+uint8_t
+get_Msg3harqpid(COMMON_channels_t * cc,
+		frame_t frame, sub_frame_t current_subframe)
 {
-  uint8_t ul_subframe=0;
-  uint32_t ul_frame=0;
+  uint8_t ul_subframe = 0;
+  uint32_t ul_frame = 0;
 
-  if (cc->tdd_Config == NULL) { // FDD
-    ul_subframe = (current_subframe>3) ? (current_subframe-4) : (current_subframe+6);
-    ul_frame    = (current_subframe>3) ? ((frame+1)&1023) : frame;
+  if (cc->tdd_Config == NULL) {	// FDD
+    ul_subframe =
+      (current_subframe >
+       3) ? (current_subframe - 4) : (current_subframe + 6);
+    ul_frame = (current_subframe > 3) ? ((frame + 1) & 1023) : frame;
   } else {
     switch (cc->tdd_Config->subframeAssignment) {
     case 1:
       switch (current_subframe) {
       case 9:
       case 0:
-        ul_subframe = 7;
-        break;
-
+	ul_subframe = 7;
+	break;
       case 5:
       case 7:
-        ul_subframe = 2;
-        break;
-
+	ul_subframe = 2;
+	break;
       }
-
       break;
-
     case 3:
       switch (current_subframe) {
       case 0:
       case 5:
       case 6:
-        ul_subframe = 2;
-        break;
-
+	ul_subframe = 2;
+	break;
       case 7:
-        ul_subframe = 3;
-        break;
-
+	ul_subframe = 3;
+	break;
       case 8:
-        ul_subframe = 4;
-        break;
-
+	ul_subframe = 4;
+	break;
       case 9:
-        ul_subframe = 2;
-        break;
+	ul_subframe = 2;
+	break;
       }
-
       break;
-
     case 4:
       switch (current_subframe) {
       case 0:
@@ -427,81 +435,74 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
       case 6:
       case 8:
       case 9:
-        ul_subframe = 2;
-        break;
-
+	ul_subframe = 2;
+	break;
       case 7:
-        ul_subframe = 3;
-        break;
+	ul_subframe = 3;
+	break;
       }
-
       break;
-
     case 5:
-      ul_subframe =2;
+      ul_subframe = 2;
       break;
-
     default:
-      LOG_E(PHY,"get_Msg3_harq_pid: Unsupported TDD configuration %d\n",(int)cc->tdd_Config->subframeAssignment);
-      AssertFatal(1==0,"get_Msg3_harq_pid: Unsupported TDD configuration");
+      LOG_E(PHY,
+	    "get_Msg3_harq_pid: Unsupported TDD configuration %d\n",
+	    (int) cc->tdd_Config->subframeAssignment);
+      AssertFatal(1 == 0,
+		  "get_Msg3_harq_pid: Unsupported TDD configuration");
       break;
     }
   }
 
-  return(subframe2harqpid(cc,ul_frame,ul_subframe));
+  return (subframe2harqpid(cc, ul_frame, ul_subframe));
 }
 
-uint32_t pdcchalloc2ulframe(COMMON_channels_t *ccP,uint32_t frame, uint8_t n)
+uint32_t
+pdcchalloc2ulframe(COMMON_channels_t * ccP, uint32_t frame, uint8_t n)
 {
   uint32_t ul_frame;
 
-  if ((ccP->tdd_Config) &&
-      (ccP->tdd_Config->subframeAssignment == 1) &&
-      ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5
-    ul_frame = (frame + (n==1 ? 0 : 1));
-  else if ((ccP->tdd_Config) &&
-           (ccP->tdd_Config->subframeAssignment == 6) &&
-           ((n==0)||(n==1)||(n==5)||(n==6)))
-    ul_frame = (frame + (n>=5 ? 1 : 0));
+  if ((ccP->tdd_Config) && (ccP->tdd_Config->subframeAssignment == 1) && ((n == 1) || (n == 6)))	// tdd_config 0,1 SF 1,5
+    ul_frame = (frame + (n == 1 ? 0 : 1));
   else if ((ccP->tdd_Config) &&
-           (ccP->tdd_Config->subframeAssignment == 6) &&
-           (n==9)) // tdd_config 6 SF 9
-    ul_frame = (frame+1);
+	   (ccP->tdd_Config->subframeAssignment == 6) &&
+	   ((n == 0) || (n == 1) || (n == 5) || (n == 6)))
+    ul_frame = (frame + (n >= 5 ? 1 : 0));
+  else if ((ccP->tdd_Config) && (ccP->tdd_Config->subframeAssignment == 6) && (n == 9))	// tdd_config 6 SF 9
+    ul_frame = (frame + 1);
   else
-    ul_frame = (frame+(n>=6 ? 1 : 0));
+    ul_frame = (frame + (n >= 6 ? 1 : 0));
 
-  LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame);
+  LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n,
+	ul_frame);
   return ul_frame;
 }
 
-uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n)
+uint8_t pdcchalloc2ulsubframe(COMMON_channels_t * ccP, uint8_t n)
 {
   uint8_t ul_subframe;
 
-  if ((ccP->tdd_Config) &&
-      (ccP->tdd_Config->subframeAssignment == 1) &&
-      ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5
-    ul_subframe = ((n+6)%10);
+  if ((ccP->tdd_Config) && (ccP->tdd_Config->subframeAssignment == 1) && ((n == 1) || (n == 6)))	// tdd_config 0,1 SF 1,5
+    ul_subframe = ((n + 6) % 10);
   else if ((ccP->tdd_Config) &&
-           (ccP->tdd_Config->subframeAssignment == 6) &&
-           ((n==0)||(n==1)||(n==5)||(n==6)))
-    ul_subframe = ((n+7)%10);
-  else if ((ccP->tdd_Config) &&
-           (ccP->tdd_Config->subframeAssignment == 6) &&
-           (n==9)) // tdd_config 6 SF 9
-    ul_subframe = ((n+5)%10);
+	   (ccP->tdd_Config->subframeAssignment == 6) &&
+	   ((n == 0) || (n == 1) || (n == 5) || (n == 6)))
+    ul_subframe = ((n + 7) % 10);
+  else if ((ccP->tdd_Config) && (ccP->tdd_Config->subframeAssignment == 6) && (n == 9))	// tdd_config 6 SF 9
+    ul_subframe = ((n + 5) % 10);
   else
-    ul_subframe = ((n+4)%10);
+    ul_subframe = ((n + 4) % 10);
 
   LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe);
   return ul_subframe;
 }
 
-int is_UL_sf(COMMON_channels_t *ccP,sub_frame_t subframeP)
+int is_UL_sf(COMMON_channels_t * ccP, sub_frame_t subframeP)
 {
   // if FDD return dummy value
   if (ccP->tdd_Config == NULL)
-    return(0);
+    return (0);
 
   switch (ccP->tdd_Config->subframeAssignment) {
   case 1:
@@ -510,398 +511,504 @@ int is_UL_sf(COMMON_channels_t *ccP,sub_frame_t subframeP)
     case 4:
     case 5:
     case 9:
-      return(0);
+      return (0);
       break;
-
     case 2:
     case 3:
     case 7:
     case 8:
-      return(1);
+      return (1);
       break;
-
     default:
-      return(0);
+      return (0);
       break;
     }
     break;
-
   case 3:
-    if  ((subframeP<=1) || (subframeP>=5))
-      return(0);
-    else if ((subframeP>1) && (subframeP < 5))
-      return(1);
-    else AssertFatal(1==0,"Unknown subframe number\n");
+    if ((subframeP <= 1) || (subframeP >= 5))
+      return (0);
+    else if ((subframeP > 1) && (subframeP < 5))
+      return (1);
+    else
+      AssertFatal(1 == 0, "Unknown subframe number\n");
     break;
-
   case 4:
-    if  ((subframeP<=1) || (subframeP>=4))
-      return(0);
-    else if ((subframeP>1) && (subframeP < 4))
-      return(1);
-    else AssertFatal(1==0,"Unknown subframe number\n");
+    if ((subframeP <= 1) || (subframeP >= 4))
+      return (0);
+    else if ((subframeP > 1) && (subframeP < 4))
+      return (1);
+    else
+      AssertFatal(1 == 0, "Unknown subframe number\n");
     break;
-
   case 5:
-    if  ((subframeP<=1) || (subframeP>=3))
-      return(0);
-    else if ((subframeP>1) && (subframeP < 3))
-      return(1);
-    else AssertFatal(1==0,"Unknown subframe number\n");
+    if ((subframeP <= 1) || (subframeP >= 3))
+      return (0);
+    else if ((subframeP > 1) && (subframeP < 3))
+      return (1);
+    else
+      AssertFatal(1 == 0, "Unknown subframe number\n");
     break;
-
   default:
-    AssertFatal(1==0,"subframe %d Unsupported TDD configuration %d\n",
-                subframeP,(int)ccP->tdd_Config->subframeAssignment);
+    AssertFatal(1 == 0,
+		"subframe %d Unsupported TDD configuration %d\n",
+		subframeP, (int) ccP->tdd_Config->subframeAssignment);
     break;
   }
 }
 
-uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF)
+uint16_t get_pucch1_absSF(COMMON_channels_t * cc, uint16_t dlsch_absSF)
 {
-  uint16_t sf,f,nextf;
+  uint16_t sf, f, nextf;
 
-  if (cc->tdd_Config==NULL) { //FDD n+4
-    return((dlsch_absSF + 4)%10240);
-  }
-  else {
-    sf    = dlsch_absSF%10;
-    f     = dlsch_absSF/10;
-    nextf = (f+1)&1023;
+  if (cc->tdd_Config == NULL) {	//FDD n+4
+    return ((dlsch_absSF + 4) % 10240);
+  } else {
+    sf = dlsch_absSF % 10;
+    f = dlsch_absSF / 10;
+    nextf = (f + 1) & 1023;
 
     switch (cc->tdd_Config->subframeAssignment) {
     case 0:
-      AssertFatal(1==0,"SFA 0 to be filled in now, :-)\n");
+      AssertFatal(1 == 0, "SFA 0 to be filled in now, :-)\n");
       break;
     case 1:
-      if      ((sf==5) || (sf==6)) return((10*nextf) + 2);                                        // ACK/NAK in SF 2 next frame
-      else if (sf==9)              return((10*nextf) + 3);                                        // ACK/NAK in SF 3 next frame
-      else if ((sf==0) || (sf==1)) return((10*f) + 2);                                            // ACK/NAK in SF 7 same frame
-      else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 3\n",sf);
+      if ((sf == 5) || (sf == 6))
+	return ((10 * nextf) + 2);	// ACK/NAK in SF 2 next frame
+      else if (sf == 9)
+	return ((10 * nextf) + 3);	// ACK/NAK in SF 3 next frame
+      else if ((sf == 0) || (sf == 1))
+	return ((10 * f) + 2);	// ACK/NAK in SF 7 same frame
+      else
+	AssertFatal(1 == 0,
+		    "Impossible dlsch subframe %d for TDD configuration 3\n",
+		    sf);
       break;
     case 2:
-      if      ((sf==4) || (sf==5) || (sf==6) || (sf==8)) return((10*nextf) + 2);                  // ACK/NAK in SF 2 next frame
-      else if (sf==9)                                    return((10*nextf) + 7);                  // ACK/NAK in SF 7 next frame
-      else if ((sf==0) || (sf==1) || (sf==3))            return((10*f) + 7);                      // ACK/NAK in SF 7 same frame
-      else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 3\n",sf);
+      if ((sf == 4) || (sf == 5) || (sf == 6) || (sf == 8))
+	return ((10 * nextf) + 2);	// ACK/NAK in SF 2 next frame
+      else if (sf == 9)
+	return ((10 * nextf) + 7);	// ACK/NAK in SF 7 next frame
+      else if ((sf == 0) || (sf == 1) || (sf == 3))
+	return ((10 * f) + 7);	// ACK/NAK in SF 7 same frame
+      else
+	AssertFatal(1 == 0,
+		    "Impossible dlsch subframe %d for TDD configuration 3\n",
+		    sf);
       break;
     case 3:
-      if      ((sf==5) || (sf==6) || (sf==7) || (sf==8) || (sf==9)) return((10*nextf) + (sf>>1)); // ACK/NAK in 2,3,4 resp. next frame
-      else if (sf==1)                                               return((10*nextf) + 2);       // ACK/NAK in 2 next frame
-      else if (sf==0)                                               return((10*f) + 4);           // ACK/NAK in 4 same frame
-      else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 3\n",sf);
+      if ((sf == 5) || (sf == 6) || (sf == 7) || (sf == 8)
+	  || (sf == 9))
+	return ((10 * nextf) + (sf >> 1));	// ACK/NAK in 2,3,4 resp. next frame
+      else if (sf == 1)
+	return ((10 * nextf) + 2);	// ACK/NAK in 2 next frame
+      else if (sf == 0)
+	return ((10 * f) + 4);	// ACK/NAK in 4 same frame
+      else
+	AssertFatal(1 == 0,
+		    "Impossible dlsch subframe %d for TDD configuration 3\n",
+		    sf);
       break;
     case 4:
-      if      ((sf==6) || (sf==7) || (sf==8) || (sf==9)) return(((10*nextf) + 3)%10240);          // ACK/NAK in SF 3 next frame
-      else if ((sf==0) || (sf==1) || (sf==4) || (sf==5)) return(((10*nextf) + 2)%10240);          // ACK/NAK in SF 2 next frame
-      else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 4\n",sf);
+      if ((sf == 6) || (sf == 7) || (sf == 8) || (sf == 9))
+	return (((10 * nextf) + 3) % 10240);	// ACK/NAK in SF 3 next frame
+      else if ((sf == 0) || (sf == 1) || (sf == 4) || (sf == 5))
+	return (((10 * nextf) + 2) % 10240);	// ACK/NAK in SF 2 next frame
+      else
+	AssertFatal(1 == 0,
+		    "Impossible dlsch subframe %d for TDD configuration 4\n",
+		    sf);
       break;
     case 5:
-      if      ((sf==0) || (sf==1) || (sf==3) || (sf==4) || (sf==5) || (sf==6) || (sf==7) || (sf==8)) return(((10*nextf) + 2)%10240);     // ACK/NAK in SF 3 next frame
-      else if (sf==9)                                                                                return(((10*(1+nextf)) + 2)%10240); // ACK/NAK in SF 2 next frame
-      else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 5\n",sf);
+      if ((sf == 0) || (sf == 1) || (sf == 3) || (sf == 4)
+	  || (sf == 5) || (sf == 6) || (sf == 7) || (sf == 8))
+	return (((10 * nextf) + 2) % 10240);	// ACK/NAK in SF 3 next frame
+      else if (sf == 9)
+	return (((10 * (1 + nextf)) + 2) % 10240);	// ACK/NAK in SF 2 next frame
+      else
+	AssertFatal(1 == 0,
+		    "Impossible dlsch subframe %d for TDD configuration 5\n",
+		    sf);
       break;
     case 6:
-      AssertFatal(1==0,"SFA 6 To be filled in now, :-)\n");
+      AssertFatal(1 == 0, "SFA 6 To be filled in now, :-)\n");
       break;
     default:
-      AssertFatal(1==0,"Illegal TDD subframe Assigment %d\n",(int)cc->tdd_Config->subframeAssignment);
+      AssertFatal(1 == 0, "Illegal TDD subframe Assigment %d\n",
+		  (int) cc->tdd_Config->subframeAssignment);
       break;
     }
   }
-  AssertFatal(1==0,"Shouldn't get here\n");
+  AssertFatal(1 == 0, "Shouldn't get here\n");
 }
 
-void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset)
+void
+get_srs_pos(COMMON_channels_t * cc, uint16_t isrs,
+	    uint16_t * psrsPeriodicity, uint16_t * psrsOffset)
 {
-  if(cc->tdd_Config) { // TDD
-    AssertFatal(isrs>=10,"2 ms SRS periodicity not supported");
+  if (cc->tdd_Config) {	// TDD
+    AssertFatal(isrs >= 10, "2 ms SRS periodicity not supported");
 
-    if ((isrs>9)&&(isrs<15)) {
-      *psrsPeriodicity=5;
-      *psrsOffset=isrs-10;
+    if ((isrs > 9) && (isrs < 15)) {
+      *psrsPeriodicity = 5;
+      *psrsOffset = isrs - 10;
     }
-    if ((isrs>14)&&(isrs<25)) {
-      *psrsPeriodicity=10;
-      *psrsOffset=isrs-15;
+    if ((isrs > 14) && (isrs < 25)) {
+      *psrsPeriodicity = 10;
+      *psrsOffset = isrs - 15;
     }
-    if ((isrs>24)&&(isrs<45)) {
-      *psrsPeriodicity=20;
-      *psrsOffset=isrs-25;
+    if ((isrs > 24) && (isrs < 45)) {
+      *psrsPeriodicity = 20;
+      *psrsOffset = isrs - 25;
     }
-    if ((isrs>44)&&(isrs<85)) {
-      *psrsPeriodicity=40;
-      *psrsOffset=isrs-45;
+    if ((isrs > 44) && (isrs < 85)) {
+      *psrsPeriodicity = 40;
+      *psrsOffset = isrs - 45;
     }
-    if ((isrs>84)&&(isrs<165)) {
-      *psrsPeriodicity=80;
-      *psrsOffset=isrs-85;
+    if ((isrs > 84) && (isrs < 165)) {
+      *psrsPeriodicity = 80;
+      *psrsOffset = isrs - 85;
     }
-    if ((isrs>164)&&(isrs<325)) {
-      *psrsPeriodicity=160;
-      *psrsOffset=isrs-165;
+    if ((isrs > 164) && (isrs < 325)) {
+      *psrsPeriodicity = 160;
+      *psrsOffset = isrs - 165;
     }
-    if ((isrs>324)&&(isrs<645)) {
-      *psrsPeriodicity=320;
-      *psrsOffset=isrs-325;
+    if ((isrs > 324) && (isrs < 645)) {
+      *psrsPeriodicity = 320;
+      *psrsOffset = isrs - 325;
     }
 
-    AssertFatal(isrs<=644,"Isrs out of range %d>644\n",isrs);
-  } // TDD
-  else { // FDD
-    if (isrs<2) {
-      *psrsPeriodicity=2;
-      *psrsOffset=isrs;
+    AssertFatal(isrs <= 644, "Isrs out of range %d>644\n", isrs);
+  }				// TDD
+  else {			// FDD
+    if (isrs < 2) {
+      *psrsPeriodicity = 2;
+      *psrsOffset = isrs;
     }
-    if ((isrs>1)&&(isrs<7)) {
-      *psrsPeriodicity=5;
-      *psrsOffset=isrs-2;
+    if ((isrs > 1) && (isrs < 7)) {
+      *psrsPeriodicity = 5;
+      *psrsOffset = isrs - 2;
     }
-    if ((isrs>6)&&(isrs<17)) {
-      *psrsPeriodicity=10;
-      *psrsOffset=isrs-7;
+    if ((isrs > 6) && (isrs < 17)) {
+      *psrsPeriodicity = 10;
+      *psrsOffset = isrs - 7;
     }
-    if ((isrs>16)&&(isrs<37)) {
-      *psrsPeriodicity=20;
-      *psrsOffset=isrs-17;
+    if ((isrs > 16) && (isrs < 37)) {
+      *psrsPeriodicity = 20;
+      *psrsOffset = isrs - 17;
     }
-    if ((isrs>36)&&(isrs<77)) {
-      *psrsPeriodicity=40;
-      *psrsOffset=isrs-37;
+    if ((isrs > 36) && (isrs < 77)) {
+      *psrsPeriodicity = 40;
+      *psrsOffset = isrs - 37;
     }
-    if ((isrs>76)&&(isrs<157)) {
-      *psrsPeriodicity=80;
-      *psrsOffset=isrs-77;
+    if ((isrs > 76) && (isrs < 157)) {
+      *psrsPeriodicity = 80;
+      *psrsOffset = isrs - 77;
     }
-    if ((isrs>156)&&(isrs<317)) {
-      *psrsPeriodicity=160;
-      *psrsOffset=isrs-157;
+    if ((isrs > 156) && (isrs < 317)) {
+      *psrsPeriodicity = 160;
+      *psrsOffset = isrs - 157;
     }
-    if ((isrs>316)&&(isrs<637)) {
-      *psrsPeriodicity=320;
-      *psrsOffset=isrs-317;
+    if ((isrs > 316) && (isrs < 637)) {
+      *psrsPeriodicity = 320;
+      *psrsOffset = isrs - 317;
     }
-    AssertFatal(isrs<=636,"Isrs out of range %d>636\n",isrs);
+    AssertFatal(isrs <= 636, "Isrs out of range %d>636\n", isrs);
   }
 }
 
-void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_ReportPeriodic,uint16_t *Npd,uint16_t *N_OFFSET_CQI,int *H)
+void
+get_csi_params(COMMON_channels_t * cc,
+	       struct CQI_ReportPeriodic *cqi_ReportPeriodic,
+	       uint16_t * Npd, uint16_t * N_OFFSET_CQI, int *H)
 {
-  uint16_t cqi_PMI_ConfigIndex = cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
-  uint8_t Jtab[6] = {0,2,2,3,4,4};
+  uint16_t cqi_PMI_ConfigIndex =
+    cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
+  uint8_t Jtab[6] = { 0, 2, 2, 3, 4, 4 };
 
-  AssertFatal(cqi_ReportPeriodic!=NULL,"cqi_ReportPeriodic is null!\n");
+  AssertFatal(cqi_ReportPeriodic != NULL,
+	      "cqi_ReportPeriodic is null!\n");
 
-  if (cc->tdd_Config==NULL) { //FDD
-    if (cqi_PMI_ConfigIndex <= 1) {        // 2 ms CQI_PMI period
+  if (cc->tdd_Config == NULL) {	//FDD
+    if (cqi_PMI_ConfigIndex <= 1) {	// 2 ms CQI_PMI period
       *Npd = 2;
       *N_OFFSET_CQI = cqi_PMI_ConfigIndex;
-    } else if (cqi_PMI_ConfigIndex <= 6) { // 5 ms CQI_PMI period
+    } else if (cqi_PMI_ConfigIndex <= 6) {	// 5 ms CQI_PMI period
       *Npd = 5;
-      *N_OFFSET_CQI = cqi_PMI_ConfigIndex-2;
-    } else if (cqi_PMI_ConfigIndex <=16) { // 10ms CQI_PMI period
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 2;
+    } else if (cqi_PMI_ConfigIndex <= 16) {	// 10ms CQI_PMI period
       *Npd = 10;
-      *N_OFFSET_CQI = cqi_PMI_ConfigIndex-7;
-    } else if (cqi_PMI_ConfigIndex <= 36) { // 20 ms CQI_PMI period
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 7;
+    } else if (cqi_PMI_ConfigIndex <= 36) {	// 20 ms CQI_PMI period
       *Npd = 20;
-      *N_OFFSET_CQI = cqi_PMI_ConfigIndex-17;
-    } else if (cqi_PMI_ConfigIndex <= 76) { // 40 ms CQI_PMI period
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 17;
+    } else if (cqi_PMI_ConfigIndex <= 76) {	// 40 ms CQI_PMI period
       *Npd = 40;
-      *N_OFFSET_CQI = cqi_PMI_ConfigIndex-37;
-    } else if (cqi_PMI_ConfigIndex <= 156) { // 80 ms CQI_PMI period
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 37;
+    } else if (cqi_PMI_ConfigIndex <= 156) {	// 80 ms CQI_PMI period
       *Npd = 80;
-      *N_OFFSET_CQI = cqi_PMI_ConfigIndex-77;
-    } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 77;
+    } else if (cqi_PMI_ConfigIndex <= 316) {	// 160 ms CQI_PMI period
       *Npd = 160;
-      *N_OFFSET_CQI = cqi_PMI_ConfigIndex-157;
-    }
-    else if (cqi_PMI_ConfigIndex > 317) {
-
-      if (cqi_PMI_ConfigIndex <= 349) { // 32 ms CQI_PMI period
-        *Npd = 32;
-      *N_OFFSET_CQI = cqi_PMI_ConfigIndex-318;
-      }
-      else if (cqi_PMI_ConfigIndex <= 413) { // 64 ms CQI_PMI period
-        *Npd = 64;
-        *N_OFFSET_CQI = cqi_PMI_ConfigIndex-350;
-      }
-      else if (cqi_PMI_ConfigIndex <= 541) { // 128 ms CQI_PMI period
-        *Npd = 128;
-        *N_OFFSET_CQI = cqi_PMI_ConfigIndex-414;
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 157;
+    } else if (cqi_PMI_ConfigIndex > 317) {
+
+      if (cqi_PMI_ConfigIndex <= 349) {	// 32 ms CQI_PMI period
+	*Npd = 32;
+	*N_OFFSET_CQI = cqi_PMI_ConfigIndex - 318;
+      } else if (cqi_PMI_ConfigIndex <= 413) {	// 64 ms CQI_PMI period
+	*Npd = 64;
+	*N_OFFSET_CQI = cqi_PMI_ConfigIndex - 350;
+      } else if (cqi_PMI_ConfigIndex <= 541) {	// 128 ms CQI_PMI period
+	*Npd = 128;
+	*N_OFFSET_CQI = cqi_PMI_ConfigIndex - 414;
       }
     }
-  }
-  else { // TDD
-   if (cqi_PMI_ConfigIndex == 0) {        // all UL subframes
-     *Npd = 1;
-     *N_OFFSET_CQI = 0;
-   } else if (cqi_PMI_ConfigIndex <= 6) { // 5 ms CQI_PMI period
-     *Npd = 5;
-     *N_OFFSET_CQI = cqi_PMI_ConfigIndex-1;
-   } else if (cqi_PMI_ConfigIndex <=16) { // 10ms CQI_PMI period
-     *Npd = 10;
-     *N_OFFSET_CQI = cqi_PMI_ConfigIndex-6;
-   } else if (cqi_PMI_ConfigIndex <= 36) { // 20 ms CQI_PMI period
-     *Npd = 20;
-     *N_OFFSET_CQI = cqi_PMI_ConfigIndex-16;
-   } else if (cqi_PMI_ConfigIndex <= 76) { // 40 ms CQI_PMI period
-     *Npd = 40;
-     *N_OFFSET_CQI = cqi_PMI_ConfigIndex-36;
-   } else if (cqi_PMI_ConfigIndex <= 156) { // 80 ms CQI_PMI period
-     *Npd = 80;
-     *N_OFFSET_CQI = cqi_PMI_ConfigIndex-76;
-   } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period
-     *Npd = 160;
-     *N_OFFSET_CQI = cqi_PMI_ConfigIndex-156;
-   }
+  } else {			// TDD
+    if (cqi_PMI_ConfigIndex == 0) {	// all UL subframes
+      *Npd = 1;
+      *N_OFFSET_CQI = 0;
+    } else if (cqi_PMI_ConfigIndex <= 6) {	// 5 ms CQI_PMI period
+      *Npd = 5;
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 1;
+    } else if (cqi_PMI_ConfigIndex <= 16) {	// 10ms CQI_PMI period
+      *Npd = 10;
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 6;
+    } else if (cqi_PMI_ConfigIndex <= 36) {	// 20 ms CQI_PMI period
+      *Npd = 20;
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 16;
+    } else if (cqi_PMI_ConfigIndex <= 76) {	// 40 ms CQI_PMI period
+      *Npd = 40;
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 36;
+    } else if (cqi_PMI_ConfigIndex <= 156) {	// 80 ms CQI_PMI period
+      *Npd = 80;
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 76;
+    } else if (cqi_PMI_ConfigIndex <= 316) {	// 160 ms CQI_PMI period
+      *Npd = 160;
+      *N_OFFSET_CQI = cqi_PMI_ConfigIndex - 156;
+    }
   }
 
   // get H
-  if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI)
-    *H = 1+(Jtab[cc->mib->message.dl_Bandwidth]*cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k);
+  if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.
+      present ==
+      CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI)
+    *H = 1 +
+      (Jtab[cc->mib->message.dl_Bandwidth] *
+       cqi_ReportPeriodic->choice.setup.
+       cqi_FormatIndicatorPeriodic.choice.subbandCQI.k);
   else
-    *H=1;
+    *H = 1;
 }
 
-uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri, CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic)
+uint8_t
+get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode,
+			  uint8_t ri,
+			  CQI_ReportModeAperiodic_t *
+			  cqi_ReportModeAperiodic)
 {
-  int Ntab[6]       = {0,4,7,9,10,13};
-  int N             = Ntab[cc->mib->message.dl_Bandwidth];
-  int Ltab_uesel[6] = {0,6,9,13,15,18};
-  int L             = Ltab_uesel[cc->mib->message.dl_Bandwidth];
+  int Ntab[6] = { 0, 4, 7, 9, 10, 13 };
+  int N = Ntab[cc->mib->message.dl_Bandwidth];
+  int Ltab_uesel[6] = { 0, 6, 9, 13, 15, 18 };
+  int L = Ltab_uesel[cc->mib->message.dl_Bandwidth];
 
-  AssertFatal(cqi_ReportModeAperiodic != NULL,"cqi_ReportPeriodic is null!\n");
+  AssertFatal(cqi_ReportModeAperiodic != NULL,
+	      "cqi_ReportPeriodic is null!\n");
 
   switch (*cqi_ReportModeAperiodic) {
   case CQI_ReportModeAperiodic_rm12:
-    AssertFatal(tmode==4 || tmode==6 || tmode==8 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm12\n",tmode);
-    AssertFatal(cc->p_eNB<=4,"only up to 4 antenna ports supported here\n");
-    if (ri==1 && cc->p_eNB==2) return(4+(N<<1));
-    else if (ri==2 && cc->p_eNB==2) return(8+N);
-    else if (ri==1 && cc->p_eNB==4) return(4+(N<<2));
-    else if (ri>1  && cc->p_eNB==4) return(8+(N<<2));
+    AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9
+		|| tmode == 10,
+		"Illegal TM (%d) for CQI_ReportModeAperiodic_rm12\n",
+		tmode);
+    AssertFatal(cc->p_eNB <= 4,
+		"only up to 4 antenna ports supported here\n");
+    if (ri == 1 && cc->p_eNB == 2)
+      return (4 + (N << 1));
+    else if (ri == 2 && cc->p_eNB == 2)
+      return (8 + N);
+    else if (ri == 1 && cc->p_eNB == 4)
+      return (4 + (N << 2));
+    else if (ri > 1 && cc->p_eNB == 4)
+      return (8 + (N << 2));
     break;
   case CQI_ReportModeAperiodic_rm20:
     // Table 5.2.2.6.3-1 (36.212)
-    AssertFatal(tmode==1 || tmode==2 || tmode==3 || tmode==7 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm20\n",tmode);
-    AssertFatal(tmode!=9 && tmode!=10,"TM9/10 will be handled later for CQI_ReportModeAperiodic_rm20\n");
-    return(4+2+L);
+    AssertFatal(tmode == 1 || tmode == 2 || tmode == 3 || tmode == 7
+		|| tmode == 9
+		|| tmode == 10,
+		"Illegal TM (%d) for CQI_ReportModeAperiodic_rm20\n",
+		tmode);
+    AssertFatal(tmode != 9
+		&& tmode != 10,
+		"TM9/10 will be handled later for CQI_ReportModeAperiodic_rm20\n");
+    return (4 + 2 + L);
     break;
   case CQI_ReportModeAperiodic_rm22:
     // Table 5.2.2.6.3-2 (36.212)
-    AssertFatal(tmode==4 || tmode==6 || tmode==8 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm22\n",tmode);
-    AssertFatal(tmode!=9 && tmode!=10,"TM9/10 will be handled later for CQI_ReportModeAperiodic_rm22\n");
-    if (ri==1 && cc->p_eNB==2) return(4+2+0+0+L+4);
-    if (ri==2 && cc->p_eNB==2) return(4+2+4+2+L+2);
-    if (ri==1 && cc->p_eNB==4) return(4+2+0+0+L+8);
-    if (ri>=2 && cc->p_eNB==4) return(4+2+4+2+L+8);
+    AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9
+		|| tmode == 10,
+		"Illegal TM (%d) for CQI_ReportModeAperiodic_rm22\n",
+		tmode);
+    AssertFatal(tmode != 9
+		&& tmode != 10,
+		"TM9/10 will be handled later for CQI_ReportModeAperiodic_rm22\n");
+    if (ri == 1 && cc->p_eNB == 2)
+      return (4 + 2 + 0 + 0 + L + 4);
+    if (ri == 2 && cc->p_eNB == 2)
+      return (4 + 2 + 4 + 2 + L + 2);
+    if (ri == 1 && cc->p_eNB == 4)
+      return (4 + 2 + 0 + 0 + L + 8);
+    if (ri >= 2 && cc->p_eNB == 4)
+      return (4 + 2 + 4 + 2 + L + 8);
     break;
   case CQI_ReportModeAperiodic_rm30:
     // Table 5.2.2.6.2-1 (36.212)
-    AssertFatal(tmode==1 || tmode==2 || tmode==3 || tmode==7 || tmode==8 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm30\n",tmode);
-    AssertFatal(tmode!=8 && tmode!=9 && tmode!=10,"TM8/9/10 will be handled later for CQI_ReportModeAperiodic_rm30\n");
-    return(4+(N<<1));
+    AssertFatal(tmode == 1 || tmode == 2 || tmode == 3 || tmode == 7
+		|| tmode == 8 || tmode == 9
+		|| tmode == 10,
+		"Illegal TM (%d) for CQI_ReportModeAperiodic_rm30\n",
+		tmode);
+    AssertFatal(tmode != 8 && tmode != 9
+		&& tmode != 10,
+		"TM8/9/10 will be handled later for CQI_ReportModeAperiodic_rm30\n");
+    return (4 + (N << 1));
     break;
   case CQI_ReportModeAperiodic_rm31:
     // Table 5.2.2.6.2-2 (36.212)
-    AssertFatal(tmode==4 || tmode==6 || tmode==8 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm31\n",tmode);
-    AssertFatal(tmode!=8 && tmode!=9 && tmode!=10,"TM8/9/10 will be handled later for CQI_ReportModeAperiodic_rm31\n");
-    if (ri==1 && cc->p_eNB==2) return(4+(N<<1)+0+0+2);
-    else if (ri==2 && cc->p_eNB==2) return(4+(N<<1)+4+(N<<1)+1);
-    else if (ri==1 && cc->p_eNB==4) return(4+(N<<1)+0+0+4);
-    else if (ri>=2 && cc->p_eNB==4) return(4+(N<<1)+4+(N<<1)+4);
+    AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9
+		|| tmode == 10,
+		"Illegal TM (%d) for CQI_ReportModeAperiodic_rm31\n",
+		tmode);
+    AssertFatal(tmode != 8 && tmode != 9
+		&& tmode != 10,
+		"TM8/9/10 will be handled later for CQI_ReportModeAperiodic_rm31\n");
+    if (ri == 1 && cc->p_eNB == 2)
+      return (4 + (N << 1) + 0 + 0 + 2);
+    else if (ri == 2 && cc->p_eNB == 2)
+      return (4 + (N << 1) + 4 + (N << 1) + 1);
+    else if (ri == 1 && cc->p_eNB == 4)
+      return (4 + (N << 1) + 0 + 0 + 4);
+    else if (ri >= 2 && cc->p_eNB == 4)
+      return (4 + (N << 1) + 4 + (N << 1) + 4);
     break;
+#ifdef Rel14
   case CQI_ReportModeAperiodic_rm32_v1250:
-    AssertFatal(tmode==4 || tmode==6 || tmode==8 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm32\n",tmode);
-    AssertFatal(1==0,"CQI_ReportModeAperiodic_rm32_v1250 not supported yet\n");
+    AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9
+		|| tmode == 10,
+		"Illegal TM (%d) for CQI_ReportModeAperiodic_rm32\n",
+		tmode);
+    AssertFatal(1 == 0,
+		"CQI_ReportModeAperiodic_rm32_v1250 not supported yet\n");
     break;
   case CQI_ReportModeAperiodic_rm10_v1310:
     // Table 5.2.2.6.1-1F/G (36.212)
-    if (ri==1) return(4); // F
-    else return(7); // G
+    if (ri == 1)
+      return (4);		// F
+    else
+      return (7);		// G
     break;
   case CQI_ReportModeAperiodic_rm11_v1310:
     // Table 5.2.2.6.1-1H (36.212)
-    AssertFatal(tmode==4 || tmode==6 || tmode==8 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm11\n",tmode);
-    AssertFatal(cc->p_eNB<=4,"only up to 4 antenna ports supported here\n");
-    if (ri==1 && cc->p_eNB==2) return(4+0+2);
-    else if (ri==2 && cc->p_eNB==2) return(4+4+1);
-    else if (ri==1 && cc->p_eNB==4) return(4+0+4);
-    else if (ri>1  && cc->p_eNB==4) return(4+4+4);
-
-    break;
-  }
-  AssertFatal(1==0,"Shouldn't get here\n");
-  return(0);
-}
-
-uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_channels_t *cc,uint8_t tmode, struct CQI_ReportPeriodic *cqi_ReportPeriodic)
-{
-  int no_pmi=0;
+    AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9
+		|| tmode == 10,
+		"Illegal TM (%d) for CQI_ReportModeAperiodic_rm11\n",
+		tmode);
+    AssertFatal(cc->p_eNB <= 4,
+		"only up to 4 antenna ports supported here\n");
+    if (ri == 1 && cc->p_eNB == 2)
+      return (4 + 0 + 2);
+    else if (ri == 2 && cc->p_eNB == 2)
+      return (4 + 4 + 1);
+    else if (ri == 1 && cc->p_eNB == 4)
+      return (4 + 0 + 4);
+    else if (ri > 1 && cc->p_eNB == 4)
+      return (4 + 4 + 4);
+
+    break;
+#endif /* Rel14 */
+  }
+  AssertFatal(1 == 0, "Shouldn't get here\n");
+  return (0);
+}
+
+uint8_t
+get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP,
+			 COMMON_channels_t * cc, uint8_t tmode,
+			 struct CQI_ReportPeriodic * cqi_ReportPeriodic)
+{
+  int no_pmi = 0;
   //    Ltab[6] = {0,log2(15/4/2),log2(25/4/2),log2(50/6/3),log2(75/8/4),log2(100/8/4)};
 
-  uint8_t Ltab[6] = {0,1,2,2,2,2};
+  uint8_t Ltab[6] = { 0, 1, 2, 2, 2, 2 };
   uint8_t ri = sched_ctl->periodic_ri_received[CC_idP];
 
-  AssertFatal(cqi_ReportPeriodic != NULL,"cqi_ReportPeriodic is null!\n");
+  AssertFatal(cqi_ReportPeriodic != NULL,
+	      "cqi_ReportPeriodic is null!\n");
   AssertFatal(cqi_ReportPeriodic->present != CQI_ReportPeriodic_PR_NOTHING,
-              "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n");
-  AssertFatal(cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present != CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING,
-              "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n");
+	      "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n");
+  AssertFatal(cqi_ReportPeriodic->choice.
+	      setup.cqi_FormatIndicatorPeriodic.present != CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING,
+	      "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n");
 
-  switch(tmode) {
+  switch (tmode) {
   case 1:
   case 2:
   case 5:
   case 6:
   case 7:
-    no_pmi=1;
+    no_pmi = 1;
     break;
   default:
-    no_pmi=0;
+    no_pmi = 0;
   }
 
-  if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) ||
-      (sched_ctl->feedback_cnt[CC_idP] == 0)) {
+  if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI)
+      || (sched_ctl->feedback_cnt[CC_idP] == 0)) {
     // send wideband report every opportunity if wideband reporting mode is selected, else every H opportunities
-    if (no_pmi == 1)
-      return(4);
-    else if ((cc->p_eNB==2) && (ri==1)) return(6);
-    else if ((cc->p_eNB==2) && (ri==2)) return(8);
-    else if ((cc->p_eNB==4) && (ri==1)) return(8);
-    else if ((cc->p_eNB==4) && (ri==2)) return(11);
-    else AssertFatal(1==0,"illegal combination p %d, ri %d, no_pmi %d\n",cc->p_eNB,ri,no_pmi);
-  }
-  else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) {
-    if ((no_pmi == 1)||ri==1) return(4+Ltab[cc->mib->message.dl_Bandwidth]);
+    if (no_pmi == 1)                        return (4);
+    else if ((cc->p_eNB == 2) && (ri == 1)) return (6);
+    else if ((cc->p_eNB == 2) && (ri == 2)) return (8);
+    else if ((cc->p_eNB == 4) && (ri == 1)) return (8);
+    else if ((cc->p_eNB == 4) && (ri == 2)) return (11);
     else
-      return(7+Ltab[cc->mib->message.dl_Bandwidth]);
-  }
-  AssertFatal(1==0,"Shouldn't get here : cqi_ReportPeriodic->present %d\n",cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present);
-}
-
-void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t   *dl_config_pdu,
-                          uint8_t aggregation_level,
-                          uint16_t rnti,
-                          uint8_t rnti_type,
-                          uint8_t harq_process,
-                          uint8_t tpc,
-                          uint16_t resource_block_coding,
-                          uint8_t mcs,
-                          uint8_t ndi,
-                          uint8_t rv,
-                          uint8_t vrb_flag)
-{
-  memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
+      AssertFatal(1 == 0,
+		  "illegal combination p %d, ri %d, no_pmi %d\n",
+		  cc->p_eNB, ri, no_pmi);
+  } else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) {
+    if ((no_pmi == 1) || ri == 1) return (4 + Ltab[cc->mib->message.dl_Bandwidth]);
+    else                          return (7 + Ltab[cc->mib->message.dl_Bandwidth]);
+  }
+
+  AssertFatal(1 == 0,
+	      "Shouldn't get here : cqi_ReportPeriodic->present %d\n",
+	      cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present);
+}
+
+void
+fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu,
+		     uint8_t                       aggregation_level,
+		     uint16_t                      rnti,
+		     uint8_t                       rnti_type,
+		     uint8_t                       harq_process,
+		     uint8_t                       tpc,
+		     uint16_t                      resource_block_coding,
+		     uint8_t                       mcs, 
+		     uint8_t                       ndi, 
+		     uint8_t                       rv,
+		     uint8_t                       vrb_flag)
+{
+  memset((void *) dl_config_pdu, 0,
+	 sizeof(nfapi_dl_config_request_pdu_t));
   dl_config_pdu->pdu_type                                                          = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
-  dl_config_pdu->pdu_size                                                          = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
+  dl_config_pdu->pdu_size                                                          = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag                                 = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format                             = NFAPI_DL_DCI_FORMAT_1A;
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level                      = aggregation_level;
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti                                   = rnti;
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type                              = rnti_type;
-  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power                     = 6000; // equal to RS power
+  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power                     = 6000;	// equal to RS power
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process                           = harq_process;
-  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc                                    = tpc; // no TPC
+  dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc                                    = tpc;
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding                  = resource_block_coding;
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1                                  = mcs;
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1                   = ndi;
@@ -909,87 +1016,86 @@ void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t   *dl_config_pdu,
   dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = vrb_flag;
 }
 
-void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t frameP, sub_frame_t subframeP,uint8_t cce_idx)
+void
+program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP,
+		     frame_t frameP, sub_frame_t subframeP,
+		     uint8_t cce_idx)
 {
-  eNB_MAC_INST                   *eNB      = RC.mac[module_idP];
-  COMMON_channels_t              *cc       = eNB->common_channels;
-  UE_list_t                      *UE_list  = &eNB->UE_list;
-  rnti_t                         rnti      = UE_RNTI(module_idP,UE_idP);
-  nfapi_ul_config_request_body_t *ul_req;
-  nfapi_ul_config_request_pdu_t  *ul_config_pdu;
-
-  int use_simultaneous_pucch_pusch=0;
-  nfapi_ul_config_ulsch_harq_information *ulsch_harq_information = NULL;
-  nfapi_ul_config_harq_information *harq_information = NULL;
+  eNB_MAC_INST                           *eNB                         = RC.mac[module_idP];
+  COMMON_channels_t                      *cc                          = eNB->common_channels;
+  UE_list_t                              *UE_list                     = &eNB->UE_list;
+  rnti_t                                 rnti                         = UE_RNTI(module_idP, UE_idP);
+  nfapi_ul_config_request_body_t         *ul_req;
+  nfapi_ul_config_request_pdu_t          *ul_config_pdu;
+  int                                    use_simultaneous_pucch_pusch = 0;
+  nfapi_ul_config_ulsch_harq_information *ulsch_harq_information      = NULL;
+  nfapi_ul_config_harq_information       *harq_information            = NULL;
 
 #if defined(Rel10) || defined(Rel14)
 
-  if ((UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2) &&
-      (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020) &&
-      (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10) &&
-      (*UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10 ==
-          PUCCH_ConfigDedicated_v1020__simultaneousPUCCH_PUSCH_r10_true))
-    use_simultaneous_pucch_pusch=1;
+  if ((UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2)
+      && (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020)
+      && (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10)
+      && (*UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10 == PUCCH_ConfigDedicated_v1020__simultaneousPUCCH_PUSCH_r10_true))
+    use_simultaneous_pucch_pusch = 1;
 #endif
 
   // pucch1 and pusch feedback is similar, namely in n+k subframes from now
   // This is used in the following "if/else" condition to check if there isn't or is already an UL grant in n+k
-  int16_t ul_absSF = get_pucch1_absSF(&cc[CC_idP],subframeP+(10*frameP));
+  int16_t ul_absSF = get_pucch1_absSF(&cc[CC_idP], subframeP + (10 * frameP));
 
-  if ((ul_config_pdu = has_ul_grant(module_idP,CC_idP,
-                                    ul_absSF,
-                                    rnti)) == NULL) {
+  if ((ul_config_pdu = has_ul_grant(module_idP, CC_idP,ul_absSF, rnti)) == NULL) {
     // no UL grant so
     // Program ACK/NAK alone Format 1a/b or 3
 
-    ul_req        = &RC.mac[module_idP]->UL_req_tmp[CC_idP][ul_absSF%10].ul_config_request_body;
+    ul_req        = &RC.mac[module_idP]->UL_req_tmp[CC_idP][ul_absSF %10].ul_config_request_body;
     ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
     // Do PUCCH
     fill_nfapi_uci_acknak(module_idP,
-                          CC_idP,
-                          rnti,
-                          (frameP*10)+subframeP,
-                          cce_idx);
-  }
-  else {
+			  CC_idP,
+			  rnti, (frameP * 10) + subframeP, cce_idx);
+  } else {
     /* there is already an existing UL grant so update it if needed
      * on top of some other UL resource (PUSCH,combined SR/CQI/HARQ on PUCCH, etc)
      */
-    switch(ul_config_pdu->pdu_type) {
-
-    /* [ulsch] to [ulsch + harq] or [ulsch + harq on pucch] */
-
+    switch (ul_config_pdu->pdu_type) {
+      
+      /* [ulsch] to [ulsch + harq] or [ulsch + harq on pucch] */
+      
     case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
-      if (use_simultaneous_pucch_pusch==1) {
-        // Convert it to an NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE
-        harq_information = &ul_config_pdu->ulsch_uci_harq_pdu.harq_information;
-        ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE;
-        LOG_D(MAC,"Frame %d, Subframe %d: Switched UCI HARQ to ULSCH UCI HARQ\n",frameP,subframeP);
-      }
-      else {
-        // Convert it to an NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE
-        ulsch_harq_information = &ul_config_pdu->ulsch_harq_pdu.harq_information;
-        ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
-        ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial=0; // last symbol not punctured
-        ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks=
-          ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks; // we don't change the number of resource blocks across retransmissions yet
-        LOG_D(MAC,"Frame %d, Subframe %d: Switched UCI HARQ to ULSCH HARQ\n",frameP,subframeP);
+      if (use_simultaneous_pucch_pusch == 1) {
+	// Convert it to an NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE
+	harq_information        = &ul_config_pdu->ulsch_uci_harq_pdu.harq_information;
+	ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE;
+	LOG_D(MAC,
+	      "Frame %d, Subframe %d: Switched UCI HARQ to ULSCH UCI HARQ\n",
+	      frameP, subframeP);
+      } else {
+	// Convert it to an NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE
+	ulsch_harq_information                                                                                                               = &ul_config_pdu->ulsch_harq_pdu.harq_information;
+	ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
+	ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag                            = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
+	ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial                     = 0;	// last symbol not punctured
+	ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks;	// we don't change the number of resource blocks across retransmissions yet
+	LOG_D(MAC,
+	      "Frame %d, Subframe %d: Switched UCI HARQ to ULSCH HARQ\n",
+	      frameP, subframeP);
       }
       break;
     case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
       AssertFatal(use_simultaneous_pucch_pusch == 1,
-                  "Cannot be NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE, simultaneous_pucch_pusch is active");
+		  "Cannot be NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE, simultaneous_pucch_pusch is active");
       break;
     case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
       AssertFatal(use_simultaneous_pucch_pusch == 0,
-                  "Cannot be NFAPI_UL_CONFIG_ULSCH_UCI_PDU_TYPE, simultaneous_pucch_pusch is inactive\n");
+		  "Cannot be NFAPI_UL_CONFIG_ULSCH_UCI_PDU_TYPE, simultaneous_pucch_pusch is inactive\n");
       break;
 
-    /* [ulsch + cqi] to [ulsch + cqi + harq] */
+      /* [ulsch + cqi] to [ulsch + cqi + harq] */
 
     case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
       // Convert it to an NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE
-      ulsch_harq_information = &ul_config_pdu->ulsch_cqi_harq_ri_pdu.harq_information;
+      ulsch_harq_information  = &ul_config_pdu->ulsch_cqi_harq_ri_pdu.harq_information;
       ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
       /* TODO: check this - when converting from nfapi_ul_config_ulsch_cqi_ri_pdu to
        * nfapi_ul_config_ulsch_cqi_harq_ri_pdu, shouldn't we copy initial_transmission_parameters
@@ -997,40 +1103,38 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t
        * Those two types are not compatible. 'initial_transmission_parameters' is not at the
        * place in both.
        */
-      ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial=0; // last symbol not punctured
-      ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks=
-        ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks; // we don't change the number of resource blocks across retransmissions yet
+      ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag                            = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
+      ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial                     = 0;	// last symbol not punctured
+      ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks;	// we don't change the number of resource blocks across retransmissions yet
       break;
     case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
       AssertFatal(use_simultaneous_pucch_pusch == 0,
-                  "Cannot be NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE, simultaneous_pucch_pusch is active\n");
+		  "Cannot be NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE, simultaneous_pucch_pusch is active\n");
       break;
 
-    /* [ulsch + cqi on pucch] to [ulsch + cqi on pucch + harq on pucch] */
+      /* [ulsch + cqi on pucch] to [ulsch + cqi on pucch + harq on pucch] */
 
     case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
       // convert it to an NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE
-      harq_information = &ul_config_pdu->ulsch_csi_uci_harq_pdu.harq_information;
+      harq_information        = &ul_config_pdu->ulsch_csi_uci_harq_pdu.harq_information;
       ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE;
       break;
     case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
       AssertFatal(use_simultaneous_pucch_pusch == 1,
-                  "Cannot be NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE, simultaneous_pucch_pusch is inactive\n");
+		  "Cannot be NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE, simultaneous_pucch_pusch is inactive\n");
       break;
 
-    /* [sr] to [sr + harq] */
+      /* [sr] to [sr + harq] */
 
     case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
       // convert to NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE
       ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE;
-      harq_information = &ul_config_pdu->uci_sr_harq_pdu.harq_information;
+      harq_information        = &ul_config_pdu->uci_sr_harq_pdu.harq_information;
       break;
     case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
       /* nothing to do */
       break;
-
-    /* [cqi] to [cqi + harq] */
-
+      /* [cqi] to [cqi + harq] */
     case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
       // convert to NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE
       ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE;
@@ -1039,9 +1143,7 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t
     case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
       /* nothing to do */
       break;
-
-    /* [cqi + sr] to [cqr + sr + harq] */
-
+      /* [cqi + sr] to [cqr + sr + harq] */
     case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
       // convert to NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE
       ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE;
@@ -1053,228 +1155,252 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t
     }
   }
 
-  if (ulsch_harq_information) fill_nfapi_ulsch_harq_information(module_idP,CC_idP,
-                                                                rnti,
-                                                                ulsch_harq_information);
+  if (ulsch_harq_information) fill_nfapi_ulsch_harq_information(module_idP, CC_idP, rnti, ulsch_harq_information);
 
-  if (harq_information) fill_nfapi_harq_information(module_idP,CC_idP,
-                                                    rnti,
-                                                    (frameP*10)+subframeP,
-                                                    harq_information,
-                                                    cce_idx);
+  if (harq_information) fill_nfapi_harq_information(module_idP, CC_idP,
+						    rnti,
+						    (frameP * 10) + subframeP,
+						    harq_information, cce_idx);
 }
 
-uint8_t get_V_UL_DAI(module_id_t module_idP,int CC_idP,uint16_t rntiP)
+uint8_t get_V_UL_DAI(module_id_t module_idP, int CC_idP, uint16_t rntiP)
 {
-  nfapi_hi_dci0_request_body_t        *HI_DCI0_req         = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
-  nfapi_hi_dci0_request_pdu_t         *hi_dci0_pdu         = &HI_DCI0_req->hi_dci0_pdu_list[0];
+  nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
+  nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu  = &HI_DCI0_req->hi_dci0_pdu_list[0];
 
-  for (int i=0;i<HI_DCI0_req->number_of_dci;i++) {
-    if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE)&&
-        (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti == rntiP))
-        return(hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.dl_assignment_index);
+  for (int i = 0; i < HI_DCI0_req->number_of_dci; i++) {
+    if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) &&
+	(hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti == rntiP))
+      return (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.dl_assignment_index);
   }
-  return(4); // this is rule from Section 7.3 in 36.213
+  return (4);			// this is rule from Section 7.3 in 36.213
 }
 
-void fill_nfapi_ulsch_harq_information(module_id_t module_idP,
-                                       int CC_idP,
-                                       uint16_t rntiP,
-                                       nfapi_ul_config_ulsch_harq_information *harq_information)
+void
+fill_nfapi_ulsch_harq_information(module_id_t                            module_idP,
+				  int                                    CC_idP,
+				  uint16_t                               rntiP,
+				  nfapi_ul_config_ulsch_harq_information *harq_information)
 {
-  eNB_MAC_INST                   *eNB      = RC.mac[module_idP];
-  COMMON_channels_t              *cc       = &eNB->common_channels[CC_idP];
-  UE_list_t                      *UE_list  = &eNB->UE_list;
+  eNB_MAC_INST *eNB     = RC.mac[module_idP];
+  COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
+  UE_list_t *UE_list    = &eNB->UE_list;
 
-  int UE_id                                = find_UE_id(module_idP,rntiP);
+  int UE_id = find_UE_id(module_idP, rntiP);
 
-  PUSCH_ConfigDedicated_t              *puschConfigDedicated;
+  PUSCH_ConfigDedicated_t *puschConfigDedicated;
   //  PUSCH_ConfigDedicated_v1020_t        *puschConfigDedicated_v1020;
   //  PUSCH_ConfigDedicated_v1130_t        *puschConfigDedicated_v1130;
   //  PUSCH_ConfigDedicated_v1250_t        *puschConfigDedicated_v1250;
 
-  AssertFatal(UE_id>=0,"UE_id cannot be found, impossible\n");
-  AssertFatal(UE_list!=NULL,"UE_list is null\n");
-  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated for rnti %x is null\n",rntiP);
-  AssertFatal((puschConfigDedicated = (PUSCH_ConfigDedicated_t *)UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pusch_ConfigDedicated)!=NULL,"physicalConfigDedicated->puschConfigDedicated for rnti %x is null\n",rntiP);
+  AssertFatal(UE_id >= 0, "UE_id cannot be found, impossible\n");
+  AssertFatal(UE_list != NULL, "UE_list is null\n");
+  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL,
+	      "physicalConfigDedicated for rnti %x is null\n", rntiP);
+  AssertFatal((puschConfigDedicated = (PUSCH_ConfigDedicated_t *)
+	       UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pusch_ConfigDedicated) != NULL,
+	      "physicalConfigDedicated->puschConfigDedicated for rnti %x is null\n",
+	      rntiP);
 #if defined(Rel14) || defined(Rel14)
   /*  if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext2) puschConfigDedicated_v1020 =  UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext2->pusch_ConfigDedicated_v1020;
-#endif
-#ifdef Rel14
-  if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext4) puschConfigDedicated_v1130 =  UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext4->pusch_ConfigDedicated_v1130;
-  if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext5) puschConfigDedicated_v1250 =  UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext5->pusch_ConfigDedicated_v1250;
+      #endif
+      #ifdef Rel14
+      if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext4) puschConfigDedicated_v1130 =  UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext4->pusch_ConfigDedicated_v1130;
+      if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext5) puschConfigDedicated_v1250 =  UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext5->pusch_ConfigDedicated_v1250;
   */
 #endif
   harq_information->harq_information_rel10.delta_offset_harq = puschConfigDedicated->betaOffset_ACK_Index;
-  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated!=NULL,"pucch_ConfigDedicated is null!\n");
-  if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode!=NULL)&&
-      (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode==PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing))
-      harq_information->harq_information_rel10.ack_nack_mode = 1;  // multiplexing
+  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL,
+	      "pucch_ConfigDedicated is null!\n");
+  if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL)
+      && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing))
+    harq_information->harq_information_rel10.ack_nack_mode = 1;	// multiplexing
   else
-      harq_information->harq_information_rel10.ack_nack_mode = 0;  // bundling
+    harq_information->harq_information_rel10.ack_nack_mode = 0;	// bundling
 
-  switch(get_tmode(module_idP,CC_idP,UE_id)) {
+  switch (get_tmode(module_idP, CC_idP, UE_id)) {
   case 1:
   case 2:
   case 5:
   case 6:
   case 7:
-    if (cc->tdd_Config==NULL) // FDD
+    if (cc->tdd_Config == NULL)	// FDD
       harq_information->harq_information_rel10.harq_size = 1;
     else {
       if (harq_information->harq_information_rel10.ack_nack_mode == 1)
-        harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP,CC_idP,rntiP);
+	harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP, CC_idP, rntiP);
       else
         harq_information->harq_information_rel10.harq_size = 1;
     }
     break;
-  default: // for any other TM we need 2 bits harq
-    if (cc->tdd_Config==NULL) {
-        harq_information->harq_information_rel10.harq_size     = 2;
-    }
-    else {
+  default:			// for any other TM we need 2 bits harq
+    if (cc->tdd_Config == NULL) {
+      harq_information->harq_information_rel10.harq_size = 2;
+    } else {
       if (harq_information->harq_information_rel10.ack_nack_mode == 1)
-        harq_information->harq_information_rel10.harq_size     = get_V_UL_DAI(module_idP,CC_idP,rntiP);
+	harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP, CC_idP, rntiP);
       else
-        harq_information->harq_information_rel10.harq_size     = 2;
+	harq_information->harq_information_rel10.harq_size = 2;
     }
     break;
-  } // get Tmode
+  }				// get Tmode
 }
 
-void fill_nfapi_harq_information(module_id_t module_idP,
-                                 int CC_idP,
-                                 uint16_t rntiP,
-                                 uint16_t absSFP,
-                                 nfapi_ul_config_harq_information *harq_information,
-                                 uint8_t cce_idxP)
+void
+fill_nfapi_harq_information(module_id_t                      module_idP,
+			    int                              CC_idP,
+			    uint16_t                         rntiP,
+			    uint16_t                         absSFP,
+			    nfapi_ul_config_harq_information *harq_information, 
+			    uint8_t                          cce_idxP)
 {
-  eNB_MAC_INST                   *eNB      = RC.mac[module_idP];
-  COMMON_channels_t              *cc       = &eNB->common_channels[CC_idP];
-  UE_list_t                      *UE_list  = &eNB->UE_list;
+  eNB_MAC_INST *eNB     = RC.mac[module_idP];
+  COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
+  UE_list_t *UE_list    = &eNB->UE_list;
 
-  int UE_id                                = find_UE_id(module_idP,rntiP);
+  int UE_id = find_UE_id(module_idP, rntiP);
 
-  AssertFatal(UE_id>=0,"UE_id cannot be found, impossible\n");
-  AssertFatal(UE_list!=NULL,"UE_list is null\n");
-  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated for rnti %x is null\n",rntiP);
+  AssertFatal(UE_id >= 0, "UE_id cannot be found, impossible\n");
+  AssertFatal(UE_list != NULL, "UE_list is null\n");
+#if 0
+  /* TODO: revisit, don't use Assert, it's perfectly possible to
+   * have physicalConfigDedicated NULL here
+   */
+  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL,
+	      "physicalConfigDedicated for rnti %x is null\n", rntiP);
+#endif
 
+  harq_information->harq_information_rel11.tl.tag        = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG;
   harq_information->harq_information_rel11.num_ant_ports = 1;
 
-  switch(get_tmode(module_idP,CC_idP,UE_id)) {
+  switch (get_tmode(module_idP, CC_idP, UE_id)) {
   case 1:
   case 2:
   case 5:
   case 6:
   case 7:
-    if (cc->tdd_Config!=NULL) {
-      AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated!=NULL,
-                  "pucch_ConfigDedicated is null for TDD!\n");
-      if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode!=NULL)&&
-          (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode==PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) {
-        harq_information->harq_information_rel10_tdd.harq_size     = 2;  // 2-bit ACK/NAK
-        harq_information->harq_information_rel10_tdd.ack_nack_mode = 1;  // multiplexing
-      }
-      else {
-        harq_information->harq_information_rel10_tdd.harq_size     = 1;  // 1-bit ACK/NAK
-        harq_information->harq_information_rel10_tdd.ack_nack_mode = 0;  // bundling
+    if (cc->tdd_Config != NULL) {
+      AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL,
+		  "pucch_ConfigDedicated is null for TDD!\n");
+      if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL)
+	  && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing))
+	{
+	  harq_information->harq_information_rel10_tdd.harq_size             = 2;	// 2-bit ACK/NAK
+	  harq_information->harq_information_rel10_tdd.ack_nack_mode         = 1;	// multiplexing
+	} else {
+	harq_information->harq_information_rel10_tdd.harq_size               = 1;	// 1-bit ACK/NAK
+	harq_information->harq_information_rel10_tdd.ack_nack_mode           = 0;	// bundling
       }
-      harq_information->harq_information_rel10_tdd.n_pucch_1_0   = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
+      harq_information->harq_information_rel10_tdd.tl.tag                    = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG;
+      harq_information->harq_information_rel10_tdd.n_pucch_1_0               = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
       harq_information->harq_information_rel10_tdd.number_of_pucch_resources = 1;
     } else {
-      harq_information->harq_information_rel9_fdd.number_of_pucch_resources = 1;
-      harq_information->harq_information_rel9_fdd.harq_size                 = 1;  // 1-bit ACK/NAK
-      harq_information->harq_information_rel9_fdd.n_pucch_1_0               = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
-    }
-    break;
-  default: // for any other TM we need 2 bits harq
-    if (cc->tdd_Config!=NULL) {
-      AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated!=NULL,
-                  "pucch_ConfigDedicated is null for TDD!\n");
-      if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode!=NULL)&&
-          (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode==PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) {
-        harq_information->harq_information_rel10_tdd.ack_nack_mode = 1;  // multiplexing
-      }
-      else {
-        harq_information->harq_information_rel10_tdd.ack_nack_mode = 0;  // bundling
+      harq_information->harq_information_rel9_fdd.tl.tag                     = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG;
+      harq_information->harq_information_rel9_fdd.number_of_pucch_resources  = 1;
+      harq_information->harq_information_rel9_fdd.harq_size                  = 1;	// 1-bit ACK/NAK
+      harq_information->harq_information_rel9_fdd.n_pucch_1_0                = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
+    }
+    break;
+  default:			// for any other TM we need 2 bits harq
+    if (cc->tdd_Config != NULL) {
+      AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL,
+		  "pucch_ConfigDedicated is null for TDD!\n");
+      if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL)
+	  && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) {
+	harq_information->harq_information_rel10_tdd.ack_nack_mode            = 1;	// multiplexing
+      } else {
+	harq_information->harq_information_rel10_tdd.ack_nack_mode            = 0;	// bundling
       }
-      harq_information->harq_information_rel10_tdd.harq_size       = 2;
-      harq_information->harq_information_rel10_tdd.n_pucch_1_0   = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
-      harq_information->harq_information_rel10_tdd.number_of_pucch_resources = 1;
-    }
-    else {
-      harq_information->harq_information_rel9_fdd.number_of_pucch_resources = 1;
-      harq_information->harq_information_rel9_fdd.ack_nack_mode    = 0;  // 1a/b
-      harq_information->harq_information_rel9_fdd.harq_size        = 2;
-      harq_information->harq_information_rel9_fdd.n_pucch_1_0      = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
-    }
-    break;
-  } // get Tmode
-}
-
-uint16_t fill_nfapi_uci_acknak(module_id_t module_idP,
-                               int CC_idP,
-                               uint16_t rntiP,
-                               uint16_t absSFP,
-                               uint8_t cce_idxP)
-{
-  eNB_MAC_INST                   *eNB          = RC.mac[module_idP];
-  COMMON_channels_t              *cc           = &eNB->common_channels[CC_idP];
-
-  int ackNAK_absSF                             = get_pucch1_absSF(cc,absSFP);
-  nfapi_ul_config_request_body_t *ul_req       = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF%10].ul_config_request_body;
-  nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
-
-  memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
-  ul_config_pdu->pdu_type                                                              = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
-  ul_config_pdu->pdu_size                                                              = (uint8_t)(2+sizeof(nfapi_ul_config_uci_harq_pdu));
-  ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle                = 0; // don't know how to use this
-  ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti                  = rntiP;
-
-  fill_nfapi_harq_information(module_idP,CC_idP,
-                              rntiP,
-                              absSFP,
-                              &ul_config_pdu->uci_harq_pdu.harq_information,
-                              cce_idxP);
-  LOG_D(MAC,"Filled in UCI HARQ request for rnti %x SF %d.%d acknakSF %d.%d, cce_idxP %d-> n1_pucch %d\n",rntiP,
-        absSFP/10,absSFP%10,ackNAK_absSF/10,ackNAK_absSF%10,cce_idxP,ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0);
-
-  ul_req->number_of_pdus++;
-
-  return(((ackNAK_absSF/10)<<4) + (ackNAK_absSF%10));
-}
-
-void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB,
-                             nfapi_dl_config_request_body_t *dl_req,
-                             uint16_t length,
-                             uint16_t pdu_index,
-                             uint16_t rnti,
-                             uint8_t resource_allocation_type,
-                             uint8_t virtual_resource_block_assignment_flag,
-                             uint16_t resource_block_coding,
-                             uint8_t modulation,
-                             uint8_t redundancy_version,
-                             uint8_t transport_blocks,
-                             uint8_t transport_block_to_codeword_swap_flag,
-                             uint8_t transmission_scheme,
-                             uint8_t number_of_layers,
-                             uint8_t number_of_subbands,
-                             //                             uint8_t codebook_index,
-                             uint8_t ue_category_capacity,
-                             uint8_t pa,
-                             uint8_t delta_power_offset_index,
-                             uint8_t ngap,
-                             uint8_t nprb,
-                             uint8_t transmission_mode,
-                             uint8_t num_bf_prb_per_subband,
-                             uint8_t num_bf_vector
-                             )
-{
-  nfapi_dl_config_request_pdu_t   *dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
-  memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
+      harq_information->harq_information_rel10_tdd.tl.tag                     = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG;
+      harq_information->harq_information_rel10_tdd.harq_size                  = 2;
+      harq_information->harq_information_rel10_tdd.n_pucch_1_0                =	cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
+      harq_information->harq_information_rel10_tdd.number_of_pucch_resources  = 1;
+    } else {
+      harq_information->harq_information_rel9_fdd.tl.tag                      = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG;
+      harq_information->harq_information_rel9_fdd.number_of_pucch_resources   = 1;
+      harq_information->harq_information_rel9_fdd.ack_nack_mode               = 0;	// 1a/b
+      harq_information->harq_information_rel9_fdd.harq_size                   = 2;
+      harq_information->harq_information_rel9_fdd.n_pucch_1_0                 =	cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
+    }
+    break;
+  }				// get Tmode
+}
+
+uint16_t
+fill_nfapi_uci_acknak(module_id_t module_idP,
+		      int         CC_idP,
+		      uint16_t    rntiP, 
+		      uint16_t    absSFP, 
+		      uint8_t     cce_idxP)
+{
+  eNB_MAC_INST                   *eNB           = RC.mac[module_idP];
+  COMMON_channels_t              *cc            = &eNB->common_channels[CC_idP];
+  int                            ackNAK_absSF   = get_pucch1_absSF(cc, absSFP);
+  nfapi_ul_config_request_t      *ul_req        = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF % 10];
+  nfapi_ul_config_request_body_t *ul_req_body   = &ul_req->ul_config_request_body;
+  nfapi_ul_config_request_pdu_t  *ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
+
+  memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t));
+  ul_config_pdu->pdu_type                                               = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
+  ul_config_pdu->pdu_size                                               = (uint8_t) (2 + sizeof(nfapi_ul_config_uci_harq_pdu));
+  ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+  ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0;	// don't know how to use this
+  ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti   = rntiP;
+
+  fill_nfapi_harq_information(module_idP, CC_idP,
+			      rntiP,
+			      absSFP,
+			      &ul_config_pdu->uci_harq_pdu.harq_information, cce_idxP);
+  LOG_D(MAC,
+	"Filled in UCI HARQ request for rnti %x SF %d.%d acknakSF %d.%d, cce_idxP %d-> n1_pucch %d\n",
+	rntiP, absSFP / 10, absSFP % 10, ackNAK_absSF / 10,
+	ackNAK_absSF % 10, cce_idxP,
+	ul_config_pdu->uci_harq_pdu.
+	harq_information.harq_information_rel9_fdd.n_pucch_1_0);
+
+  ul_req_body->number_of_pdus++;
+  ul_req_body->tl.tag       = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+  ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
+  ul_req->sfn_sf            = (ackNAK_absSF/10) << 4 | ackNAK_absSF%10;
+
+  return (((ackNAK_absSF / 10) << 4) + (ackNAK_absSF % 10));
+}
+
+void
+fill_nfapi_dlsch_config(eNB_MAC_INST * eNB,
+			nfapi_dl_config_request_body_t * dl_req,
+			uint16_t length,
+			uint16_t pdu_index,
+			uint16_t rnti,
+			uint8_t resource_allocation_type,
+			uint8_t
+			virtual_resource_block_assignment_flag,
+			uint16_t resource_block_coding,
+			uint8_t modulation,
+			uint8_t redundancy_version,
+			uint8_t transport_blocks,
+			uint8_t transport_block_to_codeword_swap_flag,
+			uint8_t transmission_scheme,
+			uint8_t number_of_layers,
+			uint8_t number_of_subbands,
+			//                             uint8_t codebook_index,
+			uint8_t ue_category_capacity,
+			uint8_t pa,
+			uint8_t delta_power_offset_index,
+			uint8_t ngap,
+			uint8_t nprb,
+			uint8_t transmission_mode,
+			uint8_t num_bf_prb_per_subband,
+			uint8_t num_bf_vector)
+{
+  nfapi_dl_config_request_pdu_t *dl_config_pdu =
+    &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+  memset((void *) dl_config_pdu, 0,
+	 sizeof(nfapi_dl_config_request_pdu_t));
 
   dl_config_pdu->pdu_type                                                        = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
-  dl_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
+  dl_config_pdu->pdu_size                                                        = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
+  dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag                                 = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
   dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length                                 = length;
   dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index                              = pdu_index;
   dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti                                   = rnti;
@@ -1300,208 +1426,233 @@ void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB,
   dl_req->number_pdu++;
 }
 
-uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,uint16_t absSF,uint16_t pdu_length, uint16_t pdu_index, uint8_t *pdu)
+uint16_t
+fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,
+		  uint16_t                absSF, 
+		  uint16_t                pdu_length,
+		  uint16_t                pdu_index, 
+		  uint8_t                 *pdu)
 {
-  nfapi_tx_request_pdu_t *TX_req        = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus];
-  LOG_D(MAC,"Filling TX_req %d for pdu length %d\n",tx_req_body->number_of_pdus,pdu_length);
-  TX_req->pdu_length                    = pdu_length;
-  TX_req->pdu_index                     = pdu_index;
-  TX_req->num_segments                  = 1;
-  TX_req->segments[0].segment_length    = pdu_length;
-  TX_req->segments[0].segment_data      = pdu;
+  nfapi_tx_request_pdu_t *TX_req = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus];
+  LOG_D(MAC, "Filling TX_req %d for pdu length %d\n",
+	tx_req_body->number_of_pdus, pdu_length);
+
+  TX_req->pdu_length                 = pdu_length;
+  TX_req->pdu_index                  = pdu_index;
+  TX_req->num_segments               = 1;
+  TX_req->segments[0].segment_length = pdu_length;
+  TX_req->segments[0].segment_data   = pdu;
+  tx_req_body->tl.tag                = NFAPI_TX_REQUEST_BODY_TAG;
   tx_req_body->number_of_pdus++;
 
-  return(((absSF/10)<<4) + (absSF%10));
-}
-
-void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t  *ul_config_pdu,
-                                          uint8_t                        cqi_req,
-                                          COMMON_channels_t              *cc,
-                                          struct PhysicalConfigDedicated  *physicalConfigDedicated,
-                                          uint8_t                        tmode,
-                                          uint32_t                       handle,
-                                          uint16_t                       rnti,
-                                          uint8_t                        resource_block_start,
-                                          uint8_t                        number_of_resource_blocks,
-                                          uint8_t                        mcs,
-                                          uint8_t                        cyclic_shift_2_for_drms,
-                                          uint8_t                        frequency_hopping_enabled_flag,
-                                          uint8_t                        frequency_hopping_bits,
-                                          uint8_t                        new_data_indication,
-                                          uint8_t                        redundancy_version,
-                                          uint8_t                        harq_process_number,
-                                          uint8_t                        ul_tx_mode,
-                                          uint8_t                        current_tx_nb,
-                                          uint8_t                        n_srs,
-                                          uint16_t                       size
-                                          )
-{
-  memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
-
-  ul_config_pdu->pdu_type                                                        = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
-  ul_config_pdu->pdu_size                                                        = (uint8_t)(2+sizeof(nfapi_ul_config_ulsch_pdu));
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle                                 = handle;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti                                   = rnti;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start                   = resource_block_start;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks              = number_of_resource_blocks;
-  if      (mcs<11) ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type       = 2;
-  else if (mcs<21) ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type       = 4;
-  else             ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type       = 6;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms                = cyclic_shift_2_for_drms;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag         = frequency_hopping_enabled_flag;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits                 = frequency_hopping_bits;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication                    = new_data_indication;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version                     = redundancy_version;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number                    = harq_process_number;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode                             = ul_tx_mode;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb                          = current_tx_nb;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs                                  = n_srs;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size                                   = size;
+  return (((absSF / 10) << 4) + (absSF % 10));
+}
+
+void
+fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_config_pdu, 
+				     uint8_t                        cqi_req,
+				     COMMON_channels_t              *cc,
+				     struct PhysicalConfigDedicated *physicalConfigDedicated,
+				     uint8_t                        tmode, 
+				     uint32_t                       handle,
+				     uint16_t                       rnti,
+				     uint8_t                        resource_block_start,
+				     uint8_t                        number_of_resource_blocks,
+				     uint8_t                        mcs,
+				     uint8_t                        cyclic_shift_2_for_drms,
+				     uint8_t                        frequency_hopping_enabled_flag,
+				     uint8_t                        frequency_hopping_bits,
+				     uint8_t                        new_data_indication,
+				     uint8_t                        redundancy_version,
+				     uint8_t                        harq_process_number,
+				     uint8_t                        ul_tx_mode,
+				     uint8_t                        current_tx_nb,
+				     uint8_t                        n_srs, 
+				     uint16_t                       size)
+{
+  memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t));
+
+  ul_config_pdu->pdu_type                                                    = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
+  ul_config_pdu->pdu_size                                                    = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_pdu));
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.tl.tag                             = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle                             = handle;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti                               = rnti;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start               = resource_block_start;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks          = number_of_resource_blocks;
+  if (mcs < 11)      ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 2;
+  else if (mcs < 21) ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 4;
+  else               ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 6;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms            = cyclic_shift_2_for_drms;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag     = frequency_hopping_enabled_flag;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits             = frequency_hopping_bits;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication                = new_data_indication;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version                 = redundancy_version;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number                = harq_process_number;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode                         = ul_tx_mode;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb                      = current_tx_nb;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs                              = n_srs;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size                               = size;
 
   if (cqi_req == 1) {
     // Add CQI portion
-    ul_config_pdu->pdu_type                                                           = NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE;
-    ul_config_pdu->pdu_size                                                           = (uint8_t)(2+sizeof(nfapi_ul_config_ulsch_cqi_ri_pdu));
-    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type             = 1;
+    ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE;
+    ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_cqi_ri_pdu));
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG;
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type = 1;
     ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.number_of_cc = 1;
-    LOG_D(MAC,"report_type %d\n",ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type);
+    LOG_D(MAC, "report_type %d\n",ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type);
 
-    if (cc->p_eNB<=2 && (tmode==3||tmode==4||tmode==8||tmode==9||tmode==10))
+    if (cc->p_eNB <= 2
+	&& (tmode == 3 || tmode == 4 || tmode == 8 || tmode == 9 || tmode == 10))
       ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 1;
-    else if (cc->p_eNB<=2)
-      ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 0;
-    else if (cc->p_eNB==4)
-      ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 2;
-
-    AssertFatal(physicalConfigDedicated->cqi_ReportConfig!=NULL,"physicalConfigDedicated->cqi_ReportConfig is null!\n");
-    AssertFatal(physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic!=NULL,"physicalConfigDedicated->cqi_ReportModeAperiodic is null!\n");
-    AssertFatal(physicalConfigDedicated->pusch_ConfigDedicated!=NULL,"physicalConfigDedicated->puschConfigDedicated is null!\n");
-
-    for (int ri=0;
-         ri<(1<<ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size);
-         ri++)
-      ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri] =
-        get_dl_cqi_pmi_size_pusch(cc,
-                                  tmode,
-                                  1+ri,
-                                  physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic);
-
-    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi        = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
-    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri         = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
+    else if (cc->p_eNB <= 2) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 0;
+    else if (cc->p_eNB == 4) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 2;
+
+    AssertFatal(physicalConfigDedicated->cqi_ReportConfig != NULL,"physicalConfigDedicated->cqi_ReportConfig is null!\n");
+    AssertFatal(physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic != NULL,"physicalConfigDedicated->cqi_ReportModeAperiodic is null!\n");
+    AssertFatal(physicalConfigDedicated->pusch_ConfigDedicated != NULL,"physicalConfigDedicated->puschConfigDedicated is null!\n");
+
+    for (int ri = 0; 
+	 ri <  (1 << ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size); 
+	 ri++)
+      ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri] =	get_dl_cqi_pmi_size_pusch(cc,tmode,1 + ri,physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic);
+
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi                                       = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
+    ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri                                        = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
   }
 }
 
 #ifdef Rel14
-void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t  *ul_config_pdu,
-                                          uint8_t ue_type,
-                                          uint16_t total_number_of_repetitions,
-                                          uint16_t repetition_number,
-                                          uint16_t initial_transmission_sf_io)
+void
+fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t *
+				     ul_config_pdu, uint8_t ue_type,
+				     uint16_t
+				     total_number_of_repetitions,
+				     uint16_t repetition_number,
+				     uint16_t initial_transmission_sf_io)
 {
   // Re13 fields
 
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type                               = ue_type;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions           = total_number_of_repetitions;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number                     = repetition_number;
-  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io            = initial_transmission_sf_io;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.tl.tag                      = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type                     = ue_type;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = total_number_of_repetitions;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number           = repetition_number;
+  ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io  = initial_transmission_sf_io;
 }
 
 int get_numnarrowbands(long dl_Bandwidth)
 {
-  int nb_tab[6] = {1,2,4,8,12,16};
+  int nb_tab[6] = { 1, 2, 4, 8, 12, 16 };
 
-  AssertFatal(dl_Bandwidth<7 || dl_Bandwidth>=0,"dl_Bandwidth not in [0..6]\n");
-  return(nb_tab[dl_Bandwidth]);
+  AssertFatal(dl_Bandwidth < 7 || dl_Bandwidth >= 0, "dl_Bandwidth not in [0..6]\n");
+  return (nb_tab[dl_Bandwidth]);
 }
 
 int get_numnarrowbandbits(long dl_Bandwidth)
 {
-  int nbbits_tab[6] = {0,1,2,3,4,4};
+  int nbbits_tab[6] = { 0, 1, 2, 3, 4, 4 };
 
-  AssertFatal(dl_Bandwidth<7 || dl_Bandwidth>=0,"dl_Bandwidth not in [0..6]\n");
-  return(nbbits_tab[dl_Bandwidth]);
+  AssertFatal(dl_Bandwidth < 7 || dl_Bandwidth >= 0, "dl_Bandwidth not in [0..6]\n");
+  return (nbbits_tab[dl_Bandwidth]);
 }
 
 //This implements the frame/subframe condition for first subframe of MPDCCH transmission (Section 9.1.5 36.213, Rel 13/14)
-int startSF_fdd_RA_times2[8] = {2,3,4,5,8,10,16,20};
-int startSF_tdd_RA[7]        = {1,2,4,5,8,10,20};
+int startSF_fdd_RA_times2[8] = { 2, 3, 4, 5, 8, 10, 16, 20 };
+int startSF_tdd_RA[7] = { 1, 2, 4, 5, 8, 10, 20 };
 
-int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t subframeP,int rmax,MPDCCH_TYPES_t mpdcch_type,int UE_id)
+int
+mpdcch_sf_condition(eNB_MAC_INST * eNB, int CC_id, frame_t frameP,
+		    sub_frame_t subframeP, int rmax,
+		    MPDCCH_TYPES_t mpdcch_type, int UE_id)
 {
-  struct PRACH_ConfigSIB_v1310 *ext4_prach = eNB->common_channels[CC_id].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+  struct PRACH_ConfigSIB_v1310 *ext4_prach =
+    eNB->common_channels[CC_id].radioResourceConfigCommon_BR->
+    ext4->prach_ConfigCommon_v1310;
 
   int T;
   EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11;
 
   switch (mpdcch_type) {
   case TYPE0:
-    AssertFatal(1==0,"MPDCCH Type 0 not handled yet\n");
+    AssertFatal(1 == 0, "MPDCCH Type 0 not handled yet\n");
     break;
   case TYPE1:
-    AssertFatal(1==0,"MPDCCH Type 1 not handled yet\n");
+    AssertFatal(1 == 0, "MPDCCH Type 1 not handled yet\n");
     break;
   case TYPE1A:
-    AssertFatal(1==0,"MPDCCH Type 1A not handled yet\n");
-    break;
-  case TYPE2: // RAR
-    AssertFatal(ext4_prach->mpdcch_startSF_CSS_RA_r13!=NULL,
-                "mpdcch_startSF_CSS_RA_r13 is null\n");
-    AssertFatal(rmax>0,"rmax is 0!\b");
-    if (eNB->common_channels[CC_id].tdd_Config==NULL) //FDD
-      T = rmax*startSF_fdd_RA_times2[ext4_prach->mpdcch_startSF_CSS_RA_r13->choice.fdd_r13]>>1;
-    else //TDD
-      T = rmax*startSF_tdd_RA[ext4_prach->mpdcch_startSF_CSS_RA_r13->choice.tdd_r13];
+    AssertFatal(1 == 0, "MPDCCH Type 1A not handled yet\n");
+    break;
+  case TYPE2:		// RAR
+    AssertFatal(ext4_prach->mpdcch_startSF_CSS_RA_r13 != NULL,
+		"mpdcch_startSF_CSS_RA_r13 is null\n");
+    AssertFatal(rmax > 0, "rmax is 0!\b");
+    if (eNB->common_channels[CC_id].tdd_Config == NULL)	//FDD
+      T = rmax *startSF_fdd_RA_times2[ext4_prach->
+				      mpdcch_startSF_CSS_RA_r13->
+				      choice.fdd_r13] >> 1;
+    else			//TDD
+      T = rmax *startSF_tdd_RA[ext4_prach->
+			       mpdcch_startSF_CSS_RA_r13->choice.tdd_r13];
     break;
   case TYPE2A:
-    AssertFatal(1==0,"MPDCCH Type 2A not handled yet\n");
+    AssertFatal(1 == 0, "MPDCCH Type 2A not handled yet\n");
     break;
   case TYPEUESPEC:
-    epdcch_setconfig_r11= eNB->UE_list.UE_template[CC_id][UE_id].physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0] ;
-
-    AssertFatal(epdcch_setconfig_r11 != NULL," epdcch_setconfig_r11 is null for UE specific \n");
-    AssertFatal(epdcch_setconfig_r11->ext2 != NULL," ext2 doesn't exist in epdcch config ' \n");
+    epdcch_setconfig_r11 =
+      eNB->UE_list.UE_template[CC_id][UE_id].physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
 
-    if (eNB->common_channels[CC_id].tdd_Config==NULL) //FDD
-      T = rmax*startSF_fdd_RA_times2[epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_StartSF_UESS_r13.choice.fdd_r13]>>1;
-    else //TDD
-      T = rmax*startSF_tdd_RA[epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_StartSF_UESS_r13.choice.tdd_r13];
+    AssertFatal(epdcch_setconfig_r11 != NULL,
+		" epdcch_setconfig_r11 is null for UE specific \n");
+    AssertFatal(epdcch_setconfig_r11->ext2 != NULL,
+		" ext2 doesn't exist in epdcch config ' \n");
 
+    if (eNB->common_channels[CC_id].tdd_Config == NULL)	//FDD
+      T = rmax *startSF_fdd_RA_times2[epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_StartSF_UESS_r13.choice.fdd_r13] >> 1;
+    else			//TDD
+      T = rmax *startSF_tdd_RA[epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_StartSF_UESS_r13.choice.tdd_r13];
     break;
   default:
-    return(0);
+    return (0);
   }
 
-  AssertFatal(T>0,"T is 0!\n");
-  if (((10*frameP) + subframeP)%T == 0) return(1);
-  else return(0);
+  AssertFatal(T > 0, "T is 0!\n");
+  if (((10 * frameP) + subframeP) % T == 0) return (1);
+  else return (0);
 }
 
-int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index)
+int narrowband_to_first_rb(COMMON_channels_t * cc, int nb_index)
 {
   switch (cc->mib->message.dl_Bandwidth) {
-  case 0: // 6 PRBs, N_NB=1, i_0=0
-    return(0);
+  case 0:			// 6 PRBs, N_NB=1, i_0=0
+    return (0);
     break;
-  case 3: // 50 PRBs, N_NB=8, i_0=1
-    return((int)(1+(6*nb_index)));
+  case 3:			// 50 PRBs, N_NB=8, i_0=1
+    return ((int) (1 + (6 * nb_index)));
     break;
-  case 5: // 100 PRBs, N_NB=16, i_0=2
-    return((int)(2+(6*nb_index)));
+  case 5:			// 100 PRBs, N_NB=16, i_0=2
+    return ((int) (2 + (6 * nb_index)));
     break;
-  case 1: // 15 PRBs  N_NB=2, i_0=1
-    if (nb_index>0) return(1);
-    else            return(0);
+  case 1:			// 15 PRBs  N_NB=2, i_0=1
+    if (nb_index > 0)
+      return (1);
+    else
+      return (0);
     break;
-  case 2: // 25 PRBs, N_NB=4, i_0=0
-    if (nb_index>1) return(1+(6*nb_index));
-    else            return((6*nb_index));
+  case 2:			// 25 PRBs, N_NB=4, i_0=0
+    if (nb_index > 1)
+      return (1 + (6 * nb_index));
+    else
+      return ((6 * nb_index));
     break;
-  case 4: // 75 PRBs, N_NB=12, i_0=1
-    if (nb_index>5) return(2+(6*nb_index));
-    else            return(1+(6*nb_index));
+  case 4:			// 75 PRBs, N_NB=12, i_0=1
+    if (nb_index > 5)
+      return (2 + (6 * nb_index));
+    else
+      return (1 + (6 * nb_index));
     break;
   default:
-    AssertFatal(1==0,"Impossible dl_Bandwidth %d\n",(int)cc->mib->message.dl_Bandwidth);
+    AssertFatal(1 == 0, "Impossible dl_Bandwidth %d\n",
+		(int) cc->mib->message.dl_Bandwidth);
     break;
   }
 }
@@ -1511,20 +1662,20 @@ int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index)
 void init_ue_sched_info(void)
 //------------------------------------------------------------------------------
 {
-  module_id_t i,j,k;
-
-  for (i=0; i<NUMBER_OF_eNB_MAX; 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;
-        eNB_dlsch_info[i][k][j].subframe         = 0;
-        eNB_dlsch_info[i][k][j].serving_num      = 0;
-        eNB_dlsch_info[i][k][j].status           = S_DL_NONE;
-        // init UL
-        eNB_ulsch_info[i][k][j].subframe         = 0;
-        eNB_ulsch_info[i][k][j].serving_num      = 0;
-        eNB_ulsch_info[i][k][j].status           = S_UL_NONE;
+  module_id_t i, j, k;
+
+  for (i = 0; i < NUMBER_OF_eNB_MAX; 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;
+	eNB_dlsch_info[i][k][j].subframe = 0;
+	eNB_dlsch_info[i][k][j].serving_num = 0;
+	eNB_dlsch_info[i][k][j].status = S_DL_NONE;
+	// init UL
+	eNB_ulsch_info[i][k][j].subframe = 0;
+	eNB_ulsch_info[i][k][j].serving_num = 0;
+	eNB_ulsch_info[i][k][j].status = S_UL_NONE;
       }
     }
   }
@@ -1536,7 +1687,7 @@ void init_ue_sched_info(void)
 unsigned char get_ue_weight(module_id_t module_idP, int CC_idP, int ue_idP)
 //------------------------------------------------------------------------------
 {
-  return(eNB_dlsch_info[module_idP][CC_idP][ue_idP].weight);
+  return (eNB_dlsch_info[module_idP][CC_idP][ue_idP].weight);
 }
 
 //------------------------------------------------------------------------------
@@ -1547,13 +1698,15 @@ int find_UE_id(module_id_t mod_idP, rnti_t rntiP)
   UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
 
   for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
-    if (UE_list->active[UE_id] != TRUE) continue;
-    if (UE_list->UE_template[UE_PCCID(mod_idP,UE_id)][UE_id].rnti==rntiP) {
-      return(UE_id);
+    if (UE_list->active[UE_id] != TRUE)
+      continue;
+    if (UE_list->UE_template[UE_PCCID(mod_idP, UE_id)][UE_id].rnti ==
+	rntiP) {
+      return (UE_id);
     }
   }
 
-  return(-1);
+  return (-1);
 }
 
 //------------------------------------------------------------------------------
@@ -1561,89 +1714,69 @@ int find_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP)
 //------------------------------------------------------------------------------
 {
   int RA_id;
-  AssertFatal(RC.mac[mod_idP],"RC.mac[%d] is null\n",mod_idP);
+  AssertFatal(RC.mac[mod_idP], "RC.mac[%d] is null\n", mod_idP);
 
-  RA_TEMPLATE *RA_template = (RA_TEMPLATE *)&RC.mac[mod_idP]->common_channels[CC_idP].RA_template[0];
+  RA_t *ra = (RA_t *) & RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
 
   for (RA_id = 0; RA_id < NB_RA_PROC_MAX; RA_id++) {
-    LOG_D(MAC,"Checking RA_id %d for %x : RA_active %d, wait_ack_Msg4 %d\n",
-          RA_id,rntiP,
-          RA_template[RA_id].RA_active,
-          RA_template[RA_id].wait_ack_Msg4);
-
-    if (RA_template[RA_id].RA_active==TRUE &&
-        RA_template[RA_id].wait_ack_Msg4 == 0 &&
-        RA_template[RA_id].rnti == rntiP) return(RA_id);
+    LOG_D(MAC,
+	  "Checking RA_id %d for %x : state %d\n",
+	  RA_id, rntiP, ra[RA_id].state);
+
+    if (ra[RA_id].state != IDLE &&
+	ra[RA_id].rnti == rntiP)
+      return (RA_id);
   }
-  return(-1);
+  return (-1);
 }
 
 //------------------------------------------------------------------------------
-int UE_num_active_CC(UE_list_t *listP,int ue_idP)
+int UE_num_active_CC(UE_list_t * listP, int ue_idP)
 //------------------------------------------------------------------------------
 {
-  return(listP->numactiveCCs[ue_idP]);
+  return (listP->numactiveCCs[ue_idP]);
 }
 
 //------------------------------------------------------------------------------
-int UE_PCCID(module_id_t mod_idP,int ue_idP)
+int UE_PCCID(module_id_t mod_idP, int ue_idP)
 //------------------------------------------------------------------------------
 {
-  return(RC.mac[mod_idP]->UE_list.pCC_id[ue_idP]);
+  if (!RC.mac || !RC.mac[mod_idP]) return 0;
+  return (RC.mac[mod_idP]->UE_list.pCC_id[ue_idP]);
 }
 
 //------------------------------------------------------------------------------
 rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP)
 //------------------------------------------------------------------------------
 {
-  rnti_t rnti = RC.mac[mod_idP]->UE_list.UE_template[UE_PCCID(mod_idP,ue_idP)][ue_idP].rnti;
+  if (!RC.mac || !RC.mac[mod_idP]) return 0;
+  rnti_t rnti =
+    RC.mac[mod_idP]->
+    UE_list.UE_template[UE_PCCID(mod_idP, ue_idP)][ue_idP].rnti;
 
-  if (rnti>0) {
+  if (rnti > 0) {
     return (rnti);
   }
 
-  LOG_D(MAC,"[eNB %d] Couldn't find RNTI for UE %d\n",mod_idP,ue_idP);
+  LOG_D(MAC, "[eNB %d] Couldn't find RNTI for UE %d\n", mod_idP, ue_idP);
   //display_backtrace();
-  return(NOT_A_RNTI);
+  return (NOT_A_RNTI);
 }
 
 //------------------------------------------------------------------------------
 boolean_t is_UE_active(module_id_t mod_idP, int ue_idP)
 //------------------------------------------------------------------------------
 {
-  return(RC.mac[mod_idP]->UE_list.active[ue_idP]);
+  if (!RC.mac || !RC.mac[mod_idP]) return 0;
+  return (RC.mac[mod_idP]->UE_list.active[ue_idP]);
 }
 
-/*
-uint8_t find_active_UEs(module_id_t module_idP,int CC_id){
-
-  module_id_t        ue_mod_id      = 0;
-  rnti_t        rnti         = 0;
-  uint8_t            nb_active_ue = 0;
-
-  for (ue_mod_id=0;ue_mod_id<NUMBER_OF_UE_MAX;ue_mod_id++) {
-
-      if (((rnti=eNB_mac_inst[module_idP][CC_id].UE_template[ue_mod_id].rnti) !=0)&&(eNB_mac_inst[module_idP][CC_id].UE_template[ue_mod_id].ul_active==TRUE)){
-
-          if (mac_xface->get_eNB_UE_stats(module_idP,rnti) != NULL){ // check at the phy enb_ue state for this rnti
-      nb_active_ue++;
-          }
-          else { // this ue is removed at the phy => remove it at the mac as well
-      mac_remove_ue(module_idP, CC_id, ue_mod_id);
-          }
-      }
-  }
-  return(nb_active_ue);
-}
-*/
-
-
-// get aggregation (L) form phy for a give UE
-unsigned char get_aggregation (uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt)
+unsigned char
+get_aggregation(uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt)
 {
-  unsigned char aggregation=3;
+  unsigned char aggregation = 3;
 
-  switch (dci_fmt){
+  switch (dci_fmt) {
   case format0:
     aggregation = cqi2fmt0_agg[bw_index][cqi];
     break;
@@ -1666,191 +1799,230 @@ unsigned char get_aggregation (uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt)
   case format3A:
   case format4:
   default:
-    LOG_W(MAC,"unsupported DCI format %d\n",dci_fmt);
+    LOG_W(MAC, "unsupported DCI format %d\n", dci_fmt);
   }
 
-  LOG_D(MAC,"Aggregation level %d (cqi %d, bw_index %d, format %d)\n",
-        1<<aggregation, cqi,bw_index,dci_fmt);
+  LOG_D(MAC, "Aggregation level %d (cqi %d, bw_index %d, format %d)\n", 1 << aggregation, cqi, bw_index, dci_fmt);
 
-  return 1<<aggregation;
+  return 1 << aggregation;
 }
 
-void dump_ue_list(UE_list_t *listP, int ul_flag)
+void dump_ue_list(UE_list_t * listP, int ul_flag)
 {
   int j;
 
-  if ( ul_flag == 0 ) {
-    for (j=listP->head; j>=0; j=listP->next[j]) {
-      LOG_T(MAC,"node %d => %d\n",j,listP->next[j]);
+  if (ul_flag == 0) {
+    for (j = listP->head; j >= 0; j = listP->next[j]) {
+      LOG_T(MAC, "node %d => %d\n", j, listP->next[j]);
     }
   } else {
-    for (j=listP->head_ul; j>=0; j=listP->next_ul[j]) {
-      LOG_T(MAC,"node %d => %d\n",j,listP->next_ul[j]);
+    for (j = listP->head_ul; j >= 0; j = listP->next_ul[j]) {
+      LOG_T(MAC, "node %d => %d\n", j, listP->next_ul[j]);
     }
   }
 }
 
-int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP,int harq_pidP
-               #ifdef Rel14
-                 ,uint8_t rach_resource_type
-               #endif
-               )
+int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP, int harq_pidP
+#ifdef Rel14
+	       , uint8_t rach_resource_type
+#endif
+	       )
 {
   int UE_id;
   int i, j;
 
   UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
 
-  LOG_D(MAC,"[eNB %d, CC_id %d] Adding UE with rnti %x (next avail %d, num_UEs %d)\n",mod_idP,cc_idP,rntiP,UE_list->avail,UE_list->num_UEs);
-  dump_ue_list(UE_list,0);
+  LOG_D(MAC,
+	"[eNB %d, CC_id %d] Adding UE with rnti %x (next avail %d, num_UEs %d)\n",
+	mod_idP, cc_idP, rntiP, UE_list->avail, UE_list->num_UEs);
+  dump_ue_list(UE_list, 0);
 
   for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
-    if (UE_list->active[i] == TRUE) continue;
+    if (UE_list->active[i] == TRUE)
+      continue;
     UE_id = i;
-    UE_list->UE_template[cc_idP][UE_id].rnti       = rntiP;
+    memset(&UE_list->UE_template[cc_idP][UE_id], 0,
+	   sizeof(UE_TEMPLATE));
+    UE_list->UE_template[cc_idP][UE_id].rnti = rntiP;
     UE_list->UE_template[cc_idP][UE_id].configured = FALSE;
-    UE_list->numactiveCCs[UE_id]                   = 1;
-    UE_list->numactiveULCCs[UE_id]                 = 1;
-    UE_list->pCC_id[UE_id]                         = cc_idP;
-    UE_list->ordered_CCids[0][UE_id]               = cc_idP;
-    UE_list->ordered_ULCCids[0][UE_id]             = cc_idP;
+    UE_list->numactiveCCs[UE_id] = 1;
+    UE_list->numactiveULCCs[UE_id] = 1;
+    UE_list->pCC_id[UE_id] = cc_idP;
+    UE_list->ordered_CCids[0][UE_id] = cc_idP;
+    UE_list->ordered_ULCCids[0][UE_id] = cc_idP;
     UE_list->num_UEs++;
-    UE_list->active[UE_id]                         = TRUE;
+    UE_list->active[UE_id] = TRUE;
+#if defined(USRP_REC_PLAY) // not specific to record/playback ?
+    UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0;
+#endif    
 
 #ifdef Rel14
-    UE_list->UE_template[cc_idP][UE_id].rach_resource_type = rach_resource_type ;
+    UE_list->UE_template[cc_idP][UE_id].rach_resource_type =
+      rach_resource_type;
 #endif
 
-    memset((void*)&UE_list->UE_sched_ctrl[UE_id],0,sizeof(UE_sched_ctrl));
-    memset((void*)&UE_list->eNB_UE_stats[cc_idP][UE_id],0,sizeof(eNB_UE_STATS));
+    memset((void *) &UE_list->UE_sched_ctrl[UE_id], 0,
+	   sizeof(UE_sched_ctrl));
+    memset((void *) &UE_list->eNB_UE_stats[cc_idP][UE_id], 0,
+	   sizeof(eNB_UE_STATS));
+    UE_list->UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0;
+
 
     UE_list->UE_sched_ctrl[UE_id].ta_update = 31;
 
-    for (j=0; j<8; j++) {
-      UE_list->UE_template[cc_idP][UE_id].oldNDI[j]    = (j==0)?1:0;   // 1 because first transmission is with format1A (Msg4) for harq_pid 0
-      UE_list->UE_template[cc_idP][UE_id].oldNDI_UL[j] = (j==harq_pidP)?0:1; // 1st transmission is with Msg3;
-      UE_list->UE_sched_ctrl[UE_id].round[cc_idP][j]   = 8;
-      UE_list->UE_sched_ctrl[UE_id].round_UL[cc_idP][j]   = 0;
+    for (j = 0; j < 8; j++) {
+      UE_list->UE_template[cc_idP][UE_id].oldNDI[j] = (j == 0) ? 1 : 0;	// 1 because first transmission is with format1A (Msg4) for harq_pid 0
+      UE_list->UE_template[cc_idP][UE_id].oldNDI_UL[j] = (j == harq_pidP) ? 0 : 1;	// 1st transmission is with Msg3;
+      UE_list->UE_sched_ctrl[UE_id].round[cc_idP][j] = 8;
+      UE_list->UE_sched_ctrl[UE_id].round_UL[cc_idP][j] = 0;
     }
 
     eNB_ulsch_info[mod_idP][cc_idP][UE_id].status = S_UL_WAITING;
     eNB_dlsch_info[mod_idP][cc_idP][UE_id].status = S_DL_WAITING;
-    LOG_D(MAC,"[eNB %d] Add UE_id %d on Primary CC_id %d: rnti %x\n",mod_idP,UE_id,cc_idP,rntiP);
-    dump_ue_list(UE_list,0);
-    return(UE_id);
+    LOG_D(MAC, "[eNB %d] Add UE_id %d on Primary CC_id %d: rnti %x\n",
+	  mod_idP, UE_id, cc_idP, rntiP);
+    dump_ue_list(UE_list, 0);
+    return (UE_id);
   }
 
   printf("MAC: cannot add new UE for rnti %x\n", rntiP);
-  LOG_E(MAC,"error in add_new_ue(), could not find space in UE_list, Dumping UE list\n");
-  dump_ue_list(UE_list,0);
-  return(-1);
+  LOG_E(MAC,
+	"error in add_new_ue(), could not find space in UE_list, Dumping UE list\n");
+  dump_ue_list(UE_list, 0);
+  return (-1);
 }
 
 //------------------------------------------------------------------------------
-int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
+int rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP)
 //------------------------------------------------------------------------------
 {
+
   int i;
+  int j;
   UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
   int UE_id = find_UE_id(mod_idP,rntiP);
   int pCC_id;
-
+  
   if (UE_id == -1) {
     LOG_W(MAC,"rrc_mac_remove_ue: UE %x not found\n", rntiP);
     return 0;
   }
-
+  
   pCC_id = UE_PCCID(mod_idP,UE_id);
-
+  
   LOG_I(MAC,"Removing UE %d from Primary CC_id %d (rnti %x)\n",UE_id,pCC_id, rntiP);
   dump_ue_list(UE_list,0);
-
+  
   UE_list->active[UE_id] = FALSE;
   UE_list->num_UEs--;
-
+  
   if (UE_list->head == UE_id) UE_list->head=UE_list->next[UE_id];
   else UE_list->next[prev(UE_list,UE_id,0)]=UE_list->next[UE_id];
   if (UE_list->head_ul == UE_id) UE_list->head_ul=UE_list->next_ul[UE_id];
   else UE_list->next_ul[prev(UE_list,UE_id,0)]=UE_list->next_ul[UE_id];
-
+  
   // clear all remaining pending transmissions
-  UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID0]  = 0;
-  UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID1]  = 0;
-  UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID2]  = 0;
-  UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID3]  = 0;
-
-  UE_list->UE_template[pCC_id][UE_id].ul_SR             = 0;
-  UE_list->UE_template[pCC_id][UE_id].rnti              = NOT_A_RNTI;
-  UE_list->UE_template[pCC_id][UE_id].ul_active         = FALSE;
+  /*  UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID0]  = 0;
+      UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID1]  = 0;
+      UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID2]  = 0;
+      UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID3]  = 0;
+      
+      UE_list->UE_template[pCC_id][UE_id].ul_SR             = 0;
+      UE_list->UE_template[pCC_id][UE_id].rnti              = NOT_A_RNTI;
+      UE_list->UE_template[pCC_id][UE_id].ul_active         = FALSE;
+  */
+  memset (&UE_list->UE_template[pCC_id][UE_id],0,sizeof(UE_TEMPLATE));
+  
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_rbs_used = 0;
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_rbs_used_retx = 0;
+  for ( j = 0; j < NB_RB_MAX; j++ ) {
+    UE_list->eNB_UE_stats[pCC_id][UE_id].num_pdu_tx[j] = 0;
+    UE_list->eNB_UE_stats[pCC_id][UE_id].num_bytes_tx[j] = 0;
+  }
+  UE_list->eNB_UE_stats[pCC_id][UE_id].num_retransmission = 0;
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_sdu_bytes = 0;
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_pdu_bytes = 0;
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_num_pdus = 0;
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_rbs_used_rx = 0;
+  for ( j = 0; j < NB_RB_MAX; j++ ) {
+    UE_list->eNB_UE_stats[pCC_id][UE_id].num_pdu_rx[j] = 0;
+    UE_list->eNB_UE_stats[pCC_id][UE_id].num_bytes_rx[j] = 0;
+  }
+  UE_list->eNB_UE_stats[pCC_id][UE_id].num_errors_rx = 0;
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_pdu_bytes_rx = 0;
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_num_pdus_rx = 0;
+  UE_list->eNB_UE_stats[pCC_id][UE_id].total_num_errors_rx = 0;
+  
   eNB_ulsch_info[mod_idP][pCC_id][UE_id].rnti                        = NOT_A_RNTI;
   eNB_ulsch_info[mod_idP][pCC_id][UE_id].status                      = S_UL_NONE;
   eNB_dlsch_info[mod_idP][pCC_id][UE_id].rnti                        = NOT_A_RNTI;
   eNB_dlsch_info[mod_idP][pCC_id][UE_id].status                      = S_DL_NONE;
-
+  
+  eNB_ulsch_info[mod_idP][pCC_id][UE_id].serving_num = 0;
+  eNB_dlsch_info[mod_idP][pCC_id][UE_id].serving_num = 0;
+  
   // check if this has an RA process active
-  RA_TEMPLATE *RA_template;
-  for (i=0;i<NB_RA_PROC_MAX;i++) {
-    RA_template = (RA_TEMPLATE *)&RC.mac[mod_idP]->common_channels[pCC_id].RA_template[i];
-    if (RA_template->rnti == rntiP){
-      RA_template->RA_active=FALSE;
-      RA_template->generate_rar=0;
-      RA_template->generate_Msg4=0;
-      RA_template->wait_ack_Msg4=0;
-      RA_template->timing_offset=0;
-      RA_template->RRC_timer=20;
-      RA_template->rnti = 0;
+  RA_t *ra;
+  for (i = 0; i < NB_RA_PROC_MAX; i++) {
+    ra = (RA_t *) & RC.mac[mod_idP]->common_channels[pCC_id].ra[i];
+    if (ra->rnti == rntiP) {
+      ra->state = IDLE;
+      ra->timing_offset = 0;
+      ra->RRC_timer = 20;
+      ra->rnti = 0;
       //break;
     }
   }
-
+  
   return 0;
 }
 
-int prev(UE_list_t *listP, int nodeP, int ul_flag)
+int prev(UE_list_t * listP, int nodeP, int ul_flag)
 {
   int j;
 
-  if (ul_flag == 0 ) {
-    if (nodeP==listP->head) {
-      return(nodeP);
+  if (ul_flag == 0) {
+    if (nodeP == listP->head) {
+      return (nodeP);
     }
 
-    for (j=listP->head; j>=0; j=listP->next[j]) {
-      if (listP->next[j]==nodeP) {
-        return(j);
-    }
+    for (j = listP->head; j >= 0; j = listP->next[j]) {
+      if (listP->next[j] == nodeP) {
+	return (j);
+      }
     }
   } else {
-    if (nodeP==listP->head_ul) {
-      return(nodeP);
+    if (nodeP == listP->head_ul) {
+      return (nodeP);
     }
 
-    for (j=listP->head_ul; j>=0; j=listP->next_ul[j]) {
-      if (listP->next_ul[j]==nodeP) {
-        return(j);
+    for (j = listP->head_ul; j >= 0; j = listP->next_ul[j]) {
+      if (listP->next_ul[j] == nodeP) {
+	return (j);
       }
     }
   }
 
-  LOG_E(MAC,"error in prev(), could not find previous to %d in UE_list %s, should never happen, Dumping UE list\n",
-        nodeP, (ul_flag == 0)? "DL" : "UL");
+  LOG_E(MAC,
+	"error in prev(), could not find previous to %d in UE_list %s, should never happen, Dumping UE list\n",
+	nodeP, (ul_flag == 0) ? "DL" : "UL");
   dump_ue_list(listP, ul_flag);
 
-  return(-1);
+  return (-1);
 }
 
-void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag)
+void swap_UEs(UE_list_t * listP, int nodeiP, int nodejP, int ul_flag)
 {
-  int prev_i,prev_j,next_i,next_j;
+  int prev_i, prev_j, next_i, next_j;
 
-  LOG_T(MAC,"Swapping UE %d,%d\n",nodeiP,nodejP);
-  dump_ue_list(listP,ul_flag);
+  LOG_T(MAC, "Swapping UE %d,%d\n", nodeiP, nodejP);
+  dump_ue_list(listP, ul_flag);
 
-  prev_i = prev(listP,nodeiP,ul_flag);
-  prev_j = prev(listP,nodejP,ul_flag);
+  prev_i = prev(listP, nodeiP, ul_flag);
+  prev_j = prev(listP, nodejP, ul_flag);
 
-  AssertFatal((prev_i>=0) && (prev_j>=0),
-              "swap_UEs: problem");
+  AssertFatal((prev_i >= 0) && (prev_j >= 0), "swap_UEs: problem");
 
   if (ul_flag == 0) {
     next_i = listP->next[nodeiP];
@@ -1860,408 +2032,324 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag)
     next_j = listP->next_ul[nodejP];
   }
 
-  LOG_T(MAC,"[%s] next_i %d, next_i, next_j %d, head %d \n",
-        (ul_flag == 0)? "DL" : "UL",
-        next_i,next_j,listP->head);
+  LOG_T(MAC, "[%s] next_i %d, next_i, next_j %d, head %d \n",
+	(ul_flag == 0) ? "DL" : "UL", next_i, next_j, listP->head);
 
-  if (ul_flag == 0 ) {
+  if (ul_flag == 0) {
 
-    if (next_i == nodejP) {   // case ... p(i) i j n(j) ... => ... p(j) j i n(i) ...
-      LOG_T(MAC,"Case ... p(i) i j n(j) ... => ... p(j) j i n(i) ...\n");
+    if (next_i == nodejP) {	// case ... p(i) i j n(j) ... => ... p(j) j i n(i) ...
+      LOG_T(MAC,
+	    "Case ... p(i) i j n(j) ... => ... p(j) j i n(i) ...\n");
 
       listP->next[nodeiP] = next_j;
       listP->next[nodejP] = nodeiP;
 
-      if (nodeiP==listP->head) { // case i j n(j)
-        listP->head = nodejP;
+      if (nodeiP == listP->head) {	// case i j n(j)
+	listP->head = nodejP;
       } else {
-        listP->next[prev_i] = nodejP;
+	listP->next[prev_i] = nodejP;
       }
-    } else if (next_j == nodeiP) {  // case ... p(j) j i n(i) ... => ... p(i) i j n(j) ...
-      LOG_T(MAC,"Case ... p(j) j i n(i) ... => ... p(i) i j n(j) ...\n");
+    } else if (next_j == nodeiP) {	// case ... p(j) j i n(i) ... => ... p(i) i j n(j) ...
+      LOG_T(MAC,
+	    "Case ... p(j) j i n(i) ... => ... p(i) i j n(j) ...\n");
       listP->next[nodejP] = next_i;
       listP->next[nodeiP] = nodejP;
 
-      if (nodejP==listP->head) { // case j i n(i)
-        listP->head = nodeiP;
+      if (nodejP == listP->head) {	// case j i n(i)
+	listP->head = nodeiP;
       } else {
-        listP->next[prev_j] = nodeiP;
+	listP->next[prev_j] = nodeiP;
       }
-    } else {  // case ...  p(i) i n(i) ... p(j) j n(j) ...
+    } else {		// case ...  p(i) i n(i) ... p(j) j n(j) ...
       listP->next[nodejP] = next_i;
       listP->next[nodeiP] = next_j;
 
-      if (nodeiP==listP->head) {
-        LOG_T(MAC,"changing head to %d\n",nodejP);
-        listP->head=nodejP;
-        listP->next[prev_j] = nodeiP;
-      } else if (nodejP==listP->head) {
-        LOG_D(MAC,"changing head to %d\n",nodeiP);
-        listP->head=nodeiP;
-        listP->next[prev_i] = nodejP;
+      if (nodeiP == listP->head) {
+	LOG_T(MAC, "changing head to %d\n", nodejP);
+	listP->head = nodejP;
+	listP->next[prev_j] = nodeiP;
+      } else if (nodejP == listP->head) {
+	LOG_D(MAC, "changing head to %d\n", nodeiP);
+	listP->head = nodeiP;
+	listP->next[prev_i] = nodejP;
       } else {
-        listP->next[prev_i] = nodejP;
-        listP->next[prev_j] = nodeiP;
+	listP->next[prev_i] = nodejP;
+	listP->next[prev_j] = nodeiP;
       }
     }
-  } else { // ul_flag
+  } else {			// ul_flag
 
-    if (next_i == nodejP) {   // case ... p(i) i j n(j) ... => ... p(j) j i n(i) ...
-      LOG_T(MAC,"[UL] Case ... p(i) i j n(j) ... => ... p(j) j i n(i) ...\n");
+    if (next_i == nodejP) {	// case ... p(i) i j n(j) ... => ... p(j) j i n(i) ...
+      LOG_T(MAC,
+	    "[UL] Case ... p(i) i j n(j) ... => ... p(j) j i n(i) ...\n");
 
       listP->next_ul[nodeiP] = next_j;
       listP->next_ul[nodejP] = nodeiP;
 
-      if (nodeiP==listP->head_ul) { // case i j n(j)
-        listP->head_ul = nodejP;
+      if (nodeiP == listP->head_ul) {	// case i j n(j)
+	listP->head_ul = nodejP;
       } else {
-        listP->next_ul[prev_i] = nodejP;
+	listP->next_ul[prev_i] = nodejP;
       }
-    } else if (next_j == nodeiP) {  // case ... p(j) j i n(i) ... => ... p(i) i j n(j) ...
-      LOG_T(MAC,"[UL]Case ... p(j) j i n(i) ... => ... p(i) i j n(j) ...\n");
+    } else if (next_j == nodeiP) {	// case ... p(j) j i n(i) ... => ... p(i) i j n(j) ...
+      LOG_T(MAC,
+	    "[UL]Case ... p(j) j i n(i) ... => ... p(i) i j n(j) ...\n");
       listP->next_ul[nodejP] = next_i;
       listP->next_ul[nodeiP] = nodejP;
 
-      if (nodejP==listP->head_ul) { // case j i n(i)
-        listP->head_ul = nodeiP;
+      if (nodejP == listP->head_ul) {	// case j i n(i)
+	listP->head_ul = nodeiP;
       } else {
-        listP->next_ul[prev_j] = nodeiP;
+	listP->next_ul[prev_j] = nodeiP;
       }
-    } else {  // case ...  p(i) i n(i) ... p(j) j n(j) ...
+    } else {		// case ...  p(i) i n(i) ... p(j) j n(j) ...
 
       listP->next_ul[nodejP] = next_i;
       listP->next_ul[nodeiP] = next_j;
 
-      if (nodeiP==listP->head_ul) {
-        LOG_T(MAC,"[UL]changing head to %d\n",nodejP);
-        listP->head_ul=nodejP;
-        listP->next_ul[prev_j] = nodeiP;
-      } else if (nodejP==listP->head_ul) {
-        LOG_T(MAC,"[UL]changing head to %d\n",nodeiP);
-        listP->head_ul=nodeiP;
-        listP->next_ul[prev_i] = nodejP;
+      if (nodeiP == listP->head_ul) {
+	LOG_T(MAC, "[UL]changing head to %d\n", nodejP);
+	listP->head_ul = nodejP;
+	listP->next_ul[prev_j] = nodeiP;
+      } else if (nodejP == listP->head_ul) {
+	LOG_T(MAC, "[UL]changing head to %d\n", nodeiP);
+	listP->head_ul = nodeiP;
+	listP->next_ul[prev_i] = nodejP;
       } else {
-        listP->next_ul[prev_i] = nodejP;
-        listP->next_ul[prev_j] = nodeiP;
+	listP->next_ul[prev_i] = nodejP;
+	listP->next_ul[prev_j] = nodeiP;
       }
     }
   }
 
-  LOG_T(MAC,"After swap\n");
-  dump_ue_list(listP,ul_flag);
+  LOG_T(MAC, "After swap\n");
+  dump_ue_list(listP, ul_flag);
 }
 
-/*
-  #if defined(Rel10) || defined(Rel14)
-  unsigned char generate_mch_header( unsigned char *mac_header,
-  unsigned char num_sdus,
-  unsigned short *sdu_lengths,
-  unsigned char *sdu_lcids,
-  unsigned char msi,
-  unsigned char short_padding,
-  unsigned short post_padding) {
-
-  SCH_SUBHEADER_FIXED *mac_header_ptr = (SCH_SUBHEADER_FIXED *)mac_header;
-  uint8_t first_element=0,last_size=0,i;
-  uint8_t mac_header_control_elements[2*num_sdus],*ce_ptr;
-
-  ce_ptr = &mac_header_control_elements[0];
-
-  if ((short_padding == 1) || (short_padding == 2)) {
-  mac_header_ptr->R    = 0;
-  mac_header_ptr->E    = 0;
-  mac_header_ptr->LCID = SHORT_PADDING;
-  first_element=1;
-  last_size=1;
-  }
-  if (short_padding == 2) {
-  mac_header_ptr->E = 1;
-  mac_header_ptr++;
-  mac_header_ptr->R = 0;
-  mac_header_ptr->E    = 0;
-  mac_header_ptr->LCID = SHORT_PADDING;
-  last_size=1;
-  }
-
-  // SUBHEADER for MSI CE
-  if (msi != 0) {// there is MSI MAC Control Element
-  if (first_element>0) {
-  mac_header_ptr->E = 1;
-  mac_header_ptr+=last_size;
-  }
-  else {
-  first_element = 1;
-  }
-  if (num_sdus*2 < 128) {
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R    = 0;
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E    = 0;
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F    = 0;
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID = MCH_SCHDL_INFO;
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L    = num_sdus*2;
-  last_size=2;
-  }
-  else {
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->R    = 0;
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->E    = 0;
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->F    = 1;
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->LCID = MCH_SCHDL_INFO;
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L    = (num_sdus*2)&0x7fff;
-  last_size=3;
-  }
-  // Create the MSI MAC Control Element here
-  }
-
-  // SUBHEADER for MAC SDU (MCCH+MTCHs)
-  for (i=0;i<num_sdus;i++) {
-  if (first_element>0) {
-  mac_header_ptr->E = 1;
-  mac_header_ptr+=last_size;
-  }
-  else {
-  first_element = 1;
-  }
-  if (sdu_lengths[i] < 128) {
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R    = 0;
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E    = 0;
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F    = 0;
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID = sdu_lcids[i];
-  ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L    = (unsigned char)sdu_lengths[i];
-  last_size=2;
-  }
-  else {
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->R    = 0;
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->E    = 0;
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->F    = 1;
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->LCID = sdu_lcids[i];
-  ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L    = (unsigned short) sdu_lengths[i]&0x7fff;
-  last_size=3;
-  }
-  }
-
-  if (post_padding>0) {// we have lots of padding at the end of the packet
-  mac_header_ptr->E = 1;
-  mac_header_ptr+=last_size;
-  // add a padding element
-  mac_header_ptr->R    = 0;
-  mac_header_ptr->E    = 0;
-  mac_header_ptr->LCID = SHORT_PADDING;
-  mac_header_ptr++;
-  }
-  else { // no end of packet padding
-  // last SDU subhead is of fixed type (sdu length implicitly to be computed at UE)
-  mac_header_ptr++;
-  }
-
-  // Copy MSI Control Element to the end of the MAC Header if it presents
-  if ((ce_ptr-mac_header_control_elements) > 0) {
-  // printf("Copying %d bytes for control elements\n",ce_ptr-mac_header_control_elements);
-  memcpy((void*)mac_header_ptr,mac_header_control_elements,ce_ptr-mac_header_control_elements);
-  mac_header_ptr+=(unsigned char)(ce_ptr-mac_header_control_elements);
-  }
-
-  return((unsigned char*)mac_header_ptr - mac_header);
-  }
-  #endif
- */
-
 // This has to be updated to include BSR information
-uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id)
+uint8_t
+UE_is_to_be_scheduled(module_id_t module_idP, int CC_id, uint8_t UE_id)
 {
-  UE_TEMPLATE *UE_template    = &RC.mac[module_idP]->UE_list.UE_template[CC_id][UE_id];
-  UE_sched_ctrl *UE_sched_ctl = &RC.mac[module_idP]->UE_list.UE_sched_ctrl[UE_id];
+  UE_TEMPLATE *UE_template =
+    &RC.mac[module_idP]->UE_list.UE_template[CC_id][UE_id];
+  UE_sched_ctrl *UE_sched_ctl =
+    &RC.mac[module_idP]->UE_list.UE_sched_ctrl[UE_id];
 
   // do not schedule UE if UL is not working
-  if (UE_sched_ctl->ul_failure_timer>0)
-    return(0);
-  if (UE_sched_ctl->ul_out_of_sync>0)
-    return(0);
-
-  LOG_D(MAC,"[eNB %d][PUSCH] Checking UL requirements UE %d/%x\n",module_idP,UE_id,UE_RNTI(module_idP,UE_id));
-
-  if ((UE_template->bsr_info[LCGID0]>0) ||
-      (UE_template->bsr_info[LCGID1]>0) ||
-      (UE_template->bsr_info[LCGID2]>0) ||
-      (UE_template->bsr_info[LCGID3]>0) ||
-      (UE_template->ul_SR>0) || // uplink scheduling request
-      ((UE_sched_ctl->ul_inactivity_timer>20)&&
-       (UE_sched_ctl->ul_scheduled==0))||  // every 2 frames when RRC_CONNECTED
-      ((UE_sched_ctl->ul_inactivity_timer>10)&&
-       (UE_sched_ctl->ul_scheduled==0)&&
-       (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED))) // every Frame when not RRC_CONNECTED
-  {
-    LOG_D(MAC,"[eNB %d][PUSCH] UE %d/%x should be scheduled (BSR0 %d,SR %d)\n",module_idP,UE_id,UE_RNTI(module_idP,UE_id),
-          UE_template->bsr_info[LCGID0],
-          UE_template->ul_SR);
-    return(1);
-  } else {
-    return(0);
+  if (UE_sched_ctl->ul_failure_timer > 0)
+    return (0);
+  if (UE_sched_ctl->ul_out_of_sync > 0)
+    return (0);
+
+  LOG_D(MAC, "[eNB %d][PUSCH] Checking UL requirements UE %d/%x\n",
+	module_idP, UE_id, UE_RNTI(module_idP, UE_id));
+
+  if ((UE_template->scheduled_ul_bytes < UE_template->estimated_ul_buffer) ||
+      (UE_template->ul_SR > 0) ||	// uplink scheduling request
+      ((UE_sched_ctl->ul_inactivity_timer > 20) && (UE_sched_ctl->ul_scheduled == 0)) ||	// every 2 frames when RRC_CONNECTED
+      ((UE_sched_ctl->ul_inactivity_timer > 10) && (UE_sched_ctl->ul_scheduled == 0) && (mac_eNB_get_rrc_status(module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED)))	// every Frame when not RRC_CONNECTED
+    {
+      LOG_D(MAC,
+	    "[eNB %d][PUSCH] UE %d/%x should be scheduled (BSR0 estimated size %d, SR %d)\n",
+	    module_idP, UE_id, UE_RNTI(module_idP, UE_id),
+	    UE_template->ul_buffer_info[LCGID0], UE_template->ul_SR);
+      return (1);
+    } else {
+    return (0);
   }
 }
 
-uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP)
+uint8_t get_tmode(module_id_t module_idP, int CC_idP, int UE_idP)
 {
-  eNB_MAC_INST         *eNB                                = RC.mac[module_idP];
-  COMMON_channels_t    *cc                                 = &eNB->common_channels[CC_idP];
-
-  struct PhysicalConfigDedicated  *physicalConfigDedicated = eNB->UE_list.physicalConfigDedicated[CC_idP][UE_idP];
-
-  if (physicalConfigDedicated == NULL ) { // RRCConnectionSetup not received by UE yet
-    AssertFatal(cc->p_eNB<=2,"p_eNB is %d, should be <2\n",cc->p_eNB);
-    return(cc->p_eNB);
-  }
-  else {
-    AssertFatal(physicalConfigDedicated->antennaInfo!=NULL,
-                "antennaInfo is null for CCId %d, UEid %d\n",CC_idP,UE_idP);
-
-    AssertFatal(physicalConfigDedicated->antennaInfo->present != PhysicalConfigDedicated__antennaInfo_PR_NOTHING,
-                "antennaInfo (mod_id %d, CC_id %d) is set to NOTHING\n",module_idP,CC_idP);
-
-    if (physicalConfigDedicated->antennaInfo->present == PhysicalConfigDedicated__antennaInfo_PR_explicitValue) {
-      return(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
-    }
-    else if (physicalConfigDedicated->antennaInfo->present == PhysicalConfigDedicated__antennaInfo_PR_defaultValue) {
-      AssertFatal(cc->p_eNB<=2,"p_eNB is %d, should be <2\n",cc->p_eNB);
-      return(cc->p_eNB);
-    }
-    else AssertFatal(1==0,"Shouldn't be here\n");
-  }
-}
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+  COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
 
-int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subframeP)
-{
-  uint8_t           ret       = -1;
-  eNB_MAC_INST      *eNB      = RC.mac[module_idP];
-  COMMON_channels_t *cc       = &eNB->common_channels[CC_idP];
+  struct PhysicalConfigDedicated *physicalConfigDedicated =
+    eNB->UE_list.physicalConfigDedicated[CC_idP][UE_idP];
 
-  if (cc->tdd_Config==NULL) { // FDD
-    ret = (((frameP<<1)+subframeP)&7);
+  if (physicalConfigDedicated == NULL) {	// RRCConnectionSetup not received by UE yet
+    AssertFatal(cc->p_eNB <= 2, "p_eNB is %d, should be <2\n",
+		cc->p_eNB);
+    return (cc->p_eNB);
+  } else {
+    AssertFatal(physicalConfigDedicated->antennaInfo != NULL,
+		"antennaInfo is null for CCId %d, UEid %d\n", CC_idP,
+		UE_idP);
+
+    AssertFatal(physicalConfigDedicated->antennaInfo->present !=
+		PhysicalConfigDedicated__antennaInfo_PR_NOTHING,
+		"antennaInfo (mod_id %d, CC_id %d) is set to NOTHING\n",
+		module_idP, CC_idP);
+
+    if (physicalConfigDedicated->antennaInfo->present ==
+	PhysicalConfigDedicated__antennaInfo_PR_explicitValue) {
+      return (physicalConfigDedicated->antennaInfo->
+	      choice.explicitValue.transmissionMode);
+    } else if (physicalConfigDedicated->antennaInfo->present ==
+	       PhysicalConfigDedicated__antennaInfo_PR_defaultValue) {
+      AssertFatal(cc->p_eNB <= 2, "p_eNB is %d, should be <2\n",
+		  cc->p_eNB);
+      return (cc->p_eNB);
+    } else
+      AssertFatal(1 == 0, "Shouldn't be here\n");
+  }
+}
+
+int8_t
+get_ULharq(module_id_t module_idP, int CC_idP, uint16_t frameP,
+	   uint8_t subframeP)
+{
+  uint8_t ret = -1;
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+  COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
+
+  if (cc->tdd_Config == NULL) {	// FDD
+    ret = (((frameP << 1) + subframeP) & 7);
   } else {
     switch (cc->tdd_Config->subframeAssignment) {
     case 1:
-      if ((subframeP==2) ||
-          (subframeP==3) ||
-          (subframeP==7) ||
-          (subframeP==8))
-        switch (subframeP) {
-        case 2:
-        case 3:
-          ret = (subframeP-2);
-          break;
-
-        case 7:
-        case 8:
-          ret = (subframeP-5);
-          break;
-
-        default:
-          AssertFatal(1==0,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment);
-          break;
-        }
+      if ((subframeP == 2) ||
+	  (subframeP == 3) || (subframeP == 7) || (subframeP == 8))
+	switch (subframeP) {
+	case 2:
+	case 3:
+	  ret = (subframeP - 2);
+	  break;
+
+	case 7:
+	case 8:
+	  ret = (subframeP - 5);
+	  break;
+
+	default:
+	  AssertFatal(1 == 0,
+		      "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		      subframeP,
+		      (int) cc->tdd_Config->subframeAssignment);
+	  break;
+	}
 
       break;
 
     case 2:
-      AssertFatal((subframeP==2) || (subframeP==7),
-                  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment);
-      ret = (subframeP/7);
+      AssertFatal((subframeP == 2) || (subframeP == 7),
+		  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		  subframeP,
+		  (int) cc->tdd_Config->subframeAssignment);
+      ret = (subframeP / 7);
       break;
 
     case 3:
-      AssertFatal((subframeP>1) && (subframeP<5),
-                  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment);
-      ret = (subframeP-2);
+      AssertFatal((subframeP > 1) && (subframeP < 5),
+		  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		  subframeP,
+		  (int) cc->tdd_Config->subframeAssignment);
+      ret = (subframeP - 2);
       break;
 
     case 4:
-      AssertFatal((subframeP>1) && (subframeP<4),
-                  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment);
-      ret = (subframeP-2);
+      AssertFatal((subframeP > 1) && (subframeP < 4),
+		  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		  subframeP,
+		  (int) cc->tdd_Config->subframeAssignment);
+      ret = (subframeP - 2);
       break;
 
     case 5:
-      AssertFatal(subframeP==2,
-                  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment);
-      ret = (subframeP-2);
+      AssertFatal(subframeP == 2,
+		  "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",
+		  subframeP,
+		  (int) cc->tdd_Config->subframeAssignment);
+      ret = (subframeP - 2);
       break;
 
     default:
-      AssertFatal(1==0,"subframe2_harq_pid, Unsupported TDD mode %d\n",(int)cc->tdd_Config->subframeAssignment);
+      AssertFatal(1 == 0,
+		  "subframe2_harq_pid, Unsupported TDD mode %d\n",
+		  (int) cc->tdd_Config->subframeAssignment);
       break;
     }
   }
 
-  AssertFatal(ret!=-1,
-              "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frameP, subframeP);
+  AssertFatal(ret != -1,
+	      "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t) ret,
+	      frameP, subframeP);
   return ret;
 }
 
 
-uint16_t getRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs)
+uint16_t getRIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs)
 {
   uint16_t RIV;
 
-  if (Lcrbs<=(1+(N_RB_DL>>1)))
-    RIV = (N_RB_DL*(Lcrbs-1)) + RBstart;
+  if (Lcrbs <= (1 + (N_RB_DL >> 1)))
+    RIV = (N_RB_DL * (Lcrbs - 1)) + RBstart;
   else
-    RIV = (N_RB_DL*(N_RB_DL+1-Lcrbs)) + (N_RB_DL-1-RBstart);
+    RIV = (N_RB_DL * (N_RB_DL + 1 - Lcrbs)) + (N_RB_DL - 1 - RBstart);
 
-  return(RIV);
+  return (RIV);
 }
 
-uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, int N_RB_DL, uint32_t *rballoc)
+uint32_t
+allocate_prbs(int UE_id, unsigned char nb_rb, int N_RB_DL,
+	      uint32_t * rballoc)
 {
   int i;
-  uint32_t rballoc_dci=0;
-  unsigned char nb_rb_alloc=0;
+  uint32_t rballoc_dci = 0;
+  unsigned char nb_rb_alloc = 0;
 
-  for (i=0; i<(N_RB_DL-2); i+=2) {
-    if (((*rballoc>>i)&3)==0) {
-      *rballoc |= (3<<i);
-      rballoc_dci |= (1<<((12-i)>>1));
-      nb_rb_alloc+=2;
+  for (i = 0; i < (N_RB_DL - 2); i += 2) {
+    if (((*rballoc >> i) & 3) == 0) {
+      *rballoc |= (3 << i);
+      rballoc_dci |= (1 << ((12 - i) >> 1));
+      nb_rb_alloc += 2;
     }
 
-    if (nb_rb_alloc==nb_rb) {
-      return(rballoc_dci);
+    if (nb_rb_alloc == nb_rb) {
+      return (rballoc_dci);
     }
   }
 
-  if ((N_RB_DL&1)==1) {
-    if ((*rballoc>>(N_RB_DL-1)&1)==0) {
-      *rballoc |= (1<<(N_RB_DL-1));
+  if ((N_RB_DL & 1) == 1) {
+    if ((*rballoc >> (N_RB_DL - 1) & 1) == 0) {
+      *rballoc |= (1 << (N_RB_DL - 1));
       rballoc_dci |= 1;
     }
   }
 
-  return(rballoc_dci);
+  return (rballoc_dci);
 }
 
 int get_bw_index(module_id_t module_id, uint8_t CC_id)
 {
-  int bw_index=0;
+  int bw_index = 0;
 
-  int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
+  int N_RB_DL =
+    to_prb(RC.mac[module_id]->common_channels[CC_id].mib->
+	   message.dl_Bandwidth);
 
   switch (N_RB_DL) {
-  case 6: // 1.4 MHz
-    bw_index=0;
+  case 6:			// 1.4 MHz
+    bw_index = 0;
     break;
 
-  case 25: // 5HMz
-    bw_index=1;
+  case 25:			// 5HMz
+    bw_index = 1;
     break;
 
-  case 50: // 10HMz
-    bw_index=2;
+  case 50:			// 10HMz
+    bw_index = 2;
     break;
 
-  case 100: // 20HMz
-    bw_index=3;
+  case 100:			// 20HMz
+    bw_index = 3;
     break;
 
   default:
-    bw_index=1;
-    LOG_W(MAC,"[eNB %d] N_RB_DL %d unknown for CC_id %d, setting bw_index to 1\n", module_id, N_RB_DL,CC_id);
+    bw_index = 1;
+    LOG_W(MAC,
+	  "[eNB %d] N_RB_DL %d unknown for CC_id %d, setting bw_index to 1\n",
+	  module_id, N_RB_DL, CC_id);
     break;
   }
 
@@ -2270,151 +2358,155 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id)
 
 int get_min_rb_unit(module_id_t module_id, uint8_t CC_id)
 {
-  int min_rb_unit=0;
-  int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
+  int min_rb_unit = 0;
+  int N_RB_DL =
+    to_prb(RC.mac[module_id]->common_channels[CC_id].mib->
+	   message.dl_Bandwidth);
 
   switch (N_RB_DL) {
-  case 6: // 1.4 MHz
-    min_rb_unit=1;
+  case 6:			// 1.4 MHz
+    min_rb_unit = 1;
     break;
 
-  case 25: // 5HMz
-    min_rb_unit=2;
+  case 25:			// 5HMz
+    min_rb_unit = 2;
     break;
 
-  case 50: // 10HMz
-    min_rb_unit=3;
+  case 50:			// 10HMz
+    min_rb_unit = 3;
     break;
 
-  case 100: // 20HMz
-    min_rb_unit=4;
+  case 100:			// 20HMz
+    min_rb_unit = 4;
     break;
 
   default:
-    min_rb_unit=2;
-    LOG_W(MAC,"[eNB %d] N_DL_RB %d unknown for CC_id %d, setting min_rb_unit to 2\n",
-          module_id, N_RB_DL, CC_id);
+    min_rb_unit = 2;
+    LOG_W(MAC,
+	  "[eNB %d] N_DL_RB %d unknown for CC_id %d, setting min_rb_unit to 2\n",
+	  module_id, N_RB_DL, CC_id);
     break;
   }
 
   return min_rb_unit;
 }
 
-uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t *rballoc)
+uint32_t
+allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t * rballoc)
 {
-  int check=0;//check1=0,check2=0;
-  uint32_t rballoc_dci=0;
+  int check = 0;		//check1=0,check2=0;
+  uint32_t rballoc_dci = 0;
   //uint8_t number_of_subbands=13;
 
-  LOG_T(MAC,"*****Check1RBALLOC****: %d%d%d%d (nb_rb %d,N_RBG %d)\n",
-        rballoc[3],rballoc[2],rballoc[1],rballoc[0],nb_rb,N_RBG);
+  LOG_T(MAC, "*****Check1RBALLOC****: %d%d%d%d (nb_rb %d,N_RBG %d)\n",
+	rballoc[3], rballoc[2], rballoc[1], rballoc[0], nb_rb, N_RBG);
 
-  while((nb_rb >0) && (check < N_RBG)) {
+  while ((nb_rb > 0) && (check < N_RBG)) {
     //printf("rballoc[%d] %d\n",check,rballoc[check]);
-    if(rballoc[check] == 1) {
-      rballoc_dci |= (1<<((N_RBG-1)-check));
+    if (rballoc[check] == 1) {
+      rballoc_dci |= (1 << ((N_RBG - 1) - check));
 
       switch (N_RB_DL) {
       case 6:
-        nb_rb--;
-        break;
+	nb_rb--;
+	break;
 
       case 25:
-        if ((check == N_RBG-1)) {
-          nb_rb--;
-        } else {
-          nb_rb-=2;
-        }
+	if ((check == N_RBG - 1)) {
+	  nb_rb--;
+	} else {
+	  nb_rb -= 2;
+	}
 
-        break;
+	break;
 
       case 50:
-        if ((check == N_RBG-1)) {
-          nb_rb-=2;
-        } else {
-          nb_rb-=3;
-        }
+	if ((check == N_RBG - 1)) {
+	  nb_rb -= 2;
+	} else {
+	  nb_rb -= 3;
+	}
 
-        break;
+	break;
 
       case 100:
-        nb_rb-=4;
-        break;
+	nb_rb -= 4;
+	break;
       }
     }
-
     //      printf("rb_alloc %x\n",rballoc_dci);
-    check = check+1;
+    check = check + 1;
     //    check1 = check1+2;
   }
 
   // rballoc_dci = (rballoc_dci)&(0x1fff);
-  LOG_T(MAC,"*********RBALLOC : %x\n",rballoc_dci);
+  LOG_T(MAC, "*********RBALLOC : %x\n", rballoc_dci);
   // exit(-1);
   return (rballoc_dci);
 }
 
 int get_subbandsize(uint8_t dl_Bandwidth)
 {
-  uint8_t ss[6] = {6,4,4,6,8,8};
+  uint8_t ss[6] = { 6, 4, 4, 6, 8, 8 };
 
-  AssertFatal(dl_Bandwidth<6,"dl_Bandwidth %d is out of bounds\n",dl_Bandwidth);
+  AssertFatal(dl_Bandwidth < 6, "dl_Bandwidth %d is out of bounds\n",
+	      dl_Bandwidth);
 
-  return(ss[dl_Bandwidth]);
+  return (ss[dl_Bandwidth]);
 }
 
 int get_nb_subband(int N_RB_DL)
 {
-  int nb_sb=0;
+  int nb_sb = 0;
 
   switch (N_RB_DL) {
   case 6:
-    nb_sb=0;
+    nb_sb = 0;
     break;
 
   case 15:
-    nb_sb = 4;  // sb_size =4
+    nb_sb = 4;		// sb_size =4
 
   case 25:
-    nb_sb = 7; // sb_size =4, 1 sb with 1PRB, 6 with 2 RBG, each has 2 PRBs
+    nb_sb = 7;		// sb_size =4, 1 sb with 1PRB, 6 with 2 RBG, each has 2 PRBs
     break;
 
-  case 50:    // sb_size =6
+  case 50:			// sb_size =6
     nb_sb = 9;
     break;
 
-  case 75:  // sb_size =8
+  case 75:			// sb_size =8
     nb_sb = 10;
     break;
 
-  case 100: // sb_size =8 , 1 sb with 1 RBG + 12 sb with 2RBG, each RBG has 4 PRBs
+  case 100:			// sb_size =8 , 1 sb with 1 RBG + 12 sb with 2RBG, each RBG has 4 PRBs
     nb_sb = 13;
     break;
 
   default:
-    nb_sb=0;
+    nb_sb = 0;
     break;
   }
 
   return nb_sb;
 }
 
-void init_CCE_table(int module_idP,int CC_idP)
+void init_CCE_table(int module_idP, int CC_idP)
 {
-  memset(RC.mac[module_idP]->CCE_table[CC_idP],0,800*sizeof(int));
+  memset(RC.mac[module_idP]->CCE_table[CC_idP], 0, 800 * sizeof(int));
 }
 
 
-int get_nCCE_offset(int *CCE_table,
-                    const unsigned char L,
-                    const int nCCE,
-                    const int common_dci,
-                    const unsigned short rnti,
-                    const unsigned char subframe)
+int
+get_nCCE_offset(int *CCE_table,
+		const unsigned char L,
+		const int nCCE,
+		const int common_dci,
+		const unsigned short rnti, const unsigned char subframe)
 {
-  int search_space_free,m,nb_candidates = 0,l,i;
+  int search_space_free, m, nb_candidates = 0, l, i;
   unsigned int Yk;
-   /*
+  /*
     printf("CCE Allocation: ");
     for (i=0;i<nCCE;i++)
     printf("%d.",CCE_table[i]);
@@ -2422,44 +2514,44 @@ int get_nCCE_offset(int *CCE_table,
   */
   if (common_dci == 1) {
     // check CCE(0 ... L-1)
-    nb_candidates = (L==4) ? 4 : 2;
-    nb_candidates = min(nb_candidates,nCCE/L);
+    nb_candidates = (L == 4) ? 4 : 2;
+    nb_candidates = min(nb_candidates, nCCE / L);
 
     //    printf("Common DCI nb_candidates %d, L %d\n",nb_candidates,L);
 
-    for (m = nb_candidates-1 ; m >=0 ; m--) {
+    for (m = nb_candidates - 1; m >= 0; m--) {
 
       search_space_free = 1;
-      for (l=0; l<L; l++) {
+      for (l = 0; l < L; l++) {
 
-        //        printf("CCE_table[%d] %d\n",(m*L)+l,CCE_table[(m*L)+l]);
-        if (CCE_table[(m*L) + l] == 1) {
-          search_space_free = 0;
-          break;
-        }
+	//        printf("CCE_table[%d] %d\n",(m*L)+l,CCE_table[(m*L)+l]);
+	if (CCE_table[(m * L) + l] == 1) {
+	  search_space_free = 0;
+	  break;
+	}
       }
 
       if (search_space_free == 1) {
 
-        //        printf("returning %d\n",m*L);
+	//        printf("returning %d\n",m*L);
 
-        for (l=0; l<L; l++)
-          CCE_table[(m*L)+l]=1;
-        return(m*L);
+	for (l = 0; l < L; l++)
+	  CCE_table[(m * L) + l] = 1;
+	return (m * L);
       }
     }
 
-    return(-1);
+    return (-1);
 
-  } else { // Find first available in ue specific search space
+  } else {			// Find first available in ue specific search space
     // according to procedure in Section 9.1.1 of 36.213 (v. 8.6)
     // compute Yk
-    Yk = (unsigned int)rnti;
+    Yk = (unsigned int) rnti;
 
-    for (i=0; i<=subframe; i++)
-      Yk = (Yk*39827)%65537;
+    for (i = 0; i <= subframe; i++)
+      Yk = (Yk * 39827) % 65537;
 
-    Yk = Yk % (nCCE/L);
+    Yk = Yk % (nCCE / L);
 
     switch (L) {
     case 1:
@@ -2477,49 +2569,52 @@ int get_nCCE_offset(int *CCE_table,
       break;
     }
 
-    LOG_D(MAC,"rnti %x, Yk = %d, nCCE %d (nCCE/L %d),nb_cand %d\n",rnti,Yk,nCCE,nCCE/L,nb_candidates);
+    LOG_D(MAC, "rnti %x, Yk = %d, nCCE %d (nCCE/L %d),nb_cand %d\n",
+	  rnti, Yk, nCCE, nCCE / L, nb_candidates);
 
-    for (m = 0 ; m < nb_candidates ; m++) {
+    for (m = 0; m < nb_candidates; m++) {
       search_space_free = 1;
 
-      for (l=0; l<L; l++) {
-        int cce = (((Yk+m)%(nCCE/L))*L) + l;
-        if (cce >= nCCE || CCE_table[cce] == 1) {
-          search_space_free = 0;
-          break;
-        }
+      for (l = 0; l < L; l++) {
+	int cce = (((Yk + m) % (nCCE / L)) * L) + l;
+	if (cce >= nCCE || CCE_table[cce] == 1) {
+	  search_space_free = 0;
+	  break;
+	}
       }
 
       if (search_space_free == 1) {
-        for (l=0; l<L; l++)
-          CCE_table[(((Yk+m)%(nCCE/L))*L)+l]=1;
+	for (l = 0; l < L; l++)
+	  CCE_table[(((Yk + m) % (nCCE / L)) * L) + l] = 1;
 
-        return(((Yk+m)%(nCCE/L))*L);
+	return (((Yk + m) % (nCCE / L)) * L);
       }
     }
 
-    return(-1);
+    return (-1);
   }
 }
 
-void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,const int subframe,int L)
+void
+dump_CCE_table(int *CCE_table, const int nCCE,
+	       const unsigned short rnti, const int subframe, int L)
 {
-  int nb_candidates = 0,i;
+  int nb_candidates = 0, i;
   unsigned int Yk;
 
   printf("CCE 0: ");
-  for (i=0;i<nCCE;i++) {
-    printf("%1d.",CCE_table[i]);
-    if ((i&7) == 7)
-      printf("\n CCE %d: ",i);
+  for (i = 0; i < nCCE; i++) {
+    printf("%1d.", CCE_table[i]);
+    if ((i & 7) == 7)
+      printf("\n CCE %d: ", i);
   }
 
-  Yk = (unsigned int)rnti;
+  Yk = (unsigned int) rnti;
 
-  for (i=0; i<=subframe; i++)
-    Yk = (Yk*39827)%65537;
+  for (i = 0; i <= subframe; i++)
+    Yk = (Yk * 39827) % 65537;
 
-  Yk = Yk % (nCCE/L);
+  Yk = Yk % (nCCE / L);
 
   switch (L) {
   case 1:
@@ -2537,478 +2632,549 @@ void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,cons
     break;
   }
 
-  printf("rnti %x, Yk*L = %d, nCCE %d (nCCE/L %d),nb_cand*L %d\n",rnti,Yk*L,nCCE,nCCE/L,nb_candidates*L);
+  printf("rnti %x, Yk*L = %d, nCCE %d (nCCE/L %d),nb_cand*L %d\n", rnti,
+	 Yk * L, nCCE, nCCE / L, nb_candidates * L);
 }
 
-uint16_t getnquad(COMMON_channels_t *cc, uint8_t num_pdcch_symbols,uint8_t mi)
+uint16_t
+getnquad(COMMON_channels_t * cc, uint8_t num_pdcch_symbols, uint8_t mi)
 {
-  uint16_t Nreg=0;
+  uint16_t Nreg = 0;
 
-  AssertFatal(cc!=NULL,"cc is null\n");
-  AssertFatal(cc->mib!=NULL,"cc->mib is null\n");
+  AssertFatal(cc != NULL, "cc is null\n");
+  AssertFatal(cc->mib != NULL, "cc->mib is null\n");
 
-  int N_RB_DL        = to_prb(cc->mib->message.dl_Bandwidth);
+  int N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
   int phich_resource = get_phich_resource_times6(cc);
 
-  uint8_t Ngroup_PHICH = (phich_resource*N_RB_DL)/48;
+  uint8_t Ngroup_PHICH = (phich_resource * N_RB_DL) / 48;
 
-  if (((phich_resource*N_RB_DL)%48) > 0)
+  if (((phich_resource * N_RB_DL) % 48) > 0)
     Ngroup_PHICH++;
 
   if (cc->Ncp == 1) {
-    Ngroup_PHICH<<=1;
+    Ngroup_PHICH <<= 1;
   }
 
-  Ngroup_PHICH*=mi;
+  Ngroup_PHICH *= mi;
 
-  if ((num_pdcch_symbols>0) && (num_pdcch_symbols<4))
+  if ((num_pdcch_symbols > 0) && (num_pdcch_symbols < 4))
     switch (N_RB_DL) {
     case 6:
-      Nreg=12+(num_pdcch_symbols-1)*18;
+      Nreg = 12 + (num_pdcch_symbols - 1) * 18;
       break;
 
     case 25:
-      Nreg=50+(num_pdcch_symbols-1)*75;
+      Nreg = 50 + (num_pdcch_symbols - 1) * 75;
       break;
 
     case 50:
-      Nreg=100+(num_pdcch_symbols-1)*150;
+      Nreg = 100 + (num_pdcch_symbols - 1) * 150;
       break;
 
     case 100:
-      Nreg=200+(num_pdcch_symbols-1)*300;
+      Nreg = 200 + (num_pdcch_symbols - 1) * 300;
       break;
 
     default:
-      return(0);
+      return (0);
     }
-
   //   printf("Nreg %d (%d)\n",Nreg,Nreg - 4 - (3*Ngroup_PHICH));
-  return(Nreg - 4 - (3*Ngroup_PHICH));
+  return (Nreg - 4 - (3 * Ngroup_PHICH));
 }
 
-uint16_t getnCCE(COMMON_channels_t *cc, uint8_t num_pdcch_symbols, uint8_t mi)
+uint16_t
+getnCCE(COMMON_channels_t * cc, uint8_t num_pdcch_symbols, uint8_t mi)
 {
-  AssertFatal(cc!=NULL,"cc is null\n");
-  return(getnquad(cc,num_pdcch_symbols,mi)/9);
+  AssertFatal(cc != NULL, "cc is null\n");
+  return (getnquad(cc, num_pdcch_symbols, mi) / 9);
 }
 
-uint8_t getmi(COMMON_channels_t *cc,int subframe)
+uint8_t getmi(COMMON_channels_t * cc, int subframe)
 {
-  AssertFatal(cc!=NULL,"cc is null\n");
+  AssertFatal(cc != NULL, "cc is null\n");
 
   // for FDD
-  if (cc->tdd_Config==NULL) // FDD
+  if (cc->tdd_Config == NULL)	// FDD
     return 1;
 
   // for TDD
   switch (cc->tdd_Config->subframeAssignment) {
   case 0:
-    if ((subframe==0) || (subframe==5))
-      return(2);
-    else return(1);
+    if ((subframe == 0) || (subframe == 5))
+      return (2);
+    else
+      return (1);
 
     break;
 
   case 1:
-    if ((subframe==0) || (subframe==5))
-      return(0);
-    else return(1);
+    if ((subframe == 0) || (subframe == 5))
+      return (0);
+    else
+      return (1);
 
     break;
 
   case 2:
-    if ((subframe==3) || (subframe==8))
-      return(1);
-    else return(0);
+    if ((subframe == 3) || (subframe == 8))
+      return (1);
+    else
+      return (0);
 
     break;
 
   case 3:
-    if ((subframe==0) || (subframe==8) || (subframe==9))
-      return(1);
-    else return(0);
+    if ((subframe == 0) || (subframe == 8) || (subframe == 9))
+      return (1);
+    else
+      return (0);
 
     break;
 
   case 4:
-    if ((subframe==8) || (subframe==9))
-      return(1);
-    else return(0);
+    if ((subframe == 8) || (subframe == 9))
+      return (1);
+    else
+      return (0);
 
     break;
 
   case 5:
-    if (subframe==8)
-      return(1);
-    else return(0);
+    if (subframe == 8)
+      return (1);
+    else
+      return (0);
 
     break;
 
   case 6:
-    return(1);
+    return (1);
     break;
 
   default:
-    return(0);
+    return (0);
   }
 }
 
-uint16_t get_nCCE_max(COMMON_channels_t *cc, int num_pdcch_symbols,int subframe)
+uint16_t
+get_nCCE_max(COMMON_channels_t * cc, int num_pdcch_symbols, int subframe)
 {
-  AssertFatal(cc!=NULL,"cc is null\n");
-  return(getnCCE(cc,num_pdcch_symbols,
-                 getmi(cc,subframe)));
+  AssertFatal(cc != NULL, "cc is null\n");
+  return (getnCCE(cc, num_pdcch_symbols, getmi(cc, subframe)));
 }
 
 // Allocate the CCEs
-int allocate_CCEs(int module_idP,
-                  int CC_idP,
-                  int subframeP,
-                  int test_onlyP)
-{
-  int                                 *CCE_table           = RC.mac[module_idP]->CCE_table[CC_idP];
-  nfapi_dl_config_request_body_t      *DL_req              = &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
-  nfapi_hi_dci0_request_body_t        *HI_DCI0_req         = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
-  nfapi_dl_config_request_pdu_t       *dl_config_pdu       = &DL_req->dl_config_pdu_list[0];
-  nfapi_hi_dci0_request_pdu_t         *hi_dci0_pdu         = &HI_DCI0_req->hi_dci0_pdu_list[0];
-  int                                 nCCE_max             = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],1,subframeP);
+int
+allocate_CCEs(int module_idP, int CC_idP, int subframeP, int test_onlyP)
+{
+  int *CCE_table = RC.mac[module_idP]->CCE_table[CC_idP];
+  nfapi_dl_config_request_body_t *DL_req =
+    &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
+  nfapi_hi_dci0_request_body_t *HI_DCI0_req =
+    &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
+  nfapi_dl_config_request_pdu_t *dl_config_pdu =
+    &DL_req->dl_config_pdu_list[0];
+  nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
+    &HI_DCI0_req->hi_dci0_pdu_list[0];
+  int nCCE_max =
+    get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP], 1,
+		 subframeP);
   int fCCE;
-  int i,j,idci;
-  int nCCE=0;
+  int i, j, idci;
+  int nCCE = 0;
 
-  LOG_D(MAC,"Allocate CCEs subframe %d, test %d : (DL PDU %d, DL DCI %d, UL %d)\n",subframeP,test_onlyP,DL_req->number_pdu,DL_req->number_dci,HI_DCI0_req->number_of_dci);
-  DL_req->number_pdcch_ofdm_symbols=1;
+  LOG_D(MAC,
+	"Allocate CCEs subframe %d, test %d : (DL PDU %d, DL DCI %d, UL %d)\n",
+	subframeP, test_onlyP, DL_req->number_pdu, DL_req->number_dci,
+	HI_DCI0_req->number_of_dci);
+  DL_req->number_pdcch_ofdm_symbols = 1;
 
-try_again:
-  init_CCE_table(module_idP,CC_idP);
-  nCCE=0;
+ try_again:
+  init_CCE_table(module_idP, CC_idP);
+  nCCE = 0;
 
-  for (i=0,idci=0;i<DL_req->number_pdu;i++) {
+  for (i = 0, idci = 0; i < DL_req->number_pdu; i++) {
     // allocate DL common DCIs first
-    if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&&
-        (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type==2)
-        ) {
-      LOG_D(MAC,"Trying to allocate COMMON DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
-            idci,DL_req->number_dci+HI_DCI0_req->number_of_dci,
-            DL_req->number_dci,HI_DCI0_req->number_of_dci,
-            dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
-            dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-            nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols);
-
-      if (nCCE + (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level) > nCCE_max) {
-        if (DL_req->number_pdcch_ofdm_symbols == 3)
-          goto failed;
-        LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols);
-        DL_req->number_pdcch_ofdm_symbols++;
-        nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP);
-        goto try_again;
+    if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
+	&& (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type ==
+	    2)) {
+      LOG_D(MAC,
+	    "Trying to allocate COMMON DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
+	    idci, DL_req->number_dci + HI_DCI0_req->number_of_dci,
+	    DL_req->number_dci, HI_DCI0_req->number_of_dci,
+	    dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
+	    dl_config_pdu[i].dci_dl_pdu.
+	    dci_dl_pdu_rel8.aggregation_level, nCCE, nCCE_max,
+	    DL_req->number_pdcch_ofdm_symbols);
+
+      if (nCCE +
+	  (dl_config_pdu[i].dci_dl_pdu.
+	   dci_dl_pdu_rel8.aggregation_level) > nCCE_max) {
+	if (DL_req->number_pdcch_ofdm_symbols == 3)
+	  goto failed;
+	LOG_D(MAC,
+	      "Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
+	      DL_req->number_pdcch_ofdm_symbols);
+	DL_req->number_pdcch_ofdm_symbols++;
+	nCCE_max =
+	  get_nCCE_max(&RC.mac[module_idP]->
+		       common_channels[CC_idP],
+		       DL_req->number_pdcch_ofdm_symbols,
+		       subframeP);
+	goto try_again;
       }
-
       // number of CCEs left can potentially hold this allocation
       fCCE = get_nCCE_offset(CCE_table,
-                             dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-                             nCCE_max,
-                             1,
-                             dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
-                             subframeP);
+			     dl_config_pdu[i].
+			     dci_dl_pdu.dci_dl_pdu_rel8.
+			     aggregation_level, nCCE_max, 1,
+			     dl_config_pdu[i].
+			     dci_dl_pdu.dci_dl_pdu_rel8.rnti,
+			     subframeP);
       if (fCCE == -1) {
-        if (DL_req->number_pdcch_ofdm_symbols == 3) {
-          LOG_D(MAC,"subframe %d: Dropping Allocation for RNTI %x\n",
-                subframeP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti);
-          for (j=0;j<=i;j++){
-            if (dl_config_pdu[j].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
-              LOG_D(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
-                    j,DL_req->number_dci+HI_DCI0_req->number_of_dci,
-                    DL_req->number_dci,HI_DCI0_req->number_of_dci,
-                    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
-                    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.dci_format,
-                    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-                    nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols);
-          }
-          //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L);
-          goto failed;
-        }
-        LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols);
-
-        DL_req->number_pdcch_ofdm_symbols++;
-        nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP);
-        goto try_again;
-      } // fCCE==-1
+	if (DL_req->number_pdcch_ofdm_symbols == 3) {
+	  LOG_D(MAC,
+		"subframe %d: Dropping Allocation for RNTI %x\n",
+		subframeP,
+		dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.
+		rnti);
+	  for (j = 0; j <= i; j++) {
+	    if (dl_config_pdu[j].pdu_type ==
+		NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
+	      LOG_D(MAC,
+		    "DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
+		    j,
+		    DL_req->number_dci +
+		    HI_DCI0_req->number_of_dci,
+		    DL_req->number_dci,
+		    HI_DCI0_req->number_of_dci,
+		    dl_config_pdu[j].
+		    dci_dl_pdu.dci_dl_pdu_rel8.rnti,
+		    dl_config_pdu[j].
+		    dci_dl_pdu.dci_dl_pdu_rel8.dci_format,
+		    dl_config_pdu[j].
+		    dci_dl_pdu.dci_dl_pdu_rel8.
+		    aggregation_level, nCCE, nCCE_max,
+		    DL_req->number_pdcch_ofdm_symbols);
+	  }
+	  //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L);
+	  goto failed;
+	}
+	LOG_D(MAC,
+	      "Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",
+	      DL_req->number_pdcch_ofdm_symbols);
+
+	DL_req->number_pdcch_ofdm_symbols++;
+	nCCE_max =  get_nCCE_max(&RC.mac[module_idP]->
+				 common_channels[CC_idP],
+				 DL_req->number_pdcch_ofdm_symbols,
+				 subframeP);
+	goto try_again;
+      }			// fCCE==-1
 
       // the allocation is feasible, rnti rule passes
       nCCE += dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level;
-      LOG_D(MAC,"Allocating at nCCE %d\n",fCCE);
+      LOG_D(MAC, "Allocating at nCCE %d\n", fCCE);
       if (test_onlyP == 0) {
-        dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx=fCCE;
-        LOG_D(MAC,"Allocate COMMON DCI CCEs subframe %d, test %d => L %d fCCE %d\n",subframeP,test_onlyP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,fCCE);
+	dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = fCCE;
+	LOG_D(MAC,
+	      "Allocate COMMON DCI CCEs subframe %d, test %d => L %d fCCE %d\n",
+	      subframeP, test_onlyP,
+	      dl_config_pdu[i].dci_dl_pdu.
+	      dci_dl_pdu_rel8.aggregation_level, fCCE);
       }
       idci++;
     }
-  } // for i = 0 ... num_DL_DCIs
+  }				// for i = 0 ... num_DL_DCIs
 
   // no try to allocate UL DCIs
-  for (i=0;i<HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi;i++) {
+  for (i = 0; i < HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi;
+       i++) {
 
     // allocate UL DCIs
     if (hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) {
 
-      LOG_D(MAC,"Trying to allocate format 0 DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
-            idci,DL_req->number_dci+HI_DCI0_req->number_of_dci,
-            DL_req->number_dci,HI_DCI0_req->number_of_dci,
-            hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti,hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level,
-            nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols);
+      LOG_D(MAC,
+	    "Trying to allocate format 0 DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
+	    idci, DL_req->number_dci + HI_DCI0_req->number_of_dci,
+	    DL_req->number_dci, HI_DCI0_req->number_of_dci,
+	    hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti,
+	    hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level,
+	    nCCE, nCCE_max, DL_req->number_pdcch_ofdm_symbols);
 
       if (nCCE + (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level) > nCCE_max) {
-        if (DL_req->number_pdcch_ofdm_symbols == 3)
-          goto failed;
-        LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols);
-
-        DL_req->number_pdcch_ofdm_symbols++;
-        nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP);
-        goto try_again;
+	if (DL_req->number_pdcch_ofdm_symbols == 3)
+	  goto failed;
+	LOG_D(MAC,
+	      "Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
+	      DL_req->number_pdcch_ofdm_symbols);
+
+	DL_req->number_pdcch_ofdm_symbols++;
+	nCCE_max =
+	  get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],
+		       DL_req->number_pdcch_ofdm_symbols,
+		       subframeP);
+	goto try_again;
       }
-
       // number of CCEs left can potentially hold this allocation
       fCCE = get_nCCE_offset(CCE_table,
-                             hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level,
-                             nCCE_max,
-                             0,
-                             hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti,
-                             subframeP);
+			     hi_dci0_pdu[i].dci_pdu.
+			     dci_pdu_rel8.aggregation_level,
+			     nCCE_max, 0,
+			     hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.
+			     rnti, subframeP);
       if (fCCE == -1) {
-        if (DL_req->number_pdcch_ofdm_symbols == 3) {
-          LOG_D(MAC,"subframe %d: Dropping Allocation for RNTI %x\n",
-                subframeP,hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti);
-          for (j=0;j<=i;j++){
-            if (hi_dci0_pdu[j].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE)
-              LOG_D(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
-                    j,DL_req->number_dci+HI_DCI0_req->number_of_dci,
-                    DL_req->number_dci,HI_DCI0_req->number_of_dci,
-                    hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.rnti,
-                    hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.dci_format,
-                    hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.aggregation_level,
-                    nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols);
-          }
-          //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L);
-          goto failed;
-        }
-        LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols);
-
-        DL_req->number_pdcch_ofdm_symbols++;
-        nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP);
-        goto try_again;
-      } // fCCE==-1
+	if (DL_req->number_pdcch_ofdm_symbols == 3) {
+	  LOG_D(MAC,
+		"subframe %d: Dropping Allocation for RNTI %x\n",
+		subframeP,
+		hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti);
+	  for (j = 0; j <= i; j++) {
+	    if (hi_dci0_pdu[j].pdu_type ==
+		NFAPI_HI_DCI0_DCI_PDU_TYPE)
+	      LOG_D(MAC,
+		    "DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
+		    j,
+		    DL_req->number_dci + HI_DCI0_req->number_of_dci,
+		    DL_req->number_dci,
+		    HI_DCI0_req->number_of_dci,
+		    hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.rnti,
+		    hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.
+		    dci_format,
+		    hi_dci0_pdu[j].dci_pdu.
+		    dci_pdu_rel8.aggregation_level, nCCE,
+		    nCCE_max,
+		    DL_req->number_pdcch_ofdm_symbols);
+	  }
+	  //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L);
+	  goto failed;
+	}
+	LOG_D(MAC,
+	      "Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",
+	      DL_req->number_pdcch_ofdm_symbols);
+
+	DL_req->number_pdcch_ofdm_symbols++;
+	nCCE_max =
+	  get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],
+		       DL_req->number_pdcch_ofdm_symbols,
+		       subframeP);
+	goto try_again;
+      }			// fCCE==-1
 
       // the allocation is feasible, rnti rule passes
       nCCE += hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level;
-      LOG_D(MAC,"Allocating at nCCE %d\n",fCCE);
+      LOG_D(MAC, "Allocating at nCCE %d\n", fCCE);
       if (test_onlyP == 0) {
-        hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.cce_index=fCCE;
-        LOG_D(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP);
+	hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.cce_index = fCCE;
+	LOG_D(MAC, "Allocate CCEs subframe %d, test %d\n",
+	      subframeP, test_onlyP);
       }
       idci++;
     }
-  } // for i = 0 ... num_UL_DCIs
+  }				// for i = 0 ... num_UL_DCIs
 
-  for (i=0;i<DL_req->number_pdu;i++) {
+  for (i = 0; i < DL_req->number_pdu; i++) {
     // allocate DL UE specific DCIs
-    if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&&
-        (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type==1)) {
-      LOG_D(MAC,"Trying to allocate DL UE-SPECIFIC DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
-            idci,DL_req->number_dci+HI_DCI0_req->number_of_dci,
-            DL_req->number_dci,HI_DCI0_req->number_of_dci,
-            dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-            nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols);
+    if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
+	&& (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type ==
+	    1)) {
+      LOG_D(MAC,
+	    "Trying to allocate DL UE-SPECIFIC DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
+	    idci, DL_req->number_dci + HI_DCI0_req->number_of_dci,
+	    DL_req->number_dci, HI_DCI0_req->number_of_dci,
+	    dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
+	    dl_config_pdu[i].dci_dl_pdu.
+	    dci_dl_pdu_rel8.aggregation_level, nCCE, nCCE_max,
+	    DL_req->number_pdcch_ofdm_symbols);
 
       if (nCCE + (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level) > nCCE_max) {
-        if (DL_req->number_pdcch_ofdm_symbols == 3)
-          goto failed;
-        LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols);
-
-        DL_req->number_pdcch_ofdm_symbols++;
-        nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP);
-        goto try_again;
+	if (DL_req->number_pdcch_ofdm_symbols == 3)
+	  goto failed;
+	LOG_D(MAC,
+	      "Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
+	      DL_req->number_pdcch_ofdm_symbols);
+
+	DL_req->number_pdcch_ofdm_symbols++;
+	nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],
+		       DL_req->number_pdcch_ofdm_symbols,
+		       subframeP);
+	goto try_again;
       }
-
       // number of CCEs left can potentially hold this allocation
       fCCE = get_nCCE_offset(CCE_table,
-                             dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-                             nCCE_max,
-                             0,
-                             dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
-                             subframeP);
+			     dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, nCCE_max, 0,
+			     dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
+			     subframeP);
       if (fCCE == -1) {
-        if (DL_req->number_pdcch_ofdm_symbols == 3) {
-          LOG_I(MAC,"subframe %d: Dropping Allocation for RNTI %x\n",
-                subframeP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti);
-          for (j=0;j<=i;j++){
-            if (dl_config_pdu[j].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
-              LOG_I(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
-                    j,DL_req->number_dci+HI_DCI0_req->number_of_dci,
-                    DL_req->number_dci,HI_DCI0_req->number_of_dci,
-                    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
-                    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.dci_format,
-                    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-                    nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols);
-          }
-          //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L);
-          goto failed;
-        }
-        LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols);
-
-        DL_req->number_pdcch_ofdm_symbols++;
-        nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP);
-        goto try_again;
-      } // fCCE==-1
+	if (DL_req->number_pdcch_ofdm_symbols == 3) {
+	  LOG_I(MAC,
+		"subframe %d: Dropping Allocation for RNTI %x\n",
+		subframeP,
+		dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.
+		rnti);
+	  for (j = 0; j <= i; j++) {
+	    if (dl_config_pdu[j].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
+	      LOG_I(MAC,
+		    "DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
+		    j,
+		    DL_req->number_dci + HI_DCI0_req->number_of_dci,
+		    DL_req->number_dci,
+		    HI_DCI0_req->number_of_dci,
+		    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.rnti,
+		    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.dci_format,
+		    dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.
+		    aggregation_level, 
+		    nCCE, 
+		    nCCE_max,
+		    DL_req->number_pdcch_ofdm_symbols);
+	  }
+	  //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L);
+	  goto failed;
+	}
+	LOG_D(MAC,
+	      "Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",
+	      DL_req->number_pdcch_ofdm_symbols);
+
+	DL_req->number_pdcch_ofdm_symbols++;
+	nCCE_max =
+	  get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],
+		       DL_req->number_pdcch_ofdm_symbols,
+		       subframeP);
+	goto try_again;
+      }			// fCCE==-1
 
       // the allocation is feasible, rnti rule passes
       nCCE += dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level;
-      LOG_D(MAC,"Allocating at nCCE %d\n",fCCE);
+      LOG_D(MAC, "Allocating at nCCE %d\n", fCCE);
       if (test_onlyP == 0) {
-        dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx=fCCE;
-        LOG_D(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP);
+	dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = fCCE;
+	LOG_D(MAC, "Allocate CCEs subframe %d, test %d\n",
+	      subframeP, test_onlyP);
       }
       idci++;
     }
-  } // for i = 0 ... num_DL_DCIs
+  }				// for i = 0 ... num_DL_DCIs
 
   return 0;
 
-failed:
+ failed:
   return -1;
 }
 
-/*
-uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subframeP)
-{
-  if (RC.mac[module_idP]->common_channels[CC_idP].tdd_Config == NULL)
-    return(0);
-
-  switch (RC.mac[module_idP]->common_channels[CC_idP].tdd_Config->subframeAssignment) {
-  case 0:
-  case 1:
-  case 2:
-  case 6:
-    return(0);
-  case 3:
-    // 1,5,6 -> 2, prog. 8, buffer 0
-    // 7,8   -> 3, prog. 9, buffer 1
-    // 9,0   -> 4, prog. 0, buffer 0
-    if ((subframeP == 7) || (subframeP == 8)) return(1);
-    else                                      return(0);
-  case 4:
-    // 0,1,4,5 -> 2, prog. 8, buffer 0
-    // 6,7,8,9 -> 3, prog. 9, buffer 1
-    if (subframeP<6) return(0);
-    else             return(1);
-    return(1);
-    break;
-  case 5:
-    // 9(-1),0,1,3,4,5,6,7,8,9 -> 2, prog 8, buffer 0
-    return(0);
-    break;
-  default:
-    AssertFatal(1==0,"Should not get here, why is tdd_Config->subframeAssignment = %d\n",(int)RC.mac[module_idP]->common_channels[CC_idP].tdd_Config->subframeAssignment);
-    break;
-  }
-  return(0);
-}
-*/
-
-nfapi_ul_config_request_pdu_t* has_ul_grant(module_id_t module_idP,int CC_idP,uint16_t absSFP,uint16_t rnti)
+nfapi_ul_config_request_pdu_t *has_ul_grant(module_id_t module_idP,
+					    int CC_idP, uint16_t absSFP,
+					    uint16_t rnti)
 {
   nfapi_ul_config_request_body_t *ul_req;
   nfapi_ul_config_request_pdu_t *ul_config_pdu;
 
-  ul_req        = &RC.mac[module_idP]->UL_req_tmp[CC_idP][absSFP%10].ul_config_request_body;
+  ul_req = &RC.mac[module_idP]->UL_req_tmp[CC_idP][absSFP % 10].ul_config_request_body;
   ul_config_pdu = &ul_req->ul_config_pdu_list[0];
-  LOG_D(MAC,"Checking for rnti %x UL grant in subframeP %d (num pdu %d)\n",rnti,absSFP%10,ul_req->number_of_pdus);
-
-  for (int i=0; i<ul_req->number_of_pdus;i++){
-    LOG_D(MAC,"PDU %d : type %d,rnti %x\n",i,ul_config_pdu[i].pdu_type,rnti);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE)&&
-        (ul_config_pdu[i].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE)&&
-        (ul_config_pdu[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE)&&
-        (ul_config_pdu[i].ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE)&&
-        (ul_config_pdu[i].ulsch_cqi_harq_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE)&&
-        (ul_config_pdu[i].uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE)&&
-        (ul_config_pdu[i].uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE)&&
-        (ul_config_pdu[i].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE)&&
-        (ul_config_pdu[i].uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE)&&
-        (ul_config_pdu[i].uci_cqi_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE)&&
-        (ul_config_pdu[i].uci_cqi_sr_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE) &&
-        (ul_config_pdu[i].uci_cqi_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE)&&
-        (ul_config_pdu[i].ulsch_uci_csi_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE)&&
-        (ul_config_pdu[i].ulsch_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE)&&
-        (ul_config_pdu[i].ulsch_csi_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
-  }
-
-  return(NULL); // no ul grant at all for this UE
-}
-
-boolean_t CCE_allocation_infeasible(int module_idP,
-                                    int CC_idP,
-                                    int format_flag,
-                                    int subframe,
-                                    int aggregation,
-                                    int rnti)
-{
-  nfapi_dl_config_request_body_t *DL_req        = &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
-  nfapi_dl_config_request_pdu_t  *dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu];
-  nfapi_hi_dci0_request_body_t   *HI_DCI0_req   = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
-  nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu   = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi];
+  LOG_D(MAC,
+	"Checking for rnti %x UL grant in subframeP %d (num pdu %d)\n",
+	rnti, absSFP % 10, ul_req->number_of_pdus);
+
+  for (int i = 0; i < ul_req->number_of_pdus; i++) {
+    LOG_D(MAC, "PDU %d : type %d,rnti %x\n", i,ul_config_pdu[i].pdu_type, rnti);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE)
+	&& (ul_config_pdu[i].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE)
+	&& (ul_config_pdu[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE)
+	&& (ul_config_pdu[i].ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE)
+	&& (ul_config_pdu[i].ulsch_cqi_harq_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE)
+	&& (ul_config_pdu[i].uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE)
+	&& (ul_config_pdu[i].uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE)
+	&& (ul_config_pdu[i].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE)
+	&& (ul_config_pdu[i].uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE)
+	&& (ul_config_pdu[i].uci_cqi_harq_pdu.ue_information.ue_information_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE)
+	&& (ul_config_pdu[i].uci_cqi_sr_pdu.ue_information.ue_information_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE)
+	&& (ul_config_pdu[i].uci_cqi_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE)
+	&& (ul_config_pdu[i].ulsch_uci_csi_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE)
+	&& (ul_config_pdu[i].ulsch_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+    if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE)
+	&& (ul_config_pdu[i].ulsch_csi_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti))
+      return (&ul_config_pdu[i]);
+  }
+
+  return (NULL);		// no ul grant at all for this UE
+}
+
+boolean_t
+CCE_allocation_infeasible(int module_idP,
+			  int CC_idP,
+			  int format_flag,
+			  int subframe, int aggregation, int rnti)
+{
+  nfapi_dl_config_request_body_t *DL_req       = &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
+  nfapi_dl_config_request_pdu_t *dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu];
+  nfapi_hi_dci0_request_body_t *HI_DCI0_req    = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
+  nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu     = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi];
   int ret;
   boolean_t res = FALSE;
 
-  if (format_flag != 2) { // DL DCI
+  if (format_flag != 2) {	// DL DCI
     if (DL_req->number_pdu == MAX_NUM_DL_PDU) {
-      LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n",
-            subframe, rnti);
+      LOG_W(MAC,
+	    "Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n",
+	    subframe, rnti);
     } else {
+      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag            = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
       dl_config_pdu->pdu_type                                     = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
       dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti              = rnti;
-      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type         = (format_flag == 0)?2:1;
+      dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type         = (format_flag == 0) ? 2 : 1;
       dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = aggregation;
       DL_req->number_pdu++;
-      LOG_D(MAC,"Subframe %d: Checking CCE feasibility format %d : (%x,%d) (%x,%d,%d)\n",
-        subframe,format_flag,rnti,aggregation,
-          dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
-          dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,
-          dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type);
-      ret = allocate_CCEs(module_idP,CC_idP,subframe,0);
-      if (ret==-1)
-        res = TRUE;
+      LOG_D(MAC,
+	    "Subframe %d: Checking CCE feasibility format %d : (%x,%d) (%x,%d,%d)\n",
+	    subframe, format_flag, rnti, aggregation,
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti,
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.
+	    aggregation_level,
+	    dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type);
+      ret = allocate_CCEs(module_idP, CC_idP, subframe, 0);
+      if (ret == -1) res = TRUE;
       DL_req->number_pdu--;
     }
-  }
-  else { // ue-specific UL DCI
-    if (HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi == MAX_NUM_HI_DCI0_PDU) {
-      LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %d\n",
-            subframe, rnti);
+  } else {			// ue-specific UL DCI
+    if (HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi == MAX_NUM_HI_DCI0_PDU) {
+      LOG_W(MAC,
+	    "Subframe %d: FAPI UL structure is full, skip scheduling UE %d\n",
+	    subframe, rnti);
     } else {
       hi_dci0_pdu->pdu_type                               = NFAPI_HI_DCI0_DCI_PDU_TYPE;
+      hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tl.tag            = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG;
       hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti              = rnti;
       hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation;
       HI_DCI0_req->number_of_dci++;
-      ret = allocate_CCEs(module_idP,CC_idP,subframe,0);
-      if (ret==-1)
-        res = TRUE;
+      ret = allocate_CCEs(module_idP, CC_idP, subframe, 0);
+      if (ret == -1) res = TRUE;
       HI_DCI0_req->number_of_dci--;
     }
   }
@@ -3016,12 +3182,15 @@ boolean_t CCE_allocation_infeasible(int module_idP,
   return res;
 }
 
-void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_frame_t subframeP,void *harq_indication,int format)
+void
+extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
+	     frame_t frameP, sub_frame_t subframeP,
+	     void *harq_indication, int format)
 {
-  UE_list_t *UE_list       = &RC.mac[mod_idP]->UE_list;
+  UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
   UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-  rnti_t rnti              = UE_RNTI(mod_idP,UE_id);
-  COMMON_channels_t *cc    = &RC.mac[mod_idP]->common_channels[CC_idP];
+  rnti_t rnti = UE_RNTI(mod_idP, UE_id);
+  COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP];
   nfapi_harq_indication_fdd_rel13_t *harq_indication_fdd;
   nfapi_harq_indication_tdd_rel13_t *harq_indication_tdd;
   uint16_t num_ack_nak;
@@ -3029,532 +3198,696 @@ void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_fr
   int pCCid = UE_list->pCC_id[UE_id];
   int spatial_bundling = 0;
   int tmode[5];
-  int i,j;
+  int i, j;
   uint8_t *pdu;
 
 #ifdef Rel14
-  AssertFatal(UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->pucch_ConfigDedicated!=NULL,"pucch_ConfigDedicated is null!\n");
-  if ((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7) &&
-      (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13) &&
-      (((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUCCH_r13) &&
-        (format==0)) ||
-       ((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUSCH_r13) &&
-        (format==1))))
+  if (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated != NULL &&
+      UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL &&
+      (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7)
+      && (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13)
+      && (((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUCCH_r13) && (format == 0))
+	  || ((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUSCH_r13)
+	      && (format == 1))))
     spatial_bundling = 1;
 #endif
 
-  for (i=0;i<numCC;i++) tmode[i] = get_tmode(mod_idP,i,UE_id);
+  for (i = 0; i < numCC; i++)
+    tmode[i] = get_tmode(mod_idP, i, UE_id);
 
   if (cc->tdd_Config) {
-    harq_indication_tdd = (nfapi_harq_indication_tdd_rel13_t *)harq_indication;
+    harq_indication_tdd = (nfapi_harq_indication_tdd_rel13_t *) harq_indication;
     //    pdu = &harq_indication_tdd->harq_tb_n[0];
 
     num_ack_nak = harq_indication_tdd->number_of_ack_nack;
 
     switch (harq_indication_tdd->mode) {
-      case 0: // Format 1a/b
-        AssertFatal(numCC==1,"numCC %d > 1, should not be using Format1a/b\n",numCC);
-        break;
-      case 1: // Channel Selection
-        break;
-      case 2: // Format 3
-        break;
-      case 3: // Format 4
-        break;
-      case 4: // Format 5
-        break;
+    case 0:		// Format 1a/b
+      AssertFatal(numCC == 1,
+		  "numCC %d > 1, should not be using Format1a/b\n",
+		  numCC);
+      break;
+    case 1:		// Channel Selection
+      break;
+    case 2:		// Format 3
+      break;
+    case 3:		// Format 4
+      break;
+    case 4:		// Format 5
+      break;
     }
-  }
-  else {
-    harq_indication_fdd = (nfapi_harq_indication_fdd_rel13_t *)harq_indication;
-    num_ack_nak = harq_indication_fdd->number_of_ack_nack;
-    pdu = &harq_indication_fdd->harq_tb_n[0];
+  } else {
+    harq_indication_fdd = (nfapi_harq_indication_fdd_rel13_t *) harq_indication;
+    num_ack_nak         = harq_indication_fdd->number_of_ack_nack;
+    pdu                 = &harq_indication_fdd->harq_tb_n[0];
 
-    uint8_t harq_pid = ((10*frameP) + subframeP + 10236)&7;
+    uint8_t harq_pid = ((10 * frameP) + subframeP + 10236) & 7;
+
+    LOG_D(MAC,"frame %d subframe %d harq_pid %d mode %d tmode[0] %d num_ack_nak %d round %d\n",frameP,subframeP,harq_pid,harq_indication_fdd->mode,tmode[0],num_ack_nak,sched_ctl->round[CC_idP][harq_pid]);
 
     switch (harq_indication_fdd->mode) {
-      case 0: // Format 1a/b (10.1.2.1)
-        AssertFatal(numCC==1,"numCC %d > 1, should not be using Format1a/b\n",numCC);
-        if (tmode[0]==1 || tmode[0]==2 || tmode[0]==5 || tmode[0]==6 || tmode[0]==7) { // NOTE: have to handle the case of TM9-10 with 1 antenna port
-          // single ACK/NAK bit
-          AssertFatal(num_ack_nak==1,"num_ack_nak %d > 1 for 1 CC and single-layer transmission\n",num_ack_nak);
-          AssertFatal(sched_ctl->round[CC_idP][harq_pid]<8,"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",harq_pid,UE_id,rnti);
-          AssertFatal(pdu[0] == 1 || pdu[0] == 2 || pdu[0] == 4,
-                      "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n",pdu[0],harq_pid,UE_id,rnti);
-          LOG_D(MAC,"Received %d for harq_pid %d\n",pdu[0],harq_pid);
-
-          if (pdu[0] == 1) { // ACK
-            sched_ctl->round[CC_idP][harq_pid]=8; // release HARQ process
-            sched_ctl->tbcnt[CC_idP][harq_pid]=0;
-          }
-          else if (pdu[0] == 2 || pdu[0] == 4) // NAK (treat DTX as NAK)
-            sched_ctl->round[CC_idP][harq_pid]++; // increment round
-        }
-        else {
-          // one or two ACK/NAK bits
-          AssertFatal(num_ack_nak>2,"num_ack_nak %d > 2 for 1 CC and TM3/4/8/9/10\n",num_ack_nak);
-          if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==1) && (pdu[0] == 1) && (pdu[1] == 1)) {
-            sched_ctl->round[CC_idP][harq_pid]=8;
-            sched_ctl->tbcnt[CC_idP][harq_pid]=0;
-          }
-          if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==1) && (pdu[0] == 2) && (pdu[1] == 2))
-            sched_ctl->round[CC_idP][harq_pid]++;
-          else if (((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[0][harq_pid]==2) && (pdu[0] == 1) && (pdu[1] == 2)) ||
-                   ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==2) && (pdu[0] == 2) && (pdu[1] == 1))) {
-            sched_ctl->round[CC_idP][harq_pid]++;
-            sched_ctl->tbcnt[CC_idP][harq_pid]=1;
-          }
-          else if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==2) && (pdu[0] == 2) && (pdu[1] == 2))
-            sched_ctl->round[CC_idP][harq_pid]++;
-          else AssertFatal(1==0,"Illegal ACK/NAK/round combination (%d,%d,%d,%d,%d) for harq_pid %d, UE %d/%x\n",
-                           num_ack_nak,sched_ctl->round[CC_idP][harq_pid],sched_ctl->round[CC_idP][harq_pid],pdu[0],pdu[1], harq_pid,UE_id,
-                           rnti);
-        }
-        break;
-      case 1: // FDD Channel Selection (10.1.2.2.1), must be received for 2 serving cells
-        AssertFatal(numCC==2,"Should not receive harq indication with channel selection with %d active CCs\n",
-                    numCC);
-
-        if ((num_ack_nak == 2) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->tbcnt[pCCid][harq_pid]==1) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==1)) {
-          AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]);
-          AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]);
-          if (pdu[0] == 1) sched_ctl->round[pCCid][harq_pid]=8;
-          else             sched_ctl->round[pCCid][harq_pid]++;
-          if (pdu[1] == 1) sched_ctl->round[1-pCCid][harq_pid]=8;
-          else             sched_ctl->round[1-pCCid][harq_pid]++;
-        } // A=2
-        else if ((num_ack_nak == 3) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->tbcnt[pCCid][harq_pid]==2) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==1)) {
-          AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]);
-          AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]);
-          AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]);
-          AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 2,"sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",pCCid,harq_pid,UE_id,rnti);
-          AssertFatal(sched_ctl->tbcnt[1-pCCid][harq_pid] == 1,"sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",1-pCCid,harq_pid,UE_id,rnti);
-          if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK
-              sched_ctl->round[pCCid][harq_pid]=8;
-              sched_ctl->tbcnt[pCCid][harq_pid]=0;
-          }
-          else if (((pdu[0] == 2) && (pdu[1] == 1))||
-                   ((pdu[0] == 1) && (pdu[1] == 2))){
-            sched_ctl->round[pCCid][harq_pid]++;
-            sched_ctl->tbcnt[pCCid][harq_pid]=1;
-          }
-          else
-             sched_ctl->round[pCCid][harq_pid]++;
-
-          if (pdu[2] == 1) sched_ctl->round[1-pCCid][harq_pid]=8;
-          else             sched_ctl->round[1-pCCid][harq_pid]++;
-        } // A=3 primary cell has 2 TBs
-        else if ((num_ack_nak == 3) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==2) && (sched_ctl->tbcnt[pCCid][harq_pid]==1)) {
-          AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]);
-          AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]);
-          AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]);
-          AssertFatal(sched_ctl->tbcnt[1-pCCid][harq_pid] == 2,"sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",1-pCCid,harq_pid,UE_id,rnti);
-          AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 1,"sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",pCCid,harq_pid,UE_id,rnti);
-          if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK
-              sched_ctl->round[1-pCCid][harq_pid]=8;
-              sched_ctl->tbcnt[1-pCCid][harq_pid]=0;
-          }
-          else if (((pdu[0] >= 2) && (pdu[1] == 1))||
-                   ((pdu[0] == 1) && (pdu[1] >= 2))){ // one ACK
-            sched_ctl->round[1-pCCid][harq_pid]++;
-            sched_ctl->tbcnt[1-pCCid][harq_pid]=1;
-          }
-          else  // both NAK/DTX
-             sched_ctl->round[1-pCCid][harq_pid]++;
-
-          if (pdu[2] == 1) sched_ctl->round[pCCid][harq_pid]=8;
-          else             sched_ctl->round[pCCid][harq_pid]++;
-        } // A=3 secondary cell has 2 TBs
+    case 0:		// Format 1a/b (10.1.2.1)
+      AssertFatal(numCC == 1,
+		  "numCC %d > 1, should not be using Format1a/b\n",
+		  numCC);
+      if (tmode[0] == 1 || tmode[0] == 2 || tmode[0] == 5 || tmode[0] == 6 || tmode[0] == 7) {	// NOTE: have to handle the case of TM9-10 with 1 antenna port
+	// single ACK/NAK bit
+	AssertFatal(num_ack_nak == 1,
+		    "num_ack_nak %d > 1 for 1 CC and single-layer transmission frame:%d subframe:%d\n",
+		    num_ack_nak,frameP,subframeP);
+	AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8,
+		    "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",
+		    harq_pid, UE_id, rnti);
+	AssertFatal(pdu[0] == 1 || pdu[0] == 2
+		    || pdu[0] == 4,
+		    "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n",
+		    pdu[0], harq_pid, UE_id, rnti);
+	LOG_D(MAC, "Received %d for harq_pid %d\n", pdu[0],
+	      harq_pid);
+
+	if (pdu[0] == 1) {	// ACK
+	  sched_ctl->round[CC_idP][harq_pid] = 8;	// release HARQ process
+	  sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
+	} else if (pdu[0] == 2 || pdu[0] == 4)	// NAK (treat DTX as NAK)
+	  sched_ctl->round[CC_idP][harq_pid]++;	// increment round
+      } else {
+	// one or two ACK/NAK bits
+	AssertFatal(num_ack_nak <= 2,
+		    "num_ack_nak %d > 2 for 1 CC and TM3/4/8/9/10\n",
+		    num_ack_nak);
+	if ((num_ack_nak == 2)
+	    && (sched_ctl->round[CC_idP][harq_pid] < 8)
+	    && (sched_ctl->tbcnt[CC_idP][harq_pid] == 1)
+	    && (pdu[0] == 1) && (pdu[1] == 1)) {
+	  sched_ctl->round[CC_idP][harq_pid] = 8;
+	  sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
+	}
+	if ((num_ack_nak == 2)
+	    && (sched_ctl->round[CC_idP][harq_pid] < 8)
+	    && (sched_ctl->tbcnt[CC_idP][harq_pid] == 1)
+	    && (pdu[0] == 2) && (pdu[1] == 2))
+	  sched_ctl->round[CC_idP][harq_pid]++;
+	else if (((num_ack_nak == 2)
+		  && (sched_ctl->round[CC_idP][harq_pid] < 8)
+		  && (sched_ctl->tbcnt[0][harq_pid] == 2)
+		  && (pdu[0] == 1) && (pdu[1] == 2))
+		 || ((num_ack_nak == 2)
+		     && (sched_ctl->round[CC_idP][harq_pid] < 8)
+		     && (sched_ctl->tbcnt[CC_idP][harq_pid] == 2)
+		     && (pdu[0] == 2) && (pdu[1] == 1))) {
+	  sched_ctl->round[CC_idP][harq_pid]++;
+	  sched_ctl->tbcnt[CC_idP][harq_pid] = 1;
+	} else if ((num_ack_nak == 2)
+		   && (sched_ctl->round[CC_idP][harq_pid] < 8)
+		   && (sched_ctl->tbcnt[CC_idP][harq_pid] == 2)
+		   && (pdu[0] == 2) && (pdu[1] == 2))
+	  sched_ctl->round[CC_idP][harq_pid]++;
+	else
+	  AssertFatal(1 == 0,
+		      "Illegal ACK/NAK/round combination (%d,%d,%d,%d,%d) for harq_pid %d, UE %d/%x\n",
+		      num_ack_nak,
+		      sched_ctl->round[CC_idP][harq_pid],
+		      sched_ctl->round[CC_idP][harq_pid], pdu[0],
+		      pdu[1], harq_pid, UE_id, rnti);
+      }
+      break;
+    case 1:		// FDD Channel Selection (10.1.2.2.1), must be received for 2 serving cells
+      AssertFatal(numCC == 2,
+		  "Should not receive harq indication with channel selection with %d active CCs\n",
+		  numCC);
+
+      if ((num_ack_nak == 2)
+	  && (sched_ctl->round[pCCid][harq_pid] < 8)
+	  && (sched_ctl->round[1 - pCCid][harq_pid] < 8)
+	  && (sched_ctl->tbcnt[pCCid][harq_pid] == 1)
+	  && (sched_ctl->tbcnt[1 - pCCid][harq_pid] == 1)) {
+	AssertFatal(pdu[0] <= 3, "pdu[0] %d is not ACK/NAK/DTX\n",
+		    pdu[0]);
+	AssertFatal(pdu[1] <= 3, "pdu[1] %d is not ACK/NAK/DTX\n",
+		    pdu[1]);
+	if (pdu[0] == 1)
+	  sched_ctl->round[pCCid][harq_pid] = 8;
+	else
+	  sched_ctl->round[pCCid][harq_pid]++;
+	if (pdu[1] == 1)
+	  sched_ctl->round[1 - pCCid][harq_pid] = 8;
+	else
+	  sched_ctl->round[1 - pCCid][harq_pid]++;
+      }			// A=2
+      else if ((num_ack_nak == 3)
+	       && (sched_ctl->round[pCCid][harq_pid] < 8)
+	       && (sched_ctl->tbcnt[pCCid][harq_pid] == 2)
+	       && (sched_ctl->round[1 - pCCid][harq_pid] < 8)
+	       && (sched_ctl->tbcnt[1 - pCCid][harq_pid] == 1)) {
+	AssertFatal(pdu[0] <= 3, "pdu[0] %d is not ACK/NAK/DTX\n",
+		    pdu[0]);
+	AssertFatal(pdu[1] <= 3, "pdu[1] %d is not ACK/NAK/DTX\n",
+		    pdu[1]);
+	AssertFatal(pdu[2] <= 3, "pdu[2] %d is not ACK/NAK/DTX\n",
+		    pdu[2]);
+	AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 2,
+		    "sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",
+		    pCCid, harq_pid, UE_id, rnti);
+	AssertFatal(sched_ctl->tbcnt[1 - pCCid][harq_pid] == 1,
+		    "sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",
+		    1 - pCCid, harq_pid, UE_id, rnti);
+	if ((pdu[0] == 1) && (pdu[1] == 1)) {	// both ACK
+	  sched_ctl->round[pCCid][harq_pid] = 8;
+	  sched_ctl->tbcnt[pCCid][harq_pid] = 0;
+	} else if (((pdu[0] == 2) && (pdu[1] == 1)) ||
+		   ((pdu[0] == 1) && (pdu[1] == 2))) {
+	  sched_ctl->round[pCCid][harq_pid]++;
+	  sched_ctl->tbcnt[pCCid][harq_pid] = 1;
+	} else
+	  sched_ctl->round[pCCid][harq_pid]++;
+
+	if (pdu[2] == 1)
+	  sched_ctl->round[1 - pCCid][harq_pid] = 8;
+	else
+	  sched_ctl->round[1 - pCCid][harq_pid]++;
+      }			// A=3 primary cell has 2 TBs
+      else if ((num_ack_nak == 3)
+	       && (sched_ctl->round[1 - pCCid][harq_pid] < 8)
+	       && (sched_ctl->round[pCCid][harq_pid] < 8)
+	       && (sched_ctl->tbcnt[1 - pCCid][harq_pid] == 2)
+	       && (sched_ctl->tbcnt[pCCid][harq_pid] == 1)) {
+	AssertFatal(pdu[0] <= 3, "pdu[0] %d is not ACK/NAK/DTX\n",
+		    pdu[0]);
+	AssertFatal(pdu[1] <= 3, "pdu[1] %d is not ACK/NAK/DTX\n",
+		    pdu[1]);
+	AssertFatal(pdu[2] <= 3, "pdu[2] %d is not ACK/NAK/DTX\n",
+		    pdu[2]);
+	AssertFatal(sched_ctl->tbcnt[1 - pCCid][harq_pid] == 2,
+		    "sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",
+		    1 - pCCid, harq_pid, UE_id, rnti);
+	AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 1,
+		    "sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",
+		    pCCid, harq_pid, UE_id, rnti);
+	if ((pdu[0] == 1) && (pdu[1] == 1)) {	// both ACK
+	  sched_ctl->round[1 - pCCid][harq_pid] = 8;
+	  sched_ctl->tbcnt[1 - pCCid][harq_pid] = 0;
+	} else if (((pdu[0] >= 2) && (pdu[1] == 1))
+		   || ((pdu[0] == 1) && (pdu[1] >= 2))) {	// one ACK
+	  sched_ctl->round[1 - pCCid][harq_pid]++;
+	  sched_ctl->tbcnt[1 - pCCid][harq_pid] = 1;
+	} else		// both NAK/DTX
+	  sched_ctl->round[1 - pCCid][harq_pid]++;
+
+	if (pdu[2] == 1)
+	  sched_ctl->round[pCCid][harq_pid] = 8;
+	else
+	  sched_ctl->round[pCCid][harq_pid]++;
+      }			// A=3 secondary cell has 2 TBs
 #if MAX_NUM_CCs>1
-        else if ((num_ack_nak == 4) && (sched_ctl->round[0][harq_pid]<8) && (sched_ctl->round[1][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==2) && (sched_ctl->tbcnt[pCCid][harq_pid]==2)) {
-          AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]);
-          AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]);
-          AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]);
-          AssertFatal(pdu[3]<=3,"pdu[3] %d is not ACK/NAK/DTX\n",pdu[3]);
-          AssertFatal(sched_ctl->tbcnt[0][harq_pid] == 2,"sched_ctl->tbcnt[0][%d] != 2 for UE %d/%x\n",harq_pid,UE_id,rnti);
-          AssertFatal(sched_ctl->tbcnt[1][harq_pid] == 2,"sched_ctl->tbcnt[1][%d] != 2 for UE %d/%x\n",harq_pid,UE_id,rnti);
-          if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK
-              sched_ctl->round[0][harq_pid]=8;
-              sched_ctl->tbcnt[0][harq_pid]=0;
-          }
-          else if (((pdu[0] >= 2) && (pdu[1] == 1))||
-                   ((pdu[0] == 1) && (pdu[1] >= 2))){ // one ACK
-            sched_ctl->round[0][harq_pid]++;
-            sched_ctl->tbcnt[0][harq_pid]=1;
-          }
-          else  // both NAK/DTX
-             sched_ctl->round[0][harq_pid]++;
-
-          if ((pdu[2] == 1) && (pdu[3] == 1)) { // both ACK
-              sched_ctl->round[1][harq_pid]=8;
-              sched_ctl->tbcnt[1][harq_pid]=0;
-          }
-          else if (((pdu[2] >= 2) && (pdu[3] == 1))||
-                   ((pdu[2] == 1) && (pdu[3] >= 2))){ // one ACK
-            sched_ctl->round[1][harq_pid]++;
-            sched_ctl->tbcnt[1][harq_pid]=1;
-          }
-          else  // both NAK/DTX
-             sched_ctl->round[1][harq_pid]++;
-        } // A=4 both serving cells have 2 TBs
+      else if ((num_ack_nak == 4)
+	       && (sched_ctl->round[0][harq_pid] < 8)
+	       && (sched_ctl->round[1][harq_pid] < 8)
+	       && (sched_ctl->tbcnt[1 - pCCid][harq_pid] == 2)
+	       && (sched_ctl->tbcnt[pCCid][harq_pid] == 2)) {
+	AssertFatal(pdu[0] <= 3, "pdu[0] %d is not ACK/NAK/DTX\n",
+		    pdu[0]);
+	AssertFatal(pdu[1] <= 3, "pdu[1] %d is not ACK/NAK/DTX\n",
+		    pdu[1]);
+	AssertFatal(pdu[2] <= 3, "pdu[2] %d is not ACK/NAK/DTX\n",
+		    pdu[2]);
+	AssertFatal(pdu[3] <= 3, "pdu[3] %d is not ACK/NAK/DTX\n",
+		    pdu[3]);
+	AssertFatal(sched_ctl->tbcnt[0][harq_pid] == 2,
+		    "sched_ctl->tbcnt[0][%d] != 2 for UE %d/%x\n",
+		    harq_pid, UE_id, rnti);
+	AssertFatal(sched_ctl->tbcnt[1][harq_pid] == 2,
+		    "sched_ctl->tbcnt[1][%d] != 2 for UE %d/%x\n",
+		    harq_pid, UE_id, rnti);
+	if ((pdu[0] == 1) && (pdu[1] == 1)) {	// both ACK
+	  sched_ctl->round[0][harq_pid] = 8;
+	  sched_ctl->tbcnt[0][harq_pid] = 0;
+	} else if (((pdu[0] >= 2) && (pdu[1] == 1))
+		   || ((pdu[0] == 1) && (pdu[1] >= 2))) {	// one ACK
+	  sched_ctl->round[0][harq_pid]++;
+	  sched_ctl->tbcnt[0][harq_pid] = 1;
+	} else		// both NAK/DTX
+	  sched_ctl->round[0][harq_pid]++;
+
+	if ((pdu[2] == 1) && (pdu[3] == 1)) {	// both ACK
+	  sched_ctl->round[1][harq_pid] = 8;
+	  sched_ctl->tbcnt[1][harq_pid] = 0;
+	} else if (((pdu[2] >= 2) && (pdu[3] == 1))
+		   || ((pdu[2] == 1) && (pdu[3] >= 2))) {	// one ACK
+	  sched_ctl->round[1][harq_pid]++;
+	  sched_ctl->tbcnt[1][harq_pid] = 1;
+	} else		// both NAK/DTX
+	  sched_ctl->round[1][harq_pid]++;
+      }			// A=4 both serving cells have 2 TBs
 #endif
-        break;
-      case 2: // Format 3
-        AssertFatal(numCC>2,"Should not receive harq indication with FDD format 3 with %d < 3 active CCs\n",
-                    numCC);
-        for (i=0,j=0;i<numCC;i++) {
-          if ((sched_ctl->round[i][harq_pid]<8)) {
-            if (tmode[i]==1 || tmode[i]==2 || tmode[0]==5 || tmode[0]==6 || tmode[0]==7) {
-              if (pdu[j] == 1) {
-                sched_ctl->round[i][harq_pid]=8;
-                sched_ctl->tbcnt[i][harq_pid]=0;
-              }
-              else if (pdu[j] == 2) sched_ctl->round[i][harq_pid]++;
-              else AssertFatal(1==0,"Illegal harq_ack value for CC %d harq_pid %d (%d) UE %d/%x\n",
-                               i,harq_pid,pdu[j],UE_id,rnti);
-              j++;
-            }
-            else if (spatial_bundling == 0) {
-              if      ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 1) && (pdu[j+1]==1)) {
-                sched_ctl->round[i][harq_pid]=8;
-                sched_ctl->tbcnt[i][harq_pid]=0;
-              }
-              else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 1) && (pdu[j+1]==2)) {
-                sched_ctl->round[i][harq_pid]++;
-                sched_ctl->tbcnt[i][harq_pid]=1;
-              }
-              else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 2) && (pdu[j+1]==1)) {
-                sched_ctl->round[i][harq_pid]++;
-                sched_ctl->tbcnt[i][harq_pid]=1;
-              }
-              else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 2) && (pdu[j+1]==2)) {
-                sched_ctl->round[i][harq_pid]++;
-              }
-              else AssertFatal(1==0,"Illegal combination for CC %d harq_pid %d (%d,%d,%d) UE %d/%x\n",
-                               i,harq_pid,sched_ctl->tbcnt[i][harq_pid],pdu[j],pdu[j+1],UE_id,rnti);
-              j+=2;
-            }
-            else if (spatial_bundling == 1) {
-              if      (pdu[j] == 1) {
-                sched_ctl->round[i][harq_pid]=8;
-                sched_ctl->tbcnt[i][harq_pid]=0;
-              }
-              else if (pdu[j] == 2) {
-                sched_ctl->round[i][harq_pid]++;
-              }
-              else AssertFatal(1==0,"Illegal hack_nak value %d for CC %d harq_pid %d UE %d/%x\n",
-                               pdu[j],i,harq_pid,UE_id,rnti);
-              j++;
-            }
-            else AssertFatal(1==0,"Illegal value for spatial_bundling %d\n",spatial_bundling);
-          }
-        }
-        break;
-      case 3: // Format 4
-        AssertFatal(1==0,"Should not receive harq indication with Format 4\n");
-        break;
-      case 4: // Format 5
-        AssertFatal(1==0,"Should not receive harq indication with Format 5\n");
-        break;
+      break;
+    case 2:		// Format 3
+      AssertFatal(numCC > 2,
+		  "Should not receive harq indication with FDD format 3 with %d < 3 active CCs\n",
+		  numCC);
+      for (i = 0, j = 0; i < numCC; i++) {
+	if ((sched_ctl->round[i][harq_pid] < 8)) {
+	  if (tmode[i] == 1 || tmode[i] == 2 || tmode[0] == 5
+	      || tmode[0] == 6 || tmode[0] == 7) {
+	    if (pdu[j] == 1) {
+	      sched_ctl->round[i][harq_pid] = 8;
+	      sched_ctl->tbcnt[i][harq_pid] = 0;
+	    } else if (pdu[j] == 2)
+	      sched_ctl->round[i][harq_pid]++;
+	    else
+	      AssertFatal(1 == 0,
+			  "Illegal harq_ack value for CC %d harq_pid %d (%d) UE %d/%x\n",
+			  i, harq_pid, pdu[j], UE_id, rnti);
+	    j++;
+	  } else if (spatial_bundling == 0) {
+	    if ((sched_ctl->tbcnt[i][harq_pid] == 2)
+		&& (pdu[j] == 1) && (pdu[j + 1] == 1)) {
+	      sched_ctl->round[i][harq_pid] = 8;
+	      sched_ctl->tbcnt[i][harq_pid] = 0;
+	    } else if ((sched_ctl->tbcnt[i][harq_pid] == 2)
+		       && (pdu[j] == 1) && (pdu[j + 1] == 2)) {
+	      sched_ctl->round[i][harq_pid]++;
+	      sched_ctl->tbcnt[i][harq_pid] = 1;
+	    } else if ((sched_ctl->tbcnt[i][harq_pid] == 2)
+		       && (pdu[j] == 2) && (pdu[j + 1] == 1)) {
+	      sched_ctl->round[i][harq_pid]++;
+	      sched_ctl->tbcnt[i][harq_pid] = 1;
+	    } else if ((sched_ctl->tbcnt[i][harq_pid] == 2)
+		       && (pdu[j] == 2) && (pdu[j + 1] == 2)) {
+	      sched_ctl->round[i][harq_pid]++;
+	    } else
+	      AssertFatal(1 == 0,
+			  "Illegal combination for CC %d harq_pid %d (%d,%d,%d) UE %d/%x\n",
+			  i, harq_pid,
+			  sched_ctl->tbcnt[i][harq_pid],
+			  pdu[j], pdu[j + 1], UE_id, rnti);
+	    j += 2;
+	  } else if (spatial_bundling == 1) {
+	    if (pdu[j] == 1) {
+	      sched_ctl->round[i][harq_pid] = 8;
+	      sched_ctl->tbcnt[i][harq_pid] = 0;
+	    } else if (pdu[j] == 2) {
+	      sched_ctl->round[i][harq_pid]++;
+	    } else
+	      AssertFatal(1 == 0,
+			  "Illegal hack_nak value %d for CC %d harq_pid %d UE %d/%x\n",
+			  pdu[j], i, harq_pid, UE_id, rnti);
+	    j++;
+	  } else
+	    AssertFatal(1 == 0,
+			"Illegal value for spatial_bundling %d\n",
+			spatial_bundling);
+	}
+      }
+      break;
+    case 3:		// Format 4
+      AssertFatal(1 == 0,
+		  "Should not receive harq indication with Format 4\n");
+      break;
+    case 4:		// Format 5
+      AssertFatal(1 == 0,
+		  "Should not receive harq indication with Format 5\n");
+      break;
     }
   }
 }
 
-void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length)
+void
+extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id,
+		  frame_t frameP, sub_frame_t subframeP,
+		  uint8_t * pdu, uint8_t length)
 {
   UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
   UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-  COMMON_channels_t *cc=&RC.mac[mod_idP]->common_channels[CC_idP];
+  COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP];
   struct CQI_ReportPeriodic *cqi_ReportPeriodic;
   int no_pmi;
-  uint8_t Ltab[6] = {0,2,4,4,4,4};
-  uint8_t Jtab[6] = {0,2,2,3,4,4};
+  uint8_t Ltab[6] = { 0, 2, 4, 4, 4, 4 };
+  uint8_t Jtab[6] = { 0, 2, 2, 3, 4, 4 };
   int feedback_cnt;
 
-  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id);
-  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL,"cqi_ReportConfig is null for UE %d\n",UE_id);
-  AssertFatal((cqi_ReportPeriodic = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic)!=NULL,
-              "cqi_ReportPeriodic is null for UE %d\n",UE_id);
+  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL,
+	      "physicalConfigDedicated is null for UE %d\n", UE_id);
+  AssertFatal(UE_list->
+	      UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL,
+	      "cqi_ReportConfig is null for UE %d\n", UE_id);
+  AssertFatal((cqi_ReportPeriodic = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) != NULL,
+	      "cqi_ReportPeriodic is null for UE %d\n", UE_id);
 
   // determine feedback mode
   AssertFatal(cqi_ReportPeriodic->present != CQI_ReportPeriodic_PR_NOTHING,
-              "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n");
+	      "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n");
   AssertFatal(cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present != CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING,
-              "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n");
+	      "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n");
 
-  uint16_t Npd,N_OFFSET_CQI;
-  int H,K,bandwidth_part,L,Lmask;
-  int ri    = sched_ctl->periodic_ri_received[CC_idP];
+  uint16_t Npd, N_OFFSET_CQI;
+  int H, K, bandwidth_part, L, Lmask;
+  int ri = sched_ctl->periodic_ri_received[CC_idP];
 
-  get_csi_params(cc,cqi_ReportPeriodic,&Npd,&N_OFFSET_CQI,&H);
-  K            =(H-1)/Jtab[cc->mib->message.dl_Bandwidth];
-  L            = Ltab[cc->mib->message.dl_Bandwidth];
-  Lmask        =L-1;
-  feedback_cnt = (((frameP*10)+subframeP)/Npd)%H;
+  get_csi_params(cc, cqi_ReportPeriodic, &Npd, &N_OFFSET_CQI, &H);
+  K = (H - 1) / Jtab[cc->mib->message.dl_Bandwidth];
+  L = Ltab[cc->mib->message.dl_Bandwidth];
+  Lmask = L - 1;
+  feedback_cnt = (((frameP * 10) + subframeP) / Npd) % H;
 
-  if (feedback_cnt>0) bandwidth_part = (feedback_cnt-1)%K;
-  else                bandwidth_part = 0;
+  if (feedback_cnt > 0)
+    bandwidth_part = (feedback_cnt - 1) % K;
+  else
+    bandwidth_part = 0;
 
-  switch(get_tmode(mod_idP,CC_idP,UE_id)) {
+  switch (get_tmode(mod_idP, CC_idP, UE_id)) {
   case 1:
   case 2:
   case 3:
   case 7:
-    no_pmi=1;
+    no_pmi = 1;
     break;
   case 4:
   case 5:
   case 6:
-    no_pmi=0;
+    no_pmi = 0;
     break;
   default:
     // note: need to check TM8-10 without PMI/RI or with 1 antenna port (see Section 5.2.3.3.1 from 36.213)
-    no_pmi=0;
+    no_pmi = 0;
   }
 
-  if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) ||
-      (feedback_cnt==0)){
-      // Note: This implements only Tables: 5.3.3.1-1,5.3.3.1-1A and 5.3.3.1-2 from 36.213 (1,2,4 antenna ports Wideband CQI/PMI)
+  if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI)
+      || (feedback_cnt == 0)) {
+    // Note: This implements only Tables: 5.3.3.1-1,5.3.3.1-1A and 5.3.3.1-2 from 36.213 (1,2,4 antenna ports Wideband CQI/PMI)
 
-    if (no_pmi == 1) { // get spatial_diffcqi if needed
-      sched_ctl->periodic_wideband_cqi[CC_idP]             = pdu[0]&0xF;
-      sched_ctl->periodic_wideband_spatial_diffcqi[CC_idP] = (pdu[0]>>4)&7;
-    }
-    else if ((cc->p_eNB==2) && (ri==1))  {
+    if (no_pmi == 1) {	// get spatial_diffcqi if needed
+      sched_ctl->periodic_wideband_cqi[CC_idP] = pdu[0] & 0xF;
+      sched_ctl->periodic_wideband_spatial_diffcqi[CC_idP] =
+	(pdu[0] >> 4) & 7;
+    } else if ((cc->p_eNB == 2) && (ri == 1)) {
       // p=2 Rank 1 wideband CQI/PMI 6 bits
-      sched_ctl->periodic_wideband_cqi[CC_idP]             = pdu[0]&0xF;
-      sched_ctl->periodic_wideband_pmi[CC_idP]             = (pdu[0]>>4)&3;
-    }
-    else if ((cc->p_eNB==2) && (ri>1)) {
+      sched_ctl->periodic_wideband_cqi[CC_idP] = pdu[0] & 0xF;
+      sched_ctl->periodic_wideband_pmi[CC_idP] = (pdu[0] >> 4) & 3;
+    } else if ((cc->p_eNB == 2) && (ri > 1)) {
       // p=2 Rank 2 wideband CQI/PMI 8 bits
-      sched_ctl->periodic_wideband_cqi[CC_idP]             = pdu[0]&0xF;
-      sched_ctl->periodic_wideband_spatial_diffcqi[CC_idP] = (pdu[0]>>4)&7;
-      sched_ctl->periodic_wideband_pmi[CC_idP]             = (pdu[0]>>7)&1;
-    }
-    else if ((cc->p_eNB==4) && (ri==1)) {
+      sched_ctl->periodic_wideband_cqi[CC_idP] = pdu[0] & 0xF;
+      sched_ctl->periodic_wideband_spatial_diffcqi[CC_idP] =
+	(pdu[0] >> 4) & 7;
+      sched_ctl->periodic_wideband_pmi[CC_idP] = (pdu[0] >> 7) & 1;
+    } else if ((cc->p_eNB == 4) && (ri == 1)) {
       // p=4 Rank 1 wideband CQI/PMI 8 bits
-      sched_ctl->periodic_wideband_cqi[CC_idP]             = pdu[0]&0xF;
-      sched_ctl->periodic_wideband_pmi[CC_idP]             = (pdu[0]>>4)&0x0F;
-
-    }
-    else if ((cc->p_eNB==4) && (ri>1)) {
+      sched_ctl->periodic_wideband_cqi[CC_idP] = pdu[0] & 0xF;
+      sched_ctl->periodic_wideband_pmi[CC_idP] =
+	(pdu[0] >> 4) & 0x0F;
+    } else if ((cc->p_eNB == 4) && (ri > 1)) {
       // p=4 Rank 2 wideband CQI/PMI 11 bits
-      sched_ctl->periodic_wideband_cqi[CC_idP]             = pdu[0]&0xF;
-      sched_ctl->periodic_wideband_spatial_diffcqi[CC_idP] = (pdu[0]>>4)&7;
-      sched_ctl->periodic_wideband_pmi[CC_idP]             = (pdu[0]>>7)&0xF;
-    }
-    else AssertFatal(1==0,"illegal combination p %d, ri %d, no_pmi %d\n",cc->p_eNB,ri,no_pmi);
-  }
-  else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) {
-    // This is Table 5.2.3.3.2-2 for 36.213
-    if (ri==1) {
-      //4+Ltab[cc->mib->message.dl_Bandwidth] bits
-      sched_ctl->periodic_subband_cqi[CC_idP][(bandwidth_part*L)+((pdu[0]>>4)&Lmask)]              = pdu[0]&0xF;
-    }
-    else if (ri>1) {
-      //7+Ltab[cc->mib->message.dl_Bandwidth] bits;
-      sched_ctl->periodic_subband_spatial_diffcqi[CC_idP][(bandwidth_part*L)+((pdu[0]>>7)&Lmask)]  = (pdu[0]>>4)&7;
-      sched_ctl->periodic_subband_cqi[CC_idP][(bandwidth_part*L)+((pdu[0]>>7)&Lmask)]              = pdu[0]&0xF;
+      sched_ctl->periodic_wideband_cqi[CC_idP] = pdu[0] & 0xF;
+      sched_ctl->periodic_wideband_spatial_diffcqi[CC_idP] =
+	(pdu[0] >> 4) & 7;
+      sched_ctl->periodic_wideband_pmi[CC_idP] = (pdu[0] >> 7) & 0xF;
+    } else
+      AssertFatal(1 == 0,
+		  "illegal combination p %d, ri %d, no_pmi %d\n",
+		  cc->p_eNB, ri, no_pmi);
+  } else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI)
+    {
+      // This is Table 5.2.3.3.2-2 for 36.213
+      if (ri == 1) {
+	//4+Ltab[cc->mib->message.dl_Bandwidth] bits
+	sched_ctl->periodic_subband_cqi[CC_idP][(bandwidth_part * L) +((pdu[0] >> 4) & Lmask)] = pdu[0] & 0xF;
+      } else if (ri > 1) {
+	//7+Ltab[cc->mib->message.dl_Bandwidth] bits;
+	sched_ctl->periodic_subband_spatial_diffcqi[CC_idP][(bandwidth_part * L) + ((pdu[0] >> 7) & Lmask)] = (pdu[0] >> 4) & 7;
+	sched_ctl->periodic_subband_cqi[CC_idP][(bandwidth_part * L) + ((pdu[0] >> 7) & Lmask)] =
+	  pdu[0] & 0xF;
+      }
     }
-  }
 }
 
-void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length)
+void
+extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id,
+		  frame_t frameP, sub_frame_t subframeP,
+		  uint8_t * pdu, uint8_t length)
 {
-  UE_list_t *UE_list    = &RC.mac[mod_idP]->UE_list;
+  UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
   COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP];
   UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-  int Ntab[6]       = {0,4,7,9,10,13};
-  int Ntab_uesel[6] = {0,8,13,17,19,25};
-  int Ltab_uesel[6] = {0,6,9,13,15,18};
-  int Mtab_uesel[6] = {0,1,3,5,6,6};
+  int Ntab[6] = { 0, 4, 7, 9, 10, 13 };
+  int Ntab_uesel[6] = { 0, 8, 13, 17, 19, 25 };
+  int Ltab_uesel[6] = { 0, 6, 9, 13, 15, 18 };
+  int Mtab_uesel[6] = { 0, 1, 3, 5, 6, 6 };
   int v[6];
   int i;
-  uint64_t p = *(uint64_t*)pdu;
+  uint64_t p = *(uint64_t *) pdu;
   int curbyte, curbit;
   CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic;
 
-  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id);
-  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL,"cqi_ReportConfig is null for UE %d\n",UE_id);
-  AssertFatal((cqi_ReportModeAperiodic = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic)!=NULL,
-              "cqi_ReportModeAperiodic is null for UE %d\n",UE_id);
-
-  int N     = Ntab[cc->mib->message.dl_Bandwidth];
-  int tmode = get_tmode(mod_idP,CC_idP,UE_id);
-  int ri    = sched_ctl->aperiodic_ri_received[CC_idP];
-  int r,diffcqi0=0,diffcqi1=0,pmi_uesel=0;
+  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL,
+	      "physicalConfigDedicated is null for UE %d\n", UE_id);
+  AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL,
+	      "cqi_ReportConfig is null for UE %d\n", UE_id);
+  AssertFatal((cqi_ReportModeAperiodic = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) != NULL,
+	      "cqi_ReportModeAperiodic is null for UE %d\n", UE_id);
+
+  int N = Ntab[cc->mib->message.dl_Bandwidth];
+  int tmode = get_tmode(mod_idP, CC_idP, UE_id);
+  int ri = sched_ctl->aperiodic_ri_received[CC_idP];
+  int r, diffcqi0 = 0, diffcqi1 = 0, pmi_uesel = 0;
   int bw = cc->mib->message.dl_Bandwidth;
   int m;
 
-  switch(*cqi_ReportModeAperiodic) {
+  switch (*cqi_ReportModeAperiodic) {
   case CQI_ReportModeAperiodic_rm12:
-    AssertFatal(0==1, "to be fixed, don't use p but pdu directly\n");
+    AssertFatal(0 == 1, "to be fixed, don't use p but pdu directly\n");
     // wideband multiple PMI (TM4/6), Table 5.2.2.6.1-1 (for TM4/6)
-    AssertFatal(tmode==4 || tmode==6 || tmode==8|| tmode==9 || tmode==10,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm12\n",tmode);
-    if (tmode <= 6) { //Table 5.2.2.6.1-1 36.213
-      if ((ri==1) && (cc->p_eNB==2)) {
-        sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-        for (i=0;i<N;i++) {
-          sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x03);
-          p>>=2;
-        }
+    AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10,
+		"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm12\n",
+		tmode);
+    if (tmode <= 6) {	//Table 5.2.2.6.1-1 36.213
+      if ((ri == 1) && (cc->p_eNB == 2)) {
+	sched_ctl->aperiodic_wideband_cqi0[CC_idP]    = (uint8_t) (p & 0x0F);
+	p >>= 4;
+	for (i = 0; i < N; i++) {
+	  sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t) (p & 0x03);
+	  p >>= 2;
+	}
       }
-      if ((ri==2) && (cc->p_eNB==2)) {
-        sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-        sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-        for (i=0;i<N;i++) {
-          sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01);
-          p>>=1;
-        }
+      if ((ri == 2) && (cc->p_eNB == 2)) {
+	sched_ctl->aperiodic_wideband_cqi0[CC_idP]    = (uint8_t) (p & 0x0F);
+	p >>= 4;
+	sched_ctl->aperiodic_wideband_cqi1[CC_idP]    = (uint8_t) (p & 0x0F);
+	p >>= 4;
+	for (i = 0; i < N; i++) {
+	  sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t) (p & 0x01);
+	  p >>= 1;
+	}
       }
-      if ((ri==1) && (cc->p_eNB==4)) {
-        sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-        for (i=0;i<N;i++) {
-          sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x03);
-          p>>=4;
-        }
+      if ((ri == 1) && (cc->p_eNB == 4)) {
+	sched_ctl->aperiodic_wideband_cqi0[CC_idP]    = (uint8_t) (p & 0x0F);
+	p >>= 4;
+	for (i = 0; i < N; i++) {
+	  sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t) (p & 0x03);
+	  p >>= 4;
+	}
       }
-      if ((ri==2) && (cc->p_eNB==4)) {
-        sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-        sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-        for (i=0;i<N;i++) {
-          sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01);
-          p>>=4;
-        }
+      if ((ri == 2) && (cc->p_eNB == 4)) {
+	sched_ctl->aperiodic_wideband_cqi0[CC_idP]    = (uint8_t) (p & 0x0F);
+	p >>= 4;
+	sched_ctl->aperiodic_wideband_cqi1[CC_idP]    = (uint8_t) (p & 0x0F);
+	p >>= 4;
+	for (i = 0; i < N; i++) {
+	  sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t) (p & 0x01);
+	  p >>= 4;
+	}
       }
-    } // if (tmode <= 6) { //Table 5.2.2.6.1-1 36.213
+    }			// if (tmode <= 6) { //Table 5.2.2.6.1-1 36.213
     else {
-      AssertFatal(1==0,"support for TM 8-10 to be done\n");
+      AssertFatal(1 == 0, "support for TM 8-10 to be done\n");
     }
 
-   break;
+    break;
   case CQI_ReportModeAperiodic_rm20:
-    AssertFatal(0==1, "to be fixed, don't use p but pdu directly\n");
+    AssertFatal(0 == 1, "to be fixed, don't use p but pdu directly\n");
     // UE-selected subband CQI no PMI (TM1/2/3/7) , Table 5.2.2.6.3-1 from 36.213
-    AssertFatal(tmode==1 || tmode==2 || tmode==3 || tmode==7,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm20\n",tmode);
-
-    sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-    diffcqi0 = (uint8_t)(p&0x03); p>>=2;
-    r = (uint8_t)(p&((1>>Ltab_uesel[bw])-1));
-    reverse_index(Ntab_uesel[bw],Mtab_uesel[bw],r,v);
-    for (m=0;m<Mtab_uesel[bw];m++) sched_ctl->aperiodic_subband_diffcqi0[CC_idP][v[m]] = diffcqi0;
+    AssertFatal(tmode == 1 || tmode == 2 || tmode == 3
+		|| tmode == 7,
+		"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm20\n",
+		tmode);
+
+    sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t) (p & 0x0F);
+    p >>= 4;
+    diffcqi0 = (uint8_t) (p & 0x03);
+    p >>= 2;
+    r = (uint8_t) (p & ((1 >> Ltab_uesel[bw]) - 1));
+    reverse_index(Ntab_uesel[bw], Mtab_uesel[bw], r, v);
+    for (m = 0; m < Mtab_uesel[bw]; m++)
+      sched_ctl->aperiodic_subband_diffcqi0[CC_idP][v[m]] = diffcqi0;
     break;
   case CQI_ReportModeAperiodic_rm22:
-    AssertFatal(0==1, "to be fixed, don't use p but pdu directly\n");
+    AssertFatal(0 == 1, "to be fixed, don't use p but pdu directly\n");
     // UE-selected subband CQI multiple PMI (TM4/6) Table 5.2.2.6.3-2 from 36.213
 
-    AssertFatal(tmode==4 || tmode==6 || tmode==8|| tmode==9 || tmode==10,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm22\n",tmode);
-
-    sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-    diffcqi0 = (uint8_t)(p&0x03); p>>=2;
-
-    if (ri>1) {
-      sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-      diffcqi1 = (uint8_t)(p&0x03); p>>=2;
-    }
-    r = (uint8_t)(p&((1>>Ltab_uesel[bw])-1)); p>>=Ltab_uesel[bw];
-    reverse_index(Ntab_uesel[bw],Mtab_uesel[bw],r,v);
-    if ((ri==1)&&(cc->p_eNB==2)) {
-      pmi_uesel                                  = p&0x3; p>>=2;
-      sched_ctl->aperiodic_wideband_pmi[CC_idP]  = p&0x3;
-    }
-    else if ((ri==2)&&(cc->p_eNB==2)) {
-      pmi_uesel                                  = p&0x1; p>>=1;
-      sched_ctl->aperiodic_wideband_pmi[CC_idP]  = p&0x1;
-    }
-    else if (cc->p_eNB==4) {
-      pmi_uesel                                  = p&0x0F; p>>=4;
-      sched_ctl->aperiodic_wideband_pmi[CC_idP]  = p&0x0F;
-    }
-    for (m=0;m<Mtab_uesel[bw];m++) {
+    AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9
+		|| tmode == 10,
+		"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm22\n",
+		tmode);
+
+    sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t) (p & 0x0F);
+    p >>= 4;
+    diffcqi0 = (uint8_t) (p & 0x03);
+    p >>= 2;
+
+    if (ri > 1) {
+      sched_ctl->aperiodic_wideband_cqi1[CC_idP] =
+	(uint8_t) (p & 0x0F);
+      p >>= 4;
+      diffcqi1 = (uint8_t) (p & 0x03);
+      p >>= 2;
+    }
+    r = (uint8_t) (p & ((1 >> Ltab_uesel[bw]) - 1));
+    p >>= Ltab_uesel[bw];
+    reverse_index(Ntab_uesel[bw], Mtab_uesel[bw], r, v);
+    if ((ri == 1) && (cc->p_eNB == 2)) {
+      pmi_uesel = p & 0x3;
+      p >>= 2;
+      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p & 0x3;
+    } else if ((ri == 2) && (cc->p_eNB == 2)) {
+      pmi_uesel = p & 0x1;
+      p >>= 1;
+      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p & 0x1;
+    } else if (cc->p_eNB == 4) {
+      pmi_uesel = p & 0x0F;
+      p >>= 4;
+      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p & 0x0F;
+    }
+    for (m = 0; m < Mtab_uesel[bw]; m++) {
       sched_ctl->aperiodic_subband_diffcqi0[CC_idP][v[m]] = diffcqi0;
-      if (ri>1) sched_ctl->aperiodic_subband_diffcqi1[CC_idP][v[m]] = diffcqi1;
-      sched_ctl->aperiodic_subband_pmi[CC_idP][v[m]]      = pmi_uesel;
+      if (ri > 1)
+	sched_ctl->aperiodic_subband_diffcqi1[CC_idP][v[m]] =
+	  diffcqi1;
+      sched_ctl->aperiodic_subband_pmi[CC_idP][v[m]] = pmi_uesel;
     }
     break;
   case CQI_ReportModeAperiodic_rm30:
     //subband CQI no PMI (TM1/2/3/7)
-    AssertFatal(tmode==1 || tmode==2 || tmode==3 || tmode==7,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm30\n",tmode);
-    sched_ctl->aperiodic_wideband_cqi0[CC_idP] = pdu[0]>>4;
+    AssertFatal(tmode == 1 || tmode == 2 || tmode == 3
+		|| tmode == 7,
+		"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm30\n",
+		tmode);
+    sched_ctl->aperiodic_wideband_cqi0[CC_idP] = pdu[0] >> 4;
     curbyte = 0;
     curbit = 3;
-    for (i=0;i<N;i++) {
-      sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] = (pdu[curbyte] >> (curbit-1)) & 0x03;
+    for (i = 0; i < N; i++) {
+      sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] =
+	(pdu[curbyte] >> (curbit - 1)) & 0x03;
       curbit -= 2;
       if (curbit < 0) {
-        curbit = 7;
-        curbyte++;
+	curbit = 7;
+	curbyte++;
       }
     }
-    sched_ctl->dl_cqi[CC_idP] = sched_ctl->aperiodic_wideband_cqi0[CC_idP];
+    sched_ctl->dl_cqi[CC_idP] =
+      sched_ctl->aperiodic_wideband_cqi0[CC_idP];
     break;
   case CQI_ReportModeAperiodic_rm31:
-    AssertFatal(0==1, "to be fixed, don't use p but pdu directly\n");
+    AssertFatal(0 == 1, "to be fixed, don't use p but pdu directly\n");
     //subband CQI single PMI (TM4/5/6)
-    AssertFatal(tmode==4 || tmode==5 || tmode==6 || tmode==8|| tmode==9|| tmode==10,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm31\n",tmode);
-
-    if ((ri==1) && (cc->p_eNB==2)) {
-      sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-      for (i=0;i<N;i++) {
-        sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] = (uint8_t)(p&0x03);
-        p>>=2;
+    AssertFatal(tmode == 4 || tmode == 5 || tmode == 6 || tmode == 8
+		|| tmode == 9
+		|| tmode == 10,
+		"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm31\n",
+		tmode);
+
+    if ((ri == 1) && (cc->p_eNB == 2)) {
+      sched_ctl->aperiodic_wideband_cqi0[CC_idP] =
+	(uint8_t) (p & 0x0F);
+      p >>= 4;
+      for (i = 0; i < N; i++) {
+	sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] =
+	  (uint8_t) (p & 0x03);
+	p >>= 2;
       }
-      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x03;
-    }
-    if ((ri==2) && (cc->p_eNB==2)) {
-      sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-      for (i=0;i<N;i++) {
-        sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01);
-        p>>=1;
+      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p & 0x03;
+    }
+    if ((ri == 2) && (cc->p_eNB == 2)) {
+      sched_ctl->aperiodic_wideband_cqi0[CC_idP] =
+	(uint8_t) (p & 0x0F);
+      p >>= 4;
+      for (i = 0; i < N; i++) {
+	sched_ctl->aperiodic_subband_pmi[CC_idP][i] =
+	  (uint8_t) (p & 0x01);
+	p >>= 1;
       }
-      sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-      for (i=0;i<N;i++) {
-        sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01);
-        p>>=1;
+      sched_ctl->aperiodic_wideband_cqi1[CC_idP] =
+	(uint8_t) (p & 0x0F);
+      p >>= 4;
+      for (i = 0; i < N; i++) {
+	sched_ctl->aperiodic_subband_pmi[CC_idP][i] =
+	  (uint8_t) (p & 0x01);
+	p >>= 1;
       }
-      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x01;
-    }
-    if ((ri==1) && (cc->p_eNB==4)) {
-      sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-      for (i=0;i<N;i++) {
-        sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] = (uint8_t)(p&0x03);
-        p>>=2;
+      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p & 0x01;
+    }
+    if ((ri == 1) && (cc->p_eNB == 4)) {
+      sched_ctl->aperiodic_wideband_cqi0[CC_idP] =
+	(uint8_t) (p & 0x0F);
+      p >>= 4;
+      for (i = 0; i < N; i++) {
+	sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] =
+	  (uint8_t) (p & 0x03);
+	p >>= 2;
       }
-      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x0F;
-    }
-    if ((ri>1) && (cc->p_eNB==4)) { // Note : 64 bits for 20 MHz
-      sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-      for (i=0;i<N;i++) {
-        sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01);
-        p>>=1;
+      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p & 0x0F;
+    }
+    if ((ri > 1) && (cc->p_eNB == 4)) {	// Note : 64 bits for 20 MHz
+      sched_ctl->aperiodic_wideband_cqi0[CC_idP] =
+	(uint8_t) (p & 0x0F);
+      p >>= 4;
+      for (i = 0; i < N; i++) {
+	sched_ctl->aperiodic_subband_pmi[CC_idP][i] =
+	  (uint8_t) (p & 0x01);
+	p >>= 1;
       }
-      sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4;
-      for (i=0;i<N;i++) {
-        sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01);
-        p>>=2;
+      sched_ctl->aperiodic_wideband_cqi1[CC_idP] =
+	(uint8_t) (p & 0x0F);
+      p >>= 4;
+      for (i = 0; i < N; i++) {
+	sched_ctl->aperiodic_subband_pmi[CC_idP][i] =
+	  (uint8_t) (p & 0x01);
+	p >>= 2;
       }
-      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x0F;
+      sched_ctl->aperiodic_wideband_pmi[CC_idP] = p & 0x0F;
     }
 
     break;
+#ifdef Rel14
   case CQI_ReportModeAperiodic_rm32_v1250:
-    AssertFatal(tmode==4 || tmode==5 || tmode==6 || tmode==8|| tmode==9|| tmode==10,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm32\n",tmode);
-    AssertFatal(1==0,"CQI_ReportModeAperiodic_rm32 to be done\n");
+    AssertFatal(tmode == 4 || tmode == 5 || tmode == 6 || tmode == 8
+		|| tmode == 9
+		|| tmode == 10,
+		"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm32\n",
+		tmode);
+    AssertFatal(1 == 0, "CQI_ReportModeAperiodic_rm32 to be done\n");
     break;
   case CQI_ReportModeAperiodic_rm10_v1310:
-    AssertFatal(tmode==1 || tmode==2 || tmode==3 || tmode==7,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm10\n",tmode);
-    AssertFatal(1==0,"CQI_ReportModeAperiodic_rm10 to be done\n");
+    AssertFatal(tmode == 1 || tmode == 2 || tmode == 3
+		|| tmode == 7,
+		"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm10\n",
+		tmode);
+    AssertFatal(1 == 0, "CQI_ReportModeAperiodic_rm10 to be done\n");
     break;
   case CQI_ReportModeAperiodic_rm11_v1310:
-    AssertFatal(tmode==4 || tmode==5 || tmode==6 || tmode==8|| tmode==9|| tmode==10,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm11\n",tmode);
-    AssertFatal(1==0,"CQI_ReportModeAperiodic_rm11 to be done\n");
+    AssertFatal(tmode == 4 || tmode == 5 || tmode == 6 || tmode == 8
+		|| tmode == 9
+		|| tmode == 10,
+		"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm11\n",
+		tmode);
+    AssertFatal(1 == 0, "CQI_ReportModeAperiodic_rm11 to be done\n");
     break;
+#endif /* Rel14 */
   }
 }
 
-void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, rnti_t rntiP,
-                    nfapi_cqi_indication_rel9_t *rel9,uint8_t *pdu,
-                    nfapi_ul_cqi_information_t *ul_cqi_information)
+void
+cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP,
+	       sub_frame_t subframeP, rnti_t rntiP,
+	       nfapi_cqi_indication_rel9_t * rel9, uint8_t * pdu,
+	       nfapi_ul_cqi_information_t * ul_cqi_information)
 {
   int UE_id = find_UE_id(mod_idP, rntiP);
   UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
@@ -3564,102 +3897,167 @@ void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t
   }
   UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
 
-  if (UE_id  >= 0) {
+  if (UE_id >= 0) {
 
-    if (ul_cqi_information->channel == 0) { // PUCCH
+    LOG_D(MAC,"%s() UE_id:%d channel:%d cqi:%d\n", __FUNCTION__, UE_id, ul_cqi_information->channel, ul_cqi_information->ul_cqi);
+
+    if (ul_cqi_information->channel == 0) {	// PUCCH
 
       // extract pucch csi information before changing RI information
-      extract_pucch_csi(mod_idP,CC_idP,UE_id,frameP,subframeP,pdu,rel9->length);
+      extract_pucch_csi(mod_idP, CC_idP, UE_id, frameP, subframeP,
+			pdu, rel9->length);
 
-      memcpy((void*)sched_ctl->periodic_ri_received,
-             (void*)rel9->ri,
-             rel9->number_of_cc_reported);
+      memcpy((void *) sched_ctl->periodic_ri_received,
+	     (void *) rel9->ri, rel9->number_of_cc_reported);
 
       // SNR for PUCCH2
       sched_ctl->pucch2_snr[CC_idP] = ul_cqi_information->ul_cqi;
-    }
-    else { //PUSCH
-      memcpy((void*)sched_ctl->aperiodic_ri_received,
-             (void*)rel9->ri,
-             rel9->number_of_cc_reported);
+    } else {		//PUSCH
+      memcpy((void *) sched_ctl->aperiodic_ri_received,
+	     (void *) rel9->ri, rel9->number_of_cc_reported);
 
-      extract_pusch_csi(mod_idP,CC_idP,UE_id,frameP,subframeP,pdu,rel9->length);
+      extract_pusch_csi(mod_idP, CC_idP, UE_id, frameP, subframeP,
+			pdu, rel9->length);
 
     }
 
     // timing advance
-    sched_ctl->timing_advance    = rel9->timing_advance;
+    sched_ctl->timing_advance = rel9->timing_advance;
     sched_ctl->timing_advance_r9 = rel9->timing_advance_r9;
   }
 }
 
-void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, sub_frame_t subframeP, rnti_t rntiP, uint8_t ul_cqi)
+void
+SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP,
+	      sub_frame_t subframeP, rnti_t rntiP, uint8_t ul_cqi)
 {
-  T(T_ENB_MAC_SCHEDULING_REQUEST, T_INT(mod_idP), T_INT(cc_idP), T_INT(frameP), T_INT(subframeP), T_INT(rntiP));
+  T(T_ENB_MAC_SCHEDULING_REQUEST, T_INT(mod_idP), T_INT(cc_idP),
+    T_INT(frameP), T_INT(subframeP), T_INT(rntiP));
 
   int UE_id = find_UE_id(mod_idP, rntiP);
   UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
 
-  if (UE_id  != -1) {
-    if (mac_eNB_get_rrc_status(mod_idP,UE_RNTI(mod_idP,UE_id)) < RRC_CONNECTED)
-      LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",mod_idP,rntiP,frameP,subframeP, UE_id,cc_idP);
+  if (UE_id != -1) {
+    if (mac_eNB_get_rrc_status(mod_idP, UE_RNTI(mod_idP, UE_id)) <
+	RRC_CONNECTED)
+      LOG_D(MAC,
+	    "[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",
+	    mod_idP, rntiP, frameP, subframeP, UE_id, cc_idP);
 
+#if 0
     UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
 
-#if 0
     /* for the moment don't use ul_cqi from SR, value is too different from harq */
-    sched_ctl->pucch1_snr[cc_idP]        = ul_cqi;
+    sched_ctl->pucch1_snr[cc_idP] = ul_cqi;
     sched_ctl->pucch1_cqi_update[cc_idP] = 1;
 #endif
 
     UE_list->UE_template[cc_idP][UE_id].ul_SR = 1;
     UE_list->UE_template[cc_idP][UE_id].ul_active = TRUE;
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SR_INDICATION,1);
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SR_INDICATION,0);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+      (VCD_SIGNAL_DUMPER_FUNCTIONS_SR_INDICATION, 1);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+      (VCD_SIGNAL_DUMPER_FUNCTIONS_SR_INDICATION, 0);
   } else {
     //     AssertFatal(0, "find_UE_id(%u,rnti %d) not found", enb_mod_idP, rntiP);
     //    AssertError(0, 0, "Frame %d: find_UE_id(%u,rnti %d) not found\n", frameP, enb_mod_idP, rntiP);
-    LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d (unknown UEid) on CC_id %d\n",mod_idP,rntiP,frameP,subframeP, UE_id,cc_idP);
+    LOG_D(MAC,
+	  "[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d (unknown UEid) on CC_id %d\n",
+	  mod_idP, rntiP, frameP, subframeP, UE_id, cc_idP);
   }
 }
 
-void UL_failure_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti_t rntiP, sub_frame_t subframeP)
+void
+UL_failure_indication(module_id_t mod_idP, int cc_idP, frame_t frameP,
+		      rnti_t rntiP, sub_frame_t subframeP)
 {
   int UE_id = find_UE_id(mod_idP, rntiP);
   UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
 
-  if (UE_id  != -1) {
-    LOG_D(MAC,"[eNB %d][UE %d/%x] Frame %d subframeP %d Signaling UL Failure for UE %d on CC_id %d (timer %d)\n",
-          mod_idP,UE_id,rntiP,frameP,subframeP, UE_id,cc_idP,
-          UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
+  if (UE_id != -1) {
+    LOG_D(MAC,
+	  "[eNB %d][UE %d/%x] Frame %d subframeP %d Signaling UL Failure for UE %d on CC_id %d (timer %d)\n",
+	  mod_idP, UE_id, rntiP, frameP, subframeP, UE_id, cc_idP,
+	  UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
     if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer == 0)
-      UE_list->UE_sched_ctrl[UE_id].ul_failure_timer=1;
+      UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 1;
   } else {
     //     AssertFatal(0, "find_UE_id(%u,rnti %d) not found", enb_mod_idP, rntiP);
     //    AssertError(0, 0, "Frame %d: find_UE_id(%u,rnti %d) not found\n", frameP, enb_mod_idP, rntiP);
-    LOG_W(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling UL Failure for UE %d (unknown UEid) on CC_id %d\n",mod_idP,rntiP,frameP,subframeP, UE_id,cc_idP);
+    LOG_W(MAC,
+	  "[eNB %d][SR %x] Frame %d subframeP %d Signaling UL Failure for UE %d (unknown UEid) on CC_id %d\n",
+	  mod_idP, rntiP, frameP, subframeP, UE_id, cc_idP);
+  }
+}
+
+static int nack_or_dtx_reported(
+    COMMON_channels_t *cc,
+    nfapi_harq_indication_pdu_t *harq_pdu)
+{
+  int i;
+
+  if (cc->tdd_Config) {
+    AssertFatal(0==1, "TDD to be done. FAPI structures (see nfapi_harq_indication_tdd_rel13_t) are not clean. To be cleaned as well?\n");
+    abort();
+  } else {
+    nfapi_harq_indication_fdd_rel13_t *hi = &harq_pdu->harq_indication_fdd_rel13;
+    for (i = 0; i < hi->number_of_ack_nack; hi++)
+      if (hi->harq_tb_n[i] != 1)
+        return 1;
+    return 0;
   }
 }
 
-void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, nfapi_harq_indication_pdu_t *harq_pdu)
+void
+harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP,
+		sub_frame_t subframeP,
+		nfapi_harq_indication_pdu_t * harq_pdu)
 {
-  rnti_t rnti              = harq_pdu->rx_ue_information.rnti;
-  uint8_t ul_cqi           = harq_pdu->ul_cqi_information.ul_cqi;
-  uint8_t channel          = harq_pdu->ul_cqi_information.channel;
-  int UE_id                = find_UE_id(mod_idP, rnti);
+  rnti_t rnti = harq_pdu->rx_ue_information.rnti;
+  uint8_t ul_cqi = harq_pdu->ul_cqi_information.ul_cqi;
+  uint8_t channel = harq_pdu->ul_cqi_information.channel;
+  int UE_id = find_UE_id(mod_idP, rnti);
   if (UE_id == -1) {
     LOG_W(MAC, "harq_indication: UE %x not found\n", rnti);
     return;
   }
-  UE_list_t *UE_list       = &RC.mac[mod_idP]->UE_list;
+  UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
   UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-  COMMON_channels_t *cc    = &RC.mac[mod_idP]->common_channels[CC_idP];
-    // extract HARQ Information
-  LOG_D(MAC,"Frame %d, subframe %d: Received harq indication (%d) from UE %d/%x, ul_cqi %d\n",frameP,subframeP,channel,UE_id,rnti,ul_cqi);
-  if (cc->tdd_Config) extract_harq(mod_idP,CC_idP,UE_id,frameP,subframeP,(void*)&harq_pdu->harq_indication_tdd_rel13,channel);
-  else                extract_harq(mod_idP,CC_idP,UE_id,frameP,subframeP,(void*)&harq_pdu->harq_indication_fdd_rel13,channel);
-  if (channel == 0) {
-    sched_ctl->pucch1_snr[CC_idP]       = ul_cqi;
+  COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP];
+  // extract HARQ Information
+  LOG_D(MAC,
+	"Frame %d, subframe %d: Received harq indication (%d) from UE %d/%x, ul_cqi %d\n",
+	frameP, subframeP, channel, UE_id, rnti, ul_cqi);
+  if (cc->tdd_Config)
+    extract_harq(mod_idP, CC_idP, UE_id, frameP, subframeP,
+		 (void *) &harq_pdu->harq_indication_tdd_rel13,
+		 channel);
+  else
+    extract_harq(mod_idP, CC_idP, UE_id, frameP, subframeP,
+		 (void *) &harq_pdu->harq_indication_fdd_rel13,
+		 channel);
+  /* don't care about cqi reporting if NACK/DTX is there */
+  if (channel == 0 && !nack_or_dtx_reported(cc, harq_pdu)) {
+    sched_ctl->pucch1_snr[CC_idP] = ul_cqi;
     sched_ctl->pucch1_cqi_update[CC_idP] = 1;
   }
 }
+
+// Flexran Slicing functions
+
+uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs)
+{
+    return (uint16_t) floor(rb_percentage * total_rbs);
+}
+
+int ue_slice_membership(int UE_id, int slice_id)
+{
+  if ((slice_id < 0) || (slice_id > n_active_slices))
+    LOG_W(MAC, "out of range slice id %d\n", slice_id);
+
+
+  if ((UE_id % n_active_slices) == slice_id) {
+    return 1;	// this ue is a member of this slice
+  }
+  return 0;
+}
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index 5b9c02544265ff2b7e9a105c40bcd3bdb6af929a..b4fb025ea479c5b5b42291af6f88509daa8be6c5 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,6 +29,8 @@
 
  */
 
+/* indented with: indent -kr eNB_scheduler_RA.c */
+
 #include "assertions.h"
 #include "PHY/defs.h"
 #include "PHY/extern.h"
@@ -52,640 +54,778 @@
 #include "pdcp.h"
 
 #if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+#include "intertask_interface.h"
 #endif
 
+#include "ENB_APP/flexran_agent_defs.h"
+#include "flexran_agent_ran_api.h"
+#include "header.pb-c.h"
+#include "flexran.pb-c.h"
+#include "flexran_agent_mac.h"
+#include <dlfcn.h>
+
 #include "T.h"
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
 #define DEBUG_eNB_SCHEDULER 1
 
-// This table holds the allowable PRB sizes for ULSCH transmissions
-uint8_t rb_table[34] = {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,64,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 uint16_t    timing_advance,
-	    const uint8_t     ul_cqi) {
+extern int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req);
+extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
+extern uint16_t sfnsf_add_subframe(uint16_t frameP, uint16_t subframeP, int offset);
+extern int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req);
+extern uint8_t nfapi_mode;
 
+extern uint8_t nfapi_mode;
 
-  unsigned char  rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr;
-  unsigned char  rx_lcids[NB_RB_MAX];
+// This table holds the allowable PRB sizes for ULSCH transmissions
+uint8_t rb_table[34] =
+  { 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, 64, 72, 75, 80, 81, 90, 96, 100
+  };
+
+/* number of active slices for  past and current time*/
+int n_active_slices_uplink = 1;
+int n_active_slices_current_uplink = 1;
+
+/* RB share for each slice for past and current time*/
+float avg_slice_percentage_uplink=0.25;
+float slice_percentage_uplink[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
+float slice_percentage_current_uplink[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
+float total_slice_percentage_uplink = 0;
+float total_slice_percentage_current_uplink = 0;
+
+// MAX MCS for each slice for past and current time
+int slice_maxmcs_uplink[MAX_NUM_SLICES] = {20, 20, 20, 20};
+int slice_maxmcs_current_uplink[MAX_NUM_SLICES] = {20,20,20,20};
+
+/*resource blocks allowed*/
+uint16_t         nb_rbs_allowed_slice_uplink[MAX_NUM_CCs][MAX_NUM_SLICES];
+/*Slice Update */
+int update_ul_scheduler[MAX_NUM_SLICES] = {1, 1, 1, 1};
+int update_ul_scheduler_current[MAX_NUM_SLICES] = {1, 1, 1, 1};
+
+/* name of available scheduler*/
+char *ul_scheduler_type[MAX_NUM_SLICES] = {"schedule_ulsch_rnti",
+					   "schedule_ulsch_rnti",
+					   "schedule_ulsch_rnti",
+					   "schedule_ulsch_rnti"
+};
+
+/* Slice Function Pointer */
+slice_scheduler_ul slice_sched_ul[MAX_NUM_SLICES] = {0};
+
+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 uint16_t timing_advance, const uint8_t ul_cqi)
+{
+  int current_rnti = rntiP;
+  unsigned char rx_ces[MAX_NUM_CE], num_ce, num_sdu, i, *payload_ptr;
+  unsigned char rx_lcids[NB_RB_MAX];
   unsigned short rx_lengths[NB_RB_MAX];
-  int    UE_id = find_UE_id(enb_mod_idP,rntiP);
+  int UE_id = find_UE_id(enb_mod_idP, current_rnti);
   int RA_id;
-  int ii,j;
-  eNB_MAC_INST *eNB = RC.mac[enb_mod_idP];
-  int    harq_pid = subframe2harqpid(&eNB->common_channels[CC_idP],frameP,subframeP);
-  
-  UE_list_t *UE_list= &eNB->UE_list;
-  int crnti_rx=0;
-  int old_buffer_info;
-  RA_TEMPLATE *RA_template = (RA_TEMPLATE *)&RC.mac[enb_mod_idP]->common_channels[CC_idP].RA_template[0];
+  int ii, j;
+  eNB_MAC_INST *mac = RC.mac[enb_mod_idP];
+  int harq_pid =
+    subframe2harqpid(&mac->common_channels[CC_idP], frameP, subframeP);
+  int lcgid_updated[4] = {0, 0, 0, 0};
+
+  UE_list_t *UE_list = &mac->UE_list;
+  int crnti_rx = 0;
+  RA_t *ra =
+    (RA_t *) & RC.mac[enb_mod_idP]->common_channels[CC_idP].ra[0];
   int first_rb = 0;
 
-  start_meas(&eNB->rx_ulsch_sdu);
+  start_meas(&mac->rx_ulsch_sdu);
 
-  if ((UE_id >  NUMBER_OF_UE_MAX) || (UE_id == -1)  )
-    for(ii=0; ii<NB_RB_MAX; ii++) {
+  if ((UE_id > NUMBER_OF_UE_MAX) || (UE_id == -1))
+    for (ii = 0; ii < NB_RB_MAX; ii++) {
       rx_lengths[ii] = 0;
     }
 
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,1);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+    (VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU, 1);
   if (opt_enabled == 1) {
-    trace_pdu(0, sduP,sdu_lenP, 0, 3, rntiP, frameP, subframeP, 0,0);
-    LOG_D(OPT,"[eNB %d][ULSCH] Frame %d  rnti %x  with size %d\n",
-    		  enb_mod_idP, frameP, rntiP, sdu_lenP);
+    trace_pdu(0, sduP, sdu_lenP, 0, 3, current_rnti, frameP, subframeP,
+	      0, 0);
+    LOG_D(OPT, "[eNB %d][ULSCH] Frame %d  rnti %x  with size %d\n",
+	  enb_mod_idP, frameP, current_rnti, sdu_lenP);
   }
-  
-
-  if (UE_id!=-1) {
-
-    LOG_D(MAC,"[eNB %d][PUSCH %d] CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",enb_mod_idP,harq_pid,CC_idP, UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],
-	  rntiP,UE_id,ul_cqi);
-
-    AssertFatal(UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] < 8,
-		"round >= 8\n");
-    if (sduP!=NULL) { 
-       UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer   = 0;
-       UE_list->UE_sched_ctrl[UE_id].ul_failure_timer      = 0;
-       UE_list->UE_sched_ctrl[UE_id].ul_scheduled         &= (~(1<<harq_pid));
-       /* don't take into account TA if timer is running */
-       if (UE_list->UE_sched_ctrl[UE_id].ta_timer == 0)
-         UE_list->UE_sched_ctrl[UE_id].ta_update             = timing_advance;
-       UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_idP]       = ul_cqi;
-       UE_list->UE_sched_ctrl[UE_id].ul_consecutive_errors = 0;
-       first_rb =  UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
-
-       if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) {
-         UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync=0;
-         mac_eNB_rrc_ul_in_sync(enb_mod_idP,CC_idP,frameP,subframeP,UE_RNTI(enb_mod_idP,UE_id));
-       }
-    }
-    else { // we've got an error
-      LOG_D(MAC,"[eNB %d][PUSCH %d] CC_id %d ULSCH in error in round %d, ul_cqi %d\n",enb_mod_idP,harq_pid,CC_idP,
-	        UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],ul_cqi);
+
+  if (UE_id != -1) {
+    LOG_D(MAC,
+	  "[eNB %d][PUSCH %d] CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
+	  enb_mod_idP, harq_pid, CC_idP,
+	  UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],
+	  current_rnti, UE_id, ul_cqi);
+
+    AssertFatal(UE_list->UE_sched_ctrl[UE_id].
+		round_UL[CC_idP][harq_pid] < 8, "round >= 8\n");
+    if (sduP != NULL) {
+      UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer = 0;
+      UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
+      UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1 << harq_pid));
+      /* Update with smoothing: 3/4 of old value and 1/4 of new.
+       * This is the logic that was done in the function
+       * lte_est_timing_advance_pusch, maybe it's not necessary?
+       * maybe it's even not correct at all?
+       */
+      UE_list->UE_sched_ctrl[UE_id].ta_update =	(UE_list->UE_sched_ctrl[UE_id].ta_update * 3 + timing_advance) / 4;
+      UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_idP] = ul_cqi;
+      UE_list->UE_sched_ctrl[UE_id].ul_consecutive_errors = 0;
+      first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
+
+      if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) {
+	UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0;
+	mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP,
+			       subframeP, UE_RNTI(enb_mod_idP,
+						  UE_id));
+      }
+
+      /* update scheduled bytes */
+      UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes -= UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid];
+      if (UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes < 0)
+        UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0;
+    } else {		// we've got an error
+      LOG_D(MAC,
+	    "[eNB %d][PUSCH %d] CC_id %d ULSCH in error in round %d, ul_cqi %d\n",
+	    enb_mod_idP, harq_pid, CC_idP,
+	    UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],
+	    ul_cqi);
 
       //      AssertFatal(1==0,"ulsch in error\n");
       if (UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] == 3) {
-	     UE_list->UE_sched_ctrl[UE_id].ul_scheduled       &= (~(1<<harq_pid));
-	     UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]=0;
-	     if (UE_list->UE_sched_ctrl[UE_id].ul_consecutive_errors++ == 10)
-            UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 1;
-      }
-      else UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++;
+	UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1 << harq_pid));
+	UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0;
+	if (UE_list->UE_sched_ctrl[UE_id].ul_consecutive_errors++ == 10)
+	  UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 1;
+
+        /* update scheduled bytes */
+        UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes -= UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid];
+        if (UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes < 0)
+          UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0;
+      } else
+	UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++;
       return;
 
     }
-  }
-  else if ((RA_id = find_RA_id(enb_mod_idP,CC_idP,rntiP))!=-1) { // Check if this is an RA process for the rnti
-    AssertFatal(eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx>1,
+  } else if ((RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti)) != -1) {	// Check if this is an RA process for the rnti
+    AssertFatal(mac->common_channels[CC_idP].
+		radioResourceConfigCommon->rach_ConfigCommon.
+		maxHARQ_Msg3Tx > 1,
 		"maxHARQ %d should be greater than 1\n",
-		(int)eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
-
-    LOG_D(MAC,"[eNB %d][PUSCH %d] CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n",enb_mod_idP,harq_pid,CC_idP,
-     RA_template[RA_id].msg3_round,
-     rntiP,RA_id,ul_cqi);
-
-    first_rb                   = RA_template->msg3_first_rb; 
-
-    if (sduP==NULL) { // we've got an error on Msg3
-      LOG_D(MAC,"[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n",enb_mod_idP,CC_idP,RA_id,
-	    RA_template[RA_id].msg3_round,
-	    (int)eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
-      if (RA_template[RA_id].msg3_round == eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx-1) { 
-	cancel_ra_proc(enb_mod_idP,CC_idP,frameP,rntiP);
+		(int) mac->common_channels[CC_idP].
+		radioResourceConfigCommon->rach_ConfigCommon.
+		maxHARQ_Msg3Tx);
+
+    LOG_D(MAC,
+	  "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n",
+	  enb_mod_idP, harq_pid, CC_idP, ra[RA_id].msg3_round,
+	  current_rnti, RA_id, ul_cqi);
+
+    first_rb = ra->msg3_first_rb;
+
+    if (sduP == NULL) {	// we've got an error on Msg3
+      LOG_D(MAC,
+	    "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n",
+	    enb_mod_idP, CC_idP, RA_id,
+	    ra[RA_id].msg3_round,
+	    (int) mac->common_channels[CC_idP].
+	    radioResourceConfigCommon->rach_ConfigCommon.
+	    maxHARQ_Msg3Tx);
+      if (ra[RA_id].msg3_round == mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
+	cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
       }
 
       else {
-        first_rb =  UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
-        RA_template[RA_id].msg3_round++;
-        // prepare handling of retransmission
-        RA_template[RA_id].Msg3_frame += ((RA_template[RA_id].Msg3_subframe>1) ? 1 : 0);
-        RA_template[RA_id].Msg3_subframe = (RA_template[RA_id].Msg3_subframe+8)%10;
-        add_msg3(enb_mod_idP,CC_idP, &RA_template[RA_id],frameP,subframeP);
+	first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
+	ra[RA_id].msg3_round++;
+	// prepare handling of retransmission
+	ra[RA_id].Msg3_frame    = (ra[RA_id].Msg3_frame + ((ra[RA_id].Msg3_subframe > 1) ? 1 : 0)) % 1024;
+	ra[RA_id].Msg3_subframe = (ra[RA_id].Msg3_subframe + 8) % 10;
+	add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP);
       }
       return;
     }
-  }
-  else  {
-    LOG_W(MAC,"Cannot find UE or RA corresponding to ULSCH rnti %x, dropping it\n",
-          rntiP);
+  } else {
+    LOG_W(MAC,
+	  "Cannot find UE or RA corresponding to ULSCH rnti %x, dropping it\n",
+	  current_rnti);
     return;
   }
-  payload_ptr = parse_ulsch_header(sduP,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,sdu_lenP);
+  payload_ptr = parse_ulsch_header(sduP, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths, sdu_lenP);
 
-  T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
+  T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP),
+    T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
     T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu));
-  T(T_ENB_MAC_UE_UL_PDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
-    T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu), T_BUFFER(sduP, sdu_lenP));
+  T(T_ENB_MAC_UE_UL_PDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP),
+    T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
+    T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu),
+    T_BUFFER(sduP, sdu_lenP));
 
-  eNB->eNB_stats[CC_idP].ulsch_bytes_rx=sdu_lenP;
-  eNB->eNB_stats[CC_idP].total_ulsch_bytes_rx+=sdu_lenP;
-  eNB->eNB_stats[CC_idP].total_ulsch_pdus_rx+=1;
+  mac->eNB_stats[CC_idP].ulsch_bytes_rx = sdu_lenP;
+  mac->eNB_stats[CC_idP].total_ulsch_bytes_rx += sdu_lenP;
+  mac->eNB_stats[CC_idP].total_ulsch_pdus_rx += 1;
 
   UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0;
 
   // control element
-  for (i=0; i<num_ce; i++) {
+  for (i = 0; i < num_ce; i++) {
 
-    T(T_ENB_MAC_UE_UL_CE, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
+    T(T_ENB_MAC_UE_UL_CE, T_INT(enb_mod_idP), T_INT(CC_idP),
+      T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
       T_INT(rx_ces[i]));
-    
-    switch (rx_ces[i]) { // implement and process BSR + CRNTI +
+
+    switch (rx_ces[i]) {	// implement and process BSR + CRNTI +
     case POWER_HEADROOM:
       if (UE_id != -1) {
-        UE_list->UE_template[CC_idP][UE_id].phr_info =  (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET;
-        LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : Received PHR PH = %d (db)\n",
-              enb_mod_idP, CC_idP, rx_ces[i], UE_list->UE_template[CC_idP][UE_id].phr_info);
-        UE_list->UE_template[CC_idP][UE_id].phr_info_configured=1;
+	UE_list->UE_template[CC_idP][UE_id].phr_info =
+	  (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET;
+	LOG_D(MAC,
+	      "[eNB %d] CC_id %d MAC CE_LCID %d : Received PHR PH = %d (db)\n",
+	      enb_mod_idP, CC_idP, rx_ces[i],
+	      UE_list->UE_template[CC_idP][UE_id].phr_info);
+	UE_list->UE_template[CC_idP][UE_id].phr_info_configured =
+	  1;
 	UE_list->UE_sched_ctrl[UE_id].phr_received = 1;
       }
-      payload_ptr+=sizeof(POWER_HEADROOM_CMD);
+      payload_ptr += sizeof(POWER_HEADROOM_CMD);
       break;
 
     case CRNTI:
-      UE_id = find_UE_id(enb_mod_idP,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1]);
-      LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
-	    frameP,subframeP,enb_mod_idP, CC_idP, rx_ces[i], i,num_ce,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1],UE_id);
-      if (UE_id!=-1) {
-	UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer=0;
-	UE_list->UE_sched_ctrl[UE_id].ul_failure_timer=0;
-	if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) {
-	  UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync=0;
-	  mac_eNB_rrc_ul_in_sync(enb_mod_idP,CC_idP,frameP,subframeP,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1]);
+      {
+	int old_rnti =
+	  (((uint16_t) payload_ptr[0]) << 8) + payload_ptr[1];
+	int old_UE_id = find_UE_id(enb_mod_idP, old_rnti);
+	LOG_D(MAC,
+	      "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
+	      enb_mod_idP, frameP, subframeP, CC_idP, rx_ces[i], i,
+	      num_ce, old_rnti, old_UE_id);
+	/* receiving CRNTI means that the current rnti has to go away */
+	cancel_ra_proc(enb_mod_idP, CC_idP, frameP,
+		       current_rnti);
+	if (old_UE_id != -1) {
+	  /* TODO: if the UE did random access (followed by a MAC uplink with
+	   * CRNTI) because none of its scheduling request was granted, then
+	   * according to 36.321 5.4.4 the UE's MAC will notify RRC to release
+	   * PUCCH/SRS. According to 36.331 5.3.13 the UE will then apply
+	   * default configuration for CQI reporting and scheduling requests,
+	   * which basically means that the CQI requests won't work anymore and
+	   * that the UE won't do any scheduling request anymore as long as the
+	   * eNB doesn't reconfigure the UE.
+	   * We have to take care of this. As the code is, nothing is done and
+	   * the UE state in the eNB is wrong.
+	   */
+	  UE_id = old_UE_id;
+	  UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer = 0;
+	  UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
+	  if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) {
+	    UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0;
+	    mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP,
+				   subframeP, old_rnti);
+	  }
+	  current_rnti = old_rnti;
 	}
-printf("TODO: deal with CRNTI\n");
-abort();
+	crnti_rx = 1;
+	payload_ptr += 2;
+	break;
       }
-      crnti_rx=1;
-      payload_ptr+=2;
-      /*
-      if (msg3_flagP != NULL) {
-	*msg3_flagP = 0;
-	}*/
-
-      break;
 
     case TRUNCATED_BSR:
-    case SHORT_BSR: {
-      uint8_t lcgid;
-      lcgid = (payload_ptr[0] >> 6);
-
-      LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
-	    enb_mod_idP, CC_idP, rx_ces[i], lcgid, payload_ptr[0] & 0x3f);
-
-      if (crnti_rx==1)
-	LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
-	      enb_mod_idP, CC_idP, rx_ces[i], lcgid, payload_ptr[0] & 0x3f);
-      if (UE_id  != -1) {
-
-        UE_list->UE_template[CC_idP][UE_id].bsr_info[lcgid] = (payload_ptr[0] & 0x3f);
-
-	// update buffer info
-	
-	UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]=BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].bsr_info[lcgid]];
-
-	UE_list->UE_template[CC_idP][UE_id].ul_total_buffer= UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid];
-
-	RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr[UE_id][(frameP*10)+subframeP] = (payload_ptr[0] & 0x3f);
-	if (UE_id == UE_list->head)
-	  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr[UE_id][(frameP*10)+subframeP]);	
-        if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] == 0 ) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid]=frameP;
-        }
-	if (mac_eNB_get_rrc_status(enb_mod_idP,UE_RNTI(enb_mod_idP,UE_id)) < RRC_CONNECTED)
-	  LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : ul_total_buffer = %d (lcg increment %d)\n",
-		enb_mod_idP, CC_idP, rx_ces[i], UE_list->UE_template[CC_idP][UE_id].ul_total_buffer,
-		UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]);	
-      }
-      else {
+    case SHORT_BSR:
+      {
+	uint8_t lcgid;
+	lcgid = (payload_ptr[0] >> 6);
+
+	LOG_D(MAC,
+	      "[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
+	      enb_mod_idP, CC_idP, rx_ces[i], lcgid,
+	      payload_ptr[0] & 0x3f);
+
+	if (crnti_rx == 1)
+	  LOG_D(MAC,
+		"[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
+		enb_mod_idP, CC_idP, rx_ces[i], lcgid,
+		payload_ptr[0] & 0x3f);
+	if (UE_id != -1) {
+          int bsr = payload_ptr[0] & 0x3f;
+
+          lcgid_updated[lcgid] = 1;
+
+          // update buffer info
+          UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid] = BSR_TABLE[bsr];
+
+          UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer =
+              UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] +
+              UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] +
+              UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] +
+              UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3];
+          //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4;
+
+	  RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = (payload_ptr[0] & 0x3f);
+	  if (UE_id == UE_list->head)
+	    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,
+						    RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr
+						    [UE_id][(frameP * 10) + subframeP]);
+	  if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] == 0) {
+	    UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] = frameP;
+	  }
+	  if (mac_eNB_get_rrc_status(enb_mod_idP,UE_RNTI(enb_mod_idP, UE_id)) < RRC_CONNECTED)
+	    LOG_D(MAC,
+		  "[eNB %d] CC_id %d MAC CE_LCID %d : estimated_ul_buffer = %d (lcg increment %d)\n",
+		  enb_mod_idP, CC_idP, rx_ces[i],
+		  UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer,
+		  UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]);
+	} else {
 
+	}
+	payload_ptr += 1;	//sizeof(SHORT_BSR); // fixme
       }
-      payload_ptr += 1;//sizeof(SHORT_BSR); // fixme
-    }
-    break;
+      break;
 
     case LONG_BSR:
-      if (UE_id  != -1) {
-        UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0] = ((payload_ptr[0] & 0xFC) >> 2);
-        UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1] =
-          ((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4);
-        UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID2] =
-          ((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6);
-        UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID3] = (payload_ptr[2] & 0x3F);
-
-	// update buffer info
-	old_buffer_info = UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0];
-	UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0]=BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0]];
-
-	UE_list->UE_template[CC_idP][UE_id].ul_total_buffer+= UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0];
-	if (UE_list->UE_template[CC_idP][UE_id].ul_total_buffer >= old_buffer_info)
-	  UE_list->UE_template[CC_idP][UE_id].ul_total_buffer -= old_buffer_info;
-	else
-	  UE_list->UE_template[CC_idP][UE_id].ul_total_buffer = 0;
-
-	old_buffer_info = UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1];
-	UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1]=BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1]];
-	UE_list->UE_template[CC_idP][UE_id].ul_total_buffer+= UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1];
-	if (UE_list->UE_template[CC_idP][UE_id].ul_total_buffer >= old_buffer_info)
-	  UE_list->UE_template[CC_idP][UE_id].ul_total_buffer -= old_buffer_info;
-	else
-	  UE_list->UE_template[CC_idP][UE_id].ul_total_buffer = 0;
-
-	old_buffer_info = UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2];
-	UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2]=BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID2]];
-	UE_list->UE_template[CC_idP][UE_id].ul_total_buffer+= UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2];
-	if (UE_list->UE_template[CC_idP][UE_id].ul_total_buffer >= old_buffer_info)
-	  UE_list->UE_template[CC_idP][UE_id].ul_total_buffer -= old_buffer_info;
-	else
-	  UE_list->UE_template[CC_idP][UE_id].ul_total_buffer = 0;
-
-	old_buffer_info = UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3];
-	UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]=BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID3]];
-	UE_list->UE_template[CC_idP][UE_id].ul_total_buffer+= UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3];
-	if (UE_list->UE_template[CC_idP][UE_id].ul_total_buffer >= old_buffer_info)
-	  UE_list->UE_template[CC_idP][UE_id].ul_total_buffer -= old_buffer_info;
-	else
-	  UE_list->UE_template[CC_idP][UE_id].ul_total_buffer = 0;
-
-        LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR LCGID0 = %u LCGID1 = "
-              "%u LCGID2 = %u LCGID3 = %u\n",
-              enb_mod_idP, CC_idP,
-              rx_ces[i],
-              UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0],
-              UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1],
-              UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID2],
-              UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID3]);
-      if (crnti_rx==1)
-        LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR LCGID0 = %u LCGID1 = "
-              "%u LCGID2 = %u LCGID3 = %u\n",
-              enb_mod_idP, CC_idP,
+      if (UE_id != -1) {
+        int bsr0 = (payload_ptr[0] & 0xFC) >> 2;
+        int bsr1 = ((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4);
+        int bsr2 = ((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6);
+        int bsr3 = payload_ptr[2] & 0x3F;
+
+        lcgid_updated[0] = 1;
+        lcgid_updated[1] = 1;
+        lcgid_updated[2] = 1;
+        lcgid_updated[3] = 1;
+
+        // update buffer info
+        UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] = BSR_TABLE[bsr0];
+        UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] = BSR_TABLE[bsr1];
+        UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] = BSR_TABLE[bsr2];
+        UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3] = BSR_TABLE[bsr3];
+
+        UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer =
+            UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] +
+            UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] +
+            UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] +
+            UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3];
+        //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4;
+
+        LOG_D(MAC,
+              "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = "
+              "%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, CC_idP,
               rx_ces[i],
-              UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0],
-              UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1],
-              UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID2],
-              UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID3]);
-
-        if (UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0] == 0 ) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0]=0;
-        } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] == 0) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0]=frameP;
-        }
+              UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0],
+              UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1],
+              UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2],
+              UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]);
+        if (crnti_rx == 1)
+          LOG_D(MAC,
+                "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = "
+                "%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP,
+                CC_idP, rx_ces[i],
+                UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0],
+                UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1],
+                UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2],
+                UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]);
+
+	if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] == 0) {
+	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] = 0;
+	} else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] == 0) {
+	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] = frameP;
+	}
 
-        if (UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1] == 0 ) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1]=0;
-        } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] == 0) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1]=frameP;
-        }
+	if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] == 0) {
+	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] = 0;
+	} else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] == 0) {
+	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] = frameP;
+	}
 
-        if (UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID2] == 0 ) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2]=0;
-        } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] == 0) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2]=frameP;
-        }
+	if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] == 0) {
+	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] = 0;
+	} else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] == 0) {
+	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] = frameP;
+	}
 
-        if (UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID3] == 0 ) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3]= 0;
-        } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] == 0) {
-          UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3]=frameP;
+	if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3] == 0) {
+	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] = 0;
+	} else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] == 0) {
+	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] = frameP;
 
-        }
+	}
       }
 
-      payload_ptr += 3;////sizeof(LONG_BSR);
+      payload_ptr += 3;	////sizeof(LONG_BSR);
       break;
 
     default:
-      LOG_E(MAC, "[eNB %d] CC_id %d Received unknown MAC header (0x%02x)\n", enb_mod_idP, CC_idP, rx_ces[i]);
+      LOG_E(MAC,
+	    "[eNB %d] CC_id %d Received unknown MAC header (0x%02x)\n",
+	    enb_mod_idP, CC_idP, rx_ces[i]);
       break;
     }
   }
 
-  for (i=0; i<num_sdu; i++) {
-    LOG_D(MAC,"SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",i,rx_lcids[i],rx_lengths[i]);
+  for (i = 0; i < num_sdu; i++) {
+    LOG_D(MAC, "SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",
+	  i, rx_lcids[i], rx_lengths[i]);
 
-    T(T_ENB_MAC_UE_UL_SDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
+    T(T_ENB_MAC_UE_UL_SDU, T_INT(enb_mod_idP), T_INT(CC_idP),
+      T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
       T_INT(rx_lcids[i]), T_INT(rx_lengths[i]));
-    T(T_ENB_MAC_UE_UL_SDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP),
-      T_INT(rx_lcids[i]), T_INT(rx_lengths[i]), T_BUFFER(payload_ptr, rx_lengths[i]));
+    T(T_ENB_MAC_UE_UL_SDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP),
+      T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
+      T_INT(rx_lcids[i]), T_INT(rx_lengths[i]), T_BUFFER(payload_ptr,
+							 rx_lengths
+							 [i]));
 
     switch (rx_lcids[i]) {
-    case CCCH :
+    case CCCH:
       if (rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) {
-        LOG_E(MAC, "[eNB %d/%d] frame %d received CCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n",
-              enb_mod_idP, CC_idP, frameP, rx_lengths[i], CCCH_PAYLOAD_SIZE_MAX,sdu_lenP);
-        break;
+	LOG_E(MAC,
+	      "[eNB %d/%d] frame %d received CCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n",
+	      enb_mod_idP, CC_idP, frameP, rx_lengths[i],
+	      CCCH_PAYLOAD_SIZE_MAX, sdu_lenP);
+	break;
       }
-      LOG_D(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);
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,1);
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,0);
-      for (ii=0; ii<NB_RA_PROC_MAX; ii++) {
-	RA_TEMPLATE *RA_template = &eNB->common_channels[CC_idP].RA_template[ii];
-
-        LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), active %d\n",
-              enb_mod_idP, CC_idP, ii,
-              RA_template->rnti, rntiP,
-              RA_template->RA_active);
-
-        if ((RA_template->rnti==rntiP) &&
-            (RA_template->RA_active==TRUE)) {
-
-          //payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len);
-
-          if (UE_id < 0) {
-            memcpy(&RA_template->cont_res_id[0],payload_ptr,6);
-            LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3: length %d, offset %ld\n",
-                  enb_mod_idP,CC_idP,frameP,rx_lengths[i],payload_ptr-sduP);
-
-            if ((UE_id=add_new_ue(enb_mod_idP,CC_idP,eNB->common_channels[CC_idP].RA_template[ii].rnti,harq_pid
-                      #ifdef Rel14
-                        ,eNB->common_channels[CC_idP].RA_template[ii].rach_resource_type
-                      #endif
-                      )) == -1 ) {
-              AssertFatal(1==0,"[MAC][eNB] Max user count reached\n");
+      LOG_D(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], current_rnti);
+      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC, 1);
+      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC, 0);
+      for (ii = 0; ii < NB_RA_PROC_MAX; ii++) {
+	RA_t *ra = &mac->common_channels[CC_idP].ra[ii];
+
+	LOG_D(MAC,
+	      "[mac %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), state %d\n",
+	      enb_mod_idP, CC_idP, ii, ra->rnti,
+	      current_rnti, ra->state);
+
+	if ((ra->rnti == current_rnti) && (ra->state != IDLE)) {
+
+	  //payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len);
+
+	  if (UE_id < 0) {
+	    memcpy(&ra->cont_res_id[0], payload_ptr, 6);
+	    LOG_D(MAC,
+		  "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3: length %d, offset %ld\n",
+		  enb_mod_idP, CC_idP, frameP, rx_lengths[i],
+		  payload_ptr - sduP);
+
+	    if ((UE_id = add_new_ue(enb_mod_idP, CC_idP,
+				    mac->common_channels[CC_idP].
+				    ra[ii].rnti, harq_pid
+#ifdef Rel14
+				    ,
+				    mac->common_channels[CC_idP].
+				    ra[ii].rach_resource_type
+#endif
+				    )) == -1) {
+	      AssertFatal(1 == 0,
+			  "[MAC][eNB] Max user count reached\n");
 	      // kill RA procedure
-            } else
-              LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n",
-                    enb_mod_idP,CC_idP,frameP,RA_template->rnti,UE_id);
-          } else {
-            LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %ld\n",
-                  enb_mod_idP,CC_idP,frameP,UE_id,rx_lengths[i],payload_ptr-sduP);
+	    } else
+	      LOG_D(MAC,
+		    "[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n",
+		    enb_mod_idP, CC_idP, frameP, ra->rnti,
+		    UE_id);
+	  } else {
+	    LOG_D(MAC,
+		  "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %ld\n",
+		  enb_mod_idP, CC_idP, frameP, UE_id,
+		  rx_lengths[i], payload_ptr - sduP);
 	    // kill RA procedure
-          }
+	  }
 
-	  mac_rrc_data_ind(
-			   enb_mod_idP,
+	  mac_rrc_data_ind(enb_mod_idP,
 			   CC_idP,
-			   frameP,subframeP,
-			   rntiP,
+			   frameP, subframeP,
+			   current_rnti,
 			   CCCH,
-			   (uint8_t*)payload_ptr,
+			   (uint8_t *) payload_ptr,
 			   rx_lengths[i],
-			   ENB_FLAG_YES,
-			   enb_mod_idP,
-                           0
-                           );
-	  
-	  
-          if (num_ce >0) {  // handle msg3 which is not RRCConnectionRequest
-            //  process_ra_message(msg3,num_ce,rx_lcids,rx_ces);
-          }
+			   0);
+
 
+	  if (num_ce > 0) {	// handle msg3 which is not RRCConnectionRequest
+	    //  process_ra_message(msg3,num_ce,rx_lcids,rx_ces);
+	  }
 	  // prepare transmission of Msg4
-          RA_template->generate_Msg4 = 1;
-          RA_template->wait_ack_Msg4 = 0;
+	  ra->state = MSG4;
 
 
 
 	  // Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now, // Check if this is ok for BL/CE, or if the rule is different
-	  RA_template->Msg4_frame    = frameP + ((subframeP>5) ? 1 : 0);
-	  RA_template->Msg4_subframe = (subframeP+4)%10;
-	  
-        } // if process is active
-      } // loop on RA processes
-      
-      break ;
-
-    case DCCH :
-    case DCCH1 :
+	  ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0);
+	  ra->Msg4_subframe = (subframeP + 4) % 10;
+
+	}		// if process is active
+      }			// loop on RA processes
+
+      break;
+
+    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, "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");
+      LOG_T(MAC, "\n");
 #endif
 
       if (UE_id != -1) {
-	// adjust buffer occupancy of the correponding logical channel group
-	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;
-
-          LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n",
-                enb_mod_idP,CC_idP,frameP, rx_lengths[i], UE_id, rx_lcids[i]);
-
-          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];
+        if (lcgid_updated[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] == 0) {
+	  // adjust buffer occupancy of the correponding logical channel group
+	  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;
+
+          UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer =
+          UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] +
+          UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] +
+          UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] +
+          UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3];
+          //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4;
+        }
+
+	LOG_D(MAC,
+	      "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n",
+	      enb_mod_idP, CC_idP, frameP, rx_lengths[i], UE_id,
+	      rx_lcids[i]);
+
+	mac_rlc_data_ind(enb_mod_idP, current_rnti, 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];
 
 
-      } /* UE_id != -1 */
+      }
 
- 
-      // } 
+      /* UE_id != -1 */
+      // }
       break;
 
       // all the DRBS
     case DTCH:
-    default :
+    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, "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");
+      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 (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 %ld, %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);
+	  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 %ld, %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 (lcgid_updated[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] == 0) {
+	    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;
+
+            UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer =
+               UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] +
+               UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] +
+               UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] +
+               UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3];
+            //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4;
+          }
+
+	  if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) {	// MAX SIZE OF transport block
+	    mac_rlc_data_ind(enb_mod_idP, current_rnti, 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];
+	    //clear uplane_inactivity_timer
+	    UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
+	  } 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*/ 
-	  LOG_E(MAC,"[eNB %d] CC_id %d Frame %d : received unsupported or unknown LCID %d from UE %d ",
+	} else {	/*(UE_id != -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];
+
+    payload_ptr += rx_lengths[i];
   }
 
   // Program ACK for PHICH
-  LOG_D(MAC,"Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",rntiP,harq_pid,first_rb);
-  nfapi_hi_dci0_request_body_t   *hi_dci0_req = &eNB->HI_DCI0_req[CC_idP].hi_dci0_request_body;
-  nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi]; 	
-  memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
-  hi_dci0_pdu->pdu_type                                               = NFAPI_HI_DCI0_HI_PDU_TYPE; 
-  hi_dci0_pdu->pdu_size                                               = 2+sizeof(nfapi_hi_dci0_hi_pdu);
-  hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start                = first_rb; 
-  hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms             = 0;
-  hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value                            = 1;
-  hi_dci0_req->number_of_hi++;
-																	
+  LOG_D(MAC,
+	"Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",
+	current_rnti, harq_pid, first_rb);
+  nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_idP];
+  nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
+  nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
+    &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
+  memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t));
+  hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
+  hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_hi_pdu);
+  hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
+  hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = first_rb;
+  hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = 0;
+  hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 1;
+  hi_dci0_req_body->number_of_hi++;
+  hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP,subframeP, 0);
+  hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
+  hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, 4);
+  hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
+
   /* NN--> FK: we could either check the payload, or use a phy helper to detect a false msg3 */
-  if ((num_sdu == 0) && (num_ce==0)) {
+  if ((num_sdu == 0) && (num_ce == 0)) {
     if (UE_id != -1)
-      UE_list->eNB_UE_stats[CC_idP][UE_id].total_num_errors_rx+=1;
+      UE_list->eNB_UE_stats[CC_idP][UE_id].total_num_errors_rx += 1;
     /*
-    if (msg3_flagP != NULL) {
+      if (msg3_flagP != NULL) {
       if( *msg3_flagP == 1 ) {
-        LOG_N(MAC,"[eNB %d] CC_id %d frame %d : false msg3 detection: signal phy to canceling RA and remove the UE\n", enb_mod_idP, CC_idP, frameP);
-        *msg3_flagP=0;
+      LOG_N(MAC,"[eNB %d] CC_id %d frame %d : false msg3 detection: signal phy to canceling RA and remove the UE\n", enb_mod_idP, CC_idP, frameP);
+      *msg3_flagP=0;
       }
-      }*/
+      } */
   } else {
     if (UE_id != -1) {
-      UE_list->eNB_UE_stats[CC_idP][UE_id].pdu_bytes_rx=sdu_lenP;
-      UE_list->eNB_UE_stats[CC_idP][UE_id].total_pdu_bytes_rx+=sdu_lenP;
-      UE_list->eNB_UE_stats[CC_idP][UE_id].total_num_pdus_rx+=1;
+      UE_list->eNB_UE_stats[CC_idP][UE_id].pdu_bytes_rx        = sdu_lenP;
+      UE_list->eNB_UE_stats[CC_idP][UE_id].total_pdu_bytes_rx += sdu_lenP;
+      UE_list->eNB_UE_stats[CC_idP][UE_id].total_num_pdus_rx  += 1;
     }
   }
 
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,0);
-  stop_meas(&eNB->rx_ulsch_sdu);
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU, 0);
+  stop_meas(&mac->rx_ulsch_sdu);
 }
 
-
 uint32_t bytes_to_bsr_index(int32_t nbytes)
 {
+  uint32_t i = 0;
 
-  uint32_t i=0;
-
-  if (nbytes<0) {
-    return(0);
+  if (nbytes < 0) {
+    return (0);
   }
 
-  while ((i<BSR_TABLE_SIZE)&&
-         (BSR_TABLE[i]<=nbytes)) {
+  while ((i < BSR_TABLE_SIZE) && (BSR_TABLE[i] <= nbytes)) {
     i++;
   }
 
-  return(i-1);
+  return (i - 1);
 }
 
-void add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id, sub_frame_t subframeP, UE_ULSCH_STATUS status)
+void
+add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id,
+		  sub_frame_t subframeP, UE_ULSCH_STATUS status)
 {
-
-  eNB_ulsch_info[module_idP][CC_id][UE_id].rnti             = UE_RNTI(module_idP,UE_id);
-  eNB_ulsch_info[module_idP][CC_id][UE_id].subframe         = subframeP;
-  eNB_ulsch_info[module_idP][CC_id][UE_id].status           = status;
+  eNB_ulsch_info[module_idP][CC_id][UE_id].rnti     = UE_RNTI(module_idP, UE_id);
+  eNB_ulsch_info[module_idP][CC_id][UE_id].subframe = subframeP;
+  eNB_ulsch_info[module_idP][CC_id][UE_id].status   = status;
 
   eNB_ulsch_info[module_idP][CC_id][UE_id].serving_num++;
-
 }
 
 unsigned char *parse_ulsch_header(unsigned char *mac_header,
-                                  unsigned char *num_ce,
-                                  unsigned char *num_sdu,
-                                  unsigned char *rx_ces,
-                                  unsigned char *rx_lcids,
-                                  unsigned short *rx_lengths,
-                                  unsigned short tb_length)
+				  unsigned char *num_ce,
+				  unsigned char *num_sdu,
+				  unsigned char *rx_ces,
+				  unsigned char *rx_lcids,
+				  unsigned short *rx_lengths,
+				  unsigned short tb_length)
 {
-
-  unsigned char not_done=1,num_ces=0,num_sdus=0,lcid,num_sdu_cnt;
+  unsigned char not_done = 1, num_ces = 0, num_sdus =
+    0, lcid, num_sdu_cnt;
   unsigned char *mac_header_ptr = mac_header;
-  unsigned short length, ce_len=0;
+  unsigned short length, ce_len = 0;
 
-  while (not_done==1) {
+  while (not_done == 1) {
 
-    if (((SCH_SUBHEADER_FIXED*)mac_header_ptr)->E == 0) {
+    if (((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E == 0) {
       not_done = 0;
     }
 
-    lcid = ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID;
+    lcid = ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID;
 
     if (lcid < EXTENDED_POWER_HEADROOM) {
-      if (not_done==0) { // last MAC SDU, length is implicit
-        mac_header_ptr++;
-        length = tb_length-(mac_header_ptr-mac_header)-ce_len;
+      if (not_done == 0) {	// last MAC SDU, length is implicit
+	mac_header_ptr++;
+	length = tb_length - (mac_header_ptr - mac_header) - ce_len;
 
-        for (num_sdu_cnt=0; num_sdu_cnt < num_sdus ; num_sdu_cnt++) {
-          length -= rx_lengths[num_sdu_cnt];
-        }
+	for (num_sdu_cnt = 0; num_sdu_cnt < num_sdus;
+	     num_sdu_cnt++) {
+	  length -= rx_lengths[num_sdu_cnt];
+	}
       } else {
-        if (((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F == 0) {
-          length = ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L;
-          mac_header_ptr += 2;//sizeof(SCH_SUBHEADER_SHORT);
-        } else { // F = 1
-          length = ((((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_MSB & 0x7f ) << 8 ) | (((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_LSB & 0xff);
-          mac_header_ptr += 3;//sizeof(SCH_SUBHEADER_LONG);
-        }
+	if (((SCH_SUBHEADER_SHORT *) mac_header_ptr)->F == 0) {
+	  length = ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L;
+	  mac_header_ptr += 2;	//sizeof(SCH_SUBHEADER_SHORT);
+	} else {	// F = 1
+	  length =
+	    ((((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_MSB &
+	      0x7f) << 8) | (((SCH_SUBHEADER_LONG *)
+			      mac_header_ptr)->L_LSB & 0xff);
+	  mac_header_ptr += 3;	//sizeof(SCH_SUBHEADER_LONG);
+	}
       }
 
-      LOG_D(MAC,"[eNB] sdu %d lcid %d tb_length %d length %d (offset now %ld)\n",
-            num_sdus,lcid,tb_length, length,mac_header_ptr-mac_header);
+      LOG_D(MAC,
+	    "[eNB] sdu %d lcid %d tb_length %d length %d (offset now %ld)\n",
+	    num_sdus, lcid, tb_length, length,
+	    mac_header_ptr - mac_header);
       rx_lcids[num_sdus] = lcid;
       rx_lengths[num_sdus] = length;
       num_sdus++;
-    } else { // This is a control element subheader POWER_HEADROOM, BSR and CRNTI
+    } else {		// This is a control element subheader POWER_HEADROOM, BSR and CRNTI
       if (lcid == SHORT_PADDING) {
-        mac_header_ptr++;
+	mac_header_ptr++;
       } else {
-        rx_ces[num_ces] = lcid;
-        num_ces++;
-        mac_header_ptr++;
-
-        if (lcid==LONG_BSR) {
-          ce_len+=3;
-        } else if (lcid==CRNTI) {
-          ce_len+=2;
-        } else if ((lcid==POWER_HEADROOM) || (lcid==TRUNCATED_BSR)|| (lcid== SHORT_BSR)) {
-          ce_len++;
-        } else {
-          LOG_E(MAC,"unknown CE %d \n", lcid);
-          AssertFatal(1==0,"unknown CE");
-        }
+	rx_ces[num_ces] = lcid;
+	num_ces++;
+	mac_header_ptr++;
+
+	if (lcid == LONG_BSR) {
+	  ce_len += 3;
+	} else if (lcid == CRNTI) {
+	  ce_len += 2;
+	} else if ((lcid == POWER_HEADROOM)
+		   || (lcid == TRUNCATED_BSR)
+		   || (lcid == SHORT_BSR)) {
+	  ce_len++;
+	} else {
+	  LOG_E(MAC, "unknown CE %d \n", lcid);
+	  AssertFatal(1 == 0, "unknown CE");
+	}
       }
     }
   }
@@ -693,7 +833,7 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
   *num_ce = num_ces;
   *num_sdu = num_sdus;
 
-  return(mac_header_ptr);
+  return (mac_header_ptr);
 }
 
 /* This function is called by PHY layer when it schedules some
@@ -701,98 +841,108 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
  * The MAC scheduler has to skip the RBs used by this message 3
  * (done below in schedule_ulsch).
  */
-void set_msg3_subframe(module_id_t Mod_id,
-                       int CC_id,
-                       int frame,
-                       int subframe,
-                       int rnti,
-                       int Msg3_frame,
-                       int Msg3_subframe)
+void
+set_msg3_subframe(module_id_t mod_id,
+		  int CC_id,
+		  int frame,
+		  int subframe, int rnti, int Msg3_frame,
+		  int Msg3_subframe)
 {
-  eNB_MAC_INST *eNB=RC.mac[Mod_id];
+  eNB_MAC_INST *mac = RC.mac[mod_id];
   int i;
-  for (i=0; i<NB_RA_PROC_MAX; i++) {
-    if (eNB->common_channels[CC_id].RA_template[i].RA_active == TRUE &&
-        eNB->common_channels[CC_id].RA_template[i].rnti == rnti) {
-      eNB->common_channels[CC_id].RA_template[i].Msg3_subframe = Msg3_subframe;
+  for (i = 0; i < NB_RA_PROC_MAX; i++) {
+    if (mac->common_channels[CC_id].ra[i].state != IDLE &&
+	mac->common_channels[CC_id].ra[i].rnti == rnti) {
+      mac->common_channels[CC_id].ra[i].Msg3_subframe =
+	Msg3_subframe;
       break;
     }
   }
 }
 
-
-void schedule_ulsch(module_id_t module_idP, 
-		    frame_t frameP,
-		    sub_frame_t subframeP) { 
-
-
-
-
-
-  uint16_t first_rb[MAX_NUM_CCs],i;
+void
+schedule_ulsch(module_id_t module_idP, frame_t frameP,
+	       sub_frame_t subframeP)
+{
+  uint16_t first_rb[MAX_NUM_CCs], i;
   int CC_id;
-  eNB_MAC_INST *eNB=RC.mac[module_idP];
+  eNB_MAC_INST *mac = RC.mac[module_idP];
   COMMON_channels_t *cc;
 
-  start_meas(&eNB->schedule_ulsch);
-
+  start_meas(&mac->schedule_ulsch);
 
-  int sched_subframe = (subframeP+4)%10;
+  int sched_subframe = (subframeP + 4) % 10;
 
-  cc = &eNB->common_channels[0];
+  cc = &mac->common_channels[0];
   int tdd_sfa;
   // for TDD: check subframes where we have to act and return if nothing should be done now
   if (cc->tdd_Config) {
     tdd_sfa = cc->tdd_Config->subframeAssignment;
     switch (subframeP) {
     case 0:
-      if ((tdd_sfa == 0)||
-	  (tdd_sfa == 3)||
-	  (tdd_sfa == 6)) sched_subframe = 4;
-      else return;
+      if ((tdd_sfa == 0) || (tdd_sfa == 3) || (tdd_sfa == 6))
+	sched_subframe = 4;
+      else
+	return;
       break;
     case 1:
-      if ((tdd_sfa==0)||
-	  (tdd_sfa==1)) sched_subframe = 7;
-      else if (tdd_sfa==6) sched_subframe = 8;
+      if ((tdd_sfa == 0) || (tdd_sfa == 1))
+	sched_subframe = 7;
+      else if (tdd_sfa == 6)
+	sched_subframe = 8;
       break;
     default:
       return;
 
-    case 2: // Don't schedule UL in subframe 2 for TDD
+    case 2:		// Don't schedule UL in subframe 2 for TDD
       return;
     case 3:
-      if (tdd_sfa==2) sched_subframe = 7;
-      else return;
+      if (tdd_sfa == 2)
+	sched_subframe = 7;
+      else
+	return;
       break;
     case 4:
-      if (tdd_sfa==1) sched_subframe = 8;
-      else return;
+      if (tdd_sfa == 1)
+	sched_subframe = 8;
+      else
+	return;
       break;
     case 5:
-      if (tdd_sfa==0)      sched_subframe = 9;
-      else if (tdd_sfa==6) sched_subframe = 3;
-      else return;
+      if (tdd_sfa == 0)
+	sched_subframe = 9;
+      else if (tdd_sfa == 6)
+	sched_subframe = 3;
+      else
+	return;
       break;
     case 6:
-      if (tdd_sfa==1)      sched_subframe = 2;
-      else if (tdd_sfa==6) sched_subframe = 3;
-      else return;
+      if (tdd_sfa == 1)
+	sched_subframe = 2;
+      else if (tdd_sfa == 6)
+	sched_subframe = 3;
+      else
+	return;
       break;
     case 7:
       return;
     case 8:
-      if ((tdd_sfa>=2) || (tdd_sfa<=5)) sched_subframe=2;
-      else return;
+      if ((tdd_sfa >= 2) || (tdd_sfa <= 5))
+	sched_subframe = 2;
+      else
+	return;
       break;
     case 9:
-      if ((tdd_sfa==1) || (tdd_sfa==3) || (tdd_sfa==4)) sched_subframe=3;
-      else if (tdd_sfa==6) sched_subframe=4;
-      else return;
+      if ((tdd_sfa == 1) || (tdd_sfa == 3) || (tdd_sfa == 4))
+	sched_subframe = 3;
+      else if (tdd_sfa == 6)
+	sched_subframe = 4;
+      else
+	return;
       break;
     }
   }
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
 
 
 
@@ -812,117 +962,204 @@ void schedule_ulsch(module_id_t module_idP,
     // Msg3 is using 1 PRB so we need to increase first_rb accordingly
     // not sure about the break (can there be more than 1 active RA procedure?)
 
-    
-    for (i=0; i<NB_RA_PROC_MAX; i++) {
-      if ((cc->RA_template[i].RA_active == TRUE) &&
-          (cc->RA_template[i].generate_rar == 0) &&
-          (cc->RA_template[i].generate_Msg4 == 0) &&
-          (cc->RA_template[i].wait_ack_Msg4 == 0) &&
-          (cc->RA_template[i].Msg3_subframe == sched_subframe)) {
-        first_rb[CC_id]++;
-	//    cc->RA_template[i].Msg3_subframe = -1;
-        break;
+    for (i = 0; i < NB_RA_PROC_MAX; i++) {
+      if ((cc->ra[i].state == WAITMSG3) &&
+	  (cc->ra[i].Msg3_subframe == sched_subframe)) {
+	first_rb[CC_id]++;
+	//    cc->ray[i].Msg3_subframe = -1;
+	break;
       }
     }
   }
 
-  schedule_ulsch_rnti(module_idP, frameP, subframeP, sched_subframe,first_rb);
-
-  stop_meas(&eNB->schedule_ulsch);
-
-}
-
+  // perform slice-specifc operations
 
+  total_slice_percentage_uplink=0;
+  avg_slice_percentage_uplink=1.0/n_active_slices_uplink;
 
-void schedule_ulsch_rnti(module_id_t   module_idP,
-                         frame_t       frameP,
-                         sub_frame_t   subframeP,
-                         unsigned char sched_subframeP,
-                         uint16_t     *first_rb)
-{
+  // reset the slice percentage for inactive slices
+  for (i = n_active_slices_uplink; i< MAX_NUM_SLICES; i++) {
+    slice_percentage_uplink[i]=0;
+  }
+  for (i = 0; i < n_active_slices_uplink; i++) {
+    if (slice_percentage_uplink[i] < 0 ){
+      LOG_W(MAC, "[eNB %d] frame %d subframe %d:invalid slice %d percentage %f. resetting to zero",
+            module_idP, frameP, subframeP, i, slice_percentage_uplink[i]);
+      slice_percentage_uplink[i]=0;
+    }
+    total_slice_percentage_uplink+=slice_percentage_uplink[i];
+  }
 
-  int               UE_id;
-  uint8_t           aggregation    = 2;
-  rnti_t            rnti           = -1;
-  uint8_t           round          = 0;
-  uint8_t           harq_pid       = 0;
-  uint8_t           status         = 0; 
-  uint8_t           rb_table_index = -1;
-  uint32_t          cqi_req,cshift,ndi,tpc;
-  int32_t           normalized_rx_power;
-  int32_t           target_rx_power=-90;
-  static int32_t    tpc_accumulated=0;
-  int               n;
-  int               CC_id = 0;
-  int               drop_ue=0;
-  int               N_RB_UL;
-  eNB_MAC_INST      *eNB = RC.mac[module_idP];
-  COMMON_channels_t *cc  = eNB->common_channels;
-  UE_list_t         *UE_list=&eNB->UE_list;
-  UE_TEMPLATE       *UE_template;
-  UE_sched_ctrl     *UE_sched_ctrl;
-  int               tmode;
-  int               sched_frame=frameP;
-  int               rvidx_tab[4] = {0,2,3,1};
-
-  if (sched_subframeP<subframeP) sched_frame++;
-
-  nfapi_hi_dci0_request_body_t   *hi_dci0_req = &eNB->HI_DCI0_req[CC_id].hi_dci0_request_body;
-  nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu;
+  for (i = 0; i < n_active_slices_uplink; i++) {
+
+    // Load any updated functions
+    if (update_ul_scheduler[i] > 0 ) {
+      slice_sched_ul[i] = dlsym(NULL, ul_scheduler_type[i]);
+      update_ul_scheduler[i] = 0;
+      update_ul_scheduler_current[i] = 0;
+      //slice_percentage_current_uplink[i]= slice_percentage_uplink[i];
+      //total_slice_percentage_current_uplink+=slice_percentage_uplink[i];
+      //if (total_slice_percentage_current_uplink> 1)
+      //total_slice_percentage_current_uplink=1;
+      LOG_N(MAC,"update ul scheduler slice %d\n", i);
+    }
+    // the new total RB share is within the range
+    if (total_slice_percentage_uplink <= 1.0){
+
+      // check if the number of slices has changed, and log
+      if (n_active_slices_current_uplink != n_active_slices_uplink ){
+        if ((n_active_slices_uplink > 0) && (n_active_slices_uplink <= MAX_NUM_SLICES)) {
+          LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active UL slices has changed: %d-->%d\n",
+                module_idP, frameP, subframeP, n_active_slices_current_uplink, n_active_slices_uplink);
+          n_active_slices_current_uplink = n_active_slices_uplink;
+        } else {
+          LOG_W(MAC,"invalid number of UL slices %d, revert to the previous value %d\n",
+                n_active_slices_uplink, n_active_slices_current_uplink);
+          n_active_slices_uplink = n_active_slices_current_uplink;
+        }
+      }
 
-  nfapi_ul_config_request_pdu_t  *ul_config_pdu;
+      // check if the slice rb share has changed, and log the console
+      if (slice_percentage_current_uplink[i] != slice_percentage_uplink[i]){
+        LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: total percentage %f-->%f, slice RB percentage has changed: %f-->%f\n",
+              module_idP, i, frameP, subframeP, total_slice_percentage_current_uplink,
+              total_slice_percentage_uplink, slice_percentage_current_uplink[i], slice_percentage_uplink[i]);
+        total_slice_percentage_current_uplink = total_slice_percentage_uplink;
+        slice_percentage_current_uplink[i] = slice_percentage_uplink[i];
+      }
 
+      // check if the slice max MCS, and log the console
+      if (slice_maxmcs_current_uplink[i] != slice_maxmcs_uplink[i]){
+        if ((slice_maxmcs_uplink[i] >= 0) && (slice_maxmcs_uplink[i] <= 16)){
+          LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n",
+                module_idP, i, frameP, subframeP, slice_maxmcs_current_uplink[i], slice_maxmcs_uplink[i]);
+          slice_maxmcs_current_uplink[i] = slice_maxmcs_uplink[i];
+        } else {
+          LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid slice max mcs %d, revert the previous value %d\n",
+                module_idP, i, slice_maxmcs_uplink[i],slice_maxmcs_current_uplink[i]);
+          slice_maxmcs_uplink[i] = slice_maxmcs_current_uplink[i];
+        }
+      }
 
+      // check if a new scheduler, and log the console
+      if (update_ul_scheduler_current[i] != update_ul_scheduler[i]){
+        LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: UL scheduler for this slice is updated: %s \n",
+              module_idP, i, frameP, subframeP, ul_scheduler_type[i]);
+        update_ul_scheduler_current[i] = update_ul_scheduler[i];
+      }
+    } else {
+      if (n_active_slices_uplink == n_active_slices_current_uplink) {
+        LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid total RB share (%f->%f), reduce proportionally the RB share by 0.1\n",
+              module_idP, i, total_slice_percentage_current_uplink, total_slice_percentage_uplink);
+        if (slice_percentage_uplink[i] > avg_slice_percentage_uplink) {
+          slice_percentage_uplink[i] -= 0.1;
+          total_slice_percentage_uplink -= 0.1;
+        }
+      } else {
+        // here we can correct the values, e.g. reduce proportionally
+        LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid total RB share (%f->%f), revert the  number of slice to its previous value (%d->%d)\n",
+              module_idP, i, total_slice_percentage_current_uplink,
+              total_slice_percentage_uplink, n_active_slices_uplink,
+              n_active_slices_current_uplink);
+        n_active_slices_uplink = n_active_slices_current_uplink;
+        slice_percentage_uplink[i] = slice_percentage_current_uplink[i];
+      }
+    }
 
-  nfapi_ul_config_request_body_t *ul_req_tmp       = &eNB->UL_req_tmp[CC_id][sched_subframeP].ul_config_request_body;
+    // Run each enabled slice-specific schedulers one by one
+    slice_sched_ul[i](module_idP, i, frameP, subframeP, sched_subframe, first_rb);
+  }
 
-  ul_config_pdu                                    = &ul_req_tmp->ul_config_pdu_list[0]; 
+  stop_meas(&mac->schedule_ulsch);
+}
 
+void
+schedule_ulsch_rnti(module_id_t module_idP,
+					slice_id_t slice_id,
+		    frame_t frameP,
+		    sub_frame_t subframeP,
+		    unsigned char sched_subframeP, uint16_t * first_rb)
+{
+  int UE_id;
+  uint8_t aggregation = 2;
+  rnti_t rnti = -1;
+  uint8_t round = 0;
+  uint8_t harq_pid = 0;
+  uint8_t status = 0;
+  uint8_t rb_table_index = -1;
+  uint32_t cqi_req, cshift, ndi, tpc;
+  int32_t normalized_rx_power;
+  int32_t target_rx_power = -90;
+  static int32_t tpc_accumulated = 0;
+  int n;
+  int CC_id = 0;
+  int drop_ue = 0;
+  int N_RB_UL;
+  eNB_MAC_INST *mac = RC.mac[module_idP];
+  COMMON_channels_t *cc = mac->common_channels;
+  UE_list_t *UE_list = &mac->UE_list;
+  UE_TEMPLATE *UE_template;
+  UE_sched_ctrl *UE_sched_ctrl;
+  int sched_frame = frameP;
+  int rvidx_tab[4] = { 0, 2, 3, 1 };
+
+  if (sched_subframeP < subframeP)
+      sched_frame++;
+
+  nfapi_hi_dci0_request_t        *hi_dci0_req = &mac->HI_DCI0_req[CC_id];
+  nfapi_hi_dci0_request_body_t   *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
+  nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu;
 
-  LOG_D(MAC,"entering ulsch preprocesor\n");
-  ulsch_scheduler_pre_processor(module_idP,
-                                frameP,
-                                subframeP,
-                                first_rb);
+  nfapi_ul_config_request_t *ul_req_tmp            = &mac->UL_req_tmp[CC_id][sched_subframeP];
+  nfapi_ul_config_request_body_t *ul_req_tmp_body  = &ul_req_tmp->ul_config_request_body;
 
-  LOG_D(MAC,"exiting ulsch preprocesor\n");
+  //LOG_D(MAC, "entering ulsch preprocesor\n");
+  ulsch_scheduler_pre_processor(module_idP, slice_id, frameP, subframeP, first_rb);
 
-  eNB->HI_DCI0_req[CC_id].sfn_sf = (frameP<<4)+subframeP;
+  //LOG_D(MAC, "exiting ulsch preprocesor\n");
 
+  hi_dci0_req->sfn_sf = (frameP << 4) + subframeP;
 
   // loop over all active UEs
-  for (UE_id=UE_list->head_ul; UE_id>=0; UE_id=UE_list->next_ul[UE_id]) {
+  for (UE_id = UE_list->head_ul; UE_id >= 0;
+       UE_id = UE_list->next_ul[UE_id]) {
+
+    if (!ue_slice_membership(UE_id, slice_id))
+        continue;
 
     // don't schedule if Msg4 is not received yet
-    if (UE_list->UE_template[UE_PCCID(module_idP,UE_id)][UE_id].configured==FALSE) {
-      LOG_D(MAC,"[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n", 
-	    module_idP,frameP,subframeP,UE_id);
-      continue;
+    if (UE_list->UE_template[UE_PCCID(module_idP, UE_id)][UE_id].
+        configured == FALSE) {
+        LOG_D(MAC,
+              "[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n",
+              module_idP, frameP, subframeP, UE_id);
+        continue;
     }
 
-    rnti = UE_RNTI(module_idP,UE_id);
+    rnti = UE_RNTI(module_idP, UE_id);
 
-    if (rnti==NOT_A_RNTI) {
-      LOG_W(MAC,"[eNB %d] frame %d subfarme %d, UE %d: no RNTI \n", module_idP,frameP,subframeP,UE_id);
+    if (rnti == NOT_A_RNTI) {
+      LOG_W(MAC, "[eNB %d] frame %d subfarme %d, UE %d: no RNTI \n",
+	    module_idP, frameP, subframeP, UE_id);
       continue;
     }
 
     drop_ue = 0;
     /* let's drop the UE if get_eNB_UE_stats returns NULL when calling it with any of the UE's active UL CCs */
-    /* TODO: refine? 
+    /* TODO: refine?
 
-    for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) {
-      CC_id = UE_list->ordered_ULCCids[n][UE_id];
-      
-      if (mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti) == NULL) {
-        LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: no PHY context\n", module_idP,frameP,subframeP,UE_id,rnti,CC_id);
-        drop_ue = 1;
-        break;
-      }
-      }*/
+       for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) {
+       CC_id = UE_list->ordered_ULCCids[n][UE_id];
+
+       if (mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti) == NULL) {
+       LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: no PHY context\n", module_idP,frameP,subframeP,UE_id,rnti,CC_id);
+       drop_ue = 1;
+       break;
+       }
+       } */
     if (drop_ue == 1) {
-/* we can't come here, ulsch_scheduler_pre_processor won't put in the list a UE with no PHY context */
-abort();
+      /* we can't come here, ulsch_scheduler_pre_processor won't put in the list a UE with no PHY context */
+      abort();
       /* TODO: this is a hack. Sometimes the UE has no PHY context but
        * is still present in the MAC with 'ul_failure_timer' = 0 and
        * 'ul_out_of_sync' = 0. It seems wrong and the UE stays there forever. Let's
@@ -931,335 +1168,377 @@ abort();
        * In the meantime, this hack...
        */
       if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer == 0 &&
-          UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 0) {
-        LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: UE in weird state, let's put it 'out of sync'\n",
-              module_idP,frameP,subframeP,UE_id,rnti,CC_id);
-        // inform RRC of failure and clear timer
-        mac_eNB_rrc_ul_failure(module_idP,CC_id,frameP,subframeP,rnti);
-        UE_list->UE_sched_ctrl[UE_id].ul_failure_timer=0;
-        UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync=1;
+	  UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 0) {
+	LOG_W(MAC,
+	      "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: UE in weird state, let's put it 'out of sync'\n",
+	      module_idP, frameP, subframeP, UE_id, rnti, CC_id);
+	// inform RRC of failure and clear timer
+	mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP,
+			       subframeP, rnti);
+	UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
+	UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1;
       }
       continue;
     }
-
     // loop over all active UL CC_ids for this UE
-    for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) {
+    for (n = 0; n < UE_list->numactiveULCCs[UE_id]; n++) {
       // This is the actual CC_id in the list
-      CC_id        = UE_list->ordered_ULCCids[n][UE_id];
-      N_RB_UL      = to_prb(cc[CC_id].ul_Bandwidth);
+      CC_id = UE_list->ordered_ULCCids[n][UE_id];
+      N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth);
 
       /*
-      aggregation=get_aggregation(get_bw_index(module_idP,CC_id), 
-				  eNB_UE_stats->dl_cqi,
-				  format0);
+	aggregation=get_aggregation(get_bw_index(module_idP,CC_id),
+	eNB_UE_stats->dl_cqi,
+	format0);
       */
 
-      if (CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,aggregation,rnti)) {
-        LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: not enough nCCE\n", module_idP,frameP,subframeP,UE_id,rnti,CC_id);
-        continue; // break;
-      } 
+      if (CCE_allocation_infeasible
+	  (module_idP, CC_id, 1, subframeP, aggregation, rnti)) {
+	LOG_W(MAC,
+	      "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: not enough nCCE\n",
+	      module_idP, frameP, subframeP, UE_id, rnti, CC_id);
+	continue;	// break;
+      }
 
       /* be sure that there are some free RBs */
-      if (first_rb[CC_id] >= N_RB_UL-1) {
-	LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n",
-	      module_idP,frameP,subframeP,UE_id,rnti,CC_id);
-        continue;
+      if (first_rb[CC_id] >= N_RB_UL - 1) {
+	LOG_W(MAC,
+	      "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n",
+	      module_idP, frameP, subframeP, UE_id, rnti, CC_id);
+	continue;
       }
-
-
-
       //      if (eNB_UE_stats->mode == PUSCH) { // ue has a ulsch channel
 
-      UE_template   = &UE_list->UE_template[CC_id][UE_id];
+      UE_template = &UE_list->UE_template[CC_id][UE_id];
       UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
-      harq_pid      = subframe2harqpid(&cc[CC_id],sched_frame,sched_subframeP);
-      round         = UE_sched_ctrl->round_UL[CC_id][harq_pid];
-      AssertFatal(round<8,"round %d > 7 for UE %d/%x\n",round,UE_id,rnti);
-      LOG_D(MAC,"[eNB %d] frame %d subframe %d,Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n", 
-	    module_idP,frameP,subframeP,harq_pid,UE_id,rnti,CC_id, aggregation,N_RB_UL);
-
-      RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->ul_total_buffer;
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP]);	
-      if (UE_is_to_be_scheduled(module_idP,CC_id,UE_id) > 0 || round > 0)// || ((frameP%10)==0))
+      harq_pid = subframe2harqpid(&cc[CC_id], sched_frame, sched_subframeP);
+      round = UE_sched_ctrl->round_UL[CC_id][harq_pid];
+      AssertFatal(round < 8, "round %d > 7 for UE %d/%x\n", round,
+		  UE_id, rnti);
+      LOG_D(MAC,
+	    "[eNB %d] frame %d subframe %d (sched_frame %d, sched_subframe %d), Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n",
+	    module_idP, frameP, subframeP, sched_frame, sched_subframeP, harq_pid, UE_id, rnti,
+	    CC_id, aggregation, N_RB_UL);
+
+      RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP * 10) + subframeP] = UE_template->estimated_ul_buffer;
+      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP *
+							   10) +
+							  subframeP]);
+      if (UE_is_to_be_scheduled(module_idP, CC_id, UE_id) > 0 || round > 0)	// || ((frameP%10)==0))
 	// if there is information on bsr of DCCH, DTCH or if there is UL_SR, or if there is a packet to retransmit, or we want to schedule a periodic feedback every 10 frames
-        {
-	  LOG_D(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round %d(SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n",
-		module_idP,harq_pid,frameP,subframeP,UE_id,rnti,round,UE_template->ul_SR,
+	{
+	  LOG_D(MAC,
+		"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round %d(SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n",
+		module_idP, harq_pid, frameP, subframeP, UE_id, rnti,
+		round, UE_template->ul_SR,
 		UE_sched_ctrl->ul_inactivity_timer,
-
 		UE_sched_ctrl->ul_failure_timer,
-
 		UE_sched_ctrl->cqi_req_timer);
-          // reset the scheduling request
-          UE_template->ul_SR = 0;
-          status = mac_eNB_get_rrc_status(module_idP,rnti);
+	  // reset the scheduling request
+	  UE_template->ul_SR = 0;
+	  status = mac_eNB_get_rrc_status(module_idP, rnti);
 	  if (status < RRC_CONNECTED)
 	    cqi_req = 0;
-	  else if (UE_sched_ctrl->cqi_req_timer>30) {
-	    cqi_req = 1;
-	    UE_sched_ctrl->cqi_req_timer=0;
-	  }
-	  else
+	  else if (UE_sched_ctrl->cqi_req_timer > 30) {
+	    if (nfapi_mode) {
+	      cqi_req = 0;
+	    } else {
+	      cqi_req = 1;
+	    }
+	    UE_sched_ctrl->cqi_req_timer = 0;
+	  } else
 	    cqi_req = 0;
-	  
-
-          //power control
-          //compute the expected ULSCH RX power (for the stats)
-	  
-          // this is the normalized RX power and this should be constant (regardless of mcs
-          normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
-          target_rx_power = 178;
-	  
-          // this assumes accumulated tpc
+
+	  //power control
+	  //compute the expected ULSCH RX power (for the stats)
+
+	  // this is the normalized RX power and this should be constant (regardless of mcs
+	  normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
+	  target_rx_power = 178;
+
+	  // this assumes accumulated tpc
 	  // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
-	  int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame*10+UE_template->pusch_tpc_tx_subframe;
-          if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case
-	      ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around
+	  int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame * 10 + UE_template->pusch_tpc_tx_subframe;
+	  if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) ||	//normal case
+	      ((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10))))	//frame wrap-around
 	    {
-	      UE_template->pusch_tpc_tx_frame=frameP;
-	      UE_template->pusch_tpc_tx_subframe=subframeP;
-	      if (normalized_rx_power>(target_rx_power+4)) {
-		tpc = 0; //-1
+	      UE_template->pusch_tpc_tx_frame = frameP;
+	      UE_template->pusch_tpc_tx_subframe = subframeP;
+	      if (normalized_rx_power > (target_rx_power + 4)) {
+		tpc = 0;	//-1
 		tpc_accumulated--;
-	      } else if (normalized_rx_power<(target_rx_power-4)) {
-		tpc = 2; //+1
+	      } else if (normalized_rx_power < (target_rx_power - 4)) {
+		tpc = 2;	//+1
 		tpc_accumulated++;
 	      } else {
-		tpc = 1; //0
+		tpc = 1;	//0
 	      }
 	    } else {
-            tpc = 1; //0
-          }
+	    tpc = 1;	//0
+	  }
 	  //tpc = 1;
-	  if (tpc!=1) {
-	    LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
-		  module_idP,frameP,subframeP,harq_pid,tpc,
-		  tpc_accumulated,normalized_rx_power,target_rx_power);
+	  if (tpc != 1) {
+	    LOG_D(MAC,
+		  "[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
+		  module_idP, frameP, subframeP, harq_pid, tpc,
+		  tpc_accumulated, normalized_rx_power,
+		  target_rx_power);
 	  }
-	  
-          // new transmission
-          if (round==0) {
-	    
-            ndi = 1-UE_template->oldNDI_UL[harq_pid];
-            UE_template->oldNDI_UL[harq_pid]=ndi;
-	    UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power;
-	    UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power;
-	    UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=UE_template->pre_assigned_mcs_ul;
-            UE_template->mcs_UL[harq_pid] = UE_template->pre_assigned_mcs_ul;//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS
-            if (UE_template->pre_allocated_rb_table_index_ul >=0) {
-              rb_table_index=UE_template->pre_allocated_rb_table_index_ul;
-            } else {
-	      UE_template->mcs_UL[harq_pid]=10;//cmin (10, openair_daq_vars.target_ue_ul_mcs);
-              rb_table_index=5; // for PHR
+	  // new transmission
+	  if (round == 0) {
+
+	    ndi = 1 - UE_template->oldNDI_UL[harq_pid];
+	    UE_template->oldNDI_UL[harq_pid] = ndi;
+	    UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power = normalized_rx_power;
+	    UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power = target_rx_power;
+		UE_template->mcs_UL[harq_pid] = cmin(UE_template->pre_assigned_mcs_ul, slice_maxmcs_uplink[slice_id]);
+		UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1= UE_template->mcs_UL[harq_pid];
+		//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS
+	    if (UE_template->pre_allocated_rb_table_index_ul >= 0) {
+	      rb_table_index = UE_template->pre_allocated_rb_table_index_ul;
+	    } else {
+	      UE_template->mcs_UL[harq_pid] = 10;	//cmin (10, openair_daq_vars.target_ue_ul_mcs);
+	      rb_table_index = 5;	// for PHR
 	    }
-	    
-            UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=UE_template->mcs_UL[harq_pid];
+
+	    UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_template->mcs_UL[harq_pid];
 	    //            buffer_occupancy = UE_template->ul_total_buffer;
 
-	    
-            while (((rb_table[rb_table_index]>(N_RB_UL-1-first_rb[CC_id])) ||
-		    (rb_table[rb_table_index]>45)) &&
-                   (rb_table_index>0)) {
-              rb_table_index--;
-            }
-	    
-            UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]);
-	    UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=rb_table[rb_table_index];
-	    UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid];
+
+	    while (((rb_table[rb_table_index] > (N_RB_UL - 1 - first_rb[CC_id]))
+                    || (rb_table[rb_table_index] > 45))
+                    && (rb_table_index > 0)) {
+	      rb_table_index--;
+	    }
+
+	    UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],
+						       rb_table[rb_table_index]);
+	    UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += rb_table[rb_table_index];
+	    UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = UE_template->TBS_UL[harq_pid];
+            UE_list->eNB_UE_stats[CC_id][UE_id].total_ulsch_TBS += UE_template->TBS_UL[harq_pid];
 	    //            buffer_occupancy -= TBS;
-            	    
-            T(T_ENB_MAC_UE_UL_SCHEDULE, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
-              T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(first_rb[CC_id]), T_INT(rb_table[rb_table_index]),
-              T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi));
-	    
-	    if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED)
-	      LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n",
-		    module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,UE_template->mcs_UL[harq_pid],
-		    first_rb[CC_id],rb_table[rb_table_index],
-		    rb_table_index,UE_template->TBS_UL[harq_pid],harq_pid);
-	    
+
+	    T(T_ENB_MAC_UE_UL_SCHEDULE, T_INT(module_idP),
+	      T_INT(CC_id), T_INT(rnti), T_INT(frameP),
+	      T_INT(subframeP), T_INT(harq_pid),
+	      T_INT(UE_template->mcs_UL[harq_pid]),
+	      T_INT(first_rb[CC_id]),
+	      T_INT(rb_table[rb_table_index]),
+	      T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi));
+
+	    if (mac_eNB_get_rrc_status(module_idP, rnti) < RRC_CONNECTED)
+	      LOG_D(MAC,
+		    "[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n",
+		    module_idP, harq_pid, rnti, CC_id, frameP,
+		    subframeP, UE_id,
+		    UE_template->mcs_UL[harq_pid],
+		    first_rb[CC_id], rb_table[rb_table_index],
+		    rb_table_index,
+		    UE_template->TBS_UL[harq_pid], harq_pid);
+
 	    // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB)
-            //store for possible retransmission
-            UE_template->nb_rb_ul[harq_pid]    = rb_table[rb_table_index];
-            UE_template->first_rb_ul[harq_pid] = first_rb[CC_id];
-	    
-	    UE_sched_ctrl->ul_scheduled |= (1<<harq_pid);
+	    //store for possible retransmission
+	    UE_template->nb_rb_ul[harq_pid] = rb_table[rb_table_index];
+	    UE_template->first_rb_ul[harq_pid] = first_rb[CC_id];
+
+	    UE_sched_ctrl->ul_scheduled |= (1 << harq_pid);
 	    if (UE_id == UE_list->head)
-	      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,UE_sched_ctrl->ul_scheduled);
-	    
-	    // adjust total UL buffer status by TBS, wait for UL sdus to do final update
-	    LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]);
-	    if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid])
-	      UE_template->ul_total_buffer -= UE_template->TBS_UL[harq_pid];
-	    else
-	      UE_template->ul_total_buffer = 0;
-	    LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);
+	      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,
+						      UE_sched_ctrl->ul_scheduled);
+
+	    // adjust scheduled UL bytes by TBS, wait for UL sdus to do final update
+	    LOG_D(MAC,
+		  "[eNB %d] CC_id %d UE %d/%x : adjusting scheduled_ul_bytes, old %d, TBS %d\n",
+		  module_idP, CC_id, UE_id, rnti,
+		  UE_template->scheduled_ul_bytes,
+		  UE_template->TBS_UL[harq_pid]);
+
+            UE_template->scheduled_ul_bytes += UE_template->TBS_UL[harq_pid];
+
+            LOG_D(MAC, "scheduled_ul_bytes, new %d\n", UE_template->scheduled_ul_bytes);
+
 	    // Cyclic shift for DM RS
-	    cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
+	    cshift = 0;	// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
 	    // save it for a potential retransmission
-            UE_template->cshift[harq_pid] = cshift;	    
-
-	    hi_dci0_pdu                                                         = &hi_dci0_req->hi_dci0_pdu_list[eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci+eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi]; 	
-	    memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
-	    hi_dci0_pdu->pdu_type                                               = NFAPI_HI_DCI0_DCI_PDU_TYPE; 
-	    hi_dci0_pdu->pdu_size                                               = 2+sizeof(nfapi_hi_dci0_dci_pdu);
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format                        = NFAPI_UL_DCI_FORMAT_0;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level                 = aggregation;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti                              = rnti;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power                = 6000;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start              = first_rb[CC_id];
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block          = rb_table[rb_table_index];
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1                             = UE_template->mcs_UL[harq_pid];
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms           = cshift;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag    = 0;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1             = ndi;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc                               = tpc;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request                   = cqi_req;
-	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index               = UE_template->DAI_ul[sched_subframeP];
-
-	    
-	    eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci++;
-	    
-	    LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
-		  harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP);
-	    
+	    UE_template->cshift[harq_pid] = cshift;
+
+	    hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
+	    memset((void *) hi_dci0_pdu, 0,sizeof(nfapi_hi_dci0_request_pdu_t));
+	    hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
+	    hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_dci_pdu);
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = first_rb[CC_id];
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = rb_table[rb_table_index];
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = UE_template->mcs_UL[harq_pid];
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = ndi;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req;
+	    hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP];
+
+	    hi_dci0_req_body->number_of_dci++;
+	    hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP, subframeP, 4);
+	    hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
+
+	    hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday!
+	    hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
+
+
+	    LOG_D(MAC,
+		  "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
+		  harq_pid, frameP, subframeP, UE_id, rnti,
+		  sched_frame, sched_subframeP);
+
 	    // Add UL_config PDUs
-	    fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
-						 cqi_req,
-						 cc,
-						 UE_template->physicalConfigDedicated,
-						 get_tmode(module_idP,CC_id,UE_id),
-						 eNB->ul_handle,
-						 rnti,
-						 first_rb[CC_id], // resource_block_start
-						 rb_table[rb_table_index], // number_of_resource_blocks
-						 UE_template->mcs_UL[harq_pid],
-						 cshift, // cyclic_shift_2_for_drms
-						 0, // frequency_hopping_enabled_flag
-						 0, // frequency_hopping_bits
-						 ndi, // new_data_indication
-						 0, // redundancy_version
-						 harq_pid, // harq_process_number
-						 0, // ul_tx_mode
-						 0, // current_tx_nb
-						 0, // n_srs
-						 get_TBS_UL(UE_template->mcs_UL[harq_pid],
-							    rb_table[rb_table_index])
-						 );
+	    fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, first_rb[CC_id],	// resource_block_start
+						 rb_table[rb_table_index],	// number_of_resource_blocks
+						 UE_template->mcs_UL[harq_pid], cshift,	// cyclic_shift_2_for_drms
+						 0,	// frequency_hopping_enabled_flag
+						 0,	// frequency_hopping_bits
+						 ndi,	// new_data_indication
+						 0,	// redundancy_version
+						 harq_pid,	// harq_process_number
+						 0,	// ul_tx_mode
+						 0,	// current_tx_nb
+						 0,	// n_srs
+						 get_TBS_UL
+						 (UE_template->
+						  mcs_UL[harq_pid],
+						  rb_table
+						  [rb_table_index]));
 #ifdef Rel14
-	    if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation
-	      fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
-						   UE_template->rach_resource_type>2 ? 2 : 1,
-						   1, //total_number_of_repetitions
-						   1, //repetition_number
-						   (frameP*10)+subframeP);
+	    if (UE_template->rach_resource_type > 0) {	// This is a BL/CE UE allocation
+	      fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], UE_template->rach_resource_type > 2 ? 2 : 1, 1,	//total_number_of_repetitions
+						   1,	//repetition_number
+						   (frameP *
+						    10) +
+						   subframeP);
 	    }
 #endif
-	    ul_req_tmp->number_of_pdus++;
-	    eNB->ul_handle++;
-	    
-	    
-	  	
+	    ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST;
+	    ul_req_tmp_body->number_of_pdus++;
+	    ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+	    mac->ul_handle++;
+
+	    uint16_t ul_sched_frame = sched_frame;
+	    uint16_t ul_sched_subframeP = sched_subframeP;
+
+	    add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2);
+	    ul_req_tmp->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP;
+
 	    add_ue_ulsch_info(module_idP,
-			      CC_id,
-			      UE_id,
-			      subframeP,
+			      CC_id, UE_id, subframeP,
 			      S_UL_SCHEDULED);
-	    
-	    LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP,CC_id,frameP,subframeP,UE_id);
 
+	    //LOG_D(MAC, "[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP, CC_id, frameP, subframeP, UE_id);
+	    LOG_D(MAC,"[PUSCH %d] SFN/SF:%04d%d UL_CFG:SFN/SF:%04d%d CQI:%d for UE %d/%x\n", harq_pid,frameP,subframeP,ul_sched_frame,ul_sched_subframeP,cqi_req,UE_id,rnti);
 
-            // increment first rb for next UE allocation
-            first_rb[CC_id]+=rb_table[rb_table_index];
-	    
-	  }
-	  else { // round > 0 => retransmission
-            T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
-              T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(first_rb[CC_id]), T_INT(rb_table[rb_table_index]),
-              T_INT(round));
+	    // increment first rb for next UE allocation
+	    first_rb[CC_id] += rb_table[rb_table_index];
+	  } else {	// round > 0 => retransmission
+	    T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION,
+	      T_INT(module_idP), T_INT(CC_id), T_INT(rnti),
+	      T_INT(frameP), T_INT(subframeP), T_INT(harq_pid),
+	      T_INT(UE_template->mcs_UL[harq_pid]),
+	      T_INT(first_rb[CC_id]),
+	      T_INT(rb_table[rb_table_index]), T_INT(round));
 
 	    // fill in NAK information
-	    
-	    hi_dci0_pdu                                                         = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi]; 	
-	    memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
-	    hi_dci0_pdu->pdu_type                                               = NFAPI_HI_DCI0_HI_PDU_TYPE; 
-	    hi_dci0_pdu->pdu_size                                               = 2+sizeof(nfapi_hi_dci0_hi_pdu);
-	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start                = UE_template->first_rb_ul[harq_pid];
-	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms             = UE_template->cshift[harq_pid];
-	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value                            = 0;
-	    hi_dci0_req->number_of_hi++;
-            LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) UE %d (mcs %d, first rb %d, nb_rb %d, TBS %d, round %d)\n",
-                  module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,UE_template->mcs_UL[harq_pid],
-                  UE_template->first_rb_ul[harq_pid], UE_template->nb_rb_ul[harq_pid],
-                  UE_template->TBS_UL[harq_pid],round);
+
+	    hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
+	    memset((void *) hi_dci0_pdu, 0,
+		   sizeof(nfapi_hi_dci0_request_pdu_t));
+	    hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
+	    hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_hi_pdu);
+	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
+	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = UE_template->first_rb_ul[harq_pid];
+	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = UE_template->cshift[harq_pid];
+	    hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0;
+	    hi_dci0_req_body->number_of_hi++;
+	    hi_dci0_req_body->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0);
+	    hi_dci0_req->sfn_sf = frameP<<4|subframeP;
+	    hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
+
+	    LOG_D(MAC,
+		  "[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) UE %d (mcs %d, first rb %d, nb_rb %d, TBS %d, round %d)\n",
+		  module_idP, harq_pid, rnti, CC_id, frameP,
+		  subframeP, UE_id, UE_template->mcs_UL[harq_pid],
+		  UE_template->first_rb_ul[harq_pid],
+		  UE_template->nb_rb_ul[harq_pid],
+		  UE_template->TBS_UL[harq_pid], round);
 	    // Add UL_config PDUs
-	    LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
-		  harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP);
-	    fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
-						 cqi_req,
-						 cc,
-						 UE_template->physicalConfigDedicated,
-						 get_tmode(module_idP,CC_id,UE_id),
-						 eNB->ul_handle,
-						 rnti,
-						 UE_template->first_rb_ul[harq_pid], // resource_block_start
-						 UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
-						 UE_template->mcs_UL[harq_pid],
-						 cshift, // cyclic_shift_2_for_drms
-						 0, // frequency_hopping_enabled_flag
-						 0, // frequency_hopping_bits
-						 UE_template->oldNDI_UL[harq_pid], // new_data_indication
-						 rvidx_tab[round&3], // redundancy_version
-						 harq_pid, // harq_process_number
-						 0, // ul_tx_mode
-						 0, // current_tx_nb
-						 0, // n_srs
-						 UE_template->TBS_UL[harq_pid]
-						 );
+	    LOG_D(MAC,
+		  "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
+		  harq_pid, frameP, subframeP, UE_id, rnti,
+		  sched_frame, sched_subframeP);
+	    fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, UE_template->first_rb_ul[harq_pid],	// resource_block_start
+						 UE_template->nb_rb_ul[harq_pid],	// number_of_resource_blocks
+						 UE_template->mcs_UL[harq_pid], cshift,	// cyclic_shift_2_for_drms
+						 0,	// frequency_hopping_enabled_flag
+						 0,	// frequency_hopping_bits
+						 UE_template->oldNDI_UL[harq_pid],	// new_data_indication
+						 rvidx_tab[round & 3],	// redundancy_version
+						 harq_pid,	// harq_process_number
+						 0,	// ul_tx_mode
+						 0,	// current_tx_nb
+						 0,	// n_srs
+						 UE_template->
+						 TBS_UL[harq_pid]);
 #ifdef Rel14
-	    if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation
-	      fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
-						   UE_template->rach_resource_type>2 ? 2 : 1,
-						   1, //total_number_of_repetitions
-						   1, //repetition_number
-						   (frameP*10)+subframeP);
+	    if (UE_template->rach_resource_type > 0) {	// This is a BL/CE UE allocation
+	      fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], UE_template->rach_resource_type > 2 ? 2 : 1, 1,	//total_number_of_repetitions
+						   1,	//repetition_number
+						   (frameP *
+						    10) +
+						   subframeP);
 	    }
 #endif
-	      ul_req_tmp->number_of_pdus++;
-	      eNB->ul_handle++;
-
-	  }/* 
-	  else if (round > 0) { //we schedule a retransmission
-
-            ndi = UE_template->oldNDI_UL[harq_pid];
-
-            if ((round&3)==0) {
-              mcs = openair_daq_vars.target_ue_ul_mcs;
-            } else {
-              mcs = rvidx_tab[round&3] + 28; //not correct for round==4!
-
-            }
-
-            LOG_I(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE retransmission (mcs %d, first rb %d, nb_rb %d, harq_pid %d, round %d)\n",
-                  module_idP,UE_id,rnti,CC_id,frameP,subframeP,mcs,
-                  first_rb[CC_id],UE_template->nb_rb_ul[harq_pid],
-		  harq_pid, round);
-
-            rballoc = mac_xface->computeRIV(frame_parms->N_RB_UL,
-                                            first_rb[CC_id],
-                                            UE_template->nb_rb_ul[harq_pid]);
-            first_rb[CC_id]+=UE_template->nb_rb_ul[harq_pid];  // increment for next UE allocation
-         
-	    UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission_rx+=1;
-	    UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx_rx=UE_template->nb_rb_ul[harq_pid];
-	    UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=UE_template->nb_rb_ul[harq_pid];
-	    UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=mcs;
-	    UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs;
-	  }
-	   */
-	  
-        } // UE_is_to_be_scheduled
-    } // loop over UE_id
-  } // loop of CC_id
-}
+	    ul_req_tmp_body->number_of_pdus++;
+	    mac->ul_handle++;
+
+	    ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+
+	    ul_req_tmp->sfn_sf = sched_frame<<4|sched_subframeP;
+	    ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST;
+
+	    LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d cqi_req %d\n",
+		  harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,cqi_req);
+	  }		/*
+			  else if (round > 0) { //we schedule a retransmission
+
+			  ndi = UE_template->oldNDI_UL[harq_pid];
 
+			  if ((round&3)==0) {
+			  mcs = openair_daq_vars.target_ue_ul_mcs;
+			  } else {
+			  mcs = rvidx_tab[round&3] + 28; //not correct for round==4!
+
+			  }
+
+			  LOG_I(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE retransmission (mcs %d, first rb %d, nb_rb %d, harq_pid %d, round %d)\n",
+			  module_idP,UE_id,rnti,CC_id,frameP,subframeP,mcs,
+			  first_rb[CC_id],UE_template->nb_rb_ul[harq_pid],
+			  harq_pid, round);
+
+			  rballoc = mac_xface->computeRIV(frame_parms->N_RB_UL,
+			  first_rb[CC_id],
+			  UE_template->nb_rb_ul[harq_pid]);
+			  first_rb[CC_id]+=UE_template->nb_rb_ul[harq_pid];  // increment for next UE allocation
+
+			  UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission_rx+=1;
+			  UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx_rx=UE_template->nb_rb_ul[harq_pid];
+			  UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=UE_template->nb_rb_ul[harq_pid];
+			  UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=mcs;
+			  UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs;
+			  }
+			*/
+
+	}			// UE_is_to_be_scheduled
+    }			// loop over UE_id
+  }				// loop of CC_id
+}
diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h
index 77e6e761a88deceb30d72028023ef9627a95c8ed..e7489ca8e6fffcabb25c34cbb188b1dc7f25dd7c 100644
--- a/openair2/LAYER2/MAC/extern.h
+++ b/openair2/LAYER2/MAC/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -32,10 +32,6 @@
 #ifndef __MAC_EXTERN_H__
 #define __MAC_EXTERN_H__
 
-
-#ifdef USER_MODE
-//#include "stdio.h"
-#endif //USER_MODE
 #include "PHY/defs.h"
 #include "defs.h"
 
@@ -56,8 +52,8 @@ extern UE_RRC_INST *UE_rrc_inst;
 extern UE_MAC_INST *UE_mac_inst;
 
 
-extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
-extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
+extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX];	// eNBxUE = 8x8
+extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX];	// eNBxUE = 8x8
 
 
 
@@ -79,28 +75,26 @@ extern uint32_t RRC_CONNECTION_FLAG;
 
 extern uint8_t rb_table[34];
 
-extern DCI0_5MHz_TDD_1_6_t       UL_alloc_pdu;
+extern DCI0_5MHz_TDD_1_6_t UL_alloc_pdu;
 
-extern DCI1A_5MHz_TDD_1_6_t      RA_alloc_pdu;
-extern DCI1A_5MHz_TDD_1_6_t      DLSCH_alloc_pdu1A;
-extern DCI1A_5MHz_TDD_1_6_t      BCCH_alloc_pdu;
+extern DCI1A_5MHz_TDD_1_6_t RA_alloc_pdu;
+extern DCI1A_5MHz_TDD_1_6_t DLSCH_alloc_pdu1A;
+extern DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu;
 
-extern DCI1A_5MHz_TDD_1_6_t      CCCH_alloc_pdu;
-extern DCI1_5MHz_TDD_t           DLSCH_alloc_pdu;
+extern DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
+extern DCI1_5MHz_TDD_t DLSCH_alloc_pdu;
 
-extern DCI0_5MHz_FDD_t       UL_alloc_pdu_fdd;
+extern DCI0_5MHz_FDD_t UL_alloc_pdu_fdd;
 
-extern DCI1A_5MHz_FDD_t      DLSCH_alloc_pdu1A_fdd;
-extern DCI1A_5MHz_FDD_t      RA_alloc_pdu_fdd;
-extern DCI1A_5MHz_FDD_t      BCCH_alloc_pdu_fdd;
+extern DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd;
+extern DCI1A_5MHz_FDD_t RA_alloc_pdu_fdd;
+extern DCI1A_5MHz_FDD_t BCCH_alloc_pdu_fdd;
 
-extern DCI1A_5MHz_FDD_t      CCCH_alloc_pdu_fdd;
-extern DCI1_5MHz_FDD_t       DLSCH_alloc_pdu_fdd;
+extern DCI1A_5MHz_FDD_t CCCH_alloc_pdu_fdd;
+extern DCI1_5MHz_FDD_t DLSCH_alloc_pdu_fdd;
 
 extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1;
 extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
 extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
 
 #endif //DEF_H
-
-
diff --git a/openair2/LAYER2/MAC/flexran_agent_mac_proto.h b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h
deleted file mode 100644
index a3ff3b6a4aa9ee88b176b795d3246312e0ddfcc0..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/flexran_agent_mac_proto.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */ 
-
-/*! \file flexran_agent_mac_proto.h
- * \brief MAC functions for FlexRAN agent
- * \author Xenofon Foukas and Navid Nikaein
- * \date 2016
- * \email: x.foukas@sms.ed.ac.uk
- * \version 0.1
- * @ingroup _mac
-
- */
-
-#ifndef __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__
-#define __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__
-
-#include "flexran_agent_defs.h"
-#include "header.pb-c.h"
-#include "flexran.pb-c.h"
-
-/*
- * slice specific scheduler 
- */
-typedef void (*slice_scheduler)(module_id_t mod_id, 
-				int slice_id, 
-				uint32_t frame, 
-				uint32_t subframe,
-				int *mbsfn_flag,
-				Protocol__FlexranMessage **dl_info);
-
-
-
-/*
- * top level flexran scheduler used by the eNB scheduler
- */
-void flexran_schedule_ue_spec_default(mid_t mod_id, 
-				      uint32_t frame, 
-				      uint32_t subframe,
-				      int *mbsfn_flag, 
-				      Protocol__FlexranMessage **dl_info);
-/*
- * slice specific scheduler for embb
- */
-void
-flexran_schedule_ue_spec_embb(mid_t   mod_id,
-			      int       slice_id, 
-			      uint32_t      frame,
-			      uint32_t      subframe,
-			      int           *mbsfn_flag,
-			      Protocol__FlexranMessage **dl_info);
-/*
- * slice specific scheduler for urllc
- */
-void
-flexran_schedule_ue_spec_urllc(mid_t   mod_id,
-			      int       slice_id, 
-			      uint32_t      frame,
-			      uint32_t      subframe,
-			      int           *mbsfn_flag,
-			      Protocol__FlexranMessage **dl_info);
-
-/*
- * slice specific scheduler for mmtc
- */
-void
-flexran_schedule_ue_spec_mmtc(mid_t   mod_id,
-			      int       slice_id, 
-			      uint32_t      frame,
-			      uint32_t      subframe,
-			      int           *mbsfn_flag,
-			      Protocol__FlexranMessage **dl_info);
-/*
- * slice specific scheduler for best effort traffic 
- */
-void
-flexran_schedule_ue_spec_be(mid_t   mod_id,
-			    int       slice_id, 
-			    uint32_t      frame,
-			    uint32_t      subframe,
-			    int           *mbsfn_flag,
-			    Protocol__FlexranMessage **dl_info);
-
-/*
- * common flexran scheduler function
- */
-void
-flexran_schedule_ue_spec_common(mid_t   mod_id,
-				int       slice_id, 
-				uint32_t      frame,
-				uint32_t      subframe,
-				int           *mbsfn_flag,
-				Protocol__FlexranMessage **dl_info);
-
-uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, 
-				      int total_rbs);
-
-int flexran_slice_member(int UE_id, 
-			 int slice_id);
-
-int flexran_slice_maxmcs(int slice_id) ;
-
-void _store_dlsch_buffer (module_id_t Mod_id,
-			  int         slice_id,
-			  frame_t     frameP,
-			  sub_frame_t subframeP);
-
-
-void _assign_rbs_required (module_id_t Mod_id,
-			   int         slice_id,
-			   frame_t     frameP,
-			   sub_frame_t subframe,
-			   uint16_t    nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-			   uint16_t    nb_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES], 
-			   int         min_rb_unit[MAX_NUM_CCs]);
-
-void _dlsch_scheduler_pre_processor (module_id_t   Mod_id,
-				     int           slice_id,
-				     frame_t       frameP,
-				     sub_frame_t   subframeP,
-				     int           N_RBG[MAX_NUM_CCs],
-				     int           *mbsfn_flag);
-
-void _dlsch_scheduler_pre_processor_reset (int module_idP,
-					   int UE_id,
-					   uint8_t  CC_id,
-					   int frameP,
-					   int subframeP,					  
-					   int N_RBG,
-					   uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					   uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					   uint16_t nb_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES],
-					   unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
-					   unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]);
-
-void _dlsch_scheduler_pre_processor_allocate (module_id_t   Mod_id,
-					      int           UE_id,
-					      uint8_t       CC_id,
-					      int           N_RBG,
-					      int           transmission_mode,
-					      int           min_rb_unit,
-					      uint8_t       N_RB_DL,
-					      uint16_t      nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					      uint16_t      nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					      unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
-					      unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]);
-
-/*
- * Default scheduler used by the eNB agent
- */
-void flexran_schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe,
-				      int *mbsfn_flag, Protocol__FlexranMessage **dl_info);
-
-/*
- * Data plane function for applying the DL decisions of the scheduler
- */
-void flexran_apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag,
-					   Protocol__FlexranMessage *dl_scheduling_info);
-
-/*
- * Data plane function for applying the UE specific DL decisions of the scheduler
- */
-void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag,
-						uint32_t n_dl_ue_data, Protocol__FlexDlData **dl_ue_data);
-
-/*
- * Data plane function for filling the DCI structure
- */
-void flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, Protocol__FlexDlDci *dl_dci);
-
-#endif
diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c
deleted file mode 100644
index 38f39e50e10e613a2f979ae8e32a6eaf0cf1901a..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c
+++ /dev/null
@@ -1,551 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */ 
-
-/*! \file flexran_agent_scheduler_dataplane.c
- * \brief data plane procedures related to eNB scheduling
- * \author Xenofon Foukas
- * \date 2016
- * \email: x.foukas@sms.ed.ac.uk
- * \version 0.1
- * @ingroup _mac
-
- */
-
-#include "assertions.h"
-#include "PHY/defs.h"
-#include "PHY/extern.h"
-
-#include "SCHED/defs.h"
-#include "SCHED/extern.h"
-
-#include "LAYER2/MAC/flexran_agent_mac_proto.h"
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/proto.h"
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/flexran_dci_conversions.h"
-
-#include "UTIL/LOG/log.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-#include "UTIL/OPT/opt.h"
-#include "OCG.h"
-#include "OCG_extern.h"
-
-#include "RRC/LITE/extern.h"
-#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
-
-#include "header.pb-c.h"
-#include "flexran.pb-c.h"
-#include "flexran_agent_extern.h"
-
-#include "flexran_agent_common.h"
-
-#include "SIMULATION/TOOLS/defs.h" // for taus
-
-void flexran_apply_dl_scheduling_decisions(mid_t mod_id,
-					   uint32_t frame,
-					   uint32_t subframe,
-					   int *mbsfn_flag,
-					   Protocol__FlexranMessage *dl_scheduling_info) {
-
-  Protocol__FlexDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg;
-
-  // Check if there is anything to schedule for random access
-  if (mac_config->n_dl_rar > 0) {
-    /*TODO: call the random access data plane function*/
-  }
-
-  // Check if there is anything to schedule for paging/broadcast
-  if (mac_config->n_dl_broadcast > 0) {
-    /*TODO: call the broadcast/paging data plane function*/
-  }
-
-  // Check if there is anything to schedule for the UEs
-  if (mac_config->n_dl_ue_data > 0) {
-    flexran_apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag,
-					       mac_config->n_dl_ue_data, mac_config->dl_ue_data);
-  }
-  
-}
-
-
-void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
-						uint32_t frame,
-						uint32_t subframe,
-						int *mbsfn_flag,
-						uint32_t n_dl_ue_data,
-						Protocol__FlexDlData **dl_ue_data) {
-
-  uint8_t               CC_id;
-  int                   UE_id;
-  mac_rlc_status_resp_t rlc_status;
-  unsigned char         ta_len=0;
-  unsigned char         header_len = 0, header_len_tmp = 0;
-  unsigned char         sdu_lcids[11],offset,num_sdus=0;
-  uint16_t              nb_rb;
-  uint16_t              TBS, sdu_lengths[11],rnti,padding=0,post_padding=0;
-  unsigned char         dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
-  uint8_t         round            = 0;
-  uint8_t         harq_pid         = 0;
-  //  LTE_DL_FRAME_PARMS   *frame_parms[MAX_NUM_CCs];
-  LTE_eNB_UE_stats     *eNB_UE_stats     = NULL;
-  uint16_t              sdu_length_total = 0;
-  short                 ta_update        = 0;
-  eNB_MAC_INST         *eNB      = &eNB_mac_inst[mod_id];
-  UE_list_t            *UE_list  = &eNB->UE_list;
-  //  static int32_t          tpc_accumulated=0;
-  UE_sched_ctrl           *ue_sched_ctl;
-
-  int last_sdu_header_len = 0;
-
-  int i, j;
-
-  Protocol__FlexDlData *dl_data;
-  Protocol__FlexDlDci *dl_dci;
-
-  uint32_t rlc_size, n_lc, lcid;
-  
-  // For each UE-related command
-  for (i = 0; i < n_dl_ue_data; i++) {
-    
-    dl_data = dl_ue_data[i];
-    dl_dci = dl_data->dl_dci;
-
-    CC_id = dl_data->serv_cell_index;
-    //    frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-    
-    rnti = dl_data->rnti;
-    UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]);
-
-    ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-    eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
-    
-    round = dl_dci->rv[0];
-    harq_pid = dl_dci->harq_process;
-    
-    //LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d] Scheduling harq %d\n", frame, subframe, harq_pid);
-    //    LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d]Now scheduling harq_pid %d (round %d)\n", frame, subframe, harq_pid, round);
-
-    // If this is a new transmission
-    if (round == 0) {
-      // First we have to deal with the creation of the PDU based on the message instructions
-      rlc_status.bytes_in_buffer = 0;
-      
-      TBS = dl_dci->tbs_size[0];
-      
-      if (dl_data->n_ce_bitmap > 0) {
-	//Check if there is TA command and set the length appropriately
-	ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 2 : 0; 
-      }
-
-      num_sdus = 0;
-      sdu_length_total = 0;
-
-      n_lc = dl_data->n_rlc_pdu;
-      // Go through each one of the channel commands and create SDUs
-      header_len = 0;
-      last_sdu_header_len = 0;
-      for (j = 0; j < n_lc; j++) {
-	sdu_lengths[j] = 0;
-	lcid = dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->logical_channel_id;
-	rlc_size = dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->size;
-	LOG_D(MAC,"[TEST] [eNB %d] [Frame %d] [Subframe %d], LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
-	      mod_id, frame, subframe, lcid, CC_id, rlc_size);
-	if (rlc_size > 0) {
-	  
-	  rlc_status = mac_rlc_status_ind(mod_id,
-	   				  rnti,
-	   				  mod_id,
-	   				  frame,
-					  subframe,
-	   				  ENB_FLAG_YES,
-	   				  MBMS_FLAG_NO,
-	   				  lcid,
-	   				  0);
-
-	  if (rlc_status.bytes_in_buffer > 0) {
-
-	    if (rlc_status.bytes_in_buffer < rlc_size) {
-	      rlc_size = rlc_status.bytes_in_buffer;
-	    }
-
-	    if (rlc_size <= 2) { 
-	      rlc_size = 3; 
-	    } 
-
-	    rlc_status = mac_rlc_status_ind(mod_id,
-					    rnti,
-					    mod_id,
-					    frame,
-						subframe,
-					    ENB_FLAG_YES,
-					    MBMS_FLAG_NO,
-					    lcid,
-					    rlc_size); // transport block set size
-	  
-	    LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid);
-	  
-	    if (rlc_status.bytes_in_buffer > 0) {
-	      
-	      sdu_lengths[j] = mac_rlc_data_req(mod_id,
-						rnti,
-						mod_id,
-						frame,
-						ENB_FLAG_YES,
-						MBMS_FLAG_NO,
-						lcid,
-						rlc_size, //not used
-						(char *)&dlsch_buffer[sdu_length_total]);
-	      
-	      LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[j]);
-	      sdu_length_total += sdu_lengths[j];
-	      sdu_lcids[j] = lcid;
-	      
-	      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[j];
-	      
-	      if (sdu_lengths[j] < 128) {
-		header_len += 2;
-		last_sdu_header_len = 2;
-	      } else {
-		header_len += 3;
-		last_sdu_header_len = 3;
-	      }
-	      num_sdus++;
-	    }
-	  }
-	}
-      } // SDU creation end
-      
-      
-      if (((sdu_length_total + header_len + ta_len) > 0)) {
-	
-	header_len_tmp = header_len;
-	
-	// If we have only a single SDU, header length becomes 1
-	if ((num_sdus) == 1) {
-	  //if (header_len == 2 || header_len == 3) {
-	  header_len = 1;
-	} else {
-	  header_len = (header_len - last_sdu_header_len) + 1;
-	}
-	
-	// If we need a 1 or 2 bit padding or no padding at all
-	if ((TBS - header_len - sdu_length_total - ta_len) <= 2
-	    || (TBS - header_len - sdu_length_total - ta_len) > TBS) { //protect from overflow
-	  padding = (TBS - header_len - sdu_length_total - ta_len);
-	  post_padding = 0;
-	} else { // The last sdu needs to have a length field, since we add padding
-	  padding = 0;
-	  header_len = header_len_tmp;
-	  post_padding = TBS - sdu_length_total - header_len - ta_len; // 1 is for the postpadding header
-	}
-		
-	if (ta_len > 0) {
-	  // Reset the measurement
-	  ta_update = flexran_get_TA(mod_id, UE_id, CC_id);
-	  ue_sched_ctl->ta_timer = 20;
-	  eNB_UE_stats->timing_advance_update = 0;
-	} else {
-	  ta_update = 0;
-	}
-
-	// If there is nothing to schedule, just leave
-	if ((sdu_length_total) <= 0) { 
-	  harq_pid_updated[UE_id][harq_pid] = 1;
-	  harq_pid_round[UE_id][harq_pid] = 0;
-	  continue;
-	}
-
-	//	LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d] TBS is %d and bytes are %d\n", frame, subframe, TBS, sdu_length_total);
-	
-	offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
-				       num_sdus,              //num_sdus
-				       sdu_lengths,  //
-				       sdu_lcids,
-				       255,                                   // no drx
-				       ta_update, // timing advance
-				       NULL,                                  // contention res id
-				       padding,
-				       post_padding);
-
-	
-
-
-	
-#ifdef DEBUG_eNB_SCHEDULER
-	LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n");
-	
-	for (i=0; i<16; i++) {
-	  LOG_T(MAC,"%x.",dlsch_buffer[i]);
-	}
-	
-	LOG_T(MAC,"\n");
-#endif
-	// cycle through SDUs and place in dlsch_buffer
-	memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total);
-	// memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
-	
-	// fill remainder of DLSCH with random data
-	for (j=0; j<(TBS-sdu_length_total-offset); j++) {
-	  UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff);
-	}
-	
-	//eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff);
-	if (opt_enabled == 1) {
-	  trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
-		    TBS, mod_id, 3, UE_RNTI(mod_id, UE_id),
-		    eNB->frame, eNB->subframe,0,0);
-	  LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d  rnti %x  with size %d\n",
-		mod_id, CC_id, frame, UE_RNTI(mod_id,UE_id), TBS);
-	}
-	
-	// store stats
-	eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total;
-	eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1;
-	UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0];
-	
-	UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti;
-	UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti);
-	UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; 
-	UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
-	
-	//nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
-	//Find the number of resource blocks and set them to the template for retransmissions
-	nb_rb = get_min_rb_unit(mod_id, CC_id);
-	uint16_t stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb);
-
-	while (stats_tbs < TBS) {
-	  nb_rb += get_min_rb_unit(mod_id, CC_id);
-	  stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb);
-	}
-
-	//	LOG_I(FLEXRAN_AGENT, "The MCS was %d\n", dl_dci->mcs[0]);
-	
-	UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
-	UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
-	UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0];
-	UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0];
-	UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS;
-	
-	UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS - sdu_length_total;
-	UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total;
-	UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS;
-	UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1;
-	
-	//eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]];
-	//eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
-      } else {
-	LOG_D(FLEXRAN_AGENT, "No need to schedule a dci after all. Just drop it\n");
-	harq_pid_updated[UE_id][harq_pid] = 1;
-	harq_pid_round[UE_id][harq_pid] = 0;
-	continue;
-      }
-    } else {
-      // No need to create anything apart of DCI in case of retransmission
-      /*TODO: Must add these */
-      //      eNB_UE_stats->dlsch_trials[round]++;
-      //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1;
-      //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb;
-      //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb;
-      //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id];
-    }
-
-    //    UE_list->UE_template[CC_id][UE_id].oldNDI[dl_dci->harq_process] = dl_dci->ndi[0];
-    //    eNB_UE_stats->dlsch_mcs1 = dl_dci->mcs[0];
-
-    //Fill the proper DCI of OAI
-    flexran_fill_oai_dci(mod_id, CC_id, rnti, dl_dci);
-  }
-}
-void flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti,
-		  Protocol__FlexDlDci *dl_dci) {
-
-  void         *DLSCH_dci        = NULL;
-  DCI_PDU      *DCI_pdu;
-
-  unsigned char         harq_pid         = 0;
-  //  unsigned char round = 0;
-  LTE_DL_FRAME_PARMS   *frame_parms[MAX_NUM_CCs];
-  int           size_bits = 0, size_bytes = 0;
-  eNB_MAC_INST         *eNB      = &eNB_mac_inst[mod_id];
-  UE_list_t            *UE_list  = &eNB->UE_list;
-  LTE_eNB_UE_stats *eNB_UE_stats = NULL;
-
-  int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]);
-
-  uint32_t format;
-
-  harq_pid = dl_dci->harq_process;
-  //  round = dl_dci->rv[0];
-  
-  // Note this code is for a specific DCI format
-  DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid];
-  DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu;
-  
-  frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id);
-
-  if (dl_dci->has_tpc == 1) {
-    // Check if tpc has been set and reset measurement */
-    if ((dl_dci->tpc == 0) || (dl_dci->tpc == 2)) {
-      eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
-      eNB_UE_stats->Po_PUCCH_update = 0;
-    }
-  }
-  
-  
-  switch (frame_parms[CC_id]->N_RB_DL) {
-  case 6:
-    if (frame_parms[CC_id]->frame_type == TDD) {
-      if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
-	FILL_DCI_TDD_1(DCI1_1_5MHz_TDD_t, DLSCH_dci, dl_dci);
-	size_bytes = sizeof(DCI1_1_5MHz_TDD_t);
-	size_bits  = sizeof_DCI1_1_5MHz_TDD_t;
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
-	//TODO
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
-	//TODO
-      }
-    } else {
-      if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
-	FILL_DCI_FDD_1(DCI1_1_5MHz_FDD_t, DLSCH_dci, dl_dci);
-	size_bytes = sizeof(DCI1_1_5MHz_FDD_t);
-	size_bits  = sizeof_DCI1_1_5MHz_FDD_t;
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
-	//TODO
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
-	  //TODO
-      }
-    }
-    break;
-  case 25:
-    if (frame_parms[CC_id]->frame_type == TDD) {
-      if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
-	FILL_DCI_TDD_1(DCI1_5MHz_TDD_t, DLSCH_dci, dl_dci);
-	size_bytes = sizeof(DCI1_5MHz_TDD_t);
-	size_bits  = sizeof_DCI1_5MHz_TDD_t;
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
-	//TODO
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
-	//TODO
-      }
-    } else {
-      if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
-	FILL_DCI_FDD_1(DCI1_5MHz_FDD_t, DLSCH_dci, dl_dci);
-	size_bytes = sizeof(DCI1_5MHz_FDD_t);
-	size_bits  = sizeof_DCI1_5MHz_FDD_t;
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
-	//TODO
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
-	//TODO
-      }
-    }
-    break;
-  case 50:
-    if (frame_parms[CC_id]->frame_type == TDD) {
-      if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
-	FILL_DCI_TDD_1(DCI1_10MHz_TDD_t, DLSCH_dci, dl_dci);
-	size_bytes = sizeof(DCI1_10MHz_TDD_t);
-	size_bits  = sizeof_DCI1_10MHz_TDD_t;
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
-	//TODO
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
-	//TODO
-      }
-    } else {
-      if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
-	FILL_DCI_FDD_1(DCI1_10MHz_FDD_t, DLSCH_dci, dl_dci);
-	size_bytes = sizeof(DCI1_10MHz_FDD_t);
-	size_bits  = sizeof_DCI1_10MHz_FDD_t;
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
-	//TODO
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
-	//TODO
-      }
-    }
-    break;
-  case 100:
-    if (frame_parms[CC_id]->frame_type == TDD) {
-      if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
-	FILL_DCI_TDD_1(DCI1_20MHz_TDD_t, DLSCH_dci, dl_dci);
-	size_bytes = sizeof(DCI1_20MHz_TDD_t);
-	size_bits  = sizeof_DCI1_20MHz_TDD_t;
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
-	//TODO
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
-	//TODO
-      }
-    } else {
-      if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
-	FILL_DCI_FDD_1(DCI1_20MHz_FDD_t, DLSCH_dci, dl_dci);
-	size_bytes = sizeof(DCI1_20MHz_FDD_t);
-	size_bits  = sizeof_DCI1_20MHz_FDD_t;
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
-	//TODO
-      } else if (dl_dci->format ==  PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
-	//TODO
-      }
-    }
-    break;
-  }
-
-  //Set format to the proper type
-  switch(dl_dci->format) {
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1:
-    format = format1;
-    break;
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1A:
-    format = format1A;
-    break;
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1B:
-    format = format1B;
-    break;
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1C:
-    format = format1C;
-    break;
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D:
-    format = format1E_2A_M10PRB;
-    break;
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2:
-    format  = format2;
-    break;
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A:
-    format = format2A;
-    break;
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2B:
-    format = format2B;
-    break;
-  case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_3:
-    format = 3;
-    break;
-  default:
-    /*TODO: Need to deal with unsupported DCI type*/
-    return;
-  }
-  
-  add_ue_spec_dci(DCI_pdu,
-		  DLSCH_dci,
-		  rnti,
-		  size_bytes,
-		  dl_dci->aggr_level,
-		  size_bits,
-		  format,
-		  0);
-}
diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c
deleted file mode 100644
index 5f1df6766340f637634343be389c027dec12d0a0..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c
+++ /dev/null
@@ -1,1669 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */ 
-
-/*! \file flexran_agent_scheduler_dlsch_ue.c
- * \brief procedures related to eNB for the DLSCH transport channel
- * \author Xenofon Foukas, Navid Nikaein and Raymond Knopp
- * \date 2016
- * \email: x.foukas@sms.ed.ac.uk
- * \version 0.1
- * @ingroup _mac
-
- */
-
-#include "assertions.h"
-#include "PHY/defs.h"
-#include "PHY/extern.h"
-
-#include "SCHED/defs.h"
-#include "SCHED/extern.h"
-
-#include "LAYER2/MAC/flexran_agent_mac_proto.h"
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/proto.h"
-#include "LAYER2/MAC/extern.h"
-#include "UTIL/LOG/log.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-#include "UTIL/OPT/opt.h"
-#include "OCG.h"
-#include "OCG_extern.h"
-
-#include "RRC/LITE/extern.h"
-#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
-
-#include "ENB_APP/flexran_agent_defs.h"
-
-#include "pdcp.h"
-
-#include "header.pb-c.h"
-#include "flexran.pb-c.h"
-#include "flexran_agent_mac.h"
-#include <dlfcn.h>
-
-#include "SIMULATION/TOOLS/defs.h" // for taus
-
-#if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
-#endif
-
-#define ENABLE_MAC_PAYLOAD_DEBUG
-
-/**
- * Local variables to support slicing
- * 
- */
-
-
-/*!\brief  UE ULSCH scheduling states*/
-typedef enum {
-  MIN_SLICE_STRATEGY = 0,
-  SLICE_MASK,
-  UEID_TO_SLICEID,
-  MAX_SLICE_STRATEGY
-} SLICING_STRATEGY;
-
-// this assumes a max of of 16 UE per eNB/CC
-#define SLICE0_MASK 0x000f 
-#define SLICE1_MASK 0x00f0
-#define SLICE2_MASK 0x0f00
-#define SLICE3_MASK 0xf000
-
-
-// number of active slices for  past and current time
-int n_active_slices = 1;
-int n_active_slices_current = 1;
-
-// ue to slice mapping
-int slicing_strategy = UEID_TO_SLICEID;
-int slicing_strategy_current = UEID_TO_SLICEID;
-
-// RB share for each slice for past and current time
-float slice_percentage[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
-float slice_percentage_current[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
-float total_slice_percentage = 0;
-
-// MAX MCS for each slice for past and current time
-int slice_maxmcs[MAX_NUM_SLICES] = {28, 28, 28, 28};
-int slice_maxmcs_current[MAX_NUM_SLICES] = {28, 28, 28, 28};
-
-int update_dl_scheduler[MAX_NUM_SLICES] = {1, 1, 1, 1};
-int update_dl_scheduler_current[MAX_NUM_SLICES] = {1, 1, 1, 1};
-
-// name of available scheduler
-char *dl_scheduler_type[MAX_NUM_SLICES] = {"flexran_schedule_ue_spec_embb",
-					   "flexran_schedule_ue_spec_urllc",
-					   "flexran_schedule_ue_spec_mmtc",
-					   "flexran_schedule_ue_spec_be"      // best effort 
-};
-
-// pointer to the slice specific scheduler 
-slice_scheduler slice_sched[MAX_NUM_SLICES] = {0};
-
-
-/**
- * preprocessor functions for scheduling
- *
- */
-
-
-// This function stores the downlink buffer for all the logical channels
-void _store_dlsch_buffer (module_id_t Mod_id,
-			  int         slice_id,
-			  frame_t     frameP,
-			  sub_frame_t subframeP)
-{
-
-  int                   UE_id,i;
-  rnti_t                rnti;
-  mac_rlc_status_resp_t rlc_status;
-  UE_list_t             *UE_list = &eNB_mac_inst[Mod_id].UE_list;
-  UE_TEMPLATE           *UE_template;
-
-  for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
-    if (UE_list->active[UE_id] != TRUE) continue;
-    
-    if (flexran_slice_member(UE_id, slice_id) == 0)
-      continue;
-    
-    UE_template = &UE_list->UE_template[UE_PCCID(Mod_id,UE_id)][UE_id];
-
-    // clear logical channel interface variables
-    UE_template->dl_buffer_total = 0;
-    UE_template->dl_pdus_total = 0;
-
-    for(i=0; i< MAX_NUM_LCID; i++) {
-      UE_template->dl_buffer_info[i]=0;
-      UE_template->dl_pdus_in_buffer[i]=0;
-      UE_template->dl_buffer_head_sdu_creation_time[i]=0;
-      UE_template->dl_buffer_head_sdu_remaining_size_to_send[i]=0;
-    }
-
-    rnti = UE_RNTI(Mod_id,UE_id);
-
-    for(i=0; i< MAX_NUM_LCID; i++) { // loop over all the logical channels
-
-      rlc_status = mac_rlc_status_ind(Mod_id,rnti, Mod_id,frameP,subframeP,ENB_FLAG_YES,MBMS_FLAG_NO,i,0 );
-      UE_template->dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel
-      UE_template->dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer;
-      UE_template->dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ;
-      UE_template->dl_buffer_head_sdu_creation_time_max = cmax(UE_template->dl_buffer_head_sdu_creation_time_max,
-          rlc_status.head_sdu_creation_time );
-      UE_template->dl_buffer_head_sdu_remaining_size_to_send[i] = rlc_status.head_sdu_remaining_size_to_send;
-      UE_template->dl_buffer_head_sdu_is_segmented[i] = rlc_status.head_sdu_is_segmented;
-      UE_template->dl_buffer_total += UE_template->dl_buffer_info[i];//storing the total dlsch buffer
-      UE_template->dl_pdus_total   += UE_template->dl_pdus_in_buffer[i];
-
-#ifdef DEBUG_eNB_SCHEDULER
-
-      /* note for dl_buffer_head_sdu_remaining_size_to_send[i] :
-       * 0 if head SDU has not been segmented (yet), else remaining size not already segmented and sent
-       */
-      if (UE_template->dl_buffer_info[i]>0)
-        LOG_D(MAC,
-              "[eNB %d][SLICE %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n",
-              Mod_id, slice_id,frameP, subframeP, UE_id,
-              i, UE_template->dl_pdus_in_buffer[i],UE_template->dl_buffer_info[i],
-              UE_template->dl_buffer_head_sdu_creation_time[i],
-              UE_template->dl_buffer_head_sdu_remaining_size_to_send[i],
-              UE_template->dl_buffer_head_sdu_is_segmented[i]
-             );
-
-#endif
-
-    }
-
-    //#ifdef DEBUG_eNB_SCHEDULER
-    if ( UE_template->dl_buffer_total>0)
-      LOG_D(MAC,"[eNB %d] Frame %d Subframe %d : RLC status for UE %d : total DL buffer size %d and total number of pdu %d \n",
-            Mod_id, frameP, subframeP, UE_id,
-            UE_template->dl_buffer_total,
-            UE_template->dl_pdus_total
-           );
-
-    //#endif
-  }
-}
-
-
-// This function returns the estimated number of RBs required by each UE for downlink scheduling
-void _assign_rbs_required (module_id_t Mod_id,
-			   int         slice_id,
-			   frame_t     frameP,
-			   sub_frame_t subframe,
-			   uint16_t    nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-			   uint16_t    nb_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES],
-			   int         min_rb_unit[MAX_NUM_CCs])
-{
-
-
-  rnti_t           rnti;
-  uint16_t         TBS = 0;
-  LTE_eNB_UE_stats *eNB_UE_stats[MAX_NUM_CCs];
-  int              UE_id,n,i,j,CC_id,pCCid,tmp;
-  UE_list_t        *UE_list = &eNB_mac_inst[Mod_id].UE_list;
-  //  UE_TEMPLATE           *UE_template;
-
-  // clear rb allocations across all CC_ids
-  for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
-    if (UE_list->active[UE_id] != TRUE) continue;
-    
-    if (flexran_slice_member(UE_id, slice_id) == 0)
-      continue;
-    
-    pCCid = UE_PCCID(Mod_id,UE_id);
-    rnti = UE_list->UE_template[pCCid][UE_id].rnti;
-
-    /* skip UE not present in PHY (for any of its active CCs) */
-    if (!phy_stats_exist(Mod_id, rnti))
-      continue;
-
-    //update CQI information across component carriers
-    for (n=0; n<UE_list->numactiveCCs[UE_id]; n++) {
-      CC_id = UE_list->ordered_CCids[n][UE_id];
-      eNB_UE_stats[CC_id] = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti);
-      eNB_UE_stats[CC_id]->dlsch_mcs1 = cqi_to_mcs[flexran_get_ue_wcqi(Mod_id, UE_id)];
-    }
-
-    // provide the list of CCs sorted according to MCS
-    for (i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
-      for (j=i+1; j<UE_list->numactiveCCs[UE_id]; j++) {
-        DevAssert( j < MAX_NUM_CCs );
-
-        if (eNB_UE_stats[UE_list->ordered_CCids[i][UE_id]]->dlsch_mcs1 >
-            eNB_UE_stats[UE_list->ordered_CCids[j][UE_id]]->dlsch_mcs1) {
-          tmp = UE_list->ordered_CCids[i][UE_id];
-          UE_list->ordered_CCids[i][UE_id] = UE_list->ordered_CCids[j][UE_id];
-          UE_list->ordered_CCids[j][UE_id] = tmp;
-        }
-      }
-    }
-
-    /* NN --> RK
-     * check the index of UE_template"
-     */
-    if (UE_list->UE_template[pCCid][UE_id].dl_buffer_total> 0) {
-      LOG_D(MAC,"[preprocessor] assign RB for UE %d\n",UE_id);
-
-      for (i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
-        CC_id = UE_list->ordered_CCids[i][UE_id];
-	eNB_UE_stats[CC_id] = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti);
-
-        if (cqi_to_mcs[flexran_get_ue_wcqi(Mod_id, UE_id)] == 0) {//eNB_UE_stats[CC_id]->dlsch_mcs1==0) {
-          nb_rbs_required[CC_id][UE_id] = 4;  // don't let the TBS get too small
-        } else {
-          nb_rbs_required[CC_id][UE_id] = min_rb_unit[CC_id];
-        }
-
-        TBS = mac_xface->get_TBS_DL(cqi_to_mcs[flexran_get_ue_wcqi(Mod_id, UE_id)], nb_rbs_required[CC_id][UE_id]);
-	nb_rbs_allowed_slice[CC_id][slice_id] = flexran_nb_rbs_allowed_slice(slice_percentage[slice_id],
-									     flexran_get_N_RB_DL(Mod_id, CC_id));
-        LOG_D(MAC,"[preprocessor] start RB assignement for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n",
-              UE_id, CC_id, UE_list->UE_template[pCCid][UE_id].dl_buffer_total,
-              nb_rbs_required[CC_id][UE_id], flexran_get_ue_wcqi(Mod_id, UE_id), TBS);
-
-        /* calculating required number of RBs for each UE */
-        while (TBS < UE_list->UE_template[pCCid][UE_id].dl_buffer_total)  {
-          nb_rbs_required[CC_id][UE_id] += min_rb_unit[CC_id];
-
-          if (nb_rbs_required[CC_id][UE_id] > nb_rbs_allowed_slice[CC_id][slice_id]) {
-            TBS = mac_xface->get_TBS_DL(flexran_get_ue_wcqi(Mod_id, UE_id), nb_rbs_allowed_slice[CC_id][slice_id]);
-            nb_rbs_required[CC_id][UE_id] = nb_rbs_allowed_slice[CC_id][slice_id];
-            break;
-          }
-
-          TBS = mac_xface->get_TBS_DL(cqi_to_mcs[flexran_get_ue_wcqi(Mod_id, UE_id)], nb_rbs_required[CC_id][UE_id]);
-        } // end of while
-
-        LOG_D(MAC,"[eNB %d][SLICE %d] Frame %d: UE %d on CC %d: RB unit %d,  nb_required RB %d (TBS %d, mcs %d)\n",
-              Mod_id, slice_id,frameP,UE_id, CC_id,  min_rb_unit[CC_id], nb_rbs_required[CC_id][UE_id], TBS, cqi_to_mcs[flexran_get_ue_wcqi(Mod_id, UE_id)]);
-      }
-    }
-  }
-}
-
-void _dlsch_scheduler_pre_processor_allocate (module_id_t   Mod_id,
-					      int           UE_id,
-					      uint8_t       CC_id,
-					      int           N_RBG,
-					      int           transmission_mode,
-					      int           min_rb_unit,
-					      uint8_t       N_RB_DL,
-					      uint16_t      nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					      uint16_t      nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					      unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
-					      unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]) {
-  int i;
-  UE_list_t *UE_list=&eNB_mac_inst[Mod_id].UE_list;
-  UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-
-  for(i=0; i<N_RBG; i++) {
-
-    if((rballoc_sub[CC_id][i] == 0)           &&
-        (ue_sched_ctl->rballoc_sub_UE[CC_id][i] == 0) &&
-        (nb_rbs_required_remaining[CC_id][UE_id]>0)   &&
-        (ue_sched_ctl->pre_nb_available_rbs[CC_id] < nb_rbs_required[CC_id][UE_id])) {
-
-      // if this UE is not scheduled for TM5
-      if (ue_sched_ctl->dl_pow_off[CC_id] != 0 )  {
-
-	if ((i == N_RBG-1) && ((N_RB_DL == 25) || (N_RB_DL == 50))) {
-	  rballoc_sub[CC_id][i] = 1;
-	  ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1;
-	  MIMO_mode_indicator[CC_id][i] = 1;
-	  if (transmission_mode == 5 ) {
-	    ue_sched_ctl->dl_pow_off[CC_id] = 1;
-	  }   
-	  nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit+1;
-          ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit - 1;
-        } else {
-	  if (nb_rbs_required_remaining[CC_id][UE_id] >=  min_rb_unit){
-	    rballoc_sub[CC_id][i] = 1;
-	    ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1;
-	    MIMO_mode_indicator[CC_id][i] = 1;
-	    if (transmission_mode == 5 ) {
-	      ue_sched_ctl->dl_pow_off[CC_id] = 1;
-	    }
-	    nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit;
-	    ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit;
-	  }
-	}
-      } // dl_pow_off[CC_id][UE_id] ! = 0
-    }
-  }
-}
-
-void _dlsch_scheduler_pre_processor_reset (int module_idP,
-					   int UE_id,
-					   uint8_t  CC_id,
-					   int frameP,
-					   int subframeP,					  
-					   int N_RBG,
-					   uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					   uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					   uint16_t nb_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES],
-					   unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
-					   unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]) {
-  int i,j;
-  UE_list_t *UE_list=&eNB_mac_inst[module_idP].UE_list;
-  UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-  uint8_t *vrb_map = eNB_mac_inst[module_idP].common_channels[CC_id].vrb_map;
-  int RBGsize = PHY_vars_eNB_g[module_idP][CC_id]->frame_parms.N_RB_DL/N_RBG;
-#ifdef SF05_LIMIT
-  //int subframe05_limit=0;
-  int sf05_upper=-1,sf05_lower=-1;
-#endif
-  //  LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti);
-  
-  flexran_update_TA(module_idP, UE_id, CC_id);
-
-  if (UE_id==0) {
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_TIMING_ADVANCE,ue_sched_ctl->ta_update);
-  }
-  nb_rbs_required[CC_id][UE_id]=0;
-  ue_sched_ctl->pre_nb_available_rbs[CC_id] = 0;
-  ue_sched_ctl->dl_pow_off[CC_id] = 2;
-  nb_rbs_required_remaining[CC_id][UE_id] = 0;
-  for (i=0; i<n_active_slices;i++)
-    nb_rbs_allowed_slice[CC_id][i] = 0;
-#ifdef SF05_LIMIT  
-  switch (N_RBG) {
-  case 6:
-    sf05_lower=0;
-    sf05_upper=5;
-    break;
-  case 8:
-    sf05_lower=2;
-    sf05_upper=5;
-    break;
-  case 13:
-    sf05_lower=4;
-    sf05_upper=7;
-    break;
-  case 17:
-    sf05_lower=7;
-    sf05_upper=9;
-    break;
-  case 25:
-    sf05_lower=11;
-    sf05_upper=13;
-    break;
-  }
-#endif
-  // Initialize Subbands according to VRB map
-  for (i=0; i<N_RBG; i++) {
-    ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 0;
-    rballoc_sub[CC_id][i] = 0;
-#ifdef SF05_LIMIT
-    // for avoiding 6+ PRBs around DC in subframe 0-5 (avoid excessive errors)
-
-    if ((subframeP==0 || subframeP==5) && 
-	(i>=sf05_lower && i<=sf05_upper))
-      rballoc_sub[CC_id][i]=1;
-#endif
-    // for SI-RNTI,RA-RNTI and P-RNTI allocations
-    for (j=0;j<RBGsize;j++) {
-      if (vrb_map[j+(i*RBGsize)]!=0)  {
-	rballoc_sub[CC_id][i] = 1;
-	LOG_D(MAC,"Frame %d, subframe %d : vrb %d allocated\n",frameP,subframeP,j+(i*RBGsize));
-	break;
-      }
-    }
-    LOG_D(MAC,"Frame %d Subframe %d CC_id %d RBG %i : rb_alloc %d\n",frameP,subframeP,CC_id,i,rballoc_sub[CC_id][i]);
-    MIMO_mode_indicator[CC_id][i] = 2;
-  }
-}
-
-// This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done
-void _dlsch_scheduler_pre_processor (module_id_t   Mod_id,
-				     int      slice_id,
-				     frame_t       frameP,
-				     sub_frame_t   subframeP,
-				     int           N_RBG[MAX_NUM_CCs],
-				     int           *mbsfn_flag)
-{
-
-  unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX], total_ue_count;
-  unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX];
-  int                     UE_id, i;
-  uint8_t round = 0;
-  uint8_t harq_pid = 0;
-  uint16_t                ii,j;
-  uint16_t                nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  uint16_t                nb_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES];
-  uint16_t                nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  uint16_t                nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  uint16_t                average_rbs_per_user[MAX_NUM_CCs] = {0};
-  rnti_t             rnti;
-  int                min_rb_unit[MAX_NUM_CCs];
-  uint16_t r1=0;
-  uint8_t CC_id;
-  UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list;
-  LTE_DL_FRAME_PARMS   *frame_parms[MAX_NUM_CCs] = {0};
-
-  int transmission_mode = 0;
-  UE_sched_ctrl *ue_sched_ctl;
-  
-  
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    
-    if (mbsfn_flag[CC_id]>0)  // If this CC is allocated for MBSFN skip it here
-      continue;
-    
-    frame_parms[CC_id] = mac_xface->get_lte_frame_parms(Mod_id,CC_id);
-    
-    
-    min_rb_unit[CC_id]=get_min_rb_unit(Mod_id,CC_id);
-    
-    for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
-      if (UE_list->active[i] != TRUE) continue;
-
-      UE_id = i;
-      // Initialize scheduling information for all active UEs
-      
-      //if (flexran_slice_member(UE_id, slice_id) == 0)
-      //continue;
-      _dlsch_scheduler_pre_processor_reset(Mod_id,
-					   UE_id,
-					   CC_id,
-					   frameP,
-					   subframeP,
-					   N_RBG[CC_id],
-					   nb_rbs_required,
-					   nb_rbs_required_remaining,
-					   nb_rbs_allowed_slice, 
-					   rballoc_sub,
-					   MIMO_mode_indicator);
-
-    }
-  }
-  
-  // Store the DLSCH buffer for each logical channel
-  _store_dlsch_buffer (Mod_id,slice_id,frameP,subframeP);
-
-  // Calculate the number of RBs required by each UE on the basis of logical channel's buffer
-  _assign_rbs_required (Mod_id,slice_id, frameP,subframeP,nb_rbs_required,nb_rbs_allowed_slice,min_rb_unit);
-
-  // Sorts the user on the basis of dlsch logical channel buffer and CQI
-  sort_UEs (Mod_id,frameP,subframeP);
-
-  total_ue_count = 0;
-
-  // loop over all active UEs
-  for (i=UE_list->head; i>=0; i=UE_list->next[i]) { 
-    rnti = flexran_get_ue_crnti(Mod_id, i);
-    if(rnti == NOT_A_RNTI)
-      continue;
-    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
-      continue;
-
-    UE_id = i;
-    
-    if (flexran_slice_member(UE_id, slice_id) == 0)
-      continue;
-    
-    if (!phy_stats_exist(Mod_id, rnti))
-      continue;
-
-    for (ii=0; ii < UE_num_active_CC(UE_list,UE_id); ii++) {
-      CC_id = UE_list->ordered_CCids[ii][UE_id];
-      ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-      ue_sched_ctl->max_allowed_rbs[CC_id]=nb_rbs_allowed_slice[CC_id][slice_id];
-      flexran_get_harq(Mod_id, CC_id, UE_id, frameP, subframeP, &harq_pid, &round);
-
-      // if there is no available harq_process, skip the UE
-      if (UE_list->UE_sched_ctrl[UE_id].harq_pid[CC_id]<0)
-        continue;
-
-      average_rbs_per_user[CC_id]=0;
-
-      frame_parms[CC_id] = mac_xface->get_lte_frame_parms(Mod_id,CC_id);
-
-      //      mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,frameP,subframeP,&harq_pid,&round,0);
-
-      if(round>0) {
-        nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
-      }
-
-      //nb_rbs_required_remaining[UE_id] = nb_rbs_required[UE_id];
-      if (nb_rbs_required[CC_id][UE_id] > 0) {
-        total_ue_count = total_ue_count + 1;
-      }
-
-
-      // hypotetical assignement
-      /*
-       * If schedule is enabled and if the priority of the UEs is modified
-       * The average rbs per logical channel per user will depend on the level of
-       * priority. Concerning the hypothetical assignement, we should assign more
-       * rbs to prioritized users. Maybe, we can do a mapping between the
-       * average rbs per user and the level of priority or multiply the average rbs
-       * per user by a coefficient which represents the degree of priority.
-       */
-
-      if (total_ue_count == 0) {
-        average_rbs_per_user[CC_id] = 0;
-      } else if( (min_rb_unit[CC_id] * total_ue_count) <= nb_rbs_allowed_slice[CC_id][slice_id] ) {
-        average_rbs_per_user[CC_id] = (uint16_t) floor(nb_rbs_allowed_slice[CC_id][slice_id]/total_ue_count);
-      } else {
-        average_rbs_per_user[CC_id] = min_rb_unit[CC_id]; // consider the total number of use that can be scheduled UE
-      }
-    }
-  }
-
-  // note: nb_rbs_required is assigned according to total_buffer_dl
-  // extend nb_rbs_required to capture per LCID RB required
-  for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
-    rnti = UE_RNTI(Mod_id,i);
-   
-    if(rnti == NOT_A_RNTI)
-      continue;
-
-    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
-      continue;
-
-    if (!phy_stats_exist(Mod_id, rnti))
-      continue;
-
-    if (flexran_slice_member(i, slice_id) == 0)
-      continue;
-    
-    for (ii=0; ii<UE_num_active_CC(UE_list,i); ii++) {
-      CC_id = UE_list->ordered_CCids[ii][i];
-
-      // control channel
-      if (mac_eNB_get_rrc_status(Mod_id,rnti) < RRC_RECONFIGURED) {
-        nb_rbs_required_remaining_1[CC_id][i] = nb_rbs_required[CC_id][i];
-      } else {
-        nb_rbs_required_remaining_1[CC_id][i] = cmin(average_rbs_per_user[CC_id],nb_rbs_required[CC_id][i]);
-
-      }
-    }
-  }
-
-  //Allocation to UEs is done in 2 rounds,
-  // 1st stage: average number of RBs allocated to each UE
-  // 2nd stage: remaining RBs are allocated to high priority UEs
-  for(r1=0; r1<2; r1++) {
-
-    for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
-      
-      if (flexran_slice_member(i, slice_id) == 0)
-	continue;
-      
-      for (ii=0; ii<UE_num_active_CC(UE_list,i); ii++) {
-        CC_id = UE_list->ordered_CCids[ii][i];
-
-        if(r1 == 0) {
-          nb_rbs_required_remaining[CC_id][i] = nb_rbs_required_remaining_1[CC_id][i];
-        } else { // rb required based only on the buffer - rb allloctaed in the 1st round + extra reaming rb form the 1st round
-          nb_rbs_required_remaining[CC_id][i] = nb_rbs_required[CC_id][i]-nb_rbs_required_remaining_1[CC_id][i]+nb_rbs_required_remaining[CC_id][i];
-        }
-
-        if (nb_rbs_required[CC_id][i]> 0 )
-          LOG_D(MAC,"round %d : nb_rbs_required_remaining[%d][%d]= %d (remaining_1 %d, required %d,  pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n",
-                r1, CC_id, i,
-                nb_rbs_required_remaining[CC_id][i],
-                nb_rbs_required_remaining_1[CC_id][i],
-                nb_rbs_required[CC_id][i],
-                UE_list->UE_sched_ctrl[i].pre_nb_available_rbs[CC_id],
-                N_RBG[CC_id],
-                min_rb_unit[CC_id]);
-
-      }
-    }
-
-    if (total_ue_count > 0 ) {
-      for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
-        UE_id = i;
-	
-	if (flexran_slice_member(UE_id, slice_id) == 0)
-	  continue;
-        
-	for (ii=0; ii<UE_num_active_CC(UE_list,UE_id); ii++) {
-          CC_id = UE_list->ordered_CCids[ii][UE_id];
-	  ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-	  flexran_get_harq(Mod_id, CC_id, UE_id, frameP, subframeP, &harq_pid, &round);	  
-          rnti = UE_RNTI(Mod_id,UE_id);
-
-          // LOG_D(MAC,"UE %d rnti 0x\n", UE_id, rnti );
-          if(rnti == NOT_A_RNTI)
-            continue;
-
-	  if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
-	    continue;
-
-	  if (!phy_stats_exist(Mod_id, rnti))
-            continue;
-
-          transmission_mode = mac_xface->get_transmission_mode(Mod_id,CC_id,rnti);
-          //rrc_status = mac_eNB_get_rrc_status(Mod_id,rnti);
-          /* 1st allocate for the retx */
-
-          // retransmission in data channels
-          // control channel in the 1st transmission
-          // data channel for all TM
-          LOG_T(MAC,"calling dlsch_scheduler_pre_processor_allocate .. \n ");
-          _dlsch_scheduler_pre_processor_allocate (Mod_id,
-						   UE_id,
-						   CC_id,
-						   N_RBG[CC_id],
-						   transmission_mode,
-						   min_rb_unit[CC_id],
-						   frame_parms[CC_id]->N_RB_DL,
-						   nb_rbs_required,
-						   nb_rbs_required_remaining,
-						   rballoc_sub,
-						   MIMO_mode_indicator);
-        }
-      }
-    } // total_ue_count
-  } // end of for for r1 and r2
-
-  for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
-    UE_id = i;
-    ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
- 
-    if (flexran_slice_member(UE_id, slice_id) == 0)
-      continue;
-
-    for (ii=0; ii<UE_num_active_CC(UE_list,UE_id); ii++) {
-      CC_id = UE_list->ordered_CCids[ii][UE_id];
-      //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].dl_pow_off = dl_pow_off[UE_id];
-
-      if (ue_sched_ctl->pre_nb_available_rbs[CC_id] > 0 ) {
-        LOG_D(MAC,"******************DL Scheduling Information for UE%d ************************\n",UE_id);
-        LOG_D(MAC,"dl power offset UE%d = %d \n",UE_id,ue_sched_ctl->dl_pow_off[CC_id]);
-        LOG_D(MAC,"***********RB Alloc for every subband for UE%d ***********\n",UE_id);
-
-        for(j=0; j<N_RBG[CC_id]; j++) {
-          //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].rballoc_sub[i] = rballoc_sub_UE[CC_id][UE_id][i];
-          LOG_D(MAC,"RB Alloc for UE%d and Subband%d = %d\n",UE_id,j,ue_sched_ctl->rballoc_sub_UE[CC_id][j]);
-        }
-
-        //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = pre_nb_available_rbs[CC_id][UE_id];
-        LOG_D(MAC,"[eNB %d][SLICE %d] Total RBs allocated for UE%d = %d\n",
-	      Mod_id, slice_id, UE_id,ue_sched_ctl->pre_nb_available_rbs[CC_id]);
-      }
-    }
-  }
-}
-
-#define SF05_LIMIT 1
-
-/*
- * Main scheduling functions to support slicing
- *
- */
-
-void
-flexran_schedule_ue_spec_default(mid_t   mod_id,
-				 uint32_t      frame,
-				 uint32_t      subframe,
-				 int           *mbsfn_flag,
-				 Protocol__FlexranMessage **dl_info)
-//------------------------------------------------------------------------------
-{
-  int i=0;
-  
-  flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
-   
-  for (i = 0; i < n_active_slices; i++) {
-    
-    // Load any updated functions
-    if (update_dl_scheduler[i] > 0 ) {
-      slice_sched[i] = dlsym(NULL, dl_scheduler_type[i]); 
-      update_dl_scheduler[i] = 0;
-      update_dl_scheduler_current[i] = 0;
-      slice_percentage_current[i]= slice_percentage[i];
-      total_slice_percentage+=slice_percentage[i];
-      LOG_N(MAC,"update dl scheduler slice %d\n", i);
-    }
- 
-    // check if the number of slices has changed, and log 
-    if (n_active_slices_current != n_active_slices ){
-      if ((n_active_slices > 0) && (n_active_slices <= MAX_NUM_SLICES)) {
-	LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active slices has changed: %d-->%d\n",
-	      mod_id, frame, subframe, n_active_slices_current, n_active_slices);
-	n_active_slices_current = n_active_slices;
-      } else {
-	LOG_W(MAC,"invalid number of slices %d, revert to the previous value %d\n",n_active_slices, n_active_slices_current);
-	n_active_slices = n_active_slices_current;
-      }
-    }
-    
-    // check if the slice rb share has changed, and log the console
-    if (slice_percentage_current[i] != slice_percentage[i]){
-      if ((slice_percentage[i] >= 0.0) && (slice_percentage[i] <= 1.0)){
-	if ((total_slice_percentage - slice_percentage_current[i]  + slice_percentage[i]) <= 1.0) {
-	  total_slice_percentage=total_slice_percentage - slice_percentage_current[i]  + slice_percentage[i];
-	  LOG_N(MAC,"[eNB %d][SLICE %d] frame %d subframe %d: total percentage %f, slice RB percentage has changed: %f-->%f\n",
-		mod_id, i, frame, subframe, total_slice_percentage, slice_percentage_current[i], slice_percentage[i]);
-	  slice_percentage_current[i] = slice_percentage[i];
-	} else {
-	  LOG_W(MAC,"[eNB %d][SLICE %d] invalid total RB share (%f->%f), revert the previous value (%f->%f)\n",
-		mod_id,i,  
-		total_slice_percentage,
-		total_slice_percentage - slice_percentage_current[i]  + slice_percentage[i],
-		slice_percentage[i],slice_percentage_current[i]);
-	  slice_percentage[i]= slice_percentage_current[i];
-
-	}
-      } else {
-	LOG_W(MAC,"[eNB %d][SLICE %d] invalid slice RB share, revert the previous value (%f->%f)\n",mod_id, i,  slice_percentage[i],slice_percentage_current[i]);
-	slice_percentage[i]= slice_percentage_current[i];
-
-      }
-    }
-  
-    // check if the slice max MCS, and log the console
-    if (slice_maxmcs_current[i] != slice_maxmcs[i]){
-      if ((slice_maxmcs[i] >= 0) && (slice_maxmcs[i] < 29)){
-	LOG_N(MAC,"[eNB %d][SLICE %d] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n",
-	      mod_id, i, frame, subframe, slice_maxmcs_current[i], slice_maxmcs[i]);
-	slice_maxmcs_current[i] = slice_maxmcs[i];
-      } else {
-	LOG_W(MAC,"[eNB %d][SLICE %d] invalid slice max mcs %d, revert the previous value %d\n",mod_id, i,  slice_percentage[i],slice_percentage[i]);
-	slice_maxmcs[i]= slice_maxmcs_current[i];
-      }
-    }
-    
-    // check if a new scheduler, and log the console
-    if (update_dl_scheduler_current[i] != update_dl_scheduler[i]){
-      LOG_N(MAC,"[eNB %d][SLICE %d] frame %d subframe %d: DL scheduler for this slice is updated: %s \n",
-	    mod_id, i, frame, subframe, dl_scheduler_type[i]);
-      update_dl_scheduler_current[i] = update_dl_scheduler[i];
-    }
-
-    // Run each enabled slice-specific schedulers one by one
-    //LOG_N(MAC,"[eNB %d]frame %d subframe %d slice %d: calling the scheduler\n", mod_id, frame, subframe,i);
-    slice_sched[i](mod_id, i, frame, subframe, mbsfn_flag,dl_info);
-
-  }
-  
-}
-
-uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs){
-  return  (uint16_t) floor(rb_percentage * total_rbs); 
-}
-
-int flexran_slice_maxmcs(int slice_id) {
-  return slice_maxmcs[slice_id];
-}
-
-int flexran_slice_member(int UE_id, int slice_id){
-  // group membership definition
-  int slice_member = 0 ;
-  
-  if ((slice_id < 0) || (slice_id > n_active_slices))
-    LOG_W(MAC,"out of range slice id %d\n",slice_id);
-
-  switch (slicing_strategy) {
-  case SLICE_MASK:
-    switch (slice_id){
-    case 0:
-      if (SLICE0_MASK&UE_id){
-	slice_member=1;
-      }
-      break;
-    case 1:
-      if (SLICE1_MASK&UE_id){
-	slice_member=1;
-      }
-      break;
-    case 2:
-      if (SLICE2_MASK&UE_id){
-	slice_member=1;
-      }
-       break;
-    case 3:
-      if (SLICE3_MASK&UE_id){
-	slice_member=1;
-      }
-      break;
-    default :
-      LOG_W(MAC,"unknown slice_id %d\n", slice_id);
-      break;
-      
-    }
-    break;
-  case UEID_TO_SLICEID:
-  default:
-    if ((UE_id % n_active_slices) == slice_id){
-      slice_member= 1; // this ue is a member of this slice
-    }
-    break;
-  }
-  
-  return slice_member;
-}
-/* more aggressive rb and mcs allocation with medium priority and the traffic qci */
-void
-flexran_schedule_ue_spec_embb(mid_t         mod_id,
-			      int           slice_id, 
-			      uint32_t      frame,
-			      uint32_t      subframe,
-			      int           *mbsfn_flag,
-			      Protocol__FlexranMessage **dl_info)
-
-{
-  flexran_schedule_ue_spec_common(mod_id,
-				  slice_id,
-				  frame,
-				  subframe,
-				  mbsfn_flag,
-				  dl_info);
-  
-}
-/* more conservative mcs allocation with high priority and the traffic qci */
-void
-flexran_schedule_ue_spec_urllc(mid_t         mod_id,
-			       int           slice_id, 
-			       uint32_t      frame,
-			       uint32_t      subframe,
-			       int           *mbsfn_flag,
-			       Protocol__FlexranMessage **dl_info)
-
-{
-  flexran_schedule_ue_spec_common(mod_id,
-				  slice_id,
-				  frame,
-				  subframe,
-				  mbsfn_flag,
-				  dl_info);
-  
-}
-/* constant rb allocation with low mcs with low priority and given the UE capabilities */
-void
-flexran_schedule_ue_spec_mmtc(mid_t         mod_id,
-			      int           slice_id, 
-			      uint32_t      frame,
-			      uint32_t      subframe,
-			      int           *mbsfn_flag,
-			      Protocol__FlexranMessage **dl_info)
-  
-{
-  
-  flexran_schedule_ue_spec_common(mod_id,
-				  slice_id,
-				  frame,
-				  subframe,
-				  mbsfn_flag,
-				  dl_info);
-  
-}
-/* regular rb and mcs allocation with low priority */
-void
-flexran_schedule_ue_spec_be(mid_t         mod_id,
-			    int           slice_id, 
-			    uint32_t      frame,
-			    uint32_t      subframe,
-			    int           *mbsfn_flag,
-			    Protocol__FlexranMessage **dl_info)
-  
-{
-  
-  flexran_schedule_ue_spec_common(mod_id,
-				  slice_id,
-				  frame,
-				  subframe,
-				  mbsfn_flag,
-				  dl_info);
-  
-}
-
-//------------------------------------------------------------------------------
-void
-flexran_schedule_ue_spec_common(mid_t   mod_id,
-				int           slice_id, 
-				uint32_t      frame,
-				uint32_t      subframe,
-				int           *mbsfn_flag,
-				Protocol__FlexranMessage **dl_info)
-//------------------------------------------------------------------------------
-{
-  uint8_t               CC_id;
-  int                   UE_id;
-  int                   N_RBG[MAX_NUM_CCs];
-  unsigned char         aggregation;
-  mac_rlc_status_resp_t rlc_status;
-  unsigned char         header_len = 0, header_len_last = 0, ta_len = 0;
-  uint16_t              nb_rb, nb_rb_temp, total_nb_available_rb[MAX_NUM_CCs], nb_available_rb;
-  uint16_t              TBS, j, rnti;
-  uint8_t         round            = 0;
-  uint8_t         harq_pid         = 0;
-  uint16_t              sdu_length_total = 0;
-  int                   mcs, mcs_tmp;
-  uint16_t              min_rb_unit[MAX_NUM_CCs];
-  eNB_MAC_INST         *eNB      = &eNB_mac_inst[mod_id];
-  /* TODO: Must move the helper structs to scheduler implementation */
-  UE_list_t            *UE_list  = &eNB->UE_list;
-  int32_t                 normalized_rx_power, target_rx_power;
-  int32_t                 tpc = 1;
-  static int32_t          tpc_accumulated=0;
-  UE_sched_ctrl           *ue_sched_ctl;
-  LTE_eNB_UE_stats     *eNB_UE_stats     = NULL;
-  Protocol__FlexDlData *dl_data[NUM_MAX_UE];
-  int num_ues_added = 0;
-  int channels_added = 0;
-
-  Protocol__FlexDlDci *dl_dci;
-  Protocol__FlexRlcPdu *rlc_pdus[11];
-  uint32_t ce_flags = 0;
-
-  uint8_t            rballoc_sub[25];
-  int i;
-  uint32_t data_to_request;
-  uint32_t dci_tbs;
-  uint8_t ue_has_transmission = 0;
-  uint32_t ndi;
-  
-#if 0
-  
-  if (UE_list->head==-1) {
-    return;
-  }
-  
-#endif
-
-  start_meas(&eNB->schedule_dlsch);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN);
-
-  //weight = get_ue_weight(module_idP,UE_id);
-  aggregation = 1; // set to the maximum aggregation level
-
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    min_rb_unit[CC_id] = get_min_rb_unit(mod_id, CC_id);
-    // get number of PRBs less those used by common channels
-    total_nb_available_rb[CC_id] = flexran_get_N_RB_DL(mod_id, CC_id);
-    for (i=0;i < flexran_get_N_RB_DL(mod_id, CC_id); i++)
-      if (eNB->common_channels[CC_id].vrb_map[i] != 0)
-	total_nb_available_rb[CC_id]--;
-    
-    N_RBG[CC_id] = flexran_get_N_RBG(mod_id, CC_id);
-
-    // store the global enb stats:
-    eNB->eNB_stats[CC_id].num_dlactive_UEs =  UE_list->num_UEs;
-    eNB->eNB_stats[CC_id].available_prbs =  total_nb_available_rb[CC_id];
-    eNB->eNB_stats[CC_id].total_available_prbs +=  total_nb_available_rb[CC_id];
-    eNB->eNB_stats[CC_id].dlsch_bytes_tx=0;
-    eNB->eNB_stats[CC_id].dlsch_pdus_tx=0;
-  }
-
-   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_IN);
-
-   start_meas(&eNB->schedule_dlsch_preprocessor);
-   _dlsch_scheduler_pre_processor(mod_id,
-				  slice_id,
-				  frame,
-				  subframe,
-				  N_RBG,
-				  mbsfn_flag);
-   stop_meas(&eNB->schedule_dlsch_preprocessor);
-   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT);
-
-   for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n",CC_id);
-
-    if (mbsfn_flag[CC_id]>0)
-      continue;
-    
-    for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
-  
-      rnti = flexran_get_ue_crnti(mod_id, UE_id);
-      eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
-      ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-      
-      if (eNB_UE_stats==NULL) {
-	LOG_D(MAC,"[eNB] Cannot find eNB_UE_stats\n");
-        //  mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n");
-	continue;
-      }
-      
-      if (flexran_slice_member(UE_id, slice_id) == 0)
-      	continue;
-      
-      if (rnti==NOT_A_RNTI) {
-        LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n", UE_id,UE_list->num_UEs);
-        // mac_xface->macphy_exit("Cannot find rnti for UE_id");
-        continue;
-      }
-
-      switch(mac_xface->get_transmission_mode(mod_id,CC_id,rnti)){
-      case 1:
-      case 2:
-      case 7:
-	aggregation = get_aggregation(get_bw_index(mod_id,CC_id), 
-				      eNB_UE_stats->DL_cqi[0],
-				      format1);
-	break;
-      case 3:
-	aggregation = get_aggregation(get_bw_index(mod_id,CC_id), 
-				      eNB_UE_stats->DL_cqi[0],
-				      format2A);
-	break;
-      default:
-	LOG_W(MAC,"Unsupported transmission mode %d\n", mac_xface->get_transmission_mode(mod_id,CC_id,rnti));
-	aggregation = 2;
-      }
-     
-      if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) ||  // no RBs allocated 
-	  CCE_allocation_infeasible(mod_id, CC_id, 0, subframe, aggregation, rnti)) {
-        LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n",
-              mod_id, frame, UE_id, CC_id);
-        //if(mac_xface->get_transmission_mode(module_idP,rnti)==5)
-        continue; //to next user (there might be rbs availiable for other UEs in TM5
-        // else
-        //  break;
-      }
-
-      if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD)  {
-        set_ue_dai (subframe,
-                    flexran_get_subframe_assignment(mod_id, CC_id),
-                    UE_id,
-                    CC_id,
-                    UE_list);
-        //TODO: update UL DAI after DLSCH scheduling
-        //set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms);
-      }
-
-      channels_added = 0;
-
-      // After this point all the UEs will be scheduled
-      dl_data[num_ues_added] = (Protocol__FlexDlData *) malloc(sizeof(Protocol__FlexDlData));
-      protocol__flex_dl_data__init(dl_data[num_ues_added]);
-      dl_data[num_ues_added]->has_rnti = 1;
-      dl_data[num_ues_added]->rnti = rnti;
-      dl_data[num_ues_added]->n_rlc_pdu = 0;
-      dl_data[num_ues_added]->has_serv_cell_index = 1;
-      dl_data[num_ues_added]->serv_cell_index = CC_id;
-      
-      nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
-      flexran_get_harq(mod_id, CC_id, UE_id, frame, subframe, &harq_pid, &round);
-      sdu_length_total=0;
-      mcs = cqi_to_mcs[flexran_get_ue_wcqi(mod_id, UE_id)];
-      //      LOG_I(FLEXRAN_AGENT, "The MCS is %d\n", mcs);
-      mcs = cmin(mcs,flexran_slice_maxmcs(slice_id));
-#ifdef EXMIMO
-
-       if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti) == 5) {
-	  mcs = cqi_to_mcs[flexran_get_ue_wcqi(mod_id, UE_id)];
-	  mcs =  cmin(mcs,16);
-       }
-
-#endif
-
-      // initializing the rb allocation indicator for each UE
-       for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) {
-        UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0;
-	rballoc_sub[j] = 0;
-      }
-
-      /* LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", */
-      /*       mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, */
-      /*       eNB_UE_stats->DL_cqi[0], mcs, */
-      /*       UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); */
-
-      dl_dci = (Protocol__FlexDlDci*) malloc(sizeof(Protocol__FlexDlDci));
-      protocol__flex_dl_dci__init(dl_dci);
-      dl_data[num_ues_added]->dl_dci = dl_dci;
-
-      
-      dl_dci->has_rnti = 1;
-      dl_dci->rnti = rnti;
-      dl_dci->has_harq_process = 1;
-      dl_dci->harq_process = harq_pid;
-      
-      /* process retransmission  */
-      if (round > 0) {
-
-	LOG_D(FLEXRAN_AGENT, "There was a retransmission just now and the round was %d\n", round);
-
-	if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
-	  UE_list->UE_template[CC_id][UE_id].DAI++;
-	  update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI);
-	  LOG_D(MAC,"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n",
-		CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI);
-	}
-
-	mcs = UE_list->UE_template[CC_id][UE_id].mcs[harq_pid];
-
-	  // get freq_allocation
-	nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
-	  
-	/*TODO: Must add this to FlexRAN agent API */
-	dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb);
-
-	if (nb_rb <= nb_available_rb) {
-	  
-	  if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
-	    for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { // for indicating the rballoc for each sub-band
-	      UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
-            }
-	  } else {
-	    nb_rb_temp = nb_rb;
-	    j = 0;
-
-	    while((nb_rb_temp > 0) && (j < flexran_get_N_RBG(mod_id, CC_id))) {
-	      if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
-		UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
-		
-		if((j == flexran_get_N_RBG(mod_id, CC_id) - 1) &&
-		   ((flexran_get_N_RB_DL(mod_id, CC_id) == 25)||
-		    (flexran_get_N_RB_DL(mod_id, CC_id) == 50))) {
-		  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1;
-		} else {
-		  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
-		}
-	      }
-	      j = j + 1;
-	    }
-	  }
-
-	  nb_available_rb -= nb_rb;
-	  PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
-	  PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
-	  
-	  for(j=0; j < flexran_get_N_RBG(mod_id, CC_id); j++) {
-	    PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
-	    rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
-	  }
-
-	  // Keep the old NDI, do not toggle
-	  ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
-	  tpc = UE_list->UE_template[CC_id][UE_id].oldTPC[harq_pid];
-	  UE_list->UE_template[CC_id][UE_id].mcs[harq_pid] = mcs;
-
-	  ue_has_transmission = 1;
-	  num_ues_added++;
-	} else {
-	  LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n",
-                mod_id, frame, CC_id, UE_id);
-	  ue_has_transmission = 0;
-	}
-	//End of retransmission
-      } else { /* This is a potentially new SDU opportunity */
-	rlc_status.bytes_in_buffer = 0;
-        // Now check RLC information to compute number of required RBs
-        // get maximum TBS size for RLC request
-        //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb);
-        TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb);
-	dci_tbs = TBS;
-	LOG_D(FLEXRAN_AGENT, "TBS is %d\n", TBS);
-	
-        // check first for RLC data on DCCH
-        // add the length for  all the control elements (timing adv, drx, etc) : header + payload
-
-	ta_len = (ue_sched_ctl->ta_update != 0) ? 2 : 0;
-	
-	dl_data[num_ues_added]->n_ce_bitmap = 2;
-	dl_data[num_ues_added]->ce_bitmap = (uint32_t *) calloc(2, sizeof(uint32_t));
-
-	if (ta_len > 0) {
-	  ce_flags |= PROTOCOL__FLEX_CE_TYPE__FLPCET_TA;
-	}
-
-	/*TODO: Add other flags if DRX and other CE are required*/
-	
-	// Add the control element flags to the flexran message
-	dl_data[num_ues_added]->ce_bitmap[0] = ce_flags;
-	dl_data[num_ues_added]->ce_bitmap[1] = ce_flags;
-
-	// TODO : Need to prioritize DRBs
-	// Loop through the UE logical channels (DCCH, DCCH1, DTCH for now)
-	header_len = 0;
-	header_len_last = 0;
-	sdu_length_total = 0;
-	for (j = 1; j < NB_RB_MAX; j++) {
-	  header_len += 3;
-	  // Need to see if we have space for data from this channel
-	  if (dci_tbs - ta_len - header_len - sdu_length_total > 0) {
-	     LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer on channel %d during first call\n", dci_tbs-ta_len-header_len);
-	     //If we have space, we need to see how much data we can request at most (if any available)
-	     rlc_status = mac_rlc_status_ind(mod_id,
-					     rnti,
-					     mod_id,
-					     frame,
-						 subframe,
-					     ENB_FLAG_YES,
-					     MBMS_FLAG_NO,
-					     j,
-					     (dci_tbs - ta_len - header_len - sdu_length_total)); // transport block set size
-
-	     //If data are available in channel j
-	     if (rlc_status.bytes_in_buffer > 0) {
-	       LOG_D(MAC, "[TEST]Have %d bytes in DCCH buffer during first call\n", rlc_status.bytes_in_buffer);
-	       //Fill in as much as possible
-	       data_to_request = cmin(dci_tbs - ta_len - header_len - sdu_length_total, rlc_status.bytes_in_buffer);
-	       LOG_D(FLEXRAN_AGENT, "Will request %d bytes from channel %d\n", data_to_request, j);
-	       if (data_to_request < 128) { //The header will be one byte less
-		 header_len--;
-		 header_len_last = 2;
-	       } else {
-		 header_len_last = 3;
-	       }
-	       /* if (j == 1 || j == 2) {
-		  data_to_request+=0; 
-		  } */
-	       LOG_D(MAC, "[TEST]Will request %d from channel %d\n", data_to_request, j);
-	       rlc_pdus[channels_added] = (Protocol__FlexRlcPdu *) malloc(sizeof(Protocol__FlexRlcPdu));
-	       protocol__flex_rlc_pdu__init(rlc_pdus[channels_added]);
-	       rlc_pdus[channels_added]->n_rlc_pdu_tb = 2;
-	       rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__FlexRlcPduTb **) malloc(sizeof(Protocol__FlexRlcPduTb *) * 2);
-	       rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__FlexRlcPduTb *) malloc(sizeof(Protocol__FlexRlcPduTb));
-	       protocol__flex_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]);
-	       rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1;
-	       rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = j;
-	       rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1;
-	       rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request;
-	       rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__FlexRlcPduTb *) malloc(sizeof(Protocol__FlexRlcPduTb));
-	       protocol__flex_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]);
-	       rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1;
-	       rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = j;
-	       rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1;
-	       rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request;
-	       dl_data[num_ues_added]->n_rlc_pdu++;
-	       channels_added++;
-	       //Set this to the max value that we might request
-	       sdu_length_total += data_to_request;
-	     } else {
-	       //Take back the assumption of a header for this channel
-	       header_len -= 3;
-	     } //End rlc_status.bytes_in_buffer <= 0
-	  } //end of if dci_tbs - ta_len - header_len > 0
-	} // End of iterating the logical channels
-	
-	// Add rlc_pdus to the dl_data message
-	dl_data[num_ues_added]->rlc_pdu = (Protocol__FlexRlcPdu **) malloc(sizeof(Protocol__FlexRlcPdu *) *
-									  dl_data[num_ues_added]->n_rlc_pdu);
-	for (i = 0; i < dl_data[num_ues_added]->n_rlc_pdu; i++) {
-	  dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i];
-	}
-	
-	if (header_len == 0) {
-	  LOG_D(FLEXRAN_AGENT, "Header was empty\n");
-	  header_len_last = 0;
-	} 
-	
-	// there is a payload
-        if ((dl_data[num_ues_added]->n_rlc_pdu > 0)) {
-	  // Now compute number of required RBs for total sdu length
-          // Assume RAH format 2
-          // adjust  header lengths
-	  LOG_D(FLEXRAN_AGENT, "We have %d bytes to transfer\n", sdu_length_total);
-	  if (header_len != 0) {
-	    LOG_D(FLEXRAN_AGENT, "Header length was %d ", header_len);
-	    header_len_last--;
-	    header_len -= header_len_last;
-	    LOG_D(FLEXRAN_AGENT, "so we resized it to %d\n", header_len);
-	  }
-	  
-	  /* if (header_len == 2 || header_len == 3) { //Only one SDU, remove length field */
-	  /*   header_len = 1; */
-	  /* } else { //Remove length field from the last SDU */
-	  /*   header_len--; */
-	  /* } */
-
-	  mcs_tmp = mcs;
-	  if (mcs_tmp == 0) {
-            nb_rb = 4;  // don't let the TBS get too small
-          } else {
-            nb_rb=min_rb_unit[CC_id];
-          }
-
-	  LOG_D(MAC,"[TEST]The initial number of resource blocks was %d\n", nb_rb);
-	  LOG_D(MAC,"[TEST] The initial mcs was %d\n", mcs_tmp);
-
-	  TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb);
-	  LOG_D(MAC,"[TEST]The TBS during rate matching was %d\n", TBS);
-
-	  while (TBS < (sdu_length_total + header_len + ta_len))  {
-            nb_rb += min_rb_unit[CC_id];  //
-	    LOG_D(MAC, "[TEST]Had to increase the number of RBs\n");
-            if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs
-              // (can happen if N_RB_DL is odd)
-              TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_available_rb);
-              nb_rb = nb_available_rb;
-              break;
-            }
-
-            TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb);
-          }
-
-	  if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
-	    LOG_D(MAC, "[TEST]We had the exact number of rbs. Time to fill the rballoc subband\n");
-            for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { // for indicating the rballoc for each sub-band
-              UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
-            }
-          } else {
-	    nb_rb_temp = nb_rb;
-            j = 0;
-	    LOG_D(MAC, "[TEST]Will only partially fill the bitmap\n");
-	    while((nb_rb_temp > 0) && (j < flexran_get_N_RBG(mod_id, CC_id))) {
-              if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
-                UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
-                if ((j == flexran_get_N_RBG(mod_id, CC_id) - 1) &&
-                    ((flexran_get_N_RB_DL(mod_id, CC_id) == 25)||
-                     (flexran_get_N_RB_DL(mod_id, CC_id) == 50))) {
-                  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id] + 1;
-                } else {
-                  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
-                }
-              }
-              j = j+1;
-            }
-	  }
-	  
-	  PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
-          PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
-
-	  for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) {
-            PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
-          }
-
-	  // decrease mcs until TBS falls below required length
-          while ((TBS > (sdu_length_total + header_len + ta_len)) && (mcs_tmp > 0)) {
-            mcs_tmp--;
-            TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb);
-          }
-
-	  // if we have decreased too much or we don't have enough RBs, increase MCS
-          while ((TBS < (sdu_length_total + header_len + ta_len)) &&
-		 ((( ue_sched_ctl->dl_pow_off[CC_id] > 0) && (mcs_tmp < 28))											     || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs_tmp <= 15)))) {
-            mcs_tmp++;
-            TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb);
-          }
-
-	  dci_tbs = TBS;
-	  mcs = mcs_tmp;
-	  LOG_D(FLEXRAN_AGENT, "Final mcs was %d\n", mcs); 
-	  
-	  dl_dci->has_aggr_level = 1;
-	  dl_dci->aggr_level = aggregation;
-	  
-          UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb;
-
-	  if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
-            UE_list->UE_template[CC_id][UE_id].DAI++;
-            //  printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI);
-	    //#warning only for 5MHz channel
-            update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI);
-          }
-
-	  // do PUCCH power control
-          // this is the normalized RX power
-	  normalized_rx_power = flexran_get_p0_pucch_dbm(mod_id,UE_id, CC_id); //eNB_UE_stats->Po_PUCCH_dBm; 
-	  target_rx_power = flexran_get_p0_nominal_pucch(mod_id, CC_id) + 20; //mac_xface->get_target_pucch_rx_power(mod_id, CC_id) + 20;
-	  // this assumes accumulated tpc
-	  // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
-	  int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
-
-	  if (((framex10psubframe+10)<=(frame*10+subframe)) || //normal case
-	      ((framex10psubframe>(frame*10+subframe)) && (((10240-framex10psubframe+frame*10+subframe)>=10)))) //frame wrap-around
-	    if (flexran_get_p0_pucch_status(mod_id, UE_id, CC_id) == 1) {
-  	      flexran_update_p0_pucch(mod_id, UE_id, CC_id);
-
-	      UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frame;
-	      UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframe;
-	      if (normalized_rx_power>(target_rx_power+1)) {
-		tpc = 0; //-1
-		tpc_accumulated--;
-	      } else if (normalized_rx_power<(target_rx_power-1)) {
-		tpc = 2; //+1
-		tpc_accumulated++;
-	      } else {
-		tpc = 1; //0
-	      }
-	      LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
-		    mod_id, frame, subframe, harq_pid, tpc,
-		    tpc_accumulated, normalized_rx_power, target_rx_power);
-	    } // Po_PUCCH has been updated 
-	    else {
-	      tpc = 1; //0
-	    } // time to do TPC update 
-	  else {
-	    tpc = 1; //0
-	  }
-
-	  for(i=0; i<PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RBG; i++) {
-	    rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i];
-          }	
-
-	   // Toggle NDI
-          LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n",
-                CC_id, frame, subframe, UE_id,
-                UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]);
-          UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]= 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
-	  ndi =  UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
-	  
-	  UE_list->UE_template[CC_id][UE_id].mcs[harq_pid] = mcs;
-	  UE_list->UE_template[CC_id][UE_id].oldTPC[harq_pid] = tpc;
-
-	  // Increase the pointer for the number of scheduled UEs
-	  num_ues_added++;
-	  ue_has_transmission = 1;
-	}  else { // There is no data from RLC or MAC header, so don't schedule
-	  ue_has_transmission = 0;
-	}
-      } // End of new scheduling
-      
-      // If we has transmission or retransmission
-      if (ue_has_transmission) {
-	switch (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)) {
-	case 1:
-	case 2:
-	default:
-	  dl_dci->has_res_alloc = 1;
-	  dl_dci->res_alloc = 0;
-	  dl_dci->has_vrb_format = 1;
-	  dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED;
-	  dl_dci->has_format = 1;
-	  dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1;
-	  dl_dci->has_rb_bitmap = 1;
-	  dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub);
-	  dl_dci->has_rb_shift = 1;
-	  dl_dci->rb_shift = 0;
-	  dl_dci->n_ndi = 1;
-	  dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
-	  dl_dci->ndi[0] = ndi;
-	  dl_dci->n_rv = 1;
-	  dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
-	  dl_dci->rv[0] = round & 3;
-	  dl_dci->has_tpc = 1;
-	  dl_dci->tpc = tpc;
-	  dl_dci->n_mcs = 1;
-	  dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
-	  dl_dci->mcs[0] = mcs;
-	  dl_dci->n_tbs_size = 1;
-	  dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size);
-	  dl_dci->tbs_size[0] = dci_tbs;
-	  if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
-	    dl_dci->has_dai = 1;
-	    dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
-	  }
-	  break;
-	case 3:
-	  dl_dci->has_res_alloc = 1;
-	  dl_dci->res_alloc = 0;
-	  dl_dci->has_vrb_format = 1;
-	  dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED;
-	  dl_dci->has_format = 1;
-	  dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A;
-	  dl_dci->has_rb_bitmap = 1;
-	  dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub);
-	  dl_dci->has_rb_shift = 1;
-	  dl_dci->rb_shift = 0;
-	  dl_dci->n_ndi = 2;
-	  dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
-	  dl_dci->ndi[0] = ndi;
-	  dl_dci->ndi[1] = ndi;
-	  dl_dci->n_rv = 2;
-	  dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
-	  dl_dci->rv[0] = round & 3;
-	  dl_dci->rv[1] = round & 3;
-	  dl_dci->has_tpc = 1;
-	  dl_dci->tpc = tpc;
-	  dl_dci->n_mcs = 2;
-	  dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
-	  dl_dci->mcs[0] = mcs;
-	  dl_dci->mcs[1] = mcs;
-	  dl_dci->n_tbs_size = 2;
-	  dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size);
-	  dl_dci->tbs_size[0] = dci_tbs;
-	  dl_dci->tbs_size[1] = dci_tbs;
-	  if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
-	    dl_dci->has_dai = 1;
-	    dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
-	  }
-	  break;
-	case 4:
-	  dl_dci->has_res_alloc = 1;
-	  dl_dci->res_alloc = 0;
-	  dl_dci->has_vrb_format = 1;
-	  dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED;
-	  dl_dci->has_format = 1;
-	  dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A;
-	  dl_dci->has_rb_bitmap = 1;
-	  dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub);
-	  dl_dci->has_rb_shift = 1;
-	  dl_dci->rb_shift = 0;
-	  dl_dci->n_ndi = 2;
-	  dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
-	  dl_dci->ndi[0] = ndi;
-	  dl_dci->ndi[1] = ndi;
-	  dl_dci->n_rv = 2;
-	  dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
-	  dl_dci->rv[0] = round & 3;
-	  dl_dci->rv[1] = round & 3;
-	  dl_dci->has_tpc = 1;
-	  dl_dci->tpc = tpc;
-	  dl_dci->n_mcs = 2;
-	  dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
-	  dl_dci->mcs[0] = mcs;
-	  dl_dci->mcs[1] = mcs;
-	  dl_dci->n_tbs_size = 2;
-	  dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size);
-	  dl_dci->tbs_size[0] = dci_tbs;
-	  dl_dci->tbs_size[1] = dci_tbs;
-	  if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
-	    dl_dci->has_dai = 1;
-	    dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
-	  }
-	  break;
-	case 5:
-	  dl_dci->has_res_alloc = 1;
-	  dl_dci->res_alloc = 0;
-	  dl_dci->has_vrb_format = 1;
-	  dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED;
-	  dl_dci->has_format = 1;
-	  dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D;
-	  dl_dci->has_rb_bitmap = 1;
-	  dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub);
-	  dl_dci->has_rb_shift = 1;
-	  dl_dci->rb_shift = 0;
-	  dl_dci->n_ndi = 1;
-	  dl_dci->ndi[0] = ndi;
-	  dl_dci->n_rv = 1;
-	  dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
-	  dl_dci->rv[0] = round & 3;
-	  dl_dci->has_tpc = 1;
-	  dl_dci->tpc = tpc;
-	  dl_dci->n_mcs = 1;
-	  dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
-	  dl_dci->mcs[0] = mcs;
-	  dl_dci->n_tbs_size = 1;
-	  dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size);
-	  dl_dci->tbs_size[0] = dci_tbs;
-	  if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
-	    dl_dci->has_dai = 1;
-	    dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
-	  }
-	  
-	  if(ue_sched_ctl->dl_pow_off[CC_id] == 2) {
-	    ue_sched_ctl->dl_pow_off[CC_id] = 1;
-	  }
-	  
-	  dl_dci->has_dl_power_offset = 1;
-	  dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id];
-	  dl_dci->has_precoding_info = 1;
-	  dl_dci->precoding_info = 5; // Is this right??
-	  
-	  break;
-	case 6:
-	  dl_dci->has_res_alloc = 1;
-	  dl_dci->res_alloc = 0;
-	  dl_dci->has_vrb_format = 1;
-	  dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED;
-	  dl_dci->has_format = 1;
-	  dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D;
-	  dl_dci->has_rb_bitmap = 1;
-	  dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub);
-	  dl_dci->has_rb_shift = 1;
-	  dl_dci->rb_shift = 0;
-	  dl_dci->n_ndi = 1;
-	  dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi);
-	  dl_dci->ndi[0] = ndi;
-	  dl_dci->n_rv = 1;
-	  dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv);
-	  dl_dci->rv[0] = round & 3;
-	  dl_dci->has_tpc = 1;
-	  dl_dci->tpc = tpc;
-	  dl_dci->n_mcs = 1;
-	  dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs);
-	  dl_dci->mcs[0] = mcs;
-	  if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
-	    dl_dci->has_dai = 1;
-	    dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
-	  }
-
-	  dl_dci->has_dl_power_offset = 1;
-	  dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id];
-	  dl_dci->has_precoding_info = 1;
-	  dl_dci->precoding_info = 5; // Is this right??
-	  break;
-	}
-      }
-      
-      if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
-        
-	/* TODO */
-	//set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms);
-      }
-    } // UE_id loop
-   } // CC_id loop
-
-   // Add all the dl_data elements to the flexran message
-   int offset = (*dl_info)->dl_mac_config_msg->n_dl_ue_data;
-   (*dl_info)->dl_mac_config_msg->n_dl_ue_data += num_ues_added;
-   if ( num_ues_added > 0 ){
-     (*dl_info)->dl_mac_config_msg->dl_ue_data = (Protocol__FlexDlData **) realloc( (*dl_info)->dl_mac_config_msg->dl_ue_data,
-										    sizeof(Protocol__FlexDlData *) * ((*dl_info)->dl_mac_config_msg->n_dl_ue_data));
-     if ((*dl_info)->dl_mac_config_msg->dl_ue_data == NULL ){
-       LOG_E(MAC, "Request for memory reallocation failed\n");
-       return;
-     }
-     for (i = 0; i < num_ues_added; i++) {
-       (*dl_info)->dl_mac_config_msg->dl_ue_data[offset+i] = dl_data[i];
-     }
-   }
-      
-   stop_meas(&eNB->schedule_dlsch);
-   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT);
-}
diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c
deleted file mode 100644
index 7dec8d0c563169a0bb9136ce3fd30521166b5634..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */ 
-
-/*! \file flexran_agent_scheduler_dlsch_ue_remote.c
- * \brief procedures related to remote scheduling in the DLSCH transport channel
- * \author Xenofon Foukas
- * \date 2016
- * \email: x.foukas@sms.ed.ac.uk
- * \version 0.1
- * @ingroup _mac
-
- */
-
-#include "flexran_agent_common_internal.h"
-
-#include "flexran_agent_scheduler_dlsch_ue_remote.h"
-
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/extern.h"
-
-struct DlMacConfigHead queue_head;
-
-int queue_initialized = 0;
-
-//uint32_t skip_subframe = 1;
-//uint32_t period = 10;
-//uint32_t sched [] = {1, 2, 3};
-
-void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
-				     int *mbsfn_flag, Protocol__FlexranMessage **dl_info) {
-
-  
-  //if ((subframe == skip_subframe) && (frame % period == 0)) {
-  //  LOG_I(MAC, "Will skip subframe %d %d\n", subframe, frame);
-  //  for (int i = 0; i < 3; i++) {
-  //    LOG_I(MAC, "%d\n", sched[i]);
-  //  }
-  //}
-
-  /* if (frame == 500 && subframe == 1) { */
-  /*   char policy[] = "rrc: \n - ul_scheduler: \n    behavior : tester_function\n    parameters:\n      period: !!int 3\nmac: \n - dl_scheduler: \n    parameters: \n      period : !!int 40\n      skip_subframe : !!int 3\n      sched : [!!int 4, !!int 5, !!int 6]"; */
-  /*   apply_reconfiguration_policy(mod_id, policy, strlen(policy)); */
-  /* } */
-
-  eNB_MAC_INST *eNB;
-
-  if (!queue_initialized) {
-    TAILQ_INIT(&queue_head);
-    queue_initialized = 1;
-  }
-
-  eNB = &eNB_mac_inst[mod_id]; 
-  
-  dl_mac_config_element_t *dl_config_elem;
-
-  int diff;
-  LOG_D(MAC, "[TEST] Current frame and subframe %d, %d\n", frame, subframe);
-  // First we check to see if we have a scheduling decision for this sfn_sf already in our queue
-  while(queue_head.tqh_first != NULL) {
-    dl_config_elem = queue_head.tqh_first;
-  
-    diff = get_sf_difference(mod_id, dl_config_elem->dl_info->dl_mac_config_msg->sfn_sf);
-    // Check if this decision is for now, for a later or a previous subframe
-    if ( diff == 0) { // Now
-      LOG_D(MAC, "Found a decision for this subframe in the queue. Let's use it!\n");
-      TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs);
-      *dl_info = dl_config_elem->dl_info;
-      free(dl_config_elem);
-      eNB->eNB_stats[mod_id].sched_decisions++;
-      return;
-    } else if (diff < 0) { //previous subframe , delete message and free memory
-      LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n");
-      TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs);
-      flexran_agent_mac_destroy_dl_config(dl_config_elem->dl_info);
-      free(dl_config_elem);
-      eNB->eNB_stats[mod_id].sched_decisions++;
-      eNB->eNB_stats[mod_id].missed_deadlines++;
-    } else { // next subframe, nothing to do now
-      LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n");
-      flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
-      return;
-    }
-  }
-
-  //Done with the local cache. Now we need to check if something new arrived
-  flexran_agent_get_pending_dl_mac_config(mod_id, dl_info);
-  while (*dl_info != NULL) {
-
-    diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf);
-    if (diff == 0) { // Got a command for this sfn_sf
-      LOG_D(MAC, "Found a decision for this subframe pending. Let's use it\n");
-      eNB->eNB_stats[mod_id].sched_decisions++;
-      return;
-    } else if (diff < 0) {
-      LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n");
-      flexran_agent_mac_destroy_dl_config(*dl_info);
-      *dl_info = NULL;
-      flexran_agent_get_pending_dl_mac_config(mod_id, dl_info);
-      eNB->eNB_stats[mod_id].sched_decisions++;
-      eNB->eNB_stats[mod_id].missed_deadlines++;
-    } else { // Intended for future subframe. Store it in local cache
-      LOG_D(MAC, "Found a decision for a future subframe in the queue. Let's store it in the cache\n");
-      dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t));
-      e->dl_info = *dl_info;
-      TAILQ_INSERT_TAIL(&queue_head, e, configs);
-      flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
-      // No need to look for another. Messages arrive ordered
-      return;
-    }
-  }
-  
-  // We found no pending command, so we will simply pass an empty one
-  flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
-}
-
-int get_sf_difference(mid_t mod_id, uint32_t sfn_sf) {
-  int diff_in_subframes;
-  
-  uint16_t current_frame = flexran_get_current_system_frame_num(mod_id);
-  uint16_t current_subframe = flexran_get_current_subframe(mod_id);
-  uint32_t current_sfn_sf = flexran_get_sfn_sf(mod_id);
-  
-  if (sfn_sf == current_sfn_sf) {
-    return 0;
-  }
-  
-  uint16_t frame_mask = ((1<<12) - 1);
-  uint16_t frame = (sfn_sf & (frame_mask << 4)) >> 4;
-  
-  uint16_t sf_mask = ((1<<4) - 1);
-  uint16_t subframe = (sfn_sf & sf_mask);
-
- LOG_D(MAC, "[TEST] Target frame and subframe %d, %d\n", frame, subframe);
-  
-  if (frame == current_frame) {
-    return subframe - current_subframe;
-  } else if (frame > current_frame) {
-    diff_in_subframes = ((frame*10)+subframe) - ((current_frame*10)+current_subframe);
-    
-    //    diff_in_subframes = 9 - current_subframe;
-    //diff_in_subframes += (subframe + 1);
-    //diff_in_subframes += (frame-2) * 10;
-    if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) {
-      return -1;
-    } else {
-      return 1;
-    }
-  } else { //frame < current_frame
-    //diff_in_subframes = 9 - current_subframe;
-    //diff_in_subframes += (subframe + 1);
-    //if (frame > 0) {
-    //  diff_in_subframes += (frame - 1) * 10;
-    //}
-    //diff_in_subframes += (1023 - current_frame) * 10;
-    diff_in_subframes = 10240 - ((current_frame*10)+current_subframe) + ((frame*10)+subframe);
-    if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) {
-      return -1;
-    } else {
-      return 1;
-    }
-  }
-}
diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h
deleted file mode 100644
index 7a02ff2f1db6d278247bba94ec4481821916c6be..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */ 
-
-/*! \file flexran_agent_scheduler_dlsch_ue_remote.h
- * \brief Local stub for remote scheduler used by the controller
- * \author Xenofon Foukas
- * \date 2016
- * \email: x.foukas@sms.ed.ac.uk
- * \version 0.1
- * @ingroup _mac
-
- */
-
-#ifndef __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__
-#define __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___
-
-#include "flexran.pb-c.h"
-#include "header.pb-c.h"
-
-#include "ENB_APP/flexran_agent_defs.h"
-#include "flexran_agent_mac.h"
-#include "LAYER2/MAC/flexran_agent_mac_proto.h"
-
-#include <sys/queue.h>
-
-// Maximum value of schedule ahead of time
-// Required to identify if a dl_command is for the future or not
-#define SCHED_AHEAD_SUBFRAMES 20
-
-typedef struct dl_mac_config_element_s {
-  Protocol__FlexranMessage *dl_info;
-  TAILQ_ENTRY(dl_mac_config_element_s) configs;
-} dl_mac_config_element_t;
-
-TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s);
-
-/*
- * Default scheduler used by the eNB agent
- */
-void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
-			     int *mbsfn_flag, Protocol__FlexranMessage **dl_info);
-
-
-// Find the difference in subframes from the given subframe
-// negative for older value
-// 0 for equal
-// positive for future value
-// Based on  
-int get_sf_difference(mid_t mod_id, uint32_t sfn_sf);
-
-#endif
diff --git a/openair2/LAYER2/MAC/flexran_dci_conversions.h b/openair2/LAYER2/MAC/flexran_dci_conversions.h
deleted file mode 100644
index a417c39d208f853cafedb8c70974cee502c2d971..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/flexran_dci_conversions.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */ 
-
-/*! \file flexran_dci_conversions.h
- * \brief Conversion helpers from flexran messages to OAI formats DCI  
- * \author Xenofon Foukas
- * \date 2016
- * \version 0.1
- */
-
-#ifndef LAYER2_MAC_FLEXRAN_DCI_CONVERISIONS_H__
-#define LAYER2_MAC_DCI_FLEXRAN_CONVERISIONS_H__
-
-#define FILL_DCI_FDD_1(TYPE, DCI, FLEXRAN_DCI) \
-  ((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \
-  ((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \
-  ((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \
-  ((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \
-  ((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \
-  ((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \
-  ((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0];
-
-#define FILL_DCI_TDD_1(TYPE, DCI, FLEXRAN_DCI) \
-  ((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \
-  ((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \
-  ((TYPE*)DCI)->dai = FLEXRAN_DCI->dai; \
-  ((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \
-  ((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \
-  ((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \
-  ((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \
-  ((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0];
-  
-#endif
diff --git a/openair2/LAYER2/MAC/l1_helpers.c b/openair2/LAYER2/MAC/l1_helpers.c
index b136b993a649bc2f0abe172ff88ab232194d2854..6e71f66ec5f56d32a52863db3fde89d6594b9b20 100644
--- a/openair2/LAYER2/MAC/l1_helpers.c
+++ b/openair2/LAYER2/MAC/l1_helpers.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -34,28 +34,36 @@
 #include "UTIL/LOG/log.h"
 #include "proto.h"
 
-int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP,uint8_t CC_id)
+int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id)
 {
-  RACH_ConfigCommon_t *rach_ConfigCommon = NULL;
+    RACH_ConfigCommon_t *rach_ConfigCommon = NULL;
 
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
-  AssertFatal(UE_mac_inst[module_idP].radioResourceConfigCommon!=NULL,
-	      "[UE %d] CCid %d FATAL radioResourceConfigCommon is NULL !!!\n",module_idP,CC_id);	      
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
+    AssertFatal(UE_mac_inst[module_idP].radioResourceConfigCommon != NULL,
+		"[UE %d] CCid %d FATAL radioResourceConfigCommon is NULL !!!\n",
+		module_idP, CC_id);
 
-  rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
+    rach_ConfigCommon =
+	&UE_mac_inst[module_idP].radioResourceConfigCommon->
+	rach_ConfigCommon;
 
-  return(-120 + (rach_ConfigCommon->powerRampingParameters.preambleInitialReceivedTargetPower<<1) +
-         get_DELTA_PREAMBLE(module_idP,CC_id));
+    return (-120 +
+	    (rach_ConfigCommon->
+	     powerRampingParameters.preambleInitialReceivedTargetPower <<
+	     1) + get_DELTA_PREAMBLE(module_idP, CC_id));
 }
 
-int8_t get_deltaP_rampup(module_id_t module_idP,uint8_t CC_id)
+int8_t get_deltaP_rampup(module_id_t module_idP, uint8_t CC_id)
 {
 
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
 
-  LOG_D(MAC,"[PUSCH]%d dB\n",UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER<<1);
-  return((int8_t)(UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER<<1));
+    LOG_D(MAC, "[PUSCH]%d dB\n",
+	  UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER << 1);
+    return ((int8_t)
+	    (UE_mac_inst[module_idP].
+	     RA_PREAMBLE_TRANSMISSION_COUNTER << 1));
 
 }
diff --git a/openair2/LAYER2/MAC/lte_transport_init.c b/openair2/LAYER2/MAC/lte_transport_init.c
index 07aadc371520e723922bf1bb7b50a2a05301acf9..e1f21f21e44935e7bf071b9377e6e69548201506 100644
--- a/openair2/LAYER2/MAC/lte_transport_init.c
+++ b/openair2/LAYER2/MAC/lte_transport_init.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,104 +29,104 @@
 void init_transport_channels(unsigned char transmission_mode)
 {
 
-  // init DCI structures for testing
-
-  UL_alloc_pdu.type    = 0;
-  UL_alloc_pdu.hopping = 0;
-  UL_alloc_pdu.rballoc = UL_RB_ALLOC;
-  UL_alloc_pdu.mcs     = 2;
-  UL_alloc_pdu.ndi     = 1;
-  UL_alloc_pdu.TPC     = 0;
-  UL_alloc_pdu.cqi_req = 1;
-
-  /*
-  BCCH_alloc_pdu.type               = 1;
-  BCCH_alloc_pdu.vrb_type           = 0;
-  BCCH_alloc_pdu.rballoc            = BCCH_RB_ALLOC;
-  BCCH_alloc_pdu.ndi      = 1;
-  BCCH_alloc_pdu.rv       = 1;
-  BCCH_alloc_pdu.mcs      = 1;
-  BCCH_alloc_pdu.harq_pid = 0;
-  BCCH_alloc_pdu.TPC      = 1;      // set to 3 PRB
-
-  // for FDD mode
-  BCCH_alloc_pdu_fdd.type               = 1;
-  BCCH_alloc_pdu_fdd.vrb_type           = 0;
-  BCCH_alloc_pdu_fdd.rballoc            = BCCH_RB_ALLOC;
-  BCCH_alloc_pdu_fdd.ndi      = 1;
-  BCCH_alloc_pdu_fdd.rv       = 1;
-  BCCH_alloc_pdu_fdd.mcs      = 1;
-  BCCH_alloc_pdu_fdd.harq_pid = 0;
-  BCCH_alloc_pdu_fdd.TPC      = 1;      // set to 3 PRB
-  */
-
-  DLSCH_alloc_pdu1A.type               = 1;
-  DLSCH_alloc_pdu1A.vrb_type           = 0;
-  DLSCH_alloc_pdu1A.rballoc            = BCCH_RB_ALLOC;
-  DLSCH_alloc_pdu1A.ndi      = 1;
-  DLSCH_alloc_pdu1A.rv       = 1;
-  DLSCH_alloc_pdu1A.mcs      = 2;
-  DLSCH_alloc_pdu1A.harq_pid = 0;
-  DLSCH_alloc_pdu1A.TPC      = 1;   // set to 3 PRB
-
-  DLSCH_alloc_pdu1A_fdd.type               = 1;
-  DLSCH_alloc_pdu1A_fdd.vrb_type           = 0;
-  DLSCH_alloc_pdu1A_fdd.rballoc            = BCCH_RB_ALLOC;
-  DLSCH_alloc_pdu1A_fdd.ndi      = 1;
-  DLSCH_alloc_pdu1A_fdd.rv       = 1;
-  DLSCH_alloc_pdu1A_fdd.mcs      = 2;
-  DLSCH_alloc_pdu1A_fdd.harq_pid = 0;
-  DLSCH_alloc_pdu1A_fdd.TPC      = 1;   // set to 3 PRB
-
-  RA_alloc_pdu.type               = 1;
-  RA_alloc_pdu.vrb_type           = 0;
-  RA_alloc_pdu.rballoc            = RA_RB_ALLOC;
-  RA_alloc_pdu.ndi      = 1;
-  RA_alloc_pdu.rv       = 0;
-  RA_alloc_pdu.mcs      = 0;
-  RA_alloc_pdu.harq_pid = 0;
-  RA_alloc_pdu.TPC      = 1;
-
-  RA_alloc_pdu_fdd.type               = 1;
-  RA_alloc_pdu_fdd.vrb_type           = 0;
-  RA_alloc_pdu_fdd.rballoc            = RA_RB_ALLOC;
-  RA_alloc_pdu_fdd.ndi      = 1;
-  RA_alloc_pdu_fdd.rv       = 1;
-  RA_alloc_pdu_fdd.mcs      = 1;
-  RA_alloc_pdu_fdd.harq_pid = 0;
-  RA_alloc_pdu_fdd.TPC      = 1;
-
-
-  DLSCH_alloc_pdu1.rballoc          = 0xf;
-  DLSCH_alloc_pdu1.TPC              = 0;
-  DLSCH_alloc_pdu1.dai              = 0;
-  DLSCH_alloc_pdu1.harq_pid         = 0;
-  DLSCH_alloc_pdu1.tb_swap          = 0;
-  DLSCH_alloc_pdu1.mcs1             = 4;
-  DLSCH_alloc_pdu1.ndi1             = 1;
-  DLSCH_alloc_pdu1.rv1              = 0;
-
-  // Forget second codeword
-  if (transmission_mode == 6) {
-    DLSCH_alloc_pdu1.tpmi           = 5;  // PUSCH_PRECODING0
-  } else {
-    DLSCH_alloc_pdu1.tpmi             = 0;
-  }
-
-  DLSCH_alloc_pdu2.rah              = 0;
-  DLSCH_alloc_pdu2.rballoc          = DLSCH_RB_ALLOC;
-  DLSCH_alloc_pdu2.TPC              = 0;
-  DLSCH_alloc_pdu2.dai              = 0;
-  DLSCH_alloc_pdu2.harq_pid         = 0;
-  DLSCH_alloc_pdu2.tb_swap          = 0;
-  DLSCH_alloc_pdu2.mcs1             = 4;
-  DLSCH_alloc_pdu2.ndi1             = 1;
-  DLSCH_alloc_pdu2.rv1              = 0;
-
-  // Forget second codeword
-  if (transmission_mode == 6) {
-    DLSCH_alloc_pdu2.tpmi           = 5;  // PUSCH_PRECODING0
-  } else {
-    DLSCH_alloc_pdu2.tpmi             = 0;
-  }
+    // init DCI structures for testing
+
+    UL_alloc_pdu.type = 0;
+    UL_alloc_pdu.hopping = 0;
+    UL_alloc_pdu.rballoc = UL_RB_ALLOC;
+    UL_alloc_pdu.mcs = 2;
+    UL_alloc_pdu.ndi = 1;
+    UL_alloc_pdu.TPC = 0;
+    UL_alloc_pdu.cqi_req = 1;
+
+    /*
+       BCCH_alloc_pdu.type               = 1;
+       BCCH_alloc_pdu.vrb_type           = 0;
+       BCCH_alloc_pdu.rballoc            = BCCH_RB_ALLOC;
+       BCCH_alloc_pdu.ndi      = 1;
+       BCCH_alloc_pdu.rv       = 1;
+       BCCH_alloc_pdu.mcs      = 1;
+       BCCH_alloc_pdu.harq_pid = 0;
+       BCCH_alloc_pdu.TPC      = 1;      // set to 3 PRB
+
+       // for FDD mode
+       BCCH_alloc_pdu_fdd.type               = 1;
+       BCCH_alloc_pdu_fdd.vrb_type           = 0;
+       BCCH_alloc_pdu_fdd.rballoc            = BCCH_RB_ALLOC;
+       BCCH_alloc_pdu_fdd.ndi      = 1;
+       BCCH_alloc_pdu_fdd.rv       = 1;
+       BCCH_alloc_pdu_fdd.mcs      = 1;
+       BCCH_alloc_pdu_fdd.harq_pid = 0;
+       BCCH_alloc_pdu_fdd.TPC      = 1;      // set to 3 PRB
+     */
+
+    DLSCH_alloc_pdu1A.type = 1;
+    DLSCH_alloc_pdu1A.vrb_type = 0;
+    DLSCH_alloc_pdu1A.rballoc = BCCH_RB_ALLOC;
+    DLSCH_alloc_pdu1A.ndi = 1;
+    DLSCH_alloc_pdu1A.rv = 1;
+    DLSCH_alloc_pdu1A.mcs = 2;
+    DLSCH_alloc_pdu1A.harq_pid = 0;
+    DLSCH_alloc_pdu1A.TPC = 1;	// set to 3 PRB
+
+    DLSCH_alloc_pdu1A_fdd.type = 1;
+    DLSCH_alloc_pdu1A_fdd.vrb_type = 0;
+    DLSCH_alloc_pdu1A_fdd.rballoc = BCCH_RB_ALLOC;
+    DLSCH_alloc_pdu1A_fdd.ndi = 1;
+    DLSCH_alloc_pdu1A_fdd.rv = 1;
+    DLSCH_alloc_pdu1A_fdd.mcs = 2;
+    DLSCH_alloc_pdu1A_fdd.harq_pid = 0;
+    DLSCH_alloc_pdu1A_fdd.TPC = 1;	// set to 3 PRB
+
+    RA_alloc_pdu.type = 1;
+    RA_alloc_pdu.vrb_type = 0;
+    RA_alloc_pdu.rballoc = RA_RB_ALLOC;
+    RA_alloc_pdu.ndi = 1;
+    RA_alloc_pdu.rv = 0;
+    RA_alloc_pdu.mcs = 0;
+    RA_alloc_pdu.harq_pid = 0;
+    RA_alloc_pdu.TPC = 1;
+
+    RA_alloc_pdu_fdd.type = 1;
+    RA_alloc_pdu_fdd.vrb_type = 0;
+    RA_alloc_pdu_fdd.rballoc = RA_RB_ALLOC;
+    RA_alloc_pdu_fdd.ndi = 1;
+    RA_alloc_pdu_fdd.rv = 1;
+    RA_alloc_pdu_fdd.mcs = 1;
+    RA_alloc_pdu_fdd.harq_pid = 0;
+    RA_alloc_pdu_fdd.TPC = 1;
+
+
+    DLSCH_alloc_pdu1.rballoc = 0xf;
+    DLSCH_alloc_pdu1.TPC = 0;
+    DLSCH_alloc_pdu1.dai = 0;
+    DLSCH_alloc_pdu1.harq_pid = 0;
+    DLSCH_alloc_pdu1.tb_swap = 0;
+    DLSCH_alloc_pdu1.mcs1 = 4;
+    DLSCH_alloc_pdu1.ndi1 = 1;
+    DLSCH_alloc_pdu1.rv1 = 0;
+
+    // Forget second codeword
+    if (transmission_mode == 6) {
+	DLSCH_alloc_pdu1.tpmi = 5;	// PUSCH_PRECODING0
+    } else {
+	DLSCH_alloc_pdu1.tpmi = 0;
+    }
+
+    DLSCH_alloc_pdu2.rah = 0;
+    DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC;
+    DLSCH_alloc_pdu2.TPC = 0;
+    DLSCH_alloc_pdu2.dai = 0;
+    DLSCH_alloc_pdu2.harq_pid = 0;
+    DLSCH_alloc_pdu2.tb_swap = 0;
+    DLSCH_alloc_pdu2.mcs1 = 4;
+    DLSCH_alloc_pdu2.ndi1 = 1;
+    DLSCH_alloc_pdu2.rv1 = 0;
+
+    // Forget second codeword
+    if (transmission_mode == 6) {
+	DLSCH_alloc_pdu2.tpmi = 5;	// PUSCH_PRECODING0
+    } else {
+	DLSCH_alloc_pdu2.tpmi = 0;
+    }
 }
diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c
index b06184c566517fb255a75c095c249581c35538a9..afee1632031a2da102c39c739aa18bc3dd260640 100644
--- a/openair2/LAYER2/MAC/main.c
+++ b/openair2/LAYER2/MAC/main.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -48,250 +48,111 @@
 
 extern RAN_CONTEXT_t RC;
 
-void dl_phy_sync_success(module_id_t   module_idP,
-                         frame_t       frameP,
-                         unsigned char eNB_index,
-                         uint8_t       first_sync)   //init as MR
-{
-  LOG_D(MAC,"[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n", module_idP, frameP, eNB_index);
-#if defined(ENABLE_USE_MME)
-  int mme_enabled=1;
-#else
-  int mme_enabled=0;
-#endif
-
-  if (first_sync==1 && !(mme_enabled==1)) {
-    //layer2_init_UE(module_idP);
-    openair_rrc_ue_init(module_idP,eNB_index);
-  } else
-  {
-    rrc_in_sync_ind(module_idP,frameP,eNB_index);
-  }
-}
 
-void mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP, uint16_t eNB_index)
+void mac_top_init_eNB(void)
 {
 
-  //  Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
-}
+    module_id_t i, j;
+    int list_el;
+    UE_list_t *UE_list;
+    eNB_MAC_INST *mac;
+
+    LOG_I(MAC, "[MAIN] Init function start:nb_macrlc_inst=%d\n",
+	  RC.nb_macrlc_inst);
+
+    if (RC.nb_macrlc_inst > 0) {
+	RC.mac =
+	    (eNB_MAC_INST **) malloc16(RC.nb_macrlc_inst *
+				       sizeof(eNB_MAC_INST *));
+	AssertFatal(RC.mac != NULL,
+		    "can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",
+		    RC.nb_macrlc_inst * sizeof(eNB_MAC_INST *),
+		    RC.nb_macrlc_inst, sizeof(eNB_MAC_INST));
+	for (i = 0; i < RC.nb_macrlc_inst; i++) {
+	    RC.mac[i] = (eNB_MAC_INST *) malloc16(sizeof(eNB_MAC_INST));
+	    AssertFatal(RC.mac != NULL,
+			"can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",
+			RC.nb_macrlc_inst * sizeof(eNB_MAC_INST *),
+			RC.nb_macrlc_inst, sizeof(eNB_MAC_INST));
+	    LOG_D(MAC,
+		  "[MAIN] ALLOCATE %zu Bytes for %d eNB_MAC_INST @ %p\n",
+		  sizeof(eNB_MAC_INST), RC.nb_macrlc_inst, RC.mac);
+	    bzero(RC.mac[i], sizeof(eNB_MAC_INST));
+	    RC.mac[i]->Mod_id = i;
+	    for (j = 0; j < MAX_NUM_CCs; j++) {
+		RC.mac[i]->DL_req[j].dl_config_request_body.
+		    dl_config_pdu_list = RC.mac[i]->dl_config_pdu_list[j];
+		RC.mac[i]->UL_req[j].ul_config_request_body.
+		    ul_config_pdu_list = RC.mac[i]->ul_config_pdu_list[j];
+		for (int k = 0; k < 10; k++)
+		    RC.mac[i]->UL_req_tmp[j][k].
+			ul_config_request_body.ul_config_pdu_list =
+			RC.mac[i]->ul_config_pdu_list_tmp[j][k];
+		RC.mac[i]->HI_DCI0_req[j].
+		    hi_dci0_request_body.hi_dci0_pdu_list =
+		    RC.mac[i]->hi_dci0_pdu_list[j];
+		RC.mac[i]->TX_req[j].tx_request_body.tx_pdu_list =
+		    RC.mac[i]->tx_request_pdu[j];
+		RC.mac[i]->ul_handle = 0;
+	    }
+	}
+
+	AssertFatal(rlc_module_init() == 0,
+		    "Could not initialize RLC layer\n");
+
+	// These should be out of here later
+	pdcp_layer_init();
+
+	rrc_init_global_param();
 
+    } else {
+	RC.mac = NULL;
+    }
 
-int mac_top_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active)
-{
-
-  int i;
+    // Initialize Linked-List for Active UEs
+    for (i = 0; i < RC.nb_macrlc_inst; i++) {
+	mac = RC.mac[i];
 
-  LOG_I(MAC,"[MAIN] Init function start:Nb_UE_INST=%d\n",NB_UE_INST);
 
-  if (NB_UE_INST>0) {
-    UE_mac_inst = (UE_MAC_INST*)malloc16(NB_UE_INST*sizeof(UE_MAC_INST));
+	mac->if_inst = IF_Module_init(i);
 
-    AssertFatal(UE_mac_inst!=NULL,
-		"[MAIN] Can't ALLOCATE %zu Bytes for %d UE_MAC_INST with size %zu \n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,sizeof(UE_MAC_INST));
+	UE_list = &mac->UE_list;
 
-    LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d UE_MAC_INST @ %p\n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,UE_mac_inst);
+	UE_list->num_UEs = 0;
+	UE_list->head = -1;
+	UE_list->head_ul = -1;
+	UE_list->avail = 0;
 
-    bzero(UE_mac_inst,NB_UE_INST*sizeof(UE_MAC_INST));
+	for (list_el = 0; list_el < NUMBER_OF_UE_MAX - 1; list_el++) {
+	    UE_list->next[list_el] = list_el + 1;
+	    UE_list->next_ul[list_el] = list_el + 1;
+	}
 
-    for(i=0; i<NB_UE_INST; i++) {
-      ue_init_mac(i);
+	UE_list->next[list_el] = -1;
+	UE_list->next_ul[list_el] = -1;
     }
-  } else {
-    UE_mac_inst = NULL;
-  }
-
-
-  LOG_I(MAC,"[MAIN] calling RRC\n");
-  openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,HO_active);
-
-  
-  LOG_I(MAC,"[MAIN][INIT] Init function finished\n");
-
-  return(0);
 
 }
 
-
-void mac_top_init_eNB()
+void mac_init_cell_params(int Mod_idP, int CC_idP)
 {
 
-  module_id_t    i,j;
-  int list_el;
-  UE_list_t *UE_list;
-  eNB_MAC_INST *mac;
-
-  LOG_I(MAC,"[MAIN] Init function start:nb_macrlc_inst=%d\n",RC.nb_macrlc_inst);
-
-  if (RC.nb_macrlc_inst>0) {
-    RC.mac = (eNB_MAC_INST**)malloc16(RC.nb_macrlc_inst*sizeof(eNB_MAC_INST*));
-    AssertFatal(RC.mac != NULL,"can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",
-		RC.nb_macrlc_inst*sizeof(eNB_MAC_INST*),
-		RC.nb_macrlc_inst,
-		sizeof(eNB_MAC_INST));
-    for (i=0;i<RC.nb_macrlc_inst;i++) {
-      RC.mac[i] = (eNB_MAC_INST*)malloc16(sizeof(eNB_MAC_INST));
-      AssertFatal(RC.mac != NULL,
-		  "can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",
-		  RC.nb_macrlc_inst*sizeof(eNB_MAC_INST*),RC.nb_macrlc_inst,sizeof(eNB_MAC_INST));
-      LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d eNB_MAC_INST @ %p\n",sizeof(eNB_MAC_INST),RC.nb_macrlc_inst,RC.mac);
-      bzero(RC.mac[i],sizeof(eNB_MAC_INST));
-      RC.mac[i]->Mod_id = i;
-      for (j=0;j<MAX_NUM_CCs;j++) {
-	RC.mac[i]->DL_req[j].dl_config_request_body.dl_config_pdu_list      = RC.mac[i]->dl_config_pdu_list[j];
-	RC.mac[i]->UL_req[j].ul_config_request_body.ul_config_pdu_list      = RC.mac[i]->ul_config_pdu_list[j];
-	for (int k=0;k<10;k++) RC.mac[i]->UL_req_tmp[j][k].ul_config_request_body.ul_config_pdu_list   = RC.mac[i]->ul_config_pdu_list_tmp[j][k];
-	RC.mac[i]->HI_DCI0_req[j].hi_dci0_request_body.hi_dci0_pdu_list     = RC.mac[i]->hi_dci0_pdu_list[j];
-	RC.mac[i]->TX_req[j].tx_request_body.tx_pdu_list                    = RC.mac[i]->tx_request_pdu[j];
-	RC.mac[i]->ul_handle                                                = 0;
-      }
-    }
-
-    AssertFatal(rlc_module_init()==0,"Could not initialize RLC layer\n");
-
-    // These should be out of here later
-    pdcp_layer_init ();
-
-    rrc_init_global_param();
-
-  } else {
-    RC.mac = NULL;
-  }
-  
-  // Initialize Linked-List for Active UEs
-  for(i=0; i<RC.nb_macrlc_inst; i++) {
-    mac = RC.mac[i];
+    int j;
+    UE_TEMPLATE *UE_template;
 
+    LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", Mod_idP);
+    //COMMON_channels_t *cc = &RC.mac[Mod_idP]->common_channels[CC_idP];
 
-    mac->if_inst                = IF_Module_init(i);
+    memset(&RC.mac[Mod_idP]->eNB_stats, 0, sizeof(eNB_STATS));
+    UE_template =
+	(UE_TEMPLATE *) & RC.mac[Mod_idP]->UE_list.UE_template[CC_idP][0];
 
-    UE_list = &mac->UE_list;
-
-    UE_list->num_UEs=0;
-    UE_list->head=-1;
-    UE_list->head_ul=-1;
-    UE_list->avail=0;
-
-    for (list_el=0; list_el<NUMBER_OF_UE_MAX-1; list_el++) {
-      UE_list->next[list_el]=list_el+1;
-      UE_list->next_ul[list_el]=list_el+1;
-    }
-
-    UE_list->next[list_el]=-1;
-    UE_list->next_ul[list_el]=-1;
-  }
-
-}
-
-void mac_init_cell_params(int Mod_idP,int CC_idP) {
-
-  int j;
-  RA_TEMPLATE *RA_template;
-  UE_TEMPLATE *UE_template;
-  int size_bytes1,size_bytes2,size_bits1,size_bits2;
-
-  LOG_D(MAC,"[MAIN][eNB %d] CC_id %d initializing RA_template\n",Mod_idP, CC_idP);
-  LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", Mod_idP);
-  COMMON_channels_t *cc = &RC.mac[Mod_idP]->common_channels[CC_idP];
-
-  RA_template = (RA_TEMPLATE *)&cc->RA_template[0];
-  
-  for (j=0; j<NB_RA_PROC_MAX; j++) {
-    if ( cc->tdd_Config != NULL) {
-      switch (cc->mib->message.dl_Bandwidth) {
-      case MasterInformationBlock__dl_Bandwidth_n6:
-	size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
-	size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
-	size_bits1 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
-	size_bits2 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
-	break;
-	
-      case MasterInformationBlock__dl_Bandwidth_n25:
-	size_bytes1 = sizeof(DCI1A_5MHz_TDD_1_6_t);
-	size_bytes2 = sizeof(DCI1A_5MHz_TDD_1_6_t);
-	size_bits1 = sizeof_DCI1A_5MHz_TDD_1_6_t;
-	size_bits2 = sizeof_DCI1A_5MHz_TDD_1_6_t;
-	break;
-	
-      case MasterInformationBlock__dl_Bandwidth_n50:
-	size_bytes1 = sizeof(DCI1A_10MHz_TDD_1_6_t);
-	size_bytes2 = sizeof(DCI1A_10MHz_TDD_1_6_t);
-	size_bits1 = sizeof_DCI1A_10MHz_TDD_1_6_t;
-	size_bits2 = sizeof_DCI1A_10MHz_TDD_1_6_t;
-	break;
-	
-      case MasterInformationBlock__dl_Bandwidth_n100:
-	size_bytes1 = sizeof(DCI1A_20MHz_TDD_1_6_t);
-	size_bytes2 = sizeof(DCI1A_20MHz_TDD_1_6_t);
-	size_bits1 = sizeof_DCI1A_20MHz_TDD_1_6_t;
-	size_bits2 = sizeof_DCI1A_20MHz_TDD_1_6_t;
-	break;
-	
-      default:
-	size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
-	size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
-	size_bits1 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
-	size_bits2 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
-	break;
-      }
-      
-    } else {
-      switch (cc->mib->message.dl_Bandwidth) {
-      case MasterInformationBlock__dl_Bandwidth_n6:
-	size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
-	size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
-	size_bits1 = sizeof_DCI1A_1_5MHz_FDD_t;
-	size_bits2 = sizeof_DCI1A_1_5MHz_FDD_t;
-	break;
-	
-      case MasterInformationBlock__dl_Bandwidth_n25:
-	size_bytes1 = sizeof(DCI1A_5MHz_FDD_t);
-	size_bytes2 = sizeof(DCI1A_5MHz_FDD_t);
-	size_bits1 = sizeof_DCI1A_5MHz_FDD_t;
-	size_bits2 = sizeof_DCI1A_5MHz_FDD_t;
-	break;
-	
-      case MasterInformationBlock__dl_Bandwidth_n50:
-	size_bytes1 = sizeof(DCI1A_10MHz_FDD_t);
-	size_bytes2 = sizeof(DCI1A_10MHz_FDD_t);
-	size_bits1 = sizeof_DCI1A_10MHz_FDD_t;
-	size_bits2 = sizeof_DCI1A_10MHz_FDD_t;
-	break;
-	
-      case MasterInformationBlock__dl_Bandwidth_n100:
-	size_bytes1 = sizeof(DCI1A_20MHz_FDD_t);
-	size_bytes2 = sizeof(DCI1A_20MHz_FDD_t);
-	size_bits1 = sizeof_DCI1A_20MHz_FDD_t;
-	size_bits2 = sizeof_DCI1A_20MHz_FDD_t;
-	break;
-	
-      default:
-	size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
-	size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
-	size_bits1 = sizeof_DCI1A_1_5MHz_FDD_t;
-	size_bits2 = sizeof_DCI1A_1_5MHz_FDD_t;
-	break;
-      }
+    for (j = 0; j < NUMBER_OF_UE_MAX; j++) {
+	UE_template[j].rnti = 0;
+	// initiallize the eNB to UE statistics
+	memset(&RC.mac[Mod_idP]->UE_list.eNB_UE_stats[CC_idP][j], 0,
+	       sizeof(eNB_UE_STATS));
     }
-    
-    memcpy((void *)&RA_template[j].RA_alloc_pdu1[0],(void *)&RA_alloc_pdu,size_bytes1);
-    memcpy((void *)&RA_template[j].RA_alloc_pdu2[0],(void *)&DLSCH_alloc_pdu1A,size_bytes2);
-    RA_template[j].RA_dci_size_bytes1 = size_bytes1;
-    RA_template[j].RA_dci_size_bytes2 = size_bytes2;
-    RA_template[j].RA_dci_size_bits1  = size_bits1;
-    RA_template[j].RA_dci_size_bits2  = size_bits2;
-    
-    RA_template[j].RA_dci_fmt1        = format1A;
-    RA_template[j].RA_dci_fmt2        = format1A;
-  }
-  
-  memset (&RC.mac[Mod_idP]->eNB_stats,0,sizeof(eNB_STATS));
-  UE_template = (UE_TEMPLATE *)&RC.mac[Mod_idP]->UE_list.UE_template[CC_idP][0];
-  
-  for (j=0; j<NUMBER_OF_UE_MAX; j++) {
-    UE_template[j].rnti=0;
-    // initiallize the eNB to UE statistics
-    memset (&RC.mac[Mod_idP]->UE_list.eNB_UE_stats[CC_idP][j],0,sizeof(eNB_UE_STATS));
-  }
 
 }
 
@@ -300,61 +161,44 @@ int rlcmac_init_global_param(void)
 {
 
 
-  LOG_I(MAC,"[MAIN] CALLING RLC_MODULE_INIT...\n");
+    LOG_I(MAC, "[MAIN] CALLING RLC_MODULE_INIT...\n");
 
-  if (rlc_module_init()!=0) {
-    return(-1);
-  }
+    if (rlc_module_init() != 0) {
+	return (-1);
+    }
 
-  pdcp_layer_init ();
+    pdcp_layer_init();
 
-  LOG_I(MAC,"[MAIN] Init Global Param Done\n");
+    LOG_I(MAC, "[MAIN] Init Global Param Done\n");
 
-  return 0;
+    return 0;
 }
 
 
 void mac_top_cleanup(void)
 {
 
-#ifndef USER_MODE
-  pdcp_module_cleanup ();
-#endif
-
-  if (NB_UE_INST>0) {
-    free (UE_mac_inst);
-  }
-
-  if (RC.nb_macrlc_inst>0) {
-    free(RC.mac);
-  }
+    if (NB_UE_INST > 0) {
+	free(UE_mac_inst);
+    }
 
-}
+    if (RC.nb_macrlc_inst > 0) {
+	free(RC.mac);
+    }
 
-int l2_init_ue(int eMBMS_active, char *uecap_xer,uint8_t cba_group_active, uint8_t HO_active)
-{
-  LOG_I(MAC,"[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
-  //    NB_NODE=2;
-  //    NB_INST=2;
-
-  rlcmac_init_global_param();
-  LOG_I(MAC,"[MAIN] init UE MAC functions \n");
-  mac_top_init_ue(eMBMS_active,uecap_xer,cba_group_active,HO_active);
-  return(1);
 }
 
-int l2_init_eNB()
+int l2_init_eNB(void)
 {
 
 
 
-  LOG_I(MAC,"[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
+    LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
 
-  rlcmac_init_global_param();
+    rlcmac_init_global_param();
 
-  LOG_D(MAC,"[MAIN] ALL INIT OK\n");
+    LOG_D(MAC, "[MAIN] ALL INIT OK\n");
 
 
-  return(1);
+    return (1);
 }
-
diff --git a/openair2/LAYER2/MAC/main_ue.c b/openair2/LAYER2/MAC/main_ue.c
new file mode 100644
index 0000000000000000000000000000000000000000..64326dec614dc9ea452c7ce7bebf73692050167b
--- /dev/null
+++ b/openair2/LAYER2/MAC/main_ue.c
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file main.c
+ * \brief top init of Layer 2
+ * \author  Navid Nikaein and Raymond Knopp
+ * \date 2010 - 2014
+ * \version 1.0
+ * \email: navid.nikaein@eurecom.fr
+ * @ingroup _mac
+
+ */
+
+#include "defs.h"
+#include "proto.h"
+#include "extern.h"
+#include "assertions.h"
+#include "PHY_INTERFACE/extern.h"
+#include "PHY/defs.h"
+#include "SCHED/defs.h"
+#include "LAYER2/PDCP_v10.1.0/pdcp.h"
+#include "RRC/LITE/defs.h"
+#include "UTIL/LOG/log.h"
+#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
+
+#include "SCHED/defs.h"
+
+
+#include "common/ran_context.h"
+
+extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
+
+void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync)	//init as MR
+{
+    LOG_D(MAC, "[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n",
+	  module_idP, frameP, eNB_index);
+#if defined(ENABLE_USE_MME)
+    int mme_enabled = 1;
+#else
+    int mme_enabled = 0;
+#endif
+
+    if (first_sync == 1 && !(mme_enabled == 1)) {
+	//layer2_init_UE(module_idP);
+	openair_rrc_ue_init(module_idP, eNB_index);
+    } else {
+	rrc_in_sync_ind(module_idP, frameP, eNB_index);
+    }
+}
+
+void
+mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
+		       uint16_t eNB_index)
+{
+
+    //  Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
+}
+
+
+int
+mac_top_init_ue(int eMBMS_active, char *uecap_xer,
+		uint8_t cba_group_active, uint8_t HO_active)
+{
+
+    int i;
+
+    LOG_I(MAC, "[MAIN] Init function start:Nb_UE_INST=%d\n", NB_UE_INST);
+
+    if (NB_UE_INST > 0) {
+	UE_mac_inst =
+	    (UE_MAC_INST *) malloc16(NB_UE_INST * sizeof(UE_MAC_INST));
+
+	AssertFatal(UE_mac_inst != NULL,
+		    "[MAIN] Can't ALLOCATE %zu Bytes for %d UE_MAC_INST with size %zu \n",
+		    NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST,
+		    sizeof(UE_MAC_INST));
+
+	LOG_D(MAC, "[MAIN] ALLOCATE %zu Bytes for %d UE_MAC_INST @ %p\n",
+	      NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST, UE_mac_inst);
+
+	bzero(UE_mac_inst, NB_UE_INST * sizeof(UE_MAC_INST));
+
+	for (i = 0; i < NB_UE_INST; i++) {
+	    ue_init_mac(i);
+	}
+    } else {
+	UE_mac_inst = NULL;
+    }
+
+
+    LOG_I(MAC, "[MAIN] calling RRC\n");
+    openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,
+			    HO_active);
+
+
+    LOG_I(MAC, "[MAIN][INIT] Init function finished\n");
+
+    return (0);
+
+}
+
+int rlcmac_init_global_param_ue(void)
+{
+
+
+    LOG_I(MAC, "[MAIN] CALLING RLC_MODULE_INIT...\n");
+
+    if (rlc_module_init() != 0) {
+        return (-1);
+    }
+
+    pdcp_layer_init();
+
+    LOG_I(MAC, "[MAIN] Init Global Param Done\n");
+
+    return 0;
+}
+
+int
+l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
+	   uint8_t HO_active)
+{
+    LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
+    //    NB_NODE=2;
+    //    NB_INST=2;
+
+    rlcmac_init_global_param_ue();
+    LOG_I(MAC, "[MAIN] init UE MAC functions \n");
+    mac_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, HO_active);
+    return (1);
+}
+
diff --git a/openair2/LAYER2/MAC/openair2_proc.c b/openair2/LAYER2/MAC/openair2_proc.c
deleted file mode 100644
index 89eea810c9e13734a8ff6a4174cee3e262aa90f1..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/openair2_proc.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/* \file openair2_proc.c
- \brief MAC layer online statistics
- \author Navid Nikaein
- \date 2013 - 2014
- \version 1.0
- @ingroup _mac
-*/
-
-#ifndef USER_MODE
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/proc_fs.h>
-
-#endif
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/extern.h"
-//#include "RRC/LITE/extern.h"
-//#include "LAYER2/PDCP/pdcp.h"
-#include "proto.h"
-
-extern RAN_CONTEXT_t RC;
-
-int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length)
-
-{
-
-  int len = 0,fg,Overhead, Sign;
-  unsigned int i,j,k,kk;
-  unsigned int ue_id, eNB_id;
-  unsigned int Mod_id = 0,CH_index;
-  unsigned int stat_tx_pdcp_sdu;
-  unsigned int stat_tx_pdcp_bytes;
-  unsigned int stat_tx_pdcp_sdu_discarded;
-  unsigned int stat_tx_pdcp_bytes_discarded;
-  unsigned int stat_tx_data_pdu;
-  unsigned int stat_tx_data_bytes;
-  unsigned int stat_tx_retransmit_pdu_by_status;
-  unsigned int stat_tx_retransmit_bytes_by_status;
-  unsigned int stat_tx_retransmit_pdu;
-  unsigned int stat_tx_retransmit_bytes;
-  unsigned int stat_tx_control_pdu;
-  unsigned int stat_tx_control_bytes;
-  unsigned int stat_rx_pdcp_sdu;
-  unsigned int stat_rx_pdcp_bytes;
-  unsigned int stat_rx_data_pdus_duplicate;
-  unsigned int stat_rx_data_bytes_duplicate;
-  unsigned int stat_rx_data_pdu;
-  unsigned int stat_rx_data_bytes;
-  unsigned int stat_rx_data_pdu_dropped;
-  unsigned int stat_rx_data_bytes_dropped;
-  unsigned int stat_rx_data_pdu_out_of_window;
-  unsigned int stat_rx_data_bytes_out_of_window;
-  unsigned int stat_rx_control_pdu;
-  unsigned int stat_rx_control_bytes;
-  unsigned int stat_timer_reordering_timed_out;
-  unsigned int stat_timer_poll_retransmit_timed_out;
-  unsigned int stat_timer_status_prohibit_timed_out;
-
-  // UE part
-  for (ue_id=0; ue_id<NUM_UE_INST; ue_id++) {
-    // mod_id used for PDCP and RLC
-    Mod_id = NB_eNB_INST + ue_id ;
-
-    len+=sprintf(&buffer[len],"UE RX TTI: %d\n",UE_mac_inst[ue_id].rxFrame);
-
-    for (enb_id= 0; enb_id <NB_SIG_CNX_UE; enb_id++) {
-
-      switch (mac_get_rrc_status(ue_id,0,enb_id) > RRC_CONNECTED) {
-      case RRC_RECONFIGURED :
-      case RRC_CONNECTED:
-      case RRC_SI_RECEIVED:
-      case RRC_IDLE:
-        break;
-
-        if (mac_get_rrc_status(ue_id,0,enb_id) > RRC_CONNECTED) {
-          //  if (UE_mac_inst[ue_id].Dcch_lchan[CH_index].Active==1) {
-          len+=sprintf(&buffer[len],"eNB %d: Wideband SINR %d dB---\n",
-                       CH_index,UE_mac_inst[Mod_id].Def_meas[CH_index].Wideband_sinr);
-          len+=sprintf(&buffer[len],"CH %d: Subband SINR (dB) :",
-                       CH_index);
-
-          for (fg=0; fg<NUMBER_OF_MEASUREMENT_SUBBANDS; fg++) {
-            len+=sprintf(&buffer[len],"%d ",UE_mac_inst[Mod_id].Def_meas[CH_index].Sinr_meas[0][fg]);
-          }
-
-          len+=sprintf(&buffer[len],"\n");
-
-
-          len+=sprintf(&buffer[len],"BCCH %d, NB_RX_MAC = %d (%d errors)\n",
-                       UE_mac_inst[Mod_id].Bcch_lchan[CH_index].Lchan_info.Lchan_id.Index,
-                       UE_mac_inst[Mod_id].Bcch_lchan[CH_index].Lchan_info.NB_RX,
-                       UE_mac_inst[Mod_id].Bcch_lchan[CH_index].Lchan_info.NB_RX_ERRORS);
-
-
-
-          len+=sprintf(&buffer[len],"CCCH %d, NB_RX_MAC = %d (%d errors)\n",
-                       UE_mac_inst[Mod_id].Ccch_lchan[CH_index].Lchan_info.Lchan_id.Index,
-                       UE_mac_inst[Mod_id].Ccch_lchan[CH_index].Lchan_info.NB_RX,
-                       UE_mac_inst[Mod_id].Ccch_lchan[CH_index].Lchan_info.NB_RX_ERRORS);
-
-
-          len+=sprintf(&buffer[len],"LCHAN %d (DCCH), NB_TX_MAC = %d (%d bits/TTI, %d kbits/sec), NB_RX_MAC = %d (%d errors)\n",
-                       UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.Lchan_id.Index,
-                       UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.NB_TX,
-                       UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.output_rate,
-                       (10*UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.output_rate)>>5,
-                       UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.NB_RX,
-                       UE_mac_inst[Mod_id].Dcch_lchan[CH_index].Lchan_info.NB_RX_ERRORS);
-
-          for(i=1; i<NB_RAB_MAX; i++) {
-            if (UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Active==1) {
-              Overhead=UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.output_rate - Pdcp_stats_tx_rate[k][CH_index][i];
-
-              if(Overhead<0) {
-                Overhead=-Overhead;
-                Sign=-1;
-              } else {
-                Sign=1;
-              }
-
-              len+=sprintf(&buffer[len],"[PDCP]LCHAN %d: NB_TX = %d ,Tx_rate =(%d bits/TTI ,%d Kbits/s), NB_RX = %d ,Rx_rate =(%d bits/TTI ,%d Kbits/s) , LAYER2 TX OVERHEAD: %d Kbits/s\n",
-                           UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
-                           Pdcp_stats_tx[k][CH_index][i],
-                           Pdcp_stats_tx_rate[k][CH_index][i],
-                           (10*Pdcp_stats_tx_rate[k][CH_index][i])>>5,
-                           Pdcp_stats_rx[k][CH_index][i],
-                           Pdcp_stats_rx_rate[k][CH_index][i],
-                           (10*Pdcp_stats_rx_rate[k][CH_index][i])>>5,
-                           Sign*(10*Overhead)>>5);
-
-
-              int status =  rlc_stat_req     (k,
-                                              UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
-                                              &stat_tx_pdcp_sdu,
-                                              &stat_tx_pdcp_bytes,
-                                              &stat_tx_pdcp_sdu_discarded,
-                                              &stat_tx_pdcp_bytes_discarded,
-                                              &stat_tx_data_pdu,
-                                              &stat_tx_data_bytes,
-                                              &stat_tx_retransmit_pdu_by_status,
-                                              &stat_tx_retransmit_bytes_by_status,
-                                              &stat_tx_retransmit_pdu,
-                                              &stat_tx_retransmit_bytes,
-                                              &stat_tx_control_pdu,
-                                              &stat_tx_control_bytes,
-                                              &stat_rx_pdcp_sdu,
-                                              &stat_rx_pdcp_bytes,
-                                              &stat_rx_data_pdus_duplicate,
-                                              &stat_rx_data_bytes_duplicate,
-                                              &stat_rx_data_pdu,
-                                              &stat_rx_data_bytes,
-                                              &stat_rx_data_pdu_dropped,
-                                              &stat_rx_data_bytes_dropped,
-                                              &stat_rx_data_pdu_out_of_window,
-                                              &stat_rx_data_bytes_out_of_window,
-                                              &stat_rx_control_pdu,
-                                              &stat_rx_control_bytes,
-                                              &stat_timer_reordering_timed_out,
-                                              &stat_timer_poll_retransmit_timed_out,
-                                              &stat_timer_status_prohibit_timed_out) ;
-
-              if (status == RLC_OP_STATUS_OK) {
-                len+=sprintf(&buffer[len],"RLC LCHAN %d, NB_SDU_TO_TX = %d\tNB_SDU_DISC %d\tNB_RX_SDU %d\n",
-                             UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
-                             tx_pdcp_sdu,
-                             tx_pdcp_sdu_discarded,
-                             rx_sdu);
-                len+=sprintf(&buffer[len],"RLC LCHAN %d, NB_TB_TX_DATA = %d\tNB_TB_TX_CONTROL %d\tNB_TX_TB_RETRANS %d",
-                             UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
-                             tx_data_pdu,
-                             tx_control_pdu,
-                             tx_retransmit_pdu);
-                len+=sprintf(&buffer[len],"\tRLC LCHAN %d, NB_TX_TB_RETRANS_BY_STATUS = %d\tNB_TX_TB_RETRANS_PADD %d\n",
-                             UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
-                             tx_retransmit_pdu_by_status,
-                             tx_retransmit_pdu_unblock);
-                len+=sprintf(&buffer[len],"RLC LCHAN %d, NB_RX_DATA = %d\tNB_RX_TB_OUT_WIN %d\tNB_RX_TB_CORRUPT %d\n",
-                             UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
-                             rx_data_pdu,
-                             rx_data_pdu_out_of_window,
-                             rx_error_pdu);
-              }
-
-              len+=sprintf(&buffer[len],"[MAC]: LCHAN %d, NB_TX_MAC = %d (%d bits/TTI, %d kbits/s), NB_RX_MAC = %d (%d errors)\n",
-                           UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.Lchan_id.Index,
-                           UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_TX,
-                           UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.output_rate,
-                           (10*UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.output_rate)>>5,
-                           UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_RX,
-                           UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_RX_ERRORS);
-              len+=sprintf(&buffer[len],"        TX per TB: ");
-
-              for(kk=0; kk<MAX_NUMBER_TB_PER_LCHAN/2; kk++) {
-                len+=sprintf(&buffer[len],"%d . ",UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_TX_TB[kk]);
-              }
-
-              len+=sprintf(&buffer[len],"\n");
-              len+=sprintf(&buffer[len],"        RXerr per TB: ");
-
-              for(kk=0; kk<MAX_NUMBER_TB_PER_LCHAN/2; kk++)
-                len+=sprintf(&buffer[len],"%d/%d . ",UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_RX_ERRORS_TB[kk],
-                             UE_mac_inst[Mod_id].Dtch_lchan[i][CH_index].Lchan_info.NB_RX_TB[kk]);
-
-              len+=sprintf(&buffer[len],"\n");
-
-
-
-            }
-
-          }
-        }
-      }
-
-#endif //PHY_EMUL_ONE_MACHINE
-    }
-
-    else if(Mac_rlc_xface->Is_cluster_head[k] ==1) {
-
-      Mod_id=k;
-      len+=sprintf(&buffer[len],
-                   "-------------------------------------------------------------------CH %d: TTI: %d------------------------------------------------------------------\n",
-                   NODE_ID[Mod_id],Mac_rlc_xface->frame);
-
-      for(i=1; i<=NB_CNX_CH; i++) {
-        if (CH_mac_inst[Mod_id].Dcch_lchan[i].Active==1) {
-          len+=sprintf(&buffer[len],"\nMR index %d: DL SINR (feedback) %d dB, CQI: %s\n\n",
-                       i,//CH_rrc_inst[Mod_id].Info.UE_list[i].L2_id[0],
-                       CH_mac_inst[Mod_id].Def_meas[i].Wideband_sinr);
-          //print_cqi(CH_mac_inst[Mod_id].Def_meas[i].cqi));
-
-          len+=sprintf(&buffer[len],
-                       "[MAC] LCHAN %d (DCCH), NB_TX_MAC= %d (%d bits/TTI, %d kbits/s), NB_RX_MAC= %d (errors %d, sacch errors %d, sach errors %d, sach_missing %d)\n\n",
-                       CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.Lchan_id.Index,
-                       CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_TX,
-                       CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.output_rate,
-                       (10*CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.output_rate)>>5,
-                       CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX,
-                       CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX_ERRORS,
-                       CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX_SACCH_ERRORS,
-                       CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX_SACH_ERRORS,
-                       CH_mac_inst[Mod_id].Dcch_lchan[i].Lchan_info.NB_RX_SACH_MISSING);
-
-          for(j=0; j<NB_RAB_MAX; j++) {
-            if (CH_mac_inst[Mod_id].Dtch_lchan[j][i].Active==1) {
-              Overhead=CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.output_rate - Pdcp_stats_tx_rate[k][i][j];
-
-              if(Overhead<0) {
-                Overhead=-Overhead;
-                Sign=-1;
-              } else {
-                Sign=1;
-              }
-
-              len+=sprintf(&buffer[len],
-                           "[PDCP]LCHAN %d: NB_TX = %d ,Tx_rate =(%d bits/TTI ,%d Kbits/s), NB_RX = %d ,Rx_rate =(%d bits/TTI ,%d Kbits/s), LAYER2 TX OVERHEAD= %d Kbits/s\n",
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
-                           Pdcp_stats_tx[k][i][j],
-                           Pdcp_stats_tx_rate[k][i][j],
-                           (10*Pdcp_stats_tx_rate[k][i][j])>>5,
-                           Pdcp_stats_rx[k][i][j],
-                           Pdcp_stats_rx_rate[k][i][j],
-                           (10*Pdcp_stats_rx_rate[k][i][j])>>5,
-                           Sign*(10*Overhead)>>5);
-              int status =  rlc_stat_req     (k,
-                                              CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
-                                              &tx_pdcp_sdu,
-                                              &tx_pdcp_sdu_discarded,
-                                              &tx_retransmit_pdu_unblock,
-                                              &tx_retransmit_pdu_by_status,
-                                              &tx_retransmit_pdu,
-                                              &tx_data_pdu,
-                                              &tx_control_pdu,
-                                              &rx_sdu,
-                                              &rx_error_pdu,
-                                              &rx_data_pdu,
-                                              &rx_data_pdu_out_of_window,
-                                              &rx_control_pdu) ;
-              /*
-              if (status == RLC_OP_STATUS_OK) {
-                len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_SDU_TO_TX = %d\tNB_SDU_DISC %d\tNB_RX_SDU %d\n",
-                      CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
-                   tx_pdcp_sdu,
-                   tx_pdcp_sdu_discarded,
-                   rx_sdu);
-                len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_TB_TX_DATA = %d\tNB_TB_TX_CONTROL %d\tNB_TX_TB_RETRANS %\n",
-                      CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
-                   tx_data_pdu,
-                   tx_control_pdu,
-                   tx_retransmit_pdu);
-                len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_TX_TB_RETRANS_BY_STATUS = %d\tNB_TX_TB_RETRANS_PADD %d\n",
-                      CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
-                   tx_retransmit_pdu_by_status,
-                   tx_retransmit_pdu_unblock);
-                len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_RX_DATA = %d\tNB_RX_TB_OUT_WIN %d\tNB_RX_TB_CORRUPT %d\n",
-                      CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
-                   rx_data_pdu,
-                   rx_data_pdu_out_of_window,
-                   rx_error_pdu);
-              }
-              */
-              len+=sprintf(&buffer[len],
-                           "[MAC]LCHAN %d (CNX %d,RAB %d), NB_TX_MAC= %d (%d bits/TTI, %d kbit/s), NB_RX_MAC= %d (errors %d, sacch_errors %d, sach_errors %d, sach_missing %d)\n",
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
-                           i,j,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_TX,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.output_rate,
-                           (10*CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.output_rate)>>5,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_ERRORS,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_SACCH_ERRORS,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_SACH_ERRORS,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_SACH_MISSING);
-              len+=sprintf(&buffer[len],"[MAC][SCHEDULER] TX Arrival Rate %d, TX Service Rate %d, RX Arrival rate %d, RX Service rate %d, NB_BW_REQ_RX %d\n\n",
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Arrival_rate,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Tx_rate,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Req_rate,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Rx_rate,
-                           CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_BW_REQ_RX);
-
-              /*
-                      len+=sprintf(&buffer[len],"        TX per TB: ");
-                      for(kk=0;kk<MAX_NUMBER_TB_PER_LCHAN/2;kk++)
-                  len+=sprintf(&buffer[len],"%d.",CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_TX_TB[kk]);
-                      len+=sprintf(&buffer[len],"\n");
-                      len+=sprintf(&buffer[len],"        RXerr per TB: ");
-                      for(kk=0;kk<MAX_NUMBER_TB_PER_LCHAN/2;kk++)
-                  len+=sprintf(&buffer[len],"%d/%d . ",CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_ERRORS_TB[kk],
-                         CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_TB[kk]);
-                      len+=sprintf(&buffer[len],"\n");
-              */
-            }
-          }
-        }
-      }
-
-    }
-  }
-
-  return len;
-}
-
-#ifndef USER_MODE
-static struct proc_dir_entry *proc_openair2_root;
-/*
- * Initialize the module and add the /proc file.
- */
-int add_openair2_stats()
-{
-  //#ifdef  KERNEL_VERSION_GREATER_THAN_2629
-  struct proc_dir_entry *pde;
-  //#endif
-
-  proc_openair2_root = proc_mkdir("openair2",0);
-  //#ifdef  KERNEL_VERSION_GREATER_THAN_2629
-  // pde = proc_create_entry("lchan_stats", S_IFREG | S_IRUGO, proc_openair2_root);
-  pde = create_proc_read_entry("lchan_stats", S_IFREG | S_IRUGO, proc_openair2_root, (read_proc_t*)&openair2_stats_read, NULL);
-
-  if (!pde) {
-    printk("[OPENAIR][ERROR] can't create proc entry !\n");
-  }
-
-  //#else
-  //create_proc_info_entry("lchan_stats", S_IFREG | S_IRUGO, proc_openair2_root, openair2_stats_read);
-  //#endif
-
-  return 0;
-}
-/*
- * Unregister the file when the module is closed.
- */
-void remove_openair2_stats()
-{
-
-  if (proc_openair2_root) {
-    printk("[OPENAIR][CLEANUP] Removing openair proc entry\n");
-    remove_proc_entry("lchan_stats", proc_openair2_root);
-    //#ifdef  KERNEL_VERSION_GREATER_THAN_2629
-
-    //#else
-    remove_proc_entry("openair2",NULL);
-    //#endif;
-  }
-}
-#endif
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index 5337dcf657acd225d0c668d2a311a5609989218c..e7458c347f40932ef248d991bd51b1e3a554e002 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -52,18 +52,19 @@
 #include "rlc.h"
 
 
-
 #define DEBUG_eNB_SCHEDULER 1
 #define DEBUG_HEADER_PARSING 1
 //#define DEBUG_PACKET_TRACE 1
 
-//#define ICIC 0
+extern float slice_percentage[MAX_NUM_SLICES];
+extern float slice_percentage_uplink[MAX_NUM_SLICES];
+extern uint32_t sorting_policy[MAX_NUM_SLICES];
 
-/*
-  #ifndef USER_MODE
-  #define msg debug_msg
-  #endif
-*/
+extern int slice_maxmcs[MAX_NUM_SLICES];
+extern int slice_maxmcs_uplink[MAX_NUM_SLICES];
+
+
+//#define ICIC 0
 
 /* this function checks that get_eNB_UE_stats returns
  * a non-NULL pointer for all the active CCs of an UE
@@ -95,513 +96,588 @@ int phy_stats_exist(module_id_t Mod_id, int rnti)
 */
 
 // This function stores the downlink buffer for all the logical channels
-void store_dlsch_buffer (module_id_t Mod_id,
-                         frame_t     frameP,
-                         sub_frame_t subframeP)
+void
+store_dlsch_buffer(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP,
+		   sub_frame_t subframeP)
 {
 
-  int                   UE_id,i;
-  rnti_t                rnti;
-  mac_rlc_status_resp_t rlc_status;
-  UE_list_t             *UE_list = &RC.mac[Mod_id]->UE_list;
-  UE_TEMPLATE           *UE_template;
-
-  for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
-    if (UE_list->active[UE_id] != TRUE) continue;
+    int UE_id, i;
+    rnti_t rnti;
+    mac_rlc_status_resp_t rlc_status;
+    UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
+    UE_TEMPLATE *UE_template;
 
-    UE_template = &UE_list->UE_template[UE_PCCID(Mod_id,UE_id)][UE_id];
+    for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+	if (UE_list->active[UE_id] != TRUE)
+	    continue;
 
-    // clear logical channel interface variables
-    UE_template->dl_buffer_total = 0;
-    UE_template->dl_pdus_total = 0;
+	if (!ue_slice_membership(UE_id, slice_id))
+	    continue;
 
-    for(i=0; i< MAX_NUM_LCID; i++) {
-      UE_template->dl_buffer_info[i]=0;
-      UE_template->dl_pdus_in_buffer[i]=0;
-      UE_template->dl_buffer_head_sdu_creation_time[i]=0;
-      UE_template->dl_buffer_head_sdu_remaining_size_to_send[i]=0;
-    }
+	UE_template =
+	    &UE_list->UE_template[UE_PCCID(Mod_id, UE_id)][UE_id];
 
-    rnti = UE_RNTI(Mod_id,UE_id);
+	// clear logical channel interface variables
+	UE_template->dl_buffer_total = 0;
+	UE_template->dl_pdus_total = 0;
 
-    for(i=0; i< MAX_NUM_LCID; i++) { // loop over all the logical channels
+	for (i = 0; i < MAX_NUM_LCID; i++) {
+	    UE_template->dl_buffer_info[i] = 0;
+	    UE_template->dl_pdus_in_buffer[i] = 0;
+	    UE_template->dl_buffer_head_sdu_creation_time[i] = 0;
+	    UE_template->dl_buffer_head_sdu_remaining_size_to_send[i] = 0;
+	}
 
-      rlc_status = mac_rlc_status_ind(Mod_id,rnti, Mod_id,frameP,subframeP,ENB_FLAG_YES,MBMS_FLAG_NO,i,0 );
-      UE_template->dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel
-      UE_template->dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer;
-      UE_template->dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ;
-      UE_template->dl_buffer_head_sdu_creation_time_max = cmax(UE_template->dl_buffer_head_sdu_creation_time_max,
-          rlc_status.head_sdu_creation_time );
-      UE_template->dl_buffer_head_sdu_remaining_size_to_send[i] = rlc_status.head_sdu_remaining_size_to_send;
-      UE_template->dl_buffer_head_sdu_is_segmented[i] = rlc_status.head_sdu_is_segmented;
-      UE_template->dl_buffer_total += UE_template->dl_buffer_info[i];//storing the total dlsch buffer
-      UE_template->dl_pdus_total   += UE_template->dl_pdus_in_buffer[i];
+	rnti = UE_RNTI(Mod_id, UE_id);
+
+	for (i = 0; i < MAX_NUM_LCID; i++) {	// loop over all the logical channels
+
+	    rlc_status =
+		mac_rlc_status_ind(Mod_id, rnti, Mod_id, frameP, subframeP,
+				   ENB_FLAG_YES, MBMS_FLAG_NO, i, 0);
+	    UE_template->dl_buffer_info[i] = rlc_status.bytes_in_buffer;	//storing the dlsch buffer for each logical channel
+	    UE_template->dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer;
+	    UE_template->dl_buffer_head_sdu_creation_time[i] =
+		rlc_status.head_sdu_creation_time;
+	    UE_template->dl_buffer_head_sdu_creation_time_max =
+		cmax(UE_template->dl_buffer_head_sdu_creation_time_max,
+		     rlc_status.head_sdu_creation_time);
+	    UE_template->dl_buffer_head_sdu_remaining_size_to_send[i] =
+		rlc_status.head_sdu_remaining_size_to_send;
+	    UE_template->dl_buffer_head_sdu_is_segmented[i] =
+		rlc_status.head_sdu_is_segmented;
+	    UE_template->dl_buffer_total += UE_template->dl_buffer_info[i];	//storing the total dlsch buffer
+	    UE_template->dl_pdus_total +=
+		UE_template->dl_pdus_in_buffer[i];
 
 #ifdef DEBUG_eNB_SCHEDULER
 
-      /* note for dl_buffer_head_sdu_remaining_size_to_send[i] :
-       * 0 if head SDU has not been segmented (yet), else remaining size not already segmented and sent
-       */
-      if (UE_template->dl_buffer_info[i]>0)
-        LOG_D(MAC,
-              "[eNB %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n",
-              Mod_id, frameP, subframeP, UE_id,
-              i, UE_template->dl_pdus_in_buffer[i],UE_template->dl_buffer_info[i],
-              UE_template->dl_buffer_head_sdu_creation_time[i],
-              UE_template->dl_buffer_head_sdu_remaining_size_to_send[i],
-              UE_template->dl_buffer_head_sdu_is_segmented[i]
-             );
+	    /* note for dl_buffer_head_sdu_remaining_size_to_send[i] :
+	     * 0 if head SDU has not been segmented (yet), else remaining size not already segmented and sent
+	     */
+	    if (UE_template->dl_buffer_info[i] > 0)
+		LOG_D(MAC,
+		      "[eNB %d][SLICE %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n",
+		      Mod_id, slice_id, frameP, subframeP, UE_id,
+		      i, UE_template->dl_pdus_in_buffer[i],
+		      UE_template->dl_buffer_info[i],
+		      UE_template->dl_buffer_head_sdu_creation_time[i],
+		      UE_template->
+		      dl_buffer_head_sdu_remaining_size_to_send[i],
+		      UE_template->dl_buffer_head_sdu_is_segmented[i]);
 
 #endif
 
-    }
+	}
 
-    //#ifdef DEBUG_eNB_SCHEDULER
-    if ( UE_template->dl_buffer_total>0)
-      LOG_D(MAC,"[eNB %d] Frame %d Subframe %d : RLC status for UE %d : total DL buffer size %d and total number of pdu %d \n",
-            Mod_id, frameP, subframeP, UE_id,
-            UE_template->dl_buffer_total,
-            UE_template->dl_pdus_total
-           );
+	//#ifdef DEBUG_eNB_SCHEDULER
+	if (UE_template->dl_buffer_total > 0)
+	    LOG_D(MAC,
+		  "[eNB %d] Frame %d Subframe %d : RLC status for UE %d : total DL buffer size %d and total number of pdu %d \n",
+		  Mod_id, frameP, subframeP, UE_id,
+		  UE_template->dl_buffer_total,
+		  UE_template->dl_pdus_total);
 
-    //#endif
-  }
+	//#endif
+    }
 }
 
 
 // This function returns the estimated number of RBs required by each UE for downlink scheduling
-void assign_rbs_required (module_id_t Mod_id,
-                          frame_t     frameP,
-                          sub_frame_t subframe,
-                          uint16_t    nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-                          int         min_rb_unit[MAX_NUM_CCs])
+void
+assign_rbs_required(module_id_t Mod_id,
+			slice_id_t slice_id,
+		    frame_t frameP,
+		    sub_frame_t subframe,
+		    uint16_t
+		    nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+		    int min_rb_unit[MAX_NUM_CCs])
 {
 
-  uint16_t         TBS = 0;
-
-  int              UE_id,n,i,j,CC_id,pCCid,tmp;
-  UE_list_t        *UE_list = &RC.mac[Mod_id]->UE_list;
-  eNB_UE_STATS     *eNB_UE_stats,*eNB_UE_stats_i,*eNB_UE_stats_j;
-  int N_RB_DL;
-
-  // clear rb allocations across all CC_id
-  for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
-    if (UE_list->active[UE_id] != TRUE) continue;
-
-    pCCid = UE_PCCID(Mod_id,UE_id);
-
-    //update CQI information across component carriers
-    for (n=0; n<UE_list->numactiveCCs[UE_id]; n++) {
+    uint16_t TBS = 0;
 
-      CC_id = UE_list->ordered_CCids[n][UE_id];
-      eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
+    int UE_id, n, i, j, CC_id, pCCid, tmp;
+    UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
+    eNB_UE_STATS *eNB_UE_stats, *eNB_UE_stats_i, *eNB_UE_stats_j;
+    int N_RB_DL;
 
-      eNB_UE_stats->dlsch_mcs1=cqi_to_mcs[UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id]];
-
-    }
-
-    // provide the list of CCs sorted according to MCS
-    for (i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
-      eNB_UE_stats_i = &UE_list->eNB_UE_stats[UE_list->ordered_CCids[i][UE_id]][UE_id];
-      for (j=i+1; j<UE_list->numactiveCCs[UE_id]; j++) {
-        DevAssert( j < MAX_NUM_CCs );
-	eNB_UE_stats_j = &UE_list->eNB_UE_stats[UE_list->ordered_CCids[j][UE_id]][UE_id];
-        if (eNB_UE_stats_j->dlsch_mcs1 >
-            eNB_UE_stats_i->dlsch_mcs1) {
-          tmp = UE_list->ordered_CCids[i][UE_id];
-          UE_list->ordered_CCids[i][UE_id] = UE_list->ordered_CCids[j][UE_id];
-          UE_list->ordered_CCids[j][UE_id] = tmp;
-        }
-      }
-    }
-
-    if (UE_list->UE_template[pCCid][UE_id].dl_buffer_total> 0) {
-      LOG_D(MAC,"[preprocessor] assign RB for UE %d\n",UE_id);
-
-      for (i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
-        CC_id = UE_list->ordered_CCids[i][UE_id];
-	eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
-
-        if (eNB_UE_stats->dlsch_mcs1==0) {
-          nb_rbs_required[CC_id][UE_id] = 4;  // don't let the TBS get too small
-        } else {
-          nb_rbs_required[CC_id][UE_id] = min_rb_unit[CC_id];
-        }
-
-        TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]);
+    // clear rb allocations across all CC_id
+    for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+	if (UE_list->active[UE_id] != TRUE)
+	    continue;
+	if (!ue_slice_membership(UE_id, slice_id))
+	    continue;
+	pCCid = UE_PCCID(Mod_id, UE_id);
 
-        LOG_D(MAC,"[preprocessor] start RB assignement for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n",
-              UE_id, CC_id, UE_list->UE_template[pCCid][UE_id].dl_buffer_total,
-              nb_rbs_required[CC_id][UE_id],eNB_UE_stats->dlsch_mcs1,TBS);
+	//update CQI information across component carriers
+	for (n = 0; n < UE_list->numactiveCCs[UE_id]; n++) {
 
-	N_RB_DL = to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
+	    CC_id = UE_list->ordered_CCids[n][UE_id];
+	    eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
 
-        /* calculating required number of RBs for each UE */
-        while (TBS < UE_list->UE_template[pCCid][UE_id].dl_buffer_total)  {
-          nb_rbs_required[CC_id][UE_id] += min_rb_unit[CC_id];
+	    eNB_UE_stats->dlsch_mcs1 =cmin(cqi_to_mcs[UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id]],
+									   slice_maxmcs[slice_id]);
 
-          if (nb_rbs_required[CC_id][UE_id] > N_RB_DL) {
-            TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,N_RB_DL);
-            nb_rbs_required[CC_id][UE_id] = N_RB_DL;
-            break;
-          }
+	}
 
-          TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]);
-        } // end of while
+	// provide the list of CCs sorted according to MCS
+	for (i = 0; i < UE_list->numactiveCCs[UE_id]; i++) {
+	    eNB_UE_stats_i =
+		&UE_list->eNB_UE_stats[UE_list->
+				       ordered_CCids[i][UE_id]][UE_id];
+	    for (j = i + 1; j < UE_list->numactiveCCs[UE_id]; j++) {
+		DevAssert(j < MAX_NUM_CCs);
+		eNB_UE_stats_j =
+		    &UE_list->
+		    eNB_UE_stats[UE_list->ordered_CCids[j][UE_id]][UE_id];
+		if (eNB_UE_stats_j->dlsch_mcs1 >
+		    eNB_UE_stats_i->dlsch_mcs1) {
+		    tmp = UE_list->ordered_CCids[i][UE_id];
+		    UE_list->ordered_CCids[i][UE_id] =
+			UE_list->ordered_CCids[j][UE_id];
+		    UE_list->ordered_CCids[j][UE_id] = tmp;
+		}
+	    }
+	}
 
-        LOG_D(MAC,"[eNB %d] Frame %d: UE %d on CC %d: RB unit %d,  nb_required RB %d (TBS %d, mcs %d)\n",
-              Mod_id, frameP,UE_id, CC_id,  min_rb_unit[CC_id], nb_rbs_required[CC_id][UE_id], TBS, eNB_UE_stats->dlsch_mcs1);
-      }
+	if (UE_list->UE_template[pCCid][UE_id].dl_buffer_total > 0) {
+	    LOG_D(MAC, "[preprocessor] assign RB for UE %d\n", UE_id);
+
+	    for (i = 0; i < UE_list->numactiveCCs[UE_id]; i++) {
+		CC_id = UE_list->ordered_CCids[i][UE_id];
+		eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
+
+		if (eNB_UE_stats->dlsch_mcs1 == 0) {
+		    nb_rbs_required[CC_id][UE_id] = 4;	// don't let the TBS get too small
+		} else {
+		    nb_rbs_required[CC_id][UE_id] = min_rb_unit[CC_id];
+		}
+
+		TBS =
+		    get_TBS_DL(eNB_UE_stats->dlsch_mcs1,
+			       nb_rbs_required[CC_id][UE_id]);
+
+		LOG_D(MAC,
+		      "[preprocessor] start RB assignement for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n",
+		      UE_id, CC_id,
+		      UE_list->UE_template[pCCid][UE_id].dl_buffer_total,
+		      nb_rbs_required[CC_id][UE_id],
+		      eNB_UE_stats->dlsch_mcs1, TBS);
+
+		N_RB_DL =
+		    to_prb(RC.mac[Mod_id]->common_channels[CC_id].
+			   mib->message.dl_Bandwidth);
+
+		UE_list->UE_sched_ctrl[UE_id].max_rbs_allowed_slice[CC_id][slice_id]= flexran_nb_rbs_allowed_slice(slice_percentage[slice_id],N_RB_DL);
+
+		/* calculating required number of RBs for each UE */
+		while (TBS <
+		       UE_list->UE_template[pCCid][UE_id].
+		       dl_buffer_total) {
+		    nb_rbs_required[CC_id][UE_id] += min_rb_unit[CC_id];
+
+		    if (nb_rbs_required[CC_id][UE_id] > UE_list->UE_sched_ctrl[UE_id].max_rbs_allowed_slice[CC_id][slice_id]) {
+			TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, UE_list->UE_sched_ctrl[UE_id].max_rbs_allowed_slice[CC_id][slice_id]);
+			nb_rbs_required[CC_id][UE_id] = UE_list->UE_sched_ctrl[UE_id].max_rbs_allowed_slice[CC_id][slice_id];
+			break;
+		    }
+
+		    TBS =
+			get_TBS_DL(eNB_UE_stats->dlsch_mcs1,
+				   nb_rbs_required[CC_id][UE_id]);
+		}		// end of while
+
+		LOG_D(MAC,
+		      "[eNB %d] Frame %d: UE %d on CC %d: RB unit %d,  nb_required RB %d (TBS %d, mcs %d)\n",
+		      Mod_id, frameP, UE_id, CC_id, min_rb_unit[CC_id],
+		      nb_rbs_required[CC_id][UE_id], TBS,
+		      eNB_UE_stats->dlsch_mcs1);
+	    }
+	}
     }
-  }
 }
 
 
 // This function scans all CC_ids for a particular UE to find the maximum round index of its HARQ processes
 
-int maxround(module_id_t Mod_id,uint16_t rnti,int frame,sub_frame_t subframe,uint8_t ul_flag )
+int
+maxround(module_id_t Mod_id, uint16_t rnti, int frame,
+	 sub_frame_t subframe, uint8_t ul_flag)
 {
 
-  uint8_t round,round_max=0,UE_id;
-  int CC_id,harq_pid;
-  UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
-  COMMON_channels_t *cc;
+    uint8_t round, round_max = 0, UE_id;
+    int CC_id, harq_pid;
+    UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
+    COMMON_channels_t *cc;
 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
 
-    cc = &RC.mac[Mod_id]->common_channels[CC_id];
+	cc = &RC.mac[Mod_id]->common_channels[CC_id];
 
-    UE_id = find_UE_id(Mod_id,rnti);
-    if (cc->tdd_Config) harq_pid = ((frame*10)+subframe)%10;
-    else harq_pid = ((frame*10)+subframe)&7;
+	UE_id = find_UE_id(Mod_id, rnti);
+	if (cc->tdd_Config)
+	    harq_pid = ((frame * 10) + subframe) % 10;
+	else
+	    harq_pid = ((frame * 10) + subframe) & 7;
 
-    round    = UE_list->UE_sched_ctrl[UE_id].round[CC_id][harq_pid];
-    if (round > round_max) {
-      round_max = round;
+	round = UE_list->UE_sched_ctrl[UE_id].round[CC_id][harq_pid];
+	if (round > round_max) {
+	    round_max = round;
+	}
     }
-  }
 
-  return round_max;
+    return round_max;
 }
 
 // This function scans all CC_ids for a particular UE to find the maximum DL CQI
 // it returns -1 if the UE is not found in PHY layer (get_eNB_UE_stats gives NULL)
-int maxcqi(module_id_t Mod_id,int32_t UE_id)
+int maxcqi(module_id_t Mod_id, int32_t UE_id)
 {
-  UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
-  int CC_id,n;
-  int CQI = 0;
+    UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
+    int CC_id, n;
+    int CQI = 0;
 
-  for (n=0; n<UE_list->numactiveCCs[UE_id]; n++) {
-    CC_id = UE_list->ordered_CCids[n][UE_id];
+    for (n = 0; n < UE_list->numactiveCCs[UE_id]; n++) {
+	CC_id = UE_list->ordered_CCids[n][UE_id];
 
-    if (UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id] > CQI) {
-      CQI = UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id];
+	if (UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id] > CQI) {
+	    CQI = UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id];
+	}
     }
-  }
 
-  return CQI;
+    return CQI;
 }
 
 struct sort_ue_dl_params {
-  int Mod_idP;
-  int frameP;
-  int subframeP;
+    int Mod_idP;
+    int frameP;
+    int subframeP;
+    int slice_id;
 };
 
 static int ue_dl_compare(const void *_a, const void *_b, void *_params)
 {
-  struct sort_ue_dl_params *params = _params;
-  UE_list_t *UE_list = &RC.mac[params->Mod_idP]->UE_list;
-
-  int UE_id1 = *(const int *)_a;
-  int UE_id2 = *(const int *)_b;
-
-  int rnti1  = UE_RNTI(params->Mod_idP, UE_id1);
-  int pCC_id1 = UE_PCCID(params->Mod_idP, UE_id1);
-  int round1 = maxround(params->Mod_idP, rnti1, params->frameP, params->subframeP, 1);
-
-  int rnti2  = UE_RNTI(params->Mod_idP, UE_id2);
-  int pCC_id2 = UE_PCCID(params->Mod_idP, UE_id2);
-  int round2 = maxround(params->Mod_idP, rnti2, params->frameP, params->subframeP, 1);
-
-  int cqi1 = maxcqi(params->Mod_idP, UE_id1);
-  int cqi2 = maxcqi(params->Mod_idP, UE_id2);
-
-  if (round1 > round2) return -1;
-  if (round1 < round2) return 1;
-
-  if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] + UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2] >
-      UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])
-    return -1;
-  if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] + UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2] <
-      UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])
-    return 1;
-
-  if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max >
-      UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max)
-    return -1;
-  if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max <
-      UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max)
-    return 1;
-
-  if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total >
-      UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total)
-    return -1;
-  if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total <
-      UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total)
-    return 1;
-
-  if (cqi1 > cqi2) return -1;
-  if (cqi1 < cqi2) return 1;
-
-  return 0;
+    struct sort_ue_dl_params *params = _params;
+    UE_list_t *UE_list = &RC.mac[params->Mod_idP]->UE_list;
+
+	int i;
+	int slice_id = params->slice_id;
+    int UE_id1 = *(const int *) _a;
+    int UE_id2 = *(const int *) _b;
+
+    int rnti1 = UE_RNTI(params->Mod_idP, UE_id1);
+    int pCC_id1 = UE_PCCID(params->Mod_idP, UE_id1);
+    int round1 = maxround(params->Mod_idP, rnti1, params->frameP, params->subframeP, 1);
+
+    int rnti2 = UE_RNTI(params->Mod_idP, UE_id2);
+    int pCC_id2 = UE_PCCID(params->Mod_idP, UE_id2);
+    int round2 = maxround(params->Mod_idP, rnti2, params->frameP, params->subframeP, 1);
+
+    int cqi1 = maxcqi(params->Mod_idP, UE_id1);
+    int cqi2 = maxcqi(params->Mod_idP, UE_id2);
+
+  for (i = 0; i < CR_NUM; ++i) {
+    switch (UE_list->sorting_criteria[slice_id][i]) {
+
+      case CR_ROUND :
+        if (round1 > round2)
+          return -1;
+        if (round1 < round2)
+          return 1;
+        break;
+
+      case CR_SRB12 :
+        if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] +
+            UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2] >
+            UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] +
+            UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])
+          return -1;
+        if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] +
+            UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2] <
+            UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] +
+            UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])
+          return 1;
+        break;
+
+      case CR_HOL :
+        if (UE_list-> UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max >
+            UE_list-> UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max)
+          return -1;
+        if (UE_list-> UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max <
+            UE_list-> UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max)
+          return 1;
+        break;
+
+      case CR_LC :
+        if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total >
+            UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total)
+          return -1;
+        if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total <
+            UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total)
+          return 1;
+        break;
+
+      case CR_CQI :
+        if (cqi1 > cqi2)
+          return -1;
+        if (cqi1 < cqi2)
+          return 1;
+
+      default :
+        break;
+    }
+  }
+
+    return 0;
 #if 0
-  /* The above order derives from the following.  */
-      if(round2 > round1) { // Check first if one of the UEs has an active HARQ process which needs service and swap order
-        swap_UEs(UE_list,UE_id1,UE_id2,0);
-      } else if (round2 == round1) {
-        // RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels.  This should be done on the sum of all information that has to be sent.  And still it wouldn't ensure fairness.  It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service.
-        //  for(j=0;j<MAX_NUM_LCID;j++){
-        //    if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] <
-        //      eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
-
-        // first check the buffer status for SRB1 and SRB2
-
-        if ( (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] + UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2]) <
-             (UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])   ) {
-          swap_UEs(UE_list,UE_id1,UE_id2,0);
-        } else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max <
-                   UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max   ) {
-          swap_UEs(UE_list,UE_id1,UE_id2,0);
-        } else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total <
-                   UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total   ) {
-          swap_UEs(UE_list,UE_id1,UE_id2,0);
-        } else if (cqi1 < cqi2) {
-          swap_UEs(UE_list,UE_id1,UE_id2,0);
-        }
-      }
+    /* The above order derives from the following.  */
+    if (round2 > round1) {	// Check first if one of the UEs has an active HARQ process which needs service and swap order
+	swap_UEs(UE_list, UE_id1, UE_id2, 0);
+    } else if (round2 == round1) {
+	// RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels.  This should be done on the sum of all information that has to be sent.  And still it wouldn't ensure fairness.  It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service.
+	//  for(j=0;j<MAX_NUM_LCID;j++){
+	//    if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] <
+	//      eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
+
+	// first check the buffer status for SRB1 and SRB2
+
+	if ((UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] +
+	     UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2]) <
+	    (UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] +
+	     UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])) {
+	    swap_UEs(UE_list, UE_id1, UE_id2, 0);
+	} else if (UE_list->UE_template[pCC_id1]
+		   [UE_id1].dl_buffer_head_sdu_creation_time_max <
+		   UE_list->UE_template[pCC_id2]
+		   [UE_id2].dl_buffer_head_sdu_creation_time_max) {
+	    swap_UEs(UE_list, UE_id1, UE_id2, 0);
+	} else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total <
+		   UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total) {
+	    swap_UEs(UE_list, UE_id1, UE_id2, 0);
+	} else if (cqi1 < cqi2) {
+	    swap_UEs(UE_list, UE_id1, UE_id2, 0);
+	}
+    }
 #endif
 }
 
-// This fuction sorts the UE in order their dlsch buffer and CQI
-void sort_UEs (module_id_t Mod_idP,
-               int         frameP,
-               sub_frame_t subframeP)
-{
-  int               i;
-  int               list[NUMBER_OF_UE_MAX];
-  int               list_size = 0;
-  int               rnti;
-  struct sort_ue_dl_params params = { Mod_idP, frameP, subframeP };
-
-  UE_list_t *UE_list = &RC.mac[Mod_idP]->UE_list;
-
-  for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
-
-    if (UE_list->active[i]==FALSE) continue;
-    if ((rnti = UE_RNTI(Mod_idP, i)) == NOT_A_RNTI) continue;
-    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1) continue;
-
-    list[list_size] = i;
-    list_size++;
-  }
+void decode_sorting_policy(module_id_t Mod_idP, slice_id_t slice_id) {
+	int i;
 
-  qsort_r(list, list_size, sizeof(int), ue_dl_compare, &params);
+	UE_list_t *UE_list = &RC.mac[Mod_idP]->UE_list;
+	uint32_t policy = sorting_policy[slice_id];
+	uint32_t mask = 0x0000000F;
+    uint16_t criterion;
 
-  if (list_size) {
-    for (i = 0; i < list_size-1; i++)
-      UE_list->next[list[i]] = list[i+1];
-    UE_list->next[list[list_size-1]] = -1;
-    UE_list->head = list[0];
-  } else {
-    UE_list->head = -1;
-  }
+	for(i = 0; i < CR_NUM; ++i) {
+		criterion = (uint16_t)(policy >> 4*(CR_NUM - 1 - i) & mask);
+        if (criterion >= CR_NUM) {
+          LOG_W(MAC, "Invalid criterion in slice %d policy, revert to default policy \n", slice_id);
+          sorting_policy[slice_id] = 0x1234;
+          break;
+        }
+      UE_list->sorting_criteria[slice_id][i] = criterion;
+	}
+}
 
-#if 0
 
+// This fuction sorts the UE in order their dlsch buffer and CQI
+void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t subframeP)
+{
+    int i;
+    int list[NUMBER_OF_UE_MAX];
+    int list_size = 0;
+    int rnti;
+    struct sort_ue_dl_params params = { Mod_idP, frameP, subframeP, slice_id };
+
+    UE_list_t *UE_list = &RC.mac[Mod_idP]->UE_list;
+
+	for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+
+		if (UE_list->active[i] == FALSE)
+			continue;
+		if ((rnti = UE_RNTI(Mod_idP, i)) == NOT_A_RNTI)
+			continue;
+		if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
+			continue;
+		if (!ue_slice_membership(i, slice_id))
+			continue;
+
+		list[list_size] = i;
+		list_size++;
+	}
 
-  int               UE_id1,UE_id2;
-  int               pCC_id1,pCC_id2;
-  int               cqi1,cqi2,round1,round2;
-  int               i=0,ii=0;//,j=0;
-  rnti_t            rnti1,rnti2;
+	decode_sorting_policy(Mod_idP, slice_id);
 
-  UE_list_t *UE_list = &RC.mac[Mod_idP]->UE_list;
+	qsort_r(list, list_size, sizeof(int), ue_dl_compare, &params);
 
-  for (i=UE_list->head; i>=0; i=UE_list->next[i]) {
+	if (list_size) {
+		for (i = 0; i < list_size - 1; i++)
+			UE_list->next[list[i]] = list[i + 1];
+		UE_list->next[list[list_size - 1]] = -1;
+		UE_list->head = list[0];
+	} else {
+		UE_list->head = -1;
+	}
 
-    for(ii=UE_list->next[i]; ii>=0; ii=UE_list->next[ii]) {
+#if 0
 
-      UE_id1  = i;
-      rnti1 = UE_RNTI(Mod_idP,UE_id1);
-      if(rnti1 == NOT_A_RNTI)
-	continue;
-      if (UE_list->UE_sched_ctrl[UE_id1].ul_out_of_sync == 1)
-	continue;
-      pCC_id1 = UE_PCCID(Mod_idP,UE_id1);
-      cqi1    = maxcqi(Mod_idP,UE_id1); //
-      round1  = maxround(Mod_idP,rnti1,frameP,subframeP,0);
 
-      UE_id2 = ii;
-      rnti2 = UE_RNTI(Mod_idP,UE_id2);
-      if(rnti2 == NOT_A_RNTI)
-        continue;
-      if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
-	continue;
-      cqi2    = maxcqi(Mod_idP,UE_id2);
-      round2  = maxround(Mod_idP,rnti2,frameP,subframeP,0);  //mac_xface->get_ue_active_harq_pid(Mod_id,rnti2,subframe,&harq_pid2,&round2,0);
-      pCC_id2 = UE_PCCID(Mod_idP,UE_id2);
-
-      if(round2 > round1) { // Check first if one of the UEs has an active HARQ process which needs service and swap order
-        swap_UEs(UE_list,UE_id1,UE_id2,0);
-      } else if (round2 == round1) {
-        // RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels.  This should be done on the sum of all information that has to be sent.  And still it wouldn't ensure fairness.  It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service.
-        //  for(j=0;j<MAX_NUM_LCID;j++){
-        //    if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] <
-        //      eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
-
-        // first check the buffer status for SRB1 and SRB2
-
-        if ( (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] + UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2]) <
-             (UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])   ) {
-          swap_UEs(UE_list,UE_id1,UE_id2,0);
-        } else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max <
-                   UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max   ) {
-          swap_UEs(UE_list,UE_id1,UE_id2,0);
-        } else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total <
-                   UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total   ) {
-          swap_UEs(UE_list,UE_id1,UE_id2,0);
-        } else if (cqi1 < cqi2) {
-          swap_UEs(UE_list,UE_id1,UE_id2,0);
-        }
-      }
+    int UE_id1, UE_id2;
+    int pCC_id1, pCC_id2;
+    int cqi1, cqi2, round1, round2;
+    int i = 0, ii = 0;		//,j=0;
+    rnti_t rnti1, rnti2;
+
+    UE_list_t *UE_list = &RC.mac[Mod_idP]->UE_list;
+
+    for (i = UE_list->head; i >= 0; i = UE_list->next[i]) {
+
+	for (ii = UE_list->next[i]; ii >= 0; ii = UE_list->next[ii]) {
+
+	    UE_id1 = i;
+	    rnti1 = UE_RNTI(Mod_idP, UE_id1);
+	    if (rnti1 == NOT_A_RNTI)
+		continue;
+	    if (UE_list->UE_sched_ctrl[UE_id1].ul_out_of_sync == 1)
+		continue;
+	    pCC_id1 = UE_PCCID(Mod_idP, UE_id1);
+	    cqi1 = maxcqi(Mod_idP, UE_id1);	//
+	    round1 = maxround(Mod_idP, rnti1, frameP, subframeP, 0);
+
+	    UE_id2 = ii;
+	    rnti2 = UE_RNTI(Mod_idP, UE_id2);
+	    if (rnti2 == NOT_A_RNTI)
+		continue;
+	    if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
+		continue;
+	    cqi2 = maxcqi(Mod_idP, UE_id2);
+	    round2 = maxround(Mod_idP, rnti2, frameP, subframeP, 0);	//mac_xface->get_ue_active_harq_pid(Mod_id,rnti2,subframe,&harq_pid2,&round2,0);
+	    pCC_id2 = UE_PCCID(Mod_idP, UE_id2);
+
+	    if (round2 > round1) {	// Check first if one of the UEs has an active HARQ process which needs service and swap order
+		swap_UEs(UE_list, UE_id1, UE_id2, 0);
+	    } else if (round2 == round1) {
+		// RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels.  This should be done on the sum of all information that has to be sent.  And still it wouldn't ensure fairness.  It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service.
+		//  for(j=0;j<MAX_NUM_LCID;j++){
+		//    if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] <
+		//      eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
+
+		// first check the buffer status for SRB1 and SRB2
+
+		if ((UE_list->UE_template[pCC_id1][UE_id1].
+		     dl_buffer_info[1] +
+		     UE_list->UE_template[pCC_id1][UE_id1].
+		     dl_buffer_info[2]) <
+		    (UE_list->UE_template[pCC_id2][UE_id2].
+		     dl_buffer_info[1] +
+		     UE_list->UE_template[pCC_id2][UE_id2].
+		     dl_buffer_info[2])) {
+		    swap_UEs(UE_list, UE_id1, UE_id2, 0);
+		} else if (UE_list->UE_template[pCC_id1]
+			   [UE_id1].dl_buffer_head_sdu_creation_time_max <
+			   UE_list->UE_template[pCC_id2]
+			   [UE_id2].dl_buffer_head_sdu_creation_time_max) {
+		    swap_UEs(UE_list, UE_id1, UE_id2, 0);
+		} else if (UE_list->UE_template[pCC_id1][UE_id1].
+			   dl_buffer_total <
+			   UE_list->UE_template[pCC_id2][UE_id2].
+			   dl_buffer_total) {
+		    swap_UEs(UE_list, UE_id1, UE_id2, 0);
+		} else if (cqi1 < cqi2) {
+		    swap_UEs(UE_list, UE_id1, UE_id2, 0);
+		}
+	    }
+	}
     }
-  }
 #endif
 }
 
+void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
+                                              slice_id_t slice_id,
+                                              frame_t frameP,
+                                              sub_frame_t subframeP,
+                                              int N_RBG[MAX_NUM_CCs],
+                                              int min_rb_unit[MAX_NUM_CCs],
+                                              uint8_t rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
+                                              uint8_t MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX],
+                                              uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]) {
 
 
+  int UE_id, CC_id;
+  int ii, r1;
 
-// This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done
-void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
-                                    frame_t       frameP,
-                                    sub_frame_t   subframeP,
-                                    int           N_RBG[MAX_NUM_CCs],
-                                    int           *mbsfn_flag)
-{
-
-  unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],harq_pid=0,round=0,total_ue_count;
-  unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX];
-  int                     UE_id, i; 
-  uint16_t                ii,j;
-  uint16_t                nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  uint16_t                nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  uint16_t                nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  uint16_t                average_rbs_per_user[MAX_NUM_CCs] = {0};
-  rnti_t             rnti;
-  int                min_rb_unit[MAX_NUM_CCs];
-  uint16_t r1=0;
-  uint8_t CC_id;
-  UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
+  rnti_t rnti;
+  uint8_t harq_pid, round, transmission_mode;
+  uint8_t total_rbs_used[MAX_NUM_CCs];
+  uint8_t total_ue_count[MAX_NUM_CCs];
+  uint16_t average_rbs_per_user[MAX_NUM_CCs];
+  uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+  uint16_t nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
 
   int N_RB_DL;
-  int transmission_mode = 0;
+  UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
   UE_sched_ctrl *ue_sched_ctl;
-  //  int rrc_status           = RRC_IDLE;
   COMMON_channels_t *cc;
 
-#ifdef TM5
-  int harq_pid1=0;
-  int round1=0,round2=0;
-  int UE_id2;
-  uint16_t                i1,i2,i3;
-  rnti_t             rnti1,rnti2;
-  LTE_eNB_UE_stats  *eNB_UE_stats1 = NULL;
-  LTE_eNB_UE_stats  *eNB_UE_stats2 = NULL;
-  UE_sched_ctrl *ue_sched_ctl1,*ue_sched_ctl2;
-#endif
-
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-    if (mbsfn_flag[CC_id]>0)  // If this CC is allocated for MBSFN skip it here
-      continue;
-
-
-
-    min_rb_unit[CC_id]=get_min_rb_unit(Mod_id,CC_id);
-
-    for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
-      if (UE_list->active[i] != TRUE) continue;
-
-      UE_id = i;
-      // Initialize scheduling information for all active UEs
-      
-
-
-      dlsch_scheduler_pre_processor_reset(Mod_id,
-        UE_id,
-        CC_id,
-        frameP,
-        subframeP,
-        N_RBG[CC_id],
-        nb_rbs_required,
-        nb_rbs_required_remaining,
-        rballoc_sub,
-        MIMO_mode_indicator);
-
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    total_ue_count[CC_id] = 0;
+    total_rbs_used[CC_id] = 0;
+    average_rbs_per_user[CC_id] = 0;
+    for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; ++UE_id) {
+      nb_rbs_required_remaining[CC_id][UE_id] = 0;
     }
   }
 
-
-  // Store the DLSCH buffer for each logical channel
-  store_dlsch_buffer (Mod_id,frameP,subframeP);
-
-
-
-  // Calculate the number of RBs required by each UE on the basis of logical channel's buffer
-  assign_rbs_required (Mod_id,frameP,subframeP,nb_rbs_required,min_rb_unit);
-
-
-
-  // Sorts the user on the basis of dlsch logical channel buffer and CQI
-  sort_UEs (Mod_id,frameP,subframeP);
-
-
-
-  total_ue_count =0;
-
   // loop over all active UEs
-  for (i=UE_list->head; i>=0; i=UE_list->next[i]) {
-    rnti = UE_RNTI(Mod_id,i);
+  for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
+    rnti = UE_RNTI(Mod_id, UE_id);
 
-    if(rnti == NOT_A_RNTI)
+    if (rnti == NOT_A_RNTI)
       continue;
-    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
+    if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
+      continue;
+    if (!ue_slice_membership(UE_id, slice_id))
       continue;
-    UE_id = i;
 
-    for (ii=0; ii<UE_num_active_CC(UE_list,UE_id); ii++) {
+    for (ii = 0; ii < UE_num_active_CC(UE_list, UE_id); ii++) {
       CC_id = UE_list->ordered_CCids[ii][UE_id];
       ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-      cc=&RC.mac[Mod_id]->common_channels[ii];
-      if (cc->tdd_Config) harq_pid = ((frameP*10)+subframeP)%10;
-      else harq_pid = ((frameP*10)+subframeP)&7;
-      round    = ue_sched_ctl->round[CC_id][harq_pid];
-
-      average_rbs_per_user[CC_id]=0;
+      cc = &RC.mac[Mod_id]->common_channels[CC_id];
+      // TODO Can we use subframe2harqpid() here?
+      if (cc->tdd_Config)
+        harq_pid = ((frameP * 10) + subframeP) % 10;
+      else
+        harq_pid = ((frameP * 10) + subframeP) & 7;
+      round = ue_sched_ctl->round[CC_id][harq_pid];
 
+      average_rbs_per_user[CC_id] = 0;
 
-      if(round != 8) {
+      if (round != 8) {
         nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
+        total_rbs_used[CC_id] += nb_rbs_required[CC_id][UE_id];
       }
 
       //nb_rbs_required_remaining[UE_id] = nb_rbs_required[UE_id];
       if (nb_rbs_required[CC_id][UE_id] > 0) {
-        total_ue_count = total_ue_count + 1;
+        total_ue_count[CC_id] = total_ue_count[CC_id] + 1;
       }
+    }
+  }
+
+  // loop over all active UEs and calculate avg rb per user based on total active UEs
+  for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
+    rnti = UE_RNTI(Mod_id, UE_id);
 
+    if (rnti == NOT_A_RNTI)
+      continue;
+    if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
+      continue;
+    if (!ue_slice_membership(UE_id, slice_id))
+      continue;
+
+    for (ii = 0; ii < UE_num_active_CC(UE_list, UE_id); ii++) {
+      CC_id = UE_list->ordered_CCids[ii][UE_id];
 
       // hypothetical assignment
       /*
@@ -613,40 +689,57 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
        * per user by a coefficient which represents the degree of priority.
        */
 
-      N_RB_DL = to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
+      N_RB_DL = to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth) - total_rbs_used[CC_id];
 
-      if (total_ue_count == 0) {
+      // recalculate based on the what is left after retransmission
+      ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+      ue_sched_ctl->max_rbs_allowed_slice[CC_id][slice_id] =
+              flexran_nb_rbs_allowed_slice(slice_percentage[slice_id], N_RB_DL);
+
+      if (total_ue_count[CC_id] == 0) {
         average_rbs_per_user[CC_id] = 0;
-      } else if( (min_rb_unit[CC_id] * total_ue_count) <= (N_RB_DL) ) {
-        average_rbs_per_user[CC_id] = (uint16_t) floor(N_RB_DL/total_ue_count);
+      } else if ((min_rb_unit[CC_id] * total_ue_count[CC_id]) <=
+                 (ue_sched_ctl->max_rbs_allowed_slice[CC_id][slice_id])) {
+        average_rbs_per_user[CC_id] =
+                (uint16_t) floor(ue_sched_ctl->max_rbs_allowed_slice[CC_id][slice_id] / total_ue_count[CC_id]);
       } else {
-        average_rbs_per_user[CC_id] = min_rb_unit[CC_id]; // consider the total number of use that can be scheduled UE
+        // consider the total number of use that can be scheduled UE
+        average_rbs_per_user[CC_id] = min_rb_unit[CC_id];
       }
     }
   }
 
   // note: nb_rbs_required is assigned according to total_buffer_dl
   // extend nb_rbs_required to capture per LCID RB required
-  for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
-    rnti = UE_RNTI(Mod_id,i);
+  for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
+    rnti = UE_RNTI(Mod_id, UE_id);
 
-    if(rnti == NOT_A_RNTI)
+    if (rnti == NOT_A_RNTI)
       continue;
-    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
+    if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
+      continue;
+    if (!ue_slice_membership(UE_id, slice_id))
       continue;
 
-    for (ii=0; ii<UE_num_active_CC(UE_list,i); ii++) {
-      CC_id = UE_list->ordered_CCids[ii][i];
-      ue_sched_ctl = &UE_list->UE_sched_ctrl[i];
-      round    = ue_sched_ctl->round[CC_id][harq_pid];
+    for (ii = 0; ii < UE_num_active_CC(UE_list, UE_id); ii++) {
+      CC_id = UE_list->ordered_CCids[ii][UE_id];
+      ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+      cc = &RC.mac[Mod_id]->common_channels[CC_id];
+      // TODO Can we use subframe2harqpid() here?
+      if (cc->tdd_Config)
+        harq_pid = ((frameP * 10) + subframeP) % 10;
+      else
+        harq_pid = ((frameP * 10) + subframeP) & 7;
+      round = ue_sched_ctl->round[CC_id][harq_pid];
 
       // control channel or retransmission
       /* TODO: do we have to check for retransmission? */
-      if (mac_eNB_get_rrc_status(Mod_id,rnti) < RRC_RECONFIGURED || round > 0) {
-        nb_rbs_required_remaining_1[CC_id][i] = nb_rbs_required[CC_id][i];
+      if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || round > 0) {
+        nb_rbs_required_remaining_1[CC_id][UE_id] =
+                nb_rbs_required[CC_id][UE_id];
       } else {
-        nb_rbs_required_remaining_1[CC_id][i] = cmin(average_rbs_per_user[CC_id],nb_rbs_required[CC_id][i]);
-
+        nb_rbs_required_remaining_1[CC_id][UE_id] =
+                cmin(average_rbs_per_user[CC_id], nb_rbs_required[CC_id][UE_id]);
       }
     }
   }
@@ -654,211 +747,395 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
   //Allocation to UEs is done in 2 rounds,
   // 1st stage: average number of RBs allocated to each UE
   // 2nd stage: remaining RBs are allocated to high priority UEs
-  for(r1=0; r1<2; r1++) {
-
-    for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
-      for (ii=0; ii<UE_num_active_CC(UE_list,i); ii++) {
-        CC_id = UE_list->ordered_CCids[ii][i];
-
-        if(r1 == 0) {
-          nb_rbs_required_remaining[CC_id][i] = nb_rbs_required_remaining_1[CC_id][i];
-        } else { // rb required based only on the buffer - rb allloctaed in the 1st round + extra reaming rb form the 1st round
-          nb_rbs_required_remaining[CC_id][i] = nb_rbs_required[CC_id][i]-nb_rbs_required_remaining_1[CC_id][i]+nb_rbs_required_remaining[CC_id][i];
-if (nb_rbs_required_remaining[CC_id][i]<0) abort();
+  for (r1 = 0; r1 < 2; r1++) {
+
+    for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
+      for (ii = 0; ii < UE_num_active_CC(UE_list, UE_id); ii++) {
+        CC_id = UE_list->ordered_CCids[ii][UE_id];
+
+        if (r1 == 0) {
+          nb_rbs_required_remaining[CC_id][UE_id] =
+                  nb_rbs_required_remaining_1[CC_id][UE_id];
+        } else {    // rb required based only on the buffer - rb allocated in the 1st round + extra reaming rb form the 1st round
+          nb_rbs_required_remaining[CC_id][UE_id] =
+                  nb_rbs_required[CC_id][UE_id] -
+                  nb_rbs_required_remaining_1[CC_id][UE_id] +
+                  nb_rbs_required_remaining[CC_id][UE_id];
+          if (nb_rbs_required_remaining[CC_id][UE_id] < 0)
+            abort();
         }
 
-        if (nb_rbs_required[CC_id][i]> 0 )
-          LOG_D(MAC,"round %d : nb_rbs_required_remaining[%d][%d]= %d (remaining_1 %d, required %d,  pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n",
-                r1, CC_id, i,
-                nb_rbs_required_remaining[CC_id][i],
-                nb_rbs_required_remaining_1[CC_id][i],
-                nb_rbs_required[CC_id][i],
-                UE_list->UE_sched_ctrl[i].pre_nb_available_rbs[CC_id],
+        if (nb_rbs_required[CC_id][UE_id] > 0)
+          LOG_D(MAC,
+                "round %d : nb_rbs_required_remaining[%d][%d]= %d (remaining_1 %d, required %d,  pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n",
+                r1, CC_id, UE_id,
+                nb_rbs_required_remaining[CC_id][UE_id],
+                nb_rbs_required_remaining_1[CC_id][UE_id],
+                nb_rbs_required[CC_id][UE_id],
+                UE_list->UE_sched_ctrl[UE_id].pre_nb_available_rbs[CC_id],
                 N_RBG[CC_id],
                 min_rb_unit[CC_id]);
 
       }
     }
 
-    if (total_ue_count > 0 ) {
-      for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
-        UE_id = i;
+    for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
 
-        for (ii=0; ii<UE_num_active_CC(UE_list,UE_id); ii++) {
-          CC_id = UE_list->ordered_CCids[ii][UE_id];
-	  ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-	  round    = ue_sched_ctl->round[CC_id][harq_pid];
+      for (ii = 0; ii < UE_num_active_CC(UE_list, UE_id); ii++) {
 
-          rnti = UE_RNTI(Mod_id,UE_id);
+        CC_id = UE_list->ordered_CCids[ii][UE_id];
+        // if there are UEs with traffic
+        if (total_ue_count[CC_id] > 0) {
+          // ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+          // round = ue_sched_ctl->round[CC_id][harq_pid];
+
+          rnti = UE_RNTI(Mod_id, UE_id);
 
           // LOG_D(MAC,"UE %d rnti 0x\n", UE_id, rnti );
-          if(rnti == NOT_A_RNTI)
+          if (rnti == NOT_A_RNTI)
+            continue;
+          if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
+            continue;
+          if (!ue_slice_membership(UE_id, slice_id))
             continue;
-	  if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
-	    continue;
 
-          transmission_mode = get_tmode(Mod_id,CC_id,UE_id);
-	  //          mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,frameP,subframeP,&harq_pid,&round,0);
-          //rrc_status = mac_eNB_get_rrc_status(Mod_id,rnti);
+          transmission_mode = get_tmode(Mod_id, CC_id, UE_id);
+          // mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,frameP,subframeP,&harq_pid,&round,0);
+          // rrc_status = mac_eNB_get_rrc_status(Mod_id,rnti);
           /* 1st allocate for the retx */
 
           // retransmission in data channels
           // control channel in the 1st transmission
           // data channel for all TM
-          LOG_T(MAC,"calling dlsch_scheduler_pre_processor_allocate .. \n ");
-          dlsch_scheduler_pre_processor_allocate (Mod_id,
-                                                  UE_id,
-                                                  CC_id,
-                                                  N_RBG[CC_id],
-                                                  transmission_mode,
-                                                  min_rb_unit[CC_id],
-                                                  to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth),
-                                                  nb_rbs_required,
-                                                  nb_rbs_required_remaining,
-                                                  rballoc_sub,
-                                                  MIMO_mode_indicator);
+          LOG_T(MAC,
+                "calling dlsch_scheduler_pre_processor_allocate .. \n ");
+          dlsch_scheduler_pre_processor_allocate(Mod_id, UE_id,
+                                                 CC_id,
+                                                 N_RBG[CC_id],
+                                                 transmission_mode,
+                                                 min_rb_unit
+                                                 [CC_id],
+                                                 to_prb(RC.mac
+                                                        [Mod_id]->common_channels
+                                                        [CC_id].mib->message.dl_Bandwidth),
+                                                 nb_rbs_required,
+                                                 nb_rbs_required_remaining,
+                                                 rballoc_sub,
+                                                 MIMO_mode_indicator);
 
 #ifdef TM5
-
-          // data chanel TM5: to be revisted
-          if ((round == 0 )  &&
-              (transmission_mode == 5)  &&
-              (ue_sched_ctl->dl_pow_off[CC_id] != 1)) {
-
-            for(j=0; j<N_RBG[CC_id]; j+=2) {
-
-              if( (((j == (N_RBG[CC_id]-1))&& (rballoc_sub[CC_id][j] == 0) && (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 0))  ||
-                   ((j < (N_RBG[CC_id]-1)) && (rballoc_sub[CC_id][j+1] == 0) && (ue_sched_ctl->rballoc_sub_UE[CC_id][j+1] == 0)) ) &&
-                  (nb_rbs_required_remaining[CC_id][UE_id]>0)) {
-
-                for (ii = UE_list->next[i+1]; ii >=0; ii=UE_list->next[ii]) {
+          // data chanel TM5: to be revisited
+          if ((round == 0) &&
+          (transmission_mode == 5) &&
+          (ue_sched_ctl->dl_pow_off[CC_id] != 1)) {
+
+          for (j = 0; j < N_RBG[CC_id]; j += 2) {
+
+              if ((((j == (N_RBG[CC_id] - 1))
+                && (rballoc_sub[CC_id][j] == 0)
+                && (ue_sched_ctl->
+                    rballoc_sub_UE[CC_id][j] == 0))
+               || ((j < (N_RBG[CC_id] - 1))
+                   && (rballoc_sub[CC_id][j + 1] == 0)
+                   &&
+                   (ue_sched_ctl->rballoc_sub_UE
+                    [CC_id][j + 1] == 0)))
+              && (nb_rbs_required_remaining[CC_id][UE_id]
+                  > 0)) {
+
+              for (ii = UE_list->next[UE_id + 1]; ii >= 0;
+                   ii = UE_list->next[ii]) {
 
                   UE_id2 = ii;
-                  rnti2 = UE_RNTI(Mod_id,UE_id2);
-		  ue_sched_ctl2 = &UE_list->UE_sched_ctrl[UE_id2];
-		  round2    = ue_sched_ctl2->round[CC_id];
-                  if(rnti2 == NOT_A_RNTI)
-                    continue;
-		  if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
-		    continue;
-
-                  eNB_UE_stats2 = UE_list->eNB_UE_stats[CC_id][UE_id2];
+                  rnti2 = UE_RNTI(Mod_id, UE_id2);
+                  ue_sched_ctl2 =
+                  &UE_list->UE_sched_ctrl[UE_id2];
+                  round2 = ue_sched_ctl2->round[CC_id];
+                  if (rnti2 == NOT_A_RNTI)
+                  continue;
+                  if (UE_list->
+                  UE_sched_ctrl
+                  [UE_id2].ul_out_of_sync == 1)
+                  continue;
+
+                  eNB_UE_stats2 =
+                  UE_list->
+                  eNB_UE_stats[CC_id][UE_id2];
                   //mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti2,frameP,subframeP,&harq_pid2,&round2,0);
 
-                  if ((mac_eNB_get_rrc_status(Mod_id,rnti2) >= RRC_RECONFIGURED) &&
-                      (round2==0) &&
-                      (get_tmode(Mod_id,CC_id,UE_id2)==5) &&
-                      (ue_sched_ctl->dl_pow_off[CC_id] != 1)) {
-
-                    if( (((j == (N_RBG[CC_id]-1)) && (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 0)) ||
-                         ((j < (N_RBG[CC_id]-1)) && (ue_sched_ctl->rballoc_sub_UE[CC_id][j+1] == 0))  ) &&
-                        (nb_rbs_required_remaining[CC_id][UE_id2]>0)) {
-
-                      if((((eNB_UE_stats2->DL_pmi_single^eNB_UE_stats1->DL_pmi_single)<<(14-j))&0xc000)== 0x4000) { //MU-MIMO only for 25 RBs configuration
-
-                        rballoc_sub[CC_id][j] = 1;
-                        ue_sched_ctl->rballoc_sub_UE[CC_id][j] = 1;
-                        ue_sched_ctl2->rballoc_sub_UE[CC_id][j] = 1;
-                        MIMO_mode_indicator[CC_id][j] = 0;
-
-                        if (j< N_RBG[CC_id]-1) {
-                          rballoc_sub[CC_id][j+1] = 1;
-                          ue_sched_ctl->rballoc_sub_UE[CC_id][j+1] = 1;
-                          ue_sched_ctl2->rballoc_sub_UE[CC_id][j+1] = 1;
-                          MIMO_mode_indicator[CC_id][j+1] = 0;
-                        }
-
-                        ue_sched_ctl->dl_pow_off[CC_id] = 0;
-                        ue_sched_ctl2->dl_pow_off[CC_id] = 0;
-
-
-                        if ((j == N_RBG[CC_id]-1) &&
-                            ((N_RB_DL == 25) ||
-                             (N_RB_DL == 50))) {
-			  
-                          nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id]+1;
-                          ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit[CC_id]-1;
-                          nb_rbs_required_remaining[CC_id][UE_id2] = nb_rbs_required_remaining[CC_id][UE_id2] - min_rb_unit[CC_id]+1;
-                          ue_sched_ctl2->pre_nb_available_rbs[CC_id] = ue_sched_ctl2->pre_nb_available_rbs[CC_id] + min_rb_unit[CC_id]-1;
-                        } else {
-                          
-			  nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - 4;
-                          ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + 4;
-                          nb_rbs_required_remaining[CC_id][UE_id2] = nb_rbs_required_remaining[CC_id][UE_id2] - 4;
-                          ue_sched_ctl2->pre_nb_available_rbs[CC_id] = ue_sched_ctl2->pre_nb_available_rbs[CC_id] + 4;
-                        }
-
-                        break;
+                  if ((mac_eNB_get_rrc_status
+                   (Mod_id,
+                    rnti2) >= RRC_RECONFIGURED)
+                  && (round2 == 0)
+                  &&
+                  (get_tmode(Mod_id, CC_id, UE_id2)
+                   == 5)
+                  && (ue_sched_ctl->
+                      dl_pow_off[CC_id] != 1)) {
+
+                  if ((((j == (N_RBG[CC_id] - 1))
+                        &&
+                        (ue_sched_ctl->rballoc_sub_UE
+                         [CC_id][j] == 0))
+                       || ((j < (N_RBG[CC_id] - 1))
+                       &&
+                       (ue_sched_ctl->
+                        rballoc_sub_UE[CC_id][j +
+                                  1]
+                        == 0)))
+                      &&
+                      (nb_rbs_required_remaining
+                       [CC_id]
+                       [UE_id2] > 0)) {
+
+                      if ((((eNB_UE_stats2->
+                         DL_pmi_single ^
+                         eNB_UE_stats1->
+                         DL_pmi_single)
+                        << (14 - j)) & 0xc000) == 0x4000) {	//MU-MIMO only for 25 RBs configuration
+
+                      rballoc_sub[CC_id][j] = 1;
+                      ue_sched_ctl->
+                          rballoc_sub_UE[CC_id]
+                          [j] = 1;
+                      ue_sched_ctl2->
+                          rballoc_sub_UE[CC_id]
+                          [j] = 1;
+                      MIMO_mode_indicator[CC_id]
+                          [j] = 0;
+
+                      if (j < N_RBG[CC_id] - 1) {
+                          rballoc_sub[CC_id][j +
+                                     1] =
+                          1;
+                          ue_sched_ctl->
+                          rballoc_sub_UE
+                          [CC_id][j + 1] = 1;
+                          ue_sched_ctl2->rballoc_sub_UE
+                          [CC_id][j + 1] = 1;
+                          MIMO_mode_indicator
+                          [CC_id][j + 1]
+                          = 0;
+                      }
+
+                      ue_sched_ctl->
+                          dl_pow_off[CC_id]
+                          = 0;
+                      ue_sched_ctl2->
+                          dl_pow_off[CC_id]
+                          = 0;
+
+
+                      if ((j == N_RBG[CC_id] - 1)
+                          && ((N_RB_DL == 25)
+                          || (N_RB_DL ==
+                              50))) {
+
+                          nb_rbs_required_remaining
+                          [CC_id][UE_id] =
+                          nb_rbs_required_remaining
+                          [CC_id][UE_id] -
+                          min_rb_unit[CC_id]
+                          + 1;
+                          ue_sched_ctl->pre_nb_available_rbs
+                          [CC_id] =
+                          ue_sched_ctl->pre_nb_available_rbs
+                          [CC_id] +
+                          min_rb_unit[CC_id]
+                          - 1;
+                          nb_rbs_required_remaining
+                          [CC_id][UE_id2] =
+                          nb_rbs_required_remaining
+                          [CC_id][UE_id2] -
+                          min_rb_unit[CC_id]
+                          + 1;
+                          ue_sched_ctl2->pre_nb_available_rbs
+                          [CC_id] =
+                          ue_sched_ctl2->pre_nb_available_rbs
+                          [CC_id] +
+                          min_rb_unit[CC_id]
+                          - 1;
+                      } else {
+
+                          nb_rbs_required_remaining
+                          [CC_id][UE_id] =
+                          nb_rbs_required_remaining
+                          [CC_id][UE_id] - 4;
+                          ue_sched_ctl->pre_nb_available_rbs
+                          [CC_id] =
+                          ue_sched_ctl->pre_nb_available_rbs
+                          [CC_id] + 4;
+                          nb_rbs_required_remaining
+                          [CC_id][UE_id2] =
+                          nb_rbs_required_remaining
+                          [CC_id][UE_id2] -
+                          4;
+                          ue_sched_ctl2->pre_nb_available_rbs
+                          [CC_id] =
+                          ue_sched_ctl2->pre_nb_available_rbs
+                          [CC_id] + 4;
+                      }
+
+                      break;
                       }
-                    }
                   }
-                }
+                  }
+              }
               }
-            }
           }
-
+          }
 #endif
-        }
-      }
-    } // total_ue_count
+        } // total_ue_count
+      } // CC
+    } // UE
   } // end of for for r1 and r2
+}
+
+// This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done
+void
+dlsch_scheduler_pre_processor(module_id_t Mod_id,
+                              slice_id_t slice_id,
+                              frame_t frameP,
+                              sub_frame_t subframeP,
+                              int N_RBG[MAX_NUM_CCs],
+                              int *mbsfn_flag) {
+
+  int UE_id;
+  uint8_t CC_id;
+  uint16_t i, j;
+
+  uint8_t rballoc_sub[MAX_NUM_CCs][N_RBG_MAX];
+  uint8_t MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]; // If TM5 is revisited, we can move this inside accounting
+
+  int min_rb_unit[MAX_NUM_CCs];
+  uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+
+  UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
+  UE_sched_ctrl *ue_sched_ctl;
+//  int rrc_status = RRC_IDLE;
 
 #ifdef TM5
+  int harq_pid1 = 0;
+  int round1 = 0, round2 = 0;
+  int UE_id2;
+  uint16_t i1, i2, i3;
+  rnti_t rnti1, rnti2;
+  LTE_eNB_UE_stats *eNB_UE_stats1 = NULL;
+  LTE_eNB_UE_stats *eNB_UE_stats2 = NULL;
+  UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2;
+#endif
 
-  // This has to be revisited!!!!
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    i1=0;
-    i2=0;
-    i3=0;
-
-    for (j=0; j<N_RBG[CC_id]; j++) {
-      if(MIMO_mode_indicator[CC_id][j] == 2) {
-        i1 = i1+1;
-      } else if(MIMO_mode_indicator[CC_id][j] == 1) {
-        i2 = i2+1;
-      } else if(MIMO_mode_indicator[CC_id][j] == 0) {
-        i3 = i3+1;
-      }
-    }
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
 
-    if((i1 < N_RBG[CC_id]) && (i2>0) && (i3==0)) {
-      PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions = PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions + 1;
-    }
+    if (mbsfn_flag[CC_id] > 0)    // If this CC is allocated for MBSFN skip it here
+      continue;
 
-    if(i3 == N_RBG[CC_id] && i1==0 && i2==0) {
-      PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions = PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions + 1;
-    }
+    min_rb_unit[CC_id] = get_min_rb_unit(Mod_id, CC_id);
+
+    for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; ++UE_id) {
+      if (UE_list->active[UE_id] != TRUE)
+        continue;
+
+      if (!ue_slice_membership(UE_id, slice_id))
+        continue;
+
+      // Initialize scheduling information for all active UEs
+      dlsch_scheduler_pre_processor_reset(Mod_id,
+                                          UE_id,
+                                          CC_id,
+                                          frameP,
+                                          subframeP,
+                                          N_RBG[CC_id],
+                                          nb_rbs_required,
+                                          rballoc_sub,
+                                          MIMO_mode_indicator);
 
-    if((i1 < N_RBG[CC_id]) && (i3 > 0)) {
-      PHY_vars_eNB_g[Mod_id][CC_id]->check_for_MUMIMO_transmissions = PHY_vars_eNB_g[Mod_id][CC_id]->check_for_MUMIMO_transmissions + 1;
     }
+  }
+
+  // Store the DLSCH buffer for each logical channel
+  store_dlsch_buffer(Mod_id, slice_id, frameP, subframeP);
 
-    PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions = PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions + 1;
+  // Calculate the number of RBs required by each UE on the basis of logical channel's buffer
+  assign_rbs_required(Mod_id, slice_id, frameP, subframeP, nb_rbs_required, min_rb_unit);
+
+  // Sorts the user on the basis of dlsch logical channel buffer and CQI
+  sort_UEs(Mod_id, slice_id, frameP, subframeP);
+
+  // This function does the main allocation of the number of RBs
+  dlsch_scheduler_pre_processor_accounting(Mod_id,
+                                           slice_id,
+                                           frameP,
+                                           subframeP,
+                                           N_RBG,
+                                           min_rb_unit,
+                                           rballoc_sub,
+                                           MIMO_mode_indicator,
+                                           nb_rbs_required);
+
+
+#ifdef TM5
+  // This has to be revisited!!!!
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+  i1 = 0;
+  i2 = 0;
+  i3 = 0;
+
+  for (j = 0; j < N_RBG[CC_id]; j++) {
+      if (MIMO_mode_indicator[CC_id][j] == 2) {
+      i1 = i1 + 1;
+      } else if (MIMO_mode_indicator[CC_id][j] == 1) {
+      i2 = i2 + 1;
+      } else if (MIMO_mode_indicator[CC_id][j] == 0) {
+      i3 = i3 + 1;
+      }
+  }
+
+  if ((i1 < N_RBG[CC_id]) && (i2 > 0) && (i3 == 0)) {
+      PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions =
+      PHY_vars_eNB_g[Mod_id][CC_id]->
+      check_for_SUMIMO_transmissions + 1;
+  }
+
+  if (i3 == N_RBG[CC_id] && i1 == 0 && i2 == 0) {
+      PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions =
+      PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions +
+      1;
+  }
 
+  if ((i1 < N_RBG[CC_id]) && (i3 > 0)) {
+      PHY_vars_eNB_g[Mod_id][CC_id]->check_for_MUMIMO_transmissions =
+      PHY_vars_eNB_g[Mod_id][CC_id]->
+      check_for_MUMIMO_transmissions + 1;
   }
 
+  PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions =
+      PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions +
+      1;
+
+  }
 #endif
 
-  for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
-    UE_id = i;
-    ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+  for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
 
-    for (ii=0; ii<UE_num_active_CC(UE_list,UE_id); ii++) {
-      CC_id = UE_list->ordered_CCids[ii][UE_id];
+    ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+    for (i = 0; i < UE_num_active_CC(UE_list, UE_id); i++) {
+      CC_id = UE_list->ordered_CCids[i][UE_id];
       //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].dl_pow_off = dl_pow_off[UE_id];
 
-      if (ue_sched_ctl->pre_nb_available_rbs[CC_id] > 0 ) {
-        LOG_D(MAC,"******************DL Scheduling Information for UE%d ************************\n",UE_id);
-        LOG_D(MAC,"dl power offset UE%d = %d \n",UE_id,ue_sched_ctl->dl_pow_off[CC_id]);
-        LOG_D(MAC,"***********RB Alloc for every subband for UE%d ***********\n",UE_id);
+      if (ue_sched_ctl->pre_nb_available_rbs[CC_id] > 0) {
+        LOG_D(MAC, "******************DL Scheduling Information for UE%d ************************\n", UE_id);
+        LOG_D(MAC, "dl power offset UE%d = %d \n", UE_id, ue_sched_ctl->dl_pow_off[CC_id]);
+        LOG_D(MAC, "***********RB Alloc for every subband for UE%d ***********\n", UE_id);
 
-        for(j=0; j<N_RBG[CC_id]; j++) {
-          //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].rballoc_sub[i] = rballoc_sub_UE[CC_id][UE_id][i];
-          LOG_D(MAC,"RB Alloc for UE%d and Subband%d = %d\n",UE_id,j,ue_sched_ctl->rballoc_sub_UE[CC_id][j]);
+        for (j = 0; j < N_RBG[CC_id]; j++) {
+          //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].rballoc_sub[UE_id] = rballoc_sub_UE[CC_id][UE_id][UE_id];
+          LOG_D(MAC, "RB Alloc for UE%d and Subband%d = %d\n", UE_id, j, ue_sched_ctl->rballoc_sub_UE[CC_id][j]);
         }
 
         //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = pre_nb_available_rbs[CC_id][UE_id];
-        LOG_D(MAC,"Total RBs allocated for UE%d = %d\n",UE_id,ue_sched_ctl->pre_nb_available_rbs[CC_id]);
+        LOG_D(MAC, "[eNB %d][SLICE %d]Total RBs allocated for UE%d = %d\n",
+              Mod_id, slice_id, UE_id, ue_sched_ctl->pre_nb_available_rbs[CC_id]);
       }
     }
   }
@@ -866,515 +1143,614 @@ if (nb_rbs_required_remaining[CC_id][i]<0) abort();
 
 #define SF0_LIMIT 1
 
-void dlsch_scheduler_pre_processor_reset (int module_idP,
-					  int UE_id,
-					  uint8_t  CC_id,
-					  int frameP,
-					  int subframeP,					  
-					  int N_RBG,
-					  uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					  uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-					  unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
-					  unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX])
-  
+void
+dlsch_scheduler_pre_processor_reset(int module_idP,
+                                    int UE_id,
+                                    uint8_t CC_id,
+                                    int frameP,
+                                    int subframeP,
+                                    int N_RBG,
+                                    uint16_t nb_rbs_required[MAX_NUM_CCs]
+                                    [NUMBER_OF_UE_MAX],
+                                    unsigned char
+                                    rballoc_sub[MAX_NUM_CCs]
+                                    [N_RBG_MAX],
+                                    unsigned char
+                                    MIMO_mode_indicator[MAX_NUM_CCs]
+                                    [N_RBG_MAX])
 {
-  int i,j;
-  UE_list_t *UE_list=&RC.mac[module_idP]->UE_list;
+  int i, j;
+  UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
   UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-  rnti_t rnti = UE_RNTI(module_idP,UE_id);
+  rnti_t rnti = UE_RNTI(module_idP, UE_id);
 
   uint8_t *vrb_map = RC.mac[module_idP]->common_channels[CC_id].vrb_map;
-  int N_RB_DL = to_prb(RC.mac[module_idP]->common_channels[CC_id].mib->message.dl_Bandwidth);
-  int RBGsize = N_RB_DL/N_RBG,RBGsize_last;
+  int N_RB_DL =
+          to_prb(RC.mac[module_idP]->common_channels[CC_id].mib->message.dl_Bandwidth);
+  int RBGsize = N_RB_DL / N_RBG, RBGsize_last;
 #ifdef SF0_LIMIT
-  int sf0_upper=-1,sf0_lower=-1;
+  int sf0_upper = -1, sf0_lower = -1;
 #endif
 
 
-  LOG_D(MAC,"Running preprocessor for UE %d (%x)\n",UE_id,rnti);
+  LOG_D(MAC, "Running preprocessor for UE %d (%x)\n", UE_id, rnti);
   // initialize harq_pid and round
 
-  if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--;
+  if (ue_sched_ctl->ta_timer)
+    ue_sched_ctl->ta_timer--;
+
+    /*
+       eNB_UE_stats *eNB_UE_stats;
+
+       if (eNB_UE_stats == NULL)
+       return;
+
 
-  /*
-  eNB_UE_stats *eNB_UE_stats;
+       mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,
+       frameP,subframeP,
+       &ue_sched_ctl->harq_pid[CC_id],
+       &ue_sched_ctl->round[CC_id],
+       openair_harq_DL);
 
-  if (eNB_UE_stats == NULL)
-    return;
 
-  
-  mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,
-				    frameP,subframeP,
-				    &ue_sched_ctl->harq_pid[CC_id],
-				    &ue_sched_ctl->round[CC_id],
-				    openair_harq_DL);
-  
+       if (ue_sched_ctl->ta_timer == 0) {
 
-  if (ue_sched_ctl->ta_timer == 0) {
+       // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ...
 
-    // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ...
+       ue_sched_ctl->ta_timer = 20;  // wait 20 subframes before taking TA measurement from PHY
+       switch (N_RB_DL) {
+       case 6:
+       ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update;
+       break;
+
+       case 15:
+       ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/2;
+       break;
+
+       case 25:
+       ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/4;
+       break;
+
+       case 50:
+       ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/8;
+       break;
+
+       case 75:
+       ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/12;
+       break;
+
+       case 100:
+       ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/16;
+       break;
+       }
+       // clear the update in case PHY does not have a new measurement after timer expiry
+       eNB_UE_stats->timing_advance_update =  0;
+       }
+       else {
+       ue_sched_ctl->ta_timer--;
+       ue_sched_ctl->ta_update =0; // don't trigger a timing advance command
+       }
+
+
+       if (UE_id==0) {
+       VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_TIMING_ADVANCE,ue_sched_ctl->ta_update);
+       }
+     */
+
+  nb_rbs_required[CC_id][UE_id] = 0;
+  ue_sched_ctl->pre_nb_available_rbs[CC_id] = 0;
+  ue_sched_ctl->dl_pow_off[CC_id] = 2;
 
-    ue_sched_ctl->ta_timer = 20;  // wait 20 subframes before taking TA measurement from PHY
-    switch (N_RB_DL) {
+  switch (N_RB_DL) {
     case 6:
-      ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update;
+      RBGsize = 1;
+      RBGsize_last = 1;
       break;
-      
     case 15:
-      ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/2;
+      RBGsize = 2;
+      RBGsize_last = 1;
       break;
-      
     case 25:
-      ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/4;
+      RBGsize = 2;
+      RBGsize_last = 1;
       break;
-      
     case 50:
-      ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/8;
+      RBGsize = 3;
+      RBGsize_last = 2;
       break;
-      
     case 75:
-      ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/12;
+      RBGsize = 4;
+      RBGsize_last = 3;
       break;
-      
     case 100:
-	ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/16;
+      RBGsize = 4;
+      RBGsize_last = 4;
       break;
-    }
-    // clear the update in case PHY does not have a new measurement after timer expiry
-    eNB_UE_stats->timing_advance_update =  0;
-  }
-  else {
-    ue_sched_ctl->ta_timer--;
-    ue_sched_ctl->ta_update =0; // don't trigger a timing advance command
-  }
-  
-
-  if (UE_id==0) {
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_TIMING_ADVANCE,ue_sched_ctl->ta_update);
+    default:
+      AssertFatal(1 == 0, "unsupported RBs (%d)\n", N_RB_DL);
   }
-  */
 
-  nb_rbs_required[CC_id][UE_id]=0;
-  ue_sched_ctl->pre_nb_available_rbs[CC_id] = 0;
-  ue_sched_ctl->dl_pow_off[CC_id] = 2;
-  nb_rbs_required_remaining[CC_id][UE_id] = 0;
-  
-  switch (N_RB_DL) {
-  case 6:   RBGsize = 1; RBGsize_last = 1; break;
-  case 15:  RBGsize = 2; RBGsize_last = 1; break;
-  case 25:  RBGsize = 2; RBGsize_last = 1; break;
-  case 50:  RBGsize = 3; RBGsize_last = 2; break;
-  case 75:  RBGsize = 4; RBGsize_last = 3; break;
-  case 100: RBGsize = 4; RBGsize_last = 4; break;
-  default: AssertFatal(1==0,"unsupported RBs (%d)\n", N_RB_DL);
-  }
-  
 #ifdef SF0_LIMIT
   switch (N_RBG) {
-  case 6:
-    sf0_lower=0;
-    sf0_upper=5;
-    break;
-  case 8:
-    sf0_lower=2;
-    sf0_upper=5;
-    break;
-  case 13:
-    sf0_lower=4;
-    sf0_upper=7;
-    break;
-  case 17:
-    sf0_lower=7;
-    sf0_upper=9;
-    break;
-  case 25:
-    sf0_lower=11;
-    sf0_upper=13;
-    break;
-  default: AssertFatal(1==0,"unsupported RBs (%d)\n", N_RB_DL);
+    case 6:
+      sf0_lower = 0;
+      sf0_upper = 5;
+      break;
+    case 8:
+      sf0_lower = 2;
+      sf0_upper = 5;
+      break;
+    case 13:
+      sf0_lower = 4;
+      sf0_upper = 7;
+      break;
+    case 17:
+      sf0_lower = 7;
+      sf0_upper = 9;
+      break;
+    case 25:
+      sf0_lower = 11;
+      sf0_upper = 13;
+      break;
+    default:
+      AssertFatal(1 == 0, "unsupported RBs (%d)\n", N_RB_DL);
   }
 #endif
+
   // Initialize Subbands according to VRB map
-  for (i=0; i<N_RBG; i++) {
-    int rb_size = i==N_RBG-1 ? RBGsize_last : RBGsize;
+  for (i = 0; i < N_RBG; i++) {
+    int rb_size = i == N_RBG - 1 ? RBGsize_last : RBGsize;
 
     ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 0;
     rballoc_sub[CC_id][i] = 0;
+
 #ifdef SF0_LIMIT
     // for avoiding 6+ PRBs around DC in subframe 0 (avoid excessive errors)
     /* TODO: make it proper - allocate those RBs, do not "protect" them, but
      * compute number of available REs and limit MCS according to the
      * TBS table 36.213 7.1.7.2.1-1 (can be done after pre-processor)
      */
-    if (subframeP==0 &&
-	i >= sf0_lower && i <= sf0_upper)
-      rballoc_sub[CC_id][i]=1;
+    if (subframeP == 0 && i >= sf0_lower && i <= sf0_upper)
+      rballoc_sub[CC_id][i] = 1;
 #endif
+
     // for SI-RNTI,RA-RNTI and P-RNTI allocations
     for (j = 0; j < rb_size; j++) {
-      if (vrb_map[j+(i*RBGsize)] != 0)  {
-	rballoc_sub[CC_id][i] = 1;
-	LOG_D(MAC,"Frame %d, subframe %d : vrb %d allocated\n",frameP,subframeP,j+(i*RBGsize));
-	break;
+      if (vrb_map[j + (i * RBGsize)] != 0) {
+        rballoc_sub[CC_id][i] = 1;
+        LOG_D(MAC, "Frame %d, subframe %d : vrb %d allocated\n",
+              frameP, subframeP, j + (i * RBGsize));
+        break;
       }
     }
-    LOG_D(MAC,"Frame %d Subframe %d CC_id %d RBG %i : rb_alloc %d\n",frameP,subframeP,CC_id,i,rballoc_sub[CC_id][i]);
+    LOG_D(MAC, "Frame %d Subframe %d CC_id %d RBG %i : rb_alloc %d\n",
+          frameP, subframeP, CC_id, i, rballoc_sub[CC_id][i]);
     MIMO_mode_indicator[CC_id][i] = 2;
   }
 }
 
 
-void dlsch_scheduler_pre_processor_allocate (module_id_t   Mod_id,
-    int           UE_id,
-    uint8_t       CC_id,
-    int           N_RBG,
-    int           transmission_mode,
-    int           min_rb_unit,
-    uint8_t       N_RB_DL,
-    uint16_t      nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-    uint16_t      nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-    unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
-    unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX])
+void
+dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
+				       int UE_id,
+				       uint8_t CC_id,
+				       int N_RBG,
+				       int transmission_mode,
+				       int min_rb_unit,
+				       uint8_t N_RB_DL,
+				       uint16_t
+				       nb_rbs_required[MAX_NUM_CCs]
+				       [NUMBER_OF_UE_MAX],
+				       uint16_t
+				       nb_rbs_required_remaining
+				       [MAX_NUM_CCs]
+				       [NUMBER_OF_UE_MAX], unsigned char
+				       rballoc_sub[MAX_NUM_CCs]
+				       [N_RBG_MAX], unsigned char
+				       MIMO_mode_indicator
+				       [MAX_NUM_CCs][N_RBG_MAX])
 {
 
-  int i;
-  UE_list_t *UE_list=&RC.mac[Mod_id]->UE_list;
-  UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
-
-  for(i=0; i<N_RBG; i++) {
-
-    if((rballoc_sub[CC_id][i] == 0)           &&
-        (ue_sched_ctl->rballoc_sub_UE[CC_id][i] == 0) &&
-        (nb_rbs_required_remaining[CC_id][UE_id]>0)   &&
-        (ue_sched_ctl->pre_nb_available_rbs[CC_id] < nb_rbs_required[CC_id][UE_id])) {
-
-      // if this UE is not scheduled for TM5
-      if (ue_sched_ctl->dl_pow_off[CC_id] != 0 )  {
-
-	if ((i == N_RBG-1) && ((N_RB_DL == 25) || (N_RB_DL == 50))) {
-	  if (nb_rbs_required_remaining[CC_id][UE_id] >=  min_rb_unit-1){
-            rballoc_sub[CC_id][i] = 1;
-            ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1;
-            MIMO_mode_indicator[CC_id][i] = 1;
-            if (transmission_mode == 5 ) {
-              ue_sched_ctl->dl_pow_off[CC_id] = 1;
-            }
-            nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit+1;
-            ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit - 1;
-          }
-        } else {
-	  if (nb_rbs_required_remaining[CC_id][UE_id] >=  min_rb_unit){
-	    rballoc_sub[CC_id][i] = 1;
-	    ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1;
-	    MIMO_mode_indicator[CC_id][i] = 1;
-	    if (transmission_mode == 5 ) {
-	      ue_sched_ctl->dl_pow_off[CC_id] = 1;
-	    }
-	    nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit;
-	    ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit;
-	  }
+    int i;
+    UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list;
+    UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+
+    for (i = 0; i < N_RBG; i++) {
+
+	if ((rballoc_sub[CC_id][i] == 0) &&
+	    (ue_sched_ctl->rballoc_sub_UE[CC_id][i] == 0) &&
+	    (nb_rbs_required_remaining[CC_id][UE_id] > 0) &&
+	    (ue_sched_ctl->pre_nb_available_rbs[CC_id] <
+	     nb_rbs_required[CC_id][UE_id])) {
+
+	    // if this UE is not scheduled for TM5
+	    if (ue_sched_ctl->dl_pow_off[CC_id] != 0) {
+
+		if ((i == N_RBG - 1)
+		    && ((N_RB_DL == 25) || (N_RB_DL == 50))) {
+		    if (nb_rbs_required_remaining[CC_id][UE_id] >=
+			min_rb_unit - 1) {
+			rballoc_sub[CC_id][i] = 1;
+			ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1;
+			MIMO_mode_indicator[CC_id][i] = 1;
+			if (transmission_mode == 5) {
+			    ue_sched_ctl->dl_pow_off[CC_id] = 1;
+			}
+			nb_rbs_required_remaining[CC_id][UE_id] =
+			    nb_rbs_required_remaining[CC_id][UE_id] -
+			    min_rb_unit + 1;
+			ue_sched_ctl->pre_nb_available_rbs[CC_id] =
+			    ue_sched_ctl->pre_nb_available_rbs[CC_id] +
+			    min_rb_unit - 1;
+		    }
+		} else {
+		    if (nb_rbs_required_remaining[CC_id][UE_id] >=
+			min_rb_unit) {
+			rballoc_sub[CC_id][i] = 1;
+			ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1;
+			MIMO_mode_indicator[CC_id][i] = 1;
+			if (transmission_mode == 5) {
+			    ue_sched_ctl->dl_pow_off[CC_id] = 1;
+			}
+			nb_rbs_required_remaining[CC_id][UE_id] =
+			    nb_rbs_required_remaining[CC_id][UE_id] -
+			    min_rb_unit;
+			ue_sched_ctl->pre_nb_available_rbs[CC_id] =
+			    ue_sched_ctl->pre_nb_available_rbs[CC_id] +
+			    min_rb_unit;
+		    }
+		}
+	    }			// dl_pow_off[CC_id][UE_id] ! = 0
 	}
-      } // dl_pow_off[CC_id][UE_id] ! = 0
     }
-  }
 }
 
 
 /// ULSCH PRE_PROCESSOR
 
 
-void ulsch_scheduler_pre_processor(module_id_t module_idP,
-                                   int frameP,
-                                   sub_frame_t subframeP,
-                                   uint16_t *first_rb)
+void
+ulsch_scheduler_pre_processor(module_id_t module_idP,
+			      slice_id_t slice_id, int frameP,
+			      sub_frame_t subframeP, uint16_t * first_rb)
 {
 
-  int16_t            i;
-  uint16_t           UE_id,n,r;
-  uint8_t            CC_id, harq_pid;
-  uint16_t           nb_allocated_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX],total_allocated_rbs[MAX_NUM_CCs],average_rbs_per_user[MAX_NUM_CCs];
-  int16_t            total_remaining_rbs[MAX_NUM_CCs];
-  uint16_t           max_num_ue_to_be_scheduled = 0;
-  uint16_t           total_ue_count             = 0;
-  rnti_t             rnti                       = -1;
-  UE_list_t          *UE_list                   = &RC.mac[module_idP]->UE_list;
-  UE_TEMPLATE        *UE_template               = 0;
-  int                N_RB_DL;
-  int                N_RB_UL;
-  LOG_D(MAC,"In ulsch_preprocessor: assign max mcs min rb\n");
-  // maximize MCS and then allocate required RB according to the buffer occupancy with the limit of max available UL RB
-  assign_max_mcs_min_rb(module_idP,frameP, subframeP, first_rb);
-
-  LOG_D(MAC,"In ulsch_preprocessor: sort ue \n");
-  // sort ues
-  sort_ue_ul (module_idP,frameP, subframeP);
-
-
-  // we need to distribute RBs among UEs
-  // step1:  reset the vars
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    N_RB_DL                     = to_prb(RC.mac[module_idP]->common_channels[CC_id].mib->message.dl_Bandwidth);
-    N_RB_UL                     = to_prb(RC.mac[module_idP]->common_channels[CC_id].ul_Bandwidth);
-    total_allocated_rbs[CC_id]  = 0;
-    total_remaining_rbs[CC_id]  = 0;
-    average_rbs_per_user[CC_id] = 0;
+    int16_t i;
+    uint16_t UE_id, n, r;
+    uint8_t CC_id, harq_pid;
+    uint16_t nb_allocated_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+	total_allocated_rbs[MAX_NUM_CCs],
+	average_rbs_per_user[MAX_NUM_CCs];
+    int16_t total_remaining_rbs[MAX_NUM_CCs];
+    uint16_t total_ue_count[MAX_NUM_CCs];
+    rnti_t rnti = -1;
+    UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
+    UE_TEMPLATE *UE_template = 0;
+    UE_sched_ctrl *ue_sched_ctl;
+    int N_RB_UL = 0;
+
+    LOG_D(MAC, "In ulsch_preprocessor: assign max mcs min rb\n");
+    // maximize MCS and then allocate required RB according to the buffer occupancy with the limit of max available UL RB
+    assign_max_mcs_min_rb(module_idP, slice_id, frameP, subframeP, first_rb);
+
+    LOG_D(MAC, "In ulsch_preprocessor: sort ue \n");
+    // sort ues
+    sort_ue_ul(module_idP, frameP, subframeP);
+
+
+    // we need to distribute RBs among UEs
+    // step1:  reset the vars
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+      total_allocated_rbs[CC_id] = 0;
+      total_remaining_rbs[CC_id] = 0;
+      average_rbs_per_user[CC_id] = 0;
+      total_ue_count[CC_id] = 0;
+    }
 
-    for (i=UE_list->head_ul; i>=0; i=UE_list->next_ul[i]) {
-      nb_allocated_rbs[CC_id][i]=0;
+    // Step 1.5: Calculate total_ue_count
+    for (i = UE_list->head_ul; i >= 0; i = UE_list->next_ul[i]) {
+      for (n = 0; n < UE_list->numactiveULCCs[i]; n++) {
+        // This is the actual CC_id in the list
+        CC_id = UE_list->ordered_ULCCids[n][i];
+        UE_template = &UE_list->UE_template[CC_id][i];
+        if (!ue_slice_membership(i, slice_id))
+          continue;
+        if (UE_template->pre_allocated_nb_rb_ul[slice_id] > 0) {
+          total_ue_count[CC_id] += 1;
+        }
+      }
     }
-  }
 
-  LOG_D(MAC,"In ulsch_preprocessor: step2 \n");
-  // step 2: calculate the average rb per UE
-  total_ue_count =0;
-  max_num_ue_to_be_scheduled=0;
+    LOG_D(MAC, "In ulsch_preprocessor: step2 \n");
+    // step 2: calculate the average rb per UE
+    for (i = UE_list->head_ul; i >= 0; i = UE_list->next_ul[i]) {
 
-  for (i=UE_list->head_ul; i>=0; i=UE_list->next_ul[i]) {
+      rnti = UE_RNTI(module_idP, i);
+      UE_id = i;
 
-    rnti = UE_RNTI(module_idP,i);
+      if (rnti == NOT_A_RNTI)
+        continue;
 
-    if (rnti==NOT_A_RNTI)
-      continue;
+      if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
+        continue;
 
-    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
-      continue;
+      if (!ue_slice_membership(UE_id, slice_id))
+          continue;
 
+      LOG_D(MAC, "In ulsch_preprocessor: handling UE %d/%x\n", UE_id,
+            rnti);
+      for (n = 0; n < UE_list->numactiveULCCs[UE_id]; n++) {
+        // This is the actual CC_id in the list
+        CC_id = UE_list->ordered_ULCCids[n][UE_id];
+        LOG_D(MAC,
+              "In ulsch_preprocessor: handling UE %d/%x CCid %d\n",
+              UE_id, rnti, CC_id);
 
-    UE_id = i;
+        average_rbs_per_user[CC_id] = 0;
 
-    LOG_D(MAC,"In ulsch_preprocessor: handling UE %d/%x\n",UE_id,rnti);
-    for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) {
-      // This is the actual CC_id in the list
-      CC_id = UE_list->ordered_ULCCids[n][UE_id];
-      LOG_D(MAC,"In ulsch_preprocessor: handling UE %d/%x CCid %d\n",UE_id,rnti,CC_id);
-      UE_template = &UE_list->UE_template[CC_id][UE_id];
-      average_rbs_per_user[CC_id]=0;
+        /*
+           if((mac_xface->get_nCCE_max(module_idP,CC_id,3,subframeP) - nCCE_to_be_used[CC_id])  > (1<<aggregation)) {
+           nCCE_to_be_used[CC_id] = nCCE_to_be_used[CC_id] + (1<<aggregation);
+           max_num_ue_to_be_scheduled+=1;
+           } */
 
-      if (UE_template->pre_allocated_nb_rb_ul > 0) {
-        total_ue_count+=1;
-      }
-      /*
-      if((mac_xface->get_nCCE_max(module_idP,CC_id,3,subframeP) - nCCE_to_be_used[CC_id])  > (1<<aggregation)) {
-        nCCE_to_be_used[CC_id] = nCCE_to_be_used[CC_id] + (1<<aggregation);
-        max_num_ue_to_be_scheduled+=1;
-	}*/
 
-      max_num_ue_to_be_scheduled+=1;
 
-      if (total_ue_count == 0) {
-        average_rbs_per_user[CC_id] = 0;
-      } else if (total_ue_count == 1 ) { // increase the available RBs, special case,
-        average_rbs_per_user[CC_id] = N_RB_UL-first_rb[CC_id]+1;
-      } else if( (total_ue_count <= (N_RB_DL-first_rb[CC_id])) &&
-                 (total_ue_count <= max_num_ue_to_be_scheduled)) {
-        average_rbs_per_user[CC_id] = (uint16_t) floor((N_RB_UL-first_rb[CC_id])/total_ue_count);
-      } else if (max_num_ue_to_be_scheduled > 0 ) {
-        average_rbs_per_user[CC_id] = (uint16_t) floor((N_RB_UL-first_rb[CC_id])/max_num_ue_to_be_scheduled);
-      } else {
-        average_rbs_per_user[CC_id]=1;
-        LOG_W(MAC,"[eNB %d] frame %d subframe %d: UE %d CC %d: can't get average rb per user (should not be here)\n",
-              module_idP,frameP,subframeP,UE_id,CC_id);
+        N_RB_UL = to_prb(RC.mac[module_idP]->common_channels[CC_id].ul_Bandwidth);
+        ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+        ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] = flexran_nb_rbs_allowed_slice(slice_percentage_uplink[slice_id],N_RB_UL);
+
+        if (total_ue_count[CC_id] == 0) {
+          average_rbs_per_user[CC_id] = 0;
+        } else if (total_ue_count[CC_id] == 1) {    // increase the available RBs, special case,
+          average_rbs_per_user[CC_id] = ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id] + 1;
+        } else if (total_ue_count[CC_id] <= (ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id])) {
+          average_rbs_per_user[CC_id] = (uint16_t) floor((ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id]) / total_ue_count[CC_id]);
+        } else {
+          average_rbs_per_user[CC_id] = 1;
+          LOG_W(MAC,
+                "[eNB %d] frame %d subframe %d: UE %d CC %d: can't get average rb per user (should not be here)\n",
+                module_idP, frameP, subframeP, UE_id, CC_id);
+        }
+        if (total_ue_count[CC_id] > 0)
+          LOG_D(MAC, "[eNB %d] Frame %d subframe %d: total ue to be scheduled %d\n",
+                module_idP, frameP, subframeP, total_ue_count[CC_id]);
       }
     }
-  }
-  if (total_ue_count > 0)
-    LOG_D(MAC,"[eNB %d] Frame %d subframe %d: total ue to be scheduled %d/%d\n",
-	  module_idP, frameP, subframeP,total_ue_count, max_num_ue_to_be_scheduled);
 
-  //LOG_D(MAC,"step3\n");
+    // step 3: assigne RBS
+    for (i = UE_list->head_ul; i >= 0; i = UE_list->next_ul[i]) {
+      rnti = UE_RNTI(module_idP, i);
 
-  // step 3: assigne RBS
-  for (i=UE_list->head_ul; i>=0; i=UE_list->next_ul[i]) {
-    rnti = UE_RNTI(module_idP,i);
+      if (rnti == NOT_A_RNTI)
+        continue;
+      if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
+        continue;
+      if (!ue_slice_membership(i, slice_id))
+        continue;
 
-    if (rnti==NOT_A_RNTI)
-      continue;
-    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
-      continue;
 
-    UE_id = i;
+      UE_id = i;
 
-    for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) {
-      // This is the actual CC_id in the list
-      CC_id = UE_list->ordered_ULCCids[n][UE_id];
-      harq_pid = subframe2harqpid(&RC.mac[module_idP]->common_channels[CC_id],frameP,subframeP);
+      for (n = 0; n < UE_list->numactiveULCCs[UE_id]; n++) {
+        // This is the actual CC_id in the list
+        CC_id = UE_list->ordered_ULCCids[n][UE_id];
+        UE_template = &UE_list->UE_template[CC_id][UE_id];
+        harq_pid = subframe2harqpid(&RC.mac[module_idP]->common_channels[CC_id],
+                                    frameP, subframeP);
 
+        //      mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,openair_harq_UL);
 
-      //      mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,openair_harq_UL);
+        if (UE_list->UE_sched_ctrl[UE_id].round_UL[CC_id] > 0) {
+          nb_allocated_rbs[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb_ul[harq_pid];
+        } else {
+          nb_allocated_rbs[CC_id][UE_id] =
+                  cmin(UE_list->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul[slice_id],
+                       average_rbs_per_user[CC_id]);
+        }
 
-      if(UE_list->UE_sched_ctrl[UE_id].round_UL[CC_id]>0) {
-        nb_allocated_rbs[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb_ul[harq_pid];
-      } else {
-        nb_allocated_rbs[CC_id][UE_id] = cmin(UE_list->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul, average_rbs_per_user[CC_id]);
+        total_allocated_rbs[CC_id] += nb_allocated_rbs[CC_id][UE_id];
+        LOG_D(MAC,
+              "In ulsch_preprocessor: assigning %d RBs for UE %d/%x CCid %d, harq_pid %d\n",
+              nb_allocated_rbs[CC_id][UE_id], UE_id, rnti, CC_id,
+              harq_pid);
       }
-
-      total_allocated_rbs[CC_id]+= nb_allocated_rbs[CC_id][UE_id];
-      LOG_D(MAC,"In ulsch_preprocessor: assigning %d RBs for UE %d/%x CCid %d, harq_pid %d\n",nb_allocated_rbs[CC_id][UE_id],UE_id,rnti,CC_id,harq_pid);
     }
-  }
 
-  // step 4: assigne the remaining RBs and set the pre_allocated rbs accordingly
-  for(r=0; r<2; r++) {
+    // step 4: assigne the remaining RBs and set the pre_allocated rbs accordingly
+  for (r = 0; r < 2; r++) {
 
-    for (i=UE_list->head_ul; i>=0; i=UE_list->next_ul[i]) {
-      rnti = UE_RNTI(module_idP,i);
+    for (i = UE_list->head_ul; i >= 0; i = UE_list->next_ul[i]) {
+      rnti = UE_RNTI(module_idP, i);
 
-      if (rnti==NOT_A_RNTI)
+      if (rnti == NOT_A_RNTI)
         continue;
       if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
-	continue;
+        continue;
+      if (!ue_slice_membership(i, slice_id))
+        continue;
+
       UE_id = i;
+      ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
 
-      for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) {
+      for (n = 0; n < UE_list->numactiveULCCs[UE_id]; n++) {
         // This is the actual CC_id in the list
         CC_id = UE_list->ordered_ULCCids[n][UE_id];
         UE_template = &UE_list->UE_template[CC_id][UE_id];
-        total_remaining_rbs[CC_id]=N_RB_UL - first_rb[CC_id] - total_allocated_rbs[CC_id];
+        total_remaining_rbs[CC_id] =
+                ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id] - total_allocated_rbs[CC_id];
 
-        if (total_ue_count == 1 ) {
-          total_remaining_rbs[CC_id]+=1;
+        if (total_ue_count[CC_id] == 1) {
+          total_remaining_rbs[CC_id] += 1;
         }
 
-        if ( r == 0 ) {
-          while ( (UE_template->pre_allocated_nb_rb_ul > 0 ) &&
-                  (nb_allocated_rbs[CC_id][UE_id] < UE_template->pre_allocated_nb_rb_ul) &&
-                  (total_remaining_rbs[CC_id] > 0)) {
-            nb_allocated_rbs[CC_id][UE_id] = cmin(nb_allocated_rbs[CC_id][UE_id]+1,UE_template->pre_allocated_nb_rb_ul);
+        if (r == 0) {
+          while ((UE_template->pre_allocated_nb_rb_ul[slice_id] > 0)
+                 && (nb_allocated_rbs[CC_id][UE_id] < UE_template->pre_allocated_nb_rb_ul[slice_id])
+                 && (total_remaining_rbs[CC_id] > 0)) {
+            nb_allocated_rbs[CC_id][UE_id] =
+                    cmin(nb_allocated_rbs[CC_id][UE_id] + 1,
+                         UE_template->pre_allocated_nb_rb_ul[slice_id]);
             total_remaining_rbs[CC_id]--;
             total_allocated_rbs[CC_id]++;
           }
         } else {
-          UE_template->pre_allocated_nb_rb_ul= nb_allocated_rbs[CC_id][UE_id];
-          LOG_D(MAC,"******************UL Scheduling Information for UE%d CC_id %d ************************\n",UE_id, CC_id);
-          LOG_D(MAC,"[eNB %d] total RB allocated for UE%d CC_id %d  = %d\n", module_idP, UE_id, CC_id, UE_template->pre_allocated_nb_rb_ul);
+          UE_template->pre_allocated_nb_rb_ul[slice_id] =
+                  nb_allocated_rbs[CC_id][UE_id];
+          LOG_D(MAC,
+                "******************UL Scheduling Information for UE%d CC_id %d ************************\n",
+                UE_id, CC_id);
+          LOG_D(MAC,
+                "[eNB %d] total RB allocated for UE%d CC_id %d  = %d\n",
+                module_idP, UE_id, CC_id,
+                UE_template->pre_allocated_nb_rb_ul[slice_id]);
         }
       }
     }
   }
 
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+#if 0
+    /* this logging is wrong, ue_sched_ctl may not be valid here
+     * TODO: fix
+     */
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
 
-    if (total_allocated_rbs[CC_id]>0) {
-      LOG_D(MAC,"[eNB %d] total RB allocated for all UEs = %d/%d\n", module_idP, total_allocated_rbs[CC_id], N_RB_UL - first_rb[CC_id]);
+	if (total_allocated_rbs[CC_id] > 0) {
+	    LOG_D(MAC, "[eNB %d] total RB allocated for all UEs = %d/%d\n",
+		  module_idP, total_allocated_rbs[CC_id],
+              ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id]);
+	}
     }
-  }
+#endif
 }
 
 
-void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subframeP, uint16_t *first_rb)
+void
+assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP,
+		      sub_frame_t subframeP, uint16_t * first_rb)
 {
 
-  int                i;
-  uint16_t           n,UE_id;
-  uint8_t            CC_id;
-  rnti_t             rnti           = -1;
-  int                mcs;
-  int                rb_table_index=0,tbs,tx_power;
-  eNB_MAC_INST       *eNB = RC.mac[module_idP];
-  UE_list_t          *UE_list = &eNB->UE_list;
+  int i;
+  uint16_t n, UE_id;
+  uint8_t CC_id;
+  rnti_t rnti = -1;
+  int mcs;
+  int rb_table_index = 0, tbs, tx_power;
+  eNB_MAC_INST *eNB = RC.mac[module_idP];
+  UE_list_t *UE_list = &eNB->UE_list;
 
-  UE_TEMPLATE       *UE_template;
+  UE_TEMPLATE *UE_template;
+  UE_sched_ctrl *ue_sched_ctl;
   int Ncp;
   int N_RB_UL;
 
   for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
-    if (UE_list->active[i] != TRUE) continue;
+    if (UE_list->active[i] != TRUE)
+      continue;
 
-    rnti = UE_RNTI(module_idP,i);
+    rnti = UE_RNTI(module_idP, i);
 
-    if (rnti==NOT_A_RNTI)
+    if (rnti == NOT_A_RNTI)
       continue;
     if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
       continue;
+    if (!ue_slice_membership(i, slice_id))
+      continue;
 
-    if (UE_list->UE_sched_ctrl[i].phr_received == 1)
-      mcs = 20; // if we've received the power headroom information the UE, we can go to maximum mcs
-    else
-      mcs = 10; // otherwise, limit to QPSK PUSCH
+    if (UE_list->UE_sched_ctrl[i].phr_received == 1) {
+      /* if we've received the power headroom information the UE, we can go to
+       * maximum mcs */
+      mcs = cmin(20, slice_maxmcs_uplink[slice_id]);
+    } else {
+      /* otherwise, limit to QPSK PUSCH */
+      mcs = cmin(10, slice_maxmcs_uplink[slice_id]);
+    }
 
     UE_id = i;
 
-    for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) {
+    for (n = 0; n < UE_list->numactiveULCCs[UE_id]; n++) {
       // This is the actual CC_id in the list
       CC_id = UE_list->ordered_ULCCids[n][UE_id];
 
       if (CC_id >= MAX_NUM_CCs) {
-        LOG_E( MAC, "CC_id %u should be < %u, loop n=%u < numactiveULCCs[%u]=%u",
-               CC_id,
-               MAX_NUM_CCs,
-               n,
-               UE_id,
-               UE_list->numactiveULCCs[UE_id]);
+        LOG_E(MAC, "CC_id %u should be < %u, loop n=%u < numactiveULCCs[%u]=%u",
+              CC_id, MAX_NUM_CCs, n, UE_id, UE_list->numactiveULCCs[UE_id]);
       }
 
-      AssertFatal( CC_id < MAX_NUM_CCs, "CC_id %u should be < %u, loop n=%u < numactiveULCCs[%u]=%u",
-                   CC_id,
-                   MAX_NUM_CCs,
-                   n,
-                   UE_id,
-                   UE_list->numactiveULCCs[UE_id]);
+      AssertFatal(CC_id < MAX_NUM_CCs,
+                  "CC_id %u should be < %u, loop n=%u < numactiveULCCs[%u]=%u",
+                  CC_id, MAX_NUM_CCs, n, UE_id,
+                  UE_list->numactiveULCCs[UE_id]);
 
       UE_template = &UE_list->UE_template[CC_id][UE_id];
+      UE_template->pre_assigned_mcs_ul = mcs;
+      ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
 
-      Ncp     = RC.mac[module_idP]->common_channels[CC_id].Ncp;
+      Ncp = RC.mac[module_idP]->common_channels[CC_id].Ncp;
       N_RB_UL = to_prb(RC.mac[module_idP]->common_channels[CC_id].ul_Bandwidth);
-      // if this UE has UL traffic
-      if (UE_template->ul_total_buffer > 0 ) {
+      ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] = flexran_nb_rbs_allowed_slice(slice_percentage_uplink[slice_id],N_RB_UL);
 
+      int bytes_to_schedule = UE_template->estimated_ul_buffer - UE_template->scheduled_ul_bytes;
+      if (bytes_to_schedule < 0) bytes_to_schedule = 0;
+      int bits_to_schedule = bytes_to_schedule * 8;
 
-        tbs = get_TBS_UL(mcs,3)<<3;  // 1 or 2 PRB with cqi enabled does not work well!
+      // if this UE has UL traffic
+      if (bits_to_schedule > 0) {
+        tbs = get_TBS_UL(UE_template->pre_assigned_mcs_ul, 3) << 3; // 1 or 2 PRB with cqi enabled does not work well!
         rb_table_index = 2;
 
         // fixme: set use_srs flag
-        tx_power= estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,Ncp,0);
+        tx_power = estimate_ue_tx_power(tbs, rb_table[rb_table_index], 0, Ncp, 0);
 
-        while ((((UE_template->phr_info - tx_power) < 0 ) || (tbs > UE_template->ul_total_buffer))&&
-               (mcs > 3)) {
+        while ((((UE_template->phr_info - tx_power) < 0)
+              || (tbs > bits_to_schedule))
+              && (UE_template->pre_assigned_mcs_ul > 3)) {
           // LOG_I(MAC,"UE_template->phr_info %d tx_power %d mcs %d\n", UE_template->phr_info,tx_power, mcs);
-          mcs--;
-          tbs = get_TBS_UL(mcs,rb_table[rb_table_index])<<3;
-          tx_power = estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,Ncp,0); // fixme: set use_srs
+          UE_template->pre_assigned_mcs_ul--;
+          tbs = get_TBS_UL(UE_template->pre_assigned_mcs_ul, rb_table[rb_table_index]) << 3;
+          tx_power = estimate_ue_tx_power(tbs, rb_table[rb_table_index], 0, Ncp, 0);   // fixme: set use_srs
         }
 
-        while ((tbs < UE_template->ul_total_buffer) &&
-               (rb_table[rb_table_index]<(N_RB_UL-first_rb[CC_id])) &&
-               ((UE_template->phr_info - tx_power) > 0) &&
-               (rb_table_index < 32 )) {
-   
+        while ((tbs < bits_to_schedule)
+                && (rb_table[rb_table_index] < (ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id]))
+                && ((UE_template->phr_info - tx_power) > 0)
+                && (rb_table_index < 32)) {
           rb_table_index++;
-          tbs = get_TBS_UL(mcs,rb_table[rb_table_index])<<3;
-          tx_power = estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,Ncp,0);
+          tbs = get_TBS_UL(UE_template->pre_assigned_mcs_ul, rb_table[rb_table_index]) << 3;
+          tx_power = estimate_ue_tx_power(tbs, rb_table[rb_table_index], 0, Ncp, 0);
         }
 
         UE_template->ue_tx_power = tx_power;
 
-        if (rb_table[rb_table_index]>(N_RB_UL-first_rb[CC_id]-1)) {
+        if (rb_table[rb_table_index] > (ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id] - 1)) {
           rb_table_index--;
         }
-
         // 1 or 2 PRB with cqi enabled does not work well
-	if (rb_table[rb_table_index]<3) {
-          rb_table_index=2; //3PRB
+        if (rb_table[rb_table_index] < 3) {
+            rb_table_index = 2;	//3PRB
         }
 
-        UE_template->pre_assigned_mcs_ul=mcs;
-        UE_template->pre_allocated_rb_table_index_ul=rb_table_index;
-        UE_template->pre_allocated_nb_rb_ul= rb_table[rb_table_index];
-        LOG_D(MAC,"[eNB %d] frame %d subframe %d: for UE %d CC %d: pre-assigned mcs %d, pre-allocated rb_table[%d]=%d RBs (phr %d, tx power %d)\n",
+        UE_template->pre_allocated_rb_table_index_ul = rb_table_index;
+        UE_template->pre_allocated_nb_rb_ul[slice_id] = rb_table[rb_table_index];
+        LOG_D(MAC,
+              "[eNB %d] frame %d subframe %d: for UE %d CC %d: pre-assigned mcs %d, pre-allocated rb_table[%d]=%d RBs (phr %d, tx power %d)\n",
               module_idP, frameP, subframeP, UE_id, CC_id,
               UE_template->pre_assigned_mcs_ul,
               UE_template->pre_allocated_rb_table_index_ul,
-              UE_template->pre_allocated_nb_rb_ul,
-              UE_template->phr_info,tx_power);
+              UE_template->pre_allocated_nb_rb_ul[slice_id],
+              UE_template->phr_info, tx_power);
       } else {
         /* if UE has pending scheduling request then pre-allocate 3 RBs */
         //if (UE_template->ul_active == 1 && UE_template->ul_SR == 1) {
         if (UE_is_to_be_scheduled(module_idP, CC_id, i)) {
+          /* use QPSK mcs */
+          UE_template->pre_assigned_mcs_ul = 10;
           UE_template->pre_allocated_rb_table_index_ul = 2;
-          UE_template->pre_allocated_nb_rb_ul          = 3;
+          UE_template->pre_allocated_nb_rb_ul[slice_id] = 3;
         } else {
-          UE_template->pre_allocated_rb_table_index_ul=-1;
-          UE_template->pre_allocated_nb_rb_ul=0;
+          UE_template->pre_assigned_mcs_ul = 0;
+          UE_template->pre_allocated_rb_table_index_ul = -1;
+          UE_template->pre_allocated_nb_rb_ul[slice_id] = 0;
         }
       }
     }
@@ -1382,150 +1758,183 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra
 }
 
 struct sort_ue_ul_params {
-  int module_idP;
-  int frameP;
-  int subframeP;
+    int module_idP;
+    int frameP;
+    int subframeP;
 };
 
 static int ue_ul_compare(const void *_a, const void *_b, void *_params)
 {
-  struct sort_ue_ul_params *params = _params;
-  UE_list_t *UE_list = &RC.mac[params->module_idP]->UE_list;
-
-  int UE_id1 = *(const int *)_a;
-  int UE_id2 = *(const int *)_b;
-
-  int rnti1  = UE_RNTI(params->module_idP, UE_id1);
-  int pCCid1 = UE_PCCID(params->module_idP, UE_id1);
-  int round1 = maxround(params->module_idP, rnti1, params->frameP, params->subframeP, 1);
-
-  int rnti2  = UE_RNTI(params->module_idP, UE_id2);
-  int pCCid2 = UE_PCCID(params->module_idP, UE_id2);
-  int round2 = maxround(params->module_idP, rnti2, params->frameP, params->subframeP, 1);
-
-  if (round1 > round2) return -1;
-  if (round1 < round2) return 1;
-
-  if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] > UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0])
-    return -1;
-  if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] < UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0])
-    return 1;
+    struct sort_ue_ul_params *params = _params;
+    UE_list_t *UE_list = &RC.mac[params->module_idP]->UE_list;
+
+    int UE_id1 = *(const int *) _a;
+    int UE_id2 = *(const int *) _b;
+
+    int rnti1 = UE_RNTI(params->module_idP, UE_id1);
+    int pCCid1 = UE_PCCID(params->module_idP, UE_id1);
+    int round1 = maxround(params->module_idP, rnti1, params->frameP,
+			  params->subframeP, 1);
+
+    int rnti2 = UE_RNTI(params->module_idP, UE_id2);
+    int pCCid2 = UE_PCCID(params->module_idP, UE_id2);
+    int round2 = maxround(params->module_idP, rnti2, params->frameP,
+			  params->subframeP, 1);
+
+    if (round1 > round2)
+	return -1;
+    if (round1 < round2)
+	return 1;
+
+    if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] >
+	UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0])
+	return -1;
+    if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] <
+	UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0])
+	return 1;
+
+    int bytes_to_schedule1 = UE_list->UE_template[pCCid1][UE_id1].estimated_ul_buffer - UE_list->UE_template[pCCid1][UE_id1].scheduled_ul_bytes;
+    if (bytes_to_schedule1 < 0) bytes_to_schedule1 = 0;
+    int bytes_to_schedule2 = UE_list->UE_template[pCCid2][UE_id2].estimated_ul_buffer - UE_list->UE_template[pCCid2][UE_id2].scheduled_ul_bytes;
+    if (bytes_to_schedule2 < 0) bytes_to_schedule2 = 0;
+
+    if (bytes_to_schedule1 > bytes_to_schedule2)
+	return -1;
+    if (bytes_to_schedule1 < bytes_to_schedule2)
+	return 1;
+
+    if (UE_list->UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul >
+	UE_list->UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul)
+	return -1;
+    if (UE_list->UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul <
+	UE_list->UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul)
+	return 1;
 
-  if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer > UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer)
-    return -1;
-  if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer < UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer)
-    return 1;
-
-  if (UE_list->UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul > UE_list->UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul)
-    return -1;
-  if (UE_list->UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul < UE_list->UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul)
-    return 1;
-
-  return 0;
+    return 0;
 
 #if 0
-  /* The above order derives from the following.
-   * The last case is not handled: "if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0 )"
-   * I don't think it makes a big difference.
-   */
-      if(round2 > round1) {
-        swap_UEs(UE_list,UE_id1,UE_id2,1);
-      } else if (round2 == round1) {
-        if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] < UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0]) {
-          swap_UEs(UE_list,UE_id1,UE_id2,1);
-        } else if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer <  UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer) {
-          swap_UEs(UE_list,UE_id1,UE_id2,1);
-        } else if (UE_list->UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul <  UE_list->UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul) {
-          if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0 ) {
-            swap_UEs(UE_list,UE_id1,UE_id2,1);
-          }
-        }
-      }
+    /* The above order derives from the following.
+     * The last case is not handled: "if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0 )"
+     * I don't think it makes a big difference.
+     */
+    if (round2 > round1) {
+	swap_UEs(UE_list, UE_id1, UE_id2, 1);
+    } else if (round2 == round1) {
+	if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] <
+	    UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0]) {
+	    swap_UEs(UE_list, UE_id1, UE_id2, 1);
+	} else if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer <
+		   UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer) {
+	    swap_UEs(UE_list, UE_id1, UE_id2, 1);
+	} else if (UE_list->UE_template[pCCid1][UE_id1].
+		   pre_assigned_mcs_ul <
+		   UE_list->UE_template[pCCid2][UE_id2].
+		   pre_assigned_mcs_ul) {
+	    if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0) {
+		swap_UEs(UE_list, UE_id1, UE_id2, 1);
+	    }
+	}
+    }
 #endif
 }
 
-void sort_ue_ul (module_id_t module_idP,int frameP, sub_frame_t subframeP)
+void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP)
 {
-  int               i;
-  int               list[NUMBER_OF_UE_MAX];
-  int               list_size = 0;
-  int               rnti;
-  struct sort_ue_ul_params params = { module_idP, frameP, subframeP };
+    int i;
+    int list[NUMBER_OF_UE_MAX];
+    int list_size = 0;
+    int rnti;
+    struct sort_ue_ul_params params = { module_idP, frameP, subframeP };
 
-  UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
+    UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
 
-  for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
-    if (UE_list->active[i] == FALSE) continue;
-    if ((rnti = UE_RNTI(module_idP, i)) == NOT_A_RNTI) continue;
-    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1) continue;
+    for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+	if (UE_list->active[i] == FALSE)
+	    continue;
+	if ((rnti = UE_RNTI(module_idP, i)) == NOT_A_RNTI)
+	    continue;
+	if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
+	    continue;
 
-    list[list_size] = i;
-    list_size++;
-  }
+	list[list_size] = i;
+	list_size++;
+    }
 
-  qsort_r(list, list_size, sizeof(int), ue_ul_compare, &params);
+    qsort_r(list, list_size, sizeof(int), ue_ul_compare, &params);
 
-  if (list_size) {
-    for (i = 0; i < list_size-1; i++)
-      UE_list->next_ul[list[i]] = list[i+1];
-    UE_list->next_ul[list[list_size-1]] = -1;
-    UE_list->head_ul = list[0];
-  } else {
-    UE_list->head_ul = -1;
-  }
+    if (list_size) {
+	for (i = 0; i < list_size - 1; i++)
+	    UE_list->next_ul[list[i]] = list[i + 1];
+	UE_list->next_ul[list[list_size - 1]] = -1;
+	UE_list->head_ul = list[0];
+    } else {
+	UE_list->head_ul = -1;
+    }
 
 #if 0
-  int               UE_id1,UE_id2;
-  int               pCCid1,pCCid2;
-  int               round1,round2;
-  int               i=0,ii=0;
-  rnti_t            rnti1,rnti2;
-
-  UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
-
-  for (i=UE_list->head_ul; i>=0; i=UE_list->next_ul[i]) {
-
-    //LOG_I(MAC,"sort ue ul i %d\n",i);
-    for (ii=UE_list->next_ul[i]; ii>=0; ii=UE_list->next_ul[ii]) {
-      //LOG_I(MAC,"sort ul ue 2 ii %d\n",ii);
- 
-      UE_id1  = i;
-      rnti1 = UE_RNTI(module_idP,UE_id1);
-      
-      if(rnti1 == NOT_A_RNTI)
-	continue;
-      if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
-	continue;
-
-
-      pCCid1 = UE_PCCID(module_idP,UE_id1);
-      round1  = maxround(module_idP,rnti1,frameP,subframeP,1);
-      
-      UE_id2  = ii;
-      rnti2 = UE_RNTI(module_idP,UE_id2);
-      
-      if(rnti2 == NOT_A_RNTI)
-        continue;
-      if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
-	continue;
-
-      pCCid2 = UE_PCCID(module_idP,UE_id2);
-      round2  = maxround(module_idP,rnti2,frameP,subframeP,1);
-
-      if(round2 > round1) {
-        swap_UEs(UE_list,UE_id1,UE_id2,1);
-      } else if (round2 == round1) {
-        if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] < UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0]) {
-          swap_UEs(UE_list,UE_id1,UE_id2,1);
-        } else if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer <  UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer) {
-          swap_UEs(UE_list,UE_id1,UE_id2,1);
-        } else if (UE_list->UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul <  UE_list->UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul) {
-          if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0 ) {
-            swap_UEs(UE_list,UE_id1,UE_id2,1);
-          }
-        }
-      }
+    int UE_id1, UE_id2;
+    int pCCid1, pCCid2;
+    int round1, round2;
+    int i = 0, ii = 0;
+    rnti_t rnti1, rnti2;
+
+    UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
+
+    for (i = UE_list->head_ul; i >= 0; i = UE_list->next_ul[i]) {
+
+	//LOG_I(MAC,"sort ue ul i %d\n",i);
+	for (ii = UE_list->next_ul[i]; ii >= 0; ii = UE_list->next_ul[ii]) {
+	    //LOG_I(MAC,"sort ul ue 2 ii %d\n",ii);
+
+	    UE_id1 = i;
+	    rnti1 = UE_RNTI(module_idP, UE_id1);
+
+	    if (rnti1 == NOT_A_RNTI)
+		continue;
+	    if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
+		continue;
+
+
+	    pCCid1 = UE_PCCID(module_idP, UE_id1);
+	    round1 = maxround(module_idP, rnti1, frameP, subframeP, 1);
+
+	    UE_id2 = ii;
+	    rnti2 = UE_RNTI(module_idP, UE_id2);
+
+	    if (rnti2 == NOT_A_RNTI)
+		continue;
+	    if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
+		continue;
+
+	    pCCid2 = UE_PCCID(module_idP, UE_id2);
+	    round2 = maxround(module_idP, rnti2, frameP, subframeP, 1);
+
+	    if (round2 > round1) {
+		swap_UEs(UE_list, UE_id1, UE_id2, 1);
+	    } else if (round2 == round1) {
+		if (UE_list->
+		    UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] <
+		    UE_list->UE_template[pCCid2][UE_id2].
+		    ul_buffer_info[LCGID0]) {
+		    swap_UEs(UE_list, UE_id1, UE_id2, 1);
+		} else if (UE_list->UE_template[pCCid1][UE_id1].
+			   ul_total_buffer <
+			   UE_list->UE_template[pCCid2][UE_id2].
+			   ul_total_buffer) {
+		    swap_UEs(UE_list, UE_id1, UE_id2, 1);
+		} else if (UE_list->
+			   UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul
+			   <
+			   UE_list->
+			   UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul)
+		{
+		    if (UE_list->UE_template[pCCid2][UE_id2].
+			ul_total_buffer > 0) {
+			swap_UEs(UE_list, UE_id1, UE_id2, 1);
+		    }
+		}
+	    }
+	}
     }
-  }
 #endif
 }
diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h
index ee589471cfa77153fa23cc7df12462c2860c7a8e..64daede100d723348bf707ca698cf12df7915896 100644
--- a/openair2/LAYER2/MAC/proto.h
+++ b/openair2/LAYER2/MAC/proto.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -35,6 +35,22 @@
  *  @{
  */
 
+/**
+ * slice specific scheduler
+ */
+typedef void (*slice_scheduler_dl)(module_id_t mod_id,
+				   slice_id_t  slice_id,
+				   frame_t     frame,
+				   sub_frame_t subframe,
+				   int        *mbsfn_flag);
+
+typedef void (*slice_scheduler_ul)(module_id_t mod_id,
+                                   slice_id_t  slice_id,
+				   frame_t       frame,
+				   sub_frame_t   subframe,
+				   unsigned char sched_subframe,
+                                   uint16_t     *first_rb);
+
 /** \fn void schedule_mib(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
 \brief MIB scheduling for PBCH. This function requests the MIB from RRC and provides it to L1.
 @param Mod_id Instance ID of eNB
@@ -43,12 +59,11 @@
 
 */
 
-void schedule_mib(module_id_t   module_idP,
-		  frame_t       frameP,
-		  sub_frame_t   subframeP);
+void schedule_mib(module_id_t module_idP,
+		  frame_t frameP, sub_frame_t subframeP);
 
 /** \fn void schedule_RA(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
-\brief First stage of Random-Access Scheduling. Loops over the RA_templates and checks if RAR, Msg3 or its retransmission are to be scheduled in the subframe.  It returns the total number of PRB used for RA SDUs.  For Msg3 it retrieves the L3msg from RRC and fills the appropriate buffers.  For the others it just computes the number of PRBs. Each DCI uses 3 PRBs (format 1A)
+\brief First stage of Random-Access Scheduling. Loops over the ras and checks if RAR, Msg3 or its retransmission are to be scheduled in the subframe.  It returns the total number of PRB used for RA SDUs.  For Msg3 it retrieves the L3msg from RRC and fills the appropriate buffers.  For the others it just computes the number of PRBs. Each DCI uses 3 PRBs (format 1A)
 for the message.
 @param Mod_id Instance ID of eNB
 @param frame Frame index
@@ -56,28 +71,32 @@ for the message.
 */
 
 
-void schedule_RA(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
+void schedule_RA(module_id_t module_idP, frame_t frameP,
+		 sub_frame_t subframe);
 
 /** \brief First stage of SI Scheduling. Gets a SI SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length.  It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs).
 @param Mod_id Instance ID of eNB
 @param frame Frame index
 @param subframe Subframe number on which to act
 */
-void schedule_SI(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP);
+void schedule_SI(module_id_t module_idP, frame_t frameP,
+		 sub_frame_t subframeP);
 
 /** \brief MBMS scheduling: Checking the position for MBSFN subframes. Create MSI, transfer MCCH from RRC to MAC, transfer MTCHs from RLC to MAC. Multiplexing MSI,MCCH&MTCHs. Return 1 if there are MBSFN data being allocated, otherwise return 0;
 @param Mod_id Instance ID of eNB
 @param frame Frame index
 @param subframe Subframe number on which to act
 */
-int schedule_MBMS(module_id_t module_idP,uint8_t CC_id, frame_t frameP, sub_frame_t subframe);
+int schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
+		  sub_frame_t subframe);
 
 /** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping
 @param Mod_id Instance ID of eNB
 @param mbsfn_sync_area index of mbsfn sync area
 @param[out] index of sf pattern
 */
-int8_t get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t CC_id, uint8_t mbsfn_sync_area);
+int8_t get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id,
+			      uint8_t mbsfn_sync_area);
 
 /** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping
 @param Mod_id Instance ID of eNB
@@ -85,22 +104,29 @@ int8_t get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t CC_id, uint8_t mb
 @param eNB_index index of eNB
 @param[out] index of sf pattern
 */
-int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area, unsigned char eNB_index);
+int8_t ue_get_mbsfn_sf_alloction(module_id_t module_idP,
+				 uint8_t mbsfn_sync_area,
+				 unsigned char eNB_index);
 
 /** \brief top ULSCH Scheduling for TDD (config 1-6).
 @param Mod_id Instance ID of eNB
 @param frame Frame index
 @param subframe Subframe number on which to act
 */
-void schedule_ulsch(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
+void schedule_ulsch(module_id_t module_idP, frame_t frameP,
+		    sub_frame_t subframe);
 
 /** \brief ULSCH Scheduling per RNTI
 @param Mod_id Instance ID of eNB
+@param slice_id Instance slice for this eNB
 @param frame Frame index
 @param subframe Subframe number on which to act
 @param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup)
 */
-void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP, sub_frame_t subframe, unsigned char sched_subframe, uint16_t *first_rb);
+void schedule_ulsch_rnti(module_id_t module_idP, slice_id_t slice_idP, frame_t frameP,
+			 sub_frame_t subframe,
+			 unsigned char sched_subframe,
+			 uint16_t * first_rb);
 
 /** \brief Second stage of DLSCH scheduling, after schedule_SI, schedule_RA and schedule_dlsch have been called.  This routine first allocates random frequency assignments for SI and RA SDUs using distributed VRB allocations and adds the corresponding DCI SDU to the DCI buffer for PHY.  It then loops over the UE specific DCIs previously allocated and fills in the remaining DCI fields related to frequency allocation.  It assumes localized allocation of type 0 (DCI.rah=0).  The allocation is done for tranmission modes 1,2,4.
 @param Mod_id Instance of eNB
@@ -108,7 +134,8 @@ void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP, sub_frame_t sub
 @param subframe Index of subframe
 @param mbsfn_flag Indicates that this subframe is for MCH/MCCH
 */
-void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag);
+void fill_DLSCH_dci(module_id_t module_idP, frame_t frameP,
+		    sub_frame_t subframe, int *mbsfn_flag);
 
 /** \brief UE specific DLSCH scheduling. Retrieves next ue to be schduled from round-robin scheduler and gets the appropriate harq_pid for the subframe from PHY. If the process is active and requires a retransmission, it schedules the retransmission with the same PRB count and MCS as the first transmission. Otherwise it consults RLC for DCCH/DTCH SDUs (status with maximum number of available PRBS), builds the MAC header (timing advance sent by default) and copies
 @param Mod_id Instance ID of eNB
@@ -117,7 +144,11 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,i
 
 @param mbsfn_flag  Indicates that MCH/MCCH is in this subframe
 */
-void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag);
+void schedule_dlsch(module_id_t module_idP, frame_t frameP,
+		      sub_frame_t subframe, int *mbsfn_flag);
+
+void schedule_ue_spec(module_id_t module_idP, slice_id_t slice_idP,
+		      frame_t frameP,sub_frame_t subframe, int *mbsfn_flag);
 
 void schedule_ue_spec_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag);
 void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP);
@@ -127,32 +158,35 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
     @param Mod_id Module id of UE
     @returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE
 */
-int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP,uint8_t CC_id);
+int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id);
 
 /** \brief Function to compute DELTA_PREAMBLE from 36.321 (for RA power ramping procedure and Msg3 PUSCH power control policy)
     @param Mod_id Module id of UE
     @returns DELTA_PREAMBLE
 */
-int8_t get_DELTA_PREAMBLE(module_id_t module_idP,int CC_id);
+int8_t get_DELTA_PREAMBLE(module_id_t module_idP, int CC_id);
 
 /** \brief Function for compute deltaP_rampup from 36.321 (for RA power ramping procedure and Msg3 PUSCH power control policy)
     @param Mod_id Module id of UE
     @param CC_id carrier component id of UE
     @returns deltaP_rampup
 */
-int8_t get_deltaP_rampup(module_id_t module_idP,uint8_t CC_id);
+int8_t get_deltaP_rampup(module_id_t module_idP, uint8_t CC_id);
 
-uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
+uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart,
+			uint16_t Lcrbs);
 
-void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_t frameP, sub_frame_t subframeP);
+void add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
+	      sub_frame_t subframeP);
 
 //main.c
 
-int mac_top_init(int eMBMS_active, char *uecap_xer,uint8_t cba_group_active, uint8_t HO_active);
+int mac_top_init(int eMBMS_active, char *uecap_xer,
+		 uint8_t cba_group_active, uint8_t HO_active);
 
 void mac_top_init_eNB(void);
 
-void mac_init_cell_params(int Mod_idP,int CC_idP);
+void mac_init_cell_params(int Mod_idP, int CC_idP);
 
 char layer2_init_UE(module_id_t module_idP);
 
@@ -164,19 +198,26 @@ int mac_init_global_param(void);
 
 void mac_top_cleanup(void);
 
-void mac_UE_out_of_sync_ind(module_id_t module_idP,frame_t frameP, uint16_t eNB_index);
-
-void clear_nfapi_information(eNB_MAC_INST *eNB,int CC_idP,frame_t frameP,sub_frame_t subframeP);
-
-void dlsch_scheduler_pre_processor_reset (int module_idP,int UE_id,
-    uint8_t  CC_id,
-    int frameP,
-    int subframeP,
-    int N_RBG,
-    uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-    uint16_t  nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-    unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
-    unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]);
+void mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
+			    uint16_t eNB_index);
+
+void clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP,
+			     frame_t frameP, sub_frame_t subframeP);
+
+void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id,
+					 uint8_t CC_id,
+					 int frameP,
+					 int subframeP,
+					 int N_RBG,
+					 uint16_t
+					 nb_rbs_required[MAX_NUM_CCs]
+					 [NUMBER_OF_UE_MAX],
+					 unsigned char
+					 rballoc_sub[MAX_NUM_CCs]
+					 [N_RBG_MAX],
+					 unsigned char
+					 MIMO_mode_indicator[MAX_NUM_CCs]
+					 [N_RBG_MAX]);
 
 // eNB functions
 /* \brief This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done
@@ -187,24 +228,34 @@ void dlsch_scheduler_pre_processor_reset (int module_idP,int UE_id,
  */
 
 
-void dlsch_scheduler_pre_processor (module_id_t module_idP,
-                                    frame_t frameP,
-                                    sub_frame_t subframe,
-                                    int N_RBG[MAX_NUM_CCs],
-                                    int *mbsfn_flag);
-
-
-void dlsch_scheduler_pre_processor_allocate (module_id_t   Mod_id,
-    int           UE_id,
-    uint8_t       CC_id,
-    int           N_RBG,
-    int           transmission_mode,
-    int           min_rb_unit,
-    uint8_t       N_RB_DL,
-    uint16_t      nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-    uint16_t      nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-    unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
-    unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]);
+void dlsch_scheduler_pre_processor(module_id_t module_idP,
+				   slice_id_t slice_idP,
+				   frame_t frameP,
+				   sub_frame_t subframe,
+				   int N_RBG[MAX_NUM_CCs],
+				   int *mbsfn_flag);
+
+
+void dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
+					    int UE_id,
+					    uint8_t CC_id,
+					    int N_RBG,
+					    int transmission_mode,
+					    int min_rb_unit,
+					    uint8_t N_RB_DL,
+					    uint16_t
+					    nb_rbs_required[MAX_NUM_CCs]
+					    [NUMBER_OF_UE_MAX],
+					    uint16_t
+					    nb_rbs_required_remaining
+					    [MAX_NUM_CCs]
+					    [NUMBER_OF_UE_MAX],
+					    unsigned char
+					    rballoc_sub[MAX_NUM_CCs]
+					    [N_RBG_MAX],
+					    unsigned char
+					    MIMO_mode_indicator
+					    [MAX_NUM_CCs][N_RBG_MAX]);
 
 /* \brief Function to trigger the eNB scheduling procedure.  It is called by PHY at the beginning of each subframe, \f$n$\f
    and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f. 
@@ -212,7 +263,7 @@ void dlsch_scheduler_pre_processor_allocate (module_id_t   Mod_id,
 @param subframe Index of current subframe
 @param calibration_flag Flag to indicate that eNB scheduler should schedule TDD auto-calibration PUSCH.
 */
-void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag);
+void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);	//, int calibration_flag);
 
 /* \brief Function to indicate a received preamble on PRACH.  It initiates the RA procedure.
 @param Mod_id Instance ID of eNB
@@ -221,12 +272,13 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame
 @param rnti RA rnti corresponding to this PRACH preamble
 @param rach_resource type (0=non BL/CE,1 CE level 0,2 CE level 1, 3 CE level 2,4 CE level 3)
 */
-void initiate_ra_proc(module_id_t module_idP,int CC_id,frame_t frameP, sub_frame_t subframeP, uint16_t preamble_index,int16_t timing_offset,uint16_t rnti
+void initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP,
+		      sub_frame_t subframeP, uint16_t preamble_index,
+		      int16_t timing_offset, uint16_t rnti
 #ifdef Rel14
-		      ,
-		      uint8_t rach_resource_type
+		      , uint8_t rach_resource_type
 #endif
-		      );
+    );
 
 /* \brief Function in eNB to fill RAR pdu when requested by PHY.  This provides a single RAR SDU for the moment and returns the t-CRNTI.
 @param Mod_id Instance ID of eNB
@@ -234,31 +286,30 @@ void initiate_ra_proc(module_id_t module_idP,int CC_id,frame_t frameP, sub_frame
 @param N_RB_UL Number of UL resource blocks
 @returns t_CRNTI
 */
-unsigned short fill_rar(
-  const module_id_t module_idP,
-  const int         CC_id,
-  const frame_t     frameP,
-  uint8_t   * const dlsch_buffer,
-  const uint16_t    N_RB_UL,
-  const uint8_t input_buffer_length
-);
+unsigned short fill_rar(const module_id_t module_idP,
+			const int CC_id,
+			RA_t *ra,
+			const frame_t frameP,
+			uint8_t * const dlsch_buffer,
+			const uint16_t N_RB_UL,
+			const uint8_t input_buffer_length);
 
 #ifdef Rel14
-unsigned short fill_rar_br(eNB_MAC_INST *eNB,
+unsigned short fill_rar_br(eNB_MAC_INST * eNB,
 			   int CC_id,
-			   RA_TEMPLATE        *RA_template,      
-			   const frame_t      frameP,
-			   const sub_frame_t  subframeP,
-			   uint8_t*    const  dlsch_buffer,
-			   const uint8_t      ce_level
-			   );
+			   RA_t * ra,
+			   const frame_t frameP,
+			   const sub_frame_t subframeP,
+			   uint8_t * const dlsch_buffer,
+			   const uint8_t ce_level);
 #endif
 
 /* \brief Function to indicate a failed RA response.  It removes all temporary variables related to the initial connection of a UE
 @param Mod_id Instance ID of eNB
 @param preamble_index index of the received RA request.
 */
-void cancel_ra_proc(module_id_t module_idP,int CC_id,frame_t frameP, uint16_t preamble_index);
+void cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP,
+		    uint16_t preamble_index);
 
 /* \brief Function used by PHY to inform MAC that an uplink is scheduled
           for Msg3 in given subframe. This is used so that the MAC
@@ -272,12 +323,10 @@ void cancel_ra_proc(module_id_t module_idP,int CC_id,frame_t frameP, uint16_t pr
 @param Msg3_subframe subframe where scheduling takes place
 */
 void set_msg3_subframe(module_id_t Mod_id,
-                       int CC_id,
-                       int frame,
-                       int subframe,
-                       int rnti,
-                       int Msg3_frame,
-                       int Msg3_subframe);
+		       int CC_id,
+		       int frame,
+		       int subframe,
+		       int rnti, int Msg3_frame, int Msg3_subframe);
 
 /* \brief Function to indicate a received SDU on ULSCH.
 @param Mod_id Instance ID of eNB
@@ -289,14 +338,13 @@ void set_msg3_subframe(module_id_t Mod_id,
 @param ul_cqi Uplink CQI estimate after this pdu (SNR quantized to 8 bits, -64 ... 63.5 dB in .5dB steps)
 */
 void rx_sdu(const module_id_t enb_mod_idP,
-	    const int         CC_idP,
-	    const frame_t     frameP,
+	    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 uint16_t    timing_advance,
-	    const uint8_t     ul_cqi);
+	    const rnti_t rntiP,
+	    uint8_t * sduP,
+	    const uint16_t sdu_lenP,
+	    const uint16_t timing_advance, const uint8_t ul_cqi);
 
 
 /* \brief Function to indicate a scheduled schduling request (SR) was received by eNB.
@@ -307,7 +355,8 @@ void rx_sdu(const module_id_t enb_mod_idP,
 @param rnti RNTI of UE transmitting the SR
 @param ul_cqi SNR measurement of PUCCH (SNR quantized to 8 bits, -64 ... 63.5 dB in .5dB steps)
 */
-void SR_indication(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subframe,rnti_t rnti,uint8_t ul_cqi);
+void SR_indication(module_id_t module_idP, int CC_id, frame_t frameP,
+		   sub_frame_t subframe, rnti_t rnti, uint8_t ul_cqi);
 
 /* \brief Function to indicate a UL failure was detected by eNB PHY.
 @param Mod_id Instance ID of eNB
@@ -316,7 +365,8 @@ void SR_indication(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t s
 @param rnti RNTI of UE transmitting the SR
 @param subframe Index of subframe where SR was received
 */
-void UL_failure_indication(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe);
+void UL_failure_indication(module_id_t Mod_id, int CC_id, frame_t frameP,
+			   rnti_t rnti, sub_frame_t subframe);
 
 /* \brief Function to indicate an HARQ ACK/NAK.
 @param Mod_id Instance ID of eNB
@@ -325,7 +375,9 @@ void UL_failure_indication(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rn
 @param subframeP subframe index
 @param harq_pdu NFAPI HARQ PDU descriptor
 */
-void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, nfapi_harq_indication_pdu_t *harq_pdu);
+void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP,
+		     sub_frame_t subframeP,
+		     nfapi_harq_indication_pdu_t * harq_pdu);
 
 /* \brief Function to indicate a received CQI pdu
 @param Mod_id Instance ID of eNB
@@ -335,11 +387,13 @@ void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_
 @param rntiP RNTI of incoming CQI information
 @param ul_cqi_information NFAPI UL CQI measurement
 */
-void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, rnti_t rntiP, 
-		    nfapi_cqi_indication_rel9_t *rel9,uint8_t *pdu,
-		    nfapi_ul_cqi_information_t *ul_cqi_information);
+void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP,
+		    sub_frame_t subframeP, rnti_t rntiP,
+		    nfapi_cqi_indication_rel9_t * rel9, uint8_t * pdu,
+		    nfapi_ul_cqi_information_t * ul_cqi_information);
 
-uint8_t *get_dlsch_sdu(module_id_t module_idP,int CC_id,frame_t frameP,rnti_t rnti,uint8_t TBindex);
+uint8_t *get_dlsch_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
+		       rnti_t rnti, uint8_t TBindex);
 
 /* \brief Function to retrieve MCH transport block and MCS used for MCH in this MBSFN subframe.  Returns null if no MCH is to be transmitted
 @param Mod_id Instance ID of eNB
@@ -348,69 +402,78 @@ uint8_t *get_dlsch_sdu(module_id_t module_idP,int CC_id,frame_t frameP,rnti_t rn
 @param mcs Pointer to mcs used by PHY (to be filled by MAC)
 @returns Pointer to MCH transport block and mcs for subframe
 */
-MCH_PDU *get_mch_sdu( module_id_t Mod_id, int CC_id, frame_t frame, sub_frame_t subframe);
+MCH_PDU *get_mch_sdu(module_id_t Mod_id, int CC_id, frame_t frame,
+		     sub_frame_t subframe);
 
 
 
 
 
-void        ue_mac_reset      (module_id_t module_idP,uint8_t eNB_index);
-void        ue_init_mac       (module_id_t module_idP);
-void        init_ue_sched_info(void);
-void        add_ue_ulsch_info (module_id_t module_idP, int CC_id, int UE_id, sub_frame_t subframe,UE_ULSCH_STATUS status);
-void        add_ue_dlsch_info (module_id_t module_idP, int CC_id,int UE_id, sub_frame_t subframe,UE_DLSCH_STATUS status);
-int         find_UE_id        (module_id_t module_idP, rnti_t rnti) ;
-int         find_RA_id        (module_id_t mod_idP, int CC_idP, rnti_t rntiP);
-rnti_t      UE_RNTI           (module_id_t module_idP, int UE_id);
-int         UE_PCCID          (module_id_t module_idP, int UE_id);
-uint8_t     find_active_UEs   (module_id_t module_idP);
-boolean_t   is_UE_active      (module_id_t module_idP, int UE_id);
-uint8_t     get_aggregation   (uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt);
+void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index);
+void ue_init_mac(module_id_t module_idP);
+void init_ue_sched_info(void);
+void add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id,
+		       sub_frame_t subframe, UE_ULSCH_STATUS status);
+void add_ue_dlsch_info(module_id_t module_idP, int CC_id, int UE_id,
+		       sub_frame_t subframe, UE_DLSCH_STATUS status);
+int find_UE_id(module_id_t module_idP, rnti_t rnti);
+int find_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP);
+rnti_t UE_RNTI(module_id_t module_idP, int UE_id);
+int UE_PCCID(module_id_t module_idP, int UE_id);
+uint8_t find_active_UEs(module_id_t module_idP);
+boolean_t is_UE_active(module_id_t module_idP, int UE_id);
+uint8_t get_aggregation(uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt);
 
 int8_t find_active_UEs_with_traffic(module_id_t module_idP);
 
-void init_CCE_table(int module_idP,int CC_idP);
+void init_CCE_table(int module_idP, int CC_idP);
 
 int get_nCCE_offset(int *CCE_table,
-		    const unsigned char L, 
-		    const int nCCE, 
-		    const int common_dci, 
-		    const unsigned short rnti, 
+		    const unsigned char L,
+		    const int nCCE,
+		    const int common_dci,
+		    const unsigned short rnti,
 		    const unsigned char subframe);
 
-int allocate_CCEs(int module_idP,
-		  int CC_idP,
-		  int subframe,
-		  int test_only);
+int allocate_CCEs(int module_idP, int CC_idP, int subframe, int test_only);
 
 boolean_t CCE_allocation_infeasible(int module_idP,
-				  int CC_idP,
-				  int common_flag,
-				  int subframe,
-				  int aggregation,
-				  int rnti);
-
-void set_ue_dai(sub_frame_t   subframeP,
-                int           UE_id,
-                uint8_t       CC_id,
-                uint8_t       tdd_config,
-                UE_list_t     *UE_list);
-
-uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_id);
-uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id);
+				    int CC_idP,
+				    int common_flag,
+				    int subframe,
+				    int aggregation, int rnti);
+
+void set_ue_dai(sub_frame_t subframeP,
+		int UE_id,
+		uint8_t CC_id, uint8_t tdd_config, UE_list_t * UE_list);
+
+/** \brief First stage of PCH Scheduling. Gets a PCH SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length.  It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs).
+@param Mod_id Instance ID of eNB
+@param frame Frame index
+@param subframe Subframe number on which to act
+@param paging_ue_index
+*/
+void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP);
+
+uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP,
+					unsigned char group_id);
+uint8_t UE_is_to_be_scheduled(module_id_t module_idP, int CC_id,
+			      uint8_t UE_id);
 /** \brief Round-robin scheduler for ULSCH traffic.
 @param Mod_id Instance ID for eNB
 @param subframe Subframe number on which to act
 @returns UE index that is to be scheduled if needed/room
 */
-module_id_t schedule_next_ulue(module_id_t module_idP, int UE_id,sub_frame_t subframe);
+module_id_t schedule_next_ulue(module_id_t module_idP, int UE_id,
+			       sub_frame_t subframe);
 
 /** \brief Round-robin scheduler for DLSCH traffic.
 @param Mod_id Instance ID for eNB
 @param subframe Subframe number on which to act
 @returns UE index that is to be scheduled if needed/room
 */
-int schedule_next_dlue(module_id_t module_idP, int CC_id, sub_frame_t subframe);
+int schedule_next_dlue(module_id_t module_idP, int CC_id,
+		       sub_frame_t subframe);
 
 /* \brief Allocates a set of PRBS for a particular UE.  This is a simple function for the moment, later it should process frequency-domain CQI information and/or PMI information.  Currently it just returns the first PRBS that are available in the subframe based on the number requested.
 @param UE_id Index of UE on which to act
@@ -419,7 +482,8 @@ int schedule_next_dlue(module_id_t module_idP, int CC_id, sub_frame_t subframe);
 @param rballoc Pointer to bit-map of current PRB allocation given to previous users/control channels.  This is updated for subsequent calls to the routine.
 @returns an rballoc bitmap for resource type 0 allocation (DCI).
 */
-uint32_t allocate_prbs(int UE_id,uint8_t nb_rb, int N_RB_DL, uint32_t *rballoc);
+uint32_t allocate_prbs(int UE_id, uint8_t nb_rb, int N_RB_DL,
+		       uint32_t * rballoc);
 
 /* \fn uint32_t req_new_ulsch(module_id_t module_idP)
 \brief check for a new transmission in any drb
@@ -436,19 +500,25 @@ uint32_t req_new_ulsch(module_id_t module_idP);
 @param subframe subframe number
 @returns 0 for no SR, 1 for SR
 */
-uint32_t ue_get_SR(module_id_t module_idP, int CC_id,frame_t frameP, uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe);
+uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
+		   uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe);
 
 uint8_t get_ue_weight(module_id_t module_idP, int CC_id, int UE_id);
 
 // UE functions
-void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP, uint16_t CH_index);
+void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
+			 uint16_t CH_index);
 
-void ue_decode_si(module_id_t module_idP, int CC_id,frame_t frame, uint8_t CH_index, void *pdu, uint16_t len);
+void ue_decode_si(module_id_t module_idP, int CC_id, frame_t frame,
+		  uint8_t CH_index, void *pdu, uint16_t len);
 
-void ue_decode_p(module_id_t module_idP, int CC_id,frame_t frame, uint8_t CH_index, void *pdu, uint16_t len);
+void ue_decode_p(module_id_t module_idP, int CC_id, frame_t frame,
+		 uint8_t CH_index, void *pdu, uint16_t len);
 
 
-void ue_send_sdu(module_id_t module_idP, uint8_t CC_id,frame_t frame, sub_frame_t subframe, uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
+void ue_send_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frame,
+		 sub_frame_t subframe, uint8_t * sdu, uint16_t sdu_len,
+		 uint8_t CH_index);
 
 
 #if defined(Rel10) || defined(Rel14)
@@ -460,7 +530,9 @@ void ue_send_sdu(module_id_t module_idP, uint8_t CC_id,frame_t frame, sub_frame_
 @param eNB_index Index of attached eNB
 @param sync_area the index of MBSFN sync area
 */
-void ue_send_mch_sdu(module_id_t module_idP,uint8_t CC_id, frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area) ;
+void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
+		     uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index,
+		     uint8_t sync_area);
 
 /*\brief Function to check if UE PHY needs to decode MCH for MAC.
 @param Mod_id Index of protocol instance
@@ -470,7 +542,9 @@ void ue_send_mch_sdu(module_id_t module_idP,uint8_t CC_id, frame_t frameP,uint8_
 @param[out] sync_area return the sync area
 @param[out] mcch_active flag indicating whether this MCCH is active in this SF
 */
-int ue_query_mch(uint8_t Mod_id,uint8_t CC_id, uint32_t frame,sub_frame_t subframe, uint8_t eNB_index, uint8_t *sync_area, uint8_t *mcch_active);
+int ue_query_mch(uint8_t Mod_id, uint8_t CC_id, uint32_t frame,
+		 sub_frame_t subframe, uint8_t eNB_index,
+		 uint8_t * sync_area, uint8_t * mcch_active);
 
 #endif
 
@@ -481,7 +555,10 @@ int ue_query_mch(uint8_t Mod_id,uint8_t CC_id, uint32_t frame,sub_frame_t subfra
 @param subframe subframe number
 @returns 0 for no SR, 1 for SR
 */
-void ue_get_sdu(module_id_t module_idP, int CC_id,frame_t frameP, sub_frame_t subframe, uint8_t eNB_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode);
+void ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
+		sub_frame_t subframe, uint8_t eNB_index,
+		uint8_t * ulsch_buffer, uint16_t buflen,
+		uint8_t * access_mode);
 
 /* \brief Function called by PHY to retrieve information to be transmitted using the RA procedure.  If the UE is not in PUSCH mode for a particular eNB index, this is assumed to be an Msg3 and MAC attempts to retrieves the CCCH message from RRC. If the UE is in PUSCH mode for a particular eNB index and PUCCH format 0 (Scheduling Request) is not activated, the MAC may use this resource for random-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 from 36.321)
 @param Mod_id Index of UE instance
@@ -489,7 +566,9 @@ void ue_get_sdu(module_id_t module_idP, int CC_id,frame_t frameP, sub_frame_t su
 @param New_Msg3 Flag to indicate this call is for a new Msg3
 @param subframe Index of subframe for PRACH transmission (0 ... 9)
 @returns A pointer to a PRACH_RESOURCES_t */
-PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t new_Msg3,sub_frame_t subframe);
+PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
+			       frame_t frameP, uint8_t new_Msg3,
+			       sub_frame_t subframe);
 
 /* \brief Function called by PHY to process the received RAR.  It checks that the preamble matches what was sent by the eNB and provides the timing advance and t-CRNTI.
 @param Mod_id Index of UE instance
@@ -504,16 +583,14 @@ random-access procedure
 @returns timing advance or 0xffff if preamble doesn't match
 */
 uint16_t
-ue_process_rar(
-  const module_id_t module_idP,
-  const int CC_id,
-  const frame_t frameP,
-  const rnti_t ra_rnti,
-  uint8_t * const dlsch_buffer,
-  rnti_t * const t_crnti,
-  const uint8_t preamble_index,
-  uint8_t* selected_rar_buffer
-);
+ue_process_rar(const module_id_t module_idP,
+	       const int CC_id,
+	       const frame_t frameP,
+	       const rnti_t ra_rnti,
+	       uint8_t * const dlsch_buffer,
+	       rnti_t * const t_crnti,
+	       const uint8_t preamble_index,
+	       uint8_t * selected_rar_buffer);
 
 
 /* \brief Generate header for UL-SCH.  This function parses the desired control elements and sdus and generates the header as described
@@ -532,17 +609,17 @@ in the ULSCH buffer.
 @param post_padding Number of bytes for padding at the end of MAC PDU
 @returns Number of bytes used for header
 */
-unsigned char generate_ulsch_header(uint8_t *mac_header,
-                                    uint8_t num_sdus,
-                                    uint8_t short_padding,
-                                    uint16_t *sdu_lengths,
-                                    uint8_t *sdu_lcids,
-                                    POWER_HEADROOM_CMD *power_headroom,
-                                    uint16_t *crnti,
-                                    BSR_SHORT *truncated_bsr,
-                                    BSR_SHORT *short_bsr,
-                                    BSR_LONG *long_bsr,
-                                    unsigned short post_padding);
+unsigned char generate_ulsch_header(uint8_t * mac_header,
+				    uint8_t num_sdus,
+				    uint8_t short_padding,
+				    uint16_t * sdu_lengths,
+				    uint8_t * sdu_lcids,
+				    POWER_HEADROOM_CMD * power_headroom,
+				    uint16_t * crnti,
+				    BSR_SHORT * truncated_bsr,
+				    BSR_SHORT * short_bsr,
+				    BSR_LONG * long_bsr,
+				    unsigned short post_padding);
 
 /* \brief Parse header for UL-SCH.  This function parses the received UL-SCH header as described
 in 36-321 MAC layer specifications.  It returns the number of bytes used for the header to be used as an offset for the payload
@@ -555,41 +632,48 @@ in the ULSCH buffer.
 @param rx_lengths Pointer to array of SDU lengths
 @returns Pointer to payload following header
 */
-uint8_t *parse_ulsch_header(uint8_t *mac_header,
-                            uint8_t *num_ce,
-                            uint8_t *num_sdu,
-                            uint8_t *rx_ces,
-                            uint8_t *rx_lcids,
-                            uint16_t *rx_lengths,
-                            uint16_t tx_lenght);
+uint8_t *parse_ulsch_header(uint8_t * mac_header,
+			    uint8_t * num_ce,
+			    uint8_t * num_sdu,
+			    uint8_t * rx_ces,
+			    uint8_t * rx_lcids,
+			    uint16_t * rx_lengths, uint16_t tx_lenght);
 
 int to_prb(int);
 int to_rbg(int);
-int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
+int l2_init(LTE_DL_FRAME_PARMS * frame_parms, int eMBMS_active,
+	    char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
 int mac_init(void);
-int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti,int harq_pid
-               #ifdef Rel14
-                 ,uint8_t rach_resource_type
-               #endif
-               );
+int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti, int harq_pid
+#ifdef Rel14
+	       , uint8_t rach_resource_type
+#endif
+    );
 int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP);
 
 
-int maxround(module_id_t Mod_id,uint16_t rnti,int frame,sub_frame_t subframe,uint8_t ul_flag);
-void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag);
-int prev(UE_list_t *listP, int nodeP, int ul_flag);
-void dump_ue_list(UE_list_t *listP, int ul_flag);
-int UE_num_active_CC(UE_list_t *listP,int ue_idP);
-int UE_PCCID(module_id_t mod_idP,int ue_idP);
+int maxround(module_id_t Mod_id, uint16_t rnti, int frame,
+	     sub_frame_t subframe, uint8_t ul_flag);
+void swap_UEs(UE_list_t * listP, int nodeiP, int nodejP, int ul_flag);
+int prev(UE_list_t * listP, int nodeP, int ul_flag);
+void dump_ue_list(UE_list_t * listP, int ul_flag);
+int UE_num_active_CC(UE_list_t * listP, int ue_idP);
+int UE_PCCID(module_id_t mod_idP, int ue_idP);
 rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP);
 
 
-void ulsch_scheduler_pre_processor(module_id_t module_idP, int frameP, sub_frame_t subframeP, uint16_t *first_rb);
-void store_ulsch_buffer(module_id_t module_idP, int frameP, sub_frame_t subframeP);
-void sort_ue_ul (module_id_t module_idP,int frameP, sub_frame_t subframeP);
-void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subframeP,uint16_t *first_rb);
-void adjust_bsr_info(int buffer_occupancy, uint16_t TBS, UE_TEMPLATE *UE_template);
+void ulsch_scheduler_pre_processor(module_id_t module_idP, slice_id_t slice_id, int frameP,
+				   sub_frame_t subframeP,
+				   uint16_t * first_rb);
+void store_ulsch_buffer(module_id_t module_idP, int frameP,
+			sub_frame_t subframeP);
+void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP);
+void assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP,
+			   sub_frame_t subframeP, uint16_t * first_rb);
+void adjust_bsr_info(int buffer_occupancy, uint16_t TBS,
+		     UE_TEMPLATE * UE_template);
 int phy_stats_exist(module_id_t Mod_id, int rnti);
+void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t subframeP);
 
 /*! \fn  UE_L2_state_t ue_scheduler(const module_id_t module_idP,const frame_t frameP, const sub_frame_t subframe, const lte_subframe_t direction,const uint8_t eNB_index)
    \brief UE scheduler where all the ue background tasks are done.  This function performs the following:  1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures.
@@ -602,15 +686,13 @@ int phy_stats_exist(module_id_t Mod_id, int rnti);
 \param[in] eNB_index  instance of eNB
 @returns L2 state (CONNETION_OK or CONNECTION_LOST or PHY_RESYNCH)
 */
-UE_L2_STATE_t ue_scheduler(
-  const module_id_t module_idP,
-  const frame_t rxFrameP,
-  const sub_frame_t rxSubframe,
-  const frame_t txFrameP,
-  const sub_frame_t txSubframe,
-  const lte_subframe_t direction,
-  const uint8_t eNB_index,
-  const int CC_id);
+UE_L2_STATE_t ue_scheduler(const module_id_t module_idP,
+			   const frame_t rxFrameP,
+			   const sub_frame_t rxSubframe,
+			   const frame_t txFrameP,
+			   const sub_frame_t txSubframe,
+			   const lte_subframe_t direction,
+			   const uint8_t eNB_index, const int CC_id);
 
 /*! \fn  int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen);
 \brief determine whether to use cba resource to transmit or not
@@ -620,7 +702,8 @@ UE_L2_STATE_t ue_scheduler(
 \param[in] eNB_index instance of eNB
 \param[out] access(1) or postpone (0)
 */
-int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen);
+int cba_access(module_id_t module_idP, frame_t frameP,
+	       sub_frame_t subframe, uint8_t eNB_index, uint16_t buflen);
 
 /*! \fn  BSR_SHORT *  get_bsr_short(module_id_t module_idP, uint8_t bsr_len)
 \brief get short bsr level
@@ -636,14 +719,15 @@ BSR_SHORT *get_bsr_short(module_id_t module_idP, uint8_t bsr_len);
 \param[in] bsr_len indicator for no, short, or long bsr
 \param[out] bsr_l pointer to long bsr
 */
-BSR_LONG * get_bsr_long(module_id_t module_idP, uint8_t bsr_len);
+BSR_LONG *get_bsr_long(module_id_t module_idP, uint8_t bsr_len);
 
 /*! \fn  boolean_t update_bsr(module_id_t module_idP, frame_t frameP,sub_frame_t subframeP)
    \brief get the rlc stats and update the bsr level for each lcid
 \param[in] Mod_id instance of the UE
 \param[in] frame Frame index
 */
-boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP,eNB_index_t eNB_index);
+boolean_t update_bsr(module_id_t module_idP, frame_t frameP,
+		     sub_frame_t subframeP, eNB_index_t eNB_index);
 
 /*! \fn  locate_BsrIndexByBufferSize (int *table, int size, int value)
    \brief locate the BSR level in the table as defined in 36.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table.
@@ -652,7 +736,8 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
 \param[in] value Value of the buffer
 \return the index in the BSR_LEVEL table
 */
-uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value);
+uint8_t locate_BsrIndexByBufferSize(const uint32_t * table, int size,
+				    int value);
 
 
 /*! \fn  int get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer)
@@ -703,7 +788,8 @@ int get_db_dl_PathlossChange(uint8_t dl_PathlossChange);
 \param[in] CC_id Component Carrier Index
 \return phr mapping
 */
-uint8_t get_phr_mapping (module_id_t module_idP, int CC_id, uint8_t eNB_index);
+uint8_t get_phr_mapping(module_id_t module_idP, int CC_id,
+			uint8_t eNB_index);
 
 /*! \fn  void update_phr (module_id_t module_idP)
    \brief update/reset the phr timers
@@ -711,13 +797,14 @@ uint8_t get_phr_mapping (module_id_t module_idP, int CC_id, uint8_t eNB_index);
 \param[in] CC_id Component carrier index
 \return void
 */
-void update_phr (module_id_t module_idP,int CC_id);
+void update_phr(module_id_t module_idP, int CC_id);
 
 /*! \brief Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer
 \param[in] Mod_id Instance index of UE
 \param[in] eNB_id Index of eNB
 */
-void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP,uint8_t eNB_id);
+void Msg3_tx(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
+	     uint8_t eNB_id);
 
 
 /*! \brief Function to indicate the transmission of msg1/rach
@@ -725,12 +812,12 @@ void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP,uint8_t eNB_id)
 \param[in] eNB_id Index of eNB
 */
 
-void Msg1_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id);
+void Msg1_tx(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
+	     uint8_t eNB_id);
 
-void dl_phy_sync_success(module_id_t   module_idP,
-                         frame_t       frameP,
-                         unsigned char eNB_index,
-                         uint8_t first_sync);
+void dl_phy_sync_success(module_id_t module_idP,
+			 frame_t frameP,
+			 unsigned char eNB_index, uint8_t first_sync);
 
 int dump_eNB_l2_stats(char *buffer, int length);
 
@@ -747,9 +834,11 @@ void add_common_dci(DCI_PDU *DCI_pdu,
                     uint8_t ra_flag);
 */
 
-uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t *rballoc);
+uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG,
+			   uint8_t * rballoc);
 
-void update_ul_dci(module_id_t module_idP,uint8_t CC_id,rnti_t rnti,uint8_t dai);
+void update_ul_dci(module_id_t module_idP, uint8_t CC_id, rnti_t rnti,
+		   uint8_t dai);
 
 int get_bw_index(module_id_t module_id, uint8_t CC_id);
 
@@ -769,15 +858,15 @@ in the DLSCH buffer.
 @param post_padding number of bytes for padding at the end of MAC PDU
 @returns Number of bytes used for header
 */
-unsigned char generate_dlsch_header(unsigned char *mac_header,
-                                    unsigned char num_sdus,
-                                    unsigned short *sdu_lengths,
-                                    unsigned char *sdu_lcids,
-                                    unsigned char drx_cmd,
-                                    unsigned short timing_advance_cmd,
-                                    unsigned char *ue_cont_res_id,
-                                    unsigned char short_padding,
-                                    unsigned short post_padding);
+int generate_dlsch_header(unsigned char *mac_header,
+                          unsigned char num_sdus,
+                          unsigned short *sdu_lengths,
+                          unsigned char *sdu_lcids,
+                          unsigned char drx_cmd,
+                          unsigned short timing_advance_cmd,
+                          unsigned char *ue_cont_res_id,
+                          unsigned char short_padding,
+                          unsigned short post_padding);
 
 /** \brief RRC eNB Configuration primitive for PHY/MAC.  Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages.
 @param Mod_id Instance ID of eNB
@@ -801,51 +890,55 @@ unsigned char generate_dlsch_header(unsigned char *mac_header,
 @param sib1_ext_r13 SI Scheduling information for SI-BR UEs         
 */
 
-int rrc_mac_config_req_eNB(module_id_t                             module_idP,
-			   int                                     CC_id,
-			   int                                     physCellId,
-			   int                                     p_eNB,
-			   int                                     Ncp,
-			   int                                     eutra_band,
-			   uint32_t                                dl_CarrierFreq,
+int rrc_mac_config_req_eNB(module_id_t module_idP,
+			   int CC_id,
+			   int physCellId,
+			   int p_eNB,
+			   int Ncp,
+			   int eutra_band, uint32_t dl_CarrierFreq,
 #ifdef Rel14
-                           int                                     pbch_repetition,
+			   int pbch_repetition,
 #endif
-			   rnti_t                                  rntiP,
-			   BCCH_BCH_Message_t                      *mib,
- 			   RadioResourceConfigCommonSIB_t          *radioResourceConfigCommon,
+			   rnti_t rntiP,
+			   BCCH_BCH_Message_t * mib,
+			   RadioResourceConfigCommonSIB_t *
+			   radioResourceConfigCommon,
 #ifdef Rel14
- 			   RadioResourceConfigCommonSIB_t          *radioResourceConfigCommon_BR,
+			   RadioResourceConfigCommonSIB_t *
+			   radioResourceConfigCommon_BR,
 #endif
-			   struct PhysicalConfigDedicated          *physicalConfigDedicated,
+			   struct PhysicalConfigDedicated
+			   *physicalConfigDedicated,
 #if defined(Rel10) || defined(Rel14)
-			   SCellToAddMod_r10_t                     *sCellToAddMod_r10,
+			   SCellToAddMod_r10_t * sCellToAddMod_r10,
 			   //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
 #endif
-			   MeasObjectToAddMod_t                    **measObj,
-			   MAC_MainConfig_t                        *mac_MainConfig,
-			   long                                    logicalChannelIdentity,
-			   LogicalChannelConfig_t                  *logicalChannelConfig,
-			   MeasGapConfig_t                         *measGapConfig,
-			   TDD_Config_t                            *tdd_Config,
-			   MobilityControlInfo_t                   *mobilityControlInfo,
-			   SchedulingInfoList_t                    *schedulingInfoList,
-			   uint32_t                                ul_CarrierFreq,
-			   long                                    *ul_Bandwidth,
-			   AdditionalSpectrumEmission_t            *additionalSpectrumEmission,
-			   struct MBSFN_SubframeConfigList         *mbsfn_SubframeConfigList
+			   MeasObjectToAddMod_t ** measObj,
+			   MAC_MainConfig_t * mac_MainConfig,
+			   long logicalChannelIdentity,
+			   LogicalChannelConfig_t * logicalChannelConfig,
+			   MeasGapConfig_t * measGapConfig,
+			   TDD_Config_t * tdd_Config,
+			   MobilityControlInfo_t * mobilityControlInfo,
+			   SchedulingInfoList_t * schedulingInfoList,
+			   uint32_t ul_CarrierFreq,
+			   long *ul_Bandwidth,
+			   AdditionalSpectrumEmission_t *
+			   additionalSpectrumEmission,
+			   struct MBSFN_SubframeConfigList
+			   *mbsfn_SubframeConfigList
 #if defined(Rel10) || defined(Rel14)
 			   ,
-			   uint8_t                                 MBMS_Flag,
-			   MBSFN_AreaInfoList_r9_t                 *mbsfn_AreaInfoList,
-			   PMCH_InfoList_r9_t                      *pmch_InfoList
-			   
+			   uint8_t MBMS_Flag,
+			   MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList,
+			   PMCH_InfoList_r9_t * pmch_InfoList
 #endif
 #ifdef Rel14
 			   ,
-			   SystemInformationBlockType1_v1310_IEs_t *sib1_ext_r13          
+			   SystemInformationBlockType1_v1310_IEs_t *
+			   sib1_ext_r13
 #endif
-			   );
+    );
 
 /** \brief RRC eNB Configuration primitive for PHY/MAC.  Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages.
 @param Mod_id Instance ID of ue
@@ -867,132 +960,154 @@ int rrc_mac_config_req_eNB(module_id_t                             module_idP,
 @param mbsfn_AreaInfoList pointer to MBSFN Area Info list from SIB13
 @param pmch_InfoList pointer to PMCH_InfoList from MBSFNAreaConfiguration Message (MCCH Message)
 */
-int rrc_mac_config_req_ue(module_id_t     module_idP,
-			  int             CC_id,
-			  uint8_t         eNB_index,
-			  RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
-			  struct PhysicalConfigDedicated *physicalConfigDedicated,
+int rrc_mac_config_req_ue(module_id_t module_idP,
+			  int CC_id,
+			  uint8_t eNB_index,
+			  RadioResourceConfigCommonSIB_t *
+			  radioResourceConfigCommon,
+			  struct PhysicalConfigDedicated
+			  *physicalConfigDedicated,
 #if defined(Rel10) || defined(Rel14)
-			  SCellToAddMod_r10_t *sCellToAddMod_r10,
+			  SCellToAddMod_r10_t * sCellToAddMod_r10,
 			  //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
 #endif
-			  MeasObjectToAddMod_t **measObj,
-			  MAC_MainConfig_t *mac_MainConfig,
+			  MeasObjectToAddMod_t ** measObj,
+			  MAC_MainConfig_t * mac_MainConfig,
 			  long logicalChannelIdentity,
-			  LogicalChannelConfig_t *logicalChannelConfig,
-			  MeasGapConfig_t *measGapConfig,
-			  TDD_Config_t *tdd_Config,
-			  MobilityControlInfo_t *mobilityControlInfo,
-			  uint8_t *SIwindowsize,
-			  uint16_t *SIperiod,
-			  ARFCN_ValueEUTRA_t *ul_CarrierFreq,
+			  LogicalChannelConfig_t * logicalChannelConfig,
+			  MeasGapConfig_t * measGapConfig,
+			  TDD_Config_t * tdd_Config,
+			  MobilityControlInfo_t * mobilityControlInfo,
+			  uint8_t * SIwindowsize,
+			  uint16_t * SIperiod,
+			  ARFCN_ValueEUTRA_t * ul_CarrierFreq,
 			  long *ul_Bandwidth,
-			  AdditionalSpectrumEmission_t *additionalSpectrumEmission,
-			  struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
+			  AdditionalSpectrumEmission_t *
+			  additionalSpectrumEmission,
+			  struct MBSFN_SubframeConfigList
+			  *mbsfn_SubframeConfigList
 #if defined(Rel10) || defined(Rel14)
 			  ,
 			  uint8_t MBMS_Flag,
-			  MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
-			  PMCH_InfoList_r9_t *pmch_InfoList
-			  
+			  MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList,
+			  PMCH_InfoList_r9_t * pmch_InfoList
 #endif
 #ifdef CBA
 			  ,
-			  uint8_t num_active_cba_groups,
-			  uint16_t cba_rnti
+			  uint8_t num_active_cba_groups, uint16_t cba_rnti
 #endif
-			  );
+    );
 
-uint16_t getRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
+uint16_t getRIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs);
 
 int get_subbandsize(uint8_t dl_bandwidth);
 
 
-void get_Msg3allocret(COMMON_channels_t *cc,
+void get_Msg3allocret(COMMON_channels_t * cc,
 		      sub_frame_t current_subframe,
 		      frame_t current_frame,
-		      frame_t *frame,
-		      sub_frame_t *subframe);
+		      frame_t * frame, sub_frame_t * subframe);
 
-void get_Msg3alloc(COMMON_channels_t *cc,
+void get_Msg3alloc(COMMON_channels_t * cc,
 		   sub_frame_t current_subframe,
 		   frame_t current_frame,
-		   frame_t *frame,
-		   sub_frame_t *subframe);
+		   frame_t * frame, sub_frame_t * subframe);
 
-uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
+uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart,
+			uint16_t Lcrbs);
 
-int get_phich_resource_times6(COMMON_channels_t *cc);
+int get_phich_resource_times6(COMMON_channels_t * cc);
 
 int to_rbg(int dl_Bandwidth);
 
 int to_prb(int dl_Bandwidth);
 
-uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
-			frame_t frame,
-			sub_frame_t current_subframe);
+uint8_t get_Msg3harqpid(COMMON_channels_t * cc,
+			frame_t frame, sub_frame_t current_subframe);
 
-uint32_t pdcchalloc2ulframe(COMMON_channels_t *ccP,uint32_t frame, uint8_t n);
+uint32_t pdcchalloc2ulframe(COMMON_channels_t * ccP, uint32_t frame,
+			    uint8_t n);
 
-uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n);
+uint8_t pdcchalloc2ulsubframe(COMMON_channels_t * ccP, uint8_t n);
 
-int is_UL_sf(COMMON_channels_t *ccP,sub_frame_t subframeP);
+int is_UL_sf(COMMON_channels_t * ccP, sub_frame_t subframeP);
 
 uint8_t getQm(uint8_t mcs);
 
-uint8_t subframe2harqpid(COMMON_channels_t *cc,frame_t frame,sub_frame_t subframe);
-
-void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
-
-void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_PMI_ConfigIndex,uint16_t *Npd,uint16_t *N_OFFSET_CQI,int *H);
-
-uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_channels_t *cc,uint8_t tmode, struct CQI_ReportPeriodic *cqi_ReportPeriodic);
-
-uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode, uint8_t ri, CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic);
-void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP, uint8_t *pdu, uint8_t length);
-
-void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length);
-
-uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,uint16_t absSF,uint16_t pdu_length, uint16_t pdu_index, uint8_t *pdu );
-
-void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t  *ul_config_pdu,
-					  uint8_t                        cqi_req,
-					  COMMON_channels_t              *cc,
-					  struct PhysicalConfigDedicated *physicalConfigDedicated,
-					  uint8_t                        tmode,
-					  uint32_t                       handle,
-					  uint16_t                       rnti,
-					  uint8_t                        resource_block_start,
-					  uint8_t                        number_of_resource_blocks,
-					  uint8_t                        mcs,
-					  uint8_t                        cyclic_shift_2_for_drms,
-					  uint8_t                        frequency_hopping_enabled_flag,
-					  uint8_t                        frequency_hopping_bits,
-					  uint8_t                        new_data_indication,
-					  uint8_t                        redundancy_version,
-					  uint8_t                        harq_process_number,
-					  uint8_t                        ul_tx_mode,
-					  uint8_t                        current_tx_nb,
-					  uint8_t                        n_srs,
-					  uint16_t                       size
-					  );
+uint8_t subframe2harqpid(COMMON_channels_t * cc, frame_t frame,
+			 sub_frame_t subframe);
+
+void get_srs_pos(COMMON_channels_t * cc, uint16_t isrs,
+		 uint16_t * psrsPeriodicity, uint16_t * psrsOffset);
+
+void get_csi_params(COMMON_channels_t * cc,
+		    struct CQI_ReportPeriodic *cqi_PMI_ConfigIndex,
+		    uint16_t * Npd, uint16_t * N_OFFSET_CQI, int *H);
+
+uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP,
+				 COMMON_channels_t * cc, uint8_t tmode,
+				 struct CQI_ReportPeriodic
+				 *cqi_ReportPeriodic);
+
+uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode,
+				  uint8_t ri,
+				  CQI_ReportModeAperiodic_t *
+				  cqi_ReportModeAperiodic);
+void extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id,
+		       frame_t frameP, sub_frame_t subframeP,
+		       uint8_t * pdu, uint8_t length);
+
+void extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id,
+		       frame_t frameP, sub_frame_t subframeP,
+		       uint8_t * pdu, uint8_t length);
+
+uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t * tx_req_body,
+			   uint16_t absSF, uint16_t pdu_length,
+			   uint16_t pdu_index, uint8_t * pdu);
+
+void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *
+					  ul_config_pdu, uint8_t cqi_req,
+					  COMMON_channels_t * cc,
+					  struct PhysicalConfigDedicated
+					  *physicalConfigDedicated,
+					  uint8_t tmode, uint32_t handle,
+					  uint16_t rnti,
+					  uint8_t resource_block_start,
+					  uint8_t
+					  number_of_resource_blocks,
+					  uint8_t mcs,
+					  uint8_t cyclic_shift_2_for_drms,
+					  uint8_t
+					  frequency_hopping_enabled_flag,
+					  uint8_t frequency_hopping_bits,
+					  uint8_t new_data_indication,
+					  uint8_t redundancy_version,
+					  uint8_t harq_process_number,
+					  uint8_t ul_tx_mode,
+					  uint8_t current_tx_nb,
+					  uint8_t n_srs, uint16_t size);
 
 #ifdef Rel14
-void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t  *ul_config_pdu,
-					  uint8_t ue_type,
-					  uint16_t total_number_of_repetitions,
+void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t *
+					  ul_config_pdu, uint8_t ue_type,
+					  uint16_t
+					  total_number_of_repetitions,
 					  uint16_t repetition_number,
-					  uint16_t initial_transmission_sf_io);
+					  uint16_t
+					  initial_transmission_sf_io);
 #endif
 
-void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t frameP, sub_frame_t subframeP,uint8_t cce_idx);
+void program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP,
+			  frame_t frameP, sub_frame_t subframeP,
+			  uint8_t cce_idx);
 
-void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB, nfapi_dl_config_request_body_t *dl_req,
-			     uint16_t length,
-			     uint16_t pdu_index,
+void fill_nfapi_dlsch_config(eNB_MAC_INST * eNB,
+			     nfapi_dl_config_request_body_t * dl_req,
+			     uint16_t length, uint16_t pdu_index,
 			     uint16_t rnti,
 			     uint8_t resource_allocation_type,
-			     uint8_t virtual_resource_block_assignment_flag,
+			     uint8_t
+			     virtual_resource_block_assignment_flag,
 			     uint16_t resource_block_coding,
 			     uint8_t modulation,
 			     uint8_t redundancy_version,
@@ -1001,7 +1116,7 @@ void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB, nfapi_dl_config_request_body_t *
 			     uint8_t transmission_scheme,
 			     uint8_t number_of_layers,
 			     uint8_t number_of_subbands,
-			     //			     uint8_t codebook_index,
+			     //                      uint8_t codebook_index,
 			     uint8_t ue_category_capacity,
 			     uint8_t pa,
 			     uint8_t delta_power_offset_index,
@@ -1009,28 +1124,27 @@ void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB, nfapi_dl_config_request_body_t *
 			     uint8_t nprb,
 			     uint8_t transmission_mode,
 			     uint8_t num_bf_prb_per_subband,
-			     uint8_t num_bf_vector
-			     );
+			     uint8_t num_bf_vector);
 
 void fill_nfapi_harq_information(module_id_t module_idP,
 				 int CC_idP,
 				 uint16_t rntiP,
 				 uint16_t absSFP,
-				 nfapi_ul_config_harq_information *harq_information,
-				 uint8_t cce_idxP);
+				 nfapi_ul_config_harq_information *
+				 harq_information, uint8_t cce_idxP);
 
 void fill_nfapi_ulsch_harq_information(module_id_t module_idP,
 				       int CC_idP,
 				       uint16_t rntiP,
-				       nfapi_ul_config_ulsch_harq_information *harq_information);
+				       nfapi_ul_config_ulsch_harq_information
+				       * harq_information);
 
 uint16_t fill_nfapi_uci_acknak(module_id_t module_idP,
 			       int CC_idP,
 			       uint16_t rntiP,
-			       uint16_t absSFP,
-			       uint8_t cce_idxP);
+			       uint16_t absSFP, uint8_t cce_idxP);
 
-void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t   *dl_config_pdu,
+void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t * dl_config_pdu,
 			  uint8_t aggregation_level,
 			  uint16_t rnti,
 			  uint8_t rnti_type,
@@ -1038,30 +1152,45 @@ void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t   *dl_config_pdu,
 			  uint8_t tpc,
 			  uint16_t resource_block_coding,
 			  uint8_t mcs,
-			  uint8_t ndi,
-			  uint8_t rv,
-			  uint8_t vrb_flag);
+			  uint8_t ndi, uint8_t rv, uint8_t vrb_flag);
 
-nfapi_ul_config_request_pdu_t* has_ul_grant(module_id_t module_idP,int CC_idP,uint16_t subframeP,uint16_t rnti);
+nfapi_ul_config_request_pdu_t *has_ul_grant(module_id_t module_idP,
+					    int CC_idP, uint16_t subframeP,
+					    uint16_t rnti);
 
-uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP);
+uint8_t get_tmode(module_id_t module_idP, int CC_idP, int UE_idP);
 
-uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subframeP);
+uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP,
+			 sub_frame_t subframeP);
 
 #ifdef Rel14
 int get_numnarrowbandbits(long dl_Bandwidth);
 
-int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t subframeP,int rmax,MPDCCH_TYPES_t mpdcch_type,int UE_id);
+int mpdcch_sf_condition(eNB_MAC_INST * eNB, int CC_id, frame_t frameP,
+			sub_frame_t subframeP, int rmax,
+			MPDCCH_TYPES_t mpdcch_type, int UE_id);
 
 int get_numnarrowbands(long dl_Bandwidth);
 
-int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index);
+int narrowband_to_first_rb(COMMON_channels_t * cc, int nb_index);
 
 #endif
 
 int l2_init_eNB(void);
 
+void Msg1_transmitted(module_id_t module_idP, uint8_t CC_id,
+		      frame_t frameP, uint8_t eNB_id);
+void Msg3_transmitted(module_id_t module_idP, uint8_t CC_id,
+		      frame_t frameP, uint8_t eNB_id);
+uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn);
+int32_t get_uldl_offset(int eutra_bandP);
+int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
+	       uint8_t HO_active);
+
+/*Slice related functions */
+uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs);
 
+int ue_slice_membership(int UE_id, int slice_id);
 
 #endif
 /** @}*/
diff --git a/openair2/LAYER2/MAC/proto_NB_IoT.h b/openair2/LAYER2/MAC/proto_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..6e6d98eba1628abc8e20a6c46dae81de5722e4c7
--- /dev/null
+++ b/openair2/LAYER2/MAC/proto_NB_IoT.h
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file LAYER2/MAC/proto_NB_IoT.h
+ * \brief MAC functions prototypes for eNB and UE
+ * \author Navid Nikaein and Raymond Knopp
+ * \date 2010 - 2014
+ * \email navid.nikaein@eurecom.fr
+ * \version 1.0
+ */
+
+#ifndef __LAYER2_MAC_PROTO_NB_IoT_H__
+#define __LAYER2_MAC_PROTO_NB_IoT_H__
+
+#include "openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h"
+#include "LAYER2/MAC/defs_NB_IoT.h"
+#include "COMMON/platform_types.h"
+#include "openair2/RRC/LITE/defs_NB_IoT.h"
+/** \addtogroup _mac
+ *  @{
+ */
+
+int l2_init_eNB_NB_IoT(void);
+
+///config
+void rrc_mac_config_req_NB_IoT(
+    module_id_t                             Mod_idP,
+    int                                     CC_idP,
+    int                                     rntiP,
+    rrc_eNB_carrier_data_NB_IoT_t           *carrier,
+    SystemInformationBlockType1_NB_t        *sib1_NB_IoT,
+    RadioResourceConfigCommonSIB_NB_r13_t   *radioResourceConfigCommon,
+    PhysicalConfigDedicated_NB_r13_t        *physicalConfigDedicated,
+    LogicalChannelConfig_NB_r13_t           *logicalChannelConfig,            //FIXME: decide how to use it
+    uint8_t                                 ded_flag,
+    uint8_t                                 ue_list_ded_num);
+
+///system
+void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst);
+//void init_rrc_NB_IoT();
+void release_mac_inst(uint8_t order);
+eNB_MAC_INST_NB_IoT *get_mac_inst(uint8_t order);
+uint8_t register_mac_inst(eNB_MAC_INST_NB_IoT *inst, uint8_t order);
+
+///tool
+void init_tool(sib1_NB_IoT_sched_t *config);
+void UE_info_setting(UE_TEMPLATE_NB_IoT *UE_info);
+UE_TEMPLATE_NB_IoT *get_ue_from_rnti(eNB_MAC_INST_NB_IoT *inst, rnti_t rnti);
+	
+///scheduler
+void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe);
+void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe, uint32_t *scheduler_flags, uint32_t *common_flags, uint32_t *max_subframe);
+
+//Calvin temp define self-tools
+int init_debug(eNB_MAC_INST_NB_IoT *inst);
+void maintain_available_resource(eNB_MAC_INST_NB_IoT *mac_inst);
+void extend_available_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, int max_subframe);
+available_resource_DL_t *check_sibs_resource(eNB_MAC_INST_NB_IoT *mac_inst, int check_start_subframe, int check_end_subframe, int num_subframe, int *residual_subframe, int *out_last_subframe, int *out_first_subframe);
+uint32_t calculate_DLSF(eNB_MAC_INST_NB_IoT *mac_inst, int abs_start_subframe, int abs_end_subframe);
+void init(eNB_MAC_INST_NB_IoT *mac_inst);
+void init_dl_list(eNB_MAC_INST_NB_IoT *mac_inst);
+int is_dlsf(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe);
+void fill_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, available_resource_DL_t *node, int start_subframe, int end_subframe, schedule_result_t *new_node);
+available_resource_DL_t *check_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, int check_subframe, int num_subframes, int *out_last_subframe, int *out_first_subframe);
+void print_available_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst);
+void print_schedule_result_DL(void);
+void print_schedule_result_UL(void);
+void add_ue(eNB_MAC_INST_NB_IoT *mac_inst, uint16_t rnti, ce_level_t ce, uint32_t PHR, uint32_t ul_total_buffer);
+void remove_ue(eNB_MAC_INST_NB_IoT *mac_inst, uint16_t rnti, ce_level_t ce);
+//	SIBs
+void schedule_sibs(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start_subframe);
+
+//RA
+void msg3_do_retransmit_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t c_rnti);
+void msg4_do_retransmit_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t c_rnti);
+void schedule_RA_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst);
+void init_RA_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint8_t preamble_index, ce_level_t ce_level, uint32_t sfn_id, uint16_t ta);
+void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe);
+void receive_msg3_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t c_rnti, uint32_t phr, uint32_t ul_total_buffer);
+void schedule_msg3_retransimission_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe);
+void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe);
+void fill_rar_NB_IoT(eNB_MAC_INST_NB_IoT *inst, RA_TEMPLATE_NB_IoT *ra_template, uint8_t msg3_schedule_delay, uint8_t msg3_rep, sched_temp_UL_NB_IoT_t *schedule_template);
+void receive_msg4_ack_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t rnti);
+
+//USS
+void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, uint32_t subframe, uint32_t frame, uint32_t hypersfn, int index_ss);
+
+//DATA
+uint8_t *parse_ulsch_header( uint8_t *mac_header,
+                             uint8_t *num_ce,
+                             uint8_t *num_sdu,
+                             uint8_t *rx_ces,
+                             uint8_t *rx_lcids,
+                             uint16_t *rx_lengths,
+                             uint16_t tb_length );
+
+/*******UL Scheduler**********/
+void print_scheduling_result_UL(void);
+void print_available_UL_resource(void);
+/*set nprach configuration at intial time*/
+void setting_nprach(void);
+/*Uplink main scheduler*/
+int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info, uint32_t subframe, uint32_t frame, uint32_t H_SFN);
+/*Check available uplink resource list, if there is available uplink resource, return 0, otherwise, return 1*/
+int Check_UL_resource(uint32_t DL_end, int total_ru, sched_temp_UL_NB_IoT_t *NPUSCH_info, int multi_tone, int fmt2_flag);
+/*Get I Repetition number in DCI*/
+int get_I_REP(int N_rep);
+/*Get N REP from preamble repeat*/
+int get_N_REP(int CE_level);
+/*Get TBS from mcs, multi-tone, Iru*/
+int get_TBS_UL_NB_IoT(uint32_t mcs,uint32_t multi_tone,int Iru);
+/*get I tbs from mcs and multi-tone*/
+int get_I_TBS_NB_IoT(int x,int y);
+/*Get DCI REP from R max and R*/
+int get_DCI_REP(uint32_t R,uint32_t R_max);
+/*Check single tone resource list*/
+int single_tone_ru_allocation(uint32_t uplink_time, int total_ru, sched_temp_UL_NB_IoT_t *NPUSCH_info, int fmt2_flag);
+/*Check multi tone resource list*/
+int multi_tone_ru_allocation(uint32_t uplink_time, int total_ru, sched_temp_UL_NB_IoT_t *NPUSCH_info);
+/*Generate scheduling result of DCI N0 and Uplink config*/
+void generate_scheduling_result_UL(int32_t DCI_subframe, int32_t DCI_end_subframe, uint32_t UL_subframe, uint32_t UL_end_subframe, DCIFormatN0_t *DCI_inst, rnti_t rnti, uint8_t *ul_debug_str, uint8_t *dl_debug_str);
+/*Adjust UL resource by removing the used resource*/
+void adjust_UL_resource_list(sched_temp_UL_NB_IoT_t *NPUSCH_info);
+/*Initialize resource by nprach configuration*/
+void Initialize_Resource(void);
+/*Function to extend uplink resource grid*/
+//void add_UL_Resource(eNB_MAC_INST_NB_IoT *mac_inst);
+void add_UL_Resource(void);
+/*Get ACK/NAK resource field*/
+int get_resource_field_value(int subcarrier, int k0);
+/*Get DL Repetition index*/
+uint8_t get_index_Rep_dl(uint16_t R);
+
+/*******DL Scheduler********/
+void schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_TEMPLATE_NB_IoT *UE_info, uint32_t hyperSF_start, uint32_t frame_start, uint32_t subframe_start);
+int check_resource_NPDCCH_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t hyperSF_start, uint32_t frame_start, uint32_t subframe_start, sched_temp_DL_NB_IoT_t *NPDCCH_info, uint32_t cdd_num, uint32_t dci_rep);
+int check_resource_NPDSCH_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, sched_temp_DL_NB_IoT_t *NPDSCH_info, uint32_t sf_end, uint32_t I_delay, uint32_t R_max, uint32_t R_dl, uint32_t n_sf);
+int check_resource_DL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t hyperSF_start, uint32_t frame_start, uint32_t subframe_start, uint32_t dlsf_require, sched_temp_DL_NB_IoT_t *schedule_info);
+uint32_t get_I_mcs(int CE_level);
+uint32_t get_max_tbs(uint32_t I_tbs);
+uint32_t get_tbs(uint32_t data_size, uint32_t I_tbs, uint32_t *I_sf);
+uint32_t get_num_sf(uint32_t I_sf);
+uint32_t get_scheduling_delay(uint32_t I_delay, uint32_t R_max);
+uint32_t get_HARQ_delay(int subcarrier_spacing, uint32_t HARQ_delay_index);
+//void generate_scheduling_result_DL(uint32_t DCI_subframe, uint32_t NPDSCH_subframe, uint32_t HARQ_subframe, DCIFormatN1_t *DCI, rnti_t rnti, uint32_t TBS, uint8_t *DLSCH_pdu);
+void generate_scheduling_result_DL(sched_temp_DL_NB_IoT_t* DCI_info, sched_temp_DL_NB_IoT_t* NPDSCH_info, sched_temp_UL_NB_IoT_t* HARQ_info, DCIFormatN1_t *DCI_inst, rnti_t rnti, uint32_t TBS, uint8_t *DLSCH_pdu);
+void fill_DCI_N1(DCIFormatN1_t *DCI_N1, UE_TEMPLATE_NB_IoT *UE_info, uint32_t scheddly, uint32_t I_sf, uint32_t I_harq);
+//Transfrom source into hyperSF, Frame, Subframe format
+void convert_system_number(uint32_t source_sf,uint32_t *hyperSF, uint32_t *frame, uint32_t *subframe);
+//Trnasform hyperSF, Frame, Subframe format into subframe unit
+uint32_t convert_system_number_sf(uint32_t hyperSF, uint32_t frame, uint32_t subframe);
+/*input start position amd num_dlsf DL subframe, caculate the last subframe number*/
+uint32_t cal_num_dlsf(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t hyperSF, uint32_t frame, uint32_t subframe, uint32_t* hyperSF_result, uint32_t* frame_result, uint32_t* subframe_result, uint32_t num_dlsf_require);
+void init_dlsf_info(eNB_MAC_INST_NB_IoT *mac_inst, DLSF_INFO_t *DLSF_info);
+uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_chan_id_t *logical_channel, uint32_t *sdu_length, uint8_t flag_drx, uint8_t flag_ta, uint32_t TBS);
+void maintain_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, sched_temp_DL_NB_IoT_t *NPDCCH_info, sched_temp_DL_NB_IoT_t *NPDSCH_info);
+void init_tool_sib1(eNB_MAC_INST_NB_IoT *mac_inst);
+//int is_dlsf(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe);
+/**DL test , delete**/
+available_resource_DL_t* new_dl_node(uint32_t start_subframe, uint32_t end_subframe, uint32_t dlsf);
+void initialize_dl_resource(available_resource_DL_t *DL_Resource_node, uint32_t start_subframe, uint32_t end_subframe, uint32_t dlsf);
+void insert_dl_resource(available_resource_DL_t *DL_Resource_node);
+void insert_schedule_result(schedule_result_t **list, int subframe, schedule_result_t *node);
+//interface with IF
+
+uint8_t *parse_ulsch_header_NB_IoT( uint8_t *mac_header, uint8_t *num_ce, uint8_t *num_sdu, uint8_t *rx_ces, uint8_t *rx_lcids, uint16_t *rx_lengths, uint16_t tb_length);
+
+void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t subframe, uint16_t rnti, uint8_t *sdu, uint16_t  length);
+
+int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_id, uint32_t hypersfn, uint32_t frame, uint32_t subframe, uint8_t MIB_flag, uint8_t SIB1_flag, uint32_t current_time);
+// main
+
+void mac_top_init_eNB_NB_IoT(void);
+
+uint32_t to_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_CarrierFreq, float m_dl);
+
+uint32_t from_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_earfcn, float m_dl);
+
+int32_t get_uldl_offset_NB_IoT(int eutra_band);
+#endif
diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c
index b63acf76f8a4d48e75ce460fc5f65d8ed8b2cd72..8868d2d548ad30ba445b924c7e294d7df1fc8294 100644
--- a/openair2/LAYER2/MAC/ra_procedures.c
+++ b/openair2/LAYER2/MAC/ra_procedures.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -35,6 +35,7 @@
 #include "proto.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "PHY_INTERFACE/extern.h"
+#include "SCHED/defs.h"
 #include "COMMON/mac_rrc_primitives.h"
 #include "RRC/LITE/extern.h"
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
@@ -46,482 +47,604 @@
 #include "SIMULATION/simulation_defs.h"
 #endif
 
-#include "SIMULATION/TOOLS/defs.h" // for taus
+#include "SIMULATION/TOOLS/defs.h"	// for taus
 
-int8_t get_DELTA_PREAMBLE(module_id_t module_idP,int CC_id)
+int8_t get_DELTA_PREAMBLE(module_id_t module_idP, int CC_id)
 {
 
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
-  uint8_t prachConfigIndex = UE_mac_inst[module_idP].radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
-  uint8_t preambleformat;
-
-  if (UE_mac_inst[module_idP].tdd_Config) { // TDD
-    if (prachConfigIndex < 20) {
-      preambleformat = 0;
-    } else if (prachConfigIndex < 30) {
-      preambleformat = 1;
-    } else if (prachConfigIndex < 40) {
-      preambleformat = 2;
-    } else if (prachConfigIndex < 48) {
-      preambleformat = 3;
-    } else {
-      preambleformat = 4;
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
+    uint8_t prachConfigIndex =
+	UE_mac_inst[module_idP].radioResourceConfigCommon->
+	prach_Config.prach_ConfigInfo.prach_ConfigIndex;
+    uint8_t preambleformat;
+
+    if (UE_mac_inst[module_idP].tdd_Config) {	// TDD
+	if (prachConfigIndex < 20) {
+	    preambleformat = 0;
+	} else if (prachConfigIndex < 30) {
+	    preambleformat = 1;
+	} else if (prachConfigIndex < 40) {
+	    preambleformat = 2;
+	} else if (prachConfigIndex < 48) {
+	    preambleformat = 3;
+	} else {
+	    preambleformat = 4;
+	}
+    } else {			// FDD
+	preambleformat = prachConfigIndex >> 2;
     }
-  } else { // FDD
-    preambleformat = prachConfigIndex>>2;
-  }
 
-  switch (preambleformat) {
-  case 0:
-  case 1:
-    return(0);
+    switch (preambleformat) {
+    case 0:
+    case 1:
+	return (0);
 
-  case 2:
-  case 3:
-    return(-3);
+    case 2:
+    case 3:
+	return (-3);
 
-  case 4:
-    return(8);
+    case 4:
+	return (8);
 
-  default:
-    AssertFatal(1==0,"[UE %d] ue_procedures.c: FATAL, Illegal preambleformat %d, prachConfigIndex %d\n",
-		module_idP,
-		preambleformat,prachConfigIndex);
-  }
+    default:
+	AssertFatal(1 == 0,
+		    "[UE %d] ue_procedures.c: FATAL, Illegal preambleformat %d, prachConfigIndex %d\n",
+		    module_idP, preambleformat, prachConfigIndex);
+    }
 
 }
 
 
 /// This routine implements Section 5.1.2 (UE Random Access Resource Selection) from 36.321
-void get_prach_resources(module_id_t module_idP,
-                         int CC_id,
-                         uint8_t eNB_index,
-                         uint8_t t_id,
-                         uint8_t first_Msg3,
-                         RACH_ConfigDedicated_t *rach_ConfigDedicated)
+void
+get_prach_resources(module_id_t module_idP,
+		    int CC_id,
+		    uint8_t eNB_index,
+		    uint8_t t_id,
+		    uint8_t first_Msg3,
+		    RACH_ConfigDedicated_t * rach_ConfigDedicated)
 {
 
-  uint8_t Msg3_size = UE_mac_inst[module_idP].RA_Msg3_size;
-  PRACH_RESOURCES_t *prach_resources = &UE_mac_inst[module_idP].RA_prach_resources;
-  RACH_ConfigCommon_t *rach_ConfigCommon = NULL;
-  uint8_t noGroupB = 0;
-  uint8_t f_id = 0,num_prach=0;
-  int numberOfRA_Preambles;
-  int messageSizeGroupA;
-  int sizeOfRA_PreamblesGroupA;
-  int messagePowerOffsetGroupB;
-  int PLThreshold;
-
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
-  AssertFatal(UE_mac_inst[module_idP].radioResourceConfigCommon!=NULL,
-	      "[UE %d] FATAL  radioResourceConfigCommon is NULL !!!\n",module_idP);
-
-  rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
-  numberOfRA_Preambles = (1+rach_ConfigCommon->preambleInfo.numberOfRA_Preambles)<<2;  
-
-  if (rach_ConfigDedicated) {   // This is for network controlled Mobility, later
-    if (rach_ConfigDedicated->ra_PRACH_MaskIndex != 0) {
-      prach_resources->ra_PreambleIndex = rach_ConfigDedicated->ra_PreambleIndex;
-      prach_resources->ra_RACH_MaskIndex = rach_ConfigDedicated->ra_PRACH_MaskIndex;
-      return;
+    uint8_t Msg3_size = UE_mac_inst[module_idP].RA_Msg3_size;
+    PRACH_RESOURCES_t *prach_resources =
+	&UE_mac_inst[module_idP].RA_prach_resources;
+    RACH_ConfigCommon_t *rach_ConfigCommon = NULL;
+    uint8_t noGroupB = 0;
+    uint8_t f_id = 0, num_prach = 0;
+    int numberOfRA_Preambles;
+    int messageSizeGroupA;
+    int sizeOfRA_PreamblesGroupA;
+    int messagePowerOffsetGroupB;
+    int PLThreshold;
+
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
+    AssertFatal(UE_mac_inst[module_idP].radioResourceConfigCommon != NULL,
+		"[UE %d] FATAL  radioResourceConfigCommon is NULL !!!\n",
+		module_idP);
+
+    rach_ConfigCommon =
+	&UE_mac_inst[module_idP].radioResourceConfigCommon->
+	rach_ConfigCommon;
+    numberOfRA_Preambles =
+	(1 + rach_ConfigCommon->preambleInfo.numberOfRA_Preambles) << 2;
+
+    if (rach_ConfigDedicated) {	// This is for network controlled Mobility, later
+	if (rach_ConfigDedicated->ra_PRACH_MaskIndex != 0) {
+	    prach_resources->ra_PreambleIndex =
+		rach_ConfigDedicated->ra_PreambleIndex;
+	    prach_resources->ra_RACH_MaskIndex =
+		rach_ConfigDedicated->ra_PRACH_MaskIndex;
+	    return;
+	}
     }
-  }
 
-  /* TODO: gcc warns if this variable is not always set, let's put -1 for no more warning */
-  messageSizeGroupA = -1;
+    /* TODO: gcc warns if this variable is not always set, let's put -1 for no more warning */
+    messageSizeGroupA = -1;
 
-  if (!rach_ConfigCommon->preambleInfo.preamblesGroupAConfig) {
-    noGroupB = 1;
-  } else {
-    sizeOfRA_PreamblesGroupA = (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA+1)<<2;
-    switch (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->messageSizeGroupA) {
-    case 0:
-      messageSizeGroupA = 56;
-      break;
-    case 1:
-      messageSizeGroupA = 144;
-      break;
-    case 2:
-      messageSizeGroupA = 208;
-      break;
-    case 3:
-      messageSizeGroupA = 256;
-      break;
-    }
+    if (!rach_ConfigCommon->preambleInfo.preamblesGroupAConfig) {
+	noGroupB = 1;
+    } else {
+	sizeOfRA_PreamblesGroupA =
+	    (rach_ConfigCommon->preambleInfo.
+	     preamblesGroupAConfig->sizeOfRA_PreamblesGroupA + 1) << 2;
+	switch (rach_ConfigCommon->preambleInfo.
+		preamblesGroupAConfig->messageSizeGroupA) {
+	case 0:
+	    messageSizeGroupA = 56;
+	    break;
+	case 1:
+	    messageSizeGroupA = 144;
+	    break;
+	case 2:
+	    messageSizeGroupA = 208;
+	    break;
+	case 3:
+	    messageSizeGroupA = 256;
+	    break;
+	}
 
-    /* TODO: what value to use as default? */
-    messagePowerOffsetGroupB = -9999;
-    switch (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->messagePowerOffsetGroupB) {
-    case 0:
-      messagePowerOffsetGroupB = -9999;
-      break;
-    case 1:
-      messagePowerOffsetGroupB = 0;
-      break;
-    case 2:
-      messagePowerOffsetGroupB = 5;
-      break;
-    case 3:
-      messagePowerOffsetGroupB = 8;
-      break;
-    case 4:
-      messagePowerOffsetGroupB = 10;
-      break;
-    case 5:
-      messagePowerOffsetGroupB = 12;
-      break;
-    case 6:
-      messagePowerOffsetGroupB = 15;
-      break;
-    case 7:
-      messagePowerOffsetGroupB = 18;
-      break;
-    }
+	/* TODO: what value to use as default? */
+	messagePowerOffsetGroupB = -9999;
+	switch (rach_ConfigCommon->preambleInfo.
+		preamblesGroupAConfig->messagePowerOffsetGroupB) {
+	case 0:
+	    messagePowerOffsetGroupB = -9999;
+	    break;
+	case 1:
+	    messagePowerOffsetGroupB = 0;
+	    break;
+	case 2:
+	    messagePowerOffsetGroupB = 5;
+	    break;
+	case 3:
+	    messagePowerOffsetGroupB = 8;
+	    break;
+	case 4:
+	    messagePowerOffsetGroupB = 10;
+	    break;
+	case 5:
+	    messagePowerOffsetGroupB = 12;
+	    break;
+	case 6:
+	    messagePowerOffsetGroupB = 15;
+	    break;
+	case 7:
+	    messagePowerOffsetGroupB = 18;
+	    break;
+	}
 
-    PLThreshold = 0 - get_DELTA_PREAMBLE(module_idP,CC_id) - get_Po_NOMINAL_PUSCH(module_idP,CC_id) - messagePowerOffsetGroupB;
-    // Note Pcmax is set to 0 here, we have to fix this
+	PLThreshold =
+	    0 - get_DELTA_PREAMBLE(module_idP,
+				   CC_id) -
+	    get_Po_NOMINAL_PUSCH(module_idP,
+				 CC_id) - messagePowerOffsetGroupB;
+	// Note Pcmax is set to 0 here, we have to fix this
 
-    if (sizeOfRA_PreamblesGroupA == numberOfRA_Preambles) {
-      noGroupB = 1;
-    }
-  }
-
-  if (first_Msg3 == 1) {
-    if (noGroupB == 1) {
-      // use Group A procedure
-      UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex  = (taus())%numberOfRA_Preambles;
-      UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
-      UE_mac_inst[module_idP].RA_usedGroupA = 1;
-    } else if ((Msg3_size <messageSizeGroupA) ||
-               (get_PL(module_idP,0,eNB_index) > PLThreshold)) {
-      // use Group A procedure
-      UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex  = (taus())%sizeOfRA_PreamblesGroupA;
-      UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
-      UE_mac_inst[module_idP].RA_usedGroupA = 1;
-    } else { // use Group B
-      UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex  = sizeOfRA_PreamblesGroupA +
-        (taus())%(numberOfRA_Preambles - sizeOfRA_PreamblesGroupA);
-      UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
-      UE_mac_inst[module_idP].RA_usedGroupA = 0;
+	if (sizeOfRA_PreamblesGroupA == numberOfRA_Preambles) {
+	    noGroupB = 1;
+	}
     }
 
-    UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER = get_Po_NOMINAL_PUSCH(module_idP,CC_id);
-  } else { // Msg3 is being retransmitted
-    if (UE_mac_inst[module_idP].RA_usedGroupA == 1) {
-      if (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig) {
-        UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex  = (taus())%rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA;
-      } else {
-        UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex  = (taus())&0x3f;
-      }
+    if (first_Msg3 == 1) {
+	if (noGroupB == 1) {
+	    // use Group A procedure
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
+		(taus()) % numberOfRA_Preambles;
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex =
+		0;
+	    UE_mac_inst[module_idP].RA_usedGroupA = 1;
+	} else if ((Msg3_size < messageSizeGroupA) ||
+		   (get_PL(module_idP, 0, eNB_index) > PLThreshold)) {
+	    // use Group A procedure
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
+		(taus()) % sizeOfRA_PreamblesGroupA;
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex =
+		0;
+	    UE_mac_inst[module_idP].RA_usedGroupA = 1;
+	} else {		// use Group B
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
+		sizeOfRA_PreamblesGroupA +
+		(taus()) % (numberOfRA_Preambles -
+			    sizeOfRA_PreamblesGroupA);
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex =
+		0;
+	    UE_mac_inst[module_idP].RA_usedGroupA = 0;
+	}
 
-      UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
-    } else {
-      // FIXME rach_ConfigCommon->preambleInfo.preamblesGroupAConfig may be zero
-      UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex  =
-        rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA +
-        (taus())%(rach_ConfigCommon->preambleInfo.numberOfRA_Preambles -
-                  rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA);
-      UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
+	UE_mac_inst[module_idP].
+	    RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER =
+	    get_Po_NOMINAL_PUSCH(module_idP, CC_id);
+    } else {			// Msg3 is being retransmitted
+	if (UE_mac_inst[module_idP].RA_usedGroupA == 1) {
+	    if (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig) {
+		UE_mac_inst[module_idP].RA_prach_resources.
+		    ra_PreambleIndex =
+		    (taus()) %
+		    rach_ConfigCommon->preambleInfo.
+		    preamblesGroupAConfig->sizeOfRA_PreamblesGroupA;
+	    } else {
+		UE_mac_inst[module_idP].RA_prach_resources.
+		    ra_PreambleIndex = (taus()) & 0x3f;
+	    }
+
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex =
+		0;
+	} else {
+	    // FIXME rach_ConfigCommon->preambleInfo.preamblesGroupAConfig may be zero
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
+		rach_ConfigCommon->preambleInfo.
+		preamblesGroupAConfig->sizeOfRA_PreamblesGroupA +
+		(taus()) %
+		(rach_ConfigCommon->preambleInfo.numberOfRA_Preambles -
+		 rach_ConfigCommon->preambleInfo.
+		 preamblesGroupAConfig->sizeOfRA_PreamblesGroupA);
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex =
+		0;
+	}
     }
-  }
-
-  // choose random PRACH resource in TDD
-  if (UE_mac_inst[module_idP].tdd_Config) {
-    num_prach = get_num_prach_tdd(module_idP);
 
-    if ((num_prach>0) && (num_prach<6)) {
-      UE_mac_inst[module_idP].RA_prach_resources.ra_TDD_map_index = (taus()%num_prach);
-    }
+    // choose random PRACH resource in TDD
+    if (UE_mac_inst[module_idP].tdd_Config) {
+	num_prach = get_num_prach_tdd(module_idP);
 
-    f_id = get_fid_prach_tdd(module_idP,
-			     UE_mac_inst[module_idP].RA_prach_resources.ra_TDD_map_index);
-  }
+	if ((num_prach > 0) && (num_prach < 6)) {
+	    UE_mac_inst[module_idP].RA_prach_resources.ra_TDD_map_index =
+		(taus() % num_prach);
+	}
 
-  // choose RA-RNTI
-  UE_mac_inst[module_idP].RA_prach_resources.ra_RNTI = 1 + t_id + 10*f_id;
+	f_id = get_fid_prach_tdd(module_idP,
+				 UE_mac_inst
+				 [module_idP].RA_prach_resources.
+				 ra_TDD_map_index);
+    }
+    // choose RA-RNTI
+    UE_mac_inst[module_idP].RA_prach_resources.ra_RNTI =
+	1 + t_id + 10 * f_id;
 }
 
-void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id)
+void
+Msg1_transmitted(module_id_t module_idP, uint8_t CC_id,
+		 frame_t frameP, uint8_t eNB_id)
 {
 
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
-  // start contention resolution timer
-  UE_mac_inst[module_idP].RA_attempt_number++;
-
-  if (opt_enabled) {
-    trace_pdu(0, NULL, 0, module_idP, 0 , UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex,
-        UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, UE_mac_inst[module_idP].RA_attempt_number);
-    LOG_D(OPT,"[UE %d][RAPROC] TX MSG1 Frame %d trace pdu for rnti %x  with size %d\n",
-          module_idP, frameP, 1, UE_mac_inst[module_idP].RA_Msg3_size);
-  }
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
+    // start contention resolution timer
+    UE_mac_inst[module_idP].RA_attempt_number++;
+
+    if (opt_enabled) {
+	trace_pdu(0, NULL, 0, module_idP, 0,
+		  UE_mac_inst[module_idP].RA_prach_resources.
+		  ra_PreambleIndex, UE_mac_inst[module_idP].txFrame,
+		  UE_mac_inst[module_idP].txSubframe, 0,
+		  UE_mac_inst[module_idP].RA_attempt_number);
+	LOG_D(OPT,
+	      "[UE %d][RAPROC] TX MSG1 Frame %d trace pdu for rnti %x  with size %d\n",
+	      module_idP, frameP, 1, UE_mac_inst[module_idP].RA_Msg3_size);
+    }
 
 }
 
 
-void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id)
+void
+Msg3_transmitted(module_id_t module_idP, uint8_t CC_id,
+		 frame_t frameP, uint8_t eNB_id)
 {
 
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
-
-  // start contention resolution timer
-  LOG_D(MAC,"[UE %d][RAPROC] Frame %d : Msg3_tx: Setting contention resolution timer\n",module_idP,frameP);
-  UE_mac_inst[module_idP].RA_contention_resolution_cnt = 0;
-  UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 1;
-
-  if (opt_enabled) { // msg3
-    trace_pdu(0, &UE_mac_inst[module_idP].CCCH_pdu.payload[0], UE_mac_inst[module_idP].RA_Msg3_size,
-              module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, 0);
-    LOG_D(OPT,"[UE %d][RAPROC] MSG3 Frame %d trace pdu Preamble %d   with size %d\n",
-          module_idP, frameP, UE_mac_inst[module_idP].crnti /*UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex*/, UE_mac_inst[module_idP].RA_Msg3_size);
-  }
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
+
+    // start contention resolution timer
+    LOG_D(MAC,
+	  "[UE %d][RAPROC] Frame %d : Msg3_tx: Setting contention resolution timer\n",
+	  module_idP, frameP);
+    UE_mac_inst[module_idP].RA_contention_resolution_cnt = 0;
+    UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 1;
+
+    if (opt_enabled) {		// msg3
+	trace_pdu(0, &UE_mac_inst[module_idP].CCCH_pdu.payload[0],
+		  UE_mac_inst[module_idP].RA_Msg3_size, module_idP, 3,
+		  UE_mac_inst[module_idP].crnti,
+		  UE_mac_inst[module_idP].txFrame,
+		  UE_mac_inst[module_idP].txSubframe, 0, 0);
+	LOG_D(OPT,
+	      "[UE %d][RAPROC] MSG3 Frame %d trace pdu Preamble %d   with size %d\n",
+	      module_idP, frameP, UE_mac_inst[module_idP].crnti
+	      /*UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex */
+	      , UE_mac_inst[module_idP].RA_Msg3_size);
+    }
 
 }
 
 
-PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, uint8_t eNB_indexP,sub_frame_t subframeP)
+PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
+			       frame_t frameP, uint8_t eNB_indexP,
+			       sub_frame_t subframeP)
 {
 
 
-  uint8_t                  Size               = 0;
-  UE_MODE_t                UE_mode            = get_ue_mode(module_idP,0,eNB_indexP);
-  uint8_t                  lcid               = CCCH;
-  uint16_t                 Size16;
-  struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL;
-  int32_t                  frame_diff         = 0;
-  mac_rlc_status_resp_t    rlc_status;
-  uint8_t                  dcch_header_len    = 0;
-  uint16_t                 sdu_lengths[8];
-  uint8_t                  ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
-
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
-
-  if (UE_mode == PRACH) {
-    if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
-      rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
-    } else {
-      return(NULL);
-    }
-
-    if (UE_mac_inst[module_idP].RA_active == 0) {
-      LOG_I(MAC,"RA not active\n");
-      // check if RRC is ready to initiate the RA procedure
-      Size = mac_rrc_data_req(module_idP,
-			      CC_id,
-			      frameP,
-			      CCCH,1,
-			      &UE_mac_inst[module_idP].CCCH_pdu.payload[sizeof(SCH_SUBHEADER_SHORT)+1],0,
-			      eNB_indexP,
-			      0);
-      Size16 = (uint16_t)Size;
-      
-      //  LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
-      LOG_I(RRC, "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n",
-	    frameP, module_idP, eNB_indexP, module_idP);
-      LOG_I(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
-      
-      if (Size>0) {
-	
-	UE_mac_inst[module_idP].RA_active                        = 1;
-	UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
-	UE_mac_inst[module_idP].RA_Msg3_size                     = Size+sizeof(SCH_SUBHEADER_SHORT)+sizeof(SCH_SUBHEADER_SHORT);
-	UE_mac_inst[module_idP].RA_prachMaskIndex                = 0;
-	UE_mac_inst[module_idP].RA_prach_resources.Msg3          = UE_mac_inst[module_idP].CCCH_pdu.payload;
-	UE_mac_inst[module_idP].RA_backoff_cnt                   = 0;  // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
-	
-	AssertFatal(rach_ConfigCommon!=NULL,
-		    "[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",module_idP,frameP);
-	UE_mac_inst[module_idP].RA_window_cnt                    = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
-	
-	if (UE_mac_inst[module_idP].RA_window_cnt == 9) {
-	  UE_mac_inst[module_idP].RA_window_cnt = 10;  // Note: 9 subframe window doesn't exist, after 8 is 10!
+    uint8_t Size = 0;
+    UE_MODE_t UE_mode = get_ue_mode(module_idP, 0, eNB_indexP);
+    uint8_t lcid = CCCH;
+    uint16_t Size16;
+    struct RACH_ConfigCommon *rach_ConfigCommon =
+	(struct RACH_ConfigCommon *) NULL;
+    int32_t frame_diff = 0;
+    mac_rlc_status_resp_t rlc_status;
+    uint8_t dcch_header_len = 0;
+    uint16_t sdu_lengths[8];
+    uint8_t ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
+
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
+
+    if (UE_mode == PRACH) {
+	if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
+	    rach_ConfigCommon =
+		&UE_mac_inst[module_idP].
+		radioResourceConfigCommon->rach_ConfigCommon;
+	} else {
+	    return (NULL);
 	}
-	
-	UE_mac_inst[module_idP].RA_tx_frame         = frameP;
-	UE_mac_inst[module_idP].RA_tx_subframe      = subframeP;
-	UE_mac_inst[module_idP].RA_backoff_frame    = frameP;
-	UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-	// Fill in preamble and PRACH resource
-	get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,1,NULL);
-	
-	generate_ulsch_header((uint8_t*)&UE_mac_inst[module_idP].CCCH_pdu.payload[0],  // mac header
-			      1,      // num sdus
-			      0,            // short pading
-			      &Size16,  // sdu length
-			      &lcid,    // sdu lcid
-			      NULL,  // power headroom
-			      NULL,  // crnti
-			      NULL,  // truncated bsr
-			      NULL, // short bsr
-			      NULL, // long_bsr
-			      1); //post_padding
-	return(&UE_mac_inst[module_idP].RA_prach_resources);
-	
-      } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > 0) {
-	// This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example)
-	dcch_header_len = 2 + 2;  /// SHORT Subheader + C-RNTI control element
-	rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, eNB_indexP,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
-					DCCH,
-					6);
-	
-	if (UE_mac_inst[module_idP].crnti_before_ho)
-	  LOG_D(MAC,
-		"[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n",
-		module_idP,frameP, UE_mac_inst[module_idP].crnti,UE_mac_inst[module_idP].crnti_before_ho, rlc_status.bytes_in_buffer,dcch_header_len);
-	else
-	  LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n",
-		module_idP,frameP, rlc_status.bytes_in_buffer,dcch_header_len);
-	
-	sdu_lengths[0] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti,
-					  eNB_indexP, frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
-					  DCCH,
-					  6,	//not used
-					  (char *)&ulsch_buff[0]);
-	
-	LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]);
-	update_bsr(module_idP, frameP, subframeP,eNB_indexP);
-	UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] =
-	  locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]]);
-	
-	//TO DO: fill BSR infos in UL TBS
-	
-	//header_len +=2;
-	UE_mac_inst[module_idP].RA_active                        = 1;
-	UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
-	UE_mac_inst[module_idP].RA_Msg3_size                     = Size+dcch_header_len;
-	UE_mac_inst[module_idP].RA_prachMaskIndex                = 0;
-	UE_mac_inst[module_idP].RA_prach_resources.Msg3          = ulsch_buff;
-	UE_mac_inst[module_idP].RA_backoff_cnt                   = 0;  // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
-	
-	AssertFatal(rach_ConfigCommon!=NULL,
-		    "[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",module_idP,frameP);
-	UE_mac_inst[module_idP].RA_window_cnt                    = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
-	
-	if (UE_mac_inst[module_idP].RA_window_cnt == 9) {
-	  UE_mac_inst[module_idP].RA_window_cnt = 10;  // Note: 9 subframe window doesn't exist, after 8 is 10!
-	}
-	
-	
-	UE_mac_inst[module_idP].RA_tx_frame         = frameP;
-	UE_mac_inst[module_idP].RA_tx_subframe      = subframeP;
-	UE_mac_inst[module_idP].RA_backoff_frame    = frameP;
-	UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-	// Fill in preamble and PRACH resource
-	get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,1,NULL);
-	generate_ulsch_header((uint8_t*)ulsch_buff,  // mac header
-			      1,      // num sdus
-			      0,            // short pading
-			      &Size16,  // sdu length
-			      &lcid,    // sdu lcid
-			      NULL,  // power headroom
-			      &UE_mac_inst[module_idP].crnti,  // crnti
-			      NULL,  // truncated bsr
-			      NULL, // short bsr
-			      NULL, // long_bsr
-			      0); //post_padding
-	
-	return(&UE_mac_inst[module_idP].RA_prach_resources);
-      }
-    } else { // RACH is active
-      LOG_D(MAC,"[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",module_idP,
-	    frameP,subframeP,UE_mac_inst[module_idP].RA_window_cnt,
-	    UE_mac_inst[module_idP].RA_tx_frame,UE_mac_inst[module_idP].RA_tx_subframe);
-      
-      // compute backoff parameters
-      if (UE_mac_inst[module_idP].RA_backoff_cnt>0) {
-	frame_diff = (sframe_t)frameP - UE_mac_inst[module_idP].RA_backoff_frame;
-	
-	if (frame_diff < 0) {
-	  frame_diff = -frame_diff;
-	}
-	
-	UE_mac_inst[module_idP].RA_backoff_cnt -= ((10*frame_diff) + (subframeP-UE_mac_inst[module_idP].RA_backoff_subframe));
-	
-	UE_mac_inst[module_idP].RA_backoff_frame    = frameP;
-	UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-      }
-      
-      // compute RA window parameters
-      if (UE_mac_inst[module_idP].RA_window_cnt>0) {
-	frame_diff = (frame_t)frameP - UE_mac_inst[module_idP].RA_tx_frame;
-	
-	if (frame_diff < 0) {
-	  frame_diff = -frame_diff;
-	}
-	
-	UE_mac_inst[module_idP].RA_window_cnt -= ((10*frame_diff) + (subframeP-UE_mac_inst[module_idP].RA_tx_subframe));
-	LOG_D(MAC,"[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, adjusted window cnt %d\n",module_idP,
-	      frameP,subframeP,UE_mac_inst[module_idP].RA_window_cnt);
-      }
-      
-      if ((UE_mac_inst[module_idP].RA_window_cnt<=0) &&
-	  (UE_mac_inst[module_idP].RA_backoff_cnt<=0)) {
-	
-	UE_mac_inst[module_idP].RA_tx_frame    = frameP;
-	UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
-	UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER++;
-	UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER +=
-	  (rach_ConfigCommon->powerRampingParameters.powerRampingStep<<1);  // 2dB increments in ASN.1 definition
-	int preambleTransMax = -1;
-	switch (rach_ConfigCommon->ra_SupervisionInfo.preambleTransMax) {
-	case PreambleTransMax_n3:
-	  preambleTransMax = 3;
-	  break;
-	case PreambleTransMax_n4:
-	  preambleTransMax = 4;
-	  break;
-	case PreambleTransMax_n5:
-	  preambleTransMax = 5;
-	  break;
-	case PreambleTransMax_n6:
-	  preambleTransMax = 6;
-	  break;
-	case PreambleTransMax_n7:
-	  preambleTransMax = 7;
-	  break;
-	case PreambleTransMax_n8:
-	  preambleTransMax = 8;
-	  break;
-	case PreambleTransMax_n10:
-	  preambleTransMax = 10;
-	  break;
-	case PreambleTransMax_n20:
-	  preambleTransMax = 20;
-	  break;
-	case PreambleTransMax_n50:
-	  preambleTransMax = 50;
-	  break;
-	case PreambleTransMax_n100:
-	  preambleTransMax = 100;
-	  break;
-	case PreambleTransMax_n200:
-	  preambleTransMax = 200;
-	  break;
-	} 
-	
-	if (UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER == preambleTransMax) {
-	  LOG_D(MAC,"[UE %d] Frame %d: Maximum number of RACH attempts (%d)\n",module_idP,frameP,preambleTransMax);
-	  // send message to RRC
-	  UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER=1;
-	  UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER = get_Po_NOMINAL_PUSCH(module_idP,CC_id);
+
+	if (UE_mac_inst[module_idP].RA_active == 0) {
+	    LOG_I(MAC, "RA not active\n");
+	    // check if RRC is ready to initiate the RA procedure
+	    Size = mac_rrc_data_req_ue(module_idP,
+				    CC_id,
+				    frameP,
+				    CCCH, 1,
+				    &UE_mac_inst[module_idP].
+				    CCCH_pdu.payload[sizeof
+						     (SCH_SUBHEADER_SHORT)
+						     + 1], eNB_indexP,
+				    0);
+	    Size16 = (uint16_t) Size;
+
+	    //  LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
+	    LOG_I(RRC,
+		  "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n",
+		  frameP, module_idP, eNB_indexP, module_idP);
+	    LOG_I(MAC,
+		  "[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",
+		  module_idP, frameP, Size);
+
+	    if (Size > 0) {
+
+		UE_mac_inst[module_idP].RA_active = 1;
+		UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER =
+		    1;
+		UE_mac_inst[module_idP].RA_Msg3_size =
+		    Size + sizeof(SCH_SUBHEADER_SHORT) +
+		    sizeof(SCH_SUBHEADER_SHORT);
+		UE_mac_inst[module_idP].RA_prachMaskIndex = 0;
+		UE_mac_inst[module_idP].RA_prach_resources.Msg3 =
+		    UE_mac_inst[module_idP].CCCH_pdu.payload;
+		UE_mac_inst[module_idP].RA_backoff_cnt = 0;	// add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
+
+		AssertFatal(rach_ConfigCommon != NULL,
+			    "[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",
+			    module_idP, frameP);
+		UE_mac_inst[module_idP].RA_window_cnt =
+		    2 +
+		    rach_ConfigCommon->ra_SupervisionInfo.
+		    ra_ResponseWindowSize;
+
+		if (UE_mac_inst[module_idP].RA_window_cnt == 9) {
+		    UE_mac_inst[module_idP].RA_window_cnt = 10;	// Note: 9 subframe window doesn't exist, after 8 is 10!
+		}
+
+		UE_mac_inst[module_idP].RA_tx_frame = frameP;
+		UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
+		UE_mac_inst[module_idP].RA_backoff_frame = frameP;
+		UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
+		// Fill in preamble and PRACH resource
+		get_prach_resources(module_idP, CC_id, eNB_indexP,
+				    subframeP, 1, NULL);
+
+		generate_ulsch_header((uint8_t *) & UE_mac_inst[module_idP].CCCH_pdu.payload[0],	// mac header
+				      1,	// num sdus
+				      0,	// short pading
+				      &Size16,	// sdu length
+				      &lcid,	// sdu lcid
+				      NULL,	// power headroom
+				      NULL,	// crnti
+				      NULL,	// truncated bsr
+				      NULL,	// short bsr
+				      NULL,	// long_bsr
+				      1);	//post_padding
+		return (&UE_mac_inst[module_idP].RA_prach_resources);
+
+	    } else if (UE_mac_inst[module_idP].
+		       scheduling_info.BSR_bytes[UE_mac_inst[module_idP].
+						 scheduling_info.LCGID
+						 [DCCH]] > 0) {
+		// This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example)
+		dcch_header_len = 2 + 2;	/// SHORT Subheader + C-RNTI control element
+		rlc_status =
+		    mac_rlc_status_ind(module_idP,
+				       UE_mac_inst[module_idP].crnti,
+				       eNB_indexP, frameP, subframeP,
+				       ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, 6);
+
+		if (UE_mac_inst[module_idP].crnti_before_ho)
+		    LOG_D(MAC,
+			  "[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n",
+			  module_idP, frameP,
+			  UE_mac_inst[module_idP].crnti,
+			  UE_mac_inst[module_idP].crnti_before_ho,
+			  rlc_status.bytes_in_buffer, dcch_header_len);
+		else
+		    LOG_D(MAC,
+			  "[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n",
+			  module_idP, frameP, rlc_status.bytes_in_buffer,
+			  dcch_header_len);
+
+		sdu_lengths[0] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, eNB_indexP, frameP, ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, 6,	//not used
+						  (char *) &ulsch_buff[0]);
+
+		LOG_D(MAC, "[UE %d] TX Got %d bytes for DCCH\n",
+		      module_idP, sdu_lengths[0]);
+		update_bsr(module_idP, frameP, subframeP, eNB_indexP);
+		UE_mac_inst[module_idP].
+		    scheduling_info.BSR[UE_mac_inst[module_idP].
+					scheduling_info.LCGID[DCCH]] =
+		    locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE,
+						UE_mac_inst
+						[module_idP].scheduling_info.BSR_bytes
+						[UE_mac_inst
+						 [module_idP].scheduling_info.LCGID
+						 [DCCH]]);
+
+		//TO DO: fill BSR infos in UL TBS
+
+		//header_len +=2;
+		UE_mac_inst[module_idP].RA_active = 1;
+		UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER =
+		    1;
+		UE_mac_inst[module_idP].RA_Msg3_size =
+		    Size + dcch_header_len;
+		UE_mac_inst[module_idP].RA_prachMaskIndex = 0;
+		UE_mac_inst[module_idP].RA_prach_resources.Msg3 =
+		    ulsch_buff;
+		UE_mac_inst[module_idP].RA_backoff_cnt = 0;	// add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
+
+		AssertFatal(rach_ConfigCommon != NULL,
+			    "[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",
+			    module_idP, frameP);
+		UE_mac_inst[module_idP].RA_window_cnt =
+		    2 +
+		    rach_ConfigCommon->ra_SupervisionInfo.
+		    ra_ResponseWindowSize;
+
+		if (UE_mac_inst[module_idP].RA_window_cnt == 9) {
+		    UE_mac_inst[module_idP].RA_window_cnt = 10;	// Note: 9 subframe window doesn't exist, after 8 is 10!
+		}
+
+
+		UE_mac_inst[module_idP].RA_tx_frame = frameP;
+		UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
+		UE_mac_inst[module_idP].RA_backoff_frame = frameP;
+		UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
+		// Fill in preamble and PRACH resource
+		get_prach_resources(module_idP, CC_id, eNB_indexP,
+				    subframeP, 1, NULL);
+		generate_ulsch_header((uint8_t *) ulsch_buff,	// mac header
+				      1,	// num sdus
+				      0,	// short pading
+				      &Size16,	// sdu length
+				      &lcid,	// sdu lcid
+				      NULL,	// power headroom
+				      &UE_mac_inst[module_idP].crnti,	// crnti
+				      NULL,	// truncated bsr
+				      NULL,	// short bsr
+				      NULL,	// long_bsr
+				      0);	//post_padding
+
+		return (&UE_mac_inst[module_idP].RA_prach_resources);
+	    }
+	} else {		// RACH is active
+	    LOG_D(MAC,
+		  "[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",
+		  module_idP, frameP, subframeP,
+		  UE_mac_inst[module_idP].RA_window_cnt,
+		  UE_mac_inst[module_idP].RA_tx_frame,
+		  UE_mac_inst[module_idP].RA_tx_subframe);
+
+	    // compute backoff parameters
+	    if (UE_mac_inst[module_idP].RA_backoff_cnt > 0) {
+		frame_diff =
+		    (sframe_t) frameP -
+		    UE_mac_inst[module_idP].RA_backoff_frame;
+
+		if (frame_diff < 0) {
+		    frame_diff = -frame_diff;
+		}
+
+		UE_mac_inst[module_idP].RA_backoff_cnt -=
+		    ((10 * frame_diff) +
+		     (subframeP -
+		      UE_mac_inst[module_idP].RA_backoff_subframe));
+
+		UE_mac_inst[module_idP].RA_backoff_frame = frameP;
+		UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
+	    }
+	    // compute RA window parameters
+	    if (UE_mac_inst[module_idP].RA_window_cnt > 0) {
+		frame_diff =
+		    (frame_t) frameP - UE_mac_inst[module_idP].RA_tx_frame;
+
+		if (frame_diff < 0) {
+		    frame_diff = -frame_diff;
+		}
+
+		UE_mac_inst[module_idP].RA_window_cnt -=
+		    ((10 * frame_diff) +
+		     (subframeP - UE_mac_inst[module_idP].RA_tx_subframe));
+		LOG_D(MAC,
+		      "[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, adjusted window cnt %d\n",
+		      module_idP, frameP, subframeP,
+		      UE_mac_inst[module_idP].RA_window_cnt);
+	    }
+
+	    if ((UE_mac_inst[module_idP].RA_window_cnt <= 0) &&
+		(UE_mac_inst[module_idP].RA_backoff_cnt <= 0)) {
+
+		UE_mac_inst[module_idP].RA_tx_frame = frameP;
+		UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
+		UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER++;
+		UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER += (rach_ConfigCommon->powerRampingParameters.powerRampingStep << 1);	// 2dB increments in ASN.1 definition
+		int preambleTransMax = -1;
+		switch (rach_ConfigCommon->ra_SupervisionInfo.
+			preambleTransMax) {
+		case PreambleTransMax_n3:
+		    preambleTransMax = 3;
+		    break;
+		case PreambleTransMax_n4:
+		    preambleTransMax = 4;
+		    break;
+		case PreambleTransMax_n5:
+		    preambleTransMax = 5;
+		    break;
+		case PreambleTransMax_n6:
+		    preambleTransMax = 6;
+		    break;
+		case PreambleTransMax_n7:
+		    preambleTransMax = 7;
+		    break;
+		case PreambleTransMax_n8:
+		    preambleTransMax = 8;
+		    break;
+		case PreambleTransMax_n10:
+		    preambleTransMax = 10;
+		    break;
+		case PreambleTransMax_n20:
+		    preambleTransMax = 20;
+		    break;
+		case PreambleTransMax_n50:
+		    preambleTransMax = 50;
+		    break;
+		case PreambleTransMax_n100:
+		    preambleTransMax = 100;
+		    break;
+		case PreambleTransMax_n200:
+		    preambleTransMax = 200;
+		    break;
+		}
+
+		if (UE_mac_inst[module_idP].
+		    RA_PREAMBLE_TRANSMISSION_COUNTER == preambleTransMax) {
+		    LOG_D(MAC,
+			  "[UE %d] Frame %d: Maximum number of RACH attempts (%d)\n",
+			  module_idP, frameP, preambleTransMax);
+		    // send message to RRC
+		    UE_mac_inst[module_idP].
+			RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
+		    UE_mac_inst[module_idP].
+			RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER
+			= get_Po_NOMINAL_PUSCH(module_idP, CC_id);
+		}
+
+		UE_mac_inst[module_idP].RA_window_cnt =
+		    2 +
+		    rach_ConfigCommon->ra_SupervisionInfo.
+		    ra_ResponseWindowSize;
+		UE_mac_inst[module_idP].RA_backoff_cnt = 0;
+
+		// Fill in preamble and PRACH resource
+		get_prach_resources(module_idP, CC_id, eNB_indexP,
+				    subframeP, 0, NULL);
+		return (&UE_mac_inst[module_idP].RA_prach_resources);
+	    }
 	}
-	
-	UE_mac_inst[module_idP].RA_window_cnt                    = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
-	UE_mac_inst[module_idP].RA_backoff_cnt                   = 0;
-	
-	// Fill in preamble and PRACH resource
-	get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,0,NULL);
-	return(&UE_mac_inst[module_idP].RA_prach_resources);
-      }
+    } else if (UE_mode == PUSCH) {
+	LOG_D(MAC,
+	      "[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...",
+	      module_idP);
+	AssertFatal(1 == 0, "");
     }
-  } else if (UE_mode == PUSCH) {
-    LOG_D(MAC,"[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...",module_idP);
-    AssertFatal(1==0,"");
-  }
-  
-  return(NULL);
+
+    return (NULL);
 }
diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c
index 62346603e231b7fda6314dbb9fd253f502ee2fc7..6261eaf35690f672225209e7972aa333d6bd9087 100644
--- a/openair2/LAYER2/MAC/rar_tools.c
+++ b/openair2/LAYER2/MAC/rar_tools.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,269 +40,145 @@
 
 #define DEBUG_RAR
 
-extern unsigned int  localRIV2alloc_LUT25[512];
-extern unsigned int  distRIV2alloc_LUT25[512];
+extern unsigned int localRIV2alloc_LUT25[512];
+extern unsigned int distRIV2alloc_LUT25[512];
 extern unsigned short RIV2nb_rb_LUT25[512];
 extern unsigned short RIV2first_rb_LUT25[512];
 extern RAN_CONTEXT_t RC;
 
 //------------------------------------------------------------------------------
-unsigned short fill_rar(
-  const module_id_t module_idP,
-  const int         CC_id,
-  const frame_t     frameP,
-  uint8_t*    const dlsch_buffer,
-  const uint16_t    N_RB_UL,
-  const uint8_t input_buffer_length
-)
+unsigned short
+fill_rar(const module_id_t module_idP,
+	 const int CC_id,
+	 RA_t * ra,
+	 const frame_t frameP,
+	 uint8_t * const dlsch_buffer,
+	 const uint16_t N_RB_UL, const uint8_t input_buffer_length)
 //------------------------------------------------------------------------------
 {
 
-  RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)dlsch_buffer;
-  //  RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
-  uint8_t *rar = (uint8_t *)(dlsch_buffer+1);
-  int i,ra_idx = -1;
-  RA_TEMPLATE *RA_template;
-
-  AssertFatal(CC_id < MAX_NUM_CCs, "CC_id %u < MAX_NUM_CCs %u", CC_id, MAX_NUM_CCs);
-
-  for (i=0; i<NB_RA_PROC_MAX; i++) {
-    if (RC.mac[module_idP]->common_channels[CC_id].RA_template[i].generate_rar == 1) {
-      ra_idx=i;
-      RC.mac[module_idP]->common_channels[CC_id].RA_template[i].generate_rar = 0;
-      break;
+    RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer;
+    uint8_t *rar = (uint8_t *) (dlsch_buffer + 1);
+
+
+    // subheader fixed
+    rarh->E = 0;		// First and last RAR
+    rarh->T = 1;		// 0 for E/T/R/R/BI subheader, 1 for E/T/RAPID subheader
+    rarh->RAPID = ra->preamble_index;	// Respond to Preamble 0 only for the moment
+    rar[4] = (uint8_t) (ra->rnti >> 8);
+    rar[5] = (uint8_t) (ra->rnti & 0xff);
+    //ra->timing_offset = 0;
+    ra->timing_offset /= 16;	//T_A = N_TA/16, where N_TA should be on a 30.72Msps
+    rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4));	// 7 MSBs of timing advance + divide by 4
+    rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0;	// 4 LSBs of timing advance + divide by 4
+    ra->msg3_first_rb = 6;
+    ra->msg3_nb_rb = 1;
+    uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb);	// first PRB only for UL Grant
+    rar[1] |= (rballoc >> 7) & 7;	// Hopping = 0 (bit 3), 3 MSBs of rballoc
+    rar[2] = ((uint8_t) (rballoc & 0xff)) << 1;	// 7 LSBs of rballoc
+    ra->msg3_mcs = 10;
+    ra->msg3_TPC = 3;
+    ra->msg3_ULdelay = 0;
+    ra->msg3_cqireq = 0;
+    rar[2] |= ((ra->msg3_mcs & 0x8) >> 3);	// mcs 10
+    rar[3] =
+	(((ra->msg3_mcs & 0x7) << 5)) | ((ra->msg3_TPC & 7) << 2) |
+	((ra->msg3_ULdelay & 1) << 1) | (ra->msg3_cqireq & 1);
+
+    if (opt_enabled) {
+	trace_pdu(1, dlsch_buffer, input_buffer_length, module_idP, 2, 1,
+		  RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe,
+		  0, 0);
+	LOG_D(OPT,
+	      "[eNB %d][RAPROC] CC_id %d RAR Frame %d trace pdu for rnti %x and  rapid %d size %d\n",
+	      module_idP, CC_id, frameP, ra->rnti, rarh->RAPID,
+	      input_buffer_length);
     }
-  }
-  RA_template = &RC.mac[module_idP]->common_channels[CC_id].RA_template[ra_idx];
- 
-  //DevAssert( ra_idx != -1 );
-  if (ra_idx==-1)
-    return(0);
-
-  // subheader fixed
-  rarh->E                     = 0; // First and last RAR
-  rarh->T                     = 1; // 0 for E/T/R/R/BI subheader, 1 for E/T/RAPID subheader
-  rarh->RAPID                 = RA_template->preamble_index; // Respond to Preamble 0 only for the moment
-  rar[4] = (uint8_t)(RA_template->rnti>>8);
-  rar[5] = (uint8_t)(RA_template->rnti&0xff);
-  //RA_template->timing_offset = 0;
-  RA_template->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
-  rar[0] = (uint8_t)(RA_template->timing_offset>>(2+4)); // 7 MSBs of timing advance + divide by 4
-  rar[1] = (uint8_t)(RA_template->timing_offset<<(4-2))&0xf0; // 4 LSBs of timing advance + divide by 4
-  RA_template->msg3_first_rb=6;
-  RA_template->msg3_nb_rb=1;
-  uint16_t rballoc = mac_computeRIV(N_RB_UL,RA_template->msg3_first_rb,RA_template->msg3_nb_rb); // first PRB only for UL Grant
-  rar[1] |= (rballoc>>7)&7; // Hopping = 0 (bit 3), 3 MSBs of rballoc
-  rar[2] = ((uint8_t)(rballoc&0xff))<<1; // 7 LSBs of rballoc
-  RA_template->msg3_mcs = 10;
-  RA_template->msg3_TPC = 3;
-  RA_template->msg3_ULdelay = 0;
-  RA_template->msg3_cqireq = 0;
-  rar[2] |= ((RA_template->msg3_mcs&0x8)>>3);  // mcs 10
-  rar[3] = (((RA_template->msg3_mcs&0x7)<<5)) | ((RA_template->msg3_TPC&7)<<2) | ((RA_template->msg3_ULdelay&1)<<1) | (RA_template->msg3_cqireq&1);
-
-  LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Generating RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ra_idx %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",
-        module_idP, CC_id,
-        frameP,
-        *(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
-        ra_idx,
-        RA_template->rnti,
-        rarh->RAPID,RC.mac[module_idP]->common_channels[CC_id].RA_template[0].preamble_index,
-        RA_template->timing_offset);
 
-  if (opt_enabled) {
-    trace_pdu(1, dlsch_buffer, input_buffer_length, module_idP, 2, 1,
-        RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe, 0, 0);
-    LOG_D(OPT,"[eNB %d][RAPROC] CC_id %d RAR Frame %d trace pdu for rnti %x and  rapid %d size %d\n",
-          module_idP, CC_id, frameP, RA_template->rnti,
-          rarh->RAPID, input_buffer_length);
-  }
-
-  return(RA_template->rnti);
+    return (ra->rnti);
 }
 
 #ifdef Rel14
 //------------------------------------------------------------------------------
-unsigned short fill_rar_br(eNB_MAC_INST *eNB,
-			   int CC_id,
-			   RA_TEMPLATE        *RA_template,      
-			   const frame_t      frameP,
-			   const sub_frame_t  subframeP,
-			   uint8_t*    const  dlsch_buffer,
-			   const uint8_t      ce_level
-)
+unsigned short
+fill_rar_br(eNB_MAC_INST * eNB,
+	    int CC_id,
+	    RA_t * ra,
+	    const frame_t frameP,
+	    const sub_frame_t subframeP,
+	    uint8_t * const dlsch_buffer, const uint8_t ce_level)
 //------------------------------------------------------------------------------
 {
 
-  RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)dlsch_buffer;
-  COMMON_channels_t *cc = &eNB->common_channels[CC_id];
-  uint8_t *rar = (uint8_t *)(dlsch_buffer+1);
-  //  uint8_t nb,reps;
-  uint8_t rballoc;
-  uint8_t mcs,TPC,ULdelay,cqireq;
-  int input_buffer_length;
-
+    RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer;
+    COMMON_channels_t *cc = &eNB->common_channels[CC_id];
+    uint8_t *rar = (uint8_t *) (dlsch_buffer + 1);
+    //  uint8_t nb,reps;
+    uint8_t rballoc;
+    uint8_t mcs, TPC, ULdelay, cqireq;
+    int input_buffer_length;
 
-  AssertFatal(RA_template != NULL, "RA is null \n");
 
-  // subheader fixed
-  rarh->E                     = 0; // First and last RAR
-  rarh->T                     = 1; // 0 for E/T/R/R/BI subheader, 1 for E/T/RAPID subheader
-  rarh->RAPID                 = RA_template->preamble_index; // Respond to Preamble 0 only for the moment
-  RA_template->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
-  rar[0] = (uint8_t)(RA_template->timing_offset>>(2+4)); // 7 MSBs of timing advance + divide by 4
-  rar[1] = (uint8_t)(RA_template->timing_offset<<(4-2))&0xf0; // 4 LSBs of timing advance + divide by 4
+    AssertFatal(ra != NULL, "RA is null \n");
 
-  int N_NB_index;
+    // subheader fixed
+    rarh->E = 0;		// First and last RAR
+    rarh->T = 1;		// 0 for E/T/R/R/BI subheader, 1 for E/T/RAPID subheader
+    rarh->RAPID = ra->preamble_index;	// Respond to Preamble 0 only for the moment
+    ra->timing_offset /= 16;	//T_A = N_TA/16, where N_TA should be on a 30.72Msps
+    rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4));	// 7 MSBs of timing advance + divide by 4
+    rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0;	// 4 LSBs of timing advance + divide by 4
 
-  AssertFatal(1==0,"RAR for BL/CE Still to be finished ...\n"); 
+    int N_NB_index;
 
-  // Copy the Msg2 narrowband
-  RA_template->msg34_narrowband = RA_template->msg2_narrowband; 
+    AssertFatal(1 == 0, "RAR for BL/CE Still to be finished ...\n");
 
-  if (ce_level<2) { //CE Level 0,1, CEmodeA
-    input_buffer_length =6;
+    // Copy the Msg2 narrowband
+    ra->msg34_narrowband = ra->msg2_narrowband;
 
-    N_NB_index = get_numnarrowbandbits(cc->mib->message.dl_Bandwidth);
+    if (ce_level < 2) {		//CE Level 0,1, CEmodeA
+	input_buffer_length = 6;
 
-    rar[4] = (uint8_t)(RA_template->rnti>>8);
-    rar[5] = (uint8_t)(RA_template->rnti&0xff);
-    //cc->RA_template[ra_idx].timing_offset = 0;
-    //    nb      = 0;
-    rballoc = mac_computeRIV(6,1+ce_level,1); // one PRB only for UL Grant in position 1+ce_level within Narrowband
-    rar[1] |= (rballoc&15)<<(4-N_NB_index); // Hopping = 0 (bit 3), 3 MSBs of rballoc
+	N_NB_index = get_numnarrowbandbits(cc->mib->message.dl_Bandwidth);
 
-    //    reps    = 4;
-    mcs     = 7;
-    TPC     = 3; // no power increase
-    ULdelay = 0;
-    cqireq = 0;
-    rar[2] |= ((mcs&0x8)>>3);  // mcs 10
-    rar[3] = (((mcs&0x7)<<5)) | ((TPC&7)<<2) | ((ULdelay&1)<<1) | (cqireq&1);
-  }
-  else { // CE level 2,3 => CEModeB
+	rar[4] = (uint8_t) (ra->rnti >> 8);
+	rar[5] = (uint8_t) (ra->rnti & 0xff);
+	//cc->ra[ra_idx].timing_offset = 0;
+	//    nb      = 0;
+	rballoc = mac_computeRIV(6, 1 + ce_level, 1);	// one PRB only for UL Grant in position 1+ce_level within Narrowband
+	rar[1] |= (rballoc & 15) << (4 - N_NB_index);	// Hopping = 0 (bit 3), 3 MSBs of rballoc
 
-    input_buffer_length =5;
+	//    reps    = 4;
+	mcs = 7;
+	TPC = 3;		// no power increase
+	ULdelay = 0;
+	cqireq = 0;
+	rar[2] |= ((mcs & 0x8) >> 3);	// mcs 10
+	rar[3] =
+	    (((mcs & 0x7) << 5)) | ((TPC & 7) << 2) | ((ULdelay & 1) << 1)
+	    | (cqireq & 1);
+    } else {			// CE level 2,3 => CEModeB
 
-    rar[3] = (uint8_t)(RA_template->rnti>>8);
-    rar[4] = (uint8_t)(RA_template->rnti&0xff);
-  }
-  LOG_D(MAC,"[RAPROC] Frame %d Generating RAR BR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ce_level %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",
-        frameP,
-        *(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
-        ce_level,
-        RA_template->rnti,
-        rarh->RAPID,RA_template->preamble_index,
-        RA_template->timing_offset);
+	input_buffer_length = 5;
 
-  if (opt_enabled) {
-    trace_pdu(1, dlsch_buffer, input_buffer_length, eNB->Mod_id, 2, 1,
-        eNB->frame, eNB->subframe, 0, 0);
-    LOG_D(OPT,"[RAPROC] RAR Frame %d trace pdu for rnti %x and  rapid %d size %d\n",
-          frameP, RA_template->rnti,
-          rarh->RAPID, input_buffer_length);
-  }
+	rar[3] = (uint8_t) (ra->rnti >> 8);
+	rar[4] = (uint8_t) (ra->rnti & 0xff);
+    }
+    LOG_D(MAC,
+	  "[RAPROC] Frame %d Generating RAR BR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ce_level %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",
+	  frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2], rar[3],
+	  rar[4], rar[5], ce_level, ra->rnti, rarh->RAPID,
+	  ra->preamble_index, ra->timing_offset);
+
+    if (opt_enabled) {
+	trace_pdu(1, dlsch_buffer, input_buffer_length, eNB->Mod_id, 2, 1,
+		  eNB->frame, eNB->subframe, 0, 0);
+	LOG_D(OPT,
+	      "[RAPROC] RAR Frame %d trace pdu for rnti %x and  rapid %d size %d\n",
+	      frameP, ra->rnti, rarh->RAPID, input_buffer_length);
+    }
 
-  return(RA_template->rnti);
+    return (ra->rnti);
 }
 #endif
 
-//------------------------------------------------------------------------------
-uint16_t
-ue_process_rar(
-  const module_id_t module_idP,
-  const int CC_id,
-  const frame_t frameP,
-  const rnti_t ra_rnti,
-  uint8_t* const dlsch_buffer,
-  rnti_t* const t_crnti,
-  const uint8_t preamble_index,
-  uint8_t* selected_rar_buffer // output argument for storing the selected RAR header and RAR payload
-)
-//------------------------------------------------------------------------------
-{
-	uint16_t ret = 0; // return value
-
-  RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)dlsch_buffer;
-  //  RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
-  uint8_t *rar = (uint8_t *)(dlsch_buffer+1);
-
-        // get the last RAR payload for working with CMW500
-	uint8_t n_rarpy = 0; // number of RAR payloads
-	uint8_t n_rarh = 0; // number of MAC RAR subheaders
-	uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs
-	while (1) {
-		n_rarh++;
-		if (rarh->T == 1) {
-			n_rarpy++;
-			LOG_D(MAC, "RAPID %d\n", rarh->RAPID);
-		}
-
-		if (rarh->RAPID == preamble_index) {
-			LOG_D(PHY, "Found RAR with the intended RAPID %d\n", rarh->RAPID);
-			rar = (uint8_t *)(dlsch_buffer+n_rarh + (n_rarpy-1)*6);
-			break;
-		}
-
-		if (abs((int)rarh->RAPID - (int)preamble_index) < abs((int)best_rx_rapid - (int)preamble_index)) {
-			best_rx_rapid = rarh->RAPID;
-			rar = (uint8_t *)(dlsch_buffer+n_rarh + (n_rarpy-1)*6);
-		}
-
-		if (rarh->E == 0) {
-			LOG_I(PHY, "No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n", best_rx_rapid);
-			break;
-		} else {
-			rarh++;
-		}
-	};
-	LOG_D(MAC, "number of RAR subheader %d; number of RAR pyloads %d\n", n_rarh, n_rarpy);
-
-  if (CC_id>0) {
-    LOG_W(MAC,"Should not have received RAR on secondary CCs! \n");
-    return(0xffff);
-  }
-
-  LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",module_idP,frameP,
-        *(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
-        rarh->RAPID,preamble_index);
-#ifdef DEBUG_RAR
-  LOG_D(MAC,"[UE %d][RAPROC] rarh->E %d\n",module_idP,rarh->E);
-  LOG_D(MAC,"[UE %d][RAPROC] rarh->T %d\n",module_idP,rarh->T);
-  LOG_D(MAC,"[UE %d][RAPROC] rarh->RAPID %d\n",module_idP,rarh->RAPID);
-
-  //  LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R);
-  LOG_D(MAC,"[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",module_idP,(((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
-  //  LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag);
-  //  LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc);
-  //  LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs);
-  //  LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC);
-  //  LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay);
-  //  LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req);
-  LOG_D(MAC,"[UE %d][RAPROC] rar->t_crnti %x\n",module_idP,(uint16_t)rar[5]+(rar[4]<<8));
-#endif
-
-  if (opt_enabled) {
-    LOG_D(OPT,"[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n",
-          module_idP, CC_id, frameP, ra_rnti);
-    trace_pdu(1, (uint8_t*)dlsch_buffer, n_rarh + n_rarpy*6, module_idP, 2, ra_rnti,
-        UE_mac_inst[module_idP].rxFrame, UE_mac_inst[module_idP].rxSubframe, 0, 0);
-  }
-
-  if (preamble_index == rarh->RAPID) {
-    *t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti;
-    UE_mac_inst[module_idP].crnti = *t_crnti;//rar->t_crnti;
-    //return(rar->Timing_Advance_Command);
-    ret = ((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
-  } else {
-    UE_mac_inst[module_idP].crnti=0;
-    ret = (0xffff);
-  }
-
-  // move the selected RAR to the front of the RA_PDSCH buffer
-  memcpy(selected_rar_buffer+0, (uint8_t*)rarh, 1);
-  memcpy(selected_rar_buffer+1, (uint8_t*)rar , 6);
-
-  return ret;
-
-}
diff --git a/openair2/LAYER2/MAC/rar_tools_ue.c b/openair2/LAYER2/MAC/rar_tools_ue.c
new file mode 100644
index 0000000000000000000000000000000000000000..ab193c7a66b2422473dd208af125fc815c4a7259
--- /dev/null
+++ b/openair2/LAYER2/MAC/rar_tools_ue.c
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file rar_tools.c
+ * \brief random access tools
+ * \author Raymond Knopp and navid nikaein
+ * \date 2011 - 2014
+ * \version 1.0
+ * @ingroup _mac
+
+ */
+
+#include "defs.h"
+#include "proto.h"
+#include "extern.h"
+#include "SIMULATION/TOOLS/defs.h"
+#include "UTIL/LOG/log.h"
+#include "OCG.h"
+#include "OCG_extern.h"
+#include "UTIL/OPT/opt.h"
+#include "common/ran_context.h"
+
+#define DEBUG_RAR
+
+//------------------------------------------------------------------------------
+uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const frame_t frameP, const rnti_t ra_rnti, uint8_t * const dlsch_buffer, rnti_t * const t_crnti, const uint8_t preamble_index, uint8_t * selected_rar_buffer	// output argument for storing the selected RAR header and RAR payload
+    )
+//------------------------------------------------------------------------------
+{
+    uint16_t ret = 0;		// return value
+
+    RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer;
+    //  RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
+    uint8_t *rar = (uint8_t *) (dlsch_buffer + 1);
+
+    // get the last RAR payload for working with CMW500
+    uint8_t n_rarpy = 0;	// number of RAR payloads
+    uint8_t n_rarh = 0;		// number of MAC RAR subheaders
+    uint8_t best_rx_rapid = -1;	// the closest RAPID receive from all RARs
+    while (1) {
+	n_rarh++;
+	if (rarh->T == 1) {
+	    n_rarpy++;
+	    LOG_D(MAC, "RAPID %d\n", rarh->RAPID);
+	}
+
+	if (rarh->RAPID == preamble_index) {
+	    LOG_D(PHY, "Found RAR with the intended RAPID %d\n",
+		  rarh->RAPID);
+	    rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
+	    break;
+	}
+
+	if (abs((int) rarh->RAPID - (int) preamble_index) <
+	    abs((int) best_rx_rapid - (int) preamble_index)) {
+	    best_rx_rapid = rarh->RAPID;
+	    rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
+	}
+
+	if (rarh->E == 0) {
+	    LOG_I(PHY,
+		  "No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n",
+		  best_rx_rapid);
+	    break;
+	} else {
+	    rarh++;
+	}
+    };
+    LOG_D(MAC, "number of RAR subheader %d; number of RAR pyloads %d\n",
+	  n_rarh, n_rarpy);
+
+    if (CC_id > 0) {
+	LOG_W(MAC, "Should not have received RAR on secondary CCs! \n");
+	return (0xffff);
+    }
+
+    LOG_I(MAC,
+	  "[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
+	  module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2],
+	  rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
+#ifdef DEBUG_RAR
+    LOG_D(MAC, "[UE %d][RAPROC] rarh->E %d\n", module_idP, rarh->E);
+    LOG_D(MAC, "[UE %d][RAPROC] rarh->T %d\n", module_idP, rarh->T);
+    LOG_D(MAC, "[UE %d][RAPROC] rarh->RAPID %d\n", module_idP,
+	  rarh->RAPID);
+
+    //  LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R);
+    LOG_D(MAC, "[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",
+	  module_idP, (((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
+    //  LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag);
+    //  LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc);
+    //  LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs);
+    //  LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC);
+    //  LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay);
+    //  LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req);
+    LOG_D(MAC, "[UE %d][RAPROC] rar->t_crnti %x\n", module_idP,
+	  (uint16_t) rar[5] + (rar[4] << 8));
+#endif
+
+    if (opt_enabled) {
+	LOG_D(OPT,
+	      "[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n",
+	      module_idP, CC_id, frameP, ra_rnti);
+	trace_pdu(1, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6,
+		  module_idP, 2, ra_rnti, UE_mac_inst[module_idP].rxFrame,
+		  UE_mac_inst[module_idP].rxSubframe, 0, 0);
+    }
+
+    if (preamble_index == rarh->RAPID) {
+	*t_crnti = (uint16_t) rar[5] + (rar[4] << 8);	//rar->t_crnti;
+	UE_mac_inst[module_idP].crnti = *t_crnti;	//rar->t_crnti;
+	//return(rar->Timing_Advance_Command);
+	ret = ((((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
+    } else {
+	UE_mac_inst[module_idP].crnti = 0;
+	ret = (0xffff);
+    }
+
+    // move the selected RAR to the front of the RA_PDSCH buffer
+    memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
+    memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6);
+
+    return ret;
+
+}
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index 3c2faf725acd9841d43332de161a36e42f1f1045..5ca6d10bb530f4ac19246777c488a24d6c8f3b4e 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -37,10 +37,10 @@
 #include "defs.h"
 #include "proto.h"
 #ifdef PHY_EMUL
-# include "SIMULATION/PHY_EMULATION/impl_defs.h"
+#include "SIMULATION/PHY_EMULATION/impl_defs.h"
 #else
-# include "SCHED/defs.h"
-# include "PHY/impl_defs_top.h"
+#include "SCHED/defs.h"
+#include "PHY/impl_defs_top.h"
 #endif
 #include "PHY_INTERFACE/extern.h"
 #include "COMMON/mac_rrc_primitives.h"
@@ -54,1761 +54,2089 @@
 #include "OCG_extern.h"
 
 #ifdef PHY_EMUL
-# include "SIMULATION/simulation_defs.h"
+#include "SIMULATION/simulation_defs.h"
 #endif
 #include "pdcp.h"
 
 #if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+#include "intertask_interface.h"
 #endif
 
 #include "assertions.h"
 
-#include "SIMULATION/TOOLS/defs.h" // for taus
+#include "SIMULATION/TOOLS/defs.h"	// for taus
 
 #define DEBUG_HEADER_PARSING 1
 #define ENABLE_MAC_PAYLOAD_DEBUG 1
 
 extern uint8_t usim_test;
 
-/*
-#ifndef USER_MODE
-#define msg debug_msg
-#endif
- */
 mapping BSR_names[] = {
-  {"NONE", 0},
-  {"SHORT BSR", 1},
-  {"TRUNCATED BSR", 2},
-  {"LONG BSR", 3},
-  {"PADDING BSR", 4},
-  {NULL, -1}
+    {"NONE", 0},
+    {"SHORT BSR", 1},
+    {"TRUNCATED BSR", 2},
+    {"LONG BSR", 3},
+    {"PADDING BSR", 4},
+    {NULL, -1}
 };
 
 
 void ue_init_mac(module_id_t module_idP)
 {
-  int i;
-  // default values as deined in 36.331 sec 9.2.2
-  LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP);
-  //UE_mac_inst[module_idP].scheduling_info.macConfig=NULL;
-  UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer= RetxBSR_Timer_r12_sf10240;
-  UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer=PeriodicBSR_Timer_r12_infinity;
-  UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
-  UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
-  UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
-  UE_mac_inst[module_idP].PHR_state = MAC_MainConfig__phr_Config_PR_setup;
-  UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0;
-  UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer=0;
-  UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running=0;
-  UE_mac_inst[module_idP].scheduling_info.maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
-  UE_mac_inst[module_idP].scheduling_info.ttiBundling=0;
-  UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10=0;
-  UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10=0;
-  UE_mac_inst[module_idP].scheduling_info.drx_config=NULL;
-  UE_mac_inst[module_idP].scheduling_info.phr_config=NULL;
-  // set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value configured by the NW.
-  UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF  =  MAC_UE_BSR_TIMER_NOT_RUNNING;
-  UE_mac_inst[module_idP].scheduling_info.retxBSR_SF     =  MAC_UE_BSR_TIMER_NOT_RUNNING;
-  UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
-  
-  UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF =  get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer);
-  UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF =  get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer);
-  UE_mac_inst[module_idP].scheduling_info.PathlossChange_db =  get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange);
-  UE_mac_inst[module_idP].PHR_reporting_active = 0;
-
-  for (i=0; i < MAX_NUM_LCID; i++) {
-    LOG_D(MAC,"[UE%d] Applying default logical channel config for LCGID %d\n",module_idP,i);
-    UE_mac_inst[module_idP].scheduling_info.Bj[i]=-1;
-    UE_mac_inst[module_idP].scheduling_info.bucket_size[i]=-1;
-
-    if (i < DTCH) { // initilize all control channels lcgid to 0
-      UE_mac_inst[module_idP].scheduling_info.LCGID[i]=0;
-    } else { // initialize all the data channels lcgid to 1
-      UE_mac_inst[module_idP].scheduling_info.LCGID[i]=1;
-    }
-
-    UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=LCID_EMPTY;
-    UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[i] = 0;
-  }
+    int i;
+    // default values as deined in 36.331 sec 9.2.2
+    LOG_I(MAC, "[UE%d] Applying default macMainConfig\n", module_idP);
+    //UE_mac_inst[module_idP].scheduling_info.macConfig=NULL;
+    UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer =
+	RetxBSR_Timer_r12_sf10240;
+    UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer =
+	PeriodicBSR_Timer_r12_infinity;
+    UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer =
+	MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
+    UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer =
+	MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
+    UE_mac_inst[module_idP].scheduling_info.PathlossChange_db =
+	MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
+    UE_mac_inst[module_idP].PHR_state =
+	MAC_MainConfig__phr_Config_PR_setup;
+    UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0;
+    UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer = 0;
+    UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running = 0;
+    UE_mac_inst[module_idP].scheduling_info.maxHARQ_Tx =
+	MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
+    UE_mac_inst[module_idP].scheduling_info.ttiBundling = 0;
+    UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10 = 0;
+    UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10 = 0;
+    UE_mac_inst[module_idP].scheduling_info.drx_config = NULL;
+    UE_mac_inst[module_idP].scheduling_info.phr_config = NULL;
+    // set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value configured by the NW.
+    UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF =
+	MAC_UE_BSR_TIMER_NOT_RUNNING;
+    UE_mac_inst[module_idP].scheduling_info.retxBSR_SF =
+	MAC_UE_BSR_TIMER_NOT_RUNNING;
+    UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
+
+    UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF =
+	get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].
+				  scheduling_info.periodicPHR_Timer);
+    UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF =
+	get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].
+				 scheduling_info.prohibitPHR_Timer);
+    UE_mac_inst[module_idP].scheduling_info.PathlossChange_db =
+	get_db_dl_PathlossChange(UE_mac_inst[module_idP].
+				 scheduling_info.PathlossChange);
+    UE_mac_inst[module_idP].PHR_reporting_active = 0;
+
+    for (i = 0; i < MAX_NUM_LCID; i++) {
+	LOG_D(MAC,
+	      "[UE%d] Applying default logical channel config for LCGID %d\n",
+	      module_idP, i);
+	UE_mac_inst[module_idP].scheduling_info.Bj[i] = -1;
+	UE_mac_inst[module_idP].scheduling_info.bucket_size[i] = -1;
+
+	if (i < DTCH) {		// initilize all control channels lcgid to 0
+	    UE_mac_inst[module_idP].scheduling_info.LCGID[i] = 0;
+	} else {		// initialize all the data channels lcgid to 1
+	    UE_mac_inst[module_idP].scheduling_info.LCGID[i] = 1;
+	}
+
+	UE_mac_inst[module_idP].scheduling_info.LCID_status[i] =
+	    LCID_EMPTY;
+	UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[i] = 0;
+    }
 
 #ifdef CBA
 
-  for (i=0; i <NUM_MAX_CBA_GROUP; i++) {
-    UE_mac_inst[module_idP].cba_last_access[i]= round(uniform_rngen(1,30));
-  }
+    for (i = 0; i < NUM_MAX_CBA_GROUP; i++) {
+	UE_mac_inst[module_idP].cba_last_access[i] =
+	    round(uniform_rngen(1, 30));
+    }
 
 #endif
 }
 
 
 unsigned char *parse_header(unsigned char *mac_header,
-                            unsigned char *num_ce,
-                            unsigned char *num_sdu,
-                            unsigned char *rx_ces,
-                            unsigned char *rx_lcids,
-                            unsigned short *rx_lengths,
-                            unsigned short tb_length)
+			    unsigned char *num_ce,
+			    unsigned char *num_sdu,
+			    unsigned char *rx_ces,
+			    unsigned char *rx_lcids,
+			    unsigned short *rx_lengths,
+			    unsigned short tb_length)
 {
 
-  unsigned char not_done=1,num_ces=0,num_cont_res = 0,num_padding = 0,num_sdus=0,lcid, num_sdu_cnt;
-  unsigned char *mac_header_ptr = mac_header;
-  unsigned short length,ce_len=0;
-
-  while (not_done==1) {
-
-    if (((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E == 0) {
-      //      printf("E=0\n");
-      not_done = 0;
-    }
-
-    lcid = ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID;
-
-    if (lcid < UE_CONT_RES) {
-      //printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]);
-      if (not_done==0) {// last MAC SDU, length is implicit
-        mac_header_ptr++;
-        length = tb_length-(mac_header_ptr-mac_header)-ce_len;
-
-        for (num_sdu_cnt=0; num_sdu_cnt < num_sdus ; num_sdu_cnt++) {
-          length -= rx_lengths[num_sdu_cnt];
-        }
-      } else {
-        if (((SCH_SUBHEADER_LONG *)mac_header_ptr)->F == 1) {
-          length = ((((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_MSB & 0x7f ) << 8 ) | (((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_LSB & 0xff);
-          mac_header_ptr += 3;
+    unsigned char not_done = 1, num_ces = 0, num_cont_res =
+	0, num_padding = 0, num_sdus = 0, lcid, num_sdu_cnt;
+    unsigned char *mac_header_ptr = mac_header;
+    unsigned short length, ce_len = 0;
+
+    while (not_done == 1) {
+
+	if (((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E == 0) {
+	    //      printf("E=0\n");
+	    not_done = 0;
+	}
+
+	lcid = ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID;
+
+	if (lcid < UE_CONT_RES) {
+	    //printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]);
+	    if (not_done == 0) {	// last MAC SDU, length is implicit
+		mac_header_ptr++;
+		length =
+		    tb_length - (mac_header_ptr - mac_header) - ce_len;
+
+		for (num_sdu_cnt = 0; num_sdu_cnt < num_sdus;
+		     num_sdu_cnt++) {
+		    length -= rx_lengths[num_sdu_cnt];
+		}
+	    } else {
+		if (((SCH_SUBHEADER_LONG *) mac_header_ptr)->F == 1) {
+		    length =
+			((((SCH_SUBHEADER_LONG *) mac_header_ptr)->
+			  L_MSB & 0x7f)
+			 << 8) | (((SCH_SUBHEADER_LONG *) mac_header_ptr)->
+				  L_LSB & 0xff);
+		    mac_header_ptr += 3;
 #ifdef DEBUG_HEADER_PARSING
-          LOG_D(MAC,"[UE] parse long sdu, size %x \n",length);
+		    LOG_D(MAC, "[UE] parse long sdu, size %x \n", length);
 #endif
 
-        }  else { //if (((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F == 0) {
-          length = ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L;
-          mac_header_ptr += 2;
-        }
-      }
+		} else {	//if (((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F == 0) {
+		    length = ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L;
+		    mac_header_ptr += 2;
+		}
+	    }
 
 #ifdef DEBUG_HEADER_PARSING
-      LOG_D(MAC,"[UE] sdu %d lcid %d length %d (offset now %ld)\n",
-            num_sdus,lcid,length,mac_header_ptr-mac_header);
+	    LOG_D(MAC, "[UE] sdu %d lcid %d length %d (offset now %ld)\n",
+		  num_sdus, lcid, length, mac_header_ptr - mac_header);
 #endif
-      rx_lcids[num_sdus] = lcid;
-      rx_lengths[num_sdus] = length;
-      num_sdus++;
-    } else { // This is a control element subheader
-      if (lcid == SHORT_PADDING) {
-    	num_padding ++;
-        mac_header_ptr++;
-      } else {
-        rx_ces[num_ces] = lcid;
-        num_ces++;
-        mac_header_ptr ++;
-
-        if (lcid==TIMING_ADV_CMD) {
-          ce_len++;
-        } else if (lcid==UE_CONT_RES) {
-
-        	// FNA: check MAC Header is one of thoses defined in Annex B of 36.321
-        	// Check there is only 1 Contention Resolution
-        	if (num_cont_res) {
-        		LOG_W(MAC,"[UE] Msg4 Wrong received format: More than 1 Contention Resolution\n");
-        		// exit parsing
-        		return NULL;
-
-        	}
-
-        	// UE_CONT_RES shall never be the last subheader unless this is the only MAC subheader
-        	if ((not_done == 0) && ((num_sdus) || (num_ces > 1) || (num_padding))) {
-        		LOG_W(MAC,"[UE] Msg4 Wrong received format: Contention Resolution after num_ces=%d num_sdus=%d num_padding=%d\n",num_ces,num_sdus,num_padding);
-        		// exit parsing
-        		return NULL;
-        	}
-          num_cont_res ++;
-          ce_len+=6;
-        }
-      }
+	    rx_lcids[num_sdus] = lcid;
+	    rx_lengths[num_sdus] = length;
+	    num_sdus++;
+	} else {		// This is a control element subheader
+	    if (lcid == SHORT_PADDING) {
+		num_padding++;
+		mac_header_ptr++;
+	    } else {
+		rx_ces[num_ces] = lcid;
+		num_ces++;
+		mac_header_ptr++;
+
+		if (lcid == TIMING_ADV_CMD) {
+		    ce_len++;
+		} else if (lcid == UE_CONT_RES) {
+
+		    // FNA: check MAC Header is one of thoses defined in Annex B of 36.321
+		    // Check there is only 1 Contention Resolution
+		    if (num_cont_res) {
+			LOG_W(MAC,
+			      "[UE] Msg4 Wrong received format: More than 1 Contention Resolution\n");
+			// exit parsing
+			return NULL;
+
+		    }
+		    // UE_CONT_RES shall never be the last subheader unless this is the only MAC subheader
+		    if ((not_done == 0)
+			&& ((num_sdus) || (num_ces > 1) || (num_padding))) {
+			LOG_W(MAC,
+			      "[UE] Msg4 Wrong received format: Contention Resolution after num_ces=%d num_sdus=%d num_padding=%d\n",
+			      num_ces, num_sdus, num_padding);
+			// exit parsing
+			return NULL;
+		    }
+		    num_cont_res++;
+		    ce_len += 6;
+		}
+	    }
 
 #ifdef DEBUG_HEADER_PARSING
-      LOG_D(MAC,"[UE] ce %d lcid %d (offset now %ld)\n",num_ces,lcid,mac_header_ptr-mac_header);
+	    LOG_D(MAC, "[UE] ce %d lcid %d (offset now %ld)\n", num_ces,
+		  lcid, mac_header_ptr - mac_header);
 #endif
+	}
     }
-  }
 
-  *num_ce = num_ces;
-  *num_sdu = num_sdus;
+    *num_ce = num_ces;
+    *num_sdu = num_sdus;
 
-  return(mac_header_ptr);
+    return (mac_header_ptr);
 }
 
-uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_id,uint16_t rnti, sub_frame_t subframe)
+uint32_t
+ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
+	  uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe)
 {
 
-  // no UL-SCH resources available for this tti && UE has a valid PUCCH resources for SR configuration for this tti
-  //  int MGL=6;// measurement gap length in ms
-  int MGRP       = 0; // measurement gap repetition period in ms
-  int gapOffset  = -1;
-  int T          = 0;
-
-  DevCheck(module_idP < (int)NB_UE_INST, module_idP, NB_UE_INST, 0);
-
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
-
-  // determin the measurement gap
-  if (UE_mac_inst[module_idP].measGapConfig !=NULL) {
-    if (UE_mac_inst[module_idP].measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) {
-      MGRP= 40;
-      gapOffset= UE_mac_inst[module_idP].measGapConfig->choice.setup.gapOffset.choice.gp0;
-    } else if (UE_mac_inst[module_idP].measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) {
-      MGRP= 80;
-      gapOffset= UE_mac_inst[module_idP].measGapConfig->choice.setup.gapOffset.choice.gp1;
-    } else {
-      LOG_W(MAC, "Measurement GAP offset is unknown\n");
-    }
-
-    T=MGRP/10;
-    DevAssert( T != 0 );
-
-    //check the measurement gap and sr prohibit timer
-    if ((subframe ==  gapOffset %10) && ((frameP %T) == (floor(gapOffset/10)))
-        && (UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running ==0)) {
-      UE_mac_inst[module_idP].scheduling_info.SR_pending=1;
-      return(0);
+    // no UL-SCH resources available for this tti && UE has a valid PUCCH resources for SR configuration for this tti
+    //  int MGL=6;// measurement gap length in ms
+    int MGRP = 0;		// measurement gap repetition period in ms
+    int gapOffset = -1;
+    int T = 0;
+
+    DevCheck(module_idP < (int) NB_UE_INST, module_idP, NB_UE_INST, 0);
+
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
+
+    // determin the measurement gap
+    if (UE_mac_inst[module_idP].measGapConfig != NULL) {
+	if (UE_mac_inst[module_idP].measGapConfig->choice.setup.
+	    gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) {
+	    MGRP = 40;
+	    gapOffset =
+		UE_mac_inst[module_idP].measGapConfig->choice.
+		setup.gapOffset.choice.gp0;
+	} else if (UE_mac_inst[module_idP].measGapConfig->choice.
+		   setup.gapOffset.present ==
+		   MeasGapConfig__setup__gapOffset_PR_gp1) {
+	    MGRP = 80;
+	    gapOffset =
+		UE_mac_inst[module_idP].measGapConfig->choice.
+		setup.gapOffset.choice.gp1;
+	} else {
+	    LOG_W(MAC, "Measurement GAP offset is unknown\n");
+	}
+
+	T = MGRP / 10;
+	DevAssert(T != 0);
+
+	//check the measurement gap and sr prohibit timer
+	if ((subframe == gapOffset % 10)
+	    && ((frameP % T) == (floor(gapOffset / 10)))
+	    && (UE_mac_inst[module_idP].
+		scheduling_info.sr_ProhibitTimer_Running == 0)) {
+	    UE_mac_inst[module_idP].scheduling_info.SR_pending = 1;
+	    return (0);
+	}
     }
-  }
 
-  if ((UE_mac_inst[module_idP].physicalConfigDedicated != NULL) &&
-      (UE_mac_inst[module_idP].scheduling_info.SR_pending==1) &&
-      (UE_mac_inst[module_idP].scheduling_info.SR_COUNTER <
-       (1<<(2+UE_mac_inst[module_idP].physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax)))
-     ) {
-    LOG_D(MAC,"[UE %d][SR %x] Frame %d subframe %d PHY asks for SR (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d\n",
-          module_idP,rnti,frameP,subframe,
-          UE_mac_inst[module_idP].scheduling_info.SR_COUNTER,
-          (1<<(2+UE_mac_inst[module_idP].physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax)),
-          UE_mac_inst[module_idP].scheduling_info.SR_pending);
-
-    UE_mac_inst[module_idP].scheduling_info.SR_COUNTER++;
-
-    // start the sr-prohibittimer : rel 9 and above
-    if (UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer > 0) { // timer configured
-      UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer--;
-      UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running=1;
+    if ((UE_mac_inst[module_idP].physicalConfigDedicated != NULL) &&
+	(UE_mac_inst[module_idP].scheduling_info.SR_pending == 1) &&
+	(UE_mac_inst[module_idP].scheduling_info.SR_COUNTER <
+	 (1 <<
+	  (2 +
+	   UE_mac_inst[module_idP].
+	   physicalConfigDedicated->schedulingRequestConfig->choice.setup.
+	   dsr_TransMax)))) {
+	LOG_D(MAC,
+	      "[UE %d][SR %x] Frame %d subframe %d PHY asks for SR (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d\n",
+	      module_idP, rnti, frameP, subframe,
+	      UE_mac_inst[module_idP].scheduling_info.SR_COUNTER,
+	      (1 <<
+	       (2 +
+		UE_mac_inst[module_idP].
+		physicalConfigDedicated->schedulingRequestConfig->choice.
+		setup.dsr_TransMax)),
+	      UE_mac_inst[module_idP].scheduling_info.SR_pending);
+
+	UE_mac_inst[module_idP].scheduling_info.SR_COUNTER++;
+
+	// start the sr-prohibittimer : rel 9 and above
+	if (UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer > 0) {	// timer configured
+	    UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer--;
+	    UE_mac_inst[module_idP].scheduling_info.
+		sr_ProhibitTimer_Running = 1;
+	} else {
+	    UE_mac_inst[module_idP].scheduling_info.
+		sr_ProhibitTimer_Running = 0;
+	}
+
+	LOG_D(MAC,
+	      "[UE %d][SR %x] Frame %d subframe %d send SR indication (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d\n",
+	      module_idP, rnti, frameP, subframe,
+	      UE_mac_inst[module_idP].scheduling_info.SR_COUNTER,
+	      (1 <<
+	       (2 +
+		UE_mac_inst[module_idP].
+		physicalConfigDedicated->schedulingRequestConfig->choice.
+		setup.dsr_TransMax)),
+	      UE_mac_inst[module_idP].scheduling_info.SR_pending);
+
+	//UE_mac_inst[module_idP].ul_active =1;
+	return (1);		//instruct phy to signal SR
     } else {
-      UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running=0;
-    }
-
-    LOG_D(MAC,"[UE %d][SR %x] Frame %d subframe %d send SR indication (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d\n",
-          module_idP,rnti,frameP,subframe,
-          UE_mac_inst[module_idP].scheduling_info.SR_COUNTER,
-          (1<<(2+UE_mac_inst[module_idP].physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax)),
-          UE_mac_inst[module_idP].scheduling_info.SR_pending);
-
-    //UE_mac_inst[module_idP].ul_active =1;
-    return(1); //instruct phy to signal SR
-  } else {
-    // notify RRC to relase PUCCH/SRS
-    // clear any configured dl/ul
-    // initiate RA
-      if (UE_mac_inst[module_idP].scheduling_info.SR_pending){
-          // release all pucch resource
-          UE_mac_inst[module_idP].physicalConfigDedicated = NULL;
-          UE_mac_inst[module_idP].ul_active=0;
-          UE_mac_inst[module_idP].BSR_reporting_active=BSR_TRIGGER_NONE;
-
-          LOG_I(MAC,"[UE %d] Release all SRs \n", module_idP);
-      }
-    UE_mac_inst[module_idP].scheduling_info.SR_pending=0;
-    UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0;
-    return(0);
-  }
+	// notify RRC to relase PUCCH/SRS
+	// clear any configured dl/ul
+	// initiate RA
+	if (UE_mac_inst[module_idP].scheduling_info.SR_pending) {
+	    // release all pucch resource
+	    UE_mac_inst[module_idP].physicalConfigDedicated = NULL;
+	    UE_mac_inst[module_idP].ul_active = 0;
+	    UE_mac_inst[module_idP].BSR_reporting_active =
+		BSR_TRIGGER_NONE;
+
+	    LOG_I(MAC, "[UE %d] Release all SRs \n", module_idP);
+	}
+	UE_mac_inst[module_idP].scheduling_info.SR_pending = 0;
+	UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0;
+	return (0);
+    }
 }
 
 //------------------------------------------------------------------------------
 void
-ue_send_sdu(
-  module_id_t module_idP,
+ue_send_sdu(module_id_t module_idP,
 	    uint8_t CC_id,
 	    frame_t frameP,
-        sub_frame_t subframeP,
-	    uint8_t* sdu,
-	    uint16_t sdu_len,
-  uint8_t eNB_index
-)
+	    sub_frame_t subframeP,
+	    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];
-  unsigned short rx_lengths[NB_RB_MAX];
-  unsigned char *tx_sdu;
+    unsigned char rx_ces[MAX_NUM_CE], num_ce, num_sdu, i, *payload_ptr;
+    unsigned char rx_lcids[NB_RB_MAX];
+    unsigned short rx_lengths[NB_RB_MAX];
+    unsigned char *tx_sdu;
 #if UE_TIMING_TRACE
-  start_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
+    start_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
 #endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN);
 
-  LOG_T(MAC,"sdu: %x.%x.%x\n",sdu[0],sdu[1],sdu[2]);
+    LOG_T(MAC, "sdu: %x.%x.%x\n", sdu[0], sdu[1], sdu[2]);
 
-  if (opt_enabled) {
-    trace_pdu(1, sdu, sdu_len, module_idP, 3, UE_mac_inst[module_idP].crnti,
-        frameP, subframeP, 0, 0);
-    LOG_D(OPT,"[UE %d][DLSCH] Frame %d trace pdu for rnti %x  with size %d\n",
-          module_idP, frameP, UE_mac_inst[module_idP].crnti, sdu_len);
-  }
+    if (opt_enabled) {
+	trace_pdu(1, sdu, sdu_len, module_idP, 3,
+		  UE_mac_inst[module_idP].crnti, frameP, subframeP, 0, 0);
+	LOG_D(OPT,
+	      "[UE %d][DLSCH] Frame %d trace pdu for rnti %x  with size %d\n",
+	      module_idP, frameP, UE_mac_inst[module_idP].crnti, sdu_len);
+    }
 
-  payload_ptr = parse_header(sdu,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,sdu_len);
+    payload_ptr =
+	parse_header(sdu, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths,
+		     sdu_len);
 
 #ifdef DEBUG_HEADER_PARSING
-  LOG_D(MAC,"[UE %d] ue_send_sdu : Frame %d eNB_index %d : num_ce %d num_sdu %d\n",module_idP,
-        frameP,eNB_index,num_ce,num_sdu);
+    LOG_D(MAC,
+	  "[UE %d] ue_send_sdu : Frame %d eNB_index %d : num_ce %d num_sdu %d\n",
+	  module_idP, frameP, eNB_index, num_ce, num_sdu);
 #endif
 
 #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
-  LOG_T(MAC,"[UE %d] First 32 bytes of DLSCH : \n", module_idP);
+    LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
 
-  for (i=0; i<32; i++) {
-    LOG_T(MAC,"%x.",sdu[i]);
-  }
+    for (i = 0; i < 32; i++) {
+	LOG_T(MAC, "%x.", sdu[i]);
+    }
 
-  LOG_T(MAC,"\n");
+    LOG_T(MAC, "\n");
 #endif
 
-  if (payload_ptr != NULL) {
-
-  for (i=0; i<num_ce; i++) {
-    //    printf("ce %d : %d\n",i,rx_ces[i]);
-    switch (rx_ces[i]) {
-    case UE_CONT_RES:
-
-      LOG_I(MAC,"[UE %d][RAPROC] Frame %d : received contention resolution msg: %x.%x.%x.%x.%x.%x, Terminating RA procedure\n",
-            module_idP,frameP,payload_ptr[0],payload_ptr[1],payload_ptr[2],payload_ptr[3],payload_ptr[4],payload_ptr[5]);
-
-      if (UE_mac_inst[module_idP].RA_active == 1) {
-        LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Clearing RA_active flag\n", module_idP, frameP);
-        UE_mac_inst[module_idP].RA_active=0;
-        // check if RA procedure has finished completely (no contention)
-        tx_sdu = &UE_mac_inst[module_idP].CCCH_pdu.payload[3];
-
-        //Note: 3 assumes sizeof(SCH_SUBHEADER_SHORT) + PADDING CE, which is when UL-Grant has TBS >= 9 (64 bits)
-        // (other possibility is 1 for TBS=7 (SCH_SUBHEADER_FIXED), or 2 for TBS=8 (SCH_SUBHEADER_FIXED+PADDING or SCH_SUBHEADER_SHORT)
-        for (i=0; i<6; i++)
-          if (tx_sdu[i] != payload_ptr[i]) {
-            LOG_E(MAC,"[UE %d][RAPROC] Contention detected, RA failed\n",module_idP);
-            ra_failed(module_idP,CC_id,eNB_index);
-            UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0;
-            VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
-            return;
-          }
-
-        LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Clearing contention resolution timer\n", module_idP, frameP);
-        UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0;
-        ra_succeeded(module_idP,CC_id,eNB_index);
-      }
-
-      payload_ptr+=6;
-      break;
-
-    case TIMING_ADV_CMD:
+    if (payload_ptr != NULL) {
+
+	for (i = 0; i < num_ce; i++) {
+	    //    printf("ce %d : %d\n",i,rx_ces[i]);
+	    switch (rx_ces[i]) {
+	    case UE_CONT_RES:
+
+		LOG_I(MAC,
+		      "[UE %d][RAPROC] Frame %d : received contention resolution msg: %x.%x.%x.%x.%x.%x, Terminating RA procedure\n",
+		      module_idP, frameP, payload_ptr[0], payload_ptr[1],
+		      payload_ptr[2], payload_ptr[3], payload_ptr[4],
+		      payload_ptr[5]);
+
+		if (UE_mac_inst[module_idP].RA_active == 1) {
+		    LOG_I(MAC,
+			  "[UE %d][RAPROC] Frame %d : Clearing RA_active flag\n",
+			  module_idP, frameP);
+		    UE_mac_inst[module_idP].RA_active = 0;
+		    // check if RA procedure has finished completely (no contention)
+		    tx_sdu = &UE_mac_inst[module_idP].CCCH_pdu.payload[3];
+
+		    //Note: 3 assumes sizeof(SCH_SUBHEADER_SHORT) + PADDING CE, which is when UL-Grant has TBS >= 9 (64 bits)
+		    // (other possibility is 1 for TBS=7 (SCH_SUBHEADER_FIXED), or 2 for TBS=8 (SCH_SUBHEADER_FIXED+PADDING or SCH_SUBHEADER_SHORT)
+		    for (i = 0; i < 6; i++)
+			if (tx_sdu[i] != payload_ptr[i]) {
+			    LOG_E(MAC,
+				  "[UE %d][RAPROC] Contention detected, RA failed\n",
+				  module_idP);
+			    ra_failed(module_idP, CC_id, eNB_index);
+			    UE_mac_inst
+				[module_idP].
+				RA_contention_resolution_timer_active = 0;
+			    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+				(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU,
+				 VCD_FUNCTION_OUT);
+			    return;
+			}
+
+		    LOG_I(MAC,
+			  "[UE %d][RAPROC] Frame %d : Clearing contention resolution timer\n",
+			  module_idP, frameP);
+		    UE_mac_inst
+			[module_idP].
+			RA_contention_resolution_timer_active = 0;
+		    ra_succeeded(module_idP, CC_id, eNB_index);
+		}
+
+		payload_ptr += 6;
+		break;
+
+	    case TIMING_ADV_CMD:
 #ifdef DEBUG_HEADER_PARSING
-      LOG_D(MAC,"[UE] CE %d : UE Timing Advance : %d\n",i,payload_ptr[0]);
+		LOG_D(MAC, "[UE] CE %d : UE Timing Advance : %d\n", i,
+		      payload_ptr[0]);
 #endif
-      process_timing_advance(module_idP,CC_id,payload_ptr[0]);
-      payload_ptr++;
-      break;
+		process_timing_advance(module_idP, CC_id, payload_ptr[0]);
+		payload_ptr++;
+		break;
 
-    case DRX_CMD:
+	    case DRX_CMD:
 #ifdef DEBUG_HEADER_PARSING
-      LOG_D(MAC,"[UE] CE %d : UE DRX :",i);
+		LOG_D(MAC, "[UE] CE %d : UE DRX :", i);
 #endif
-      payload_ptr++;
-      break;
-    }
-  }
+		payload_ptr++;
+		break;
+	    }
+	}
 
-  for (i=0; i<num_sdu; i++) {
+	for (i = 0; i < num_sdu; i++) {
 #ifdef DEBUG_HEADER_PARSING
-    LOG_D(MAC,"[UE] SDU %d : LCID %d, length %d\n",i,rx_lcids[i],rx_lengths[i]);
+	    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",
-            module_idP,
-            UE_mac_inst[module_idP].crnti,
-            frameP,
-            eNB_index,
-            rx_lengths[i]);
+	    if (rx_lcids[i] == CCCH) {
+
+		LOG_D(MAC,
+		      "[UE %d] rnti %x Frame %d : DLSCH -> DL-CCCH, RRC message (eNB %d, %d bytes)\n",
+		      module_idP, UE_mac_inst[module_idP].crnti, frameP,
+		      eNB_index, rx_lengths[i]);
 
 #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
-      int j;
+		int j;
 
-      for (j=0; j<rx_lengths[i]; j++) {
-        LOG_T(MAC,"%x.",(uint8_t)payload_ptr[j]);
-      }
+		for (j = 0; j < rx_lengths[i]; j++) {
+		    LOG_T(MAC, "%x.", (uint8_t) payload_ptr[j]);
+		}
 
-      LOG_T(MAC,"\n");
+		LOG_T(MAC, "\n");
 #endif
-      mac_rrc_data_ind(module_idP,
-                       CC_id,
-                       frameP,subframeP,
-                       UE_mac_inst[module_idP].crnti,
-                       CCCH,
-                       (uint8_t*)payload_ptr,
-                       rx_lengths[i],
-                       ENB_FLAG_NO,
-                       eNB_index,
-                       0);
-
-    } 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,
-		       eNB_index,
-                       frameP,
-                       ENB_FLAG_NO,
-                       MBMS_FLAG_NO,
-                       rx_lcids[i],
-                       (char *)payload_ptr,
-                       rx_lengths[i],
-                       1,
-                       NULL);
- 
-    } 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]);
+		mac_rrc_data_ind_ue(module_idP,
+				 CC_id,
+				 frameP, subframeP,
+				 UE_mac_inst[module_idP].crnti,
+				 CCCH,
+				 (uint8_t *) payload_ptr,
+				 rx_lengths[i], eNB_index, 0);
+
+	    } 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,
+				 eNB_index, frameP, ENB_FLAG_NO,
+				 MBMS_FLAG_NO, rx_lcids[i],
+				 (char *) payload_ptr, rx_lengths[i], 1,
+				 NULL);
+
+	    } 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]);
-      LOG_T(MAC,"\n");
+		int 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,
-		       eNB_index,
-		       frameP,
-		       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];
-  }
-  } // end if (payload_ptr != NULL)
-  
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
+		mac_rlc_data_ind(module_idP,
+				 UE_mac_inst[module_idP].crnti,
+				 eNB_index,
+				 frameP,
+				 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];
+	}
+    }				// end if (payload_ptr != NULL)
+
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-  stop_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
+    stop_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
 #endif
 }
 
-void ue_decode_si(module_id_t module_idP,int CC_id,frame_t frameP, uint8_t eNB_index, void *pdu,uint16_t len)
+void
+ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
+	     uint8_t eNB_index, void *pdu, uint16_t len)
 {
 #if UE_TIMING_TRACE
     start_meas(&UE_mac_inst[module_idP].rx_si);
 #endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_IN);
-
-  LOG_D(MAC,"[UE %d] Frame %d Sending SI to RRC (LCID Id %d,len %d)\n",module_idP,frameP,BCCH,len);
-
-  mac_rrc_data_ind(module_idP,
-                   CC_id,
-                   frameP,0, // unknown subframe
-                   SI_RNTI,
-                   BCCH,
-                   (uint8_t *)pdu,
-                   len,
-                   ENB_FLAG_NO,
-                   eNB_index,
-                   0);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_OUT);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_IN);
+
+    LOG_D(MAC, "[UE %d] Frame %d Sending SI to RRC (LCID Id %d,len %d)\n",
+	  module_idP, frameP, BCCH, len);
+
+    mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0,	// unknown subframe
+		     SI_RNTI,
+		     BCCH, (uint8_t *) pdu, len, eNB_index,
+		     0);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-  stop_meas(&UE_mac_inst[module_idP].rx_si);
+    stop_meas(&UE_mac_inst[module_idP].rx_si);
 #endif
-  if (opt_enabled == 1) {
-    trace_pdu(0,
-	      (uint8_t *)pdu,
-	      len,
-	      module_idP,
-	      4,
-	      0xffff,
-	      UE_mac_inst[module_idP].rxFrame,
-	      UE_mac_inst[module_idP].rxSubframe,
-	      0,
-	      0);
-    LOG_D(OPT,"[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
-	    module_idP, frameP, CC_id, 0xffff, len);
-  }
+    if (opt_enabled == 1) {
+	trace_pdu(0,
+		  (uint8_t *) pdu,
+		  len,
+		  module_idP,
+		  4,
+		  0xffff,
+		  UE_mac_inst[module_idP].rxFrame,
+		  UE_mac_inst[module_idP].rxSubframe, 0, 0);
+	LOG_D(OPT,
+	      "[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
+	      module_idP, frameP, CC_id, 0xffff, len);
+    }
 }
 
-void ue_decode_p(module_id_t module_idP,int CC_id,frame_t frameP, uint8_t eNB_index, void *pdu,uint16_t len)
+void
+ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP,
+	    uint8_t eNB_index, void *pdu, uint16_t len)
 {
 #if UE_TIMING_TRACE
     start_meas(&UE_mac_inst[module_idP].rx_p);
 #endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_IN);
-
-  LOG_D(MAC,"[UE %d] Frame %d Sending Paging message to RRC (LCID Id %d,len %d)\n",module_idP,frameP,PCCH,len);
-
-  mac_rrc_data_ind(module_idP,
-                   CC_id,
-                   frameP,0, // unknown subframe
-                   P_RNTI,
-                   PCCH,
-                   (uint8_t *)pdu,
-                   len,
-                   ENB_FLAG_NO,
-                   eNB_index,
-                   0);
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_OUT);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_IN);
+
+    LOG_D(MAC,
+	  "[UE %d] Frame %d Sending Paging message to RRC (LCID Id %d,len %d)\n",
+	  module_idP, frameP, PCCH, len);
+
+    mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0,	// unknown subframe
+		     P_RNTI,
+		     PCCH, (uint8_t *) pdu, len, eNB_index,
+		     0);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-  stop_meas(&UE_mac_inst[module_idP].rx_p);
+    stop_meas(&UE_mac_inst[module_idP].rx_p);
 #endif
-  if (opt_enabled == 1) {
-    trace_pdu(0,
-	      (uint8_t *)pdu,
-	      len,
-	      module_idP,
-	      4,
-	      P_RNTI,
-	      UE_mac_inst[module_idP].rxFrame,
-	      UE_mac_inst[module_idP].rxSubframe,
-	      0,
-	      0);
-    LOG_D(OPT,"[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
-	    module_idP, frameP, CC_id, P_RNTI, len);
-  }
+    if (opt_enabled == 1) {
+	trace_pdu(0,
+		  (uint8_t *) pdu,
+		  len,
+		  module_idP,
+		  4,
+		  P_RNTI,
+		  UE_mac_inst[module_idP].rxFrame,
+		  UE_mac_inst[module_idP].rxSubframe, 0, 0);
+	LOG_D(OPT,
+	      "[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
+	      module_idP, frameP, CC_id, P_RNTI, len);
+    }
 }
 
 #if defined(Rel10) || defined(Rel14)
 unsigned char *parse_mch_header(unsigned char *mac_header,
-                                unsigned char *num_sdu,
-                                unsigned char *rx_lcids,
-                                unsigned short *rx_lengths,
-                                unsigned short tb_length)
+				unsigned char *num_sdu,
+				unsigned char *rx_lcids,
+				unsigned short *rx_lengths,
+				unsigned short tb_length)
 {
-  unsigned char not_done=1, num_sdus=0, lcid, i;
-  unsigned char *mac_header_ptr = mac_header;
-  unsigned short length;
-
-  while (not_done == 1) {
-    if (((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E == 0) {
-      not_done = 0;
-    }
-
-    lcid = ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID;
-
-    if (lcid < SHORT_PADDING) {// subheader for MSI, MCCH or MTCH
-      if (not_done == 0) { // last MAC SDU, length is implicit
-        mac_header_ptr++;
-        length = tb_length- (mac_header_ptr - mac_header);
-
-        for (i=0; i<num_sdus; i++) {
-          length -= rx_lengths[i];
-        }
-      } else { // not the last MAC SDU
-        if ( ((SCH_SUBHEADER_LONG *)mac_header_ptr)->F == 1) {// subheader has length of 3octets
-          //    length = ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L;
-          length = ((((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_MSB & 0x7f ) << 8 ) | (((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_LSB & 0xff);
-          mac_header_ptr += 3;
-        } else { // subheader has length of 2octets
-          length = ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L;
-          mac_header_ptr += 2;
-        }
-      }
-
-      rx_lcids[num_sdus] = lcid;
-      rx_lengths[num_sdus] = length;
-      num_sdus++;
-    } else { // subheader for padding
-      //     if (lcid == SHORT_PADDING)
-      mac_header_ptr++;
-    }
-  }
-
-  *num_sdu = num_sdus;
-  return(mac_header_ptr);
+    unsigned char not_done = 1, num_sdus = 0, lcid, i;
+    unsigned char *mac_header_ptr = mac_header;
+    unsigned short length;
+
+    while (not_done == 1) {
+	if (((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E == 0) {
+	    not_done = 0;
+	}
+
+	lcid = ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID;
+
+	if (lcid < SHORT_PADDING) {	// subheader for MSI, MCCH or MTCH
+	    if (not_done == 0) {	// last MAC SDU, length is implicit
+		mac_header_ptr++;
+		length = tb_length - (mac_header_ptr - mac_header);
+
+		for (i = 0; i < num_sdus; i++) {
+		    length -= rx_lengths[i];
+		}
+	    } else {		// not the last MAC SDU
+		if (((SCH_SUBHEADER_LONG *) mac_header_ptr)->F == 1) {	// subheader has length of 3octets
+		    //    length = ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L;
+		    length =
+			((((SCH_SUBHEADER_LONG *) mac_header_ptr)->
+			  L_MSB & 0x7f)
+			 << 8) | (((SCH_SUBHEADER_LONG *) mac_header_ptr)->
+				  L_LSB & 0xff);
+		    mac_header_ptr += 3;
+		} else {	// subheader has length of 2octets
+		    length = ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L;
+		    mac_header_ptr += 2;
+		}
+	    }
+
+	    rx_lcids[num_sdus] = lcid;
+	    rx_lengths[num_sdus] = length;
+	    num_sdus++;
+	} else {		// subheader for padding
+	    //     if (lcid == SHORT_PADDING)
+	    mac_header_ptr++;
+	}
+    }
+
+    *num_sdu = num_sdus;
+    return (mac_header_ptr);
 }
 
 // this function is for sending mch_sdu from phy to mac
-void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, uint8_t *sdu, uint16_t sdu_len, uint8_t eNB_index, uint8_t sync_area)
+void
+ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
+		uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index,
+		uint8_t sync_area)
 {
 
-  unsigned char num_sdu, i, *payload_ptr;
-  unsigned char rx_lcids[NB_RB_MAX];
-  unsigned short rx_lengths[NB_RB_MAX];
+    unsigned char num_sdu, i, *payload_ptr;
+    unsigned char rx_lcids[NB_RB_MAX];
+    unsigned short rx_lengths[NB_RB_MAX];
 #if UE_TIMING_TRACE
-  start_meas(&UE_mac_inst[module_idP].rx_mch_sdu);
+    start_meas(&UE_mac_inst[module_idP].rx_mch_sdu);
 #endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU, VCD_FUNCTION_IN);
-
-  LOG_D(MAC,"[UE %d] Frame %d : process the mch PDU for sync area %d \n",module_idP,frameP, sync_area);
-  LOG_D(MAC,"[UE %d] sdu: %x.%x\n", module_idP,sdu[0], sdu[1]);
-  LOG_D(MAC,"[UE %d] parse_mch_header, demultiplex\n",module_idP);
-
-  payload_ptr = parse_mch_header(sdu, &num_sdu, rx_lcids, rx_lengths, sdu_len);
-  LOG_D(MAC,"[UE %d] parse_mch_header, found %d sdus\n",module_idP,num_sdu);
-
-  for (i=0; i<num_sdu; i++) {
-    if (rx_lcids[i] == MCH_SCHDL_INFO) {
-      if (UE_mac_inst[module_idP].mcch_status==1) {
-        LOG_I(MAC,"[UE %d] Frame %d : MCH->MSI for sync area %d (eNB %d, %d bytes)\n",module_idP,frameP, sync_area, eNB_index, rx_lengths[i]);
-        // ??store necessary scheduling info to ue_mac_inst in order to
-        // calculate exact position of interested service (for the complex case has >1 mtch)
-        // set msi_status to 1
-        UE_mac_inst[module_idP].msi_status = 1;
-      }
-    } else if (rx_lcids[i] == MCCH_LCHANID) {
-      LOG_I(MAC,"[UE %d] Frame %d : SDU %d MCH->MCCH for sync area %d (eNB %d, %d bytes)\n",module_idP,frameP, i, sync_area, eNB_index, rx_lengths[i]);
-      mac_rrc_data_ind(module_idP,
-                       CC_id,
-                       frameP,0, // unknown subframe
-                       M_RNTI,
-                       MCCH,
-                       payload_ptr, rx_lengths[i], 0, eNB_index, sync_area);
-    } else if (rx_lcids[i] == MTCH) {
-      if (UE_mac_inst[module_idP].msi_status==1) {
-        LOG_I(MAC,"[UE %d] Frame %d : MCH->MTCH for sync area %d (eNB %d, %d bytes)\n",module_idP,frameP, sync_area, 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_YES,
-          MTCH, /*+ (maxDRB + 3),*/
-          (char *)payload_ptr,
-          rx_lengths[i],
-          1,
-          NULL);
-
-      }
-    } else {
-      LOG_W(MAC,"[UE %d] Frame %d : unknown sdu %d rx_lcids[%d]=%d mcch status %d eNB %d \n",
-            module_idP,
-            frameP,
-            rx_lengths[i],
-            i,
-            rx_lcids[i],
-            UE_mac_inst[module_idP].mcch_status, eNB_index);
-    }
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU, VCD_FUNCTION_IN);
 
-    payload_ptr += rx_lengths[i];
-  }
+    LOG_D(MAC,
+	  "[UE %d] Frame %d : process the mch PDU for sync area %d \n",
+	  module_idP, frameP, sync_area);
+    LOG_D(MAC, "[UE %d] sdu: %x.%x\n", module_idP, sdu[0], sdu[1]);
+    LOG_D(MAC, "[UE %d] parse_mch_header, demultiplex\n", module_idP);
+
+    payload_ptr =
+	parse_mch_header(sdu, &num_sdu, rx_lcids, rx_lengths, sdu_len);
+    LOG_D(MAC, "[UE %d] parse_mch_header, found %d sdus\n", module_idP,
+	  num_sdu);
+
+    for (i = 0; i < num_sdu; i++) {
+	if (rx_lcids[i] == MCH_SCHDL_INFO) {
+	    if (UE_mac_inst[module_idP].mcch_status == 1) {
+		LOG_I(MAC,
+		      "[UE %d] Frame %d : MCH->MSI for sync area %d (eNB %d, %d bytes)\n",
+		      module_idP, frameP, sync_area, eNB_index,
+		      rx_lengths[i]);
+		// ??store necessary scheduling info to ue_mac_inst in order to
+		// calculate exact position of interested service (for the complex case has >1 mtch)
+		// set msi_status to 1
+		UE_mac_inst[module_idP].msi_status = 1;
+	    }
+	} else if (rx_lcids[i] == MCCH_LCHANID) {
+	    LOG_I(MAC,
+		  "[UE %d] Frame %d : SDU %d MCH->MCCH for sync area %d (eNB %d, %d bytes)\n",
+		  module_idP, frameP, i, sync_area, eNB_index,
+		  rx_lengths[i]);
+	    mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0,	// unknown subframe
+			     M_RNTI,
+			     MCCH,
+			     payload_ptr, rx_lengths[i], eNB_index,
+			     sync_area);
+	} else if (rx_lcids[i] == MTCH) {
+	    if (UE_mac_inst[module_idP].msi_status == 1) {
+		LOG_I(MAC,
+		      "[UE %d] Frame %d : MCH->MTCH for sync area %d (eNB %d, %d bytes)\n",
+		      module_idP, frameP, sync_area, 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_YES, MTCH,	/*+ (maxDRB + 3), */
+				 (char *) payload_ptr, rx_lengths[i], 1,
+				 NULL);
+
+	    }
+	} else {
+	    LOG_W(MAC,
+		  "[UE %d] Frame %d : unknown sdu %d rx_lcids[%d]=%d mcch status %d eNB %d \n",
+		  module_idP, frameP, rx_lengths[i], i, rx_lcids[i],
+		  UE_mac_inst[module_idP].mcch_status, eNB_index);
+	}
+
+	payload_ptr += rx_lengths[i];
+    }
 
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU, VCD_FUNCTION_OUT);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-  stop_meas(&UE_mac_inst[module_idP].rx_mch_sdu);
+    stop_meas(&UE_mac_inst[module_idP].rx_mch_sdu);
 #endif
 }
 
-int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area, unsigned char eNB_index)
+int8_t
+ue_get_mbsfn_sf_alloction(module_id_t module_idP,
+			  uint8_t mbsfn_sync_area, unsigned char eNB_index)
 {
-  // currently there is one-to-one mapping between sf allocation pattern and sync area
-  if (mbsfn_sync_area >= MAX_MBSFN_AREA) {
-    LOG_W( MAC, "[UE %"PRIu8"] MBSFN synchronization area %"PRIu8" out of range for eNB %"PRIu8"\n", module_idP, mbsfn_sync_area, eNB_index );
-    return -1;
-  } else if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[mbsfn_sync_area] != NULL) {
-    return mbsfn_sync_area;
-  } else {
-    LOG_W( MAC, "[UE %"PRIu8"] MBSFN Subframe Config pattern %"PRIu8" not found \n", module_idP, mbsfn_sync_area );
-    return -1;
-  }
+    // currently there is one-to-one mapping between sf allocation pattern and sync area
+    if (mbsfn_sync_area >= MAX_MBSFN_AREA) {
+	LOG_W(MAC,
+	      "[UE %" PRIu8 "] MBSFN synchronization area %" PRIu8
+	      " out of range for eNB %" PRIu8 "\n", module_idP,
+	      mbsfn_sync_area, eNB_index);
+	return -1;
+    } else if (UE_mac_inst[module_idP].
+	       mbsfn_SubframeConfig[mbsfn_sync_area] != NULL) {
+	return mbsfn_sync_area;
+    } else {
+	LOG_W(MAC,
+	      "[UE %" PRIu8 "] MBSFN Subframe Config pattern %" PRIu8
+	      " not found \n", module_idP, mbsfn_sync_area);
+	return -1;
+    }
 }
 
-int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_t subframe, uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active)
+int
+ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP,
+	     uint32_t subframe, uint8_t eNB_index, uint8_t * sync_area,
+	     uint8_t * mcch_active)
 {
 
-  int i=0, j=0, ii=0, msi_pos=0, mcch_mcs = - 1;
-  int mcch_flag=0, mtch_flag=0, msi_flag=0;
-  int mbsfn_period = 0;// 1<<(UE_mac_inst[module_idP].mbsfn_SubframeConfig[0]->radioframeAllocationPeriod);
-  int mcch_period = 0;// 32<<(UE_mac_inst[module_idP].mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
-  int mch_scheduling_period = -1;
+    int i = 0, j = 0, ii = 0, msi_pos = 0, mcch_mcs = -1;
+    int mcch_flag = 0, mtch_flag = 0, msi_flag = 0;
+    int mbsfn_period = 0;	// 1<<(UE_mac_inst[module_idP].mbsfn_SubframeConfig[0]->radioframeAllocationPeriod);
+    int mcch_period = 0;	// 32<<(UE_mac_inst[module_idP].mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
+    int mch_scheduling_period = -1;
 
-  int frame_FDD=1;
+    int frame_FDD = 1;
 
 
 #if UE_TIMING_TRACE
-  start_meas(&UE_mac_inst[module_idP].ue_query_mch);
+    start_meas(&UE_mac_inst[module_idP].ue_query_mch);
 #endif
 
-  if (UE_mac_inst[module_idP].pmch_Config[0]) {
-    mch_scheduling_period = 8<<(UE_mac_inst[module_idP].pmch_Config[0]->mch_SchedulingPeriod_r9);
-  }
-
-  for (i=0;
-       i< UE_mac_inst[module_idP].num_active_mbsfn_area;
-       i++ ) {
-    // assume, that there is always a mapping
-    if ((j=ue_get_mbsfn_sf_alloction(module_idP,i,eNB_index)) == -1) {
-      return -1; // continue;
+    if (UE_mac_inst[module_idP].pmch_Config[0]) {
+	mch_scheduling_period =
+	    8 << (UE_mac_inst[module_idP].
+		  pmch_Config[0]->mch_SchedulingPeriod_r9);
     }
 
-    ii=0;
-    msi_pos=0;
-    mbsfn_period = 1<<(UE_mac_inst[module_idP].mbsfn_SubframeConfig[0]->radioframeAllocationPeriod);
-    mcch_period = 32<<(UE_mac_inst[module_idP].mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
+    for (i = 0; i < UE_mac_inst[module_idP].num_active_mbsfn_area; i++) {
+	// assume, that there is always a mapping
+	if ((j =
+	     ue_get_mbsfn_sf_alloction(module_idP, i, eNB_index)) == -1) {
+	    return -1;		// continue;
+	}
+
+	ii = 0;
+	msi_pos = 0;
+	mbsfn_period =
+	    1 << (UE_mac_inst[module_idP].
+		  mbsfn_SubframeConfig[0]->radioframeAllocationPeriod);
+	mcch_period =
+	    32 << (UE_mac_inst[module_idP].
+		   mbsfn_AreaInfo[0]->mcch_Config_r9.
+		   mcch_RepetitionPeriod_r9);
+
+	LOG_D(MAC,
+	      "[UE %d] Frame %d subframe %d: Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d,mac sched period (%d,%ld))\n",
+	      module_idP, frameP, subframe, i,
+	      UE_mac_inst[module_idP].num_active_mbsfn_area, j,
+	      UE_mac_inst[module_idP].num_sf_allocation_pattern,
+	      mbsfn_period, mcch_period, mch_scheduling_period,
+	      UE_mac_inst[module_idP].
+	      mbsfn_SubframeConfig[j]->radioframeAllocationOffset);
+
+	// get the real MCS value
+	switch (UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->
+		mcch_Config_r9.signallingMCS_r9) {
+	case 0:
+	    mcch_mcs = 2;
+	    break;
+
+	case 1:
+	    mcch_mcs = 7;
+	    break;
+
+	case 2:
+	    mcch_mcs = 13;
+	    break;
+
+	case 3:
+	    mcch_mcs = 19;
+	    break;
+	}
+
+	if (frameP % mbsfn_period == UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset) {	// MBSFN frameP
+	    if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {	// one-frameP format
+
+		if (UE_mac_inst[module_idP].pmch_Config[0]) {
+		    //  Find the first subframe in this MCH to transmit MSI
+		    if (frameP % mch_scheduling_period ==
+			UE_mac_inst[module_idP].
+			mbsfn_SubframeConfig
+			[j]->radioframeAllocationOffset) {
+			while (ii == 0) {
+			    ii = UE_mac_inst[module_idP].
+				mbsfn_SubframeConfig[j]->
+				subframeAllocation.choice.
+				oneFrame.buf[0] & (0x80 >> msi_pos);
+			    msi_pos++;
+			}
+		    }
+		}
+
+		if (UE_mac_inst[module_idP].tdd_Config == NULL)
+		    frame_FDD = 1;
+		else
+		    frame_FDD = 0;
+		// Check if the subframe is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
+		switch (subframe) {
+		case 1:
+		    if (frame_FDD == 1) {
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
+			    if (msi_pos == 1) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF1) ==
+				 MBSFN_FDD_SF1)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
 
-    LOG_D(MAC,
-          "[UE %d] Frame %d subframe %d: Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d,mac sched period (%d,%ld))\n",
-          module_idP,frameP, subframe,i,UE_mac_inst[module_idP].num_active_mbsfn_area,
-          j,UE_mac_inst[module_idP].num_sf_allocation_pattern,mbsfn_period,mcch_period,
-          mch_scheduling_period,UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset);
-
-    // get the real MCS value
-    switch (UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
-    case 0:
-      mcch_mcs = 2;
-      break;
-
-    case 1:
-      mcch_mcs = 7;
-      break;
-
-    case 2:
-      mcch_mcs = 13;
-      break;
-
-    case 3:
-      mcch_mcs = 19;
-      break;
-    }
-
-    if (frameP % mbsfn_period == UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset) { // MBSFN frameP
-      if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { // one-frameP format
-
-        if (UE_mac_inst[module_idP].pmch_Config[0]) {
-          //  Find the first subframe in this MCH to transmit MSI
-          if (frameP % mch_scheduling_period == UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset ) {
-            while (ii == 0) {
-              ii = UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & (0x80>>msi_pos);
-              msi_pos++;
-            }
-          }
-        }
-
-	if (UE_mac_inst[module_idP].tdd_Config == NULL) frame_FDD=1;
-	else frame_FDD=0;
-        // Check if the subframe is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
-        switch (subframe) {
-        case 1:
-          if (frame_FDD==1) {
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
-              if (msi_pos == 1) {
-                msi_flag = 1;
-              }
-
-	      if ( (frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 2:
-          if (frame_FDD==1) {
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) {
-              if (msi_pos == 2) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 3:
-          if (frame_FDD==0) { //TDD
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) {
-              if (msi_pos == 1) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          } else { // FDD
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) {
-              if (msi_pos == 3) {
-                msi_flag = 1;
-              }
-
-              if ((frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                  ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 4:
-          if (frame_FDD==0) {
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) {
-              if (msi_pos == 2) {
-                msi_flag = 1;
-              }
-
-              if ((frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                  ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 6:
-          if (frame_FDD==1) {
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) {
-              if (msi_pos == 4) {
-                msi_flag = 1;
-              }
-
-              if ((frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                  ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 7:
-          if (frame_FDD==0) { // TDD
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) {
-              if (msi_pos == 3) {
-                msi_flag = 1;
-              }
-
-              if ((frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                  ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          } else { // FDD
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
-              if (msi_pos == 5) {
-                msi_flag = 1;
-              }
-
-              if ((frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                  ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 8:
-          if (frame_FDD==0) { //TDD
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) {
-              if (msi_pos == 4) {
-                msi_flag = 1;
-              }
-
-              if ( (frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                   ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          } else { // FDD
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) {
-              if (msi_pos == 6) {
-                msi_flag = 1;
-              }
-
-              if ((frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                  ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-
-        case 9:
-          if (frame_FDD==0) {
-            if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) {
-              if (msi_pos == 5) {
-                msi_flag = 1;
-              }
-
-              if ((frameP % mcch_period == UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                  ((UE_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) ) {
-                mcch_flag = 1;
-              }
-
-              mtch_flag = 1;
-            }
-          }
-
-          break;
-        }// end switch
-
-        // sf allocation is non-overlapping
-        if ((msi_flag==1) || (mcch_flag==1) || (mtch_flag==1)) {
-          LOG_D(MAC,"[UE %d] Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
-                module_idP, frameP, subframe,i,j,msi_flag,mcch_flag,mtch_flag);
-
-          *sync_area=i;
-          break;
-        }
-      } else { // four-frameP format
-      }
-    }
-  } // end of for
+		    break;
+
+		case 2:
+		    if (frame_FDD == 1) {
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) {
+			    if (msi_pos == 2) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF2) ==
+				 MBSFN_FDD_SF2)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 3:
+		    if (frame_FDD == 0) {	//TDD
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) {
+			    if (msi_pos == 1) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF3) ==
+				 MBSFN_TDD_SF3)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    } else {	// FDD
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) {
+			    if (msi_pos == 3) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF3) ==
+				 MBSFN_FDD_SF3)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 4:
+		    if (frame_FDD == 0) {
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) {
+			    if (msi_pos == 2) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF4) ==
+				 MBSFN_TDD_SF4)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 6:
+		    if (frame_FDD == 1) {
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) {
+			    if (msi_pos == 4) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF6) ==
+				 MBSFN_FDD_SF6)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 7:
+		    if (frame_FDD == 0) {	// TDD
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) {
+			    if (msi_pos == 3) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF7) ==
+				 MBSFN_TDD_SF7)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    } else {	// FDD
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
+			    if (msi_pos == 5) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF7) ==
+				 MBSFN_FDD_SF7)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 8:
+		    if (frame_FDD == 0) {	//TDD
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) {
+			    if (msi_pos == 4) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF8) ==
+				 MBSFN_TDD_SF8)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    } else {	// FDD
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) {
+			    if (msi_pos == 6) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_FDD_SF8) ==
+				 MBSFN_FDD_SF8)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+
+		case 9:
+		    if (frame_FDD == 0) {
+			if ((UE_mac_inst[module_idP].mbsfn_SubframeConfig
+			     [j]->subframeAllocation.choice.oneFrame.
+			     buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) {
+			    if (msi_pos == 5) {
+				msi_flag = 1;
+			    }
+
+			    if ((frameP % mcch_period ==
+				 UE_mac_inst[module_idP].mbsfn_AreaInfo
+				 [i]->mcch_Config_r9.mcch_Offset_r9)
+				&&
+				((UE_mac_inst[module_idP].mbsfn_AreaInfo
+				  [i]->mcch_Config_r9.sf_AllocInfo_r9.
+				  buf[0] & MBSFN_TDD_SF9) ==
+				 MBSFN_TDD_SF9)) {
+				mcch_flag = 1;
+			    }
+
+			    mtch_flag = 1;
+			}
+		    }
+
+		    break;
+		}		// end switch
+
+		// sf allocation is non-overlapping
+		if ((msi_flag == 1) || (mcch_flag == 1)
+		    || (mtch_flag == 1)) {
+		    LOG_D(MAC,
+			  "[UE %d] Frame %d Subframe %d: sync area %d SF alloc %d: msi flag %d, mcch flag %d, mtch flag %d\n",
+			  module_idP, frameP, subframe, i, j, msi_flag,
+			  mcch_flag, mtch_flag);
+
+		    *sync_area = i;
+		    break;
+		}
+	    } else {		// four-frameP format
+	    }
+	}
+    }				// end of for
 #if UE_TIMING_TRACE
-  stop_meas(&UE_mac_inst[module_idP].ue_query_mch);
+    stop_meas(&UE_mac_inst[module_idP].ue_query_mch);
 #endif
 
-  if ( (mcch_flag==1)) { // || (msi_flag==1))
-    *mcch_active=1;
-  }
-
-  if ( (mcch_flag==1) || ((msi_flag==1) && (UE_mac_inst[module_idP].mcch_status==1)) ) {
-    return mcch_mcs;
-  } else if ((mtch_flag==1) && (UE_mac_inst[module_idP].msi_status==1)) {
-    return UE_mac_inst[module_idP].pmch_Config[0]->dataMCS_r9;
-  } else {
-    return -1;
-  }
+    if ((mcch_flag == 1)) {	// || (msi_flag==1))
+	*mcch_active = 1;
+    }
+
+    if ((mcch_flag == 1)
+	|| ((msi_flag == 1) && (UE_mac_inst[module_idP].mcch_status == 1))) {
+	return mcch_mcs;
+    } else if ((mtch_flag == 1)
+	       && (UE_mac_inst[module_idP].msi_status == 1)) {
+	return UE_mac_inst[module_idP].pmch_Config[0]->dataMCS_r9;
+    } else {
+	return -1;
+    }
 }
 
 #endif
 
-unsigned char generate_ulsch_header(uint8_t *mac_header,
-                                    uint8_t num_sdus,
-                                    uint8_t short_padding,
-                                    uint16_t *sdu_lengths,
-                                    uint8_t *sdu_lcids,
-                                    POWER_HEADROOM_CMD *power_headroom,
-                                    uint16_t *crnti,
-                                    BSR_SHORT *truncated_bsr,
-                                    BSR_SHORT *short_bsr,
-                                    BSR_LONG *long_bsr,
-                                    unsigned short post_padding)
+unsigned char
+generate_ulsch_header(uint8_t * mac_header,
+		      uint8_t num_sdus,
+		      uint8_t short_padding,
+		      uint16_t * sdu_lengths,
+		      uint8_t * sdu_lcids,
+		      POWER_HEADROOM_CMD * power_headroom,
+		      uint16_t * crnti,
+		      BSR_SHORT * truncated_bsr,
+		      BSR_SHORT * short_bsr,
+		      BSR_LONG * long_bsr, unsigned short post_padding)
 {
 
-  SCH_SUBHEADER_FIXED *mac_header_ptr = (SCH_SUBHEADER_FIXED *)mac_header;
-  unsigned char first_element=0,last_size=0,i;
-  unsigned char mac_header_control_elements[16],*ce_ptr;
+    SCH_SUBHEADER_FIXED *mac_header_ptr =
+	(SCH_SUBHEADER_FIXED *) mac_header;
+    unsigned char first_element = 0, last_size = 0, i;
+    unsigned char mac_header_control_elements[16], *ce_ptr;
 
-  LOG_D(MAC,"[UE] Generate ULSCH : num_sdus %d\n",num_sdus);
+    LOG_D(MAC, "[UE] Generate ULSCH : num_sdus %d\n", num_sdus);
 #ifdef DEBUG_HEADER_PARSING
 
-  for (i=0; i<num_sdus; i++) {
-    LOG_T(MAC,"[UE] sdu %d : lcid %d length %d",i,sdu_lcids[i],sdu_lengths[i]);
-  }
+    for (i = 0; i < num_sdus; i++) {
+	LOG_T(MAC, "[UE] sdu %d : lcid %d length %d", i, sdu_lcids[i],
+	      sdu_lengths[i]);
+    }
 
-  LOG_T(MAC,"\n");
+    LOG_T(MAC, "\n");
 #endif
-  ce_ptr = &mac_header_control_elements[0];
-
-  if ((short_padding == 1) || (short_padding == 2)) {
-    mac_header_ptr->R    = 0;
-    mac_header_ptr->E    = 0;
-    mac_header_ptr->LCID = SHORT_PADDING;
-    first_element=1;
-    last_size=1;
-  }
-
-  if (short_padding == 2) {
-    mac_header_ptr->E = 1;
-    mac_header_ptr++;
-    mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
-    mac_header_ptr->LCID = SHORT_PADDING;
-    last_size=1;
-  }
-
-  if (power_headroom) {
-    if (first_element>0) {
-      mac_header_ptr->E = 1;
-      mac_header_ptr++;
-    } else {
-      first_element=1;
+    ce_ptr = &mac_header_control_elements[0];
+
+    if ((short_padding == 1) || (short_padding == 2)) {
+	mac_header_ptr->R = 0;
+	mac_header_ptr->E = 0;
+	mac_header_ptr->LCID = SHORT_PADDING;
+	first_element = 1;
+	last_size = 1;
     }
 
-    mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
-    mac_header_ptr->LCID = POWER_HEADROOM;
-    last_size=1;
-    *((POWER_HEADROOM_CMD *)ce_ptr)=(*power_headroom);
-    ce_ptr+=sizeof(POWER_HEADROOM_CMD);
-    LOG_D(MAC, "phr header size %zu\n",sizeof(POWER_HEADROOM_CMD));
-  }
+    if (short_padding == 2) {
+	mac_header_ptr->E = 1;
+	mac_header_ptr++;
+	mac_header_ptr->R = 0;
+	mac_header_ptr->E = 0;
+	mac_header_ptr->LCID = SHORT_PADDING;
+	last_size = 1;
+    }
+
+    if (power_headroom) {
+	if (first_element > 0) {
+	    mac_header_ptr->E = 1;
+	    mac_header_ptr++;
+	} else {
+	    first_element = 1;
+	}
+
+	mac_header_ptr->R = 0;
+	mac_header_ptr->E = 0;
+	mac_header_ptr->LCID = POWER_HEADROOM;
+	last_size = 1;
+	*((POWER_HEADROOM_CMD *) ce_ptr) = (*power_headroom);
+	ce_ptr += sizeof(POWER_HEADROOM_CMD);
+	LOG_D(MAC, "phr header size %zu\n", sizeof(POWER_HEADROOM_CMD));
+    }
 
-  if (crnti) {
+    if (crnti) {
 #ifdef DEBUG_HEADER_PARSING
-    LOG_D(MAC,"[UE] CRNTI : %x (first_element %d)\n",*crnti,first_element);
+	LOG_D(MAC, "[UE] CRNTI : %x (first_element %d)\n", *crnti,
+	      first_element);
 #endif
 
-    if (first_element>0) {
-      mac_header_ptr->E = 1;
-      mac_header_ptr++;
-    } else {
-      first_element=1;
-    }
-
-    mac_header_ptr->R    = 0;
-    mac_header_ptr->E    = 0;
-    mac_header_ptr->LCID = CRNTI;
-    last_size=1;
-    *((uint16_t *)ce_ptr)=(*crnti);
-    ce_ptr+=sizeof(uint16_t);
-    //    printf("offset %d\n",ce_ptr-mac_header_control_elements);
-  }
-
-  if (truncated_bsr) {
-    if (first_element>0) {
-      mac_header_ptr->E = 1;
-      /*
-      printf("last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
-       */
-      mac_header_ptr++;
-    } else {
-      first_element=1;
+	if (first_element > 0) {
+	    mac_header_ptr->E = 1;
+	    mac_header_ptr++;
+	} else {
+	    first_element = 1;
+	}
+
+	mac_header_ptr->R = 0;
+	mac_header_ptr->E = 0;
+	mac_header_ptr->LCID = CRNTI;
+	last_size = 1;
+	*((uint16_t *) ce_ptr) = (*crnti);
+	ce_ptr += sizeof(uint16_t);
+	//    printf("offset %d\n",ce_ptr-mac_header_control_elements);
     }
 
+    if (truncated_bsr) {
+	if (first_element > 0) {
+	    mac_header_ptr->E = 1;
+	    /*
+	       printf("last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
+	     */
+	    mac_header_ptr++;
+	} else {
+	    first_element = 1;
+	}
+
 #ifdef DEBUG_HEADER_PARSING
-    LOG_D(MAC,"[UE] Scheduler Truncated BSR Header\n");
+	LOG_D(MAC, "[UE] Scheduler Truncated BSR Header\n");
 #endif
-    mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
-    mac_header_ptr->LCID = TRUNCATED_BSR;
-    last_size=1;
-    *((BSR_TRUNCATED *)ce_ptr)=(*truncated_bsr);
-    ce_ptr+=sizeof(BSR_TRUNCATED);
-    //    printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
-
-  } else if (short_bsr) {
-    if (first_element>0) {
-      mac_header_ptr->E = 1;
-      /*
-      printf("last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
-       */
-      mac_header_ptr++;
-    } else {
-      first_element=1;
-    }
+	mac_header_ptr->R = 0;
+	mac_header_ptr->E = 0;
+	mac_header_ptr->LCID = TRUNCATED_BSR;
+	last_size = 1;
+	*((BSR_TRUNCATED *) ce_ptr) = (*truncated_bsr);
+	ce_ptr += sizeof(BSR_TRUNCATED);
+	//    printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
+
+    } else if (short_bsr) {
+	if (first_element > 0) {
+	    mac_header_ptr->E = 1;
+	    /*
+	       printf("last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
+	     */
+	    mac_header_ptr++;
+	} else {
+	    first_element = 1;
+	}
 
 #ifdef DEBUG_HEADER_PARSING
-    LOG_D(MAC,"[UE] Scheduler SHORT BSR Header\n");
+	LOG_D(MAC, "[UE] Scheduler SHORT BSR Header\n");
 #endif
-    mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
-    mac_header_ptr->LCID = SHORT_BSR;
-    last_size=1;
-    *((BSR_SHORT *)ce_ptr)=(*short_bsr);
-    ce_ptr+=sizeof(BSR_SHORT);
-
-    //    printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
-  } else if (long_bsr) {
-    if (first_element>0) {
-      mac_header_ptr->E = 1;
-      /*
-      printf("last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
-      ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
-       */
-      mac_header_ptr++;
-    } else {
-      first_element=1;
-    }
+	mac_header_ptr->R = 0;
+	mac_header_ptr->E = 0;
+	mac_header_ptr->LCID = SHORT_BSR;
+	last_size = 1;
+	*((BSR_SHORT *) ce_ptr) = (*short_bsr);
+	ce_ptr += sizeof(BSR_SHORT);
+
+	//    printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
+    } else if (long_bsr) {
+	if (first_element > 0) {
+	    mac_header_ptr->E = 1;
+	    /*
+	       printf("last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
+	       ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
+	     */
+	    mac_header_ptr++;
+	} else {
+	    first_element = 1;
+	}
 
 #ifdef DEBUG_HEADER_PARSING
-    LOG_D(MAC,"[UE] Scheduler Long BSR Header\n");
+	LOG_D(MAC, "[UE] Scheduler Long BSR Header\n");
 #endif
-    mac_header_ptr->R = 0;
-    mac_header_ptr->E    = 0;
-    mac_header_ptr->LCID = LONG_BSR;
-    last_size=1;
-
-    *(ce_ptr)     = (long_bsr->Buffer_size0 << 2) | ((long_bsr->Buffer_size1 & 0x30) >> 4);
-    *(ce_ptr + 1) = ((long_bsr->Buffer_size1 & 0x0F) << 4) | ((long_bsr->Buffer_size2 & 0x3C) >> 2);
-    *(ce_ptr + 2) = ((long_bsr->Buffer_size2 & 0x03) << 2) | (long_bsr->Buffer_size3 & 0x3F);
-    ce_ptr += BSR_LONG_SIZE;
-
-    //    printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
-  }
+	mac_header_ptr->R = 0;
+	mac_header_ptr->E = 0;
+	mac_header_ptr->LCID = LONG_BSR;
+	last_size = 1;
+
+	*(ce_ptr) =
+	    (long_bsr->
+	     Buffer_size0 << 2) | ((long_bsr->Buffer_size1 & 0x30) >> 4);
+	*(ce_ptr + 1) =
+	    ((long_bsr->Buffer_size1 & 0x0F) << 4) | ((long_bsr->
+						       Buffer_size2 & 0x3C)
+						      >> 2);
+	*(ce_ptr + 2) =
+	    ((long_bsr->
+	      Buffer_size2 & 0x03) << 2) | (long_bsr->Buffer_size3 & 0x3F);
+	ce_ptr += BSR_LONG_SIZE;
+
+	//    printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements);
+    }
+    //  printf("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr);
 
-  //  printf("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr);
+    for (i = 0; i < num_sdus; i++) {
+#ifdef DEBUG_HEADER_PARSING
+	LOG_T(MAC, "[UE] sdu subheader %d (lcid %d, %d bytes)\n", i,
+	      sdu_lcids[i], sdu_lengths[i]);
+#endif
 
-  for (i=0; i<num_sdus; i++) {
+	if ((i == (num_sdus - 1))
+	    && ((short_padding) || (post_padding == 0))) {
+	    if (first_element > 0) {
+		mac_header_ptr->E = 1;
+#ifdef DEBUG_HEADER_PARSING
+		LOG_D(MAC, "[UE] last subheader : %x (R%d,E%d,LCID%d)\n",
+		      *(unsigned char *) mac_header_ptr,
+		      ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->R,
+		      ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E,
+		      ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID);
+#endif
+		mac_header_ptr += last_size;
+	    }
+	    mac_header_ptr->R = 0;
+	    mac_header_ptr->E = 0;
+	    mac_header_ptr->LCID = sdu_lcids[i];
+	} else {
+	    if ((first_element > 0)) {
+		mac_header_ptr->E = 1;
 #ifdef DEBUG_HEADER_PARSING
-    LOG_T(MAC,"[UE] sdu subheader %d (lcid %d, %d bytes)\n",i,sdu_lcids[i],sdu_lengths[i]);
+		LOG_D(MAC, "[UE] last subheader : %x (R%d,E%d,LCID%d)\n",
+		      *(unsigned char *) mac_header_ptr,
+		      ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->R,
+		      ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E,
+		      ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID);
 #endif
+		mac_header_ptr += last_size;
+		//      printf("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr);
+	    } else {
+		first_element = 1;
+
+	    }
+
+	    if (sdu_lengths[i] < 128) {
+		((SCH_SUBHEADER_SHORT *) mac_header_ptr)->R = 0;	// 3
+		((SCH_SUBHEADER_SHORT *) mac_header_ptr)->E = 0;
+		((SCH_SUBHEADER_SHORT *) mac_header_ptr)->F = 0;
+		((SCH_SUBHEADER_SHORT *) mac_header_ptr)->LCID =
+		    sdu_lcids[i];
+		((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L =
+		    (unsigned char) sdu_lengths[i];
+		last_size = 2;
+#ifdef DEBUG_HEADER_PARSING
+		LOG_D(MAC, "[UE] short sdu\n");
+		LOG_T(MAC,
+		      "[UE] last subheader : %x (R%d,E%d,LCID%d,F%d,L%d)\n",
+		      ((uint16_t *) mac_header_ptr)[0],
+		      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->R,
+		      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->E,
+		      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->LCID,
+		      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->F,
+		      ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L);
+#endif
+	    } else {
+		((SCH_SUBHEADER_LONG *) mac_header_ptr)->R = 0;
+		((SCH_SUBHEADER_LONG *) mac_header_ptr)->E = 0;
+		((SCH_SUBHEADER_LONG *) mac_header_ptr)->F = 1;
+		((SCH_SUBHEADER_LONG *) mac_header_ptr)->LCID =
+		    sdu_lcids[i];
+		((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_MSB =
+		    ((unsigned short) sdu_lengths[i] >> 8) & 0x7f;
+		((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_LSB =
+		    (unsigned short) sdu_lengths[i] & 0xff;
+		((SCH_SUBHEADER_LONG *) mac_header_ptr)->padding = 0x00;
+		last_size = 3;
+#ifdef DEBUG_HEADER_PARSING
+		LOG_D(MAC, "[UE] long sdu\n");
+#endif
+	    }
+	}
+    }
+
+    if (post_padding > 0) {	// we have lots of padding at the end of the packet
+	mac_header_ptr->E = 1;
+	mac_header_ptr += last_size;
+	// add a padding element
+	mac_header_ptr->R = 0;
+	mac_header_ptr->E = 0;
+	mac_header_ptr->LCID = SHORT_PADDING;
+	mac_header_ptr++;
+    } else {			// no end of packet padding
+	// last SDU subhead is of fixed type (sdu length implicitly to be computed at UE)
+	mac_header_ptr++;
+	//mac_header_ptr=last_size; // FIXME: should be ++
+    }
 
-    if ((i == (num_sdus - 1)) && ((short_padding) || (post_padding == 0))) {
-        if (first_element>0) {
-            mac_header_ptr->E = 1;
-      #ifdef DEBUG_HEADER_PARSING
-            LOG_D(MAC,"[UE] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
-                  ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
-                  ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
-                  ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
-      #endif
-            mac_header_ptr+=last_size;
-        }
-        mac_header_ptr->R    = 0;
-        mac_header_ptr->E    = 0;
-        mac_header_ptr->LCID = sdu_lcids[i];
-    }
-    else {
-        if ((first_element>0)) {
-          mac_header_ptr->E = 1;
-    #ifdef DEBUG_HEADER_PARSING
-          LOG_D(MAC,"[UE] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr,
-                ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R,
-                ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E,
-                ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID);
-    #endif
-          mac_header_ptr+=last_size;
-          //      printf("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr);
-        } else {
-          first_element=1;
-
-        }
-
-        if (sdu_lengths[i] < 128) {
-          ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R    = 0; // 3
-          ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E    = 0;
-          ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F    = 0;
-          ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID = sdu_lcids[i];
-          ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L    = (unsigned char)sdu_lengths[i];
-          last_size=2;
-    #ifdef DEBUG_HEADER_PARSING
-          LOG_D(MAC,"[UE] short sdu\n");
-          LOG_T(MAC,"[UE] last subheader : %x (R%d,E%d,LCID%d,F%d,L%d)\n",
-                ((uint16_t*)mac_header_ptr)[0],
-                ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R,
-                ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E,
-                ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID,
-                ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F,
-                ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L);
-    #endif
-        } else {
-          ((SCH_SUBHEADER_LONG *)mac_header_ptr)->R    = 0;
-          ((SCH_SUBHEADER_LONG *)mac_header_ptr)->E    = 0;
-          ((SCH_SUBHEADER_LONG *)mac_header_ptr)->F    = 1;
-          ((SCH_SUBHEADER_LONG *)mac_header_ptr)->LCID = sdu_lcids[i];
-          ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_MSB    = ((unsigned short) sdu_lengths[i]>>8)&0x7f;
-          ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_LSB    = (unsigned short) sdu_lengths[i]&0xff;
-          ((SCH_SUBHEADER_LONG *)mac_header_ptr)->padding  = 0x00;
-          last_size=3;
-    #ifdef DEBUG_HEADER_PARSING
-          LOG_D(MAC,"[UE] long sdu\n");
-    #endif
-        }
-    }
-  }
-
-  if (post_padding>0) {// we have lots of padding at the end of the packet
-    mac_header_ptr->E = 1;
-    mac_header_ptr+=last_size;
-    // add a padding element
-    mac_header_ptr->R    = 0;
-    mac_header_ptr->E    = 0;
-    mac_header_ptr->LCID = SHORT_PADDING;
-    mac_header_ptr++;
-  } else { // no end of packet padding
-    // last SDU subhead is of fixed type (sdu length implicitly to be computed at UE)
-    mac_header_ptr++;
-    //mac_header_ptr=last_size; // FIXME: should be ++
-  }
-
-
-  if ((ce_ptr-mac_header_control_elements) > 0) {
-    memcpy((void*)mac_header_ptr,mac_header_control_elements,ce_ptr-mac_header_control_elements);
-    mac_header_ptr+=(unsigned char)(ce_ptr-mac_header_control_elements);
-  }
 
+    if ((ce_ptr - mac_header_control_elements) > 0) {
+	memcpy((void *) mac_header_ptr, mac_header_control_elements,
+	       ce_ptr - mac_header_control_elements);
+	mac_header_ptr +=
+	    (unsigned char) (ce_ptr - mac_header_control_elements);
+    }
 #ifdef DEBUG_HEADER_PARSING
-  LOG_T(MAC," [UE] header : ");
+    LOG_T(MAC, " [UE] header : ");
 
-  for (i=0; i<((unsigned char*)mac_header_ptr - mac_header); i++) {
-    LOG_T(MAC,"%2x.",mac_header[i]);
-  }
+    for (i = 0; i < ((unsigned char *) mac_header_ptr - mac_header); i++) {
+	LOG_T(MAC, "%2x.", mac_header[i]);
+    }
 
-  LOG_T(MAC,"\n");
+    LOG_T(MAC, "\n");
 #endif
-  return((unsigned char*)mac_header_ptr - mac_header);
+    return ((unsigned char *) mac_header_ptr - mac_header);
 
 }
 
-void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint8_t *ulsch_buffer,uint16_t buflen, uint8_t *access_mode)
+void
+ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
+	   sub_frame_t subframe, uint8_t eNB_index,
+	   uint8_t * ulsch_buffer, uint16_t buflen, uint8_t * access_mode)
 {
 
-  uint8_t total_rlc_pdu_header_len=0, rlc_pdu_header_len_last=0 ;
-  uint16_t buflen_remain = 0;
-  uint8_t bsr_len=0,bsr_ce_len=0,bsr_header_len=0;
-  uint8_t phr_header_len=0, phr_ce_len=0,phr_len=0;
-  uint8_t lcid=0,lcid_rlc_pdu_count=0;
-  boolean_t is_lcid_processed = FALSE;
-  boolean_t is_all_lcid_processed = FALSE;
-  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;
-  uint8_t ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
-  uint16_t sdu_length_total=0;
-  BSR_SHORT bsr_short,bsr_truncated;
-  BSR_LONG bsr_long;
-  BSR_SHORT *bsr_s=&bsr_short;
-  BSR_LONG  *bsr_l=&bsr_long;
-  BSR_SHORT *bsr_t=&bsr_truncated;
-  POWER_HEADROOM_CMD phr;
-  POWER_HEADROOM_CMD *phr_p=&phr;
-  unsigned short short_padding=0, post_padding=0, padding_len=0;
-  int j; // used for padding
-  // Compute header length
-  int lcg_id = 0;
-  int lcg_id_bsr_trunc = 0;
-  int highest_priority = 16;
-  int num_lcg_id_with_data = 0;
-  rlc_buffer_occupancy_t lcid_buffer_occupancy_old=0, lcid_buffer_occupancy_new=0;
-  
-  LOG_D(MAC,"[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n",
-                        module_idP, frameP, subframe, buflen);
-
-
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
+    uint8_t total_rlc_pdu_header_len = 0, rlc_pdu_header_len_last = 0;
+    uint16_t buflen_remain = 0;
+    uint8_t bsr_len = 0, bsr_ce_len = 0, bsr_header_len = 0;
+    uint8_t phr_header_len = 0, phr_ce_len = 0, phr_len = 0;
+    uint8_t lcid = 0, lcid_rlc_pdu_count = 0;
+    boolean_t is_lcid_processed = FALSE;
+    boolean_t is_all_lcid_processed = FALSE;
+    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;
+    uint8_t ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
+    uint16_t sdu_length_total = 0;
+    BSR_SHORT bsr_short, bsr_truncated;
+    BSR_LONG bsr_long;
+    BSR_SHORT *bsr_s = &bsr_short;
+    BSR_LONG *bsr_l = &bsr_long;
+    BSR_SHORT *bsr_t = &bsr_truncated;
+    POWER_HEADROOM_CMD phr;
+    POWER_HEADROOM_CMD *phr_p = &phr;
+    unsigned short short_padding = 0, post_padding = 0, padding_len = 0;
+    int j;			// used for padding
+    // Compute header length
+    int lcg_id = 0;
+    int lcg_id_bsr_trunc = 0;
+    int highest_priority = 16;
+    int num_lcg_id_with_data = 0;
+    rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
+	0, lcid_buffer_occupancy_new = 0;
+
+    LOG_D(MAC,
+	  "[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n",
+	  module_idP, frameP, subframe, buflen);
+
+
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
 
 #if UE_TIMING_TRACE
-  start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
+    start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
 #endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_IN);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_IN);
 
 #ifdef CBA
 
-  if (*access_mode==CBA_ACCESS) {
-    LOG_D(MAC,"[UE %d] frameP %d subframe %d try CBA transmission\n",
-          module_idP, frameP, subframe);
+    if (*access_mode == CBA_ACCESS) {
+	LOG_D(MAC, "[UE %d] frameP %d subframe %d try CBA transmission\n",
+	      module_idP, frameP, subframe);
+
+	//if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DTCH] == LCID_EMPTY)
+	if (cba_access(module_idP, frameP, subframe, eNB_index, buflen) ==
+	    0) {
+	    *access_mode = POSTPONED_ACCESS;
+	    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+		(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT);
+	    return;
+	}
+
+	LOG_I(MAC,
+	      "[UE %d] frameP %d subframe %d CBA transmission oppurtunity, tbs %d\n",
+	      module_idP, frameP, subframe, buflen);
+    }
+#endif
+    bsr_header_len = 0;
+    phr_header_len = 1;		//sizeof(SCH_SUBHEADER_FIXED);
+
+    while (lcg_id < MAX_NUM_LCGID) {
+	if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]) {
+	    num_lcg_id_with_data++;
+	}
+	lcg_id++;
+    }
+
+    if (num_lcg_id_with_data) {
+	LOG_D(MAC,
+	      "[UE %d] MAC Tx data pending at frame%d subframe %d nb LCG =%d Bytes for LCG0=%d LCG1=%d LCG2=%d LCG3=%d BSR Trigger status =%d TBS=%d\n",
+	      module_idP, frameP, subframe, num_lcg_id_with_data,
+	      UE_mac_inst[module_idP].scheduling_info.BSR_bytes[0],
+	      UE_mac_inst[module_idP].scheduling_info.BSR_bytes[1],
+	      UE_mac_inst[module_idP].scheduling_info.BSR_bytes[2],
+	      UE_mac_inst[module_idP].scheduling_info.BSR_bytes[3],
+	      UE_mac_inst[module_idP].BSR_reporting_active, buflen);
 
-    //if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DTCH] == LCID_EMPTY)
-    if (cba_access(module_idP,frameP,subframe,eNB_index,buflen)==0) {
-      *access_mode=POSTPONED_ACCESS;
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT);
-      return;
     }
+    //Restart ReTxBSR Timer at new grant indication (36.321)
+    if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF !=
+	MAC_UE_BSR_TIMER_NOT_RUNNING) {
+	UE_mac_inst[module_idP].scheduling_info.retxBSR_SF =
+	    get_sf_retxBSRTimer(UE_mac_inst[module_idP].
+				scheduling_info.retxBSR_Timer);
+    }
+    // periodicBSR-Timer expires, trigger BSR
+    if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer !=
+	 PeriodicBSR_Timer_r12_infinity)
+	&& (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == 0)) {
+	// Trigger BSR Periodic
+	UE_mac_inst[module_idP].BSR_reporting_active |=
+	    BSR_TRIGGER_PERIODIC;
+
+	LOG_D(MAC,
+	      "[UE %d] MAC BSR Triggered PeriodicBSR Timer expiry at frame%d subframe %d TBS=%d\n",
+	      module_idP, frameP, subframe, buflen);
 
-    LOG_I(MAC,"[UE %d] frameP %d subframe %d CBA transmission oppurtunity, tbs %d\n",
-          module_idP, frameP, subframe,buflen);
-  }
+    }
+    //Compute BSR Length if Regular or Periodic BSR is triggered
+    //WARNING: if BSR long is computed, it may be changed to BSR short during or after multiplexing if there remains less than 1 LCGROUP with data after Tx
+    if (UE_mac_inst[module_idP].BSR_reporting_active) {
+
+	AssertFatal((UE_mac_inst[module_idP].BSR_reporting_active &
+		     BSR_TRIGGER_PADDING) == 0,
+		    "Inconsistent BSR Trigger=%d !\n",
+		    UE_mac_inst[module_idP].BSR_reporting_active);
+
+	if (buflen >= 4) {
+	    //A Regular or Periodic BSR can only be sent if TBS >= 4 as transmitting only a BSR is not allowed if UE has data to transmit
+	    bsr_header_len = 1;
+
+	    if (num_lcg_id_with_data <= 1) {
+		bsr_ce_len = sizeof(BSR_SHORT);	//1 byte
+	    } else {
+		bsr_ce_len = BSR_LONG_SIZE;	//3 bytes
+	    }
+	}
+    }
 
-#endif
-  bsr_header_len = 0;
-  phr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED);
-
-  while (lcg_id < MAX_NUM_LCGID) {
-     if  (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]){
-         num_lcg_id_with_data ++;
-     }
-     lcg_id ++;
-  }
-
-  if (num_lcg_id_with_data){
-      LOG_D(MAC,"[UE %d] MAC Tx data pending at frame%d subframe %d nb LCG =%d Bytes for LCG0=%d LCG1=%d LCG2=%d LCG3=%d BSR Trigger status =%d TBS=%d\n",
-                            module_idP,
-                            frameP,
-                            subframe,
-                            num_lcg_id_with_data,
-                            UE_mac_inst[module_idP].scheduling_info.BSR_bytes[0],
-                            UE_mac_inst[module_idP].scheduling_info.BSR_bytes[1],
-                            UE_mac_inst[module_idP].scheduling_info.BSR_bytes[2],
-                            UE_mac_inst[module_idP].scheduling_info.BSR_bytes[3],
-                            UE_mac_inst[module_idP].BSR_reporting_active, buflen);
-
-  }
-  //Restart ReTxBSR Timer at new grant indication (36.321)
-  if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING){
-      UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer);
-  }
-
-  // periodicBSR-Timer expires, trigger BSR
-  if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer != PeriodicBSR_Timer_r12_infinity)
-            && (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == 0)){
-        // Trigger BSR Periodic
-      UE_mac_inst[module_idP].BSR_reporting_active |= BSR_TRIGGER_PERIODIC;
-
-      LOG_D(MAC,"[UE %d] MAC BSR Triggered PeriodicBSR Timer expiry at frame%d subframe %d TBS=%d\n",
-                       module_idP, frameP, subframe, buflen);
-
-    }
-
-  //Compute BSR Length if Regular or Periodic BSR is triggered
-  //WARNING: if BSR long is computed, it may be changed to BSR short during or after multiplexing if there remains less than 1 LCGROUP with data after Tx
-  if (UE_mac_inst[module_idP].BSR_reporting_active){
-
-	  AssertFatal ((UE_mac_inst[module_idP].BSR_reporting_active & BSR_TRIGGER_PADDING) == 0 , "Inconsistent BSR Trigger=%d !\n",
-			  UE_mac_inst[module_idP].BSR_reporting_active);
-
-      if (buflen >= 4){
-    	  //A Regular or Periodic BSR can only be sent if TBS >= 4 as transmitting only a BSR is not allowed if UE has data to transmit
-    	  bsr_header_len = 1;
-
-          if (num_lcg_id_with_data <= 1){
-              bsr_ce_len = sizeof(BSR_SHORT); //1 byte
-          }
-          else{
-              bsr_ce_len = BSR_LONG_SIZE; //3 bytes
-          }
-      }
-  }
-
-  bsr_len = bsr_ce_len + bsr_header_len;
-
-  phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0;
-  if ((phr_ce_len > 0) && ((phr_ce_len + phr_header_len + bsr_len) <= buflen)){
-    phr_len = phr_ce_len + phr_header_len;
-    LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n",
-          module_idP, phr_len, phr_ce_len, phr_header_len, buflen);
-  } else {
-    phr_len=0;
-    phr_header_len = 0;
-    phr_ce_len = 0;
-  }
-
-  // check for UL bandwidth requests and add SR control element
-
-  // check for UL bandwidth requests and add SR control element
-
-  // Check for DCCH first
-// TO DO: Multiplex in the order defined by the logical channel prioritization
-for (lcid=DCCH; (lcid < MAX_NUM_LCID) && (is_all_lcid_processed == FALSE) ; lcid++) {
-  if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) {
+    bsr_len = bsr_ce_len + bsr_header_len;
+
+    phr_ce_len =
+	(UE_mac_inst[module_idP].PHR_reporting_active ==
+	 1) ? 1 /* sizeof(POWER_HEADROOM_CMD) */ : 0;
+    if ((phr_ce_len > 0)
+	&& ((phr_ce_len + phr_header_len + bsr_len) <= buflen)) {
+	phr_len = phr_ce_len + phr_header_len;
+	LOG_D(MAC,
+	      "[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n",
+	      module_idP, phr_len, phr_ce_len, phr_header_len, buflen);
+    } else {
+	phr_len = 0;
+	phr_header_len = 0;
+	phr_ce_len = 0;
+    }
 
-      lcid_rlc_pdu_count = 0;
-      is_lcid_processed	= FALSE;
-      lcid_buffer_occupancy_old = mac_rlc_get_buffer_occupancy_ind(module_idP,
-              	  	  	  	  	  	  	  	  	  	  	  	  	  UE_mac_inst[module_idP].crnti,
-																  eNB_index,
-																  frameP,
-																  subframe,
-																  ENB_FLAG_NO,
-																  lcid);
+    // check for UL bandwidth requests and add SR control element
 
-      lcid_buffer_occupancy_new = lcid_buffer_occupancy_old;
+    // check for UL bandwidth requests and add SR control element
 
-      AssertFatal (lcid_buffer_occupancy_new == UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid], "LCID=%d RLC has BO %d bytes but MAC has stored %d bytes\n",
-      					lcid,lcid_buffer_occupancy_new,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]);
+    // Check for DCCH first
+// TO DO: Multiplex in the order defined by the logical channel prioritization
+    for (lcid = DCCH;
+	 (lcid < MAX_NUM_LCID) && (is_all_lcid_processed == FALSE); lcid++)
+    {
+	if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] ==
+	    LCID_NOT_EMPTY) {
+
+	    lcid_rlc_pdu_count = 0;
+	    is_lcid_processed = FALSE;
+	    lcid_buffer_occupancy_old =
+		mac_rlc_get_buffer_occupancy_ind(module_idP,
+						 UE_mac_inst[module_idP].
+						 crnti, eNB_index, frameP,
+						 subframe, ENB_FLAG_NO,
+						 lcid);
+
+	    lcid_buffer_occupancy_new = lcid_buffer_occupancy_old;
+
+	    AssertFatal(lcid_buffer_occupancy_new ==
+			UE_mac_inst[module_idP].
+			scheduling_info.LCID_buffer_remain[lcid],
+			"LCID=%d RLC has BO %d bytes but MAC has stored %d bytes\n",
+			lcid, lcid_buffer_occupancy_new,
+			UE_mac_inst[module_idP].
+			scheduling_info.LCID_buffer_remain[lcid]);
+
+	    AssertFatal(lcid_buffer_occupancy_new <=
+			UE_mac_inst[module_idP].
+			scheduling_info.BSR_bytes[UE_mac_inst[module_idP].
+						  scheduling_info.LCGID
+						  [lcid]],
+			"LCID=%d RLC has more BO %d bytes than BSR = %d bytes\n",
+			lcid, lcid_buffer_occupancy_new,
+			UE_mac_inst[module_idP].
+			scheduling_info.BSR_bytes[UE_mac_inst[module_idP].
+						  scheduling_info.LCGID
+						  [lcid]]);
+
+
+	    //Multiplex all available DCCH RLC PDUs considering to multiplex the last PDU each time for maximize the data
+	    //Adjust at the end of the loop
+	    while ((!is_lcid_processed) && (lcid_buffer_occupancy_new)
+		   && (bsr_len + phr_len + total_rlc_pdu_header_len +
+		       sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen))
+	    {
+
+		// Workaround for issue in OAI eNB or EPC which are not able to process SRB2 message multiplexed with SRB1 on the same MAC PDU
+		if ((usim_test == 0) && (lcid == DCCH1)
+		    && (lcid_rlc_pdu_count == 0) && (num_sdus)) {
+
+		    // Skip SRB2 multiplex if at least one SRB1 SDU is already multiplexed
+		    break;
+		}
+
+		buflen_remain =
+		    buflen - (bsr_len + phr_len +
+			      total_rlc_pdu_header_len + sdu_length_total +
+			      1);
+
+
+		LOG_D(MAC,
+		      "[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
+		      "send (Transport Block size %d BSR size=%d PHR=%d SDU Length Total %d , mac header len %d BSR byte before Tx=%d)\n",
+		      module_idP, frameP, lcid, lcid_buffer_occupancy_new,
+		      buflen, bsr_len, phr_len, sdu_length_total,
+		      total_rlc_pdu_header_len,
+		      UE_mac_inst[module_idP].
+		      scheduling_info.BSR_bytes[UE_mac_inst[module_idP].
+						scheduling_info.LCGID
+						[lcid]]);
+
+
+		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,
+							 lcid,
+							 buflen_remain,
+							 (char *)
+							 &ulsch_buff
+							 [sdu_length_total]);
+
+
+		AssertFatal(buflen_remain >= sdu_lengths[num_sdus],
+			    "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n",
+			    lcid, sdu_lengths[num_sdus], buflen_remain);
+
+
+		if (sdu_lengths[num_sdus]) {
+		    sdu_length_total += sdu_lengths[num_sdus];
+		    sdu_lcids[num_sdus] = lcid;
+		    LOG_D(MAC,
+			  "[UE %d] TX Multiplex RLC PDU TX Got %d bytes for LcId%d\n",
+			  module_idP, sdu_lengths[num_sdus], lcid);
+
+		    if (buflen ==
+			(bsr_len + phr_len + total_rlc_pdu_header_len +
+			 sdu_length_total + 1)) {
+			//No more remaining TBS after this PDU
+			//exit the function
+			rlc_pdu_header_len_last = 1;
+			is_lcid_processed = TRUE;
+			is_all_lcid_processed = TRUE;
+		    } else {
+			rlc_pdu_header_len_last =
+			    (sdu_lengths[num_sdus] > 128) ? 3 : 2;
+
+			//Change to 1 byte if it does not fit in the TBS, ie last PDU
+			if (buflen <=
+			    (bsr_len + phr_len + total_rlc_pdu_header_len +
+			     rlc_pdu_header_len_last + sdu_length_total)) {
+			    rlc_pdu_header_len_last = 1;
+			    is_lcid_processed = TRUE;
+			    is_all_lcid_processed = TRUE;
+			}
+		    }
 
-      AssertFatal (lcid_buffer_occupancy_new <= UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], "LCID=%d RLC has more BO %d bytes than BSR = %d bytes\n",
-      					lcid,lcid_buffer_occupancy_new,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]);
+		    //Update number of SDU
+		    num_sdus++;
+
+		    //Update total MAC Header size for RLC PDUs and save last one
+		    total_rlc_pdu_header_len += rlc_pdu_header_len_last;
+
+		    lcid_rlc_pdu_count++;
+		} else {
+		    /* avoid infinite loop ... */
+		    is_lcid_processed = TRUE;
+		}
+
+		/* Get updated BO after multiplexing this PDU */
+		lcid_buffer_occupancy_new =
+		    mac_rlc_get_buffer_occupancy_ind(module_idP,
+						     UE_mac_inst
+						     [module_idP].crnti,
+						     eNB_index, frameP,
+						     subframe, ENB_FLAG_NO,
+						     lcid);
+
+		is_lcid_processed = (is_lcid_processed)
+		    || (lcid_buffer_occupancy_new <= 0);
+	    }
+
+	    //Update Buffer remain and BSR bytes after transmission
+
+	    AssertFatal(lcid_buffer_occupancy_new <=
+			lcid_buffer_occupancy_old,
+			"MAC UE Tx error : Buffer Occupancy After Tx=%d greater than before=%d BO! for LCID=%d RLC PDU nb=%d Frame %d Subrame %d\n",
+			lcid_buffer_occupancy_new,
+			lcid_buffer_occupancy_old, lcid,
+			lcid_rlc_pdu_count, frameP, subframe);
+
+	    UE_mac_inst[module_idP].scheduling_info.
+		LCID_buffer_remain[lcid] = lcid_buffer_occupancy_new;
+	    UE_mac_inst[module_idP].
+		scheduling_info.BSR_bytes[UE_mac_inst[module_idP].
+					  scheduling_info.LCGID[lcid]] +=
+		(lcid_buffer_occupancy_new - lcid_buffer_occupancy_old);
+
+	    //Update the number of LCGID with data as BSR shall reflect status after BSR transmission
+	    if ((num_lcg_id_with_data > 1)
+		&& (UE_mac_inst[module_idP].
+		    scheduling_info.BSR_bytes[UE_mac_inst[module_idP].
+					      scheduling_info.LCGID[lcid]]
+		    == 0)) {
+		num_lcg_id_with_data--;
+		// Change BSR size to BSR SHORT if num_lcg_id_with_data becomes to 1
+		if ((bsr_len) && (num_lcg_id_with_data == 1)) {
+		    bsr_ce_len = sizeof(BSR_SHORT);
+		    bsr_len = bsr_ce_len + bsr_header_len;
+		}
+	    }
+
+
+	    UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] =
+		LCID_EMPTY;
+	}
+    }
 
 
-      //Multiplex all available DCCH RLC PDUs considering to multiplex the last PDU each time for maximize the data
-      //Adjust at the end of the loop
-      while ((!is_lcid_processed) && (lcid_buffer_occupancy_new) && (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) {
 
-    	  // Workaround for issue in OAI eNB or EPC which are not able to process SRB2 message multiplexed with SRB1 on the same MAC PDU
-    	  if ((usim_test == 0) && (lcid == DCCH1) && (lcid_rlc_pdu_count == 0) && (num_sdus)) {
+    // Compute BSR Values and update Nb LCGID with data after multiplexing
+    num_lcg_id_with_data = 0;
+    lcg_id_bsr_trunc = 0;
+    for (lcg_id = 0; lcg_id < MAX_NUM_LCGID; lcg_id++) {
+	UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] =
+	    locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE,
+					UE_mac_inst
+					[module_idP].scheduling_info.
+					BSR_bytes[lcg_id]);
 
-    		  // Skip SRB2 multiplex if at least one SRB1 SDU is already multiplexed
-    		  break;
-    	  }
+	if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]) {
+	    num_lcg_id_with_data++;
+	    lcg_id_bsr_trunc = lcg_id;
+	}
+    }
 
-          buflen_remain = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1);
 
+    if (bsr_ce_len) {
+	//Print updated BSR when sent
+	LOG_D(MAC,
+	      "[UE %d] Remaining Buffer after Tx frame%d subframe %d nb LCG =%d Bytes for LCG0=%d LCG1=%d LCG2=%d LCG3=%d BSR Trigger status =%d TBS=%d\n",
+	      module_idP, frameP, subframe, num_lcg_id_with_data,
+	      UE_mac_inst[module_idP].scheduling_info.BSR_bytes[0],
+	      UE_mac_inst[module_idP].scheduling_info.BSR_bytes[1],
+	      UE_mac_inst[module_idP].scheduling_info.BSR_bytes[2],
+	      UE_mac_inst[module_idP].scheduling_info.BSR_bytes[3],
+	      UE_mac_inst[module_idP].BSR_reporting_active, buflen);
+
+	LOG_D(MAC,
+	      "[UE %d] Frame %d Subframe %d TX BSR Regular or Periodic size=%d BSR0=%d BSR1=%d BSR2=%d BSR3=%d\n",
+	      module_idP, frameP, subframe, bsr_ce_len,
+	      UE_mac_inst[module_idP].scheduling_info.BSR[0],
+	      UE_mac_inst[module_idP].scheduling_info.BSR[1],
+	      UE_mac_inst[module_idP].scheduling_info.BSR[2],
+	      UE_mac_inst[module_idP].scheduling_info.BSR[3]);
+    }
+    // build PHR and update the timers
+    if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) {
+	phr_p->PH = get_phr_mapping(module_idP, CC_id, eNB_index);
+	phr_p->R = 0;
+	LOG_D(MAC,
+	      "[UE %d] Frame %d report PHR with mapping (%d->%d) for LCID %d\n",
+	      module_idP, frameP, get_PHR(module_idP, CC_id, eNB_index),
+	      phr_p->PH, POWER_HEADROOM);
+	update_phr(module_idP, CC_id);
+    } else {
+	phr_p = NULL;
+    }
 
-		  LOG_D(MAC, "[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
-				"send (Transport Block size %d BSR size=%d PHR=%d SDU Length Total %d , mac header len %d BSR byte before Tx=%d)\n",
-				module_idP,frameP, lcid,lcid_buffer_occupancy_new,buflen,bsr_len,phr_len,sdu_length_total,total_rlc_pdu_header_len,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]);
+    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);
 
 
-		  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,
-							 lcid,
-							 buflen_remain,
-							 (char *)&ulsch_buff[sdu_length_total]);
-
-
-		  AssertFatal (buflen_remain >= sdu_lengths[num_sdus], "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n",
-					lcid,sdu_lengths[num_sdus],buflen_remain);
-
-
-		  if (sdu_lengths[num_sdus])
-		  {
-			  sdu_length_total += sdu_lengths[num_sdus];
-			  sdu_lcids[num_sdus] = lcid;
-			  LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU TX Got %d bytes for LcId%d\n",module_idP,sdu_lengths[num_sdus],lcid);
-
-			  if (buflen == (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1)) {
-				  //No more remaining TBS after this PDU
-				  //exit the function
-				  rlc_pdu_header_len_last = 1;
-				  is_lcid_processed = TRUE;
-				  is_all_lcid_processed = TRUE;
-			  }
-			  else {
-				  rlc_pdu_header_len_last = (sdu_lengths[num_sdus] > 128 ) ? 3 : 2 ;
-
-				  //Change to 1 byte if it does not fit in the TBS, ie last PDU
-				  if (buflen <= (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total)) {
-					  rlc_pdu_header_len_last = 1;
-					  is_lcid_processed = TRUE;
-					  is_all_lcid_processed = TRUE;
-				  }
-			  }
-
-			  //Update number of SDU
-			  num_sdus ++;
-
-			  //Update total MAC Header size for RLC PDUs and save last one
-			  total_rlc_pdu_header_len += rlc_pdu_header_len_last;
-
-			  lcid_rlc_pdu_count ++;
-		  }
-		  else
-		  {
-			  /* avoid infinite loop ... */
-			  is_lcid_processed = TRUE;
-		  }
-
-          /* Get updated BO after multiplexing this PDU */
-          lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,
-                        	  	  	  	  	  	  	  	  	  	  	  	  	  UE_mac_inst[module_idP].crnti,
-          																  eNB_index,
-          																  frameP,
-          																  subframe,
-          																  ENB_FLAG_NO,
-          																  lcid);
-
-          is_lcid_processed = (is_lcid_processed) || (lcid_buffer_occupancy_new <= 0);
-   }
-
-    //Update Buffer remain and BSR bytes after transmission
-
-    AssertFatal (lcid_buffer_occupancy_new <=  lcid_buffer_occupancy_old, "MAC UE Tx error : Buffer Occupancy After Tx=%d greater than before=%d BO! for LCID=%d RLC PDU nb=%d Frame %d Subrame %d\n",
-    		lcid_buffer_occupancy_new,lcid_buffer_occupancy_old,lcid,lcid_rlc_pdu_count,frameP,subframe);
-
-    UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = lcid_buffer_occupancy_new;
-    UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] += (lcid_buffer_occupancy_new - lcid_buffer_occupancy_old);
-
-    //Update the number of LCGID with data as BSR shall reflect status after BSR transmission
-    if ((num_lcg_id_with_data > 1) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] == 0))
-    {
-        num_lcg_id_with_data --;
-        // Change BSR size to BSR SHORT if num_lcg_id_with_data becomes to 1
-        if ((bsr_len) && (num_lcg_id_with_data == 1))
-        {
-            bsr_ce_len = sizeof(BSR_SHORT);
-            bsr_len = bsr_ce_len + bsr_header_len;
-        }
-    }
-
-
-    UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY;
-   }
- }
-
-
-
-  // Compute BSR Values and update Nb LCGID with data after multiplexing
-  num_lcg_id_with_data = 0;
-  lcg_id_bsr_trunc = 0;
-  for (lcg_id=0;lcg_id<MAX_NUM_LCGID;lcg_id++){
-      UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]);
-
-      if  (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]){
-          num_lcg_id_with_data ++;
-          lcg_id_bsr_trunc = lcg_id;
-      }
-  }
-
-
-  if (bsr_ce_len) {
-      //Print updated BSR when sent
-      LOG_D(MAC,"[UE %d] Remaining Buffer after Tx frame%d subframe %d nb LCG =%d Bytes for LCG0=%d LCG1=%d LCG2=%d LCG3=%d BSR Trigger status =%d TBS=%d\n",
-                            module_idP,
-                            frameP,
-                            subframe,
-                            num_lcg_id_with_data,
-                            UE_mac_inst[module_idP].scheduling_info.BSR_bytes[0],
-                            UE_mac_inst[module_idP].scheduling_info.BSR_bytes[1],
-                            UE_mac_inst[module_idP].scheduling_info.BSR_bytes[2],
-                            UE_mac_inst[module_idP].scheduling_info.BSR_bytes[3],
-                            UE_mac_inst[module_idP].BSR_reporting_active, buflen);
-
-      LOG_D(MAC,"[UE %d] Frame %d Subframe %d TX BSR Regular or Periodic size=%d BSR0=%d BSR1=%d BSR2=%d BSR3=%d\n",module_idP,frameP,subframe,bsr_ce_len,
-              UE_mac_inst[module_idP].scheduling_info.BSR[0],
-              UE_mac_inst[module_idP].scheduling_info.BSR[1],
-              UE_mac_inst[module_idP].scheduling_info.BSR[2],
-              UE_mac_inst[module_idP].scheduling_info.BSR[3]);
-  }
-
-
-  // build PHR and update the timers
-  if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) {
-    phr_p->PH = get_phr_mapping(module_idP,CC_id,eNB_index);
-    phr_p->R  = 0;
-    LOG_D(MAC,"[UE %d] Frame %d report PHR with mapping (%d->%d) for LCID %d\n",
-          module_idP,frameP, get_PHR(module_idP,CC_id,eNB_index), phr_p->PH,POWER_HEADROOM);
-    update_phr(module_idP,CC_id);
-  } else {
-    phr_p=NULL;
-  }
-
-  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);
-
-
-  // Check BSR padding: it is done after PHR according to Logical Channel Prioritization order
-  // Check for max padding size, ie MAC Hdr for last RLC PDU = 1
-  /* For Padding BSR:
-     -	if the number of padding bits is equal to or larger than the size of the Short BSR plus its subheader but smaller than the size of the Long BSR plus its subheader:
-         -	if more than one LCG has data available for transmission in the TTI where the BSR is transmitted: report Truncated BSR of the LCG with the highest priority logical channel with data available for transmission;
-         -	else report Short BSR.
-     -	else if the number of padding bits is equal to or larger than the size of the Long BSR plus its subheader, report Long BSR.
-   */
-  if (sdu_length_total) {
-      padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len - rlc_pdu_header_len_last + sdu_length_total + 1);
-  }
-  else {
-      padding_len = buflen - (bsr_len + phr_len);
-  }
-
-
-   if ((padding_len) && (bsr_len == 0))
-   {
-	   /* if the number of padding bits is equal to or larger than the size of the Long BSR plus its subheader, report Long BSR*/
-     if (padding_len >= (1+BSR_LONG_SIZE))
-     {
-    	 bsr_ce_len = BSR_LONG_SIZE;
-    	 bsr_header_len = 1;
-         // Trigger BSR Padding
-       UE_mac_inst[module_idP].BSR_reporting_active |= BSR_TRIGGER_PADDING;
-
-
-     } else if (padding_len >= (1+sizeof(BSR_SHORT))) {
-    	 bsr_ce_len = sizeof(BSR_SHORT);
-    	 bsr_header_len = 1;
-
-    	 if (num_lcg_id_with_data > 1)
-    	 {
-    	  // REPORT TRUNCATED BSR
-       	  //Get LCGID of highest priority LCID with data
-    		 for (lcid=DCCH; lcid < MAX_NUM_LCID ; lcid++) {
-    			 if (UE_mac_inst[module_idP].logicalChannelConfig[lcid] != NULL) {
-        			 lcg_id = UE_mac_inst[module_idP].scheduling_info.LCGID[lcid];
-
-        			 if ((lcg_id < MAX_NUM_LCGID) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id])
-        					 && (UE_mac_inst[module_idP].logicalChannelConfig[lcid]->ul_SpecificParameters->priority <= highest_priority)) {
-        				 highest_priority = UE_mac_inst[module_idP].logicalChannelConfig[lcid]->ul_SpecificParameters->priority;
-        				 lcg_id_bsr_trunc = lcg_id;
-        			 }
-    			 }
-    		 }
-    	 }
-    	 else
-    	 {
-    		 //Report SHORT BSR, clear bsr_t
-    		 bsr_t = NULL;
-    	 }
-
-       // Trigger BSR Padding
-       UE_mac_inst[module_idP].BSR_reporting_active |= BSR_TRIGGER_PADDING;
-     }
- 	 bsr_len = bsr_header_len + bsr_ce_len;
-   }
-
-   //Fill BSR Infos
-   if (bsr_ce_len == 0 ) {
-     bsr_s = NULL;
-     bsr_l = NULL;
-     bsr_t = NULL;
-   } else if (bsr_ce_len == BSR_LONG_SIZE) {
-     bsr_s = NULL;
-     bsr_t = NULL;
-     bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0];
-     bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1];
-     bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2];
-     bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3];
-
-     LOG_D(MAC, "[UE %d] Frame %d subframe %d BSR Trig=%d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP,subframe,
-    	   UE_mac_inst[module_idP].BSR_reporting_active,
-           UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0],
-           UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1],
-           UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2],
-           UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]);
-
-   } else if (bsr_ce_len == sizeof(BSR_SHORT)) {
-     bsr_l = NULL;
-     if ((bsr_t != NULL) && (UE_mac_inst[module_idP].BSR_reporting_active & BSR_TRIGGER_PADDING)) {
-    	 //Truncated BSR
-    	 bsr_s = NULL;
-    	 bsr_t->LCGID = lcg_id_bsr_trunc;
-    	 bsr_t->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc];
-
-         LOG_D(MAC,"[UE %d] Frame %d subframe %d BSR Trig=%d report TRUNCATED BSR with level %d for LCGID %d\n",
-               module_idP, frameP, subframe, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc);
-
-     }
-     else
-     {
-    	 bsr_t = NULL;
-         bsr_s->LCGID = lcg_id_bsr_trunc;
-         bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc];
-
-         LOG_D(MAC,"[UE %d] Frame %d subframe %d BSR Trig=%d report SHORT BSR with level %d for LCGID %d\n",
-               module_idP, frameP, subframe, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc);
-     }
-   }
+    // Check BSR padding: it is done after PHR according to Logical Channel Prioritization order
+    // Check for max padding size, ie MAC Hdr for last RLC PDU = 1
+    /* For Padding BSR:
+       -  if the number of padding bits is equal to or larger than the size of the Short BSR plus its subheader but smaller than the size of the Long BSR plus its subheader:
+       -  if more than one LCG has data available for transmission in the TTI where the BSR is transmitted: report Truncated BSR of the LCG with the highest priority logical channel with data available for transmission;
+       -  else report Short BSR.
+       -  else if the number of padding bits is equal to or larger than the size of the Long BSR plus its subheader, report Long BSR.
+     */
+    if (sdu_length_total) {
+	padding_len =
+	    buflen - (bsr_len + phr_len + total_rlc_pdu_header_len -
+		      rlc_pdu_header_len_last + sdu_length_total + 1);
+    } else {
+	padding_len = buflen - (bsr_len + phr_len);
+    }
+
 
+    if ((padding_len) && (bsr_len == 0)) {
+	/* if the number of padding bits is equal to or larger than the size of the Long BSR plus its subheader, report Long BSR */
+	if (padding_len >= (1 + BSR_LONG_SIZE)) {
+	    bsr_ce_len = BSR_LONG_SIZE;
+	    bsr_header_len = 1;
+	    // Trigger BSR Padding
+	    UE_mac_inst[module_idP].BSR_reporting_active |=
+		BSR_TRIGGER_PADDING;
+
+
+	} else if (padding_len >= (1 + sizeof(BSR_SHORT))) {
+	    bsr_ce_len = sizeof(BSR_SHORT);
+	    bsr_header_len = 1;
+
+	    if (num_lcg_id_with_data > 1) {
+		// REPORT TRUNCATED BSR
+		//Get LCGID of highest priority LCID with data
+		for (lcid = DCCH; lcid < MAX_NUM_LCID; lcid++) {
+		    if (UE_mac_inst[module_idP].
+			logicalChannelConfig[lcid] != NULL) {
+			lcg_id =
+			    UE_mac_inst[module_idP].scheduling_info.
+			    LCGID[lcid];
+
+			if ((lcg_id < MAX_NUM_LCGID)
+			    && (UE_mac_inst[module_idP].
+				scheduling_info.BSR_bytes[lcg_id])
+			    &&
+			    (UE_mac_inst[module_idP].logicalChannelConfig
+			     [lcid]->ul_SpecificParameters->priority <=
+			     highest_priority)) {
+			    highest_priority =
+				UE_mac_inst[module_idP].
+				logicalChannelConfig[lcid]->
+				ul_SpecificParameters->priority;
+			    lcg_id_bsr_trunc = lcg_id;
+			}
+		    }
+		}
+	    } else {
+		//Report SHORT BSR, clear bsr_t
+		bsr_t = NULL;
+	    }
+
+	    // Trigger BSR Padding
+	    UE_mac_inst[module_idP].BSR_reporting_active |=
+		BSR_TRIGGER_PADDING;
+	}
+	bsr_len = bsr_header_len + bsr_ce_len;
+    }
+    //Fill BSR Infos
+    if (bsr_ce_len == 0) {
+	bsr_s = NULL;
+	bsr_l = NULL;
+	bsr_t = NULL;
+    } else if (bsr_ce_len == BSR_LONG_SIZE) {
+	bsr_s = NULL;
+	bsr_t = NULL;
+	bsr_l->Buffer_size0 =
+	    UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0];
+	bsr_l->Buffer_size1 =
+	    UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1];
+	bsr_l->Buffer_size2 =
+	    UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2];
+	bsr_l->Buffer_size3 =
+	    UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3];
+
+	LOG_D(MAC,
+	      "[UE %d] Frame %d subframe %d BSR Trig=%d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n",
+	      module_idP, frameP, subframe,
+	      UE_mac_inst[module_idP].BSR_reporting_active,
+	      UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0],
+	      UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1],
+	      UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2],
+	      UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]);
+
+    } else if (bsr_ce_len == sizeof(BSR_SHORT)) {
+	bsr_l = NULL;
+	if ((bsr_t != NULL)
+	    && (UE_mac_inst[module_idP].BSR_reporting_active &
+		BSR_TRIGGER_PADDING)) {
+	    //Truncated BSR
+	    bsr_s = NULL;
+	    bsr_t->LCGID = lcg_id_bsr_trunc;
+	    bsr_t->Buffer_size =
+		UE_mac_inst[module_idP].scheduling_info.
+		BSR[lcg_id_bsr_trunc];
+
+	    LOG_D(MAC,
+		  "[UE %d] Frame %d subframe %d BSR Trig=%d report TRUNCATED BSR with level %d for LCGID %d\n",
+		  module_idP, frameP, subframe,
+		  UE_mac_inst[module_idP].BSR_reporting_active,
+		  UE_mac_inst[module_idP].
+		  scheduling_info.BSR[lcg_id_bsr_trunc], lcg_id_bsr_trunc);
+
+	} else {
+	    bsr_t = NULL;
+	    bsr_s->LCGID = lcg_id_bsr_trunc;
+	    bsr_s->Buffer_size =
+		UE_mac_inst[module_idP].scheduling_info.
+		BSR[lcg_id_bsr_trunc];
+
+	    LOG_D(MAC,
+		  "[UE %d] Frame %d subframe %d BSR Trig=%d report SHORT BSR with level %d for LCGID %d\n",
+		  module_idP, frameP, subframe,
+		  UE_mac_inst[module_idP].BSR_reporting_active,
+		  UE_mac_inst[module_idP].
+		  scheduling_info.BSR[lcg_id_bsr_trunc], lcg_id_bsr_trunc);
+	}
+    }
 // 1-bit padding or 2-bit padding  special padding subheader
 // Check for max padding size, ie MAC Hdr for last RLC PDU = 1
-   if (sdu_length_total) {
-       padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len - rlc_pdu_header_len_last + sdu_length_total + 1);
-   }
-   else {
-       padding_len = buflen - (bsr_len + phr_len);
-   }
-
-  if (padding_len <= 2) {
-    short_padding = padding_len;
-    // only add padding header
-    post_padding = 0;
-    //update total MAC Hdr size for RLC data
     if (sdu_length_total) {
-        total_rlc_pdu_header_len = total_rlc_pdu_header_len - rlc_pdu_header_len_last + 1;
-        rlc_pdu_header_len_last = 1;
-   }
-  }
-  else if (sdu_length_total) {
-      post_padding = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1);
-      // If by adding MAC Hdr for last RLC PDU the padding is 0 then set MAC Hdr for last RLC PDU = 1 and compute 1 or 2 byte padding
-      if (post_padding == 0) {
-          total_rlc_pdu_header_len -= rlc_pdu_header_len_last;
-          padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1);
-          short_padding = padding_len;
-          total_rlc_pdu_header_len ++;
-      }
-  }
-  else {
-    if (padding_len == buflen) {// nona mac pdu
-      *access_mode=CANCELED_ACCESS;
-    }
-
-    short_padding = 0;
-
-    post_padding = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1);
-  }
-
-  // Generate header
-  // if (num_sdus>0) {
-
-  payload_offset = generate_ulsch_header(ulsch_buffer,  // mac header
-                                         num_sdus,      // num sdus
-                                         short_padding,            // short pading
-                                         sdu_lengths,  // sdu length
-                                         sdu_lcids,    // sdu lcid
-                                         phr_p,  // power headroom
-                                         NULL,  // crnti
-                                         bsr_t,  // truncated bsr
-                                         bsr_s, // short bsr
-                                         bsr_l,
-                                         post_padding); // long_bsr
-
-  LOG_D(MAC,
-        "[UE %d] Generate header :bufflen %d  sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,  total_rlc_pdu_header_len %d, padding %d,post_padding %d, bsr len %d, phr len %d, reminder %d \n",
-        module_idP,buflen, sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],payload_offset, total_rlc_pdu_header_len,
-        short_padding,post_padding, bsr_len, phr_len,buflen-sdu_length_total-payload_offset);
-  // cycle through SDUs and place in ulsch_buffer
-  if (sdu_length_total) {
-      memcpy(&ulsch_buffer[payload_offset],ulsch_buff,sdu_length_total);
-  }
-
-  // fill remainder of DLSCH with random data
-  if (post_padding) {
-      for (j=0; j<(buflen-sdu_length_total-payload_offset); j++) {
-        ulsch_buffer[payload_offset+sdu_length_total+j] = (char)(taus()&0xff);
-      }
-  }
-  LOG_D(MAC,"[UE %d][SR] Gave SDU to PHY, clearing any scheduling request\n", module_idP);
-  UE_mac_inst[module_idP].scheduling_info.SR_pending=0;
-  UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0;
-
-  /* Actions when a BSR is sent */
-  if (bsr_ce_len)
-  {
-      LOG_D(MAC,"[UE %d] MAC BSR Sent !! bsr (ce%d,hdr%d) buff_len %d\n",
-              module_idP, bsr_ce_len, bsr_header_len, buflen);
-
-	  // Reset ReTx BSR Timer
-	  UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer);
-
-	  LOG_D(MAC,"[UE %d] MAC ReTx BSR Timer Reset =%d\n", module_idP,
-			  UE_mac_inst[module_idP].scheduling_info.retxBSR_SF);
-
-	  // Reset Periodic Timer except when BSR is truncated
-	  if ((bsr_t == NULL) && (UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer != PeriodicBSR_Timer_r12_infinity))
-	  {
-		  UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer);
-
-		  LOG_D(MAC,"[UE %d] MAC Periodic BSR Timer Reset =%d\n",
-		        module_idP, UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF);
-
-	  }
-
-	  // Reset BSR Trigger flags
-	  UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
-  }
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT);
+	padding_len =
+	    buflen - (bsr_len + phr_len + total_rlc_pdu_header_len -
+		      rlc_pdu_header_len_last + sdu_length_total + 1);
+    } else {
+	padding_len = buflen - (bsr_len + phr_len);
+    }
+
+    if (padding_len <= 2) {
+	short_padding = padding_len;
+	// only add padding header
+	post_padding = 0;
+	//update total MAC Hdr size for RLC data
+	if (sdu_length_total) {
+	    total_rlc_pdu_header_len =
+		total_rlc_pdu_header_len - rlc_pdu_header_len_last + 1;
+	    rlc_pdu_header_len_last = 1;
+	}
+    } else if (sdu_length_total) {
+	post_padding =
+	    buflen - (bsr_len + phr_len + total_rlc_pdu_header_len +
+		      sdu_length_total + 1);
+	// If by adding MAC Hdr for last RLC PDU the padding is 0 then set MAC Hdr for last RLC PDU = 1 and compute 1 or 2 byte padding
+	if (post_padding == 0) {
+	    total_rlc_pdu_header_len -= rlc_pdu_header_len_last;
+	    padding_len =
+		buflen - (bsr_len + phr_len + total_rlc_pdu_header_len +
+			  sdu_length_total + 1);
+	    short_padding = padding_len;
+	    total_rlc_pdu_header_len++;
+	}
+    } else {
+	if (padding_len == buflen) {	// nona mac pdu
+	    *access_mode = CANCELED_ACCESS;
+	}
+
+	short_padding = 0;
+
+	post_padding =
+	    buflen - (bsr_len + phr_len + total_rlc_pdu_header_len +
+		      sdu_length_total + 1);
+    }
+
+    // Generate header
+    // if (num_sdus>0) {
+
+    payload_offset = generate_ulsch_header(ulsch_buffer,	// mac header
+					   num_sdus,	// num sdus
+					   short_padding,	// short pading
+					   sdu_lengths,	// sdu length
+					   sdu_lcids,	// sdu lcid
+					   phr_p,	// power headroom
+					   NULL,	// crnti
+					   bsr_t,	// truncated bsr
+					   bsr_s,	// short bsr
+					   bsr_l, post_padding);	// long_bsr
+
+    LOG_D(MAC,
+	  "[UE %d] Generate header :bufflen %d  sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,  total_rlc_pdu_header_len %d, padding %d,post_padding %d, bsr len %d, phr len %d, reminder %d \n",
+	  module_idP, buflen, sdu_length_total, num_sdus, sdu_lengths[0],
+	  sdu_lcids[0], payload_offset, total_rlc_pdu_header_len,
+	  short_padding, post_padding, bsr_len, phr_len,
+	  buflen - sdu_length_total - payload_offset);
+    // cycle through SDUs and place in ulsch_buffer
+    if (sdu_length_total) {
+	memcpy(&ulsch_buffer[payload_offset], ulsch_buff,
+	       sdu_length_total);
+    }
+    // fill remainder of DLSCH with random data
+    if (post_padding) {
+	for (j = 0; j < (buflen - sdu_length_total - payload_offset); j++) {
+	    ulsch_buffer[payload_offset + sdu_length_total + j] =
+		(char) (taus() & 0xff);
+	}
+    }
+    LOG_D(MAC,
+	  "[UE %d][SR] Gave SDU to PHY, clearing any scheduling request\n",
+	  module_idP);
+    UE_mac_inst[module_idP].scheduling_info.SR_pending = 0;
+    UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0;
+
+    /* Actions when a BSR is sent */
+    if (bsr_ce_len) {
+	LOG_D(MAC,
+	      "[UE %d] MAC BSR Sent !! bsr (ce%d,hdr%d) buff_len %d\n",
+	      module_idP, bsr_ce_len, bsr_header_len, buflen);
+
+	// Reset ReTx BSR Timer
+	UE_mac_inst[module_idP].scheduling_info.retxBSR_SF =
+	    get_sf_retxBSRTimer(UE_mac_inst[module_idP].
+				scheduling_info.retxBSR_Timer);
+
+	LOG_D(MAC, "[UE %d] MAC ReTx BSR Timer Reset =%d\n", module_idP,
+	      UE_mac_inst[module_idP].scheduling_info.retxBSR_SF);
+
+	// Reset Periodic Timer except when BSR is truncated
+	if ((bsr_t == NULL)
+	    && (UE_mac_inst[module_idP].scheduling_info.
+		periodicBSR_Timer != PeriodicBSR_Timer_r12_infinity)) {
+	    UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF =
+		get_sf_periodicBSRTimer(UE_mac_inst
+					[module_idP].scheduling_info.
+					periodicBSR_Timer);
+
+	    LOG_D(MAC, "[UE %d] MAC Periodic BSR Timer Reset =%d\n",
+		  module_idP,
+		  UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF);
+
+	}
+	// Reset BSR Trigger flags
+	UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
+    }
+
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-  stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
+    stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
 #endif
-  
-  if (opt_enabled) {
-    trace_pdu(0, ulsch_buffer, buflen, module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, 0);
-    LOG_D(OPT,"[UE %d][ULSCH] Frame %d subframe %d trace pdu for rnti %x  with size %d\n",
-          module_idP, frameP, subframe, UE_mac_inst[module_idP].crnti, buflen);
-  }
+
+    if (opt_enabled) {
+	trace_pdu(0, ulsch_buffer, buflen, module_idP, 3,
+		  UE_mac_inst[module_idP].crnti,
+		  UE_mac_inst[module_idP].txFrame,
+		  UE_mac_inst[module_idP].txSubframe, 0, 0);
+	LOG_D(OPT,
+	      "[UE %d][ULSCH] Frame %d subframe %d trace pdu for rnti %x  with size %d\n",
+	      module_idP, frameP, subframe, UE_mac_inst[module_idP].crnti,
+	      buflen);
+    }
 }
 
 //------------------------------------------------------------------------------
@@ -1820,281 +2148,327 @@ for (lcid=DCCH; (lcid < MAX_NUM_LCID) && (is_all_lcid_processed == FALSE) ; lcid
 // 4. Perform PHR procedures
 
 UE_L2_STATE_t
-ue_scheduler(
-  const module_id_t    module_idP,
-  const frame_t        rxFrameP,
-  const sub_frame_t    rxSubframeP,
-  const frame_t        txFrameP,
-  const sub_frame_t    txSubframeP,
-  const lte_subframe_t directionP,
-  const uint8_t        eNB_indexP,
-  const int            CC_id)
+ue_scheduler(const module_id_t module_idP,
+	     const frame_t rxFrameP,
+	     const sub_frame_t rxSubframeP,
+	     const frame_t txFrameP,
+	     const sub_frame_t txSubframeP,
+	     const lte_subframe_t directionP,
+	     const uint8_t eNB_indexP, const int CC_id)
 //------------------------------------------------------------------------------
 {
-  int lcid; // lcid index
-  int TTI= 1;
-  int bucketsizeduration = -1;
-  int bucketsizeduration_max = -1;
-  // mac_rlc_status_resp_t rlc_status[MAX_NUM_LCGID]; // 4
-  // int8_t lcg_id;
-  struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL;
-  protocol_ctxt_t   ctxt;
+    int lcid;			// lcid index
+    int TTI = 1;
+    int bucketsizeduration = -1;
+    int bucketsizeduration_max = -1;
+    // mac_rlc_status_resp_t rlc_status[MAX_NUM_LCGID]; // 4
+    // int8_t lcg_id;
+    struct RACH_ConfigCommon *rach_ConfigCommon =
+	(struct RACH_ConfigCommon *) NULL;
+    protocol_ctxt_t ctxt;
 
 #if defined(ENABLE_ITTI)
-  MessageDef   *msg_p;
-  const char   *msg_name;
-  instance_t    instance;
-  int           result;
+    MessageDef *msg_p;
+    const char *msg_name;
+    instance_t instance;
+    int result;
 #endif
 #if UE_TIMING_TRACE
-  start_meas(&UE_mac_inst[module_idP].ue_scheduler);
+    start_meas(&UE_mac_inst[module_idP].ue_scheduler);
 #endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_IN);
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_IN);
 
-  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_NO, UE_mac_inst[module_idP].crnti, txFrameP, txSubframeP,eNB_indexP);
+    PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_NO,
+				   UE_mac_inst[module_idP].crnti, txFrameP,
+				   txSubframeP, eNB_indexP);
 #if defined(ENABLE_ITTI)
 
-  do {
-    // Checks if a message has been sent to MAC sub-task
-    itti_poll_msg (TASK_MAC_UE, &msg_p);
+    do {
+	// Checks if a message has been sent to MAC sub-task
+	itti_poll_msg(TASK_MAC_UE, &msg_p);
 
-    if (msg_p != NULL) {
-      msg_name = ITTI_MSG_NAME (msg_p);
-      instance = ITTI_MSG_INSTANCE (msg_p);
+	if (msg_p != NULL) {
+	    msg_name = ITTI_MSG_NAME(msg_p);
+	    instance = ITTI_MSG_INSTANCE(msg_p);
 
-      switch (ITTI_MSG_ID(msg_p)) {
-      case RRC_MAC_CCCH_DATA_REQ:
-        LOG_I(MAC, "Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
-              msg_name, ITTI_MSG_ORIGIN_NAME(msg_p), instance,
-              RRC_MAC_CCCH_DATA_REQ (msg_p).frame, RRC_MAC_CCCH_DATA_REQ (msg_p).enb_index);
+	    switch (ITTI_MSG_ID(msg_p)) {
+	    case RRC_MAC_CCCH_DATA_REQ:
+		LOG_I(MAC,
+		      "Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
+		      msg_name, ITTI_MSG_ORIGIN_NAME(msg_p), instance,
+		      RRC_MAC_CCCH_DATA_REQ(msg_p).frame,
+		      RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index);
 
-        // TODO process CCCH data req.
-        break;
+		// TODO process CCCH data req.
+		break;
 
 
-      default:
-        LOG_E(MAC, "Received unexpected message %s\n", msg_name);
-        break;
-      }
+	    default:
+		LOG_E(MAC, "Received unexpected message %s\n", msg_name);
+		break;
+	    }
 
-      result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
-      AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+	    result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
+	    AssertFatal(result == EXIT_SUCCESS,
+			"Failed to free memory (%d)!\n", result);
+	}
     }
-  } while(msg_p != NULL);
+    while (msg_p != NULL);
 
 #endif
 
-  //Mac_rlc_xface->frameP=frameP;
-  //Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
-  //if (subframe%5 == 0)
-  //LG#ifdef EXMIMO
-  pdcp_run(&ctxt);
-  //#endif
-  UE_mac_inst[module_idP].txFrame    = txFrameP;
-  UE_mac_inst[module_idP].txSubframe = txSubframeP;
-  UE_mac_inst[module_idP].rxFrame    = rxFrameP;
-  UE_mac_inst[module_idP].rxSubframe = rxSubframeP;
+    //Mac_rlc_xface->frameP=frameP;
+    //Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
+    //if (subframe%5 == 0)
+    //LG#ifdef EXMIMO
+    pdcp_run(&ctxt);
+    //#endif
+    UE_mac_inst[module_idP].txFrame = txFrameP;
+    UE_mac_inst[module_idP].txSubframe = txSubframeP;
+    UE_mac_inst[module_idP].rxFrame = rxFrameP;
+    UE_mac_inst[module_idP].rxSubframe = rxSubframeP;
 
 #ifdef CELLULAR
-  rrc_rx_tx(module_idP, txFrameP, 0, eNB_indexP);
+    rrc_rx_tx_ue(module_idP, txFrameP, 0, eNB_indexP);
 #else
 
-  switch (rrc_rx_tx(&ctxt,
-                    eNB_indexP,
-                    CC_id)) {
-  case RRC_OK:
-    break;
+    switch (rrc_rx_tx_ue(&ctxt, eNB_indexP, CC_id)) {
+    case RRC_OK:
+	break;
 
-  case RRC_ConnSetup_failed:
-    LOG_E(MAC,"RRCConnectionSetup failed, returning to IDLE state\n");
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
+    case RRC_ConnSetup_failed:
+	LOG_E(MAC, "RRCConnectionSetup failed, returning to IDLE state\n");
+	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	    (VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-    stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
+	stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
 #endif
-    return(CONNECTION_LOST);
-    break;
+	return (CONNECTION_LOST);
+	break;
 
-  case RRC_PHY_RESYNCH:
-    LOG_E(MAC,"RRC Loss of synch, returning PHY_RESYNCH\n");
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
+    case RRC_PHY_RESYNCH:
+	LOG_E(MAC, "RRC Loss of synch, returning PHY_RESYNCH\n");
+	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	    (VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-    stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
+	stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
 #endif
-    return(PHY_RESYNCH);
-
-  case RRC_Handover_failed:
-    LOG_N(MAC,"Handover failure for UE %d eNB_index %d\n",module_idP,eNB_indexP);
-    //Invalid...need to add another MAC UE state for re-connection procedure
-    phy_config_afterHO_ue(module_idP,0,eNB_indexP,(MobilityControlInfo_t *)NULL,1);
-    //return(3);
-    break;
-
-  case RRC_HO_STARTED:
-    LOG_I(MAC,"RRC handover, Instruct PHY to start the contention-free PRACH and synchronization\n");
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
+	return (PHY_RESYNCH);
+
+    case RRC_Handover_failed:
+	LOG_N(MAC, "Handover failure for UE %d eNB_index %d\n", module_idP,
+	      eNB_indexP);
+	//Invalid...need to add another MAC UE state for re-connection procedure
+	phy_config_afterHO_ue(module_idP, 0, eNB_indexP,
+			      (MobilityControlInfo_t *) NULL, 1);
+	//return(3);
+	break;
+
+    case RRC_HO_STARTED:
+	LOG_I(MAC,
+	      "RRC handover, Instruct PHY to start the contention-free PRACH and synchronization\n");
+	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	    (VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-    stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
+	stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
 #endif
-    return(PHY_HO_PRACH);
+	return (PHY_HO_PRACH);
 
-  default:
-    break;
-  }
+    default:
+	break;
+    }
 
 #endif
 
-  // Check Contention resolution timer (put in a function later)
-  if (UE_mac_inst[module_idP].RA_contention_resolution_timer_active == 1) {
+    // Check Contention resolution timer (put in a function later)
+    if (UE_mac_inst[module_idP].RA_contention_resolution_timer_active == 1) {
 
-    if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
-      rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
-    } else {
-      LOG_E(MAC,"FATAL: radioResourceConfigCommon is NULL!!!\n");
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
+	if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
+	    rach_ConfigCommon =
+		&UE_mac_inst[module_idP].
+		radioResourceConfigCommon->rach_ConfigCommon;
+	} else {
+	    LOG_E(MAC, "FATAL: radioResourceConfigCommon is NULL!!!\n");
+	    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+		(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER,
+		 VCD_FUNCTION_OUT);
 
-      stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
-      AssertFatal(1==0,"");
+	    stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
+	    AssertFatal(1 == 0, "");
 
 #if UE_TIMING_TRACE
-      stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
+	    stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
 #endif
-      //return(RRC_OK);
-    }
-
-    LOG_I(MAC,"Frame %d: Contention resolution timer %d/%ld\n",txFrameP,UE_mac_inst[module_idP].RA_contention_resolution_cnt,
-          ((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3));
-
-    UE_mac_inst[module_idP].RA_contention_resolution_cnt++;
-
-    if (UE_mac_inst[module_idP].RA_contention_resolution_cnt ==
-        ((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3)) {
-      UE_mac_inst[module_idP].RA_active = 0;
-      UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0;
-      // Signal PHY to quit RA procedure
-      LOG_E(MAC,"Module id %u Contention resolution timer expired, RA failed\n", module_idP);
-      ra_failed(module_idP,0,eNB_indexP);
-    }
-  }
-
-
-  // Get RLC status info and update Bj for all lcids that are active
-  for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) {
-    if (UE_mac_inst[module_idP].logicalChannelConfig[lcid]) {
-      // meausre the Bj
-      if ((directionP == SF_UL)&& (UE_mac_inst[module_idP].scheduling_info.Bj[lcid] >= 0)) {
-        if (UE_mac_inst[module_idP].logicalChannelConfig[lcid]->ul_SpecificParameters) {
-          bucketsizeduration = UE_mac_inst[module_idP].logicalChannelConfig[lcid]->ul_SpecificParameters->prioritisedBitRate * TTI;
-          bucketsizeduration_max = get_ms_bucketsizeduration(UE_mac_inst[module_idP].logicalChannelConfig[lcid]->ul_SpecificParameters->bucketSizeDuration);
-        } else {
-          LOG_E(MAC,"[UE %d] lcid %d, NULL ul_SpecificParameters\n",module_idP,lcid);
-          AssertFatal(1==0,"");
-        }
-
-        if ( UE_mac_inst[module_idP].scheduling_info.Bj[lcid] > bucketsizeduration_max ) {
-          UE_mac_inst[module_idP].scheduling_info.Bj[lcid] = bucketsizeduration_max;
-        } else {
-          UE_mac_inst[module_idP].scheduling_info.Bj[lcid] = bucketsizeduration;
-        }
-      }
-
-
-      /*
-      if (lcid == DCCH) {    
-        LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d Pending data for SRB1=%d for LCGID %d \n",                  
-        module_idP, txFrameP,txSubframeP,UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]],                  
-//         UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]);
-      }
-      */
-    }
-  }
-
-  // Call BSR procedure as described in Section 5.4.5 in 36.321
-
-  // First check ReTxBSR Timer because it is always configured
-  // Decrement ReTxBSR Timer if it is running and not null
-  if ((UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING)
-          && (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != 0)){
-      UE_mac_inst[module_idP].scheduling_info.retxBSR_SF --;
-  }
-
-  // Decrement Periodic Timer if it is running and not null
-  if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING)
-            && (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != 0)){
-        UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--;
-    }
-
-  //Check whether Regular BSR is triggered
-  if (update_bsr(module_idP,txFrameP, txSubframeP,eNB_indexP) == TRUE) {
-  // call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp.  This should implement the procedures
-  // outlined in Sections 5.4.4 an 5.4.5 of 36.321
-    UE_mac_inst[module_idP].scheduling_info.SR_pending= 1;
-    // Regular BSR trigger
-    UE_mac_inst[module_idP].BSR_reporting_active |= BSR_TRIGGER_REGULAR;
-    LOG_D(MAC,"[UE %d][BSR] Regular BSR Triggered Frame %d subframe %d SR for PUSCH is pending\n",
-          module_idP, txFrameP,txSubframeP);
-  }
-
-  // UE has no valid phy config dedicated ||  no valid/released  SR
-  if ((UE_mac_inst[module_idP].physicalConfigDedicated == NULL)) {
-    // cancel all pending SRs
-    UE_mac_inst[module_idP].scheduling_info.SR_pending=0;
-    UE_mac_inst[module_idP].ul_active=0;
-    LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP);
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
+	    //return(RRC_OK);
+	}
+
+	LOG_I(MAC, "Frame %d: Contention resolution timer %d/%ld\n",
+	      txFrameP,
+	      UE_mac_inst[module_idP].RA_contention_resolution_cnt,
+	      ((1 +
+		rach_ConfigCommon->
+		ra_SupervisionInfo.mac_ContentionResolutionTimer) << 3));
+
+	UE_mac_inst[module_idP].RA_contention_resolution_cnt++;
+
+	if (UE_mac_inst[module_idP].RA_contention_resolution_cnt ==
+	    ((1 +
+	      rach_ConfigCommon->
+	      ra_SupervisionInfo.mac_ContentionResolutionTimer) << 3)) {
+	    UE_mac_inst[module_idP].RA_active = 0;
+	    UE_mac_inst[module_idP].RA_contention_resolution_timer_active =
+		0;
+	    // Signal PHY to quit RA procedure
+	    LOG_E(MAC,
+		  "Module id %u Contention resolution timer expired, RA failed\n",
+		  module_idP);
+	    ra_failed(module_idP, 0, eNB_indexP);
+	}
+    }
+    // Get RLC status info and update Bj for all lcids that are active
+    for (lcid = DCCH; lcid < MAX_NUM_LCID; lcid++) {
+	if (UE_mac_inst[module_idP].logicalChannelConfig[lcid]) {
+	    // meausre the Bj
+	    if ((directionP == SF_UL)
+		&& (UE_mac_inst[module_idP].scheduling_info.Bj[lcid] >= 0)) {
+		if (UE_mac_inst[module_idP].
+		    logicalChannelConfig[lcid]->ul_SpecificParameters) {
+		    bucketsizeduration =
+			UE_mac_inst[module_idP].logicalChannelConfig
+			[lcid]->ul_SpecificParameters->prioritisedBitRate *
+			TTI;
+		    bucketsizeduration_max =
+			get_ms_bucketsizeduration(UE_mac_inst
+						  [module_idP].logicalChannelConfig
+						  [lcid]->ul_SpecificParameters->bucketSizeDuration);
+		} else {
+		    LOG_E(MAC,
+			  "[UE %d] lcid %d, NULL ul_SpecificParameters\n",
+			  module_idP, lcid);
+		    AssertFatal(1 == 0, "");
+		}
+
+		if (UE_mac_inst[module_idP].scheduling_info.Bj[lcid] >
+		    bucketsizeduration_max) {
+		    UE_mac_inst[module_idP].scheduling_info.Bj[lcid] =
+			bucketsizeduration_max;
+		} else {
+		    UE_mac_inst[module_idP].scheduling_info.Bj[lcid] =
+			bucketsizeduration;
+		}
+	    }
+
+
+	    /*
+	       if (lcid == DCCH) {    
+	       LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d Pending data for SRB1=%d for LCGID %d \n",                  
+	       module_idP, txFrameP,txSubframeP,UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]],                  
+	       //         UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]);
+	       }
+	     */
+	}
+    }
+
+    // Call BSR procedure as described in Section 5.4.5 in 36.321
+
+    // First check ReTxBSR Timer because it is always configured
+    // Decrement ReTxBSR Timer if it is running and not null
+    if ((UE_mac_inst[module_idP].scheduling_info.retxBSR_SF !=
+	 MAC_UE_BSR_TIMER_NOT_RUNNING)
+	&& (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != 0)) {
+	UE_mac_inst[module_idP].scheduling_info.retxBSR_SF--;
+    }
+    // Decrement Periodic Timer if it is running and not null
+    if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF !=
+	 MAC_UE_BSR_TIMER_NOT_RUNNING)
+	&& (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != 0)) {
+	UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--;
+    }
+    //Check whether Regular BSR is triggered
+    if (update_bsr(module_idP, txFrameP, txSubframeP, eNB_indexP) == TRUE) {
+	// call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp.  This should implement the procedures
+	// outlined in Sections 5.4.4 an 5.4.5 of 36.321
+	UE_mac_inst[module_idP].scheduling_info.SR_pending = 1;
+	// Regular BSR trigger
+	UE_mac_inst[module_idP].BSR_reporting_active |=
+	    BSR_TRIGGER_REGULAR;
+	LOG_D(MAC,
+	      "[UE %d][BSR] Regular BSR Triggered Frame %d subframe %d SR for PUSCH is pending\n",
+	      module_idP, txFrameP, txSubframeP);
+    }
+    // UE has no valid phy config dedicated ||  no valid/released  SR
+    if ((UE_mac_inst[module_idP].physicalConfigDedicated == NULL)) {
+	// cancel all pending SRs
+	UE_mac_inst[module_idP].scheduling_info.SR_pending = 0;
+	UE_mac_inst[module_idP].ul_active = 0;
+	LOG_T(MAC, "[UE %d] Release all SRs \n", module_idP);
+	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	    (VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
-    stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
+	stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
 #endif
-    return(CONNECTION_OK);
-  }
-
-  if ((UE_mac_inst[module_idP].physicalConfigDedicated->schedulingRequestConfig == NULL) ||
-      (UE_mac_inst[module_idP].physicalConfigDedicated->schedulingRequestConfig->present == SchedulingRequestConfig_PR_release)) {
+	return (CONNECTION_OK);
+    }
 
-    // initiate RA with CRNTI included in msg3 (no contention) as descibed in 36.321 sec 5.1.5
+    if ((UE_mac_inst[module_idP].
+	 physicalConfigDedicated->schedulingRequestConfig == NULL)
+	|| (UE_mac_inst[module_idP].
+	    physicalConfigDedicated->schedulingRequestConfig->present ==
+	    SchedulingRequestConfig_PR_release)) {
 
-    // cancel all pending SRs
-    UE_mac_inst[module_idP].scheduling_info.SR_pending=0;
-    UE_mac_inst[module_idP].ul_active=0;
-    LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP);
-  }
+	// initiate RA with CRNTI included in msg3 (no contention) as descibed in 36.321 sec 5.1.5
 
-  // Put this in a function
-  // Call PHR procedure as described in Section 5.4.6 in 36.321
-  if (UE_mac_inst[module_idP].PHR_state == MAC_MainConfig__phr_Config_PR_setup) { // normal operation
+	// cancel all pending SRs
+	UE_mac_inst[module_idP].scheduling_info.SR_pending = 0;
+	UE_mac_inst[module_idP].ul_active = 0;
+	LOG_T(MAC, "[UE %d] Release all SRs \n", module_idP);
+    }
+    // Put this in a function
+    // Call PHR procedure as described in Section 5.4.6 in 36.321
+    if (UE_mac_inst[module_idP].PHR_state == MAC_MainConfig__phr_Config_PR_setup) {	// normal operation
+
+	if (UE_mac_inst[module_idP].PHR_reconfigured == 1) {	// upon (re)configuration of the power headroom reporting functionality by upper layers
+	    UE_mac_inst[module_idP].PHR_reporting_active = 1;
+	    UE_mac_inst[module_idP].PHR_reconfigured = 0;
+	} else {
+	    //LOG_D(MAC,"PHR normal operation %d active %d \n", UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF, UE_mac_inst[module_idP].PHR_reporting_active);
+	    if ((UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF <=
+		 0)
+		&&
+		((get_PL(module_idP, 0, eNB_indexP) <
+		  UE_mac_inst[module_idP].scheduling_info.
+		  PathlossChange_db)
+		 || (UE_mac_inst[module_idP].power_backoff_db[eNB_indexP] >
+		     UE_mac_inst[module_idP].
+		     scheduling_info.PathlossChange_db)))
+		// trigger PHR and reset the timer later when the PHR report is sent
+	    {
+		UE_mac_inst[module_idP].PHR_reporting_active = 1;
+	    } else if (UE_mac_inst[module_idP].PHR_reporting_active == 0) {
+		UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF--;
+	    }
+
+	    if (UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF <=
+		0)
+		// trigger PHR and reset the timer later when the PHR report is sent
+	    {
+		UE_mac_inst[module_idP].PHR_reporting_active = 1;
+	    } else if (UE_mac_inst[module_idP].PHR_reporting_active == 0) {
+		UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF--;
+	    }
+	}
+    } else {			// release / nothing
+	UE_mac_inst[module_idP].PHR_reporting_active = 0;	// release PHR
+    }
 
-    if (UE_mac_inst[module_idP].PHR_reconfigured == 1) { // upon (re)configuration of the power headroom reporting functionality by upper layers
-      UE_mac_inst[module_idP].PHR_reporting_active = 1;
-      UE_mac_inst[module_idP].PHR_reconfigured = 0;
-    } else {
-      //LOG_D(MAC,"PHR normal operation %d active %d \n", UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF, UE_mac_inst[module_idP].PHR_reporting_active);
-      if ((UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF <= 0) &&
-          ((get_PL(module_idP,0,eNB_indexP) <  UE_mac_inst[module_idP].scheduling_info.PathlossChange_db) ||
-           (UE_mac_inst[module_idP].power_backoff_db[eNB_indexP] > UE_mac_inst[module_idP].scheduling_info.PathlossChange_db)))
-        // trigger PHR and reset the timer later when the PHR report is sent
-      {
-        UE_mac_inst[module_idP].PHR_reporting_active = 1;
-      } else if (UE_mac_inst[module_idP].PHR_reporting_active ==0 ) {
-        UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF--;
-      }
-
-      if (UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF <= 0 )
-        // trigger PHR and reset the timer later when the PHR report is sent
-      {
-        UE_mac_inst[module_idP].PHR_reporting_active = 1;
-      } else if (UE_mac_inst[module_idP].PHR_reporting_active == 0 ) {
-        UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF--;
-      }
-    }
-  } else {    // release / nothing
-    UE_mac_inst[module_idP].PHR_reporting_active = 0; // release PHR
-  }
-
-  //If the UE has UL resources allocated for new transmission for this TTI here:
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
+    //If the UE has UL resources allocated for new transmission for this TTI here:
+    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
+	(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
 #if UE_TIMING_TRACE
     stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
 #endif
-  return(CONNECTION_OK);
+    return (CONNECTION_OK);
 }
 
 // to be improved
@@ -2102,522 +2476,564 @@ ue_scheduler(
 extern int cba_backoff;
 double uniform_rngen(int min, int max)
 {
-  double random = (double)taus()/((double)0xffffffff);
-  return (max - min) * random + min;
+    double random = (double) taus() / ((double) 0xffffffff);
+    return (max - min) * random + min;
 }
 
-int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen)
+int
+cba_access(module_id_t module_idP, frame_t frameP,
+	   sub_frame_t subframe, uint8_t eNB_index, uint16_t buflen)
 {
 
-  mac_rlc_status_resp_t rlc_status;
-  int header_offset=4;
-  int rv =0;
-
-  /*
-  if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]<64))   ||
-      ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]<64))   ||
-      ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]<64)) )
-      //  && (UE_mac_inst[module_idP].ul_active == 0) // check if the ul is acrtive
-      && (UE_mac_inst[module_idP].cba_last_access[0] <= 0) ) { // backoff
-      //  LOG_D(MAC,"[UE %d] Frame %d Subframe %d: the current CBA backoff is %d \n", module_idP, frameP, subframe,
-      //  UE_mac_inst[module_idP].cba_last_access[0] );
-
-      UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,40));
-      LOG_D(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d UL active state %d \n", module_idP, frameP, subframe,
-          UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
-
-      rv=1;
-  } else if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]> 0 ))   ||
-      ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]> 0 ))   ||
-      ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]> 0 )) )
-      // && (UE_mac_inst[module_idP].ul_active == 0) // check if the ul is acrtive
-      && (UE_mac_inst[module_idP].cba_last_access[0]> 0) ){
-
-      UE_mac_inst[module_idP].cba_last_access[0]-=1;
-      LOG_D(MAC,"[UE %d] Frame %d Subframe %d: CBA backoff is decreased by one to %d UL active state %d \n",
-          module_idP, frameP, subframe,
-          UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
-
-  } else if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] == 0 ))   &&
-               ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] == 0 ))   &&
-               ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] ==  0 )) )
-             && (UE_mac_inst[module_idP].cba_last_access[0]> 0) ){
-    UE_mac_inst[module_idP].cba_last_access[0]-=1;
-    }*/
-
-  if ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]<64) ) {
-    return 0;
-  }
-
-  if ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] <= 0 ) &&
-      (UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] <= 0 ) &&
-      (UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] <= 0 ) ) {
-    return 0;
-  }
-
-  if (cba_backoff == 0 ) { // apply probablisitc method
-    UE_mac_inst[module_idP].cba_last_access[0]= uniform_rngen(0,1);
-
-    if (uniform_rngen(0,1) > 0.6 ) {
-      LOG_I(MAC,"[UE %d] Frame %d Subframe %d: CBA probability-based backoff (%d), UL active state %d \n", module_idP, frameP, subframe,
-            cba_backoff,UE_mac_inst[module_idP].ul_active);
-
-      rv=1;
-    }
-  } else {
-
-    if (UE_mac_inst[module_idP].cba_last_access[0] <= 0) {
-      UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,cba_backoff));
-
-      LOG_I(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d/%d UL active state %d \n", module_idP, frameP, subframe,
-            UE_mac_inst[module_idP].cba_last_access[0], cba_backoff,UE_mac_inst[module_idP].ul_active);
-
-      rv = 1;
-      /*
-      rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, // eNB_index
-      DTCH,
-      0);
-
-      if ((
-      //  (rlc_status.pdus_in_buffer > 0 )           &&
-      // (UE_mac_inst[module_idP].ul_active == 0)  && // check if the ul is acrtive
-      (rlc_status.head_sdu_is_segmented  == 0 )          &&
-      ((rlc_status.head_sdu_remaining_size_to_send + header_offset ) <= buflen )
-      )){
-      rv = 1;
-
-      UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,30));
-      LOG_D(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d UL active state %d \n", module_idP, frameP, subframe,
-      UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
-      */
+    mac_rlc_status_resp_t rlc_status;
+    int header_offset = 4;
+    int rv = 0;
+
+    /*
+       if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]<64))   ||
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]<64))   ||
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]<64)) )
+       //  && (UE_mac_inst[module_idP].ul_active == 0) // check if the ul is acrtive
+       && (UE_mac_inst[module_idP].cba_last_access[0] <= 0) ) { // backoff
+       //  LOG_D(MAC,"[UE %d] Frame %d Subframe %d: the current CBA backoff is %d \n", module_idP, frameP, subframe,
+       //  UE_mac_inst[module_idP].cba_last_access[0] );
+
+       UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,40));
+       LOG_D(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d UL active state %d \n", module_idP, frameP, subframe,
+       UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
+
+       rv=1;
+       } else if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]> 0 ))   ||
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]> 0 ))   ||
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]> 0 )) )
+       // && (UE_mac_inst[module_idP].ul_active == 0) // check if the ul is acrtive
+       && (UE_mac_inst[module_idP].cba_last_access[0]> 0) ){
+
+       UE_mac_inst[module_idP].cba_last_access[0]-=1;
+       LOG_D(MAC,"[UE %d] Frame %d Subframe %d: CBA backoff is decreased by one to %d UL active state %d \n",
+       module_idP, frameP, subframe,
+       UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
+
+       } else if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] == 0 ))   &&
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] == 0 ))   &&
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] ==  0 )) )
+       && (UE_mac_inst[module_idP].cba_last_access[0]> 0) ){
+       UE_mac_inst[module_idP].cba_last_access[0]-=1;
+       } */
+
+    if ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] > 0)
+	&& (UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] < 64)) {
+	return 0;
+    }
+
+    if ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] <= 0) &&
+	(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] <= 0) &&
+	(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] <= 0)) {
+	return 0;
+    }
+
+    if (cba_backoff == 0) {	// apply probablisitc method
+	UE_mac_inst[module_idP].cba_last_access[0] = uniform_rngen(0, 1);
+
+	if (uniform_rngen(0, 1) > 0.6) {
+	    LOG_I(MAC,
+		  "[UE %d] Frame %d Subframe %d: CBA probability-based backoff (%d), UL active state %d \n",
+		  module_idP, frameP, subframe, cba_backoff,
+		  UE_mac_inst[module_idP].ul_active);
+
+	    rv = 1;
+	}
     } else {
-      UE_mac_inst[module_idP].cba_last_access[0]-=1;
-      LOG_D(MAC,"[UE %d] Frame %d Subframe %d: wait for backoff to expire (%d) CBA UL active state %d \n",
-            module_idP, frameP, subframe,
-            UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
-    }
-  }
-
-  return rv;
-  /*
-    if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]<64))   ||
-    ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]<64))   ||
-    ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]<64)) )
-  //  && (UE_mac_inst[module_idP].ul_active == 0) // check if the ul is acrtive
-  && (UE_mac_inst[module_idP].cba_last_access[0] <= 0) ) {
-
-      UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,cba_backoff));
-
-      LOG_I(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d/%d UL active state %d \n", module_idP, frameP, subframe,
-      UE_mac_inst[module_idP].cba_last_access[0], cba_backoff,UE_mac_inst[module_idP].ul_active);
-
-      rv = 1;
-
-    rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, // eNB_index
-            DTCH,
-            0);
-
-    if ((
-   // (rlc_status.pdus_in_buffer > 0 )           &&
-  // (UE_mac_inst[module_idP].ul_active == 0)  && // check if the ul is acrtive
-   (rlc_status.head_sdu_is_segmented  == 0 )          &&
-   ((rlc_status.head_sdu_remaining_size_to_send + header_offset ) <= buflen )
-   )){
-      rv = 1;
-
-      UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,30));
-      LOG_D(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d UL active state %d \n", module_idP, frameP, subframe,
-      UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
-    } else
-      UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,5));
-
-
-    } else if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]> 0 ))   ||
-     ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]> 0 ))   ||
-     ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]> 0 )) )
-         // && (UE_mac_inst[module_idP].ul_active == 0) // check if the ul is acrtive
-         && (UE_mac_inst[module_idP].cba_last_access[0]> 0) )
-      {
-
-  UE_mac_inst[module_idP].cba_last_access[0]-=1;
-  LOG_D(MAC,"[UE %d] Frame %d Subframe %d: wait for backoff to expire (%d) CBA UL active state %d \n",
-        module_idP, frameP, subframe,
-        UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
-      }
-  }
-  */
+
+	if (UE_mac_inst[module_idP].cba_last_access[0] <= 0) {
+	    UE_mac_inst[module_idP].cba_last_access[0] =
+		round(uniform_rngen(1, cba_backoff));
+
+	    LOG_I(MAC,
+		  "[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d/%d UL active state %d \n",
+		  module_idP, frameP, subframe,
+		  UE_mac_inst[module_idP].cba_last_access[0], cba_backoff,
+		  UE_mac_inst[module_idP].ul_active);
+
+	    rv = 1;
+	    /*
+	       rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, // eNB_index
+	       DTCH,
+	       0);
+
+	       if ((
+	       //  (rlc_status.pdus_in_buffer > 0 )           &&
+	       // (UE_mac_inst[module_idP].ul_active == 0)  && // check if the ul is acrtive
+	       (rlc_status.head_sdu_is_segmented  == 0 )          &&
+	       ((rlc_status.head_sdu_remaining_size_to_send + header_offset ) <= buflen )
+	       )){
+	       rv = 1;
+
+	       UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,30));
+	       LOG_D(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d UL active state %d \n", module_idP, frameP, subframe,
+	       UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
+	     */
+	} else {
+	    UE_mac_inst[module_idP].cba_last_access[0] -= 1;
+	    LOG_D(MAC,
+		  "[UE %d] Frame %d Subframe %d: wait for backoff to expire (%d) CBA UL active state %d \n",
+		  module_idP, frameP, subframe,
+		  UE_mac_inst[module_idP].cba_last_access[0],
+		  UE_mac_inst[module_idP].ul_active);
+	}
+    }
+
+    return rv;
+    /*
+       if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]<64))   ||
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]<64))   ||
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]>0)&&(UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]<64)) )
+       //  && (UE_mac_inst[module_idP].ul_active == 0) // check if the ul is acrtive
+       && (UE_mac_inst[module_idP].cba_last_access[0] <= 0) ) {
+
+       UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,cba_backoff));
+
+       LOG_I(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d/%d UL active state %d \n", module_idP, frameP, subframe,
+       UE_mac_inst[module_idP].cba_last_access[0], cba_backoff,UE_mac_inst[module_idP].ul_active);
+
+       rv = 1;
+
+       rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, // eNB_index
+       DTCH,
+       0);
+
+       if ((
+       // (rlc_status.pdus_in_buffer > 0 )           &&
+       // (UE_mac_inst[module_idP].ul_active == 0)  && // check if the ul is acrtive
+       (rlc_status.head_sdu_is_segmented  == 0 )          &&
+       ((rlc_status.head_sdu_remaining_size_to_send + header_offset ) <= buflen )
+       )){
+       rv = 1;
+
+       UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,30));
+       LOG_D(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff  %d UL active state %d \n", module_idP, frameP, subframe,
+       UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
+       } else
+       UE_mac_inst[module_idP].cba_last_access[0]= round(uniform_rngen(1,5));
+
+
+       } else if (( ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]> 0 ))   ||
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]> 0 ))   ||
+       ((UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]> 0 )) )
+       // && (UE_mac_inst[module_idP].ul_active == 0) // check if the ul is acrtive
+       && (UE_mac_inst[module_idP].cba_last_access[0]> 0) )
+       {
+
+       UE_mac_inst[module_idP].cba_last_access[0]-=1;
+       LOG_D(MAC,"[UE %d] Frame %d Subframe %d: wait for backoff to expire (%d) CBA UL active state %d \n",
+       module_idP, frameP, subframe,
+       UE_mac_inst[module_idP].cba_last_access[0], UE_mac_inst[module_idP].ul_active);
+       }
+       }
+     */
 
 }
 #endif
 
 
-boolean_t  update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP,eNB_index_t eNB_index)
+boolean_t
+update_bsr(module_id_t module_idP, frame_t frameP,
+	   sub_frame_t subframeP, eNB_index_t eNB_index)
 {
 
-  mac_rlc_status_resp_t rlc_status;
-  boolean_t bsr_regular_triggered = FALSE;
-  uint8_t lcid;
-  uint8_t lcgid;
-  uint8_t num_lcid_with_data = 0; // for LCID with data only if LCGID is defined
-  uint16_t lcgid_buffer_remain[MAX_NUM_LCGID] = {0,0,0,0};
-  int32_t lcid_bytes_in_buffer[MAX_NUM_LCID];
-  /* Array for ordering LCID with data per decreasing priority order */
-  uint8_t lcid_reordered_array[MAX_NUM_LCID]=
-  {MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID};
-  uint8_t pos_next = 0;
-  uint8_t highest_priority = 16;
-  uint8_t array_index = 0;
-
-  // Reset All BSR Infos
-  lcid_bytes_in_buffer[0] = 0;
-  for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++)
-  {
-	  // Reset transmission status
-	  lcid_bytes_in_buffer[lcid] = 0;
-	  UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid]=LCID_EMPTY;
-  }
-
-  for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++)
-  {
-	  // Reset Buffer Info
-	  UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]=0;
-	  UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid]=0;
-  }
-
-  //Get Buffer Occupancy and fill lcid_reordered_array
-  for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++)
-  {
-	  if (UE_mac_inst[module_idP].logicalChannelConfig[lcid])
-	  {
-		  	lcgid = UE_mac_inst[module_idP].scheduling_info.LCGID[lcid];
-
-		  	// Store already available data to transmit per Group
-		  	if (lcgid < MAX_NUM_LCGID)
-		  	{
-			  	lcgid_buffer_remain[lcgid] += UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid];
-		  	}
-
-		    rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti,eNB_index,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
-		                                    lcid,
-		                                    0xFFFF); //TBS is not used in RLC at this step, set a special value for debug
-
-		    lcid_bytes_in_buffer[lcid] = rlc_status.bytes_in_buffer;
-
-		    if (rlc_status.bytes_in_buffer > 0)
-		    {
-		          LOG_D(MAC,"[UE %d] PDCCH Tick : LCID%d LCGID%d has data to transmit =%d bytes at frame %d subframe %d\n",
-		                              module_idP, lcid,lcgid,rlc_status.bytes_in_buffer,frameP,subframeP);
-
-		         UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY;
-		         //Update BSR_bytes and position in lcid_reordered_array only if Group is defined
-		         if (lcgid < MAX_NUM_LCGID)
-		         {
-		        	 num_lcid_with_data ++;
-			         // sum lcid buffer which has same lcgid
-			         UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] += rlc_status.bytes_in_buffer;
-
-			         //Fill in the array
-			         array_index = 0;
-			         do
-					{
-			        	 if (UE_mac_inst[module_idP].logicalChannelConfig[lcid]->ul_SpecificParameters->priority <= highest_priority)
-			        	 {
-			        		 //Insert if priority is higher or equal (lower or equal in value)
-			        		 for (pos_next=num_lcid_with_data-1; pos_next > array_index; pos_next--)
-			        		 {
-			        			 lcid_reordered_array[pos_next] = lcid_reordered_array[pos_next - 1];
-
-			        		 }
-			        		 lcid_reordered_array[array_index] = lcid;
-			        		 break;
-
-			        	 }
-			        	 array_index ++;
-					}
-			         while ((array_index < num_lcid_with_data) && (array_index < MAX_NUM_LCID));
-		         }
+    mac_rlc_status_resp_t rlc_status;
+    boolean_t bsr_regular_triggered = FALSE;
+    uint8_t lcid;
+    uint8_t lcgid;
+    uint8_t num_lcid_with_data = 0;	// for LCID with data only if LCGID is defined
+    uint16_t lcgid_buffer_remain[MAX_NUM_LCGID] = { 0, 0, 0, 0 };
+    int32_t lcid_bytes_in_buffer[MAX_NUM_LCID];
+    /* Array for ordering LCID with data per decreasing priority order */
+    uint8_t lcid_reordered_array[MAX_NUM_LCID] =
+	{ MAX_NUM_LCID, MAX_NUM_LCID, MAX_NUM_LCID, MAX_NUM_LCID,
+	MAX_NUM_LCID, MAX_NUM_LCID, MAX_NUM_LCID, MAX_NUM_LCID,
+	    MAX_NUM_LCID,
+	MAX_NUM_LCID, MAX_NUM_LCID
+    };
+    uint8_t pos_next = 0;
+    uint8_t highest_priority = 16;
+    uint8_t array_index = 0;
+
+    // Reset All BSR Infos
+    lcid_bytes_in_buffer[0] = 0;
+    for (lcid = DCCH; lcid < MAX_NUM_LCID; lcid++) {
+	// Reset transmission status
+	lcid_bytes_in_buffer[lcid] = 0;
+	UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] =
+	    LCID_EMPTY;
+    }
+
+    for (lcgid = 0; lcgid < MAX_NUM_LCGID; lcgid++) {
+	// Reset Buffer Info
+	UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0;
+	UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0;
+    }
+
+    //Get Buffer Occupancy and fill lcid_reordered_array
+    for (lcid = DCCH; lcid < MAX_NUM_LCID; lcid++) {
+	if (UE_mac_inst[module_idP].logicalChannelConfig[lcid]) {
+	    lcgid = UE_mac_inst[module_idP].scheduling_info.LCGID[lcid];
+
+	    // Store already available data to transmit per Group
+	    if (lcgid < MAX_NUM_LCGID) {
+		lcgid_buffer_remain[lcgid] +=
+		    UE_mac_inst[module_idP].
+		    scheduling_info.LCID_buffer_remain[lcid];
+	    }
+
+	    rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti, eNB_index, frameP, subframeP, ENB_FLAG_NO, MBMS_FLAG_NO, lcid, 0xFFFF);	//TBS is not used in RLC at this step, set a special value for debug
+
+	    lcid_bytes_in_buffer[lcid] = rlc_status.bytes_in_buffer;
+
+	    if (rlc_status.bytes_in_buffer > 0) {
+		LOG_D(MAC,
+		      "[UE %d] PDCCH Tick : LCID%d LCGID%d has data to transmit =%d bytes at frame %d subframe %d\n",
+		      module_idP, lcid, lcgid, rlc_status.bytes_in_buffer,
+		      frameP, subframeP);
+
+		UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] =
+		    LCID_NOT_EMPTY;
+		//Update BSR_bytes and position in lcid_reordered_array only if Group is defined
+		if (lcgid < MAX_NUM_LCGID) {
+		    num_lcid_with_data++;
+		    // sum lcid buffer which has same lcgid
+		    UE_mac_inst[module_idP].scheduling_info.
+			BSR_bytes[lcgid] += rlc_status.bytes_in_buffer;
+
+		    //Fill in the array
+		    array_index = 0;
+		    do {
+			if (UE_mac_inst[module_idP].logicalChannelConfig
+			    [lcid]->ul_SpecificParameters->priority <=
+			    highest_priority) {
+			    //Insert if priority is higher or equal (lower or equal in value)
+			    for (pos_next = num_lcid_with_data - 1;
+				 pos_next > array_index; pos_next--) {
+				lcid_reordered_array[pos_next] =
+				    lcid_reordered_array[pos_next - 1];
+
+			    }
+			    lcid_reordered_array[array_index] = lcid;
+			    break;
+
+			}
+			array_index++;
 		    }
-	  }
-
-  }
-
-  // Check whether a regular BSR can be triggered according to the first cases in 36.321
-  if (num_lcid_with_data)
-  {
-          LOG_D(MAC,"[UE %d] PDCCH Tick at frame %d subframe %d: NumLCID with data=%d Reordered LCID0=%d LCID1=%d LCID2=%d\n",
-                            module_idP, frameP, subframeP,num_lcid_with_data,lcid_reordered_array[0],lcid_reordered_array[1],lcid_reordered_array[2]);
-
-	  for (array_index=0; array_index < num_lcid_with_data; array_index++)
-	  {
-		  lcid = lcid_reordered_array[array_index];
-	      /* UL data, for a logical channel which belongs to a LCG, becomes available for transmission in the RLC entity
-	         either the data belongs to a logical channel with higher priority than the priorities of the logical channels
-	         which belong to any LCG and for which data is already available for transmission
-	      */
-		  if ((UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] == 0)
-			/* or there is no data available for any of the logical channels which belong to a LCG */
-			||(lcgid_buffer_remain[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] == 0)
-			)
-		  {
-			  bsr_regular_triggered = TRUE;
-
-		      LOG_D(MAC,"[UE %d] PDCCH Tick : MAC BSR Triggered LCID%d LCGID%d data become available at frame %d subframe %d\n",
-		                      module_idP, lcid,UE_mac_inst[module_idP].scheduling_info.LCGID[lcid],frameP, subframeP);
-
-			  break;
-		  }
-	  }
-
-	  // Trigger Regular BSR if ReTxBSR Timer has expired and UE has data for transmission
-	  if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF == 0)
-	  {
-		  bsr_regular_triggered = TRUE;
-
-		  if ((UE_mac_inst[module_idP].BSR_reporting_active & BSR_TRIGGER_REGULAR) == 0) {
-		        LOG_I(MAC,"[UE %d] PDCCH Tick : MAC BSR Triggered ReTxBSR Timer expiry at frame %d subframe %d\n",
-		                          module_idP, frameP, subframeP);
-		  }
-
-	  }
-  }
-
-  //Store Buffer Occupancy in remain buffers for next TTI
-  for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++)
-  {
-	  UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = lcid_bytes_in_buffer[lcid];
-  }
-
-  return bsr_regular_triggered;
+		    while ((array_index < num_lcid_with_data)
+			   && (array_index < MAX_NUM_LCID));
+		}
+	    }
+	}
+
+    }
+
+    // Check whether a regular BSR can be triggered according to the first cases in 36.321
+    if (num_lcid_with_data) {
+	LOG_D(MAC,
+	      "[UE %d] PDCCH Tick at frame %d subframe %d: NumLCID with data=%d Reordered LCID0=%d LCID1=%d LCID2=%d\n",
+	      module_idP, frameP, subframeP, num_lcid_with_data,
+	      lcid_reordered_array[0], lcid_reordered_array[1],
+	      lcid_reordered_array[2]);
+
+	for (array_index = 0; array_index < num_lcid_with_data;
+	     array_index++) {
+	    lcid = lcid_reordered_array[array_index];
+	    /* UL data, for a logical channel which belongs to a LCG, becomes available for transmission in the RLC entity
+	       either the data belongs to a logical channel with higher priority than the priorities of the logical channels
+	       which belong to any LCG and for which data is already available for transmission
+	     */
+	    if ((UE_mac_inst[module_idP].
+		 scheduling_info.LCID_buffer_remain[lcid] == 0)
+		/* or there is no data available for any of the logical channels which belong to a LCG */
+		||
+		(lcgid_buffer_remain
+		 [UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] ==
+		 0)) {
+		bsr_regular_triggered = TRUE;
+
+		LOG_D(MAC,
+		      "[UE %d] PDCCH Tick : MAC BSR Triggered LCID%d LCGID%d data become available at frame %d subframe %d\n",
+		      module_idP, lcid,
+		      UE_mac_inst[module_idP].scheduling_info.LCGID[lcid],
+		      frameP, subframeP);
+
+		break;
+	    }
+	}
+
+	// Trigger Regular BSR if ReTxBSR Timer has expired and UE has data for transmission
+	if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF == 0) {
+	    bsr_regular_triggered = TRUE;
+
+	    if ((UE_mac_inst[module_idP].BSR_reporting_active &
+		 BSR_TRIGGER_REGULAR) == 0) {
+		LOG_I(MAC,
+		      "[UE %d] PDCCH Tick : MAC BSR Triggered ReTxBSR Timer expiry at frame %d subframe %d\n",
+		      module_idP, frameP, subframeP);
+	    }
+
+	}
+    }
+    //Store Buffer Occupancy in remain buffers for next TTI
+    for (lcid = DCCH; lcid < MAX_NUM_LCID; lcid++) {
+	UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] =
+	    lcid_bytes_in_buffer[lcid];
+    }
+
+    return bsr_regular_triggered;
 }
 
-uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value)
+uint8_t
+locate_BsrIndexByBufferSize(const uint32_t * table, int size, int value)
 {
 
-  uint8_t ju, jm, jl;
-  int ascend;
+    uint8_t ju, jm, jl;
+    int ascend;
 
-  DevAssert( size > 0 );
-  DevAssert( size <= 256 );
+    DevAssert(size > 0);
+    DevAssert(size <= 256);
 
-  if (value == 0) {
-    return 0;  //elseif (value > 150000) return 63;
-  }
+    if (value == 0) {
+	return 0;		//elseif (value > 150000) return 63;
+    }
 
-  jl = 0;        // lower bound
-  ju = size - 1; // upper bound
-  ascend = (table[ju] >= table[jl]) ? 1 : 0; // determine the order of the the table:  1 if ascending order of table, 0 otherwise
+    jl = 0;			// lower bound
+    ju = size - 1;		// upper bound
+    ascend = (table[ju] >= table[jl]) ? 1 : 0;	// determine the order of the the table:  1 if ascending order of table, 0 otherwise
 
-  while (ju-jl > 1) { //If we are not yet done,
-    jm = (ju+jl) >> 1; //compute a midpoint,
+    while (ju - jl > 1) {	//If we are not yet done,
+	jm = (ju + jl) >> 1;	//compute a midpoint,
 
-    if ((value >= table[jm]) == ascend) {
-      jl=jm; // replace the lower limit
-    } else {
-      ju=jm; //replace the upper limit
-    }
+	if ((value >= table[jm]) == ascend) {
+	    jl = jm;		// replace the lower limit
+	} else {
+	    ju = jm;		//replace the upper limit
+	}
 
-    LOG_T(MAC,"[UE] searching BSR index %d for (BSR TABLE %d < value %d)\n", jm, table[jm], value);
-  }
+	LOG_T(MAC,
+	      "[UE] searching BSR index %d for (BSR TABLE %d < value %d)\n",
+	      jm, table[jm], value);
+    }
 
-  if (value == table[jl]) {
-    return jl;
-  } else                    {
-    return jl+1;  //equally  ju
-  }
+    if (value == table[jl]) {
+	return jl;
+    } else {
+	return jl + 1;		//equally  ju
+    }
 
 }
 
 int get_sf_periodicBSRTimer(uint8_t sf_offset)
 {
 
-  switch (sf_offset) {
-  case PeriodicBSR_Timer_r12_sf5:
-    return 5;
-    break;
+    switch (sf_offset) {
+    case PeriodicBSR_Timer_r12_sf5:
+	return 5;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf10:
-    return 10;
-    break;
+    case PeriodicBSR_Timer_r12_sf10:
+	return 10;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf16:
-    return 16;
-    break;
+    case PeriodicBSR_Timer_r12_sf16:
+	return 16;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf20:
-    return 20;
-    break;
+    case PeriodicBSR_Timer_r12_sf20:
+	return 20;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf32:
-    return 32;
-    break;
+    case PeriodicBSR_Timer_r12_sf32:
+	return 32;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf40:
-    return 40;
-    break;
+    case PeriodicBSR_Timer_r12_sf40:
+	return 40;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf64:
-    return 64;
-    break;
+    case PeriodicBSR_Timer_r12_sf64:
+	return 64;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf80:
-    return 80;
-    break;
+    case PeriodicBSR_Timer_r12_sf80:
+	return 80;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf128:
-    return 128;
-    break;
+    case PeriodicBSR_Timer_r12_sf128:
+	return 128;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf160:
-    return 160;
-    break;
+    case PeriodicBSR_Timer_r12_sf160:
+	return 160;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf320:
-    return 320;
-    break;
+    case PeriodicBSR_Timer_r12_sf320:
+	return 320;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf640:
-    return 640;
-    break;
+    case PeriodicBSR_Timer_r12_sf640:
+	return 640;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf1280:
-    return 1280;
-    break;
+    case PeriodicBSR_Timer_r12_sf1280:
+	return 1280;
+	break;
 
-  case PeriodicBSR_Timer_r12_sf2560:
-    return 2560;
-    break;
+    case PeriodicBSR_Timer_r12_sf2560:
+	return 2560;
+	break;
 
-  case PeriodicBSR_Timer_r12_infinity:
-  default:
-    return 0xFFFF;
-    break;
-  }
+    case PeriodicBSR_Timer_r12_infinity:
+    default:
+	return 0xFFFF;
+	break;
+    }
 }
 
 int get_sf_retxBSRTimer(uint8_t sf_offset)
 {
 
-  switch (sf_offset) {
-  case RetxBSR_Timer_r12_sf320:
-    return 320;
-    break;
+    switch (sf_offset) {
+    case RetxBSR_Timer_r12_sf320:
+	return 320;
+	break;
 
-  case RetxBSR_Timer_r12_sf640:
-    return 640;
-    break;
+    case RetxBSR_Timer_r12_sf640:
+	return 640;
+	break;
 
-  case RetxBSR_Timer_r12_sf1280:
-    return 1280;
-    break;
+    case RetxBSR_Timer_r12_sf1280:
+	return 1280;
+	break;
 
-  case RetxBSR_Timer_r12_sf2560:
-    return 2560;
-    break;
+    case RetxBSR_Timer_r12_sf2560:
+	return 2560;
+	break;
 
-  case RetxBSR_Timer_r12_sf5120:
-    return 5120;
-    break;
+    case RetxBSR_Timer_r12_sf5120:
+	return 5120;
+	break;
 
-  case RetxBSR_Timer_r12_sf10240:
-    return 10240;
-    break;
+    case RetxBSR_Timer_r12_sf10240:
+	return 10240;
+	break;
 
-  default:
-    return -1;
-    break;
-  }
+    default:
+	return -1;
+	break;
+    }
 }
+
 int get_ms_bucketsizeduration(uint8_t bucketsizeduration)
 {
 
-  switch (bucketsizeduration) {
-  case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50:
-    return 50;
-    break;
-
-  case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100:
-    return 100;
-    break;
-
-  case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms150:
-    return 150;
-    break;
-
-  case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms300:
-    return 300;
-    break;
-
-  case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms500:
-    return 500;
-    break;
-
-  case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms1000:
-    return 1000;
-    break;
-
-  default:
-    return 0;
-    break;
-  }
+    switch (bucketsizeduration) {
+    case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50:
+	return
+	    50;
+	break;
+
+    case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100:
+	return
+	    100;
+	break;
+
+    case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms150:
+	return
+	    150;
+	break;
+
+    case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms300:
+	return
+	    300;
+	break;
+
+    case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms500:
+	return
+	    500;
+	break;
+
+    case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms1000:
+	return
+	    1000;
+	break;
+
+    default:
+	return 0;
+	break;
+    }
 }
 
-void update_phr(module_id_t module_idP,int CC_id)
+void update_phr(module_id_t module_idP, int CC_id)
 {
 
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
-
-  UE_mac_inst[module_idP].PHR_reporting_active =0;
-  UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF =  get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer);
-  UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF =  get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer);
-  // LOG_D(MAC,"phr %d %d\n ",UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF, UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF);
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
+
+    UE_mac_inst[module_idP].PHR_reporting_active = 0;
+    UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF =
+	get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].
+				  scheduling_info.periodicPHR_Timer);
+    UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF =
+	get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].
+				 scheduling_info.prohibitPHR_Timer);
+    // LOG_D(MAC,"phr %d %d\n ",UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF, UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF);
 }
-uint8_t get_phr_mapping (module_id_t module_idP, int CC_id, uint8_t eNB_index)
+
+uint8_t
+get_phr_mapping(module_id_t module_idP, int CC_id, uint8_t eNB_index)
 {
 
-  AssertFatal(CC_id==0,
-	      "Transmission on secondary CCs is not supported yet\n");
+    AssertFatal(CC_id == 0,
+		"Transmission on secondary CCs is not supported yet\n");
 
-  //power headroom reporting range is from -23 ...+40 dB, as described in 36313
-  //note: mac_xface->get_Po_NOMINAL_PUSCH(module_idP) is float
-  if (get_PHR(module_idP,CC_id,eNB_index) < -23) {
-    return 0;
-  } else if (get_PHR(module_idP,CC_id,eNB_index) >= 40) {
-    return 63;
-  } else { // -23 to 40
-    return  (uint8_t) get_PHR(module_idP,CC_id,eNB_index) + PHR_MAPPING_OFFSET;
+    //power headroom reporting range is from -23 ...+40 dB, as described in 36313
+    //note: mac_xface->get_Po_NOMINAL_PUSCH(module_idP) is float
+    if (get_PHR(module_idP, CC_id, eNB_index) < -23) {
+	return 0;
+    } else if (get_PHR(module_idP, CC_id, eNB_index) >= 40) {
+	return 63;
+    } else {			// -23 to 40
+	return (uint8_t) get_PHR(module_idP, CC_id,
+				 eNB_index) + PHR_MAPPING_OFFSET;
 
-  }
+    }
 }
+
 int get_sf_perioidicPHR_Timer(uint8_t perioidicPHR_Timer)
 {
-  return (perioidicPHR_Timer+1)*10;
+    return (perioidicPHR_Timer + 1) * 10;
 }
 
 
 int get_sf_prohibitPHR_Timer(uint8_t prohibitPHR_Timer)
 {
-  return (prohibitPHR_Timer)*10;
+    return (prohibitPHR_Timer) * 10;
 }
 
 int get_db_dl_PathlossChange(uint8_t dl_PathlossChange)
 {
-  switch (dl_PathlossChange) {
-  case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1:
-    return 1;
-    break;
-
-  case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB3:
-    return 3;
-    break;
-
-  case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB6:
-    return 6;
-    break;
-
-  case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_infinity:
-  default:
-    return -1;
-    break;
-  }
+    switch (dl_PathlossChange) {
+    case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1:
+	return 1;
+	break;
+
+    case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB3:
+	return 3;
+	break;
+
+    case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB6:
+	return 6;
+	break;
+
+    case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_infinity:
+    default:
+	return -1;
+	break;
+    }
 }
diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/vars.h
index 92e00eaaa70217aea51c7e9fccfb7cf244390b00..d153c82aeeef2e2ed132cd7c790ffd10150d18d5 100644
--- a/openair2/LAYER2/MAC/vars.h
+++ b/openair2/LAYER2/MAC/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -32,27 +32,31 @@
 
 #ifndef __MAC_VARS_H__
 #define __MAC_VARS_H__
-#ifdef USER_MODE
-//#include "stdio.h"
-#endif //USER_MODE
 #include "PHY/defs.h"
 #include "defs.h"
 #include "COMMON/mac_rrc_primitives.h"
 
-const uint32_t BSR_TABLE[BSR_TABLE_SIZE]= {0,10,12,14,17,19,22,26,31,36,42,49,57,67,78,91,
-                                           105,125,146,171,200,234,274,321,376,440,515,603,706,826,967,1132,
-                                           1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099,
-                                           16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439, 128125,150000, 300000
-                                          };
-// extended bsr table--currently not used										  
-const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,
-                                                     181,223,274,337,414,509,625,769,945,1162,1429,
-                                                     1757,2161,2657,3267,4017,4940,6074,7469,9185,
-                                                     11294,13888,17077,20999,25822,31752,39045,48012,
-                                                     59039,72598,89272,109774,134986,165989,204111,
-                                                     250990,308634,379519,466683,573866,705666,867737,
-                                                     1067031,1312097,1613447,1984009,2439678,3000000,
-                                                     6000000};
+const uint32_t BSR_TABLE[BSR_TABLE_SIZE] =
+    { 0, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91,
+    105, 125, 146, 171, 200, 234, 274, 321, 376, 440, 515, 603, 706, 826,
+	967, 1132,
+    1326, 1552, 1817, 2127, 2490, 2915, 3413, 3995, 4677, 5467, 6411, 7505,
+	8787, 10287, 12043, 14099,
+    16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759, 58255, 68201,
+	79846, 93479, 109439, 128125, 150000, 300000
+};
+
+// extended bsr table--currently not used                                                                                 
+const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] =
+    { 0, 10, 13, 16, 19, 23, 29, 35, 43, 53, 65, 80, 98, 120, 147,
+    181, 223, 274, 337, 414, 509, 625, 769, 945, 1162, 1429,
+    1757, 2161, 2657, 3267, 4017, 4940, 6074, 7469, 9185,
+    11294, 13888, 17077, 20999, 25822, 31752, 39045, 48012,
+    59039, 72598, 89272, 109774, 134986, 165989, 204111,
+    250990, 308634, 379519, 466683, 573866, 705666, 867737,
+    1067031, 1312097, 1613447, 1984009, 2439678, 3000000,
+    6000000
+};
 
 //#define MAX_SIZE_OF_AGG3   576 
 //#define MAX_SIZE_OF_AGG2   288
@@ -64,24 +68,26 @@ const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {0,10,13,16,19,23,29,35,43,5
  * this is also dependent to transmission mode, where an offset could be defined
  */
 // the follwoing three tables are calibrated for TXMODE 1 and 2
-const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]= { 
-  {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size= 37 bits
-  //{3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
-  {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
-  {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE = 43
-  {3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}   // 20_DCI0_CRC_SIZE = 44
+const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
+    {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},	// 1.4_DCI0_CRC_Size= 37 bits
+    //{3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
+    {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},	// 5_DCI0_CRC_SIZE = 41
+    {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0},	// 10_DCI0_CRC_SIZE = 43
+    {3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}	// 20_DCI0_CRC_SIZE = 44
 };
-const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]= { 
-  {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size < 38 bits
-  {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE  < 43
-  {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE  < 47
-  {3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}   // 20_DCI0_CRC_SIZE  < 55
+
+const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
+    {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},	// 1.4_DCI0_CRC_Size < 38 bits
+    {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},	// 5_DCI0_CRC_SIZE  < 43
+    {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0},	// 10_DCI0_CRC_SIZE  < 47
+    {3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}	// 20_DCI0_CRC_SIZE  < 55
 };
-const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]= { 
-  {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size= 47 bits
-  {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 55
-  {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE = 59
-  {3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0}   // 20_DCI0_CRC_SIZE = 64
+
+const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
+    {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},	// 1.4_DCI0_CRC_Size= 47 bits
+    {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},	// 5_DCI0_CRC_SIZE = 55
+    {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0},	// 10_DCI0_CRC_SIZE = 59
+    {3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0}	// 20_DCI0_CRC_SIZE = 64
 };
 
 //uint32_t EBSR_Level[63]={0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181};
@@ -89,7 +95,7 @@ const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]= {
 
 uint32_t RRC_CONNECTION_FLAG;
 
-UE_MAC_INST *UE_mac_inst; //[NB_MODULE_MAX];
+UE_MAC_INST *UE_mac_inst;	//[NB_MODULE_MAX];
 MAC_RLC_XFACE *Mac_rlc_xface;
 
 /// Primary component carrier index of eNB
@@ -97,39 +103,39 @@ int pCC_id[NUMBER_OF_eNB_MAX];
 
 
 
-eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
-eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
+eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX];	// eNBxUE = 8x8
+eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX];	// eNBxUE = 8x8
 
 
 #ifdef OPENAIR2
-unsigned char NB_eNB_INST=0;
-unsigned char NB_UE_INST=0;
-unsigned char NB_RN_INST=0;
-unsigned char NB_INST=0;
+unsigned char NB_eNB_INST = 0;
+unsigned char NB_UE_INST = 0;
+unsigned char NB_RN_INST = 0;
+unsigned char NB_INST = 0;
 #endif
 
 
-DCI0_5MHz_TDD_1_6_t       UL_alloc_pdu;
+DCI0_5MHz_TDD_1_6_t UL_alloc_pdu;
 
-DCI1A_5MHz_TDD_1_6_t      DLSCH_alloc_pdu1A;
-DCI1A_5MHz_TDD_1_6_t      RA_alloc_pdu;
-DCI1A_5MHz_TDD_1_6_t      BCCH_alloc_pdu;
+DCI1A_5MHz_TDD_1_6_t DLSCH_alloc_pdu1A;
+DCI1A_5MHz_TDD_1_6_t RA_alloc_pdu;
+DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu;
 
-DCI1A_5MHz_TDD_1_6_t      CCCH_alloc_pdu;
-DCI1_5MHz_TDD_t           DLSCH_alloc_pdu;
+DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
+DCI1_5MHz_TDD_t DLSCH_alloc_pdu;
 
 #if defined(Rel10) || defined(Rel14)
-DCI1C_5MHz_t                 MCCH_alloc_pdu;
+DCI1C_5MHz_t MCCH_alloc_pdu;
 #endif
 
-DCI0_5MHz_FDD_t       UL_alloc_pdu_fdd;
+DCI0_5MHz_FDD_t UL_alloc_pdu_fdd;
 
-DCI1A_5MHz_FDD_t      DLSCH_alloc_pdu1A_fdd;
-DCI1A_5MHz_FDD_t      RA_alloc_pdu_fdd;
-DCI1A_5MHz_FDD_t      BCCH_alloc_pdu_fdd;
+DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd;
+DCI1A_5MHz_FDD_t RA_alloc_pdu_fdd;
+DCI1A_5MHz_FDD_t BCCH_alloc_pdu_fdd;
 
-DCI1A_5MHz_FDD_t      CCCH_alloc_pdu_fdd;
-DCI1_5MHz_FDD_t       DLSCH_alloc_pdu_fdd;
+DCI1A_5MHz_FDD_t CCCH_alloc_pdu_fdd;
+DCI1_5MHz_FDD_t DLSCH_alloc_pdu_fdd;
 
 DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1;
 DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
@@ -137,5 +143,3 @@ DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
 DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
 
 #endif
-
-
diff --git a/openair2/LAYER2/Makefile.inc b/openair2/LAYER2/Makefile.inc
index c0e4df5617a7faf659f048bf4fe75305cae9ba92..2f5cea7555462e485dcf00b0d1ec9dc10a98feb5 100644
--- a/openair2/LAYER2/Makefile.inc
+++ b/openair2/LAYER2/Makefile.inc
@@ -54,10 +54,6 @@ SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_reassembly.c
 SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_receiver.c
 SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_dar.c
 
-ifeq ($(OPENAIR_EMU),1)
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_very_simple_test.c
-endif
-
 SOURCES_L2 +=  $(RLC_DIR)/rlc_mac.c
 SOURCES_L2 +=  $(RLC_DIR)/rlc.c
 SOURCES_L2 +=  $(RLC_DIR)/rlc_rrc.c
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index ac8b87a41a7cb079528922dcd33defb0323a47a1..00557ce7e075a04efb439120c2da73c879c8d2b0 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -30,9 +30,6 @@
 #define PDCP_C
 //#define DEBUG_PDCP_FIFO_FLUSH_SDU
 
-#ifndef USER_MODE
-#include <rtai_fifos.h>
-#endif
 #include "assertions.h"
 #include "hashtable.h"
 #include "pdcp.h"
@@ -64,10 +61,10 @@
 #  include "gtpv1u.h"
 #endif
 
-#ifndef OAI_EMU
 extern int otg_enabled;
-#endif
 
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
 
 //-----------------------------------------------------------------------------
 /*
@@ -102,6 +99,8 @@ boolean_t pdcp_data_req(
 
   hash_key_t         key             = HASHTABLE_NOT_A_KEY_VALUE;
   hashtable_rc_t     h_rc;
+  uint8_t            rb_offset= (srb_flagP == 0) ? DTCH -1 : 0;
+  uint16_t           pdcp_uid=0;
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_IN);
   CHECK_CTXT_ARGS(ctxt_pP);
 
@@ -147,7 +146,7 @@ boolean_t pdcp_data_req(
     ctxt_pP->configured=TRUE;
   }
     
-  if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+  if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
     start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
   } else {
     start_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -218,7 +217,7 @@ boolean_t pdcp_data_req(
           LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n",
                 PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p));
 
-          if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+          if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
             stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
           } else {
             stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -236,8 +235,9 @@ boolean_t pdcp_data_req(
         if (pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer((unsigned char*)pdcp_pdu_p->data, &pdu_header) == FALSE) {
           LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n",
                 PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p));
+         
+          if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
 
-          if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
             stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
           } else {
             stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -259,7 +259,7 @@ boolean_t pdcp_data_req(
 
         free_mem_block(pdcp_pdu_p, __func__);
 
-        if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+        if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
           stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
         } else {
           stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -287,7 +287,7 @@ boolean_t pdcp_data_req(
           (((pdcp_p->cipheringAlgorithm) != 0) ||
            ((pdcp_p->integrityProtAlgorithm) != 0))) {
 
-        if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+        if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
           start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].apply_security);
         } else {
           start_meas(&UE_pdcp_stats[ctxt_pP->module_id].apply_security);
@@ -382,7 +382,7 @@ boolean_t pdcp_data_req(
     break;
   }
 
-  if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
+  if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
     stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
   } else {
     stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -392,16 +392,23 @@ boolean_t pdcp_data_req(
    * Control arrives here only if rlc_data_req() returns RLC_OP_STATUS_OK
    * so we return TRUE afterwards
    */
-  /*
-   if (rb_id>=DTCH) {
-    if (ctxt_pP->enb_flag == 1) {
-      Pdcp_stats_tx[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH]++;
-      Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size;
-    } else {
-      Pdcp_stats_tx[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH]++;
-      Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size;
-    }
-    }*/
+  
+  for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
+    if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ) 
+      break;
+  }
+
+  //LOG_I(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, rb_idP+rb_offset, current_sn);
+  Pdcp_stats_tx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
+  Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
+  Pdcp_stats_tx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=sdu_buffer_sizeP;
+  Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=sdu_buffer_sizeP;
+  Pdcp_stats_tx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=current_sn;
+
+  Pdcp_stats_tx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
+  Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); 
+  Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn;
+    
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
   return ret;
 
@@ -431,6 +438,9 @@ pdcp_data_ind(
   boolean_t    packet_forwarded = FALSE;
   hash_key_t      key             = HASHTABLE_NOT_A_KEY_VALUE;
   hashtable_rc_t  h_rc;
+  uint8_t      rb_offset= (srb_flagP == 0) ? DTCH -1 :0;
+  uint16_t     pdcp_uid=0;      
+  uint8_t      oo_flag=0;
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
   MessageDef  *message_p        = NULL;
   uint8_t     *gtpu_buffer_p    = NULL;
@@ -439,11 +449,6 @@ pdcp_data_ind(
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP);
-
-#endif
 #ifdef PDCP_MSG_PRINT
   int i=0;
   LOG_F(PDCP,"[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
@@ -585,6 +590,7 @@ pdcp_data_ind(
       else
       LOG_D(PDCP, "Passing piggybacked SDU to RRC ...\n");*/
     } else {
+      oo_flag=1;
       LOG_W(PDCP,
             PROTOCOL_PDCP_CTXT_FMT"Incoming PDU has an unexpected sequence number (%d), RX window synchronisation have probably been lost!\n",
             PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
@@ -638,11 +644,12 @@ pdcp_data_ind(
         PROTOCOL_PDCP_CTXT_FMT" DATA-IND len %u",
         PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
         sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len);
-      rrc_data_ind(ctxt_pP,
+        rrc_data_ind(ctxt_pP,
 		   rb_id,
 		   sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
 		   (uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]);
-      free_mem_block(sdu_buffer_pP, __func__);
+        free_mem_block(sdu_buffer_pP, __func__);
+
 
       // free_mem_block(new_sdu, __func__);
       if (ctxt_pP->enb_flag) {
@@ -691,49 +698,6 @@ pdcp_data_ind(
     payload_offset=0;
   }
 
-#if defined(USER_MODE) && defined(OAI_EMU)
-
-  if (oai_emulation.info.otg_enabled == 1) {
-    //unsigned int dst_instance;
-    int    ctime;
-
-    if ((pdcp_p->rlc_mode == RLC_MODE_AM)&&(MBMS_flagP==0) ) {
-      pdcp_p->last_submitted_pdcp_rx_sn = sequence_number;
-    }
-
-#if defined(DEBUG_PDCP_PAYLOAD)
-    rlc_util_print_hex_octets(PDCP,
-                              (unsigned char*)&sdu_buffer_pP->data[payload_offset],
-                              sdu_buffer_sizeP - payload_offset);
-#endif
-
-    ctime = oai_emulation.info.time_ms; // avg current simulation time in ms : we may get the exact time through OCG?
-    if (MBMS_flagP == 0){
-      LOG_D(PDCP,
-	    PROTOCOL_PDCP_CTXT_FMT"Check received buffer :  (dst %d)\n",
-	    PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
-	    ctxt_pP->instance);
-    }
-    if (otg_rx_pkt(
-          ctxt_pP->instance,
-          ctime,
-          (const char*)(&sdu_buffer_pP->data[payload_offset]),
-                   sdu_buffer_sizeP - payload_offset ) == 0 ) {
-      free_mem_block(sdu_buffer_pP, __func__);
-
-      if (ctxt_pP->enb_flag) {
-        stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
-      } else {
-        stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_ind);
-      }
-
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
-      return TRUE;
-    }
-  }
-
-#else
-
   if (otg_enabled==1) {
     LOG_D(OTG,"Discarding received packed\n");
     free_mem_block(sdu_buffer_pP, __func__);
@@ -748,9 +712,6 @@ pdcp_data_ind(
     return TRUE;
   }
 
-#endif
-
-
   // XXX Decompression would be done at this point
 
   /*
@@ -783,9 +744,9 @@ pdcp_data_ind(
     GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti         = ctxt_pP->rnti;
     GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id       = rb_id + 4;
     itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
-    packet_forwarded = TRUE;
+    packet_forwarded = TRUE;    
   }
-
+  
 #else
   packet_forwarded = FALSE;
 #endif
@@ -809,22 +770,15 @@ pdcp_data_ind(
       // set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here
       if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
         ((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id;
-#if defined(OAI_EMU)
-        ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = ctxt_pP->module_id + oai_emulation.info.nb_enb_local - oai_emulation.info.first_ue_local;
-#else
-#  if defined(ENABLE_USE_MME)
+#if defined(ENABLE_USE_MME)
         /* for the UE compiled in S1 mode, we need 1 here
          * for the UE compiled in noS1 mode, we need 0
          * TODO: be sure of this
          */
         ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = 1;
-#  endif
 #endif
       } else {
         ((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * maxDRB);
-#if defined(OAI_EMU)
-        ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = ctxt_pP->module_id - oai_emulation.info.first_enb_local;
-#endif
       }
 #ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
       static uint32_t pdcp_inst = 0;
@@ -837,28 +791,44 @@ pdcp_data_ind(
              sdu_buffer_sizeP - payload_offset);
       list_add_tail_eurecom (new_sdu_p, sdu_list_p);
 
-      /* Print octets of incoming data in hexadecimal form */
-      LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
-            sdu_buffer_sizeP  - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
-            sdu_buffer_sizeP  - payload_offset);
-      //util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
-      //util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
-
-      /*
-       * Update PDCP statistics
-       * XXX Following two actions are identical, is there a merge error?
-       */
-
-      /*if (ctxt_pP->enb_flag == 1) {
-          Pdcp_stats_rx[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH]++;
-          Pdcp_stats_rx_bytes[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH] += sdu_buffer_sizeP;
-        } else {
-          Pdcp_stats_rx[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH]++;
-          Pdcp_stats_rx_bytes[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH] += sdu_buffer_sizeP;
-        }*/
+      
+      
     }
   }
 
+  /* Print octets of incoming data in hexadecimal form */
+  LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
+	sdu_buffer_sizeP  - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
+	sdu_buffer_sizeP  - payload_offset);
+  //util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
+  //util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
+  
+  /*
+     * Update PDCP statistics
+   * XXX Following two actions are identical, is there a merge error?
+   */
+  
+  for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
+    if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ){
+      break;
+    }
+  }	
+  
+  Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
+  Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
+  Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP  - payload_offset);
+  Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP  - payload_offset);
+  
+  Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number;
+  
+  if (oo_flag == 1 )
+    Pdcp_stats_rx_outoforder[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
+  
+  Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
+  Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
+  Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn;
+
+  
 #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
   else {
     AssertFatal(0, PROTOCOL_PDCP_CTXT_FMT" PDCP_DATA_IND SDU DROPPED, OUT OF MEMORY \n",
@@ -879,6 +849,53 @@ pdcp_data_ind(
   return TRUE;
 }
 
+void pdcp_update_stats(const protocol_ctxt_t* const  ctxt_pP){
+
+  uint8_t            pdcp_uid = 0;
+  uint8_t            rb_id     = 0;
+  
+ // these stats are measured for both eNB and UE on per seond basis 
+  for (rb_id =0; rb_id < NB_RB_MAX; rb_id ++){
+    for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
+      //printf("frame %d and subframe %d \n", pdcp_enb[ctxt_pP->module_id].frame, pdcp_enb[ctxt_pP->module_id].subframe);
+      // tx stats
+      if (pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_tx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){
+	// unit: bit/s
+	Pdcp_stats_tx_throughput_w[ctxt_pP->module_id][pdcp_uid][rb_id]=Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]*8;
+	Pdcp_stats_tx_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
+	Pdcp_stats_tx_bytes_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
+	if (Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id] > 0){
+	  Pdcp_stats_tx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=(Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]/Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]);
+	}else {
+	  Pdcp_stats_tx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
+	}
+	// reset the tmp vars 
+	Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
+	Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
+	Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
+	
+      }
+      if (pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_rx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){
+	// rx stats
+	Pdcp_stats_rx_goodput_w[ctxt_pP->module_id][pdcp_uid][rb_id]=Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]*8;
+	Pdcp_stats_rx_w[ctxt_pP->module_id][pdcp_uid][rb_id]= 	Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
+	Pdcp_stats_rx_bytes_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
+	
+	if(Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id] > 0){
+	  Pdcp_stats_rx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]= (Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]/Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]);
+	} else {
+	  Pdcp_stats_rx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
+	}
+	
+	// reset the tmp vars 
+	Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
+	Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
+	Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
+      } 
+    }
+    
+  }
+}
 //-----------------------------------------------------------------------------
 void
 pdcp_run (
@@ -886,6 +903,7 @@ pdcp_run (
 )
 //-----------------------------------------------------------------------------
 {
+  
 #if defined(ENABLE_ITTI)
   MessageDef   *msg_p;
   const char   *msg_name;
@@ -894,12 +912,18 @@ pdcp_run (
   protocol_ctxt_t  ctxt;
 #endif
 
+  
   if (ctxt_pP->enb_flag) {
     start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].pdcp_run);
   } else {
     start_meas(&UE_pdcp_stats[ctxt_pP->module_id].pdcp_run);
   }
 
+  pdcp_enb[ctxt_pP->module_id].sfn++; // range: 0 to 18,446,744,073,709,551,615
+  pdcp_enb[ctxt_pP->module_id].frame=ctxt_pP->frame; // 1023 
+  pdcp_enb[ctxt_pP->module_id].subframe= ctxt_pP->subframe;
+  pdcp_update_stats(ctxt_pP);
+   
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_IN);
 
 #if defined(ENABLE_ITTI)
@@ -948,6 +972,21 @@ pdcp_run (
         AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
         break;
 
+      case RRC_PCCH_DATA_REQ:
+      {
+        sdu_size_t     sdu_buffer_sizeP;
+        sdu_buffer_sizeP = RRC_PCCH_DATA_REQ(msg_p).sdu_size;
+        uint8_t CC_id = RRC_PCCH_DATA_REQ(msg_p).CC_id;
+        uint8_t ue_index = RRC_PCCH_DATA_REQ(msg_p).ue_index;
+        RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_paging[ue_index] = sdu_buffer_sizeP;
+        if (sdu_buffer_sizeP > 0) {
+        	memcpy(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].paging[ue_index], RRC_PCCH_DATA_REQ(msg_p).sdu_p, sdu_buffer_sizeP);
+        }
+        //paging pdcp log
+        LOG_D(PDCP, "PDCP Received RRC_PCCH_DATA_REQ CC_id %d length %d \n", CC_id, sdu_buffer_sizeP);
+      }
+      break;
+
       default:
         LOG_E(PDCP, "Received unexpected message %s\n", msg_name);
         break;
@@ -981,11 +1020,6 @@ pdcp_run (
     itti_send_msg_to_task(TASK_MAC_ENB, 3, msg_resp_p);
   }
 # endif
-#endif
-
-#if defined(USER_MODE) && defined(OAI_EMU)
-    pdcp_fifo_read_input_sdus_from_otg(ctxt_pP);
-
 #endif
 
   // IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
@@ -1022,6 +1056,28 @@ pdcp_run (
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT);
 }
 
+void pdcp_add_UE(const protocol_ctxt_t* const  ctxt_pP){
+  int i, ue_flag=1; //, ret=-1; to be decied later
+  for (i=0; i < NUMBER_OF_UE_MAX; i++){
+    if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti) {
+      ue_flag=-1;
+      break;
+    }
+  }
+  if (ue_flag == 1 ){
+    for (i=0; i < NUMBER_OF_UE_MAX ; i++){
+      if (pdcp_enb[ctxt_pP->module_id].rnti[i] == 0 ){
+	pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti;
+	pdcp_enb[ctxt_pP->module_id].uid[i]=i;
+	pdcp_enb[ctxt_pP->module_id].num_ues++;
+	printf("add new uid is %d %x\n\n", i, ctxt_pP->rnti);
+	// ret=1;
+	break;
+      }
+    }
+  }
+  //return ret;
+}
 
 //-----------------------------------------------------------------------------
 boolean_t
@@ -1034,10 +1090,17 @@ pdcp_remove_UE(
   DRB_Identity_t  drb_id         = 0;
   hash_key_t      key            = HASHTABLE_NOT_A_KEY_VALUE;
   hashtable_rc_t  h_rc;
+  int i; 
+   // check and remove SRBs first
 
-  // check and remove SRBs first
+  for(int i = 0;i<NUMBER_OF_UE_MAX;i++){
+    if(pdcp_eNB_UE_instance_to_rnti[i] == ctxt_pP->rnti){
+      pdcp_eNB_UE_instance_to_rnti[i] = NOT_A_RNTI;
+      break;
+    }
+  }
 
-  for (srb_id=0; srb_id<2; srb_id++) {
+  for (srb_id=1; srb_id<3; srb_id++) {
     key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES);
     h_rc = hashtable_remove(pdcp_coll_p, key);
   }
@@ -1050,6 +1113,19 @@ pdcp_remove_UE(
 
   (void)h_rc; /* remove gcc warning "set but not used" */
 
+  // remove ue for pdcp enb inst
+   for (i=0; i < NUMBER_OF_UE_MAX; i++) {
+    if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti ) {
+      LOG_I(PDCP, "remove uid is %d/%d %x\n", i,
+	    pdcp_enb[ctxt_pP->module_id].uid[i],
+	    pdcp_enb[ctxt_pP->module_id].rnti[i]);
+      pdcp_enb[ctxt_pP->module_id].uid[i]=0;
+      pdcp_enb[ctxt_pP->module_id].rnti[i]=0;
+      pdcp_enb[ctxt_pP->module_id].num_ues--;
+      break;
+    }
+  }
+   
   return 1;
 }
 
@@ -1134,7 +1210,7 @@ rrc_pdcp_config_asn1_req (
           return TRUE;
 
       } else {
-          LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD key 0x%"PRIx64"\n",
+	  LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD key 0x%"PRIx64"\n",
                 PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
                 key);
         }
@@ -1344,7 +1420,7 @@ rrc_pdcp_config_asn1_req (
     for (cnt=0; cnt<drb2release_list_pP->list.count; cnt++) {
       pdrb_id_p = drb2release_list_pP->list.array[cnt];
       drb_id =  *pdrb_id_p;
-      key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_NO);
+      key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO);
       h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
 
       if (h_rc != HASH_TABLE_OK) {
@@ -1444,7 +1520,6 @@ rrc_pdcp_config_asn1_req (
   return 0;
 }
 
-
 //-----------------------------------------------------------------------------
 boolean_t
 pdcp_config_req_asn1 (
@@ -1465,14 +1540,26 @@ pdcp_config_req_asn1 (
   uint8_t         *const        kUPenc_pP)
 //-----------------------------------------------------------------------------
 {
-
+  
   switch (actionP) {
   case CONFIG_ACTION_ADD:
     DevAssert(pdcp_pP != NULL);
     if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
       pdcp_pP->is_ue = FALSE;
+      pdcp_add_UE(ctxt_pP);
+      
       //pdcp_eNB_UE_instance_to_rnti[ctxtP->module_id] = ctxt_pP->rnti;
-      pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
+//      pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
+      if( srb_flagP == SRB_FLAG_NO ) {
+          for(int i = 0;i<NUMBER_OF_UE_MAX;i++){
+              if(pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] == NOT_A_RNTI){
+                  break;
+              }
+              pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
+          }
+          pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
+          pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
+      }
       //pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
     } else {
       pdcp_pP->is_ue = TRUE;
@@ -1570,6 +1657,10 @@ pdcp_config_req_asn1 (
           lc_idP,
           rb_idP);
 
+   if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
+     // pdcp_remove_UE(ctxt_pP);
+   }
+
     /* Security keys */
     if (pdcp_pP->kUPenc != NULL) {
       free(pdcp_pP->kUPenc);
@@ -1821,13 +1912,14 @@ rrc_pdcp_config_req (
 
 
 //-----------------------------------------------------------------------------
-// TODO PDCP module initialization code might be removed
+ 
 int
 pdcp_module_init (
   void
 )
 //-----------------------------------------------------------------------------
 {
+ 
 #ifdef PDCP_USE_RT_FIFO
   int ret;
 
@@ -1903,6 +1995,7 @@ void pdcp_layer_init(void)
 {
 
   module_id_t       instance;
+  int i,j;
 #if defined(Rel10) || defined(Rel14)
   mbms_session_id_t session_id;
   mbms_service_id_t service_id;
@@ -1946,15 +2039,42 @@ void pdcp_layer_init(void)
   pdcp_output_header_bytes_to_write=0;
   pdcp_input_sdu_remaining_size_to_read=0;
 
+  memset(pdcp_enb, 0, sizeof(pdcp_enb_t));
+
+  
+  memset(Pdcp_stats_tx_window_ms, 0, sizeof(Pdcp_stats_tx_window_ms));
+  memset(Pdcp_stats_rx_window_ms, 0, sizeof(Pdcp_stats_rx_window_ms));
+  for (i =0; i< MAX_NUM_CCs ; i ++){
+    for (j=0; j< NUMBER_OF_UE_MAX;j++){
+      Pdcp_stats_tx_window_ms[i][j]=100;
+      Pdcp_stats_rx_window_ms[i][j]=100;
+    }
+  }
+  
   memset(Pdcp_stats_tx, 0, sizeof(Pdcp_stats_tx));
+  memset(Pdcp_stats_tx_w, 0, sizeof(Pdcp_stats_tx_w));
+  memset(Pdcp_stats_tx_tmp_w, 0, sizeof(Pdcp_stats_tx_tmp_w));
   memset(Pdcp_stats_tx_bytes, 0, sizeof(Pdcp_stats_tx_bytes));
-  memset(Pdcp_stats_tx_bytes_last, 0, sizeof(Pdcp_stats_tx_bytes_last));
-  memset(Pdcp_stats_tx_rate, 0, sizeof(Pdcp_stats_tx_rate));
+  memset(Pdcp_stats_tx_bytes_w, 0, sizeof(Pdcp_stats_tx_bytes_w));
+  memset(Pdcp_stats_tx_bytes_tmp_w, 0, sizeof(Pdcp_stats_tx_bytes_tmp_w));
+  memset(Pdcp_stats_tx_sn, 0, sizeof(Pdcp_stats_tx_sn));
+  memset(Pdcp_stats_tx_throughput_w, 0, sizeof(Pdcp_stats_tx_throughput_w));
+  memset(Pdcp_stats_tx_aiat, 0, sizeof(Pdcp_stats_tx_aiat));
+  memset(Pdcp_stats_tx_iat, 0, sizeof(Pdcp_stats_tx_iat));
+  
 
   memset(Pdcp_stats_rx, 0, sizeof(Pdcp_stats_rx));
+  memset(Pdcp_stats_rx_w, 0, sizeof(Pdcp_stats_rx_w));
+  memset(Pdcp_stats_rx_tmp_w, 0, sizeof(Pdcp_stats_rx_tmp_w));
   memset(Pdcp_stats_rx_bytes, 0, sizeof(Pdcp_stats_rx_bytes));
-  memset(Pdcp_stats_rx_bytes_last, 0, sizeof(Pdcp_stats_rx_bytes_last));
-  memset(Pdcp_stats_rx_rate, 0, sizeof(Pdcp_stats_rx_rate));
+  memset(Pdcp_stats_rx_bytes_w, 0, sizeof(Pdcp_stats_rx_bytes_w));
+  memset(Pdcp_stats_rx_bytes_tmp_w, 0, sizeof(Pdcp_stats_rx_bytes_tmp_w));
+  memset(Pdcp_stats_rx_sn, 0, sizeof(Pdcp_stats_rx_sn));
+  memset(Pdcp_stats_rx_goodput_w, 0, sizeof(Pdcp_stats_rx_goodput_w));
+  memset(Pdcp_stats_rx_aiat, 0, sizeof(Pdcp_stats_rx_aiat));
+  memset(Pdcp_stats_rx_iat, 0, sizeof(Pdcp_stats_rx_iat));
+  memset(Pdcp_stats_rx_outoforder, 0, sizeof(Pdcp_stats_rx_outoforder));
+    
 }
 
 //-----------------------------------------------------------------------------
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index b33eb2f2aa344af0bcbcda7f2cf60d79a07db299..7c8f2dd033571f3faac8d484ea99be494b020a81 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -94,15 +94,54 @@ extern int             pdcp_instance_cnt;
 int init_pdcp_thread(void);
 void cleanup_pdcp_thread(void);
 
-
-public_pdcp(unsigned int Pdcp_stats_tx[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
-public_pdcp(unsigned int Pdcp_stats_tx_bytes[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
-public_pdcp(unsigned int Pdcp_stats_tx_bytes_last[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
-public_pdcp(unsigned int Pdcp_stats_tx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
-public_pdcp(unsigned int Pdcp_stats_rx[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
-public_pdcp(unsigned int Pdcp_stats_rx_bytes[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
-public_pdcp(unsigned int Pdcp_stats_rx_bytes_last[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
-public_pdcp(unsigned int Pdcp_stats_rx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+
+public_pdcp(uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+public_pdcp(uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
+
+public_pdcp(void pdcp_update_perioidical_stats(const protocol_ctxt_t* const  ctxt_pP));
+
+
+/*Packet Probing for agent PDCP*/
+//public_pdcp(uint64_t *pdcp_packet_counter);
+//public_pdcp(uint64_t *pdcp_size_packet);
+typedef struct pdcp_enb_s {
+  // used for eNB stats generation
+  uint16_t uid[NUMBER_OF_UE_MAX];
+  rnti_t rnti[NUMBER_OF_UE_MAX];
+  uint16_t num_ues;
+  
+  uint64_t sfn;
+  frame_t  frame;
+  sub_frame_t subframe;
+  
+} pdcp_enb_t; 
+
+public_pdcp(pdcp_enb_t pdcp_enb[MAX_NUM_CCs]);
 
 typedef struct pdcp_stats_s {
   time_stats_t pdcp_run;
@@ -125,7 +164,7 @@ typedef struct pdcp_s {
   boolean_t is_ue;
   boolean_t is_srb;
 
-  /* Configured security algorithms */
+   /* Configured security algorithms */
   uint8_t cipheringAlgorithm;
   uint8_t integrityProtAlgorithm;
 
@@ -327,9 +366,15 @@ public_pdcp(boolean_t pdcp_config_req_asn1 (
               uint8_t         *const kRRCint,
               uint8_t         *const kUPenc));
 
-
+/*! \fn void pdcp_add_UE(const protocol_ctxt_t* const  ctxt_pP)
+* \brief  Function (for RRC) to add a new UE in PDCP module
+* \param[in]  ctxt_pP           Running context.
+* \return     A status about the processing, OK or error code.
+*/
+public_pdcp(void pdcp_add_UE(const protocol_ctxt_t* const  ctxt_pP));
+  
 /*! \fn boolean_t pdcp_remove_UE(const protocol_ctxt_t* const  ctxt_pP)
-* \brief  Function for RRC to configure a Radio Bearer clear all PDCP resources for a particular UE
+* \brief  Function for RRC to remove UE from PDCP module hashtable 
 * \param[in]  ctxt_pP           Running context.
 * \return     A status about the processing, OK or error code.
 */
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c
index 795cb2e80aa3056a6581bc56470a6fb31039a818..abec97ddfd4c0c8a6aea1cede86a7dc19c170837 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h
index b7930ab1e1481ef4ceefa4e8a83a72f574308c6f..6226dccc335c3b46d9010d224d8c103c28c331ca 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index 046ba33e71de16fe607a67b703c4f5118b8aac3c..2de1b3fc743a4bd4ca41d9de64866fa0a8c79285 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,14 +33,11 @@
 #define PDCP_DEBUG 1
 //#define DEBUG_PDCP_FIFO_FLUSH_SDU
 
-#ifndef OAI_EMU
 extern int otg_enabled;
-#endif
 
 #include "pdcp.h"
 #include "pdcp_primitives.h"
 
-#ifdef USER_MODE
 #include <pthread.h>
 #include <errno.h>
 #include <stdio.h>
@@ -48,9 +45,6 @@ extern int otg_enabled;
 #include <unistd.h>
 #define rtf_put write
 #define rtf_get read
-#else
-#include <rtai_fifos.h>
-#endif //USER_MODE
 
 #include "../MAC/extern.h"
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
@@ -89,8 +83,11 @@ extern Packet_OTG_List_t *otg_pdcp_buffer;
 
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
 #  include "gtpv1u_eNB_task.h"
+#  include "gtpv1u_eNB_defs.h"
 #endif
 
+extern int gtpv1u_new_data_req( uint8_t  enb_module_idP, rnti_t   ue_rntiP, uint8_t  rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP);
+
 /* Prevent de-queueing the same PDCP SDU from the queue twice
  * by multiple threads. This has happened in TDD when thread-odd
  * is flushing a PDCP SDU after UE_RX() processing; whereas
@@ -165,11 +162,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const  ctxt_pP)
         threadname, ctxt_pP->frame, ctxt_pP->subframe,
         ((pdcp_data_ind_header_t*) sdu_p->data)->inst,
         ((pdcp_data_ind_header_t *) sdu_p->data)->data_size);
-#else
-#if ! defined(OAI_EMU)
-    /* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
-//    ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
-#endif
 #endif
 
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
@@ -550,29 +542,6 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                 nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr));
 #endif
 
-#ifdef OAI_EMU
-
-          // overwrite function input parameters, because only one netlink socket for all instances
-          if (pdcp_read_header_g.inst < oai_emulation.info.nb_enb_local) {
-            ctxt.frame         = ctxt_cpy.frame;
-            ctxt.enb_flag      = ENB_FLAG_YES;
-            ctxt.module_id     = pdcp_read_header_g.inst  +  oai_emulation.info.first_enb_local;
-            ctxt.rnti          = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pdcp_read_header_g.rb_id / maxDRB + oai_emulation.info.first_ue_local];
-            rab_id    = pdcp_read_header_g.rb_id % maxDRB;
-          } else {
-            ctxt.frame         = ctxt_cpy.frame;
-            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;
-          }
-
-          CHECK_CTXT_ARGS(&ctxt);
-          AssertFatal (rab_id    < maxDRB,                       "RB id is too high (%u/%d)!\n", rab_id, maxDRB);
-          /*LGpdcp_read_header.inst = (pdcp_read_header_g.inst >= oai_emulation.info.nb_enb_local) ? \
-                  pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
-                  pdcp_read_header_g.inst +  oai_emulation.info.first_enb_local;*/
-#else // OAI_EMU
           /* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
 //          pdcp_read_header_g.inst = 0;
 //#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
@@ -586,16 +555,13 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
           if (ctxt_cpy.enb_flag) {
             ctxt.module_id = 0;
             rab_id      = pdcp_read_header_g.rb_id % maxDRB;
-            ctxt.rnti          = pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index];
+            ctxt.rnti          = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / maxDRB];
           } else {
             ctxt.module_id = 0;
             rab_id      = pdcp_read_header_g.rb_id % maxDRB;
             ctxt.rnti          = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
           }
 
-
-#endif
-
           if (ctxt.enb_flag) {
             if (rab_id != 0) {
               rab_id = rab_id % maxDRB;
@@ -803,131 +769,15 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
 
 void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const  ctxt_pP) {
 
-  unsigned char       *otg_pkt=NULL;
+
   module_id_t          dst_id; // dst for otg
-  rb_id_t              rb_id;
-  unsigned int         pkt_size=0;
-#if defined(USER_MODE) && defined(OAI_EMU)
-  module_id_t          src_id;
-  static unsigned int  pkt_cnt_enb=0, pkt_cnt_ue=0;
-
-  Packet_otg_elt_t    *otg_pkt_info=NULL;
-  int                  result;
-  uint8_t              pdcp_mode, is_ue=0;
-#endif
   protocol_ctxt_t      ctxt;
   // we need to add conditions to avoid transmitting data when the UE is not RRC connected.
-#if defined(USER_MODE) && defined(OAI_EMU)
-
-  if (oai_emulation.info.otg_enabled ==1 ) {
-    // module_id is source id
-    while ((otg_pkt_info = pkt_list_remove_head(&(otg_pdcp_buffer[ctxt_pP->instance]))) != NULL) {
-      LOG_I(OTG,"Mod_id %d Frame %d Got a packet (%p), HEAD of otg_pdcp_buffer[%d] is %p and Nb elements is %d\n",
-            ctxt_pP->module_id,
-            ctxt_pP->frame,
-            otg_pkt_info,
-            ctxt_pP->instance,
-            pkt_list_get_head(&(otg_pdcp_buffer[ctxt_pP->instance])),
-            otg_pdcp_buffer[ctxt_pP->instance].nb_elements);
-      //otg_pkt_info = pkt_list_remove_head(&(otg_pdcp_buffer[module_id]));
-      dst_id    = (otg_pkt_info->otg_pkt).dst_id; // type is module_id_t
-      src_id    = (otg_pkt_info->otg_pkt).module_id; // type is module_id_t
-      rb_id     = (otg_pkt_info->otg_pkt).rb_id;
-      is_ue     = (otg_pkt_info->otg_pkt).is_ue;
-      pdcp_mode = (otg_pkt_info->otg_pkt).mode;
-      //    LOG_I(PDCP,"pdcp_fifo, pdcp mode is= %d\n",pdcp_mode);
-
-      // generate traffic if the ue is rrc reconfigured state
-      // if (mac_get_rrc_status(module_id, ctxt_pP->enb_flag, dst_id ) > 2 /*RRC_CONNECTED*/) { // not needed: this test is already done in update_otg_enb
-      otg_pkt = (unsigned char*) (otg_pkt_info->otg_pkt).sdu_buffer;
-      pkt_size = (otg_pkt_info->otg_pkt).sdu_buffer_size;
-
-      if (otg_pkt != NULL) {
-        if (is_ue == 0 ) {
-          PROTOCOL_CTXT_SET_BY_MODULE_ID(
-            &ctxt,
-            src_id,
-            ENB_FLAG_YES,
-            oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id],
-            ctxt_pP->frame,
-            ctxt_pP->subframe,
-	    src_id);
-
-          LOG_D(OTG,"[eNB %d] Frame %d sending packet %d from module %d on rab id %d (src %d, dst %d/%x) pkt size %d for pdcp mode %d\n",
-                ctxt.module_id,
-                ctxt.frame,
-                pkt_cnt_enb++,
-                src_id,
-                rb_id,
-                src_id,
-                dst_id,
-		oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id],
-                pkt_size,
-                pdcp_mode);
-          result = pdcp_data_req(&ctxt,
-                                 SRB_FLAG_NO,
-                                 rb_id,
-                                 RLC_MUI_UNDEFINED,
-                                 RLC_SDU_CONFIRM_NO,
-                                 pkt_size,
-                                 otg_pkt,
-                                 pdcp_mode);
-          if (result != TRUE) {
-            LOG_W(OTG,"PDCP data request failed!\n");
-          }
-        } else {
-          //rb_id= eNB_index * MAX_NUM_RB + DTCH;
-
-
-          LOG_D(OTG,"[UE %d] Frame %d: sending packet %d from module %d on rab id %d (src %d/%x, dst %d) pkt size %d\n",
-                ctxt_pP->module_id,
-                ctxt_pP->frame,
-                pkt_cnt_ue++,
-                ctxt_pP->module_id,
-                rb_id,
-                src_id,
-		pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id], // [src_id]
-                dst_id,
-                pkt_size);
-          PROTOCOL_CTXT_SET_BY_MODULE_ID(
-            &ctxt,
-            ctxt_pP->module_id, //src_id,
-            ENB_FLAG_NO,
-            pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id],// [src_id]
-            ctxt_pP->frame,
-            ctxt_pP->subframe,
-	    dst_id);
-
-          result = pdcp_data_req( &ctxt,
-                                  SRB_FLAG_NO,
-                                  rb_id,
-                                  RLC_MUI_UNDEFINED,
-                                  RLC_SDU_CONFIRM_NO,
-                                  pkt_size,
-                                  otg_pkt,
-                                  PDCP_TRANSMISSION_MODE_DATA);
-          if (result != TRUE) {
-            LOG_W(OTG,"PDCP data request failed!\n");
-          }
-        }
-
-        free(otg_pkt);
-        otg_pkt = NULL;
-      }
-
-      // } //else LOG_D(OTG,"ctxt_pP->frame %d enb %d-> ue %d link not yet established state %d  \n", ctxt_pP->frame, eNB_index,dst_id - NB_eNB_INST, mac_get_rrc_status(module_id, ctxt_pP->enb_flag, dst_id - NB_eNB_INST));
+  if ((otg_enabled==1) && (ctxt_pP->enb_flag == ENB_FLAG_YES)) { // generate DL traffic
 
-    }
-  }
 
-#else
 
-  if ((otg_enabled==1) && (ctxt_pP->enb_flag == ENB_FLAG_YES)) { // generate DL traffic
-    unsigned int ctime=0;
-    ctime = ctxt_pP->frame * 100;
 
-    /*if  ((mac_get_rrc_status(eNB_index, ctxt_pP->enb_flag, 0 ) > 2) &&
-    (mac_get_rrc_status(eNB_index, ctxt_pP->enb_flag, 1 ) > 2)) { */
     PROTOCOL_CTXT_SET_BY_MODULE_ID(
       &ctxt,
       ctxt_pP->module_id,
@@ -940,36 +790,6 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const  ctxt_pP)
     for (dst_id = 0; dst_id<NUMBER_OF_UE_MAX; dst_id++) {
       ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id];
 
-      if (ctxt.rnti != NOT_A_RNTI) {
-        if (mac_eNB_get_rrc_status(ctxt.module_id, ctxt.rnti ) > 2 /*RRC_SI_RECEIVED*/) {
-        unsigned int temp = 0;
-          otg_pkt=packet_gen(
-                    ENB_MODULE_ID_TO_INSTANCE(ctxt.module_id),
-                    UE_MODULE_ID_TO_INSTANCE(dst_id),
-                    0,
-                    ctime,
-                    &temp);
-        pkt_size = temp;
-
-        if (otg_pkt != NULL) {
-          rb_id = dst_id * maxDRB + DTCH;
-          pdcp_data_req(&ctxt,
-                        SRB_FLAG_NO,
-                        rb_id,
-                        RLC_MUI_UNDEFINED,
-                        RLC_SDU_CONFIRM_NO,
-                        pkt_size,
-                        otg_pkt,
-                        PDCP_TRANSMISSION_MODE_DATA);
-            LOG_I(OTG,
-                  "send packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n",
-                  ctxt_pP->module_id, rb_id, ctxt_pP->module_id, dst_id, pkt_size);
-            free(otg_pkt);
-          }
-        }
-      }
     }
   }
-
-#endif
 }
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
index 68cf6facdeee9b77782619bfac1b32feda3bf9ff..0df8e59e6d4536bd09654ac739d5651c11fc78d5 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -101,13 +101,8 @@ pdcp_netlink_init(
   struct sched_param sched_param;
 
   reset_meas(&ip_pdcp_stats_tmp);
-#if defined(USER_MODE) && defined(OAI_EMU)
-  nb_inst_enb = oai_emulation.info.nb_enb_local;
-  nb_inst_ue  = oai_emulation.info.nb_ue_local;
-#else
   nb_inst_enb = 1;
   nb_inst_ue  = 1;
-#endif
 
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
   nb_inst_enb = 0;
@@ -259,24 +254,7 @@ void *pdcp_netlink_thread_fct(void *arg)
           }
         } else {
           pdcp_thread_read_state = 0;
-
-#ifdef OAI_EMU
-
-          // LG: new_data_p->pdcp_read_header.inst will contain in fact a module id
-          if (new_data_p->pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) {
-            module_id = new_data_p->pdcp_read_header.inst
-                                                - oai_emulation.info.nb_enb_local +
-                                                + oai_emulation.info.first_ue_local;
-            eNB_flag = 0;
-          } else {
-            module_id = new_data_p->pdcp_read_header.inst
-                                                + oai_emulation.info.first_enb_local;
-            eNB_flag = 1;
-          }
-
-#else
           module_id = 0;
-#endif
           new_data_p->data = malloc(sizeof(uint8_t) * new_data_p->pdcp_read_header.data_size);
           /* Copy the data */
           memcpy(new_data_p->data, NLMSG_DATA(nas_nlh_rx), new_data_p->pdcp_read_header.data_size);
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c
index 6cef21c4931ae4f5f1241b6e60832a5e19bd6451..7117a760b979a2ba1d6470d99cfcd0d62b955e08 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h
index cc86a1cd6a559c334e5bb0e13ca0691aead3e39c..8e57f84b0a9e9fa86ec72144b219a2b9714304f3 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h
index 8bb383e6159678ec73c6fbc2794cf1a4c8c93df3..afcc2fdd0255dc0f11d15df8e670ee29dec8119f 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
index 030505d9ac7822003cdf51ac573676160e1cea1b..2554eb145ab9de975100795e207efe6276e39978 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -220,7 +220,7 @@ pdcp_validate_security(
   stream_decrypt(pdcp_pP->cipheringAlgorithm,
                  &decrypt_params,
                  &buffer_decrypted);
-
+#if !defined(USRP_REC_PLAY)
   if (srb_flagP) {
     /* Now check the integrity of the complete PDU */
     decrypt_params.message    = pdcp_pdu_buffer;
@@ -241,7 +241,7 @@ pdcp_validate_security(
       return -1;
     }
   }
-
+#endif
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
 
   return 0;
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c
index 3eff6e335c6310f30eab32eff0d09aab7e1c3dd0..949858c1e52f155fe28023d129cd6db7887169b4 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.h
index 3faa001575e3bf5b8c8de822c892888827c7c30f..ec59a4b4fe8dca5190bd26118b0e0209af2f8b8e 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_sequence_manager.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c
index a4d6b7d112556362c12d02da67f9b49f2319db51..0b6be93d59a5f44448282293529f0c1ff337e95b 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -110,9 +110,7 @@ int init_pdcp_thread(void)
 
   p.sched_priority = OPENAIR_THREAD_PRIORITY;
   pthread_attr_setschedparam  (&pdcp_thread_attr, &p);
-#ifndef RTAI_ISNT_POSIX
   pthread_attr_setschedpolicy (&pdcp_thread_attr, SCHED_FIFO);
-#endif
   pthread_mutex_init(&pdcp_mutex,NULL);
   pthread_cond_init(&pdcp_cond,NULL);
 
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
index eac42cb1297c8958a580f70c57685903f223b5ad..ad2cbae8479ad13c21f3a8463c1636b442f6c687 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h
index 4934e0c635ab30107e93dc9db7ced6e170ec2916..7944049c3bd06f24b44549ccc6c134867061f372 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
index 03fabf47b31facd3d84479c1a7cc874713cfc88c..0e21d5cfac8c8d79237b472a1ce691512eede2cb 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
index 4619a07315fa67cc6d6836a5b125c2ba208e0960..5130bde38b9f32f6a8d3b18c6d4d8e139c388c84 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -73,10 +73,6 @@
 #        include "RLC-Config.h"
 //#        include "rlc_am_test.h"
 
-#ifdef USER_MODE
-//#        include "rlc_am_very_simple_test.h"
-#endif
-
 
 #define PROTOCOL_RLC_AM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u]"
 #define PROTOCOL_RLC_AM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_constants.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_constants.h
index 12af0279a8143fcd966f72c4b4d83e6f92b1fc12..674b8c244eef590fb830e39053fdd6837b41c85c 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_constants.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_constants.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h
index 602e8e98c2f7ff1bc3abef94b3ba07c1fe8fe45c..1b6d8375655d00a98b5851daf8e40cc4c207535f 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c
index 4b5c173d4b6e891c5d98b7eb7c1d95ade8e60719..a133ce09920157695402118420de43ab601e610b 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h
index c596bc671accf0c97b013c0342a6b7a21675d0d6..43503a1b3a014169ddcc2741044f2cf2e2a385fa 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c
index 129d4ffb0f97f621cc3d17898006a17082c39a5d..01a635656e24ce819f112c399f70f99ccf7a3e1a 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -21,9 +21,7 @@
 
 #define RLC_AM_MODULE 1
 #define RLC_AM_INIT_C 1
-#ifdef USER_MODE
 #include <string.h>
-#endif
 //-----------------------------------------------------------------------------
 #include "rlc_am.h"
 #include "LAYER2/MAC/extern.h"
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h
index d088f9f0116430ef137d8307bc815e5671c178ad..2ee7d040ab36b65b0a617dacd8a24e69aa34d996 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_proto_extern.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_proto_extern.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_proto_extern.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
index 4202443a5a4e02c5248836e0607a61a9a5ce9bf7..d0b5b52395417f9e01e6581402111ec51d2c05de 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -268,11 +268,9 @@ rlc_am_reassemble_pdu(
       //}
 
       break;
-#if USER_MODE
 
     default:
       assert(0 != 0);
-#endif
     }
   } else {
     switch (pdu_info->fi) {
@@ -382,19 +380,13 @@ rlc_am_reassemble_pdu(
       if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
         // data is already ok, done by last loop above
         rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
-      } else {
-#if USER_MODE
-        //assert (5!=5);
-#endif
       }
 
       //rlc_pP->reassembly_missing_sn_detected = 0;
       break;
-#if USER_MODE
 
     default:
       assert(1 != 1);
-#endif
     }
   }
 
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h
index 4b780ce4414c2735074a4477b93fbf3e58c5e5e9..82148a4a377899c4a98c5b0a2909e79764a3d846 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c
index d2a5cc985e848881c26fda350b996a6e5bb5485e..b1facdfb023671b9e948280b6031c1ade079e285 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h
index fbc02474eb0480c0085458bfad36278742f46f01..9d2978b0f8a6566cef8418f0a112b2c489767e37 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c
index 06ad9a3b05ace2ccbaeff4fe42a5d6a040254181..9e1db8a95bb07d58a4f582c302088156425c8f0e 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h
index 7224d39bf96b90b11562fb4be5eb47c74daeca41..60fefab84b22c17ce36bd87401d5ee170ca8e088 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c
index cad1a776a8244503a7257fca0d3799c9d43d05d3..dc1ed2116341ed9d395a9546c103b61f022c25e3 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h
index e6e043dd0a579092223189ba1464519bc931be15..d2f0740b33de9530a97e531f442f955562ba2d42 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c
index 113ee7d048a61677c67fac3d7f818dde03b3374b..c16e897bb6f67fdadddb2111694cb95e7ad11097 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -22,9 +22,7 @@
 #define RLC_AM_MODULE 1
 #define RLC_AM_SEGMENT_C 1
 //-----------------------------------------------------------------------------
-#if USER_MODE
 #include <assert.h>
-#endif
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
 //-----------------------------------------------------------------------------
@@ -468,9 +466,7 @@ void rlc_am_segment_10 (
               PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
               sdu_mngt_p->sdu_remaining_size,
               pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
-#if USER_MODE
         assert(1!=1);
-#endif
         memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
         pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
         pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h
index b52b3e5aaa5d87e78b413e911504df7aa337f030..aa5cb6dceb25ecd00576cea224b1eca1b9909007 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c
index 46a656e65a5961058625c4b973659ab729f21595..1da5bbc441cb1aa865afc6e58ee951c7761dd498 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h
index 68200c0f996fedfab863267f84714534ac078154..7c22697ac42b08186856287ab4d222c310f9d2cf 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
index a5c15a5262a15bcb154c9c013765ebeb8f5645db..092c7c65f135f05827e36fcf46bc5c56f4d72a86 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h
index 31afd6ae4bade810ae7fd7121e770f5ef7d836dd..e09189fcd6060c9b303c59b6b3a6a75cd98df10a 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h
index 2b75cb21a7a8eaf63a9d42a9239e654bb366cb37..147fd44d07e0cb0f55af32d92eca4b8011aeda2e 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,9 +36,7 @@
 #        include "list.h"
 #        include "mem_block.h"
 #        include "rlc_am_constants.h"
-//#ifdef USER_MODE
 #        include "mac_rlc_primitives.h"
-//#endif //USER_MODE
 #        include "mac_primitives.h"
 #        include "rlc_primitives.h"
 /**
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c
index 86cafb89ce441ab8cad42825bc661a8ac131cc11..ff969c0b6ee8f4fb45916b71bf6670973258a93b 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.h
index 6064f777cb8cbc06e92c9cee4a2cbea77cca4ba8..b42800e15f3a3799920075dec308d34fbce530c7 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c
index 3edb09d22815ca0053af0aecf9aed40f1f53e8a7..0b88e7c650fe4e3d4b9fb23e93eb7fbfb45c9f00 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h
index 1df0be62d98bece13415d48baa1a65755e21c842..c5d49268c4d0f95e299eea9dfa1d066bf226e94d 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c
index cec0dffd1d726ea6027e809b630cff5504ae4c46..b9383980a4231cd9f84dba7b276bf7c1787dd3be 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h
index dcf27a1977895e0ad4c5f26b1a9d2a68fd610811..a2876d91694b91a66202a66c87f4c3a2943a700b 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c
index 65ea0561205b6d09d28026edac333978e9a0b364..13d4205c2800cd1f7de367f46547ce928e9efe53 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h
index e6445b6d156ec06a9911d2ff0502c26bfcaace06..31ff985e414a0e1c41e3a63d2786ce9f5000fcf4 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c
index 2c181b5d6c857ff469d431e16c6148f7d4dd29b8..7a3005334e8cdd7d8ef0d393230ecc3f459c85cc 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -22,9 +22,7 @@
 #define RLC_AM_MODULE 1
 #define RLC_AM_WINDOWS_C 1
 //-----------------------------------------------------------------------------
-#if USER_MODE
 #include <assert.h>
-#endif
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
 //-----------------------------------------------------------------------------
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h
index 8274de2428ee5fc21cba56a2342404008f99caba..aff78a15c6e21c4298f7c813372c8822597b3b7d 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c
index 077e9f403aea32cf35d4f63bf909584e44b875ce..ee2ff57c1eae1a9a48d9e4013a1abe76907ec9bc 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h
index 3c74470eba41f473895ec5146b36d26df3f625f4..a0049e4c2a5d89ab3f315c23ba8247019105eb61 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h
index 9c4e06efbc02396d02fb18926169b2454f5d16ec..1a13982df65fd2bac70d02dae4452c7ea0711e0c 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c
index 8ddea705cdc5acfb0949653089e7c81245688bbd..15dc90f175a183dab9d247afeb081aad21db975a 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -125,6 +125,7 @@ rlc_tm_cleanup (
   // RX SIDE
   if ((rlcP->output_sdu_in_construction)) {
     free_mem_block (rlcP->output_sdu_in_construction, __func__);
+    rlcP->output_sdu_in_construction = NULL;
   }
 
   memset(rlcP, 0, sizeof(rlc_tm_entity_t));
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h
index 0e400a48adc6172633c6cfc4ec6acd2be5045344..35e6c792aea248aaabb73ffad819af5de6a47c65 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_structs.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_structs.h
index 597fe0f04aff0bc63bee185cb48e6a1346fc7c9d..ee9d5268d4a25b3ed601aa15465261658e421740 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_structs.h
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_structs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
index e3322d9410b62829e2a4bede9937d70adb0b8b2b..7bd0da83a903e40f909f8538a73d5f1c7c192232 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -682,10 +682,6 @@ rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, mem_block_t
 {
   rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP;
 
-#if ! USER_MODE
-  unsigned long int rlc_um_time_us;
-  int min, sec, usec;
-#endif
 #if TRACE_RLC_UM_PDU
 #if ENABLE_ITTI
   MessageDef          *msg_p;
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
index 87cf2e2f3764b8d17c60b917070aa013c4ccba75..abf4f8ad6e991a59fd7e98c086b7d557f51f969f 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -64,9 +64,6 @@
 #        include "rlc_um_receiver.h"
 #        include "rlc_um_segment.h"
 #        include "rlc_um_test.h"
-#ifdef USER_MODE
-//#        include "rlc_um_very_simple_test.h"
-#endif
 
 #define PROTOCOL_RLC_UM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u] %s()"
 #define PROTOCOL_RLC_UM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_constants.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_constants.h
index 34d97de59d35b96cb7ebfb0403d23d5e8269a813..5f210dbe7b08bdb4c413b54e01abd4eaff1ce6d9 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_constants.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_constants.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c
index 14ca1a62a985674078cd7b7542ab5b83e5a0a48c..4e2723a8f476489bb16fe1eb677f6e0ed4550ab2 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -79,9 +79,9 @@ void config_req_rlc_um (
 }
 //-----------------------------------------------------------------------------
 #if defined(Rel14)
-const uint32_t const t_Reordering_tab[32] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200,1600};
+const uint32_t t_Reordering_tab[32] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200,1600};
 #else
-const uint32_t const t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200};
+const uint32_t t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200};
 #endif
 
 void config_req_rlc_um_asn1 (
@@ -343,6 +343,7 @@ rlc_um_cleanup (
 
   if ((rlc_pP->output_sdu_in_construction)) {
     free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
+    rlc_pP->output_sdu_in_construction = NULL;
   }
 
   if (rlc_pP->dar_buffer) {
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h
index b6964f9f129f0ad1911fc39891d9a9208e13affd..5847a8bb13bbe08b445284efaed347331faf8740 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c
index c00e87c4e09fa3a29cb599f792c4e9bc82d719d4..fe718392310a8ef4e9c854775cf46d5883a4b41c 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h
index 10816a372afff747e8c5d3e5457a53c6a9dbd5c6..f62cddfbcae2c2437f8d7b4735635f39f23fc744 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h
index f4bfef2b149347eb968783e21f80de3a1db21113..3250ac85b85c925cfaea642af929f200eecd4752 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c
index a0995944504edb1d05d7c99889ad58611f686be1..758630b3cce88476ea49df4a253a60d7d36c9879 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h
index 28fec3567a2a99707bd7ab1f4945da22324c0416..1f7310803be110ccc03916d5f3f92c19ce46772a 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c
index 0805d708ca99fb01cb5eaea8197c52d52755a4a1..91e1ba66d1bfa662eb29f75cdd286260c48e5147 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -23,9 +23,7 @@
 #define RLC_UM_REASSEMBLY_C 1
 #include "platform_types.h"
 //-----------------------------------------------------------------------------
-#if USER_MODE
 #include <string.h>
-#endif
 #if ENABLE_ITTI
 # include "platform_types.h"
 # include "intertask_interface.h"
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h
index d199409c57551bfbd4b7fb239b4bb68fb2bd40ac..95aac89623e6adf29a531f60b871ee6f840e50e8 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c
index 3f083a77a881bc069c6597a9a7ec280dc50d69b2..37608d43308b12b88dde5e274f3d6445314958ce 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h
index 882a29de7e01edf822c3672a7a5e7f64beb72993..5e93f272fdb0140ae1506f32c33c038d8a78350d 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
index bae9bd8d80535e3bfc253b7f272e99b3ff96f81c..98a44ceeeb0fccb77a78e4016410294eace7ab53 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -25,9 +25,7 @@
 #include "platform_types.h"
 #include "platform_constants.h"
 //-----------------------------------------------------------------------------
-#if USER_MODE
 #include <assert.h>
-#endif
 #include "assertions.h"
 #include "msc.h"
 #include "list.h"
@@ -174,7 +172,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
         test_pdu_remaining_size = 0;
         test_remaining_size_to_substract = 0;
         test_remaining_num_li_to_substract = 0;
-        pdu_remaining_size = pdu_remaining_size - (test_li_length_in_bytes ^ 3);
+        //pdu_remaining_size = pdu_remaining_size - (test_li_length_in_bytes ^ 3);
       } else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) < test_pdu_remaining_size ) {
         test_num_li += 1;
         num_fill_sdu += 1;
@@ -367,11 +365,9 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
               sdu_mngt_p->sdu_remaining_size,
               pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
 #endif
-#if USER_MODE
-#if !EXMIMO
-        assert(1!=1);
-#endif
-#endif
+//#if !EXMIMO
+//        assert(1!=1);
+//#endif
         memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
         // reduce the size of the PDU
         continue_fill_pdu_with_sdu = 0;
@@ -754,9 +750,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
               sdu_mngt_p->sdu_remaining_size,
               pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
 #endif
-#if USER_MODE
         assert(1!=1);
-#endif
         memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
         // reduce the size of the PDU
         continue_fill_pdu_with_sdu = 0;
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h
index 7f3d8d7e92c6c3dd32232a0fdeafb3a8c7eea25b..9794f9a502fa3628da00afbcfa83fd7f1fcbb06c 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h
index 232450c5accbf63966e1fe196ab6eddddb818a06..7ab9798a38d66a128079abe3142ddf3f960ffb04 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,9 +36,7 @@
 #        include "rlc_um_constants.h"
 #        include "mac_primitives.h"
 #        include "rlc_primitives.h"
-//#ifdef USER_MODE
 #        include "mac_rlc_primitives.h"
-//#endif //USER_MODE
 //-----------------------
 /**
 * @addtogroup _rlc_um_impl_
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c
index fced6efbf92bff76713c998974b19897185dd659..2c1fa9333f0136c8ae42e61fd428fa4140974bca 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h
index 71030b639dcc5095df73c3cd48990ddca0008ce0..2c874b8d2432c32d4cdf7afe86a46e1da3b71478 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.c
index 9934fd3a588e2d7f921005a0226ba9fa18ae2322..91985e4800d96f88f651c9d648af5eac35db0587 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.h
index 34cd0fea12c22d9593940e1de297d76e7f872c3e..261183ad1d8be8660725d96b39f22da32d91e649 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/mac_primitives.h b/openair2/LAYER2/RLC/mac_primitives.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair2/LAYER2/RLC/mac_primitives.h
+++ b/openair2/LAYER2/RLC/mac_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index 1472a990c8823bea61e858cacbb19106c8ed9ce9..783441bd586928fb2dfe9dfc61dc1e926ca31ada 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -135,11 +135,6 @@ rlc_op_status_t rlc_stat_req     (
   hash_key_t             key             = HASHTABLE_NOT_A_KEY_VALUE;
   hashtable_rc_t         h_rc;
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
   AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
   key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
   h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
@@ -346,11 +341,6 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t* const ctxt_pP,
 #else
   AssertFatal(MBMS_flagP == 0, "MBMS_flagP %u", MBMS_flagP);
 #endif
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
 
 #if T_TRACER
   if (ctxt_pP->enb_flag)
@@ -447,6 +437,15 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t* const ctxt_pP,
       break;
 
     case RLC_MODE_UM:
+      /* TODO: this is a hack, needs better solution. Let's not use too
+       * much memory and store at maximum 5 millions bytes.
+       */
+      /* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */
+      if (rlc_um_get_buffer_occupancy(&rlc_union_p->rlc.um) > 5000000) {
+        free_mem_block(sdu_pP, __func__);
+        return RLC_OP_STATUS_OUT_OF_RESSOURCES;
+      }
+
       new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc), __func__);
 
       if (new_sdu_p != NULL) {
diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h
index 3d6be205249b0284c2f9062c838a38a88051964c..ffd963204eeba97839d93bf27cf393dedb9846c5 100644
--- a/openair2/LAYER2/RLC/rlc.h
+++ b/openair2/LAYER2/RLC/rlc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -662,10 +662,6 @@ public_rlc(rlc_op_status_t rlc_stat_req     (
 public_rlc(int rlc_module_init(void);)
 
 /** @} */
-#ifndef USER_MODE
-#define assert(x) ((x)?msg("rlc assertion fails\n"):0)
-#endif
-
 
 #define RLC_FG_COLOR_BLACK            "\e[0;30m"
 #define RLC_FG_COLOR_RED              "\e[0;31m"
diff --git a/openair2/LAYER2/RLC/rlc_def.h b/openair2/LAYER2/RLC/rlc_def.h
index 929d66b70bc55f77f4dbe26c02d874d32edcc021..e7014043f74b7ce3bba049e459464c1e48773627 100644
--- a/openair2/LAYER2/RLC/rlc_def.h
+++ b/openair2/LAYER2/RLC/rlc_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/rlc_def_lte.h b/openair2/LAYER2/RLC/rlc_def_lte.h
index 20a60c5d9310723993a73031bb1e4dcdb5be73c6..aa4dac79ae354e32e4b4b28f432aa6fa0b236625 100644
--- a/openair2/LAYER2/RLC/rlc_def_lte.h
+++ b/openair2/LAYER2/RLC/rlc_def_lte.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c
index b4061ad29f9b9adc1e1adc2d57897541da7a2d8e..497937d073841cdb37ce5ddf17b0f8aadee419cf 100644
--- a/openair2/LAYER2/RLC/rlc_mac.c
+++ b/openair2/LAYER2/RLC/rlc_mac.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -157,13 +157,6 @@ tbs_size_t mac_rlc_data_req(
     AssertFatal (channel_idP < NB_RB_MAX,        "channel id is too high (%u/%d)!\n",     channel_idP, NB_RB_MAX);
   }
 
-#ifdef OAI_EMU
-  CHECK_CTXT_ARGS(&ctxt);
-  //printf("MBMS_flagP %d, MBMS_FLAG_NO %d \n",MBMS_flagP, MBMS_FLAG_NO);
-  //  AssertFatal (MBMS_flagP == MBMS_FLAG_NO ," MBMS FLAG SHOULD NOT BE SET IN mac_rlc_data_req in UE\n");
-
-#endif
-
   if (MBMS_flagP) {
     if (enb_flagP) {
       mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP];
@@ -256,18 +249,6 @@ void mac_rlc_data_ind     (
   }
 
 #endif // DEBUG_MAC_INTERFACE
-#ifdef OAI_EMU
-
-  if (MBMS_flagP)
-    AssertFatal (channel_idP < RLC_MAX_MBMS_LC,  "channel id is too high (%u/%d)!\n",
-                 channel_idP, RLC_MAX_MBMS_LC);
-  else
-    AssertFatal (channel_idP < NB_RB_MAX,        "channel id is too high (%u/%d)!\n",
-                 channel_idP, NB_RB_MAX);
-
-  CHECK_CTXT_ARGS(&ctxt);
-
-#endif
 
 #if T_TRACER
   if (enb_flagP)
@@ -347,31 +328,6 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
   memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t));
   memset (&tx_status          , 0, sizeof(struct mac_status_ind));
 
-#ifdef OAI_EMU
-
-  if (MBMS_flagP)
-    AssertFatal (channel_idP < RLC_MAX_MBMS_LC,
-                 "%s channel id is too high (%u/%d) enb module id %u ue %u!\n",
-                 (enb_flagP) ? "eNB" : "UE",
-                 channel_idP,
-                 RLC_MAX_MBMS_LC,
-                 module_idP,
-                 rntiP);
-  else
-    AssertFatal (channel_idP < NB_RB_MAX,
-                 "%s channel id is too high (%u/%d) enb module id %u ue %u!\n",
-                 (enb_flagP) ? "eNB" : "UE",
-                 channel_idP,
-                 NB_RB_MAX,
-                 module_idP,
-                 rntiP);
-
-  CHECK_CTXT_ARGS(&ctxt);
-
-#endif
-
-
-
   if (MBMS_flagP) {
     if (enb_flagP) {
       mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP];
diff --git a/openair2/LAYER2/RLC/rlc_mpls.c b/openair2/LAYER2/RLC/rlc_mpls.c
index e508c3193f628e4e4ec6f64a0da82173256265a6..34e4f028aec13ccc4f6a234413cffca1791c0643 100644
--- a/openair2/LAYER2/RLC/rlc_mpls.c
+++ b/openair2/LAYER2/RLC/rlc_mpls.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/LAYER2/RLC/rlc_primitives.h b/openair2/LAYER2/RLC/rlc_primitives.h
index 611c48ee4c36252d390ac2066467f5e002138f3f..eb7b9ae0053b925a3d52132c99e3240b1658181d 100644
--- a/openair2/LAYER2/RLC/rlc_primitives.h
+++ b/openair2/LAYER2/RLC/rlc_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -31,10 +31,8 @@
 #ifndef __RLC_PRIMITIVES_H__
 #    define __RLC_PRIMITIVES_H__
 
-#    ifdef USER_MODE
-#        include <stdio.h>
-#        include <stdlib.h>
-#    endif
+#    include <stdio.h>
+#    include <stdlib.h>
 #    include "platform_types.h"
 #    include "platform_constants.h"
 #    include "mem_block.h"
diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c
index a45838603e324f9aa3adb0fc78e67f3a0adce011..dee6ba700017d6dc48151b32ccac8f7a82eead0c 100644
--- a/openair2/LAYER2/RLC/rlc_rrc.c
+++ b/openair2/LAYER2/RLC/rlc_rrc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,9 +33,6 @@
 #include "rlc_um.h"
 #include "rlc_tm.h"
 #include "UTIL/LOG/log.h"
-#ifdef OAI_EMU
-#include "UTIL/OCG/OCG_vars.h"
-#endif
 #include "RLC-Config.h"
 #include "DRB-ToAddMod.h"
 #include "DRB-ToAddModList.h"
@@ -88,12 +85,6 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t   * const ctxt_pP
   LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ ASN1 \n",
         PROTOCOL_CTXT_ARGS(ctxt_pP));
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
-
   if (srb2add_listP != NULL) {
     for (cnt=0; cnt<srb2add_listP->list.count; cnt++) {
       rb_id = srb2add_listP->list.array[cnt]->srb_Identity;
@@ -489,10 +480,6 @@ rlc_op_status_t rrc_rlc_remove_rlc   (
   rlc_union_t           *rlc_union_p = NULL;
 #if defined(Rel10) || defined(Rel14)
   rlc_mbms_id_t         *mbms_id_p  = NULL;
-#endif
-#ifdef OAI_EMU
-  CHECK_CTXT_ARGS(ctxt_pP)
-
 #endif
 
   /* for no gcc warnings */
@@ -597,12 +584,6 @@ rlc_union_t* rrc_rlc_add_rlc   (
   logical_chan_id_t      lcid            = 0;
 #endif
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
-
   if (MBMS_flagP == FALSE) {
     AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
     AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
@@ -706,11 +687,6 @@ rlc_op_status_t rrc_rlc_config_req   (
         PROTOCOL_CTXT_ARGS(ctxt_pP),
         rb_idP);
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
   AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
 
   switch (actionP) {
diff --git a/openair2/LAYER2/openair2_proc.c b/openair2/LAYER2/openair2_proc.c
index 10a4059950c79844b064b53c141a97ffe153e480..f66d1142abf5c668f240de1fcda9bc2aa65337ff 100644
--- a/openair2/LAYER2/openair2_proc.c
+++ b/openair2/LAYER2/openair2_proc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,21 +29,7 @@
 # @ingroup _openair2
 */
 
-#ifdef USER_MODE
-# include <inttypes.h>
-#else
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/proc_fs.h>
-
-# ifndef PRIu64
-#  if __WORDSIZE == 64
-#     define PRIu64 "lu"
-#   else
-#     define PRIu64 "llu"
-#   endif
-# endif
-#endif
+#include <inttypes.h>
 
 #include "LAYER2/RLC/rlc.h"
 #include "LAYER2/MAC/defs.h"
@@ -131,6 +117,12 @@ int dump_eNB_l2_stats(char *buffer, int length)
 		     eNB->eNB_stats[CC_id].bcch_buffer,
 		     eNB->eNB_stats[CC_id].total_bcch_buffer,
 		     eNB->eNB_stats[CC_id].bcch_mcs);
+
+      len += sprintf(&buffer[len],"PCCH , NB_TX_MAC = %d, transmitted bytes (TTI %d, total %d) MCS (TTI %d)\n",
+         eNB->eNB_stats[CC_id].total_num_pcch_pdu,
+         eNB->eNB_stats[CC_id].pcch_buffer,
+         eNB->eNB_stats[CC_id].total_pcch_buffer,
+         eNB->eNB_stats[CC_id].pcch_mcs);
       
       eNB->eNB_stats[CC_id].dlsch_bitrate=((eNB->eNB_stats[CC_id].dlsch_bytes_tx*8)/((eNB->frame + 1)*10));
       eNB->eNB_stats[CC_id].total_dlsch_pdus_tx+=eNB->eNB_stats[CC_id].dlsch_pdus_tx;
@@ -225,18 +217,18 @@ int dump_eNB_l2_stats(char *buffer, int length)
                        UE_list->eNB_UE_stats[CC_id][UE_id].num_errors_rx);
 
         len+= sprintf(&buffer[len],"[MAC] Received PHR PH = %d (db)\n", UE_list->UE_template[CC_id][UE_id].phr_info);
-        len+= sprintf(&buffer[len],"[MAC] Received BSR LCGID[0][1][2][3] = %u %u %u %u\n",
-                      UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID0],
-                      UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID1],
-                      UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID2],
-                      UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID3]
+        len+= sprintf(&buffer[len],"[MAC] Estimated size LCGID[0][1][2][3] = %u %u %u %u\n",
+                      UE_list->UE_template[CC_id][UE_id].ul_buffer_info[LCGID0],
+                      UE_list->UE_template[CC_id][UE_id].ul_buffer_info[LCGID1],
+                      UE_list->UE_template[CC_id][UE_id].ul_buffer_info[LCGID2],
+                      UE_list->UE_template[CC_id][UE_id].ul_buffer_info[LCGID3]
                      );
       }
       
       PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,
 				     eNB_id,
 				     ENB_FLAG_YES,
-				     UE_list->eNB_UE_stats[UE_PCCID(eNB_id,UE_id)][UE_id].crnti, 
+				     UE_list->eNB_UE_stats[0][UE_id].crnti,//UE_PCCID(eNB_id,UE_id)][UE_id].crnti, 
 				     eNB->frame,
 				     eNB->subframe,
 				     eNB_id);
@@ -404,11 +396,7 @@ int dump_eNB_l2_stats(char *buffer, int length)
 }
 
 #ifdef PROC
-#ifndef USER_MODE
-static int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length)
-#else
 int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length)
-#endif
 {
 
   int len = 0,fg,Overhead, Sign;
@@ -691,36 +679,4 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length)
   return len;
 }
 
-#ifndef USER_MODE
-static struct proc_dir_entry *proc_openair2_root;
-/*
- * Initialize the module and add the /proc file.
- */
-int add_openair2_stats()
-{
-  struct proc_dir_entry *pde;
-
-  proc_openair2_root = proc_mkdir("openair2",0);
-  // pde = proc_create_entry("lchan_stats", S_IFREG | S_IRUGO, proc_openair2_root);
-  pde = proc_create_data("lchan_stats", S_IFREG | S_IRUGO, proc_openair2_root, NULL,openair2_stats_read);
-
-  if (!pde) {
-    printk("[OPENAIR][ERROR] can't create proc entry !\n");
-  }
-
-  return 0;
-}
-/*
- * Unregister the file when the module is closed.
- */
-void remove_openair_stats()
-{
-
-  if (proc_openair2_root) {
-    printk("[OPENAIR][CLEANUP] Removing openair proc entry\n");
-    remove_proc_entry("lchan_stats", proc_openair2_root);
-
-  }
-}
-#endif
 #endif
diff --git a/openair2/LAYER2/register.c b/openair2/LAYER2/register.c
deleted file mode 100644
index 400020b8a561fa40078df1ba1990aec4aa578757..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/register.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*________________________rrc_register.c________________________
-
- Authors : Hicham Anouar, Raymond Knopp
- Company : EURECOM
- Emails  : anouar@eurecom.fr,  knopp@eurecom.fr
-________________________________________________________________*/
-
-
-#ifndef USER_MODE
-#define __NO_VERSION__
-#else
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <pthread.h>
-#endif
-
-#include "COMMON/openair_types.h"
-#include "MAC/extern.h"
-
-#include <linux/module.h>
-
-#ifndef USER_MODE
-
-//-----------------------------------------------------------------------------------------------------------//
-MAC_RLC_XFACE* mac_rrc_register(RRC_XFACE* RRC_xface)
-{
-  //-----------------------------------------------------------------------------------------------------------//
-  if(Is_rrc_registered) {
-    msg("[OPENAIR][MAC][RRC_REGISTER] RRC interface already registered, aborting ...\n");
-    return NULL;
-  } else {
-    msg("[OPENAIR][MAC][RRC_REGISTER] Registering RRC Interface, Mac_rlc_xface=%p\n",Mac_rlc_xface);
-    Rrc_xface=RRC_xface;
-    Is_rrc_registered=1;
-    return Mac_rlc_xface;
-  }
-}
-
-//-----------------------------------------------------------------------------------------------------------//
-int mac_rrc_unregister(RRC_XFACE *RRC_xface)
-{
-  //-----------------------------------------------------------------------------------------------------------//
-  if (Rrc_xface == RRC_xface) {
-    msg("[OPENAIR][MAC XFACE][RRC_UNREGISTER] Unregistering RRC interface\n");
-    Rrc_xface=NULL;
-    Is_rrc_registered=0;
-    return(0);
-  } else {
-    msg("[OPENAIR][MAC XFACE][RRC_UNREGISTER] Not the right interface descriptor pointer!!!, aborting ...\n");
-    return (-1);
-  }
-
-}
-
-EXPORT_SYMBOL(mac_rrc_register);
-EXPORT_SYMBOL(mac_rrc_unregister);
-#endif //USER_MODE
-
-
diff --git a/openair2/LAYER2/register.h b/openair2/LAYER2/register.h
index e65aa92361b464237486fd91df89a4489c95d74e..8a4aeb5b12336011cbc80aff0a6f547a411b49c4 100644
--- a/openair2/LAYER2/register.h
+++ b/openair2/LAYER2/register.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/Makefile b/openair2/Makefile
deleted file mode 100755
index 87b3108f1bc4dafb969fdaded01a783651c0beea..0000000000000000000000000000000000000000
--- a/openair2/Makefile
+++ /dev/null
@@ -1,254 +0,0 @@
-#/*
-# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
-# * contributor license agreements.  See the NOTICE file distributed with
-# * this work for additional information regarding copyright ownership.
-# * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
-# * except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# *      http://www.openairinterface.org/?page_id=698
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-# *-------------------------------------------------------------------------------
-# * For more information about the OpenAirInterface (OAI) Software Alliance:
-# *      contact@openairinterface.org
-# */
-
-####################################################
-#       USER SPACE CODE GENERATION
-####################################################
-
-#---------------------------------------------------
-#
-#---------------------------------------------------
-
-
-#LM_LICENSE_FILE=
-#export LM_LICENSE_FILE
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-
-KERNEL_NAME:=$(shell uname -r)
-NUM_CORES=$(shell getconf _NPROCESSORS_CONF)
-
-export SET_UM=$(shell if grep --silent User\ Mode\ Linux /proc/cpuinfo ; then echo "ARCH=um" ; else echo ""; fi)
-
-#SUBDIRS_openair_USERRF  =   $(MAIN_RT_DIR) $(CONFIG_DIR)
-
-#openair_USERRFDIR  = openair_RFOBJS
-#openair_USERRFLIBS = $(addsuffix /${openair_USERRFDIR}/Lib.a, ${SUBDIRS_openair_USERRF})
-#openair_USERRFOBJS = $(addsuffix /${openair_USERRFDIR}/*.o, ${SUBDIRS_openair_USERRF})
-#openair_USERRFDEPS = $(addsuffix /${openair_USERRFDIR}/*.d, ${SUBDIRS_openair_USERRF})
-
-mac_sim_no_netlink:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim MASTER=1)
-
-mac_sim:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim MASTER=1 NETLINK=1 NO_RRM=1)
-
-mac_sim_rrm:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim_rrm MASTER=1 NETLINK=1)
-
-mac_sim_mt_cellular:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim_mt CELLULAR=1 NO_RRM=1)
-
-mac_sim_rg_cellular:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim_rg MASTER=1 CELLULAR=1 NO_RRM=1)
-
-openair_layer2_emul.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` NO_RRM=1 PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 PHYEMUL=1 && mv openair_l2.ko openair_layer2.ko)
-
-openair_layer2_emul_rrm.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 PHYEMUL=1 && mv openair_l2.ko openair_layer2.ko)
-
-
-openair_layer2.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build M=`pwd` NO_RRM=1 PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 OPENAIR1=1 && mv openair_l2.ko openair_layer2.ko)
-
-openair_layer2_rrm.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 OPENAIR1=1 && mv openair_l2.ko openair_layer2.ko)
-
-openair_layer2_2615.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 OPENAIR1=1 && mv openair_l2.ko openair_layer2_2615.ko)
-
-
-openair_rrc.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 NO_RRM=1 && mv openair_rrc.ko openair_RRC.ko)
-
-openair_rrc_rrm.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 && mv openair_rrc.ko openair_RRC.ko)
-
-
-openair_rrc_2615.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 && mv openair_rrc.ko openair_RRC_2615.ko)
-
-openair_rrc_emul.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 PHYEMUL=1 NO_RRM=1)
-
-openair_rrc_emul_rrm.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 PHYEMUL=1)
-
-
-openair_emul.ko:
-	(cd SIMULATION/PHY_EMULATION/DEVICE_DRIVER/ && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 NO_RRM=1)
-
-openair_emul_rrm.ko:
-	(cd SIMULATION/PHY_EMULATION/DEVICE_DRIVER/ && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1)
-
-
-
-create_device:
-	rm -f /dev/openair0
-	mknod /dev/openair0 c 127 0
-	chmod a+rw /dev/openair0
-
-
-install_emul:
-	make devs
-	make fifos
-	(insmod SIMULATION/PHY_EMULATION/DEVICE_DRIVER/openair_emul.ko)
-	(insmod LAYER2/openair_layer2.ko)
-	(insmod RRC/MESH/openair_rrc.ko)
-	(insmod NETWORK_DRIVER/MESH/nasmesh.ko)
-
-remove_emul:
-	rmmod  nasmesh
-	sleep 1
-	rmmod  openair_rrc
-	sleep 1
-	rmmod  openair_l2
-	sleep 1
-	rmmod  openair_emul
-
-
-clean_nasmesh:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build M=`pwd` clean)
-
-nasmesh_address_fix.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) V=1 ADDRESS_FIX=1 -C $(KERNEL_DIR)/build M=`pwd`)
-
-nasmesh.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) V=1 -C $(KERNEL_DIR)/build M=`pwd`)
-
-# automatically detect the linux header files for driver compilation
-nasmesh_netlink.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-naslite_netlink_ether.ko:
-	(cd NETWORK_DRIVER/LITE && $(MAKE) -j$(NUM_CORES) $(SET_UM) OAI_NW_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 OAI_NW_DRIVER_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-oai_nw_ether.ko:
-	(cd NETWORK_DRIVER/LITE && $(MAKE) -j$(NUM_CORES) $(SET_UM) OAI_NW_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 OAI_NW_DRIVER_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-oai_nw_drv.ko:
-	(cd NETWORK_DRIVER/LITE && $(MAKE) -j$(NUM_CORES) $(SET_UM) OAI_NW_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 OAI_NW_DRIVER_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-nasmesh_netlink_address_fix.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) PDCP_USE_NETLINK=1 ADDRESS_FIX=1  V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-
-nasmesh_netlink_loopback.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) $(SET_UM) PDCP_USE_NETLINK=1 LOOPBACK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-# drivers cellular version
-nascellmt_netlink.ko:
-	(cd NAS/DRIVER/CELLULAR/NASMT && $(MAKE) -j$(NUM_CORES) $(SET_UM) NAS_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-nascellmt_clean.ko:
-	(cd NAS/DRIVER/CELLULAR/NASMT && $(MAKE) -j$(NUM_CORES) $(SET_UM) NAS_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` clean)
-
-nascellrg_netlink.ko:
-	(cd NAS/DRIVER/CELLULAR/NASRG && $(MAKE) -j$(NUM_CORES) $(SET_UM) NAS_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-nascellrg_clean.ko:
-	(cd NAS/DRIVER/CELLULAR/NASRG && $(MAKE) -j$(NUM_CORES) $(SET_UM) NAS_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` clean)
-
-# Driver for UE using LTE core network (MME, S+P-GW)
-ue_ip.ko:
-	(cd NETWORK_DRIVER/UE_IP && $(MAKE) -j$(NUM_CORES) $(SET_UM) PDCP_USE_NETLINK=1 OAI_NW_DRIVER_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-
-rt_emul:
-	(cd SIMULATION/USER_TOOLS/RT_EMUL_LAUNCHER && $(MAKE))
-
-bypass_phy:
-	(cd SIMULATION/PHY_EMULATION/TRANSPORT/KERNEL_INTERFACE && $(MAKE))
-
-rb_tool:
-	(cd NETWORK_DRIVER/MESH/RB_TOOL && $(MAKE))
-
-
-fifos:
-	@for i in `seq 0 64`;\
-	do \
-	have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
-	if [ "$$have_rtfX" -eq 0 ] ;then \
-	mknod -m 666 /dev/rtf$$i c 150 $$i; \
-	fi;\
-	done
-
-#	cp arch/openair_CardBus_MIMO1/device_driver/openair_rf.ko $(KERNEL_DIR)/openair/
-#	depmod -aq
-
-devs:
-	if ! test -a /dev/openair0;\
-	then \
-	mknod /dev/openair0 c 127 0;\
-	chmod a+rw /dev/openair0;\
-	fi;
-
-load_sounder_ue: install_cbmimo1_ublaze
-	insmod mac/chansounder/openair_chansounder_ue.ko
-
-load_sounder_nodeb: install_platon
-	(cd openair_rf && ./openair_rf_platon 1917600 0 ../arch/platon/rbt_files/DAQ_B.rbt 30p 15p 10p 25p && ./openair_rf_platon 1917600 0 ../arch/platon/rbt_files/daq_platon_11_2005.rbt 30p 15p 10p 25p)
-
-
-stop_sounder:
-	rmmod openair_chansounder
-	rmmod openair_rf
-
-stop_sounder_nodeb:
-	(cd openair_rf && ./openair_rf_platon 1907600 4)
-	rmmod openair_chansounder
-	rmmod openair_rf
-
-
-emul_rt:
-	(cd SIMULATION/USER_TOOLS/RT_EMUL_LAUNCHER && $(MAKE))
-
-clean:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) clean)
-	(cd NETWORK_DRIVER/LITE && $(MAKE) clean)
-	rm -rf NETWORK_DRIVER/MESH/RB_TOOL/rb_tool
-	rm -rf NETWORK_DRIVER/LITE/RB_TOOL/rb_tool
-
-cleanall:
-	find -name *.o -delete -print
-	find -name *.ko -delete -print
-	find -name *~ -delete -print
-	find -name *.bak -delete -print
-	rm -rf NETWORK_DRIVER/MESH/RB_TOOL/rb_tool
-	rm -rf NETWORK_DRIVER/LITE/RB_TOOL/rb_tool
-
-
-cleansvn:
-	rm -rf `find -name *.svn* -print` ; \
-	find -name *.svn* -delete -print
-
-tgz:
-	mkdir /tmp/openair2_tmp; \
-	$(MAKE) cleanall; \
-	cp -r . /tmp/openair2_tmp; \
-	(cd /tmp/openair2_tmp && $(MAKE) cleansvn && cd .. && tar czfv openair2.tgz openair2_tmp) ; \
-	cp /tmp/openair2.tgz . ;\
-	rm -rf /tmp/openair2_tmp
-
-print:
-	@echo $(IS_KERNEL_OPENAIRINTERFACE)
-	@echo $(KERNEL_DIR)
-	@echo $(IS_LINUX)
diff --git a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/Makefile b/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/Makefile
deleted file mode 100755
index 427a9fad518f07312b3564ee19bc83219b3e3b2f..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-# Lines starting with the pound sign are comments.
-#
-# These things are options that you might need
-# to tweak.
-
-# You can modify the below as well, but probably
-# won't need to.
-
-#CC = egcs
-
-#UPDIR	:= $(shell /bin/pwd)
-#GRAAL_DIR  =$(UPDIR)/..
-#RRC_DIR =$(UPDIR)/../../../AS/L3/RRC
-
-CELL_UPDIR := $(shell /bin/pwd)
-NAS_DIR := $(OPENAIR2_DIR)/NAS/DRIVER/CELLULAR/NASMT
-RRC_DIR := $(OPENAIR2_DIR)/RRC/CELLULAR
-EXTRA_CFLAGS += -I$(RRC_DIR) -DNODE_MT
-
-CFLAGS = -Wall -g -I$(NAS_DIR) -I$(RRC_DIR)
-
-COMPILE = $(CC) $(CFLAGS) -c
-
-OBJS = nascell_ioctl.o
-
-EXECUTABLE = gioctl
-
-# "all" is the default target. Simply make it point to myprogram.
-
-all: $(EXECUTABLE)
-
-# Define the components of the program, and how to link them together.
-# These components are defined as dependencies; that is, they must be
-# made up-to-date before the code is linked.
-
-$(EXECUTABLE): $(OBJS)
-	$(CC) $(CFLAGS) -o $(EXECUTABLE) $(OBJS)
-
-# Add any special rules here.
-
-# Specify that all .o files depend on .c files, and indicate how
-# the .c files are converted (compiled) to the .o files.
-
-%.o: %.c
-	$(COMPILE) -o $@ $<
-
-clean:
-	-rm $(OBJS) $(EXECUTABLE)
diff --git a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.c b/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.c
deleted file mode 100644
index a15b4bf6af89b82157afa7633599b6dff859e710..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.c
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include "nascell_ioctl.h"
-#include "rrc_nas_primitives.h"
-//#include "rrc_qos.h"
-//#include "graal_local.h"
-#include "nasmt_constant.h"
-#include "nasmt_iocontrol.h"
-#define USHRT_MAX 255
-//---------------------------------------------------------------------------
-void print_error(int status)
-{
-  //---------------------------------------------------------------------------
-  switch(status) {
-  case -NAS_ERROR_NOMEMORY:
-    printf(" The memory is low\n");
-    break;
-
-  case -NAS_ERROR_NORB:
-    printf(" The radio bearer is not identified\n");
-    break;
-
-  case -NAS_ERROR_NOTMT:
-    printf(" The entity must be a mobile\n");
-    break;
-
-  case -NAS_ERROR_NOTRG:
-    printf(" The entity must be an access router\n");
-    break;
-
-  case -NAS_ERROR_NOTIDLE:
-    printf(" The selected connection or radio bearer must be IDLE\n");
-    break;
-
-  case -NAS_ERROR_NOTCONNECTED:
-    printf(" The selected connection or radio bearer must be CONNECTED\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTLCR:
-    printf(" The LCR value is not correct\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTDIR:
-    printf(" The DIR value is not correct\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTDSCP:
-    printf(" The DSCP value is not correct\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTVERSION:
-    printf(" The version value is not correct\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTRABI:
-    printf(" The rab_id value is not correct\n");
-    break;
-
-  case -NAS_ERROR_ALREADYEXIST:
-    printf(" Some components must not be duplicated\n");
-    break;
-
-  default:
-    printf(" Unknown error cause %d\n", status);
-  }
-}
-
-//---------------------------------------------------------------------------
-void print_state(uint8_t state)
-{
-  //---------------------------------------------------------------------------
-  switch(state) {
-  case NAS_IDLE:
-    printf("NAS_IDLE\n");
-    return;
-
-    //  case NAS_STATE_CONNECTED:printf("NAS_STATE_CONNECTED\n");return;
-    //  case NAS_STATE_ESTABLISHMENT_REQUEST:printf("NAS_STATE_ESTABLISHMENT_REQUEST\n");return;
-    //  case NAS_STATE_ESTABLISHMENT_FAILURE:printf("NAS_STATE_ESTABLISHMENT_FAILURE\n");return;
-    //  case NAS_STATE_RELEASE_FAILURE:printf("NAS_STATE_RELEASE_FAILURE\n");return;
-  case  NAS_CX_FACH:
-    printf("NAS_CX_FACH\n");
-    return;
-
-  case  NAS_CX_DCH:
-    printf("NAS_CX_DCH\n");
-    return;
-
-  case  NAS_CX_RECEIVED:
-    printf("NAS_CX_RECEIVED\n");
-    return;
-
-  case  NAS_CX_CONNECTING:
-    printf("NAS_CX_CONNECTING\n");
-    return;
-
-  case  NAS_CX_RELEASING:
-    printf("NAS_CX_RELEASING\n");
-    return;
-
-  case  NAS_CX_CONNECTING_FAILURE:
-    printf("NAS_CX_CONNECTING_FAILURE\n");
-    return;
-
-  case  NAS_CX_RELEASING_FAILURE:
-    printf("NAS_CX_RELEASING_FAILURE\n");
-    return;
-
-  case  NAS_RB_ESTABLISHING:
-    printf("NAS_RB_ESTABLISHING\n");
-    return;
-
-  case  NAS_RB_RELEASING:
-    printf("NAS_RB_RELEASING\n");
-    return;
-
-  default:
-    printf(" Unknown state\n");
-  }
-}
-
-//---------------------------------------------------------------------------
-void print_usage_class()
-{
-  //---------------------------------------------------------------------------
-  printf("Usage: gioctl class add {send <lcr>|receive} -f {qos <rab_id>|del|ctl|dc} -cr <classref> [-dscp <dscp>] [-ip {6|4} <saddr> <splen> <daddr> <dplen>] [-p {tcp|udp|icmp4|icmp6} <sport> <dport>]\n");
-  printf("Usage: gioctl class del {send <lcr>|receive} -cr <classref> [-dscp <dscp>] \n");
-  printf("Usage: gioctl class list {send <lcr>|receive} [-dscp <dscp>]\n");
-}
-//---------------------------------------------------------------------------
-void print_usage_cx()
-{
-  //---------------------------------------------------------------------------
-  printf("Usage: gioctl cx add <lcr> <cellid>\n");
-  printf("Usage: gioctl cx del <lcr>\n");
-  printf("Usage: gioctl cx list\n");
-}
-//---------------------------------------------------------------------------
-void print_usage_rb()
-{
-  //---------------------------------------------------------------------------
-  printf("Usage: gioctl rb add <lcr> <rab_id> <qos>\n");
-  printf("Usage: gioctl rb list <lcr>\n");
-}
-
-//---------------------------------------------------------------------------
-int main(int argc, char *argv[])
-{
-  //---------------------------------------------------------------------------
-  struct nas_ioctl gifr;
-  int err, fd;
-
-  // Invalid number of arguments
-  if (argc<2) {
-    printf("Usage: gioctl statistic\n");
-    print_usage_cx();
-    print_usage_rb();
-    print_usage_class();
-    return  -1;
-  }
-
-  // Get an UDP IPv6 socket ??
-  fd=socket(AF_INET6, SOCK_DGRAM, 0);
-
-  if (fd<0)  {
-    printf("Error opening socket\n");
-    return 0;
-  }
-
-  strcpy(gifr.name, "oai0");
-  printf("Socket opened successfully\n");
-
-  /***************************/
-  if (strcmp(argv[1], "statistic")==0) {
-    struct nas_msg_statistic_reply *msgrep;
-    gifr.type=NAS_MSG_STATISTIC_REQUEST;
-    gifr.msg=(char *)malloc(sizeof(msgrep));
-    msgrep=(struct nas_msg_statistic_reply *)(gifr.msg);
-    printf(" Statistics requested\n");
-    err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-    if (err<0) {
-      printf("IOCTL error, err=%d\n",err);
-      return -1;
-    }
-
-    printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
-    printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
-    printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
-    printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
-    return 0;
-  }
-
-  /***************************/
-  if (strcmp(argv[1], "cx")==0) {
-    if (argc<3) {
-      print_usage_cx();
-      return -1;
-    }
-
-    /***/
-    //  printf("Usage: gioctl cx add <lcr> <cellid>\n");
-    if (strcmp(argv[2], "add")==0) {
-      struct nas_msg_cx_establishment_request *msgreq;
-      struct nas_msg_cx_establishment_reply *msgrep;
-
-      if (argc<5) {
-        print_usage_cx();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_CX_ESTABLISHMENT_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_cx_establishment_request *)(gifr.msg);
-      msgrep=(struct nas_msg_cx_establishment_reply *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      msgreq->cellid=strtoul(argv[4], NULL, 0);
-      //
-      printf(" Connection establishment requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        perror("Connection establishment IOCTL error\n");
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Connexion establishment failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    //  printf("Usage: gioctl cx del <lcr>\n");
-    if (strcmp(argv[2], "del")==0) {
-      struct nas_msg_cx_release_request *msgreq;
-      struct nas_msg_cx_release_reply *msgrep;
-
-      if (argc<4) {
-        print_usage_cx();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_CX_RELEASE_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_cx_release_request *)(gifr.msg);
-      msgrep=(struct nas_msg_cx_release_reply *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      //
-      printf(" Connexion release requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Connexion release failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    //  printf("Usage: gioctl cx list\n");
-    if (strcmp(argv[2], "list")==0) {
-      uint8_t *msgrep;
-      uint8_t i;
-      struct nas_msg_cx_list_reply *list;
-      uint8_t lcr;
-      gifr.type=NAS_MSG_CX_LIST_REQUEST;
-      gifr.msg=(char *)malloc(NAS_LIST_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1);
-      msgrep=(uint8_t *)(gifr.msg);
-      //
-      printf(" Connexion list requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      printf("Lcr\t\tCellId\tIID4\tIID6\t\t\tnrb\tnsclass\tState\n");
-      list=(struct nas_msg_cx_list_reply *)(msgrep+1);
-
-      for(lcr=0; lcr<msgrep[0]; ++lcr) {
-        printf("%u\t\t%u\t%u\t", list[lcr].lcr, list[lcr].cellid, list[lcr].iid4);
-
-        for (i=0; i<8; ++i)
-          printf("%02x", *((uint8_t *)list[lcr].iid6+i));
-
-        printf("\t%u\t%u\t", list[lcr].num_rb, list[lcr].nsclassifier);
-        print_state(list[lcr].state);
-      }
-
-      return 0;
-    }
-
-    print_usage_cx();
-    return -1;
-  }
-
-  /***************************/
-  if (strcmp(argv[1], "rb")==0) {
-    if (argc<3) {
-      print_usage_rb();
-      return -1;
-    }
-
-    /***/
-    //  printf("Usage: gioctl rb add <lcr> <rab_id> <qos>\n");
-    if (strcmp(argv[2], "add")==0) {
-      struct nas_msg_rb_establishment_request *msgreq;
-      struct nas_msg_rb_establishment_reply *msgrep;
-
-      if (argc<6) {
-        print_usage_rb();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_RB_ESTABLISHMENT_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_rb_establishment_request *)(gifr.msg);
-      msgrep=(struct nas_msg_rb_establishment_reply *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      msgreq->rab_id=strtoul(argv[4], NULL, 0);
-      msgreq->qos=strtoul(argv[5], NULL, 0);
-      //
-      printf(" Radio bearer establishment requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Radio bearer establishment failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    if (strcmp(argv[2], "del")==0) {
-      struct nas_msg_rb_release_request *msgreq;
-      struct nas_msg_rb_release_reply *msgrep;
-
-      if (argc<5) {
-        print_usage_rb();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_RB_RELEASE_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_rb_release_request *)(gifr.msg);
-      msgrep=(struct nas_msg_rb_release_reply *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      msgreq->rab_id=strtoul(argv[4], NULL, 0);
-      //
-      printf(" Radio Bearer release requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Radio bearer release failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    //  printf("Usage: gioctl rb list <lcr>\n");
-    if (strcmp(argv[2], "list")==0) {
-      uint8_t *msgrep;
-      uint8_t rbi;
-      struct nas_msg_rb_list_reply *list;
-      struct nas_msg_rb_list_request *msgreq;
-
-      if (argc<4) {
-        print_usage_rb();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_RB_LIST_REQUEST;
-      gifr.msg=(char *)malloc(NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1);
-      msgreq=(struct nas_msg_rb_list_request *)(gifr.msg);
-      msgrep=(uint8_t *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      //
-      printf(" Radio bearer list requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      printf("rab_id\t\tSapi\t\tQoS\t\tState\n");
-      list=(struct nas_msg_rb_list_reply *)(msgrep+1);
-
-      for(rbi=0; rbi<msgrep[0]; ++rbi) {
-        printf("%u\t\t%u\t\t%u\t\t", list[rbi].rab_id, list[rbi].sapi, list[rbi].qos);
-        print_state(list[rbi].state);
-      }
-
-      return 0;
-    }
-
-    print_usage_rb();
-    return -1;
-  }
-
-  /***************************/
-  if (strcmp(argv[1], "class")==0) {
-    if (argc<3) {
-      print_usage_class();
-      return  -1;
-    }
-
-    /***/
-    if (strcmp(argv[2], "add")==0) {
-      struct nas_msg_class_add_request *msgreq;
-      struct nas_msg_class_add_reply *msgrep;
-      uint8_t i,j;
-      gifr.type=NAS_MSG_CLASS_ADD_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_class_add_request *)(gifr.msg);
-      msgrep=(struct nas_msg_class_add_reply *)(gifr.msg);
-      i=3;
-
-      if (strcmp(argv[i], "send")==0) {
-        msgreq->dir=NAS_DIRECTION_SEND;
-        msgreq->lcr=strtoul(argv[++i], NULL, 0);
-        ++i;
-      } else {
-        if (strcmp(argv[i], "receive")==0) {
-          msgreq->dir=NAS_DIRECTION_RECEIVE;
-          ++i;
-        } else {
-          print_usage_class();
-          return -1;
-        }
-      }
-
-      msgreq->classref=USHRT_MAX;
-      msgreq->dscp=NAS_DSCP_DEFAULT;
-      msgreq->version=NAS_VERSION_DEFAULT;
-      msgreq->protocol=NAS_PROTOCOL_DEFAULT;
-      msgreq->sport=NAS_PORT_DEFAULT;
-      msgreq->dport=NAS_PORT_DEFAULT;
-      msgreq->fct=0;
-
-      while (i<argc) {
-        if (strcmp(argv[i], "-cr")==0) {
-          msgreq->classref=strtoul(argv[++i], NULL, 0);
-          ++i;
-          continue;
-        }
-
-        if (strcmp(argv[i], "-dscp")==0) {
-          msgreq->dscp=strtoul(argv[++i], NULL, 0);
-          ++i;
-          continue;
-        }
-
-        if (strcmp(argv[i], "-f")==0) {
-          ++i;
-
-          if (strcmp(argv[i], "qos")==0) {
-            msgreq->fct=NAS_FCT_QOS_SEND;
-            msgreq->rab_id=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "del")==0) {
-            msgreq->fct=NAS_FCT_DEL_SEND;
-            msgreq->rab_id=0;
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "ctl")==0) {
-            msgreq->fct=NAS_FCT_CTL_SEND;
-            msgreq->rab_id=0;
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "dc")==0) {
-            msgreq->fct=NAS_FCT_DC_SEND;
-            msgreq->rab_id=0;
-            ++i;
-            continue;
-          }
-
-          print_usage_class();
-          return -1;
-        }
-
-        if (strcmp(argv[i], "-ip")==0) {
-          ++i;
-
-          if (strcmp(argv[i], "4")==0) {
-            if (msgreq->version!=NAS_VERSION_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->version=NAS_VERSION_4;
-            inet_pton(AF_INET, argv[++i], (void *)(&msgreq->saddr));
-            msgreq->splen=strtoul(argv[++i], NULL, 0);
-            inet_pton(AF_INET, argv[++i], (void *)(&msgreq->daddr));
-            msgreq->dplen=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "6")==0) {
-            if (msgreq->version!=NAS_VERSION_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->version=NAS_VERSION_6;
-            inet_pton(AF_INET6, argv[++i], (void *)(&msgreq->saddr));
-            msgreq->splen=strtoul(argv[++i], NULL, 0);
-            inet_pton(AF_INET6, argv[++i], (void *)(&msgreq->daddr));
-            msgreq->dplen=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          print_usage_class();
-          return -1;
-        }
-
-        if (strcmp(argv[i], "-p")==0) {
-          ++i;
-
-          if (strcmp(argv[i], "tcp")==0) {
-            if (msgreq->protocol!=NAS_PROTOCOL_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->protocol=NAS_PROTOCOL_TCP;
-            msgreq->sport=strtoul(argv[++i], NULL, 0);
-            msgreq->dport=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "udp")==0) {
-            if (msgreq->protocol!=NAS_PROTOCOL_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->protocol=NAS_PROTOCOL_UDP;
-            msgreq->sport=strtoul(argv[++i], NULL, 0);
-            msgreq->dport=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "icmp4")==0) {
-            if (msgreq->protocol!=NAS_PROTOCOL_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->protocol=NAS_PROTOCOL_ICMP4;
-            msgreq->sport=strtoul(argv[++i], NULL, 0);
-            msgreq->dport=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "icmp6")==0) {
-            if (msgreq->protocol!=NAS_PROTOCOL_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->protocol=NAS_PROTOCOL_ICMP6;
-            msgreq->sport=strtoul(argv[++i], NULL, 0);
-            msgreq->dport=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          print_usage_class();
-          return -1;
-        }
-
-        print_usage_class();
-        return -1;
-      }
-
-      if ((msgreq->classref==USHRT_MAX)||(msgreq->fct==0)) {
-        print_usage_class();
-        return -1;
-      }
-
-      printf(" Class add requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Class add failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    if (strcmp(argv[2], "del")==0) {
-      uint8_t i;
-      struct nas_msg_class_del_request *msgreq;
-      struct nas_msg_class_del_reply *msgrep;
-      gifr.type=NAS_MSG_CLASS_DEL_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_class_del_request *)(gifr.msg);
-      msgrep=(struct nas_msg_class_del_reply *)(gifr.msg);
-      i=3;
-
-      if (strcmp(argv[i], "send")==0) {
-        msgreq->dir=NAS_DIRECTION_SEND;
-        msgreq->lcr=strtoul(argv[++i], NULL, 0);
-        ++i;
-      } else {
-        if (strcmp(argv[i], "receive")==0) {
-          msgreq->dir=NAS_DIRECTION_RECEIVE;
-          ++i;
-        } else {
-          print_usage_class();
-          return -1;
-        }
-      }
-
-      msgreq->classref=USHRT_MAX;
-      msgreq->dscp=NAS_DSCP_DEFAULT;
-
-      while (i<argc) {
-        if (strcmp(argv[i], "-cr")==0) {
-          msgreq->classref=strtoul(argv[++i], NULL, 0);
-          ++i;
-          continue;
-        }
-
-        if (strcmp(argv[i], "-dscp")==0) {
-          msgreq->dscp=strtoul(argv[++i], NULL, 0);
-          ++i;
-          continue;
-        }
-
-        print_usage_class();
-        return -1;
-      }
-
-      if (msgreq->classref==USHRT_MAX) {
-        print_usage_class();
-        return -1;
-      }
-
-      printf(" Class del requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Class add failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    if (strcmp(argv[2], "list")==0) {
-      uint8_t *msgrep;
-      uint8_t cli, i;
-      struct nas_msg_class_list_reply *list;
-      struct nas_msg_class_list_request *msgreq;
-      char addr[45];
-
-      if (argc<4) {
-        print_usage_class();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_CLASS_LIST_REQUEST;
-      gifr.msg=(char *)malloc(NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1);
-
-      if (gifr.msg==NULL) {
-        printf(" No memory\n");
-        return -1;
-      }
-
-      msgreq=(struct nas_msg_class_list_request *)(gifr.msg);
-      msgrep=(uint8_t *)(gifr.msg);
-      i=3;
-
-      if (strcmp(argv[i], "send")==0) {
-        msgreq->dir=NAS_DIRECTION_SEND;
-        msgreq->lcr=strtoul(argv[++i], NULL, 0);
-        ++i;
-      } else {
-        if (strcmp(argv[i], "receive")==0) {
-          msgreq->dir=NAS_DIRECTION_RECEIVE;
-          msgreq->lcr=0;
-          ++i;
-        } else {
-          print_usage_class();
-          return  -1;
-        }
-      }
-
-      msgreq->dscp=NAS_DSCP_DEFAULT;
-
-      while (i<argc) {
-        if (strcmp(argv[i], "-dscp")==0)
-          msgreq->dscp=strtoul(argv[++i], NULL, 0);
-      }
-
-      printf(" Classifier list requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      //
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      printf("Lcr\trab_id\tCref\tFct\t(Vers., saddr, daddr)\t\t\t\t(Proto., Sport, Dport)\n");
-      list=(struct nas_msg_class_list_reply *)(msgrep+1);
-
-      for(cli=0; cli<msgrep[0]; ++cli) {
-        printf("%u\t%u\t%u\t", list[cli].lcr, list[cli].rab_id, list[cli].classref);
-
-        switch(list[cli].fct) {
-        case NAS_FCT_QOS_SEND:
-          printf("qos\t");
-          break;
-
-        case NAS_FCT_DEL_SEND:
-          printf("del\t");
-          break;
-
-        case NAS_FCT_CTL_SEND:
-          printf("ctl\t");
-          break;
-
-        case NAS_FCT_DC_SEND:
-          printf("dc\t");
-          break;
-
-        default:
-          printf("?\t");
-        }
-
-        switch(list[cli].version) {
-        case 4:
-          inet_ntop(AF_INET, (void *)&list[cli].saddr, addr, 45);
-          printf("(ip4, %s/%u,", addr, list[cli].splen);
-          inet_ntop(AF_INET, (void *)&list[cli].daddr, addr, 45);
-          printf("%s/%u\t", addr, list[cli].dplen);
-          break;
-
-        case 6:
-          inet_ntop(AF_INET6, (void *)&list[cli].saddr, addr, 45);
-          printf("(ip6, %s/%u", addr, list[cli].splen);
-          inet_ntop(AF_INET6, (void *)&list[cli].daddr, addr, 45);
-          printf("%s/%u\t", addr, list[cli].dplen);
-          break;
-
-        default:
-          printf("(--, --, --)\t\t\t");
-          break;
-        }
-
-        switch(list[cli].protocol) {
-        case IPPROTO_UDP:
-          printf("(udp, %u, %u)\t\n", list[cli].sport, list[cli].dport);
-          break;
-
-        case IPPROTO_TCP:
-          printf("(tcp, %u, %u)\t\n", list[cli].sport, list[cli].dport);
-          break;
-
-        case IPPROTO_ICMP:
-          printf("(icmp4, %u, %u)\t\n", list[cli].sport, list[cli].dport);
-          break;
-
-        case IPPROTO_ICMPV6:
-          printf("(icmp6, %u, %u)\t\n", list[cli].sport, list[cli].dport);
-          break;
-
-        default:
-          printf("(--, --, --)\t\n");
-        }
-      }
-
-      return 0;
-    }
-
-    return 0;
-  }
-
-  printf(" Unknown command %s\n",argv[1]);
-  return 0;
-}
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/Makefile b/openair2/NAS/DRIVER/CELLULAR/NASMT/Makefile
deleted file mode 100755
index ec14990d6321e4c64a76bad8ca43ec005c85daa1..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-# NAS CELLULAR Driver makefile
-#
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-####################################################
-#  D E B U G   F L A G S
-####################################################
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-EXTRA_CFLAGS = -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,)
-
-ifdef ADDRCONF
-EXTRA_CFLAGS += -DADDRCONF
-endif
-
-ifdef NAS_DRIVER_TYPE_ETHERNET
-EXTRA_CFLAGS += -DNAS_DRIVER_TYPE_ETHERNET 
-endif
-
-
-ifdef PDCP_USE_NETLINK
-EXTRA_CFLAGS += -DPDCP_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-ifdef LOOPBACK
-EXTRA_CFLAGS += -DLOOPBACK_TEST
-endif
-
-ifdef ADDRESS_FIX
-EXTRA_CFLAGS += -DNAS_ADDRESS_FIX
-endif
-
-####################################################
-#      NASMTCELL extra compilation flags
-####################################################
-#RTAI=1
-RRC_DIR := $(OPENAIR2_DIR)/RRC/CELLULAR
-EXTRA_CFLAGS += -I$(RRC_DIR) -DNODE_MT
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += nascellmt.o
-nascellmt-objs += nasmt_device.o
-nascellmt-objs += nasmt_common.o
-nascellmt-objs += nasmt_iocontrol.o
-nascellmt-objs += nasmt_classifier.o
-nascellmt-objs += nasmt_tool.o
-nascellmt-objs += nasmt_ascontrol.o
-ifdef PDCP_USE_NETLINK
-nascellmt-objs += nasmt_netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-#netlink.ko:
-	#make $(x)$(y) PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-#nasmesh.ko:
-#	make  V=1 -C  $(KERNEL_DIR) M=`pwd` modules
-print:
-	@echo subversion : $(SUBVERSION)
-	@echo RRC_DIR $(RRC_DIR)
-clean:
-	rm -f *.ko
-	rm -f .*.ko.cmd
-	rm -f .*.o.cmd
-	rm -f *.o
-	rm -f *.mod.c
-	find . -name *.ko     -delete
-	find . -name *.o      -delete
-	find . -name *.mod.c  -delete
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_ascontrol.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_ascontrol.c
deleted file mode 100644
index 8f34e93565c90c6d0d0d931d4f4725fed3ff0dd6..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_ascontrol.c
+++ /dev/null
@@ -1,1152 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_ascontrol.c
-* \brief Access Stratum Control functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifdef NODE_MT
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-//---------------------------------------------------------------------------
-void nasmt_ASCTL_init(void)
-{
-  //---------------------------------------------------------------------------
-  //  struct cx_entity *cx;
-  int i;
-  gpriv->next_sclassref = NASMT_DEFAULTRAB_CLASSREF;
-
-  for (i = 0; i<NASMT_MBMS_SVCES_MAX; i++) {
-    gpriv->cx->joined_services[i]= -1;
-  }
-
-  printk("nasmt_ASCTL_init Complete\n");
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ASCTL_write(int sap, unsigned char *data_buffer, unsigned int data_length)
-{
-  //---------------------------------------------------------------------------
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xmit_buffer [NAS_MESSAGE_MAXLEN];
-  //MT xmit on DC-SAP only
-  xmit_buffer[0] = RRC_NAS_DC0_IN;
-  memcpy (&((char*)xmit_buffer)[1], data_buffer, data_length);
-  bytes_wrote = nasmt_netlink_send(xmit_buffer,data_length, NASNL_DEST_RRC);
-#else
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);  //original version
-  bytes_wrote = rtf_put(sap, data_buffer, data_length);
-#endif //PDCP_USE_NETLINK
-  return bytes_wrote;
-}
-
-//---------------------------------------------------------------------------
-//For demo, add automatically a classifier
-//Equivalent to class add send 0 -f qos <x> -cr 0
-void nasmt_ASCTL_start_default_sclassifier(struct cx_entity *cx,struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("\nnasmt_ASCTL_start_default_sclass - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasmt_ASCTL_start_default_sclass - input parameter cx or rb is NULL \n");
-    return;
-  }
-
-  // End debug information
-  //
-  gc=nasmt_CLASS_add_sclassifier(cx, NAS_DSCP_DEFAULT, gpriv->next_sclassref);
-
-  //  gc=nasmt_CLASS_add_sclassifier(cx, 5, 0);
-  if (gc==NULL) {
-    printk("nasmt_ASCTL_start_default_sclass - Error - Classifier not added \n");
-    return;
-  }
-
-  gc->fct = nasmt_COMMON_QOS_send;
-  gc->rab_id =rb->rab_id;
-  gc->rb= rb;
-  gc->version = NASMT_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-  gc->dplen= NAS_DEFAULT_IPv6_PREFIX_LENGTH;
-  //gc->daddr.ipv6.s6_addr32[2] = cx->iid6[0];
-  //gc->daddr.ipv6.s6_addr32[3] = cx->iid6[1];
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_ASCTL_start_default_sclass - end \n");
-  nasmt_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-//For demo, add automatically a classifier
-//Equivalent to class add send 0 -f qos <x> -cr 0
-void nasmt_ASCTL_start_sclassifier(struct cx_entity *cx,struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("\nnasmt_ASCTL_start_sclass - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_start_sclass - input parameter cx is NULL \n");
-    return;
-  }
-
-  if (rb==NULL) {
-    printk("nasmt_ASCTL_start_sclass - input parameter rb is NULL \n");
-    return;
-  }
-
-  // End debug information
-  //
-  gc=nasmt_CLASS_add_sclassifier(cx, rb->dscp, gpriv->next_sclassref);
-
-  //  gc=nasmt_CLASS_add_sclassifier(cx, 5, 0);
-  if (gc==NULL) {
-    printk("nasmt_ASCTL_start_sclass - Error - Classifier not added \n");
-    return;
-  }
-
-  gc->fct = nasmt_COMMON_QOS_send;
-  gc->rab_id =rb->rab_id;
-  gc->rb= rb;
-  gc->version = NASMT_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-  gc->dplen= NAS_DEFAULT_IPv6_PREFIX_LENGTH;
-  gc->daddr.ipv6.s6_addr32[2] = cx->iid6[0];
-  gc->daddr.ipv6.s6_addr32[3] = cx->iid6[1];
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_ASCTL_start_sclass - end \n");
-  nasmt_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasmt_ASCTL_timer(unsigned long data)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  struct cx_entity *cx;
-  struct rb_entity *rb;
-  spin_lock(&gpriv->lock);
-#ifdef NAS_DEBUG_TIMER
-  printk("nasmt_ASCTL_timer - begin \n");
-#endif
-  (gpriv->timer).function=nasmt_ASCTL_timer;
-  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
-  (gpriv->timer).data=0L;
-
-  for (cxi=0; cxi<NAS_CX_MAX; ++cxi) {
-    cx=gpriv->cx+cxi;
-
-    if (cx==NULL) {
-#ifdef NAS_DEBUG_TIMER
-      printk("nasmt_ASCTL_timer - No pointer for connection %d \n", cxi);
-#endif
-      continue;
-    }
-
-    if (cx->countimer!=NAS_TIMER_IDLE) {
-#ifdef NAS_DEBUG_TIMER
-      printk("nasmt_ASCTL_timer: lcr %u, countimer %u\n", cx->lcr, cx->countimer);
-#endif
-
-      if (cx->countimer==0) {
-        switch (cx->state) {
-        case NAS_CX_CONNECTING:
-        case NAS_CX_CONNECTING_FAILURE:
-          if (cx->retry<gpriv->retry_limit)
-            nasmt_ASCTL_DC_send_cx_establish_request(cx);
-          else {
-            printk("nasmt_ASCTL_timer: Establishment failure\n");
-            cx->state=NAS_IDLE;
-            cx->retry=0;
-            cx->countimer=NAS_TIMER_IDLE;
-          }
-
-          break;
-
-        case NAS_CX_RELEASING_FAILURE:
-          nasmt_ASCTL_DC_send_cx_release_request(cx);
-          break;
-
-        default:
-          printk("nasmt_ASCTL_timer: default value\n");
-          cx->countimer=NAS_TIMER_IDLE;
-        }
-      } else
-        --cx->countimer;
-    }
-
-    for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-      if (rb->countimer!=NAS_TIMER_IDLE) {
-#ifdef NAS_DEBUG_TIMER
-        printk("nasmt_ASCTL_timer : rb countimer %d, rb state %d\n", rb->countimer, rb->state);
-#endif
-
-        if (rb->countimer==0) {
-          switch (rb->state) {
-          case NAS_RB_DCH:
-#ifdef DEMO_3GSM
-            if (cx->num_rb == 1) {
-              nasmt_ASCTL_start_default_sclassifier(cx, rb);
-            }
-
-#endif
-            nasmt_ASCTL_start_sclassifier(cx, rb);
-            rb->countimer=NAS_TIMER_IDLE;
-            break;
-
-          default:
-            rb->countimer=NAS_TIMER_IDLE;
-          }
-        } else {
-          --rb->countimer;
-          printk("nasmt_ASCTL_timer : rb countimer-- %d, rb state %d\n", rb->countimer, rb->state);
-        }
-      }
-    }
-  }
-
-  add_timer(&gpriv->timer);
-  spin_unlock(&gpriv->lock);
-}
-
-//---------------------------------------------------------------------------
-// Request the sleep of a connexion
-int nasmt_ASCTL_enter_sleep_mode(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t sig_category;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_enter_sleep_mode - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_enter_sleep_mode - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  // send peer message to NASRG
-  sig_category = NAS_CMD_ENTER_SLEEP;
-  printk("nasmt_ASCTL_enter_sleep_mode - sig_category %u \n", sig_category);
-  nasmt_ASCTL_DC_send_peer_sig_data_request(cx, sig_category);
-  cx->state=NAS_CX_RELEASING;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-// Request to reactivate a connexion
-int nasmt_ASCTL_leave_sleep_mode(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t sig_category;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_leave_sleep_mode - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_leave_sleep_mode - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  cx->state=NAS_CX_DCH;
-  // send peer message to NASRG
-  sig_category = NAS_CMD_LEAVE_SLEEP;
-  printk("nasmt_ASCTL_leave_sleep_mode - sig_category %u \n", sig_category);
-  nasmt_ASCTL_DC_send_peer_sig_data_request(cx, sig_category);
-  return 0;
-}
-
-/***********************************************
- *  Transmit Functions                         *
- ***********************************************/
-
-//---------------------------------------------------------------------------
-// Request the establishment of a connexion (DC channel)
-int nasmt_ASCTL_DC_send_cx_establish_request(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ue_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_cx_establish - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_DC_send_cx_establish - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-
-  switch (cx->state) {
-  case NAS_CX_CONNECTING:
-  case NAS_CX_CONNECTING_FAILURE:
-  case NAS_IDLE:
-    p= (struct nas_ue_dc_element *)(gpriv->xbuffer);
-    p->type = CONN_ESTABLISH_REQ;
-    p->length =  NAS_TL_SIZE + sizeof(struct NASConnEstablishReq);
-    p->nasUEDCPrimitive.conn_establish_req.localConnectionRef = cx->lcr;
-    p->nasUEDCPrimitive.conn_establish_req.cellId = cx->cellid;
-#ifdef NAS_DEBUG_DC
-    printk ("\nCONN_ESTABLISH_REQ Buffer to Xmit: ");
-    nasmt_TOOL_print_buffer((char *)p,p->length);
-#endif
-    ++cx->retry;
-
-    //bytes_wrote = rtf_put(cx->sap[GRAAL_DC_INPUT_SAPI], p, p->length); //original version
-    bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-    //printk("nasmt_ASCTL_DC_send_cx_establish_request - Wrote %d bytes to RRC NAS_DC_INPUT_SAPI\n", bytes_wrote);
-
-    cx->countimer=gpriv->timer_establishment;
-
-    if (bytes_wrote==p->length) {
-      cx->state=NAS_CX_CONNECTING;
-#ifdef NAS_DEBUG_DC
-      printk("nasmt_ASCTL_DC_send_cx_establish - Message sent successfully in DC-FIFO\n");
-      printk(" Local Connection reference %u\n", p->nasUEDCPrimitive.conn_establish_req.localConnectionRef);
-      printk(" Cell Identification %u\n", p->nasUEDCPrimitive.conn_establish_req.cellId);
-      nasmt_TOOL_print_state(cx->state);
-#endif
-    } else {
-      cx->state=NAS_CX_CONNECTING_FAILURE;
-      printk("nasmt_ASCTL_DC_send_cx_establish - Message sent failure in DC-FIFO\n");
-      nasmt_TOOL_print_state(cx->state);
-    }
-
-    return bytes_wrote;
-
-  default:
-    return -NAS_ERROR_NOTIDLE;
-#ifdef NAS_DEBUG_DC
-    printk("nasmt_ASCTL_DC_send_cx_establish - NAS_ERROR_NOTIDLE \n");
-#endif
-  }
-}
-
-//---------------------------------------------------------------------------
-// Request the release of a connexion (DC channel)
-int nasmt_ASCTL_DC_send_cx_release_request(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ue_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_cx_release - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_DC_send_cx_release - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  switch (cx->state) {
-  case NAS_CX_RELEASING_FAILURE:
-  case NAS_CX_DCH:
-    p= (struct nas_ue_dc_element *)(gpriv->xbuffer);
-    p->type = CONN_RELEASE_REQ;
-    p->length =  NAS_TL_SIZE + sizeof(struct NASConnReleaseReq);
-    p->nasUEDCPrimitive.conn_release_req.localConnectionRef = cx->lcr;
-    p->nasUEDCPrimitive.conn_release_req.releaseCause = NAS_CX_RELEASE_UNDEF_CAUSE;
-
-    //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length); //original version
-    bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-    //printk("nasmt_ASCTL_DC_send_cx_release - Wrote %d bytes to RRC NAS_DC_INPUT_SAPI\n", bytes_wrote);
-
-    if (bytes_wrote==p->length) {
-      cx->state=NAS_IDLE;
-      cx->iid4=0;
-      //      nasmt_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)cx->iid6);
-      nasmt_COMMON_flush_rb(cx);
-      nasmt_CLASS_flush_sclassifier(cx);
-
-#ifdef NAS_DEBUG_DC
-      printk("nasmt_ASCTL_DC_send_cx_release - Message sent successfully in DC-FIFO\n");
-      printk(" Local Connection Reference %u\n", p->nasUEDCPrimitive.conn_release_req.localConnectionRef);
-      printk(" Release Cause %u\n", p->nasUEDCPrimitive.conn_release_req.releaseCause);
-      nasmt_TOOL_print_state(cx->state);
-#endif
-    } else {
-      ++cx->retry;
-      cx->countimer=gpriv->timer_release;
-      cx->state=NAS_CX_RELEASING_FAILURE;
-      printk("nasmt_ASCTL_DC_send_cx_release - Message sent failure in DC-FIFO\n");
-      nasmt_TOOL_print_state(cx->state);
-    }
-
-    return bytes_wrote;
-
-  default:
-    return -NAS_ERROR_NOTCONNECTED;
-#ifdef NAS_DEBUG_DC
-    printk("nasmt_ASCTL_DC_send_cx_release - NAS_ERROR_NOTCONNECTED \n");
-#endif
-  }
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (DC SAP)
-void nasmt_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ue_dc_element *p;
-  char data_type = 'A';
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_sig_data - begin \n");
-#endif
-
-  if (!skb || !gc || !cx) {
-    printk("nasmt_ASCTL_DC_send_sig_data - input parameter skb, gc or cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-  if (cx->state!=NAS_CX_DCH) {
-    printk("nasmt_ASCTL_DC_send_sig_data - Not connected, so the message is dropped\n");
-    ++gpriv->stats.tx_dropped;
-    return;
-  }
-
-  p = (struct nas_ue_dc_element *)(gpriv->xbuffer);
-  p->type = DATA_TRANSFER_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASDataReq);
-  p->nasUEDCPrimitive.data_transfer_req.localConnectionRef = cx->lcr;
-  p->nasUEDCPrimitive.data_transfer_req.priority = 3;  // TBD
-  p->nasUEDCPrimitive.data_transfer_req.nasDataLength = (skb->len)+1; //adds category character
-
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length); //original version
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-#endif
-  //printk("nasmt_ASCTL_DC_send_sig_data - Wrote %d bytes to RRC NAS_DC_INPUT_SAPI\n", bytes_wrote);
-
-  if (bytes_wrote!=p->length) {
-    printk("nasmt_ASCTL_DC_send_sig_data - Header sent failure in DC-FIFO\n");
-    return;
-  }
-
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)&data_type, 1);
-  count += 1;
-  bytes_wrote = count;
-#else
-  bytes_wrote += nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)&data_type, 1);
-#endif
-
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)skb->data, skb->len);
-  count += skb->len;
-  bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)skb->data, skb->len);
-#endif
-
-  if (bytes_wrote != p->length + skb->len + 1) {
-    printk("nasmt_ASCTL_DC_send_sig_data - Data sent failure in DC-FIFO\n");
-    return;
-  }
-
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_sig_data - end \n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (DC SAP)
-void nasmt_ASCTL_DC_send_peer_sig_data_request(struct cx_entity *cx, uint8_t sig_category)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ue_dc_element *p;
-  uint8_t nasmt_data[10];
-  unsigned int nasmt_length;
-  char data_type = 'Z';
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_peer_sig_data - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_DC_send_peer_sig_data - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  if (cx->state!=NAS_CX_DCH) {
-    printk("nasmt_ASCTL_DC_send_peer_sig_data: Not connected, so the message is dropped\n");
-    return;
-  }
-
-  // Initialize peer message
-  nasmt_length = 10;
-  memset (nasmt_data, 0, nasmt_length);
-  nasmt_data[0]= sig_category;
-  //
-  p = (struct nas_ue_dc_element *)(gpriv->xbuffer);
-  p->type = DATA_TRANSFER_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASDataReq);
-  p->nasUEDCPrimitive.data_transfer_req.localConnectionRef = cx->lcr;
-  p->nasUEDCPrimitive.data_transfer_req.priority = 3;  // TBD
-  p->nasUEDCPrimitive.data_transfer_req.nasDataLength = (nasmt_length)+1; //adds category character
-
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length); //original version
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-#endif
-  //printk("nasmt_ASCTL_DC_send_sig_data - Wrote %d bytes to RRC NAS_DC_INPUT_SAPI\n", bytes_wrote);
-
-  if (bytes_wrote!=p->length) {
-    printk("nasmt_ASCTL_DC_send_peer_sig_data - Header sent failure in DC-FIFO\n");
-    return;
-  }
-
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)&data_type, 1);
-  count += 1;
-#else
-  bytes_wrote += nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)&data_type, 1);
-#endif
-
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)nasmt_data, nasmt_length);
-  count += nasmt_length;
-  bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (char *)nasmt_data, nasmt_length);
-#endif
-
-  if (bytes_wrote != p->length + nasmt_length + 1) {
-    printk("nasmt_ASCTL_DC_send_peer_sig_data - Data sent failure in DC-FIFO\n");
-    return;
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_peer_sig_data - end \n");
-#endif
-}
-
-/***************************************************************************
-     Reception side
- ***************************************************************************/
-//---------------------------------------------------------------------------
-// Decode CONN_ESTABLISH_RESP message from RRC
-void nasmt_ASCTL_DC_decode_cx_establish_resp(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-
-  uint8_t sig_category;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_cx_establish - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasmt_ASCTL_DC_decode_cx_establish - input parameter cx or p is NULL \n");
-    return;
-  }
-
-  // End debug information
-  cx->retry=0;
-
-  if (p->nasUEDCPrimitive.conn_establish_resp.status == TERMINATED) {
-    cx->state=NAS_CX_DCH; //to be changed to NAS_CX_FACH
-    cx->iid4=1;
-    nasmt_TOOL_imei2iid(NAS_RG_IMEI, (uint8_t *)cx->iid6);
-    sig_category = NAS_CMD_OPEN_RB;
-    //For demo, add automatically a radio bearer
-#ifdef DEMO_3GSM
-    printk("nasmt_ASCTL_DC_decode_cx_establish - sig_category %u \n", sig_category);
-    nasmt_ASCTL_DC_send_peer_sig_data_request(cx, sig_category);
-#endif
-  } else {
-    cx->state=NAS_IDLE;
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk(" nasmt_ASCTL_DC_decode_cx_establish: CONN_ESTABLISH_RESP\n");
-  printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.conn_establish_resp.localConnectionRef);
-  printk(" Connection Establishment status %u\n",p->nasUEDCPrimitive.conn_establish_resp.status);
-  nasmt_TOOL_print_state(cx->state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode CONN_LOSS_IND message from RRC
-void nasmt_ASCTL_DC_decode_cx_loss_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_cx_loss - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_DC_decode_cx_loss - input parameter cx is NULL \n");
-    return;
-  }
-
-  if (p==NULL) {
-    printk("nasmt_ASCTL_DC_decode_cx_loss - input parameter p is NULL \n");
-    return;
-  }
-
-  // End debug information
-  cx->state=NAS_IDLE;
-  cx->iid4=0;
-  //nasmt_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)cx->iid6);
-  nasmt_COMMON_flush_rb(cx);
-#ifdef NAS_DEBUG_DC
-  printk(" nasmt_ASCTL_DC_decode_cx_loss: CONN_LOSS_IND reception\n");
-  printk(" Local Connection reference %u\n", p->nasUEDCPrimitive.conn_loss_ind.localConnectionRef);
-  nasmt_TOOL_print_state(cx->state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode CONN_RELEASE_IND message from RRC
-//void nasmt_ASCTL_DC_decode_cx_release_ind(struct cx_entity *cx, struct nas_ue_dc_element *p){
-//---------------------------------------------------------------------------
-//      printk("\t\tCONN_RELEASE_IND\n");
-//      printk("\t\tLocal Connection reference %u\n", p->nasUEDCPrimitive.conn_release_ind.localConnectionRef);
-//      printk("\t\tRelease cause %u\n", p->nasRGDCPrimitive.conn_release_ind.releaseCause);
-//      if (gpriv->cx[cxi].state==NAS_CX_DCH)
-//      {
-//        gpriv->cx[cxi].state=NAS_IDLE;
-//        printk("\t\tMobile no more connected\n");
-//        return bytes_read;
-//      }
-//      printk("\t\tIncoherent state %u\n", gpriv->cx[cxi].state);
-//      return bytes_read;
-//}
-
-//---------------------------------------------------------------------------
-// Decode DATA_TRANSFER_IND message from RRC
-void nasmt_ASCTL_DC_decode_sig_data_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  //  struct pdcp_data_ind_header_t  *pdcph;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_sig_data - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasmt_ASCTL_DC_decode_sig_data - input parameter cx or p is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-#ifdef NAS_DEBUG_DC
-  printk(" nasmt_ASCTL_DC_decode_sig_data: DATA_TRANSFER_IND reception\n");
-  printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.data_transfer_ind.localConnectionRef);
-  printk(" Signaling Priority %u\n",p->nasUEDCPrimitive.data_transfer_ind.priority);
-  printk(" NAS Data length %u\n",p->nasUEDCPrimitive.data_transfer_ind.nasDataLength);
-  printk(" NAS Data string %s\n", (uint8_t *)p+p->length);
-#endif
-
-  //nasmt_COMMON_receive(p->length, p->nasUEDCPrimitive.data_transfer_ind.nasDataLength, cx->sap[GRAAL_DC_OUTPUT_SAPI]); // original
-#ifndef PDCP_USE_NETLINK
-  //void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-  // data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
-  nasmt_COMMON_receive(p->length, p->nasUEDCPrimitive.data_transfer_ind.nasDataLength, NULL, 2, cx->sap[NAS_DC_OUTPUT_SAPI]);
-#else
-  nasmt_COMMON_receive(p->length, p->nasUEDCPrimitive.data_transfer_ind.nasDataLength, (unsigned char *)p+p->length, 2, 0);
-#endif
-
-}
-//---------------------------------------------------------------------------
-// Decode RB_ESTABLISH_IND message from RRC
-void nasmt_ASCTL_DC_decode_rb_establish_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  int hard_coded_rbId = 3;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_rb_establish - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_DC_decode_rb_establish - input parameter cx is NULL \n");
-    return;
-  }
-
-  if (p==NULL) {
-    printk("nasmt_ASCTL_DC_decode_rb_establish - input parameter p is NULL \n");
-    return;
-  }
-
-  // End debug information
-  // TEMP -MW - 26/9/13- Overwrite the rb_id sent by RRC
-  p->nasUEDCPrimitive.rb_establish_ind.rbId = hard_coded_rbId;
-  // TEMP -MW - 26/9/13- Rest should be kept unchanged
-  rb=nasmt_COMMON_search_rb(cx, p->nasUEDCPrimitive.rb_establish_ind.rbId);
-
-  if (rb==NULL) {
-    rb=nasmt_COMMON_add_rb(cx, p->nasUEDCPrimitive.rb_establish_ind.rbId, p->nasUEDCPrimitive.rb_establish_ind.QoSclass);
-    rb->state=NAS_RB_DCH;
-    cx->state=NAS_CX_DCH;
-    rb->dscp = p->nasUEDCPrimitive.rb_establish_ind.dscp;
-    rb->sapi = p->nasUEDCPrimitive.rb_establish_ind.sapId;
-    rb->countimer=1;
-#ifdef NAS_DEBUG_DC
-    printk(" nasmt_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_IND reception\n");
-    printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.rb_establish_ind.localConnectionRef);
-    printk(" Radio Bearer Identity %u \n",p->nasUEDCPrimitive.rb_establish_ind.rbId);
-    printk(" QoS Traffic Class %u\n",p->nasUEDCPrimitive.rb_establish_ind.QoSclass);
-    printk(" DSCP Code %u\n",p->nasUEDCPrimitive.rb_establish_ind.dscp);
-    printk(" SAP Id %u\n",p->nasUEDCPrimitive.rb_establish_ind.sapId);
-    nasmt_TOOL_print_state(cx->state);
-    nasmt_TOOL_print_rb_entity(rb);
-#endif
-  } else
-    printk("NAS_MT_DC_DECODE_RB_ESTABLISH_IND: RB_ESTABLISH_IND reception, Radio bearer already opened\n");
-}
-
-//---------------------------------------------------------------------------
-// Decode RB_RELEASE_IND message from RRC
-void nasmt_ASCTL_DC_decode_rb_release_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  uint8_t dscp;
-  int hard_coded_rbId = 3;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_rb_release - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasmt_ASCTL_DC_decode_rb_release - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  // TEMP -MW - 26/9/13- Overwrite the rb_id sent by RRC
-  p->nasUEDCPrimitive.rb_release_ind.rbId = hard_coded_rbId;
-  // TEMP -MW - 26/9/13- Rest should be kept unchanged
-  rb=nasmt_COMMON_search_rb(cx, p->nasUEDCPrimitive.rb_release_ind.rbId);
-
-  if (rb!=NULL) {
-#ifdef NAS_DEBUG_DC
-    printk(" nasmt_ASCTL_DC_decode_rb_release : RB_RELEASE_IND reception\n");
-    printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.rb_release_ind.localConnectionRef);
-    printk(" Radio Bearer Identity %u\n",p->nasUEDCPrimitive.rb_release_ind.rbId);
-    nasmt_TOOL_print_state(cx->state);
-#endif
-    // rb->state=NAS_IDLE;
-    dscp = rb->dscp;
-    nasmt_COMMON_del_rb(cx, p->nasUEDCPrimitive.rb_release_ind.rbId, dscp);
-  } else
-    printk("nasmt_ASCTL_DC_decode_rb_release: RB_RELEASE_IND reception, No corresponding radio bearer\n");
-
-}
-//---------------------------------------------------------------------------
-// Decode MEASUREMENT_IND message from RRC
-void nasmt_ASCTL_DC_decode_measurement_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  uint8_t i;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_measurement - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_DC_decode_measurement - input parameter cx is NULL \n");
-    return;
-  }
-
-  if (p==NULL) {
-    printk("nasmt_ASCTL_DC_decode_measurement - input parameter p is NULL \n");
-    return;
-  }
-
-  // End debug information
-#ifdef NAS_DEBUG_DC_MEASURE
-  printk(" nasmt_ASCTL_DC_decode_measurement : MEASUREMENT_IND reception\n");
-  printk(" Local Connection reference: %u\n", p->nasUEDCPrimitive.measurement_ind.localConnectionRef);
-  printk(" Number of RGs: %u\n", p->nasUEDCPrimitive.measurement_ind.nb_rg);
-  nasmt_TOOL_print_state(cx->state);
-
-  for (i=0; i<p->nasUEDCPrimitive.measurement_ind.nb_rg; ++i) {
-    printk(" RG[%u]:  Cell_Id %u, Level: %u\n", i,
-           p->nasUEDCPrimitive.measurement_ind.measures[i].cell_id,
-           p->nasUEDCPrimitive.measurement_ind.measures[i].level);
-  }
-
-#endif
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_measurement - Local cell %d\n",p->nasUEDCPrimitive.measurement_ind.measures[0].cell_id);
-#endif
-  cx->num_measures = p->nasUEDCPrimitive.measurement_ind.nb_rg;
-
-  for (i=0; i<cx->num_measures; i++) {
-    cx->meas_cell_id[i]= (int)(p->nasUEDCPrimitive.measurement_ind.measures[i].cell_id);
-    cx->meas_level[i] = (int)(p->nasUEDCPrimitive.measurement_ind.measures[i].level);
-    //npriv->provider_id[i]=;
-  }
-
-  cx->provider_id[0]=25;
-  cx->provider_id[1]=1;
-  cx->provider_id[2]=25;
-
-}
-
-//---------------------------------------------------------------------------
-// Decode MBMS_UE_NOTIFY_IND message from RRC
-void nasmt_ASCTL_DC_decode_mbms_ue_notify_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  uint8_t i, j, k;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_mbms_ue_notify - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasmt_ASCTL_DC_decode_mbms_ue_notify - input parameter is NULL \n");
-    return;
-  }
-
-  for (i = 0; i<NASMT_MBMS_SVCES_MAX; i++) {
-    if (p->nasUEDCPrimitive.mbms_ue_notify_ind.joined_services[i].mbms_serviceId >=0) {
-      for (j = 0; j<NASMT_MBMS_SVCES_MAX; j++) {
-        if (cx->joined_services[j] ==-1) {
-          cx->joined_services[j]= p->nasUEDCPrimitive.mbms_ue_notify_ind.joined_services[i].mbms_serviceId;
-          break;
-        }
-      }
-    }
-
-    if (p->nasUEDCPrimitive.mbms_ue_notify_ind.left_services[i].mbms_serviceId >=0) {
-      for (k = 0; k<NASMT_MBMS_SVCES_MAX; k++) {
-        if (cx->joined_services[k] == p->nasUEDCPrimitive.mbms_ue_notify_ind.left_services[i].mbms_serviceId) {
-          cx->joined_services[k]=-1;
-          break;
-        }
-      }
-    }
-  }
-
-  // End debug information
-#ifdef NAS_DEBUG_DC
-  printk(" nasmt_ASCTL_DC_decode_mbms_ue_notify : MBMS_UE_NOTIFY_IND reception\n");
-  printk(" Local Connection reference: %u\n", p->nasUEDCPrimitive.mbms_ue_notify_ind.localConnectionRef);
-  nasmt_TOOL_print_state(cx->state);
-  printk("Joined services: ");
-
-  for (i = 0; i<MAX_MBMS_SERVICES && (int) (p->nasUEDCPrimitive.mbms_ue_notify_ind.joined_services[i].mbms_serviceId) >= 0; i++)
-    printk("%d    ", (p->nasUEDCPrimitive.mbms_ue_notify_ind.joined_services[i].mbms_serviceId));
-
-  printk("\n");
-  printk("Left services: ");
-
-  for (i = 0; i<MAX_MBMS_SERVICES && (int) (p->nasUEDCPrimitive.mbms_ue_notify_ind.left_services[i].mbms_serviceId) >= 0; i++)
-    printk("%d    ", (p->nasUEDCPrimitive.mbms_ue_notify_ind.left_services[i].mbms_serviceId));
-
-  printk("\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Check if anything in DC FIFO and decode it (MT)
-int nasmt_ASCTL_DC_receive(struct cx_entity *cx, char *buffer)
-{
-  //---------------------------------------------------------------------------
-  int bytes_read=0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC_DETAIL
-  printk("nasmt_ASCTL_DC_receive - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_DC_receive - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read = rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI] , gpriv->rbuffer, NAS_TL_SIZE);
-#else
-  bytes_read = NAS_TL_SIZE;
-#endif
-
-  //
-  if (bytes_read>0) {
-    struct nas_ue_dc_element *p;
-
-#ifndef PDCP_USE_NETLINK
-    p= (struct nas_ue_dc_element *)(gpriv->rbuffer);
-    //get the rest of the primitive
-    bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], (uint8_t *)p+NAS_TL_SIZE, p->length-NAS_TL_SIZE);
-
-    if (bytes_read!=p->length) {
-      printk("nasmt_ASCTL_DC_receive: Problem while reading primitive header\n");
-      return bytes_read;
-    }
-
-#else
-    p= (struct nas_ue_dc_element *)(buffer);
-#endif
-
-    switch (p->type) {
-    case CONN_ESTABLISH_RESP :
-      if (p->nasUEDCPrimitive.conn_establish_resp.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: CONN_ESTABLISH_RESP, Local connection reference not correct %u\n",p->nasUEDCPrimitive.conn_establish_resp.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_CONNECTING:
-          nasmt_ASCTL_DC_decode_cx_establish_resp(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: CONN_ESTABLISH_RESP reception, Invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case CONN_LOSS_IND :
-      if (p->nasUEDCPrimitive.conn_loss_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: CONN_LOSS_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.conn_loss_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_RELEASING_FAILURE:
-          cx->retry=0;
-
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_cx_loss_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: CONN_LOSS_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-      //    case CONN_RELEASE_IND :
-      //      break;
-    case DATA_TRANSFER_IND :
-      if (p->nasUEDCPrimitive.data_transfer_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: DATA_TRANSFER_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.conn_loss_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_FACH:
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_sig_data_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: DATA_TRANSFER_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-    case RB_ESTABLISH_IND :
-      if (p->nasUEDCPrimitive.rb_establish_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: RB_ESTABLISH_IND reception, Local connexion reference not correct %u\n", p->nasUEDCPrimitive.rb_establish_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_FACH:
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_rb_establish_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: RB_ESTABLISH_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-    case RB_RELEASE_IND :
-      if (p->nasUEDCPrimitive.rb_release_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: RB_RELEASE_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.rb_release_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_rb_release_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: RB_RELEASE_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-    case MEASUREMENT_IND :
-      if (p->nasUEDCPrimitive.measurement_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: MEASUREMENT_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.measurement_ind.localConnectionRef);
-      else {
-        nasmt_ASCTL_DC_decode_measurement_ind(cx,p);
-      }
-
-      break;
-
-    case MBMS_UE_NOTIFY_IND :
-      if (p->nasUEDCPrimitive.rb_release_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: MBMS_UE_NOTIFY_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.rb_release_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_mbms_ue_notify_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: MBMS_UE_NOTIFY_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-    default :
-      printk("nasmt_ASCTL_DC_receive: Invalid message received\n");
-    }
-  }
-
-#ifdef NAS_DEBUG_DC_DETAIL
-  printk("nasmt_ASCTL_DC_receive - end \n");
-#endif
-  return bytes_read;
-}
-
-//---------------------------------------------------------------------------
-// Check if anything in GC FIFO and decode it (MT)
-int nasmt_ASCTL_GC_receive(char *buffer)
-{
-  //---------------------------------------------------------------------------
-  int bytes_read = 0;
-
-#ifdef NAS_DEBUG_GC
-  printk("nasmt_ASCTL_GC_receive - begin \n");
-#endif
-  // End debug information
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read = rtf_get(gpriv->sap[NAS_GC_SAPI], gpriv->rbuffer, NAS_TL_SIZE);
-#else
-  bytes_read = NAS_TL_SIZE;
-#endif
-
-  //
-  if (bytes_read>0) {
-    struct nas_ue_gc_element *p;
-#ifndef PDCP_USE_NETLINK
-    p= (struct nas_ue_gc_element *)(gpriv->rbuffer);
-    //get the rest of the primitive
-    bytes_read += rtf_get(gpriv->sap[NAS_GC_SAPI], (uint8_t *)p+NAS_TL_SIZE, p->length-NAS_TL_SIZE);
-
-    if (bytes_read!=p->length) {
-      printk("nasmt_ASCTL_GC_receive: Problem while reading primitive's header\n");
-      return bytes_read;
-    }
-
-#else
-    p= (struct nas_ue_gc_element *)(buffer);
-    bytes_read = p->length;
-#endif
-
-    // start decoding message
-    switch (p->type) {
-    case INFO_BROADCAST_IND :
-#ifndef PDCP_USE_NETLINK
-      bytes_read += rtf_get(gpriv->sap[NAS_GC_SAPI], (uint8_t *)p+p->length, p->nasUEGCPrimitive.broadcast_ind.nasDataLength);
-
-      if (bytes_read!=p->length+p->nasUEGCPrimitive.broadcast_ind.nasDataLength) {
-        printk("nasmt_ASCTL_GC_receive: INFO_BROADCAST_IND reception, Problem while reading primitive's data\n");
-        return bytes_read;
-      }
-
-#endif
-#ifdef NAS_DEBUG_GC
-      printk(" nasmt_ASCTL_GC_receive : INFO_BROADCAST_IND reception\n");
-      printk(" Primitive length %d \n", (int)(p->type));
-      printk(" Data length %u\n", p->nasUEGCPrimitive.broadcast_ind.nasDataLength);
-      printk(" Data string %s\n", (uint8_t *)p+p->length);
-#endif
-      return bytes_read;
-
-    default :
-      printk("nasmt_ASCTL_GC_receive: Invalid message received, type %d\n", p->type);
-      nasmt_TOOL_print_buffer(buffer, 16);
-      return -1;
-    }
-  } else
-    return -1;
-}
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_classifier.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_classifier.c
deleted file mode 100644
index 689b51584340868f01aaf834bc36353a98425c19..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_classifier.c
+++ /dev/null
@@ -1,884 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_classifier.c
-* \brief Flow classification functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-#include <net/ip6_fib.h>
-#include <net/route.h>
-
-#define IN_CLASSA(a)            ((((long int) (a)) & 0x80000000) == 0)
-#define IN_CLASSB(a)            ((((long int) (a)) & 0xc0000000) == 0x80000000)
-#define IN_CLASSC(a)            ((((long int) (a)) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSD(a)            ((((long int) (a)) & 0xf0000000) == 0xe0000000)
-
-/* Address to accept any incoming messages. */
-#define INADDR_ANY              ((unsigned long int) 0x00000000)
-
-#define NIPADDR(addr) \
-        (uint8_t)(addr & 0x000000FF), \
-        (uint8_t)((addr & 0x0000FF00) >> 8), \
-        (uint8_t)((addr & 0x00FF0000) >> 16), \
-        (uint8_t)((addr & 0xFF000000) >> 24)
-
-#define NIP6ADDR(addr) \
-        ntohs((addr)->s6_addr16[0]), \
-        ntohs((addr)->s6_addr16[1]), \
-        ntohs((addr)->s6_addr16[2]), \
-        ntohs((addr)->s6_addr16[3]), \
-        ntohs((addr)->s6_addr16[4]), \
-        ntohs((addr)->s6_addr16[5]), \
-        ntohs((addr)->s6_addr16[6]), \
-        ntohs((addr)->s6_addr16[7])
-
-
-#define IN6_IS_ADDR_UNSPECIFIED(a) \
-        (((__const uint32_t *) (a))[0] == 0                                   \
-         && ((__const uint32_t *) (a))[1] == 0                                \
-         && ((__const uint32_t *) (a))[2] == 0                                \
-         && ((__const uint32_t *) (a))[3] == 0)
-
-#define IN6_ARE_ADDR_MASKED_EQUAL(a,b,m) \
-           (((((__const uint32_t *) (a))[0] & (((__const uint32_t *) (m))[0])) == (((__const uint32_t *) (b))[0] & (((__const uint32_t *) (m))[0])))  \
-         && ((((__const uint32_t *) (a))[1] & (((__const uint32_t *) (m))[1])) == (((__const uint32_t *) (b))[1] & (((__const uint32_t *) (m))[1])))  \
-         && ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2])))  \
-         && ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
-
-#define IN_ARE_ADDR_MASKED_EQUAL(a,b,m) \
-           (((((__const uint8_t *) (a))[0] & (((__const uint8_t *) (m))[0])) == (((__const uint8_t *) (b))[0] & (((__const uint8_t *) (m))[0])))  \
-         && ((((__const uint8_t *) (a))[1] & (((__const uint8_t *) (m))[1])) == (((__const uint8_t *) (b))[1] & (((__const uint8_t *) (m))[1])))  \
-         && ((((__const uint8_t *) (a))[2] & (((__const uint8_t *) (m))[2])) == (((__const uint8_t *) (b))[2] & (((__const uint8_t *) (m))[2])))  \
-         && ((((__const uint8_t *) (a))[3] & (((__const uint8_t *) (m))[3])) == (((__const uint8_t *) (b))[3] & (((__const uint8_t *) (m))[3]))))
-
-//---------------------------------------------------------------------------
-void nasmt_create_mask_ipv6_addr(struct in6_addr *masked_addrP, int prefix_len)
-{
-  //---------------------------------------------------------------------------
-  int   u6_addr8_index;
-  int   u6_addr1_index;
-  int   index;
-
-  masked_addrP->s6_addr32[0] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[1] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[2] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[3] = 0xFFFFFFFF;
-
-  u6_addr8_index = prefix_len >> 3;
-  u6_addr1_index = prefix_len & 0x07;
-
-  for (index = u6_addr8_index + 1; index < 16; index++) {
-    masked_addrP->s6_addr[index] = 0;
-  }
-
-  if (u6_addr1_index > 0) {
-    masked_addrP->s6_addr[u6_addr8_index] = 0xFF << (8-u6_addr1_index);
-  }
-}
-//---------------------------------------------------------------------------
-void nasmt_create_mask_ipv4_addr(struct in_addr *masked_addrP, int prefix_len)
-{
-  //---------------------------------------------------------------------------
-  if (prefix_len > 32) {
-    prefix_len = 32;
-  }
-
-  masked_addrP->s_addr = 0xFFFFFFFF << (32 - prefix_len);
-  return;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (send direction)
-struct classifier_entity *nasmt_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_add_sclassifier: begin for dscp %d, classref %d\n", dscp,classref);
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_CLASS_add_sclassifier - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  //***
-  for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_add_sclassifier: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_ATOMIC);
-
-  if (gc==NULL)
-    return NULL;
-
-  memset(gc, 0, sizeof(struct classifier_entity));
-  gc->next=cx->sclassifier[dscp];
-  gc->classref=classref;
-  cx->sclassifier[dscp]=gc;
-  ++cx->nsclassifier;
-  ++gpriv->next_sclassref; //increment send classref index - MW 15/01/07
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_add_sclassifier: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (receive direction)
-struct classifier_entity *nasmt_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_add_rclassifier: begin\n");
-#endif
-
-  //***
-  for (gc=gpriv->rclassifier[dscp]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_add_rclassifier: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
-
-  if (gc==NULL)
-    return NULL;
-
-  gc->next=gpriv->rclassifier[dscp];
-  gc->classref=classref;
-  gpriv->rclassifier[dscp]=gc;
-  ++gpriv->nrclassifier;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_add_rclassifier: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-void nasmt_CLASS_flush_sclassifier(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t dscpi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_flush_sclassifier: begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_CLASS_flush_sclassifier - input parameter cx is NULL \n");
-    return;
-  }
-
-  //***
-  for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-    for (gc=cx->sclassifier[dscpi]; gc!=NULL; gc=cx->sclassifier[dscpi]) {
-      cx->sclassifier[dscpi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  cx->nsclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_flush_sclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasmt_CLASS_flush_rclassifier()
-{
-  //---------------------------------------------------------------------------
-  uint8_t dscpi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_flush_rclassifier: begin\n");
-#endif
-
-  //***
-  for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-    for (gc=gpriv->rclassifier[dscpi]; gc!=NULL; gc=gpriv->rclassifier[dscpi]) {
-      gpriv->rclassifier[dscpi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  gpriv->nrclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_flush_rclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (send direction)
-void nasmt_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_del_sclassifier: begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_CLASS_del_sclassifier - input parameter cx is NULL \n");
-    return;
-  }
-
-  //***
-  p=cx->sclassifier[dscp];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    cx->sclassifier[dscp]=p->next;
-    kfree(p);
-    --cx->nsclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --cx->nsclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_del_sclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (receive direction)
-void nasmt_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_del_rclassifier: begin\n");
-#endif
-  //***
-  p=gpriv->rclassifier[dscp];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    gpriv->rclassifier[dscp]=p->next;
-    kfree(p);
-    --gpriv->nrclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --gpriv->nrclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_del_rclassifier: end\n");
-#endif
-}
-
-/*  ORIGINAL VERSION
-//---------------------------------------------------------------------------
-// Search the entity with the IPv6 address 'addr'
-struct cx_entity *nasmt_CLASS_cx6(struct sk_buff *skb){
-//---------------------------------------------------------------------------
-  uint8_t cxi;
-  #ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_cx6: begin\n");
-  #endif
-  cxi=0;
-  return gpriv->cx+cxi;
-}*/
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv6 address 'addr'
-// Navid: the ipv6 classifier is not fully tested
-struct cx_entity *nasmt_CLASS_cx6(struct sk_buff *skb, unsigned char dscp, int *paddr_type, unsigned char *cx_index)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  struct cx_entity *cx = NULL;
-  struct classifier_entity *sclassifier= NULL;
-  uint32_t mc_addr_hdr;
-  struct in6_addr masked_addr;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_cx6: begin\n");
-#endif
-
-  if (skb) {
-#ifdef NAS_DEBUG_CLASS
-    printk("SOURCE ADDR %X:%X:%X:%X:%X:%X:%X:%X",NIP6ADDR(&(ipv6_hdr(skb)->saddr)));
-    printk(" DEST ADDR %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&(ipv6_hdr(skb)->daddr)));
-#endif
-    mc_addr_hdr = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0]);
-
-    // First check if multicast [1st octet is FF]
-    if ((mc_addr_hdr & 0xFF000000) == 0xFF000000) {
-      // packet type according to the scope of the multicast packet
-      // we don't consider RPT bits in second octet [maybe done later if needed]
-      switch(mc_addr_hdr & 0x000F0000) {
-      case (0x00020000):
-        *paddr_type = NAS_IPV6_ADDR_MC_SIGNALLING;
-#ifdef NAS_DEBUG_CLASS
-        printk("nasmt_CLASS_cx6: multicast packet - signalling \n");
-#endif
-        break;
-
-      default:
-        printk("nasmt_CLASS_cx6: default multicast\n");
-        *paddr_type = NAS_IPV6_ADDR_UNKNOWN;
-      }
-    } else {
-      // This is not multicast, so we should be able to identify the MT
-      *paddr_type = NAS_IPV6_ADDR_UNICAST;
-      cxi = 0;
-      (*cx_index)++;
-      sclassifier = gpriv->cx[cxi].sclassifier[dscp];
-
-      while (sclassifier!=NULL) {
-        // verify that this is an IPv6 classifier
-        if ((sclassifier->version == NAS_VERSION_6) || (sclassifier->version == NAS_VERSION_DEFAULT)) {
-          /*LGif (IN6_IS_ADDR_UNSPECIFIED(&(sclassifier->daddr.ipv6))) {
-            printk("nas_CLASS_cx6: addr is null \n");
-            sclassifier = sclassifier->next;
-            continue;
-            }*/
-#ifdef NAS_DEBUG_CLASS
-          printk("cx %d : DSCP %d %X:%X:%X:%X:%X:%X:%X:%X\n",cxi, dscp, NIP6ADDR(&(sclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-
-          //if ((dst = (unsigned int*)&(((struct rt6_info *)skbdst)->rt6i_gateway)) == 0){
-          // LG: STRANGE
-          if (IN6_IS_ADDR_UNSPECIFIED(&ipv6_hdr(skb)->daddr)) {
-            printk("nasmt_CLASS_cx6: dst addr is null \n");
-            sclassifier = sclassifier->next;
-            continue;
-          }
-
-          nasmt_create_mask_ipv6_addr(&masked_addr, sclassifier->dplen);
-          // Modified MW to check only the iid6
-          masked_addr.s6_addr32[0] = 0x00000000;
-          masked_addr.s6_addr32[1] = 0x00000000;
-
-          if (IN6_ARE_ADDR_MASKED_EQUAL(&ipv6_hdr(skb)->daddr, &(sclassifier->daddr.ipv6), &masked_addr)) {
-#ifdef NAS_DEBUG_CLASS
-            printk("nasmt_CLASS_cx6: found cx %d: %X:%X:%X:%X:%X:%X:%X:%X\n",cxi, NIP6ADDR(&(sclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-            return &gpriv->cx[cxi];
-          }
-        }
-
-        // Go to next classifier entry for connection
-        sclassifier = sclassifier->next;
-      }
-    }
-  }
-
-  //printk("nas_CLASS_cx6 NOT FOUND: %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&ipv6_hdr(skb)->daddr));
-  return cx;
-}
-
-/*  ORIGINAL VERSION
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nasmt_CLASS_cx4(struct sk_buff *skb){
-//---------------------------------------------------------------------------
-  uint8_t cxi;
-  #ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_cx4: begin\n");
-  #endif
-  cxi=0;
-  return gpriv->cx+cxi;
-}*/
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nasmt_CLASS_cx4(struct sk_buff *skb, unsigned char dscp, int *paddr_type, unsigned char *cx_index)
-{
-  //---------------------------------------------------------------------------
-  unsigned char cxi;
-  uint32_t daddr;
-  struct cx_entity *cx=NULL;
-  struct classifier_entity *pclassifier=NULL;
-  struct in_addr masked_addr;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_cx4: begin\n");
-#endif
-
-  if (skb!=NULL) {
-    daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr;
-
-    if (daddr != INADDR_ANY) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_cx4: SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
-      printk(" DEST ADDR %d.%d.%d.%d\n",NIPADDR(ip_hdr(skb)->daddr));
-#endif
-
-      if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
-        // TO BE CHECKED
-        *paddr_type = NAS_IPV4_ADDR_MC_SIGNALLING;
-      } else {
-        if (ipv4_is_lbcast(ip_hdr(skb)->daddr)) {
-          // TO BE CHECKED
-          *paddr_type = NAS_IPV4_ADDR_BROADCAST;
-        } else {
-          if (IN_CLASSA(ip_hdr(skb)->daddr) || IN_CLASSB(ip_hdr(skb)->daddr) || IN_CLASSC(ip_hdr(skb)->daddr)) {
-            *paddr_type = NAS_IPV4_ADDR_UNICAST;
-            cxi = 0;
-            (*cx_index)++;
-            pclassifier = gpriv->cx[cxi].sclassifier[dscp];
-
-            while (pclassifier!=NULL) {
-              // verify that this is an IPv4 classifier
-              if ((pclassifier->version == NAS_VERSION_4)  || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-                nasmt_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-
-                if (IN_ARE_ADDR_MASKED_EQUAL(&ip_hdr(skb)->daddr, &(pclassifier->daddr.ipv4), &masked_addr)) {
-#ifdef NAS_DEBUG_CLASS
-                  printk("nasmt_CLASS_cx4: IP MASK MATCHED: found cx %d: %d.%d.%d.%d/%d\n",cxi, NIPADDR(pclassifier->daddr.ipv4), pclassifier->dplen);
-#endif
-                  return &gpriv->cx[cxi];
-                }
-              }
-
-              // goto to next classification rule for the connection
-              pclassifier = pclassifier->next;
-            }
-          } else {
-            *paddr_type = NAS_IPV4_ADDR_UNKNOWN;
-          }
-        }
-      }
-    }
-  }
-
-  return cx;
-}
-
-//---------------------------------------------------------------------------
-// Search the sending function for IP Packet
-void nasmt_CLASS_send(struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity  *pclassifier, *sp;
-  uint8_t *protocolh = NULL;
-  uint8_t version;
-  uint8_t protocol, dscp;
-  uint16_t classref;
-  struct cx_entity *cx;
-#ifdef NAS_DEBUG_CLASS
-  char sfct[10], sprotocol[10];
-#endif
-  struct net_device *dev = gdev;
-  unsigned char cx_index,no_connection;
-  int addr_type;
-  struct in6_addr masked6_addr;
-  struct in_addr  masked_addr;
-  // RARP vars
-  struct arphdr  *rarp;
-  unsigned char  *rarp_ptr;
-  /* s for "source", t for "target" */
-  __be32 sip, tip;
-  unsigned char *sha, *tha;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_send: begin -\n");
-#endif
-
-  if (skb==NULL) {
-    printk("nasmt_CLASS_send - input parameter skb is NULL \n");
-    return;
-  }
-
-  //***
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_CLASS_send - Received IP packet to transmit:");
-
-  if ((skb->data) != NULL) {
-    if (skb->len<100)
-      nasmt_TOOL_print_buffer(skb->data,skb->len);
-    else
-      nasmt_TOOL_print_buffer(skb->data,100);
-  }
-
-#endif
-  //***
-  // find all connections related to socket
-  cx_index   = 0;
-  no_connection = 1;
-  cx = NULL;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_send: [before switch on IP protocol version] \n");
-#endif
-
-
-  // Get mobile connexion entity, protocol and dscp from IP packet
-  switch (ntohs(skb->protocol)) {
-  case ETH_P_IPV6:
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send : skb->protocol : IPv6 \n");
-#endif
-    version = NAS_VERSION_6;
-    addr_type = NAS_IPV6_ADDR_UNKNOWN;
-    protocolh = nasmt_TOOL_get_protocol6(ipv6_hdr(skb), &protocol);
-    dscp      = nasmt_TOOL_get_dscp6 (ipv6_hdr(skb));
-    cx        = nasmt_CLASS_cx6 (skb, dscp, &addr_type, &cx_index);
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send - ETH_P_IPV6 skb %p dscp %d gpriv %p cx_index %p \n",skb, dscp, gpriv, &cx_index);
-#endif
-
-    // find in default DSCP a valid classification
-    if (cx == NULL) {
-      switch (addr_type) {
-      case NAS_IPV6_ADDR_MC_SIGNALLING:
-      case NAS_IPV6_ADDR_UNICAST:
-        pclassifier=(&gpriv->cx[0])->sclassifier[NAS_DSCP_DEFAULT];
-
-        while (pclassifier!=NULL) {
-          if ((pclassifier->version == NAS_VERSION_6) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-            // ok found default classifier for this packet
-            nasmt_create_mask_ipv6_addr(&masked6_addr, pclassifier->dplen);
-
-            if (IN6_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv6, &ipv6_hdr(skb)->daddr, &masked6_addr)) {
-              // then force dscp
-              cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-              printk("nasmt_CLASS_send - ETH_P_IPV6 FOUND NAS_DSCP_DEFAULT with IN6_ARE_ADDR_MASKED_EQUAL(%d bits)\n",pclassifier->dplen);
-#endif
-              dscp = NAS_DSCP_DEFAULT;
-              break;
-            } else {
-              if(IN6_IS_ADDR_UNSPECIFIED(&pclassifier->daddr.ipv6)) {
-                cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-                printk("nasmt_CLASS_send - ETH_P_IPV6 FOUND NAS_DSCP_DEFAULT with IN6_IS_ADDR_UNSPECIFIED\n");
-#endif
-                dscp = NAS_DSCP_DEFAULT;
-                break;
-              }
-            }
-          }
-
-          pclassifier = pclassifier->next;
-        }
-
-        break;
-
-        // should have found a valid classification rule
-      case NAS_IPV6_ADDR_UNKNOWN:
-      default:
-        printk("nasmt_CLASS_send: No corresponding address type\n");
-      }
-    }
-
-    break;
-
-  case ETH_P_ARP:
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send : skb->protocol : ARP \n");
-#endif
-    version = NAS_VERSION_4;
-    addr_type = NAS_IPV4_ADDR_BROADCAST;
-    dscp = 0;
-    cx = NULL;
-    // Basic sanity checks can be done without the lock
-    rarp = (struct arphdr *)skb_network_header(skb);
-
-    if (rarp) {
-      if (rarp->ar_hln != dev->addr_len || dev->type != ntohs(rarp->ar_hrd)) {
-        printk("nasmt_CLASS_send: ARP PACKET WRONG ADDR LEN or WRONG ARP HEADER TYPE\n");
-        break;
-      }
-    } else {
-      printk("nasmt_CLASS_send: ARP HEADER POINTER IS NULL\n");
-      break;
-    }
-
-    // If it's not Ethernet, delete it.
-    if (rarp->ar_pro != htons(ETH_P_IP)) {
-      printk("nasmt_CLASS_send: ARP PACKET PROTOCOL IS NOT ETHERNET\n");
-      break;
-    }
-
-    rarp_ptr = (unsigned char *) (rarp + 1);
-    sha = rarp_ptr;
-    rarp_ptr += dev->addr_len;
-    memcpy(&sip, rarp_ptr, 4);
-    rarp_ptr += 4;
-    tha = rarp_ptr;
-    rarp_ptr += dev->addr_len;
-    memcpy(&tip, rarp_ptr, 4);
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send: ARP DEST IP transport IP = %d.%d.%d.%d\n",NIPADDR(tip));
-#endif
-    pclassifier=(&gpriv->cx[0])->sclassifier[NAS_DSCP_DEFAULT];
-
-    while (pclassifier!=NULL) {
-      if ((pclassifier->version == NAS_VERSION_4) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-        // ok found default classifier for this packet
-        nasmt_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-#ifdef NAS_DEBUG_CLASS
-        printk("nasmt_CLASS_send: MASK = %d.%d.%d.%d\n",NIPADDR(masked_addr.s_addr));
-#endif
-
-        //
-        if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &tip, &masked_addr.s_addr)) {
-          // then force dscp
-          cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-          printk("nasmt_CLASS_send: ETH_P_ARP FOUND NAS_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n", pclassifier->dplen);
-#endif
-          dscp = NAS_DSCP_DEFAULT;
-          break;
-        } else {
-          if (INADDR_ANY == pclassifier->daddr.ipv4) {
-            cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-            printk("nasmt_CLASS_send: ETH_P_ARP FOUND NAS_DSCP_DEFAULT with INADDR_ANY\n");
-#endif
-            dscp = NAS_DSCP_DEFAULT;
-            break;
-          }
-        }
-      }
-
-      pclassifier = pclassifier->next;
-    }
-
-    break;
-
-  case ETH_P_IP:
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send : skb->protocol : IPv4 \n");
-#endif
-    version   = NAS_VERSION_4;
-    addr_type = NAS_IPV4_ADDR_UNKNOWN;
-    dscp      = nasmt_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
-    cx        = nasmt_CLASS_cx4(skb, dscp, &addr_type, &cx_index);
-    protocolh = nasmt_TOOL_get_protocol4((struct iphdr *)(skb_network_header(skb)), &protocol);
-
-    // find in default DSCP a valid classification
-    if (cx == NULL) {
-      switch (addr_type) {
-      case NAS_IPV4_ADDR_MC_SIGNALLING:
-      case NAS_IPV4_ADDR_UNICAST:
-      case NAS_IPV4_ADDR_BROADCAST:
-        pclassifier=(&gpriv->cx[0])->sclassifier[NAS_DSCP_DEFAULT];
-
-        while (pclassifier != NULL) {
-          if ((pclassifier->version == NAS_VERSION_4) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-            // ok found default classifier for this packet
-            nasmt_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-#ifdef NAS_DEBUG_CLASS
-            printk("nasmt_CLASS_send : MASK = %d.%d.%d.%d\n", NIPADDR(masked_addr.s_addr));
-#endif
-
-            if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &ip_hdr(skb)->daddr, &masked_addr.s_addr)) {
-              // then force dscp
-              cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-              printk("nasmt_CLASS_send : ETH_P_IP FOUND NAS_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n",pclassifier->dplen);
-#endif
-              dscp = NAS_DSCP_DEFAULT;
-              break;
-            } else {
-              if(INADDR_ANY == pclassifier->daddr.ipv4) {
-                cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-                printk("nasmt_CLASS_send : ETH_P_IP FOUND NAS_DSCP_DEFAULT with INADDR_ANY\n");
-#endif
-                dscp = NAS_DSCP_DEFAULT;
-                break;
-              }
-            }
-          }
-
-          pclassifier = pclassifier->next;
-        }
-
-        break;
-
-        // should have found a valid classification rule
-      case NAS_IPV4_ADDR_UNKNOWN:
-      default:
-        printk("nasmt_CLASS_send: No corresponding address type\n");
-      }
-    }
-
-#ifdef NAS_DEBUG_CLASS
-
-    //printk("nasmt_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, cx = %08X\n",ntohs(skb->protocol),dscp,cx);
-    if (cx)
-      printk("nasmt_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, cx = %d\n",ntohs(skb->protocol),dscp,cx->lcr);
-    else
-      printk("nasmt_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, No valid connection\n",ntohs(skb->protocol),dscp);
-
-#endif
-    break;
-
-  default:
-    printk("nasmt_CLASS_send: Unknown IP version protocol\n");
-    version = 0;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasmt_CLASS_send: [before if (cx != NULL)]\n");
-#endif
-
-  // If a valid connection for the DSCP/EXP with destination address
-  // is found scan all protocol-based classification rules
-  if (cx != NULL) {
-    classref = 0;
-    sp       = NULL;
-
-    if (cx->state!=NAS_CX_DCH) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_send: UE not connected, in state %d. Packet is dropped\n",cx->state);
-#endif
-      return;
-    }
-
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send: DSCP %d version %d: looking for classifier entry\n",dscp, version);
-#endif
-
-    for (pclassifier=cx->sclassifier[dscp]; pclassifier!=NULL; pclassifier=pclassifier->next) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_send: DSCP %d p->classref=%d,p->protocol=%d,p->version=%d\n",dscp,pclassifier->classref,pclassifier->protocol,pclassifier->version);
-#endif
-
-      // normal rule checks that network protocol version matches
-      if ((pclassifier->version == version)  || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-        //printk("nasmt_CLASS_send: IP version are equals\n");
-        sp=pclassifier;
-        classref=sp->classref;
-#ifdef NAS_DEBUG_SEND_DETAIL
-        printk("nasmt_CLASS_send: classifier found for dscp %u \n", dscp);
-#endif
-        break;
-      }
-    }
-
-    if (sp!=NULL) {
-#ifdef NAS_DEBUG_CLASS
-
-      //char sfct[10], sprotocol[10];
-      // classifier entity found. Print its parameters
-      if (sp->fct==nasmt_COMMON_QOS_send)
-        strcpy(sfct, "data xfer");
-
-      if (sp->fct==nasmt_CTL_send)
-        strcpy(sfct, "iocontrol");
-
-      if (sp->fct==nasmt_COMMON_del_send)
-        strcpy(sfct, "delete");
-
-      if (sp->fct==nasmt_ASCTL_DC_send_sig_data_request)
-        strcpy(sfct, "DC-SAP");
-
-      switch(protocol) {
-      case NAS_PROTOCOL_UDP:
-        strcpy(sprotocol, "udp");
-        printk("udp packet\n");
-        break;
-
-      case NAS_PROTOCOL_TCP:
-        strcpy(sprotocol, "tcp");
-        printk("tcp packet\n");
-        break;
-
-      case NAS_PROTOCOL_ICMP4:
-        strcpy(sprotocol, "icmp4");
-        printk("icmp4 packet\n");
-        break;
-
-      case NAS_PROTOCOL_ICMP6:
-        strcpy(sprotocol, "icmp6");
-        nasmt_TOOL_pk_icmp6((struct icmp6hdr*)protocolh);
-        break;
-
-      default:
-        strcpy(sprotocol, "other L4");
-        break;
-      }
-
-      printk("nasmt_CLASS_send: (dscp %u, %s) received, (classref %u, fct %s, drb_id %u) classifier rule\n",
-             dscp, sprotocol, sp->classref, sfct, sp->rab_id);
-#endif
-
-      //forward packet to the correct entity
-      if (sp->fct!=NULL) {
-        sp->fct(skb, cx, sp);
-      } else {
-        printk("\n\nnasmt_CLASS_send: ERROR : CLASSIFIER FUNCTION IS NULL\n\n");
-      }
-
-      no_connection = 0;
-      // end : if classifier entry match found
-    } else {
-      printk("nasmt_CLASS_send: no corresponding item in the classifier list, so the message is dropped\n");
-      printk("nasmt_CLASS_send: packet parameters: dscp %u, %s\n", dscp, sprotocol);
-      nasmt_COMMON_del_send(skb, cx, NULL);  // Note MW: LG has commented this line. Why?
-    }
-  }   // if connection found
-
-#ifdef NAS_DEBUG_CLASS
-
-  if (no_connection == 1) {
-    printk("nasmt_CLASS_send: no corresponding connection, so the message is dropped\n");
-  }
-
-  printk("nasmt_CLASS_send: end\n");
-#endif
-}
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_common.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_common.c
deleted file mode 100644
index 4782f13488f1259ee6eeddca55c12572a6c7103c..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_common.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_common.c
-* \brief Common functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-#include <linux/inetdevice.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/etherdevice.h>
-#endif
-
-//---------------------------------------------------------------------------
-// Receive data from FIFO (QOS or DC)
-//void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlen, int sap){
-//void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlen, void *pdcp_sdu, int sap){
-void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap)
-{
-  //---------------------------------------------------------------------------
-  struct sk_buff *skb;
-  struct ipversion *ipv;
-  unsigned int hard_header_len;
-  uint16_t  *p_ether_type;
-  uint16_t  ether_type;
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_receive: begin\n");
-#endif
-#ifdef PDCP_USE_NETLINK
-
-  // data_buffer is NULL if FIFOs
-  if (!data_buffer) {
-    printk("nasmt_COMMON_receive - input parameter data_buffer is NULL \n");
-    return;
-  }
-
-#endif
-
-  skb = dev_alloc_skb( payload_length + 2 );
-
-  if(!skb) {
-    printk("nasmt_COMMON_receive: low on memory\n");
-    ++gpriv->stats.rx_dropped;
-    return;
-  }
-
-  skb_reserve(skb,2);
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read += rtf_get(sap, skb_put(skb, payload_length), payload_length);
-
-  if (bytes_read != NAS_PDCPH_SIZE + payload_length) {
-    printk("nasmt_COMMON_receive: problem while reading DC sap\n");
-    kfree(skb->data);
-    dev_kfree_skb(skb);
-    return;
-  }
-
-#else
-  memcpy(skb_put(skb, payload_length), data_buffer, payload_length);
-  bytes_read += payload_length;
-#endif
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_receive: received packet from PDCP, length %d\n", bytes_read);
-#endif
-
-  skb->dev = gdev;
-  hard_header_len = gdev->hard_header_len;
-  skb->mac_header = skb->data;
-  skb->pkt_type = PACKET_HOST;
-  skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-  ipv = (struct ipversion *)&(skb->data[hard_header_len]);
-
-  switch (ipv->version) {
-  case 6:
-#ifdef NAS_DEBUG_RECEIVE_BASIC
-    printk("nasmt_COMMON_receive: receive IPv6 message\n");
-#endif
-    skb->network_header = &skb->data[hard_header_len];
-    // set  protocol default value
-    skb->protocol = htons(ETH_P_IPV6);
-    // If type Ethernet, correct it
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    skb->protocol = eth_type_trans(skb, gdev);
-#endif
-    break;
-
-  case 4:
-#ifdef NAS_DEBUG_RECEIVE_BASIC
-    printk("nasmt_COMMON_receive: receive IPv4 message\n");
-#endif
-
-#ifdef NAS_DEBUG_RECEIVE
-    addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
-
-    if (addr) {
-      printk("nasmt_COMMON_receive: Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
-    }
-
-    addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
-
-    if (addr) {
-      printk("[NAS][COMMON][RECEIVE] Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
-    }
-
-    printk("[NAS][COMMON][RECEIVE] protocol  %d\n",((struct iphdr *)&skb->data[hard_header_len])->protocol);
-#endif
-
-    skb->network_header = &skb->data[hard_header_len];
-    // set  protocol default value
-    skb->protocol = htons(ETH_P_IP);
-    // If type Ethernet, correct it
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    skb->protocol = eth_type_trans(skb, gdev);
-#endif
-    break;
-
-  default:
-    printk("nasmt_COMMON_receive: Packet is not IPv4 or IPv6 (version=%d)\n", ipv->version);
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#ifdef NAS_DEBUG_RECEIVE
-    printk("nasmt_COMMON_receive: ether_type=%04X\n", ether_type);
-#endif
-    skb->protocol = eth_type_trans(skb, gdev);
-    // minus 1(short) instead of 2(bytes) because uint16_t*
-    p_ether_type = (uint16_t *)&(skb->mac_header[hard_header_len-2]);
-    ether_type = ntohs(*p_ether_type);
-#ifdef NAS_DEBUG_RECEIVE
-    printk("nasmt_COMMON_receive: ether_type=%04X\n", ether_type);
-#endif
-
-    switch (ether_type) {
-    case ETH_P_ARP:
-      printk("[NAS][COMMON] ether_type = ETH_P_ARP\n");
-      skb->protocol = htons(ETH_P_ARP);
-      skb->network_header = &skb->mac_header[hard_header_len];
-      break;
-
-    default:
-      break;
-    }
-
-#endif
-  }
-
-  ++gpriv->stats.rx_packets;
-  gpriv->stats.rx_bytes += bytes_read;
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_receive: forwarding packet of size %d to kernel\n",skb->len);
-#endif
-
-  netif_rx(skb);
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_receive: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete the data
-void nasmt_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp)
-{
-  //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_del_send - updating statistics \n");
-#endif
-  ++gpriv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (QoS SAP)
-void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  //struct pdcp_data_req     pdcph;
-  struct pdcp_data_req_header_t     pdcph;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_QOS_send - begin \n");
-#endif
-
-  //  if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
-  //  {
-  //    gpriv->stats.tx_dropped ++;
-  //    printk("NAS_QOS_SEND: No connected, so message are dropped \n");
-  //    return;
-  //  }
-  if (!skb || !gc || !cx) {
-    printk("nasmt_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  if (gc->rb==NULL) {
-    gc->rb = nasmt_COMMON_search_rb(cx, gc->rab_id);
-
-    if (gc->rb==NULL) {
-      ++gpriv->stats.tx_dropped;
-      printk("nasmt_COMMON_QOS_send: No corresponding Radio Bearer, so message is dropped, rab_id=%u \n", gc->rab_id);
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_QOS_send #1 :");
-  printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
-  nasmt_TOOL_print_classifier(gc);
-#endif
-
-  pdcph.data_size  = skb->len;
-  pdcph.rb_id      = ((gc->rb)->rab_id+(32*cx->lcr))-NAS_SIG_NUM_SRB;
-  pdcph.inst       = 0;
-
-#ifdef PDCP_USE_NETLINK
-  bytes_wrote = nasmt_netlink_send((unsigned char *)&pdcph,NAS_PDCPH_SIZE, NASNL_DEST_PDCP);
-  //printk("nasmt_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n", bytes_wrote,skb->len);
-#else
-  //bytes_wrote = rtf_put(gpriv->sap[(gc->rb)->sapi], &pdcph, NAS_PDCPH_SIZE);
-  bytes_wrote = rtf_put(NAS2PDCP_FIFO, &pdcph, NAS_PDCPH_SIZE);
-  //printk("nasmt_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP fifo\n", bytes_wrote,skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != NAS_PDCPH_SIZE) {
-    printk("nasmt_COMMON_QOS_send: problem while writing PDCP's header\n");
-    printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef  PDCP_USE_NETLINK
-  bytes_wrote += nasmt_netlink_send((unsigned char *)skb->data,skb->len, NASNL_DEST_PDCP);
-#else
-  //bytes_wrote += rtf_put(gpriv->sap[(gc->rb)->sapi], skb->data, skb->len);
-  bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != skb->len + NAS_PDCPH_SIZE) {
-    printk("nasmt_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
-    printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_QOS_send - %d bytes wrote to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id,NAS2PDCP_FIFO);
-#endif
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_QOS_send - end \n");
-#endif
-}
-
-#ifndef PDCP_USE_NETLINK
-//---------------------------------------------------------------------------
-void nasmt_COMMON_QOS_receive(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t sapi;
-  //struct pdcp_data_ind     pdcph;
-  struct pdcp_data_ind_header_t  pdcph;
-  int bytes_read = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_QOS_receive - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_COMMON_QOS_receive - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  // LG force the use of only 1 rt fifo
-  sapi = NAS_DRB_OUTPUT_SAPI;
-
-  bytes_read =  rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
-
-  while (bytes_read>0) {
-    if (bytes_read != NAS_PDCPH_SIZE) {
-      printk("nasmt_COMMON_QOS_receive: problem while reading PDCP header\n");
-      return;
-    }
-
-    //void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-    // data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
-    nasmt_COMMON_receive(NAS_PDCPH_SIZE, pdcph.data_size, NULL, pdcph->rb_id, gpriv->sap[sapi]);
-    // check if another frame is in the FIFO, otherwise return
-    bytes_read =  rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
-  }
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_QOS_receive - end \n");
-#endif
-}
-
-#else
-//---------------------------------------------------------------------------
-void nasmt_COMMON_QOS_receive(struct nlmsghdr *nlh)
-{
-  //---------------------------------------------------------------------------
-
-  struct pdcp_data_ind_header_t  *pdcph;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_QOS_receive - begin \n");
-#endif
-
-  if (!nlh) {
-    printk("nasmt_COMMON_QOS_receive - input parameter nlh is NULL \n");
-    return;
-  }
-
-  // End debug information
-  pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_QOS_receive - receive from PDCP, size %d, rab %d\\n", pdcph->data_size, pdcph->rb_id);
-#endif //NAS_DEBUG_RECEIVE
-
-  //void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-  nasmt_COMMON_receive(NAS_PDCPH_SIZE + pdcph->data_size, pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE, pdcph->rb_id, 0);
-
-}
-#endif //PDCP_USE_NETLINK
-
-
-//---------------------------------------------------------------------------
-struct cx_entity *nasmt_COMMON_search_cx(nasLocalConnectionRef_t lcr)
-{
-  //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_search_cx - lcr %d\n",lcr);
-#endif
-
-  if (lcr<NAS_CX_MAX)
-    return gpriv->cx+lcr;
-  else
-    return NULL;
-}
-
-//---------------------------------------------------------------------------
-// Search a Radio Bearer
-struct rb_entity *nasmt_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_search_rb - rab_id %d\n", rab_id);
-#endif
-
-  if (!cx) {
-    printk("nasmt_COMMON_search_rb - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-    if (rb->rab_id==rab_id)
-      return rb;
-  }
-
-  return NULL;
-}
-
-//---------------------------------------------------------------------------
-struct rb_entity *nasmt_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_add_rb - begin for rab_id %d , qos %d\n", rab_id, qos );
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_COMMON_add_rb - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  rb=nasmt_COMMON_search_rb(cx, rab_id);
-
-  if (rb==NULL) {
-    rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
-
-    if (rb!=NULL) {
-      rb->retry=0;
-      rb->countimer=NAS_TIMER_IDLE;
-      rb->rab_id=rab_id;
-      //      rb->rab_id=rab_id+(32*cx->lcr);
-#ifdef NAS_DEBUG_DC
-      printk("nasmt_COMMON_add_rb: rb rab_id=%u, rab_id=%u, mt_id=%u\n",rb->rab_id,rab_id, cx->lcr);
-#endif
-      rb->qos=qos;
-      rb->sapi=NAS_DRB_INPUT_SAPI;
-      // LG force the use of only one rt-fifo rb->sapi=NAS_BA_INPUT_SAPI;
-      rb->state=NAS_IDLE;
-      rb->next=cx->rb;
-      cx->rb=rb;
-      ++cx->num_rb;
-    } else
-      printk("nasmt_COMMON_add_rb: no memory\n");
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_add_rb - end \n" );
-#endif
-  return rb;
-}
-
-//---------------------------------------------------------------------------
-// free the memory that has previously been allocated to rb and remove from linked list
-void nasmt_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb, *curr_rb, *prev_rb;
-  struct classifier_entity *p;
-  uint16_t classref=0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_del_rb - begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_COMMON_del_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  // Clear the associated classifier
-  for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next) {
-    if (p->classref>=classref) {
-      classref=p->classref;
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_COMMON_del_rb: classifier found for dscp %u \n", dscp);
-#endif
-    }
-  }
-
-  nasmt_CLASS_del_sclassifier(cx, dscp, classref);
-
-  // Now, delete the RB
-  curr_rb = NULL;
-  prev_rb = NULL;
-
-  for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-    if (rb->rab_id == rab_id) {
-      curr_rb = rb;
-
-      if (prev_rb!=NULL) {
-        prev_rb->next = rb->next;
-      } else {
-        cx->rb=rb->next;
-      }
-
-      break;
-    } else {
-      prev_rb = rb;
-    }
-  }
-
-  if (curr_rb!= NULL) {
-    printk("nasmt_COMMON_del_rb: del rab_id %u\n", rb->rab_id);
-    kfree(rb);
-    (cx->num_rb)--;
-  } else {
-    printk("\n\n--nasmt_COMMON_del_rb: ERROR, invalid rab_id %u\n", rb->rab_id);
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_del_rb - end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasmt_COMMON_flush_rb(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  struct classifier_entity *gc;
-  uint8_t dscp;
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_flush_rb - begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_COMMON_flush_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-  for (rb=cx->rb; rb!=NULL; rb=cx->rb) {
-    printk("nasmt_COMMON_flush_rb: del rab_id %u\n", rb->rab_id);
-    cx->rb=rb->next;
-    kfree(rb);
-  }
-
-  cx->num_rb=0;
-  cx->rb=NULL;
-
-  for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp) {
-    for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
-      gc->rb=NULL;
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_flush_rb - end\n");
-#endif
-}
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_constant.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_constant.h
deleted file mode 100644
index 0e77b3e44c00de3502c70e15b1106f09b8856ad5..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_constant.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_constant.h
-* \brief Defines all constants for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASMTD_CST
-#define _NASMTD_CST
-
-//Debug flags
-#define NAS_DEBUG_DC
-//#define NAS_DEBUG_DC_DETAIL    // detail of DC-SAP operation
-#define NAS_DEBUG_SEND
-#define NAS_DEBUG_SEND_DETAIL  // detail of packet transmission
-//#define NAS_DEBUG_RECEIVE
-#define NAS_DEBUG_RECEIVE_BASIC
-#define NAS_DEBUG_CLASS
-//#define NAS_DEBUG_GC
-//#define NAS_DEBUG_DC_MEASURE
-//#define NAS_DEBUG_TIMER
-#define NAS_DEBUG_DEVICE
-//#define NAS_DEBUG_INTERRUPT
-//#define NAS_DEBUG_TOOL
-#define NETLINK_DEBUG
-//#define NAS_DEBUG_RRCNL // RRC netlink socket
-
-// Other flags
-#define DEMO_3GSM
-#define ENABLE_SLEEP_MODE
-
-// Parameters for the default RAB started after attachment (needs DEMO_3GSM defined)
-#define NASMT_DEFAULTRAB_CLASSREF   1  //MW-01/01/07-
-#define NASMT_DEFAULTRAB_DSCP       0  //MW-01/01/07-
-#define NASMT_DEFAULTRAB_IPVERSION  NAS_VERSION_DEFAULT  //MW-01/01/07-
-
-#define NAS_DEFAULT_IPv6_PREFIX_LENGTH 128 // used to compare destination address
-
-
-// General Constants
-#define NAS_MTU  1500
-#define NAS_TX_QUEUE_LEN  100
-#define NAS_ADDR_LEN  8
-#define NAS_INET6_ADDRSTRLEN 46
-#define NAS_INET_ADDRSTRLEN  16
-
-#define NAS_RESET_RX_FLAGS  0
-
-#define NAS_CX_MAX 1
-//#define NAS_CX_MULTICAST_ALLNODE 2
-#define NASMT_MBMS_SVCES_MAX 4 // Identical to RRC constant
-
-#define NAS_RETRY_LIMIT_DEFAULT 5
-
-#define NAS_MESSAGE_MAXLEN 1600
-
-// UMTS
-#define NAS_SIG_SRB3 3
-#define NAS_SIG_SRB4 3 // not used yet
-//LTE
-#define NAS_SIG_NUM_SRB 3  // number of srbs in LTE to send Rb_Id to PDCP
-
-//peer-to-peer messages between NAS entities
-#define NAS_CMD_OPEN_RB     1
-#define NAS_CMD_ENTER_SLEEP 2
-#define NAS_CMD_LEAVE_SLEEP 3
-
-//#define NAS_IID1_CONTROL 0x0
-//#define NAS_IID2_CONTROL __constant_htonl(0xffffffff)
-
-//#define NAS_STATE_IDLE      0
-//#define NAS_STATE_CONNECTED     1
-//#define NAS_STATE_ESTABLISHMENT_REQUEST 2
-//#define NAS_STATE_ESTABLISHMENT_FAILURE 3
-//#define NAS_STATE_RELEASE_FAILURE   4
-#define NAS_CX_RELEASE_UNDEF_CAUSE 1
-
-// MT+RG NAS States
-#define NAS_IDLE                  0x01
-// Connection
-#define NAS_CX_FACH               0x06
-#define NAS_CX_DCH                0x0A
-#define NAS_CX_RECEIVED           0x10
-#define NAS_CX_CONNECTING         0x04
-#define NAS_CX_RELEASING          0x08
-#define NAS_CX_CONNECTING_FAILURE 0x14
-#define NAS_CX_RELEASING_FAILURE  0x18
-// Radio Bearers
-#define NAS_RB_ESTABLISHING       0x24
-#define NAS_RB_RELEASING          0x28
-#define NAS_RB_DCH                0x2A
-
-
-#define NAS_TIMER_ESTABLISHMENT_DEFAULT 12
-#define NAS_TIMER_RELEASE_DEFAULT 2
-#define NAS_TIMER_IDLE UINT_MAX
-#define NAS_TIMER_TICK HZ
-
-#define NAS_PDCPH_SIZE sizeof(struct pdcp_data_req_header_t)
-#define NAS_IPV4_SIZE 20
-#define NAS_IPV6_SIZE 40
-
-#define NAS_DIRECTION_SEND  0
-#define NAS_DIRECTION_RECEIVE 1
-
-// function number
-#define NAS_FCT_DEL_SEND  1
-#define NAS_FCT_QOS_SEND  2
-#define NAS_FCT_DC_SEND         3
-#define NAS_FCT_CTL_SEND  4
-
-// type of IOCTL command
-#define NASMT_IOCTL_RAL 0x89F0
-
-// Error cause
-#define NAS_ERROR_ALREADYEXIST  1
-#define NAS_ERROR_NOMEMORY    3
-#define NAS_ERROR_NOTMT     9
-#define NAS_ERROR_NOTRG     10
-#define NAS_ERROR_NOTIDLE     11
-#define NAS_ERROR_NOTCONNECTED    12
-#define NAS_ERROR_NORB    14
-#define NAS_ERROR_NOTCORRECTVALUE 32
-#define NAS_ERROR_NOTCORRECTLCR 33
-#define NAS_ERROR_NOTCORRECTDIR 34
-#define NAS_ERROR_NOTCORRECTDSCP  35
-#define NAS_ERROR_NOTCORRECTVERSION 36
-#define NAS_ERROR_NOTCORRECTRABI  37
-
-
-/**********************************************************/
-/* Constants related with IP protocols                    */
-/**********************************************************/
-// Destination address types
-#define NAS_IPV6_ADDR_UNICAST        1
-#define NAS_IPV6_ADDR_MC_SIGNALLING  2
-#define NAS_IPV6_ADDR_MC_MBMS        3
-#define NAS_IPV6_ADDR_UNKNOWN        4
-
-#define NAS_IPV4_ADDR_UNICAST        5
-#define NAS_IPV4_ADDR_MC_SIGNALLING  6
-#define NAS_IPV4_ADDR_BROADCAST      7
-#define NAS_IPV4_ADDR_UNKNOWN        8
-
-
-//#define NAS_PORT_CONTROL __constant_htons(0xc45)
-//#define NAS_PORT_AUTHENTICATION __constant_htons(1811)
-
-//#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0fc00000) //Yan
-#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0ff00000)
-
-// Network control codepoint 111000 + IP version 6
-#define NAS_FLOWINFO_NCONTROL __constant_htonl(0x6e000000)
-// network control codepoint 111000
-#define NAS_DSCP_NCONTROL 56   //0x38
-// default codepoint 1000000
-#define NAS_DSCP_DEFAULT 64
-#define NAS_DSCP_MAX 65
-
-#define NAS_PROTOCOL_DEFAULT 0
-#define NAS_PROTOCOL_TCP IPPROTO_TCP
-#define NAS_PROTOCOL_UDP IPPROTO_UDP
-#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
-#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
-
-#define NAS_PORT_DEFAULT  __constant_htons(65535)
-#define NAS_PORT_HTTP   __constant_htons(80)
-
-#define NAS_VERSION_DEFAULT  0
-#define NAS_VERSION_4        4
-#define NAS_VERSION_6        6 //?MW
-
-/**********************************************************/
-/* Constants related with Netlink sockets                 */
-/**********************************************************/
-#define OAI_IP_DRIVER_NETLINK_ID 31
-#define NL_DEST_PID 1
-
-// defined in rrc_nas_sap.h
-//#define NAS_RRCNL_ID 30
-//#define NL_DEST_RRC_PID 2
-
-#define NASNL_DEST_PDCP 0
-#define NASNL_DEST_RRC 1
-
-#endif
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c
deleted file mode 100644
index 77b3c28165f879f182c6204398cd3e0685fe1ca7..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_device.c
-* \brief Networking Device Driver for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef PDCP_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // PDCP_USE_NETLINK
-//:::::::::::::::::::::::::::::::::::::::;;
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-//:::::::::::::::::::::::::::::::::::::::;;
-//#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/moduleparam.h>
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/if_ether.h>
-#endif
-
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/delay.h>
-#include <asm/unistd.h>
-#include <linux/netdevice.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/etherdevice.h>
-#endif
-//:::::::::::::::::::::::::::::::::::::::;;
-struct net_device *gdev;
-struct nas_priv *gpriv;
-//int bytes_wrote;
-//int bytes_read;
-uint8_t NAS_NULL_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00};
-uint8_t NAS_RG_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x01};
-
-// TEMP
-//uint8_t nas_IMEI[14];
-static unsigned char nas_IMEI[14];
-static int m_arg=0;
-
-
-#ifdef PDCP_USE_NETLINK
-extern void nasmt_netlink_release(void);
-extern int nasmt_netlink_init(void);
-#endif
-extern void nasmt_ASCTL_timer(unsigned long data);
-
-
-#ifndef PDCP_USE_NETLINK
-//---------------------------------------------------------------------------
-//void nasmt_interrupt(void){
-void *nasmt_interrupt(void)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  char *buffer = NULL;
-#ifdef NAS_DEBUG_INTERRUPT
-  printk("nasmt_interrupt - begin\n");
-#endif
-  //spin_lock(&gpriv->lock);
-  cxi=0;
-  nasmt_COMMON_QOS_receive(gpriv->cx+cxi);
-  nasmt_ASCTL_GC_receive(buffer);
-  nasmt_ASCTL_DC_receive(gpriv->cx+cxi, buffer);
-  //spin_unlock(&gpriv->lock);
-#ifdef NAS_DEBUG_INTERRUPT
-  printk("nasmt_interrupt: end\n");
-#endif
-}
-#endif //NETLINK
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is activated by ifconfig
-int nasmt_open(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_open: begin\n");
-
-  gpriv=netdev_priv(dev);
-
-  // Address has already been set at init
-#ifndef PDCP_USE_NETLINK
-
-  if (gpriv->irq==-EBUSY) {
-    printk("nasmt_open: irq failure\n");
-    return -EBUSY;
-  }
-
-#endif //NETLINK
-
-  // next lines prevent compilation of the driver with kernel version under 2.6.29
-  // ATTENTION !!!!!! NASMT is not usable with these versions
-
-  if(!netif_queue_stopped(dev))
-    netif_start_queue(dev);
-  else
-    netif_wake_queue(dev);
-
-  //
-  init_timer(&gpriv->timer);
-  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
-  (gpriv->timer).data=0L;
-  (gpriv->timer).function=nasmt_ASCTL_timer;
-  // ??LITE comments: add_timer(&gpriv->timer);
-  add_timer(&gpriv->timer);
-  //
-  printk("nasmt_open: name = %s, end\n", dev->name);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is desactivated by ifconfig
-int nasmt_stop(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  struct nas_priv *priv = netdev_priv(dev);
-  printk("nasmt_stop: begin\n");
-  del_timer(&priv->timer);
-  netif_stop_queue(dev);
-
-  printk("nasmt_stop: name = %s, end\n", dev->name);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-void nasmt_teardown(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  int cxi;
-#ifndef PDCP_USE_NETLINK
-  struct nas_priv *priv = netdev_priv(dev);
-#endif //PDCP_USE_NETLINK
-
-  printk("nasmt_teardown: begin\n");
-  //  priv=(struct nas_priv *)(gdev.priv);
-
-  if (dev) {
-#ifndef PDCP_USE_NETLINK
-
-    if (priv->irq!=-EBUSY) {
-      *pt_nas_ue_irq=-1;
-      rt_free_srq(priv->irq);
-    }
-
-#endif //PDCP_USE_NETLINK
-
-#ifdef PDCP_USE_NETLINK
-    nasmt_netlink_release();
-#endif //PDCP_USE_NETLINK
-    //  for (sapi=0; sapi<NAS_SAPI_MAX; ++sapi)
-    //    close(priv->sap[sapi]);
-    nasmt_CLASS_flush_rclassifier();
-    cxi=0;
-    nasmt_COMMON_flush_rb(gpriv->cx+cxi);
-    nasmt_CLASS_flush_sclassifier(gpriv->cx+cxi);
-    // for (sapi=0; sapi<NAS_SAPI_CX_MAX; ++sapi)
-    // close(priv->cx[cxi].sap[sapi]);
-  } // check dev
-  else {
-    printk("nasmt_teardown: Device is null\n");
-  }
-
-  printk("nasmt_teardown: end\n");
-}
-
-//---------------------------------------------------------------------------
-int nasmt_set_config(struct net_device *dev, struct ifmap *map)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_set_config: begin\n");
-
-  if (dev->flags & IFF_UP)
-    return -EBUSY;
-
-  if (map->base_addr != dev->base_addr) {
-    printk(KERN_WARNING "nasmt_set_config: Can't change I/O address\n");
-    return -EOPNOTSUPP;
-  }
-
-  if (map->irq != dev->irq)
-    dev->irq = map->irq;
-
-  printk("nasmt_set_config: end\n");
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-//
-int nasmt_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DEVICE
-  printk("nasmt_hard_start_xmit: begin\n");
-#endif
-
-  if ((!skb)||(!dev)) {
-    printk("nasmt_hard_start_xmit - input parameter skb or dev is NULL \n");
-    return -1;
-  }
-
-  // End debug information
-  netif_stop_queue(dev);
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-  netif_trans_update(dev);
-#else
-  dev->trans_start = jiffies;
-#endif
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasmt_hard_start_xmit: step 1\n");
-#endif
-  nasmt_CLASS_send(skb);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasmt_hard_start_xmit: step 2\n");
-#endif
-  dev_kfree_skb(skb);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasmt_hard_start_xmit: step 3\n");
-#endif
-  netif_wake_queue(dev);
-#ifdef NAS_DEBUG_DEVICE
-  printk("nasmt_hard_start_xmit: end\n");
-#endif
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-struct net_device_stats *nasmt_get_stats(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  //  return &((struct nas_priv *)dev->priv)->stats;
-  struct nas_priv *npriv = netdev_priv(dev);
-  return &npriv->stats;
-}
-
-//---------------------------------------------------------------------------
-// New function from LITE DRIVER
-int nasmt_set_mac_address(struct net_device *dev, void *mac)
-{
-  //---------------------------------------------------------------------------
-  struct sockaddr *addr = mac;
-  printk("nasmt_set_mac_address: begin\n");
-  memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-  return 0;
-}
-
-
-//---------------------------------------------------------------------------
-int nasmt_change_mtu(struct net_device *dev, int mtu)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_change_mtu: begin\n");
-
-  if ((mtu<50) || (mtu>1500))
-    //  if ((mtu<1280) || (mtu>1500))
-    return -EINVAL;
-
-  dev->mtu = mtu;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_change_rx_flags(struct net_device *dev, int flags)
-{
-  //---------------------------------------------------------------------------
-  //struct nas_priv *priv =  netdev_priv(dev);
-  printk("nasmt_change_rx_flags %08X\n", flags);
-  gpriv->rx_flags ^= flags;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-void nasmt_tx_timeout(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  /* Transmitter timeout, serious problems. */
-  printk("nasmt_tx_timeout: begin\n");
-  //((struct nas_priv *)(dev->priv))->stats.tx_errors++;
-  (gpriv->stats).tx_errors++;
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-  netif_trans_update(dev);
-#else
-  dev->trans_start = jiffies;
-#endif
-  netif_wake_queue(dev);
-  printk("nasmt_tx_timeout: transmit timed out %s\n",dev->name);
-}
-
-//---------------------------------------------------------------------------
-// Define pointers for the module
-static const struct net_device_ops nasmt_netdev_ops = {
-  // ?? nasmt_interrupt
-  //
-  .ndo_open               = nasmt_open,
-  .ndo_stop               = nasmt_stop,
-  .ndo_start_xmit         = nasmt_hard_start_xmit,
-  .ndo_validate_addr      = NULL,
-  .ndo_get_stats          = nasmt_get_stats,
-  //#ifdef  KERNEL_VERSION_GREATER_THAN_32
-  //    .ndo_set_multicast_list = NULL,
-  .ndo_set_mac_address    = nasmt_set_mac_address,
-  .ndo_set_config         = nasmt_set_config,
-  .ndo_do_ioctl           = nasmt_CTL_ioctl,
-  .ndo_change_mtu         = nasmt_change_mtu,
-  .ndo_tx_timeout         = nasmt_tx_timeout,
-  .ndo_change_rx_flags    = nasmt_change_rx_flags,
-  //#endif
-};
-//---------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------
-// Initialisation of the network device
-void nasmt_init(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi, dscpi;
-
-  printk("nasmt_init: begin\n");
-
-  if (dev) {
-    gpriv=netdev_priv(dev);
-    memset(gpriv, 0, sizeof(struct nas_priv));
-    // Initialize function pointers
-    dev->netdev_ops = &nasmt_netdev_ops;
-
-#ifndef NAS_DRIVER_TYPE_ETHERNET
-    //  Update driver properties
-    dev->type = ARPHRD_EURUMTS;
-    dev->features = NETIF_F_NO_CSUM;
-    dev->hard_header_len = 0;
-    dev->addr_len = NAS_ADDR_LEN;
-    dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
-    dev->tx_queue_len = NAS_TX_QUEUE_LEN;
-    dev->mtu = NAS_MTU;
-#endif
-    // Can be one of the following enum defined in include/linux/netdevice.h:
-    // enum netdev_state_t {
-    // __LINK_STATE_START,
-    // __LINK_STATE_PRESENT,
-    // __LINK_STATE_NOCARRIER,
-    // __LINK_STATE_LINKWATCH_PENDING,
-    // __LINK_STATE_DORMANT,
-    // };
-    set_bit(__LINK_STATE_PRESENT, &dev->state);
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    // overwrite values written above ( header_ops,type,hard_header_len,mtu,addr_len,tx_queue_len,flags,broadcast)
-    printk("\nnasmt_init: WARNING Driver type ETHERNET\n");
-    ether_setup(dev);
-#endif
-
-    //
-    // Initialize private structure
-    gpriv->rx_flags = NAS_RESET_RX_FLAGS;
-
-    gpriv->sap[NAS_GC_SAPI] = RRC_DEVICE_GC;
-    gpriv->sap[NAS_NT_SAPI] = RRC_DEVICE_NT;
-    gpriv->cx[0].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
-    gpriv->cx[0].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
-
-    //gpriv->sap[NAS_CO_INPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_INPUT;
-    //gpriv->sap[NAS_CO_OUTPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_OUTPUT;
-    gpriv->sap[NAS_DRB_INPUT_SAPI]  = PDCP2PDCP_USE_RT_FIFO;//QOS_DEVICE_CONVERSATIONAL_INPUT;
-    gpriv->sap[NAS_DRB_OUTPUT_SAPI] = NAS2PDCP_FIFO;//QOS_DEVICE_STREAMING_INPUT;
-
-    gpriv->retry_limit = NAS_RETRY_LIMIT_DEFAULT;
-    gpriv->timer_establishment = NAS_TIMER_ESTABLISHMENT_DEFAULT;
-    gpriv->timer_release = NAS_TIMER_RELEASE_DEFAULT;
-
-    for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
-      gpriv->rclassifier[dscpi] = NULL;
-
-    gpriv->nrclassifier = 0;
-    //
-    cxi=0;
-#ifdef NAS_DEBUG_DEVICE
-    printk("nasmt_init: init classifiers, state and timer for MT %u\n", cxi);
-#endif
-    gpriv->cx[cxi].state = NAS_IDLE;
-    gpriv->cx[cxi].countimer = NAS_TIMER_IDLE;
-    gpriv->cx[cxi].retry = 0;
-    gpriv->cx[cxi].lcr = cxi;
-    gpriv->cx[cxi].rb = NULL;
-    gpriv->cx[cxi].num_rb = 0;
-
-    // initialisation of the classifiers
-    for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-      gpriv->cx[cxi].sclassifier[dscpi]=NULL;
-    }
-
-    gpriv->cx[cxi].nsclassifier=0;
-    // initialisation of the IP address
-    nasmt_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)gpriv->cx[cxi].iid6);
-    gpriv->cx[cxi].iid4=0;
-    //
-    spin_lock_init(&gpriv->lock);
-    printk("nasmt_init: init IMEI to IID\n");
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    nasmt_TOOL_eth_imei2iid(nas_IMEI, dev->dev_addr ,(uint8_t *)gpriv->cx[0].iid6, dev->addr_len);
-#else
-    nasmt_TOOL_imei2iid(nas_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
-    nasmt_TOOL_imei2iid(nas_IMEI, (uint8_t *)gpriv->cx[0].iid6);
-#endif
-
-    nasmt_ASCTL_init();
-  } else {
-    printk("\n\nnasmt_init: ERROR, Device is NULL!!\n");
-  }
-
-  printk("nasmt_init: end\n");
-  return;
-}
-
-//---------------------------------------------------------------------------
-int init_module (void)
-{
-  //---------------------------------------------------------------------------
-  int err;
-  int inst = 0;
-  int index;
-  struct nas_priv *priv;
-  char devicename[100];
-
-  printk("\n\n\ninit_module: begin \n");
-
-  // check IMEI parameter
-  printk("number of IMEI parameters %d, IMEI ", m_arg);
-
-  for (index = 0; index < m_arg;  index++) {
-    printk("%02X ", nas_IMEI[index]);
-  }
-
-  printk("\n");
-
-
-#ifndef PDCP_USE_NETLINK
-
-  // Initialize parameters shared with RRC (done first to avoid going further)
-  if (pt_nas_ue_irq==NULL) {
-    printk("init_module: shared irq parameter not initialised\n");
-    err =  -EBUSY;
-    printk("init_module: returning %d \n\n", err);
-    return err;
-  }
-
-  printk("init_module: pt_nas_ue_irq valid \n");
-#endif
-
-  // Allocate device structure
-  sprintf(devicename,"oai%d",inst);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
-  gdev = alloc_netdev(sizeof(struct nas_priv), devicename, nasmt_init);
-#else
-  gdev = alloc_netdev(sizeof(struct nas_priv), devicename, NET_NAME_PREDICTABLE, nasmt_init);
-#endif
-  priv = netdev_priv(gdev);
-  ////
-#ifndef PDCP_USE_NETLINK
-  priv->irq=rt_request_srq(0, nasmt_interrupt, NULL);
-
-  if (priv->irq == -EBUSY || priv->irq == -EINVAL) {
-    printk("\n init_module: No interrupt resource available\n");
-
-    if (gdev) {
-      free_netdev(gdev);
-      printk("init_module: free_netdev ..\n");
-    }
-
-    return -EBUSY;
-  } else
-    printk("init_module: Interrupt %d, ret = %d \n", priv->irq , ret);
-
-  if (pt_nas_ue_irq==NULL) {
-    printk("init_module: shared irq parameter has been reset\n");
-  } else {
-    *pt_nas_ue_irq=priv->irq;
-  }
-
-#endif
-
-#ifdef PDCP_USE_NETLINK
-
-  if ((err=nasmt_netlink_init()) == -1)
-    printk("init_module: NETLINK failed\n");
-
-  printk("init_module: NETLINK INIT successful\n");
-#endif //NETLINK
-  //
-  err= register_netdev(gdev);
-
-  if (err) {
-    printk("init_module: error %i registering device %s\n", err, gdev->name);
-  } else {
-    printk("init_module: registering device %s, ifindex = %d\n\n",gdev->name, gdev->ifindex);
-  }
-
-  return err;
-}
-
-//---------------------------------------------------------------------------
-void cleanup_module(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_cleanup_module: begin\n");
-  unregister_netdev(gdev);
-  nasmt_teardown(gdev);
-  free_netdev(gdev);
-  printk("nasmt_cleanup_module: end\n\n\n\n");
-}
-
-//---------------------------------------------------------------------------
-// Replaced by init_module and cleanup_module
-//module_init (nasmt_init_module);
-//module_exit (nasmt_cleanup_module);
-//---------------------------------------------------------------------------
-
-#define DRV_NAME        "oai_nasmt"
-#define DRV_VERSION     "3.0.1"DRV_NAME
-#define DRV_DESCRIPTION "OPENAIR CELLULAR LTE NASMT Device Driver"
-#define DRV_COPYRIGHT   "-Copyright(c) GNU GPL Eurecom 2013"
-#define DRV_AUTHOR      "Michelle Wetterwald <michelle.wetterwald@eurecom.fr>"DRV_COPYRIGHT
-
-module_param_array_named(nas_IMEI,nas_IMEI,byte,&m_arg,0);
-//module_param_array(oai_nw_drv_IMEI,byte,&m_arg,0444);
-MODULE_PARM_DESC(nas_IMEI,"Terminal IMEI Identifier (14 digits, only first 10 significant if ETH option ON)");
-
-
-// MODULE_LICENSE("GPL");
-// MODULE_DESCRIPTION("LTE Driver for Mobile Terminal, playing as Non Access Stratum");
-// MODULE_AUTHOR("Michelle Wetterwald <michelle.wetterwald@eurecom.fr>");
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.c
deleted file mode 100644
index 14d598abb79422f487da30c416ea0aae80752238..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.c
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_iocontrol.c
-* \brief I/O control functions for upper layers of driver for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasmt_variables.h"
-#include "nasmt_iocontrol.h"
-#include "nasmt_proto.h"
-
-//#include <linux/in.h>
-#include <asm/uaccess.h>
-#include <asm/checksum.h>
-#include <asm/uaccess.h>
-
-extern int  nasmt_ASCTL_DC_send_cx_establish_request(struct cx_entity *cx);
-
-// Statistic
-//---------------------------------------------------------------------------
-void nasmt_set_msg_statistic_reply(struct nas_msg_statistic_reply *msgrep)
-{
-  //---------------------------------------------------------------------------
-  msgrep->rx_packets=gpriv->stats.rx_packets;
-  msgrep->tx_packets=gpriv->stats.tx_packets;
-  msgrep->rx_bytes=gpriv->stats.rx_bytes;
-  msgrep->tx_bytes=gpriv->stats.tx_bytes;
-  msgrep->rx_errors=gpriv->stats.rx_errors;
-  msgrep->tx_errors=gpriv->stats.tx_errors;
-  msgrep->rx_dropped=gpriv->stats.rx_dropped;
-  msgrep->tx_dropped=gpriv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_statistic_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_statistic_reply msgrep;
-  printk("nasmt_ioCTL_statistic: stat requested\n");
-  nasmt_set_msg_statistic_reply(&msgrep);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_statistic: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connections List
-//---------------------------------------------------------------------------
-void nasmt_set_msg_cx_list_reply(uint8_t *msgrep)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  nasLocalConnectionRef_t lcr;
-  struct nas_msg_cx_list_reply *list;
-  msgrep[0]=NAS_CX_MAX;
-  list=(struct nas_msg_cx_list_reply *)(msgrep+1);
-
-  for(lcr=0; lcr<NAS_CX_MAX; ++lcr) {
-    cx=nasmt_COMMON_search_cx(lcr);
-    list[lcr].lcr=lcr;
-    list[lcr].state=cx->state;
-    list[lcr].cellid=cx->cellid;
-    list[lcr].iid4=cx->iid4;
-    list[lcr].iid6[0]=cx->iid6[0];
-    list[lcr].iid6[1]=cx->iid6[1];
-    list[lcr].num_rb=cx->num_rb;
-    list[lcr].nsclassifier=cx->nsclassifier;
-    printk("nasmt_set_msg_cx_list_reply: nsc=%u\n",cx->nsclassifier);
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_cx_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1];
-  printk("nasmt_ioCTL_cx_list: connection list requested\n");
-  nasmt_set_msg_cx_list_reply(msgrep);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1)) {
-    printk("nasmt_ioCTL_cx_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasmt_ioCTL_cx_list: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connection Establishment
-//---------------------------------------------------------------------------
-void nasmt_set_msg_cx_establishment_reply(struct nas_msg_cx_establishment_reply *msgrep, struct nas_msg_cx_establishment_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-#ifdef NODE_RG
-  msgrep->status=-NAS_ERROR_NOTMT;
-#else
-  struct cx_entity *cx;
-  cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-  if (cx!=NULL) {
-    if (cx->state == NAS_CX_RELEASING) {
-      msgrep->status=nasmt_ASCTL_leave_sleep_mode(cx);
-    } else {
-      cx->cellid=msgreq->cellid;
-      msgrep->status=nasmt_ASCTL_DC_send_cx_establish_request(cx);
-    }
-  } else
-    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-
-#endif
-}
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_cx_establishment_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_cx_establishment_request msgreq;
-  struct nas_msg_cx_establishment_reply msgrep;
-  printk("nasmt_ioCTL_cx_establishment: connection establishment requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_cx_establishment: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_cx_establishment_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_cx_establishment: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connection Release
-//---------------------------------------------------------------------------
-void nasmt_set_msg_cx_release_reply(struct nas_msg_cx_release_reply *msgrep, struct nas_msg_cx_release_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-#ifdef NODE_RG
-  msgrep->status=-NAS_ERROR_NOTMT;
-#else
-  struct cx_entity *cx;
-  cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-  if (cx!=NULL) {
-#ifdef ENABLE_SLEEP_MODE
-    msgrep->status=nasmt_ASCTL_enter_sleep_mode(cx);
-#endif
-#ifndef ENABLE_SLEEP_MODE
-    msgrep->status=nasmt_ASCTL_DC_send_cx_release_request(cx);
-#endif
-  } else
-    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Request the release of a connection
-int nasmt_ioCTL_cx_release_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_cx_release_request msgreq;
-  struct nas_msg_cx_release_reply msgrep;
-
-  printk("nasmt_ioCTL_cx_release: connection release requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_cx_release: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_cx_release_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_cx_release: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasmt_ioCTL_cx_release: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer List
-//---------------------------------------------------------------------------
-void nasmt_set_msg_rb_list_reply(uint8_t *msgrep, struct nas_msg_rb_list_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-  if (cx!=NULL) {
-    uint8_t rbi;
-    struct rb_entity *rb;
-    struct nas_msg_rb_list_reply *list;
-
-    if (cx->num_rb > NAS_LIST_RB_MAX)
-      msgrep[0] = NAS_LIST_RB_MAX;
-    else
-      msgrep[0] = cx->num_rb;
-
-    list=(struct nas_msg_rb_list_reply *)(msgrep+1);
-
-    for (rb=cx->rb, rbi=0; (rb!=NULL)&&(rbi<msgrep[0]); rb=rb->next, ++rbi) {
-      list[rbi].state=rb->state;
-      list[rbi].rab_id=rb->rab_id;
-      list[rbi].sapi=rb->sapi;
-      list[rbi].qos=rb->qos;
-    }
-  } else
-    msgrep[0]=0;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_rb_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1];
-  struct nas_msg_rb_list_request msgreq;
-  printk("nasmt_ioCTL_rb_list: Radio Bearer list requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_rb_list: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_rb_list_reply(msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1)) {
-    printk("nasmt_ioCTL_rb_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasmt_ioCTL_rb_list: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer Establishment
-//---------------------------------------------------------------------------
-void nasmt_set_msg_rb_establishment_reply(struct nas_msg_rb_establishment_reply *msgrep, struct nas_msg_rb_establishment_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  msgrep->status=-NAS_ERROR_NOTRG;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_rb_establishment_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_rb_establishment_request msgreq;
-  struct nas_msg_rb_establishment_reply msgrep;
-  printk("nasmt_ioCTL_rb_establishment: Radio bearer establishment requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_rb_establishment: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_rb_establishment_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_rb_establishment: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer Release
-//---------------------------------------------------------------------------
-void nasmt_set_msg_rb_release_reply(struct nas_msg_rb_release_reply *msgrep, struct nas_msg_rb_release_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  msgrep->status=-NAS_ERROR_NOTRG;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_rb_release_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_rb_release_request msgreq;
-  struct nas_msg_rb_release_reply msgrep;
-  printk("nasmt_ioCTL_rb_release: Radio bearer release requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_rb_release: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_rb_release_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_rb_release: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Classifier List
-//---------------------------------------------------------------------------
-void nasmt_set_msg_class_list_reply(uint8_t *msgrep, struct nas_msg_class_list_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  struct classifier_entity *gc;
-  struct nas_msg_class_list_reply *list;
-  uint8_t cli;
-  list=(struct nas_msg_class_list_reply *)(msgrep+1);
-
-  switch(msgreq->dir) {
-  case NAS_DIRECTION_SEND:
-    cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-    if (cx==NULL) {
-      msgrep[0]=0;
-      return;
-    }
-
-    gc=cx->sclassifier[msgreq->dscp];
-    break;
-
-  case NAS_DIRECTION_RECEIVE:
-    cx=NULL;
-    gc=gpriv->rclassifier[msgreq->dscp];
-    break;
-
-  default:
-    cx=NULL;
-    msgrep[0]=0;
-    return;
-  }
-
-  for (cli=0; (gc!=NULL)&&(cli<NAS_LIST_CLASS_MAX); gc=gc->next, ++cli) {
-    list[cli].classref=gc->classref;
-    list[cli].lcr=msgreq->lcr;
-    list[cli].dir=msgreq->dir;
-    list[cli].dscp=msgreq->dscp;
-    list[cli].rab_id=gc->rab_id;
-    list[cli].version=gc->version;
-
-    switch(gc->version) {
-    case 4:
-      list[cli].saddr.ipv4 = gc->saddr.ipv4;
-      list[cli].daddr.ipv4 = gc->daddr.ipv4;
-      break;
-
-    case 6:
-      list[cli].saddr.ipv6 = gc->saddr.ipv6;
-      list[cli].daddr.ipv6 = gc->daddr.ipv6;
-      break;
-    }
-
-    list[cli].protocol=gc->protocol;
-    list[cli].sport=ntohs(gc->sport);
-    list[cli].dport=ntohs(gc->dport);
-    list[cli].splen=gc->splen;
-    list[cli].dplen=gc->dplen;
-    list[cli].fct=nasmt_TOOL_invfct(gc);
-  }
-
-  msgrep[0]=cli;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_class_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1];
-  struct nas_msg_class_list_request msgreq;
-  printk("nasmt_ioCTL_class_list: classifier list requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_class_list: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_class_list_reply(msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1)) {
-    printk("nasmt_ioCTL_class_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Request the addition of a classifier rule
-//---------------------------------------------------------------------------
-void nasmt_set_msg_class_add_reply(struct nas_msg_class_add_reply *msgrep, struct nas_msg_class_add_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
-    printk("nasmt_set_msg_class_add_reply: Incoherent parameter value\n");
-    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
-    return;
-  }
-
-  if (msgreq->dir==NAS_DIRECTION_SEND) {
-    struct cx_entity *cx;
-    cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL) {
-      printk("nasmt_set_msg_class_add_reply: DSCP %d, Classref %d\n",msgreq->dscp, msgreq->classref );
-      gc=nasmt_CLASS_add_sclassifier(cx, msgreq->dscp, msgreq->classref);
-      printk("nasmt_set_msg_class_add_reply: %p %p\n" , msgreq, gc);
-
-      if (gc==NULL) {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-        return;
-      }
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      return;
-    }
-
-    gc->rab_id=msgreq->rab_id;
-    gc->rb=nasmt_COMMON_search_rb(cx, gc->rab_id);
-  } else {
-    if (msgreq->dir==NAS_DIRECTION_RECEIVE) {
-      gc=nasmt_CLASS_add_rclassifier(msgreq->dscp, msgreq->classref);
-
-      if (gc==NULL) {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-        return;
-      }
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
-      return;
-    }
-  }
-
-  nasmt_TOOL_fct(gc, msgreq->fct);
-  gc->version=msgreq->version;
-
-  switch(gc->version) {
-  case 4:
-    gc->saddr.ipv4=msgreq->saddr.ipv4;
-    gc->daddr.ipv4=msgreq->daddr.ipv4;
-    gc->splen=msgreq->splen;
-    gc->dplen=msgreq->dplen;
-    break;
-
-  case 6:
-    gc->saddr.ipv6=msgreq->saddr.ipv6;
-    gc->daddr.ipv6=msgreq->daddr.ipv6;
-    gc->splen=msgreq->splen;
-    gc->dplen=msgreq->dplen;
-    break;
-
-  case 0:
-    gc->saddr.ipv6.s6_addr32[0]=0;
-    gc->daddr.ipv6.s6_addr32[1]=0;
-    gc->saddr.ipv6.s6_addr32[2]=0;
-    gc->daddr.ipv6.s6_addr32[3]=0;
-    gc->splen=0;
-    gc->dplen=0;
-    break;
-
-  default:
-    msgrep->status=-NAS_ERROR_NOTCORRECTVERSION;
-    kfree(gc);
-    return;
-  }
-
-  gc->protocol=msgreq->protocol;
-  gc->sport=htons(msgreq->sport);
-  gc->dport=htons(msgreq->dport);
-  msgrep->status=0;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_class_add_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_class_add_request msgreq;
-  struct nas_msg_class_add_reply msgrep;
-  printk("nasmt_ioCTL_class_add: Add classifier components requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_class_add: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_class_add_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_class_add: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Request the deletion of a classifier rule
-//---------------------------------------------------------------------------
-void nasmt_set_msg_class_del_reply(struct nas_msg_class_del_reply *msgrep, struct nas_msg_class_del_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
-    printk("nasmt_set_msg_class_del_reply: Incoherent parameter value\n");
-    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
-    return;
-  }
-
-  if (msgreq->dir==NAS_DIRECTION_SEND) {
-    struct cx_entity *cx;
-    cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL)
-      nasmt_CLASS_del_sclassifier(cx, msgreq->dscp, msgreq->classref);
-    else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      return;
-    }
-  } else {
-    if (msgreq->dir==NAS_DIRECTION_RECEIVE)
-      nasmt_CLASS_del_rclassifier(msgreq->dscp, msgreq->classref);
-    else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
-      return;
-    }
-  }
-
-  msgrep->status=0;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_class_del_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_class_del_request msgreq;
-  struct nas_msg_class_del_reply msgrep;
-  printk("nasmt_ioCTL_class_del: Del classifier components requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_class_del: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_class_del_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_class_del: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Measurement
-// Messages for Measurement transfer
-
-//---------------------------------------------------------------------------
-void nasmt_set_msg_measure_reply(struct nas_msg_measure_reply *msgrep, struct nas_msg_measure_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  int lcr=0; // Temp lcr->mt =0
-  int i;
-
-  cx = nasmt_COMMON_search_cx(lcr);
-
-  if (cx!=NULL) {
-    msgrep->num_cells = cx->num_measures;
-
-    for (i=0; i<cx->num_measures; i++) {
-      msgrep-> measures[i].cell_id = cx->meas_cell_id[i];
-      msgrep-> measures[i].level = cx->meas_level[i];
-      msgrep-> measures[i].provider_id = cx->provider_id[i];
-    }
-
-    msgrep->signal_lost_flag = 0;
-  } else {
-    //    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-    //    return;
-  }
-}
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_measure_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_measure_request msgreq;
-  struct nas_msg_measure_reply msgrep;
-  printk("nasmt_ioCTL_measure: Measurement requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_measure: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_measure_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_measure: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// IMEI
-// Messages for IMEI transfer
-//---------------------------------------------------------------------------
-void nasmt_set_msg_imei_reply(struct nas_msg_l2id_reply *msgrep)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  int lcr=0; // Temp lcr->mt =0
-  int i;
-
-  cx=nasmt_COMMON_search_cx(lcr);
-
-  if (cx!=NULL) {
-    msgrep->l2id[0] = cx->iid6[0];
-    msgrep->l2id[1] = cx->iid6[1];
-  } else {
-    //    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-    //    return;
-  }
-}
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_imei_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_l2id_reply msgrep;
-  printk("nasmt_ioCTL_imei: IMEI requested\n");
-  nasmt_set_msg_imei_reply(&msgrep);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_imei: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// IOCTL command
-//---------------------------------------------------------------------------
-int nasmt_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ioctl *gifr;
-  int r;
-  printk("nasmt_CTL_ioctl: begin\n");
-
-  //spin_lock(&gpriv->lock);
-  switch(cmd) {
-  case NASMT_IOCTL_RAL:
-    gifr=(struct nas_ioctl *)ifr;
-
-    switch(gifr->type) {
-    case NAS_MSG_STATISTIC_REQUEST:
-      r=nasmt_ioCTL_statistic_request(gifr);
-      break;
-
-    case NAS_MSG_CX_ESTABLISHMENT_REQUEST:
-      r=nasmt_ioCTL_cx_establishment_request(gifr);
-      break;
-
-    case NAS_MSG_CX_RELEASE_REQUEST:
-      r=nasmt_ioCTL_cx_release_request(gifr);
-      break;
-
-    case NAS_MSG_CX_LIST_REQUEST:
-      r=nasmt_ioCTL_cx_list_request(gifr);
-      break;
-
-    case NAS_MSG_RB_ESTABLISHMENT_REQUEST:
-      r=nasmt_ioCTL_rb_establishment_request(gifr);
-      break;
-
-    case NAS_MSG_RB_RELEASE_REQUEST:
-      r= nasmt_ioCTL_rb_release_request(gifr);
-      break;
-
-    case NAS_MSG_RB_LIST_REQUEST:
-      r=nasmt_ioCTL_rb_list_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_ADD_REQUEST:
-      r=nasmt_ioCTL_class_add_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_LIST_REQUEST:
-      r=nasmt_ioCTL_class_list_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_DEL_REQUEST:
-      r=nasmt_ioCTL_class_del_request(gifr);
-      break;
-
-    case NAS_MSG_MEAS_REQUEST:
-      r=nasmt_ioCTL_measure_request(gifr);
-      break;
-
-    case NAS_MSG_IMEI_REQUEST:
-      r=nasmt_ioCTL_imei_request(gifr);
-      break;
-
-    default:
-      printk("nasmt_CTL_ioctl: unkwon request type, type=%x\n", gifr->type);
-      r=-EFAULT;
-    }
-
-    break;
-
-  default:
-    printk("nasmt_CTL_ioctl: Unknown ioctl command, cmd=%x\n", cmd);
-    r=-EFAULT;
-  }
-
-  //spin_unlock(&gpriv->lock);
-  printk("nasmt_CTL_ioctl: end\n");
-  return r;
-}
-
-//---------------------------------------------------------------------------
-void nasmt_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_CTL_send - void \n");
-}
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.h
deleted file mode 100644
index 924f442341a2e2bbbded39e44e5be04b4a6f7e03..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_iocontrol.h
-* \brief I/O control constnats and structures for upper layers of driver for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef NASMTD_CTL_H
-#define NASMTD_CTL_H
-
-#include <asm/byteorder.h>
-#include <asm/types.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-
-#define NAS_MSG_MAXLEN 1100
-
-// type of CTL message
-#define NAS_MSG_STATISTIC_REQUEST   1
-#define NAS_MSG_STATISTIC_REPLY     2
-#define NAS_MSG_ECHO_REQUEST        3
-#define NAS_MSG_ECHO_REPLY          4
-#define NAS_MSG_CX_ESTABLISHMENT_REQUEST  5
-#define NAS_MSG_CX_ESTABLISHMENT_REPLY    6
-#define NAS_MSG_CX_RELEASE_REQUEST  7
-#define NAS_MSG_CX_RELEASE_REPLY    8
-#define NAS_MSG_CX_LIST_REQUEST     9
-#define NAS_MSG_CX_LIST_REPLY      10
-#define NAS_MSG_RB_ESTABLISHMENT_REQUEST  11
-#define NAS_MSG_RB_ESTABLISHMENT_REPLY    12
-#define NAS_MSG_RB_RELEASE_REQUEST  13
-#define NAS_MSG_RB_RELEASE_REPLY    14
-#define NAS_MSG_RB_LIST_REQUEST    15
-#define NAS_MSG_RB_LIST_REPLY      16
-#define NAS_MSG_CLASS_ADD_REQUEST  17
-#define NAS_MSG_CLASS_ADD_REPLY    18
-#define NAS_MSG_CLASS_DEL_REQUEST  19
-#define NAS_MSG_CLASS_DEL_REPLY    20
-#define NAS_MSG_CLASS_LIST_REQUEST  21
-#define NAS_MSG_CLASS_LIST_REPLY    22
-#define NAS_MSG_MEAS_REQUEST  23
-#define NAS_MSG_MEAS_REPLY    24
-#define NAS_MSG_IMEI_REQUEST  25
-#define NAS_MSG_IMEI_REPLY    26
-
-// Max number of entry of a message list
-#define NAS_LIST_CX_MAX  32
-#define NAS_LIST_RB_MAX  32
-#define NAS_LIST_CLASS_MAX  32
-
-typedef uint16_t nasMsgType_t;
-
-struct nas_ioctl {
-  char name[IFNAMSIZ];
-  nasMsgType_t type;
-  char *msg;
-};
-
-struct nas_msg_statistic_reply {
-  uint32_t rx_packets;
-  uint32_t tx_packets;
-  uint32_t rx_bytes;
-  uint32_t tx_bytes;
-  uint32_t rx_errors;
-  uint32_t tx_errors;
-  uint32_t rx_dropped;
-  uint32_t tx_dropped;
-};
-
-struct nas_msg_cx_list_reply {
-  nasLocalConnectionRef_t lcr;   // Local Connection reference
-  uint8_t state;
-  nasCellID_t cellid;    // cell identification
-  uint32_t iid6[2];       // IPv6  interface identification
-  uint8_t iid4;       // IPv4 interface identification
-  uint16_t num_rb;
-  uint16_t nsclassifier;
-};
-struct nas_msg_cx_establishment_reply {
-  int status;
-};
-struct nas_msg_cx_establishment_request {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-  nasCellID_t cellid; // Cell identification
-};
-struct nas_msg_cx_release_reply {
-  int status;
-};
-struct nas_msg_cx_release_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-};
-
-struct nas_msg_rb_list_reply {
-  nasRadioBearerId_t rab_id;
-  nasSapId_t sapi;
-  nasQoSTrafficClass_t qos;
-  uint8_t state;
-};
-struct nas_msg_rb_list_request {
-  nasLocalConnectionRef_t lcr;   // Local Connection reference
-};
-struct nas_msg_rb_establishment_reply {
-  int status;
-};
-struct nas_msg_rb_establishment_request {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  nasQoSTrafficClass_t qos;
-};
-
-struct nas_msg_rb_release_reply {
-  int status;
-};
-struct nas_msg_rb_release_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-};
-
-struct nas_msg_class_add_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  uint8_t dir; // direction (send or receive)
-  uint8_t dscp; // codepoint
-  uint8_t fct;
-  uint16_t classref;
-  uint8_t version;
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } saddr; // IP source address
-  uint8_t splen; // prefix length
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } daddr; // IP destination address
-  uint8_t dplen; // prefix length
-  uint8_t protocol;   // high layer protocol type
-  uint16_t sport;   // source port
-  uint16_t dport;   // destination port
-};
-struct nas_msg_class_add_reply {
-  int status;
-};
-struct nas_msg_class_del_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  uint8_t dir; // direction (send or receive)
-  uint8_t dscp; // codepoint
-  uint16_t classref;
-};
-struct nas_msg_class_del_reply {
-  int status;
-};
-#define nas_msg_class_list_reply nas_msg_class_add_request
-struct nas_msg_class_list_request {
-  nasLocalConnectionRef_t lcr;   // Local Connection reference
-  uint8_t dir;
-  uint8_t dscp;
-};
-
-
-// Messages for Measurement transfer - MW 01/04/2005
-typedef uint32_t nioctlProviderId_t;
-typedef uint16_t nioctlSignalLoss_t;
-typedef struct nioctlMeasures {
-  nasCellID_t cell_id;
-  nasSigLevel_t level;
-  nioctlProviderId_t provider_id;
-} nioctlMeasures_t;
-
-struct nas_msg_measure_request {
-  nasNumRGsMeas_t num_cells;
-  nasCellID_t cellid[MAX_MEASURE_NB]; // Cell identification
-  uint16_t num_providers;
-  nioctlProviderId_t provider_id[MAX_MEASURE_NB]; // Provider identification
-};
-struct nas_msg_measure_reply {
-  nasNumRGsMeas_t num_cells;
-  nioctlMeasures_t measures[MAX_MEASURE_NB];
-  nioctlSignalLoss_t signal_lost_flag;
-};
-
-// Messages for L2Id transfer - MW
-typedef uint32_t nioctlL2Id_t[2];
-
-struct nas_msg_l2id_reply {
-  nioctlL2Id_t l2id;
-};
-
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_netlink.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_netlink.c
deleted file mode 100644
index 13c50570b4b6b305bd90cde209a93dc16aefbf65..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_netlink.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_netlink.c
-* \brief Netlink socket functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-//#include <linux/config.h>
-#include <linux/socket.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/netlink.h>
-#include <net/sock.h>
-#include <linux/kthread.h>
-
-#include <linux/mutex.h>
-
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-static struct sock *nas_nl_sk = NULL;
-static struct sock *nas_rrcnl_sk = NULL;
-
-//static int exit_netlink_thread=0;
-static DEFINE_MUTEX(nasmt_mutex);
-
-// This can also be implemented using thread to get the data from PDCP without blocking.
-//---------------------------------------------------------------------------
-// Function for transfer with PDCP (from NASLITE)
-static void nasmt_nl_data_ready (struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nlmsghdr *nlh = NULL;
-
-  // Start debug information
-#ifdef NETLINK_DEBUG
-  printk("nasmt_nl_data_ready - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasmt_nl_data_ready - input parameter skb is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-#ifdef NETLINK_DEBUG
-  printk("nasmt_nl_data_ready - Received socket from PDCP\n");
-#endif //NETLINK_DEBUG
-  nlh = (struct nlmsghdr *)skb->data;
-  nasmt_COMMON_QOS_receive(nlh);
-}
-
-//---------------------------------------------------------------------------
-//  Function for transfer with RRC
-static void nasmt_rrcnl_data_ready (struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nlmsghdr *nlh = NULL;
-  char target_sap;
-  uint8_t cxi = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RRCNL
-  printk("nasmt_rrcnl_data_ready - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasmt_rrcnl_data_ready - input parameter skb is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  nlh = (struct nlmsghdr *)skb->data;
-  //pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
-  //nasmt_TOOL_print_buffer((char *)NLMSG_DATA(nlh), 48);
-
-  target_sap = ((char*)NLMSG_DATA(nlh))[0];
-#ifdef NAS_DEBUG_RRCNL
-  printk("nasmt_rrcnl_data_ready - Received on socket from RRC, SAP %d\n", target_sap);
-#endif //NAS_DEBUG_RRCNL
-
-  switch (target_sap) {
-  case RRC_NAS_GC_OUT:
-    //printk("nasmt_rrcnl_data_ready - Calling  nasmt_ASCTL_GC_receive\n");
-    nasmt_ASCTL_GC_receive(&((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  case RRC_NAS_DC0_OUT:
-    //printk("nasmt_rrcnl_data_ready - Calling  nasmt_ASCTL_DC_receive\n");
-    nasmt_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  default:
-    printk("nasmt_rrcnl_data_ready - Invalid SAP value received\n");
-  }
-
-}
-
-//---------------------------------------------------------------------------
-int nasmt_netlink_init(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_netlink_init - begin \n");
-
-  nas_nl_sk = netlink_kernel_create(&init_net,OAI_IP_DRIVER_NETLINK_ID, 0, nasmt_nl_data_ready,
-                                    &nasmt_mutex, // NULL
-                                    THIS_MODULE);
-
-  if (!nas_nl_sk) {
-    printk("nasmt_netlink_init - netlink_kernel_create failed for PDCP socket\n");
-    return(-1);
-  }
-
-  nas_rrcnl_sk = netlink_kernel_create(&init_net,NAS_RRCNL_ID, 0, nasmt_rrcnl_data_ready,
-                                       &nasmt_mutex, // NULL
-                                       THIS_MODULE);
-
-  if (!nas_rrcnl_sk) {
-    printk("nasmt_rrcnl_init - netlink_kernel_create failed for RRC socket\n");
-    return(-1);
-  }
-
-  return(0);
-}
-
-//---------------------------------------------------------------------------
-void nasmt_netlink_release(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_netlink_release - begin \n");
-
-  //exit_netlink_thread=1;
-  printk("nasmt_netlink_release - Releasing netlink sockets\n");
-
-  if(nas_nl_sk) {
-    netlink_kernel_release(nas_nl_sk);
-  }
-
-  if(nas_rrcnl_sk) {
-    netlink_kernel_release(nas_rrcnl_sk);
-  }
-
-}
-
-//---------------------------------------------------------------------------
-int nasmt_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination)
-{
-  //---------------------------------------------------------------------------
-  struct sk_buff *nl_skb;
-  struct nlmsghdr *nlh;
-  int status;
-  // Start debug information
-#ifdef NETLINK_DEBUG
-  printk("nasmt_netlink_send - begin \n");
-#endif
-
-  if (!data_buffer) {
-    printk("nasmt_netlink_send - ERROR - input parameter data is NULL \n");
-    return(0);
-  }
-
-  if (!nas_nl_sk || !nas_rrcnl_sk) {
-    printk("nasmt_netlink_send - ERROR - socket is NULL\n");
-    return(0);
-  }
-
-  // End debug information
-
-  nl_skb = alloc_skb(NLMSG_SPACE(data_length),GFP_ATOMIC);
-
-  if (!nl_skb) {
-    printk("nasmt_netlink_send - ERROR - could not allocate skbuffer\n");
-    return(0);
-  }
-
-  nlh = (struct nlmsghdr *)nl_skb->data;
-
-  //  printk("nasmt_netlink_send Sending %d bytes (%d)\n",data_length,NLMSG_SPACE(data_length));
-  skb_put(nl_skb, NLMSG_SPACE(data_length));
-  memcpy(NLMSG_DATA(nlh), data_buffer, data_length);
-  nlh->nlmsg_len = NLMSG_SPACE(data_length);
-
-  nlh->nlmsg_pid = 0;      /* from kernel */
-  NETLINK_CB(nl_skb).pid = 0;
-
-  // destination 0 = PDCP, 1 = RRC
-  if (!destination) {
-#ifdef NETLINK_DEBUG
-    printk("nasmt_netlink_send - nl_skb %p, nl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_nl_sk, nlh, nlh->nlmsg_len);
-#endif //DEBUG_NETLINK
-    status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
-  } else {
-#ifdef NAS_DEBUG_RRCNL
-    printk("nasmt_rrcnl_send - nl_skb %p, nas_rrcnl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_rrcnl_sk, nlh, nlh->nlmsg_len);
-#endif //NAS_DEBUG_RRCNL
-    status = netlink_unicast(nas_rrcnl_sk, nl_skb, NL_DEST_RRC_PID, MSG_DONTWAIT);
-  }
-
-  if (status < 0) {
-    printk("nasmt_netlink_send - SEND status is %d\n",status);
-    return(0);
-  } else {
-#ifdef NETLINK_DEBUG
-    printk("nasmt_netlink_send - SEND status is %d, data_length %d\n",status, data_length);
-#endif
-    return data_length;
-  }
-}
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h
deleted file mode 100644
index ec7f7ec2cce5bd112a7c6c6d97eef6a39e114c58..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_proto.h
-* \brief Function prototypes for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASMTD_PROTO_H
-#define _NASMTD_PROTO_H
-
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/ipv6.h>
-#include <linux/ip.h>
-#include <linux/sysctl.h>
-#include <linux/timer.h>
-#include <asm/param.h>
-//#include <sys/sysctl.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/in.h>
-#include <net/ndisc.h>
-
-//#include "rrc_nas_primitives.h"
-//#include "protocol_vars_extern.h"
-//#include "as_sap.h"
-//#include "rrc_qos.h"
-//#include "rrc_sap.h"
-
-// nasmt_netlink.c
-void nasmt_netlink_release(void);
-int nasmt_netlink_init(void);
-int nasmt_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination);
-
-// nasmt_common.c
-//void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlength, int sap);
-void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-
-void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-void nasmt_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-#ifndef PDCP_USE_NETLINK
-void nasmt_COMMON_QOS_receive(struct cx_entity *cx);
-#else
-void nasmt_COMMON_QOS_receive(struct nlmsghdr *nlh);
-#endif
-struct rb_entity *nasmt_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rabi, nasQoSTrafficClass_t qos);
-struct rb_entity *nasmt_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rabi);
-struct cx_entity *nasmt_COMMON_search_cx(nasLocalConnectionRef_t lcr);
-void nasmt_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp);
-void nasmt_COMMON_flush_rb(struct cx_entity *cx);
-
-
-//nasmt_ascontrol.c
-void nasmt_ASCTL_init(void);
-void nasmt_ASCTL_timer(unsigned long data);
-int  nasmt_ASCTL_DC_receive(struct cx_entity *cx, char *buffer);
-int  nasmt_ASCTL_GC_receive(char *buffer);
-int  nasmt_ASCTL_DC_send_cx_establish_request(struct cx_entity *cx);
-int  nasmt_ASCTL_DC_send_cx_release_request(struct cx_entity *cx);
-void nasmt_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-void nasmt_ASCTL_DC_send_peer_sig_data_request(struct cx_entity *cx, uint8_t sig_category);
-int nasmt_ASCTL_leave_sleep_mode(struct cx_entity *cx);
-int nasmt_ASCTL_enter_sleep_mode(struct cx_entity *cx);
-
-// nasmt_iocontrol.c
-void nasmt_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-int nasmt_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-
-// nasmt_classifier.c
-void nasmt_CLASS_send(struct sk_buff *skb);
-struct classifier_entity *nasmt_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref);
-struct classifier_entity *nasmt_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref);
-void nasmt_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref);
-void nasmt_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref);
-void nasmt_CLASS_flush_sclassifier(struct cx_entity *cx);
-void nasmt_CLASS_flush_rclassifier(void);
-
-// nasmt_tool.c
-uint8_t nasmt_TOOL_invfct(struct classifier_entity *gc);
-void nasmt_TOOL_fct(struct classifier_entity *gc, uint8_t fct);
-void nasmt_TOOL_imei2iid(uint8_t *imei, uint8_t *iid);
-
-void nasmt_TOOL_eth_imei2iid(unsigned char *imei, unsigned char *addr ,unsigned char *iid, unsigned char len);
-uint8_t nasmt_TOOL_get_dscp6(struct ipv6hdr *iph);
-uint8_t nasmt_TOOL_get_dscp4(struct iphdr *iph);
-uint8_t *nasmt_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol);
-uint8_t *nasmt_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol);
-
-void nasmt_TOOL_pk_icmp6(struct icmp6hdr *icmph);
-
-void nasmt_TOOL_print_state(uint8_t state);
-void nasmt_TOOL_print_buffer(unsigned char * buffer,int length);
-void nasmt_TOOL_print_rb_entity(struct rb_entity *rb);
-void nasmt_TOOL_print_classifier(struct classifier_entity *gc);
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_sap.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_sap.h
deleted file mode 100644
index 83874b375d04041504250476849f3041b6a32c33..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_sap.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_sap.h
-* \brief SAP constants for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASMTD_SAP_H
-#define _NASMTD_SAP_H
-
-// RT-FIFO identifiers ** must be identical to Access Stratum as_sap.h and rrc_sap.h
-#define RRC_DEVICE_GC          RRC_SAPI_UE_GCSAP
-#define RRC_DEVICE_NT          RRC_SAPI_UE_NTSAP
-#define RRC_DEVICE_DC_INPUT0   RRC_SAPI_UE_DCSAP_IN
-#define RRC_DEVICE_DC_OUTPUT0  RRC_SAPI_UE_DCSAP_OUT
-
-//#define QOS_DEVICE_CONVERSATIONAL_INPUT  QOS_SAPI_CONVERSATIONAL_INPUT_MT
-//#define QOS_DEVICE_CONVERSATIONAL_OUTPUT QOS_SAPI_CONVERSATIONAL_OUTPUT_MT
-
-#define PDCP2PDCP_USE_RT_FIFO 21
-#define NAS2PDCP_FIFO 22
-
-//FIFO indexes in control blocks
-#define NAS_DC_INPUT_SAPI    0
-#define NAS_DC_OUTPUT_SAPI   1
-#define NAS_SAPI_CX_MAX      2
-
-#define NAS_GC_SAPI         0
-#define NAS_NT_SAPI         1
-#define NAS_DRB_INPUT_SAPI  2  //NAS_CO_INPUT_SAPI
-#define NAS_DRB_OUTPUT_SAPI 3  //NAS_CO_OUTPUT_SAPI
-#define NAS_SAPI_MAX        4
-
-//#define NAS_QOS_CONVERSATIONAL UMTS_TRAFFIC_CONVERSATIONAL
-//
-
-/* Defined in RRC
-#define RRC_NAS_GC_IN   0
-#define RRC_NAS_GC_OUT  1
-#define RRC_NAS_NT_IN   2
-#define RRC_NAS_NT_OUT  3
-#define RRC_NAS_DC0_IN  4
-#define RRC_NAS_DC0_OUT 5
-#define RRC_NAS_DC1_IN  6
-#define RRC_NAS_DC1_OUT 7
-#define RRC_NAS_DC2_IN  8
-#define RRC_NAS_DC2_OUT 9
-*/
-#endif
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_tool.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_tool.c
deleted file mode 100644
index c4e8ed284c3c1decfe9293f80e91f810c225e0dd..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_tool.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/***************************************************************************
-                          nasmt_tool.c  -  description
- ***************************************************************************
-
- ***************************************************************************/
-/*! \file nasmt_tool.c
-* \brief Tool functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-//---------------------------------------------------------------------------
-//
-void nasmt_TOOL_fct(struct classifier_entity *gc, uint8_t fct)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_fct - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasmt_TOOL_fct - input parameter gc is NULL \n");
-    return;
-  }
-
-  // End debug information
-  switch(fct) {
-  case NAS_FCT_QOS_SEND:
-    gc->fct=nasmt_COMMON_QOS_send;
-    break;
-
-  case NAS_FCT_CTL_SEND:
-    gc->fct=nasmt_CTL_send;
-    break;
-
-  case NAS_FCT_DC_SEND:
-    gc->fct=nasmt_ASCTL_DC_send_sig_data_request;
-    break;
-
-  case NAS_FCT_DEL_SEND:
-    gc->fct=nasmt_COMMON_del_send;
-    break;
-
-  default:
-    gc->fct=nasmt_COMMON_del_send;
-  }
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasmt_TOOL_invfct(struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_invfct - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasmt_TOOL_invfct - input parameter gc is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  if (gc->fct==nasmt_COMMON_QOS_send)
-    return NAS_FCT_QOS_SEND;
-
-  if (gc->fct==nasmt_CTL_send)
-    return NAS_FCT_CTL_SEND;
-
-  if (gc->fct==nasmt_COMMON_del_send)
-    return NAS_FCT_DEL_SEND;
-
-  if (gc->fct==nasmt_ASCTL_DC_send_sig_data_request)
-    return NAS_FCT_DC_SEND;
-
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasmt_TOOL_get_dscp6(struct ipv6hdr *iph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_get_dscp6 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasmt_TOOL_get_dscp6 - input parameter ipv6hdr is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  //  return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>22; //Yan
-  return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>20;
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasmt_TOOL_get_dscp4(struct iphdr *iph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_get_dscp4 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasmt_TOOL_get_dscp4 - input parameter ipv4hdr is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  return ((iph->tos)>>5)<<3;
-}
-
-
-//---------------------------------------------------------------------------
-uint8_t *nasmt_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol)
-{
-  //---------------------------------------------------------------------------
-  uint16_t size;
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_get_protocol6 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasmt_TOOL_get_protocol6 - input parameter ipv6hdr is NULL \n");
-    return NULL;
-  }
-
-  if (protocol==NULL) {
-    printk("nasmt_TOOL_get_protocol6 - input parameter protocol is NULL \n");
-    return NULL;
-  }
-
-  // End debug information
-  *protocol=iph->nexthdr;
-  size=NAS_IPV6_SIZE;
-
-  while (1) {
-    switch(*protocol) {
-    case IPPROTO_UDP:
-    case IPPROTO_TCP:
-    case IPPROTO_ICMPV6:
-      return (uint8_t *)((uint8_t *)iph+size);
-
-    case IPPROTO_HOPOPTS:
-    case IPPROTO_ROUTING:
-    case IPPROTO_DSTOPTS:
-      *protocol=((uint8_t *)iph+size)[0];
-      size+=((uint8_t *)iph+size)[1]*8+8;
-      break;
-
-    case IPPROTO_FRAGMENT:
-      *protocol=((uint8_t *)iph+size)[0];
-      size+=((uint8_t *)iph+size)[1]+8;
-      break;
-
-    case IPPROTO_NONE:
-    case IPPROTO_AH:
-    case IPPROTO_ESP:
-    default:
-      return NULL;
-    }
-  }
-}
-
-//---------------------------------------------------------------------------
-uint8_t *nasmt_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_get_protocol4 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasmt_TOOL_get_protocol4 - input parameter iph is NULL \n");
-    return NULL;
-  }
-
-  if (protocol==NULL) {
-    printk("nasmt_TOOL_get_protocol4 - input parameter protocol is NULL \n");
-    return NULL;
-  }
-
-  // End debug information
-  *protocol=iph->protocol;
-
-  switch(*protocol) {
-  case IPPROTO_UDP:
-  case IPPROTO_TCP:
-  case IPPROTO_ICMP:
-    return (uint8_t *)((uint8_t *)iph+iph->tot_len);
-
-  default:
-    return NULL;
-  }
-}
-
-//---------------------------------------------------------------------------
-// Convert the IMEI to iid
-void nasmt_TOOL_imei2iid(uint8_t *imei, uint8_t *iid)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_imei2iid - begin \n");
-#endif
-
-  if (imei==NULL) {
-    printk("nasmt_TOOL_imei2iid - input parameter imei is NULL \n");
-    return;
-  }
-
-  if (iid==NULL) {
-    printk("nasmt_TOOL_imei2iid - input parameter iid is NULL \n");
-    return;
-  }
-
-  // End debug information
-  memset(iid, 0, NAS_ADDR_LEN);
-  iid[0] = 0x03;
-  iid[1] = 16*imei[0]+imei[1];
-  iid[2] = 16*imei[2]+imei[3];
-  iid[3] = 16*imei[4]+imei[5];
-  iid[4] = 16*imei[6]+imei[7];
-  iid[5] = 16*imei[8]+imei[9];
-  iid[6] = 16*imei[10]+imei[11];
-  iid[7] = 16*imei[12]+imei[13];
-}
-
-//---------------------------------------------------------------------------
-// Convert the IMEI to iid
-void nasmt_TOOL_eth_imei2iid(unsigned char *imei, unsigned char *addr ,unsigned char *iid, unsigned char len)
-{
-  //---------------------------------------------------------------------------
-  unsigned int index;
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_eth_imei2iid - begin \n");
-#endif
-
-  if (!imei || !addr || !iid) {
-    printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter imei, addr or iid is NULL \n");
-    return;
-  }
-
-  // End debug information
-  // set addr (should be device HW address)
-  memset(addr, 0, len);
-  addr[0] = 0x00;  // to be compatible between link local and global
-
-  // len -1 because of insertion of 0 above
-  for (index = 0; index < (len-1); index++) {
-    addr[index+1] = 16*imei[index*2]+imei[index*2+1];
-  }
-
-  // set iid6
-  memset(iid, 0, NAS_ADDR_LEN);
-  iid[0] = 0x02;
-  iid[1] = 16*imei[0]+imei[1];
-  iid[2] = 16*imei[2]+imei[3];
-  iid[3] = 0xff;
-  iid[4] = 0xfe;
-  iid[5] = 16*imei[4]+imei[5];
-  iid[6] = 16*imei[6]+imei[7];
-  iid[7] = 16*imei[8]+imei[9];
-
-}
-
-//---------------------------------------------------------------------------
-void nasmt_TOOL_pk_icmp6(struct icmp6hdr *icmph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef GRAAL_DEBUG_TOOL
-  printk("nasmt_TOOL_pk_icmp6 - begin \n");
-#endif
-
-  if (!icmph) {
-    printk("nasmt_TOOL_pk_icmp6 - input parameter icmph is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
-
-  switch(icmph->icmp6_type) {
-  case ICMPV6_DEST_UNREACH:
-    printk("Destination unreachable\n");
-    break;
-
-  case ICMPV6_PKT_TOOBIG:
-    printk("Packet too big\n");
-    break;
-
-  case ICMPV6_TIME_EXCEED:
-    printk("Time exceeded\n");
-    break;
-
-  case ICMPV6_PARAMPROB:
-    printk("Parameter problem\n");
-    break;
-
-  case ICMPV6_ECHO_REQUEST:
-    printk("Echo request\n");
-    break;
-
-  case ICMPV6_ECHO_REPLY:
-    printk("Echo reply\n");
-    break;
-
-  case ICMPV6_MGM_QUERY:
-    printk("Multicast listener query\n");
-    break;
-
-  case ICMPV6_MGM_REPORT:
-    printk("Multicast listener report\n");
-    break;
-
-  case ICMPV6_MGM_REDUCTION:
-    printk("Multicast listener done\n");
-    break;
-
-  case NDISC_ROUTER_SOLICITATION:
-    printk("Router solicitation\n");
-    break;
-
-  case NDISC_ROUTER_ADVERTISEMENT:
-    printk("Router advertisment\n");
-    break;
-
-  case NDISC_NEIGHBOUR_SOLICITATION:
-    printk("Neighbour solicitation\n");
-    break;
-
-  case NDISC_NEIGHBOUR_ADVERTISEMENT:
-    printk("Neighbour advertisment\n");
-    break;
-
-  case NDISC_REDIRECT:
-    printk("redirect message\n");
-    break;
-  }
-}
-
-//---------------------------------------------------------------------------
-void nasmt_TOOL_print_state(uint8_t state)
-{
-  //---------------------------------------------------------------------------
-  switch(state) {
-  case  NAS_IDLE:
-    printk("NAS_IDLE\n");
-    return;
-
-  case  NAS_CX_FACH:
-    printk("NAS_CX_FACH\n");
-    return;
-
-  case  NAS_CX_DCH:
-    printk("NAS_CX_DCH\n");
-    return;
-
-  case  NAS_CX_RECEIVED:
-    printk("NAS_CX_RECEIVED\n");
-    return;
-
-  case  NAS_CX_CONNECTING:
-    printk("NAS_CX_CONNECTING\n");
-    return;
-
-  case  NAS_CX_RELEASING:
-    printk("NAS_CX_RELEASING\n");
-    return;
-
-  case  NAS_CX_CONNECTING_FAILURE:
-    printk("NAS_CX_CONNECTING_FAILURE\n");
-    return;
-
-  case  NAS_CX_RELEASING_FAILURE:
-    printk("NAS_CX_RELEASING_FAILURE\n");
-    return;
-
-  case  NAS_RB_ESTABLISHING:
-    printk("NAS_RB_ESTABLISHING\n");
-    return;
-
-  case  NAS_RB_RELEASING:
-    printk("NAS_RB_RELEASING\n");
-    return;
-
-  case  NAS_RB_DCH:
-    printk("NAS_RB_DCH\n");
-    return;
-
-  default:
-    printk("nasmt_TOOL_print_state - Unknown state\n");
-  }
-}
-
-//-----------------------------------------------------------------------------
-// Print the content of a buffer in hexadecimal
-void nasmt_TOOL_print_buffer(unsigned char * buffer,int length)
-{
-  //-----------------------------------------------------------------------------
-  int i;
-
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_print_buffer - begin \n");
-#endif
-
-  if (buffer==NULL) {
-    printk("nasmt_TOOL_print_buffer - input parameter buffer is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nBuffer content: ");
-
-  for (i=0; i<length; i++)
-    printk("-%hx-",buffer[i]);
-
-  printk(",\t length %d\n", length);
-}
-//-----------------------------------------------------------------------------
-void nasmt_TOOL_print_rb_entity(struct rb_entity *rb)
-{
-  //-----------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_print_rb_entity - begin \n");
-#endif
-
-  if (rb==NULL) {
-    printk("nasmt_TOOL_print_rb_entity - input parameter rb is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, dscp %d, \n", rb->rab_id, rb->sapi, rb->qos, rb->dscp);
-  printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
-};
-
-//-----------------------------------------------------------------------------
-void nasmt_TOOL_print_classifier(struct classifier_entity *gc)
-{
-  //-----------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_print_classifier - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasmt_TOOL_print_classifier - input parameter gc is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", gc->classref, gc->version, gc->splen, gc->dplen);
-  printk("protocol %d, sport %d, dport %d, rab_id %d\n", gc->protocol, gc->sport, gc->dport, gc->rab_id);
-  nasmt_TOOL_print_rb_entity(gc->rb);
-};
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_variables.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_variables.h
deleted file mode 100644
index 130488bca6be95862ab52afa014deeb18f2c766e..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_variables.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_variables.h
-* \brief Variable and structure definitions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASMTD_VAR_H
-#define _NASMTD_VAR_H
-
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/ipv6.h>
-#include <linux/ip.h>
-#include <linux/sysctl.h>
-#include <linux/timer.h>
-#include <linux/unistd.h>
-#include <asm/param.h>
-//#include <sys/sysctl.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/in.h>
-#include <net/ndisc.h>
-
-#include "rrc_nas_primitives.h"
-#include "rrc_qos_classes.h"
-#include "rrc_nas_sap.h"
-
-#include "nasmt_constant.h"
-#include "nasmt_sap.h"
-
-struct cx_entity;
-
-struct rb_entity {
-  uint32_t   cnxid;
-  nasRadioBearerId_t rab_id;  //ue_rbId
-  nasSapId_t sapi;
-  nasQoSTrafficClass_t qos;
-  nasQoSTrafficClass_t RadioQosClass;
-  nasIPdscp_t dscp;
-  uint8_t state;
-  uint8_t result;
-  uint8_t retry;
-  uint32_t countimer;
-  struct rb_entity *next;
-};
-
-struct classifier_entity {
-  uint32_t classref;               // classifier identity
-  uint8_t version;                 // IP version 4 or 6
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } saddr;                    // IP source address
-  uint8_t splen;                   // IP prefix size
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } daddr;                    // IP destination address
-  uint8_t dplen;                   // IP prefix size
-  uint8_t protocol;                 // layer 4 protocol type (tcp, udp, ...)
-  uint16_t sport;                   // source port
-  uint16_t dport;                   // destination port
-  struct rb_entity *rb;
-  nasRadioBearerId_t rab_id;  // RAB identification
-  void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-  struct classifier_entity *next;
-};
-
-
-struct cx_entity {
-  int sap[NAS_SAPI_CX_MAX];
-  uint8_t state;                     // state of the connection
-  nasLocalConnectionRef_t lcr;  // Local connection reference
-  nasCellID_t cellid;           // cell identification
-  uint32_t countimer;                // timeout's counter
-  uint8_t retry;                     // number of retransmissions
-  struct classifier_entity *sclassifier[NAS_DSCP_MAX]; // send classifiers table
-  uint16_t nsclassifier;
-  uint32_t iid6[2];                  // IPv6  interface identification
-  uint8_t iid4;                      // IPv4 interface identification
-  struct rb_entity *rb;
-  uint16_t num_rb;
-  //measures
-  int req_prov_id[MAX_MEASURE_NB];
-  int num_measures;
-  int meas_cell_id[MAX_MEASURE_NB];
-  int meas_level[MAX_MEASURE_NB];
-  int provider_id[MAX_MEASURE_NB];
-  //MBMS
-  int joined_services[NASMT_MBMS_SVCES_MAX];
-
-};
-
-struct nas_priv {
-  int irq;
-  int rx_flags;
-  struct timer_list timer;
-  spinlock_t lock;
-  struct net_device_stats stats;
-  uint8_t retry_limit;
-  uint32_t timer_establishment;
-  uint32_t timer_release;
-  struct cx_entity cx[NAS_CX_MAX];
-  struct classifier_entity *rclassifier[NAS_DSCP_MAX]; // receive classifier
-  uint16_t nrclassifier;
-  uint32_t next_sclassref;
-  int sap[NAS_SAPI_MAX];
-  uint8_t xbuffer[NAS_MAX_LENGTH]; // transmission buffer
-  uint8_t rbuffer[NAS_MAX_LENGTH]; // reception buffer
-};
-
-struct ipversion {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-  uint8_t    reserved:4,
-             version:4;
-#else
-  uint8_t    version:4,
-             reserved:4;
-#endif
-};
-
-typedef struct pdcp_data_req_header_t {
-  unsigned int             rb_id;
-  unsigned int           data_size;
-  int            inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
-  unsigned int            rb_id;
-  unsigned int           data_size;
-  int            inst;
-} pdcp_data_ind_header_t;
-//
-
-extern struct nas_priv *gpriv;
-extern struct net_device *gdev;
-//extern int bytes_wrote;
-//extern int bytes_read;
-
-extern uint8_t NAS_NULL_IMEI[14];
-extern uint8_t NAS_RG_IMEI[14];
-
-//global variables shared with RRC
-extern int *pt_nas_ue_irq;
-//extern uint8_t nas_IMEI[14];
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/Makefile b/openair2/NAS/DRIVER/CELLULAR/NASRG/Makefile
deleted file mode 100755
index 758fa0420b0220e949ebae6266e6a11e403e1926..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-# NAS CELLULAR Driver makefile
-#
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-####################################################
-#  D E B U G   F L A G S
-####################################################
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-EXTRA_CFLAGS = -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) 
-
-ifdef ADDRCONF
-EXTRA_CFLAGS += -DADDRCONF
-endif
-
-ifdef NAS_DRIVER_TYPE_ETHERNET
-EXTRA_CFLAGS += -DNAS_DRIVER_TYPE_ETHERNET 
-endif
-
-
-ifdef PDCP_USE_NETLINK
-EXTRA_CFLAGS += -DPDCP_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-ifdef LOOPBACK
-EXTRA_CFLAGS += -DLOOPBACK_TEST
-endif
-
-ifdef ADDRESS_FIX
-EXTRA_CFLAGS += -DNAS_ADDRESS_FIX
-endif
-
-####################################################
-#      NASRGCELL extra compilation flags
-####################################################
-#RTAI=1
-RRC_DIR := $(OPENAIR2_DIR)/RRC/CELLULAR
-EXTRA_CFLAGS += -I$(RRC_DIR) -DNODE_RG
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += nascellrg.o
-nascellrg-objs += nasrg_device.o
-nascellrg-objs += nasrg_common.o
-nascellrg-objs += nasrg_iocontrol.o
-nascellrg-objs += nasrg_classifier.o
-nascellrg-objs += nasrg_tool.o
-nascellrg-objs += nasrg_ascontrol.o
-ifdef PDCP_USE_NETLINK
-nascellrg-objs += nasrg_netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-#netlink.ko:
-	#make $(x)$(y) PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-#nasmesh.ko:
-#	make  V=1 -C $(KERNEL_DIR) M=`pwd` modules
-print:
-	@echo RRC_DIR $(RRC_DIR)
-clean:
-	rm -f *.ko
-	rm -f .*.ko.cmd
-	rm -f .*.o.cmd
-	rm -f *.o
-	rm -f *.mod.c
-	find . -name *.ko     -delete
-	find . -name *.o      -delete
-	find . -name *.mod.c  -delete
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_ascontrol.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_ascontrol.c
deleted file mode 100644
index 1864406ce0dea6aacb0137cbb197f41989bfba8c..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_ascontrol.c
+++ /dev/null
@@ -1,1494 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_ascontrol.c
-* \brief Access Stratum Control functions for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifdef NODE_RG
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-//---------------------------------------------------------------------------
-void nasrg_ASCTL_init(void)
-{
-  //---------------------------------------------------------------------------
-  int cxi, i;
-
-  gpriv->next_sclassref = NASRG_DEFAULTRAB_CLASSREF;
-
-  // Initialize MBMS services list in MT
-  for (cxi=0; cxi<NAS_CX_MAX ; ++cxi) {
-    for (i = 0; i<NASRG_MBMS_SVCES_MAX; i++) {
-      gpriv->cx[cxi].requested_joined_services[i]= -1;
-      gpriv->cx[cxi].requested_left_services[i]= -1;
-      gpriv->cx[cxi].joined_services[i]= -1;
-    }
-  }
-
-  printk("nasrg_ASCTL_init Complete\n");
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ASCTL_write(int sap, unsigned char *data_buffer, unsigned int data_length)
-{
-  //---------------------------------------------------------------------------
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xmit_buffer [NAS_MESSAGE_MAXLEN];
-
-  //write SAP_Id
-  switch (sap) {
-  case RRC_DEVICE_GC:
-    xmit_buffer[0] = RRC_NAS_GC_IN;
-    break;
-
-  case RRC_DEVICE_NT:
-    xmit_buffer[0] = RRC_NAS_NT_IN;
-    break;
-
-  case RRC_DEVICE_DC_INPUT0:
-    xmit_buffer[0] = RRC_NAS_DC0_IN;
-    break;
-
-  case RRC_DEVICE_DC_INPUT1:
-    xmit_buffer[0] = RRC_NAS_DC1_IN;
-    //case RRC_DEVICE_DC_INPUT2:
-    //xmit_buffer[0] = RRC_NAS_DC2_IN;
-    break;
-
-  default:
-    printk("nasrg_ASCTL_write - ERROR - Invalid SAP %d\n", sap);
-    return 0;
-    break;
-  }
-
-  memcpy (&((char*)xmit_buffer)[1], data_buffer, data_length);
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_write - Sending data to RRC, sap %d, length %d (including NETLINK SAP value)\n", sap, data_length+1);
-  nasrg_TOOL_print_buffer(xmit_buffer,data_length+1);
-#endif
-  bytes_wrote = nasrg_netlink_send(xmit_buffer,data_length+1, NASNL_DEST_RRC);
-#else
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);  //original version
-  bytes_wrote = rtf_put(sap, data_buffer, data_length+1);
-#endif //PDCP_USE_NETLINK
-  return bytes_wrote-1;
-}
-
-//---------------------------------------------------------------------------
-//For demo, add automatically a radio bearer
-//Equivalent to rb add send 0 5 2
-void nasrg_ASCTL_start_default_rb(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-#ifdef DEMO_3GSM
-  struct rb_entity *rb;
-  int status;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_start_default_rb - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_start_default_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  rb = nasrg_COMMON_add_rb(cx, NASRG_DEFAULTRAB_RBID, NASRG_DEFAULTRAB_QoS);
-
-  if (rb!=NULL) {
-    rb->cnxid = (NAS_RB_MAX_NUM * cx->lcr)+1;
-    //rb->default_rab =1;
-    rb->dscp = NASRG_DEFAULTRAB_DSCP;
-    rb->dscp_ul = NASRG_DEFAULTRAB_DSCP;
-    status=nasrg_ASCTL_DC_send_rb_establish_request(cx, rb);
-  } else
-    status=-NAS_ERROR_NOMEMORY;
-
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_start_default_rb - end %d \n",status);
-#endif
-}
-#endif
-
-//---------------------------------------------------------------------------
-//For demo, add automatically a classifier
-//Equivalent to class add send 0 -f qos <x> -cr 0
-void nasrg_ASCTL_start_default_sclassifier(struct cx_entity *cx,struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_default_sclassifier - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasrg_ASCTL_start_default_sclassifier - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  gc=nasrg_CLASS_add_sclassifier(cx, NAS_DSCP_DEFAULT, gpriv->next_sclassref);
-
-  if (gc==NULL) {
-    printk("nasrg_ASCTL_start_default_sclassifier - Classifier pointer is null : not added \n");
-    return;
-  }
-
-  gc->fct = nasrg_COMMON_QOS_send;
-  gc->rab_id =rb->rab_id;
-  gc->rb= rb;
-  gc->version = NASRG_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-  gc->dplen= NAS_DEFAULT_IPv6_PREFIX_LENGTH;
-  // copy locator part of address into the gc structure
-  //gc->daddr.ipv6.s6_addr32[0] = 0;
-  //gc->daddr.ipv6.s6_addr32[1] = 0;
-  //gc->daddr.ipv6.s6_addr32[2] = 0;
-  //gc->daddr.ipv6.s6_addr32[3] = 0;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_default_sclassifier - end \n");
-  nasrg_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-//Add automatically a classifier on DSCP
-//Equivalent to class add send 0 -f qos <x> -cr 0
-void nasrg_ASCTL_start_sclassifier(struct cx_entity *cx,struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_sclassifier - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasrg_ASCTL_start_sclassifier - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  gc=nasrg_CLASS_add_sclassifier(cx, rb->dscp, gpriv->next_sclassref);
-
-  if (gc==NULL) {
-    printk("nasrg_ASCTL_start_sclassifier - Classifier pointer is null : not added \n");
-    return;
-  }
-
-  gc->fct = nasrg_COMMON_QOS_send;
-  gc->rab_id =rb->rab_id;
-  gc->rb= rb;
-  gc->version = NASRG_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-  gc->dplen= NAS_DEFAULT_IPv6_PREFIX_LENGTH;
-  // copy locator part of address into the gc structure
-  gc->daddr.ipv6.s6_addr32[2] = cx->iid6[0];
-  gc->daddr.ipv6.s6_addr32[3] = cx->iid6[1];
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_sclassifier - end \n");
-  nasrg_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-//Add automatically a classifier for mbms
-void nasrg_ASCTL_start_mbmsclassifier(int mbms_ix,struct rb_entity *mbms_rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_mbmsclassifier - begin \n");
-#endif
-
-  if (!mbms_rb) {
-    printk("nasrg_ASCTL_start_mbmsclassifier - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  //
-  //  gc=nasrg_CLASS_add_mbmsclassifier(mbms_ix, gpriv->next_mbmsclassref);
-  gc=nasrg_CLASS_add_mbmsclassifier(mbms_ix, gpriv->next_sclassref++);
-
-  if (gc==NULL) {
-    printk("nasrg_ASCTL_start_mbmsclassifier - Classifier pointer is null : not added \n");
-    return;
-  }
-
-  gc->fct = nasrg_COMMON_QOS_send;
-  gc->rab_id =mbms_rb->mbms_rbId;
-  gc->rb= mbms_rb;
-  gc->version = NASRG_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_mbmsclassifier - end \n");
-  nasrg_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-//Notifies automatically UE on default MBMS service
-void nasrg_ASCTL_start_default_ue_notification(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_start_default_ue_notification - begin \n");
-#endif
-
-  if (!cx) {
-    printk("\nERROR nasrg_ASCTL_start_default_ue_notification - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  // set value for default MBMS service
-  cx->requested_joined_services[0] = (NAS_CX_MAX*NAS_RB_MAX_NUM) +1;
-  nasrg_ASCTL_DC_send_mbms_ue_notify_req(cx);
-}
-
-//---------------------------------------------------------------------------
-//Notifies automatically UE on default MBMS service
-void nasrg_ASCTL_start_default_mbms_service(void)
-{
-  //---------------------------------------------------------------------------
-  int mbms_ix=0; // should allocate index based on Service_id /cnxid / MC IP address
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_start_default_mbms_service - begin \n");
-#endif
-
-  // Establish MBMS bearer if not already done
-  if ((gpriv->mbms_rb[mbms_ix].state != NAS_CX_DCH)&&(gpriv->mbms_rb[mbms_ix].state != NAS_RB_ESTABLISHING)) {
-    gpriv->mbms_rb[mbms_ix].cnxid = (NAS_CX_MAX*NAS_RB_MAX_NUM) +1;
-    gpriv->mbms_rb[mbms_ix].serviceId = (NAS_CX_MAX*NAS_RB_MAX_NUM) +1;
-    gpriv->mbms_rb[mbms_ix].sessionId = NASRG_TEMP_MBMS_SESSION_ID; //Temp hard coded
-    gpriv->mbms_rb[mbms_ix].mbms_rbId = NASRG_DEFAULTRAB_RBID;
-    gpriv->mbms_rb[mbms_ix].sapi = NAS_DC_INPUT_SAPI;
-#ifdef NAS_DEBUG_MBMS_PROT
-    gpriv->mbms_rb[mbms_ix].sapi = NAS_DRB_INPUT_SAPI; //Only one RT-FIFO is used
-#endif
-    gpriv->mbms_rb[mbms_ix].qos = 20; //from first version of MBMS traces
-    gpriv->mbms_rb[mbms_ix].dscp = 0; //maybe 7
-    gpriv->mbms_rb[mbms_ix].duration = NASRG_TEMP_MBMS_DURATION; //Temp hard coded
-    //memcpy ((char *)&(gpriv->mbms_rb[mbms_ix].mcast_address),(char *)&(msgreq->mcast_group), 16);
-    gpriv->mbms_rb[mbms_ix].mcast_address[0] = 0xFF;
-    gpriv->mbms_rb[mbms_ix].mcast_address[1] = 0x0E;
-    nasrg_ASCTL_GC_send_mbms_bearer_establish_req(mbms_ix);
-  } else {
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_start_default_mbms_service - skipped, mbms_rb.state = %d \n", gpriv->mbms_rb[mbms_ix].state);
-#endif
-  }
-}
-//---------------------------------------------------------------------------
-void nasrg_ASCTL_timer(unsigned long data)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  struct cx_entity *cx;
-  struct rb_entity *rb;
-  spin_lock(&gpriv->lock);
-#ifdef NAS_DEBUG_TIMER
-  printk("nasrg_ASCTL_timer - begin \n");
-#endif
-  (gpriv->timer).function = nasrg_ASCTL_timer;
-  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
-  (gpriv->timer).data=0L;
-
-  for (cxi=0; cxi<NAS_CX_MAX ; ++cxi) {
-    cx=gpriv->cx+cxi;
-
-    if (!cx) {
-      printk("nasrg_ASCTL_timer - No pointer for connection %d \n", cxi);
-      continue;
-    }
-
-    for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-      if (rb->countimer!=NAS_TIMER_IDLE) {
-#ifdef NAS_DEBUG_TIMER
-        printk("nasrg_ASCTL_timer : rb countimer %d, rb state %d\n", rb->countimer, rb->state);
-#endif
-
-        if (rb->countimer==0) {
-          switch (rb->state) {
-          case NAS_CX_CONNECTING:
-          case NAS_CX_CONNECTING_FAILURE:  // MW - 15/01/07 Useless, currently no retry if failure
-            if (rb->retry<gpriv->retry_limit) {
-              printk("nasrg_ASCTL_timer: Retry RB establishment %d\n", rb->retry);
-              nasrg_ASCTL_DC_send_rb_establish_request(cx, rb);
-            } else {
-              printk("nasrg_ASCTL_timer: RB Establishment failure\n");
-              rb->state=NAS_IDLE;
-              rb->countimer=NAS_TIMER_IDLE;
-            }
-
-            break;
-
-          case NAS_CX_DCH:
-#ifdef DEMO_3GSM
-            if (cx->num_rb == 1) {
-              nasrg_ASCTL_start_default_sclassifier(cx, rb);
-            }
-
-#endif
-            nasrg_ASCTL_start_sclassifier(cx, rb);
-            rb->countimer=NAS_TIMER_IDLE;
-            break;
-
-          case NAS_CX_RELEASING_FAILURE:
-            nasrg_ASCTL_DC_send_rb_release_request(cx, rb);
-            break;
-
-          default:
-            rb->countimer=NAS_TIMER_IDLE;
-          }
-        } else {
-          --rb->countimer;
-          printk("nasrg_ASCTL_timer : rb countimer-- %d, rb state %d\n", rb->countimer, rb->state);
-        }
-      }
-    }
-  }
-
-  add_timer(&gpriv->timer);
-#ifdef NAS_DEBUG_TIMER
-  printk("nasrg_ASCTL_timer - end \n");
-#endif
-  spin_unlock(&gpriv->lock);
-}
-
-
-/***************************************************************************
-     Transmission side
- ***************************************************************************/
-//---------------------------------------------------------------------------
-// Encode INFO_BROADCAST_REQ message
-int nasrg_ASCTL_GC_send_broadcast_request(uint8_t category)
-{
-  //---------------------------------------------------------------------------
-  char *xmit_data = "TESTING BROADCASTING ROUTER ADVERTISEMENT. TESTING BROADCASTING ROUTER ADVERTISEMENT. BROADCASTING ROUTER.\0";
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-
-  struct nas_rg_gc_element *p;
-  p= (struct nas_rg_gc_element *)(gpriv->xbuffer);
-  p->type = INFO_BROADCAST_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASInfoBroadcastReq);
-  //
-  p->nasRGGCPrimitive.broadcast_req.period = 0;
-  p->nasRGGCPrimitive.broadcast_req.category = category;
-  p->nasRGGCPrimitive.broadcast_req.nasDataLength = strlen(xmit_data)+1;  // TBD
-
-  //bytes_wrote = rtf_put(gpriv->sap[NAS_GC_SAPI], p, p->length); //original version
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)p, p->length);
-#endif
-  //printk("nasrg_ASCTL_GC_send_broadcast_request - Wrote %d bytes to RRC NAS_GC_SAPII\n", bytes_wrote);
-
-  //bytes_wrote += rtf_put(gpriv->sap[NAS_GC_SAPI], xmit_data, p->nasRGGCPrimitive.broadcast_req.nasDataLength);
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)xmit_data, p->nasRGGCPrimitive.broadcast_req.nasDataLength);
-  count += p->nasRGGCPrimitive.broadcast_req.nasDataLength;
-  bytes_wrote += nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasrg_ASCTL_write((gpriv->sap[NAS_GC_SAPI], xmit_data, p->nasRGGCPrimitive.broadcast_req.nasDataLength);
-#endif
-
-  if (bytes_wrote==p->length+p->nasRGGCPrimitive.broadcast_req.nasDataLength) {
-#ifdef NAS_DEBUG_GC
-    printk("nasrg_ASCTL_GC_send_broadcast: INFO_BROADCAST_REQ primitive sent successfully in GC-FIFO\n");
-#endif
-  } else {
-    printk("nasrg_ASCTL_GC_send_broadcast: Message sent failure in GC-FIFO\n");
-  }
-  return bytes_wrote;
-}
-
-
-//---------------------------------------------------------------------------
-// Encode INFO_BROADCAST_REQ message for RRC SIB1
-int nasrg_ASCTL_GC_send_SIB1_broadcast_request(struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_gc_element *p;
-  char sib1_flag; // will be used for reception in nas_ue
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-
-  // Start debug information
-#ifdef NAS_DEBUG_GC
-  printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request - input parameter is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  p= (struct nas_rg_gc_element *)(gpriv->xbuffer);
-  p->type = INFO_BROADCAST_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASInfoBroadcastReq);
-  //
-  p->nasRGGCPrimitive.broadcast_req.period = 10; // to be checked
-  p->nasRGGCPrimitive.broadcast_req.category = 1;
-  p->nasRGGCPrimitive.broadcast_req.nasDataLength = skb->len+1;  // TBD
-  sib1_flag = 1;
-  // send header
-  //bytes_wrote = rtf_put(gpriv->sap[NAS_GC_SAPI], p, p->length); //original version
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)p, p->length);
-#endif
-  //printk("nasrg_ASCTL_GC_send_broadcast_request - Wrote %d bytes to RRC NAS_GC_SAPII\n", bytes_wrote);
-
-
-  if (bytes_wrote!=p->length) {
-    printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request: Header send failure in GC-FIFO\n");
-    return bytes_wrote;
-  }
-
-  // send sib1_flag
-  //bytes_wrote +=  rtf_put(gpriv->sap[NAS_GC_SAPI], &sib1_flag, 1);
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)&sib1_flag, 1);
-  count += 1;
-  bytes_wrote = count;
-#else
-  bytes_wrote += nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)&sib1_flag, 1);
-#endif
-
-  if (bytes_wrote!=p->length+1) {
-    printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request: sib1_flag send failure in GC-FIFO\n");
-    return bytes_wrote;
-  }
-
-  // send data
-  //bytes_wrote += rtf_put(gpriv->sap[NAS_GC_SAPI], skb->data, skb->len);
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),skb->data, skb->len);
-  count += skb->len;
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], skb->data, skb->len);
-#endif
-
-
-  if (bytes_wrote!=p->length+skb->len+1) {
-    printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request: Data send failure in GC-FIFO\n");
-    return bytes_wrote;
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request - end \n");
-#endif
-  return bytes_wrote;
-}
-
-//-----------------------------------------------------------------------------
-// Encode MBMS_BEARER_ESTABLISH_REQ message
-int nasrg_ASCTL_GC_send_mbms_bearer_establish_req(int mbms_ix )
-{
-  //-----------------------------------------------------------------------------
-  struct nas_rg_gc_element *p;
-  int bytes_wrote = 0;
-
-  p= (struct nas_rg_gc_element *)(gpriv->xbuffer);
-  p->type = MBMS_BEARER_ESTABLISH_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASMBMSBearerEstablishReq);
-  //
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_serviceId = gpriv->mbms_rb[mbms_ix].serviceId;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_sessionId = gpriv->mbms_rb[mbms_ix].sessionId;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_rbId = gpriv->mbms_rb[mbms_ix].mbms_rbId;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_sapId = gpriv->mbms_rb[mbms_ix].sapi;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_QoSclass = gpriv->mbms_rb[mbms_ix].qos;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_duration = gpriv->mbms_rb[mbms_ix].duration;
-  gpriv->mbms_rb[mbms_ix].state = NAS_RB_ESTABLISHING;
-  //
-  //bytes_wrote = rtf_put(gpriv->sap[NAS_GC_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_GC
-    printk(" nasrg_ASCTL_GC_send_mbms_bearer_establish: MBMS_BEARER_ESTABLISH_REQ primitive sent successfully in GC-FIFO\n");
-    printk(" ServiceId %d, RB_Id %d , qos class %d \n",
-           p->nasRGGCPrimitive.mbms_establish_req.mbms_serviceId,
-           p->nasRGGCPrimitive.mbms_establish_req.mbms_rbId,
-           p->nasRGGCPrimitive.mbms_establish_req.mbms_QoSclass);
-#endif
-  } else {
-    printk("nasrg_ASCTL_GC_send_mbms_bearer_establish: Message sent failure in GC-FIFO\n");
-  }
-
-  return bytes_wrote;
-}
-
-//-----------------------------------------------------------------------------
-// HNN - Encode MBMS_BEARER_RELEASE_REQ message
-int nasrg_ASCTL_GC_send_mbms_bearer_release_req(int mbms_ix)
-{
-  //-----------------------------------------------------------------------------
-  struct nas_rg_gc_element *p;
-  uint16_t classref=0;
-  int bytes_wrote = 0;
-
-  p= (struct nas_rg_gc_element *)(gpriv->xbuffer);
-
-  p->type = MBMS_BEARER_RELEASE_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASMBMSBearerReleaseReq);
-  //
-  p->nasRGGCPrimitive.mbms_release_req.mbms_serviceId = gpriv->mbms_rb[mbms_ix].serviceId;
-  p->nasRGGCPrimitive.mbms_release_req.mbms_sessionId = gpriv->mbms_rb[mbms_ix].sessionId;
-  p->nasRGGCPrimitive.mbms_release_req.mbms_rbId = gpriv->mbms_rb[mbms_ix].mbms_rbId;
-  //gpriv->mbms_rb[mbms_ix].state = NAS_RB_RELEASING;
-  //
-  //bytes_wrote = rtf_put(gpriv->sap[NAS_GC_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_GC
-    printk(" nasrg_ASCTL_GC_send_mbms_bearer_release: MBMS_BEARER_RELEASE_REQ primitive sent successfully in GC-FIFO\n");
-    printk(" ServiceId %d, RB_Id %d \n", p->nasRGGCPrimitive.mbms_establish_req.mbms_serviceId, p->nasRGGCPrimitive.mbms_establish_req.mbms_rbId);
-#endif
-    // clean NASRG private structures
-    classref =  (gpriv->mbmsclassifier[mbms_ix])->classref;
-    nasrg_CLASS_del_mbmsclassifier(mbms_ix, classref);
-    //nasrg_CLASS_flush_mbmsclassifier();
-    //gpriv->mbms_rb[mbms_ix].state = NAS_IDLE;
-    memset (&(gpriv->mbms_rb[mbms_ix]),0,sizeof (struct rb_entity));
-  } else {
-    printk("nasrg_ASCTL_GC_send_mbms_bearer_release: Message sent failure in GC-FIFO\n");
-  }
-
-  return bytes_wrote;
-}
-
-//---------------------------------------------------------------------------
-// Confirm the establishment of a connection (DC channel)
-int nasrg_ASCTL_DC_send_cx_establish_confirm(struct cx_entity *cx, uint8_t response)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_cx_establish - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_DC_send_cx_establish - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-  p->type = CONN_ESTABLISH_CNF;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASConnEstablishConf);
-  p->nasRGDCPrimitive.conn_establish_conf.localConnectionRef = cx->lcr;
-  p->nasRGDCPrimitive.conn_establish_conf.status = response;  // can be ACCEPTED  or FAILURE
-  p->nasRGDCPrimitive.conn_establish_conf.num_RBs = 0; // Hard coded in first step
-  //
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_DC_send_cx_establish: CONN_ESTABLISH_CNF primitive sent successfully in DC-FIFO\n");
-    printk(" lcr (Mobile_id) %u\n",p->nasRGDCPrimitive.conn_establish_conf.localConnectionRef);
-    printk(" Status %u\n",p->nasRGDCPrimitive.conn_establish_conf.status);
-#endif
-  } else
-    printk("nasrg_ASCTL_DC_send_cx_establish: Message transmission failure to DC-FIFO\n");
-
-  return bytes_wrote;
-}
-
-//---------------------------------------------------------------------------
-// Request the establishment of a radio bearer
-int nasrg_ASCTL_DC_send_rb_establish_request(struct cx_entity *cx, struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_rb_establish - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasrg_ASCTL_DC_send_rb_establish - input parameter is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  switch(rb->state) {
-  case NAS_CX_CONNECTING:
-  case NAS_CX_CONNECTING_FAILURE:
-  case NAS_IDLE:
-    ++rb->retry;
-    rb->countimer=gpriv->timer_establishment;
-
-    if (cx->state==NAS_CX_DCH) {
-      p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-      p->type = RB_ESTABLISH_REQ;
-      p->length =  NAS_TL_SIZE + sizeof(struct NASrbEstablishReq);
-      p->nasRGDCPrimitive.rb_establish_req.localConnectionRef = cx->lcr;
-      p->nasRGDCPrimitive.rb_establish_req.rbId = rb->rab_id + (NAS_RB_MAX_NUM * cx->lcr);
-      p->nasRGDCPrimitive.rb_establish_req.QoSclass = rb->qos;
-      p->nasRGDCPrimitive.rb_establish_req.dscp = rb->dscp_ul;
-      //
-      //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-      bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-      if (bytes_wrote==p->length) {
-        rb->state=NAS_CX_CONNECTING;
-#ifdef NAS_DEBUG_DC
-        printk(" nasrg_ASCTL_DC_send_rb_establish: RB_ESTABLISH_REQ primitive sent successfully in DC-FIFO\n");
-        printk(" lcr (Mobile_id) %u\n",p->nasRGDCPrimitive.rb_establish_req.localConnectionRef);
-        printk(" Radio Bearer identification %u\n",p->nasRGDCPrimitive.rb_establish_req.rbId);
-        printk(" QoS %u\n",p->nasRGDCPrimitive.rb_establish_req.QoSclass);
-#endif
-      } else {
-        rb->state=NAS_CX_CONNECTING_FAILURE;
-        printk("nasrg_ASCTL_DC_send_rb_establish: Message sent failure in DC-FIFO\n");
-      }
-
-      return bytes_wrote;
-    } else {
-      rb->state=NAS_CX_CONNECTING_FAILURE;
-      printk("nasrg_ASCTL_DC_send_rb_establish: Failure \n");
-      return 0;
-    }
-
-  default:
-    return -NAS_ERROR_NOTIDLE;
-  }
-}
-
-//---------------------------------------------------------------------------
-// Request the release of a radio bearer
-int nasrg_ASCTL_DC_send_rb_release_request(struct cx_entity *cx, struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_rb_release - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasrg_ASCTL_DC_send_rb_release - input parameter is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  switch (rb->state) {
-  case NAS_CX_RELEASING_FAILURE:
-  case NAS_CX_DCH:
-    p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-    p->type = RB_RELEASE_REQ;
-    p->length =  NAS_TL_SIZE + sizeof(struct NASrbReleaseReq);
-    p->nasRGDCPrimitive.rb_release_req.localConnectionRef = cx->lcr;
-    p->nasRGDCPrimitive.rb_release_req.rbId = rb->rab_id + (NAS_RB_MAX_NUM * cx->lcr);
-    //
-    //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-    bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-    if (bytes_wrote) {
-      rb->state=NAS_IDLE;
-#ifdef NAS_DEBUG_DC
-      printk("nasrg_ASCTL_DC_send_rb_release: RB_RELEASE_REQ primitive sent successfully in DC-FIFO\n");
-#endif
-    } else {
-      ++rb->retry;
-      rb->countimer=gpriv->timer_release;
-      rb->state=NAS_CX_RELEASING_FAILURE;
-      printk("nasrg_ASCTL_DC_send_rb_release: Message sent failure in DC-FIFO\n");
-    }
-
-    return bytes_wrote;
-
-  default:
-    return -NAS_ERROR_NOTCONNECTED;
-  }
-}
-
-//-----------------------------------------------------------------------------
-// Request the notification of a UE to joined or left services
-int nasrg_ASCTL_DC_send_mbms_ue_notify_req(struct cx_entity *cx)
-{
-  //-----------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int i;
-  int bytes_wrote = 0;
-
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_mbms_ue_notify_req - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_DC_send_mbms_ue_notify_req - input parameter is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-  p->type = MBMS_UE_NOTIFY_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASMBMSUENotifyReq);
-  //
-  p->nasRGDCPrimitive.mbms_ue_notify_req.localConnectionRef = cx->lcr;
-
-  // joined/left services are lists of MAX_MBMS_SERVICES
-  // -1 means the end of the list
-  for (i = 0; i < MAX_MBMS_SERVICES; i++) {
-    p->nasRGDCPrimitive.mbms_ue_notify_req.joined_services[i].mbms_serviceId = (nasMBMSServiceId_t)cx->requested_joined_services[i];
-    p->nasRGDCPrimitive.mbms_ue_notify_req.left_services[i].mbms_serviceId = (nasMBMSServiceId_t)cx->requested_left_services[i];
-  }
-
-  //
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_DC_send_mbms_ue_notify_req: MBMS_UE_NOTIFY_REQ primitive sent successfully in DC-FIFO\n");
-    printk(" lcr (Mobile_id) %u\n",p->nasRGDCPrimitive.mbms_ue_notify_req.localConnectionRef);
-    printk(" joined service %d, left service %d\n",cx->requested_joined_services[0], cx->requested_left_services[0] );
-#endif
-  } else
-    printk("nasrg_ASCTL_DC_send_mbms_ue_notify_req: Message transmission failure to DC-FIFO\n");
-
-  return bytes_wrote;
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (DC SAP)
-void nasrg_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_sig_data - begin \n");
-#endif
-
-  if (!skb || !gc || !cx) {
-    printk("nasrg_ASCTL_DC_send_sig_data - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  if (cx->state!=NAS_CX_DCH) {
-    printk("nasrg_ASCTL_DC_send_sig_data: Not connected, so the message is dropped\n");
-    ++gpriv->stats.tx_dropped;
-    return;
-  }
-
-  p = (struct nas_rg_dc_element *)(gpriv->xbuffer);
-  p->type = DATA_TRANSFER_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASDataReq);
-  p->nasRGDCPrimitive.data_transfer_req.localConnectionRef = cx->lcr;
-  p->nasRGDCPrimitive.data_transfer_req.priority = NAS_SIG_SRB3;
-  p->nasRGDCPrimitive.data_transfer_req.nasDataLength = skb->len;
-  //
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-#endif
-
-  if (bytes_wrote!=p->length) {
-    printk("nasrg_ASCTL_DC_send_sig_data: Header sent failure in DC-FIFO\n");
-    return;
-  }
-
-  //bytes_wrote += rtf_put(cx->sap[NAS_DC_INPUT_SAPI], skb->data, skb->len);
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)skb->data, skb->len);
-  count += skb->len;
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)skb->data, skb->len);
-#endif
-
-  if (bytes_wrote!=p->length+skb->len) {
-    printk("nasrg_ASCTL_DC_send_sig_data: Data sent failure in DC-FIFO\n");
-    return;
-  }
-
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_sig_data - end \n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Confirm the establishment of a connection (DC channel)
-int nasrg_ASCTL_DC_send_eNBmeasurement_req(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_eNBmeasurement_req - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_DC_send_eNBmeasurement_req - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-  p->type = ENB_MEASUREMENT_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASENbMeasureReq);
-  p->nasRGDCPrimitive.eNBmeasurement_req.cell_id = cx->cellid;
-  //
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_DC_send_eNBmeasurement_req: ENB_MEASUREMENT_REQ primitive sent successfully in DC-FIFO\n");
-    printk(" cell_id %u\n",p->nasRGDCPrimitive.eNBmeasurement_req.cell_id);
-#endif
-  } else
-    printk("nasrg_ASCTL_DC_send_eNBmeasurement_req: Message transmission failure to DC-FIFO\n");
-
-  return bytes_wrote;
-}
-
-/***************************************************************************
-     Reception side
- ***************************************************************************/
-
-//---------------------------------------------------------------------------
-// Decode CONN_ESTABLISH_IND message from RRC
-void nasrg_ASCTL_DC_decode_cx_establish_ind(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  int i;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_establish - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_cx_establish - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  if (nasrg_ASCTL_DC_send_cx_establish_confirm(cx, ACCEPTED)>0) {
-    nasrg_TOOL_imei2iid(p->nasRGDCPrimitive.conn_establish_ind.InterfaceIMEI, (uint8_t *)cx->iid6);
-    cx->iid4=97;  // A AUTOMATISER
-    cx->lcr = p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef;
-    cx->state=NAS_CX_DCH;
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_DC_decode_cx_establish: CONN_ESTABLISH_IND reception\n");
-    printk(" primitive length %d\n",p->length);
-    printk(" Local Connection reference %d\n",p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef);
-    printk(" IMEI ");
-
-    for (i=0; i<14; ++i)
-      printk("%u",p->nasRGDCPrimitive.conn_establish_ind.InterfaceIMEI[i]);
-
-    printk(" state ");
-    nasrg_TOOL_print_state(cx->state);
-#endif
-  }
-}
-
-//---------------------------------------------------------------------------
-// Decode CONN_RELEASE_IND message from RRC
-void nasrg_ASCTL_DC_decode_cx_release_ind(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_release - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_cx_release - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  cx->state=NAS_IDLE;
-  cx->iid4=0;
-  nasrg_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)cx->iid6);
-  nasrg_COMMON_flush_rb(cx);
-  nasrg_CLASS_flush_sclassifier(cx);
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_release: CONN_RELEASE_IND reception\n");
-  printk(" Primitive length %u\n",p->length);
-  printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.conn_release_ind.localConnectionRef);
-  printk(" Release cause %u\n",p->nasRGDCPrimitive.conn_release_ind.releaseCause);
-  nasrg_TOOL_print_state(cx->state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode CONN_LOSS_IND message from RRC
-void nasrg_ASCTL_DC_decode_cx_loss_ind(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_loss - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_cx_loss - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  cx->state = NAS_IDLE;
-  cx->iid4=0;
-  nasrg_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)cx->iid6);
-  nasrg_COMMON_flush_rb(cx);
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_loss: CONN_LOSS_IND reception\n");
-  printk(" Primitive length %u\n",(int)(p->length));
-  printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.conn_loss_ind.localConnectionRef);
-  nasrg_TOOL_print_state(cx->state);
-#endif
-}
-//---------------------------------------------------------------------------
-// Decode RB_ESTABLISH_CNF message from RRC
-void nasrg_ASCTL_DC_decode_rb_establish_cnf(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  int rb_id;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_rb_establish - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_rb_establish - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  rb_id = p->nasRGDCPrimitive.rb_establish_conf.rbId;
-  rb=nasrg_COMMON_search_rb(cx, rb_id - (NAS_RB_MAX_NUM * cx->lcr));
-
-  //
-  if (rb!=NULL) {
-    if (rb->state==NAS_CX_CONNECTING) {
-#ifdef NAS_DEBUG_DC
-      printk("nasrg_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_CNF received\n");
-      printk(" Primitive length %u\n", p->length);
-      printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      printk(" RB Id %u\n",p->nasRGDCPrimitive.rb_establish_conf.rbId);
-      printk(" SAP Id %u\n",p->nasRGDCPrimitive.rb_establish_conf.sapId);
-      printk(" Status %u, Failure code %d, Cx state, RB state\n",p->nasRGDCPrimitive.rb_establish_conf.status, p->nasRGDCPrimitive.rb_establish_conf.fail_code);
-      nasrg_TOOL_print_state(cx->state);
-      nasrg_TOOL_print_state(rb->state);
-#endif
-
-      switch (p->nasRGDCPrimitive.rb_establish_conf.status) {
-      case ACCEPTED:
-        rb->state = NAS_CX_DCH;
-        rb->countimer=1;
-        break;
-
-      case FAILURE:
-        printk("nasrg_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_CNF rejected\n");
-        rb->state = NAS_CX_CONNECTING_FAILURE;
-        //delete rb
-        break;
-
-      default:
-        printk("nasrg_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_CNF reception, invalid status\n");
-      }
-    } else
-      printk("nasrg_ASCTL_DC_decode_rb_establish: invalid state %u\n", cx->state);
-  } else
-    printk("nasrg_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_CNF, No corresponding radio bearer\n");
-}
-
-//---------------------------------------------------------------------------
-// Decode DATA_TRANSFER_IND message from RRC
-void nasrg_ASCTL_DC_decode_data_transfer_ind(struct cx_entity *cx, struct nas_rg_dc_element *p, char *buffer)
-{
-  //---------------------------------------------------------------------------
-  uint8_t nasrg_data[10];
-  unsigned int nas_length;
-  char data_type;
-  int bytes_read=0;
-  unsigned int peer_command;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_data_transfer - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_data_transfer - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  bytes_read=p->length;
-  // Get first character
-  nas_length = (p->nasRGDCPrimitive.data_transfer_ind.nasDataLength) -1;
-#ifndef PDCP_USE_NETLINK
-  bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], &data_type, 1);
-#else
-  memcpy (&data_type, (char *)(&buffer[bytes_read]), 1);
-  bytes_read ++;
-#endif
-
-  //check if peer message
-  if (data_type =='A') {
-    // receive in a skbuff
-    //nasrg_COMMON_receive((p->length) + 1, nas_length, cx->sap[NAS_DC_OUTPUT_SAPI]); // original
-#ifndef PDCP_USE_NETLINK
-    //void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-    // data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
-    nasrg_COMMON_receive((p->length) + 1, nas_length, NULL, 2, cx->sap[NAS_DC_OUTPUT_SAPI]);
-#else
-    //nasrg_COMMON_receive((p->length) + 1, nas_length, (unsigned char *)p+p->length+1, 2, 0);
-    nasrg_COMMON_receive((p->length) + 1, nas_length, (unsigned char *)(&buffer[bytes_read]), 2, 0);
-#endif
-  } else {
-    // if FIFO, empty remaining data
-#ifndef PDCP_USE_NETLINK
-    bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], (gpriv->rbuffer)+ (p->length), nas_length);
-#endif
-
-    if (data_type=='Z') {
-#ifndef PDCP_USE_NETLINK
-      memcpy (&nasrg_data, (char *)(gpriv->rbuffer)+ (p->length), 10);
-#else
-      memcpy (&nasrg_data, (char *)(&buffer[bytes_read]), 10);
-#endif
-      peer_command = (int)nasrg_data[0];
-      printk("nasrg_ASCTL_DC_decode_data_transfer: Received peer message %d %d \n", nasrg_data[0], peer_command);
-      nasrg_TOOL_print_buffer(nasrg_data, 10);
-
-      if (nasrg_data[0]== NAS_CMD_OPEN_RB) {
-        // open radio bearer
-        printk("nasrg_ASCTL_DC_decode_data_transfer: Opening Default Radio Bearer\n");
-        nasrg_ASCTL_start_default_rb(cx);
-      } else if (nasrg_data[0]== NAS_CMD_ENTER_SLEEP) {
-        printk("nasrg_ASCTL_DC_decode_data_transfer: Entering Sleep Mode\n");
-        cx->state = NAS_CX_RELEASING;
-      } else if (nasrg_data[0]== NAS_CMD_LEAVE_SLEEP) {
-        printk("nasrg_ASCTL_DC_decode_data_transfer: Leaving Sleep Mode\n");
-        cx->state = NAS_CX_DCH;
-      } else {
-        printk("\n\nnasrg_ASCTL_DC_decode_data_transfer: Unknown peer command\n");
-      }
-    } else
-      printk("nasrg_ASCTL_DC_decode_data_transfer: Error during reception of the message - Dropped\n");
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_data_transfer: DATA_TRANSFER_IND reception\n");
-  printk(" Primitive length %u\n", p->length);
-  printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.data_transfer_ind.localConnectionRef);
-  printk(" Data Length %u\n", p->nasRGDCPrimitive.data_transfer_ind.nasDataLength);
-  nasrg_TOOL_print_state(cx->state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode MBMS_BEARER_ESTABLISH_CNF message from RRC
-void nasrg_ASCTL_DC_decode_mbms_bearer_establish_cnf(struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  int mbms_ix;
-  int rb_id;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_mbms_bearer_establish - begin \n");
-#endif
-
-  if (!p) {
-    printk("nasrg_ASCTL_DC_decode_mbms_bearer_establish - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  rb_id = p->nasRGDCPrimitive.mbms_establish_cnf.rbId;
-  mbms_ix = 0;  // A revoir - find using cnxid...
-
-  if (rb_id == gpriv->mbms_rb[mbms_ix].mbms_rbId) {
-    switch (p->nasRGDCPrimitive.mbms_establish_cnf.status) {
-    case ACCEPTED:
-      gpriv->mbms_rb[mbms_ix].state = NAS_CX_DCH;
-      gpriv->mbms_rb[mbms_ix].rab_id = gpriv->mbms_rb[mbms_ix].mbms_rbId;
-      nasrg_ASCTL_start_mbmsclassifier(mbms_ix,&(gpriv->mbms_rb[mbms_ix]));
-      break;
-
-    case FAILURE:
-      printk("nasrg_ASCTL_DC_decode_mbms_bearer_establish: MBMS_BEARER_ESTABLISH_CNF rejected\n");
-      gpriv->mbms_rb[mbms_ix].state = NAS_CX_CONNECTING_FAILURE; //supprimer l'entree
-      break;
-
-    default:
-      printk("nasrg_ASCTL_DC_decode_mbms_bearer_establish: MBMS_BEARER_ESTABLISH_CNF reception, invalid status\n");
-    }
-  } else
-    printk(" nasrg_ASCTL_DC_decode_mbms_bearer_establish: invalid RB_Id %d\n", rb_id);
-
-#ifdef NAS_DEBUG_DC
-  printk(" nasrg_ASCTL_DC_decode_mbms_bearer_establish: MBMS_BEARER_ESTABLISH_CNF reception\n");
-  printk(" Primitive length %u\n",p->length);
-  printk(" rb_id %d, status %d\n",p->nasRGDCPrimitive.mbms_establish_cnf.rbId, p->nasRGDCPrimitive.mbms_establish_cnf.status);
-  nasrg_TOOL_print_state(gpriv->mbms_rb[mbms_ix].state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode MBMS_UE_NOTIFY_CNF message from RRC
-void nasrg_ASCTL_DC_decode_mbms_ue_notify_cnf(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  int i, j, k;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_mbms_ue_notify - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_mbms_ue_notify - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  if (p->nasRGDCPrimitive.mbms_ue_notify_cnf.mbmsStatus == ACCEPTED) {
-    for (i = 0; i<NASRG_MBMS_SVCES_MAX; i++) {
-      if (cx->requested_joined_services[i] >=0) {
-        for (j = 0; j<NASRG_MBMS_SVCES_MAX; j++) {
-          if (cx->joined_services[j] ==-1) {
-            cx->joined_services[j]= cx->requested_joined_services[i];
-            cx->requested_joined_services[i]=-1;
-            break;
-          }
-        }
-      }
-
-      if (cx->requested_left_services[i] >=0) {
-        for (k = 0; k<NASRG_MBMS_SVCES_MAX; k++) {
-          if (cx->joined_services[k] == cx->requested_left_services[i]) {
-            cx->joined_services[k]=-1;
-            cx->requested_left_services[i]=-1;
-            break;
-          }
-        }
-      }
-    }
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk(" nasrg_ASCTL_DC_decode_mbms_ue_notify: MBMS_UE_NOTIFY_CNF reception\n");
-  printk(" Primitive length %u\n",p->length);
-  printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.mbms_ue_notify_cnf.localConnectionRef);
-  printk(" MBMS Status: %d\n", p->nasRGDCPrimitive.mbms_ue_notify_cnf.mbmsStatus);
-  printk(" UE services currently joined \n");
-
-  for (i = 0; i<NASRG_MBMS_SVCES_MAX; i++)
-    printk ("%d * ", cx->joined_services[i]);
-
-  nasrg_TOOL_print_state(cx->state);
-#endif
-}
-/*
-  msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.cell_id = protocol_bs->rrc.rg_cell_id;
-  // next values are temp hard coded, to be replaced by real values
-  msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.num_UEs = num_connected_UEs;
-  for (ix=0; ix<ralpriv->num_connected_UEs; ix++){
-    msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.measures[ix].rlcBufferOccupancy = 100 - (30*ix);
-    msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.measures[ix].scheduledPRB = 500 - (200*ix);
-    msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.measures[ix].totalDataVolume = 640000 + (160000*ix);
-  }
-  msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.totalNumPRBs = 1000;
-
-*/
-//---------------------------------------------------------------------------
-// Decode ENB_MEASUREMENT_IND message from RRC
-void nasrg_ASCTL_DC_decode_eNBmeasurement_ind(struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  uint8_t i;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_eNBmeasurement_ind - begin \n");
-#endif
-
-  if (!p) {
-    printk("nasrg_ASCTL_DC_decode_eNBmeasurement_ind - input parameter p is NULL \n");
-    return;
-  }
-
-  // End debug information
-#ifdef NAS_DEBUG_DC_DETAIL
-  printk(" nasrg_ASCTL_DC_decode_eNBmeasurement_ind : ENB_MEASUREMENT_IND reception\n");
-  printk(" Measured Cell: %u\n", p->nasRGDCPrimitive.eNBmeasurement_ind.cell_id);
-  printk(" Number of Connected Mobiles: %u\n", p->nasRGDCPrimitive.eNBmeasurement_ind.num_UEs);
-
-  for (i=0; i<p->nasRGDCPrimitive.eNBmeasurement_ind.num_UEs; ++i) {
-    printk(" UE[%u]:  rlcBufferOccupancy %u, scheduledPRB: %u, totalDataVolume: %u\n", i,
-           p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].rlcBufferOccupancy,
-           p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].scheduledPRB,
-           p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].totalDataVolume);
-  }
-
-  printk(" Total number of PRBs: %u\n", p->nasRGDCPrimitive.eNBmeasurement_ind.totalNumPRBs);
-#endif
-  // store Measures
-  gpriv->measured_cell_id = p->nasRGDCPrimitive.eNBmeasurement_ind.cell_id;
-  gpriv->num_UEs = p->nasRGDCPrimitive.eNBmeasurement_ind.num_UEs;
-
-  for (i=0; i<gpriv-> num_UEs; ++i) {
-    gpriv->rlcBufferOccupancy[i] = p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].rlcBufferOccupancy;
-    gpriv->scheduledPRB[i] += p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].scheduledPRB;
-    gpriv->totalDataVolume[i] += p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].totalDataVolume;
-  }
-
-  gpriv->totalNumPRBs += p->nasRGDCPrimitive.eNBmeasurement_ind.totalNumPRBs;
-}
-
-//---------------------------------------------------------------------------
-// Check if anything in DC FIFO and process it (RG Finite State Machine)
-int nasrg_ASCTL_DC_receive(struct cx_entity *cx, char *buffer)
-{
-  //---------------------------------------------------------------------------
-  int bytes_read=0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC_DETAIL
-  printk("nasrg_ASCTL_DC_receive - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_DC_receive - input parameter cx is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read = rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI] , gpriv->rbuffer, NAS_TL_SIZE);
-#else
-  bytes_read = NAS_TL_SIZE;
-#endif
-
-  if (bytes_read>0) {
-    struct nas_rg_dc_element *p;
-#ifndef PDCP_USE_NETLINK
-    p= (struct nas_rg_dc_element *)(gpriv->rbuffer);
-    //get the rest of the primitive
-    bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], (uint8_t *)p+NAS_TL_SIZE, p->length-NAS_TL_SIZE);
-
-    if (bytes_read!=p->length) {
-      printk("nasrg_ASCTL_DC_receive: Problem while reading primitive's header\n");
-      return bytes_read;
-    }
-
-#else
-    p= (struct nas_rg_dc_element *)(buffer);
-    bytes_read=p->length;
-#endif
-
-    switch (p->type) {
-    case CONN_ESTABLISH_IND :
-      if (p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: CONN_ESTABLISH_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_IDLE:
-          nasrg_ASCTL_DC_decode_cx_establish_ind(cx,p);
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: CONN_ESTABLISH_IND reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case CONN_RELEASE_IND :
-      if (p->nasRGDCPrimitive.conn_release_ind.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: CONN_RELEASE_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.conn_release_ind.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-          nasrg_ASCTL_DC_decode_cx_release_ind(cx,p);
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: CONN_RELEASE_IND reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case CONN_LOSS_IND:
-      if (p->nasRGDCPrimitive.conn_loss_ind.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: CONN_LOSS_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.conn_loss_ind.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-          nasrg_ASCTL_DC_decode_cx_loss_ind(cx,p);
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: CONN_LOSS_IND reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case RB_ESTABLISH_CNF:
-      if (p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: RB_ESTABLISH_CNF reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-          nasrg_ASCTL_DC_decode_rb_establish_cnf(cx,p);
-#ifdef NAS_AUTO_MBMS
-          nasrg_ASCTL_start_default_ue_notification(cx);
-#endif
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: RB_ESTABLISH_CNF reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case DATA_TRANSFER_IND:
-      if (p->nasRGDCPrimitive.data_transfer_ind.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: DATA_TRANSFER_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-        case NAS_CX_RELEASING:
-          nasrg_ASCTL_DC_decode_data_transfer_ind(cx,p,buffer);
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: DATA_TRANSFER_IND reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-      // Temp - Should be in uplink GC-SAP
-    case MBMS_BEARER_ESTABLISH_CNF:
-      //      if (p->nasRGDCPrimitive.mbms_ue_notify_cnf.localConnectionRef!=cx->lcr)
-      //        printk("nasrg_ASCTL_DC_receive: MBMS_BEARER_ESTABLISH_CNF reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      //      else
-      nasrg_ASCTL_DC_decode_mbms_bearer_establish_cnf(p);
-      break;
-
-    case MBMS_UE_NOTIFY_CNF:
-      if (p->nasRGDCPrimitive.mbms_ue_notify_cnf.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: MBMS_UE_NOTIFY_CNF reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-          nasrg_ASCTL_DC_decode_mbms_ue_notify_cnf(cx,p);
-          /* //Temp
-          nasrg_ASCTL_start_default_mbms_service();*/
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: MBMS_UE_NOTIFY_CNF reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-      // Temp - Should be in uplink GC-SAP
-    case ENB_MEASUREMENT_IND :
-      //      if (p->nasRGDCPrimitive.eNBmeasurement_ind.localConnectionRef!=cx->lcr)
-      //        printk("nasrg_ASCTL_DC_receive: ENB_MEASUREMENT_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.eNBmeasurement_ind.localConnectionRef);
-      //      else
-      nasrg_ASCTL_DC_decode_eNBmeasurement_ind(p);
-      break;
-
-    default :
-      printk("nasrg_ASCTL_DC_receive: Invalid message received\n");
-    }
-  }
-
-  return bytes_read;
-}
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_classifier.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_classifier.c
deleted file mode 100644
index 1883b17eb06e21efa2250ea01a17b25091f5dc33..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_classifier.c
+++ /dev/null
@@ -1,1139 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_classifier.c
-* \brief Flow classification functions for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-#include <net/ip6_fib.h>
-#include <net/route.h>
-
-#define IN_CLASSA(a)            ((((long int) (a)) & 0x80000000) == 0)
-#define IN_CLASSB(a)            ((((long int) (a)) & 0xc0000000) == 0x80000000)
-#define IN_CLASSC(a)            ((((long int) (a)) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSD(a)            ((((long int) (a)) & 0xf0000000) == 0xe0000000)
-
-/* Address to accept any incoming messages. */
-#define INADDR_ANY              ((unsigned long int) 0x00000000)
-
-#define NIPADDR(addr) \
-        (uint8_t)(addr & 0x000000FF), \
-        (uint8_t)((addr & 0x0000FF00) >> 8), \
-        (uint8_t)((addr & 0x00FF0000) >> 16), \
-        (uint8_t)((addr & 0xFF000000) >> 24)
-
-#define NIP6ADDR(addr) \
-        ntohs((addr)->s6_addr16[0]), \
-        ntohs((addr)->s6_addr16[1]), \
-        ntohs((addr)->s6_addr16[2]), \
-        ntohs((addr)->s6_addr16[3]), \
-        ntohs((addr)->s6_addr16[4]), \
-        ntohs((addr)->s6_addr16[5]), \
-        ntohs((addr)->s6_addr16[6]), \
-        ntohs((addr)->s6_addr16[7])
-
-
-#define IN6_IS_ADDR_UNSPECIFIED(a) \
-        (((__const uint32_t *) (a))[0] == 0                                   \
-         && ((__const uint32_t *) (a))[1] == 0                                \
-         && ((__const uint32_t *) (a))[2] == 0                                \
-         && ((__const uint32_t *) (a))[3] == 0)
-
-#define IN6_ARE_ADDR_MASKED_EQUAL(a,b,m) \
-           (((((__const uint32_t *) (a))[0] & (((__const uint32_t *) (m))[0])) == (((__const uint32_t *) (b))[0] & (((__const uint32_t *) (m))[0])))  \
-         && ((((__const uint32_t *) (a))[1] & (((__const uint32_t *) (m))[1])) == (((__const uint32_t *) (b))[1] & (((__const uint32_t *) (m))[1])))  \
-         && ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2])))  \
-         && ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
-
-#define IN_ARE_ADDR_MASKED_EQUAL(a,b,m) \
-           (((((__const uint8_t *) (a))[0] & (((__const uint8_t *) (m))[0])) == (((__const uint8_t *) (b))[0] & (((__const uint8_t *) (m))[0])))  \
-         && ((((__const uint8_t *) (a))[1] & (((__const uint8_t *) (m))[1])) == (((__const uint8_t *) (b))[1] & (((__const uint8_t *) (m))[1])))  \
-         && ((((__const uint8_t *) (a))[2] & (((__const uint8_t *) (m))[2])) == (((__const uint8_t *) (b))[2] & (((__const uint8_t *) (m))[2])))  \
-         && ((((__const uint8_t *) (a))[3] & (((__const uint8_t *) (m))[3])) == (((__const uint8_t *) (b))[3] & (((__const uint8_t *) (m))[3]))))
-
-//---------------------------------------------------------------------------
-void nasrg_create_mask_ipv6_addr(struct in6_addr *masked_addrP, int prefix_len)
-{
-  //---------------------------------------------------------------------------
-  int   u6_addr8_index;
-  int   u6_addr1_index;
-  int   index;
-
-  masked_addrP->s6_addr32[0] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[1] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[2] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[3] = 0xFFFFFFFF;
-
-  u6_addr8_index = prefix_len >> 3;
-  u6_addr1_index = prefix_len & 0x07;
-
-  for (index = u6_addr8_index + 1; index < 16; index++) {
-    masked_addrP->s6_addr[index] = 0;
-  }
-
-  if (u6_addr1_index > 0) {
-    masked_addrP->s6_addr[u6_addr8_index] = 0xFF << (8-u6_addr1_index);
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  //printk("nasrg_create_mask_ipv6_addr: MASK = %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(masked_addrP));
-#endif
-}
-//---------------------------------------------------------------------------
-void nasrg_create_mask_ipv4_addr(struct in_addr *masked_addrP, int prefix_len)
-{
-  //---------------------------------------------------------------------------
-  if (prefix_len > 32) {
-    prefix_len = 32;
-  }
-
-  masked_addrP->s_addr = 0xFFFFFFFF << (32 - prefix_len);
-#ifdef NAS_DEBUG_CLASS
-  //printk("nasrg_create_mask_ipv4_addr: MASK = %d.%d.%d.%d\n",NIPADDR(masked_addrP));
-#endif
-  return;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (send direction)
-struct classifier_entity *nasrg_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_sclassifier: begin for dscp %d, classref %d\n", dscp,classref);
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_CLASS_add_sclassifier - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  //***
-  for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_CLASS_add_sclassifier: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_ATOMIC);
-
-  if (gc==NULL)
-    return NULL;
-
-  memset(gc, 0, sizeof(struct classifier_entity));
-  gc->next=cx->sclassifier[dscp];
-  gc->classref=classref;
-  cx->sclassifier[dscp]=gc;
-  ++cx->nsclassifier;
-  ++gpriv->next_sclassref; //increment send classref index - MW 15/01/07
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_sclassifier: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (receive direction)
-struct classifier_entity *nasrg_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_rclassifier: begin\n");
-#endif
-
-  //***
-  for (gc=gpriv->rclassifier[dscp]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_CLASS_add_rclassifier: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
-
-  if (gc==NULL)
-    return NULL;
-
-  gc->next=gpriv->rclassifier[dscp];
-  gc->classref=classref;
-  gpriv->rclassifier[dscp]=gc;
-  ++gpriv->nrclassifier;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_rclassifier: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (mbms direction)
-struct classifier_entity *nasrg_CLASS_add_mbmsclassifier(int mbms_ix, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_mbmsclassifier: begin\n");
-#endif
-
-  //***
-  for (gc=gpriv->mbmsclassifier[mbms_ix]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_CLASS_add_mbmsclassifier: classifier already exist for service %d, classref %d\n",mbms_ix,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_ATOMIC);
-
-  if (gc==NULL)
-    return NULL;
-
-  gc->next=gpriv->mbmsclassifier[mbms_ix];
-  gc->classref=classref;
-  gpriv->mbmsclassifier[mbms_ix]=gc;
-  ++gpriv->nmbmsclassifier;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_mbmsclassifier: classifier created for service index %d, classref %d\n",mbms_ix,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-void nasrg_CLASS_flush_sclassifier(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t dscpi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_sclassifier: begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_CLASS_flush_sclassifier - input parameter cx is NULL \n");
-    return;
-  }
-
-  //***
-  for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-    for (gc=cx->sclassifier[dscpi]; gc!=NULL; gc=cx->sclassifier[dscpi]) {
-      cx->sclassifier[dscpi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  cx->nsclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_sclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasrg_CLASS_flush_rclassifier()
-{
-  //---------------------------------------------------------------------------
-  uint8_t dscpi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_rclassifier: begin\n");
-#endif
-
-  //***
-  for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-    for (gc=gpriv->rclassifier[dscpi]; gc!=NULL; gc=gpriv->rclassifier[dscpi]) {
-      gpriv->rclassifier[dscpi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  gpriv->nrclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_rclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasrg_CLASS_flush_mbmsclassifier()
-{
-  //---------------------------------------------------------------------------
-  int mbmsi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_mbmsclassifier: begin\n");
-#endif
-
-  //***
-  for (mbmsi=0; mbmsi<NASRG_MBMS_SVCES_MAX; ++mbmsi) {
-    for (gc=gpriv->mbmsclassifier[mbmsi]; gc!=NULL; gc=gpriv->mbmsclassifier[mbmsi]) {
-      gpriv->mbmsclassifier[mbmsi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  gpriv->nmbmsclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_mbmsclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (send direction)
-void nasrg_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_sclassifier: begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_CLASS_del_sclassifier - input parameter cx is NULL \n");
-    return;
-  }
-
-  //***
-  p=cx->sclassifier[dscp];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    cx->sclassifier[dscp]=p->next;
-    kfree(p);
-    --cx->nsclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --cx->nsclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_sclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (receive direction)
-void nasrg_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_rclassifier: begin\n");
-#endif
-  //***
-  p=gpriv->rclassifier[dscp];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    gpriv->rclassifier[dscp]=p->next;
-    kfree(p);
-    --gpriv->nrclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --gpriv->nrclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_rclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (mbms direction)
-void nasrg_CLASS_del_mbmsclassifier(int mbms_ix, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_mbmsclassifier: begin\n");
-#endif
-  //***
-  p=gpriv->mbmsclassifier[mbms_ix];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    gpriv->mbmsclassifier[mbms_ix]=p->next;
-    kfree(p);
-    --gpriv->nmbmsclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --gpriv->nmbmsclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_mbmsclassifier: end\n");
-#endif
-}
-
-/*  ORIGINAL VERSION
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nasrg_CLASS_cx4(struct sk_buff *skb){
-//---------------------------------------------------------------------------
-  uint8_t cxi;
-  #ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_cx4: begin\n");
-  #endif
-  cxi=0;
-  return gpriv->cx+cxi;
-//#endif
-}*/
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nasrg_CLASS_cx4(struct sk_buff *skb, unsigned char dscp, int *paddr_type, unsigned char *cx_index)
-{
-  //---------------------------------------------------------------------------
-  unsigned char cxi;
-  uint32_t daddr;
-  struct cx_entity *cx=NULL;
-  struct classifier_entity *pclassifier=NULL;
-  struct in_addr masked_addr;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_cx4: begin\n");
-#endif
-
-  if (skb!=NULL) {
-    daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr;
-
-    if (daddr != INADDR_ANY) {
-#ifdef NAS_DEBUG_CLASS
-      printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
-      printk(" DEST ADDR %d.%d.%d.%d\n",NIPADDR(ip_hdr(skb)->daddr));
-#endif
-
-      if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
-        // TO BE CHECKED
-        *paddr_type = NAS_IPV4_ADDR_MC_SIGNALLING;
-      } else {
-        if (ipv4_is_lbcast(ip_hdr(skb)->daddr)) {
-          // TO BE CHECKED
-          *paddr_type = NAS_IPV4_ADDR_BROADCAST;
-        } else {
-          if (IN_CLASSA(ip_hdr(skb)->daddr) || IN_CLASSB(ip_hdr(skb)->daddr) || IN_CLASSC(ip_hdr(skb)->daddr)) {
-            *paddr_type = NAS_IPV4_ADDR_UNICAST;
-
-            for (cxi=*cx_index; cxi<NAS_CX_MAX; ++cxi) {
-              (*cx_index)++;
-              pclassifier = gpriv->cx[cxi].sclassifier[dscp];
-
-              while (pclassifier!=NULL) {
-                // verify that this is an IPv4 classifier
-                if ((pclassifier->version == NAS_VERSION_4)  || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-                  nasrg_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-
-                  if (IN_ARE_ADDR_MASKED_EQUAL(&ip_hdr(skb)->daddr, &(pclassifier->daddr.ipv4), &masked_addr)) {
-#ifdef NAS_DEBUG_CLASS
-                    printk("nasrg_CLASS_cx4: IP MASK MATCHED: found cx %d: %d.%d.%d.%d/%d\n",cxi, NIPADDR(pclassifier->daddr.ipv4), pclassifier->dplen);
-#endif
-                    return &gpriv->cx[cxi];
-                  }
-                }
-
-                // goto to next classification rule for the connection
-                pclassifier = pclassifier->next;
-              }
-            }
-          } else {
-            *paddr_type = NAS_IPV4_ADDR_UNKNOWN;
-          }
-        }
-      }
-    }
-  }
-
-  return cx;
-}
-
-/*  ORIGINAL VERSION
-//---------------------------------------------------------------------------
-// Search the entity corresponding to destination address in IPv6 header
-struct cx_entity *nasrg_CLASS_cx6(struct sk_buff *skb, int* paddr_type, int* pmbms_ix){
-//---------------------------------------------------------------------------
-  struct cx_entity * cx=NULL;
-  uint8_t cxi;
-  uint32_t mc_addr_hdr, uni_ifid1, uni_ifid2;
-  //int addr_type = NASRG_ADDR_UNKNOWN;
-
-  #ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_cx6: begin\n");
-  #endif
-  if (!skb){
-     printk("nasrg_CLASS_cx6 - input parameter skb is NULL \n");
-    return cx;
-  }
-  *paddr_type = NASRG_ADDR_UNKNOWN;
-  //mc_addr_hdr = ntohl(skb->nh.ipv6h->daddr.in6_u.u6_addr32[0]);
-  mc_addr_hdr = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0]);
-  // First check if multicast [1st octet is FF]
-  if ((mc_addr_hdr & 0xFF000000) == 0xFF000000) {
-     // packet type according to the scope of the multicast packet
-     // we don't consider RPT bits in second octet [maybe done later if needed]
-      switch(mc_addr_hdr & 0x000F0000) {
-       case (0x00020000):
-         *paddr_type = NASRG_ADDR_MC_SIGNALLING;
-         #ifdef NAS_DEBUG_CLASS
-         printk("nasrg_CLASS_cx6: multicast packet - signalling \n");
-         #endif
-         break;
-       case (0x000E0000):
-         *paddr_type = NASRG_ADDR_MC_MBMS;
-         *pmbms_ix = 0;
-         cx=gpriv->cx;  // MBMS associate to Mobile 0
-         #ifdef NAS_DEBUG_CLASS
-         printk("nasrg_CLASS_cx6: multicast packet - MBMS data \n");
-         #endif
-         break;
-       default:
-         *paddr_type = NASRG_ADDR_UNKNOWN;
-         *pmbms_ix = NASRG_MBMS_SVCES_MAX;
-     }
-  // This is not multicast, so we should be able to identify the MT
-  }else{
-     #ifdef NAS_DEBUG_CLASS
-     printk("nasrg_CLASS_cx6: unicast packet\n");
-     #endif
-     *paddr_type = NASRG_ADDR_UNICAST;
-     uni_ifid1 = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[2]);
-     uni_ifid2 = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[3]);
-     for (cxi=0; cxi<NAS_CX_MAX; cxi++){
-       cx=gpriv->cx+cxi;
-       #ifdef NAS_DEBUG_SEND_DETAIL
-       printk("nasrg_CLASS_cx6: Compared addresses \n");
-       printk("                Daddr[2] %ul, Daddr[3] %ul\n",
-                 ipv6_hdr(skb)->daddr.in6_u.u6_addr32[2],ipv6_hdr(skb)->daddr.in6_u.u6_addr32[3]);
-       printk("          ntohl Daddr[2] %ul, Daddr[3] %ul\n",uni_ifid1,uni_ifid2);
-       printk("                IIF[0]   %ul, IIF[1]   %ul\n",cx->iid6[0],cx->iid6[1]);
-       printk("          htonl IIF[0]   %ul, IIF[1]   %ul\n",htonl(cx->iid6[0]),htonl(cx->iid6[1]));
-       #endif
-       if (((cx->iid6[0] == uni_ifid1)&&(cx->iid6[1] == uni_ifid2))
-              || ((htonl(cx->iid6[0]) == uni_ifid1)&&(htonl(cx->iid6[1]) == uni_ifid2))){
-         return cx;
-       }
-     }
-  }
-  return cx;
-}*/
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv6 address 'addr'
-// Navid: the ipv6 classifier is not fully tested
-struct cx_entity *nasrg_CLASS_cx6(struct sk_buff *skb, unsigned char dscp, int *paddr_type, unsigned char *cx_index, int* pmbms_ix)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  struct cx_entity *cx = NULL;
-  struct classifier_entity *sclassifier= NULL;
-  uint32_t mc_addr_hdr;
-  struct in6_addr masked_addr;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_cx6: begin\n");
-#endif
-
-  if (skb) {
-#ifdef NAS_DEBUG_CLASS
-    printk("nasrg_CLASS_cx6: SOURCE ADDR %X:%X:%X:%X:%X:%X:%X:%X",NIP6ADDR(&(ipv6_hdr(skb)->saddr)));
-    printk(" DEST ADDR %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&(ipv6_hdr(skb)->daddr)));
-#endif
-    mc_addr_hdr = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0]);
-
-    // First check if multicast [1st octet is FF]
-    if ((mc_addr_hdr & 0xFF000000) == 0xFF000000) {
-      // packet type according to the scope of the multicast packet
-      // we don't consider RPT bits in second octet [maybe done later if needed]
-      switch(mc_addr_hdr & 0x000F0000) {
-      case (0x00020000):
-        *paddr_type = NAS_IPV6_ADDR_MC_SIGNALLING;
-#ifdef NAS_DEBUG_CLASS
-        printk("nasrg_CLASS_cx6: multicast packet - signalling \n");
-#endif
-        break;
-
-      case (0x000E0000):
-        *paddr_type = NAS_IPV6_ADDR_MC_MBMS;
-        *pmbms_ix = 0;
-        cx=gpriv->cx;  // MBMS associate to Mobile 0
-#ifdef NAS_DEBUG_CLASS
-        printk("nasrg_CLASS_cx6: multicast packet - MBMS data \n");
-#endif
-        break;
-
-      default:
-        printk("nasrg_CLASS_cx6: default multicast\n");
-        *paddr_type = NAS_IPV6_ADDR_UNKNOWN;
-        *pmbms_ix = NASRG_MBMS_SVCES_MAX;
-      }
-    } else {
-      // This is not multicast, so we should be able to identify the MT
-      *paddr_type = NAS_IPV6_ADDR_UNICAST;
-
-      for (cxi=*cx_index; cxi<NAS_CX_MAX; cxi++) {
-        //cxi = 0;
-        (*cx_index)++;
-        sclassifier = gpriv->cx[cxi].sclassifier[dscp];
-
-        while (sclassifier!=NULL) {
-          // verify that this is an IPv6 classifier
-          if ((sclassifier->version == NAS_VERSION_6) || (sclassifier->version == NAS_VERSION_DEFAULT)) {
-            /*LGif (IN6_IS_ADDR_UNSPECIFIED(&(sclassifier->daddr.ipv6))) {
-              printk("nas_CLASS_cx6: addr is null \n");
-              sclassifier = sclassifier->next;
-              continue;
-              }*/
-#ifdef NAS_DEBUG_CLASS
-            printk("cx %d : DSCP %d %X:%X:%X:%X:%X:%X:%X:%X\n",cxi, dscp, NIP6ADDR(&(sclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-
-            //if ((dst = (unsigned int*)&(((struct rt6_info *)skbdst)->rt6i_gateway)) == 0){
-            // LG: STRANGE
-            if (IN6_IS_ADDR_UNSPECIFIED(&ipv6_hdr(skb)->daddr)) {
-              printk("nasrg_CLASS_cx6: dst addr is null \n");
-              sclassifier = sclassifier->next;
-              continue;
-            }
-
-            nasrg_create_mask_ipv6_addr(&masked_addr, sclassifier->dplen);
-            // Modified MW to check only the iid6
-            masked_addr.s6_addr32[0] = 0x00000000;
-            masked_addr.s6_addr32[1] = 0x00000000;
-
-            if (IN6_ARE_ADDR_MASKED_EQUAL(&ipv6_hdr(skb)->daddr, &(sclassifier->daddr.ipv6), &masked_addr)) {
-#ifdef NAS_DEBUG_CLASS
-              printk("nasrg_CLASS_cx6: found cx %d: %X:%X:%X:%X:%X:%X:%X:%X\n",cxi, NIP6ADDR(&(sclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-              return &gpriv->cx[cxi];
-            }
-          }
-
-          // Go to next classifier entry for connection
-          sclassifier = sclassifier->next;
-        }
-      }
-    }
-  }
-
-  //printk("nas_CLASS_cx6 NOT FOUND: %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&ipv6_hdr(skb)->daddr));
-  return cx;
-}
-
-//---------------------------------------------------------------------------
-// Search the sending function for IP Packet
-void nasrg_CLASS_send(struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity  *pclassifier, *sp;
-  uint8_t *protocolh = NULL;
-  uint8_t version;
-  uint8_t protocol, dscp;
-  uint16_t classref;
-  struct cx_entity *cx;
-  unsigned int i;
-#ifdef NAS_DEBUG_CLASS
-  char sfct[10], sprotocol[10];
-#endif
-  struct net_device *dev = gdev;
-  unsigned char cx_index,no_connection;
-  int addr_type;
-  int mbms_ix;
-  struct in6_addr masked6_addr;
-  struct in_addr  masked_addr;
-  // RARP vars
-  struct arphdr  *rarp;
-  unsigned char  *rarp_ptr;
-  /* s for "source", t for "target" */
-  __be32 sip, tip;
-  unsigned char *sha, *tha;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_send: begin -\n");
-#endif
-
-  if (skb==NULL) {
-    printk("nasrg_CLASS_send - input parameter skb is NULL \n");
-    return;
-  }
-
-  //***
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_CLASS_send - Received IP packet to transmit, length %d\n", skb->len);
-#endif
-#ifdef NAS_DEBUG_SEND_DETAIL
-
-  if ((skb->data) != NULL) {
-    if (skb->len<150)
-      nasrg_TOOL_print_buffer(skb->data,skb->len);
-    else
-      nasrg_TOOL_print_buffer(skb->data,150);
-  }
-
-#endif
-  //***
-  // find all connections related to socket
-  cx_index   = 0;
-  no_connection = 1;
-  cx = NULL;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_send: [before switch on IP protocol version] \n");
-#endif
-
-
-  // Get mobile connexion entity, protocol and dscp from IP packet
-  switch (ntohs(skb->protocol)) {
-  case ETH_P_IPV6:
-#ifdef NAS_DEBUG_CLASS_DETAIL
-    printk("nasrg_CLASS_send : skb->protocol : IPv6 \n");
-#endif
-    version = NAS_VERSION_6;
-    addr_type = NAS_IPV6_ADDR_UNKNOWN;
-    protocolh = nasrg_TOOL_get_protocol6(ipv6_hdr(skb), &protocol);
-    dscp      = nasrg_TOOL_get_dscp6 (ipv6_hdr(skb));
-    cx        = nasrg_CLASS_cx6 (skb, dscp, &addr_type, &cx_index, &mbms_ix);
-#ifdef NAS_DEBUG_CLASS_DETAIL
-    printk("nasrg_CLASS_send - ETH_P_IPV6 skb %p dscp %d gpriv %p cx_index %p \n",skb, dscp, gpriv, &cx_index);
-#endif
-
-    // find in default DSCP a valid classification
-    if (cx == NULL) {
-      switch (addr_type) {
-      case NAS_IPV6_ADDR_MC_SIGNALLING:
-      case NAS_IPV6_ADDR_UNICAST:
-#ifdef NAS_DEBUG_CLASS_DETAIL
-        printk("nasrg_CLASS_send - case NAS_IPV6_ADDR_MC_SIGNALLING | NAS_IPV6_ADDR_UNICAST\n");
-#endif //NAS_DEBUG_CLASS
-
-        for (i=0; i<NAS_CX_MAX; i++) {
-          pclassifier=(&gpriv->cx[i])->sclassifier[NAS_DSCP_DEFAULT];
-
-          while (pclassifier!=NULL) {
-            if ((pclassifier->version == NAS_VERSION_6) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-              // ok found default classifier for this packet
-              nasrg_create_mask_ipv6_addr(&masked6_addr, pclassifier->dplen);
-              // Modified MW to let everything go (pb with signalling)
-              masked6_addr.s6_addr32[0] = 0x00000000;
-              masked6_addr.s6_addr32[1] = 0x00000000;
-#ifdef NAS_DEBUG_CLASS_DETAIL
-              printk("nasrg_CLASS_send - cx %d : DSCP NAS_DSCP_DEFAULT %X:%X:%X:%X:%X:%X:%X:%X\n",i, NIP6ADDR(&(pclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-
-              if (IN6_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv6, &ipv6_hdr(skb)->daddr, &masked6_addr)) {
-                // then force dscp
-                cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-                printk("nasrg_CLASS_send - ETH_P_IPV6 FOUND NAS_DSCP_DEFAULT with IN6_ARE_ADDR_MASKED_EQUAL(%d bits)\n",pclassifier->dplen);
-#endif
-                dscp = NAS_DSCP_DEFAULT;
-                break;
-              } else {
-                if(IN6_IS_ADDR_UNSPECIFIED(&pclassifier->daddr.ipv6)) {
-                  cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-                  printk("nasrg_CLASS_send - ETH_P_IPV6 FOUND NAS_DSCP_DEFAULT with IN6_IS_ADDR_UNSPECIFIED\n");
-#endif
-                  dscp = NAS_DSCP_DEFAULT;
-                  break;
-                }
-              }
-            }
-
-            pclassifier = pclassifier->next;
-          }
-        }
-
-        break;
-
-        // MBMS is broken!!!! To be updated (these values will be over-ridden afterwards
-      case NAS_IPV6_ADDR_MC_MBMS:
-#ifdef NAS_DEBUG_CLASS
-        printk("nasrg_CLASS_send - case NAS_IPV6_ADDR_MC_MBMS\n");
-#endif //NAS_DEBUG_CLASS
-        pclassifier = gpriv->mbmsclassifier[mbms_ix];
-        printk("nasrg_CLASS_send: MBMS is broken!!!!\n\n\n");
-        sp = gpriv->mbmsclassifier[mbms_ix];
-
-        if (sp!= NULL) {
-          classref=sp->classref;
-#ifdef NAS_DEBUG_CLASS_DETAIL
-          printk("nasrg_CLASS_send: classifier found for multicast service %d \n", mbms_ix);
-#endif
-        } else {
-          printk("nasrg_CLASS_send: No corresponding multicast bearer, so the message is dropped\n");
-          return;
-        }
-
-        break;
-
-        // should have found a valid classification rule
-      case NAS_IPV6_ADDR_UNKNOWN:
-      default:
-        printk("nasrg_CLASS_send: No corresponding address type\n");
-      }
-    }
-
-    break;
-
-  case ETH_P_ARP:
-#ifdef NAS_DEBUG_CLASS
-    printk("nasrg_CLASS_send : skb->protocol : ARP \n");
-#endif
-    version = NAS_VERSION_4;
-    addr_type = NAS_IPV4_ADDR_BROADCAST;
-    dscp = 0;
-    cx = NULL;
-    // Basic sanity checks can be done without the lock
-    rarp = (struct arphdr *)skb_network_header(skb);
-
-    if (rarp) {
-      if (rarp->ar_hln != dev->addr_len || dev->type != ntohs(rarp->ar_hrd)) {
-        printk("nasrg_CLASS_send: ARP PACKET WRONG ADDR LEN or WRONG ARP HEADER TYPE\n");
-        break;
-      }
-    } else {
-      printk("nasrg_CLASS_send: ARP HEADER POINTER IS NULL\n");
-      break;
-    }
-
-    // If it's not Ethernet, delete it.
-    if (rarp->ar_pro != htons(ETH_P_IP)) {
-      printk("nasrg_CLASS_send: ARP PACKET PROTOCOL IS NOT ETHERNET\n");
-      break;
-    }
-
-    rarp_ptr = (unsigned char *) (rarp + 1);
-    sha = rarp_ptr;
-    rarp_ptr += dev->addr_len;
-    memcpy(&sip, rarp_ptr, 4);
-    rarp_ptr += 4;
-    tha = rarp_ptr;
-    rarp_ptr += dev->addr_len;
-    memcpy(&tip, rarp_ptr, 4);
-#ifdef NAS_DEBUG_CLASS
-    printk("nasrg_CLASS_send: ARP DEST IP transport IP = %d.%d.%d.%d\n",NIPADDR(tip));
-#endif
-
-    for (i=0; i<NAS_CX_MAX; i++) {
-      pclassifier=(&gpriv->cx[i])->sclassifier[NAS_DSCP_DEFAULT];
-
-      while (pclassifier!=NULL) {
-        if ((pclassifier->version == NAS_VERSION_4) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-          // ok found default classifier for this packet
-          nasrg_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-#ifdef NAS_DEBUG_CLASS
-          printk("nasrg_CLASS_send: MASK = %d.%d.%d.%d\n",NIPADDR(masked_addr.s_addr));
-#endif
-
-          //
-          if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &tip, &masked_addr.s_addr)) {
-            // then force dscp
-            cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-            printk("nasrg_CLASS_send: ETH_P_ARP FOUND NAS_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n", pclassifier->dplen);
-#endif
-            dscp = NAS_DSCP_DEFAULT;
-            break;
-          } else {
-            if (INADDR_ANY == pclassifier->daddr.ipv4) {
-              cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-              printk("nasrg_CLASS_send: ETH_P_ARP FOUND NAS_DSCP_DEFAULT with INADDR_ANY\n");
-#endif
-              dscp = NAS_DSCP_DEFAULT;
-              break;
-            }
-          }
-        }
-
-        pclassifier = pclassifier->next;
-      }
-    }
-
-    break;
-
-  case ETH_P_IP:
-#ifdef NAS_DEBUG_CLASS_DETAIL
-    printk("nasrg_CLASS_send : skb->protocol : IPv4 \n");
-#endif
-    version   = NAS_VERSION_4;
-    addr_type = NAS_IPV4_ADDR_UNKNOWN;
-    dscp      = nasrg_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
-    cx        = nasrg_CLASS_cx4(skb, dscp, &addr_type, &cx_index);
-    protocolh = nasrg_TOOL_get_protocol4((struct iphdr *)(skb_network_header(skb)), &protocol);
-
-    // find in default DSCP a valid classification
-    if (cx == NULL) {
-      switch (addr_type) {
-      case NAS_IPV4_ADDR_MC_SIGNALLING:
-      case NAS_IPV4_ADDR_UNICAST:
-      case NAS_IPV4_ADDR_BROADCAST:
-        for (i=0; i<NAS_CX_MAX; i++) {
-          pclassifier=(&gpriv->cx[i])->sclassifier[NAS_DSCP_DEFAULT];
-
-          while (pclassifier != NULL) {
-            if ((pclassifier->version == NAS_VERSION_4) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-              // ok found default classifier for this packet
-              nasrg_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-#ifdef NAS_DEBUG_CLASS_DETAIL
-              printk("nasrg_CLASS_send : MASK = %d.%d.%d.%d\n", NIPADDR(masked_addr.s_addr));
-#endif
-
-              if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &ip_hdr(skb)->daddr, &masked_addr.s_addr)) {
-                // then force dscp
-                cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-                printk("nasrg_CLASS_send : ETH_P_IP FOUND NAS_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n",pclassifier->dplen);
-#endif
-                dscp = NAS_DSCP_DEFAULT;
-                break;
-              } else {
-                if(INADDR_ANY == pclassifier->daddr.ipv4) {
-                  cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-                  printk("nasrg_CLASS_send : ETH_P_IP FOUND NAS_DSCP_DEFAULT with INADDR_ANY\n");
-#endif
-                  dscp = NAS_DSCP_DEFAULT;
-                  break;
-                }
-              }
-            }
-
-            pclassifier = pclassifier->next;
-          }
-        }
-
-        break;
-
-        // should have found a valid classification rule
-      case NAS_IPV4_ADDR_UNKNOWN:
-      default:
-        printk("nasrg_CLASS_send: No corresponding address type\n");
-      }
-    }
-
-#ifdef NAS_DEBUG_CLASS
-
-    if (cx)
-      printk("nasrg_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, cx = %d\n",ntohs(skb->protocol),dscp,cx->lcr);
-    else
-      printk("nasrg_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, No valid connection\n",ntohs(skb->protocol),dscp);
-
-#endif
-    break;
-
-  default:
-    printk("nasrg_CLASS_send: Unknown IP version protocol\n");
-    version = 0;
-    return;
-  }
-
-#ifdef NAS_DEBUG_CLASS_DETAIL
-  printk("nasrg_CLASS_send: [before if (cx != NULL)]\n");
-#endif
-
-  //Next lines bypass classifiers to test the netlink socket
-  //#define DEBUG_NETLINKRG_TEST
-#ifdef DEBUG_NETLINKRG_TEST
-  nasrg_COMMON_QOS_send_test_netlink(skb);
-  return;
-#endif
-
-  // If a valid connection for the DSCP/EXP with destination address
-  // is found scan all protocol-based classification rules
-  if (cx != NULL) {
-    classref = 0;
-    sp = NULL;
-
-    if (cx->state!=NAS_CX_DCH) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_CLASS_send: UE not connected, in state %d. Packet is dropped\n",cx->state);
-#endif
-      return;
-    }
-
-    if (addr_type==NAS_IPV6_ADDR_MC_MBMS) {
-      sp = gpriv->mbmsclassifier[mbms_ix];
-
-      if (sp!= NULL) {
-        classref=sp->classref;
-#ifdef NAS_DEBUG_CLASS
-        printk("nasrg_CLASS_send: classifier found for multicast index %d, service %d\n", mbms_ix, gpriv->mbms_rb[mbms_ix].cnxid);
-#endif
-      } else {
-        // Temp MEDIEVAL : use default classifier
-        sp = cx->sclassifier[NAS_DSCP_DEFAULT];
-
-        if (sp!= NULL) {
-          classref=sp->classref;
-#ifdef NAS_DEBUG_CLASS
-          printk("nasrg_CLASS_send: classifier for multicast service %d replaced by default %d\n", mbms_ix, classref);
-#endif
-#ifdef NAS_AUTO_MBMS
-          nasrg_ASCTL_start_default_mbms_service();
-#endif
-        } else {
-          printk("nasrg_CLASS_send: No corresponding multicast bearer, so the message is dropped\n");
-          return;
-        }
-      }
-    } else {
-#ifdef NAS_DEBUG_CLASS_DETAIL
-      printk("nasrg_CLASS_send: DSCP %d version %d: looking for classifier entry\n",dscp, version);
-#endif
-
-      for (pclassifier=cx->sclassifier[dscp]; pclassifier!=NULL; pclassifier=pclassifier->next) {
-#ifdef NAS_DEBUG_CLASS_DETAIL
-        printk("nasrg_CLASS_send: DSCP %d p->classref=%d,p->protocol=%d,p->version=%d\n",dscp,pclassifier->classref,pclassifier->protocol,pclassifier->version);
-#endif
-
-        // normal rule checks that network protocol version matches
-        if ((pclassifier->version == version)  || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-          //printk("nasrg_CLASS_send: IP version are equals\n");
-          sp=pclassifier;
-          classref=sp->classref;
-#ifdef NAS_DEBUG_CLASS_DETAIL
-          printk("nasrg_CLASS_send: classifier found for dscp %u \n", dscp);
-#endif
-          break;
-        }
-      }
-    }
-
-    if (sp!=NULL) {
-#ifdef NAS_DEBUG_CLASS
-
-      //char sfct[10], sprotocol[10];
-      // classifier entity found. Print its parameters
-      if (sp->fct==nasrg_COMMON_QOS_send)
-        strcpy(sfct, "data xfer");
-
-      if (sp->fct==nasrg_CTL_send)
-        strcpy(sfct, "iocontrol");
-
-      if (sp->fct==nasrg_COMMON_del_send)
-        strcpy(sfct, "delete");
-
-      if (sp->fct==nasrg_ASCTL_DC_send_sig_data_request)
-        strcpy(sfct, "DC-SAP");
-
-      switch(protocol) {
-      case NAS_PROTOCOL_UDP:
-        strcpy(sprotocol, "udp");
-        printk("udp packet\n");
-        break;
-
-      case NAS_PROTOCOL_TCP:
-        strcpy(sprotocol, "tcp");
-        printk("tcp packet\n");
-        break;
-
-      case NAS_PROTOCOL_ICMP4:
-        strcpy(sprotocol, "icmp4");
-        printk("icmp4 packet\n");
-        break;
-
-      case NAS_PROTOCOL_ICMP6:
-        strcpy(sprotocol, "icmp6");
-        nasrg_TOOL_pk_icmp6((struct icmp6hdr*)protocolh);
-        break;
-
-      default:
-        strcpy(sprotocol, "other L4");
-        break;
-      }
-
-      printk("nasrg_CLASS_send: (dscp %u, %s) received, (classref %u, fct %s, drb_id %u) classifier rule\n",
-             dscp, sprotocol, sp->classref, sfct, sp->rab_id);
-#endif
-
-      //forward packet to the correct entity
-      if (sp->fct!=NULL) {
-        sp->fct(skb, cx, sp);
-      } else {
-        printk("\n\nnasrg_CLASS_send: ERROR : CLASSIFIER FUNCTION IS NULL\n\n");
-      }
-
-      no_connection = 0;
-      // end : if classifier entry match found
-    } else {
-      printk("nasrg_CLASS_send: no corresponding item in the classifier list, so the message is dropped\n");
-      printk("nasrg_CLASS_send: packet parameters: dscp %u, %s\n", dscp, sprotocol);
-      nasrg_COMMON_del_send(skb, cx, NULL);  // Note MW: LG has commented this line. Why?
-    }
-  }   // if connection found
-
-#ifdef NAS_DEBUG_CLASS
-
-  if (no_connection == 1) {
-    printk("nasrg_CLASS_send: no corresponding connection, so the message is dropped\n");
-  }
-
-#endif
-#ifdef NAS_DEBUG_CLASS_DETAIL
-  printk("nasrg_CLASS_send: end\n");
-#endif
-}
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_common.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_common.c
deleted file mode 100644
index e2819d075ed905b3a1646645c4ae7a835b86a959..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_common.c
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_common.c
-* \brief Common functions for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-#include <linux/inetdevice.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/etherdevice.h>
-#endif
-
-//---------------------------------------------------------------------------
-// Receive data from FIFO (QOS or DC)
-//void nasrg_COMMON_receive(uint16_t hlen, uint16_t dlen, int sap){
-void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap)
-{
-  //---------------------------------------------------------------------------
-  struct sk_buff *skb;
-  struct ipversion *ipv;
-  unsigned int hard_header_len;
-  uint16_t  *p_ether_type;
-  uint16_t  ether_type;
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_receive: begin\n");
-#endif
-#ifdef PDCP_USE_NETLINK
-
-  // data_buffer is NULL if FIFOs
-  if (!data_buffer) {
-    printk("nasrg_COMMON_receive - input parameter data_buffer is NULL \n");
-    return;
-  }
-
-#endif
-
-  skb = dev_alloc_skb( payload_length + 2 );
-
-  if(!skb) {
-    printk("nasrg_COMMON_receive: low on memory\n");
-    ++gpriv->stats.rx_dropped;
-    return;
-  }
-
-  skb_reserve(skb,2);
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read += rtf_get(sap, skb_put(skb, payload_length), payload_length);
-
-  if (bytes_read != NAS_PDCPH_SIZE + payload_length) {
-    printk("nasrg_COMMON_receive: problem while reading rtf sap\n");
-    kfree(skb->data);
-    dev_kfree_skb(skb);
-    return;
-  }
-
-#else
-  memcpy(skb_put(skb, payload_length), data_buffer, payload_length);
-  bytes_read += payload_length;
-#endif
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_receive: received packet from PDCP, length %d\n", bytes_read);
-#endif
-
-  skb->dev = gdev;
-  hard_header_len = gdev->hard_header_len;
-  skb->mac_header = skb->data;
-  skb->pkt_type = PACKET_HOST;
-  skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-  ipv = (struct ipversion *)&(skb->data[hard_header_len]);
-
-  switch (ipv->version) {
-  case 6:
-#ifdef NAS_DEBUG_RECEIVE_BASIC
-    printk("nasrg_COMMON_receive: receive IPv6 message\n");
-#endif
-    skb->network_header = &skb->data[hard_header_len];
-    // set  protocol default value
-    skb->protocol = htons(ETH_P_IPV6);
-    // If type Ethernet, correct it
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    skb->protocol = eth_type_trans(skb, gdev);
-#endif
-    break;
-
-  case 4:
-#ifdef NAS_DEBUG_RECEIVE_BASIC
-    printk("nasrg_COMMON_receive: receive IPv4 message\n");
-#endif
-
-#ifdef NAS_DEBUG_RECEIVE
-    addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
-
-    if (addr) {
-      printk("nasrg_COMMON_receive: Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
-    }
-
-    addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
-
-    if (addr) {
-      printk("nasrg_COMMON_receive Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
-    }
-
-    printk("nasrg_COMMON_receive protocol  %d\n",((struct iphdr *)&skb->data[hard_header_len])->protocol);
-#endif
-
-    skb->network_header = &skb->data[hard_header_len];
-    // set  protocol default value
-    skb->protocol = htons(ETH_P_IP);
-    // If type Ethernet, correct it
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    skb->protocol = eth_type_trans(skb, gdev);
-#endif
-    break;
-
-  default:
-    printk("nasrg_COMMON_receive: Packet is not IPv4 or IPv6 (version=%d)\n", ipv->version);
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#ifdef NAS_DEBUG_RECEIVE
-    printk("nasrg_COMMON_receive: ether_type=%04X\n", ether_type);
-#endif
-    skb->protocol = eth_type_trans(skb, gdev);
-    // minus 1(short) instead of 2(bytes) because uint16_t*
-    p_ether_type = (uint16_t *)&(skb->mac_header[hard_header_len-2]);
-    ether_type = ntohs(*p_ether_type);
-#ifdef NAS_DEBUG_RECEIVE
-    printk("nasrg_COMMON_receive: ether_type=%04X\n", ether_type);
-#endif
-
-    switch (ether_type) {
-    case ETH_P_ARP:
-      printk("nasrg_COMMON_receive: ether_type = ETH_P_ARP\n");
-      skb->protocol = htons(ETH_P_ARP);
-      skb->network_header = &skb->mac_header[hard_header_len];
-      break;
-
-    default:
-      break;
-    }
-
-#endif
-  }
-
-  ++gpriv->stats.rx_packets;
-  gpriv->stats.rx_bytes += bytes_read;
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_receive: forwarding packet of size %d to kernel\n",skb->len);
-#endif
-
-  netif_rx(skb);
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_receive: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete the data
-void nasrg_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp)
-{
-  //---------------------------------------------------------------------------
-  ++gpriv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (QoS SAP)
-void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  struct pdcp_data_req_header_t  pdcph;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send - begin \n");
-#endif
-
-  //  if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
-  //  {
-  //    gpriv->stats.tx_dropped ++;
-  //    printk("NAS_QOS_SEND: No connected, so message are dropped \n");
-  //    return;
-  //  }
-  if (!skb || !gc || !cx) {
-    printk("nasrg_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  if (gc->rb==NULL) {
-    gc->rb=nasrg_COMMON_search_rb(cx, gc->rab_id);
-
-    if (gc->rb==NULL) {
-      ++gpriv->stats.tx_dropped;
-      printk("nasrg_COMMON_QOS_send: No corresponding Radio Bearer, so message is dropped, rab_id=%u \n", gc->rab_id);
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #1 :");
-  printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
-#endif
-#ifdef NAS_DEBUG_SEND_DETAIL
-  nasrg_TOOL_print_classifier(gc);
-#endif
-  pdcph.data_size  = skb->len;
-  //pdcph.rb_id      = (gc->rb)->rab_id+(NAS_RB_MAX_NUM*cx->lcr);
-  pdcph.rb_id      = ((gc->rb)->rab_id)-NAS_SIG_NUM_SRB;
-  pdcph.inst       = 0;
-
-#ifdef PDCP_USE_NETLINK
-  bytes_wrote = nasrg_netlink_send((unsigned char *)&pdcph,NAS_PDCPH_SIZE, NASNL_DEST_PDCP);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n", bytes_wrote,skb->len);
-#endif
-#else
-  //bytes_wrote = rtf_put(gpriv->sap[(gc->rb)->sapi], &pdcph, NAS_PDCPH_SIZE);
-  bytes_wrote = rtf_put(NAS2PDCP_FIFO, &pdcph, NAS_PDCPH_SIZE);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP fifo\n", bytes_wrote,skb->len);
-#endif
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != NAS_PDCPH_SIZE) {
-    printk("nasrg_COMMON_QOS_send: problem while writing PDCP's header\n");
-    printk("PDCP rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_COMMON_QOS_send #2 :");
-  printk("Header bytes written : %d\n", bytes_wrote);
-#endif
-
-#ifdef  PDCP_USE_NETLINK
-  bytes_wrote += nasrg_netlink_send((unsigned char *)skb->data,skb->len, NASNL_DEST_PDCP);
-#else
-  //bytes_wrote += rtf_put(gpriv->sap[(gc->rb)->sapi], skb->data, skb->len);
-  bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
-    printk("nasrg_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
-    printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #3 :");
-  printk(" %d bytes written to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id, NAS2PDCP_FIFO);
-#endif
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_COMMON_QOS_send - end \n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (QoS SAP)
-void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct pdcp_data_req_header_t  pdcph;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send - begin \n");
-#endif
-
-  //  if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
-  //  {
-  //    gpriv->stats.tx_dropped ++;
-  //    printk("NAS_QOS_SEND: No connected, so message are dropped \n");
-  //    return;
-  //  }
-  if (!skb ) {
-    printk("nasrg_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #1 :");
-  //  printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
-  //  nasrg_TOOL_print_classifier(gc);
-#endif
-  pdcph.data_size  = skb->len;
-  //pdcph.rb_id      = (gc->rb)->rab_id+(NAS_RB_MAX_NUM*cx->lcr);
-  pdcph.rb_id      = 6;
-  pdcph.inst       = 0;
-
-#ifdef PDCP_USE_NETLINK
-  bytes_wrote = nasrg_netlink_send((unsigned char *)&pdcph,NAS_PDCPH_SIZE, NASNL_DEST_PDCP);
-  //printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n", bytes_wrote,skb->len);
-#else
-  //bytes_wrote = rtf_put(gpriv->sap[(gc->rb)->sapi], &pdcph, NAS_PDCPH_SIZE);
-  bytes_wrote = rtf_put(NAS2PDCP_FIFO, &pdcph, NAS_PDCPH_SIZE);
-  //printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP fifo\n", bytes_wrote,skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != NAS_PDCPH_SIZE) {
-    printk("nasrg_COMMON_QOS_send: problem while writing PDCP's header\n");
-    //    printk("PDCP rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #2 :");
-  printk("Header bytes wrote : %d\n", bytes_wrote);
-#endif
-
-#ifdef  PDCP_USE_NETLINK
-  bytes_wrote += nasrg_netlink_send((unsigned char *)skb->data,skb->len, NASNL_DEST_PDCP);
-#else
-  //bytes_wrote += rtf_put(gpriv->sap[(gc->rb)->sapi], skb->data, skb->len);
-  bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
-    printk("nasrg_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
-    //    printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #3 :");
-  printk(" %d bytes wrote to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id, NAS2PDCP_FIFO);
-#endif
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send - end \n");
-#endif
-}
-
-#ifndef PDCP_USE_NETLINK
-//---------------------------------------------------------------------------
-void nasrg_COMMON_QOS_receive(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t sapi;
-  struct pdcp_data_ind_header_t  pdcph;
-  int bytes_read = 0;
-  // Start debug information
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_QOS_receive - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_COMMON_QOS_receive - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  // LG force the use of only 1 rt fifo
-  sapi = NAS_DRB_OUTPUT_SAPI;
-
-  bytes_read =  rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
-
-  while (bytes_read>0) {
-    if (bytes_read != NAS_PDCPH_SIZE) {
-      printk("nasrg_COMMON_QOS_receive: problem while reading PDCP header\n");
-      return;
-    }
-
-    // data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
-    nasrg_COMMON_receive(NAS_PDCPH_SIZE, pdcph.data_size, NULL, pdcph->rb_id, gpriv->sap[sapi]);
-    // check if another frame is in the FIFO, otherwise return
-    bytes_read = rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
-  }
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_QOS_receive - end \n");
-#endif
-}
-#else
-//---------------------------------------------------------------------------
-void nasrg_COMMON_QOS_receive(struct nlmsghdr *nlh)
-{
-  //---------------------------------------------------------------------------
-
-  struct pdcp_data_ind_header_t  *pdcph;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_QOS_receive - begin \n");
-#endif
-
-  if (!nlh) {
-    printk("nasrg_COMMON_QOS_receive - input parameter nlh is NULL \n");
-    return;
-  }
-
-  // End debug information
-  pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_QOS_receive - receive from PDCP, size %d, rab %d\\n", pdcph->data_size, pdcph->rb_id);
-#endif //NAS_DEBUG_RECEIVE
-
-  //void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-  nasrg_COMMON_receive(NAS_PDCPH_SIZE + pdcph->data_size, pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE, pdcph->rb_id, 0);
-}
-#endif //PDCP_USE_NETLINK
-
-//---------------------------------------------------------------------------
-struct cx_entity *nasrg_COMMON_search_cx(nasLocalConnectionRef_t lcr)
-{
-  //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_search_cx - lcr %d\n",lcr);
-#endif
-
-  if (lcr<NAS_CX_MAX)
-    return gpriv->cx+lcr;
-  else
-    return NULL;
-}
-
-//---------------------------------------------------------------------------
-// Search a Radio Bearer
-struct rb_entity *nasrg_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_search_rb - rab_id %d\n", rab_id);
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_COMMON_search_rb - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-    if (rb->rab_id==rab_id)
-      return rb;
-  }
-
-  return NULL;
-}
-
-//---------------------------------------------------------------------------
-struct rb_entity *nasrg_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_add_rb - begin for rab_id %d , qos %d\n", rab_id, qos );
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_COMMON_add_rb - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  rb=nasrg_COMMON_search_rb(cx, rab_id);
-
-  if (rb==NULL) {
-    rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
-
-    if (rb!=NULL) {
-      rb->retry=0;
-      rb->countimer=NAS_TIMER_IDLE;
-      rb->rab_id=rab_id;
-      //      rb->rab_id=rab_id+(32*cx->lcr);
-#ifdef NAS_DEBUG_DC
-      printk("nasrg_COMMON_add_rb: rb rab_id=%u, rab_id=%u, mt_id=%u\n",rb->rab_id,rab_id, cx->lcr);
-#endif
-      //      rb->dscp = NASRG_TEMP_2NDRAB_DSCP; //TEMP
-      rb->qos=qos;
-      rb->sapi=NAS_DRB_INPUT_SAPI;
-      // LG force the use of only one rt-fifo
-      // rb->sapi=NAS_BA_INPUT_SAPI;
-      rb->state=NAS_IDLE;
-      rb->next=cx->rb;
-      cx->rb=rb;
-      (cx->num_rb)++;
-    } else
-      printk("nasrg_COMMON_add_rb: no memory\n");
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_add_rb - end \n" );
-#endif
-  return rb;
-}
-
-//---------------------------------------------------------------------------
-// free the memory that has previously been allocated to rb and remove from linked list
-void nasrg_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb, *curr_rb, *prev_rb;
-  struct classifier_entity *p;
-  uint16_t classref=0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_del_rb - begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_COMMON_del_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  // Clear the associated classifier
-  for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next) {
-    if (p->classref>=classref) {
-      classref=p->classref;
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_COMMON_del_rb: classifier found for dscp %u \n", dscp);
-#endif
-    }
-  }
-
-  nasrg_CLASS_del_sclassifier(cx, dscp, classref);
-
-  // Now, delete the RB
-  curr_rb = NULL;
-  prev_rb = NULL;
-
-  for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-    if (rb->rab_id == rab_id) {
-      curr_rb = rb;
-
-      if (prev_rb!=NULL) {
-        prev_rb->next = rb->next;
-      } else {
-        cx->rb=rb->next;
-      }
-
-      break;
-    } else {
-      prev_rb = rb;
-    }
-  }
-
-  if (curr_rb!= NULL) {
-    printk("nasrg_COMMON_del_rb: del rab_id %u\n", rb->rab_id);
-    kfree(rb);
-    (cx->num_rb)--;
-  } else {
-    printk("\n\n--nasrg_COMMON_del_rb: ERROR, invalid rab_id %u\n", rb->rab_id);
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_del_rb - end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasrg_COMMON_flush_rb(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  struct classifier_entity *gc;
-  uint8_t dscp;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_flush_rb - begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_COMMON_flush_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-  for (rb=cx->rb; rb!=NULL; rb=cx->rb) {
-    printk("nasrg_COMMON_flush_rb: del rab_id %u\n", rb->rab_id);
-    cx->rb=rb->next;
-    kfree(rb);
-  }
-
-  cx->num_rb=0;
-  cx->rb=NULL;
-
-  for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp) {
-    for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
-      gc->rb=NULL;
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_flush_rb - end\n");
-#endif
-}
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_constant.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_constant.h
deleted file mode 100644
index b346816e8f68e9aa29a3eb6d73767413478bf3de..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_constant.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_constant.h
-* \brief Defines all constants for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASRGD_CST
-#define _NASRGD_CST
-
-//Debug flags
-#define NAS_DEBUG_DC
-//#define NAS_DEBUG_DC_DETAIL
-#define NAS_DEBUG_SEND
-//#define NAS_DEBUG_SEND_DETAIL  // detail of packet transmission
-//#define NAS_DEBUG_RECEIVE
-#define NAS_DEBUG_RECEIVE_BASIC
-#define NAS_DEBUG_CLASS
-//#define NAS_DEBUG_CLASS_DETAIL
-#define NAS_DEBUG_GC
-//#define NAS_DEBUG_DC_MEASURE
-//#define NAS_DEBUG_TIMER
-#define NAS_DEBUG_DEVICE
-//#define NAS_DEBUG_INTERRUPT
-//#define NAS_DEBUG_TOOL
-//#define NAS_DEBUG_MBMS_PROT //Only one RT-FIFO is used
-#define NETLINK_DEBUG
-#define NAS_DEBUG_RRCNL // RRC netlink socket
-
-// Other flags
-#define DEMO_3GSM
-//#define NODE_RG
-//#define NAS_AUTO_MBMS
-
-// Begin default RAB
-// Parameters for the default RAB started after network attachment (needs DEMO_3GSM defined)
-// RBId value to be synchronized with RAL-RG
-#define NASRG_DEFAULTRAB_RBID  6  //MW-01/01/07- RBID 5 => MBMS, 6 => DEFAULTRAB, 7+ => others
-// Only one of next lines must be active - other values in l3/rrc/rrc_qos.h
-#define NASRG_DEFAULTRAB_QoS 2  //MW-01/01/07- RRC_QOS_CONV_64_64
-//#define NASRG_DEFAULTRAB_QoS 3  //MW-01/01/07- RRC_QOS_CONV_128_128
-//#define NASRG_DEFAULTRAB_QoS 4  //MW-01/01/07- RRC_QOS_CONV_256_256
-//#define NASRG_DEFAULTRAB_QoS 5  //MW-01/01/07- RRC_QOS_CONV_320_320
-//#define NASRG_DEFAULTRAB_QoS 11   //LG RRC_QOS_INTER_128_64
-//
-#define NASRG_DEFAULTRAB_CLASSREF   1  //MW-01/01/07
-#define NASRG_DEFAULTRAB_DSCP       0  //MW-01/01/07
-#define NASRG_DEFAULTRAB_IPVERSION  NAS_VERSION_DEFAULT  //MW-01/01/07
-// End default RAB
-
-//Temp - hard coded
-#define NASRG_OWN_CELLID 5
-#define NASRG_TEMP_2NDRAB_DSCP 5
-#define NASRG_TEMP_MBMS_SESSION_ID 1
-#define NASRG_TEMP_MBMS_DURATION 999
-#define NAS_DEFAULT_IPv6_PREFIX_LENGTH 128 // used to compare destination address with MT's
-
-// General Constants
-#define NAS_MTU 1500
-#define NAS_TX_QUEUE_LEN 100
-#define NAS_ADDR_LEN 8
-#define NAS_INET6_ADDRSTRLEN 46
-#define NAS_INET_ADDRSTRLEN 16
-
-#define NAS_RESET_RX_FLAGS  0
-
-#define NAS_CX_MAX 3  //Identical to RRC constant
-//#define NAS_CX_MULTICAST_ALLNODE 2
-
-#define NASRG_MBMS_SVCES_MAX 4 // Identical to RRC constant
-
-#define NAS_RB_MAX_NUM 32 // maximum number of RBs per MT - 25.331
-#define NAS_RETRY_LIMIT_DEFAULT 5
-
-#define NAS_MESSAGE_MAXLEN 1600
-
-// UMTS
-#define NAS_SIG_SRB3 3
-#define NAS_SIG_SRB4 3 // not used yet
-//LTE
-#define NAS_SIG_NUM_SRB 3  // number of srbs in LTE to send Rb_Id to PDCP
-
-
-//peer-to-peer messages between NAS entities
-#define NAS_CMD_OPEN_RB 1
-#define NAS_CMD_ENTER_SLEEP 2
-#define NAS_CMD_LEAVE_SLEEP 3
-
-#define NAS_CX_RELEASE_UNDEF_CAUSE 1
-
-// MT+RG NAS States
-#define NAS_IDLE                  0x01
-// Connection
-#define NAS_CX_FACH               0x06
-#define NAS_CX_DCH                0x0A
-#define NAS_CX_RECEIVED           0x10
-#define NAS_CX_CONNECTING         0x04
-#define NAS_CX_RELEASING          0x08
-#define NAS_CX_CONNECTING_FAILURE 0x14
-#define NAS_CX_RELEASING_FAILURE  0x18
-// Radio Bearers
-#define NAS_RB_ESTABLISHING       0x24
-#define NAS_RB_RELEASING          0x28
-#define NAS_RB_ESTABLISHED        0x2A
-
-
-#define NAS_TIMER_ESTABLISHMENT_DEFAULT 12
-#define NAS_TIMER_RELEASE_DEFAULT 2
-#define NAS_TIMER_IDLE UINT_MAX
-#define NAS_TIMER_TICK HZ
-
-#define NAS_PDCPH_SIZE sizeof(struct pdcp_data_req_header_t)
-#define NAS_IPV4_SIZE 20
-#define NAS_IPV6_SIZE 40
-
-#define NAS_DIRECTION_SEND  0
-#define NAS_DIRECTION_RECEIVE 1
-
-// function number
-#define NAS_FCT_DEL_SEND  1
-#define NAS_FCT_QOS_SEND  2
-#define NAS_FCT_DC_SEND 3
-#define NAS_FCT_CTL_SEND  4
-
-// type of IOCTL command
-#define NASRG_IOCTL_RAL 0x89F0
-
-// Error cause
-#define NAS_ERROR_ALREADYEXIST  1
-#define NAS_ERROR_NOMEMORY    3
-#define NAS_ERROR_NOTMT     9
-#define NAS_ERROR_NOTRG     10
-#define NAS_ERROR_NOTIDLE     11
-#define NAS_ERROR_NOTCONNECTED    12
-#define NAS_ERROR_NORB    14
-#define NAS_ERROR_NOTCORRECTVALUE 32
-#define NAS_ERROR_NOTCORRECTLCR 33
-#define NAS_ERROR_NOTCORRECTDIR 34
-#define NAS_ERROR_NOTCORRECTDSCP  35
-#define NAS_ERROR_NOTCORRECTVERSION 36
-#define NAS_ERROR_NOTCORRECTRABI  37
-
-
-/**********************************************************/
-/* Constants related with IP protocols                    */
-/**********************************************************/
-
-// Destination address types
-#define NAS_IPV6_ADDR_UNICAST        1
-#define NAS_IPV6_ADDR_MC_SIGNALLING  2
-#define NAS_IPV6_ADDR_MC_MBMS        3
-#define NAS_IPV6_ADDR_UNKNOWN        4
-
-#define NAS_IPV4_ADDR_UNICAST        5
-#define NAS_IPV4_ADDR_MC_SIGNALLING  6
-#define NAS_IPV4_ADDR_BROADCAST      7
-#define NAS_IPV4_ADDR_UNKNOWN        8
-
-//#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0fc00000) Yan
-#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0ff00000)
-
-// Network control codepoint 111000 + IP version 6
-#define NAS_FLOWINFO_NCONTROL __constant_htonl(0x6e000000)
-// network control codepoint 111000
-#define NAS_DSCP_NCONTROL 56   //0x38
-// default codepoint 1000000
-#define NAS_DSCP_DEFAULT 64
-#define NAS_DSCP_MAX 65
-
-#define NAS_PROTOCOL_DEFAULT 0
-#define NAS_PROTOCOL_TCP IPPROTO_TCP
-#define NAS_PROTOCOL_UDP IPPROTO_UDP
-#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
-#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
-
-#define NAS_PORT_DEFAULT  __constant_htons(65535)
-#define NAS_PORT_HTTP   __constant_htons(80)
-
-#define NAS_VERSION_DEFAULT   0
-#define NAS_VERSION_4   4
-#define NAS_VERSION_6   6 //?MW
-
-/**********************************************************/
-/* Constants related with Netlink sockets                 */
-/**********************************************************/
-#define OAI_IP_DRIVER_NETLINK_ID 31
-#define NL_DEST_PID 1
-
-// defined in rrc_nas_sap.h
-//#define NAS_RRCNL_ID 30
-//#define NL_DEST_RRC_PID 2
-
-#define NASNL_DEST_PDCP 0
-#define NASNL_DEST_RRC 1
-
-#endif
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c
deleted file mode 100644
index 970600de214357157b9546eec561d02a846de770..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_device.c
-* \brief Networking Device Driver for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef PDCP_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // PDCP_USE_NETLINK
-//:::::::::::::::::::::::::::::::::::::::;;
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-//:::::::::::::::::::::::::::::::::::::::;;
-//#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/if_ether.h>
-#endif
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/delay.h>
-#include <asm/unistd.h>
-#include <linux/netdevice.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/etherdevice.h>
-#endif
-//:::::::::::::::::::::::::::::::::::::::;;
-/* Global variables */
-struct net_device *gdev;
-struct nas_priv *gpriv;
-//int bytes_wrote;
-//int bytes_read;
-uint8_t NAS_RG_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x01};
-uint8_t NAS_NULL_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00};
-
-uint16_t local_rg_cell_id;
-
-#ifdef PDCP_USE_NETLINK
-extern void nasrg_netlink_release(void);
-extern int nasrg_netlink_init(void);
-#endif
-extern void nasrg_ASCTL_timer(unsigned long data);
-
-#ifndef PDCP_USE_NETLINK
-//---------------------------------------------------------------------------
-void *nasrg_interrupt(void)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-#ifdef NAS_DEBUG_INTERRUPT
-  printk("nasrg_interrupt - begin\n");
-#endif
-
-  //spin_lock(&gpriv->lock);
-  for (cxi=0; cxi<NAS_CX_MAX; ++cxi)
-    nasrg_COMMON_QOS_receive(gpriv->cx+cxi);
-
-  for (cxi=0; cxi<NAS_CX_MAX; ++cxi)
-    nasrg_ASCTL_DC_receive(gpriv->cx+cxi);
-
-  //spin_unlock(&gpriv->lock);
-#ifdef NAS_DEBUG_INTERRUPT
-  printk("nasrg_interrupt: end\n");
-#endif
-  //  return 0;
-}
-#endif //NETLINK
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is activated by ifconfig
-int nasrg_open(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_open: begin\n");
-
-  gpriv=netdev_priv(dev);
-
-  // Address has already been set at init
-#ifndef PDCP_USE_NETLINK
-
-  if (gpriv->irq==-EBUSY) {
-    printk("nasrg_open: irq failure\n");
-    return -EBUSY;
-  }
-
-#endif //NETLINK
-
-  if(!netif_queue_stopped(dev))
-    netif_start_queue(dev);
-  else
-    netif_wake_queue(dev);
-
-  //
-  init_timer(&gpriv->timer);
-  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
-  (gpriv->timer).data=0L;
-  (gpriv->timer).function=nasrg_ASCTL_timer;
-  add_timer(&gpriv->timer);
-  //
-  printk("nasrg_open: name = %s, end\n", dev->name);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is desactivated by ifconfig
-int nasrg_stop(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  struct nas_priv *priv = netdev_priv(dev);
-  printk("nasrg_stop: begin\n");
-  del_timer(&priv->timer);
-  netif_stop_queue(dev);
-
-  printk("nasrg_stop: name = %s, end\n", dev->name);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-void nasrg_teardown(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  int cxi;
-#ifndef PDCP_USE_NETLINK
-  struct nas_priv *priv = netdev_priv(dev);
-#endif //PDCP_USE_NETLINK
-
-  printk("nasrg_teardown: begin\n");
-
-  if (dev) {
-#ifndef PDCP_USE_NETLINK
-
-    if (priv->irq!=-EBUSY) {
-      *pt_nas_rg_irq=-1;
-      rt_free_srq(priv->irq);
-    }
-
-#endif //PDCP_USE_NETLINK
-
-#ifdef PDCP_USE_NETLINK
-    nasrg_netlink_release();
-#endif //PDCP_USE_NETLINK
-
-    //  for (sapi=0; sapi<NAS_SAPI_MAX; ++sapi)
-    //    close(priv->sap[sapi]);
-    nasrg_CLASS_flush_rclassifier();
-    nasrg_CLASS_flush_mbmsclassifier();
-
-    for (cxi=0; cxi<NAS_CX_MAX; ++cxi) {
-      nasrg_COMMON_flush_rb(gpriv->cx+cxi);
-      nasrg_CLASS_flush_sclassifier(gpriv->cx+cxi);
-      //for (sapi=0; sapi<NAS_SAPI_CX_MAX; ++sapi)
-      //  close(priv->cx[cxi].sap[sapi]);
-    }
-  } // check dev
-  else {
-    printk("nasmt_teardown: Device is null\n");
-  }
-
-  printk("nasrg_teardown: end\n");
-}
-
-//---------------------------------------------------------------------------
-int nasrg_set_config(struct net_device *dev, struct ifmap *map)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_set_config: begin\n");
-
-  if (dev->flags & IFF_UP)
-    return -EBUSY;
-
-  if (map->base_addr != dev->base_addr) {
-    printk(KERN_WARNING "nasrg_set_config: Can't change I/O address\n");
-    return -EOPNOTSUPP;
-  }
-
-  if (map->irq != dev->irq)
-    dev->irq = map->irq;
-
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DEVICE
-  printk("nasrg_hard_start_xmit: begin\n");
-#endif
-
-  if ((!skb )||(!dev)) {
-    printk("nasrg_hard_start_xmit - input parameter skb or dev is NULL \n");
-    return -1;
-  }
-
-  // End debug information
-  netif_stop_queue(dev);
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-  netif_trans_update(dev);
-#else
-  dev->trans_start = jiffies;
-#endif
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_hard_start_xmit: step 1\n");
-#endif
-  nasrg_CLASS_send(skb);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_hard_start_xmit: step 2\n");
-#endif
-  dev_kfree_skb(skb);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_hard_start_xmit: step 3\n");
-#endif
-  netif_wake_queue(dev);
-#ifdef NAS_DEBUG_DEVICE
-  printk("nasrg_hard_start_xmit: end\n");
-#endif
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-struct net_device_stats *nasrg_get_stats(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  struct nas_priv *npriv = netdev_priv(dev);
-  return &npriv->stats;
-}
-
-//---------------------------------------------------------------------------
-// New function from LITE DRIVER
-int nasrg_set_mac_address(struct net_device *dev, void *mac)
-{
-  //---------------------------------------------------------------------------
-  struct sockaddr *addr = mac;
-  printk("nasrg_set_mac_address: begin\n");
-  memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_change_mtu(struct net_device *dev, int mtu)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_change_mtu: begin\n");
-
-  if ((mtu<50) || (mtu>1500))
-    //  if ((mtu<1280) || (mtu>1500))
-    return -EINVAL;
-
-  dev->mtu = mtu;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_change_rx_flags(struct net_device *dev, int flags)
-{
-  //---------------------------------------------------------------------------
-  //struct nas_priv *priv =  netdev_priv(dev);
-  printk("nasrg_change_rx_flags %08X\n", flags);
-  gpriv->rx_flags ^= flags;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-void nasrg_tx_timeout(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  /* Transmitter timeout, serious problems. */
-  printk("nasrg_tx_timeout: begin\n");
-  //  ((struct nas_priv *)(dev->priv))->stats.tx_errors++;
-  (gpriv->stats).tx_errors++;
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-  netif_trans_update(dev);
-#else
-  dev->trans_start = jiffies;
-#endif
-  netif_wake_queue(dev);
-  printk("nasrg_tx_timeout: transmit timed out %s\n",dev->name);
-}
-
-//---------------------------------------------------------------------------
-// Define pointers for the module
-static const struct net_device_ops nasrg_netdev_ops = {
-  // ?? nasrg_ interrupt
-  //
-  .ndo_open               = nasrg_open,
-  .ndo_stop               = nasrg_stop,
-  .ndo_start_xmit         = nasrg_hard_start_xmit,
-  .ndo_validate_addr      = NULL,
-  .ndo_get_stats          = nasrg_get_stats,
-  //#ifdef  KERNEL_VERSION_GREATER_THAN_32
-  //  .ndo_set_multicast_list = NULL,
-  .ndo_set_mac_address    = nasrg_set_mac_address,
-  .ndo_set_config         = nasrg_set_config,
-  .ndo_do_ioctl           = nasrg_CTL_ioctl,
-  .ndo_change_mtu         = nasrg_change_mtu,
-  .ndo_tx_timeout         = nasrg_tx_timeout,
-  .ndo_change_rx_flags    = nasrg_change_rx_flags,
-  //#endif
-};
-//---------------------------------------------------------------------------
-
-
-//---------------------------------------------------------------------------
-// Initialisation of the network device
-void nasrg_init(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi, dscpi;
-
-  printk("nasrg_init: begin\n");
-
-  if (dev) {
-    gpriv=netdev_priv(dev);
-
-    memset(gpriv, 0, sizeof(struct nas_priv));
-    // Initialize function pointers
-    dev->netdev_ops = &nasrg_netdev_ops;
-
-#ifndef NAS_DRIVER_TYPE_ETHERNET
-    dev->type = ARPHRD_EURUMTS;
-    dev->features = NETIF_F_NO_CSUM;
-    dev->hard_header_len = 0;
-    dev->addr_len = NAS_ADDR_LEN;
-    dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
-    dev->tx_queue_len = NAS_TX_QUEUE_LEN;
-    dev->mtu = NAS_MTU;
-#endif
-    // Can be one of the following enum defined in include/linux/netdevice.h:
-    // enum netdev_state_t {
-    // __LINK_STATE_START,
-    // __LINK_STATE_PRESENT,
-    // __LINK_STATE_NOCARRIER,
-    // __LINK_STATE_LINKWATCH_PENDING,
-    // __LINK_STATE_DORMANT,
-    // };
-    set_bit(__LINK_STATE_PRESENT, &dev->state);
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    // overwrite values written above ( header_ops,type,hard_header_len,mtu,addr_len,tx_queue_len,flags,broadcast)
-    printk("\nnasrg_init: WARNING Driver type ETHERNET\n");
-    ether_setup(dev);
-#endif
-    //
-    // Initialize private structure
-    gpriv->rx_flags = NAS_RESET_RX_FLAGS;
-
-    gpriv->sap[NAS_GC_SAPI] = RRC_DEVICE_GC;
-    gpriv->sap[NAS_NT_SAPI] = RRC_DEVICE_NT;
-    gpriv->cx[0].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
-    gpriv->cx[0].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
-    gpriv->cx[1].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT1;
-    gpriv->cx[1].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT1;
-    //  gpriv->sap[NAS_CO_INPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_INPUT;
-    //  gpriv->sap[NAS_CO_OUTPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_OUTPUT;
-    gpriv->sap[NAS_DRB_INPUT_SAPI]  = PDCP2PDCP_USE_RT_FIFO;//QOS_DEVICE_CONVERSATIONAL_INPUT;
-    gpriv->sap[NAS_DRB_OUTPUT_SAPI] = NAS2PDCP_FIFO;//QOS_DEVICE_STREAMING_INPUT;
-    //
-    gpriv->retry_limit=NAS_RETRY_LIMIT_DEFAULT;
-    gpriv->timer_establishment=NAS_TIMER_ESTABLISHMENT_DEFAULT;
-    gpriv->timer_release=NAS_TIMER_RELEASE_DEFAULT;
-
-    for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
-      gpriv->rclassifier[dscpi]=NULL;
-
-    gpriv->nrclassifier=0;
-
-    //
-    for(cxi=0; cxi<NAS_CX_MAX; ++cxi) {
-#ifdef NAS_DEBUG_DEVICE
-      printk("nasrg_init: init classifiers, state and timer for MTs %u\n", cxi);
-#endif
-      gpriv->cx[cxi].state=NAS_IDLE;
-      gpriv->cx[cxi].countimer=NAS_TIMER_IDLE;
-      gpriv->cx[cxi].retry=0;
-      gpriv->cx[cxi].lcr=cxi;
-      gpriv->cx[cxi].rb=NULL;
-      gpriv->cx[cxi].num_rb=0;
-
-      // initialisation of the classifier
-      for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
-        gpriv->cx[cxi].sclassifier[dscpi]=NULL;
-
-      gpriv->cx[cxi].nsclassifier=0;
-      // initialisation of the IP address
-      nasrg_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)gpriv->cx[cxi].iid6);
-      gpriv->cx[cxi].iid4=0;
-    }
-
-    spin_lock_init(&gpriv->lock);
-
-    nasrg_TOOL_RGimei2iid(NAS_RG_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
-    printk("nasrg_init: init IMEI to IID\n");
-    nasrg_ASCTL_init();
-  } else {
-    printk("\n\nnasmt_init: ERROR, Device is NULL!!\n");
-  }
-
-  printk("nasrg_init: end\n");
-  return ;
-}
-
-//---------------------------------------------------------------------------
-int init_module (void)
-{
-  //---------------------------------------------------------------------------
-  int err;
-  int inst = 0;
-  struct nas_priv *priv;
-  char devicename[100];
-
-  printk("\n\n\n\nnasrg_init_module: begin \n");
-
-  // Initialize parameters shared with RRC
-#ifndef PDCP_USE_NETLINK
-
-  if (pt_nas_rg_irq==NULL) {
-    printk("nasrg_init_module: shared irq parameter not initialised\n");
-    err =  -EBUSY;
-    printk("nasrg_init_module: returning %d \n\n", err);
-    return err;
-  }
-
-  printk("nasrg_init_module: pt_nas_rg_irq valid \n");
-#endif
-
-  /*
-    if (pt_rg_own_cell_id==NULL){
-      printk("nasrg_init_module: shared cell_id parameter not initialised\n");
-      err =  -EBUSY;
-      printk("nasrg_init_module: returning %d \n\n\n", err);
-      return err;
-    }
-    printk("nasrg_init_module: pt_rg_own_cell_id valid \n");
-    *pt_rg_own_cell_id = NASRG_OWN_CELLID;
-  */
-  local_rg_cell_id = NASRG_OWN_CELLID;
-
-  // Allocate device structure
-  sprintf(devicename,"oai%d",inst);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
-  gdev = alloc_netdev(sizeof(struct nas_priv), devicename, nasrg_init);
-#else
-  gdev = alloc_netdev(sizeof(struct nas_priv), devicename, NET_NAME_PREDICTABLE, nasrg_init);
-#endif
-  printk("nasrg_init_module: after alloc_netdev \n");
-  priv = netdev_priv(gdev);
-  ////
-  //
-#ifndef PDCP_USE_NETLINK
-  priv->irq=rt_request_srq(0, nasrg_interrupt, NULL);
-
-  if (priv->irq == -EBUSY || priv->irq == -EINVAL) {
-    printk("nasrg_init_module: No interrupt resource available\n");
-
-    if (gdev) {
-      free_netdev(gdev);
-      printk("nasrg_init_module: free_netdev ..\n");
-    }
-
-    return -EBUSY;
-  } else
-    printk("nasrg_init_module: Interrupt %d, ret = %d \n", priv->irq , ret);
-
-  if (pt_nas_rg_irq==NULL) {
-    printk("nasmt_init_module: shared irq parameter has been reset\n");
-  } else {
-    *pt_nas_rg_irq=priv->irq;
-  }
-
-#endif
-  //
-  //////
-#ifdef PDCP_USE_NETLINK
-
-  if ((err=nasrg_netlink_init()) < 0)
-    printk("nasrg_init_module: NETLINK failed\n");
-
-  printk("nasrg_init_module: NETLINK INIT successful\n");
-#endif //NETLINK
-
-  err= register_netdev(gdev);
-
-  if (err) {
-    printk("nasrg_init_module: error %i registering device %s\n", err, gdev->name);
-  } else {
-    printk("nasrg_init_module: registering device %s, ifindex = %d\n\n",gdev->name, gdev->ifindex);
-  }
-
-  return err;
-}
-
-//---------------------------------------------------------------------------
-void cleanup_module(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_cleanup_module: begin\n");
-  unregister_netdev(gdev);
-  nasrg_teardown(gdev);
-  free_netdev(gdev);
-  printk("nasrg_cleanup_module: end\n\n\n\n");
-}
-
-//---------------------------------------------------------------------------
-// Replaced by init_module and cleanup_module
-//module_init (nasrg_init_module);
-//module_exit (nasrg_cleanup_module);
-//---------------------------------------------------------------------------
-
-#define DRV_NAME        "oai_nasrg"
-#define DRV_VERSION     "3.0.1"DRV_NAME
-#define DRV_DESCRIPTION "OPENAIR CELLULAR LTE NASRG (eNodeB) Device Driver"
-#define DRV_COPYRIGHT   "-Copyright(c) GNU GPL Eurecom 2013"
-#define DRV_AUTHOR      "Michelle Wetterwald <michelle.wetterwald@eurecom.fr>"DRV_COPYRIGHT
-
-// MODULE_LICENSE("GPL");
-// MODULE_DESCRIPTION("LTE Driver for eNodeB, playing as Non Access Stratum");
-// MODULE_AUTHOR("Michelle Wetterwald <michelle.wetterwald@eurecom.fr>");
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.c
deleted file mode 100644
index 86576500b7ed7e03040fe798f1de8c66ee7ac906..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.c
+++ /dev/null
@@ -1,906 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_iocontrol.c
-* \brief I/O control functions for upper layers of driver for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasrg_variables.h"
-#include "nasrg_iocontrol.h"
-#include "nasrg_proto.h"
-
-//#include <linux/in.h>
-#include <asm/uaccess.h>
-#include <asm/checksum.h>
-#include <asm/uaccess.h>
-
-// Statistic
-///////////////////////////////////////////////////////////////////////////////
-
-//---------------------------------------------------------------------------
-void nasrg_set_msg_statistic_reply(struct nas_msg_statistic_reply *msgrep)
-{
-  //---------------------------------------------------------------------------
-  msgrep->rx_packets=gpriv->stats.rx_packets;
-  msgrep->tx_packets=gpriv->stats.tx_packets;
-  msgrep->rx_bytes=gpriv->stats.rx_bytes;
-  msgrep->tx_bytes=gpriv->stats.tx_bytes;
-  msgrep->rx_errors=gpriv->stats.rx_errors;
-  msgrep->tx_errors=gpriv->stats.tx_errors;
-  msgrep->rx_dropped=gpriv->stats.rx_dropped;
-  msgrep->tx_dropped=gpriv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_statistic_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_statistic_reply msgrep;
-  printk("nasrg_ioCTL_statistic: stat requested\n");
-  nasrg_set_msg_statistic_reply(&msgrep);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_statistic: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Connections List
-//---------------------------------------------------------------------------
-void nasrg_set_msg_cx_list_reply(uint8_t *msgrep)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  nasLocalConnectionRef_t lcr;
-  struct nas_msg_cx_list_reply *list;
-  msgrep[0]=NAS_CX_MAX;
-  list=(struct nas_msg_cx_list_reply *)(msgrep+1);
-
-  for(lcr=0; lcr<NAS_CX_MAX; ++lcr) {
-    cx=nasrg_COMMON_search_cx(lcr);
-    list[lcr].lcr=lcr;
-    list[lcr].state=cx->state;
-    list[lcr].cellid=cx->cellid;
-    list[lcr].iid4=cx->iid4;
-    list[lcr].iid6[0]=cx->iid6[0];
-    list[lcr].iid6[1]=cx->iid6[1];
-    list[lcr].num_rb=cx->num_rb;
-    list[lcr].nsclassifier=cx->nsclassifier;
-    printk("nasrg_set_msg_cx_list: nsc=%u\n",cx->nsclassifier);
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_cx_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1];
-  printk("nasrg_ioCTL_cx_list: connection list requested\n");
-  nasrg_set_msg_cx_list_reply(msgrep);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1)) {
-    printk("nasrg_ioCTL_cx_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasrg_ioCTL_cx_list: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connection Establishment
-//---------------------------------------------------------------------------
-void nasrg_set_msg_cx_establishment_reply(struct nas_msg_cx_establishment_reply *msgrep, struct nas_msg_cx_establishment_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  msgrep->status=-NAS_ERROR_NOTMT;
-}
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_cx_establishment_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_cx_establishment_request msgreq;
-  struct nas_msg_cx_establishment_reply msgrep;
-  printk("nasrg_ioCTL_cx_establishment: connection establishment requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_cx_establishment: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_cx_establishment_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_cx_establishment: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connection Release
-//---------------------------------------------------------------------------
-void nasrg_set_msg_cx_release_reply(struct nas_msg_cx_release_reply *msgrep, struct nas_msg_cx_release_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  msgrep->status=-NAS_ERROR_NOTMT;
-}
-
-//---------------------------------------------------------------------------
-// Request the release of a connection
-int nasrg_ioCTL_cx_release_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_cx_release_request msgreq;
-  struct nas_msg_cx_release_reply msgrep;
-
-  printk("nasrg_set_msg_cx_release: connection release requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_set_msg_cx_release: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_cx_release_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_set_msg_cx_release: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasrg_set_msg_cx_release: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer List
-//---------------------------------------------------------------------------
-void nasrg_set_msg_rb_list_reply(uint8_t *msgrep, struct nas_msg_rb_list_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-  if (cx!=NULL) {
-    uint8_t rbi;
-    struct rb_entity *rb;
-    struct nas_msg_rb_list_reply *list;
-
-    if (cx->num_rb > NAS_LIST_RB_MAX)
-      msgrep[0] = NAS_LIST_RB_MAX;
-    else
-      msgrep[0] = cx->num_rb;
-
-    list=(struct nas_msg_rb_list_reply *)(msgrep+1);
-
-    // list all radio bearers
-    for (rb=cx->rb, rbi=0; (rb!=NULL)&&(rbi<msgrep[0]); rb=rb->next, ++rbi) {
-      list[rbi].state=rb->state;
-      list[rbi].rab_id=rb->rab_id;
-      list[rbi].sapi=rb->sapi;
-      list[rbi].qos=rb->qos;
-      list[rbi].cnxid=rb->cnxid;
-    }
-
-    // check if mt0 requested and multicast bearer started, then add it to the list
-    if ((msgreq->lcr==0)&&(gpriv->mbms_rb[0].mbms_rbId!=0)) {
-      printk("MT %d, MBMS bearer rb_id %d\n", msgreq->lcr, gpriv->mbms_rb[0].mbms_rbId);
-      //++rbi;
-      ++msgrep[0];
-      list[rbi].state=gpriv->mbms_rb[0].state;
-      list[rbi].rab_id=gpriv->mbms_rb[0].mbms_rbId;
-      list[rbi].sapi=gpriv->mbms_rb[0].sapi;
-      list[rbi].qos=gpriv->mbms_rb[0].qos;
-      list[rbi].cnxid=gpriv->mbms_rb[0].cnxid;
-      printk("rab_id  cnxid  Sapi  QoS  State\n");
-      printk("%u  %u  %u  %u  ", list[rbi].rab_id,list[rbi].cnxid, list[rbi].sapi, list[rbi].qos);
-      nasrg_TOOL_print_state(list[rbi].state);
-      printk("\n");
-    }
-  } else
-    msgrep[0]=0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_rb_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1];
-  struct nas_msg_rb_list_request msgreq;
-  printk("nasrg_ioCTL_rb_list: Radio Bearer list requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_rb_list: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_rb_list_reply(msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1)) {
-    printk("nasrg_ioCTL_rb_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasrg_ioCTL_rb_list: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer Establishment
-//---------------------------------------------------------------------------
-void nasrg_set_msg_rb_establishment_reply(struct nas_msg_rb_establishment_reply *msgrep, struct nas_msg_rb_establishment_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if ((msgreq->rab_id<5)||(msgreq->rab_id>(NAS_RB_MAX_NUM-1)))
-    msgrep->status=-NAS_ERROR_NOTCORRECTRABI;
-  else {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL) { //not multicast
-      struct rb_entity *rb;
-      rb=nasrg_COMMON_add_rb(cx, msgreq->rab_id, msgreq->qos);
-
-      if (rb!=NULL) {
-        rb->cnxid = msgreq->cnxid;
-        rb->dscp = msgreq->dscp_dl;
-        rb->dscp_ul = msgreq->dscp_ul;
-        msgrep->status=nasrg_ASCTL_DC_send_rb_establish_request(cx, rb);
-      } else {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-      }
-    } else { //no MT found
-      if (msgreq->mcast_flag) { //multicast
-        int mbms_ix=0; // should allocate index based on Service_id /cnxid / MC IP address
-        //
-        gpriv->mbms_rb[mbms_ix].cnxid = msgreq->cnxid;
-        gpriv->mbms_rb[mbms_ix].serviceId = msgreq->cnxid;
-        gpriv->mbms_rb[mbms_ix].sessionId = NASRG_TEMP_MBMS_SESSION_ID; //Temp hard coded
-        gpriv->mbms_rb[mbms_ix].mbms_rbId = msgreq->rab_id;
-        gpriv->mbms_rb[mbms_ix].sapi = NAS_DC_INPUT_SAPI;
-#ifdef NAS_DEBUG_MBMS_PROT
-        gpriv->mbms_rb[mbms_ix].sapi = NAS_DRB_INPUT_SAPI; //Only one RT-FIFO is used
-#endif
-        gpriv->mbms_rb[mbms_ix].qos = msgreq->qos;
-        gpriv->mbms_rb[mbms_ix].dscp = msgreq->dscp_dl;
-        gpriv->mbms_rb[mbms_ix].duration = NASRG_TEMP_MBMS_DURATION; //Temp hard coded
-        memcpy ((char *)&(gpriv->mbms_rb[mbms_ix].mcast_address),(char *)&(msgreq->mcast_group), 16);
-        msgrep->status=nasrg_ASCTL_GC_send_mbms_bearer_establish_req(mbms_ix);
-      } else {
-        msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      }
-
-      msgrep->cnxid  = msgreq->cnxid;
-    }
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_rb_establishment_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_rb_establishment_request msgreq;
-  struct nas_msg_rb_establishment_reply msgrep;
-  printk("nasrg_ioCTL_rb_establishment: Radio bearer establishment requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_rb_establishment: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_rb_establishment_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_rb_establishment: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer Release
-//---------------------------------------------------------------------------
-void nasrg_set_msg_rb_release_reply(struct nas_msg_rb_release_reply *msgrep, struct nas_msg_rb_release_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->lcr<NAS_CX_MAX) {
-    if (msgreq->rab_id!=NASRG_DEFAULTRAB_RBID) {
-      struct rb_entity *rb;
-      struct cx_entity *cx;
-      cx=nasrg_COMMON_search_cx(msgreq->lcr);
-      rb=nasrg_COMMON_search_rb(cx, msgreq->rab_id);
-
-      if ((rb!=NULL)&&(cx!=NULL)) {
-        uint8_t dscp;
-        msgrep->status=nasrg_ASCTL_DC_send_rb_release_request(cx, rb);
-        dscp=rb->dscp;
-        nasrg_COMMON_del_rb(cx, msgreq->rab_id, dscp);
-      } else
-        msgrep->status=-NAS_ERROR_NOTCONNECTED;
-
-      msgrep->cnxid  = msgreq->cnxid;
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTRABI;
-    }
-  } else {
-    if (msgreq->mcast_flag) { // multicast
-      int mbms_ix=0;  // should search mbms_ix based on cnxid
-      msgrep->status=nasrg_ASCTL_GC_send_mbms_bearer_release_req(mbms_ix);
-      msgrep->cnxid  = msgreq->cnxid;
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-    }
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_rb_release_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_rb_release_request msgreq;
-  struct nas_msg_rb_release_reply msgrep;
-  printk("nasrg_ioCTL_rb_release: Radio bearer release requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_rb_release: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_rb_release_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_rb_release: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Classifier List
-//---------------------------------------------------------------------------
-void nasrg_set_msg_class_list_reply(uint8_t *msgrep, struct nas_msg_class_list_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  struct classifier_entity *gc;
-  struct nas_msg_class_list_reply *list;
-  uint8_t cli;
-  list=(struct nas_msg_class_list_reply *)(msgrep+1);
-
-  switch(msgreq->dir) {
-  case NAS_DIRECTION_SEND:
-    cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-    if (cx==NULL) {
-      msgrep[0]=0;
-      return;
-    }
-
-    gc=cx->sclassifier[msgreq->dscp];
-    break;
-
-  case NAS_DIRECTION_RECEIVE:
-    cx=NULL;
-    gc=gpriv->rclassifier[msgreq->dscp];
-    break;
-
-  default:
-    cx=NULL;
-    msgrep[0]=0;
-    return;
-  }
-
-  for (cli=0; (gc!=NULL)&&(cli<NAS_LIST_CLASS_MAX); gc=gc->next, ++cli) {
-    list[cli].classref=gc->classref;
-    list[cli].lcr=msgreq->lcr;
-    list[cli].dir=msgreq->dir;
-    list[cli].dscp=msgreq->dscp;
-    list[cli].rab_id=gc->rab_id;
-    list[cli].version=gc->version;
-
-    switch(gc->version) {
-    case 4:
-      list[cli].saddr.ipv4 = gc->saddr.ipv4;
-      list[cli].daddr.ipv4 = gc->daddr.ipv4;
-      break;
-
-    case 6:
-      list[cli].saddr.ipv6 = gc->saddr.ipv6;
-      list[cli].daddr.ipv6 = gc->daddr.ipv6;
-      break;
-    }
-
-    list[cli].protocol=gc->protocol;
-    list[cli].sport=ntohs(gc->sport);
-    list[cli].dport=ntohs(gc->dport);
-    list[cli].splen=gc->splen;
-    list[cli].dplen=gc->dplen;
-    list[cli].fct=nasrg_TOOL_invfct(gc);
-  }
-
-  msgrep[0]=cli;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_class_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1];
-  struct nas_msg_class_list_request msgreq;
-  printk("nasrg_ioCTL_class_list: classifier list requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_class_list: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_class_list_reply(msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1)) {
-    printk("nasrg_ioCTL_class_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Request the addition of a classifier rule
-//---------------------------------------------------------------------------
-void nasrg_set_msg_class_add_reply(struct nas_msg_class_add_reply *msgrep, struct nas_msg_class_add_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
-    printk("nasrg_set_msg_class_add: Incoherent parameter value\n");
-    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
-    return;
-  }
-
-  if (msgreq->dir==NAS_DIRECTION_SEND) {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL) {
-      printk("nasrg_set_msg_class_add: DSCP %d, Classref %d\n",msgreq->dscp, msgreq->classref );
-      gc=nasrg_CLASS_add_sclassifier(cx, msgreq->dscp, msgreq->classref);
-      printk("nasrg_set_msg_class_add: %p %p\n" , msgreq, gc);
-
-      if (gc==NULL) {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-        return;
-      }
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      return;
-    }
-
-    gc->rab_id=msgreq->rab_id;
-    gc->rb=nasrg_COMMON_search_rb(cx, gc->rab_id);
-  } else {
-    if (msgreq->dir==NAS_DIRECTION_RECEIVE) {
-      gc=nasrg_CLASS_add_rclassifier(msgreq->dscp, msgreq->classref);
-
-      if (gc==NULL) {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-        return;
-      }
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
-      return;
-    }
-  }
-
-  nasrg_TOOL_fct(gc, msgreq->fct);
-  gc->version=msgreq->version;
-
-  switch(gc->version) {
-  case 4:
-    gc->saddr.ipv4=msgreq->saddr.ipv4;
-    gc->daddr.ipv4=msgreq->daddr.ipv4;
-    gc->splen=msgreq->splen;
-    gc->dplen=msgreq->dplen;
-    break;
-
-  case 6:
-    gc->saddr.ipv6=msgreq->saddr.ipv6;
-    gc->daddr.ipv6=msgreq->daddr.ipv6;
-    gc->splen=msgreq->splen;
-    gc->dplen=msgreq->dplen;
-    break;
-
-  case 0:
-    gc->saddr.ipv6.s6_addr32[0]=0;
-    gc->daddr.ipv6.s6_addr32[1]=0;
-    gc->saddr.ipv6.s6_addr32[2]=0;
-    gc->daddr.ipv6.s6_addr32[3]=0;
-    gc->splen=0;
-    gc->dplen=0;
-    break;
-
-  default:
-    msgrep->status=-NAS_ERROR_NOTCORRECTVERSION;
-    kfree(gc);
-    return;
-  }
-
-  gc->protocol=msgreq->protocol;
-  gc->sport=htons(msgreq->sport);
-  gc->dport=htons(msgreq->dport);
-  msgrep->status=0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_class_add_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_class_add_request msgreq;
-  struct nas_msg_class_add_reply msgrep;
-  printk("nasrg_ioCTL_class_add: Add classifier components requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_class_add: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_class_add_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_class_add: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Request the deletion of a classifier rule
-//---------------------------------------------------------------------------
-void nasrg_set_msg_class_del_reply(struct nas_msg_class_del_reply *msgrep, struct nas_msg_class_del_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
-    printk("nasrg_set_msg_class_del: Incoherent parameter value\n");
-    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
-    return;
-  }
-
-  if (msgreq->dir==NAS_DIRECTION_SEND) {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL)
-      nasrg_CLASS_del_sclassifier(cx, msgreq->dscp, msgreq->classref);
-    else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      return;
-    }
-  } else {
-    if (msgreq->dir==NAS_DIRECTION_RECEIVE)
-      nasrg_CLASS_del_rclassifier(msgreq->dscp, msgreq->classref);
-    else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
-      return;
-    }
-  }
-
-  msgrep->status=0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_class_del_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_class_del_request msgreq;
-  struct nas_msg_class_del_reply msgrep;
-  printk("nasrg_ioCTL_class_del: Del classifier components requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_class_del: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_class_del_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_class_del: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// UE Multicast Join
-//---------------------------------------------------------------------------
-void nasrg_set_ue_multicast_join_reply(struct nas_msg_mt_mcast_reply *msgrep, struct nas_msg_mt_mcast_join *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->ue_id<NAS_CX_MAX) {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->ue_id);
-    cx->requested_joined_services[0] = msgreq->cnxid;
-    msgrep->ue_id  = msgreq->ue_id;
-    msgrep->result = nasrg_ASCTL_DC_send_mbms_ue_notify_req(cx);
-    msgrep->cnxid  = msgreq->cnxid;
-  } else {
-    msgrep->result=-NAS_ERROR_NOTCORRECTLCR;
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_ue_multicast_join_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_mt_mcast_join msgreq;
-  struct nas_msg_mt_mcast_reply msgrep;
-  printk("nasrg_ioCTL_ue_multicast_join: UE multicast join requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_ue_multicast_join: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_ue_multicast_join_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_ue_multicast_join: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// UE Multicast Leave
-//---------------------------------------------------------------------------
-void nasrg_set_ue_multicast_leave_reply(struct nas_msg_mt_mcast_reply *msgrep, struct nas_msg_mt_mcast_leave *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->ue_id<NAS_CX_MAX) {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->ue_id);
-    cx->requested_left_services[0] = msgreq->cnxid;
-    msgrep->ue_id  = msgreq->ue_id;
-    msgrep->result = nasrg_ASCTL_DC_send_mbms_ue_notify_req(cx);
-    msgrep->cnxid  = msgreq->cnxid;
-  } else {
-    msgrep->result=-NAS_ERROR_NOTCORRECTLCR;
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_ue_multicast_leave_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_mt_mcast_leave msgreq;
-  struct nas_msg_mt_mcast_reply msgrep;
-  printk("nasrg_ioCTL_ue_multicast_leave: UE multicast leave requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_ue_multicast_leave: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_ue_multicast_leave_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_ue_multicast_leave: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// ENB Measures
-// Messages for triggering measurement
-//---------------------------------------------------------------------------
-void nasrg_set_msg_eNBmeasure_trigger_reply(struct nas_msg_enb_measure_trigger_reply *msgrep, struct nas_msg_enb_measure_trigger *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  int lcr=0; // Temp lcr->mt =0 (should be GC uplink)
-
-  cx=nasrg_COMMON_search_cx(lcr);
-
-  if (msgreq->cell_id != cx->cellid)
-    printk("\nERROR : invalid cell_id received\n\n");
-
-  if (nasrg_ASCTL_DC_send_eNBmeasurement_req(cx)>0)
-    msgrep->status = 0;
-  else
-    msgrep->status = NAS_ERROR_NOTCORRECTVALUE ;
-}
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_eNBmeasure_trigger_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_enb_measure_trigger msgreq;
-  struct nas_msg_enb_measure_trigger_reply msgrep;
-  printk("nasrg_ioCTL_eNBmeasure_trigger_request: Measures triggered\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_eNBmeasure_trigger_request: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_eNBmeasure_trigger_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_eNBmeasure_trigger_request: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// ENb Measurement
-// Messages for Measurement retrieval
-//---------------------------------------------------------------------------
-void nasrg_set_msg_eNBmeasure_retrieve_reply(struct nas_msg_enb_measure_retrieve *msgrep)
-{
-  //---------------------------------------------------------------------------
-  int i;
-
-  msgrep->cell_id = gpriv->measured_cell_id;
-  msgrep->num_UEs = gpriv->num_UEs;
-
-  for (i=0; i<gpriv-> num_UEs; i++) {
-    msgrep->measures[i].rlcBufferOccupancy = gpriv->rlcBufferOccupancy[i];
-    msgrep->measures[i].scheduledPRB = gpriv->scheduledPRB[i];
-    msgrep->measures[i].totalDataVolume = gpriv->totalDataVolume[i];
-    //clean variables
-    gpriv->rlcBufferOccupancy[i] = 0;
-    gpriv->scheduledPRB[i] = 0;
-    gpriv->totalDataVolume[i] = 0;
-  }
-
-  msgrep->totalNumPRBs = gpriv->totalNumPRBs;
-  //clean variable
-  gpriv->totalNumPRBs = 0;
-}
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_eNBmeasure_retrieve_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_enb_measure_retrieve msgrep;
-  printk("nasrg_ioCTL_eNBmeasure_retrieve_request: Measurement requested\n");
-
-  nasrg_set_msg_eNBmeasure_retrieve_reply(&msgrep);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_eNBmeasure_retrieve_request: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// IOCTL command
-//---------------------------------------------------------------------------
-int nasrg_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ioctl *gifr;
-  int r;
-  printk("nasrg_CTL_ioctl: begin\n");
-  spin_lock(&gpriv->lock);
-
-  switch(cmd) {
-  case NASRG_IOCTL_RAL:
-    gifr=(struct nas_ioctl *)ifr;
-
-    switch(gifr->type) {
-    case NAS_MSG_STATISTIC_REQUEST:
-      r=nasrg_ioCTL_statistic_request(gifr);
-      break;
-
-    case NAS_MSG_CX_ESTABLISHMENT_REQUEST:
-      r=nasrg_ioCTL_cx_establishment_request(gifr);
-      break;
-
-    case NAS_MSG_CX_RELEASE_REQUEST:
-      r=nasrg_ioCTL_cx_release_request(gifr);
-      break;
-
-    case NAS_MSG_CX_LIST_REQUEST:
-      r=nasrg_ioCTL_cx_list_request(gifr);
-      break;
-
-    case NAS_MSG_RB_ESTABLISHMENT_REQUEST:
-      r=nasrg_ioCTL_rb_establishment_request(gifr);
-      break;
-
-    case NAS_MSG_RB_RELEASE_REQUEST:
-      r=nasrg_ioCTL_rb_release_request(gifr);
-      break;
-
-    case NAS_MSG_RB_LIST_REQUEST:
-      r=nasrg_ioCTL_rb_list_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_ADD_REQUEST:
-      r=nasrg_ioCTL_class_add_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_LIST_REQUEST:
-      r=nasrg_ioCTL_class_list_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_DEL_REQUEST:
-      r=nasrg_ioCTL_class_del_request(gifr);
-      break;
-
-    case NAS_RG_MSG_MT_MCAST_JOIN:
-      r=nasrg_ioCTL_ue_multicast_join_request(gifr);
-      break;
-
-    case NAS_RG_MSG_MT_MCAST_LEAVE:
-      r=nasrg_ioCTL_ue_multicast_leave_request(gifr);
-      break;
-
-    case NAS_MSG_ENB_MEAS_TRIGGER:
-      r=nasrg_ioCTL_eNBmeasure_trigger_request(gifr);
-      break;
-
-    case NAS_MSG_ENB_MEAS_RETRIEVE:
-      r=nasrg_ioCTL_eNBmeasure_retrieve_request(gifr);
-      break;
-
-    default:
-      printk("nasrg_CTL_ioctl: unkwon request type, type=%x\n", gifr->type);
-      r=-EFAULT;
-    }
-
-    break;
-
-  default:
-    printk("nasrg_CTL_ioctl: Unknown ioctl command, cmd=%x\n", cmd);
-    r=-EFAULT;
-  }
-
-  spin_unlock(&gpriv->lock);
-  printk("nasrg_CTL_ioctl: end\n");
-  return r;
-}
-
-//---------------------------------------------------------------------------
-void nasrg_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_CTL_send - void \n");
-}
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.h
deleted file mode 100644
index 2104c6cac1287ab156052b7eb718f9b33adf3de2..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_iocontrol.h
-* \brief I/O control constnats and structures for upper layers of driver for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef NASRGD_CTL_H
-#define NASRGD_CTL_H
-
-#include <asm/byteorder.h>
-#include <asm/types.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-
-#define NAS_MSG_MAXLEN 1100
-
-// type of CTL message
-#define NAS_MSG_STATISTIC_REQUEST       1
-#define NAS_MSG_STATISTIC_REPLY         2
-#define NAS_MSG_ECHO_REQUEST   3
-#define NAS_MSG_ECHO_REPLY   4
-#define NAS_MSG_CX_ESTABLISHMENT_REQUEST 5
-#define NAS_MSG_CX_ESTABLISHMENT_REPLY 6
-#define NAS_MSG_CX_RELEASE_REQUEST  7
-#define NAS_MSG_CX_RELEASE_REPLY  8
-#define NAS_MSG_CX_LIST_REQUEST  9
-#define NAS_MSG_CX_LIST_REPLY   10
-#define NAS_MSG_RB_ESTABLISHMENT_REQUEST 11
-#define NAS_MSG_RB_ESTABLISHMENT_REPLY 12
-#define NAS_MSG_RB_RELEASE_REQUEST  13
-#define NAS_MSG_RB_RELEASE_REPLY  14
-#define NAS_MSG_RB_LIST_REQUEST  15
-#define NAS_MSG_RB_LIST_REPLY   16
-#define NAS_MSG_CLASS_ADD_REQUEST  17
-#define NAS_MSG_CLASS_ADD_REPLY  18
-#define NAS_MSG_CLASS_DEL_REQUEST  19
-#define NAS_MSG_CLASS_DEL_REPLY  20
-#define NAS_MSG_CLASS_LIST_REQUEST  21
-#define NAS_MSG_CLASS_LIST_REPLY  22
-#define NAS_MSG_NEIGHBOUR_REQUEST  23
-#define NAS_MSG_NEIGHBOUR_REPLY  24
-//MBMS
-#define NAS_RG_MSG_MT_MCAST_JOIN           30
-#define NAS_RG_MSG_MT_MCAST_LEAVE          31
-#define NAS_RG_MSG_MT_MCAST_REPLY          32
-// ENB MEASURES (MEDIEVAL DEMO 3)
-#define NAS_MSG_ENB_MEAS_TRIGGER  33
-#define NAS_MSG_ENB_MEAS_RETRIEVE 34
-
-
-// Max number of entry of a message list
-#define NAS_LIST_CX_MAX 32
-#define NAS_LIST_RB_MAX 32
-#define NAS_LIST_CLASS_MAX 32
-
-typedef uint16_t nasMsgType_t;
-
-struct nas_ioctl {
-  char name[IFNAMSIZ];
-  nasMsgType_t type;
-  char *msg;
-};
-
-//****
-struct nas_msg_statistic_reply {
-  uint32_t rx_packets;
-  uint32_t tx_packets;
-  uint32_t rx_bytes;
-  uint32_t tx_bytes;
-  uint32_t rx_errors;
-  uint32_t tx_errors;
-  uint32_t rx_dropped;
-  uint32_t tx_dropped;
-};
-
-//****
-struct nas_msg_cx_list_reply {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-  uint8_t state;
-  nasCellID_t cellid;  // cell identification
-  uint32_t iid6[2];    // IPv6  interface identification
-  uint8_t iid4;    // IPv4 interface identification
-  uint16_t num_rb;
-  uint16_t nsclassifier;
-};
-//****
-struct nas_msg_cx_establishment_reply {
-  int status;
-};
-struct nas_msg_cx_establishment_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasCellID_t cellid; // Cell identification
-};
-//****
-struct nas_msg_cx_release_reply {
-  int status;
-};
-struct nas_msg_cx_release_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-};
-
-//****
-struct nas_msg_rb_list_reply {
-  nasRadioBearerId_t rab_id;
-  nasSapId_t sapi;
-  nasQoSTrafficClass_t qos;
-  uint8_t state;
-  uint32_t cnxid;
-};
-struct nas_msg_rb_list_request {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-};
-//****
-struct nas_msg_rb_establishment_reply {
-  int status;
-  uint32_t cnxid;
-};
-struct nas_msg_rb_establishment_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  nasQoSTrafficClass_t qos;
-  uint16_t dscp_ul;
-  uint16_t dscp_dl;
-  uint16_t mcast_flag;
-  uint8_t mcast_group[16];
-  uint32_t cnxid;
-};
-
-//****
-struct nas_msg_rb_release_reply {
-  int status;
-  uint32_t cnxid;
-};
-struct nas_msg_rb_release_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  uint16_t mcast_flag;
-  uint32_t cnxid;
-};
-
-//****
-struct nas_msg_class_add_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  uint8_t dir; // direction (send or receive)
-  uint8_t dscp; // codepoint
-  uint8_t fct;
-  uint16_t classref;
-  uint8_t version;
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } saddr; // IP source address
-  uint8_t splen; // prefix length
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } daddr; // IP destination address
-  uint8_t dplen; // prefix length
-  uint8_t protocol;  // high layer protocol type
-  uint16_t sport;  // source port
-  uint16_t dport;  // destination port
-};
-struct nas_msg_class_add_reply {
-  int status;
-};
-//****
-struct nas_msg_class_del_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  uint8_t dir; // direction (send or receive)
-  uint8_t dscp; // codepoint
-  uint16_t classref;
-};
-struct nas_msg_class_del_reply {
-  int status;
-};
-//****
-#define nas_msg_class_list_reply nas_msg_class_add_request
-struct nas_msg_class_list_request {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-  uint8_t dir;
-  uint8_t dscp;
-};
-
-//****
-struct nas_msg_neighbour_cell_list_reply {
-  nasCellID_t cellid;  // cell identification
-  uint32_t iid6[4];    // IPv6  address of access router
-};
-
-//MBMS
-//****
-struct nas_msg_mt_mcast_join {
-  nasLocalConnectionRef_t  ue_id;
-  uint32_t   cnxid;
-  nasRadioBearerId_t rab_id;
-};
-
-struct nas_msg_mt_mcast_leave {
-  nasLocalConnectionRef_t  ue_id;
-  uint32_t   cnxid;
-  nasRadioBearerId_t rab_id;
-};
-
-struct nas_msg_mt_mcast_reply {
-  nasLocalConnectionRef_t  ue_id;
-  uint32_t   cnxid;
-  int  result;
-};
-//****
-
-//MEDIEVAL DEMO 3
-//****
-struct nas_msg_enb_measure_trigger {
-  nasCellID_t cell_id;
-};
-struct nas_msg_enb_measure_trigger_reply {
-  int status;
-};
-
-struct nas_msg_enb_measure_retrieve {
-  nasCellID_t cell_id;
-  nasNumConnUEs_t num_UEs;
-  nasENbMeasures_t measures[MAX_MEASURE_UE];
-  nasENbMeasure_t totalNumPRBs;
-};
-
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_netlink.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_netlink.c
deleted file mode 100644
index 9cccb7c22674de9e7c2bad6b0020c2a6ae0687d9..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_netlink.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_netlink.c
-* \brief Netlink socket functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-//#include <linux/config.h>
-#include <linux/socket.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/netlink.h>
-#include <net/sock.h>
-#include <linux/kthread.h>
-
-#include <linux/mutex.h>
-
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-static struct sock *nas_nl_sk = NULL;
-static struct sock *nas_rrcnl_sk = NULL;
-
-//static int exit_netlink_thread=0;
-static DEFINE_MUTEX(nasrg_mutex);
-
-// This can also be implemented using thread to get the data from PDCP without blocking.
-//---------------------------------------------------------------------------
-// Function for transfer with PDCP (from NASLITE)
-static void nasrg_nl_data_ready (struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nlmsghdr *nlh = NULL;
-
-  // Start debug information
-#ifdef NETLINK_DEBUG
-  printk("nasrg_nl_data_ready - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasrg_nl_data_ready - input parameter skb is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-#ifdef NETLINK_DEBUG
-  printk("nasrg_nl_data_ready - Received socket from PDCP\n");
-#endif //NETLINK_DEBUG
-  nlh = (struct nlmsghdr *)skb->data;
-  nasrg_COMMON_QOS_receive(nlh);
-}
-
-//---------------------------------------------------------------------------
-//  Function for transfer with RRC
-static void nasrg_rrcnl_data_ready (struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nlmsghdr *nlh = NULL;
-  char target_sap;
-  uint8_t cxi;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RRCNL
-  printk("nasrg_rrcnl_data_ready - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasrg_rrcnl_data_ready - input parameter skb is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  nlh = (struct nlmsghdr *)skb->data;
-  //pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
-  //nasrg_TOOL_print_buffer((char *)NLMSG_DATA(nlh), 48);
-
-  target_sap = ((char*)NLMSG_DATA(nlh))[0];
-#ifdef NAS_DEBUG_RRCNL
-  printk("nasrg_rrcnl_data_ready - Received on socket from RRC, SAP %d\n", target_sap);
-#endif //NAS_DEBUG_RRCNL
-
-  switch (target_sap) {
-  case RRC_NAS_DC0_OUT:
-    //printk("nasrg_rrcnl_data_ready - Calling  nasrg_ASCTL_DC_receive\n");
-    cxi = 0;
-    nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  case RRC_NAS_DC1_OUT:
-    //printk("nasrg_rrcnl_data_ready - Calling  nasrg_ASCTL_DC_receive\n");
-    cxi = 1;
-    nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  case RRC_NAS_DC2_OUT:
-    //printk("nasrg_rrcnl_data_ready - Calling  nasrg_ASCTL_DC_receive\n");
-    cxi = 2;
-    nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  default:
-    printk("nasrg_rrcnl_data_ready - Invalid SAP value received\n");
-  }
-
-}
-
-//---------------------------------------------------------------------------
-int nasrg_netlink_init(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_netlink_init - begin \n");
-
-  nas_nl_sk = netlink_kernel_create(&init_net,OAI_IP_DRIVER_NETLINK_ID, 0, nasrg_nl_data_ready,
-                                    &nasrg_mutex, // NULL
-                                    THIS_MODULE);
-
-  if (!nas_nl_sk) {
-    printk("nasrg_netlink_init - netlink_kernel_create failed for PDCP socket\n");
-    // TEMP printk("nasrg_netlink_init - netlink_kernel_create failed for PDCP socket %d\n", errno);
-    return(-1);
-  }
-
-  nas_rrcnl_sk = netlink_kernel_create(&init_net,NAS_RRCNL_ID, 0, nasrg_rrcnl_data_ready,
-                                       &nasrg_mutex, // NULL
-                                       THIS_MODULE);
-
-  if (!nas_rrcnl_sk) {
-    printk("nasrg_rrcnl_init - netlink_kernel_create failed for RRC socket\n");
-    return(-1);
-  }
-
-  return(0);
-}
-
-//---------------------------------------------------------------------------
-void nasrg_netlink_release(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_netlink_release - begin \n");
-
-  //exit_netlink_thread=1;
-  printk("nasrg_netlink_release - Releasing netlink sockets\n");
-
-  if(nas_nl_sk) {
-    netlink_kernel_release(nas_nl_sk);
-  }
-
-  if(nas_rrcnl_sk) {
-    netlink_kernel_release(nas_rrcnl_sk);
-  }
-
-}
-
-//---------------------------------------------------------------------------
-int nasrg_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination)
-{
-  //---------------------------------------------------------------------------
-  struct sk_buff *nl_skb;
-  struct nlmsghdr *nlh;
-  int status;
-  // Start debug information
-#ifdef NETLINK_DEBUG
-  printk("nasrg_netlink_send - begin \n");
-#endif
-
-  if (!data_buffer) {
-    printk("nasrg_netlink_send - ERROR - input parameter data is NULL \n");
-    return(0);
-  }
-
-  if (!nas_nl_sk || !nas_rrcnl_sk) {
-    printk("nasrg_netlink_send - ERROR - socket is NULL\n");
-    return(0);
-  }
-
-  // End debug information
-
-  nl_skb = alloc_skb(NLMSG_SPACE(data_length),GFP_ATOMIC);
-
-  if (!nl_skb) {
-    printk("nasrg_netlink_send - ERROR - could not allocate skbuffer\n");
-    return(0);
-  }
-
-  nlh = (struct nlmsghdr *)nl_skb->data;
-
-  //  printk("nasrg_netlink_send Sending %d bytes (%d)\n",data_length,NLMSG_SPACE(data_length));
-  skb_put(nl_skb, NLMSG_SPACE(data_length));
-  memcpy(NLMSG_DATA(nlh), data_buffer, data_length);
-  nlh->nlmsg_len = NLMSG_SPACE(data_length);
-
-  nlh->nlmsg_pid = 0;      /* from kernel */
-  NETLINK_CB(nl_skb).pid = 0;
-
-  // destination 0 = PDCP, 1 = RRC
-  if (destination== NASNL_DEST_PDCP) {
-#ifdef NETLINK_DEBUG
-    printk("nasrg_netlink_send - Sending to PDCP - nl_skb %p, nl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_nl_sk, nlh, nlh->nlmsg_len);
-#ifdef NAS_DEBUG_SEND_DETAIL
-    nasrg_TOOL_print_buffer(NLMSG_DATA(nlh),48);
-#endif
-#endif //DEBUG_NETLINK
-    status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
-  } else {
-#ifdef NAS_DEBUG_RRCNL
-    printk("nasrg_netlink_send - Sending to RRC - nl_skb %p, nas_rrcnl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_rrcnl_sk, nlh, nlh->nlmsg_len);
-    nasrg_TOOL_print_buffer(NLMSG_DATA(nlh),data_length);
-#endif //NAS_DEBUG_RRCNL
-    status = netlink_unicast(nas_rrcnl_sk, nl_skb, NL_DEST_RRC_PID, MSG_DONTWAIT);
-  }
-
-  if (status < 0) {
-    printk("nasrg_netlink_send - SEND status is %d\n",status);
-    return(0);
-  } else {
-#ifdef NETLINK_DEBUG
-    printk("nasrg_netlink_send - SEND status is %d, data_length %d\n",status, data_length);
-#endif
-    return data_length;
-  }
-}
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_proto.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_proto.h
deleted file mode 100644
index 74eb226b05f1e10b452c3671014924a49c6f3d3f..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_proto.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_proto.h
-* \brief Function prototypes for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASRGD_PROTO_H
-#define _NASRGD_PROTO_H
-
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/ipv6.h>
-#include <linux/ip.h>
-#include <linux/sysctl.h>
-#include <linux/timer.h>
-#include <asm/param.h>
-//#include <sys/sysctl.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/in.h>
-#include <net/ndisc.h>
-
-// #include "rrc_nas_primitives.h"
-// #include "protocol_vars_extern.h"
-// #include "as_sap.h"
-// #include "rrc_qos.h"
-// #include "rrc_sap.h"
-
-// nasrg_netlink.c
-void nasrg_netlink_release(void);
-int nasrg_netlink_init(void);
-int nasrg_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination);
-
-// nasrg_common.c
-//void nasrg_COMMON_receive(uint16_t hlen, uint16_t dlength, int sap);
-void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-
-void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb);
-void nasrg_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-#ifndef PDCP_USE_NETLINK
-void nasrg_COMMON_QOS_receive(struct cx_entity *cx);
-#else
-void nasrg_COMMON_QOS_receive(struct nlmsghdr *nlh);
-#endif
-struct rb_entity *nasrg_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rabi, nasQoSTrafficClass_t qos);
-struct rb_entity *nasrg_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rabi);
-struct cx_entity *nasrg_COMMON_search_cx(nasLocalConnectionRef_t lcr);
-void nasrg_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp);
-void nasrg_COMMON_flush_rb(struct cx_entity *cx);
-
-//nasrg_ascontrol.c
-void nasrg_ASCTL_init(void);
-void nasrg_ASCTL_timer(unsigned long data);
-void nasrg_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-//int nasrg_ASCTL_DC_receive(struct cx_entity *cx);
-int nasrg_ASCTL_DC_receive(struct cx_entity *cx, char *buffer);
-//
-int nasrg_ASCTL_DC_send_cx_establish_confirm(struct cx_entity *cx, uint8_t response);
-int nasrg_ASCTL_DC_send_rb_establish_request(struct cx_entity *cx, struct rb_entity *rb);
-int nasrg_ASCTL_DC_send_rb_release_request(struct cx_entity *cx, struct rb_entity *rb);
-int nasrg_ASCTL_GC_send_mbms_bearer_establish_req(int mbms_ix );
-int nasrg_ASCTL_GC_send_mbms_bearer_release_req(int mbms_ix);
-int nasrg_ASCTL_DC_send_mbms_ue_notify_req(struct cx_entity *cx);
-int nasrg_ASCTL_DC_send_eNBmeasurement_req(struct cx_entity *cx);
-
-void nasrg_ASCTL_start_default_mbms_service(void);
-
-// nasrg_iocontrol.c
-void nasrg_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-int nasrg_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-
-// nasrg_classifier.c
-void nasrg_CLASS_send(struct sk_buff *skb);
-struct classifier_entity *nasrg_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref);
-struct classifier_entity *nasrg_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref);
-struct classifier_entity *nasrg_CLASS_add_mbmsclassifier(int mbms_ix, uint16_t classref);
-void nasrg_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref);
-void nasrg_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref);
-void nasrg_CLASS_del_mbmsclassifier(int mbms_ix, uint16_t classref);
-void nasrg_CLASS_flush_sclassifier(struct cx_entity *cx);
-void nasrg_CLASS_flush_rclassifier(void);
-void nasrg_CLASS_flush_mbmsclassifier(void);
-
-// nasrg_tool.c
-uint8_t nasrg_TOOL_invfct(struct classifier_entity *gc);
-void nasrg_TOOL_fct(struct classifier_entity *gc, uint8_t fct);
-void nasrg_TOOL_imei2iid(uint8_t *imei, uint8_t *iid);
-void nasrg_TOOL_RGimei2iid(uint8_t *imei, uint8_t *iid);
-uint8_t nasrg_TOOL_get_dscp6(struct ipv6hdr *iph);
-uint8_t nasrg_TOOL_get_dscp4(struct iphdr *iph);
-uint8_t *nasrg_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol);
-uint8_t *nasrg_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol);
-char *nasrg_TOOL_get_udpmsg(struct udphdr *udph);
-uint16_t nasrg_TOOL_udpcksum(struct in6_addr *saddr, struct in6_addr *daddr, uint8_t proto, uint32_t udplen, void *data);
-int nasrg_TOOL_network6(struct in6_addr *addr, struct in6_addr *prefix, uint8_t plen);
-int nasrg_TOOL_network4(uint32_t *addr, uint32_t *prefix, uint8_t plen);
-
-void nasrg_TOOL_pk_icmp6(struct icmp6hdr *icmph);
-
-void nasrg_TOOL_pk_all(struct sk_buff *skb);
-void nasrg_TOOL_pk_ipv6(struct ipv6hdr *iph);
-void nasrg_TOOL_print_state(uint8_t state);
-void nasrg_TOOL_print_buffer(unsigned char * buffer,int length);
-void nasrg_TOOL_print_rb_entity(struct rb_entity *rb);
-void nasrg_TOOL_print_classifier(struct classifier_entity *gc);
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_sap.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_sap.h
deleted file mode 100644
index 84f508cbc363753aa081e20061b24b14c81f74ce..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_sap.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_sap.h
-* \brief SAP constants for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASRGD_SAP_H
-#define _NASRGD_SAP_H
-
-
-// RT-FIFO identifiers ** must be identical to Access Stratum as_sap.h and rrc_sap.h
-
-#define RRC_DEVICE_GC                    RRC_SAPI_RG_GCSAP
-#define RRC_DEVICE_NT                    RRC_SAPI_RG_NTSAP
-#define RRC_DEVICE_DC_INPUT0             RRC_SAPI_RG_DCSAP0_IN
-#define RRC_DEVICE_DC_INPUT1             RRC_SAPI_RG_DCSAP1_IN
-#define RRC_DEVICE_DC_OUTPUT0            RRC_SAPI_RG_DCSAP0_OUT
-#define RRC_DEVICE_DC_OUTPUT1            RRC_SAPI_RG_DCSAP1_OUT
-//
-//#define QOS_DEVICE_CONVERSATIONAL_INPUT  QOS_SAPI_CONVERSATIONAL_INPUT_RG
-//#define QOS_DEVICE_CONVERSATIONAL_OUTPUT QOS_SAPI_CONVERSATIONAL_OUTPUT_RG
-
-#define PDCP2PDCP_USE_RT_FIFO 21
-#define NAS2PDCP_FIFO 22
-
-//FIFO indexes in control blocks
-#define NAS_DC_INPUT_SAPI  0
-#define NAS_DC_OUTPUT_SAPI 1
-#define NAS_SAPI_CX_MAX    2
-
-#define NAS_GC_SAPI         0
-#define NAS_NT_SAPI         1
-#define NAS_DRB_INPUT_SAPI  2  //NAS_CO_INPUT_SAPI
-#define NAS_DRB_OUTPUT_SAPI 3  //NAS_CO_OUTPUT_SAPI
-#define NAS_SAPI_MAX        4
-
-//#define NAS_QOS_CONVERSATIONAL UMTS_TRAFFIC_CONVERSATIONAL
-//
-
-/* Defined in RRC
-#define RRC_NAS_GC_IN   0
-#define RRC_NAS_GC_OUT  1
-#define RRC_NAS_NT_IN   2
-#define RRC_NAS_NT_OUT  3
-#define RRC_NAS_DC0_IN  4
-#define RRC_NAS_DC0_OUT 5
-#define RRC_NAS_DC1_IN  6
-#define RRC_NAS_DC1_OUT 7
-#define RRC_NAS_DC2_IN  8
-#define RRC_NAS_DC2_OUT 9
-*/
-#endif
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_tool.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_tool.c
deleted file mode 100644
index 4891f5447f4dd42f0161b036cbacb6bc18e786a1..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_tool.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-//---------------------------------------------------------------------------
-//
-void nasrg_TOOL_fct(struct classifier_entity *gc, uint8_t fct)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_fct - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasrg_TOOL_fct - input parameter gc is NULL \n");
-    return;
-  }
-
-  // End debug information
-  switch(fct) {
-  case NAS_FCT_QOS_SEND:
-    gc->fct=nasrg_COMMON_QOS_send;
-    break;
-
-  case NAS_FCT_CTL_SEND:
-    gc->fct=nasrg_CTL_send;
-    break;
-
-  case NAS_FCT_DC_SEND:
-    gc->fct=nasrg_ASCTL_DC_send_sig_data_request;
-    break;
-
-  case NAS_FCT_DEL_SEND:
-    gc->fct=nasrg_COMMON_del_send;
-    break;
-
-  default:
-    gc->fct=nasrg_COMMON_del_send;
-  }
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasrg_TOOL_invfct(struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_invfct - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasrg_TOOL_invfct - input parameter gc is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  if (gc->fct==nasrg_COMMON_QOS_send)
-    return NAS_FCT_QOS_SEND;
-
-  if (gc->fct==nasrg_CTL_send)
-    return NAS_FCT_CTL_SEND;
-
-  if (gc->fct==nasrg_COMMON_del_send)
-    return NAS_FCT_DEL_SEND;
-
-  if (gc->fct==nasrg_ASCTL_DC_send_sig_data_request)
-    return NAS_FCT_DC_SEND;
-
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasrg_TOOL_get_dscp6(struct ipv6hdr *iph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_get_dscp6 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasrg_TOOL_get_dscp6 - input parameter iph is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  // return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>22; //Yan
-  return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>20;
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasrg_TOOL_get_dscp4(struct iphdr *iph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_get_dscp4 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasrg_TOOL_get_dscp4 - input parameter iph is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  return ((iph->tos)>>5)<<3;
-}
-
-//---------------------------------------------------------------------------
-uint8_t *nasrg_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol)
-{
-  //---------------------------------------------------------------------------
-  uint16_t size;
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_get_protocol6 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasrg_TOOL_get_protocol6 - input parameter iph is NULL \n");
-    return NULL;
-  }
-
-  if (protocol==NULL) {
-    printk("nasrg_TOOL_get_protocol6 - input parameter protocol is NULL \n");
-    return NULL;
-  }
-
-  // End debug information
-
-  *protocol=iph->nexthdr;
-  size=NAS_IPV6_SIZE;
-
-  while (1) {
-    switch(*protocol) {
-    case IPPROTO_UDP:
-    case IPPROTO_TCP:
-    case IPPROTO_ICMPV6:
-      return (uint8_t *)((uint8_t *)iph+size);
-
-    case IPPROTO_HOPOPTS:
-    case IPPROTO_ROUTING:
-    case IPPROTO_DSTOPTS:
-      *protocol=((uint8_t *)iph+size)[0];
-      size+=((uint8_t *)iph+size)[1]*8+8;
-      break;
-
-    case IPPROTO_FRAGMENT:
-      *protocol=((uint8_t *)iph+size)[0];
-      size+=((uint8_t *)iph+size)[1]+8;
-      break;
-
-    case IPPROTO_NONE:
-    case IPPROTO_AH:
-    case IPPROTO_ESP:
-    default:
-      return NULL;
-    }
-  }
-}
-
-//---------------------------------------------------------------------------
-uint8_t *nasrg_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_get_protocol4 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasrg_TOOL_get_protocol4 - input parameter iph is NULL \n");
-    return NULL;
-  }
-
-  if (protocol==NULL) {
-    printk("nasrg_TOOL_get_protocol4 - input parameter protocol is NULL \n");
-    return NULL;
-  }
-
-  // End debug information
-  *protocol=iph->protocol;
-
-  switch(*protocol) {
-  case IPPROTO_UDP:
-  case IPPROTO_TCP:
-  case IPPROTO_ICMP:
-    return (uint8_t *)((uint8_t *)iph+iph->tot_len);
-
-  default:
-    return NULL;
-  }
-}
-
-//---------------------------------------------------------------------------
-// Convert the IMEI to iid
-void nasrg_TOOL_imei2iid(uint8_t *imei, uint8_t *iid)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_imei2iid - begin \n");
-#endif
-
-  if (imei==NULL) {
-    printk("nasrg_TOOL_imei2iid - input parameter imei is NULL \n");
-    return;
-  }
-
-  if (iid==NULL) {
-    printk("nasrg_TOOL_imei2iid - input parameter iid is NULL \n");
-    return;
-  }
-
-  // End debug information
-  memset(iid, 0, NAS_ADDR_LEN);
-  iid[0] = 0x03;
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-  iid[0] = 0x02;
-#endif
-  iid[1] = 16*imei[0]+imei[1];
-  iid[2] = 16*imei[2]+imei[3];
-  iid[3] = 16*imei[4]+imei[5];
-  iid[4] = 16*imei[6]+imei[7];
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-  iid[3] = 0xff;
-  iid[4] = 0xfe;
-#endif
-  iid[5] = 16*imei[8]+imei[9];
-  iid[6] = 16*imei[10]+imei[11];
-  iid[7] = 16*imei[12]+imei[13];
-}
-
-//---------------------------------------------------------------------------
-// Convert the RG IMEI to iid
-void nasrg_TOOL_RGimei2iid(uint8_t *imei, uint8_t *iid)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_RGimei2iid - begin \n");
-#endif
-
-  if (!imei || !iid) {
-    printk("nasrg_TOOL_RGimei2iid - input parameter imei or iid is NULL \n");
-    return;
-  }
-
-  // End debug information
-  memset(iid, 0, NAS_ADDR_LEN);
-  iid[0] = 0x00;   // to be compatible between link local and global
-  iid[1] = 16*imei[0]+imei[1];
-  iid[2] = 16*imei[2]+imei[3];
-  iid[3] = 16*imei[4]+imei[5];
-  iid[4] = 16*imei[6]+imei[7];
-  iid[5] = 16*imei[8]+imei[9];
-  iid[6] = 16*imei[10]+imei[11];
-  iid[7] = 16*imei[12]+imei[13];
-}
-
-//---------------------------------------------------------------------------
-void nasrg_TOOL_pk_icmp6(struct icmp6hdr *icmph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef GRAAL_DEBUG_TOOL
-  printk("nasrg_TOOL_pk_icmp6 - begin \n");
-#endif
-
-  if (!icmph) {
-    printk("nasrg_TOOL_pk_icmp6 - input parameter icmph is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
-
-  switch(icmph->icmp6_type) {
-  case ICMPV6_DEST_UNREACH:
-    printk("Destination unreachable\n");
-    break;
-
-  case ICMPV6_PKT_TOOBIG:
-    printk("Packet too big\n");
-    break;
-
-  case ICMPV6_TIME_EXCEED:
-    printk("Time exceeded\n");
-    break;
-
-  case ICMPV6_PARAMPROB:
-    printk("Parameter problem\n");
-    break;
-
-  case ICMPV6_ECHO_REQUEST:
-    printk("Echo request\n");
-    break;
-
-  case ICMPV6_ECHO_REPLY:
-    printk("Echo reply\n");
-    break;
-
-  case ICMPV6_MGM_QUERY:
-    printk("Multicast listener query\n");
-    break;
-
-  case ICMPV6_MGM_REPORT:
-    printk("Multicast listener report\n");
-    break;
-
-  case ICMPV6_MGM_REDUCTION:
-    printk("Multicast listener done\n");
-    break;
-
-  case NDISC_ROUTER_SOLICITATION:
-    printk("Router solicitation\n");
-    break;
-
-  case NDISC_ROUTER_ADVERTISEMENT:
-    printk("Router advertisment\n");
-    break;
-
-  case NDISC_NEIGHBOUR_SOLICITATION:
-    printk("Neighbour solicitation\n");
-    break;
-
-  case NDISC_NEIGHBOUR_ADVERTISEMENT:
-    printk("Neighbour advertisment\n");
-    break;
-
-  case NDISC_REDIRECT:
-    printk("redirect message\n");
-    break;
-  }
-}
-
-
-//---------------------------------------------------------------------------
-void nasrg_TOOL_print_state(uint8_t state)
-{
-  //---------------------------------------------------------------------------
-  switch(state) {
-  case  NAS_IDLE:
-    printk("NAS_IDLE\n");
-    return;
-
-  case  NAS_CX_FACH:
-    printk("NAS_CX_FACH\n");
-    return;
-
-  case  NAS_CX_DCH:
-    printk("NAS_CX_DCH\n");
-    return;
-
-  case  NAS_CX_RECEIVED:
-    printk("NAS_CX_RECEIVED\n");
-    return;
-
-  case  NAS_CX_CONNECTING:
-    printk("NAS_CX_CONNECTING\n");
-    return;
-
-  case  NAS_CX_RELEASING:
-    printk("NAS_CX_RELEASING\n");
-    return;
-
-  case  NAS_CX_CONNECTING_FAILURE:
-    printk("NAS_CX_CONNECTING_FAILURE\n");
-    return;
-
-  case  NAS_CX_RELEASING_FAILURE:
-    printk("NAS_CX_RELEASING_FAILURE\n");
-    return;
-
-  case  NAS_RB_ESTABLISHING:
-    printk("NAS_RB_ESTABLISHING\n");
-    return;
-
-  case  NAS_RB_RELEASING:
-    printk("NAS_RB_RELEASING\n");
-    return;
-
-  case  NAS_RB_ESTABLISHED:
-    printk("NAS_RB_ESTABLISHED\n");
-    return;
-
-  default:
-    printk(" Unknown state\n");
-  }
-}
-
-//-----------------------------------------------------------------------------
-// Print the content of a buffer in hexadecimal
-void nasrg_TOOL_print_buffer(unsigned char * buffer,int length)
-{
-  //-----------------------------------------------------------------------------
-  int i;
-
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_print_buffer - begin \n");
-#endif
-
-  if (buffer==NULL) {
-    printk("\n nasrg_TOOL_print_buffer - input parameter buffer is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("Buffer content: ");
-
-  for (i=0; i<length; i++)
-    printk("-%hx-",buffer[i]);
-
-  printk(",\t length %d\n", length);
-}
-
-//-----------------------------------------------------------------------------
-void nasrg_TOOL_print_rb_entity(struct rb_entity *rb)
-{
-  //-----------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_print_rb_entity - begin \n");
-#endif
-
-  if (rb==NULL) {
-    printk("\n nasrg_TOOL_print_rb_entity - input parameter rb is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, dscp %d, \n", rb->rab_id, rb->sapi, rb->qos, rb->dscp);
-  printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
-};
-
-//-----------------------------------------------------------------------------
-void nasrg_TOOL_print_classifier(struct classifier_entity *gc)
-{
-  //-----------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_print_classifier - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("\n nasrg_TOOL_print_classifier - input parameter gc is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", gc->classref, gc->version, gc->splen, gc->dplen);
-  printk("protocol %d, sport %d, dport %d, rab_id %d\n", gc->protocol, gc->sport, gc->dport, gc->rab_id);
-  nasrg_TOOL_print_rb_entity(gc->rb);
-};
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_variables.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_variables.h
deleted file mode 100644
index a8677452bcca209a4ac98efe14194f63baf26c9a..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_variables.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_variables.h
-* \brief Variable and structure definitions for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASRGD_VAR_H
-#define _NASRGD_VAR_H
-
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/ipv6.h>
-#include <linux/ip.h>
-#include <linux/sysctl.h>
-#include <linux/timer.h>
-#include <linux/unistd.h>
-//#include <asm/unistd.h>
-#include <asm/param.h>
-//#include <sys/sysctl.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/in.h>
-#include <net/ndisc.h>
-
-#include "rrc_nas_primitives.h"
-#include "rrc_qos_classes.h"
-#include "rrc_nas_sap.h"
-
-#include "nasrg_constant.h"
-#include "nasrg_sap.h"
-
-struct cx_entity;
-
-struct rb_entity {
-  //  uint16_t default_rab;
-  uint32_t   cnxid;
-  nasRadioBearerId_t rab_id;  //ue_rbId
-  nasRadioBearerId_t rg_rbId;
-  nasRadioBearerId_t mbms_rbId;
-  nasSapId_t sapi;
-  nasQoSTrafficClass_t qos;
-  nasQoSTrafficClass_t RadioQosClass;
-  nasIPdscp_t dscp;  //this is DL dscp
-  nasIPdscp_t dscp_ul;
-  uint8_t state;
-  uint8_t result;
-  uint8_t retry;
-  uint32_t countimer;
-  //for MBMS
-  uint16_t serviceId;
-  uint16_t sessionId;
-  uint16_t duration;
-  uint8_t  mcast_address[16];
-  //
-  struct rb_entity *next;
-};
-
-struct classifier_entity {
-  uint32_t classref;               // classifier identity
-  uint8_t version;                 // IP version 4 or 6
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } saddr;                    // IP source address
-  uint8_t splen;                   // IP prefix size
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } daddr;                    // IP destination address
-  uint8_t dplen;                   // IP prefix size
-  uint8_t protocol;                 // layer 4 protocol type (tcp, udp, ...)
-  uint16_t sport;                   // source port
-  uint16_t dport;                   // destination port
-  struct rb_entity *rb;
-  nasRadioBearerId_t rab_id;  // RAB identification
-  void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-  struct classifier_entity *next;
-};
-
-
-struct cx_entity {
-  int sap[NAS_SAPI_CX_MAX];
-  uint8_t state;                     // state of the connection
-  nasLocalConnectionRef_t lcr;  // Local connection reference
-  nasCellID_t cellid;            // cell identification
-  uint32_t countimer;                // timeout's counter
-  uint8_t retry;                      // number of retransmissions
-  struct classifier_entity *sclassifier[NAS_DSCP_MAX]; // send classifiers table
-  uint16_t nsclassifier;
-  uint32_t iid6[2];                   // IPv6  interface identification
-  uint8_t iid4;                       // IPv4 interface identification
-  struct rb_entity *rb;         // RB entities for RABs
-  uint16_t num_rb;
-  // MW - 17/5/05
-  int  ue_id;
-  int rrc_state;
-  // MBMS
-  int requested_joined_services[NASRG_MBMS_SVCES_MAX];
-  int requested_left_services[NASRG_MBMS_SVCES_MAX];
-  int joined_services[NASRG_MBMS_SVCES_MAX];
-};
-
-//struct mbms_rb_entity{
-//  uint32_t   cnxid;
-//  nasRadioBearerId_t mbms_rbId;
-//  nasSapId_t sapi;
-//  nasQoSTrafficClass_t qos;
-//  nasQoSTrafficClass_t RadioQosClass;
-//  uint8_t state;
-//  uint8_t result;
-//  uint8_t retry;
-//  uint32_t countimer;
-//
-//  uint16_t serviceId;
-//  uint16_t sessionId;
-//  uint16_t duration;
-//};
-//
-
-struct nas_priv {
-  int irq;
-  int rx_flags;
-  struct timer_list timer;
-  spinlock_t lock;
-  struct net_device_stats stats;
-  uint8_t retry_limit;
-  uint32_t timer_establishment;
-  uint32_t timer_release;
-  struct cx_entity cx[NAS_CX_MAX];
-  struct classifier_entity *rclassifier[NAS_DSCP_MAX]; // receive classifier
-  int nrclassifier;
-  uint32_t next_sclassref;
-  int sap[NAS_SAPI_MAX];
-  uint8_t xbuffer[NAS_MAX_LENGTH]; // transmission buffer
-  uint8_t rbuffer[NAS_MAX_LENGTH]; // reception buffer
-  // MW - 17/5/05
-  int broadcast_counter;
-  int SIB18_counter;
-  // MBMS
-  struct rb_entity mbms_rb[NASRG_MBMS_SVCES_MAX];
-  struct classifier_entity *mbmsclassifier[NASRG_MBMS_SVCES_MAX]; // mbms classifier
-  int nmbmsclassifier;
-  uint32_t next_mbmsclassref;
-  //Added for demo 3 - MW
-  nasCellID_t measured_cell_id;
-  uint16_t num_UEs;
-  uint32_t rlcBufferOccupancy[NAS_CX_MAX];
-  uint32_t scheduledPRB[NAS_CX_MAX];
-  uint32_t totalDataVolume[NAS_CX_MAX];
-  uint32_t totalNumPRBs;
-};
-
-struct ipversion {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-  uint8_t    reserved:4,
-             version:4;
-#else
-  uint8_t    version:4,
-             reserved:4;
-#endif
-};
-
-typedef struct pdcp_data_req_header_t {
-  unsigned int             rb_id;
-  unsigned int           data_size;
-  int            inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
-  unsigned int            rb_id;
-  unsigned int           data_size;
-  int            inst;
-} pdcp_data_ind_header_t;
-//
-extern struct nas_priv *gpriv;
-extern struct net_device *gdev;
-//extern int bytes_wrote;
-//extern int bytes_read;
-
-extern uint8_t NAS_RG_IMEI[14];
-extern uint8_t NAS_NULL_IMEI[14];
-
-//global variables shared with RRC
-extern int *pt_nas_rg_irq;
-//extern uint16_t *pt_rg_own_cell_id;
-extern uint16_t local_rg_cell_id;
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/Makefile b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/Makefile
deleted file mode 100755
index eec82de367aaa0dd70afc5d94cf3a397a9dc3ed7..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-# Lines starting with the pound sign are comments.
-#
-# These things are options that you might need
-# to tweak.
-
-# You can modify the below as well, but probably
-# won't need to.
-
-#CC = egcs
-
-#UPDIR	:= $(shell /bin/pwd)
-#GRAAL_DIR  =$(UPDIR)/..
-#RRC_DIR =$(UPDIR)/../../../AS/L3/RRC
-
-CELL_UPDIR := $(shell /bin/pwd)
-NAS_DIR := $(OPENAIR2_DIR)/NAS/DRIVER/CELLULAR/NASMT
-RRC_DIR := $(OPENAIR2_DIR)/RRC/CELLULAR
-EXTRA_CFLAGS += -I$(RRC_DIR) -DNODE_MT
-
-CFLAGS = -Wall -g -I$(NAS_DIR) -I$(RRC_DIR)
-
-COMPILE = $(CC) $(CFLAGS) -c
-
-OBJS = netltest.o
-
-EXECUTABLE = netltest
-
-# "all" is the default target. Simply make it point to myprogram.
-
-all: $(EXECUTABLE)
-
-# Define the components of the program, and how to link them together.
-# These components are defined as dependencies; that is, they must be
-# made up-to-date before the code is linked.
-
-$(EXECUTABLE): $(OBJS)
-	$(CC) $(CFLAGS) -o $(EXECUTABLE) $(OBJS)
-
-# Add any special rules here.
-
-# Specify that all .o files depend on .c files, and indicate how
-# the .c files are converted (compiled) to the .o files.
-
-%.o: %.c
-	$(COMPILE) -o $@ $<
-
-clean:
-	-rm $(OBJS) $(EXECUTABLE)
diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest
deleted file mode 100755
index f44ea64b09862efd61f5e17082141e4be4e9a500..0000000000000000000000000000000000000000
Binary files a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest and /dev/null differ
diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c
deleted file mode 100644
index 9f33bf6ce033b351dc4a0b16178de44ae80f0549..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-//-----------------------------------------------------------------------------
-// For FIFOS / NETLINK interface
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/********************
-// RRC definitions
- ********************/
-#include "nasmt_constant.h"
-#include "rrc_nas_sap.h"
-#include "rrc_constant.h"
-//-----------------------------------------------------------------------------
-//#define MAX_PAYLOAD 4096  /* this sould cover the max mtu size*/
-struct nlmsghdr *rrcnl_nlh;
-int rrcnl_sock_fd;
-struct sockaddr_nl rrcnl_src_addr, rrcnl_dest_addr;
-struct iovec rrcnl_iov;
-struct msghdr rrcnl_msg;
-
-//-----------------------------------------------------------------------------
-typedef unsigned int       sdu_size_t;
-typedef unsigned int       rb_id_t;
-
-typedef struct pdcp_data_req_header_t {
-  rb_id_t             rb_id;
-  sdu_size_t           data_size;
-  int       inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
-  rb_id_t             rb_id;
-  sdu_size_t           data_size;
-  int       inst;
-} pdcp_data_ind_header_t;
-
-#define MAX_PAYLOAD 1024  /* maximum payload size*/
-struct sockaddr_nl src_addr, dest_addr;
-struct nlmsghdr *nlh = NULL;
-struct iovec iov;
-int sock_fd;
-struct msghdr msg;
-#define OAI_IP_DRIVER_NETLINK_ID 31
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-void foo( int sig )
-{
-  //-----------------------------------------------------------------------------
-  printf("I got cntl-C, closing socket\n");
-  close(sock_fd);
-  close(rrcnl_sock_fd);
-  exit(-1);
-}
-
-//-----------------------------------------------------------------------------
-int main()
-{
-  //-----------------------------------------------------------------------------
-  struct sigaction newaction;
-  int i=0;
-  int ret;
-  int len, count;
-
-  newaction.sa_handler = foo;
-
-  // register cntl-C handler
-  if ( sigaction( SIGINT, &newaction, NULL ) == -1)
-    perror("Could not install the new signal handler");
-
-  // create both sockets
-  sock_fd = socket(PF_NETLINK, SOCK_RAW,OAI_IP_DRIVER_NETLINK_ID);
-  printf("Opened socket with fd %d\n",sock_fd);
-  ret = fcntl(sock_fd,F_SETFL,O_NONBLOCK);
-  printf("fcntl returns %d\n",ret);
-
-  rrcnl_sock_fd = socket(PF_NETLINK, SOCK_RAW, NAS_RRCNL_ID);
-  printf("rrc_ue_netlink_init - Opened socket with fd %d\n", rrcnl_sock_fd);
-  ret = fcntl(rrcnl_sock_fd,F_SETFL,O_NONBLOCK);
-  printf("rrc_ue_netlink_init - fcntl returns %d\n",ret);
-
-  // set src addresses blocks
-  memset(&src_addr, 0, sizeof(src_addr));
-  src_addr.nl_family = AF_NETLINK;
-  src_addr.nl_pid = 1;//getpid();  /* self pid */
-  src_addr.nl_groups = 0;  /* not in mcast groups */
-  ret = bind(sock_fd, (struct sockaddr*)&src_addr, sizeof(src_addr));
-  printf("bind returns %d\n",ret);
-
-  memset(&rrcnl_src_addr, 0, sizeof(rrcnl_src_addr));
-  rrcnl_src_addr.nl_family = AF_NETLINK;
-  rrcnl_src_addr.nl_pid = NL_DEST_RRC_PID;//getpid();  /* self pid */
-  rrcnl_src_addr.nl_groups = 0;  /* not in mcast groups */
-  ret = bind(rrcnl_sock_fd, (struct sockaddr*)&rrcnl_src_addr, sizeof(rrcnl_src_addr));
-  printf("rrc_ue_netlink_init - bind returns %d\n",ret);
-
-  // set dest addresses blocks
-  memset(&dest_addr, 0, sizeof(dest_addr));
-  dest_addr.nl_family = AF_NETLINK;
-  dest_addr.nl_pid = 0;   /* For Linux Kernel */
-  dest_addr.nl_groups = 0; /* unicast */
-
-  memset(&rrcnl_dest_addr, 0, sizeof(rrcnl_dest_addr));
-  rrcnl_dest_addr.nl_family = AF_NETLINK;
-  rrcnl_dest_addr.nl_pid = 0;   /* For Linux Kernel */
-  rrcnl_dest_addr.nl_groups = 0; /* unicast */
-
-  // set nlh
-  nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
-  /* Fill the netlink message header */
-  nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
-  nlh->nlmsg_pid = 1;//getpid();  /* self pid */
-  nlh->nlmsg_flags = 0;
-
-  rrcnl_nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(RRC_NAS_MAX_SIZE));
-  //memset(rrcnl_nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-  /* Fill the netlink message header */
-  rrcnl_nlh->nlmsg_len = NLMSG_SPACE(RRC_NAS_MAX_SIZE);
-  rrcnl_nlh->nlmsg_pid = NL_DEST_RRC_PID;//getpid();  /* self pid */
-  rrcnl_nlh->nlmsg_flags = 0;
-
-  // set iov
-  iov.iov_base = (void *)nlh;
-  iov.iov_len = nlh->nlmsg_len;
-  memset(&msg,0,sizeof(msg));
-  msg.msg_name = (void *)&dest_addr;
-  msg.msg_namelen = sizeof(dest_addr);
-  msg.msg_iov = &iov;
-  msg.msg_iovlen = 1;
-
-  rrcnl_iov.iov_base = (void *)rrcnl_nlh;
-  rrcnl_iov.iov_len = rrcnl_nlh->nlmsg_len;
-  memset(&rrcnl_msg,0,sizeof(rrcnl_msg));
-  rrcnl_msg.msg_name = (void *)&rrcnl_dest_addr;
-  rrcnl_msg.msg_namelen = sizeof(rrcnl_dest_addr);
-  rrcnl_msg.msg_iov = &rrcnl_iov;
-  rrcnl_msg.msg_iovlen = 1;
-
-  /* Read message from kernel */
-  memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-
-  /* Read message from kernel */
-  memset(rrcnl_nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-
-  while (1) {
-    len = recvmsg(sock_fd, &msg, 0);
-    count = recvmsg(rrcnl_sock_fd, &rrcnl_msg, 0);
-
-    if (len<0) {
-      //  exit(-1);
-    } else {
-      printf("Received PDCP socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
-    }
-
-    if (count<0) {
-      //  exit(-1);
-    } else {
-      printf("Received RRC socket with length %d (nlmsg_len = %d)\n",count,rrcnl_nlh->nlmsg_len);
-    }
-
-    /*    usleep(1000);
-        i=i+1;
-        if ((i % 100) == 0)
-          printf("%d\n",i);*/
-    usleep(50);
-    i=i+1;
-
-    if ((i % 1000) == 0)
-      printf("%d\n",i);
-
-    /*
-    for (i=0;i<nlh->nlmsg_len - sizeof(struct nlmsghdr);i++) {
-      printf("%x ",
-       ((unsigned char *)NLMSG_DATA(nlh))[i]);
-       }
-       */
-  }
-
-  /* Close Netlink Socket */
-  return 0;
-}
-
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/nettestPDCP.c b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/nettestPDCP.c
deleted file mode 100644
index 172110fa9b8f3bce79c57dac4e7ca2f20c76a241..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/nettestPDCP.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-
-typedef unsigned int       sdu_size_t;
-typedef unsigned int       rb_id_t;
-
-typedef struct pdcp_data_req_header_t {
-  rb_id_t             rb_id;
-  sdu_size_t           data_size;
-  int       inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
-  rb_id_t             rb_id;
-  sdu_size_t           data_size;
-  int       inst;
-} pdcp_data_ind_header_t;
-
-#define MAX_PAYLOAD 1024  /* maximum payload size*/
-struct sockaddr_nl src_addr, dest_addr;
-struct nlmsghdr *nlh = NULL;
-struct iovec iov;
-int sock_fd;
-struct msghdr msg;
-
-
-void foo( int sig )
-{
-
-  printf("I got cntl-C, closing socket\n");
-
-
-  close(sock_fd);
-  exit(-1);
-}
-
-
-#define OAI_IP_DRIVER_NETLINK_ID 31
-
-void main()
-{
-
-
-  struct sigaction newaction;
-  int i=0;
-  int ret;
-  int len;
-
-  newaction.sa_handler = foo;
-
-  if ( sigaction( SIGINT, &newaction, NULL ) == -1)
-    perror("Could not install the new signal handler");
-
-  sock_fd = socket(PF_NETLINK, SOCK_RAW,OAI_IP_DRIVER_NETLINK_ID);
-
-  printf("Opened socket with fd %d\n",sock_fd);
-
-  ret = fcntl(sock_fd,F_SETFL,O_NONBLOCK);
-  printf("fcntl returns %d\n",ret);
-
-  memset(&src_addr, 0, sizeof(src_addr));
-  src_addr.nl_family = AF_NETLINK;
-  src_addr.nl_pid = 1;//getpid();  /* self pid */
-  src_addr.nl_groups = 0;  /* not in mcast groups */
-  ret = bind(sock_fd, (struct sockaddr*)&src_addr,
-             sizeof(src_addr));
-  printf("bind returns %d\n",ret);
-
-  memset(&dest_addr, 0, sizeof(dest_addr));
-  dest_addr.nl_family = AF_NETLINK;
-  dest_addr.nl_pid = 0;   /* For Linux Kernel */
-  dest_addr.nl_groups = 0; /* unicast */
-
-  nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
-  /* Fill the netlink message header */
-  nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
-  nlh->nlmsg_pid = 1;//getpid();  /* self pid */
-  nlh->nlmsg_flags = 0;
-
-  iov.iov_base = (void *)nlh;
-  iov.iov_len = nlh->nlmsg_len;
-  memset(&msg,0,sizeof(msg));
-  msg.msg_name = (void *)&dest_addr;
-  msg.msg_namelen = sizeof(dest_addr);
-  msg.msg_iov = &iov;
-  msg.msg_iovlen = 1;
-
-
-  /* Read message from kernel */
-  memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-
-  while (1) {
-    len = recvmsg(sock_fd, &msg, 0);
-
-
-    if (len<0) {
-
-      //  exit(-1);
-    } else {
-      printf("Received socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
-    }
-
-    usleep(1000);
-    i=i+1;
-
-    if ((i % 100) == 0)
-      printf("%d\n",i);
-
-    /*
-    for (i=0;i<nlh->nlmsg_len - sizeof(struct nlmsghdr);i++) {
-      printf("%x ",
-       ((unsigned char *)NLMSG_DATA(nlh))[i]);
-       }
-       */
-  }
-
-  /* Close Netlink Socket */
-
-}
-
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/readme.txt b/openair2/NAS/DRIVER/CELLULAR/readme.txt
deleted file mode 100755
index fd4411a25bf46168b66fed55a4c9aa442cba6d39..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/readme.txt
+++ /dev/null
@@ -1,157 +0,0 @@
-         ---------------------------------
-         | UMTS-TDD (TD-CDMA) NAS driver |
-         ---------------------------------
-
-
-  
-1 - COMPILATION
----------------
-Pre-Req :
- - RTAI installed and running
- - IPv6 patched as described below (see 4 - Patching IPv6)
-  
-From RHODOS26 directory:
-  
- - make nasrg : creates the NAS RG driver (nasrg.ko) and copies it to the RHODOS26/bin directory
-  
- - make cleannasrg : deletes all object and temporary files from the nasrg directory
-  
- - make nasmt : creates the NAS MT driver (nasmt.ko) and copies it to the RHODOS26/bin directory
-  
- - make cleannasmt : deletes all object and temporary files from the nasmt directory
-  
-  
-2 - OPERATION - RG side
------------------------
-  
-A1 - Compile the Access Stratum (for IF mode)
-  
-Pre-Req : RTAI installed and running
-          ICC 8.0 installed and running
-  
-  > make rgif
-  > make asrguserif
-  > make rrmumts 
-
-A2 - Compile the Access Stratum (for RF mode)
-
-Pre-Req : RTAI installed and running
-          ICC 8.0 installed and running
-
-  > make guimakefiles
-  > make rgrf
-  > make asrguserrfa2
-  > make rrmumts
-
-
-B - Start the Access Stratum
-  
- (as root      )  > cd  <..>RHODOS26/bin
-  
- (first install)  > create_rtfifos
- (first install)  > mknod -m 666 /dev/daq0 c 127 1
- (after cleanas)  > cp
-../src/rrm_umts/congestion_control/resources_manager/rrm_master.properties .
-  
- (--           )  > ./start_rtos
- (--           )  > ./runrgif [for IF]   [or ./runrga2 for RF]
-  
- ==> to check correct operation:
- (as root      ) cat /dev/rtf62
- (as root      ) tail -f /var/log/messages
-  
-C - Start the NAS Driver
-  
- (as root      ) > cd  <..>RHODOS26/bin
- (--           ) > insmod nasrg.ko
- (--           ) > ./access_router.up
-  
-D - Stop the NAS Driver and the Access Stratum
-  
- (--           ) > ./access_router.down
- (--           ) > rmmod nasrg
- (--           ) > <CTRL+C> on Acccess stratum window
- (--           ) > ./stop_rtos
-  
-E - Clean Access Stratum compilation
-  
- > make cleanas
-  
-3 - OPERATION - MT side
------------------------
-  
-A1 - Compile the Access Stratum (for IF mode)
-
-Pre-Req : RTAI installed and running
-          ICC 8.0 installed and running
-          file RHODOS26/src/access_stratum/l1/low/control/mmx.h copied in /usr/include
-
-  > make mtif
-  > make asmtuserif
-  > make fpgatest
-
-A2 - Compile the Access Stratum (for RF mode)
-
-Pre-Req : RTAI installed and running
-          ICC 8.0 installed and running
-          file RHODOS26/src/access_stratum/l1/low/control/mmx.h copied in /usr/include
-
-  > make guimakefiles
-  > make mtrf
-  > make asmtuserrf
-  > make fpgatest
-
-
-B - Start the Access Stratum
-
- (as root      )  > cd  <..>RHODOS26/bin
-
- (first install)  > create_rtfifos
- (first install)  > mknod -m 666 /dev/daq0 c 127 1
-
- (--           )  > ./start_rtos
- (--           )  > ./runrgif [for IF]   [or ./runrga2 for RF]
-
- ==> to check correct operation:
- (as root      ) cat /dev/rtf62
- (as root      ) tail -f /var/log/messages
-
-C - Start the NAS Driver
-
- (as root      ) > cd  <..>RHODOS26/bin
- (--           ) > insmod nasmt.ko
- (--           ) > ./mobile_node.up
-
-D - Stop the NAS Driver and the Access Stratum
-
- (--           ) > ./mobile_node.down
- (--           ) > rmmod nasmt
- (--           ) > <CTRL+C> on Acccess stratum window
- (--           ) > ./stop_rtos
-
-E - Clean Access Stratum compilation
-
- > make cleanas
-
-
-4 - Patching IPv6
------------------------
-
-For Linux with 2.6.xx kernel version (xx = 10 or 81):
-
-- move RHODOS26/non_access_stratum/driver/src/addrconf.c.26.xx to /usr/src/linux/net/ipv6/addrconf.c
-- move RHODOS26/non_access_stratum/driver/src/if_arp.h.26.xx   to /usr/src/linux/include/linux/if_arp.h
-- recompile IPv6 (inside the kernel or as a module, as usual)
-  
-5 - Start the MT connection
------------------------
-
-You can use either the RAL-UMTS (RAL-CDMA) -- see corresponding documentation --
-
-* OR *
-
-the tool provided with the driver (directory RHODOS26/src/non_access_stratum/driver/mt_tools).
-Install the tool, update the Cell_id field if needed and click on the "Attach" button.
-  
-
- 
\ No newline at end of file
diff --git a/openair2/NAS/DRIVER/CELLULAR/start_mt_cellular b/openair2/NAS/DRIVER/CELLULAR/start_mt_cellular
deleted file mode 100755
index c89f19e9c04e315fdce80edaff46645816c9efee..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/start_mt_cellular
+++ /dev/null
@@ -1,13 +0,0 @@
-#xterm -hold "tail -f /var/log/messages" &
-insmod ./NASMT/nascellmt.ko nas_IMEI=3,5,6,0,1,4,9,1,5,0,0,0,0,0
-#insmod ./NASMT/nascellmt.ko
-sleep 2
-ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
-#ifconfig oai0 add 2001:660:382:14:335:600:8014:9150/64
-#./bin/mobile_node.up
-#sleep 3
-#./CTL_TOOL/gioctl cx add 0 5
-#xterm -hold -e ./bin/IALdummy &
-#sleep 1
-#xterm -hold -e ./bin/tdcdma_gui &
-#lsmod
diff --git a/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_noradvd b/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_noradvd
deleted file mode 100755
index 3d51140dcde1916cec44af8f32674ca7e9e65f87..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_noradvd
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#xterm -hold -e ant -buildfile rrm_umts.xml run &
-#sleep 2
-insmod ./NASRG/nascellrg.ko
-sleep 2
-#bin/access_router_noradvd.up
-sysctl -w net.ipv6.conf.default.dad_transmits=0
-#sysctl -w net.ipv6.conf.all.forwarding=1
-#sysctl -w net.ipv4.conf.all.forwarding=1
-
-#ifconfig oai0 192.168.14.100
-ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
-ifconfig oai0 add 2001:660:382:14::1/64
-#ifconfig graal0 192.168.14.100
-#ifconfig graal0 add 2001:690:2380:7777::1/64
-#ifconfig graal0 add 2001:660:382:14::1/64
-#lsmod
\ No newline at end of file
diff --git a/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_radvd b/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_radvd
deleted file mode 100755
index f57fb7712d6fb16a76d1041e1e31af8c082767fc..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_radvd
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#xterm -hold -e ant -buildfile rrm_umts.xml run &
-#sleep 2
-insmod ./NASRG/nascellrg.ko
-sleep 2
-#bin/access_router_noradvd.up
-sysctl -w net.ipv6.conf.default.dad_transmits=0
-sysctl -w net.ipv6.conf.all.forwarding=1
-#sysctl -w net.ipv4.conf.all.forwarding=1
-
-#ifconfig oai0 192.168.14.100
-ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
-ifconfig oai0 add 2001:660:382:14::1/64
-
-#lsmod
-sleep 4s
-radvd
diff --git a/openair2/NAS/DRIVER/CELLULAR/stop_mt_cellular b/openair2/NAS/DRIVER/CELLULAR/stop_mt_cellular
deleted file mode 100755
index e7325cf40f586f45dc4bb2cf20ff12d6507a0e2f..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/stop_mt_cellular
+++ /dev/null
@@ -1,5 +0,0 @@
-#killall -qw tdcdma_gui
-#killall -qw IALdummy
-#./bin/mobile_node.down
-rmmod -w nascellmt
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/stop_rg_cellular b/openair2/NAS/DRIVER/CELLULAR/stop_rg_cellular
deleted file mode 100755
index 88d17a7e6bffae19a5ff224c8157bf0aac45fe45..0000000000000000000000000000000000000000
--- a/openair2/NAS/DRIVER/CELLULAR/stop_rg_cellular
+++ /dev/null
@@ -1,2 +0,0 @@
-ifconfig oai0 down
-rmmod -w nascellrg
diff --git a/openair2/NAS/Makefile.inc b/openair2/NAS/Makefile.inc
deleted file mode 100644
index a06e8f690aa3d9ae1aea78d27767f293eace592b..0000000000000000000000000000000000000000
--- a/openair2/NAS/Makefile.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-NAS_UE_DIR = $(OPENAIR2_TOP)/NAS
-
-NAS_UE_OBJS =
-
-NAS_UE_incl = \
-    -I$(NAS_UE_DIR)
diff --git a/openair2/NAS/SIMU_CELLULAR/Makefile b/openair2/NAS/SIMU_CELLULAR/Makefile
deleted file mode 100755
index 26af978a4ef741d386f7be4614948057b91af3e6..0000000000000000000000000000000000000000
--- a/openair2/NAS/SIMU_CELLULAR/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-# lines starting with the pound sign are comments.
-#
-# These things are options that you might need
-# to tweak.
-
-
-# You can modify the below as well, but probably
-# won't need to.
-
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-#UPDIR	:= /homes/mwett/rh_mw/RHODOS
-COMMON_DIR = $(OPENAIR2_DIR)/COMMON
-RRC_CELL_DIR = $(OPENAIR2_DIR)/RRC/CELLULAR
-NAS_SIMU_DIR = $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR
-#ASN1_DIR = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
-ASN1_DIR = $(OPENAIR2_DIR)
-
-#UPDIR	:= $(EURECOM_SRC_PATH)
-#GRAAL_DIR  =$(UPDIR)/non_access_stratum/driver/nasmt
-#RRC_DIR =$(UPDIR)/access_stratum/l3/rrc
-
-#CFLAGS += -Wall -g -DDEBUG_RRC_STATE -DUSER_MODE -DNODE_RG -DNODE_MT
-CFLAGS += -std=gnu99 -I$(KERNEL_DIR)  -DUSER_MODE -DNB_ANTENNAS_RX=1
-
-ifdef CELL_RRM
-CFLAGS += -DNODE_RG
-OBJ +=rrm_fifo_standalone.o nasrg_simu_meas.o
-else
-ifdef MASTER
-CFLAGS += -DNODE_RG
-OBJ +=nasrg_simu_main.o nasrg_simu_control.o nasrg_simu_rrm_fifo.o nasrg_simu_meas.o
-else
-CFLAGS += -DNODE_MT
-OBJ +=nasmt_simu_main.o nasmt_simu_control.o
-endif
-endif
-
-ifdef CELLULAR
-CFLAGS += -DCELLULAR -DNO_RRM -I$(COMMON_DIR) -I$(RRC_CELL_DIR) -I$(NAS_SIMU_DIR) -I$(ASN1_DIR)
-endif
-
-
-$(OBJ) : %.o : %.c
-	$(CC) $(CFLAGS) -c -o $@ $< -pthread
-
-all: nasmt_simu nasrg_simu
-
-nasmt_sim : $(OBJ)
-	$(CC)  -o nasmt_simu $(OBJ) $(CFLAGS) -lm -lrt -pthread
-	mv nasmt_simu $(OPENAIR_TARGETS)/SIMU/USER
-
-nasrg_sim : $(OBJ)
-	$(CC)  -o nasrg_simu $(OBJ) $(CFLAGS) -lm -lrt -pthread
-	mv nasrg_simu $(OPENAIR_TARGETS)/SIMU/USER
-
-cell_rrm : $(OBJ)
-	$(CC)  -o cell_rrm $(OBJ) $(CFLAGS) -lm -lrt -pthread
-	mv cell_rrm $(OPENAIR_TARGETS)/SIMU/USER
-
-clean:
-	-rm $(OBJ) $(EXECUTABLE)
-
diff --git a/openair2/NAS/SIMU_CELLULAR/nas_simu_proto.h b/openair2/NAS/SIMU_CELLULAR/nas_simu_proto.h
deleted file mode 100644
index ef728f1b142162465e2187d681549ff7c5861d09..0000000000000000000000000000000000000000
--- a/openair2/NAS/SIMU_CELLULAR/nas_simu_proto.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#ifndef __NAS_CONTROL_H__
-#define __NAS_CONTROL_H__
-
-#ifdef NODE_MT
-//-----------------------------------------------------------------------------
-void nas_ue_control_init (void);
-//int nas_ue_DC_attach(void);
-//int nas_ue_DC_attach_complete(void);
-int  nas_ue_GC_Rcve_FIFO (void);
-int  nas_ue_NT_Rcve_FIFO (void);
-int  nas_ue_DC_Rcve_FIFO (void);
-#endif
-
-#ifdef NODE_RG
-//-----------------------------------------------------------------------------
-void nas_rg_control_init (void);
-//int nas_rg_DC_ConnectMs(void) ;
-int  nas_rg_DC_Rcve_FIFO (int time);
-
-int nasrg_rrm_socket_init(void);
-void nasrg_rrm_fifos_init (void);
-void nasrg_rrm_to_rrc_write (void);
-void nasrg_rrm_from_rrc_read (void);
-
-int nasrg_meas_loop (int time, int UE_Id);
-void nas_rg_print_buffer (char *buffer, int length);
-/*void nasrg_print_meas_report (char *rrc_rrm_meas_payload, uint16_t type);
-void nasrg_print_bs_meas_report (char *rrc_rrm_meas_payload, uint16_t type);*/
-void nasrg_print_meas_report (char *rrc_rrm_meas_payload, unsigned short type);
-void nasrg_print_bs_meas_report (char *rrc_rrm_meas_payload, unsigned short type);
-#endif
-
-#endif
diff --git a/openair2/NAS/SIMU_CELLULAR/nasrg_simu_meas.c b/openair2/NAS/SIMU_CELLULAR/nasrg_simu_meas.c
deleted file mode 100644
index 37fbcb7756bd926368d294561bf3eb9d7360216c..0000000000000000000000000000000000000000
--- a/openair2/NAS/SIMU_CELLULAR/nasrg_simu_meas.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-
-
-#include "openair_types.h"
-#include "rrc_constant.h"
-
-#include "rrc_msg_constant.h"
-#include "rrc_rrm_primitives.h"
-#include "rrc_msg_ies.h"
-
-#include "nas_simu_proto.h"
-
-extern int  rrc_rg_rrm_in_fifo;
-
-int sim_counter=0;
-
-/* Mobile Station */
-//-------------------------------------------------------------------
-void nasrg_meas_if_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Intra-Frequency
-  rrm_control->type = IX_ifM;
-  // measurementCommand         SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount16;
-  rrm_control->period = int2000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_if_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Intra-Frequency
-  rrm_control->type = IX_ifM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Traffic Volume
-  rrm_control->type = IX_tvM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount_inf;
-  rrm_control->period = int2000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Traffic Volume
-  rrm_control->type = IX_tvM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Quality
-  rrm_control->type = IX_qM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount2; //for test
-  //rrm_control->amount = amount_inf; // for execution
-  rrm_control->period = int3000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Quality
-  rrm_control->type = IX_qM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_int_ue_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Internal UE
-  rrm_control->type = IX_iueM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount8;
-  rrm_control->period = int1000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_int_ue_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Internal UE
-  rrm_control->type = IX_iueM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-}
-
-
-/* Base Station */
-//-------------------------------------------------------------------
-void nasrg_meas_bs_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Traffic Volume
-  rrm_control->type = IX_tvbM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount_inf;
-  rrm_control->period = int4000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_bs_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Traffic Volume
-  rrm_control->type = IX_tvbM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_bs_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Quality
-  rrm_control->type = IX_qbM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount2;
-  rrm_control->period = int3000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_bs_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Quality
-  rrm_control->type = IX_qbM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_int_bs_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Internal BS
-  rrm_control->type = IX_ibsM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = maxUsers;        //should not be set
-  rrm_control->amount = amount16;
-  rrm_control->period = int4000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_int_bs_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Internal BS
-  rrm_control->type = IX_ibsM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = maxUsers;        //should not be set
-}
-
-//-------------------------------------------------------------------
-void nasrg_send_meas_request_to_rrc (int ue_id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  measurement_request meas_request;
-  int count =0;
-
-  printf ("[NASRG_MEAS_TEST] RPC_MEASUREMENT_REQUEST --> RRC\n ");
-  memset ((char*)& rpc_mess, 0, sizeof (rpc_message));
-  memset ((char*)& meas_request, 0, sizeof (measurement_request));
-  //build header
-  rpc_mess.type = RPC_MEASUREMENT_REQUEST;
-  rpc_mess.length = sizeof (measurement_request);
-  // build content
-  meas_request.measurement_type = rrm_control->type;
-  meas_request.measurement_command = rrm_control->command;
-  // different conding between RRM and RRC
-  // Mobile terminal RRC = 0, RRM = 1
-  // Base Station    RRC = 1, RRM = 2
-  meas_request.equipment_type = rrm_control->BaseStation + 1;
-  meas_request.equipment_id = rrm_control->UE_Id;
-  meas_request.amount = rrm_control->amount;
-  meas_request.period = rrm_control->period;
-
-  // send to RRC
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & meas_request, sizeof (measurement_request));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-
-#ifdef DEBUG_NAS_MEAS_SIMU
-  nas_rg_print_buffer ((char *) & rpc_mess, sizeof (rpc_message));
-  nas_rg_print_buffer ((char *) & meas_request, sizeof (meas_request));
-#endif
-}
-
-//-------------------------------------------------------------------
-//  in case not  rrc_rg_meas_loop (time,UE_Id);
-int nasrg_rrm_meas_stop (int time, int UE_Id)
-{
-  //-------------------------------------------------------------------
-  struct rrc_rrm_measure_ctl control;
-
-  // Measurement Control  - Stop Quality previously sent by RRM
-  nasrg_meas_q_release (UE_Id, &control);
-  //rrc_rrm_measure_request (control);
-  nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  return 0;
-}
-//-------------------------------------------------------------------
-//        rrc_rg_meas_loop (time,UE_Id);
-int nasrg_meas_loop (int time, int UE_Id)
-{
-  //-------------------------------------------------------------------
-  struct rrc_rrm_measure_ctl control;
-
-  sim_counter++;
-  //  if (time % 5 == 0) {
-#ifdef DEBUG_NAS_MEAS_SIMU
-  printf ("\n[NASRG_MEAS_TEST] Simu Measurement Time : %d, counter : %d\n", time, sim_counter);
-#endif
-
-  //  }
-  if (sim_counter == 8) {
-    // Measurement Control  - Stop Quality previously sent by RRM
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] NAS sends Measurement Control (Stop Quality) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_q_release (UE_Id, &control);
-    //rrc_rrm_measure_request (control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Intra-Frequency
-  //  if (sim_counter == 140) {
-  if (sim_counter == 16) {
-    // Measurement Control  - Start Intra-frequency
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Start Intra-freq) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_if_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 700) {
-  if (sim_counter == 70) {
-    // Measurement Control  - Stop Intra-frequency
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Intra-freq) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_if_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Traffic Volume
-  //  if (sim_counter == 100) {
-  if (sim_counter == 12) {
-    // Measurement Control  - Start Traffic Volume
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Start Traffic Volume) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_tv_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 990) {
-  if (sim_counter == 92) {
-    // Measurement Control  - Stop Traffic Volume
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Traffic Volume) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_tv_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Quality
-  //  if (sim_counter == 503) {
-  if (sim_counter == 50) {
-    // Measurement Control  - Start Quality
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Start Quality) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_q_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 995) {
-  if (sim_counter == 96) {
-    // Measurement Control  - Stop Quality
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Quality) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_q_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Internal UE
-  //  if (sim_counter == 210) {
-  if (sim_counter == 20) {
-    // Measurement Control  - Start Internal UE
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Start Int UE) message at time : %d\n\n", sim_counter);
-#endif
-    // setup int_ue measurement for MT
-    nasrg_meas_int_ue_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 999) {
-  if (sim_counter == 98) {
-    // Measurement Control  - Stop Internal UE
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Int UE) message at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_int_ue_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Internal BS
-  //  if (sim_counter == 105) {
-  if (sim_counter == 14) {
-    // Measurement Control  - Start Internal BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG starts internal Measurement (Int BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_int_bs_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 980) {
-  if (sim_counter == 86) {
-    // Measurement Control  - Stop Internal BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG stops internal Measurement (Int BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_int_bs_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Traffic Volume BS
-  //  if (sim_counter == 220) {
-  if (sim_counter == 22) {
-    // Measurement Control  - Start Traffic Volume BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG starts internal Measurement (Traffic Volume BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_bs_tv_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 900) {
-  if (sim_counter == 80) {
-    // Measurement Control  - Stop Traffic Volume BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG stops internal Measurement (Traffic Volume BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_bs_tv_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Quality BS
-  //  if (sim_counter == 625) {
-  if (sim_counter == 62) {
-    // Measurement Control  - Start Quality BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG starts internal Measurement (Quality BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_bs_q_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 989) {
-  if (sim_counter == 90) {
-    // Measurement Control  - Stop Quality BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG stops internal Measurement (Quality BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_bs_q_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  return sim_counter;
-}
-
-//-----------------------------------------------------------------------------
-//void rrc_rg_print_meas_report (struct rrc_rg_mt_meas_rep *p){
-void nasrg_print_meas_report (char *rrc_rrm_meas_payload, uint16_t type)
-{
-  //-----------------------------------------------------------------------------
-  int i, j;
-  char *payload[20] =
-  { "pl0", "pl4", "pl8", "pl16", "pl32", "pl64", "pl128", "pl256", "pl512", "pl1024", "pl2k", "pl4k", "pl8k", "pl16k", "pl32k", "pl64k", "pl128k", "pl256k", "pl512k", "pl1024k" };
-  char *average[20] = {
-    "pla0", "pla4", "pla8", "pla16", "pla32", "pla64", "pla128", "pla256", "pla512", "pla1024", "pla2k",
-    "pla4k", "pla8k", "pla16k", "pla32k", "pla64k", "pla128k", "pla256k", "pla512k","pla1024k"
-  };
-  char *variance[14] = { "plv0", "plv4", "plv8", "plv16", "plv32", "plv64", "plv128", "plv256", "plv512", "plv1024", "plv2k", "plv4k", "plv8k", "plv16k" };
-
-  printf ("\n[NASRG-MEAS] **************  MT  Measurement Report Message   *****************\n");
-
-  switch (type) {
-  case RPC_L1_MEASUREMENT_MT_INTRA_FREQUENCY_REPORT: {
-    struct rrc_rrm_meas_report_mt_if *p;
-    p = (struct rrc_rrm_meas_report_mt_if *)rrc_rrm_meas_payload;
-    printf ("Intra Frequency Measurement\t Number of cells: %d\n", p->if_num_cells);
-
-    for (i = 0; i < p->if_num_cells; i++) {
-      printf ("[NASRG-MEAS] Cell number: %d\tCell Identity: %d\tCell Parameters Id: %d\tP-CCPCH RSCP: %d\tPathloss: %d\n", i, p->if_cell_id[i], p->if_cell_parms_id[i], p->if_BCH_RSCP[i], p->if_pathloss[i]);
-      printf ("\tTimeslot ISCP for each slot:\t");
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d: %d, ", j, p->if_slot_iscp[i][j]);
-
-      printf ("\n");
-    }
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_MT_TRAFFIC_VOLUME_REPORT: {
-    struct rrc_rrm_meas_report_mt_tv *p;
-    p = (struct rrc_rrm_meas_report_mt_tv *)rrc_rrm_meas_payload;
-    printf ("Traffic Volume Measurement -\t Number of RBs: %d\n", p->tv_num_rbs);
-
-    for (i = 0; i < p->tv_num_rbs; i++)
-      printf ("[NASRG-MEAS] RB_Id : %d\t, RLC_BufferPayload : %s\t, Average : %s\t, Variance : %s\n",
-              p->tv_rbid[i], payload[p->tv_rb_payload[i]], average[p->tv_rb_average[i]], variance[p->tv_rb_variance[i]]);
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_MT_QUALITY_REPORT: {
-    struct rrc_rrm_meas_report_mt_q *p;
-    p = (struct rrc_rrm_meas_report_mt_q *)rrc_rrm_meas_payload;
-    printf ("Quality Measurement -\t Number of Transport Channels : %d, Number of TFCS : %d\n", p->q_num_TrCH, p->q_num_tfcs);
-    printf ("[NASRG-MEAS] BLER for each Transport Channel:\t");
-
-    for (i = 0; i < p->q_num_TrCH; i++)
-      printf ("%d: %d, ", p->q_dl_TrCH_id[i], p->q_dl_TrCH_BLER[i]);
-
-    printf ("\n");
-    printf ("[NASRG-MEAS] SIR for each TFCS for each slot:\n");
-
-    for (i = 0; i < p->q_num_tfcs; i++) {
-      printf ("%d: ", p->q_tfcs_id[i]);
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d, ", p->q_sir[i][j]);
-
-      printf ("\n");
-    }
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_MT_INTERNAL_REPORT: {
-    struct rrc_rrm_meas_report_mt_int *p;
-    p = (struct rrc_rrm_meas_report_mt_int *)rrc_rrm_meas_payload;
-    printf ("UE internal Measurement\t Timing Advance: %d\n", p->int_timing_advance);
-    printf ("[NASRG-MEAS] Transmitted Power for each slot:\t");
-
-    for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-      printf ("%d: %d, ", j, p->int_xmit_power[j]);
-
-    printf ("\n");
-  }
-  break;
-  }
-
-  printf ("[NASRG-MEAS] *****END*********    Measurement Report Message   *******\n\n");
-}
-
-//-----------------------------------------------------------------------------
-void nasrg_print_bs_meas_report (char *rrc_rrm_meas_payload, uint16_t type)
-{
-  //-----------------------------------------------------------------------------
-  int i, j;
-  char *payload[20] =
-  { "pl0", "pl4", "pl8", "pl16", "pl32", "pl64", "pl128", "pl256", "pl512", "pl1024", "pl2k", "pl4k", "pl8k", "pl16k", "pl32k", "pl64k", "pl128k", "pl256k", "pl512k", "pl1024k" };
-  char *average[20] = {
-    "pla0", "pla4", "pla8", "pla16", "pla32", "pla64", "pla128", "pla256", "pla512", "pla1024", "pla2k",
-    "pla4k", "pla8k", "pla16k", "pla32k", "pla64k", "pla128k", "pla256k", "pla512k", "pla1024k"
-  };
-  char *variance[14] = { "plv0", "plv4", "plv8", "plv16", "plv32", "plv64", "plv128", "plv256", "plv512", "plv1024", "plv2k", "plv4k", "plv8k", "plv16k" };
-
-  printf ("\n[NASRG-MEAS] **************  BS  Measurement Report Message   *****************\n");
-
-  switch (type) {
-  case RPC_L1_MEASUREMENT_RG_TRAFFIC_VOLUME_REPORT: {
-    struct rrc_rrm_meas_report_bs_tv *p;
-    p = (struct rrc_rrm_meas_report_bs_tv *)rrc_rrm_meas_payload;
-    printf ("Traffic Volume Measurement -\t Number of RBs: %d\n", p->tv_num_rbs);
-
-    for (i = 0; i < p->tv_num_rbs; i++)
-      printf ("[NASRG-MEAS] RB_Id : %d\t, RLC_BufferPayload : %s\t, Average : %s\t, Variance : %s\n",
-              p->tv_rbid[i], payload[p->tv_rb_payload[i]], average[p->tv_rb_average[i]], variance[p->tv_rb_variance[i]]);
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_RG_QUALITY_REPORT: {
-    struct rrc_rrm_meas_report_bs_q *p;
-    p = (struct rrc_rrm_meas_report_bs_q *)rrc_rrm_meas_payload;
-    printf ("Quality Measurement -\t Number of Transport Channels : %d, Number of TFCS : %d\n", p->q_num_TrCH, p->q_num_tfcs);
-    printf ("[NASRG-MEAS] BLER for each Transport Channel:\t");
-
-    for (i = 0; i < p->q_num_TrCH; i++)
-      printf ("%d: %d, ", p->q_dl_TrCH_id[i], p->q_dl_TrCH_BLER[i]);
-
-    printf ("\n");
-    printf ("[NASRG-MEAS] SIR for each TFCS for each slot:\n");
-
-    for (i = 0; i < p->q_num_tfcs; i++) {
-      printf ("%d: ", p->q_tfcs_id[i]);
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d, ", p->q_sir[i][j]);
-
-      printf ("\n");
-    }
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_RG_INTERNAL_REPORT: {
-    struct rrc_rrm_meas_report_bs_int *p;
-    p = (struct rrc_rrm_meas_report_bs_int *)rrc_rrm_meas_payload;
-    printf ("BS internal Measurement\n");
-
-    for (i = 0; i < numANTENNAS; i++) {
-      printf ("[NASRG-MEAS] Transmitted Power for each slot on antenna %d :  ", i);
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d: %d, ", j, p->int_xmit_power[i][j]);
-
-      printf ("\n");
-    }
-
-    for (i = 0; i < JRRM_SLOTS_PER_FRAME; i++) {
-      printf ("[NASRG-MEAS] RSCP for each channel on slot %d :  ", i);
-
-      for (j = 0; j < MAXCH; j++)
-        printf ("%d: %d, ", j, p->int_rscp[i][j]);
-
-      printf ("\n");
-    }
-
-    for (i = 0; i < numANTENNAS; i++) {
-      printf ("[NASRG-MEAS] RSSI RF for each slot on antenna %d :  ", i);
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d: %d, ", j, p->int_rssi_rf[i][j]);
-
-      printf ("\n");
-    }
-
-    for (i = 0; i < NUMSPARE; i++) {
-      printf ("[NASRG-MEAS] Spare value : %d: %d\n", i, p->int_spare[i]);
-    }
-  }
-  break;
-  }
-
-  printf ("[NASRG-MEAS] *****END*********    Measurement Report Message   *******\n\n");
-}
-
diff --git a/openair2/NAS/SIMU_CELLULAR/rrm_fifo_standalone.c b/openair2/NAS/SIMU_CELLULAR/rrm_fifo_standalone.c
deleted file mode 100644
index 08a19403886ed06256fd79c944e1c695b120f882..0000000000000000000000000000000000000000
--- a/openair2/NAS/SIMU_CELLULAR/rrm_fifo_standalone.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <errno.h>
-#include <sys/time.h>
-#include <ctype.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-//
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-//-----------------------------------------------------------------------------
-#include "openair_types.h"
-#include "rrc_constant.h"
-#include "nas_simu_proto.h"
-
-#include "rrc_rrm_sap.h"
-#include "rrc_msg_constant.h"
-#include "rrc_rrm_primitives.h"
-
-void nasrg_meas_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control);
-void nasrg_meas_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control);
-void nasrg_send_meas_request_to_rrc (int ue_id, struct rrc_rrm_measure_ctl *rrm_control);
-//-----------------------------------------------------------------------------
-int  rrc_rg_rrm_in_fifo;
-int  rrc_rg_rrm_out_fifo;
-int  tXmit_id;
-#define RRM_MSG_MAX_LENGTH 1500
-struct rrc_rrm_measure_ctl control;
-
-//-----------------------------------------------------------------------------
-// Open FIFOs for RG RRC SAPs
-void nasrg_rrm_fifos_init (void)
-{
-  //-----------------------------------------------------------------------------
-  int write_flag = O_WRONLY | O_NONBLOCK | O_NDELAY;
-  int read_flag = O_RDONLY | O_NONBLOCK | O_NDELAY;
-
-  // Open FIFOs
-
-  while ((rrc_rg_rrm_in_fifo = open (RRM_INPUT_SAPI, write_flag)) < 0) {
-    printf ("%s returned value %d\n", RRM_INPUT_SAPI, rrc_rg_rrm_in_fifo);
-    fflush(stdout);
-    sleep (1);
-  }
-
-  while ((rrc_rg_rrm_out_fifo = open (RRM_OUTPUT_SAPI, read_flag)) < 0) {
-    printf ("%s returned value %d\n", RRM_OUTPUT_SAPI, rrc_rg_rrm_out_fifo);
-    fflush(stdout);
-    sleep (1);
-  }
-
-  printf ("FIFO RRM_INPUT_SAPI, %d\n", rrc_rg_rrm_in_fifo);
-  printf ("FIFO RRM_OUTPUT_SAPI, %d\n", rrc_rg_rrm_out_fifo);
-}
-
-//-------------------------------------------------------------------
-void rrm_connection_response (void)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  connection_response response;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  printf ("[CELL-RRM] RPC_CONNECTION_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_CONNECTION_RESPONSE;
-  rpc_mess.length = sizeof (connection_response)+ strlen (sim_data);
-  response.equipment_id = 0;
-  response.status = STATUS_CONNECTION_ACCEPTED;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (connection_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-}
-
-//-------------------------------------------------------------------
-void rrm_add_user_response (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  add_user_response response;
-  add_user_request *request;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  request = (add_user_request *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_ADD_USER_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_ADD_USER_RESPONSE;
-  rpc_mess.length = sizeof (add_user_response)+ strlen (sim_data);
-  response.equipment_id = 0;
-  response.user_id = request->user_id;
-  response.tx_id = request->tx_id;
-  response.status = ADD_USER_SUCCESSFUL;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (add_user_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-}
-
-//-------------------------------------------------------------------
-void rrm_remove_user_response (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  remove_user_response response;
-  remove_user_request *request;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  request = (remove_user_request *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_REMOVE_USER_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_REMOVE_USER_RESPONSE;
-  rpc_mess.length = sizeof (remove_user_response)+ strlen (sim_data);
-  response.equipment_id = 0;
-  response.user_id = request->user_id;
-  response.tx_id = request->tx_id;
-  response.status = REMOVE_USER_SUCCESSFUL;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (remove_user_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-
-  /* Not sure it is really needed here
-  usleep (5000); //wait 5ms
-  // stop q measurement for MT
-  nasrg_meas_q_release (UE_Id, &control);
-  nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  */
-}
-
-//-------------------------------------------------------------------
-void rrm_add_radio_access_bearer_response (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  add_radio_access_bearer_response response;
-  add_radio_access_bearer_request *request;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  request = (add_radio_access_bearer_request *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_ADD_RADIO_ACCESS_BEARER_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_ADD_RADIO_ACCESS_BEARER_RESPONSE;
-  rpc_mess.length = sizeof (add_radio_access_bearer_response)+ strlen (sim_data);
-  response.user_id = request->user_id;
-  response.rab_id = request->rab_id;
-  response.tx_id = request->tx_id;
-  response.status = ADD_RADIO_ACCESS_BEARER_SUCCESSFUL;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (add_radio_access_bearer_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-}
-
-//-------------------------------------------------------------------
-void rrm_add_measurement_request (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  add_radio_access_bearer_confirm *confirm;
-
-  confirm = (add_radio_access_bearer_confirm *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_L1_MEASUREMENT_MT_QUALITY_REPORT --> RRC\n ");
-
-  // TEMP removed the Meas request (causes bothe messages to be received together by RRC RG
-  //   usleep (20000); //wait 5ms
-  // setup q measurement for MT
-  nasrg_meas_q_setup (confirm->user_id, &control);
-  nasrg_send_meas_request_to_rrc (confirm->user_id, &control);
-
-}
-
-
-//-------------------------------------------------------------------
-void rrm_remove_radio_access_bearer_response (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  remove_radio_access_bearer_response response;
-  remove_radio_access_bearer_request *request;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  request = (remove_radio_access_bearer_request *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_REMOVE_RADIO_ACCESS_BEARER_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_REMOVE_RADIO_ACCESS_BEARER_RESPONSE;
-  rpc_mess.length = sizeof (remove_radio_access_bearer_response)+ strlen (sim_data);
-  response.user_id = request->user_id;
-  response.rab_id = request->rab_id;
-  response.tx_id = request->tx_id;
-  response.status = REMOVE_RADIO_ACCESS_BEARER_SUCCESSFUL;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (remove_radio_access_bearer_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-
-  usleep (20000); //wait 5ms
-  // stop q measurement for MT
-  nasrg_meas_q_release (request->user_id, &control);
-  nasrg_send_meas_request_to_rrc (request->user_id, &control);
-}
-
-
-//-----------------------------------------------------------------------------
-// Check if anything in RRC FIFO and send it to RRM
-void nasrg_rrm_from_rrc_read (void)
-{
-  //-----------------------------------------------------------------------------
-  char rcve_buffer[RRM_MSG_MAX_LENGTH];
-  int  rpc_header_size=0;
-  int  count = 0;
-  rpc_message *rrc_rrm_mess;
-  char *rrc_rrm_meas_payload;
-
-  memset (rcve_buffer, 0, RRM_MSG_MAX_LENGTH - 1);
-  rpc_header_size = sizeof (rpc_message);
-  rrc_rrm_mess = (rpc_message *) rcve_buffer;
-
-  if ((count = read (rrc_rg_rrm_out_fifo, rcve_buffer, rpc_header_size)) > 0) {
-    //printf("\n RRM FIFO %d, bytes count %d", rrc_rg_rrm_out_fifo, count);
-#ifdef DEBUG_RRC_RRM_INTF
-    printf ("\n [DEBUG]Message Received in RRM FIFO %d , length %d, type %d \n", rrc_rg_rrm_out_fifo, rrc_rrm_mess->length, rrc_rrm_mess->type);
-#endif
-    //get the rest of the primitive
-    count += read (rrc_rg_rrm_out_fifo, &(rcve_buffer[rpc_header_size]), rrc_rrm_mess->length );
-
-    switch (rrc_rrm_mess->type) {
-    case RPC_CONNECTION_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_CONNECTION_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_connection_response();
-      break;
-
-    case RPC_ADD_USER_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_ADD_USER_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_add_user_response(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_REMOVE_USER_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_REMOVE_USER_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_remove_user_response(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_ADD_RADIO_ACCESS_BEARER_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_ADD_RADIO_ACCESS_BEARER_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_add_radio_access_bearer_response(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_REMOVE_RADIO_ACCESS_BEARER_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_REMOVE_RADIO_ACCESS_BEARER_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_remove_radio_access_bearer_response(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_ADD_USER_CONFIRM:
-      printf ("\n[CELL-RRM]Received RPC RPC_ADD_USER_CONFIRM , length %d\n", rrc_rrm_mess->length);
-      break;
-
-    case RPC_ADD_RADIO_ACCESS_BEARER_CONFIRM:
-      printf ("\n[CELL-RRM]Received RPC RPC_ADD_RADIO_ACCESS_BEARER_CONFIRM , length %d\n", rrc_rrm_mess->length);
-      //rrm_add_measurement_request(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_L1_MEASUREMENT_RG_INTERNAL_REPORT:
-    case RPC_L1_MEASUREMENT_RG_QUALITY_REPORT:
-    case RPC_L1_MEASUREMENT_RG_TRAFFIC_VOLUME_REPORT:
-      rrc_rrm_meas_payload = (char *)rcve_buffer +12; //12 = rpc_header + equipment_id
-      //nas_rg_print_buffer (rrc_rrm_meas_payload, rrc_rrm_mess->length);
-      nasrg_print_bs_meas_report (rrc_rrm_meas_payload,rrc_rrm_mess->type);
-      break;
-
-    case RPC_L1_MEASUREMENT_MT_INTERNAL_REPORT:
-    case RPC_L1_MEASUREMENT_MT_QUALITY_REPORT:
-    case RPC_L1_MEASUREMENT_MT_TRAFFIC_VOLUME_REPORT:
-    case RPC_L1_MEASUREMENT_MT_INTRA_FREQUENCY_REPORT:
-      rrc_rrm_meas_payload = (char *)rcve_buffer +12; //12 = rpc_header + equipment_id
-      //nas_rg_print_buffer (rrc_rrm_meas_payload, rrc_rrm_mess->length);
-      nasrg_print_meas_report (rrc_rrm_meas_payload,rrc_rrm_mess->type);
-      break;
-
-    default:
-      break;
-    }
-
-    fflush(stdout);
-  }
-}
-
-
-//-----------------------------------------------------------------------------
-int main (int argc, char **argv)
-{
-  //-----------------------------------------------------------------------------
-  int time = 0;
-  //     int rc, sd_rrm;
-  //     fd_set readfds;
-  //     struct timeval tv;
-  tXmit_id =0;
-  nasrg_rrm_fifos_init ();
-  printf ("[RRM] RRM FIFOs ready\n");
-  fflush(stdout);
-
-  while (1) {
-    usleep (100000);
-    time ++;
-    //printf ("\n[RRM_TEST] Simu Measurement Time at Main: %d\n", time);
-
-    // check RRM FIFO
-    nasrg_rrm_from_rrc_read();
-  }
-}
diff --git a/openair2/NETWORK_DRIVER/LITE/Makefile b/openair2/NETWORK_DRIVER/LITE/Makefile
deleted file mode 100755
index 76ba3b5bdb3baaed7780d38cb60ee40699fc6d5e..0000000000000000000000000000000000000000
--- a/openair2/NETWORK_DRIVER/LITE/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-# NASMESH Driver makefile
-#
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-KERNEL_ARCH:=$(shell echo `uname -m`)
-SET_X64:=$(shell if [ $(KERNEL_ARCH) = 'x86_64' ]; then echo true ; fi)
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-EXTRA_CFLAGS = -I$(OPENAIR2_DIR)/COMMON -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) 
-
-ifdef ADDRCONF
-EXTRA_CFLAGS += -DADDRCONF
-endif
-
-ifdef OAI_NW_DRIVER_TYPE_ETHERNET
-EXTRA_CFLAGS += -DOAI_NW_DRIVER_TYPE_ETHERNET
-endif
-
-ifdef OAI_NW_DRIVER_USE_NETLINK
-EXTRA_CFLAGS += -DOAI_NW_DRIVER_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-ccflags-y= $(CFLAGS) $(EXTRA_CFLAGS)
-CFLAGS=
-
-ifdef LOOPBACK
-EXTRA_CFLAGS += -DLOOPBACK_TEST
-endif
-
-ifdef ADDRESS_FIX
-EXTRA_CFLAGS += -DNAS_ADDRESS_FIX
-endif
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += oai_nw_drv.o
-oai_nw_drv-objs += device.o
-oai_nw_drv-objs += common.o
-oai_nw_drv-objs += ioctl.o
-oai_nw_drv-objs += classifier.o
-oai_nw_drv-objs += tool.o
-ifdef OAI_NW_DRIVER_USE_NETLINK
-oai_nw_drv-objs += netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-#netlink.ko:
-	#make $(x)$(y) PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-#oai_nw_drv.ko:
-#	make  V=1 -C $(KERNEL_DIR) M=`pwd` modules
-print:
-	@echo subversion : $(SUBVERSION)
-clean:
-	rm -f *.ko
-	rm -f .*.ko.cmd
-	rm -f .*.o.cmd
-	rm -f *.o
-	rm -f *.mod.c
-	find . -name *.ko     -delete
-	find . -name .*.o     -delete
-	find . -name *.o      -delete
-	find . -name *.mod.c  -delete
diff --git a/openair2/NETWORK_DRIVER/LITE/RB_TOOL/rb_tool.c b/openair2/NETWORK_DRIVER/LITE/RB_TOOL/rb_tool.c
index edf29dbee0e12606741531daaff356ef0a247257..e918f209e37f3dab584a81a3bdcbd6f67f077550 100644
--- a/openair2/NETWORK_DRIVER/LITE/RB_TOOL/rb_tool.c
+++ b/openair2/NETWORK_DRIVER/LITE/RB_TOOL/rb_tool.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/classifier.c b/openair2/NETWORK_DRIVER/LITE/classifier.c
index 18dba8725341273345e73f77bec1d2ce0deb675c..bc6888279b422eed3a16021892a70055f0be4296 100644
--- a/openair2/NETWORK_DRIVER/LITE/classifier.c
+++ b/openair2/NETWORK_DRIVER/LITE/classifier.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/common.c b/openair2/NETWORK_DRIVER/LITE/common.c
index 9749429201b6d27efdb09ee6e1eb3ea5b7df53f6..0d616d5764fa16e47ec5971b8f81346c54d110c8 100644
--- a/openair2/NETWORK_DRIVER/LITE/common.c
+++ b/openair2/NETWORK_DRIVER/LITE/common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/constant.h b/openair2/NETWORK_DRIVER/LITE/constant.h
index 1d8821dfdd99fab445804ca6175915a2caa6014d..efeba0b86dd92c817db6ac43f7de0f7520e0544d 100644
--- a/openair2/NETWORK_DRIVER/LITE/constant.h
+++ b/openair2/NETWORK_DRIVER/LITE/constant.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/device.c b/openair2/NETWORK_DRIVER/LITE/device.c
index 616af5e14550c47e52f38c91b292ff64806bcab8..854c3bcc997b07b4231b088a2eabd9215d8e6f42 100644
--- a/openair2/NETWORK_DRIVER/LITE/device.c
+++ b/openair2/NETWORK_DRIVER/LITE/device.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,13 +28,6 @@
 */
 /*******************************************************************************/
 
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // OAI_NW_DRIVER_USE_NETLINK
-
 #include "constant.h"
 #include "local.h"
 #include "proto_extern.h"
@@ -519,23 +512,12 @@ int init_module (void)
 
 #ifndef OAI_NW_DRIVER_USE_NETLINK
 
-#ifdef RTAI //with RTAI you have to indicate which irq# you want
-
-  pdcp_2_oai_nw_drv_irq=rt_request_srq(0, oai_nw_drv_interrupt, NULL);
-
-#endif
-
   if (pdcp_2_oai_nw_drv_irq == -EBUSY || pdcp_2_oai_nw_drv_irq == -EINVAL) {
     printk("[OAI_IP_DRV][%s] No interrupt resource available\n", __FUNCTION__);
     return -EBUSY;
   } else
     printk("[OAI_IP_DRV][%s] Interrupt %d\n", __FUNCTION__, pdcp_2_oai_nw_drv_irq);
 
-  //rt_startup_irq(RTAI_IRQ);
-
-  //rt_enable_irq(RTAI_IRQ);
-
-
 #endif //NETLINK
 
   for (inst=0; inst<OAI_NW_DRV_NB_INSTANCES_MAX; inst++) {
@@ -601,12 +583,6 @@ void cleanup_module(void)
 
   if (pdcp_2_oai_nw_drv_irq!=-EBUSY) {
     pdcp_2_oai_nw_drv_irq=0;
-#ifdef RTAI
-    // V1
-    //    rt_free_linux_irq(priv->irq, NULL);
-    // END V1
-    rt_free_srq(pdcp_2_oai_nw_drv_irq);
-#endif
     // Start IRQ linux
     //free_irq(priv->irq, NULL);
     // End IRQ linux
diff --git a/openair2/NETWORK_DRIVER/LITE/ioctl.c b/openair2/NETWORK_DRIVER/LITE/ioctl.c
index 06309403d1de9d1d14edb05cbf8327db082c85fa..85c213c5fff365f31970c31a7f15d3ca32fdd69b 100644
--- a/openair2/NETWORK_DRIVER/LITE/ioctl.c
+++ b/openair2/NETWORK_DRIVER/LITE/ioctl.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/ioctl.h b/openair2/NETWORK_DRIVER/LITE/ioctl.h
index dcd26543de71eea267bdc79f7ad0465fe52731f6..d5bab2038c2c4d8363b689b66e0b91bb45f1836b 100644
--- a/openair2/NETWORK_DRIVER/LITE/ioctl.h
+++ b/openair2/NETWORK_DRIVER/LITE/ioctl.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/local.h b/openair2/NETWORK_DRIVER/LITE/local.h
index f1d2a7bb3dd29705fceeb01e6e00224521c53c0b..ea82dd9b8588519c9c740abbd9e7f78ed440d29f 100644
--- a/openair2/NETWORK_DRIVER/LITE/local.h
+++ b/openair2/NETWORK_DRIVER/LITE/local.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/netlink.c b/openair2/NETWORK_DRIVER/LITE/netlink.c
index b54ec4a9875a38d311cf233790804e67d8f2a2fa..2ad104b421358fc91876dc21ca4e8550ad0f3edf 100644
--- a/openair2/NETWORK_DRIVER/LITE/netlink.c
+++ b/openair2/NETWORK_DRIVER/LITE/netlink.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/proto_extern.h b/openair2/NETWORK_DRIVER/LITE/proto_extern.h
index 57aa601a61a9f9d3c3c3e0bc93aa2def9b2be8af..f07083921f3f81adc07a34c25aea4358609eb04c 100644
--- a/openair2/NETWORK_DRIVER/LITE/proto_extern.h
+++ b/openair2/NETWORK_DRIVER/LITE/proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/sap.h b/openair2/NETWORK_DRIVER/LITE/sap.h
index 1fff9744afae2e2d9385d8c0f3a98e84b9b3ba5f..d72a1b10df1ee35d685f8a7be8beea5939ed4015 100644
--- a/openair2/NETWORK_DRIVER/LITE/sap.h
+++ b/openair2/NETWORK_DRIVER/LITE/sap.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/LITE/tool.c b/openair2/NETWORK_DRIVER/LITE/tool.c
index 089259458d4cd82e6d56ace58f2601f16a33d264..d8d0030dd9186c85cf07e759a3c046270d635ee0 100644
--- a/openair2/NETWORK_DRIVER/LITE/tool.c
+++ b/openair2/NETWORK_DRIVER/LITE/tool.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/Makefile b/openair2/NETWORK_DRIVER/MESH/Makefile
deleted file mode 100755
index f4bf87f3185dab440d6bf00b5598c942f2a0597b..0000000000000000000000000000000000000000
--- a/openair2/NETWORK_DRIVER/MESH/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-# NASMESH Driver makefile
-#
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-####################################################
-#      NASMESH compilation flags
-####################################################
-#RTAI=1
-
-####################################################
-#  D E B U G   F L A G S
-####################################################
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-#EXTRA_CFLAGS = -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) 
-EXTRA_CFLAGS += -I$(OPENAIR2_DIR)
-ifdef PDCP_USE_NETLINK
-EXTRA_CFLAGS += -DPDCP_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-ifdef LOOPBACK
-EXTRA_CFLAGS += -DLOOPBACK_TEST
-endif
-
-ifdef ADDRESS_FIX
-EXTRA_CFLAGS += -DNAS_ADDRESS_FIX
-endif
-ifdef NAS_DEBUG_RECEIVE
-EXTRA_CFLAGS += -DNAS_DEBUG_RECEIVE
-endif
-
-ifdef NAS_DEBUG_SEND
-EXTRA_CFLAGS += -DNAS_DEBUG_SEND
-endif
-
-ccflags-y := $(CFLAGS) $(EXTRA_CFLAGS)
-CFLAGS=
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += nasmesh.o
-nasmesh-objs += device.o
-nasmesh-objs += common.o
-nasmesh-objs += ioctl.o
-nasmesh-objs += classifier.o
-nasmesh-objs += tool.o
-nasmesh-objs += mesh.o
-ifdef PDCP_USE_NETLINK
-nasmesh-objs += netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-#netlink.ko:
-#	make PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-#nasmesh.ko:
-#	make  V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-clean:
-	rm -f $(nasmesh-objs) $(obj-m)
-#	make -C $(KERNEL_DIR) modules
diff --git a/openair2/NETWORK_DRIVER/MESH/RB_TOOL/rb_tool.c b/openair2/NETWORK_DRIVER/MESH/RB_TOOL/rb_tool.c
index 24dfcaf61ec098c3c85269a40945fdb52296cbdd..8e231895d97a0961da97e9f060c673a5cbe80e39 100644
--- a/openair2/NETWORK_DRIVER/MESH/RB_TOOL/rb_tool.c
+++ b/openair2/NETWORK_DRIVER/MESH/RB_TOOL/rb_tool.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/TESTBENCH/testbench.c b/openair2/NETWORK_DRIVER/MESH/TESTBENCH/testbench.c
index 172110fa9b8f3bce79c57dac4e7ca2f20c76a241..121d3bba8b9cb9ade5a35f79a82d7ab7d37d5f39 100644
--- a/openair2/NETWORK_DRIVER/MESH/TESTBENCH/testbench.c
+++ b/openair2/NETWORK_DRIVER/MESH/TESTBENCH/testbench.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/classifier.c b/openair2/NETWORK_DRIVER/MESH/classifier.c
index f47d63008c947d74a098ba58ee9e07f2983ee87e..985bab946ecffc9241661b447e735fa09ab0d32e 100644
--- a/openair2/NETWORK_DRIVER/MESH/classifier.c
+++ b/openair2/NETWORK_DRIVER/MESH/classifier.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/common.c b/openair2/NETWORK_DRIVER/MESH/common.c
index 95e4cf1fc2662f890192e8e106e7a53e7ae62a7f..d380b8a4d829cf31bf1369996d05de279cab73a5 100644
--- a/openair2/NETWORK_DRIVER/MESH/common.c
+++ b/openair2/NETWORK_DRIVER/MESH/common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,12 +28,8 @@
 * \email: navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr
 */
 
-//#include "nas_common.h"
 #include "local.h"
 #include "proto_extern.h"
-#ifdef RTAI
-#include "rtai_fifos.h"
-#endif
 
 //#define NAS_DEBUG_RECEIVE 1
 //#define NAS_DEBUG_SEND 1
diff --git a/openair2/NETWORK_DRIVER/MESH/constant.h b/openair2/NETWORK_DRIVER/MESH/constant.h
index fed132c61ea5d263ca0958dd870f70584db2932f..1c756765c6c1a0e86201332f5ef77bc8cca6333e 100644
--- a/openair2/NETWORK_DRIVER/MESH/constant.h
+++ b/openair2/NETWORK_DRIVER/MESH/constant.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/device.c b/openair2/NETWORK_DRIVER/MESH/device.c
index 393fe9f9e01fe3ffd4fe863a7b693ab5d309e4f8..f8a420697a95d043d2f5870d2c55ca8279567ed5 100644
--- a/openair2/NETWORK_DRIVER/MESH/device.c
+++ b/openair2/NETWORK_DRIVER/MESH/device.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,13 +28,6 @@
 */
 /*******************************************************************************/
 
-#ifndef PDCP_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // PDCP_USE_NETLINK
-
 #include "constant.h"
 #include "local.h"
 #include "proto_extern.h"
@@ -116,6 +109,7 @@ void *nas_interrupt(void)
   printk("INTERRUPT: end\n");
 #endif
   //  return 0;
+  return NULL;
 }
 #endif //NETLINK
 
@@ -247,7 +241,7 @@ int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
     // End debug information
     netif_stop_queue(dev);
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
+#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE>=1796
     netif_trans_update(dev);
 #else
     dev->trans_start = jiffies;
@@ -312,7 +306,7 @@ void nas_tx_timeout(struct net_device *dev)
   printk("TX_TIMEOUT: begin\n");
   //  (struct nas_priv *)(dev->priv)->stats.tx_errors++;
   (priv->stats).tx_errors++;
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
+#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE>=1796
   netif_trans_update(dev);
 #else
   dev->trans_start = jiffies;
@@ -449,23 +443,12 @@ int init_module (void)
 
 #ifndef PDCP_USE_NETLINK
 
-#ifdef RTAI //with RTAI you have to indicate which irq# you want
-
-  pdcp_2_nas_irq=rt_request_srq(0, nas_interrupt, NULL);
-
-#endif
-
   if (pdcp_2_nas_irq == -EBUSY || pdcp_2_nas_irq == -EINVAL) {
     printk("[NAS][INIT] No interrupt resource available\n");
     return -EBUSY;
   } else
     printk("[NAS][INIT]: Interrupt %d\n", pdcp_2_nas_irq);
 
-  //rt_startup_irq(RTAI_IRQ);
-
-  //rt_enable_irq(RTAI_IRQ);
-
-
 #endif //NETLINK
 
   for (inst=0; inst<NB_INSTANCES_MAX; inst++) {
@@ -529,12 +512,6 @@ void cleanup_module(void)
 
   if (pdcp_2_nas_irq!=-EBUSY) {
     pdcp_2_nas_irq=0;
-#ifdef RTAI
-    // V1
-    //    rt_free_linux_irq(priv->irq, NULL);
-    // END V1
-    rt_free_srq(pdcp_2_nas_irq);
-#endif
     // Start IRQ linux
     //    free_irq(priv->irq, NULL);
     // End IRQ linux
diff --git a/openair2/NETWORK_DRIVER/MESH/ioctl.c b/openair2/NETWORK_DRIVER/MESH/ioctl.c
index 913fcc1e755e2ac9dd658d5fc1d34c1ee1146053..56dfb1cfe8dd4f7e25edebb8d5498b71de798a29 100644
--- a/openair2/NETWORK_DRIVER/MESH/ioctl.c
+++ b/openair2/NETWORK_DRIVER/MESH/ioctl.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/ioctl.h b/openair2/NETWORK_DRIVER/MESH/ioctl.h
index 9273d1865103771989fdaf51a94e0a630efd8217..ffa9b4e79b7ed4c02a091fc117b2c2243e612796 100644
--- a/openair2/NETWORK_DRIVER/MESH/ioctl.h
+++ b/openair2/NETWORK_DRIVER/MESH/ioctl.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/local.h b/openair2/NETWORK_DRIVER/MESH/local.h
index 0e0a581cbc9590a0cda18fe29caba28a9e91e5b5..e23188d357006d2bebf16f58c5650cbea5d39266 100644
--- a/openair2/NETWORK_DRIVER/MESH/local.h
+++ b/openair2/NETWORK_DRIVER/MESH/local.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/mesh.c b/openair2/NETWORK_DRIVER/MESH/mesh.c
index e2cf3bcf0a0e31ad350de7ee56040030e5cdc560..367e34cc4fb519265ad568e60292af048d0241c5 100644
--- a/openair2/NETWORK_DRIVER/MESH/mesh.c
+++ b/openair2/NETWORK_DRIVER/MESH/mesh.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/netlink.c b/openair2/NETWORK_DRIVER/MESH/netlink.c
index 8d40a9d965bc890f04e70f6fae7c1a0ebb9c5656..9ac44453a94ab43e6dbc3c390d7a9dcfb25134bd 100644
--- a/openair2/NETWORK_DRIVER/MESH/netlink.c
+++ b/openair2/NETWORK_DRIVER/MESH/netlink.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/proto_extern.h b/openair2/NETWORK_DRIVER/MESH/proto_extern.h
index a362876f834fa8227619063bb0f54c0d93e004f9..844c5b41a4a3d9a9f99e454ef93d51977f37af05 100644
--- a/openair2/NETWORK_DRIVER/MESH/proto_extern.h
+++ b/openair2/NETWORK_DRIVER/MESH/proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/rrc_nas_primitives.h b/openair2/NETWORK_DRIVER/MESH/rrc_nas_primitives.h
index cb4c00dcb92332c5588bbdbb8ca3106aef95966f..193ce286cb970e2751eff2d45a1e4a30274ecd8f 100644
--- a/openair2/NETWORK_DRIVER/MESH/rrc_nas_primitives.h
+++ b/openair2/NETWORK_DRIVER/MESH/rrc_nas_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/sap.h b/openair2/NETWORK_DRIVER/MESH/sap.h
index eb85437999d06ec2b3b102b3799bcdfe94d0edfe..60b8fa11fb5ef8830557e28812a08341b14323c2 100644
--- a/openair2/NETWORK_DRIVER/MESH/sap.h
+++ b/openair2/NETWORK_DRIVER/MESH/sap.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/MESH/tool.c b/openair2/NETWORK_DRIVER/MESH/tool.c
index 872a2583ce9454599ef44397b4b282dafa13d92d..2e8e68a17cfb821f44c72bdae0fed1754c7099e5 100644
--- a/openair2/NETWORK_DRIVER/MESH/tool.c
+++ b/openair2/NETWORK_DRIVER/MESH/tool.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/UE_IP/Makefile b/openair2/NETWORK_DRIVER/UE_IP/Makefile
deleted file mode 100755
index fbcf85fabb3527bed1233302289f75e1c4a899d2..0000000000000000000000000000000000000000
--- a/openair2/NETWORK_DRIVER/UE_IP/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-# UE IP Driver makefile
-#
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-KERNEL_ARCH=$(shell echo `uname -m`)
-SET_X64=$(shell if [ $(KERNEL_ARCH) = 'x86_64' ]; then echo true ; fi)
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-EXTRA_CFLAGS = -I$(OPENAIR2_DIR)/COMMON -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) 
-
-
-
-ifdef OAI_NW_DRIVER_USE_NETLINK
-EXTRA_CFLAGS += -DOAI_NW_DRIVER_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += ue_ip.o
-ue_ip-objs += device.o
-ue_ip-objs += common.o
-ifdef OAI_NW_DRIVER_USE_NETLINK
-ue_ip-objs += netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-
-print:
-	@echo SET_X64             : $(SET_X64)
-
-clean:
-	rm -f *.ko
-	rm -f .*.ko.cmd
-	rm -f .*.o.cmd
-	rm -f *.o
-	rm -f *.mod.c
-	find . -name *.ko     -delete
-	find . -name .*.o     -delete
-	find . -name *.o      -delete
-	find . -name *.mod.c  -delete
diff --git a/openair2/NETWORK_DRIVER/UE_IP/common.c b/openair2/NETWORK_DRIVER/UE_IP/common.c
index 8c3e4557d36d109efcf7198a41a033a906897108..99712cc5d2fc7e749109280c01a59e808b1e28e1 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/common.c
+++ b/openair2/NETWORK_DRIVER/UE_IP/common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/UE_IP/constant.h b/openair2/NETWORK_DRIVER/UE_IP/constant.h
index 42fd0b6303c0bcaca9665e0eae52c135a31d6a0b..faff970dcdb3cb32e8ade1d2a3e8ee0cae1e3600 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/constant.h
+++ b/openair2/NETWORK_DRIVER/UE_IP/constant.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c
index a4f714d4c5537218896398f5fd6d92dbee44a12e..36c6afe914bb3f16f8ab5367733d879d7b65f4c3 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/device.c
+++ b/openair2/NETWORK_DRIVER/UE_IP/device.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,13 +28,6 @@
 */
 /*******************************************************************************/
 
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // OAI_NW_DRIVER_USE_NETLINK
-
 #include "constant.h"
 #include "local.h"
 #include "proto_extern.h"
@@ -243,7 +236,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
 
     // End debug information
     netif_stop_queue(dev_pP);
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
+#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796
     netif_trans_update(dev_pP);
 #else
     dev_pP->trans_start = jiffies;
@@ -319,7 +312,7 @@ void ue_ip_tx_timeout(struct net_device *dev_pP)
   printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__);
   //  (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
   (priv_p->stats).tx_errors++;
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
+#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796
   netif_trans_update(dev_pP);
 #else
   dev_pP->trans_start = jiffies;
diff --git a/openair2/NETWORK_DRIVER/UE_IP/local.h b/openair2/NETWORK_DRIVER/UE_IP/local.h
index 3c9c4c4295d6bad486f63fdf1c554900bd4286b0..ac3b0409954daab75466448b14a1727c94d76ada 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/local.h
+++ b/openair2/NETWORK_DRIVER/UE_IP/local.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/UE_IP/netlink.c b/openair2/NETWORK_DRIVER/UE_IP/netlink.c
index 8ecd989f4d4ed1ea44ac2c1a5b333159c96b70e7..e8e36619d1b6942dcc0c1bbc73e353078baddcb5 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/netlink.c
+++ b/openair2/NETWORK_DRIVER/UE_IP/netlink.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/UE_IP/proto_extern.h b/openair2/NETWORK_DRIVER/UE_IP/proto_extern.h
index 459fbc0837331fd2d6477b3dc472ed91b0cc8467..b335b019c120e1ee9a6261bb54cb0d04f3de7a45 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/proto_extern.h
+++ b/openair2/NETWORK_DRIVER/UE_IP/proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/NETWORK_DRIVER/UE_IP/sap.h b/openair2/NETWORK_DRIVER/UE_IP/sap.h
index cfe4bf81b85f55330058771a8b58cbce9703d06b..ad70386ed7da95c8ceaa41169dc2fcff36cca5a4 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/sap.h
+++ b/openair2/NETWORK_DRIVER/UE_IP/sap.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c
index 0fa5453fe3ff56753b8802a4103b927a1e1d8fe5..d0b8e5755858bbaf3ac64711016a8debce09b04c 100644
--- a/openair2/PHY_INTERFACE/IF_Module.c
+++ b/openair2/PHY_INTERFACE/IF_Module.c
@@ -10,21 +10,29 @@
 IF_Module_t *if_inst[MAX_IF_MODULES];
 Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs];
 
+extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind);
+extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
+extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind);
+extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
+extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
+extern uint8_t nfapi_mode;
+extern uint16_t sf_ahead;
+
 void handle_rach(UL_IND_t *UL_info) {
   int i;
 
-  if (UL_info->rach_ind.number_of_preambles>0) {
+  if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) {
 
-    AssertFatal(UL_info->rach_ind.number_of_preambles==1,"More than 1 preamble not supported\n");
-    UL_info->rach_ind.number_of_preambles=0;
-    LOG_D(MAC,"Frame %d, Subframe %d Calling initiate_ra_proc\n",UL_info->frame,UL_info->subframe);
+    AssertFatal(UL_info->rach_ind.rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n");
+    UL_info->rach_ind.rach_indication_body.number_of_preambles=0;
+    LOG_D(MAC,"UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:SFN/SF:%d\n",UL_info->frame,UL_info->subframe, NFAPI_SFNSF2DEC(UL_info->rach_ind.sfn_sf));
     initiate_ra_proc(UL_info->module_id,
 		     UL_info->CC_id,
-		     UL_info->frame,
-		     UL_info->subframe,
-		     UL_info->rach_ind.preamble_list[0].preamble_rel8.preamble,
-		     UL_info->rach_ind.preamble_list[0].preamble_rel8.timing_advance,
-		     UL_info->rach_ind.preamble_list[0].preamble_rel8.rnti
+		     NFAPI_SFNSF2SFN(UL_info->rach_ind.sfn_sf),
+		     NFAPI_SFNSF2SF(UL_info->rach_ind.sfn_sf),
+		     UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble,
+		     UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
+		     UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti
 #ifdef Rel14
 		     ,0
 #endif
@@ -32,24 +40,24 @@ void handle_rach(UL_IND_t *UL_info) {
   }
 
 #ifdef Rel14
-  if (UL_info->rach_ind_br.number_of_preambles>0) {
+  if (UL_info->rach_ind_br.rach_indication_body.number_of_preambles>0) {
 
-    AssertFatal(UL_info->rach_ind_br.number_of_preambles<5,"More than 4 preambles not supported\n");
-    for (i=0;i<UL_info->rach_ind_br.number_of_preambles;i++) {
-      AssertFatal(UL_info->rach_ind_br.preamble_list[i].preamble_rel13.rach_resource_type>0,
+    AssertFatal(UL_info->rach_ind_br.rach_indication_body.number_of_preambles<5,"More than 4 preambles not supported\n");
+    for (i=0;i<UL_info->rach_ind_br.rach_indication_body.number_of_preambles;i++) {
+      AssertFatal(UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type>0,
 		  "Got regular PRACH preamble, not BL/CE\n");
       LOG_D(MAC,"Frame %d, Subframe %d Calling initiate_ra_proc (CE_level %d)\n",UL_info->frame,UL_info->subframe,
-	    UL_info->rach_ind_br.preamble_list[i].preamble_rel13.rach_resource_type-1);
+	    UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type-1);
       initiate_ra_proc(UL_info->module_id,
 		       UL_info->CC_id,
 		       UL_info->frame,
 		       UL_info->subframe,
-		       UL_info->rach_ind_br.preamble_list[i].preamble_rel8.preamble,
-		       UL_info->rach_ind_br.preamble_list[i].preamble_rel8.timing_advance,
-		       UL_info->rach_ind_br.preamble_list[i].preamble_rel8.rnti,
-		       UL_info->rach_ind_br.preamble_list[i].preamble_rel13.rach_resource_type);
+		       UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.preamble,
+		       UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.timing_advance,
+		       UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.rnti,
+		       UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type);
     }
-    UL_info->rach_ind.number_of_preambles=0;
+    UL_info->rach_ind_br.rach_indication_body.number_of_preambles=0;
   }
 #endif
 }
@@ -58,91 +66,164 @@ void handle_sr(UL_IND_t *UL_info) {
 
   int i;
 
-  for (i=0;i<UL_info->sr_ind.number_of_srs;i++) 
-    SR_indication(UL_info->module_id,
-		  UL_info->CC_id,
-		  UL_info->frame,
-		  UL_info->subframe,
-		  UL_info->sr_ind.sr_pdu_list[i].rx_ue_information.rnti,
-		  UL_info->sr_ind.sr_pdu_list[i].ul_cqi_information.ul_cqi);
+  if (nfapi_mode == 1)  // PNF
+  {
+    if (UL_info->sr_ind.sr_indication_body.number_of_srs>0)
+    {
+      oai_nfapi_sr_indication(&UL_info->sr_ind);
+    }
+  }
+  else
+  {
+    for (i=0;i<UL_info->sr_ind.sr_indication_body.number_of_srs;i++)
+      SR_indication(UL_info->module_id,
+          UL_info->CC_id,
+          UL_info->frame,
+          UL_info->subframe,
+          UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].rx_ue_information.rnti,
+          UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].ul_cqi_information.ul_cqi);
+  }
 
-  UL_info->sr_ind.number_of_srs=0;
+  UL_info->sr_ind.sr_indication_body.number_of_srs=0;
 }
 
 void handle_cqi(UL_IND_t *UL_info) {
 
   int i;
 
-  for (i=0;i<UL_info->cqi_ind.number_of_cqis;i++) 
-    cqi_indication(UL_info->module_id,
-		   UL_info->CC_id,
-		   UL_info->frame,
-		   UL_info->subframe,
-		   UL_info->cqi_ind.cqi_pdu_list[i].rx_ue_information.rnti,
-		   &UL_info->cqi_ind.cqi_pdu_list[i].cqi_indication_rel9,
-		   UL_info->cqi_ind.cqi_raw_pdu_list[i].pdu,
-		   &UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information);
-
-  UL_info->cqi_ind.number_of_cqis=0;
+  if (nfapi_mode == 1)
+  {
+    if (UL_info->cqi_ind.number_of_cqis>0)
+    {
+      LOG_D(PHY,"UL_info->cqi_ind.number_of_cqis:%d\n", UL_info->cqi_ind.number_of_cqis);
+      nfapi_cqi_indication_t ind;
+
+      ind.header.message_id = NFAPI_RX_CQI_INDICATION;
+      ind.sfn_sf = UL_info->frame<<4 | UL_info->subframe;
+      ind.cqi_indication_body = UL_info->cqi_ind;
+
+      oai_nfapi_cqi_indication(&ind);
+
+      UL_info->cqi_ind.number_of_cqis=0;
+    }
+  }
+  else
+  {
+    for (i=0;i<UL_info->cqi_ind.number_of_cqis;i++) 
+      cqi_indication(UL_info->module_id,
+          UL_info->CC_id,
+          UL_info->frame,
+          UL_info->subframe,
+          UL_info->cqi_ind.cqi_pdu_list[i].rx_ue_information.rnti,
+          &UL_info->cqi_ind.cqi_pdu_list[i].cqi_indication_rel9,
+          UL_info->cqi_ind.cqi_raw_pdu_list[i].pdu,
+          &UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information);
+
+    UL_info->cqi_ind.number_of_cqis=0;
+  }
 }
 
 void handle_harq(UL_IND_t *UL_info) {
 
   int i;
 
-  for (i=0;i<UL_info->harq_ind.number_of_harqs;i++) 
-    harq_indication(UL_info->module_id,
-		    UL_info->CC_id,
-		    UL_info->frame,
-		    UL_info->subframe,
-		    &UL_info->harq_ind.harq_pdu_list[i]);
+  if (nfapi_mode == 1 && UL_info->harq_ind.harq_indication_body.number_of_harqs>0) // PNF
+  {
+    //LOG_D(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Send to VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs);
+
+    int retval = oai_nfapi_harq_indication(&UL_info->harq_ind);
+
+    if (retval!=0)
+    {
+      LOG_E(PHY, "Failed to encode NFAPI HARQ_IND retval:%d\n", retval);
+    }
 
-  UL_info->harq_ind.number_of_harqs=0;
+    UL_info->harq_ind.harq_indication_body.number_of_harqs = 0;
+  }
+  else
+  {
+    for (i=0;i<UL_info->harq_ind.harq_indication_body.number_of_harqs;i++)
+      harq_indication(UL_info->module_id,
+          UL_info->CC_id,
+          NFAPI_SFNSF2SFN(UL_info->harq_ind.sfn_sf),
+          NFAPI_SFNSF2SF(UL_info->harq_ind.sfn_sf),
+          &UL_info->harq_ind.harq_indication_body.harq_pdu_list[i]);
+
+    UL_info->harq_ind.harq_indication_body.number_of_harqs=0;
+  }
 }
 
 void handle_ulsch(UL_IND_t *UL_info) {
 
   int i,j;
 
-  for (i=0;i<UL_info->rx_ind.number_of_pdus;i++) {
-
-    for (j=0;j<UL_info->crc_ind.number_of_crcs;j++) {
-      // find crc_indication j corresponding rx_indication i
-      if (UL_info->crc_ind.crc_pdu_list[j].rx_ue_information.rnti ==
-	  UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti) {
-	if (UL_info->crc_ind.crc_pdu_list[j].crc_indication_rel8.crc_flag == 1) { // CRC error indication
-	  LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->subframe);
-	  rx_sdu(UL_info->module_id,
-		 UL_info->CC_id,
-		 UL_info->frame,
-		 UL_info->subframe,
-		 UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti,
-		 (uint8_t *)NULL,
-		 UL_info->rx_ind.rx_pdu_list[i].rx_indication_rel8.length,
-		 UL_info->rx_ind.rx_pdu_list[i].rx_indication_rel8.timing_advance,
-		 UL_info->rx_ind.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
-	}
-	else {
-	  LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->subframe);
-	  rx_sdu(UL_info->module_id,
-		 UL_info->CC_id,
-		 UL_info->frame,
-		 UL_info->subframe,
-		 UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti,
-		 UL_info->rx_ind.rx_pdu_list[i].data,
-		 UL_info->rx_ind.rx_pdu_list[i].rx_indication_rel8.length,
-		 UL_info->rx_ind.rx_pdu_list[i].rx_indication_rel8.timing_advance,
-		 UL_info->rx_ind.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
-	}
-	break;
-      } //if (UL_info->crc_ind.crc_pdu_list[j].rx_ue_information.rnti ==
-	//    UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti) {
-    } //    for (j=0;j<UL_info->crc_ind.number_of_crcs;j++) {
-    AssertFatal(j<UL_info->crc_ind.number_of_crcs,"Couldn't find matchin CRC indication\n");
-  } //   for (i=0;i<UL_info->rx_ind.number_of_pdus;i++) {
-    
-  UL_info->rx_ind.number_of_pdus=0;
-  UL_info->crc_ind.number_of_crcs=0;
+  if(nfapi_mode == 1)
+  {
+    if (UL_info->crc_ind.crc_indication_body.number_of_crcs>0)
+    {
+      //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
+
+      oai_nfapi_crc_indication(&UL_info->crc_ind);
+
+      UL_info->crc_ind.crc_indication_body.number_of_crcs = 0;
+    }
+
+    if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0)
+    {
+      //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
+      oai_nfapi_rx_ind(&UL_info->rx_ind);
+      UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
+    }
+  }
+  else
+  {
+    if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) {
+      for (i=0;i<UL_info->rx_ind.rx_indication_body.number_of_pdus;i++) {
+        for (j=0;j<UL_info->crc_ind.crc_indication_body.number_of_crcs;j++) {
+          // find crc_indication j corresponding rx_indication i
+          LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti, i, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti);
+          if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti ==
+              UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti) {
+            LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag);
+            if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag == 1) { // CRC error indication
+              LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->subframe);
+              rx_sdu(UL_info->module_id,
+                  UL_info->CC_id,
+                  NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
+                  NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->subframe,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
+                  (uint8_t *)NULL,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
+            }
+            else {
+              LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->subframe);
+              rx_sdu(UL_info->module_id,
+                  UL_info->CC_id,
+                  NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
+                  NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->subframe,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].data,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
+                  UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
+            }
+            break;
+          } //if (UL_info->crc_ind.crc_pdu_list[j].rx_ue_information.rnti ==
+          //    UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti)
+        } //    for (j=0;j<UL_info->crc_ind.crc_indication_body.number_of_crcs;j++)
+      } //   for (i=0;i<UL_info->rx_ind.number_of_pdus;i++)
+      UL_info->crc_ind.crc_indication_body.number_of_crcs=0;
+      UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
+    } // UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->subframe && UL_info->crc_ind.crc_indication_body.number_of_crcs>0
+    else if (UL_info->rx_ind.rx_indication_body.number_of_pdus!=0 || UL_info->crc_ind.crc_indication_body.number_of_crcs!=0) {
+      LOG_E(PHY,"hoping not to have mis-match between CRC ind and RX ind - hopefully the missing message is coming shortly rx_ind:%d(SFN/SF:%05d) crc_ind:%d(SFN/SF:%05d) UL_info(SFN/SF):%04d%d\n",
+          UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf),
+          UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf),
+          UL_info->frame, UL_info->subframe);
+    }
+  }
 }
 
 /****************************************************************************/
@@ -156,6 +237,9 @@ void handle_ulsch(UL_IND_t *UL_info) {
 #define C do { size = 0; put(0); } while (0)
 #define A(...) do { char t[4096]; sprintf(t, __VA_ARGS__); append_string(t); } while (0)
 
+#if 0
+
+/* eats lots of ms at startup, disrupts realtime */
 static char *s;
 static int size;
 static int maxsize;
@@ -169,6 +253,22 @@ static void put(char x)
   s[size++] = x;
 }
 
+#else
+
+/* eats nothing at startup, but fixed size */
+#define SMAX 65536
+static char s[SMAX];
+static int size;
+static int maxsize = SMAX;
+
+static void put(char x)
+{
+  if (size == maxsize) { printf("incrase SMAX\n"); exit(1); }
+  s[size++] = x;
+}
+
+#endif
+
 static void append_string(char *t)
 {
   size--;
@@ -184,24 +284,24 @@ static void dump_ul(UL_IND_t *u)
   A("XXXX UL  mod %d CC %d f.sf %d.%d\n",
     u->module_id, u->CC_id, u->frame, u->subframe);
 
-  A("XXXX     harq_ind %d\n", u->harq_ind.number_of_harqs);
-      for (i = 0; i < u->harq_ind.number_of_harqs; i++) {
-        nfapi_harq_indication_pdu_t *v = &u->harq_ind.harq_pdu_list[i];
+  A("XXXX     harq_ind %d\n", u->harq_ind.harq_indication_body.number_of_harqs);
+      for (i = 0; i < u->harq_ind.harq_indication_body.number_of_harqs; i++) {
+        nfapi_harq_indication_pdu_t *v = &u->harq_ind.harq_indication_body.harq_pdu_list[i];
   A("XXXX         harq ind %d\n", i);
-  A("XXXX             rnti %d\n", v->rx_ue_information.rnti);
-  A("XXXX             tb1 %d tb2 %d\n", v->harq_indication_fdd_rel8.harq_tb1,
-                                        v->harq_indication_fdd_rel8.harq_tb2);
-  A("XXXX             number_of_ack_nack %d\n",
-                              v->harq_indication_fdd_rel9.number_of_ack_nack);
+  A("XXXX         rnti %d\n", v->rx_ue_information.rnti);
+  A("XXXX         tb1 %d tb2 %d\n", v->harq_indication_fdd_rel8.harq_tb1,
+                                    v->harq_indication_fdd_rel8.harq_tb2);
+  A("XXXX         number_of_ack_nack %d\n",
+                          v->harq_indication_fdd_rel9.number_of_ack_nack);
   A("XXXX             harq[0] = %d\n",
                                     v->harq_indication_fdd_rel9.harq_tb_n[0]);
   A("XXXX harq        ul_cqi %d channel %d\n", v->ul_cqi_information.ul_cqi,
-                                               v->ul_cqi_information.channel);
+                                           v->ul_cqi_information.channel);
       }
 
-  A("XXXX     crc_ind  %d\n", u->crc_ind.number_of_crcs);
+  A("XXXX     crc_ind  %d\n", u->crc_ind.crc_indication_body.number_of_crcs);
 
-  A("XXXX     sr_ind   %d\n", u->sr_ind.number_of_srs);
+  A("XXXX     sr_ind   %d\n", u->sr_ind.sr_indication_body.number_of_srs);
 
   A("XXXX     cqi_ind  %d\n", u->cqi_ind.number_of_cqis);
       for (i = 0; i < u->cqi_ind.number_of_cqis; i++) {
@@ -211,11 +311,11 @@ static void dump_ul(UL_IND_t *u)
                                                v->ul_cqi_information.channel);
       }
 
-  A("XXXX     rach_ind %d\n", u->rach_ind.number_of_preambles);
+  A("XXXX     rach_ind %d\n", u->rach_ind.rach_indication_body.number_of_preambles);
 
-  A("XXXX     rx_ind   %d\n", u->rx_ind.number_of_pdus);
-      for (i = 0; i < u->rx_ind.number_of_pdus; i++) {
-        nfapi_rx_indication_pdu_t *v = &u->rx_ind.rx_pdu_list[i];
+  A("XXXX     rx_ind   %d\n", u->rx_ind.rx_indication_body.number_of_pdus);
+      for (i = 0; i < u->rx_ind.rx_indication_body.number_of_pdus; i++) {
+        nfapi_rx_indication_pdu_t *v = &u->rx_ind.rx_indication_body.rx_pdu_list[i];
   A("XXXX         rx ind %d\n", i);
   A("XXXX             timing_advance %d\n",
                                     v->rx_indication_rel8.timing_advance);
@@ -366,6 +466,14 @@ static void dump_dl(Sched_Rsp_t *d)
   A("XXXX up          tpc_bitmap           %d\n", q->tpc_bitmap);
   A("XXXX up          transmission_power   %d\n", q->transmission_power);
           }
+          if (p->pdu_type == NFAPI_HI_DCI0_HI_PDU_TYPE) {
+            nfapi_hi_dci0_hi_pdu_rel8_t *q = &p->hi_pdu.hi_pdu_rel8;
+  A("XXXX up          rb start    %d\n", q->resource_block_start);
+  A("XXXX up          cs2_drms    %d\n", q->cyclic_shift_2_for_drms);
+  A("XXXX up          ack         %d\n", q->hi_value);
+  A("XXXX up          i_phich     %d\n", q->i_phich);
+  A("XXXX up          power       %d\n", q->transmission_power);
+          }
         }
       }
 
@@ -434,26 +542,29 @@ void UL_indication(UL_IND_t *UL_info)
   IF_Module_t  *ifi        = if_inst[module_id];
   eNB_MAC_INST *mac        = RC.mac[module_id];
 
-  LOG_D(PHY,"UL_Indication: frame %d, subframe %d, module_id %d, CC_id %d\n",
-	UL_info->frame,UL_info->subframe,
-	module_id,CC_id);
+  LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n",
+        UL_info->frame,UL_info->subframe,
+        module_id,CC_id,
+        UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs);
 
-  if (ifi->CC_mask==0) {
-    ifi->current_frame    = UL_info->frame;
-    ifi->current_subframe = UL_info->subframe;
-  }
-  else {
-    AssertFatal(UL_info->frame != ifi->current_frame,"CC_mask %x is not full and frame has changed\n",ifi->CC_mask);
-    AssertFatal(UL_info->subframe != ifi->current_subframe,"CC_mask %x is not full and subframe has changed\n",ifi->CC_mask);
+  if (nfapi_mode != 1)
+  {
+    if (ifi->CC_mask==0) {
+      ifi->current_frame    = UL_info->frame;
+      ifi->current_subframe = UL_info->subframe;
+    }
+    else {
+      AssertFatal(UL_info->frame != ifi->current_frame,"CC_mask %x is not full and frame has changed\n",ifi->CC_mask);
+      AssertFatal(UL_info->subframe != ifi->current_subframe,"CC_mask %x is not full and subframe has changed\n",ifi->CC_mask);
+    }
+    ifi->CC_mask |= (1<<CC_id);
   }
-  ifi->CC_mask |= (1<<CC_id);
- 
+
 
   // clear DL/UL info for new scheduling round
   clear_nfapi_information(RC.mac[module_id],CC_id,
 			  UL_info->frame,UL_info->subframe);
 
-
   handle_rach(UL_info);
 
   handle_sr(UL_info);
@@ -462,61 +573,68 @@ void UL_indication(UL_IND_t *UL_info)
 
   handle_harq(UL_info);
 
-  // clear HI prior to hanling ULSCH
+  // clear HI prior to handling ULSCH
   mac->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi                     = 0;
   
   handle_ulsch(UL_info);
 
-  if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
+  if (nfapi_mode != 1)
+  {
+    if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
 
-    eNB_dlsch_ulsch_scheduler(module_id,
-			      (UL_info->frame+((UL_info->subframe>5)?1:0)) % 1024,
-			      (UL_info->subframe+4)%10);
+      eNB_dlsch_ulsch_scheduler(module_id,
+          (UL_info->frame+((UL_info->subframe>(9-sf_ahead))?1:0)) % 1024,
+          (UL_info->subframe+sf_ahead)%10);
 
-    ifi->CC_mask            = 0;
+      ifi->CC_mask            = 0;
 
-    sched_info->module_id   = module_id;
-    sched_info->CC_id       = CC_id;
-    sched_info->frame       = (UL_info->frame + ((UL_info->subframe>5) ? 1 : 0)) % 1024;
-    sched_info->subframe    = (UL_info->subframe+4)%10;
-    sched_info->DL_req      = &mac->DL_req[CC_id];
-    sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id];
-    if ((mac->common_channels[CC_id].tdd_Config==NULL) ||
-	(is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+4)%10)>0)) 
-      sched_info->UL_req      = &mac->UL_req[CC_id];
-    else
-      sched_info->UL_req      = NULL;
+      sched_info->module_id   = module_id;
+      sched_info->CC_id       = CC_id;
+      sched_info->frame       = (UL_info->frame + ((UL_info->subframe>(9-sf_ahead)) ? 1 : 0)) % 1024;
+      sched_info->subframe    = (UL_info->subframe+sf_ahead)%10;
+      sched_info->DL_req      = &mac->DL_req[CC_id];
+      sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id];
+      if ((mac->common_channels[CC_id].tdd_Config==NULL) ||
+          (is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+sf_ahead)%10)>0))
+        sched_info->UL_req      = &mac->UL_req[CC_id];
+      else
+        sched_info->UL_req      = NULL;
 
-    sched_info->TX_req      = &mac->TX_req[CC_id];
+      sched_info->TX_req      = &mac->TX_req[CC_id];
 
 #ifdef DUMP_FAPI
-    dump_dl(sched_info);
+      dump_dl(sched_info);
 #endif
 
-    AssertFatal(ifi->schedule_response!=NULL,
-		"UL_indication is null (mod %d, cc %d)\n",
-		module_id,
-		CC_id);
-    ifi->schedule_response(sched_info);
+      if (ifi->schedule_response)
+      {
+        AssertFatal(ifi->schedule_response!=NULL,
+            "schedule_response is null (mod %d, cc %d)\n",
+            module_id,
+            CC_id);
+        ifi->schedule_response(sched_info);
+      }
 
-    LOG_D(PHY,"Schedule_response: frame %d, subframe %d (dl_pdus %d / %p)\n",sched_info->frame,sched_info->subframe,sched_info->DL_req->dl_config_request_body.number_pdu,
-	  &sched_info->DL_req->dl_config_request_body.number_pdu);
-  }						 
+      LOG_D(PHY,"Schedule_response: SFN_SF:%d%d dl_pdus:%d\n",sched_info->frame,sched_info->subframe,sched_info->DL_req->dl_config_request_body.number_pdu);
+    }
+  }
 }
 
 IF_Module_t *IF_Module_init(int Mod_id){
 
   AssertFatal(Mod_id<MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES);
 
+  LOG_D(PHY,"Installing callbacks for IF_Module - UL_indication\n");
+
   if (if_inst[Mod_id]==NULL) {
     if_inst[Mod_id] = (IF_Module_t*)malloc(sizeof(IF_Module_t));
     memset((void*)if_inst[Mod_id],0,sizeof(IF_Module_t));
-    
+
     if_inst[Mod_id]->CC_mask=0;
     if_inst[Mod_id]->UL_indication = UL_indication;
 
     AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0,
-		"allocation of if_inst[%d]->if_mutex fails\n",Mod_id);
+        "allocation of if_inst[%d]->if_mutex fails\n",Mod_id);
   }
   return if_inst[Mod_id];
 }
diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h
index e33a8291e2eab88969a790df5d3d2ffc09269643..3b1c88dda03b5857f99c40a3a724b1a072a469e5 100644
--- a/openair2/PHY_INTERFACE/IF_Module.h
+++ b/openair2/PHY_INTERFACE/IF_Module.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -61,30 +61,30 @@ typedef struct{
   sub_frame_t subframe;
 
   /// harq indication list
-  nfapi_harq_indication_body_t harq_ind;
+  nfapi_harq_indication_t harq_ind;
 
   /// crc indication list
-  nfapi_crc_indication_body_t crc_ind;
+  nfapi_crc_indication_t crc_ind;
 
   /// SR indication list
-  nfapi_sr_indication_body_t sr_ind;
+  nfapi_sr_indication_t sr_ind;
 
   /// CQI indication list
   nfapi_cqi_indication_body_t cqi_ind;
 
   /// RACH indication list
-  nfapi_rach_indication_body_t rach_ind;
+  nfapi_rach_indication_t rach_ind;
 
 #ifdef Rel14
   /// RACH indication list for BR UEs
-  nfapi_rach_indication_body_t rach_ind_br;
+  nfapi_rach_indication_t rach_ind_br;
 #endif
 
   /// SRS indication list
   nfapi_srs_indication_body_t srs_ind;
 
   /// RX indication
-  nfapi_rx_indication_body_t rx_ind;
+  nfapi_rx_indication_t rx_ind;
 
 } UL_IND_t;
 
diff --git a/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h b/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..479bd47d947d0c2fd79c96b84c72badf21557712
--- /dev/null
+++ b/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h
@@ -0,0 +1,215 @@
+
+/*This is the interface module between PHY
+*Provided the FAPI style interface structures for P7.
+*Provide the semi-FAPI style interface for P5 (configuration)
+*
+*/
+
+#ifndef __IF_MODULE_NB_IoT__H__
+#define __IF_MODULE_NB_IoT__H__
+
+#include "nfapi_interface.h"
+//#include "openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h"
+#include "PhysicalConfigDedicated-NB-r13.h"
+//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
+#include "openair2/COMMON/platform_types.h"
+//#include "openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h"
+
+//#define SCH_PAYLOAD_SIZE_MAX 4096
+#define BCCH_PAYLOAD_SIZE_MAX_NB_IoT 128
+
+
+
+// P5 FAPI-like configuration structures-------------------------------------------------------------------------------
+
+/*MP: MISSED COMMON CONFIG. of SIB2-NB in FAPI SPECS
+ * some of them may not needed because are used only at UE side
+ * some of them are not needed because not necessary at PHY level
+ * other have to be clarified since seems to be needed at PHY layer
+ * there is no UE_Config. request message carrying NB-IoT parameters???
+ *
+ * */
+typedef struct{
+	//nprach_config
+	uint16_t nprach_config_0_subcarrier_MSG3_range_start;
+	uint16_t nprach_config_1_subcarrier_MSG3_range_start;
+	uint16_t nprach_config_2_subcarrier_MSG3_range_start;
+	uint16_t nprach_config_0_max_num_preamble_attempt_CE;
+	uint16_t nprach_config_1_max_num_preamble_attempt_CE;
+	uint16_t nprach_config_2_max_num_preamble_attempt_CE;
+	uint16_t nprach_config_0_npdcch_num_repetitions_RA; //Rmax (see TS 36.213 ch 16.6) -->only this is managed at PHY layer
+	uint16_t nprach_config_1_npdcch_num_repetitions_RA;
+	uint16_t nprach_config_2_npdcch_num_repetitions_RA;
+	uint16_t nprach_config_0_npdcch_startSF_CSS_RA; //G (see TS 36.213 ch 16.6)
+	uint16_t nprach_config_1_npdcch_startSF_CSS_RA;
+	uint16_t nprach_config_2_npdcch_startSF_CSS_RA;
+	uint16_t nprach_config_0_npdcch_offset_RA; //Alfa_offset (see TS 36.213 ch 16.6)
+	uint16_t nprach_config_1_npdcch_offset_RA;
+	uint16_t nprach_config_2_npdcch_offset_RA;
+
+	//configured through the phy_config_dedicated
+	//Higher layer parameter for NPDCCH UE-spec search space
+	uint16_t npdcch_NumRepetitions;//Rmax (see TS 36.213 ch 16.6)  -->only this is managed at PHY layer
+	uint16_t npdcch_StartSF_USS; //G (see TS 36.213 ch 16.6)
+	uint16_t npdcch_Offset_USS; //Alfa_offset (see TS 36.213 ch 16.6)
+
+
+	ACK_NACK_NumRepetitions_NB_r13_t *ack_nack_numRepetitions_MSG4; //pointer to the first cell of a list of ack_nack_num_repetitions
+
+    //ulPowerControlCommon (UE side)
+    uint16_t p0_nominal_npusch;
+	uint16_t alpha;
+	uint16_t delta_preamle_MSG3;
+
+
+	/*Dedicated configuration -->not supported by FAPI (may not needed)
+	 * In OAI at least are needed when we manage the phy_procedures_eNB_TX in which we call the phy_config_dedicated_eNB_step2
+	 * that use the physicalConfigDedicated info previously stored in the PHY_VARS_eNB_NB_IoT structure through the phy_config_dedicated procedure
+	 */
+	//PhysicalConfigDedicated_NB_r13_t *phy_config_dedicated;
+
+
+
+
+}extra_phyConfig_t;
+
+typedef struct{
+
+	/*OAI config. parameters*/
+	module_id_t mod_id;
+	int CC_id;
+	uint16_t rnti;
+	int get_MIB; //should be different from 0 only when the mib!= null (NB_rrc_mac_config_req_eNB_IoT)
+	int get_COMMON;
+	int get_DEDICATED;
+
+	//ID of the Resource Block dedicated to NB-IoT
+	//For Nb-IoT only a restricted values of PRB indexes are allowed (see Rhode&Shwartz pag9)
+	//unsigned short NB_IoT_RB_ID; (should coincide with PRB index)
+
+
+
+
+	/*FAPI useful config. parameters used in the code
+	 *
+	 * -nfapi_uplink_reference_signal_config_t uplink_reference_signal_config
+	 * -nfapi_subframe_config_t subframe_config;
+	 * -nfapi_rf_config_t rf_config;
+	 * -nfapi_sch_config_t sch_config;
+	 * -nfapi_nb_iot_config_t config_NB_IoT;
+	 * -nfapi_l23_config_t l23_config;
+	 * -nfapi_config --> EARFCN (for the transport of the dl_CarrierFreq
+	 * */
+
+	//XXX where allocate memory??
+	nfapi_config_request_t* cfg;
+
+	/*MP: MISSED COMMON CONFIG. of SIB2-NB in FAPI SPECS (may non needed)*/
+	extra_phyConfig_t extra_phy_parms;
+
+}PHY_Config_NB_IoT_t;
+
+
+
+// uplink subframe P7---------------------------------------------------------------------------------
+
+
+/*UL_IND_t:
+* A structure handles all the uplink information.
+* Corresponding to the NRACH.indicaiton, UL_Config_indication, RX_ULSCH.indication, CRC.inidcation, NB_HARQ.indication in FAPI
+*/
+typedef struct{
+
+ 	/*Start at the common part*/
+
+ 	int test;
+
+ 	//Module ID
+ 	module_id_t module_id;
+ 	//CC ID
+ 	int CC_id;
+ 	//frame 
+ 	frame_t frame;
+ 	//subframe
+ 	sub_frame_t subframe;
+ 	//Hyper frame for NB-IoT implementation
+ 	uint32_t hypersfn;
+
+ 	/*preamble part*/
+
+ 	nfapi_nrach_indication_body_t NRACH;
+
+ 	/*Uplink data part*/
+
+ 	/*indication of the harq feedback*/
+ 	nfapi_nb_harq_indication_t nb_harq_ind;
+ 	/*indication of the uplink data PDU*/
+  	nfapi_rx_indication_body_t RX_NPUSCH;
+ 	/*crc_indication*/
+ 	nfapi_crc_indication_body_t crc_ind;
+
+ }UL_IND_NB_IoT_t;
+
+ // Downlink subframe P7
+
+
+typedef struct{
+
+ 	/*Start at the common part*/
+
+ 	//Module ID
+	module_id_t module_id; 
+ 	//CC ID
+ 	int CC_id;
+ 	// hyper subframe
+ 	uint32_t hypersfn;
+ 	//frame
+ 	frame_t frame;
+ 	//subframe
+ 	sub_frame_t subframe;
+
+  	/// nFAPI DL Config Request
+  	nfapi_dl_config_request_t *DL_req;
+  	/// nFAPI UL Config Request
+  	nfapi_ul_config_request_t *UL_req;
+  	/// nFAPI HI_DCI Request
+  	nfapi_hi_dci0_request_t *HI_DCI0_req;
+  	/// nFAPI TX Request
+  	nfapi_tx_request_t        *TX_req; 
+  	/// Pointers to DL SDUs
+  	//uint8_t **sdu;
+
+}Sched_Rsp_NB_IoT_t;
+
+
+/*IF_Module_t a group for gathering the Interface
+It should be allocated at the main () in lte-softmodem.c*/
+typedef struct IF_Module_NB_IoT_s{
+	//define the function pointer
+	void (*UL_indication)(UL_IND_NB_IoT_t *UL_INFO);
+	void (*schedule_response)(Sched_Rsp_NB_IoT_t *Sched_INFO);
+	void (*PHY_config_req)(PHY_Config_NB_IoT_t* config_INFO);
+}IF_Module_NB_IoT_t;
+
+/*Initial */
+
+/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
+void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO);
+
+/*Interface for PHY Configuration
+ * Trigger the phy_config_xxx functions using parameters from the shared PHY_Config structure
+ * */
+void PHY_config_req_NB_IoT(PHY_Config_NB_IoT_t* config_INFO);
+
+//int IF_Module_init(IF_Module_t *if_inst);
+
+/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
+//void Schedule_Response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO);
+
+/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
+*/
+void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO);
+
+IF_Module_NB_IoT_t *IF_Module_init_NB_IoT(int Mod_id);
+
+#endif
diff --git a/openair2/PHY_INTERFACE/defs.h b/openair2/PHY_INTERFACE/defs.h
index 1fdd69497aa66e045d426ec5b3ec211124b27422..deb07443f18fcddf3a1555821fece15ca0acd7c4 100644
--- a/openair2/PHY_INTERFACE/defs.h
+++ b/openair2/PHY_INTERFACE/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/PHY_INTERFACE/extern.h b/openair2/PHY_INTERFACE/extern.h
index 403847f3f4c8e31b9414268776c7387a7ff6b90d..b87fa42fe41ae930bce6b0d03abfea34bb20c0b8 100644
--- a/openair2/PHY_INTERFACE/extern.h
+++ b/openair2/PHY_INTERFACE/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/PHY_INTERFACE/mac_phy_primitives.c b/openair2/PHY_INTERFACE/mac_phy_primitives.c
index d9693e3d5ec8f4e273b4292a34b795f18d031f0d..06e06d096dc53caf0066bbdd26f6546dd5f7f9ee 100644
--- a/openair2/PHY_INTERFACE/mac_phy_primitives.c
+++ b/openair2/PHY_INTERFACE/mac_phy_primitives.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -187,9 +187,6 @@ MACPHY_DATA_REQ *new_macphy_data_req(unsigned char Mod_id)
 
   return((MACPHY_DATA_REQ*)0);
 }
-#ifndef USER_MODE
-EXPORT_SYMBOL(new_macphy_data_req);
-#endif
 
 
 #endif //PHY_CONTEXT
@@ -262,13 +259,7 @@ void macphy_data_ind(unsigned char Mod_id,unsigned char Pdu_type,void *pdu,unsig
     }
   }
   msg("[OPENAIR][MAC][ERROR] No more PHY_RESOURCES !!!!\n");
-#ifdef USER_MODE
   exit(-1);
-#else
-  print_active_indications();
-  print_active_requests();
-  mac_xface->macphy_exit();
-#endif
 }
 */
 
diff --git a/openair2/PHY_INTERFACE/mac_phy_primitives.h b/openair2/PHY_INTERFACE/mac_phy_primitives.h
index 02ff1fceac9c7e359a505973b7efe2c5c0a92718..889cb503dca1d91088401f20c8ee963433512e35 100644
--- a/openair2/PHY_INTERFACE/mac_phy_primitives.h
+++ b/openair2/PHY_INTERFACE/mac_phy_primitives.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/PHY_INTERFACE/vars.h b/openair2/PHY_INTERFACE/vars.h
index 810d073a233606d77a51ca9f67fb7de5c422932c..566f4347b6e5e264ff19a5a28193b1c96258ab97 100644
--- a/openair2/PHY_INTERFACE/vars.h
+++ b/openair2/PHY_INTERFACE/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -42,7 +42,3 @@ unsigned int mac_registered;
 
 #endif
 
-#ifndef USER_MODE
-EXPORT_SYMBOL(mac_xface);
-#endif //PHY_EMUL
-
diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c
index 222b9f7b410f1e04e3b347d7a25e2daef3c6c8d5..0844593d93e787a710b2dafb8b00aeb88bfaf19f 100644
--- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c
+++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,45 +28,10 @@
 * \email: navid.nikaein@eurecom.fr
 */
 
-#ifdef USER_MODE
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#else //USER_MODE
-
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/delay.h>
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-
-#include <linux/slab.h>
-#include <linux/version.h>
-#include <linux/kernel.h>
-#include <linux/fs.h>
-
-#include <linux/errno.h>
-
-
-#ifdef KERNEL2_6
-
-#include <linux/slab.h>
-#endif
-
-#ifdef KERNEL2_4
-#include <linux/malloc.h>
-#include <linux/wrapper.h>
-#endif
-#endif //USER_MODE
-
 #include "platform_types.h"
 #include "openair_defs.h"
 
diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
index c2325f99bd1628cb19fc5dc29c437aeb8672d1b2..4b651761de57a7c1cf7438afe33956cef1a3cdec 100644
--- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
+++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -41,8 +41,6 @@ mac_rrc_data_req(
   const rb_id_t         srb_idP,
   const uint8_t         nb_tbP,
   uint8_t* const        buffer_pP,
-  const eNB_flag_t      eNB_flagP,
-  const mac_enb_index_t eNB_indexP,
   const uint8_t         mbsfn_sync_areaP
 );
 
@@ -56,7 +54,31 @@ mac_rrc_data_ind(
   const rb_id_t         srb_idP,
   const uint8_t        *sduP,
   const sdu_size_t      sdu_lenP,
-  const eNB_flag_t      eNB_flagP,
+  const uint8_t         mbsfn_sync_area
+);
+
+int8_t
+mac_rrc_data_req_ue(
+  const module_id_t     module_idP,
+  const int             CC_idP,
+  const frame_t         frameP,
+  const rb_id_t         srb_idP,
+  const uint8_t         nb_tbP,
+  uint8_t* const        buffer_pP,
+  const mac_enb_index_t eNB_indexP,
+  const uint8_t         mbsfn_sync_areaP
+);
+
+int8_t
+mac_rrc_data_ind_ue(
+  const module_id_t     module_idP,
+  const int             CC_idP,
+  const frame_t         frameP,
+  const sub_frame_t     sub_frameP,
+  const rnti_t          rntiP,
+  const rb_id_t         srb_idP,
+  const uint8_t        *sduP,
+  const sdu_size_t      sdu_lenP,
   const mac_enb_index_t eNB_indexP,
   const uint8_t         mbsfn_sync_area
 );
diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LITE/L2_interface.c
index bac68807906f22cb5c10b7ba6c95b1b79bfd70ac..91834d9c9d64f4742cec1cd2b9d538a8ca9b8065 100644
--- a/openair2/RRC/LITE/L2_interface.c
+++ b/openair2/RRC/LITE/L2_interface.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -53,10 +53,11 @@ extern UE_MAC_INST *UE_mac_inst;
 # include "intertask_interface.h"
 #endif
 
+#include "flexran_agent_extern.h"
+
 //#define RRC_DATA_REQ_DEBUG
 //#define DEBUG_RRC 1
 
-mui_t mui=0;
 
 extern RAN_CONTEXT_t RC;
 
@@ -69,8 +70,6 @@ mac_rrc_data_req(
   const rb_id_t     Srb_id,
   const uint8_t     Nb_tb,
   uint8_t*    const buffer_pP,
-  const eNB_flag_t  enb_flagP,
-  const uint8_t     eNB_index,
   const uint8_t     mbsfn_sync_area
 )
 //--------------------------------------------------------------------------
@@ -81,7 +80,6 @@ mac_rrc_data_req(
   uint8_t sfn                     = (uint8_t)((frameP>>2)&0xff);
 
 
-  
 #ifdef DEBUG_RRC
   int i;
   LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
@@ -91,7 +89,6 @@ mac_rrc_data_req(
   rrc_eNB_carrier_data_t *carrier;
   BCCH_BCH_Message_t *mib;
 
-  if( enb_flagP == ENB_FLAG_YES) {
 
     rrc     = RC.rrc[Mod_idP];
     carrier = &rrc->carrier[0];
@@ -250,6 +247,44 @@ mac_rrc_data_req(
       return (Sdu_size);
     }
 
+    if( (Srb_id & RAB_OFFSET ) == PCCH) {
+      LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
+
+      // check if data is there for MAC
+      if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
+        LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
+               RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
+
+#if 0 //defined(ENABLE_ITTI)
+        {
+          MessageDef *message_p;
+          int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
+          int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
+
+          if (pcch_size > sdu_size) {
+            LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
+            pcch_size = sdu_size;
+          }
+
+          message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
+          RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
+          RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
+          memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
+          memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
+          RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
+
+          itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+        }
+#endif
+
+        memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
+        Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
+        RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
+      }
+
+      return (Sdu_size);
+    }
+
 #if defined(Rel10) || defined(Rel14)
 
     if((Srb_id & RAB_OFFSET) == MCCH) {
@@ -322,48 +357,6 @@ mac_rrc_data_req(
 
 #endif
 
-  } else {  //This is an UE
-
-
-    LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id);
-    LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
-
-
-    if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
-
-#if defined(ENABLE_ITTI)
-      {
-        MessageDef *message_p;
-        int ccch_size = UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
-        int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
-
-        if (ccch_size > sdu_size) {
-          LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
-          ccch_size = sdu_size;
-        }
-
-        message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ);
-        RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
-        RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
-        memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
-        memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload, ccch_size);
-        RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
-
-        itti_send_msg_to_task (TASK_MAC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
-      }
-#endif
-
-      memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
-      uint8_t Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
-      //   UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
-      UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active = 1;
-      UE_rrc_inst[Mod_idP].Info[eNB_index].T300_cnt = 0;
-      //      msg("[RRC][UE %d] Sending rach\n",Mod_id);
-      return(Ret_size);
-    } else {
-      return 0;
-    }
-  }
 
   return(0);
 }
@@ -379,8 +372,6 @@ mac_rrc_data_ind(
   const rb_id_t         srb_idP,
   const uint8_t*        sduP,
   const sdu_size_t      sdu_lenP,
-  const eNB_flag_t      eNB_flagP,
-  const mac_enb_index_t eNB_indexP,
   const uint8_t         mbsfn_sync_areaP
 )
 //--------------------------------------------------------------------------
@@ -395,114 +386,8 @@ mac_rrc_data_ind(
   /*
   int si_window;
    */
-  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, eNB_flagP, rntiP, frameP, sub_frameP,eNB_indexP);
-
-  if(eNB_flagP == ENB_FLAG_NO) {
-    if(srb_idP == BCCH) {
-      LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
-
-#if defined(ENABLE_ITTI)
-      {
-        MessageDef *message_p;
-        int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
-
-        if (sdu_lenP > msg_sdu_size) {
-          LOG_E(RRC, "SDU larger than BCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
-          sdu_size = msg_sdu_size;
-        } else {
-          sdu_size = sdu_lenP;
-        }
-
-        message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND);
-        memset (RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
-        RRC_MAC_BCCH_DATA_IND (message_p).frame     = frameP;
-        RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frameP;
-        RRC_MAC_BCCH_DATA_IND (message_p).sdu_size  = sdu_size;
-        memcpy (RRC_MAC_BCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
-        RRC_MAC_BCCH_DATA_IND (message_p).enb_index = eNB_indexP;
-        RRC_MAC_BCCH_DATA_IND (message_p).rsrq      = 30 /* TODO change phy to report rspq */;
-        RRC_MAC_BCCH_DATA_IND (message_p).rsrp      = 45 /* TODO change phy to report rspp */;
-
-        itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
-      }
-#else
-      decode_BCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t*)sduP,sdu_lenP, 0, 0);
-#endif
-    }
-
-    if(srb_idP == PCCH) {
-      LOG_D(RRC,"[UE %d] Received SDU for PCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
-      decode_PCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t*)sduP,sdu_lenP);
-    }
-    if((srb_idP & RAB_OFFSET) == CCCH) {
-      if (sdu_lenP>0) {
-        LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",module_idP,srb_idP & RAB_OFFSET,eNB_indexP);
-
-#if defined(ENABLE_ITTI)
-        {
-          MessageDef *message_p;
-          int msg_sdu_size = CCCH_SDU_SIZE;
-
-          if (sdu_lenP > msg_sdu_size) {
-            LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
-            sdu_size = msg_sdu_size;
-          } else {
-            sdu_size =  sdu_lenP;
-          }
-
-          message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND);
-          memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
-          memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
-          RRC_MAC_CCCH_DATA_IND (message_p).frame     = frameP;
-          RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
-          RRC_MAC_CCCH_DATA_IND (message_p).sdu_size  = sdu_size;
-          RRC_MAC_CCCH_DATA_IND (message_p).enb_index = eNB_indexP;
-          RRC_MAC_CCCH_DATA_IND (message_p).rnti      = rntiP;
-          itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
-        }
-#else
-        Srb_info = &UE_rrc_inst[module_idP].Srb0[eNB_indexP];
-        memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
-        Srb_info->Rx_buffer.payload_size = sdu_lenP;
-        rrc_ue_decode_ccch(&ctxt, Srb_info, eNB_indexP);
-#endif
-      }
-    }
-
-#if defined(Rel10) || defined(Rel14)
-
-    if ((srb_idP & RAB_OFFSET) == MCCH) {
-      LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n",
-            module_idP,frameP, mbsfn_sync_areaP, srb_idP & RAB_OFFSET,eNB_indexP);
-
-#if defined(ENABLE_ITTI)
-      {
-        MessageDef *message_p;
-        int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
-
-        if (sdu_size > msg_sdu_size) {
-          LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
-          sdu_size = msg_sdu_size;
-        }
-
-        message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND);
-        RRC_MAC_MCCH_DATA_IND (message_p).frame           = frameP;
-        RRC_MAC_MCCH_DATA_IND (message_p).sub_frame       = sub_frameP;
-        RRC_MAC_MCCH_DATA_IND (message_p).sdu_size        = sdu_lenP;
-        memset (RRC_MAC_MCCH_DATA_IND (message_p).sdu, 0, MCCH_SDU_SIZE);
-        memcpy (RRC_MAC_MCCH_DATA_IND (message_p).sdu, sduP, sdu_lenP);
-        RRC_MAC_MCCH_DATA_IND (message_p).enb_index       = eNB_indexP;
-        RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_areaP;
-        itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
-      }
-#else
-      decode_MCCH_Message(&ctxt, eNB_indexP, sduP, sdu_lenP, mbsfn_sync_areaP);
-#endif
-    }
+  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
 
-#endif // Rel10 || Rel14
-
-  } else { // This is an eNB
     Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
     LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
     
@@ -539,205 +424,11 @@ mac_rrc_data_ind(
     }
 
 #endif
-  }
 
   return(0);
 
 }
 
-//-------------------------------------------------------------------------------------------//
-// this function is Not USED anymore
-void mac_sync_ind(module_id_t Mod_idP,uint8_t Status)
-{
-  //-------------------------------------------------------------------------------------------//
-}
-
-//------------------------------------------------------------------------------
-uint8_t
-rrc_data_req(
-  const protocol_ctxt_t*   const ctxt_pP,
-  const rb_id_t                  rb_idP,
-  const mui_t                    muiP,
-  const confirm_t                confirmP,
-  const sdu_size_t               sdu_sizeP,
-  uint8_t*                 const buffer_pP,
-  const pdcp_transmission_mode_t modeP
-)
-//------------------------------------------------------------------------------
-{
-  MSC_LOG_TX_MESSAGE(
-    ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
-    ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
-    buffer_pP,
-    sdu_sizeP,
-    MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u",
-    MSC_AS_TIME_ARGS(ctxt_pP),
-    ctxt_pP->rnti,
-    muiP,
-    sdu_sizeP);
-
-#if defined(ENABLE_ITTI)
-  {
-    MessageDef *message_p;
-    // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
-    uint8_t *message_buffer;
-
-    message_buffer = itti_malloc (
-                       ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
-                       ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
-                       sdu_sizeP);
-
-    memcpy (message_buffer, buffer_pP, sdu_sizeP);
-
-    message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
-    RRC_DCCH_DATA_REQ (message_p).frame     = ctxt_pP->frame;
-    RRC_DCCH_DATA_REQ (message_p).enb_flag  = ctxt_pP->enb_flag;
-    RRC_DCCH_DATA_REQ (message_p).rb_id     = rb_idP;
-    RRC_DCCH_DATA_REQ (message_p).muip      = muiP;
-    RRC_DCCH_DATA_REQ (message_p).confirmp  = confirmP;
-    RRC_DCCH_DATA_REQ (message_p).sdu_size  = sdu_sizeP;
-    RRC_DCCH_DATA_REQ (message_p).sdu_p     = message_buffer;
-    RRC_DCCH_DATA_REQ (message_p).mode      = modeP;
-    RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
-    RRC_DCCH_DATA_REQ (message_p).rnti      = ctxt_pP->rnti;
-    RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
-
-    itti_send_msg_to_task (
-      ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
-      ctxt_pP->instance,
-      message_p);
-    return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
-
-  }
-#else
-  return pdcp_data_req (
-           ctxt_pP,
-           SRB_FLAG_YES,
-           rb_idP,
-           muiP,
-           confirmP,
-           sdu_sizeP,
-           buffer_pP,
-           modeP);
-#endif
-}
-
-//------------------------------------------------------------------------------
-void
-rrc_data_ind(
-  const protocol_ctxt_t* const ctxt_pP,
-  const rb_id_t                Srb_id,
-  const sdu_size_t             sdu_sizeP,
-  const uint8_t*   const       buffer_pP
-)
-//------------------------------------------------------------------------------
-{
-  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 %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,
-          sdu_sizeP,
-          ctxt_pP->rnti);
-  }
-
-#if defined(ENABLE_ITTI)
-  {
-    MessageDef *message_p;
-    // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
-    uint8_t *message_buffer;
-
-    message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP);
-    memcpy (message_buffer, buffer_pP, sdu_sizeP);
-
-    message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
-    RRC_DCCH_DATA_IND (message_p).frame      = ctxt_pP->frame;
-    RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
-    RRC_DCCH_DATA_IND (message_p).sdu_size   = sdu_sizeP;
-    RRC_DCCH_DATA_IND (message_p).sdu_p      = message_buffer;
-    RRC_DCCH_DATA_IND (message_p).rnti       = ctxt_pP->rnti;
-    RRC_DCCH_DATA_IND (message_p).module_id  = ctxt_pP->module_id;
-    RRC_DCCH_DATA_IND (message_p).eNB_index  = ctxt_pP->eNB_index;
-
-    itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, ctxt_pP->instance, message_p);
-  }
-#else
-
-  if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
-    rrc_eNB_decode_dcch(
-      ctxt_pP,
-      DCCH_index,
-      buffer_pP,
-      sdu_sizeP);
-  } else {
-//#warning "LG put 0 to arg4 that is eNB index"
-    rrc_ue_decode_dcch(
-      ctxt_pP,
-      DCCH_index,
-      buffer_pP,
-      0);
-  }
-
-#endif
-}
-
-//-------------------------------------------------------------------------------------------//
-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;
-
-    itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
-  }
-#else
-  UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0;
-
-  if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1) {
-    UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++;
-  }
-
-#endif
-}
-
-//-------------------------------------------------------------------------------------------//
-void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index)
-{
-  //-------------------------------------------------------------------------------------------//
-  if (UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt>10)
-    LOG_I(RRC,"[UE %d] Frame %d: OUT OF SYNC FROM eNB %d (T310 active %d : T310 %d, N310 %d, N311 %d)\n ",
-	  Mod_idP,frameP,eNB_index,
-	  UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active,
-	  UE_rrc_inst[Mod_idP].Info[eNB_index].T310_cnt,
-	  UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt,
-	  UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt);
-  
-#if defined(ENABLE_ITTI)
-  {
-    MessageDef *message_p;
-
-    message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND);
-    RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frameP;
-    RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index;
-
-    itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
-  }
-#else
-  UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++;
-#endif
-}
-
 //------------------------------------------------------------------------------
 int
 mac_eNB_get_rrc_status(
@@ -771,12 +462,39 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
 
   if (ue_context_p != NULL) {
     LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP);
-    ue_context_p->ue_context.ul_failure_timer=1;
+    if(ue_context_p->ue_context.ul_failure_timer == 0)
+      ue_context_p->ue_context.ul_failure_timer=1;
   }
   else {
     LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
   }
-  rrc_mac_remove_ue(Mod_instP,rntiP);
+  if (rrc_agent_registered[Mod_instP]) {
+    agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP,
+								     rntiP,
+								     PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+  }
+//  rrc_mac_remove_ue(Mod_instP,rntiP);
+}
+
+void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
+                const int CC_idP,
+                const frame_t frameP,
+                const sub_frame_t subframeP,
+                const rnti_t rntiP)
+{
+    struct rrc_eNB_ue_context_s* ue_context_p = NULL;
+    ue_context_p = rrc_eNB_get_ue_context(
+                     RC.rrc[Mod_instP],
+                     rntiP);
+    if (ue_context_p != NULL) {
+      LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP);
+
+      if(ue_context_p->ue_context.ul_failure_timer == 0)
+          ue_context_p->ue_context.ul_failure_timer=19999;
+    }
+    else {
+      LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP);
+    }
 }
 
 void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, 
@@ -799,33 +517,3 @@ void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
           frameP, subframeP, rntiP);
   }
 }
-//------------------------------------------------------------------------------
-int
-mac_UE_get_rrc_status(
-  const module_id_t Mod_idP,
-  const uint8_t     indexP
-)
-//------------------------------------------------------------------------------
-{
-  return(UE_rrc_inst[Mod_idP].Info[indexP].State);
-}
-
-//-------------------------------------------------------------------------------------------//
-int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index)
-{
-  //-------------------------------------------------------------------------------------------//
-#if defined(ENABLE_ITTI)
-  {
-    MessageDef *message_p;
-
-    message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF);
-    RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index;
-
-    itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
-  }
-#else
-  // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
-  UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0;
-#endif
-  return 0;
-}
diff --git a/openair2/RRC/LITE/L2_interface_common.c b/openair2/RRC/LITE/L2_interface_common.c
new file mode 100644
index 0000000000000000000000000000000000000000..1b832521528ec231b8b8dc9d016e62584ff97191
--- /dev/null
+++ b/openair2/RRC/LITE/L2_interface_common.c
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file l2_interface.c
+ * \brief layer 2 interface, used to support different RRC sublayer
+ * \author Raymond Knopp and Navid Nikaein
+ * \date 2010-2014
+ * \version 1.0
+ * \company Eurecom
+ * \email: raymond.knopp@eurecom.fr
+ */
+
+#include "platform_types.h"
+//#include "openair_defs.h"
+//#include "openair_proto.h"
+#include "defs.h"
+#include "extern.h"
+//#include "mac_lchan_interface.h"
+//#include "openair_rrc_utils.h"
+//#include "openair_rrc_main.h"
+#include "UTIL/LOG/log.h"
+#include "rrc_eNB_UE_context.h"
+#include "pdcp.h"
+#include "msc.h"
+#include "common/ran_context.h"
+
+#ifdef PHY_EMUL
+#include "SIMULATION/simulation_defs.h"
+extern EMULATION_VARS *Emul_vars;
+extern eNB_MAC_INST *eNB_mac_inst;
+extern UE_MAC_INST *UE_mac_inst;
+#endif
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+#endif
+
+//#define RRC_DATA_REQ_DEBUG
+//#define DEBUG_RRC 1
+
+//------------------------------------------------------------------------------
+uint8_t
+rrc_data_req(
+  const protocol_ctxt_t*   const ctxt_pP,
+  const rb_id_t                  rb_idP,
+  const mui_t                    muiP,
+  const confirm_t                confirmP,
+  const sdu_size_t               sdu_sizeP,
+  uint8_t*                 const buffer_pP,
+  const pdcp_transmission_mode_t modeP
+)
+//------------------------------------------------------------------------------
+{
+  MSC_LOG_TX_MESSAGE(
+    ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
+    ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
+    buffer_pP,
+    sdu_sizeP,
+    MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ctxt_pP->rnti,
+    muiP,
+    sdu_sizeP);
+
+#if defined(ENABLE_ITTI)
+  {
+    MessageDef *message_p;
+    // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
+    uint8_t *message_buffer;
+
+    message_buffer = itti_malloc (
+                       ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
+                       ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
+                       sdu_sizeP);
+
+    memcpy (message_buffer, buffer_pP, sdu_sizeP);
+
+    message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
+    RRC_DCCH_DATA_REQ (message_p).frame     = ctxt_pP->frame;
+    RRC_DCCH_DATA_REQ (message_p).enb_flag  = ctxt_pP->enb_flag;
+    RRC_DCCH_DATA_REQ (message_p).rb_id     = rb_idP;
+    RRC_DCCH_DATA_REQ (message_p).muip      = muiP;
+    RRC_DCCH_DATA_REQ (message_p).confirmp  = confirmP;
+    RRC_DCCH_DATA_REQ (message_p).sdu_size  = sdu_sizeP;
+    RRC_DCCH_DATA_REQ (message_p).sdu_p     = message_buffer;
+    RRC_DCCH_DATA_REQ (message_p).mode      = modeP;
+    RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
+    RRC_DCCH_DATA_REQ (message_p).rnti      = ctxt_pP->rnti;
+    RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
+
+    itti_send_msg_to_task (
+      ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
+      ctxt_pP->instance,
+      message_p);
+    return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
+
+  }
+#else
+  return pdcp_data_req (
+           ctxt_pP,
+           SRB_FLAG_YES,
+           rb_idP,
+           muiP,
+           confirmP,
+           sdu_sizeP,
+           buffer_pP,
+           modeP);
+#endif
+}
+
+//------------------------------------------------------------------------------
+void
+rrc_data_ind(
+  const protocol_ctxt_t* const ctxt_pP,
+  const rb_id_t                Srb_id,
+  const sdu_size_t             sdu_sizeP,
+  const uint8_t*   const       buffer_pP
+)
+//------------------------------------------------------------------------------
+{
+  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 %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,
+          sdu_sizeP,
+          ctxt_pP->rnti);
+  }
+
+#if defined(ENABLE_ITTI)
+  {
+    MessageDef *message_p;
+    // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
+    uint8_t *message_buffer;
+
+    message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP);
+    memcpy (message_buffer, buffer_pP, sdu_sizeP);
+
+    message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
+    RRC_DCCH_DATA_IND (message_p).frame      = ctxt_pP->frame;
+    RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
+    RRC_DCCH_DATA_IND (message_p).sdu_size   = sdu_sizeP;
+    RRC_DCCH_DATA_IND (message_p).sdu_p      = message_buffer;
+    RRC_DCCH_DATA_IND (message_p).rnti       = ctxt_pP->rnti;
+    RRC_DCCH_DATA_IND (message_p).module_id  = ctxt_pP->module_id;
+    RRC_DCCH_DATA_IND (message_p).eNB_index  = ctxt_pP->eNB_index;
+
+    itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, ctxt_pP->instance, message_p);
+  }
+#else
+
+    rrc_eNB_decode_dcch(
+      ctxt_pP,
+      DCCH_index,
+      buffer_pP,
+      sdu_sizeP);
+
+#endif
+}
diff --git a/openair2/RRC/LITE/L2_interface_ue.c b/openair2/RRC/LITE/L2_interface_ue.c
new file mode 100644
index 0000000000000000000000000000000000000000..244f0d2253bbd6cd78f5724650be5b3dcf7a29d3
--- /dev/null
+++ b/openair2/RRC/LITE/L2_interface_ue.c
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file l2_interface.c
+ * \brief layer 2 interface, used to support different RRC sublayer
+ * \author Raymond Knopp and Navid Nikaein
+ * \date 2010-2014
+ * \version 1.0
+ * \company Eurecom
+ * \email: raymond.knopp@eurecom.fr
+ */
+
+#include "platform_types.h"
+//#include "openair_defs.h"
+//#include "openair_proto.h"
+#include "defs.h"
+#include "extern.h"
+//#include "mac_lchan_interface.h"
+//#include "openair_rrc_utils.h"
+//#include "openair_rrc_main.h"
+#include "UTIL/LOG/log.h"
+#include "rrc_eNB_UE_context.h"
+#include "pdcp.h"
+#include "msc.h"
+
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+#endif
+
+//#define RRC_DATA_REQ_DEBUG
+//#define DEBUG_RRC 1
+
+
+
+//------------------------------------------------------------------------------
+int8_t
+mac_rrc_data_req_ue(
+  const module_id_t Mod_idP,
+  const int         CC_id,
+  const frame_t     frameP,
+  const rb_id_t     Srb_id,
+  const uint8_t     Nb_tb,
+  uint8_t*    const buffer_pP,
+  const uint8_t     eNB_index,
+  const uint8_t     mbsfn_sync_area
+)
+//--------------------------------------------------------------------------
+{
+
+#ifdef DEBUG_RRC
+  int i;
+  LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
+#endif
+
+  LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id);
+  LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
+
+  if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
+
+#if defined(ENABLE_ITTI)
+      {
+        MessageDef *message_p;
+        int ccch_size = UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
+        int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
+
+        if (ccch_size > sdu_size) {
+          LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
+          ccch_size = sdu_size;
+        }
+
+        message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ);
+        RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
+        RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
+        memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
+        memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload, ccch_size);
+        RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
+
+        itti_send_msg_to_task (TASK_MAC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+      }
+#endif
+
+      memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
+      uint8_t Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
+      //   UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
+      UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active = 1;
+      UE_rrc_inst[Mod_idP].Info[eNB_index].T300_cnt = 0;
+      //      msg("[RRC][UE %d] Sending rach\n",Mod_id);
+      return(Ret_size);
+    } else {
+      return 0;
+    }
+
+  return(0);
+}
+
+//------------------------------------------------------------------------------
+int8_t
+mac_rrc_data_ind_ue(
+  const module_id_t     module_idP,
+  const int             CC_id,
+  const frame_t         frameP,
+  const sub_frame_t     sub_frameP,
+  const rnti_t          rntiP,
+  const rb_id_t         srb_idP,
+  const uint8_t*        sduP,
+  const sdu_size_t      sdu_lenP,
+  const mac_enb_index_t eNB_indexP,
+  const uint8_t         mbsfn_sync_areaP
+)
+//--------------------------------------------------------------------------
+{
+  protocol_ctxt_t ctxt;
+  sdu_size_t      sdu_size = 0;
+
+  /* for no gcc warnings */
+  (void)sdu_size;
+
+  /*
+  int si_window;
+   */
+  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, 0, rntiP, frameP, sub_frameP,eNB_indexP);
+
+    if(srb_idP == BCCH) {
+      LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
+
+#if defined(ENABLE_ITTI)
+      {
+        MessageDef *message_p;
+        int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
+
+        if (sdu_lenP > msg_sdu_size) {
+          LOG_E(RRC, "SDU larger than BCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
+          sdu_size = msg_sdu_size;
+        } else {
+          sdu_size = sdu_lenP;
+        }
+
+        message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND);
+        memset (RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
+        RRC_MAC_BCCH_DATA_IND (message_p).frame     = frameP;
+        RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frameP;
+        RRC_MAC_BCCH_DATA_IND (message_p).sdu_size  = sdu_size;
+        memcpy (RRC_MAC_BCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
+        RRC_MAC_BCCH_DATA_IND (message_p).enb_index = eNB_indexP;
+        RRC_MAC_BCCH_DATA_IND (message_p).rsrq      = 30 /* TODO change phy to report rspq */;
+        RRC_MAC_BCCH_DATA_IND (message_p).rsrp      = 45 /* TODO change phy to report rspp */;
+
+        itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
+      }
+#else
+      decode_BCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t*)sduP,sdu_lenP, 0, 0);
+#endif
+    }
+
+    if(srb_idP == PCCH) {
+      LOG_D(RRC,"[UE %d] Received SDU for PCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
+      decode_PCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t*)sduP,sdu_lenP);
+    }
+    if((srb_idP & RAB_OFFSET) == CCCH) {
+      if (sdu_lenP>0) {
+        LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",module_idP,srb_idP & RAB_OFFSET,eNB_indexP);
+
+#if defined(ENABLE_ITTI)
+        {
+          MessageDef *message_p;
+          int msg_sdu_size = CCCH_SDU_SIZE;
+
+          if (sdu_lenP > msg_sdu_size) {
+            LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
+            sdu_size = msg_sdu_size;
+          } else {
+            sdu_size =  sdu_lenP;
+          }
+
+          message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND);
+          memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
+          memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
+          RRC_MAC_CCCH_DATA_IND (message_p).frame     = frameP;
+          RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
+          RRC_MAC_CCCH_DATA_IND (message_p).sdu_size  = sdu_size;
+          RRC_MAC_CCCH_DATA_IND (message_p).enb_index = eNB_indexP;
+          RRC_MAC_CCCH_DATA_IND (message_p).rnti      = rntiP;
+          itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
+        }
+#else
+        SRB_INFO *Srb_info;
+        Srb_info = &UE_rrc_inst[module_idP].Srb0[eNB_indexP];
+        memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
+        Srb_info->Rx_buffer.payload_size = sdu_lenP;
+        rrc_ue_decode_ccch(&ctxt, Srb_info, eNB_indexP);
+#endif
+      }
+    }
+
+#if defined(Rel10) || defined(Rel14)
+
+    if ((srb_idP & RAB_OFFSET) == MCCH) {
+      LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n",
+            module_idP,frameP, mbsfn_sync_areaP, srb_idP & RAB_OFFSET,eNB_indexP);
+
+#if defined(ENABLE_ITTI)
+      {
+        MessageDef *message_p;
+        int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
+
+        if (sdu_size > msg_sdu_size) {
+          LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
+          sdu_size = msg_sdu_size;
+        }
+
+        message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND);
+        RRC_MAC_MCCH_DATA_IND (message_p).frame           = frameP;
+        RRC_MAC_MCCH_DATA_IND (message_p).sub_frame       = sub_frameP;
+        RRC_MAC_MCCH_DATA_IND (message_p).sdu_size        = sdu_lenP;
+        memset (RRC_MAC_MCCH_DATA_IND (message_p).sdu, 0, MCCH_SDU_SIZE);
+        memcpy (RRC_MAC_MCCH_DATA_IND (message_p).sdu, sduP, sdu_lenP);
+        RRC_MAC_MCCH_DATA_IND (message_p).enb_index       = eNB_indexP;
+        RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_areaP;
+        itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
+      }
+#else
+      decode_MCCH_Message(&ctxt, eNB_indexP, sduP, sdu_lenP, mbsfn_sync_areaP);
+#endif
+    }
+
+#endif // Rel10 || Rel14
+
+  return(0);
+
+}
+
+
+//------------------------------------------------------------------------------
+uint8_t
+rrc_data_req_ue(
+  const protocol_ctxt_t*   const ctxt_pP,
+  const rb_id_t                  rb_idP,
+  const mui_t                    muiP,
+  const confirm_t                confirmP,
+  const sdu_size_t               sdu_sizeP,
+  uint8_t*                 const buffer_pP,
+  const pdcp_transmission_mode_t modeP
+)
+//------------------------------------------------------------------------------
+{
+  MSC_LOG_TX_MESSAGE(
+    ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
+    ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
+    buffer_pP,
+    sdu_sizeP,
+    MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ctxt_pP->rnti,
+    muiP,
+    sdu_sizeP);
+
+#if defined(ENABLE_ITTI)
+  {
+    MessageDef *message_p;
+    // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
+    uint8_t *message_buffer;
+
+    message_buffer = itti_malloc (
+                       ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
+                       ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
+                       sdu_sizeP);
+
+    memcpy (message_buffer, buffer_pP, sdu_sizeP);
+
+    message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
+    RRC_DCCH_DATA_REQ (message_p).frame     = ctxt_pP->frame;
+    RRC_DCCH_DATA_REQ (message_p).enb_flag  = ctxt_pP->enb_flag;
+    RRC_DCCH_DATA_REQ (message_p).rb_id     = rb_idP;
+    RRC_DCCH_DATA_REQ (message_p).muip      = muiP;
+    RRC_DCCH_DATA_REQ (message_p).confirmp  = confirmP;
+    RRC_DCCH_DATA_REQ (message_p).sdu_size  = sdu_sizeP;
+    RRC_DCCH_DATA_REQ (message_p).sdu_p     = message_buffer;
+    RRC_DCCH_DATA_REQ (message_p).mode      = modeP;
+    RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
+    RRC_DCCH_DATA_REQ (message_p).rnti      = ctxt_pP->rnti;
+    RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
+
+    itti_send_msg_to_task (
+      TASK_PDCP_UE,
+      ctxt_pP->instance,
+      message_p);
+    return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
+
+  }
+#else
+  return pdcp_data_req (
+           ctxt_pP,
+           SRB_FLAG_YES,
+           rb_idP,
+           muiP,
+           confirmP,
+           sdu_sizeP,
+           buffer_pP,
+           modeP);
+#endif
+}
+
+//------------------------------------------------------------------------------
+void
+rrc_data_ind_ue(
+  const protocol_ctxt_t* const ctxt_pP,
+  const rb_id_t                Srb_id,
+  const sdu_size_t             sdu_sizeP,
+  const uint8_t*   const       buffer_pP
+)
+//------------------------------------------------------------------------------
+{
+  rb_id_t    DCCH_index = Srb_id;
+
+    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);
+
+#if defined(ENABLE_ITTI)
+  {
+    MessageDef *message_p;
+    // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
+    uint8_t *message_buffer;
+
+    message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP);
+    memcpy (message_buffer, buffer_pP, sdu_sizeP);
+
+    message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
+    RRC_DCCH_DATA_IND (message_p).frame      = ctxt_pP->frame;
+    RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
+    RRC_DCCH_DATA_IND (message_p).sdu_size   = sdu_sizeP;
+    RRC_DCCH_DATA_IND (message_p).sdu_p      = message_buffer;
+    RRC_DCCH_DATA_IND (message_p).rnti       = ctxt_pP->rnti;
+    RRC_DCCH_DATA_IND (message_p).module_id  = ctxt_pP->module_id;
+    RRC_DCCH_DATA_IND (message_p).eNB_index  = ctxt_pP->eNB_index;
+
+    itti_send_msg_to_task (TASK_RRC_UE, ctxt_pP->instance, message_p);
+  }
+#else
+
+//#warning "LG put 0 to arg4 that is eNB index"
+    rrc_ue_decode_dcch(
+      ctxt_pP,
+      DCCH_index,
+      buffer_pP,
+      0);
+
+#endif
+}
+
+//-------------------------------------------------------------------------------------------//
+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;
+
+    itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+  }
+#else
+  UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0;
+
+  if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1) {
+    UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++;
+  }
+
+#endif
+}
+
+//-------------------------------------------------------------------------------------------//
+void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index)
+{
+  //-------------------------------------------------------------------------------------------//
+  if (UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt>10)
+    LOG_I(RRC,"[UE %d] Frame %d: OUT OF SYNC FROM eNB %d (T310 active %d : T310 %d, N310 %d, N311 %d)\n ",
+	  Mod_idP,frameP,eNB_index,
+	  UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active,
+	  UE_rrc_inst[Mod_idP].Info[eNB_index].T310_cnt,
+	  UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt,
+	  UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt);
+  
+#if defined(ENABLE_ITTI)
+  {
+    MessageDef *message_p;
+
+    message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND);
+    RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frameP;
+    RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index;
+
+    itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+  }
+#else
+  UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++;
+#endif
+}
+
+//------------------------------------------------------------------------------
+int
+mac_UE_get_rrc_status(
+  const module_id_t Mod_idP,
+  const uint8_t     indexP
+)
+//------------------------------------------------------------------------------
+{
+  if (UE_rrc_inst)
+    return(UE_rrc_inst[Mod_idP].Info[indexP].State);
+  else
+    return(-1);
+}
+
+//-------------------------------------------------------------------------------------------//
+int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index)
+{
+  //-------------------------------------------------------------------------------------------//
+#if defined(ENABLE_ITTI)
+  {
+    MessageDef *message_p;
+
+    message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF);
+    RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index;
+
+    itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+  }
+#else
+  // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
+  UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0;
+#endif
+  return 0;
+}
diff --git a/openair2/RRC/LITE/MESSAGES/Makefile b/openair2/RRC/LITE/MESSAGES/Makefile
deleted file mode 100644
index bd99081ad2e3d6768cf7bb16fa44fce5d51c4dbd..0000000000000000000000000000000000000000
--- a/openair2/RRC/LITE/MESSAGES/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-OPENAIR2_TOP = ../../..
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-
-EXTRA_CFLAGS += -I$(OPENAIR1_DIR) -I/usr/realtime/include -D__need_Emath -D__NO_ASSERT_H__ 
-
-ifdef RTAI
-# Get the RTAI variables
-CCC = $(shell rtai-config --cc)
-RTAI_SUBVERSION=$(shell rtai-config --version | sed -e 's/^..\(.\).*$$/\1/')
-IS_RTAI_SUBVERSION_LESS_THAN_FIVE=$(shell if [ $(RTAI_SUBVERSION) -lt 5 ] ; then echo true ; fi)
-
-EXTRA_CFLAGS += -D__IN_RTAI__ $(shell rtai-config --module-cflags) -g -march=pentium4 -DNODE_RG -DBIGPHYSAREA -DRTAI -DRTAI_ENABLED -fno-stack-protector -DHW_PREFIX_REMOVAL -Wall -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DWIDENS_DLC -I$(KERNEL_DIR)/build/include -I$(KERNEL_DIR)/build/include/asm/mach-default -include $(KERNEL_DIR)/build/include/linux/autoconf.h $(if $(IS_RTAI_SUBVERSION_LESS_THAN_FIVE),-DRTAI_ISNT_POSIX,)
-endif
-
-
-obj-m = asn1_msg_kern.o
-asn1_msg_kern-objs = $(ASN1_CONVERTER_OBJS) $(ASN1_MODULE_OBJS) bsearch.o rtai_mem.o
-
-clean:
-	rm -rf $(asn1_msg_kern-objs) $(obj-m)
-
-test:
-	echo $(asn1_msg_kern-objs) $(obj-m)
-
-regen: regenerate-from-asn1-source
-
-regenerate-from-asn1-source:
-	asn1c -gen-PER -fcompound-names -fnative-types -fskeletons-copy asn1c/ASN1_files/EUTRA-RRC-Definitions.asn
-
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
index c378e4766375827068e564774ab585e8ef3d4d29..77ba0c4cade0378c36db0cb8807d4f1a23b30ace 100644
--- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,7 +28,6 @@
 * \email: raymond.knopp@eurecom.fr and  navid.nikaein@eurecom.fr
 */
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <sys/types.h>
 #include <stdlib.h> /* for atoi(3) */
@@ -36,14 +35,7 @@
 #include <string.h> /* for strerror(3) */
 #include <sysexits.h> /* for EX_* exit codes */
 #include <errno.h>  /* for errno */
-#else
-#include <linux/module.h>  /* Needed by all modules */
-#endif
-#ifdef USER_MODE
-//#include "RRC/LITE/defs.h"
-//#include "COMMON/mac_rrc_primitives.h"
 #include "UTIL/LOG/log.h"
-#endif
 #include <asn_application.h>
 #include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
 #include <per_encoder.h>
@@ -54,6 +46,8 @@
 #include "UL-DCCH-Message.h"
 #include "DL-CCCH-Message.h"
 #include "DL-DCCH-Message.h"
+#include "PCCH-Message.h"
+#include "openair3/UTILS/conversions.h"
 #include "EstablishmentCause.h"
 #include "RRCConnectionSetup.h"
 #include "SRB-ToAddModList.h"
@@ -89,17 +83,10 @@
 #endif
 
 #include "common/ran_context.h"
+#include "secu_defs.h"
 
-//#include "PHY/defs.h"
-#ifndef USER_MODE
-#define msg printk
-#ifndef errno
-int errno;
-#endif
-#else
-# if !defined (msg)
-#   define msg printf
-# endif
+#if !defined (msg)
+#define msg printf
 #endif
 
 //#define XER_PRINT
@@ -158,11 +145,11 @@ int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, voi
   er = xer_encode(td, sptr, XER_F_BASIC, xer__print2s, &string_buffer);
 
   if (er.encoded < 0) {
-    LOG_E(RRC, "xer_sprint encoding error (%d)!", er.encoded);
+    LOG_E(RRC, "xer_sprint encoding error (%zd)!", er.encoded);
     er.encoded = string_buffer.string_size;
   } else {
     if (er.encoded > string_buffer.string_size) {
-      LOG_E(RRC, "xer_sprint string buffer too small, got %d need %d!", string_buffer.string_size, er.encoded);
+      LOG_E(RRC, "xer_sprint string buffer too small, got %zd need %zd!", string_buffer.string_size, er.encoded);
       er.encoded = string_buffer.string_size;
     }
   }
@@ -230,7 +217,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
 
   AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n");
   mib->message.phich_Config.phich_Resource = phich_Resource;
-  AssertFatal(phich_Resource <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n");
+  AssertFatal(phich_duration <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n");
   mib->message.phich_Config.phich_Duration = phich_duration;
   LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n",
          (uint32_t)mib->message.dl_Bandwidth,
@@ -483,9 +470,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
+  LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
 
   if (enc_rval.encoded==-1) {
     return(-1);
@@ -891,7 +876,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
   (*sib3)->intraFreqCellReselectionInfo.presenceAntennaPort1 = 0;
   (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf = CALLOC(8,1);
   (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.size = 1;
-  (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf[0] = 1;
+  (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf[0] = 1 << 6;
   (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.bits_unused = 6;
   (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA = 1;
   (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF = (struct SpeedStateScaleFactors *)NULL;
@@ -1013,9 +998,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"[eNB] SystemInformation Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
+  LOG_D(RRC,"[eNB] SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
 
   if (enc_rval.encoded==-1) {
     msg("[RRC] ASN1 : SI encoding failed for SIB23\n");
@@ -1102,9 +1085,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv)
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %d bits (%d bytes), ecause %d\n",enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
-#endif
+  LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %zd bits (%zd bytes), ecause %d\n",enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
 
   return((enc_rval.encoded+7)/8);
 
@@ -1185,9 +1166,7 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"RRCConnectionSetupComplete Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
+  LOG_D(RRC,"RRCConnectionSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
 
   return((enc_rval.encoded+7)/8);
 
@@ -1247,9 +1226,7 @@ do_RRCConnectionReconfigurationComplete(
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
+  LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
 
   return((enc_rval.encoded+7)/8);
 }
@@ -1468,7 +1445,7 @@ do_RRCConnectionSetup(
       if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
 	  == SoundingRS_UL_ConfigCommon_PR_setup)
 	if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) 
-	  LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %d. Expect undefined behaviour!\n",
+	  LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %zd. Expect undefined behaviour!\n",
 		carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig);
       if (ue_context_pP->local_uid >=20) 
 	LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n",
@@ -1481,7 +1458,7 @@ do_RRCConnectionSetup(
       if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
 	  == SoundingRS_UL_ConfigCommon_PR_setup)
 	if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=7) {
-	  LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %d and %d. Expect undefined behaviour!\n",
+	  LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %zd and %zd. Expect undefined behaviour!\n",
 		carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig,
 		carrier->sib1->tdd_Config->subframeAssignment);
 	}
@@ -1491,7 +1468,7 @@ do_RRCConnectionSetup(
       physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=17+ue_context_pP->local_uid/2;
       physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2;
     }
-    LOG_W(RRC,"local UID %d, srs ConfigIndex %d, TransmissionComb %d\n",ue_context_pP->local_uid,
+    LOG_W(RRC,"local UID %d, srs ConfigIndex %zd, TransmissionComb %zd\n",ue_context_pP->local_uid,
 	  physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex,
 	  physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb);
 
@@ -1636,10 +1613,8 @@ do_RRCConnectionSetup(
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"RRCConnectionSetup Encoded %d bits (%d bytes), ecause %d\n",
+  LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes), ecause %d\n",
         enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
-#endif
 
   //  FREEMEM(SRB_list);
   //  free(SRB1_config);
@@ -1709,13 +1684,11 @@ do_SecurityModeCommand(
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"[eNB %d] securityModeCommand for UE %x Encoded %d bits (%d bytes)\n",
+  LOG_D(RRC,"[eNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n",
         ctxt_pP->module_id,
         ctxt_pP->rnti,
         enc_rval.encoded,
         (enc_rval.encoded+7)/8);
-#endif
 
   if (enc_rval.encoded==-1) {
     LOG_E(RRC,"[eNB %d] ASN1 : securityModeCommand encoding failed for UE %x\n",
@@ -1787,13 +1760,11 @@ do_UECapabilityEnquiry(
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"[eNB %d] UECapabilityRequest for UE %x Encoded %d bits (%d bytes)\n",
+  LOG_D(RRC,"[eNB %d] UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n",
         ctxt_pP->module_id,
         ctxt_pP->rnti,
         enc_rval.encoded,
         (enc_rval.encoded+7)/8);
-#endif
 
   if (enc_rval.encoded==-1) {
     LOG_E(RRC,"[eNB %d] ASN1 : UECapabilityRequest encoding failed for UE %x\n",
@@ -1927,7 +1898,7 @@ do_RRCConnectionReconfiguration(
                                    (void*)&dl_dcch_msg,
                                    buffer,
                                    RRC_BUF_SIZE);
-  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %l)!\n",
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %zd)!\n",
                enc_rval.failed_type->name, enc_rval.encoded);
 
 #ifdef XER_PRINT
@@ -1953,13 +1924,219 @@ do_RRCConnectionReconfiguration(
 # endif
 #endif
 
-  //#ifdef USER_MODE
-  LOG_I(RRC,"RRCConnectionReconfiguration Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+  LOG_I(RRC,"RRCConnectionReconfiguration Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
   // for (i=0;i<30;i++)
   //    msg("%x.",buffer[i]);
   // msg("\n");
 
-  //#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
+//------------------------------------------------------------------------------
+uint8_t
+do_RRCConnectionReestablishment(
+  const protocol_ctxt_t*     const ctxt_pP,
+  rrc_eNB_ue_context_t*      const ue_context_pP,
+  int                              CC_id,
+  uint8_t*                   const buffer,
+  const uint8_t                    transmission_mode,
+  const uint8_t                    Transaction_id,
+  SRB_ToAddModList_t               **SRB_configList,
+  struct PhysicalConfigDedicated   **physicalConfigDedicated)
+{
+  asn_enc_rval_t enc_rval;
+
+  long* logicalchannelgroup = NULL;
+  struct SRB_ToAddMod* SRB1_config = NULL;
+  struct SRB_ToAddMod* SRB2_config = NULL;
+  struct SRB_ToAddMod__rlc_Config* SRB1_rlc_config = NULL;
+  struct SRB_ToAddMod__logicalChannelConfig* SRB1_lchan_config = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters* SRB1_ul_SpecificParameters = NULL;
+  eNB_RRC_INST *rrc               = RC.rrc[ctxt_pP->module_id];
+
+#ifdef CBA
+  struct PUSCH_CBAConfigDedicated_vlola* pusch_CBAConfigDedicated_vlola = NULL;
+  long* betaOffset_CBA_Index = NULL;
+  long* cShift_CBA = NULL;
+#endif
+  PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL;
+
+  DL_CCCH_Message_t dl_ccch_msg;
+
+  RRCConnectionReestablishment_t* rrcConnectionReestablishment = NULL;
+
+  int i = 0;
+  SRB_ToAddModList_t **SRB_configList2 = NULL;
+  SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[Transaction_id];
+  if (*SRB_configList2) {
+    free(*SRB_configList2);
+  }
+  *SRB_configList2 = CALLOC(1, sizeof(SRB_ToAddModList_t));
+
+  memset((void *)&dl_ccch_msg, 0, sizeof(DL_CCCH_Message_t));
+  dl_ccch_msg.message.present           = DL_CCCH_MessageType_PR_c1;
+  dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment;
+  rrcConnectionReestablishment          = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReestablishment;
+
+  // RRCConnectionReestablishment
+  // Configure SRB1
+
+
+  // get old configuration of SRB2
+  if (*SRB_configList != NULL) {
+    for (i = 0; (i < (*SRB_configList)->list.count) && (i < 3); i++) {
+      LOG_D(RRC, "(*SRB_configList)->list.array[%d]->srb_Identity=%ld\n",
+          i, (*SRB_configList)->list.array[i]->srb_Identity);
+      if ((*SRB_configList)->list.array[i]->srb_Identity == 2 ){
+        SRB2_config = (*SRB_configList)->list.array[i];
+      } else if ((*SRB_configList)->list.array[i]->srb_Identity == 1 ){
+        SRB1_config = (*SRB_configList)->list.array[i];
+      }
+    }
+  }
+
+  if (SRB1_config == NULL) {
+    // default SRB1 configuration
+    LOG_W(RRC,"SRB1 configuration does not exist in SRB configuration list, use default\n");
+    /// SRB1
+    SRB1_config = CALLOC(1, sizeof(*SRB1_config));
+
+    SRB1_config->srb_Identity = 1;
+    SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config));
+    SRB1_config->rlc_Config   = SRB1_rlc_config;
+
+    SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
+    SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am;
+  #if defined(ENABLE_ITTI)
+    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit;
+    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = rrc->srb1_poll_pdu;
+    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = rrc->srb1_poll_byte;
+    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold;
+    SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = rrc->srb1_timer_reordering;
+    SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit;
+  #else
+    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20;;
+    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = PollPDU_p4;;
+    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = PollByte_kBinfinity;
+    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
+    SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = T_Reordering_ms35;
+    SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0;
+  #endif
+
+    SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config));
+    SRB1_config->logicalChannelConfig = SRB1_lchan_config;
+
+    SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
+    SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters));
+
+    SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters;
+    SRB1_ul_SpecificParameters->priority = 1;
+
+    //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity);
+    SRB1_ul_SpecificParameters->prioritisedBitRate=LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+
+    //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50);
+    SRB1_ul_SpecificParameters->bucketSizeDuration=LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+    logicalchannelgroup = CALLOC(1, sizeof(long));
+    *logicalchannelgroup = 0;
+    SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
+  }
+
+  if (SRB2_config == NULL) {
+    LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n");
+  } else {
+    ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
+  }
+
+  if (*SRB_configList) {
+    free(*SRB_configList);
+  }
+
+  *SRB_configList = CALLOC(1, sizeof(SRB_ToAddModList_t));
+
+  ASN_SEQUENCE_ADD(&(*SRB_configList)->list,SRB1_config);
+
+  physicalConfigDedicated2 = *physicalConfigDedicated;
+
+  rrcConnectionReestablishment->rrc_TransactionIdentifier = Transaction_id;
+  rrcConnectionReestablishment->criticalExtensions.present = RRCConnectionReestablishment__criticalExtensions_PR_c1;
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.present = RRCConnectionReestablishment__criticalExtensions__c1_PR_rrcConnectionReestablishment_r8;
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.srb_ToAddModList = *SRB_configList;
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.drb_ToAddModList = NULL;
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.drb_ToReleaseList = NULL;
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.sps_Config = NULL;
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.physicalConfigDedicated = physicalConfigDedicated2;
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.mac_MainConfig = NULL;
+
+  uint8_t KeNB_star[32] = { 0 };
+  uint16_t pci = rrc->carrier[CC_id].physCellId;
+  uint32_t earfcn_dl = (uint32_t)freq_to_arfcn10(RC.mac[ctxt_pP->module_id]->common_channels[CC_id].eutra_band,
+                  rrc->carrier[CC_id].dl_CarrierFreq);
+  bool     is_rel8_only = true;
+  if (earfcn_dl > 65535) {
+    is_rel8_only = false;
+  }
+
+  LOG_D(RRC, "pci=%d, eutra_band=%d, downlink_frequency=%d, earfcn_dl=%u, is_rel8_only=%s\n",
+      pci,
+      RC.mac[ctxt_pP->module_id]->common_channels[CC_id].eutra_band,
+      rrc->carrier[CC_id].dl_CarrierFreq,
+      earfcn_dl,
+      is_rel8_only == true ? "true": "false");
+#if defined(ENABLE_SECURITY)
+  if (ue_context_pP->ue_context.nh_ncc >= 0) {
+    derive_keNB_star(ue_context_pP->ue_context.nh, pci, earfcn_dl, is_rel8_only, KeNB_star);
+    rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = ue_context_pP->ue_context.nh_ncc;
+  } else { // first HO 
+    derive_keNB_star (ue_context_pP->ue_context.kenb, pci, earfcn_dl, is_rel8_only, KeNB_star);
+    // LG: really 1
+    rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = 0;
+  }
+
+  // copy KeNB_star to ue_context_pP->ue_context.kenb
+  memcpy (ue_context_pP->ue_context.kenb, KeNB_star, 32);
+  ue_context_pP->ue_context.kenb_ncc = 0;
+#else
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = 0;
+#endif
+
+  rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nonCriticalExtension = NULL;
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
+                                   (void*)&dl_ccch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"RRCConnectionReestablishment Encoded %zd bits (%zd bytes)\n",
+        enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
 
   return((enc_rval.encoded+7)/8);
 }
@@ -2014,10 +2191,8 @@ do_RRCConnectionReestablishmentReject(
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %d bits (%d bytes)\n",
+  LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n",
         enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
 
   return((enc_rval.encoded+7)/8);
 }
@@ -2075,10 +2250,8 @@ do_RRCConnectionReject(
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"RRCConnectionReject Encoded %d bits (%d bytes)\n",
+  LOG_D(RRC,"RRCConnectionReject Encoded %zd bits (%zd bytes)\n",
         enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
 
   return((enc_rval.encoded+7)/8);
 }
@@ -2266,9 +2439,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
 # endif
 #endif
 
-#ifdef USER_MODE
-  LOG_D(RRC,"[eNB] MCCH Message Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
+  LOG_D(RRC,"[eNB] MCCH Message Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
 
   if (enc_rval.encoded==-1) {
     msg("[RRC] ASN1 : MCCH  encoding failed for MBSFNAreaConfiguration\n");
@@ -2400,9 +2571,7 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
 # endif
 #endif
 
-#ifdef USER_MODE
   printf("Measurement Report Encoded %zu bits (%zu bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
 
   return((enc_rval.encoded+7)/8);
 }
@@ -2451,6 +2620,73 @@ uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t trans
   return encoded;
 }
 
+uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_paging_identity, cn_domain_t cn_domain)
+{
+  LOG_D(RRC, "[eNB %d] do_Paging start\n", Mod_id);
+  asn_enc_rval_t enc_rval;
+
+  PCCH_Message_t pcch_msg;
+  PagingRecord_t *paging_record_p;
+  int j;
+
+  pcch_msg.message.present           = PCCH_MessageType_PR_c1;
+  pcch_msg.message.choice.c1.present = PCCH_MessageType__c1_PR_paging;
+
+  pcch_msg.message.choice.c1.choice.paging.pagingRecordList = CALLOC(1,sizeof(*pcch_msg.message.choice.c1.choice.paging.pagingRecordList));
+
+  pcch_msg.message.choice.c1.choice.paging.systemInfoModification = NULL;
+  pcch_msg.message.choice.c1.choice.paging.etws_Indication = NULL;
+  pcch_msg.message.choice.c1.choice.paging.nonCriticalExtension = NULL;
+
+  asn_set_empty(&pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list);
+  pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count = 0;
+
+  if ((paging_record_p = calloc(1, sizeof(PagingRecord_t))) == NULL) {
+    /* Possible error on calloc */
+    return (-1);
+  }
+
+  memset(paging_record_p, 0, sizeof(PagingRecord_t));
+
+  /* convert ue_paging_identity_t to PagingUE_Identity_t */
+  if (ue_paging_identity.presenceMask == UE_PAGING_IDENTITY_s_tmsi) {
+    paging_record_p->ue_Identity.present = PagingUE_Identity_PR_s_TMSI;
+    MME_CODE_TO_OCTET_STRING(ue_paging_identity.choice.s_tmsi.mme_code,
+                             &paging_record_p->ue_Identity.choice.s_TMSI.mmec);
+    paging_record_p->ue_Identity.choice.s_TMSI.mmec.bits_unused = 0;
+    M_TMSI_TO_OCTET_STRING(ue_paging_identity.choice.s_tmsi.m_tmsi,
+                             &paging_record_p->ue_Identity.choice.s_TMSI.m_TMSI);
+    paging_record_p->ue_Identity.choice.s_TMSI.m_TMSI.bits_unused = 0;
+  } else if (ue_paging_identity.presenceMask == UE_PAGING_IDENTITY_imsi) {
+    IMSI_Digit_t imsi_digit[21];
+    for (j = 0; j< ue_paging_identity.choice.imsi.length; j++) {  /* IMSI size */
+      imsi_digit[j] = (IMSI_Digit_t)ue_paging_identity.choice.imsi.buffer[j];
+      ASN_SEQUENCE_ADD(&paging_record_p->ue_Identity.choice.imsi.list, &imsi_digit[j]);
+    }
+  }
+
+  /* set cn_domain */
+  if (cn_domain == CN_DOMAIN_PS) {
+    paging_record_p->cn_Domain = PagingRecord__cn_Domain_ps;
+  } else {
+    paging_record_p->cn_Domain = PagingRecord__cn_Domain_cs;
+  }
+  /* add to list */
+  ASN_SEQUENCE_ADD(&pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list, paging_record_p);
+  LOG_D(RRC, "[eNB %d] do_Paging paging_record: cn_Domain %ld, ue_paging_identity.presenceMask %d, PagingRecordList.count %d\n",
+          Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count);
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, (void*)&pcch_msg, buffer, RRC_BUF_SIZE);
+
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_PCCH_Message, (void*)&pcch_msg);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
 uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer)
 {
   ssize_t encoded;
@@ -2490,7 +2726,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
   char UE_EUTRA_Capability_xer[8192];
   size_t size;
 
-  LOG_I(RRC,"Allocating %u bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability));
+  LOG_I(RRC,"Allocating %zu bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability));
 
   UE_EUTRA_Capability = CALLOC(1, sizeof(*UE_EUTRA_Capability));
 
@@ -2577,18 +2813,17 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
     // UE_EUTRA_Capability->measParameters.bandListEUTRA.list.count                         = 0;  // no measurements on other bands
     // UE_EUTRA_Capability->featureGroupIndicators  // null
 
-    // featureGroup is mandatory for CMW tests
-    // featureGroup is filled only for usim-test mode
-    BIT_STRING_t *bit_string;
-    uint32_t     featrG;
-    bit_string = CALLOC(1, sizeof(*bit_string));
-    featrG     = 0x04000800;
     if(usim_test == 1)
     {
-        bit_string->buf         = &featrG;
-        bit_string->size        = 4;
-        bit_string->bits_unused = 0;
-        UE_EUTRA_Capability->featureGroupIndicators = bit_string;
+      // featureGroup is mandatory for CMW tests
+      // featureGroup is filled only for usim-test mode
+      BIT_STRING_t *bit_string = CALLOC(1, sizeof(*bit_string));
+      char featrG[4]           = { 0x00, 0x08, 0x00, 0x04 };
+      bit_string->buf          = CALLOC(1, 4);
+      memcpy(bit_string->buf, featrG, 4);
+      bit_string->size         = 4;
+      bit_string->bits_unused  = 0;
+      UE_EUTRA_Capability->featureGroupIndicators = bit_string;
     }
 
     // UE_EUTRA_Capability->interRAT_Parameters     // null
@@ -2649,7 +2884,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
 #endif
 
   UECapability.sdu_size = (enc_rval.encoded + 7) / 8;
-  LOG_I(PHY, "[RRC]UE Capability encoded, %d bytes (%d bits)\n",
+  LOG_I(PHY, "[RRC]UE Capability encoded, %d bytes (%zd bits)\n",
         UECapability.sdu_size, enc_rval.encoded + 7);
   {
     char *sdu;
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.h b/openair2/RRC/LITE/MESSAGES/asn1_msg.h
index 0e03ff92747d5868cb749d0af0d1a878ebc97f1b..05396bf727961b03a8278f00ddbbf606da6bd629 100644
--- a/openair2/RRC/LITE/MESSAGES/asn1_msg.h
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,7 +28,6 @@
 * \email: raymond.knopp@eurecom.fr and  navid.nikaein@eurecom.fr
 */
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <sys/types.h>
 #include <stdlib.h> /* for atoi(3) */
@@ -36,9 +35,6 @@
 #include <string.h> /* for strerror(3) */
 #include <sysexits.h> /* for EX_* exit codes */
 #include <errno.h>  /* for errno */
-#else
-#include <linux/module.h>  /* Needed by all modules */
-#endif
 
 #include <asn_application.h>
 #include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
@@ -195,6 +191,28 @@ do_RRCConnectionReconfiguration(
     , SCellToAddMod_r10_t  *SCell_config
 #endif
                                         );
+/**
+\brief Generate an RRCConnectionReestablishment DL-CCCH-Message (eNB).  This routine configures SRB_ToAddMod (SRB1/SRB2) and
+PhysicalConfigDedicated IEs.  The latter does not enable periodic CQI reporting (PUCCH format 2/2a/2b) or SRS.
+@param ctxt_pP Running context
+@param ue_context_pP UE context
+@param CC_id         Component Carrier ID
+@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
+@param transmission_mode Transmission mode for UE (1-9)
+@param Transaction_id Transaction_ID for this message
+@param SRB_configList Pointer (returned) to SRB1_config/SRB2_config(later) IEs for this UE
+@param physicalConfigDedicated Pointer (returned) to PhysicalConfigDedicated IE for this UE
+@returns Size of encoded bit stream in bytes*/
+uint8_t
+do_RRCConnectionReestablishment(
+  const protocol_ctxt_t*     const ctxt_pP,
+  rrc_eNB_ue_context_t*      const ue_context_pP,
+  int                              CC_id,
+  uint8_t*                   const buffer,
+  const uint8_t                    transmission_mode,
+  const uint8_t                    Transaction_id,
+  SRB_ToAddModList_t               **SRB_configList,
+  struct PhysicalConfigDedicated   **physicalConfigDedicated);
 
 /**
 \brief Generate an RRCConnectionReestablishmentReject DL-CCCH-Message (eNB).
@@ -249,6 +267,8 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
 
 uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer);
 
+uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_paging_identity, cn_domain_t cn_domain);
+
 uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer);
 
 OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer);
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c
new file mode 100644
index 0000000000000000000000000000000000000000..43721bbfd55f0ee6d03f2c90e618dcf92571e63d
--- /dev/null
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c
@@ -0,0 +1,1417 @@
+/* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file asn1_msg.c
+* \brief primitives to build the asn1 messages
+* \author Raymond Knopp, Navid Nikaein and Michele Paffetti
+* \date 2011, 2017
+* \version 1.0
+* \company Eurecom
+* \email: raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr, michele.paffetti@studio.unibo.it
+*/
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdlib.h> /* for atoi(3) */
+#include <unistd.h> /* for getopt(3) */
+#include <string.h> /* for strerror(3) */
+#include <sysexits.h> /* for EX_* exit codes */
+#include <errno.h>  /* for errno */
+#include "UTIL/LOG/log.h"
+#include <asn_application.h>
+#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
+#include <per_encoder.h>
+#include "asn1_msg.h"
+
+
+
+//#include for NB-IoT-------------------
+#include "RRCConnectionRequest-NB.h"
+#include "BCCH-DL-SCH-Message-NB.h"
+#include "UL-CCCH-Message-NB.h"
+#include "UL-DCCH-Message-NB.h"
+#include "DL-CCCH-Message-NB.h"
+#include "DL-DCCH-Message-NB.h"
+#include "EstablishmentCause-NB-r13.h"
+#include "RRCConnectionSetup-NB.h"
+#include "SRB-ToAddModList-NB-r13.h"
+#include "DRB-ToAddModList-NB-r13.h"
+#include "RRC/LITE/defs_NB_IoT.h"
+#include "RRCConnectionSetupComplete-NB.h"
+#include "RRCConnectionReconfigurationComplete-NB.h"
+#include "RRCConnectionReconfiguration-NB.h"
+#include "MasterInformationBlock-NB.h"
+#include "SystemInformation-NB.h"
+#include "SystemInformationBlockType1.h"
+#include "SIB-Type-NB-r13.h"
+#include "RRCConnectionResume-NB.h"
+#include "RRCConnectionReestablishment-NB.h"
+#include "../defs_NB_IoT.h"
+//----------------------------------------
+
+//#include "PHY/defs.h"
+#include "enb_config.h"
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+#endif
+
+
+
+
+/*do_MIB_NB_NB_IoT*/
+uint8_t do_MIB_NB_IoT(
+		rrc_eNB_carrier_data_NB_IoT_t *carrier,
+		uint16_t N_RB_DL,//may not needed--> for NB_IoT only 1 PRB is used
+		uint32_t frame,
+    uint32_t hyper_frame)
+{
+  asn_enc_rval_t enc_rval;
+  BCCH_BCH_Message_NB_t *mib_NB_IoT = &(carrier->mib_NB_IoT);
+
+  /*
+   * systemFrameNumber-MSB: (TS 36.331 pag 576)
+   * define the 4 MSB of the SFN (10 bits). The last significant 6 bits will be acquired implicitly by decoding the NPBCH
+   * NOTE: 6 LSB will be used for counting the 64 radio frames in the TTI period (640 ms) that is exactly the MIB period
+   *
+   * hyperSFN-LSB:
+   * indicates the 2 least significant bits of the HSFN. The remaining 8 bits are present in SIB1-NB
+   * NOTE: with the 2 bits we count the 4 HSFN (is 1 SIB1-Nb modification period) while the other 6 count the number of modification periods
+   *
+   *
+   * NOTE: in OAI never modify the SIB messages!!??
+   */
+
+  //XXX check if correct the bit assignment
+  uint8_t sfn_MSB = (uint8_t)((frame>>6) & 0x0f); // all the 4 bits are set to 1
+  uint8_t hsfn_LSB = (uint8_t)(hyper_frame & 0x03); //2 bits set to 1 (0x3 = 0011)
+  uint16_t spare=0; //11 bits --> use uint16
+
+  mib_NB_IoT->message.systemFrameNumber_MSB_r13.buf = &sfn_MSB;
+  mib_NB_IoT->message.systemFrameNumber_MSB_r13.size = 1; //if expressed in byte
+  mib_NB_IoT->message.systemFrameNumber_MSB_r13.bits_unused = 4; //is byte based (so how many bits you don't use of the 8 bits of a bite
+
+  mib_NB_IoT->message.hyperSFN_LSB_r13.buf= &hsfn_LSB;
+  mib_NB_IoT->message.hyperSFN_LSB_r13.size= 1;
+  mib_NB_IoT->message.hyperSFN_LSB_r13.bits_unused = 6;
+
+  //XXX to be set??
+  mib_NB_IoT->message.spare.buf = (uint8_t *)&spare;
+  mib_NB_IoT->message.spare.size = 2;
+  mib_NB_IoT->message.spare.bits_unused = 5;
+
+  //decide how to set it
+  mib_NB_IoT->message.schedulingInfoSIB1_r13 =11; //see TS 36.213-->tables 16.4.1.3-3 ecc...
+  mib_NB_IoT->message.systemInfoValueTag_r13= 0;
+  mib_NB_IoT->message.ab_Enabled_r13 = 0;
+
+  //to be decided
+  mib_NB_IoT->message.operationModeInfo_r13.present = MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13;
+  mib_NB_IoT->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13 = 0;
+
+  printf("[MIB] Initialization of frame information,sfn_MSB %x, hsfn_LSB %x\n",
+         (uint32_t)sfn_MSB,
+		 (uint32_t)hsfn_LSB);
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message_NB,
+                                   (void*)mib_NB_IoT,
+                                   carrier->MIB_NB_IoT,
+                                   100);
+  if(enc_rval.encoded <= 0) {
+      LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+  }
+
+  if (enc_rval.encoded==-1) {
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+
+}
+
+/*do_SIB1_NB*/
+uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
+				rrc_eNB_carrier_data_NB_IoT_t *carrier,
+                NbIoTRrcConfigurationReq *configuration,
+				uint32_t frame
+               )
+{
+  BCCH_DL_SCH_Message_NB_t *bcch_message= &(carrier->siblock1_NB_IoT);
+  SystemInformationBlockType1_NB_t **sib1_NB_IoT= &(carrier->sib1_NB_IoT);
+  
+
+  asn_enc_rval_t enc_rval;
+
+  PLMN_IdentityInfo_NB_r13_t PLMN_identity_info_NB_IoT;
+  MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3];
+  SchedulingInfo_NB_r13_t *schedulingInfo_NB_IoT;
+  SIB_Type_NB_r13_t *sib_type_NB_IoT;
+
+
+  long* attachWithoutPDN_Connectivity = NULL;
+  attachWithoutPDN_Connectivity = CALLOC(1,sizeof(long));
+  long *nrs_CRS_PowerOffset=NULL;
+  nrs_CRS_PowerOffset = CALLOC(1, sizeof(long));
+  long *eutraControlRegionSize=NULL; //this parameter should be set only if we are considering in-band operating mode (samePCI or differentPCI)
+   eutraControlRegionSize = CALLOC(1,sizeof(long));
+  long systemInfoValueTagSI = 0;
+
+  memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_NB_t));
+  bcch_message->message.present = BCCH_DL_SCH_MessageType_NB_PR_c1;
+  bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformationBlockType1_r13;
+
+  //allocation
+  *sib1_NB_IoT = &bcch_message->message.choice.c1.choice.systemInformationBlockType1_r13;
+
+
+  /*TS 36.331 v14.2.0 pag 589
+   * hyperSFN-MSB
+   * Indicates the 8 most significant bits of the hyper-SFN. Together with the hyper-LSB in MIB-NB the complete HSFN is build up
+   */
+  //FIXME see if correct
+  uint8_t hyperSFN_MSB = (uint8_t) ((frame>>2)& 0xff);
+
+  //XXX to be checked
+  (*sib1_NB_IoT)->hyperSFN_MSB_r13.buf = &hyperSFN_MSB;
+  (*sib1_NB_IoT)->hyperSFN_MSB_r13.size = 1;
+  (*sib1_NB_IoT)->hyperSFN_MSB_r13.bits_unused = 0;
+
+  memset(&PLMN_identity_info_NB_IoT,0,sizeof(PLMN_IdentityInfo_NB_r13_t));
+
+  PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc = CALLOC(1,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc));
+  memset(PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc,0,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc));
+
+  asn_set_empty(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list);//.size=0;
+
+  //left as it is???
+#if defined(ENABLE_ITTI)
+  dummy_mcc[0] = (configuration->mcc / 100) % 10;
+  dummy_mcc[1] = (configuration->mcc / 10) % 10;
+  dummy_mcc[2] = (configuration->mcc / 1) % 10;
+#else
+  dummy_mcc[0] = 0;
+  dummy_mcc[1] = 0;
+  dummy_mcc[2] = 1;
+#endif
+  ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[0]);
+  ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[1]);
+  ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[2]);
+
+  PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.size=0;
+  PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.count=0;
+
+
+#if defined(ENABLE_ITTI)
+
+  if (configuration->mnc >= 100) {
+    dummy_mnc[0] = (configuration->mnc / 100) % 10;
+    dummy_mnc[1] = (configuration->mnc / 10) % 10;
+    dummy_mnc[2] = (configuration->mnc / 1) % 10;
+  } else {
+    if (configuration->mnc_digit_length == 2) {
+      dummy_mnc[0] = (configuration->mnc / 10) % 10;
+      dummy_mnc[1] = (configuration->mnc / 1) % 10;
+      dummy_mnc[2] = 0xf;
+    } else {
+      dummy_mnc[0] = (configuration->mnc / 100) % 100;
+      dummy_mnc[1] = (configuration->mnc / 10) % 10;
+      dummy_mnc[2] = (configuration->mnc / 1) % 10;
+    }
+  }
+
+#else
+  dummy_mnc[0] = 0;
+  dummy_mnc[1] = 1;
+  dummy_mnc[2] = 0xf;
+#endif
+  ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list,&dummy_mnc[0]);
+  ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list,&dummy_mnc[1]);
+
+  if (dummy_mnc[2] != 0xf) {
+    ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list,&dummy_mnc[2]);
+  }
+
+  //still set to "notReserved" as in the previous case
+  PLMN_identity_info_NB_IoT.cellReservedForOperatorUse_r13=PLMN_IdentityInfo_NB_r13__cellReservedForOperatorUse_r13_notReserved;
+
+  *attachWithoutPDN_Connectivity = 0;
+  PLMN_identity_info_NB_IoT.attachWithoutPDN_Connectivity_r13 = attachWithoutPDN_Connectivity;
+
+  ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.plmn_IdentityList_r13.list,&PLMN_identity_info_NB_IoT);
+
+  // 16 bits = 2 byte
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf = MALLOC(2); //MALLOC works in byte
+
+  //lefts as it is?
+#if defined(ENABLE_ITTI)
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = (configuration->tac >> 8) & 0xff;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = (configuration->tac >> 0) & 0xff;
+#else
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = 0x00;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = 0x01;
+#endif
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.size=2;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.bits_unused=0;
+
+  // 28 bits --> i have to use 32 bits = 4 byte
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf = MALLOC(8); // why allocate 8 byte?
+#if defined(ENABLE_ITTI)
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = (configuration->cell_identity >> 20) & 0xff;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = (configuration->cell_identity >> 12) & 0xff;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = (configuration->cell_identity >>  4) & 0xff;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = (configuration->cell_identity <<  4) & 0xf0;
+#else
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = 0x00;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = 0x00;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = 0x00;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = 0x10;
+#endif
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.size=4;
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.bits_unused=4;
+
+  //Still set to "notBarred" as in the previous case
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellBarred_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__cellBarred_r13_notBarred;
+
+  //Still Set to "notAllowed" like in the previous case
+  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.intraFreqReselection_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__intraFreqReselection_r13_notAllowed;
+
+
+  (*sib1_NB_IoT)->cellSelectionInfo_r13.q_RxLevMin_r13=-65; //which value?? TS 36.331 V14.2.1 pag. 589
+  (*sib1_NB_IoT)->cellSelectionInfo_r13.q_QualMin_r13 = 0; //FIXME new parameter for SIB1-NB, not present in SIB1 (for cell reselection but if not used the UE should apply the default value)
+
+  (*sib1_NB_IoT)->p_Max_r13 = CALLOC(1, sizeof(P_Max_t));
+  *((*sib1_NB_IoT)->p_Max_r13) = 23;
+
+  //FIXME
+  (*sib1_NB_IoT)->freqBandIndicator_r13 =
+#if defined(ENABLE_ITTI)
+    configuration->eutra_band;
+#else
+    5; //if not configured we use band 5 (UL: 824 MHz - 849MHz / DL: 869 MHz - 894 MHz  FDD mode)
+#endif
+
+    //OPTIONAL new parameters, to be used?
+      /*
+       * freqBandInfo_r13
+       * multiBandInfoList_r13
+       * nrs_CRS_PowerOffset_r13
+       * sib1_NB_IoT->downlinkBitmap_r13.choice.subframePattern10_r13 =(is a BIT_STRING)
+       */
+
+
+   (*sib1_NB_IoT)->downlinkBitmap_r13 = CALLOC(1, sizeof(struct DL_Bitmap_NB_r13));
+   ((*sib1_NB_IoT)->downlinkBitmap_r13)->present= DL_Bitmap_NB_r13_PR_NOTHING;
+
+   *eutraControlRegionSize = 1;
+   (*sib1_NB_IoT)->eutraControlRegionSize_r13 = eutraControlRegionSize;
+
+
+   *nrs_CRS_PowerOffset= 0;
+   (*sib1_NB_IoT)->nrs_CRS_PowerOffset_r13 = nrs_CRS_PowerOffset;
+
+   schedulingInfo_NB_IoT = (SchedulingInfo_NB_r13_t*) malloc (3*sizeof(SchedulingInfo_NB_r13_t));
+   sib_type_NB_IoT = (SIB_Type_NB_r13_t *) malloc (3*sizeof(SIB_Type_NB_r13_t));
+
+  memset(&schedulingInfo_NB_IoT[0],0,sizeof(SchedulingInfo_NB_r13_t));
+  memset(&schedulingInfo_NB_IoT[1],0,sizeof(SchedulingInfo_NB_r13_t));
+  memset(&schedulingInfo_NB_IoT[2],0,sizeof(SchedulingInfo_NB_r13_t));    
+  memset(&sib_type_NB_IoT[0],0,sizeof(SIB_Type_NB_r13_t));
+  memset(&sib_type_NB_IoT[1],0,sizeof(SIB_Type_NB_r13_t));
+  memset(&sib_type_NB_IoT[2],0,sizeof(SIB_Type_NB_r13_t));
+
+
+  // Now, follow the scheduler SIB configuration
+  // There is only one sib2+sib3 common setting
+  schedulingInfo_NB_IoT[0].si_Periodicity_r13=SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096;
+  schedulingInfo_NB_IoT[0].si_RepetitionPattern_r13=SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF; //This Indicates the starting radio frames within the SI window used for SI message transmission.
+  schedulingInfo_NB_IoT[0].si_TB_r13= SchedulingInfo_NB_r13__si_TB_r13_b680;//208 bits
+  
+
+  // This is for SIB2/3
+  /*SIB3 --> There is no mapping information of SIB2 since it is always present
+    *  in the first SystemInformation message
+    * listed in the schedulingInfoList list.
+    * */
+  sib_type_NB_IoT[0]=SIB_Type_NB_r13_sibType3_NB_r13;
+
+  ASN_SEQUENCE_ADD(&schedulingInfo_NB_IoT[0].sib_MappingInfo_r13.list,&sib_type_NB_IoT[0]);
+  ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->schedulingInfoList_r13.list,&schedulingInfo_NB_IoT[0]);
+
+  //printf("[ASN Debug] SI P: %ld\n",(*sib1_NB_IoT)->schedulingInfoList_r13.list.array[0]->si_Periodicity_r13);
+
+#if defined(ENABLE_ITTI)
+
+  if (configuration->frame_type == TDD)
+#endif
+  {
+	//FIXME in NB-IoT mandatory to be FDD --> so must give an error
+	  LOG_E(RRC,"[NB-IoT %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct?
+	  exit(-1);
+  }
+
+  //FIXME which value chose for the following parameter
+  (*sib1_NB_IoT)->si_WindowLength_r13=SystemInformationBlockType1_NB__si_WindowLength_r13_ms160;
+  (*sib1_NB_IoT)->si_RadioFrameOffset_r13= 0;
+
+  /*In Nb-IoT change/update of specific SI message can additionally be indicated by a SI message specific value tag
+   * systemInfoValueTagSI (there is no SystemInfoValueTag in SIB1-NB but only in MIB-NB)
+   *contained in systemInfoValueTagList_r13
+   **/
+  //FIXME correct?
+  (*sib1_NB_IoT)->systemInfoValueTagList_r13 = CALLOC(1, sizeof(struct SystemInfoValueTagList_NB_r13));
+  asn_set_empty(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list);
+  ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list,&systemInfoValueTagSI);
+
+
+#ifdef XER_PRINT //generate xml files
+  xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
+#endif
+
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB,
+                                   (void*)bcch_message,
+                                   carrier->SIB1_NB_IoT,
+                                   100);
+
+  if (enc_rval.encoded > 0){ 
+       LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+  }
+
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[NB-IoT] SystemInformationBlockType1-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+}
+
+/*SIB23_NB_IoT*/
+//to be clarified is it is possible to carry SIB2 and SIB3  in the same SI message for NB-IoT?
+uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
+                        int CC_id,
+                        rrc_eNB_carrier_data_NB_IoT_t *carrier,//MP: this is already a carrier[CC_id]
+                        NbIoTRrcConfigurationReq *configuration ) //openair2/COMMON/rrc_messages_types.h
+{
+  struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib2_NB_part;
+  struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib3_NB_part;
+
+  BCCH_DL_SCH_Message_NB_t *bcch_message = &(carrier->systemInformation_NB_IoT); //is the systeminformation-->BCCH_DL_SCH_Message_NB
+  SystemInformationBlockType2_NB_r13_t *sib2_NB_IoT;
+  SystemInformationBlockType3_NB_r13_t *sib3_NB_IoT;
+
+  asn_enc_rval_t enc_rval;
+  RACH_Info_NB_r13_t rach_Info_NB_IoT;
+  NPRACH_Parameters_NB_r13_t *nprach_parameters;
+
+  //optional
+  long *connEstFailOffset = NULL;
+  connEstFailOffset = CALLOC(1, sizeof(long));
+
+//  RSRP_ThresholdsNPRACH_InfoList_NB_r13_t *rsrp_ThresholdsPrachInfoList;
+//  RSRP_Range_t rsrp_range;
+
+  ACK_NACK_NumRepetitions_NB_r13_t ack_nack_repetition;
+  struct NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13 *dmrs_config;
+  struct DL_GapConfig_NB_r13	*dl_Gap;
+
+  long *srs_SubframeConfig;
+  srs_SubframeConfig= CALLOC(1, sizeof(long));
+
+
+  if (bcch_message) {
+    memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_NB_t));
+  } else {
+    LOG_E(RRC,"[NB-IoT %d] BCCH_MESSAGE_NB is null, exiting\n", Mod_id);
+    exit(-1);
+  }
+
+  //before schould be allocated memory somewhere?
+//  if (!carrier->sib2_NB_IoT) {
+//    LOG_E(RRC,"[NB-IoT %d] sib2_NB_IoT is null, exiting\n", Mod_id);
+//    exit(-1);
+//  }
+//
+//  if (!carrier->sib3_NB_IoT) {
+//    LOG_E(RRC,"[NB-IoT %d] sib3_NB_IoT is null, exiting\n", Mod_id);
+//    exit(-1);
+//  }
+
+
+  LOG_I(RRC,"[NB-IoT %d] Configuration SIB2/3\n", Mod_id);
+
+  sib2_NB_part = CALLOC(1,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
+  sib3_NB_part = CALLOC(1,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
+  memset(sib2_NB_part,0,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
+  memset(sib3_NB_part,0,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
+
+  sib2_NB_part->present = SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib2_r13;
+  sib3_NB_part->present = SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib3_r13;
+
+  //may bug if not correct allocation of memory
+  carrier->sib2_NB_IoT = &sib2_NB_part->choice.sib2_r13;
+  carrier->sib3_NB_IoT = &sib3_NB_part->choice.sib3_r13;
+  sib2_NB_IoT = carrier->sib2_NB_IoT;
+  sib3_NB_IoT = carrier->sib3_NB_IoT;
+
+  nprach_parameters = (NPRACH_Parameters_NB_r13_t *) malloc (3*sizeof(NPRACH_Parameters_NB_r13_t));
+
+  memset(&nprach_parameters[0],0,sizeof(NPRACH_Parameters_NB_r13_t));
+  memset(&nprach_parameters[1],0,sizeof(NPRACH_Parameters_NB_r13_t));
+  memset(&nprach_parameters[2],0,sizeof(NPRACH_Parameters_NB_r13_t));
+
+/// SIB2-NB-----------------------------------------
+
+  //Barring is manage by ab-Enabled in MIB-NB (but is not a struct as ac-BarringInfo in LTE legacy)
+
+  //RACH Config. Common--------------------------------------------------------------
+  sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.preambleTransMax_CE_r13 =
+   		  configuration->rach_preambleTransMax_CE_NB;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.powerRampingParameters_r13.powerRampingStep =
+	configuration->rach_powerRampingStep_NB;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.powerRampingParameters_r13.preambleInitialReceivedTargetPower =
+    configuration->rach_preambleInitialReceivedTargetPower_NB;
+
+  rach_Info_NB_IoT.ra_ResponseWindowSize_r13 = configuration->rach_raResponseWindowSize_NB;
+  rach_Info_NB_IoT.mac_ContentionResolutionTimer_r13 = configuration-> rach_macContentionResolutionTimer_NB;
+  //rach_infoList max size = maxNPRACH-Resources-NB-r13 = 3
+  ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.rach_InfoList_r13.list,&rach_Info_NB_IoT);
+
+  //TS 36.331 pag 614 --> if not present the value to infinity sould be used
+  *connEstFailOffset = 0;
+  
+  sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.connEstFailOffset_r13 = connEstFailOffset; /*OPTIONAL*/
+
+
+  // BCCH-Config-NB-IoT----------------------------------------------------------------
+  sib2_NB_IoT->radioResourceConfigCommon_r13.bcch_Config_r13.modificationPeriodCoeff_r13
+    = configuration->bcch_modificationPeriodCoeff_NB;
+
+  // PCCH-Config-NB-IoT-----------------------------------------------------------------
+  sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.defaultPagingCycle_r13
+    = configuration->pcch_defaultPagingCycle_NB;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.nB_r13 = configuration->pcch_nB_NB;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.npdcch_NumRepetitionPaging_r13 = configuration-> pcch_npdcch_NumRepetitionPaging_NB;
+
+  //NPRACH-Config-NB-IoT-----------------------------------------------------------------
+
+  sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13 = NULL; 
+  sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_CP_Length_r13 = configuration->nprach_CP_Length;
+  /*OPTIONAL*/
+//   =CALLOC(1, sizeof(struct RSRP_ThresholdsNPRACH_InfoList_NB_r13)); //fatto uguale dopo
+//   rsrp_ThresholdsPrachInfoList = sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13;
+//   rsrp_range = configuration->nprach_rsrp_range_NB;
+//   ASN_SEQUENCE_ADD(&rsrp_ThresholdsPrachInfoList->list,rsrp_range);
+
+  // According configuration to set the 3 CE level configuration setting
+
+  nprach_parameters[0].nprach_Periodicity_r13               = configuration->nprach_Periodicity[0];
+  nprach_parameters[0].nprach_StartTime_r13                 = configuration->nprach_StartTime[0];
+  nprach_parameters[0].nprach_SubcarrierOffset_r13          = configuration->nprach_SubcarrierOffset[0];
+  nprach_parameters[0].nprach_NumSubcarriers_r13            = configuration->nprach_NumSubcarriers[0];
+  nprach_parameters[0].numRepetitionsPerPreambleAttempt_r13 = configuration->numRepetitionsPerPreambleAttempt_NB[0];
+  nprach_parameters[0].nprach_SubcarrierMSG3_RangeStart_r13 = configuration->nprach_SubcarrierMSG3_RangeStart;
+  nprach_parameters[0].maxNumPreambleAttemptCE_r13          = configuration->maxNumPreambleAttemptCE_NB;
+  nprach_parameters[0].npdcch_NumRepetitions_RA_r13         = configuration->npdcch_NumRepetitions_RA[0];
+  nprach_parameters[0].npdcch_StartSF_CSS_RA_r13            = configuration->npdcch_StartSF_CSS_RA[0];
+  nprach_parameters[0].npdcch_Offset_RA_r13                 = configuration->npdcch_Offset_RA[0];
+
+  nprach_parameters[1].nprach_Periodicity_r13               = configuration->nprach_Periodicity[1];
+  nprach_parameters[1].nprach_StartTime_r13                 = configuration->nprach_StartTime[1];
+  nprach_parameters[1].nprach_SubcarrierOffset_r13          = configuration->nprach_SubcarrierOffset[1];
+  nprach_parameters[1].nprach_NumSubcarriers_r13            = configuration->nprach_NumSubcarriers[1];
+  nprach_parameters[1].numRepetitionsPerPreambleAttempt_r13 = configuration->numRepetitionsPerPreambleAttempt_NB[1];
+  nprach_parameters[1].nprach_SubcarrierMSG3_RangeStart_r13 = configuration->nprach_SubcarrierMSG3_RangeStart;
+  nprach_parameters[1].maxNumPreambleAttemptCE_r13          = configuration->maxNumPreambleAttemptCE_NB;
+  nprach_parameters[1].npdcch_NumRepetitions_RA_r13         = configuration->npdcch_NumRepetitions_RA[1];
+  nprach_parameters[1].npdcch_StartSF_CSS_RA_r13            = configuration->npdcch_StartSF_CSS_RA[1];
+  nprach_parameters[1].npdcch_Offset_RA_r13                 = configuration->npdcch_Offset_RA[1];
+
+  nprach_parameters[2].nprach_Periodicity_r13               = configuration->nprach_Periodicity[2];
+  nprach_parameters[2].nprach_StartTime_r13                 = configuration->nprach_StartTime[2];
+  nprach_parameters[2].nprach_SubcarrierOffset_r13          = configuration->nprach_SubcarrierOffset[2];
+  nprach_parameters[2].nprach_NumSubcarriers_r13            = configuration->nprach_NumSubcarriers[2];
+  nprach_parameters[2].numRepetitionsPerPreambleAttempt_r13 = configuration->numRepetitionsPerPreambleAttempt_NB[2];
+  nprach_parameters[2].nprach_SubcarrierMSG3_RangeStart_r13 = configuration->nprach_SubcarrierMSG3_RangeStart;
+  nprach_parameters[2].maxNumPreambleAttemptCE_r13          = configuration->maxNumPreambleAttemptCE_NB;
+  nprach_parameters[2].npdcch_NumRepetitions_RA_r13         = configuration->npdcch_NumRepetitions_RA[2];
+  nprach_parameters[2].npdcch_StartSF_CSS_RA_r13            = configuration->npdcch_StartSF_CSS_RA[2];
+  nprach_parameters[2].npdcch_Offset_RA_r13                 = configuration->npdcch_Offset_RA[2];
+
+
+  //nprach_parameterList have a max size of 3 possible nprach configuration (see maxNPRACH_Resources_NB_r13)
+  ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[0]);
+  ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[1]);
+  ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[2]);
+  
+  // NPDSCH-Config NB-IOT
+  sib2_NB_IoT->radioResourceConfigCommon_r13.npdsch_ConfigCommon_r13.nrs_Power_r13= configuration->npdsch_nrs_Power;
+
+
+  //NPUSCH-Config NB-IoT----------------------------------------------------------------
+  //list of size 3 (see maxNPRACH_Resources_NB_r13)
+  ack_nack_repetition = configuration-> npusch_ack_nack_numRepetitions_NB; //is an enumerative
+  ASN_SEQUENCE_ADD(&(sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list) ,&ack_nack_repetition);
+
+  *srs_SubframeConfig = configuration->npusch_srs_SubframeConfig_NB;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.srs_SubframeConfig_r13= srs_SubframeConfig; /*OPTIONAL*/
+
+
+  /*OPTIONAL*/
+  dmrs_config = CALLOC(1,sizeof(struct NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13));
+  dmrs_config->threeTone_CyclicShift_r13 = configuration->npusch_threeTone_CyclicShift_r13;
+  dmrs_config->sixTone_CyclicShift_r13 = configuration->npusch_sixTone_CyclicShift_r13;
+
+  /*OPTIONAL
+   * -define the base sequence for a DMRS sequence in a cell with multi tone transmission (3,6,12) see TS 36.331 NPUSCH-Config-NB
+   * -if not defined will be calculated based on the cellID once we configure the phy layer (rrc_mac_config_req) through the config_sib2 */
+  dmrs_config->threeTone_BaseSequence_r13 = NULL;
+  dmrs_config->sixTone_BaseSequence_r13 = NULL;
+  dmrs_config->twelveTone_BaseSequence_r13 = NULL;
+
+  sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.dmrs_Config_r13 = dmrs_config;
+
+  //ulReferenceSignalsNPUSCH
+  /*Reference Signal (RS) for UL in NB-IoT is called DRS (Demodulation Reference Signal)
+   * sequence-group hopping can be enabled or disabled by means of the cell-specific parameter groupHoppingEnabled_r13
+   * sequence-group hopping can be disabled for certain specific UE through the parameter groupHoppingDisabled (physicalConfigDedicated)
+   * groupAssignmentNPUSCH--> is used for generate the sequence-shift pattern
+   */
+  sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13= configuration->npusch_groupHoppingEnabled;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13 =configuration->npusch_groupAssignmentNPUSCH_r13;
+
+
+  //dl_GAP---------------------------------------------------------------------------------/*OPTIONAL*/
+  dl_Gap = CALLOC(1,sizeof(struct DL_GapConfig_NB_r13));
+  dl_Gap->dl_GapDurationCoeff_r13= configuration-> dl_GapDurationCoeff_NB;
+  dl_Gap->dl_GapPeriodicity_r13= configuration->dl_GapPeriodicity_NB;
+  dl_Gap->dl_GapThreshold_r13= configuration->dl_GapThreshold_NB;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.dl_Gap_r13 = dl_Gap;
+
+
+  // uplinkPowerControlCommon - NB-IoT------------------------------------------------------
+  sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13 = configuration->npusch_p0_NominalNPUSCH;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13 = configuration->deltaPreambleMsg3;
+  sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.alpha_r13 = configuration->npusch_alpha;
+  //no deltaFlist_PUCCH and no UL cyclic prefix
+
+  // UE Timers and Constants -NB-IoT--------------------------------------------------------
+  sib2_NB_IoT->ue_TimersAndConstants_r13.t300_r13 = configuration-> ue_TimersAndConstants_t300_NB;
+  sib2_NB_IoT->ue_TimersAndConstants_r13.t301_r13 = configuration-> ue_TimersAndConstants_t301_NB;
+  sib2_NB_IoT->ue_TimersAndConstants_r13.t310_r13 = configuration-> ue_TimersAndConstants_t310_NB;
+  sib2_NB_IoT->ue_TimersAndConstants_r13.t311_r13 = configuration-> ue_TimersAndConstants_t311_NB;
+  sib2_NB_IoT->ue_TimersAndConstants_r13.n310_r13 = configuration-> ue_TimersAndConstants_n310_NB;
+  sib2_NB_IoT->ue_TimersAndConstants_r13.n311_r13 = configuration-> ue_TimersAndConstants_n311_NB;
+
+  //other SIB2-NB Parameters--------------------------------------------------------------------------------
+  sib2_NB_IoT->freqInfo_r13.additionalSpectrumEmission_r13 = 1;
+  sib2_NB_IoT->freqInfo_r13.ul_CarrierFreq_r13 = NULL; /*OPTIONAL*/
+
+  sib2_NB_IoT->timeAlignmentTimerCommon_r13=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120;
+
+  /*OPTIONAL*/
+  sib2_NB_IoT->multiBandInfoList_r13 = NULL;
+
+/// SIB3-NB-------------------------------------------------------
+
+  sib3_NB_IoT->cellReselectionInfoCommon_r13.q_Hyst_r13=SystemInformationBlockType3_NB_r13__cellReselectionInfoCommon_r13__q_Hyst_r13_dB4;
+  sib3_NB_IoT->cellReselectionServingFreqInfo_r13.s_NonIntraSearch_r13=0; //or define in configuration?
+
+  sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_RxLevMin_r13 = -70;
+  //new
+  sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13 = CALLOC(1,sizeof(*sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13));
+  *(sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13)= 10; //a caso
+
+  sib3_NB_IoT->intraFreqCellReselectionInfo_r13.p_Max_r13 = NULL;
+  sib3_NB_IoT->intraFreqCellReselectionInfo_r13.s_IntraSearchP_r13 = 31; // s_intraSearch --> s_intraSearchP!!! (they call in a different way)
+  sib3_NB_IoT->intraFreqCellReselectionInfo_r13.t_Reselection_r13=1;
+
+  //how to manage?
+  sib3_NB_IoT->freqBandInfo_r13 = NULL;
+  sib3_NB_IoT->multiBandInfoList_r13 = NULL;
+
+
+///BCCH message (generate the SI message)
+  bcch_message->message.present = BCCH_DL_SCH_MessageType_NB_PR_c1;
+  bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformation_r13;
+
+  bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.present = SystemInformation_NB__criticalExtensions_PR_systemInformation_r13;
+  bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list.count=0;
+
+  ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list,
+                   sib2_NB_part);
+  ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list,
+                   sib3_NB_part);
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB,
+                                   (void*)bcch_message,
+                                   carrier->SIB23_NB_IoT,
+                                   900);
+//  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+//               enc_rval.failed_type->name, enc_rval.encoded);
+
+//#if defined(ENABLE_ITTI).....
+
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[NB-IoT] SystemInformation-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    msg("[RRC] ASN1 : SI-NB encoding failed for SIB23_NB_IoT\n");
+    return(-1);
+  }
+
+  carrier->sib2_NB_IoT = sib2_NB_IoT;
+  carrier->sib3_NB_IoT = sib3_NB_IoT;
+
+  return((enc_rval.encoded+7)/8);
+}
+
+/*do_RRCConnectionSetup_NB_IoT--> the aim is to establish SRB1 and SRB1bis(implicitly)*/
+uint8_t do_RRCConnectionSetup_NB_IoT(
+  const protocol_ctxt_t*     const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*      const ue_context_pP,
+  int                              CC_id,
+  uint8_t*                   const buffer, //Srb0.Tx_buffer.Payload
+  const uint8_t                    Transaction_id,
+  const NB_IoT_DL_FRAME_PARMS* const frame_parms, // maybe not used
+  SRB_ToAddModList_NB_r13_t**             SRB_configList_NB_IoT, //for both SRB1bis and SRB1
+  struct PhysicalConfigDedicated_NB_r13** physicalConfigDedicated_NB_IoT
+)
+
+{
+
+ asn_enc_rval_t enc_rval;
+
+
+ //MP:logical channel group not defined for Nb-IoT
+
+ //MP: logical channel priority pag 605 (is 1 for SRB1 and for SRB1bis should be the same)
+ //long* prioritySRB1 = NULL;
+ long* prioritySRB1bis = NULL;
+ BOOLEAN_t* logicalChannelSR_Prohibit =NULL; //pag 605
+ BOOLEAN_t* npusch_AllSymbols= NULL;
+
+// struct SRB_ToAddMod_NB_r13* SRB1_config_NB = NULL;
+// struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1_rlc_config_NB = NULL;
+// struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1_lchan_config_NB = NULL;
+
+ struct SRB_ToAddMod_NB_r13* SRB1bis_config_NB_IoT = NULL;
+ struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1bis_rlc_config_NB_IoT = NULL;
+ struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1bis_lchan_config_NB_IoT = NULL;
+
+ //No UL_specific parameters for NB-IoT in LogicalChanelConfig-NB
+
+ PhysicalConfigDedicated_NB_r13_t* physicalConfigDedicated2_NB_IoT = NULL;
+ DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
+ RRCConnectionSetup_NB_t* rrcConnectionSetup_NB_IoT = NULL;
+
+ memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t));
+ dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1;
+ dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionSetup_r13;
+ rrcConnectionSetup_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionSetup_r13;
+
+
+ if (*SRB_configList_NB_IoT) {
+   free(*SRB_configList_NB_IoT);
+ }
+ *SRB_configList_NB_IoT = CALLOC(1,sizeof(SRB_ToAddModList_NB_r13_t));
+
+/// SRB1--------------------
+ {
+// SRB1_config_NB = CALLOC(1,sizeof(*SRB1_config_NB));
+//
+// //no srb_Identity in SRB_ToAddMod_NB
+//
+// SRB1_rlc_config_NB = CALLOC(1,sizeof(*SRB1_rlc_config_NB));
+// SRB1_config_NB->rlc_Config_r13   = SRB1_rlc_config_NB;
+//
+// SRB1_rlc_config_NB->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue;
+// SRB1_rlc_config_NB->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//the only possible in NB_IoT
+//
+//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_timer_poll_retransmit_r13;
+//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_max_retx_threshold_r13;
+//// //(musT be disabled--> SRB1 config pag 640 specs )
+//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL;
+//
+//
+// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000;
+// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8;
+// //(musT be disabled--> SRB1 config pag 640 specs )
+// SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 = NULL;
+//
+// SRB1_lchan_config_NB = CALLOC(1,sizeof(*SRB1_lchan_config_NB));
+// SRB1_config_NB->logicalChannelConfig_r13  = SRB1_lchan_config_NB;
+//
+// SRB1_lchan_config_NB->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue;
+//
+//
+// prioritySRB1 = CALLOC(1, sizeof(long));
+// *prioritySRB1 = 1;
+// SRB1_lchan_config_NB->choice.explicitValue.priority_r13 = prioritySRB1;
+//
+// logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t));
+// *logicalChannelSR_Prohibit = 1;
+// //schould be set to TRUE (specs pag 641)
+// SRB1_lchan_config_NB->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;
+//
+// //ADD SRB1
+// ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1_config_NB);
+ }
+
+///SRB1bis (The configuration for SRB1 and SRB1bis is the same) the only difference is the logical channel identity = 3 but not set here
+
+		 SRB1bis_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_config_NB_IoT));
+
+		 //no srb_Identity in SRB_ToAddMod_NB
+		 SRB1bis_rlc_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_rlc_config_NB_IoT));
+		 SRB1bis_config_NB_IoT->rlc_Config_r13   = SRB1bis_rlc_config_NB_IoT;
+
+		 SRB1bis_rlc_config_NB_IoT->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue;
+		 SRB1bis_rlc_config_NB_IoT->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//MP: the only possible RLC config in NB_IoT
+
+		 SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000;
+		 SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8;
+		 //(musT be disabled--> SRB1 config pag 640 specs )
+		 SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL;
+
+		 SRB1bis_lchan_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_lchan_config_NB_IoT));
+		 SRB1bis_config_NB_IoT->logicalChannelConfig_r13  = SRB1bis_lchan_config_NB_IoT;
+
+		 SRB1bis_lchan_config_NB_IoT->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue;
+
+		 prioritySRB1bis = CALLOC(1, sizeof(long));
+		 *prioritySRB1bis = 1; //same as SRB1?
+		 SRB1bis_lchan_config_NB_IoT->choice.explicitValue.priority_r13 = prioritySRB1bis;
+
+		 logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t));
+		 *logicalChannelSR_Prohibit = 1; //schould be set to TRUE (specs pag 641)
+		 SRB1bis_lchan_config_NB_IoT->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;
+
+		 //ADD SRB1bis
+		 //MP: Actually there is no way to distinguish SRB1 and SRB1bis once put in the list
+		 //MP: SRB_ToAddModList_NB_r13_t size = 1
+		 ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1bis_config_NB_IoT);
+
+
+ // PhysicalConfigDedicated (NPDCCH, NPUSCH, CarrierConfig, UplinkPowerControl)
+
+ physicalConfigDedicated2_NB_IoT = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT));
+ *physicalConfigDedicated_NB_IoT = physicalConfigDedicated2_NB_IoT;
+
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13= CALLOC(1, sizeof(*physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13));
+ physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13));
+ physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13));
+ physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13));
+
+ //no tpc, no cqi and no pucch, no pdsch, no soundingRS, no AntennaInfo, no scheduling request config
+
+ /*
+  * NB-IoT supports the operation with either one or two antenna ports, AP0 and AP1.
+  * For the latter case, Space Frequency Block Coding (SFBC) is applied.
+  * Once selected, the same transmission scheme applies to NPBCH, NPDCCH, and NPDSCH.
+  * */
+
+ //FIXME: MP: CarrierConfigDedicated check the set values ----------------------------------------------
+
+  //DL
+
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_CarrierFreq_r13.carrierFreq_r13=0;//random value set
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13= CALLOC(1,sizeof(struct DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13));
+		 physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13->present=
+				 	 	 	 	 	 	 	 	 DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13_PR_useNoBitmap_r13;
+
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13 = CALLOC(1,sizeof(struct DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13));
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13->present =
+		  	  	  	  	  	  	  	  	  	  	  DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13_PR_useNoGap_r13;
+
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.inbandCarrierInfo_r13= NULL;
+
+  //UL
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->ul_CarrierConfig_r13.ul_CarrierFreq_r13= NULL;
+
+ // NPDCCH
+ physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13 =0;
+ physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13 =0;
+ physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13=0;
+
+ // NPUSCH //(specs TS 36.331 v14.2.1 pag 643) /* OPTIONAL */
+ physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->ack_NACK_NumRepetitions_r13= NULL;
+ npusch_AllSymbols= CALLOC(1, sizeof(BOOLEAN_t));
+ *npusch_AllSymbols= 1; //TRUE
+ physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->npusch_AllSymbols_r13= npusch_AllSymbols; /* OPTIONAL */
+ physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->groupHoppingDisabled_r13=NULL; /* OPTIONAL */
+
+ // UplinkPowerControlDedicated
+ physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13->p0_UE_NPUSCH_r13 = 0; // 0 dB (specs TS36.331 v14.2.1 pag 643)
+
+
+ //Fill the rrcConnectionSetup-NB message
+ rrcConnectionSetup_NB_IoT->rrc_TransactionIdentifier = Transaction_id; //input value
+ rrcConnectionSetup_NB_IoT->criticalExtensions.present = RRCConnectionSetup_NB__criticalExtensions_PR_c1;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.present =RRCConnectionSetup_NB__criticalExtensions__c1_PR_rrcConnectionSetup_r13 ;
+ //MP: carry only SRB1bis at the moment and phyConfigDedicated
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = *SRB_configList_NB_IoT;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13 = NULL;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = physicalConfigDedicated2_NB_IoT;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13 = NULL;
+
+#ifdef XER_PRINT
+ xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+#endif
+ enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
+                                  (void*)&dl_ccch_msg_NB_IoT,
+                                  buffer,
+                                  100);
+
+ if (enc_rval.encoded <= 0) {
+     LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
+              enc_rval.failed_type->name, enc_rval.encoded);
+ }
+
+#ifdef USER_MODE
+ LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes), ecause %d\n",
+       enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
+#endif
+
+ return((enc_rval.encoded+7)/8);
+}
+
+/*do_SecurityModeCommand - exactly the same as previous implementation*/
+uint8_t do_SecurityModeCommand_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  uint8_t* const buffer,
+  const uint8_t Transaction_id,
+  const uint8_t cipheringAlgorithm,
+  const uint8_t integrityProtAlgorithm)
+{
+  DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
+  asn_enc_rval_t enc_rval;
+
+  memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t));
+
+  dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1;
+  dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_securityModeCommand_r13;
+
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.rrc_TransactionIdentifier = Transaction_id;
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1;
+
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.present =
+		  SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8;
+
+  // the two following information could be based on the mod_id
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm
+    = (CipheringAlgorithm_r12_t)cipheringAlgorithm; //bug solved
+
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm
+    = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm;
+
+//only changed "asn_DEF_DL_DCCH_Message_NB"
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
+                                   (void*)&dl_dcch_msg_NB_IoT,
+                                   buffer,
+                                   100);
+  if (enc_rval.encoded <= 0) {
+      LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+  }
+
+
+//#if defined(ENABLE_ITTI)
+//# if !defined(DISABLE_XER_SPRINT)....
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[NB-IoT %d] securityModeCommand-NB for UE %x Encoded %zd bits (%zd bytes)\n",
+        ctxt_pP->module_id,
+        ctxt_pP->rnti,
+        enc_rval.encoded,
+        (enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    LOG_E(RRC,"[NB-IoT %d] ASN1 : securityModeCommand-NB encoding failed for UE %x\n",
+          ctxt_pP->module_id,
+          ctxt_pP->rnti);
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+}
+
+/*do_UECapabilityEnquiry_NB_IoT - very similar to legacy lte*/
+uint8_t do_UECapabilityEnquiry_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  uint8_t*               const buffer,
+  const uint8_t                Transaction_id
+)
+
+{
+
+  DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
+  //no RAT type in NB-IoT
+  asn_enc_rval_t enc_rval;
+
+  memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t));
+
+  dl_dcch_msg_NB_IoT.message.present           = DL_DCCH_MessageType_NB_PR_c1;
+  dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_ueCapabilityEnquiry_r13;
+
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.rrc_TransactionIdentifier = Transaction_id;
+
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.present = UECapabilityEnquiry_NB__criticalExtensions_PR_c1;
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.choice.c1.present =
+		  UECapabilityEnquiry_NB__criticalExtensions__c1_PR_ueCapabilityEnquiry_r13;
+
+  //no ue_CapabilityRequest (list of RAT_Type)
+
+//only changed "asn_DEF_DL_DCCH_Message_NB"
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
+                                   (void*)&dl_dcch_msg_NB_IoT,
+                                   buffer,
+                                   100);
+  if (enc_rval.encoded <= 0) {
+     LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+    }
+
+//#if defined(ENABLE_ITTI)
+//# if !defined(DISABLE_XER_SPRINT)....
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[NB-IoT %d] UECapabilityEnquiry-NB for UE %x Encoded %zd bits (%zd bytes)\n",
+        ctxt_pP->module_id,
+        ctxt_pP->rnti,
+        enc_rval.encoded,
+        (enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    LOG_E(RRC,"[NB-IoT %d] ASN1 : UECapabilityEnquiry-NB encoding failed for UE %x\n",
+          ctxt_pP->module_id,
+          ctxt_pP->rnti);
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+}
+
+/*do_RRCConnectionReconfiguration_NB_IoT-->may convey information for resource configuration
+ * (including RBs, MAC main configuration and physical channel configuration)
+ * including any associated dedicated NAS information.*/
+uint16_t do_RRCConnectionReconfiguration_NB_IoT(
+  const protocol_ctxt_t*        const ctxt_pP,
+    uint8_t                            *buffer,
+    uint8_t                             Transaction_id,
+    SRB_ToAddModList_NB_r13_t          *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1
+    DRB_ToAddModList_NB_r13_t          *DRB_list_NB_IoT, //DRB_ConfigList (default)
+    DRB_ToReleaseList_NB_r13_t         *DRB_list2_NB_IoT, //is NULL when passed
+    struct PhysicalConfigDedicated_NB_r13     *physicalConfigDedicated_NB_IoT,
+	MAC_MainConfig_NB_r13_t                   *mac_MainConfig_NB_IoT,
+  struct RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13* dedicatedInfoNASList_NB_IoT)
+
+{
+
+ //check on DRB_list if contains more than 2 DRB?
+
+  asn_enc_rval_t enc_rval;
+  DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
+  RRCConnectionReconfiguration_NB_t *rrcConnectionReconfiguration_NB;
+
+
+  memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t));
+
+  dl_dcch_msg_NB_IoT.message.present           = DL_DCCH_MessageType_NB_PR_c1;
+  dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_rrcConnectionReconfiguration_r13;
+  rrcConnectionReconfiguration_NB          = &dl_dcch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReconfiguration_r13;
+
+  // RRCConnectionReconfiguration
+  rrcConnectionReconfiguration_NB->rrc_TransactionIdentifier = Transaction_id;
+  rrcConnectionReconfiguration_NB->criticalExtensions.present = RRCConnectionReconfiguration_NB__criticalExtensions_PR_c1;
+  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.present =RRCConnectionReconfiguration_NB__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r13 ;
+
+  //RAdioResourceconfigDedicated
+  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13 =
+		  CALLOC(1,sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13));
+  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->srb_ToAddModList_r13 = SRB1_list_NB; //only SRB1
+  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToAddModList_r13 = DRB_list_NB_IoT;
+  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToReleaseList_r13 = DRB_list2_NB_IoT; //NULL
+  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->physicalConfigDedicated_r13 = physicalConfigDedicated_NB_IoT;
+  //FIXME may not used now
+  //rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->rlf_TimersAndConstants_r13
+
+  if (mac_MainConfig_NB_IoT!=NULL) {
+    rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13 =
+    		CALLOC(1, sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13));
+    rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13->present
+      =RadioResourceConfigDedicated_NB_r13__mac_MainConfig_r13_PR_explicitValue_r13;
+   //why memcopy only this one?
+    memcpy(&rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13->choice.explicitValue_r13,
+           mac_MainConfig_NB_IoT, sizeof(*mac_MainConfig_NB_IoT));
+
+  } else {
+	  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13=NULL;
+  }
+
+  //no measConfig, measIDlist
+  //no mobilityControlInfo
+
+  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.dedicatedInfoNASList_r13 = dedicatedInfoNASList_NB_IoT;
+  //mainly used for cell-reselection/handover purposes??
+  rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.fullConfig_r13 = NULL;
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
+                                   (void*)&dl_dcch_msg_NB_IoT,
+                                   buffer,
+                                   RRC_BUF_SIZE);
+  if (enc_rval.encoded <= 0) {
+     LOG_F(RRC, "ASN1 message encoding failed %s, %li\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+  }
+
+  //changed only asn_DEF_DL_DCCH_Message_NB
+#ifdef XER_PRINT
+  xer_fprint(stdout,&asn_DEF_DL_DCCH_Message_NB,(void*)&dl_dcch_msg_NB_IoT);
+#endif
+
+//#if defined(ENABLE_ITTI)
+//# if !defined(DISABLE_XER_SPRINT)...
+
+
+  LOG_I(RRC,"RRCConnectionReconfiguration-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+
+  return((enc_rval.encoded+7)/8);
+}
+
+/*do_RRCConnectionReestablishmentReject - exactly the same as legacy LTE*/
+uint8_t do_RRCConnectionReestablishmentReject_NB_IoT(
+    uint8_t                    Mod_id,
+    uint8_t*                   const buffer)
+{
+
+  asn_enc_rval_t enc_rval;
+
+  DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
+  RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject;
+
+  memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t));
+  dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1;
+  dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishmentReject_r13;
+  rrcConnectionReestablishmentReject    = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishmentReject_r13;
+
+  // RRCConnectionReestablishmentReject //exactly the same as LTE
+  rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8;
+
+  //Only change in "asn_DEF_DL_CCCH_Message_NB"
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
+                                   (void*)&dl_ccch_msg_NB_IoT,
+                                   buffer,
+                                   100);
+  if (enc_rval.encoded <= 0) {
+     LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+  }
+
+  //Only change in "asn_DEF_DL_CCCH_Message_NB"
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n",
+        enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
+/*do_RRCConnectionReject_NB_IoT*/
+uint8_t do_RRCConnectionReject_NB_IoT(
+    uint8_t                    Mod_id,
+    uint8_t*                   const buffer)
+
+{
+
+  asn_enc_rval_t enc_rval;
+
+  DL_CCCH_Message_NB_t          dl_ccch_msg_NB_IoT;
+  RRCConnectionReject_NB_t      *rrcConnectionReject_NB_IoT;
+
+  memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t));
+  dl_ccch_msg_NB_IoT.message.present           = DL_CCCH_MessageType_NB_PR_c1;
+  dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReject_r13;
+  rrcConnectionReject_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReject_r13;
+
+  // RRCConnectionReject-NB_IoT
+  rrcConnectionReject_NB_IoT->criticalExtensions.present = RRCConnectionReject_NB__criticalExtensions_PR_c1;
+  rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.present = RRCConnectionReject_NB__criticalExtensions__c1_PR_rrcConnectionReject_r13;
+  /* let's put an extended wait time of 1s for the moment */
+  rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.extendedWaitTime_r13 = 1;
+  //new-use of suspend indication
+  //If present, this field indicates that the UE should remain suspended and not release its stored context.
+  rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.rrc_SuspendIndication_r13=
+		  CALLOC(1, sizeof(long));
+  *(rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.rrc_SuspendIndication_r13)=
+		  RRCConnectionReject_NB_r13_IEs__rrc_SuspendIndication_r13_true;
+
+  //Only Modified "asn_DEF_DL_CCCH_Message_NB"
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
+                                   (void*)&dl_ccch_msg_NB_IoT,
+                                   buffer,
+                                   100);
+  if (enc_rval.encoded <= 0) {
+     LOG_F(RRC, "ASN1 message encoding failed (%s, %ld)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+  }
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"RRCConnectionReject-NB Encoded %zd bits (%zd bytes)\n",
+        enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
+
+//no do_MBSFNAreaConfig(..) in NB-IoT
+//no do_MeasurementReport(..) in NB-IoT
+
+/*do_DLInformationTransfer_NB*/
+uint8_t do_DLInformationTransfer_NB_IoT(
+		uint8_t Mod_id,
+		uint8_t **buffer,
+		uint8_t transaction_id,
+		uint32_t pdu_length,
+		uint8_t *pdu_buffer)
+
+{
+  ssize_t encoded;
+
+  DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
+
+  memset(&dl_dcch_msg_NB_IoT, 0, sizeof(DL_DCCH_Message_NB_t));
+
+  dl_dcch_msg_NB_IoT.message.present           = DL_DCCH_MessageType_NB_PR_c1;
+  dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_dlInformationTransfer_r13;
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.rrc_TransactionIdentifier = transaction_id;
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.present = DLInformationTransfer_NB__criticalExtensions_PR_c1;
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.present = DLInformationTransfer_NB__criticalExtensions__c1_PR_dlInformationTransfer_r13;
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.size = pdu_length;
+  dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.buf = pdu_buffer;
+
+  encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message_NB, NULL, (void*) &dl_dcch_msg_NB_IoT, (void **) buffer);
+
+  //only change in "asn_DEF_DL_DCCH_Message_NB"
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[10000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+  return encoded;
+}
+
+/*do_ULInformationTransfer*/
+//for the moment is not needed (UE-SIDE)
+
+/*OAI_UECapability_t *fill_ue_capability*/
+
+/*do_RRCConnectionReestablishment_NB-->used to re-establish SRB1*/ //which parameter to use?
+uint8_t do_RRCConnectionReestablishment_NB_IoT(
+		uint8_t Mod_id,
+		uint8_t* const buffer,
+		const uint8_t     Transaction_id,
+		const NB_IoT_DL_FRAME_PARMS* const frame_parms, //to be changed
+		SRB_ToAddModList_NB_r13_t*      SRB_list_NB_IoT) //should contain SRB1 already configured?
+{
+
+	asn_enc_rval_t enc_rval;
+	DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
+	RRCConnectionReestablishment_NB_t* rrcConnectionReestablishment_NB_IoT;
+
+	memset(&dl_ccch_msg_NB_IoT, 0, sizeof(DL_CCCH_Message_NB_t));
+
+	dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1;
+	dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishment_r13;
+	rrcConnectionReestablishment_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishment_r13;
+
+	//rrcConnectionReestablishment_NB
+	rrcConnectionReestablishment_NB_IoT->rrc_TransactionIdentifier = Transaction_id;
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.present = RRCConnectionReestablishment_NB__criticalExtensions_PR_c1;
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.present = RRCConnectionReestablishment_NB__criticalExtensions__c1_PR_rrcConnectionReestablishment_r13;
+
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = SRB_list_NB_IoT;
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL;
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL;
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13= NULL;
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13= NULL;
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = NULL;
+
+	rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.nextHopChainingCount_r13=0;
+
+	enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
+	                                   (void*)&dl_ccch_msg_NB_IoT,
+	                                   buffer,
+	                                   RRC_BUF_SIZE);
+
+	if (enc_rval.encoded <= 0) {
+           LOG_F(RRC, "ASN1 message encoding failed (%s, %li)!\n",
+	               enc_rval.failed_type->name, enc_rval.encoded);
+        }
+
+#ifdef XER_PRINT
+  xer_fprint(stdout,&asn_DEF_DL_CCCH_Message_NB,(void*)&dl_ccch_msg_NB_IoT);
+#endif
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[30000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+  LOG_I(RRC,"RRCConnectionReestablishment-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+  return 0;
+}
+
+/*do_RRCConnectionRelease_NB--> is used to command the release of an RRC connection*/
+uint8_t do_RRCConnectionRelease_NB_IoT(
+  uint8_t                             Mod_id,
+  uint8_t                            *buffer,
+ const uint8_t                             Transaction_id)
+{
+
+  asn_enc_rval_t enc_rval;
+
+  DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
+  RRCConnectionRelease_NB_t *rrcConnectionRelease_NB_IoT;
+
+
+  memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t));
+
+  dl_dcch_msg_NB_IoT.message.present           = DL_DCCH_MessageType_NB_PR_c1;
+  dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_rrcConnectionRelease_r13;
+  rrcConnectionRelease_NB_IoT                  = &dl_dcch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionRelease_r13;
+
+  // RRCConnectionRelease
+  rrcConnectionRelease_NB_IoT->rrc_TransactionIdentifier = Transaction_id;
+  rrcConnectionRelease_NB_IoT->criticalExtensions.present = RRCConnectionRelease_NB__criticalExtensions_PR_c1;
+  rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.present =RRCConnectionRelease_NB__criticalExtensions__c1_PR_rrcConnectionRelease_r13 ;
+
+  rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.releaseCause_r13 = ReleaseCause_NB_r13_other;
+  rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.redirectedCarrierInfo_r13 = NULL;
+  rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.extendedWaitTime_r13 = NULL;
+
+  //Why allocate memory for non critical extension?
+  rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension=CALLOC(1,
+      sizeof(*rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension));
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
+                                   (void*)&dl_dcch_msg_NB_IoT,
+                                   buffer,
+                                   RRC_BUF_SIZE);//check
+
+  return((enc_rval.encoded+7)/8);
+}
+
+
+
+
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h b/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fb073f80de30638aad1208c52a0af79edc42250
--- /dev/null
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h
@@ -0,0 +1,293 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file asn1_msg.h
+* \brief primitives to build the asn1 messages
+* \author Raymond Knopp, Navid Nikaein and Michele Paffetti
+* \date 2011, 2017
+* \version 1.0
+* \company Eurecom
+* \email: raymond.knopp@eurecom.fr ,navid.nikaein@eurecom.fr, michele.paffetti@studio.unibo.it
+*/
+
+#ifdef USER_MODE
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdlib.h> /* for atoi(3) */
+#include <unistd.h> /* for getopt(3) */
+#include <string.h> /* for strerror(3) */
+#include <sysexits.h> /* for EX_* exit codes */
+#include <errno.h>  /* for errno */
+#else
+#include <linux/module.h>  /* Needed by all modules */
+#endif
+
+#include <asn_application.h>
+#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
+
+
+#include "RRC/LITE/defs_NB_IoT.h"
+
+/*
+ * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
+ * output into the chosen string buffer.
+ * RETURN VALUES:
+ *       0: The structure is printed.
+ *      -1: Problem printing the structure.
+ * WARNING: No sensible error value is returned.
+ */
+
+
+/**
+\brief Generate configuration for SIB1 (eNB).
+@param carrier pointer to Carrier information
+@param N_RB_DL Number of downlink PRBs
+@param frame radio frame number
+@return size of encoded bit stream in bytes*/
+uint8_t do_MIB_NB_IoT(
+		rrc_eNB_carrier_data_NB_IoT_t *carrier,
+		uint32_t N_RB_DL,
+		uint32_t frame,
+    uint32_t hyper_frame);
+
+
+/**
+\brief Generate a default configuration for SIB1-NB (eNB).
+@param Mod_id Instance of eNB
+@param CC_id Component carrier to configure
+@param carrier pointer to Carrier information
+@param configuration Pointer Configuration Request structure
+@return size of encoded bit stream in bytes*/
+
+uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, 
+                       int CC_id,
+				               rrc_eNB_carrier_data_NB_IoT_t *carrier,
+                       NbIoTRrcConfigurationReq *configuration,
+				               uint32_t frame
+                      );
+
+/**
+\brief Generate a default configuration for SIB2/SIB3-NB in one System Information PDU (eNB).
+@param Mod_id Index of eNB (used to derive some parameters)
+@param buffer Pointer to PER-encoded ASN.1 description of SI-NB PDU
+@param systemInformation_NB_IoT Pointer to asn1c C representation of SI-NB PDU
+@param sib2_NB Pointer (returned) to sib2_NB component withing SI-NB PDU
+@param sib3_NB Pointer (returned) to sib3_NB component withing SI-NB PDU
+@return size of encoded bit stream in bytes*/
+
+uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
+                        int CC_id,
+                        rrc_eNB_carrier_data_NB_IoT_t *carrier,
+                        NbIoTRrcConfigurationReq *configuration
+                        );
+
+/**(UE-SIDE)
+\brief Generate an RRCConnectionRequest-NB UL-CCCH-Message (UE) based on random string or S-TMSI.  This
+routine only generates an mo-data establishment cause.
+@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
+@param rv 5 byte random string or S-TMSI
+@param Mod_id
+@returns Size of encoded bit stream in bytes*/
+
+uint8_t do_RRCConnectionRequest_NB_IoT(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv);
+
+
+/**(UE -SIDE)
+\brief Generate an RRCConnectionSetupComplete-NB UL-DCCH-Message (UE)
+@param Mod_id
+@param Transaction_id
+@param dedicatedInfoNASLength
+@param dedicatedInfoNAS
+@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
+@returns Size of encoded bit stream in bytes*/
+
+uint8_t do_RRCConnectionSetupComplete_NB_IoT(uint8_t Mod_id, uint8_t* buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength,
+                                             const char* dedicatedInfoNAS);
+
+/** (UE-SIDE)
+\brief Generate an RRCConnectionReconfigurationComplete-NB UL-DCCH-Message (UE)
+@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
+@param ctxt_pP
+@param Transaction_id
+@returns Size of encoded bit stream in bytes*/
+
+uint8_t do_RRCConnectionReconfigurationComplete_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  uint8_t* buffer,
+  const uint8_t Transaction_id
+);
+
+/**
+\brief Generate an RRCConnectionSetup-NB DL-CCCH-Message (eNB).  This routine configures SRB_ToAddMod (SRB1/SRB1bis-NB) and
+PhysicalConfigDedicated-NB IEs.
+@param ctxt_pP Running context
+@param ue_context_pP UE context
+@param CC_id         Component Carrier ID
+@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
+@param transmission_mode Transmission mode for UE (1-9)
+@param UE_id UE index for this message
+@param Transaction_id Transaction_ID for this message
+@param SRB_configList Pointer (returned) to SRB1_config/SRB1bis_config(later) IEs for this UE
+@param physicalConfigDedicated_NB Pointer (returned) to PhysicalConfigDedicated-NB IE for this UE
+@returns Size of encoded bit stream in bytes*/
+
+uint8_t do_RRCConnectionSetup_NB_IoT(
+  const protocol_ctxt_t*     const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*      const ue_context_pP,
+  int                              CC_id,
+  uint8_t*                   const buffer, //carrier[CC_id].Srb0.Tx_buffer.Payload
+  const uint8_t                    Transaction_id,
+  const NB_IoT_DL_FRAME_PARMS* const frame_parms, //to be changed but not deleted
+  SRB_ToAddModList_NB_r13_t**             SRB_configList_NB_IoT, //in order to be configured--> stanno puntando alla SRB_configlist dell ue_context
+  struct PhysicalConfigDedicated_NB_r13** physicalConfigDedicated_NB_IoT //in order to be configured--> stanno puntando alla physicalConfigDedicated dell ue_context
+);
+
+
+/**
+ * For which SRB is used in NB-IoT??
+\brief Generate an RRCConnectionReconfiguration-NB DL-DCCH-Message (eNB).  This routine configures SRBToAddMod-NB (SRB1) and one DRBToAddMod-NB
+(DRB3).  PhysicalConfigDedicated-NB is not updated.
+@param ctxt_pP Running context
+@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
+@param Transaction_id Transaction_ID for this message
+@param SRB_list_NB Pointer to SRB List to be added/modified (NULL if no additions/modifications)
+@param DRB_list_NB Pointer to DRB List to be added/modified (NULL if no additions/modifications)
+@param DRB_list2_NB Pointer to DRB List to be released      (NULL if none to be released)
+//sps not supported by NB-IoT
+@param physicalConfigDedicated_NB Pointer to PhysicalConfigDedicated-NB to be modified (NULL if no modifications)
+//measurement not supported by NB-IoT
+@param mac_MainConfig Pointer to Mac_MainConfig(NULL if no modifications)
+//no CBA functionalities
+@returns Size of encoded bit stream in bytes*/
+
+uint16_t
+do_RRCConnectionReconfiguration_NB_IoT(
+  const protocol_ctxt_t*        const ctxt_pP,
+    uint8_t                            *buffer,
+    uint8_t                             Transaction_id,
+    SRB_ToAddModList_NB_r13_t          *SRB_list_NB_IoT,
+    DRB_ToAddModList_NB_r13_t          *DRB_list_NB_IoT,
+    DRB_ToReleaseList_NB_r13_t         *DRB_list2_NB_IoT,
+    struct PhysicalConfigDedicated_NB_r13     *physicalConfigDedicated,
+    MAC_MainConfig_t                   *mac_MainConfig,
+  struct RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13* dedicatedInfoNASList_NB_IoT);
+
+/**
+ * E-UTRAN applies the procedure as follows: when only for NB-IoT SRB1 and SRB1bis is established
+ \brief Generate a SecurityModeCommand
+ @param ctxt_pP Running context
+ @param buffer Pointer to PER-encoded ASN.1 description
+ @param Transaction_id Transaction_ID for this message
+ @param cipheringAlgorithm
+ @param integrityProtAlgorithm
+ */
+
+uint8_t do_SecurityModeCommand_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  uint8_t* const buffer,
+  const uint8_t Transaction_id,
+  const uint8_t cipheringAlgorithm,
+  const uint8_t integrityProtAlgorithm);
+
+/**
+ * E-UTRAN applies the procedure as follows: when only for NB-IoT SRB1 and SRB1bis is established
+ \brief Generate a SecurityModeCommand
+ @param ctxt_pP Running context
+ @param buffer Pointer to PER-encoded ASN.1 description
+ @param Transaction_id Transaction_ID for this message
+ */
+
+uint8_t do_UECapabilityEnquiry_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  uint8_t*               const buffer,
+  const uint8_t                Transaction_id
+);
+
+
+/**
+ * There is nothing new in this type of message for NB-IoT (only change in some nomenclature)
+\brief Generate an RRCConnectionReestablishmentReject DL-CCCH-Message (eNB).
+@param Mod_id Module ID of eNB
+@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
+@returns Size of encoded bit stream in bytes*/
+
+uint8_t
+do_RRCConnectionReestablishmentReject_NB_IoT(
+    uint8_t                    Mod_id,
+    uint8_t*                   const buffer);
+
+
+/**
+\brief Generate an RRCConnectionReject-NB DL-CCCH-Message (eNB).
+@param Mod_id Module ID of eNB
+@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
+@returns Size of encoded bit stream in bytes*/
+uint8_t
+do_RRCConnectionReject_NB_IoT(
+    uint8_t                    Mod_id,
+    uint8_t*                   const buffer);
+
+
+/**
+\brief Generate an RRCConnectionRelease-NB DL-DCCH-Message
+@param Mod_id Module ID of eNB
+@param buffer Pointer to PER-encoded ASN.1 description
+@param transaction_id Transaction index
+@returns Size of encoded bit stream in bytes*/
+
+uint8_t do_RRCConnectionRelease_NB_IoT(uint8_t Mod_id, uint8_t *buffer,int Transaction_id);
+
+
+uint8_t do_DLInformationTransfer_NB_IoT(
+		uint8_t Mod_id,
+		uint8_t **buffer,
+		uint8_t transaction_id,
+		uint32_t pdu_length,
+		uint8_t *pdu_buffer);
+
+//for now not implemented since UE side
+//uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer);
+
+//for now not implemented since UE side???
+//OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
+
+/**
+\brief Generate an RRCConnectionReestablishment-NB DL-CCCH Message
+ *@param
+ *
+ */
+
+uint8_t do_RRCConnectionReestablishment_NB_IoT(
+		uint8_t Mod_id,
+		uint8_t* const buffer,
+		const uint8_t     Transaction_id,
+		const NB_IoT_DL_FRAME_PARMS* const frame_parms, //to be changed
+		SRB_ToAddModList_NB_r13_t**             SRB_configList_NB_IoT
+		 );
+
+/**
+\brief Generate an RRCConnectionRelease-NB DL-DCCH-Message (eNB)
+@param Mod_id Module ID of eNB
+@param buffer Pointer to PER-encoded ASN.1 description of DL-DCCH-Message PDU
+@param transaction_id Transaction index
+@returns Size of encoded bit stream in bytes*/
+
+//uint8_t do_RRCConnectionRelease_NB_IoT(uint8_t Mod_id, uint8_t *buffer,int Transaction_id);
diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e10.asn b/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn
similarity index 83%
rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e10.asn
rename to openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn
index cb13f30c0eef108b1d09e1bd68cbbab424c332cc..2f02a8b4e55c32a65b53653df40d0c6d23fbd36f 100644
--- a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e10.asn
+++ b/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn
@@ -11,6 +11,13 @@ BCCH-BCH-Message ::= SEQUENCE {
 BCCH-BCH-MessageType ::=                        MasterInformationBlock
 
 
+BCCH-BCH-Message-MBMS::= SEQUENCE {
+    message                 BCCH-BCH-MessageType-MBMS-r14
+}
+
+BCCH-BCH-MessageType-MBMS-r14 ::=                   MasterInformationBlock-MBMS-r14
+
+
 BCCH-DL-SCH-Message ::= SEQUENCE {
     message                 BCCH-DL-SCH-MessageType
 }
@@ -37,6 +44,19 @@ BCCH-DL-SCH-MessageType-BR-r13 ::= CHOICE {
 }
 
 
+BCCH-DL-SCH-Message-MBMS ::= SEQUENCE {
+    message                     BCCH-DL-SCH-MessageType-MBMS-r14
+}
+
+BCCH-DL-SCH-MessageType-MBMS-r14 ::= CHOICE {
+    c1                      CHOICE {
+        systemInformation-MBMS-r14                      SystemInformation-MBMS-r14,
+        systemInformationBlockType1-MBMS-r14                SystemInformationBlockType1-MBMS-r14
+    },
+    messageClassExtension   SEQUENCE {}
+}
+
+
 MCCH-Message ::=        SEQUENCE {
     message                 MCCH-MessageType
 }
@@ -130,21 +150,21 @@ UL-DCCH-Message ::= SEQUENCE {
 
 UL-DCCH-MessageType ::= CHOICE {
     c1                      CHOICE {
-        csfbParametersRequestCDMA2000           CSFBParametersRequestCDMA2000,
-        measurementReport                       MeasurementReport,
-        rrcConnectionReconfigurationComplete    RRCConnectionReconfigurationComplete,
-        rrcConnectionReestablishmentComplete    RRCConnectionReestablishmentComplete,
+        csfbParametersRequestCDMA2000               CSFBParametersRequestCDMA2000,
+        measurementReport                           MeasurementReport,
+        rrcConnectionReconfigurationComplete        RRCConnectionReconfigurationComplete,
+        rrcConnectionReestablishmentComplete        RRCConnectionReestablishmentComplete,
         rrcConnectionSetupComplete              RRCConnectionSetupComplete,
-        securityModeComplete                    SecurityModeComplete,
+        securityModeComplete                        SecurityModeComplete,
         securityModeFailure                     SecurityModeFailure,
         ueCapabilityInformation                 UECapabilityInformation,
-        ulHandoverPreparationTransfer           ULHandoverPreparationTransfer,
-        ulInformationTransfer                   ULInformationTransfer,
-        counterCheckResponse                    CounterCheckResponse,
-        ueInformationResponse-r9                UEInformationResponse-r9,
+        ulHandoverPreparationTransfer               ULHandoverPreparationTransfer,
+        ulInformationTransfer                       ULInformationTransfer,
+        counterCheckResponse                        CounterCheckResponse,
+        ueInformationResponse-r9                    UEInformationResponse-r9,
         proximityIndication-r9                  ProximityIndication-r9,
-        rnReconfigurationComplete-r10           RNReconfigurationComplete-r10,
-        mbmsCountingResponse-r10                MBMSCountingResponse-r10,
+        rnReconfigurationComplete-r10               RNReconfigurationComplete-r10,
+        mbmsCountingResponse-r10                    MBMSCountingResponse-r10,
         interFreqRSTDMeasurementIndication-r10  InterFreqRSTDMeasurementIndication-r10
     },
     messageClassExtension   CHOICE {
@@ -152,9 +172,9 @@ UL-DCCH-MessageType ::= CHOICE {
             ueAssistanceInformation-r11         UEAssistanceInformation-r11,
             inDeviceCoexIndication-r11          InDeviceCoexIndication-r11,
             mbmsInterestIndication-r11          MBMSInterestIndication-r11,
-            scgFailureInformation-r12           SCGFailureInformation-r12,
-            sidelinkUEInformation-r12           SidelinkUEInformation-r12,
-            wlanConnectionStatusReport-r13          WLANConnectionStatusReport-r13,
+            scgFailureInformation-r12               SCGFailureInformation-r12,
+            sidelinkUEInformation-r12               SidelinkUEInformation-r12,
+            wlanConnectionStatusReport-r13      WLANConnectionStatusReport-r13,
             rrcConnectionResumeComplete-r13     RRCConnectionResumeComplete-r13,
             spare9 NULL, spare8 NULL, spare7 NULL,
             spare6 NULL, spare5 NULL, spare4 NULL,
@@ -174,7 +194,13 @@ SC-MCCH-MessageType-r13 ::= CHOICE {
     c1                      CHOICE {
         scptmConfiguration-r13                      SCPTMConfiguration-r13
     },
-    messageClassExtension   SEQUENCE {}
+    messageClassExtension   CHOICE {
+        c2                          CHOICE {
+            scptmConfiguration-BR-r14               SCPTMConfiguration-BR-r14,
+            spare                                   NULL
+        },
+        messageClassExtensionFuture-r14 SEQUENCE {}
+    }
 }
 
 
@@ -360,9 +386,14 @@ InDeviceCoexIndication-v11d0-IEs ::=    SEQUENCE {
 }
 
 InDeviceCoexIndication-v1310-IEs ::=    SEQUENCE {
-    affectedCarrierFreqList-v1310       AffectedCarrierFreqList-v1310           OPTIONAL,
-    affectedCarrierFreqCombList-r13 AffectedCarrierFreqCombList-r13     OPTIONAL,
-    nonCriticalExtension                    SEQUENCE {}                             OPTIONAL
+    affectedCarrierFreqList-v1310       AffectedCarrierFreqList-v1310       OPTIONAL,
+    affectedCarrierFreqCombList-r13     AffectedCarrierFreqCombList-r13     OPTIONAL,
+    nonCriticalExtension                    InDeviceCoexIndication-v1360-IEs        OPTIONAL
+}
+
+InDeviceCoexIndication-v1360-IEs ::=    SEQUENCE {
+    hardwareSharingProblem-r13      ENUMERATED {true}                       OPTIONAL,
+    nonCriticalExtension                SEQUENCE {}                         OPTIONAL
 }
 
 AffectedCarrierFreqList-r11 ::= SEQUENCE (SIZE (1..maxFreqIDC-r11)) OF AffectedCarrierFreq-r11
@@ -510,6 +541,15 @@ MasterInformationBlock ::=          SEQUENCE {
 
 
 
+MasterInformationBlock-MBMS-r14 ::=         SEQUENCE {
+    dl-Bandwidth-MBMS-r14                       ENUMERATED {
+                                            n6, n15, n25, n50, n75, n100},
+    systemFrameNumber-r14                   BIT STRING (SIZE (6)),
+    additionalNonMBSFNSubframes-r14     INTEGER (0..3),
+    spare                                   BIT STRING (SIZE (13))
+}
+
+
 MBMSCountingRequest-r10 ::=     SEQUENCE {
     countingRequestList-r10         CountingRequestList-r10,
     lateNonCriticalExtension        OCTET STRING                        OPTIONAL,
@@ -582,16 +622,23 @@ MBSFNAreaConfiguration-r9 ::=       SEQUENCE {
 
 MBSFNAreaConfiguration-v930-IEs ::= SEQUENCE {
     lateNonCriticalExtension            OCTET STRING                        OPTIONAL,
-    nonCriticalExtension                MBSFNAreaConfiguration-v1250-IEs        OPTIONAL
+    nonCriticalExtension                MBSFNAreaConfiguration-v1250-IEs    OPTIONAL
 }
 
 MBSFNAreaConfiguration-v1250-IEs ::= SEQUENCE {
     pmch-InfoListExt-r12                PMCH-InfoListExt-r12                OPTIONAL,   -- Need OR
+    nonCriticalExtension                MBSFNAreaConfiguration-v1430-IEs    OPTIONAL
+}
+
+MBSFNAreaConfiguration-v1430-IEs ::= SEQUENCE {
+    commonSF-Alloc-r14                  CommonSF-AllocPatternList-r14,
     nonCriticalExtension                SEQUENCE {}                         OPTIONAL
 }
 
 CommonSF-AllocPatternList-r9 ::=    SEQUENCE (SIZE (1..maxMBSFN-Allocations)) OF MBSFN-SubframeConfig
 
+CommonSF-AllocPatternList-r14 ::=   SEQUENCE (SIZE (1..maxMBSFN-Allocations)) OF MBSFN-SubframeConfig-v1430
+
 
 MeasurementReport ::=               SEQUENCE {
     criticalExtensions                  CHOICE {
@@ -904,12 +951,14 @@ RRCConnectionReconfiguration-v1310-IEs ::= SEQUENCE {
     lwa-Configuration-r13               LWA-Configuration-r13           OPTIONAL,   -- Need ON
     lwip-Configuration-r13              LWIP-Configuration-r13          OPTIONAL,   -- Need ON
     rclwi-Configuration-r13             RCLWI-Configuration-r13         OPTIONAL,   -- Need ON
-    nonCriticalExtension                RRCConnectionReconfiguration-v14x0-IEs                      OPTIONAL
+    nonCriticalExtension                RRCConnectionReconfiguration-v1430-IEs                      OPTIONAL
 }
 
-RRCConnectionReconfiguration-v14x0-IEs ::= SEQUENCE {
+RRCConnectionReconfiguration-v1430-IEs ::= SEQUENCE {
     sl-V2X-ConfigDedicated-r14      SL-V2X-ConfigDedicated-r14          OPTIONAL,   -- Need ON
-    sCellToAddModListExt-v14xy      SCellToAddModListExt-v14xy          OPTIONAL,   -- Need ON
+    sCellToAddModListExt-v1430      SCellToAddModListExt-v1430          OPTIONAL,   -- Need ON
+    perCC-GapIndicationRequest-r14  ENUMERATED{true}                    OPTIONAL,   -- Need ON
+    systemInformationBlockType2Dedicated-r14    OCTET STRING (CONTAINING SystemInformationBlockType2)                                                                           OPTIONAL,   -- Need ON
     nonCriticalExtension            SEQUENCE {}                         OPTIONAL
 }
 
@@ -942,7 +991,7 @@ SCellToAddModList-r10 ::=       SEQUENCE (SIZE (1..maxSCell-r10)) OF SCellToAddM
 
 SCellToAddModListExt-r13 ::=    SEQUENCE (SIZE (1..maxSCell-r13)) OF SCellToAddModExt-r13
 
-SCellToAddModListExt-v14xy ::=  SEQUENCE (SIZE (1..maxSCell-r13)) OF SCellToAddModExt-v14xy
+SCellToAddModListExt-v1430 ::=  SEQUENCE (SIZE (1..maxSCell-r13)) OF SCellToAddModExt-v1430
 
 SCellToAddMod-r10 ::=           SEQUENCE {
     sCellIndex-r10                      SCellIndex-r10,
@@ -972,8 +1021,9 @@ SCellToAddModExt-r13 ::=            SEQUENCE {
     antennaInfoDedicatedSCell-r13           AntennaInfoDedicated-v10i0      OPTIONAL    -- Need ON
 }
 
-SCellToAddModExt-v14xy ::=          SEQUENCE {
-    srs-SwitchFromServCellIndex-r14         INTEGER (0.. 31) OPTIONAL   -- Need ON
+SCellToAddModExt-v1430 ::=          SEQUENCE {
+    srs-SwitchFromServCellIndex-r14         INTEGER (0.. 31)            OPTIONAL,   -- Need ON
+    ...
 }
 
 SCellToReleaseList-r10 ::=          SEQUENCE (SIZE (1..maxSCell-r10)) OF SCellIndex-r10
@@ -1053,6 +1103,13 @@ RRCConnectionReconfigurationComplete-v1130-IEs ::= SEQUENCE {
 
 RRCConnectionReconfigurationComplete-v1250-IEs ::= SEQUENCE {
     logMeasAvailableMBSFN-r12           ENUMERATED {true}               OPTIONAL,
+    nonCriticalExtension                RRCConnectionReconfigurationComplete-v1430-IEs                      OPTIONAL
+}
+
+RRCConnectionReconfigurationComplete-v1430-IEs ::= SEQUENCE {
+    perCC-GapIndicationList-r14         PerCC-GapIndicationList-r14     OPTIONAL,
+    numFreqEffective-r14                INTEGER (1..12)                 OPTIONAL,
+    numFreqEffectiveReduced-r14         INTEGER (1..12)                 OPTIONAL,
     nonCriticalExtension                SEQUENCE {}                     OPTIONAL
 }
 
@@ -1417,8 +1474,8 @@ RRCConnectionResume-r13 ::=     SEQUENCE {
     criticalExtensions                  CHOICE {
         c1                                  CHOICE {
             rrcConnectionResume-r13             RRCConnectionResume-r13-IEs,
-            spare3                              NULL, 
-            spare2                              NULL, 
+            spare3                              NULL,
+            spare2                              NULL,
             spare1                              NULL
         },
         criticalExtensionsFuture            SEQUENCE {}
@@ -1432,7 +1489,12 @@ RRCConnectionResume-r13-IEs ::=     SEQUENCE {
     antennaInfoDedicatedPCell-r13           AntennaInfoDedicated-v10i0      OPTIONAL,   -- Need ON
     drb-ContinueROHC-r13                    ENUMERATED {true}               OPTIONAL,   -- Need OP
     lateNonCriticalExtension                OCTET STRING                    OPTIONAL,
-    nonCriticalExtension                    SEQUENCE {}                     OPTIONAL
+    rrcConnectionResume-v1430-IEs           RRCConnectionResume-v1430-IEs   OPTIONAL
+}
+
+RRCConnectionResume-v1430-IEs ::= SEQUENCE {
+    otherConfig-r14             OtherConfig-r9              OPTIONAL,           -- Need ON
+    nonCriticalExtension        SEQUENCE {}                 OPTIONAL
 }
 
     
@@ -1549,17 +1611,22 @@ RRCConnectionSetupComplete-v1250-IEs ::= SEQUENCE {
 }
 
 RRCConnectionSetupComplete-v1320-IEs ::= SEQUENCE {
-    ce-ModeB-r13                        ENUMERATED {supported}          OPTIONAL,
-    s-TMSI-r13                              S-TMSI                          OPTIONAL,
-    attachWithoutPDN-Connectivity-r13       ENUMERATED {true}               OPTIONAL,
-    up-CIoT-EPS-Optimisation-r13            ENUMERATED {true}               OPTIONAL,
-    cp-CIoT-EPS-Optimisation-r13            ENUMERATED {true}               OPTIONAL,
-    nonCriticalExtension                RRCConnectionSetupComplete-v1330-IEs                OPTIONAL
+    ce-ModeB-r13                        ENUMERATED {supported}                      OPTIONAL,
+    s-TMSI-r13                          S-TMSI                                      OPTIONAL,
+    attachWithoutPDN-Connectivity-r13   ENUMERATED {true}                           OPTIONAL,
+    up-CIoT-EPS-Optimisation-r13        ENUMERATED {true}                           OPTIONAL,
+    cp-CIoT-EPS-Optimisation-r13        ENUMERATED {true}                           OPTIONAL,
+    nonCriticalExtension                RRCConnectionSetupComplete-v1330-IEs        OPTIONAL
 }
 
 RRCConnectionSetupComplete-v1330-IEs ::= SEQUENCE {
     ue-CE-NeedULGaps-r13                    ENUMERATED {true}               OPTIONAL,
-    nonCriticalExtension                    SEQUENCE {}                     OPTIONAL
+    nonCriticalExtension                RRCConnectionSetupComplete-v1430-IEs        OPTIONAL
+}
+
+RRCConnectionSetupComplete-v1430-IEs ::= SEQUENCE {
+    dcn-ID-r14                          INTEGER (0..65535)              OPTIONAL,
+    nonCriticalExtension                SEQUENCE {}                     OPTIONAL
 }
 
 RegisteredMME ::=                   SEQUENCE {
@@ -1585,10 +1652,16 @@ SCGFailureInformation-r12-IEs ::=   SEQUENCE {
 }
 
 SCGFailureInformation-v1310-IEs ::= SEQUENCE {
-    lateNonCriticalExtension            OCTET STRING                        OPTIONAL,
+    lateNonCriticalExtension            OCTET STRING (CONTAINING SCGFailureInformation-v12d0-IEs)                       OPTIONAL,
     nonCriticalExtension                SEQUENCE {}                         OPTIONAL
 }
 
+-- Late non-critical extensions:
+SCGFailureInformation-v12d0-IEs ::= SEQUENCE {
+    failureReportSCG-v12d0              FailureReportSCG-v12d0              OPTIONAL,   nonCriticalExtension                SEQUENCE {}                         OPTIONAL
+}
+
+-- Regular non-critical extensions:
 FailureReportSCG-r12 ::=            SEQUENCE {
     failureType-r12                     ENUMERATED {t313-Expiry, randomAccessProblem,
                                                 rlc-MaxNumRetx, scg-ChangeFailure },
@@ -1601,6 +1674,10 @@ FailureReportSCG-r12 ::=            SEQUENCE {
     ]]
 }
 
+FailureReportSCG-v12d0 ::= SEQUENCE {
+    measResultNeighCells-v12d0          MeasResultList2EUTRA-v9e0           OPTIONAL
+}
+
 
 SCPTMConfiguration-r13 ::=      SEQUENCE {
     sc-mtch-InfoList-r13            SC-MTCH-InfoList-r13,
@@ -1615,6 +1692,15 @@ SCPTMConfiguration-v1340 ::= SEQUENCE {
 }
 
 
+SCPTMConfiguration-BR-r14 ::=   SEQUENCE {
+    sc-mtch-InfoList-r14            SC-MTCH-InfoList-BR-r14,
+    scptm-NeighbourCellList-r14     SCPTM-NeighbourCellList-r13         OPTIONAL,   -- Need OP
+    p-b-r14                         INTEGER (0..3)                      OPTIONAL,   -- Need OR
+    lateNonCriticalExtension        OCTET STRING                        OPTIONAL,
+    nonCriticalExtension            SEQUENCE {}                         OPTIONAL
+}
+
+
 SecurityModeCommand ::=             SEQUENCE {
     rrc-TransactionIdentifier           RRC-TransactionIdentifier,
     criticalExtensions                  CHOICE {
@@ -1712,12 +1798,13 @@ SidelinkUEInformation-v1310-IEs ::= SEQUENCE {
     discRxGapReq-r13                    SL-GapRequest-r13           OPTIONAL,
     discTxGapReq-r13                    SL-GapRequest-r13           OPTIONAL,
     discSysInfoReportFreqList-r13       SL-DiscSysInfoReportFreqList-r13    OPTIONAL,
-    nonCriticalExtension            SidelinkUEInformation-v14x0-IEs                 OPTIONAL
+    nonCriticalExtension            SidelinkUEInformation-v1430-IEs                 OPTIONAL
 }
 
-SidelinkUEInformation-v14x0-IEs ::= SEQUENCE {
-    v2x-CommRxInterestedFreq-r14        INTEGER (0..maxFreq)                OPTIONAL,
-    v2x-CommTxResourceReq-r14           V2X-CommTxResourceReq-r14           OPTIONAL,
+SidelinkUEInformation-v1430-IEs ::= SEQUENCE {
+    v2x-CommRxInterestedFreqList-r14    SL-V2X-CommFreqList-r14             OPTIONAL,
+    p2x-CommTxType-r14                  ENUMERATED {true}                   OPTIONAL,
+    v2x-CommTxResourceReq-r14           SL-V2X-CommTxFreqList-r14           OPTIONAL,
     nonCriticalExtension                SEQUENCE {}                         OPTIONAL
 }
 
@@ -1726,11 +1813,6 @@ SL-CommTxResourceReq-r12 ::=        SEQUENCE {
     destinationInfoList-r12         SL-DestinationInfoList-r12
 }
 
-V2X-CommTxResourceReq-r14 ::=   SEQUENCE {
-    v2x-CommTxFreq-r14              INTEGER (0..maxFreq)                OPTIONAL,
-    v2x-DestinationInfoList-r14     SL-DestinationInfoList-r12          OPTIONAL
-}
-
 SL-DiscTxResourceReqPerFreqList-r13 ::= SEQUENCE (SIZE (1..maxFreq)) OF SL-DiscTxResourceReq-r13
 
 SL-DiscTxResourceReq-r13 ::=        SEQUENCE {
@@ -1744,9 +1826,23 @@ SL-DestinationIdentity-r12 ::=  BIT STRING (SIZE (24))
 
 SL-DiscSysInfoReportFreqList-r13 ::=    SEQUENCE (SIZE (1.. maxSL-DiscSysInfoReportFreq-r13)) OF SL-DiscSysInfoReport-r13
 
+SL-V2X-CommFreqList-r14 ::= SEQUENCE (SIZE (1..maxFreqV2X-r14)) OF INTEGER (0..maxFreqV2X-1-r14)
+
+SL-V2X-CommTxFreqList-r14 ::=   SEQUENCE (SIZE (1..maxFreqV2X-r14)) OF SL-V2X-CommTxResourceReq-r14
+
+SL-V2X-CommTxResourceReq-r14 ::=        SEQUENCE {
+    carrierFreqCommTx-r14           INTEGER (0.. maxFreqV2X-1-r14)          OPTIONAL,
+    v2x-TypeTxSync-r14              SL-TypeTxSync-r14               OPTIONAL,
+    v2x-DestinationInfoList-r14     SL-DestinationInfoList-r12      OPTIONAL
+}
+
+SL-TypeTxSyncList-r14 ::=   SEQUENCE (SIZE (1..maxFreqV2X-r14)) OF SL-TypeTxSync-r14
+
 
 SystemInformation-BR-r13 ::=    SystemInformation
 
+SystemInformation-MBMS-r14 ::=  SystemInformation
+
 SystemInformation ::=               SEQUENCE {
     criticalExtensions                  CHOICE {
         systemInformation-r8                SystemInformation-r8-IEs,
@@ -1775,7 +1871,7 @@ SystemInformation-r8-IEs ::=        SEQUENCE {
         sib18-v1250                         SystemInformationBlockType18-r12,
         sib19-v1250                         SystemInformationBlockType19-r12,
         sib20-v1310                         SystemInformationBlockType20-r13,
-        sib21-v14x0                         SystemInformationBlockType21-r14
+        sib21-v1430                         SystemInformationBlockType21-r14
     },
     nonCriticalExtension                SystemInformation-v8a0-IEs          OPTIONAL
 }
@@ -1895,11 +1991,24 @@ SystemInformationBlockType1-v1320-IEs ::=   SEQUENCE {
         }                                                                   OPTIONAL,   -- Need OR
         mpdcch-pdsch-HoppingOffset-r13          INTEGER (1..maxAvailNarrowBands-r13)    OPTIONAL    -- Need OR
     }                                                               OPTIONAL,   -- Cond Hopping
-    nonCriticalExtension                        SystemInformationBlockType1-v14xy-IEs                   OPTIONAL
+    nonCriticalExtension                        SystemInformationBlockType1-v1350-IEs                   OPTIONAL
+}
+
+SystemInformationBlockType1-v1350-IEs ::=   SEQUENCE {
+    cellSelectionInfoCE1-r13                CellSelectionInfoCE1-r13    OPTIONAL,   -- Need OP
+    nonCriticalExtension                    SystemInformationBlockType1-v1360-IEs               OPTIONAL
+}
+
+SystemInformationBlockType1-v1360-IEs ::=   SEQUENCE {
+    cellSelectionInfoCE1-v1360              CellSelectionInfoCE1-v1360  OPTIONAL,   -- Cond QrxlevminCE1
+    nonCriticalExtension                        SystemInformationBlockType1-v1430-IEs       OPTIONAL
 }
 
-SystemInformationBlockType1-v14xy-IEs ::=   SEQUENCE {
+SystemInformationBlockType1-v1430-IEs ::=   SEQUENCE {
     eCallOverIMS-Support-r14                ENUMERATED {true}           OPTIONAL,   -- Need OR
+    tdd-Config-v1430                        TDD-Config-v1430            OPTIONAL,   -- Cond TDD-OR
+    cellAccessRelatedInfoList-r14           SEQUENCE (SIZE (1..maxPLMN-1-r14)) OF 
+                                            CellAccessRelatedInfo-r14   OPTIONAL,   -- Need OR
     nonCriticalExtension                    SEQUENCE {}                 OPTIONAL
 }
 
@@ -1934,7 +2043,7 @@ SIB-Type ::=                        ENUMERATED {
                                         sibType11, sibType12-v920, sibType13-v920,
                                         sibType14-v1130, sibType15-v1130,
                                         sibType16-v1130, sibType17-v1250, sibType18-v1250,
-                                        ..., sibType19-v1250, sibType20-v1310, sibType21-v14x0}
+                                        ..., sibType19-v1250, sibType20-v1310, sibType21-v1430}
 
 SystemInfoValueTagList-r13 ::=      SEQUENCE (SIZE (1..maxSI-Message)) OF SystemInfoValueTagSI-r13
 
@@ -1953,6 +2062,56 @@ CellSelectionInfo-v1250 ::=         SEQUENCE {
     q-QualMinRSRQ-OnAllSymbols-r12                      Q-QualMin-r9
 }
 
+CellAccessRelatedInfo-r14 ::=   SEQUENCE {
+    plmn-IdentityList-r14               PLMN-IdentityList,
+    trackingAreaCode-r14                TrackingAreaCode,
+    cellIdentity-r14                    CellIdentity
+}
+
+
+SystemInformationBlockType1-MBMS-r14 ::=    SEQUENCE {
+    cellAccessRelatedInfo-r14               SEQUENCE {
+        plmn-IdentityList-r14                   PLMN-IdentityList-MBMS-r14,
+        trackingAreaCode-r14                        TrackingAreaCode,
+        cellIdentity-r14                            CellIdentity
+    },
+    freqBandIndicator-r14                   FreqBandIndicator-r11,
+    multiBandInfoList-r14                   MultiBandInfoList-r11               OPTIONAL, -- Need OR
+    schedulingInfoList-MBMS-r14         SchedulingInfoList-MBMS-r14,
+    si-WindowLength-r14                     ENUMERATED {
+                                                ms1, ms2, ms5, ms10, ms15, ms20,ms40, ms80},
+    systemInfoValueTag-r14                  INTEGER (0..31),
+    nonMBSFN-SubframeConfig-r14             NonMBSFN-SubframeConfig-r14     OPTIONAL, --Need OR
+    pdsch-ConfigCommon-r14                  PDSCH-ConfigCommon,
+    systemInformationBlockType13-r14        SystemInformationBlockType13-r9 OPTIONAL, --Need OR
+    cellAccessRelatedInfoList-r14       SEQUENCE (SIZE (1..maxPLMN-1-r14)) OF 
+                                            CellAccessRelatedInfo-r14   OPTIONAL,   -- Need OR
+    nonCriticalExtension                    SEQUENCE {}                         OPTIONAL
+}
+
+PLMN-IdentityList-MBMS-r14 ::=              SEQUENCE (SIZE (1..maxPLMN-r11)) OF PLMN-Identity
+
+SchedulingInfoList-MBMS-r14 ::= SEQUENCE (SIZE (1..maxSI-Message)) OF SchedulingInfo-MBMS-r14
+
+SchedulingInfo-MBMS-r14 ::= SEQUENCE {
+    si-Periodicity-r14                      ENUMERATED {
+                                                rf16, rf32, rf64, rf128, rf256, rf512},
+    sib-MappingInfo-r14                     SIB-MappingInfo-MBMS-r14
+}
+
+SIB-MappingInfo-MBMS-r14 ::= SEQUENCE (SIZE (0..maxSIB-1)) OF SIB-Type-MBMS-r14
+
+SIB-Type-MBMS-r14 ::=                   ENUMERATED {
+                                            sibType10, sibType11, sibType12-v920, sibType13-v920,
+                                            sibType15-v1130, sibType16-v1130, ...}
+
+
+NonMBSFN-SubframeConfig-r14 ::=         SEQUENCE {
+    radioFrameAllocationPeriod-r14      ENUMERATED {rf4, rf8, rf16, rf32, rf64, rf128, rf512},
+    radioFrameAllocationOffset-r14      INTEGER (0..7),
+    subframeAllocation-r14              BIT STRING (SIZE(9))
+}
+
 
 UEAssistanceInformation-r11 ::=             SEQUENCE {
     criticalExtensions                  CHOICE {
@@ -1966,8 +2125,48 @@ UEAssistanceInformation-r11 ::=             SEQUENCE {
 
 UEAssistanceInformation-r11-IEs ::=     SEQUENCE {
     powerPrefIndication-r11             ENUMERATED  {normal, lowPowerConsumption}   OPTIONAL,
-    lateNonCriticalExtension            OCTET STRING                        OPTIONAL,
-    nonCriticalExtension                SEQUENCE {}                         OPTIONAL
+    lateNonCriticalExtension            OCTET STRING                                    OPTIONAL,
+    nonCriticalExtension                UEAssistanceInformation-v1430-IEs           OPTIONAL
+}
+
+UEAssistanceInformation-v1430-IEs ::=       SEQUENCE    {
+    bw-Preference-r14                   BW-Preference-r14                                   OPTIONAL,
+    sps-AssistanceInformation-r14       SEQUENCE {
+        trafficPatternInfoListSL-r14        TrafficPatternInfoList-r14      OPTIONAL,
+        trafficPatternInfoListUL-r14        TrafficPatternInfoList-r14      OPTIONAL
+    }           OPTIONAL,
+    rlm-Report-r14                      SEQUENCE {
+        rlm-Event-r14                       ENUMERATED {earlyOutOfSync, earlyInSync},
+        excessRep-MPDCCH-r14                ENUMERATED {excessRep1, excessRep2}     OPTIONAL
+    }                                                                               OPTIONAL,   delayBudgetReport-r14               DelayBudgetReport-r14                       OPTIONAL,
+    nonCriticalExtension                SEQUENCE {}                                 OPTIONAL
+}
+
+BW-Preference-r14 ::= SEQUENCE {
+    dl-Preference-r14       ENUMERATED  {mhz1dot4, mhz5, mhz20 }                        OPTIONAL,
+    ul-Preference-r14       ENUMERATED  {mhz1dot4, mhz5}                        OPTIONAL
+}
+
+TrafficPatternInfoList-r14 ::= SEQUENCE (SIZE (1..maxTrafficPattern-r14)) OF TrafficPatternInfo-r14
+
+TrafficPatternInfo-r14 ::=  SEQUENCE {
+    trafficPeriodicity-r14          ENUMERATED {
+                                            sf20, sf50, sf100, sf200, sf300, sf400, sf500,
+                                            sf600, sf700, sf800, sf900, sf1000},
+    timingOffset-r14                    INTEGER (0..10239),
+    priorityInfoSL-r14                  SL-Priority-r13                             OPTIONAL,
+    logicalChannelIdentityUL-r14        INTEGER (3..10)                             OPTIONAL,
+    messageSize-r14                 BIT STRING (SIZE (6))
+}
+
+DelayBudgetReport-r14::=    CHOICE {
+    type1                           ENUMERATED {
+                                        msMinus1280, msMinus640, msMinus320, msMinus160,
+                                        msMinus80, msMinus60, msMinus40, msMinus20, ms0, ms20,                                              ms40, ms60, ms80, ms160, ms320, ms640, ms1280}, 
+
+    type2                           ENUMERATED {
+                                        msMinus192, msMinus168,msMinus144, msMinus120, 
+                                        msMinus96, msMinus72, msMinus48, msMinus24, ms0, ms24,                                              ms48, ms72, ms96, ms120, ms144, ms168, ms192}
 }
 
 
@@ -2003,6 +2202,11 @@ UECapabilityEnquiry-v1310-IEs ::=   SEQUENCE {
     requestedMaxCCsDL-r13               INTEGER (2..32)                 OPTIONAL,   -- Need ON
     requestedMaxCCsUL-r13               INTEGER (2..32)                 OPTIONAL,   -- Need ON
     requestReducedIntNonContComb-r13    ENUMERATED {true}                   OPTIONAL,   -- Need ON
+    nonCriticalExtension                UECapabilityEnquiry-v1430-IEs       OPTIONAL
+}
+
+UECapabilityEnquiry-v1430-IEs ::=   SEQUENCE {
+    requestDiffFallbackCombList-r14     BandCombinationList-r14         OPTIONAL,   -- Need ON
     nonCriticalExtension                SEQUENCE {}                     OPTIONAL
 }
 
@@ -2183,6 +2387,8 @@ RLF-Report-r9 ::=                   SEQUENCE {
         measResultListEUTRA-v1250       MeasResultList2EUTRA-v1250      OPTIONAL
     ]],
     [[  drb-EstablishedWithQCI-1-r13            ENUMERATED {qci1}               OPTIONAL
+    ]],
+    [[  measResultLastServCell-v1360            RSRP-Range-v1360                OPTIONAL
     ]]
 }
 
@@ -2258,6 +2464,8 @@ LogMeasInfo-r10 ::=         SEQUENCE {
         measResultListEUTRA-v1250           MeasResultList2EUTRA-v1250  OPTIONAL
     ]],
     [[  inDeviceCoexDetected-r13            ENUMERATED {true}           OPTIONAL
+    ]],
+    [[  measResultServCell-v1360            RSRP-Range-v1360            OPTIONAL
     ]]
 }
 
@@ -2316,6 +2524,8 @@ ConnEstFailReport-r11 ::=               SEQUENCE {
     [[  measResultFailedCell-v1250      RSRQ-Range-v1250                OPTIONAL,
         failedCellRSRQ-Type-r12         RSRQ-Type-r12                   OPTIONAL,
         measResultListEUTRA-v1250       MeasResultList2EUTRA-v1250      OPTIONAL
+    ]],
+    [[  measResultFailedCell-v1360      RSRP-Range-v1360            OPTIONAL
     ]]
 }
 
@@ -2387,6 +2597,11 @@ WLANConnectionStatusReport-r13 ::=  SEQUENCE {
 WLANConnectionStatusReport-r13-IEs ::=  SEQUENCE {
     wlan-Status-r13                 WLAN-Status-r13,
     lateNonCriticalExtension        OCTET STRING                        OPTIONAL,
+    nonCriticalExtension            WLANConnectionStatusReport-v1430-IEs    OPTIONAL
+}
+
+WLANConnectionStatusReport-v1430-IEs ::=    SEQUENCE {
+    wlan-Status-v1430               WLAN-Status-v1430,
     nonCriticalExtension            SEQUENCE {}                         OPTIONAL
 }
 
@@ -2425,10 +2640,15 @@ SystemInformationBlockType2 ::=     SEQUENCE {
         acdc-BarringPerPLMN-List-r13        ACDC-BarringPerPLMN-List-r13    OPTIONAL    -- Need OP
     ]],
     [[
-        udt-RestrictingForCommon-r13            UDT-Restricting-r13             OPTIONAL,   -- Need OR
+        udt-RestrictingForCommon-r13        UDT-Restricting-r13             OPTIONAL,   -- Need OR
         udt-RestrictingPerPLMN-List-r13     UDT-RestrictingPerPLMN-List-r13 OPTIONAL,   -- Need OR
         cIoT-EPS-OptimisationInfo-r13       CIOT-EPS-OptimisationInfo-r13   OPTIONAL,   -- Need OP
         useFullResumeID-r13                 ENUMERATED {true}               OPTIONAL    -- Need OP
+    ]],
+    [[  unicastFreqHoppingInd-r13           ENUMERATED {true}               OPTIONAL    -- Need OP
+    ]],
+    [[  mbsfn-SubframeConfigList-v1430      MBSFN-SubframeConfigList-v1430  OPTIONAL,   -- Need OP
+        videoServiceCauseIndication-r14     ENUMERATED {true}               OPTIONAL    -- Need OP
     ]]
 
 }
@@ -2453,6 +2673,8 @@ AC-BarringConfig ::=                SEQUENCE {
 
 MBSFN-SubframeConfigList ::=        SEQUENCE (SIZE (1..maxMBSFN-Allocations)) OF MBSFN-SubframeConfig
 
+MBSFN-SubframeConfigList-v1430 ::=      SEQUENCE (SIZE (1..maxMBSFN-Allocations)) OF MBSFN-SubframeConfig-v1430
+
 AC-BarringPerPLMN-List-r12 ::=      SEQUENCE (SIZE (1.. maxPLMN-r11)) OF AC-BarringPerPLMN-r12
 
 AC-BarringPerPLMN-r12 ::=           SEQUENCE {
@@ -2567,7 +2789,11 @@ SystemInformationBlockType3 ::=     SEQUENCE {
         redistributionServingInfo-r13           RedistributionServingInfo-r13 OPTIONAL, --Need OR
         cellSelectionInfoCE-r13                 CellSelectionInfoCE-r13     OPTIONAL,       -- Need OP
         t-ReselectionEUTRA-CE-r13               T-ReselectionEUTRA-CE-r13   OPTIONAL        -- Need OP
-        ]]
+    ]],
+    [[  cellSelectionInfoCE1-r13                CellSelectionInfoCE1-r13    OPTIONAL    -- Need OP
+    ]],
+    [[  cellSelectionInfoCE1-v1360          CellSelectionInfoCE1-v1360  OPTIONAL        -- Cond QrxlevminCE1
+    ]]
 }
 
 RedistributionServingInfo-r13 ::=       SEQUENCE {
@@ -2620,6 +2846,13 @@ SystemInformationBlockType5 ::=     SEQUENCE {
     ]],
     [[  interFreqCarrierFreqList-v1310      InterFreqCarrierFreqList-v1310      OPTIONAL,   -- Need OR
         interFreqCarrierFreqListExt-v1310   InterFreqCarrierFreqListExt-v1310   OPTIONAL    -- Need OR
+    ]],
+    [[  interFreqCarrierFreqList-v1350      InterFreqCarrierFreqList-v1350  OPTIONAL,   -- Need OR
+    interFreqCarrierFreqListExt-v1350   InterFreqCarrierFreqListExt-v1350   OPTIONAL    -- Need OR
+    ]],
+    [[  interFreqCarrierFreqListExt-v1360   InterFreqCarrierFreqListExt-v1360   OPTIONAL    -- Need OR
+    ]],
+    [[  scptm-FreqOffset-r14                INTEGER (1..8)                  OPTIONAL    -- Need OP 
     ]]
 }
 
@@ -2642,14 +2875,20 @@ InterFreqCarrierFreqList ::=        SEQUENCE (SIZE (1..maxFreq)) OF InterFreqCar
 
 InterFreqCarrierFreqList-v1250 ::=  SEQUENCE (SIZE (1.. maxFreq)) OF InterFreqCarrierFreqInfo-v1250
 
+InterFreqCarrierFreqList-v1310 ::=  SEQUENCE (SIZE (1.. maxFreq)) OF InterFreqCarrierFreqInfo-v1310
+
+InterFreqCarrierFreqList-v1350 ::=  SEQUENCE (SIZE (1.. maxFreq)) OF InterFreqCarrierFreqInfo-v1350
+
 InterFreqCarrierFreqListExt-r12 ::= SEQUENCE (SIZE (1.. maxFreq)) OF InterFreqCarrierFreqInfo-r12
 
 InterFreqCarrierFreqListExt-v1280 ::=   SEQUENCE (SIZE (1.. maxFreq)) OF InterFreqCarrierFreqInfo-v10j0
 
-InterFreqCarrierFreqList-v1310 ::=  SEQUENCE (SIZE (1.. maxFreq)) OF InterFreqCarrierFreqInfo-v1310
-
 InterFreqCarrierFreqListExt-v1310 ::=   SEQUENCE (SIZE (1.. maxFreq)) OF InterFreqCarrierFreqInfo-v1310
 
+InterFreqCarrierFreqListExt-v1350 ::=   SEQUENCE (SIZE (1.. maxFreq)) OF InterFreqCarrierFreqInfo-v1350
+
+InterFreqCarrierFreqListExt-v1360 ::=   SEQUENCE (SIZE (1..maxFreq)) OF InterFreqCarrierFreqInfo-v1360
+
 InterFreqCarrierFreqInfo ::=    SEQUENCE {
     dl-CarrierFreq                      ARFCN-ValueEUTRA,
     q-RxLevMin                          Q-RxLevMin,
@@ -2729,6 +2968,14 @@ InterFreqCarrierFreqInfo-v1310  ::= SEQUENCE {
     t-ReselectionEUTRA-CE-r13           T-ReselectionEUTRA-CE-r13       OPTIONAL    -- Need OP
 }
 
+InterFreqCarrierFreqInfo-v1350  ::= SEQUENCE {
+    cellSelectionInfoCE1-r13            CellSelectionInfoCE1-r13            OPTIONAL    -- Need OP
+}
+
+InterFreqCarrierFreqInfo-v1360  ::= SEQUENCE {
+    cellSelectionInfoCE1-v1360      CellSelectionInfoCE1-v1360  OPTIONAL    -- Cond QrxlevminCE1
+}
+
 InterFreqNeighCellList ::=          SEQUENCE (SIZE (1..maxCellInter)) OF InterFreqNeighCellInfo
 
 InterFreqNeighCellInfo ::=          SEQUENCE {
@@ -3058,7 +3305,10 @@ SystemInformationBlockType13-r9 ::= SEQUENCE {
     mbsfn-AreaInfoList-r9               MBSFN-AreaInfoList-r9,
     notificationConfig-r9               MBMS-NotificationConfig-r9,
     lateNonCriticalExtension            OCTET STRING                    OPTIONAL,
-    ...
+    ...,
+    [[  
+     notificationConfig-v1430           MBMS-NotificationConfig-v1430       OPTIONAL
+    ]]
 }
 
 
@@ -3087,6 +3337,10 @@ SystemInformationBlockType15-r11 ::=    SEQUENCE {
     lateNonCriticalExtension                OCTET STRING                    OPTIONAL,
     ...,
     [[  mbms-SAI-InterFreqList-v1140        MBMS-SAI-InterFreqList-v1140    OPTIONAL    -- Cond InterFreq
+    ]],
+    [[  mbms-IntraFreqCarrierType-r14       MBMS-CarrierType-r14            OPTIONAL,   -- Need OR
+        mbms-InterFreqCarrierTypeList-r14   
+                                            MBMS-InterFreqCarrierTypeList-r14   OPTIONAL    -- Need OR
     ]]
 }
 
@@ -3107,6 +3361,12 @@ MBMS-SAI-InterFreq-v1140 ::=            SEQUENCE {
         multiBandInfoList-r11               MultiBandInfoList-r11           OPTIONAL    -- Need OR
 }
 
+MBMS-InterFreqCarrierTypeList-r14 ::=   SEQUENCE (SIZE (1..maxFreq)) OF MBMS-CarrierType-r14
+
+MBMS-CarrierType-r14 ::=                SEQUENCE {
+    carrierType-r14                         ENUMERATED {mbms, fembmsMixed, fembmsDedicated},
+    frameOffset-r14                         INTEGER (0..3)                  OPTIONAL    -- Need OR
+}
 
 
 SystemInformationBlockType16-r11 ::=        SEQUENCE {
@@ -3251,40 +3511,96 @@ SL-ResourcesInterFreq-r13 ::= SEQUENCE {
 
 
 SystemInformationBlockType20-r13 ::=    SEQUENCE {
-    sc-mcch-RepetionPeriod-r13      ENUMERATED {rf2, rf4, rf8, rf16, rf32, rf64, rf128, rf256},
+    sc-mcch-RepetitionPeriod-r13        ENUMERATED {rf2, rf4, rf8, rf16, rf32, rf64, rf128, rf256},
     sc-mcch-Offset-r13              INTEGER (0..10),
     sc-mcch-FirstSubframe-r13       INTEGER (0..9),
     sc-mcch-duration-r13            INTEGER (2..9)  OPTIONAL,
     sc-mcch-ModificationPeriod-r13  ENUMERATED {rf2, rf4, rf8, rf16, rf32, rf64, rf128, rf256,
                                          rf512, rf1024, r2048, rf4096, rf8192, rf16384, rf32768,                                                 rf65536},
-    lateNonCriticalExtension            OCTET STRING                    OPTIONAL,
+    lateNonCriticalExtension            OCTET STRING                        OPTIONAL,
+    ...,
+    [[  br-BCCH-Config-r14                  SEQUENCE {
+            sc-mcch-RepetitionPeriod-v1430      ENUMERATED {rf1},
+            sc-mcch-ModificationPeriod-v1430    ENUMERATED {rf1},
+            mpdcch-Narrowband-SC-MCCH-r14       INTEGER (1..maxAvailNarrowBands-r13),
+            mpdcch-NumRepetition-SC-MCCH-r14    ENUMERATED {r1, r2, r4, r8, r16, 
+                                                            r32, r64, r128, r256},
+            mpdcch-StartSF-SC-MCCH-r14          CHOICE {
+                fdd-r14                             ENUMERATED {v1, v1dot5, v2, v2dot5, v4,
+                                                                v5, v8, v10},
+                tdd-r14                             ENUMERATED {v1, v2, v4, v5, v8, v10, v20}
+            },
+            mpdcch-PDSCH-HoppingConfig-SC-MCCH-r14  ENUMERATED {off, ce-ModeA, ce-ModeB},
+            sc-mcch-CarrierFreq-r14             ARFCN-ValueEUTRA-r9,
+            sc-mcch-Offset-BR-r14               INTEGER (0..10),
+            sc-mcch-RepetitionPeriod-BR-r14     ENUMERATED {rf32, rf128, rf512, rf1024,
+                                                    rf2048, rf4096, rf8192, rf16384},
+            sc-mcch-ModificationPeriod-BR-r14   ENUMERATED { rf32, rf128, rf256, rf512, rf1024, 
+                                                    rf2048, rf4096, rf8192, rf16384, rf32768, 
+                                                    rf65536, rf131072, rf262144, rf524288, 
+                                                    rf1048576}
+        }                                                                   OPTIONAL,   -- Need OR
+        sc-mcch-SchedulingInfo-r14          SC-MCCH-SchedulingInfo-r14      OPTIONAL,   -- Need OP
+        pdsch-maxNumRepetitionCEmodeA-SC-MTCH-r14
+                                            ENUMERATED { r16, r32 }     OPTIONAL,   -- Need OR
+        pdsch-maxNumRepetitionCEmodeB-SC-MTCH-r14
+                                            ENUMERATED {
+                                                r192, r256, r384, r512, r768, r1024, 
+                                                r1536, r2048}               OPTIONAL    -- Need OR
+    ]]
+}
+
+SC-MCCH-SchedulingInfo-r14::=   SEQUENCE    {
+    onDurationTimerSCPTM-r14            ENUMERATED {psf10, psf20, psf100, psf300, 
+                                                psf500, psf1000, psf1200, psf1600},
+    drx-InactivityTimerSCPTM-r14        ENUMERATED {psf0, psf1, psf2, psf4, psf8, psf16, 
+                                                psf32, psf64, psf128, psf256, ps512, 
+                                                psf1024, psf2048, psf4096, psf8192, psf16384},
+    schedulingPeriodStartOffsetSCPTM-r14    CHOICE {
+        sf10                                    INTEGER(0..9),
+        sf20                                    INTEGER(0..19),
+        sf32                                    INTEGER(0..31),
+        sf40                                    INTEGER(0..39),
+        sf64                                    INTEGER(0..63),
+        sf80                                    INTEGER(0..79),
+        sf128                                   INTEGER(0..127),
+        sf160                                   INTEGER(0..159),
+        sf256                                   INTEGER(0..255),
+        sf320                                   INTEGER(0..319),
+        sf512                                   INTEGER(0..511),
+        sf640                                   INTEGER(0..639),
+        sf1024                                  INTEGER(0..1023),
+        sf2048                                  INTEGER(0..2047),
+        sf4096                                  INTEGER(0..4095),
+        sf8192                                  INTEGER(0..8191)
+    },
     ...
 }
 
 
 SystemInformationBlockType21-r14 ::= SEQUENCE {
-    sl-V2X-ConfigCommon-r14         SL-V2X-ConfigCommon-r14         OPTIONAL,   -- Need OR
-    lateNonCriticalExtension        OCTET STRING                    OPTIONAL,
+    sl-V2X-ConfigCommon-r14             SL-V2X-ConfigCommon-r14             OPTIONAL,   -- Need OR
+    lateNonCriticalExtension            OCTET STRING                        OPTIONAL,
     ...
 }
 
 SL-V2X-ConfigCommon-r14 ::=     SEQUENCE {
     v2x-CommRxPool-r14                  SL-CommRxPoolListV2X-r14            OPTIONAL,   -- Need OR
     v2x-CommTxPoolNormalCommon-r14      SL-CommTxPoolListV2X-r14            OPTIONAL,   -- Need OR
+    p2x-CommTxPoolNormalCommon-r14      SL-CommTxPoolListV2X-r14            OPTIONAL,   -- Need OR
     v2x-CommTxPoolExceptional-r14       SL-CommResourcePoolV2X-r14          OPTIONAL,   -- Need OR
     v2x-SyncConfig-r14                  SL-SyncConfigListV2X-r14            OPTIONAL,   -- Need OR
     v2x-InterFreqInfoList-r14           SL-InterFreqInfoListV2X-r14         OPTIONAL,   -- Need OR
-    v2x-ResourceSelectionConfig-r14         SL-CommTxPoolSensingConfig-r14      OPTIONAL,   -- Need OR
-    zoneConfig-r14                      SL-ZoneConfig-r14                   OPTIONAL    -- Need OR
+    v2x-ResourceSelectionConfig-r14     SL-CommTxPoolSensingConfig-r14      OPTIONAL,   -- Need OR
+    zoneConfig-r14                      SL-ZoneConfig-r14                   OPTIONAL,   -- Need OR
+    typeTxSync-r14                      SL-TypeTxSync-r14                   OPTIONAL,   -- Need OR
+    thresSL-TxPrioritization-r14        SL-Priority-r13                     OPTIONAL,   -- Need OR
+    anchorCarrierFreqList-r14           SL-AnchorCarrierFreqList-V2X-r14    OPTIONAL,   -- Need OR
+    offsetDFN-r14                       INTEGER (0..1000)                   OPTIONAL,   -- Need OR
+    cbr-CommonTxConfigList-r14          SL-CBR-CommonTxConfigList-r14       OPTIONAL    -- Need OR
 }
 
-SL-CommTxPoolSensingConfig-r14 ::=      SEQUENCE {
-    pssch-TxConfigList-r14                  SL-PSSCH-TxConfigList-r14,
-    thresPSSCH-RSRP-List-r14                SL-ThresPSSCH-RSRP-List-r14,
-    restrictResourceReservationPeriodList-r14   SL-RestrictResourceReservationPeriodList-r14    OPTIONAL,   -- Need OR
-    probResourceKeep-r14                ENUMERATED {v0, v0dot2, v0dot4, v0dot6, v0dot8,
-                                                    spare3,spare2, spare1}
-}
+
 
 AntennaInfoCommon ::=               SEQUENCE {
     antennaPortsCount                   ENUMERATED {an1, an2, an4, spare1}
@@ -3337,6 +3653,10 @@ AntennaInfoDedicated-v1250 ::=      SEQUENCE {
     alternativeCodebookEnabledFor4TX-r12    BOOLEAN
 }
 
+AntennaInfoDedicated-v1430 ::=      SEQUENCE {
+    ce-UE-TxAntennaSelection-config-r14         ENUMERATED {on}     OPTIONAL    -- Need OR 
+}
+
 
 AntennaInfoUL-r10 ::=       SEQUENCE {
     transmissionModeUL-r10              ENUMERATED {tm1, tm2, spare6, spare5,
@@ -3399,6 +3719,10 @@ CQI-ReportConfig-v1320 ::=          SEQUENCE {
         cqi-ReportPeriodic-v1320            CQI-ReportPeriodic-v1320    OPTIONAL    -- Need ON
 }
 
+CQI-ReportConfig-v1430 ::=          SEQUENCE {
+        cqi-ReportAperiodicHybrid-r14       CQI-ReportAperiodicHybrid-r14   OPTIONAL    -- Need ON
+}
+
 CQI-ReportConfigSCell-r10 ::=               SEQUENCE {
     cqi-ReportModeAperiodic-r10         CQI-ReportModeAperiodic OPTIONAL,           -- Need OR
     nomPDSCH-RS-EPRE-Offset-r10             INTEGER (-1..6),
@@ -3561,6 +3885,28 @@ CQI-ReportAperiodicProc-v1310   ::=     SEQUENCE {
     trigger111-r13                      BOOLEAN
 }
 
+CQI-ReportAperiodicHybrid-r14   ::=     SEQUENCE {
+    triggers-r14                        CHOICE {
+        oneBit-r14                          SEQUENCE {
+            trigger1-Indicator-r14              BIT STRING (SIZE (8))
+        },
+        twoBit-r14                          SEQUENCE {
+            trigger01-Indicator-r14         BIT STRING (SIZE (8)),
+            trigger10-Indicator-r14         BIT STRING (SIZE (8)),
+            trigger11-Indicator-r14         BIT STRING (SIZE (8))
+        },
+        threeBit-r14                        SEQUENCE {
+            trigger001-Indicator-r14            BIT STRING (SIZE (32)),
+            trigger010-Indicator-r14            BIT STRING (SIZE (32)),
+            trigger011-Indicator-r14            BIT STRING (SIZE (32)),
+            trigger100-Indicator-r14            BIT STRING (SIZE (32)),
+            trigger101-Indicator-r14            BIT STRING (SIZE (32)),
+            trigger110-Indicator-r14            BIT STRING (SIZE (32)),
+            trigger111-Indicator-r14            BIT STRING (SIZE (32))
+        }
+    }                                                               OPTIONAL    -- Need OR
+}
+
 CQI-ReportModeAperiodic ::=             ENUMERATED {
                                             rm12, rm20, rm22, rm30, rm31,
                                             rm32-v1250, rm10-v1310, rm11-v1310
@@ -3699,6 +4045,10 @@ CSI-Process-r11 ::=     SEQUENCE {
             setup                           CQI-ReportAperiodicProc-v1310
         }                                                               OPTIONAL,       -- Need ON
         eMIMO-Type-r13                  CSI-RS-ConfigEMIMO-r13          OPTIONAL        -- Need ON
+    ]],
+    [[  eMIMO-Type-v1430                CSI-RS-ConfigEMIMO-v1430        OPTIONAL,       -- Need ON
+        eMIMO-Hybrid-r14                CSI-RS-ConfigEMIMO-Hybrid-r14       OPTIONAL,   -- Need ON
+        advancedCodebookEnabled-r14     BOOLEAN                         OPTIONAL        -- Need ON
     ]]
 }
 
@@ -3733,6 +4083,12 @@ CSI-RS-Config-v1310 ::=     SEQUENCE {
     eMIMO-Type-r13              CSI-RS-ConfigEMIMO-r13          OPTIONAL    -- Need ON
 }
 
+CSI-RS-Config-v1430 ::=     SEQUENCE {
+    eMIMO-Type-v1430                CSI-RS-ConfigEMIMO-v1430            OPTIONAL,   -- Need ON
+    eMIMO-Hybrid-r14                CSI-RS-ConfigEMIMO-Hybrid-r14       OPTIONAL,   -- Need ON
+    advancedCodebookEnabled-r14     BOOLEAN                             OPTIONAL    -- Need ON
+}
+
 ZeroTxPowerCSI-RS-Conf-r12 ::=  CHOICE {
         release                         NULL,
         setup                           ZeroTxPowerCSI-RS-r12 
@@ -3752,6 +4108,27 @@ CSI-RS-ConfigEMIMO-r13 ::=  CHOICE {
     }
 }
 
+CSI-RS-ConfigEMIMO-v1430 ::=    CHOICE {
+    release                     NULL,
+    setup                       CHOICE {
+        nonPrecoded-v1430               CSI-RS-ConfigNonPrecoded-v1430,
+        beamformed-v1430                CSI-RS-ConfigBeamformed-v1430
+    }
+}
+
+CSI-RS-ConfigEMIMO2-r14 ::= CHOICE {
+    release                     NULL,
+    setup                       CSI-RS-ConfigBeamformed-r14
+}
+
+CSI-RS-ConfigEMIMO-Hybrid-r14 ::=   CHOICE {
+    release                     NULL,
+    setup                       SEQUENCE {
+        periodicityOffsetIndex-r14          INTEGER (0..1023)               OPTIONAL,   -- Need OR
+        eMIMO-Type2-r14                     CSI-RS-ConfigEMIMO2-r14     OPTIONAL    -- Need ON
+    }
+}
+
 CSI-RS-ConfigNonPrecoded-r13 ::=        SEQUENCE {
     p-C-AndCBSRList-r13                     P-C-AndCBSR-Pair-r13            OPTIONAL,   -- Need OR
     codebookConfigN1-r13                    ENUMERATED {n1, n2, n3, n4, n8},
@@ -3763,6 +4140,13 @@ CSI-RS-ConfigNonPrecoded-r13 ::=        SEQUENCE {
     csi-RS-ConfigNZP-EMIMO-r13              CSI-RS-ConfigNZP-EMIMO-r13      OPTIONAL    -- Need ON
 }
 
+CSI-RS-ConfigNonPrecoded-v1430::=       SEQUENCE {
+    csi-RS-ConfigNZP-EMIMO-v1430            CSI-RS-ConfigNZP-EMIMO-v1430    OPTIONAL,   -- Need ON
+    codebookConfigN1-v1430                  ENUMERATED {n5, n6, n7, n10, n12, n14, n16},
+    codebookConfigN2-r1430                  ENUMERATED {n5, n6, n7 },
+    nzp-ResourceConfigTM9-Original-v1430    CSI-RS-Config-NZP-v1430
+}
+
 CSI-RS-ConfigBeamformed-r13 ::=         SEQUENCE    {
     csi-RS-ConfigNZPIdListExt-r13           SEQUENCE (SIZE (1..7)) OF CSI-RS-ConfigNZPId-r13    OPTIONAL,   -- Need OR
     csi-IM-ConfigIdList-r13                 SEQUENCE (SIZE (1..8)) OF CSI-IM-ConfigId-r13   OPTIONAL,   -- Need OR
@@ -3772,6 +4156,36 @@ CSI-RS-ConfigBeamformed-r13 ::=         SEQUENCE    {
     channelMeasRestriction-r13              ENUMERATED {on}         OPTIONAL    -- Need OR
 }
 
+CSI-RS-ConfigBeamformed-r14 ::=         SEQUENCE    {
+    csi-RS-ConfigNZPIdListExt-r14           SEQUENCE (SIZE (1..7)) OF CSI-RS-ConfigNZPId-r13    OPTIONAL,   -- Need OR
+    csi-IM-ConfigIdList-r14                 SEQUENCE (SIZE (1..8)) OF CSI-IM-ConfigId-r13   OPTIONAL,   -- Need OR
+    p-C-AndCBSR-PerResourceConfigList-r14   SEQUENCE (SIZE (1..8)) OF P-C-AndCBSR-Pair-r13  OPTIONAL,   -- Need OR
+    ace-For4Tx-PerResourceConfigList-r14    SEQUENCE (SIZE (1..7)) OF BOOLEAN   OPTIONAL,   -- Need OR
+    alternativeCodebookEnabledBeamformed-r14    ENUMERATED {true}   OPTIONAL,   -- Need OR
+    channelMeasRestriction-r14              ENUMERATED {on}         OPTIONAL,   -- Need OR
+    csi-RS-ConfigNZP-ApList-r14             SEQUENCE (SIZE (1..8)) OF CSI-RS-ConfigNZP-r11
+                                                                            OPTIONAL,   -- Need OR
+    nzp-ResourceConfigOriginal-v1430    CSI-RS-Config-NZP-v1430     OPTIONAL,   -- Need OR
+    csi-RS-NZP-Activation-r14               CSI-RS-ConfigNZP-Activation-r14 OPTIONAL        -- Need OR
+}
+
+CSI-RS-ConfigBeamformed-v1430::=        SEQUENCE {
+    csi-RS-ConfigNZP-ApList-r14             SEQUENCE (SIZE (1..8)) OF CSI-RS-ConfigNZP-r11
+                                                                            OPTIONAL,   -- Need OR
+    nzp-ResourceConfigOriginal-v1430    CSI-RS-Config-NZP-v1430     OPTIONAL,   -- Need OR
+    csi-RS-NZP-Activation-r14               CSI-RS-ConfigNZP-Activation-r14 OPTIONAL        -- Need OR
+}
+
+CSI-RS-Config-NZP-v1430::=      SEQUENCE {
+    transmissionComb-r14                    NZP-TransmissionComb-r14    OPTIONAL,   -- Need OR
+    frequencyDensity-r14                    NZP-FrequencyDensity-r14    OPTIONAL    -- Need OR
+}
+
+CSI-RS-ConfigNZP-Activation-r14::=      SEQUENCE {
+    csi-RS-NZP-mode-r14                     ENUMERATED {semiPersistent, aperiodic},
+    activatedResources-r14                  INTEGER (0..4)
+}
+
 
 CSI-RS-ConfigNZP-r11 ::=        SEQUENCE {
     csi-RS-ConfigNZPId-r11          CSI-RS-ConfigNZPId-r11,
@@ -3791,6 +4205,16 @@ CSI-RS-ConfigNZP-r11 ::=        SEQUENCE {
     }                                                                   OPTIONAL,   -- Need OR
     ...,
     [[  csi-RS-ConfigNZPId-v1310        CSI-RS-ConfigNZPId-v1310        OPTIONAL    -- Need ON
+    ]],
+    [[  transmissionComb-r14            NZP-TransmissionComb-r14        OPTIONAL,   -- Need OR
+        frequencyDensity-r14            NZP-FrequencyDensity-r14        OPTIONAL    -- Need OR
+    ]],
+    [[  mbsfn-SubframeConfigList-v1430  CHOICE {
+                release                     NULL,
+                setup                       SEQUENCE {
+                    subframeConfigList-v1430    MBSFN-SubframeConfigList-v1430
+                }
+        }                                                               OPTIONAL    -- Need OP
     ]]
 }
 
@@ -3802,13 +4226,25 @@ CSI-RS-ConfigNZP-EMIMO-r13 ::=  CHOICE {
         }
 }
 
+CSI-RS-ConfigNZP-EMIMO-v1430 ::=    SEQUENCE {
+    -- All extensions are for Non-Precoded so could be grouped by setup/ release choice
+    nzp-resourceConfigListExt-r14   SEQUENCE (SIZE (0..4)) OF NZP-ResourceConfig-r13,
+    cdmType-v1430                   ENUMERATED {cdm8 }          OPTIONAL    -- Need OR
+}
+
 NZP-ResourceConfig-r13 ::=  SEQUENCE {
     resourceConfig-r13              ResourceConfig-r13,
-    ...
+    ...,
+    [[  transmissionComb-r14        NZP-TransmissionComb-r14        OPTIONAL,   -- Need OR
+        frequencyDensity-r14        NZP-FrequencyDensity-r14        OPTIONAL    -- Need OR
+    ]]
 }
 
 ResourceConfig-r13 ::=              INTEGER (0..31)
 
+NZP-TransmissionComb-r14 ::=            INTEGER (0..2)
+NZP-FrequencyDensity-r14 ::=            ENUMERATED {d1, d2, d3}
+
 
 CSI-RS-ConfigNZPId-r11 ::=                  INTEGER (1..maxCSI-RS-NZP-r11)
 CSI-RS-ConfigNZPId-v1310 ::=                INTEGER (minCSI-RS-NZP-r13..maxCSI-RS-NZP-r13)
@@ -3822,10 +4258,20 @@ CSI-RS-ConfigZP-r11 ::=     SEQUENCE {
     ...
 }
 
+CSI-RS-ConfigZP-ApList-r14 ::=  CHOICE {
+    release                         NULL,
+    setup                           SEQUENCE (SIZE (1.. maxCSI-RS-ZP-r11)) OF CSI-RS-ConfigZP-r11
+}
+
 
 CSI-RS-ConfigZPId-r11 ::=                   INTEGER (1..maxCSI-RS-ZP-r11)
 
 
+DataInactivityTimer-r14 ::=                     ENUMERATED {
+                                                s1, s2, s3, s5, s7, s10, s15, s20, s40, s50, s60,
+                                                s80, s100, s120, s150, s180}
+
+
 DMRS-Config-r11 ::=     CHOICE {
     release                     NULL,
     setup                       SEQUENCE {
@@ -3916,7 +4362,7 @@ EIMTA-MainConfigServCell-r12 ::=    CHOICE {
     release                             NULL,
     setup                               SEQUENCE {
         eimta-UL-DL-ConfigIndex-r12             INTEGER (1..5),
-        eimta-HARQ-ReferenceConfig-r12      ENUMERATED {sa2,sa4,sa5},
+        eimta-HARQ-ReferenceConfig-r12      ENUMERATED {sa2, sa4, sa5},
         mbsfn-SubframeConfigList-v1250      CHOICE {
                 release                             NULL,
                 setup                               SEQUENCE {
@@ -3945,7 +4391,10 @@ LogicalChannelConfig ::=            SEQUENCE {
     ]],
     [[  logicalChannelSR-Prohibit-r12       BOOLEAN                 OPTIONAL        -- Need ON
     ]],
-    [[  laa-Allowed-r14                 BOOLEAN                 OPTIONAL        -- Need ON
+    [[  laa-UL-Allowed-r14                  BOOLEAN                 OPTIONAL,       -- Need ON
+        bitRateQueryProhibitTimer-r14   ENUMERATED {
+                                            s0, s0dot4, s0dot8, s1dot6, s3, s6, s12,
+                                            s30}                OPTIONAL        --Need OR
     ]]
 }
 
@@ -3960,7 +4409,9 @@ LWA-Configuration-r13 ::=           CHOICE {
 LWA-Config-r13 ::=  SEQUENCE {
     lwa-MobilityConfig-r13          WLAN-MobilityConfig-r13     OPTIONAL,   -- Need ON
     lwa-WT-Counter-r13              INTEGER (0..65535)          OPTIONAL,   -- Need ON
-    ...
+    ...,
+    [[  wt-MAC-Address-r14      OCTET STRING (SIZE (6)) OPTIONAL    -- Need ON
+    ]]
 }
 
 
@@ -4051,7 +4502,13 @@ MAC-MainConfig ::=                  SEQUENCE {
                 skipUplinkTxSPS-r14                 ENUMERATED {true}       OPTIONAL,   -- Need OR
                 skipUplinkTxDynamic-r14             ENUMERATED {true}       OPTIONAL    -- Need OR
             }
-        }                                                           OPTIONAL    -- Need ON
+        }                                                           OPTIONAL,   -- Need ON
+        dataInactivityTimerConfig-r14       CHOICE {
+            release                             NULL,
+            setup                               SEQUENCE {
+                dataInactivityTimer-r14             DataInactivityTimer-r14
+            }
+        }                                                OPTIONAL   -- Need ON
     ]]
 }
 
@@ -4188,18 +4645,8 @@ PDCCH-ConfigSCell-r13 ::=       SEQUENCE {
 }
 
 PDCCH-ConfigLAA-r14 ::=     SEQUENCE {
-    enableMonitoringDCI-Format0B-r14    CHOICE {
-        release                             NULL,
-        setup                               SEQUENCE {
-            maxNumberOfSchedSubframes-Format0B-r14  ENUMERATED {sf2, sf3, sf4}
-        }
-    }                                                                   OPTIONAL,       -- Need ON
-    enableMonitoringDCI-Format4B-r14    CHOICE {
-        release                             NULL,
-        setup                               SEQUENCE {
-            maxNumberOfSchedSubframes-Format4B-r14  ENUMERATED {sf2, sf3, sf4}
-        }
-    }                                                                   OPTIONAL,       -- Need ON
+    maxNumberOfSchedSubframes-Format0B-r14  ENUMERATED {sf2, sf3, sf4}  OPTIONAL,       -- Need OR
+    maxNumberOfSchedSubframes-Format4B-r14  ENUMERATED {sf2, sf3, sf4}  OPTIONAL,       -- Need OR
     skipMonitoringDCI-Format0A-r14              ENUMERATED {true}       OPTIONAL,       -- Need OR
     skipMonitoringDCI-Format4A-r14              ENUMERATED {true}       OPTIONAL,       -- Need OR
     pdcch-CandidateReductions-Format0A-r14      
@@ -4305,9 +4752,29 @@ PDCP-Config ::=                     SEQUENCE {
                                         ms1, ms2, ms5, ms10, ms25, ms50, ms100, ms250, ms500,
                                         ms2500, ms5000, ms25000}    OPTIONAL    -- Need ON
             }
-        }                                                               OPTIONAL    -- Need ON 
+        }                                                               OPTIONAL    -- Need ON
+    ]],
+    [[  ul-LWA-Config-r14           CHOICE {
+            release                     NULL,
+            setup                       SEQUENCE {
+                ul-LWA-DRB-ViaWLAN-r14      BOOLEAN,
+                ul-LWA-DataSplitThreshold-r14   ENUMERATED {
+                                        b0, b100, b200, b400, b800, b1600, b3200, b6400,
+                                        b12800, b25600, b51200, b102400, b204800, b409600,
+                                        b819200 }           OPTIONAL    -- Need OR
+            }
+        }                                                       OPTIONAL,       -- Need ON
+        uplinkOnlyHeaderCompression-r14     CHOICE {
+            notUsed-r14                         NULL,
+            rohc-r14                                SEQUENCE {
+                maxCID-r14                              INTEGER (1..16383)      DEFAULT 15,
+                profiles-r14                            SEQUENCE {
+                    profile0x0006-r14                       BOOLEAN
+                },
+                ...
+            }
+        }                                                   OPTIONAL -- Need ON
     ]]
-
 }
 
 
@@ -4345,6 +4812,18 @@ PDSCH-ConfigDedicated-v1310 ::=     SEQUENCE {
     dmrs-ConfigPDSCH-v1310              DMRS-Config-v1310                   OPTIONAL    -- Need ON
 }
 
+PDSCH-ConfigDedicated-v1430 ::=     SEQUENCE {
+    ce-PDSCH-MaxBandwidth-r14           ENUMERATED {bw5, bw20}              OPTIONAL,   -- Need OP
+    ce-PDSCH-TenProcesses-r14           ENUMERATED {on}                     OPTIONAL,   -- Need OR
+    ce-HARQ-AckBundling-r14             ENUMERATED {on}                     OPTIONAL,   -- Need OR
+    ce-SchedulingEnhancement-r14        ENUMERATED {range1, range2}         OPTIONAL,   -- Need OR
+    tbsIndexAlt2-r14                        ENUMERATED {b33}                OPTIONAL    -- Need OR
+}
+
+PDSCH-ConfigDedicatedSCell-v1430 ::=        SEQUENCE {
+    tbsIndexAlt2-r14                        ENUMERATED {b33}                OPTIONAL    -- Need OR
+}
+
 RE-MappingQCLConfigToAddModList-r11 ::=     SEQUENCE (SIZE (1..maxRE-MapQCL-r11)) OF PDSCH-RE-MappingQCL-Config-r11
 
 RE-MappingQCLConfigToReleaseList-r11 ::=    SEQUENCE (SIZE (1..maxRE-MapQCL-r11)) OF PDSCH-RE-MappingQCL-ConfigId-r11
@@ -4364,12 +4843,26 @@ PDSCH-RE-MappingQCL-Config-r11 ::=      SEQUENCE {
     }                                                                       OPTIONAL,   -- Need OP
     csi-RS-ConfigZPId-r11               CSI-RS-ConfigZPId-r11,
     qcl-CSI-RS-ConfigNZPId-r11          CSI-RS-ConfigNZPId-r11              OPTIONAL,   -- Need OR
-    ...
+    ...,
+    [[  mbsfn-SubframeConfigList-v1430  CHOICE {
+            release                     NULL,
+            setup                       SEQUENCE {
+                subframeConfigList-v1430    MBSFN-SubframeConfigList-v1430
+            }
+        }                                                                   OPTIONAL    -- Need OP
+    ]]
 }
 
 
 PDSCH-RE-MappingQCL-ConfigId-r11 ::=        INTEGER (1..maxRE-MapQCL-r11)
 
+PerCC-GapIndicationList-r14 ::=     SEQUENCE (SIZE (1..maxServCell-r13)) OF PerCC-GapIndication-r14
+
+PerCC-GapIndication-r14 ::=         SEQUENCE {
+    servCellId-r14                              ServCellIndex-r13,      
+    gapIndication-r14                           ENUMERATED {gap, ncsg, nogap-noNcsg}
+}
+
 
 PHICH-Config ::=                    SEQUENCE {
     phich-Duration                      ENUMERATED {normal, extended},
@@ -4473,7 +4966,10 @@ PhysicalConfigDedicated ::=     SEQUENCE {
     ]],
     [[  cqi-ReportConfig-v1320                  CQI-ReportConfig-v1320  OPTIONAL        -- Need ON
     ]],
-    [[  typeA-SRS-TPC-PDCCH-Group-r14           SEQUENCE (SIZE (1..32)) OF SRS-TPC-PDCCH-Config-r14         OPTIONAL,       -- Need ON
+    [[  typeA-SRS-TPC-PDCCH-Group-r14   CHOICE {
+            release                         NULL,
+            setup                           SEQUENCE (SIZE (1..32)) OF SRS-TPC-PDCCH-Config-r14
+        }                                                               OPTIONAL,       -- Need ON
         must-Config-r14                         CHOICE{
             release                             NULL,
             setup                               SEQUENCE {
@@ -4482,9 +4978,22 @@ PhysicalConfigDedicated ::=     SEQUENCE {
                                                     dB-6, dB-4dot77, dB-3, dB-1dot77,
                                                     dB0, dB1, dB2, dB3} OPTIONAL        -- Need ON
             }
-        }                                                           OPTIONAL        -- Need ON
+        }                                                           OPTIONAL,       -- Need ON
+        pusch-EnhancementsConfig-r14        PUSCH-EnhancementsConfig-r14        OPTIONAL,   -- Need 
+        ce-pdsch-pusch-EnhancementConfig-r14        ENUMERATED {on}     OPTIONAL,   -- Need OR
+        antennaInfo-v1430               AntennaInfoDedicated-v1430      OPTIONAL,   -- Need ON
+        pucch-ConfigDedicated-v1430     PUCCH-ConfigDedicated-v1430     OPTIONAL,   -- Need ON
+        pdsch-ConfigDedicated-v1430     PDSCH-ConfigDedicated-v1430     OPTIONAL,       -- Need ON
+        pusch-ConfigDedicated-v1430     PUSCH-ConfigDedicated-v1430 OPTIONAL,       -- Need ON
+        soundingRS-UL-PeriodicConfigDedicatedList-r14           SEQUENCE (SIZE (1..2)) OF SoundingRS-UL-ConfigDedicated OPTIONAL,       -- Cond PeriodicSRSPCell
+        soundingRS-UL-PeriodicConfigDedicatedUpPTsExtList-r14   SEQUENCE (SIZE (1..4)) OF SoundingRS-UL-ConfigDedicatedUpPTsExt-r13 OPTIONAL,       -- Cond PeriodicSRSExt      
+        soundingRS-UL-AperiodicConfigDedicatedList-r14          SEQUENCE (SIZE (1..2)) OF SoundingRS-UL-ConfigDedicatedAperiodic-r10    OPTIONAL,       -- Cond AperiodicSRS
+        soundingRS-UL-ConfigDedicatedApUpPTsExtList-r14 SEQUENCE (SIZE (1..4)) OF SoundingRS-UL-ConfigDedicatedAperiodicUpPTsExt-r13    OPTIONAL,       -- Cond AperiodicSRSExt
+        csi-RS-Config-v1430             CSI-RS-Config-v1430             OPTIONAL,       -- Need ON
+        csi-RS-ConfigZP-ApList-r14              CSI-RS-ConfigZP-ApList-r14  OPTIONAL,   -- Need ON
+        cqi-ReportConfig-v1430                  CQI-ReportConfig-v1430  OPTIONAL,   -- Need ON
+        semiOpenLoop-r14                        BOOLEAN                 OPTIONAL    -- Need ON
     ]]
-
 }
 
 PhysicalConfigDedicatedSCell-r10 ::=        SEQUENCE {
@@ -4575,18 +5084,17 @@ PhysicalConfigDedicatedSCell-r10 ::=        SEQUENCE {
         csi-RS-ConfigNZPToAddModListExt-r13 CSI-RS-ConfigNZPToAddModListExt-r13 OPTIONAL,   -- Need ON
         csi-RS-ConfigNZPToReleaseListExt-r13    CSI-RS-ConfigNZPToReleaseListExt-r13    OPTIONAL    -- Need ON
     ]],
-    [[  cqi-ReportConfig-v1320                  CQI-ReportConfig-v1320  OPTIONAL        -- Need ON
+    [[  cqi-ReportConfig-v1320              CQI-ReportConfig-v1320  OPTIONAL        -- Need ON
     ]],
-    [[  laa-SCellConfiguration-v14xy                    LAA-SCellConfiguration-v14xy    OPTIONAL,       -- Need ON      
-        typeB-SRS-TPC-PDCCH-Config-r14                      SRS-TPC-PDCCH-Config-r14            OPTIONAL,       -- Need ON
+    [[  laa-SCellConfiguration-v1430        LAA-SCellConfiguration-v1430
+                                                                        OPTIONAL,   -- Need ON
+        typeB-SRS-TPC-PDCCH-Config-r14      SRS-TPC-PDCCH-Config-r14    OPTIONAL,   -- Need ON
 
-        uplinkPUSCH-LessPowerControlDedicated-v14xy         UplinkPUSCH-LessPowerControlDedicated-v14xy OPTIONAL,       -- Need ON
+        uplinkPUSCH-LessPowerControlDedicated-v1430         UplinkPUSCH-LessPowerControlDedicated-v1430 OPTIONAL,       -- Need ON
         soundingRS-UL-PeriodicConfigDedicatedList-r14                   SEQUENCE (SIZE (1..2)) OF SoundingRS-UL-ConfigDedicated                      OPTIONAL,      -- Cond PeriodicSRS
         soundingRS-UL-PeriodicConfigDedicatedUpPTsExtList-r14                   SEQUENCE (SIZE (1..4)) OF SoundingRS-UL-ConfigDedicatedUpPTsExt-r13                      OPTIONAL,      -- Cond PeriodicSRSExt      
-
-        soundingRS-UL-AperiodicConfigDedicatedList-r14                  SEQUENCE (SIZE (1..2)) OF SoundingRSAperiodicGroup-r14                       OPTIONAL,      -- Cond AperiodicSRS
-        soundingRS-UL-AperiodicConfigDedicatedUpPTsExtList-r14                  SEQUENCE (SIZE (1..4)) OF SoundingRSAperiodicGroupUpPTsExt-r14               OPTIONAL,      -- Cond AperiodicSRSExt
-
+        soundingRS-UL-AperiodicConfigDedicatedList-r14                  SEQUENCE (SIZE (1..2)) OF SoundingRS-AperiodicSet-r14                        OPTIONAL,      -- Cond AperiodicSRS
+        soundingRS-UL-ConfigDedicatedApUpPTsExtList-r14                 SEQUENCE (SIZE (1..4)) OF SoundingRS-AperiodicSetUpPTsExt-r14                OPTIONAL,      -- Cond AperiodicSRSExt
         must-Config-r14                         CHOICE{
             release                             NULL,
             setup                               SEQUENCE {
@@ -4595,7 +5103,13 @@ PhysicalConfigDedicatedSCell-r10 ::=        SEQUENCE {
                                                     dB-6, dB-4dot77, dB-3, dB-1dot77,
                                                     dB0, dB1, dB2, dB3} OPTIONAL        -- Need ON
             }
-        }                                                           OPTIONAL        -- Need ON
+        }                                                           OPTIONAL,       -- Need ON
+        pusch-ConfigDedicated-v1430             PUSCH-ConfigDedicatedSCell-v1430    OPTIONAL,   -- Need ON
+        csi-RS-Config-v1430                     CSI-RS-Config-v1430         OPTIONAL,   -- Need ON
+        csi-RS-ConfigZP-ApList-r14              CSI-RS-ConfigZP-ApList-r14      OPTIONAL,   -- Need ON
+        cqi-ReportConfig-v1430                  CQI-ReportConfig-v1430  OPTIONAL,   -- Need ON
+        semiOpenLoop-r14                        BOOLEAN                     OPTIONAL,   -- Need ON
+        pdsch-ConfigDedicatedSCell-v1430        PDSCH-ConfigDedicatedSCell-v1430        OPTIONAL        -- Need ON
     ]]
 }
 
@@ -4604,7 +5118,7 @@ LAA-SCellConfiguration-r13 ::=          SEQUENCE {
     laa-SCellSubframeConfig-r13             BIT STRING (SIZE(8))
 }
 
-LAA-SCellConfiguration-v14xy ::=        SEQUENCE {
+LAA-SCellConfiguration-v1430 ::=        SEQUENCE {
     crossCarrierSchedulingConfig-UL-r14 CHOICE {
         release                                 NULL,
         setup                                   SEQUENCE {
@@ -4614,8 +5128,8 @@ LAA-SCellConfiguration-v14xy ::=        SEQUENCE {
     lbt-Config-r14                              LBT-Config-r14          OPTIONAL,       -- Need ON
     pdcch-ConfigLAA-r14                         PDCCH-ConfigLAA-r14     OPTIONAL,       -- Need ON
     absenceOfAnyOtherTechnology-r14         ENUMERATED {true}       OPTIONAL,       -- Need OR
-    soundingRS-UL-ConfigDedicatedAperiodic-v14xy
-                        SoundingRS-UL-ConfigDedicatedAperiodic-v14xy    OPTIONAL        -- Need ON
+    soundingRS-UL-ConfigDedicatedAperiodic-v1430
+                        SoundingRS-UL-ConfigDedicatedAperiodic-v1430    OPTIONAL        -- Need ON
 }
 
 LBT-Config-r14 ::=      CHOICE{
@@ -4635,14 +5149,20 @@ CSI-RS-ConfigZPToAddModList-r11 ::= SEQUENCE (SIZE (1..maxCSI-RS-ZP-r11)) OF CSI
 
 CSI-RS-ConfigZPToReleaseList-r11 ::=    SEQUENCE (SIZE (1..maxCSI-RS-ZP-r11)) OF CSI-RS-ConfigZPId-r11
 
-SoundingRSAperiodicGroup-r14 ::= SEQUENCE{
-    srsCcGroupIndexList                 SEQUENCE (SIZE (1..4)) OF SrsCcGroupIndex OPTIONAL, -- Cond Srs-Trigger-TypeA
-    soundingRS-UL-ConfigDedicatedAperiodic-r10      SoundingRS-UL-ConfigDedicatedAperiodic-r10
+SoundingRS-AperiodicSet-r14 ::= SEQUENCE{
+    srs-CC-SetIndexList-r14                 
+                                SEQUENCE (SIZE (1..4)) OF SRS-CC-SetIndex-r14
+                                                             OPTIONAL,  -- Cond SRS-Trigger-TypeA
+    soundingRS-UL-ConfigDedicatedAperiodic-r14
+                                                SoundingRS-UL-ConfigDedicatedAperiodic-r10
 }
 
-SoundingRSAperiodicGroupUpPTsExt-r14 ::= SEQUENCE{
-    srsCcGroupIndexList                 SEQUENCE (SIZE (1..4)) OF SrsCcGroupIndex OPTIONAL, -- Cond Srs-Trigger-TypeA
-    soundingRS-UL-ConfigDedicatedAperiodicUpPTsExt-r13      SoundingRS-UL-ConfigDedicatedAperiodicUpPTsExt-r13
+SoundingRS-AperiodicSetUpPTsExt-r14 ::= SEQUENCE{
+    srs-CC-SetIndexList-r14
+                                SEQUENCE (SIZE (1..4)) OF SRS-CC-SetIndex-r14 
+                                                            OPTIONAL,   -- Cond SRS-Trigger-TypeA
+    soundingRS-UL-ConfigDedicatedAperiodicUpPTsExt-r14
+                                            SoundingRS-UL-ConfigDedicatedAperiodicUpPTsExt-r13
 }
 
 
@@ -4682,9 +5202,11 @@ PRACH-Config-v1310 ::=              SEQUENCE {
     initial-CE-level-r13                    INTEGER (0..3)      OPTIONAL    -- Need OR
 }
 
-PRACH-Config-v14xy ::=              SEQUENCE {
+PRACH-Config-v1430 ::=              SEQUENCE {
     rootSequenceIndexHighSpeed-r14              INTEGER (0..837),
-    zeroCorrelationZoneConfigHighSpeed-r14      INTEGER (0..12)
+    zeroCorrelationZoneConfigHighSpeed-r14      INTEGER (0..12),
+    prach-ConfigIndexHighSpeed-r14              INTEGER (0..63),
+    prach-FreqOffsetHighSpeed-r14               INTEGER (0..94)
 }
 
 PRACH-ConfigSCell-r10 ::=               SEQUENCE {
@@ -4736,7 +5258,11 @@ PUCCH-ConfigCommon-v1310 ::=        SEQUENCE {
     pucch-NumRepetitionCE-Msg4-Level3-r13   ENUMERATED {n4, n8, n16, n32}   OPTIONAL    -- Need OR
 }
 
-PUCCH-ConfigDedicated ::=           SEQUENCE {
+PUCCH-ConfigCommon-v1430 ::=        SEQUENCE {
+    pucch-NumRepetitionCE-Msg4-Level3-r14   ENUMERATED {n64, n128}  OPTIONAL    -- Need OR
+}
+
+PUCCH-ConfigDedicated ::=           SEQUENCE {
     ackNackRepetition                   CHOICE{
         release                             NULL,
         setup                               SEQUENCE {
@@ -4875,6 +5401,10 @@ PUCCH-ConfigDedicated-r13 ::=       SEQUENCE {
     }                                                                       OPTIONAL    --Need ON
 }
 
+PUCCH-ConfigDedicated-v1430 ::=     SEQUENCE {
+    pucch-NumRepetitionCE-format1-r14       ENUMERATED {r64,r128}       OPTIONAL    -- Need OR
+}
+
 Format4-resource-r13    ::=             SEQUENCE {
     startingPRB-format4-r13                     INTEGER (0..109),
     numberOfPRB-format4-r13                 INTEGER (0..7)
@@ -4976,7 +5506,7 @@ PUSCH-ConfigDedicated-r13 ::=           SEQUENCE {
             nPUSCH-Identity-r13                     INTEGER (0..509),
             nDMRS-CSH-Identity-r13                  INTEGER (0..509)
         }
-    }                                                                   OPTIONAL,   -- Need ON
+    }                                                                       OPTIONAL,   -- Need ON
     uciOnPUSCH                              CHOICE {
         release                                 NULL,
         setup                                   SEQUENCE {
@@ -4995,11 +5525,58 @@ PUSCH-ConfigDedicated-r13 ::=           SEQUENCE {
     pusch-HoppingConfig-r13                 ENUMERATED {on}                 OPTIONAL    -- Need OR
 }
 
+PUSCH-ConfigDedicated-v1430 ::=         SEQUENCE {
+    ce-PUSCH-NB-MaxTBS-r14                  ENUMERATED {on}                 OPTIONAL,   -- Need OR
+    ce-PUSCH-MaxBandwidth-r14               ENUMERATED {bw5}                OPTIONAL,   -- Need OP
+    tdd-PUSCH-UpPTS-r14                     TDD-PUSCH-UpPTS-r14             OPTIONAL,   -- Need ON
+    ul-DMRS-IFDMA-r14                       BOOLEAN,
+    enable256QAM-r14                        Enable256QAM-r14                OPTIONAL    -- Need ON
+}
+
 PUSCH-ConfigDedicatedSCell-r10 ::=      SEQUENCE {
     groupHoppingDisabled-r10                ENUMERATED {true}               OPTIONAL,   -- Need OR
     dmrs-WithOCC-Activated-r10              ENUMERATED {true}               OPTIONAL    -- Need OR
 }
 
+PUSCH-ConfigDedicatedSCell-v1430 ::=            SEQUENCE {
+    enable256QAM-r14                        Enable256QAM-r14                OPTIONAL    -- Need OR
+}
+
+TDD-PUSCH-UpPTS-r14 ::=                 CHOICE {
+    release                                 NULL,
+    setup                                   SEQUENCE {
+        symPUSCH-UpPTS-r14                      ENUMERATED {sym1, sym2, sym3, sym4, sym5, sym6}                                                                                 OPTIONAL,   -- Need ON
+        dmrs-LessUpPTS-Config-r14               ENUMERATED {true}           OPTIONAL    -- Need OR
+    }
+}
+
+Enable256QAM-r14 ::=                    CHOICE {
+        release                             NULL,
+        setup                               CHOICE {
+            tpc-SubframeSet-Configured-r14      SEQUENCE {
+                    subframeSet1-DCI-Format0-r14                                        BOOLEAN,
+                    subframeSet1-DCI-Format4-r14                                        BOOLEAN,
+                    subframeSet2-DCI-Format0-r14                                        BOOLEAN,
+                    subframeSet2-DCI-Format4-r14                                        BOOLEAN
+            },
+            tpc-SubframeSet-NotConfigured-r14   SEQUENCE {
+                    dci-Format0-r14     BOOLEAN,
+                    dci-Format4-r14     BOOLEAN
+            }
+        }
+}
+
+PUSCH-EnhancementsConfig-r14 ::=        CHOICE {
+    release                         NULL,
+    setup                           SEQUENCE {
+        pusch-HoppingOffsetPUSCH-Enh-r14            INTEGER (1..100)        OPTIONAL,   -- Need ON
+        interval-ULHoppingPUSCH-Enh-r14         CHOICE {
+            interval-FDD-PUSCH-Enh-r14              ENUMERATED {int1, int2, int4, int8},
+            interval-TDD-PUSCH-Enh-r14              ENUMERATED {int1, int5, int10, int20}
+        }                                                                   OPTIONAL    -- Need ON
+    }
+}
+
 UL-ReferenceSignalsPUSCH ::=        SEQUENCE {
     groupHoppingEnabled                 BOOLEAN,
     groupAssignmentPUSCH                INTEGER (0..29),
@@ -5123,7 +5700,8 @@ RadioResourceConfigCommonSIB ::=    SEQUENCE {
         pucch-ConfigCommon-v1310        PUCCH-ConfigCommon-v1310            OPTIONAL    -- Need OR
     ]],
     [[  highSpeedConfig-r14             HighSpeedConfig-r14                 OPTIONAL,   -- Need OR
-        prach-Config-v14xy              PRACH-Config-v14xy                  OPTIONAL    -- Need OR
+        prach-Config-v1430              PRACH-Config-v1430                  OPTIONAL,   -- Need OR
+        pucch-ConfigCommon-v1430        PUCCH-ConfigCommon-v1430            OPTIONAL    -- Need OR
     ]]
 }
 
@@ -5156,7 +5734,9 @@ RadioResourceConfigCommon ::=       SEQUENCE {
         uplinkPowerControlCommon-v1310  UplinkPowerControlCommon-v1310      OPTIONAL    -- Need ON
     ]],
     [[  highSpeedConfig-r14             HighSpeedConfig-r14                 OPTIONAL,   -- Need OR
-        prach-Config-v14xy              PRACH-Config-v14xy                  OPTIONAL    -- Need OR
+        prach-Config-v1430              PRACH-Config-v1430                  OPTIONAL,   -- Need OR
+        pucch-ConfigCommon-v1430        PUCCH-ConfigCommon-v1430            OPTIONAL,   -- Need OR
+        tdd-Config-v1430                TDD-Config-v1430                    OPTIONAL    -- Cond TDD3
     ]]
 }
 
@@ -5219,7 +5799,7 @@ RadioResourceConfigCommonSCell-r10 ::=  SEQUENCE {
                                 UplinkPowerControlCommonSCell-v1310 OPTIONAL    -- Cond UL
     ]],
     [[  highSpeedConfigSCell-r14        HighSpeedConfigSCell-r14            OPTIONAL,   -- Need OR
-        prach-Config-v14xy              PRACH-Config-v14xy                  OPTIONAL,   -- Cond UL
+        prach-Config-v1430              PRACH-Config-v1430                  OPTIONAL,   -- Cond UL
     ul-Configuration-r14                SEQUENCE {
         ul-FreqInfo-r14                     SEQUENCE {
             ul-CarrierFreq-r14                  ARFCN-ValueEUTRA-r9         OPTIONAL,   -- Need OP
@@ -5231,11 +5811,13 @@ RadioResourceConfigCommonSCell-r10 ::=  SEQUENCE {
         soundingRS-UL-ConfigCommon-r14      SoundingRS-UL-ConfigCommon,
         ul-CyclicPrefixLength-r14           UL-CyclicPrefixLength,
         prach-ConfigSCell-r14                   PRACH-ConfigSCell-r10       OPTIONAL,   -- Cond TDD-OR-NoR11        
-        uplinkPowerControlCommonPUSCH-LessCell-v14xy                                                UplinkPowerControlCommonPUSCH-LessCell-v14xy    OPTIONAL    -- Need OR
+        uplinkPowerControlCommonPUSCH-LessCell-v1430                                                UplinkPowerControlCommonPUSCH-LessCell-v1430    OPTIONAL    -- Need OR
 }                                                                   OPTIONAL,   -- Cond ULSRS
     harq-ReferenceConfig-r14                    ENUMERATED {sa2,sa4,sa5}    OPTIONAL,       -- Need OR
     soundingRS-FlexibleTiming-r14               ENUMERATED {true}           OPTIONAL        -- Need OR
-    ]]  
+    ]],
+    [[  mbsfn-SubframeConfigList-v1430      MBSFN-SubframeConfigList-v1430      OPTIONAL-- Need ON
+    ]]
 }
 
 BCCH-Config ::=                     SEQUENCE {
@@ -5316,6 +5898,8 @@ RadioResourceConfigDedicated ::=        SEQUENCE {
     ]],
     [[  neighCellsCRS-Info-r13          NeighCellsCRS-Info-r13              OPTIONAL,   -- Cond CRSIM
         rlf-TimersAndConstants-r13      RLF-TimersAndConstants-r13          OPTIONAL    -- Need ON
+    ]],
+    [[  sps-Config-v1430                SPS-Config-v1430                    OPTIONAL    -- Cond SPS
     ]]
 }
 
@@ -5326,6 +5910,8 @@ RadioResourceConfigDedicatedPSCell-r12 ::=      SEQUENCE {
     naics-Info-r12                          NAICS-AssistanceInfo-r12    OPTIONAL,   -- Need ON
     ...,
     [[  neighCellsCRS-InfoPSCell-r13        NeighCellsCRS-Info-r13      OPTIONAL    -- Need ON
+    ]],
+    [[  sps-Config-v1430                SPS-Config-v1430                OPTIONAL    -- Cond SPS2
     ]]
 }
 
@@ -5346,7 +5932,6 @@ RadioResourceConfigDedicatedSCell-r10 ::=   SEQUENCE {
     ]],
     [[  neighCellsCRS-InfoSCell-r13         NeighCellsCRS-Info-r13      OPTIONAL    -- Need ON
     ]]
-
 }
 
 SRB-ToAddModList ::=                SEQUENCE (SIZE (1..2)) OF SRB-ToAddMod
@@ -5384,9 +5969,10 @@ DRB-ToAddMod ::=    SEQUENCE {
         drb-TypeLWIP-r13                    ENUMERATED {lwip, lwip-DL-only,
                                              lwip-UL-only, eutran}      OPTIONAL        -- Need ON
     ]],
-    [[  rlc-Config-v14xy                    RLC-Config-v14xy        OPTIONAL,       -- Need ON
+    [[  rlc-Config-v1430                    RLC-Config-v1430        OPTIONAL,       -- Need ON
         lwip-UL-Aggregation-r14             BOOLEAN                 OPTIONAL,       -- Cond LWIP
-        lwip-DL-Aggregation-r14             BOOLEAN                 OPTIONAL        -- Cond LWIP
+        lwip-DL-Aggregation-r14             BOOLEAN                 OPTIONAL,       -- Cond LWIP
+        lwa-WLAN-AC-r14         ENUMERATED {ac-bk, ac-be, ac-vi, ac-vo} OPTIONAL    -- Cond UL-LWA
     ]]
 }
 
@@ -5404,7 +5990,7 @@ DRB-ToAddModSCG-r12 ::= SEQUENCE {
     logicalChannelIdentitySCG-r12       INTEGER (3..10)         OPTIONAL,   -- Cond DRB-SetupS
     logicalChannelConfigSCG-r12         LogicalChannelConfig    OPTIONAL,   -- Cond SetupS
     ...,
-    [[  rlc-Config-v14xy                    RLC-Config-v14xy        OPTIONAL        -- Need ON
+    [[  rlc-Config-v1430                    RLC-Config-v1430        OPTIONAL        -- Need ON
     ]]
 }
 
@@ -5426,7 +6012,9 @@ CRS-AssistanceInfo-r11 ::= SEQUENCE {
     physCellId-r11                      PhysCellId,
     antennaPortsCount-r11               ENUMERATED {an1, an2, an4, spare1},
     mbsfn-SubframeConfigList-r11        MBSFN-SubframeConfigList,
-    ...
+    ...,
+    [[  mbsfn-SubframeConfigList-v1430  MBSFN-SubframeConfigList-v1430      OPTIONAL    -- Need ON
+    ]]
 }
 
 NeighCellsCRS-Info-r13 ::=      CHOICE {
@@ -5439,8 +6027,10 @@ CRS-AssistanceInfoList-r13 ::=  SEQUENCE (SIZE (1..maxCellReport)) OF CRS-Assist
 CRS-AssistanceInfo-r13 ::= SEQUENCE {
     physCellId-r13                      PhysCellId,
     antennaPortsCount-r13               ENUMERATED {an1, an2, an4, spare1},
-    mbsfn-SubframeConfigList-r13        MBSFN-SubframeConfigList    OPTIONAL,   -- Need ON
-    ...
+    mbsfn-SubframeConfigList-r13        MBSFN-SubframeConfigList            OPTIONAL,   -- Need ON
+    ...,
+    [[  mbsfn-SubframeConfigList-v1430  MBSFN-SubframeConfigList-v1430      OPTIONAL    -- Need ON
+    ]]
 }
 
 NAICS-AssistanceInfo-r12 ::=        CHOICE {
@@ -5517,7 +6107,7 @@ RLC-Config-v1310 ::=                SEQUENCE {
     pollPDU-v1310                               PollPDU-v1310       OPTIONAL    -- Need OR
 }
 
-RLC-Config-v14xy ::=                CHOICE {
+RLC-Config-v1430 ::=                CHOICE {
     release                             NULL,
     setup                               SEQUENCE {
         pollByte-r14                        PollByte-r14
@@ -5826,7 +6416,7 @@ SoundingRS-UL-ConfigDedicatedAperiodicUpPTsExt-r13 ::=  CHOICE{
     }
 }
 
-SoundingRS-UL-ConfigDedicatedAperiodic-v14xy ::=    CHOICE{
+SoundingRS-UL-ConfigDedicatedAperiodic-v1430 ::=    CHOICE{
     release                             NULL,
     setup                               SEQUENCE {      
         srs-SubframeIndication-r14          INTEGER (1..4)  OPTIONAL        -- Need ON
@@ -5866,6 +6456,23 @@ SPS-Config ::=  SEQUENCE {
     sps-ConfigUL                    SPS-ConfigUL            OPTIONAL            -- Need ON
 }
 
+SPS-Config-v1430 ::=    SEQUENCE {
+    ul-SPS-V-RNTI-r14                   C-RNTI                  OPTIONAL,           -- Need OR
+    sl-SPS-V-RNTI-r14                   C-RNTI                  OPTIONAL,           -- Need OR
+    sps-ConfigUL-ToAddModList-r14       SPS-ConfigUL-ToAddModList-r14   OPTIONAL,   -- Need ON
+    sps-ConfigUL-ToReleaseList-r14      SPS-ConfigUL-ToReleaseList-r14  OPTIONAL,   -- Need ON
+    sps-ConfigSL-ToAddModList-r14       SPS-ConfigSL-ToAddModList-r14   OPTIONAL,   -- Need ON
+    sps-ConfigSL-ToReleaseList-r14      SPS-ConfigSL-ToReleaseList-r14  OPTIONAL    -- Need ON
+}
+
+SPS-ConfigUL-ToAddModList-r14 ::= SEQUENCE (SIZE (1..maxConfigSPS-r14)) OF SPS-ConfigUL
+
+SPS-ConfigUL-ToReleaseList-r14 ::= SEQUENCE (SIZE (1..maxConfigSPS-r14)) OF SPS-ConfigIndex-r14
+
+SPS-ConfigSL-ToAddModList-r14 ::= SEQUENCE (SIZE (1..maxConfigSPS-r14)) OF SPS-ConfigSL-r14
+
+SPS-ConfigSL-ToReleaseList-r14 ::= SEQUENCE (SIZE (1..maxConfigSPS-r14)) OF SPS-ConfigIndex-r14
+
 SPS-ConfigDL ::=    CHOICE{
     release                         NULL,
     setup                           SEQUENCE {
@@ -5892,8 +6499,8 @@ SPS-ConfigUL ::=    CHOICE {
     setup                           SEQUENCE {
         semiPersistSchedIntervalUL          ENUMERATED {
                                                 sf10, sf20, sf32, sf40, sf64, sf80,
-                                                sf128, sf160, sf320, sf640, sf1-v14xy,
-                                                sf2-v14xy, sf3-v14xy, sf4-v14xy, sf5-v14xy,
+                                                sf128, sf160, sf320, sf640, sf1-v1430,
+                                                sf2-v1430, sf3-v1430, sf4-v1430, sf5-v1430,
                                                 spare1},
         implicitReleaseAfter                ENUMERATED {e2, e3, e4, e8},
         p0-Persistent                       SEQUENCE {
@@ -5912,11 +6519,27 @@ SPS-ConfigUL ::=    CHOICE {
         ]],
         [[  numberOfConfUlSPS-Processes-r13         INTEGER (1..8)      OPTIONAL    -- Need OR
         ]],
-        [[  fixedRV-NonAdaptive-r14                 ENUMERATED {true}       OPTIONAL    -- Need OR
+        [[  fixedRV-NonAdaptive-r14                 ENUMERATED {true}       OPTIONAL,   -- Need OR
+            sps-ConfigIndex-r14                     SPS-ConfigIndex-r14     OPTIONAL,   -- Need OR
+            semiPersistSchedIntervalUL-v1430        ENUMERATED {
+                                            sf50, sf100, sf200, sf300, sf400, sf500,
+                                            sf600, sf700, sf800, sf900, sf1000, spare5,
+                                            spare4, spare3, spare2, spare1} OPTIONAL    -- Need OR
+
         ]]
     }
 }
 
+SPS-ConfigSL-r14 ::=    SEQUENCE {
+    sps-ConfigIndex-r14             SPS-ConfigIndex-r14,
+    semiPersistSchedIntervalSL-r14  ENUMERATED {
+                                        sf20, sf50, sf100, sf200, sf300, sf400,
+                                        sf500, sf600, sf700, sf800, sf900, sf1000,
+                                        spare4, spare3, spare2, spare1}
+}
+
+SPS-ConfigIndex-r14 ::=         INTEGER (1..maxConfigSPS-r14)
+
 N1PUCCH-AN-PersistentList ::=       SEQUENCE (SIZE (1..4)) OF INTEGER (0..2047)
 
 
@@ -5925,12 +6548,16 @@ SRS-TPC-PDCCH-Config-r14 ::=                    CHOICE {
     setup                               SEQUENCE {
         srs-TPC-RNTI-r14                                    BIT STRING (SIZE (16)),
     startingBitOfFormat3B-r14                           INTEGER (0..31),                fieldTypeFormat3B-r14                               INTEGER (1..4), 
-        srsCcGroupIndexlist                                 SEQUENCE (SIZE(1..4)) OF SrsCcGroupIndex    OPTIONAL    -- Cond Srs-Trigger-TypeA       
+        srs-CC-SetIndexlist-r14                                 SEQUENCE (SIZE(1..4)) OF SRS-CC-SetIndex-r14    OPTIONAL    -- Cond SRS-Trigger-TypeA       
 
     }
 }
 
-SrsCcGroupIndex ::=                     INTEGER (0..3)
+SRS-CC-SetIndex-r14 ::=         SEQUENCE {
+    cc-SetIndex-r14             INTEGER (0..3),
+    cc-IndexInOneCC-Set-r14     INTEGER (0..7)
+}
+
 
 TDD-Config ::=                      SEQUENCE {
     subframeAssignment                  ENUMERATED {
@@ -5944,6 +6571,10 @@ TDD-Config-v1130 ::=                SEQUENCE {
     specialSubframePatterns-v1130       ENUMERATED {ssp7,ssp9}
 }
 
+TDD-Config-v1430 ::=                SEQUENCE {
+    specialSubframePatterns-v1430       ENUMERATED {ssp10}
+}
+
 TDD-ConfigSL-r12 ::=        SEQUENCE {
     subframeAssignmentSL-r12                ENUMERATED {
                                             none, sa0, sa1, sa2, sa3, sa4, sa5, sa6}
@@ -6049,9 +6680,9 @@ UplinkPowerControlCommonSCell-v1310 ::= SEQUENCE {
                                                 deltaF10, deltaF9, deltaF8, deltaF7, 
                                                 spare1}                         OPTIONAL    -- Need OR
 }
-UplinkPowerControlCommonPUSCH-LessCell-v14xy ::=    SEQUENCE {
-    p0-Nominal-PeriodicSRS                      INTEGER (-126..24)          OPTIONAL,   -- Need OR
-    p0-Nominal-AperiodicSRS                     INTEGER (-126..24)          OPTIONAL,   -- Need OR
+UplinkPowerControlCommonPUSCH-LessCell-v1430 ::=    SEQUENCE {
+    p0-Nominal-PeriodicSRS-r14                      INTEGER (-126..24)      OPTIONAL,   -- Need OR
+    p0-Nominal-AperiodicSRS-r14                     INTEGER (-126..24)      OPTIONAL,   -- Need OR
     alpha-SRS-r14                               Alpha-r12                   OPTIONAL    -- Need OR
 }
 
@@ -6087,10 +6718,10 @@ UplinkPowerControlDedicated-v1250 ::=   SEQUENCE {
     }
 }
 
-UplinkPUSCH-LessPowerControlDedicated-v14xy ::=     SEQUENCE {
-    p0-UE-PeriodicSRS                           INTEGER (-8..7)             OPTIONAL,   -- Need OR
-    p0-UE-AperiodicSRS                          INTEGER (-8..7)             OPTIONAL,   -- Need OR
-    accumulationEnabled                         BOOLEAN
+UplinkPUSCH-LessPowerControlDedicated-v1430 ::=     SEQUENCE {
+    p0-UE-PeriodicSRS-r14                       INTEGER (-8..7)             OPTIONAL,   -- Need OR
+    p0-UE-AperiodicSRS-r14                      INTEGER (-8..7)             OPTIONAL,   -- Need OR
+    accumulationEnabled-r14                     BOOLEAN
 }
 
 UplinkPowerControlDedicatedSCell-r10 ::=        SEQUENCE {
@@ -6143,7 +6774,9 @@ WLAN-MobilityConfig-r13 ::=     SEQUENCE {
     associationTimer-r13                ENUMERATED {s10, s30,
                                          s60, s120, s240}           OPTIONAL,   -- Need OR
     successReportRequested-r13          ENUMERATED {true}           OPTIONAL,   -- Need OR
-    ...
+    ...,
+    [[  wlan-SuspendConfig-r14          WLAN-SuspendConfig-r14      OPTIONAL    -- Need ON
+    ]]
 }
 
 
@@ -6246,6 +6879,15 @@ CellSelectionInfoCE-r13 ::=     SEQUENCE {
 }
 
 
+CellSelectionInfoCE1-r13 ::=        SEQUENCE {
+    q-RxLevMinCE1-r13               Q-RxLevMin,
+    q-QualMinRSRQ-CE1-r13           Q-QualMin-r9                        OPTIONAL    -- Need OR
+}
+
+CellSelectionInfoCE1-v1360 ::=      SEQUENCE {
+    delta-RxLevMinCE1-v1360                 INTEGER (-8..-1)
+}
+
 CellReselectionSubPriority-r13 ::=          ENUMERATED {oDot2, oDot4, oDot6, oDot8}
 
 
@@ -6334,7 +6976,11 @@ MobilityControlInfo ::=     SEQUENCE {
     ]],
     [[  drb-ContinueROHC-r11            ENUMERATED {true}                   OPTIONAL    -- Cond HO
     ]],
-    [[  mobilityControlInfoV2X-r14  MobilityControlInfoV2X-r14              OPTIONAL    -- Need OR
+    [[  mobilityControlInfoV2X-r14  MobilityControlInfoV2X-r14              OPTIONAL,   -- Need ON
+        handoverWithoutWT-Change-r14    ENUMERATED {keepLWA-Config, sendEndMarker}  OPTIONAL,   -- Cond HO
+        makeBeforeBreak-r14             ENUMERATED {true}                   OPTIONAL,   -- Need OR
+        rach-Skip-r14                   RACH-Skip-r14                       OPTIONAL,   -- Need OR
+        sameSFN-Indication-r14          ENUMERATED {true}                   OPTIONAL    -- Cond HO-SFNsynced
     ]]
 }
 
@@ -6345,13 +6991,17 @@ MobilityControlInfoSCG-r12 ::=      SEQUENCE {
     ue-IdentitySCG-r12                  C-RNTI                          OPTIONAL,   -- Cond SCGEst,
     rach-ConfigDedicated-r12            RACH-ConfigDedicated            OPTIONAL,   -- Need OP
     cipheringAlgorithmSCG-r12       CipheringAlgorithm-r12      OPTIONAL,   -- Need ON
-    ...
+    ...,
+    [[  makeBeforeBreakSCG-r14          ENUMERATED {true}               OPTIONAL,   -- Need OR
+        rach-SkipSCG-r14                RACH-Skip-r14                   OPTIONAL    -- Need OR
+    ]]
 }
 
 MobilityControlInfoV2X-r14 ::=  SEQUENCE {
     v2x-CommTxPoolExceptional-r14       SL-CommResourcePoolV2X-r14      OPTIONAL,       -- Need OR
     v2x-CommRxPool-r14                  SL-CommRxPoolListV2X-r14        OPTIONAL,       -- Need OR
-    v2x-CommSyncConfig-r14              SL-SyncConfigListV2X-r14        OPTIONAL        -- Need OR
+    v2x-CommSyncConfig-r14              SL-SyncConfigListV2X-r14        OPTIONAL,       -- Need OR
+    cbr-MobilityTxConfigList-r14        SL-CBR-CommonTxConfigList-r14   OPTIONAL        -- Need OR
 }
 
 CarrierBandwidthEUTRA ::=           SEQUENCE {
@@ -6375,6 +7025,22 @@ CarrierFreqEUTRA-v9e0 ::=           SEQUENCE {
     ul-CarrierFreq-v9e0                 ARFCN-ValueEUTRA-r9         OPTIONAL    -- Cond FDD
 }
 
+RACH-Skip-r14 ::=                   SEQUENCE {
+    targetTA-r14                    CHOICE {
+        ta0-r14                         NULL,
+        ptag-r14                        NULL,
+        pstag-r14                       NULL,
+        mcg-STAG-r14                    STAG-Id-r11,
+        scg-STAG-r14                    STAG-Id-r11
+    },
+    ul-ConfigInfo-r14               SEQUENCE {
+        numberOfConfUL-Processes-r14            INTEGER (1..8),
+        ul-SchedInterval-r14            ENUMERATED {sf2, sf5, sf10},
+        ul-StartSubframe-r14            INTEGER (0..9),
+        ul-Grant-r14                    BIT STRING (SIZE (16))
+    }                                                               OPTIONAL    -- Need OR
+}
+
 
 MobilityParametersCDMA2000 ::=          OCTET STRING
 
@@ -6599,7 +7265,10 @@ MeasConfig ::=                      SEQUENCE {
         measObjectToRemoveListExt-r13       MeasObjectToRemoveListExt-r13   OPTIONAL,   -- Need ON
         measObjectToAddModListExt-r13       MeasObjectToAddModListExt-r13   OPTIONAL,   -- Need ON
         measIdToAddModList-v1310            MeasIdToAddModList-v1310        OPTIONAL,   -- Need ON
-        measIdToAddModListExt-v1310         MeasIdToAddModListExt-v1310     OPTIONAL        -- Need ON
+        measIdToAddModListExt-v1310         MeasIdToAddModListExt-v1310     OPTIONAL    -- Need ON
+    ]],
+    [[  measGapConfigPerCC-List-r14         MeasGapConfigPerCC-List-r14     OPTIONAL,   -- Need ON
+        measGapSharingConfig-r14            MeasGapSharingConfig-r14        OPTIONAL    -- Need ON
     ]]
 }
 
@@ -6656,12 +7325,50 @@ MeasGapConfig ::=                   CHOICE {
         gapOffset                           CHOICE {
                 gp0                                 INTEGER (0..39),
                 gp1                                 INTEGER (0..79),
-                ...
+                
+                ...,
+                gp2-r14                             INTEGER (0..39),
+                gp3-r14                             INTEGER (0..79), 
+                gp-ncsg1-r14                        INTEGER (0..39), 
+                gp-ncsg2-r14                        INTEGER (0..79), 
+                gp-ncsg3-r14                        INTEGER (0..39), 
+                gp-ncsg4-r14                        INTEGER (0..79),
+                gp-nonUniform1-r14                  INTEGER (0..1279),
+                gp-nonUniform2-r14                  INTEGER (0..2559),
+                gp-nonUniform3-r14                  INTEGER (0..5119),
+                gp-nonUniform4-r14                  INTEGER (0..10239)
         }
     }
 }
 
 
+
+MeasGapConfigPerCC-List-r14 ::= CHOICE {
+    release                     NULL,
+    setup                       SEQUENCE {
+        measGapConfigToRemoveList-r14   MeasGapConfigToRemoveList-r14   OPTIONAL,   -- Need ON
+        measGapConfigToAddModList-r14   MeasGapConfigToAddModList-r14   OPTIONAL    -- Need ON
+    }
+}
+
+MeasGapConfigToRemoveList-r14 ::=   SEQUENCE (SIZE (1..maxServCell-r13)) OF ServCellIndex-r13
+
+MeasGapConfigToAddModList-r14 ::=   SEQUENCE (SIZE (1..maxServCell-r13)) OF MeasGapConfigPerCC-r14
+
+MeasGapConfigPerCC-r14 ::=  SEQUENCE {
+    servCellId-r14              ServCellIndex-r13,
+    measGapConfigCC-r14         MeasGapConfig
+}
+
+
+MeasGapSharingConfig-r14 ::=            CHOICE {
+    release                             NULL,
+    setup                               SEQUENCE {
+        measGapSharingScheme-r14                ENUMERATED {scheme00, scheme01, scheme10, scheme11} 
+    }
+}
+
+
 MeasId ::=                          INTEGER (1..maxMeasId)
 
 MeasId-v1250 ::=                    INTEGER (maxMeasId-Plus1..maxMeasId-r12)
@@ -6745,6 +7452,11 @@ MeasObjectEUTRA ::=                 SEQUENCE {
         whiteCellsToAddModList-r13      WhiteCellsToAddModList-r13  OPTIONAL,       -- Need ON
         rmtc-Config-r13             RMTC-Config-r13         OPTIONAL,       -- Need ON
         carrierFreq-r13                 ARFCN-ValueEUTRA-v9e0       OPTIONAL            -- Need ON
+    ]],
+    [[  
+        tx-ResourcePoolToRemoveList-r14 Tx-ResourcePoolMeasList-r14     OPTIONAL,   -- Need ON
+        tx-ResourcePoolToAddList-r14    Tx-ResourcePoolMeasList-r14     OPTIONAL,   -- Need ON
+        fembms-MixedCarrier-r14             BOOLEAN                 OPTIONAL            -- Need ON
     ]]
 }
 
@@ -6804,6 +7516,8 @@ RMTC-Config-r13 ::= CHOICE {
     }
 }
 
+Tx-ResourcePoolMeasList-r14 ::= SEQUENCE (SIZE (1..maxSL-PoolToMeasure-r14)) OF SL-V2X-TxPoolReportIdentity-r14
+
 
 MeasObjectGERAN ::=                 SEQUENCE {
     carrierFreqs                        CarrierFreqsGERAN,
@@ -6903,7 +7617,7 @@ MeasObjectWLAN-r13 ::=  SEQUENCE {
     ...
 }
 
-WLAN-BandIndicator-r13 ::=  ENUMERATED {band2dot4, band5, spare6, spare5, spare4, spare3, spare2, spare1, ...}
+WLAN-BandIndicator-r13 ::=  ENUMERATED {band2dot4, band5, band60-v1430, spare5, spare4, spare3, spare2, spare1, ...}
 
 
 MeasResults ::=                     SEQUENCE {
@@ -6937,8 +7651,12 @@ MeasResults ::=                     SEQUENCE {
         }                                                                   OPTIONAL,
         ul-PDCP-DelayResultList-r13         UL-PDCP-DelayResultList-r13     OPTIONAL,
         measResultListWLAN-r13              MeasResultListWLAN-r13          OPTIONAL
+    ]],
+    [[  measResultPCell-v1360               RSRP-Range-v1360                OPTIONAL
+    ]],
+    [[  measResultListCBR-r14               MeasResultListCBR-r14           OPTIONAL,
+        measResultListWLAN-r14              MeasResultListWLAN-r14          OPTIONAL
     ]]
-
 }
 
 MeasResultListEUTRA ::=             SEQUENCE (SIZE (1..maxCellReport)) OF MeasResultEUTRA 
@@ -6965,6 +7683,9 @@ MeasResultEUTRA ::= SEQUENCE {
                 multiBandInfoList-r13               MultiBandInfoList-r11       OPTIONAL,
                 freqBandIndicatorPriority-r13       ENUMERATED {true}           OPTIONAL
             }                                                               OPTIONAL
+        ]],
+        [[
+            measResult-v1360                    RSRP-Range-v1360                    OPTIONAL
         ]]
     }
 }
@@ -7010,7 +7731,11 @@ MeasResultServFreq-r13 ::=          SEQUENCE {
         rsrqResultNCell-r13                 RSRQ-Range-r13,
         rs-sinr-Result-r13                  RS-SINR-Range-r13   OPTIONAL
     }                                                           OPTIONAL,
-    ...
+    ...,
+    [[  measResultBestNeighCell-v1360       SEQUENCE {
+            rsrpResultNCell-v1360               RSRP-Range-v1360
+        }                                                       OPTIONAL
+    ]]
 }
 
 MeasResultCSI-RS-List-r12 ::=   SEQUENCE (SIZE (1..maxCellReport)) OF MeasResultCSI-RS-r12
@@ -7079,6 +7804,8 @@ MeasResultCDMA2000 ::=  SEQUENCE {
 
 MeasResultListWLAN-r13 ::=      SEQUENCE (SIZE (1..maxCellReport)) OF MeasResultWLAN-r13
 
+MeasResultListWLAN-r14 ::=      SEQUENCE (SIZE (1..maxWLAN-Id-Report-r14)) OF MeasResultWLAN-r13
+
 MeasResultWLAN-r13 ::=  SEQUENCE {
     wlan-Identifiers-r13                    WLAN-Identifiers-r12,
     carrierInfoWLAN-r13                     WLAN-CarrierInfo-r13    OPTIONAL,
@@ -7093,6 +7820,14 @@ MeasResultWLAN-r13 ::=  SEQUENCE {
     ...
 }
 
+MeasResultListCBR-r14 ::=           SEQUENCE (SIZE (1..maxCBR-Report-r14)) OF MeasResultCBR-r14
+
+MeasResultCBR-r14 ::=   SEQUENCE {
+    poolIdentity-r14        SL-V2X-TxPoolReportIdentity-r14,
+    cbr-PSSCH-r14           SL-CBR-r14,
+    cbr-PSCCH-r14           SL-CBR-r14              OPTIONAL
+}
+
 MeasResultForECID-r9 ::=        SEQUENCE {
     ue-RxTxTimeDiffResult-r9                INTEGER (0..4095),
     currentSFN-r9                           BIT STRING (SIZE (10))
@@ -7217,6 +7952,12 @@ ReportConfigEUTRA ::=               SEQUENCE {
                     c2-RefCSI-RS-r12                    MeasCSI-RS-Id-r12,
                     c2-Offset-r12                       INTEGER (-30..30),
                     c2-ReportOnLeave-r12                BOOLEAN
+                },
+                eventV1-r14                         SEQUENCE {
+                    v1-Threshold-r14                    SL-CBR-r14
+                },
+                eventV2-r14                         SEQUENCE {
+                    v2-Threshold-r14                    SL-CBR-r14
                 }
             },
             hysteresis                          Hysteresis,
@@ -7267,6 +8008,10 @@ ReportConfigEUTRA ::=               SEQUENCE {
         ul-DelayConfig-r13                  UL-DelayConfig-r13          OPTIONAL    -- Need ON
     ]],
     [[  ue-RxTxTimeDiffPeriodicalTDD-r13    BOOLEAN                     OPTIONAL    -- Need ON
+    ]],
+    [[  
+        purpose-v1430           ENUMERATED {reportLocation, sidelink, spare2, spare1}       
+                                                            OPTIONAL    -- Need ON
     ]]
 }
 
@@ -7347,6 +8092,8 @@ ReportConfigInterRAT ::=            SEQUENCE {
         }                                                           OPTIONAL    -- Need ON
     ]],
     [[  reportQuantityWLAN-r13              ReportQuantityWLAN-r13  OPTIONAL    -- Need ON
+    ]],
+    [[  reportAnyWLAN-r14                   BOOLEAN                 OPTIONAL    -- Need ON
     ]]
 }
 
@@ -7362,11 +8109,11 @@ ThresholdCDMA2000 ::=           INTEGER (0..63)
 ReportQuantityWLAN-r13 ::=      SEQUENCE {
     bandRequestWLAN-r13                         ENUMERATED {true}   OPTIONAL,   -- Need OR
     carrierInfoRequestWLAN-r13                  ENUMERATED {true}   OPTIONAL,   -- Need OR
-    availableAdmissionCapacityRequestWLAN-r13   ENUMERATED {true}   OPTIONAL,   -- Need ON
+    availableAdmissionCapacityRequestWLAN-r13   ENUMERATED {true}   OPTIONAL,   -- Need OR
     backhaulDL-BandwidthRequestWLAN-r13         ENUMERATED {true}   OPTIONAL,   -- Need OR
     backhaulUL-BandwidthRequestWLAN-r13         ENUMERATED {true}   OPTIONAL,   -- Need OR
     channelUtilizationRequestWLAN-r13           ENUMERATED {true}   OPTIONAL,   -- Need OR
-    stationCountRequestWLAN-r13                 ENUMERATED {true}   OPTIONAL    ,   -- Need OR
+    stationCountRequestWLAN-r13                 ENUMERATED {true}   OPTIONAL,   -- Need OR
     ...
 }
 
@@ -7390,6 +8137,8 @@ ReportInterval ::=                  ENUMERATED {
 
 RSRP-Range ::=                      INTEGER(0..97)
 
+RSRP-Range-v1360 ::=                    INTEGER(-17..-1)
+
 RSRP-RangeSL-r12 ::=                INTEGER(0..13)
 
 RSRP-RangeSL2-r12 ::=               INTEGER(0..7)
@@ -7451,6 +8200,14 @@ WLAN-RSSI-Range-r13 ::=                     INTEGER(0..141)
 
 WLAN-Status-r13 ::=     ENUMERATED {successfulAssociation, failureWlanRadioLink, failureWlanUnavailable, failureTimeout}
 
+WLAN-Status-v1430 ::=   ENUMERATED {suspended, resumed}
+
+
+WLAN-SuspendConfig-r14 ::=  SEQUENCE {
+    wlan-SuspendResumeAllowed-r14           BOOLEAN     OPTIONAL,   -- Need ON
+    wlan-SuspendTriggersStatusReport-r14        BOOLEAN     OPTIONAL    -- Need ON
+}
+
 
 AbsoluteTimeInfo-r10 ::=                BIT STRING (SIZE (48))
 
@@ -7473,6 +8230,17 @@ TrackingAreaCodeList-v1130 ::=  SEQUENCE {
 }
 
 
+BandCombinationList-r14 ::= SEQUENCE (SIZE (1..maxBandComb-r13)) OF BandCombination-r14
+
+BandCombination-r14 ::= SEQUENCE (SIZE (1..maxSimultaneousBands-r10)) OF BandIndication-r14
+
+BandIndication-r14 ::=  SEQUENCE {
+    bandEUTRA-r14                   FreqBandIndicator-r11,
+    ca-BandwidthClassDL-r14         CA-BandwidthClass-r10,
+    ca-BandwidthClassUL-r14         CA-BandwidthClass-r10           OPTIONAL
+}
+
+
 C-RNTI ::=                          BIT STRING (SIZE (16))
 
 
@@ -7521,11 +8289,32 @@ OtherConfig-r9 ::= SEQUENCE {
     [[  idc-Config-r11                  IDC-Config-r11                  OPTIONAL,   -- Need ON
         powerPrefIndicationConfig-r11   PowerPrefIndicationConfig-r11   OPTIONAL,   -- Need ON
         obtainLocationConfig-r11        ObtainLocationConfig-r11        OPTIONAL    -- Need ON
+    ]],
+    [[  powerPrefIndicationTimer-r11        ENUMERATED {s0, s0dot5, s1, s2, s5, s10, s20, 
+                                            s30, s60, s90, s120, s300, s600, spare3, 
+                                            spare2, spare1}         OPTIONAL,   -- Need OR
+        sps-AssistanceInfoReport-r14        BOOLEAN             OPTIONAL,   -- Need ON
+        delayBudgetReportingConfig-r14  CHOICE{
+            release                 NULL,
+            setup                   SEQUENCE{
+                delayBudgetReportingProhibitTimer-r14   ENUMERATED {
+                                                                s0, s0dot4, s0dot8, 
+                                                                s1dot6, s3, s6, s12, s30}
+            }
+        }                                                               OPTIONAL,   -- Need ON
+        rlm-ReportConfig-r14            CHOICE {
+            release                 NULL,
+            setup                   SEQUENCE{
+                rlmReportTimer-r14              ENUMERATED {s0, s0dot5, s1, s2, s5, s10, s20, s30, 
+                                                s60, s90, s120, s300, s600, spare3, spare2, spare1},
+                rlmReportRep-MPDCCH-r14         ENUMERATED {setup}      OPTIONAL    -- Need OR
+            }
+        }   OPTIONAL    -- Need ON
     ]]
 }
 
 IDC-Config-r11 ::=              SEQUENCE {
-    idc-Indication-r11                  ENUMERATED {setup}      OPTIONAL,       -- Need OR
+    idc-Indication-r11                  ENUMERATED {setup}              OPTIONAL,   -- Need OR
     autonomousDenialParameters-r11      SEQUENCE {
             autonomousDenialSubframes-r11           ENUMERATED {n2, n5, n10, n15,
                                                         n20, n30, spare2, spare1},
@@ -7534,12 +8323,14 @@ IDC-Config-r11 ::=              SEQUENCE {
                                                         spare4, spare3, spare2, spare1}
     }       OPTIONAL,       -- Need OR
     ...,
-    [[  idc-Indication-UL-CA-r11        ENUMERATED {setup}      OPTIONAL        -- Cond idc-Ind
+    [[  idc-Indication-UL-CA-r11            ENUMERATED {setup}      OPTIONAL    -- Cond idc-Ind
+    ]],
+    [[  idc-HardwareSharingIndication-r13   ENUMERATED {setup}      OPTIONAL    -- Need OR
     ]]
 }
 
 ObtainLocationConfig-r11 ::= SEQUENCE {
-    obtainLocation-r11              ENUMERATED {setup}              OPTIONAL        -- Need OR
+    obtainLocation-r11              ENUMERATED {setup}                  OPTIONAL    -- Need OR
 }
 
 PowerPrefIndicationConfig-r11 ::= CHOICE{
@@ -7552,8 +8343,8 @@ PowerPrefIndicationConfig-r11 ::= CHOICE{
 }
 
 ReportProximityConfig-r9 ::= SEQUENCE {
-    proximityIndicationEUTRA-r9     ENUMERATED {enabled}            OPTIONAL,       -- Need OR
-    proximityIndicationUTRA-r9      ENUMERATED {enabled}            OPTIONAL        -- Need OR
+    proximityIndicationEUTRA-r9     ENUMERATED {enabled}            OPTIONAL,   -- Need OR
+    proximityIndicationUTRA-r9      ENUMERATED {enabled}            OPTIONAL    -- Need OR
 }
 
 
@@ -7830,14 +8621,44 @@ UE-EUTRA-Capability-v1330-IEs ::= SEQUENCE {
 
 UE-EUTRA-Capability-v1340-IEs ::= SEQUENCE {
     ue-CategoryUL-v1340             INTEGER (15)                            OPTIONAL,
-    nonCriticalExtension                UE-EUTRA-Capability-v14xy-IEs           OPTIONAL
-}
-
-UE-EUTRA-Capability-v14xy-IEs ::= SEQUENCE {
-    mac-Parameters-v14xy                MAC-Parameters-v14xy                    OPTIONAL,
-    rlc-Parameters-v14xy                RLC-Parameters-v14xy,
-    laa-Parameters-v14xy                LAA-Parameters-v14xy                    OPTIONAL,
-    lwip-Parameters-v14xy               LWIP-Parameters-v14xy                   OPTIONAL,
+    nonCriticalExtension                UE-EUTRA-Capability-v1350-IEs           OPTIONAL
+}
+
+UE-EUTRA-Capability-v1350-IEs ::= SEQUENCE {
+    ue-CategoryDL-v1350             ENUMERATED {oneBis}                     OPTIONAL,
+    ue-CategoryUL-v1350             ENUMERATED {oneBis}                     OPTIONAL,
+    ce-Parameters-v1350             CE-Parameters-v1350,
+    nonCriticalExtension            UE-EUTRA-Capability-v1360-IEs           OPTIONAL
+}
+
+UE-EUTRA-Capability-v1360-IEs ::= SEQUENCE {
+    other-Parameters-v1360      Other-Parameters-v1360                  OPTIONAL,
+    nonCriticalExtension        UE-EUTRA-Capability-v1430-IEs           OPTIONAL
+}
+
+UE-EUTRA-Capability-v1430-IEs ::= SEQUENCE {
+    phyLayerParameters-v1430            PhyLayerParameters-v1430,
+    ue-CategoryDL-v1430                 ENUMERATED {m2}                         OPTIONAL,
+    ue-CategoryUL-v1430                 ENUMERATED {n16, n17, n18, n19, n20, m2}    OPTIONAL,
+    ue-CategoryUL-v1430b                ENUMERATED {n21}                        OPTIONAL,
+    mac-Parameters-v1430                MAC-Parameters-v1430                    OPTIONAL,
+    measParameters-v1430                MeasParameters-v1430                    OPTIONAL,
+    pdcp-Parameters-v1430               PDCP-Parameters-v1430                   OPTIONAL,
+    rlc-Parameters-v1430                RLC-Parameters-v1430,
+    rf-Parameters-v1430                 RF-Parameters-v1430                     OPTIONAL,
+    laa-Parameters-v1430                LAA-Parameters-v1430                    OPTIONAL,
+    lwa-Parameters-v1430                LWA-Parameters-v1430                    OPTIONAL,
+    lwip-Parameters-v1430               LWIP-Parameters-v1430                   OPTIONAL,
+    otherParameters-v1430               Other-Parameters-v1430,
+    mmtel-Parameters-r14                MMTEL-Parameters-r14                    OPTIONAL,
+    mobilityParameters-r14              MobilityParameters-r14                  OPTIONAL,
+    ce-Parameters-v1430                 CE-Parameters-v1430,
+    fdd-Add-UE-EUTRA-Capabilities-v1430 UE-EUTRA-CapabilityAddXDD-Mode-v1430    OPTIONAL,
+    tdd-Add-UE-EUTRA-Capabilities-v1430 UE-EUTRA-CapabilityAddXDD-Mode-v1430    OPTIONAL,
+    mbms-Parameters-v1430               MBMS-Parameters-v1430                   OPTIONAL,
+    sl-Parameters-v1430                 SL-Parameters-v1430                     OPTIONAL,
+    ue-BasedNetwPerfMeasParameters-v1430    UE-BasedNetwPerfMeasParameters-v1430        OPTIONAL, 
+    highSpeedEnhParameters-r14          HighSpeedEnhParameters-r14              OPTIONAL,
     nonCriticalExtension                SEQUENCE {}                             OPTIONAL
 }
 
@@ -7887,9 +8708,19 @@ UE-EUTRA-CapabilityAddXDD-Mode-v1320 ::=    SEQUENCE {
     scptm-Parameters-r13                SCPTM-Parameters-r13                OPTIONAL
 }
 
+UE-EUTRA-CapabilityAddXDD-Mode-v1430 ::=    SEQUENCE {
+    phyLayerParameters-v1430            PhyLayerParameters-v1430            OPTIONAL,
+    mmtel-Parameters-r14                MMTEL-Parameters-r14                OPTIONAL
+}
+
 AccessStratumRelease ::=            ENUMERATED {
                                         rel8, rel9, rel10, rel11, rel12, rel13,
-                                        spare2, spare1, ...}
+                                        rel14, spare1, ...}
+
+MobilityParameters-r14 ::=          SEQUENCE {
+    makeBeforeBreak-r14                 ENUMERATED {supported}                  OPTIONAL,
+    rach-Less-r14                       ENUMERATED {supported}                  OPTIONAL
+}
 
 DC-Parameters-r12 ::=           SEQUENCE {
     drb-TypeSplit-r12                       ENUMERATED {supported}          OPTIONAL,
@@ -7911,11 +8742,13 @@ MAC-Parameters-v1310 ::=                SEQUENCE {
     extendedLongDRX-r13             ENUMERATED {supported}              OPTIONAL
 }
 
-MAC-Parameters-v14xy ::=                SEQUENCE {
+MAC-Parameters-v1430 ::=                SEQUENCE {
     shortSPS-IntervalFDD-r14            ENUMERATED {supported}              OPTIONAL,
     shortSPS-IntervalTDD-r14            ENUMERATED {supported}              OPTIONAL,
     skipUplinkDynamic-r14               ENUMERATED {supported}              OPTIONAL,
-    skipUplinkSPS-r14                   ENUMERATED {supported}              OPTIONAL
+    skipUplinkSPS-r14                   ENUMERATED {supported}              OPTIONAL,
+    multipleUplinkSPS-r14               ENUMERATED {supported}              OPTIONAL,
+    dataInactMon-r14                    ENUMERATED {supported}              OPTIONAL
 }
 
 RLC-Parameters-r12 ::=              SEQUENCE {
@@ -7926,7 +8759,7 @@ RLC-Parameters-v1310 ::=                SEQUENCE {
     extendedRLC-SN-SO-Field-r13             ENUMERATED {supported}          OPTIONAL
 }
 
-RLC-Parameters-v14xy ::=                SEQUENCE {
+RLC-Parameters-v1430 ::=                SEQUENCE {
     extendedPollByte-r14                        ENUMERATED {supported}          OPTIONAL
 }
 
@@ -7958,6 +8791,16 @@ PDCP-Parameters-v1310 ::=               SEQUENCE {
     pdcp-SN-Extension-18bits-r13            ENUMERATED {supported}  OPTIONAL
 }
 
+PDCP-Parameters-v1430 ::=               SEQUENCE {
+    supportedUplinkOnlyROHC-Profiles-r14        SEQUENCE {
+        profile0x0006-r14                       BOOLEAN
+    },
+    maxNumberROHC-ContextSessions-r14       ENUMERATED {
+                                            cs2, cs4, cs8, cs12, cs16, cs24, cs32,
+                                            cs48, cs64, cs128, cs256, cs512, cs1024,
+                                            cs16384, spare2, spare1}                DEFAULT cs16
+}
+
 PhyLayerParameters ::=              SEQUENCE {
     ue-TxAntennaSelectionSupported      BOOLEAN,
     ue-SpecificRefSigsSupported     BOOLEAN
@@ -8019,7 +8862,8 @@ PhyLayerParameters-v1310 ::=            SEQUENCE {
     aperiodicCSI-Reporting-r13              BIT STRING (SIZE (2))           OPTIONAL,
     codebook-HARQ-ACK-r13                   BIT STRING (SIZE (2))           OPTIONAL,
     crossCarrierScheduling-B5C-r13          ENUMERATED {supported}          OPTIONAL,
-    fdd-HARQ-TimingTDD-r13                  ENUMERATED {supported}          OPTIONAL,   maxNumberUpdatedCSI-Proc-r13            INTEGER(5..32)                  OPTIONAL,
+    fdd-HARQ-TimingTDD-r13                  ENUMERATED {supported}          OPTIONAL,
+    maxNumberUpdatedCSI-Proc-r13            INTEGER(5..32)                  OPTIONAL,
     pucch-Format4-r13                       ENUMERATED {supported}          OPTIONAL,
     pucch-Format5-r13                       ENUMERATED {supported}          OPTIONAL,
     pucch-SCell-r13                         ENUMERATED {supported}          OPTIONAL,
@@ -8045,6 +8889,25 @@ PhyLayerParameters-v1330 ::=            SEQUENCE {
     crs-InterfMitigationTM1toTM9-r13        INTEGER (1.. maxServCell-r13)   OPTIONAL
 }
 
+PhyLayerParameters-v1430 ::=            SEQUENCE {
+    ce-PUSCH-NB-MaxTBS-r14                  ENUMERATED {supported}          OPTIONAL,
+    ce-PDSCH-PUSCH-MaxBandwidth-r14         ENUMERATED {bw5, bw20}          OPTIONAL,
+    ce-HARQ-AckBundling-r14                 ENUMERATED {supported}          OPTIONAL,
+    ce-PDSCH-TenProcesses-r14               ENUMERATED {supported}          OPTIONAL,
+    ce-RetuningSymbols-r14                  ENUMERATED {n0, n1}             OPTIONAL,
+    ce-PDSCH-PUSCH-Enhancement-r14          ENUMERATED {supported}          OPTIONAL,
+    ce-SchedulingEnhancement-r14            ENUMERATED {supported}          OPTIONAL,
+    ce-SRS-Enhancement-r14                  ENUMERATED {supported}          OPTIONAL,
+    ce-PUCCH-Enhancement-r14                ENUMERATED {supported}          OPTIONAL,
+    ce-ClosedLoopTxAntennaSelection-r14     ENUMERATED {supported}          OPTIONAL,
+    tdd-SpecialSubframe-r14                 ENUMERATED {supported}          OPTIONAL,
+    tdd-TTI-Bundling-r14                    ENUMERATED {supported}          OPTIONAL,
+    dmrs-LessUpPTS-r14                      ENUMERATED {supported}          OPTIONAL,
+    mimo-UE-Parameters-v1430                MIMO-UE-Parameters-v1430        OPTIONAL,
+    alternativeTBS-Index-r14                ENUMERATED {supported}          OPTIONAL,
+    feMBMS-Unicast-Parameters-r14           FeMBMS-Unicast-Parameters-r14   OPTIONAL
+}
+
 MIMO-UE-Parameters-r13 ::=              SEQUENCE {
     parametersTM9-r13                       MIMO-UE-ParametersPerTM-r13     OPTIONAL,
     parametersTM10-r13                      MIMO-UE-ParametersPerTM-r13     OPTIONAL,
@@ -8053,25 +8916,58 @@ MIMO-UE-Parameters-r13 ::=              SEQUENCE {
     interferenceMeasRestriction-r13         ENUMERATED {supported}          OPTIONAL
 }
 
+MIMO-UE-Parameters-v1430 ::=            SEQUENCE {
+    parametersTM9-v1430                     MIMO-UE-ParametersPerTM-v1430   OPTIONAL,
+    parametersTM10-v1430                    MIMO-UE-ParametersPerTM-v1430   OPTIONAL
+}
+
 MIMO-UE-ParametersPerTM-r13 ::=         SEQUENCE {
     nonPrecoded-r13                         MIMO-NonPrecodedCapabilities-r13    OPTIONAL,
-    beamformed-r13                          MIMO-UE-BeamformedCapabilities-r13      OPTIONAL,
+    beamformed-r13                          MIMO-UE-BeamformedCapabilities-r13  OPTIONAL,
     channelMeasRestriction-r13              ENUMERATED {supported}              OPTIONAL,
     dmrs-Enhancements-r13                   ENUMERATED {supported}              OPTIONAL,
     csi-RS-EnhancementsTDD-r13              ENUMERATED {supported}              OPTIONAL
 }
 
+MIMO-UE-ParametersPerTM-v1430 ::=       SEQUENCE {
+    nzp-CSI-RS-AperiodicInfo-r14            SEQUENCE {
+        nMaxProc-r14                            INTEGER(5..32),
+        nMaxResource-r14                        ENUMERATED {ffs1, ffs2, ffs3, ffs4}
+    }                                                                           OPTIONAL,
+    nzp-CSI-RS-PeriodicInfo-r14             SEQUENCE {
+        nMaxResource-r14                        ENUMERATED {ffs1, ffs2, ffs3, ffs4}
+    }                                                                           OPTIONAL,
+    zp-CSI-RS-AperiodicInfo-r14                 ENUMERATED {supported}          OPTIONAL,
+    ul-dmrs-Enhancements-r14                ENUMERATED {supported}              OPTIONAL,
+    densityReductionNP-r14                  ENUMERATED {supported}              OPTIONAL,
+    densityReductionBF-r14                  ENUMERATED {supported}              OPTIONAL,
+    hybridCSI-r14                           ENUMERATED {supported}              OPTIONAL,
+    semiOL-r14                              ENUMERATED {supported}              OPTIONAL,
+    csi-ReportingNP-r14                     ENUMERATED {supported}              OPTIONAL,
+    csi-ReportingAdvanced-r14               ENUMERATED {supported}              OPTIONAL
+}
+
 MIMO-CA-ParametersPerBoBC-r13 ::=       SEQUENCE {
     parametersTM9-r13                       MIMO-CA-ParametersPerBoBCPerTM-r13      OPTIONAL,
     parametersTM10-r13                      MIMO-CA-ParametersPerBoBCPerTM-r13      OPTIONAL
 }
 
+MIMO-CA-ParametersPerBoBC-v1430 ::=     SEQUENCE {
+    parametersTM9-v1430                     MIMO-CA-ParametersPerBoBCPerTM-v1430    OPTIONAL,
+    parametersTM10-v1430                    MIMO-CA-ParametersPerBoBCPerTM-v1430    OPTIONAL
+}
+
 MIMO-CA-ParametersPerBoBCPerTM-r13 ::=  SEQUENCE {
     nonPrecoded-r13                         MIMO-NonPrecodedCapabilities-r13    OPTIONAL,
     beamformed-r13                          MIMO-BeamformedCapabilityList-r13   OPTIONAL,
     dmrs-Enhancements-r13                   ENUMERATED {different}              OPTIONAL
 }
 
+MIMO-CA-ParametersPerBoBCPerTM-v1430 ::=    SEQUENCE {
+    csi-ReportingNP-r14                     ENUMERATED {different}              OPTIONAL,
+    csi-ReportingAdvanced-r14               ENUMERATED {different}              OPTIONAL
+}
+
 MIMO-NonPrecodedCapabilities-r13 ::=    SEQUENCE {
     config1-r13                             ENUMERATED {supported}          OPTIONAL,
     config2-r13                             ENUMERATED {supported}          OPTIONAL,
@@ -8180,6 +9076,16 @@ RF-Parameters-v12b0 ::=             SEQUENCE {
     maxLayersMIMO-Indication-r12            ENUMERATED {supported}                  OPTIONAL
 }
 
+RF-Parameters-v1430 ::=             SEQUENCE {
+    supportedBandCombination-v1430          SupportedBandCombination-v1430          OPTIONAL,
+    supportedBandCombinationAdd-v1430       SupportedBandCombinationAdd-v1430       OPTIONAL,
+    supportedBandCombinationReduced-v1430   SupportedBandCombinationReduced-v1430   OPTIONAL,
+    eNB-RequestedParameters-v1430           SEQUENCE {
+        requestedDiffFallbackCombList-r14       BandCombinationList-r14
+    }                                                                               OPTIONAL,
+    diffFallbackCombReport-r14              ENUMERATED {supported}                  OPTIONAL
+}
+
 SupportedBandCombination-r10 ::= SEQUENCE (SIZE (1..maxBandComb-r10)) OF BandCombinationParameters-r10 
 
 SupportedBandCombinationExt-r10 ::= SEQUENCE (SIZE (1..maxBandComb-r10)) OF BandCombinationParametersExt-r10
@@ -8196,6 +9102,8 @@ SupportedBandCombination-v1270 ::= SEQUENCE (SIZE (1..maxBandComb-r10)) OF BandC
 
 SupportedBandCombination-v1320 ::= SEQUENCE (SIZE (1..maxBandComb-r10)) OF BandCombinationParameters-v1320
 
+SupportedBandCombination-v1430 ::= SEQUENCE (SIZE (1..maxBandComb-r10)) OF BandCombinationParameters-v1430
+
 SupportedBandCombinationAdd-r11 ::= SEQUENCE (SIZE (1..maxBandComb-r11)) OF BandCombinationParameters-r11
 
 SupportedBandCombinationAdd-v11d0 ::= SEQUENCE (SIZE (1..maxBandComb-r11)) OF BandCombinationParameters-v10i0
@@ -8206,10 +9114,14 @@ SupportedBandCombinationAdd-v1270 ::= SEQUENCE (SIZE (1..maxBandComb-r11)) OF Ba
 
 SupportedBandCombinationAdd-v1320 ::= SEQUENCE (SIZE (1..maxBandComb-r11)) OF BandCombinationParameters-v1320
 
+SupportedBandCombinationAdd-v1430 ::= SEQUENCE (SIZE (1..maxBandComb-r11)) OF BandCombinationParameters-v1430
+
 SupportedBandCombinationReduced-r13 ::= SEQUENCE (SIZE (1..maxBandComb-r13)) OF BandCombinationParameters-r13
 
 SupportedBandCombinationReduced-v1320 ::=   SEQUENCE (SIZE (1..maxBandComb-r13)) OF BandCombinationParameters-v1320
 
+SupportedBandCombinationReduced-v1430 ::=   SEQUENCE (SIZE (1..maxBandComb-r13)) OF BandCombinationParameters-v1430
+
 BandCombinationParameters-r10 ::= SEQUENCE (SIZE (1..maxSimultaneousBands-r10)) OF BandParameters-r10
 
 BandCombinationParametersExt-r10 ::= SEQUENCE {
@@ -8284,6 +9196,12 @@ BandCombinationParameters-v1320 ::= SEQUENCE {
     additionalRx-Tx-PerformanceReq-r13      ENUMERATED {supported}                  OPTIONAL
 }
 
+BandCombinationParameters-v1430 ::= SEQUENCE {
+    bandParameterList-v1430         SEQUENCE (SIZE (1..maxSimultaneousBands-r10)) OF 
+            BandParameters-v1430        OPTIONAL,
+    v2x-SupportedTxBandCombListPerBC-r14            BIT STRING (SIZE (1.. maxBandComb-r13))     OPTIONAL,
+    v2x-SupportedRxBandCombListPerBC-r14            BIT STRING (SIZE (1.. maxBandComb-r13))     OPTIONAL}
+
 SupportedBandwidthCombinationSet-r10 ::=    BIT STRING (SIZE (1..maxBandwidthCombSet-r10))
 
 BandParameters-r10 ::= SEQUENCE {
@@ -8327,6 +9245,37 @@ BandParameters-v1320 ::= SEQUENCE {
     bandParametersDL-v1320          MIMO-CA-ParametersPerBoBC-r13
 }
 
+BandParameters-v1430 ::= SEQUENCE {
+    bandParametersDL-v1430          MIMO-CA-ParametersPerBoBC-v1430 OPTIONAL,
+    ul-256QAM-r14                       ENUMERATED {supported}      OPTIONAL,
+    ul-256QAM-perCC-InfoList-r14        SEQUENCE (SIZE (2..maxServCell-r13)) OF UL-256QAM-perCC-Info-r14        OPTIONAL,
+    retuningTimeInfoBandList-r14        SEQUENCE (SIZE (1..maxSimultaneousBands-r10)) OF 
+            RetuningTimeInfo-r14    OPTIONAL
+}
+
+V2X-BandParameters-r14 ::= SEQUENCE {
+    v2x-FreqBandEUTRA-r14           FreqBandIndicator-r11,
+    bandParametersTxSL-r14          BandParametersTxSL-r14              OPTIONAL,
+    bandParametersRxSL-r14          BandParametersRxSL-r14              OPTIONAL
+}
+
+BandParametersTxSL-r14 ::= SEQUENCE {
+    v2x-BandwidthClassTxSL-r14      V2X-BandwidthClassSL-r14,
+    v2x-eNB-Scheduled-r14           ENUMERATED {supported}              OPTIONAL,
+    v2x-HighPower-r14               ENUMERATED {supported}              OPTIONAL
+}
+
+BandParametersRxSL-r14 ::= SEQUENCE {
+    v2x-BandwidthClassRxSL-r14      V2X-BandwidthClassSL-r14,
+    v2x-HighReception-r14           ENUMERATED {supported}              OPTIONAL
+}
+
+V2X-BandwidthClassSL-r14 ::= SEQUENCE (SIZE (1..maxBandwidthClass-r10)) OF V2X-BandwidthClass-r14
+
+UL-256QAM-perCC-Info-r14 ::= SEQUENCE {
+    ul-256QAM-perCC-r14         ENUMERATED {supported}              OPTIONAL
+}
+
 BandParametersUL-r10 ::= SEQUENCE (SIZE (1..maxBandwidthClass-r10)) OF CA-MIMO-ParametersUL-r10
 
 BandParametersUL-r13 ::= CA-MIMO-ParametersUL-r10
@@ -8369,6 +9318,8 @@ IntraBandContiguousCC-Info-r12 ::= SEQUENCE {
 
 CA-BandwidthClass-r10 ::= ENUMERATED {a, b, c, d, e, f, ...}
 
+V2X-BandwidthClass-r14 ::= ENUMERATED {a, b, c, d, e, f, ...}
+
 MIMO-CapabilityUL-r10 ::= ENUMERATED {twoLayers, fourLayers}
 
 MIMO-CapabilityDL-r10 ::= ENUMERATED {twoLayers, fourLayers, eightLayers}
@@ -8443,6 +9394,14 @@ MeasParameters-v1310 ::=            SEQUENCE {
     rssi-AndChannelOccupancyReporting-r13   ENUMERATED {supported}      OPTIONAL
 }
 
+MeasParameters-v1430 ::=            SEQUENCE {
+    ceMeasurements-r14                      ENUMERATED {supported}      OPTIONAL,
+    ncsg-r14                                ENUMERATED {supported}              OPTIONAL,
+    shortMeasurementGap-r14                 ENUMERATED {supported}              OPTIONAL,
+    perServingCellMeasurementGap-r14        ENUMERATED {supported}              OPTIONAL,
+    nonUniformGap-r14                       ENUMERATED {supported}              OPTIONAL
+}
+
 BandListEUTRA ::=                   SEQUENCE (SIZE (1..maxBands)) OF BandInfoEUTRA 
 
 BandCombinationListEUTRA-r10 ::=    SEQUENCE (SIZE (1..maxBandComb-r10)) OF BandInfoEUTRA
@@ -8605,6 +9564,10 @@ UE-BasedNetwPerfMeasParameters-v1250 ::=    SEQUENCE {
     loggedMBSFNMeasurements-r12             ENUMERATED {supported}
 }
 
+UE-BasedNetwPerfMeasParameters-v1430 ::=    SEQUENCE {
+    locationReport-r14                      ENUMERATED {supported}      OPTIONAL
+}
+
 OTDOA-PositioningCapabilities-r10 ::=   SEQUENCE {
     otdoa-UE-Assisted-r10                   ENUMERATED {supported},
     interFreqRSTD-Measurement-r10           ENUMERATED {supported}      OPTIONAL
@@ -8620,6 +9583,15 @@ Other-Parameters-v11d0 ::=              SEQUENCE {
     inDeviceCoexInd-UL-CA-r11               ENUMERATED {supported}      OPTIONAL
 }
 
+Other-Parameters-v1360 ::=  SEQUENCE {
+    inDeviceCoexInd-HardwareSharingInd-r13      ENUMERATED {supported}      OPTIONAL
+}
+
+Other-Parameters-v1430 ::=          SEQUENCE {
+    bwPrefInd-r14                   ENUMERATED {supported}      OPTIONAL,
+    rlm-ReportSupport-r14           ENUMERATED {supported}      OPTIONAL
+}
+
 MBMS-Parameters-r11 ::=             SEQUENCE {
     mbms-SCell-r11                          ENUMERATED {supported}      OPTIONAL,
     mbms-NonServingCell-r11                 ENUMERATED {supported}      OPTIONAL
@@ -8629,6 +9601,18 @@ MBMS-Parameters-v1250 ::=               SEQUENCE {
     mbms-AsyncDC-r12                        ENUMERATED {supported}      OPTIONAL
 }
 
+MBMS-Parameters-v1430 ::=               SEQUENCE {
+    fembmsDedicatedCell-r14             ENUMERATED {supported}      OPTIONAL,
+    fembmsMixedCell-r14                 ENUMERATED {supported}      OPTIONAL,
+    subcarrierSpacingMBMS-khz7dot5-r14  ENUMERATED {supported}      OPTIONAL,
+    subcarrierSpacingMBMS-khz1dot25-r14 ENUMERATED {supported}      OPTIONAL
+}
+
+FeMBMS-Unicast-Parameters-r14 ::=       SEQUENCE {
+    unicast-fembmsMixedSCell-r14            ENUMERATED {supported}      OPTIONAL,
+    emptyUnicastRegion-r14                  ENUMERATED {supported}      OPTIONAL
+}
+
 SCPTM-Parameters-r13 ::=                SEQUENCE {
     scptm-ParallelReception-r13                 ENUMERATED {supported}      OPTIONAL,
     scptm-SCell-r13                             ENUMERATED {supported}      OPTIONAL,
@@ -8648,6 +9632,14 @@ CE-Parameters-v1320 ::=     SEQUENCE {
     intraFreqHO-CE-ModeB-r13                ENUMERATED {supported}              OPTIONAL
 }
 
+CE-Parameters-v1350 ::=     SEQUENCE {
+    unicastFrequencyHopping-r13             ENUMERATED {supported}              OPTIONAL
+}
+
+CE-Parameters-v1430 ::=     SEQUENCE {
+    ce-SwitchWithoutHO-r14                  ENUMERATED {supported}              OPTIONAL
+}
+
 LAA-Parameters-r13 ::=              SEQUENCE {
     crossCarrierSchedulingLAA-DL-r13            ENUMERATED {supported}      OPTIONAL,
     csi-RS-DRS-RRM-MeasurementsLAA-r13          ENUMERATED {supported}      OPTIONAL,
@@ -8658,10 +9650,13 @@ LAA-Parameters-r13 ::=              SEQUENCE {
     tm10-LAA-r13                                ENUMERATED {supported}      OPTIONAL
 }
 
-LAA-Parameters-v14xy ::=                SEQUENCE {
+LAA-Parameters-v1430 ::=                SEQUENCE {
     crossCarrierSchedulingLAA-UL-r14            ENUMERATED {supported}      OPTIONAL,
     uplinkLAA-r14                               ENUMERATED {supported}      OPTIONAL,
-    twoStepSchedulingTimingInfo-r14             ENUMERATED {nPlus1, nPlus2, nPlus3} OPTIONAL
+    twoStepSchedulingTimingInfo-r14             ENUMERATED {nPlus1, nPlus2, nPlus3} OPTIONAL,
+    uss-BlindDecodingAdjustment-r14             ENUMERATED {supported}      OPTIONAL,
+    uss-BlindDecodingReduction-r14              ENUMERATED {supported}      OPTIONAL,
+    outOfSequenceGrantHandling-r14              ENUMERATED {supported}      OPTIONAL
 }
 
 WLAN-IW-Parameters-r12 ::=  SEQUENCE {
@@ -8676,6 +9671,14 @@ LWA-Parameters-r13 ::=      SEQUENCE {
     lwa-BufferSize-r13          ENUMERATED {supported}      OPTIONAL
 }
 
+LWA-Parameters-v1430 ::=        SEQUENCE {
+    lwa-HO-WithoutWT-Change-r14         ENUMERATED {supported}      OPTIONAL,
+    lwa-UL-r14                          ENUMERATED {supported}      OPTIONAL,
+    wlan-PeriodicMeas-r14               ENUMERATED {supported}      OPTIONAL,
+    wlan-ReportAnyWLAN-r14              ENUMERATED {supported}      OPTIONAL,
+    wlan-SupportedDataRate-r14          INTEGER (1..2048)           OPTIONAL
+}
+
 WLAN-IW-Parameters-v1310 ::=    SEQUENCE {
     rclwi-r13                                       ENUMERATED {supported}      OPTIONAL
 }
@@ -8684,7 +9687,7 @@ LWIP-Parameters-r13 ::=     SEQUENCE {
     lwip-r13                    ENUMERATED {supported}              OPTIONAL
 }
 
-LWIP-Parameters-v14xy ::=       SEQUENCE {
+LWIP-Parameters-v1430 ::=       SEQUENCE {
     lwip-Aggregation-DL-r14                 ENUMERATED {supported}              OPTIONAL,
     lwip-Aggregation-UL-r14                 ENUMERATED {supported}              OPTIONAL
 }
@@ -8718,6 +9721,21 @@ SL-Parameters-v1310 ::=             SEQUENCE {
     discPeriodicSLSS-r13                        ENUMERATED {supported}      OPTIONAL
 }
 
+SL-Parameters-v1430 ::=             SEQUENCE {
+    zoneBasedPoolSelection-r14              ENUMERATED {supported}              OPTIONAL,
+    ue-AutonomousWithFullSensing-r14        ENUMERATED {supported}              OPTIONAL,
+    ue-AutonomousWithPartialSensing-r14     ENUMERATED {supported}              OPTIONAL,
+    sl-CongestionControl-r14                ENUMERATED {supported}              OPTIONAL,
+    v2x-TxWithShortResvInterval-r14         ENUMERATED {supported}              OPTIONAL,
+    v2x-numberTxRxTiming-r14                INTEGER(1..16)                      OPTIONAL,
+    v2x-nonAdjacentPSCCH-PSSCH-r14          ENUMERATED {supported}              OPTIONAL,
+    slss-TxRx-r14                           ENUMERATED {supported}              OPTIONAL,
+    v2x-SupportedBandCombinationList-r14    V2X-SupportedBandCombination-r14    OPTIONAL
+}
+
+V2X-SupportedBandCombination-r14 ::=        SEQUENCE (SIZE (1..maxBandComb-r13)) OF V2X-BandCombinationParameters-r14
+
+V2X-BandCombinationParameters-r14 ::=   SEQUENCE (SIZE (1.. maxSimultaneousBands-r10)) OF V2X-BandParameters-r14
 
 SupportedBandInfoList-r12 ::=       SEQUENCE (SIZE (1..maxBands)) OF SupportedBandInfo-r12 
 
@@ -8727,6 +9745,30 @@ SupportedBandInfo-r12 ::=           SEQUENCE {
 
 FreqBandIndicatorListEUTRA-r12 ::=      SEQUENCE (SIZE (1..maxBands)) OF FreqBandIndicator-r11
 
+MMTEL-Parameters-r14 ::=            SEQUENCE {
+    delayBudgetReporting-r14                    ENUMERATED {supported}      OPTIONAL,
+    pusch-Enhancements-r14                      ENUMERATED {supported}      OPTIONAL,
+    recommendedBitRate-r14                      ENUMERATED {supported}      OPTIONAL,
+    recommendedBitRateQuery-r14                 ENUMERATED {supported}      OPTIONAL
+}
+
+RetuningTimeInfo-r14 ::= SEQUENCE {
+    retuningInfo                SEQUENCE {
+        rf-RetuningTimeDL-r14           ENUMERATED {n0, n0dot5, n1, n1dot5, n2, n2dot5, n3,
+                                                    n3dot5, n4, n4dot5, n5, n5dot5, n6, n6dot5,
+                                                    n7, spare1}     OPTIONAL,
+        rf-RetuningTimeUL-r14           ENUMERATED {n0, n0dot5, n1, n1dot5, n2, n2dot5, n3,
+                                                    n3dot5, n4, n4dot5, n5, n5dot5, n6, n6dot5,
+                                                    n7, spare1}     OPTIONAL
+    }
+}
+
+HighSpeedEnhParameters-r14 ::= SEQUENCE {
+    measurementEnhancements-r14     ENUMERATED {supported}      OPTIONAL,
+    demodulationEnhancements-r14    ENUMERATED {supported}      OPTIONAL,
+    prach-Enhancements-r14          ENUMERATED {supported}      OPTIONAL
+}
+
 
 UE-RadioPagingInfo-r12 ::=              SEQUENCE {
     ue-Category-v1250                   INTEGER (0)         OPTIONAL,
@@ -8839,6 +9881,10 @@ MBMS-NotificationConfig-r9 ::=              SEQUENCE {
     notificationSF-Index-r9             INTEGER (1..6)
 }
 
+MBMS-NotificationConfig-v1430 ::=               SEQUENCE {
+    notificationSF-Index-v1430              INTEGER (7..10)
+}
+
 
 MBMS-ServiceList-r13 ::=            SEQUENCE (SIZE (0..maxMBMS-ServiceListPerUE-r13)) OF MBMS-ServiceInfo-r13
 
@@ -8855,15 +9901,23 @@ MBSFN-AreaInfoList-r9 ::=           SEQUENCE (SIZE(1..maxMBSFN-Area)) OF MBSFN-A
 MBSFN-AreaInfo-r9 ::=               SEQUENCE {
     mbsfn-AreaId-r9                     MBSFN-AreaId-r12,
     non-MBSFNregionLength               ENUMERATED {s1, s2},
-    notificationIndicator-r9                INTEGER (0..7),
+    notificationIndicator-r9            INTEGER (0..7),
     mcch-Config-r9                      SEQUENCE {
-        mcch-RepetitionPeriod-r9            ENUMERATED {rf32, rf64, rf128, rf256},
-        mcch-Offset-r9                      INTEGER (0..10),
-        mcch-ModificationPeriod-r9          ENUMERATED {rf512, rf1024},
-        sf-AllocInfo-r9                     BIT STRING (SIZE(6)),
-        signallingMCS-r9                    ENUMERATED {n2, n7, n13, n19}
+        mcch-RepetitionPeriod-r9        ENUMERATED {rf32, rf64, rf128, rf256},
+        mcch-Offset-r9                  INTEGER (0..10),
+        mcch-ModificationPeriod-r9      ENUMERATED {rf512, rf1024},
+        sf-AllocInfo-r9                 BIT STRING (SIZE(6)),
+        signallingMCS-r9                ENUMERATED {n2, n7, n13, n19}
     },
-    ...
+    ...,
+    [[  mcch-Config-r14             SEQUENCE {
+            mcch-RepetitionPeriod-v1430     ENUMERATED {rf1, rf2, rf4, rf8,
+                                        rf16 }      OPTIONAL,   -- Need OR
+            mcch-ModificationPeriod-v1430   ENUMERATED {rf1, rf2, rf4, rf8, rf16, rf32, rf64, rf128,
+                                            rf256, spare7}                  OPTIONAL    -- Need OR
+        }                                                                   OPTIONAL,   -- Need OR
+        subcarrierSpacingMBMS-r14       ENUMERATED {khz-7dot5, khz-1dot25}  OPTIONAL    -- Need OR
+    ]]
 }
 
 
@@ -8876,6 +9930,14 @@ MBSFN-SubframeConfig ::=            SEQUENCE {
     }
 }
 
+MBSFN-SubframeConfig-v1430 ::=      SEQUENCE {
+    subframeAllocation-v1430                CHOICE {
+        oneFrame-v1430                      BIT STRING (SIZE(2)),
+        fourFrames-v1430                    BIT STRING (SIZE(8))
+    }
+}
+
+
 PMCH-InfoList-r9 ::=                SEQUENCE (SIZE (0..maxPMCH-PerMBSFN)) OF PMCH-Info-r9
 
 PMCH-InfoListExt-r12 ::=            SEQUENCE (SIZE (0..maxPMCH-PerMBSFN)) OF PMCH-InfoExt-r12
@@ -8917,7 +9979,9 @@ PMCH-Config-r12 ::=                 SEQUENCE {
     },
     mch-SchedulingPeriod-r12        ENUMERATED {
                                         rf4, rf8, rf16, rf32, rf64, rf128, rf256, rf512, rf1024},
-    ...
+    ...,
+    [[  mch-SchedulingPeriod-v1430      ENUMERATED {rf1, rf2}           OPTIONAL    -- Need OR
+    ]]
 }
 
 TMGI-r9 ::=                     SEQUENCE {
@@ -8929,7 +9993,6 @@ TMGI-r9 ::=                     SEQUENCE {
 }
 
 
-
 SC-MTCH-InfoList-r13 ::=            SEQUENCE (SIZE (0..maxSC-MTCH-r13)) OF SC-MTCH-Info-r13
 
 SC-MTCH-Info-r13 ::=                SEQUENCE    {
@@ -8983,6 +10046,66 @@ SC-MTCH-SchedulingInfo-r13::=       SEQUENCE    {
 }
 
 
+SC-MTCH-InfoList-BR-r14 ::=     SEQUENCE (SIZE (0..maxSC-MTCH-BR-r14)) OF SC-MTCH-Info-BR-r14
+
+SC-MTCH-Info-BR-r14 ::=             SEQUENCE    {
+    sc-mtch-CarrierFreq-r14                 ARFCN-ValueEUTRA-r9,
+    mbmsSessionInfo-r14                     MBMSSessionInfo-r13,
+    g-RNTI-r14                              BIT STRING(SIZE(16)),
+    sc-mtch-schedulingInfo-r14          SC-MTCH-SchedulingInfo-BR-r14               OPTIONAL,   -- Need OP
+    sc-mtch-neighbourCell-r14               BIT STRING (SIZE(maxNeighCell-SCPTM-r13))   OPTIONAL,   -- Need OP
+    mpdcch-Narrowband-SC-MTCH-r14               INTEGER (1.. maxAvailNarrowBands-r13),
+    mpdcch-NumRepetition-SC-MTCH-r14            ENUMERATED {r1, r2, r4, r8, r16, 
+                                                            r32, r64, r128, r256},
+    mpdcch-StartSF-SC-MTCH-r14      CHOICE {
+            fdd-r14                             ENUMERATED {v1, v1dot5, v2, v2dot5, v4,
+                                                                v5, v8, v10},
+            tdd-r14                             ENUMERATED {v1, v2, v4, v5, v8, v10,
+                                                                v20}
+    },
+    mpdcch-PDSCH-HoppingConfig-SC-MTCH-r14      ENUMERATED {on, off},
+    mpdcch-PDSCH-CEmodeConfig-SC-MTCH-r14       ENUMERATED {ce-ModeA, ce-ModeB},
+    mpdcch-PDSCH-MaxBandwidth-SC-MTCH-r14       ENUMERATED {bw1dot4, bw5},
+    mpdcch-Offset-SC-MTCH-r14                   ENUMERATED {zero, oneEighth, oneQuarter,
+                                                            threeEighth, oneHalf, fiveEighth,
+                                                            threeQuarter, sevenEighth},
+
+    p-a-r14                                     ENUMERATED { dB-6, dB-4dot77, dB-3,
+                                                            dB-1dot77, dB0, dB1, dB2,
+                                                            dB3}                OPTIONAL,-- Need OR
+    ...
+}
+
+SC-MTCH-SchedulingInfo-BR-r14::=    SEQUENCE    {
+    onDurationTimerSCPTM-r14                ENUMERATED {
+                                                psf300, psf400, psf500, psf600,
+                                                psf800, psf1000, psf1200, psf1600},
+    drx-InactivityTimerSCPTM-r14            ENUMERATED {
+                                                psf0, psf1, psf2, psf4, psf8, psf16,
+                                                psf32, psf64, psf128, psf256, ps512, 
+                                                psf1024, psf2048, psf4096, psf8192, psf16384},
+    schedulingPeriodStartOffsetSCPTM-r14    CHOICE {
+        sf10                                    INTEGER(0..9),
+        sf20                                    INTEGER(0..19),
+        sf32                                    INTEGER(0..31),
+        sf40                                    INTEGER(0..39),
+        sf64                                    INTEGER(0..63),
+        sf80                                    INTEGER(0..79),
+        sf128                                   INTEGER(0..127),
+        sf160                                   INTEGER(0..159),
+        sf256                                   INTEGER(0..255),
+        sf320                                   INTEGER(0..319),
+        sf512                                   INTEGER(0..511),
+        sf640                                   INTEGER(0..639),
+        sf1024                                  INTEGER(0..1023),
+        sf2048                                  INTEGER(0..2047),
+        sf4096                                  INTEGER(0..4095),
+        sf8192                                  INTEGER(0..8191)
+    },
+    ...
+}
+
+
 SCPTM-NeighbourCellList-r13 ::=     SEQUENCE (SIZE (1..maxNeighCell-SCPTM-r13)) OF PCI-ARFCN-r13
 
 PCI-ARFCN-r13 ::=                   SEQUENCE {
@@ -8991,6 +10114,37 @@ PCI-ARFCN-r13 ::=                   SEQUENCE {
 }
 
 
+SL-AnchorCarrierFreqList-V2X-r14 ::= SEQUENCE (SIZE (1..maxFreqV2X-r14)) OF ARFCN-ValueEUTRA-r9
+
+
+SL-CBR-CommonTxConfigList-r14 ::=   SEQUENCE {
+    cbr-RangeCommonConfigList-r14   SEQUENCE (SIZE (1..maxSL-V2X-CBRConfig-r14)) OF SL-CBR-Levels-Config-r14,
+    sl-CBR-PSSCH-TxConfigList-r14   SEQUENCE (SIZE (1..maxSL-V2X-TxConfig-r14)) OF SL-CBR-PSSCH-TxConfig-r14
+}
+
+SL-CBR-Levels-Config-r14 ::=        SEQUENCE (SIZE (1..maxCBR-Level-r14)) OF SL-CBR-r14
+
+
+SL-CBR-PSSCH-TxConfig-r14 ::=       SEQUENCE {
+    cr-Limit-r14                    INTEGER(0..10000),
+    tx-Parameters-r14               SL-PSSCH-TxParameters-r14
+}
+
+SL-CBR-r14 ::=                      INTEGER(0..100)
+
+
+SL-CBR-PPPP-TxConfigList-r14 ::=    SEQUENCE (SIZE (1..8)) OF SL-PPPP-TxConfigIndex-r14
+
+SL-PPPP-TxConfigIndex-r14 ::=       SEQUENCE {
+    priorityThreshold-r14           SL-Priority-r13,
+    defaultTxConfigIndex-r14        INTEGER(0..maxCBR-Level-1-r14),
+    cbr-ConfigIndex-r14             INTEGER(0..maxSL-V2X-CBRConfig-1-r14),
+    tx-ConfigIndexList-r14          SEQUENCE (SIZE (1..maxCBR-Level-r14)) OF Tx-ConfigIndex-r14
+}
+
+Tx-ConfigIndex-r14 ::=              INTEGER(0..maxSL-V2X-TxConfig-1-r14)
+
+
 SL-CommConfig-r12 ::=               SEQUENCE    {
     commTxResources-r12                 CHOICE {
         release                             NULL,
@@ -9095,7 +10249,7 @@ SL-CommResourcePoolV2X-r14 ::=      SEQUENCE {
                                         n48, n50, n72, n75, n96, n100, spare13, spare12, spare11,
                                         spare10, spare9, spare8, spare7, spare6, spare5, spare4, 
                                         spare3, spare2, spare1},
-    numSubchannel-r14                   ENUMERATED {n1, n3, n5, n10, n15, n20, spare2, spare1},
+    numSubchannel-r14                   ENUMERATED {n1, n3, n5, n8, n10, n15, n20, spare1},
     startRB-Subchannel-r14              INTEGER (0..99),
     startRB-PSCCH-Pool-r14              INTEGER (0..99)             OPTIONAL,   -- Need OR
     rxParametersNCell-r14               SEQUENCE {
@@ -9103,12 +10257,36 @@ SL-CommResourcePoolV2X-r14 ::=      SEQUENCE {
         syncConfigIndex-r14             INTEGER (0..15)
     }                                                               OPTIONAL,   -- Need OR
     dataTxParameters-r14                SL-TxParameters-r12         OPTIONAL,   -- Cond Tx
-    zoneID-r14                          INTEGER (0..7)              OPTIONAL,   -- Need OR,
+    zoneID-r14                          INTEGER (0..7)              OPTIONAL,   -- Need OR
+    threshS-RSSI-CBR-r14                    INTEGER (0..45)             OPTIONAL,   -- Need OR
+    poolReportId-r14                    SL-V2X-TxPoolReportIdentity-r14     OPTIONAL,   -- Need OR
+    cbr-pssch-TxConfigList-r14          SL-CBR-PPPP-TxConfigList-r14    OPTIONAL,   -- Need OR
+    resourceSelectionConfigP2X-r14      SL-P2X-ResourceSelectionConfig-r14  OPTIONAL,   -- Cond P2X
+    syncAllowed-r14                     SL-SyncAllowed-r14              OPTIONAL,   -- Need OR
+    restrictResourceReservationPeriod-r14   SL-RestrictResourceReservationPeriodList-r14    OPTIONAL,   -- Need OR
     ...
 }
 
 SL-TRPT-Subset-r12 ::=          BIT STRING (SIZE (3..5))
 
+SL-V2X-TxPoolReportIdentity-r14::=      INTEGER (1..maxSL-PoolToMeasure-r14)
+
+
+SL-CommTxPoolSensingConfig-r14 ::=      SEQUENCE {
+    pssch-TxConfigList-r14                  SL-PSSCH-TxConfigList-r14,
+    thresPSSCH-RSRP-List-r14                SL-ThresPSSCH-RSRP-List-r14,
+    restrictResourceReservationPeriod-r14   SL-RestrictResourceReservationPeriodList-r14    OPTIONAL,   -- Need OR
+    probResourceKeep-r14                ENUMERATED {v0, v0dot2, v0dot4, v0dot6, v0dot8,
+                                                    spare3,spare2, spare1},
+    p2x-SensingConfig-r14                   SEQUENCE {
+        minNumCandidateSF-r14               INTEGER (1..13),
+        gapCandidateSensing-r14             BIT STRING (SIZE (10))
+    }       OPTIONAL,   -- Need OR
+    sl-ReselectAfter-r14                ENUMERATED {n1, n2, n3, n4, n5, n6, n7, n8, n9,
+                                                spare7, spare6, spare5, spare4, spare3, spare2,
+                                                spare1}             OPTIONAL        -- Need OR
+}
+
 
 SL-CP-Len-r12 ::=               ENUMERATED {normal, extended}
 
@@ -9301,8 +10479,40 @@ SL-PoolSelectionConfig-r12 ::=      SEQUENCE {
 }
 
 
-SL-DiscTxPowerInfoList-r12 ::=  SEQUENCE (SIZE (maxSL-DiscPowerClass-r12)) OF SL-DiscTxPowerInfo-r12
-
+SL-DiscSysInfoReport-r13 ::=    SEQUENCE {
+    plmn-IdentityList-r13           PLMN-IdentityList           OPTIONAL,
+    cellIdentity-13                 CellIdentity                OPTIONAL,
+    carrierFreqInfo-13              ARFCN-ValueEUTRA-r9         OPTIONAL,
+    discRxResources-r13             SL-DiscRxPoolList-r12       OPTIONAL,
+    discTxPoolCommon-r13            SL-DiscTxPoolList-r12       OPTIONAL,
+    discTxPowerInfo-r13             SL-DiscTxPowerInfoList-r12  OPTIONAL,
+    discSyncConfig-r13              SL-SyncConfigNFreq-r13      OPTIONAL,
+    discCellSelectionInfo-r13       SEQUENCE {
+        q-RxLevMin-r13                  Q-RxLevMin,
+        q-RxLevMinOffset-r13            INTEGER (1..8)          OPTIONAL
+    }                                                           OPTIONAL,
+    cellReselectionInfo-r13         SEQUENCE {
+        q-Hyst-r13                      ENUMERATED {
+                                                dB0, dB1, dB2, dB3, dB4, dB5, dB6, dB8, dB10,
+                                                dB12, dB14, dB16, dB18, dB20, dB22, dB24},
+        q-RxLevMin-r13                  Q-RxLevMin,
+        t-ReselectionEUTRA-r13          T-Reselection
+    }                                                           OPTIONAL,
+    tdd-Config-r13                  TDD-Config                  OPTIONAL,
+    freqInfo-r13                    SEQUENCE {
+        ul-CarrierFreq-r13              ARFCN-ValueEUTRA                OPTIONAL,   
+        ul-Bandwidth-r13                ENUMERATED {n6, n15, n25, n50, n75, n100}
+                                                                        OPTIONAL,   
+        additionalSpectrumEmission-r13  AdditionalSpectrumEmission      OPTIONAL
+    }                                                               OPTIONAL,
+    p-Max-r13                       P-Max   OPTIONAL,
+    referenceSignalPower-r13        INTEGER (-60..50)   OPTIONAL,
+    ...
+}
+
+
+SL-DiscTxPowerInfoList-r12 ::=  SEQUENCE (SIZE (maxSL-DiscPowerClass-r12)) OF SL-DiscTxPowerInfo-r12
+
 SL-DiscTxPowerInfo-r12 ::=              SEQUENCE    {
     discMaxTxPower-r12                          P-Max,
     ...
@@ -9346,12 +10556,32 @@ SL-HoppingConfigDisc-r12 ::=    SEQUENCE    {
 }
 
 
-SL-InterFreqInfoListV2X-r14 ::= SEQUENCE (SIZE (1..maxFreq)) OF SL-InterFreqInfoV2X-r14
+SL-InterFreqInfoListV2X-r14 ::= SEQUENCE (SIZE (0..maxFreqV2X-1-r14)) OF SL-InterFreqInfoV2X-r14
 
-SL-InterFreqInfoV2X-r14::=      SEQUENCE {
+SL-InterFreqInfoV2X-r14 ::=         SEQUENCE {
+    plmn-IdentityList-r14               PLMN-IdentityList           OPTIONAL,       -- Need OP
     v2x-CommCarrierFreq-r14             ARFCN-ValueEUTRA-r9,
-    typeTxSync-r14                      ENUMERATED {gnss, enb}              OPTIONAL,   -- Need OR
+    sl-MaxTxPower-r14                   P-Max               OPTIONAL,       -- Need OR
+    sl-Bandwidth-r14                    ENUMERATED {n6, n15, n25, n50, n75, n100}   OPTIONAL,   -- Need OR
     v2x-SchedulingPool-r14              SL-CommResourcePoolV2X-r14              OPTIONAL,   -- Need OR
+    v2x-UE-ConfigList-r14       SL-V2X-UE-ConfigList-r14    OPTIONAL,   -- Need OR
+    ...
+}
+
+
+SL-V2X-UE-ConfigList-r14 ::=    SEQUENCE (SIZE (1.. maxCellIntra)) OF SL-V2X-InterFreqUE-Config-r14
+
+SL-V2X-InterFreqUE-Config-r14 ::=       SEQUENCE {
+    physCellIdList-r14                  PhysCellIdList-r13                  OPTIONAL,   -- Need OR
+    typeTxSync-r14                      SL-TypeTxSync-r14                   OPTIONAL,   -- Need OR
+    v2x-SyncConfig-r14                  SL-SyncConfigListNFreqV2X-r14       OPTIONAL,   -- Need OR
+    v2x-CommRxPool-r14                  SL-CommRxPoolListV2X-r14                OPTIONAL,   -- Need OR
+    v2x-CommTxPoolNormal-r14                SL-CommTxPoolListV2X-r14                OPTIONAL,   -- Need OR
+    p2x-CommTxPoolNormal-r14                SL-CommTxPoolListV2X-r14                OPTIONAL,   -- Need OR
+    v2x-CommTxPoolExceptional-r14       SL-CommResourcePoolV2X-r14          OPTIONAL,   -- Need OR
+    v2x-ResourceSelectionConfig-r14     SL-CommTxPoolSensingConfig-r14      OPTIONAL,   -- Need OR
+    zoneConfig-r14                      SL-ZoneConfig-r14                   OPTIONAL,   -- Need OR
+    offsetDFN-r14                       INTEGER (0..1000)                   OPTIONAL,   -- Need OR
     ...
 }
 
@@ -9363,7 +10593,15 @@ SL-OffsetIndicator-r12 ::=          CHOICE {
 
 SL-OffsetIndicatorSync-r12 ::=          INTEGER (0..39)
 
-SL-OffsetIndicatorSync-v14xy ::=        INTEGER (40..159)
+SL-OffsetIndicatorSync-v1430 ::=        INTEGER (40..159)
+
+SL-OffsetIndicatorSync-r14 ::=          INTEGER (0..159)
+
+
+SL-P2X-ResourceSelectionConfig-r14 ::=          SEQUENCE {
+    partialSensing-r14              ENUMERATED {true}               OPTIONAL,   -- Need OR
+    randomSelection-r14             ENUMERATED {true}               OPTIONAL    -- Need OR
+}
 
 
 SL-PeriodComm-r12 ::=                   ENUMERATED {sf40, sf60, sf70, sf80, sf120, sf140,
@@ -9379,7 +10617,7 @@ SL-Priority-r13 ::=         INTEGER (1..8)
 SL-PSSCH-TxConfigList-r14 ::=   SEQUENCE (SIZE (1..maxPSSCH-TxConfig-r14)) OF SL-PSSCH-TxConfig-r14
 
 SL-PSSCH-TxConfig-r14 ::=       SEQUENCE {
-    typeTxSync-r14              ENUMERATED {gnss, enb, ue, spare1}      OPTIONAL,   -- Need OR
+    typeTxSync-r14              SL-TypeTxSync-r14       OPTIONAL,   -- Need OR
     thresUE-Speed-r14           ENUMERATED {kmph60, kmph80, kmph100, kmph120, 
                                 kmph140, kmph160, kmph180, kmph200},
     parametersAboveThres-r14    SL-PSSCH-TxParameters-r14,
@@ -9390,9 +10628,10 @@ SL-PSSCH-TxConfig-r14 ::=       SEQUENCE {
 SL-PSSCH-TxParameters-r14 ::=       SEQUENCE {
     minMCS-PSSCH-r14            INTEGER (0..31),
     maxMCS-PSSCH-r14            INTEGER (0..31),
-    minRB-NumberPSSCH-r14       INTEGER (1..100),
-    maxRB-NumberPSSCH-r14       INTEGER (1..100),
-    allowedRetxNumberPSSCH-r14  ENUMERATED {n0, n1, both, spare1}
+    minSubChannel-NumberPSSCH-r14       INTEGER (1..20),
+    maxSubchannel-NumberPSSCH-r14       INTEGER (1..20),
+    allowedRetxNumberPSSCH-r14  ENUMERATED {n0, n1, both, spare1},
+    maxTxPower-r14              SL-TxPower-r14              OPTIONAL            -- Cond CBR
 }
 
 
@@ -9404,6 +10643,13 @@ SL-RestrictResourceReservationPeriod-r14 ::=        ENUMERATED {v0dot2, v0dot5,
 SLSSID-r12 ::=                  INTEGER (0..167)
 
 
+SL-SyncAllowed-r14 ::=      SEQUENCE {
+    gnss-Sync-r14                       ENUMERATED {true}               OPTIONAL,   -- Need OR
+    enb-Sync-r14                        ENUMERATED {true}               OPTIONAL,   -- Need OR
+    ue-Sync-r14                         ENUMERATED {true}               OPTIONAL    -- Need OR
+}
+
+
 SL-SyncConfigList-r12 ::=       SEQUENCE (SIZE (1..maxSL-SyncConfig-r12)) OF SL-SyncConfig-r12
 
 SL-SyncConfigListV2X-r14 ::=    SEQUENCE (SIZE (1.. maxSL-V2X-SyncConfig-r14)) OF SL-SyncConfig-r12
@@ -9424,12 +10670,15 @@ SL-SyncConfig-r12 ::=                   SEQUENCE {
     ...,
     [[  syncTxPeriodic-r13                  ENUMERATED {true}           OPTIONAL    -- Need OR
     ]],
-    [[  syncOffsetIndicator-v14xy       SL-OffsetIndicatorSync-v14xy    OPTIONAL    -- Need OR
+    [[  syncOffsetIndicator-v1430       SL-OffsetIndicatorSync-v1430    OPTIONAL,   -- Need OR
+        gnss-Sync-r14                   ENUMERATED {true}               OPTIONAL    -- Need OR
     ]]
 }
 
 SL-SyncConfigListNFreq-r13 ::=      SEQUENCE (SIZE (1..maxSL-SyncConfig-r12)) OF SL-SyncConfigNFreq-r13
 
+SL-SyncConfigListNFreqV2X-r14 ::=       SEQUENCE (SIZE (1..maxSL-V2X-SyncConfig-r14)) OF SL-SyncConfigNFreq-r13
+
 SL-SyncConfigNFreq-r13 ::=          SEQUENCE {
     asyncParameters-r13                 SEQUENCE {
         syncCP-Len-r13                      SL-CP-Len-r12,
@@ -9445,39 +10694,10 @@ SL-SyncConfigNFreq-r13 ::=          SEQUENCE {
     rxParameters-r13                    SEQUENCE {
         discSyncWindow-r13                  ENUMERATED {w1, w2}
     }                                                                   OPTIONAL,   -- Need OR
-    ...
-}
-
-
-SL-DiscSysInfoReport-r13 ::=    SEQUENCE {
-    plmn-IdentityList-r13           PLMN-IdentityList           OPTIONAL,
-    cellIdentity-13                 CellIdentity                OPTIONAL,
-    carrierFreqInfo-13              ARFCN-ValueEUTRA-r9         OPTIONAL,
-    discRxResources-r13             SL-DiscRxPoolList-r12       OPTIONAL,
-    discTxPoolCommon-r13            SL-DiscTxPoolList-r12       OPTIONAL,
-    discTxPowerInfo-r13             SL-DiscTxPowerInfoList-r12  OPTIONAL,
-    discSyncConfig-r13              SL-SyncConfigNFreq-r13      OPTIONAL,
-    discCellSelectionInfo-r13       SEQUENCE {
-        q-RxLevMin-r13                  Q-RxLevMin,
-        q-RxLevMinOffset-r13            INTEGER (1..8)          OPTIONAL
-    }                                                           OPTIONAL,
-    cellReselectionInfo-r13         SEQUENCE {
-        q-Hyst-r13                      ENUMERATED {
-                                                dB0, dB1, dB2, dB3, dB4, dB5, dB6, dB8, dB10,
-                                                dB12, dB14, dB16, dB18, dB20, dB22, dB24},
-        q-RxLevMin-r13                  Q-RxLevMin,
-        t-ReselectionEUTRA-r13          T-Reselection
-    }                                                           OPTIONAL,
-    tdd-Config-r13                  TDD-Config                  OPTIONAL,
-    freqInfo-r13                    SEQUENCE {
-        ul-CarrierFreq-r13              ARFCN-ValueEUTRA                OPTIONAL,   
-        ul-Bandwidth-r13                ENUMERATED {n6, n15, n25, n50, n75, n100}
-                                                                        OPTIONAL,   
-        additionalSpectrumEmission-r13  AdditionalSpectrumEmission      OPTIONAL
-    }                                                               OPTIONAL,
-    p-Max-r13                       P-Max   OPTIONAL,
-    referenceSignalPower-r13        INTEGER (-60..50)   OPTIONAL,
-    ...
+    ...,
+    [[  syncOffsetIndicator-v1430       SL-OffsetIndicatorSync-v1430    OPTIONAL,   -- Need OR
+        gnss-Sync-r14                   ENUMERATED {true}               OPTIONAL    -- Need OR
+    ]]
 }
 
 
@@ -9500,13 +10720,27 @@ SubframeBitmapSL-r12 ::=        CHOICE {
 }
 
 SubframeBitmapSL-r14 ::=        CHOICE {
+    bs10-r14                                BIT STRING (SIZE (10)),
     bs16-r14                                BIT STRING (SIZE (16)),
     bs20-r14                                BIT STRING (SIZE (20)),
+    bs30-r14                                BIT STRING (SIZE (30)),
+    bs40-r14                                BIT STRING (SIZE (40)),
+    bs50-r14                                BIT STRING (SIZE (50)),
+    bs60-r14                                BIT STRING (SIZE (60)),
     bs100-r14                               BIT STRING (SIZE (100))
 }
 
 
-SL-ThresPSSCH-RSRP-List-r14 ::= SEQUENCE (SIZE (1..64)) OF SL-ThresPSSCH-RSRP-r14
+SL-TxPower-r14 ::=      CHOICE {
+    minusinfinity-r14               NULL,
+    txPower-r14                     INTEGER (-41..31)
+}
+
+
+SL-TypeTxSync-r14 ::=       ENUMERATED {gnss, enb, ue}
+
+
+SL-ThresPSSCH-RSRP-List-r14 ::= SEQUENCE (SIZE (64)) OF SL-ThresPSSCH-RSRP-r14
 
 SL-ThresPSSCH-RSRP-r14 ::=      INTEGER (0..66)
 
@@ -9536,17 +10770,17 @@ SL-V2X-ConfigDedicated-r14 ::=              SEQUENCE    {
         release                             NULL,
         setup                               CHOICE {
             scheduled-r14                   SEQUENCE {
-                sl-D-RNTI-r14           C-RNTI,
-                mac-MainConfig-r14              MAC-MainConfigSL-r12        OPTIONAL,   -- Need OP
-                v2x-SchedulingPool-r14          SL-CommResourcePoolV2X-r14  OPTIONAL,   -- Need OP
-                mcs-r14                         INTEGER (0..31)             OPTIONAL,   -- Need OP
+                sl-V-RNTI-r14           C-RNTI,
+                mac-MainConfig-r14              MAC-MainConfigSL-r12,
+                v2x-SchedulingPool-r14          SL-CommResourcePoolV2X-r14  OPTIONAL,   -- Need ON
+                mcs-r14                         INTEGER (0..31)             OPTIONAL,   -- Need OR
                 logicalChGroupInfoList-r14      LogicalChGroupInfoList-r13
             },
             ue-Selected-r14                 SEQUENCE {
                 -- Pool for normal usage
                 v2x-CommTxPoolNormalDedicated-r14   SEQUENCE {
                     poolToReleaseList-r14   SL-TxPoolToReleaseListV2X-r14   OPTIONAL,   -- Need ON
-                    poolToAddModList-r14    SL-TxPoolToAddModListV2X-r14    OPTIONAL,   -- Need ON
+                    poolToAddModList-r14        SL-TxPoolToAddModListV2X-r14        OPTIONAL,   -- Need ON
                     v2x-CommTxPoolSensingConfig-r14     SL-CommTxPoolSensingConfig-r14
                                                                             OPTIONAL    -- Need ON
                 }
@@ -9554,10 +10788,15 @@ SL-V2X-ConfigDedicated-r14 ::=              SEQUENCE    {
         }
     }                                                                       OPTIONAL,   -- Need ON
     v2x-InterFreqInfoList-r14           SL-InterFreqInfoListV2X-r14         OPTIONAL,   -- Need ON
+    thresSL-TxPrioritization-r14            SL-Priority-r13                         OPTIONAL,   -- Need OR
+    typeTxSync-r14                      SL-TypeTxSync-r14                   OPTIONAL,   -- Need OR
+    cbr-DedicatedTxConfigList-r14       SL-CBR-CommonTxConfigList-r14   OPTIONAL,   -- Need OR
     ...
 }
 
-SL-TxPoolToAddModListV2X-r14 ::=        SEQUENCE    {
+SL-TxPoolToAddModListV2X-r14 ::=        SEQUENCE (SIZE (1.. maxSL-V2X-TxPool-r14)) OF SL-TxPoolToAddMod-r14
+
+SL-TxPoolToAddMod-r14 ::=   SEQUENCE    {
     poolIdentity-r14                    SL-V2X-TxPoolIdentity-r14,
     pool-r14                            SL-CommResourcePoolV2X-r14
 }
@@ -9566,10 +10805,10 @@ SL-TxPoolToReleaseListV2X-r14 ::=   SEQUENCE (SIZE (1.. maxSL-V2X-TxPool-r14)) O
 
 
 SL-ZoneConfig-r14 ::=       SEQUENCE {
-    zoneLength-r14  ENUMERATED { m5, m10, m20, m50, m100, m200, m500, spare1}   OPTIONAL, -- Need OR
-    zoneWidth-r14   ENUMERATED { m5, m10, m20, m50, m100, m200, m500, spare1}   OPTIONAL, -- Need OR
-    zoneIdLongiMod-r14  INTEGER (1..4)                                  OPTIONAL,   -- Need OR
-    zoneIdLatiMod-r14   INTEGER (1..4)                                  OPTIONAL    -- Need OR
+    zoneLength-r14  ENUMERATED { m5, m10, m20, m50, m100, m200, m500, spare1},
+    zoneWidth-r14   ENUMERATED { m5, m10, m20, m50, m100, m200, m500, spare1},
+    zoneIdLongiMod-r14  INTEGER (1..4),
+    zoneIdLatiMod-r14   INTEGER (1..4)
 }
 
 
@@ -9582,6 +10821,9 @@ maxBands                    INTEGER ::= 64  -- Maximum number of bands listed in
 maxBandwidthClass-r10       INTEGER ::= 16  -- Maximum number of supported CA BW classes per band
 maxBandwidthCombSet-r10     INTEGER ::= 32  -- Maximum number of bandwidth combination sets per
                                             -- supported band combination
+maxCBR-Level-r14            INTEGER ::= 16  -- Maximum number of CBR levels 
+maxCBR-Level-1-r14          INTEGER ::= 15
+maxCBR-Report-r14           INTEGER ::= 72  -- Maximum number of CBR results in a report
 maxCDMA-BandClass           INTEGER ::= 32  -- Maximum value of the CDMA band classes
 maxCE-Level-r13             INTEGER ::= 4   -- Maximum number of CE levels
 maxCellBlack                INTEGER ::= 16  -- Maximum number of blacklisted physical cell identity
@@ -9632,6 +10874,7 @@ maxCellListGERAN            INTEGER ::= 3   -- Maximum number of lists of GERAN
 maxCellMeas                 INTEGER ::= 32  -- Maximum number of entries in each of the
                                             -- cell lists in a measurement object
 maxCellReport               INTEGER ::= 8   -- Maximum number of reported cells/CSI-RS resources
+maxConfigSPS-r14            INTEGER ::= 8   -- Maximum number of simultaneous SPS configurations
 maxCSI-RS-Meas-r12          INTEGER ::= 96  -- Maximum number of entries in the CSI-RS list
                                             -- in a measurement object
 maxDRB                      INTEGER ::= 11  -- Maximum number of Data Radio Bearers
@@ -9651,6 +10894,9 @@ maxFreqIDC-r11              INTEGER ::= 32  -- Maximum number of carrier frequen
                                             -- affected by the IDC problems
 maxFreqMBMS-r11             INTEGER ::= 5   -- Maximum number of carrier frequencies for which an 
                                             -- MBMS capable UE may indicate an interest
+maxFreqV2X-r14              INTEGER ::= 8   -- Maximum number of carrier frequencies for which V2X 
+                                            -- sidelink communication can be configured
+maxFreqV2X-1-r14                INTEGER ::= 7   -- Highest index of frequencies
 maxGERAN-SI                 INTEGER ::= 10  -- Maximum number of GERAN SI blocks that can be
                                             -- provided as part of NACC information
 maxGNFG                     INTEGER ::= 16  -- Maximum number of GERAN neighbour freq groups
@@ -9681,6 +10927,7 @@ maxP-a-PerNeighCell-r12     INTEGER ::= 3   -- Maximum number of power offsets f
 maxPageRec                  INTEGER ::= 16  -- 
 maxPhysCellIdRange-r9       INTEGER ::= 4   -- Maximum number of physical cell identity ranges
 maxPLMN-r11                 INTEGER ::= 6   -- Maximum number of PLMNs
+maxPLMN-1-r14               INTEGER ::= 5   -- Maximum number of PLMNs minus one
 maxPNOffset                 INTEGER ::= 511 -- Maximum number of CDMA2000 PNOffsets
 maxPMCH-PerMBSFN            INTEGER ::= 15
 maxPSSCH-TxConfig-r14       INTEGER ::= 16  -- Maximum number of PSSCH TX configurations
@@ -9690,7 +10937,7 @@ maxRE-MapQCL-r11            INTEGER ::= 4   -- Maximum number of PDSCH RE Mappin
                                             --  (per carrier frequency)
 maxReportConfigId           INTEGER ::= 32
 maxReservationPeriod-r14    INTEGER ::= 16  -- Maximum number of resource reservation periodicities
-                                            --  for sidelink V2X communications
+                                            --  for sidelink V2X communication
 maxRSTD-Freq-r10            INTEGER ::= 3   -- Maximum number of frequency layers for RSTD
                                             -- measurement
 maxSAI-MBMS-r11             INTEGER ::= 64  -- Maximum number of MBMS service area identities
@@ -9698,6 +10945,7 @@ maxSAI-MBMS-r11             INTEGER ::= 64  -- Maximum number of MBMS service ar
 maxSCell-r10                INTEGER ::= 4   -- Maximum number of SCells
 maxSCell-r13                INTEGER ::= 31  -- Highest value of extended number range of SCells
 maxSC-MTCH-r13              INTEGER ::= 1023    -- Maximum number of SC-MTCHs in one cell
+maxSC-MTCH-BR-r14           INTEGER ::= 128 -- Maximum number of SC-MTCHs in one cell for feMTC
 maxSL-CommRxPoolNFreq-r13   INTEGER ::= 32  -- Maximum number of individual sidelink communication
                                             -- Rx resource pools on neighbouring freq
 maxSL-CommRxPoolPreconf-v1310   INTEGER ::= 12  -- Maximum number of additional preconfigured
@@ -9722,22 +10970,40 @@ maxSL-DiscTxPoolPreconf-r13     INTEGER ::= 4   -- Maximum number of preconfigur
                                                 -- discovery Tx resource pool entries
 maxSL-GP-r13            INTEGER ::= 8   -- Maximum number of gap patterns that can be requested
                                         -- for a frequency or assigned
+maxSL-PoolToMeasure-r14     INTEGER ::= 72  -- Maximum number of TX resource pools for CBR
+                                                -- measurement and report
 maxSL-Prio-r13          INTEGER ::= 8   -- Maximum number of entries in sidelink priority list
 maxSL-RxPool-r12            INTEGER ::= 16  -- Maximum number of individual sidelink Rx resource pools
 maxSL-SyncConfig-r12        INTEGER ::= 16  -- Maximum number of sidelink Sync configurations
 maxSL-TF-IndexPair-r12  INTEGER ::= 64  -- Maximum number of sidelink Time Freq resource index
                                             --  pairs
 maxSL-TxPool-r12            INTEGER ::= 4   -- Maximum number of individual sidelink Tx resource pools
-maxSL-V2X-RxPool-r14        INTEGER ::= 16  -- Maximum number of RX resource pools for 
+maxSL-V2X-RxPool-r14        INTEGER ::= 16  -- Maximum number of RX resource pools for
                                                 -- V2X sidelink communication
-maxSL-V2X-RxPoolPreconf-r14 INTEGER ::= 16      -- Maximum number of RX resource pools for 
+maxSL-V2X-RxPoolPreconf-r14 INTEGER ::= 16      -- Maximum number of RX resource pools for
                                                 -- V2X sidelink communication
-maxSL-V2X-TxPool-r14        INTEGER ::= 8   -- Maximum number of TX resource pools for 
+maxSL-V2X-TxPool-r14        INTEGER ::= 8   -- Maximum number of TX resource pools for
                                                 -- V2X sidelink communication
-maxSL-V2X-TxPoolPreconf-r14 INTEGER ::= 8       -- Maximum number of TX resource pools for 
+maxSL-V2X-TxPoolPreconf-r14 INTEGER ::= 8       -- Maximum number of TX resource pools for
                                                 -- V2X sidelink communication
 maxSL-V2X-SyncConfig-r14    INTEGER ::= 16  -- Maximum number of sidelink Sync configurations
                                                 -- for V2X sidelink communication
+maxSL-V2X-CBRConfig-r14     INTEGER ::= 4   -- Maximum number of CBR range configurations 
+                                                -- for V2X sidelink communication congestion
+                                                -- control
+maxSL-V2X-CBRConfig-1-r14   INTEGER ::= 3
+maxSL-V2X-TxConfig-r14      INTEGER ::= 64  -- Maximum number of TX parameter configurations
+                                                -- for V2X sidelink communication congestion
+                                                -- control
+maxSL-V2X-TxConfig-1-r14    INTEGER ::= 63
+maxSL-V2X-CBRConfig2-r14        INTEGER ::= 8   -- Maximum number of CBR range configurations in
+                                                -- pre-configuration for V2X sidelink
+                                                -- communication congestion control
+maxSL-V2X-CBRConfig2-1-r14  INTEGER ::= 7
+maxSL-V2X-TxConfig2-r14     INTEGER ::= 128 -- Maximum number of TX parameter
+                                                -- configurations in pre-configuration for V2X
+                                                -- sidelink communication congestion control
+maxSL-V2X-TxConfig2-1-r14   INTEGER ::= 127
 maxSTAG-r11                 INTEGER ::= 3   -- Maximum number of STAGs
 maxServCell-r10             INTEGER ::= 5   -- Maximum number of Serving cells
 maxServCell-r13             INTEGER ::= 32  -- Highest value of extended number range of Serving cells
@@ -9753,6 +11019,9 @@ maxSimultaneousBands-r10    INTEGER ::= 64  -- Maximum number of simultaneously
 maxSubframePatternIDC-r11   INTEGER ::= 8   -- Maximum number of subframe reservation patterns
                                             -- that the UE can simultaneously recommend to the
                                             -- E-UTRAN for use.
+maxTrafficPattern-r14       INTEGER ::= 8   -- Maximum number of periodical traffic patterns
+                                            -- that the UE can simultaneously report to the
+                                            -- E-UTRAN.
 maxUTRA-FDD-Carrier         INTEGER ::= 16  -- Maximum number of UTRA FDD carrier frequencies
 maxUTRA-TDD-Carrier         INTEGER ::= 16  -- Maximum number of UTRA TDD carrier frequencies
 maxWLAN-Id-r12              INTEGER ::= 16  -- Maximum number of WLAN identifiers
@@ -9761,6 +11030,7 @@ maxWLAN-Id-r13              INTEGER ::= 32  -- Maximum number of WLAN identifier
 maxWLAN-Channels-r13        INTEGER ::= 16  -- maximum number of WLAN channels used in
                                             -- WLAN-CarrierInfo
 maxWLAN-CarrierInfo-r13     INTEGER ::= 8   -- Maximum number of WLAN Carrier Information
+maxWLAN-Id-Report-r14       INTEGER ::= 32  -- Maximum number of WLAN IDs to report
 
 
 END
@@ -9782,6 +11052,13 @@ SBCCH-SL-BCH-Message ::= SEQUENCE {
 SBCCH-SL-BCH-MessageType ::=                        MasterInformationBlock-SL
 
 
+SBCCH-SL-BCH-Message-V2X-r14 ::= SEQUENCE {
+    message                 SBCCH-SL-BCH-MessageType-V2X-r14
+}
+
+SBCCH-SL-BCH-MessageType-V2X-r14 ::=                MasterInformationBlock-SL-V2X-r14
+
+
 MasterInformationBlock-SL ::=       SEQUENCE {
     sl-Bandwidth-r12                    ENUMERATED {
                                             n6, n15, n25, n50, n75, n100},
@@ -9794,6 +11071,18 @@ MasterInformationBlock-SL ::=       SEQUENCE {
 
 
 
+MasterInformationBlock-SL-V2X-r14 ::=       SEQUENCE {
+    sl-Bandwidth-r14                    ENUMERATED {
+                                            n6, n15, n25, n50, n75, n100},
+    tdd-ConfigSL-r14                    TDD-ConfigSL-r12,
+    directFrameNumber-r14               BIT STRING (SIZE (10)),
+    directSubframeNumber-r14            INTEGER (0..9),
+    inCoverage-r14                      BOOLEAN,
+    reserved-r14                        BIT STRING (SIZE (27))
+}
+
+
+
 END
 
 
@@ -9822,8 +11111,12 @@ IMPORTS
     maxMultiBands,
     maxPageRec,
     maxPLMN-r11,
+    maxSAI-MBMS-r11,
     maxSIB,
     maxSIB-1,
+    MBMS-SAI-r11,
+    MBMS-SAI-List-r11,
+    MBMSSessionInfo-r13,
     NextHopChainingCount,
     PagingUE-Identity,
     PLMN-Identity,
@@ -9844,8 +11137,12 @@ IMPORTS
     S-TMSI,
     SystemInformationBlockType16-r11,
     SystemInfoValueTagSI-r13,
+    T-Reordering,
     TimeAlignmentTimer,
-    TrackingAreaCode
+    TMGI-r9,
+    TrackingAreaCode,
+    DataInactivityTimer-r14
+
 FROM EUTRA-RRC-Definitions;
 
 
@@ -9933,6 +11230,19 @@ UL-CCCH-MessageType-NB ::= CHOICE {
 }
 
 
+SC-MCCH-Message-NB ::= SEQUENCE {
+    message                 SC-MCCH-MessageType-NB
+}
+
+
+SC-MCCH-MessageType-NB ::= CHOICE {
+    c1                      CHOICE {
+        scptmConfiguration-r14                      SCPTMConfiguration-NB-r14
+    },
+    messageClassExtension   SEQUENCE {}
+}
+
+
 UL-DCCH-Message-NB ::= SEQUENCE {
     message                 UL-DCCH-MessageType-NB
 }
@@ -10076,7 +11386,12 @@ RRCConnectionReestablishment-NB-r13-IEs ::= SEQUENCE {
     radioResourceConfigDedicated-r13            RadioResourceConfigDedicated-NB-r13,
     nextHopChainingCount-r13                    NextHopChainingCount,
     lateNonCriticalExtension                    OCTET STRING                        OPTIONAL,
-    nonCriticalExtension                        SEQUENCE {}                         OPTIONAL
+    nonCriticalExtension                        RRCConnectionReestablishment-NB-v1430-IEs   OPTIONAL
+}
+
+RRCConnectionReestablishment-NB-v1430-IEs ::=   SEQUENCE {
+    dl-NAS-MAC                          BIT STRING (SIZE (16)), -- Cond Reestablish-CP 
+    nonCriticalExtension                SEQUENCE {}             OPTIONAL
 }
 
 
@@ -10098,21 +11413,36 @@ RRCConnectionReestablishmentRequest-NB ::= SEQUENCE {
     criticalExtensions                  CHOICE {
         rrcConnectionReestablishmentRequest-r13
                                             RRCConnectionReestablishmentRequest-NB-r13-IEs,
-        criticalExtensionsFuture            SEQUENCE {}
+        later   CHOICE {
+                    rrcConnectionReestablishmentRequest-r14
+                                            RRCConnectionReestablishmentRequest-NB-r14-IEs,
+                    criticalExtensionsFuture    SEQUENCE {}
+        }
     }
 }
 
 RRCConnectionReestablishmentRequest-NB-r13-IEs ::= SEQUENCE {
     ue-Identity-r13                     ReestabUE-Identity,
-    reestablishmentCause-r13            ReestablishmentCause-NB-r13,
+    reestablishmentCause-r13                ReestablishmentCause-NB-r13,
     spare                               BIT STRING (SIZE (25))
 }
 
+RRCConnectionReestablishmentRequest-NB-r14-IEs ::= SEQUENCE {
+    ue-Identity-r14                     ReestabUE-Identity-CP-NB-r14,
+    reestablishmentCause-r14                ReestablishmentCause-NB-r13,
+    spare                               BIT STRING (SIZE (4))
+}
 
 ReestablishmentCause-NB-r13 ::=         ENUMERATED {
                                             reconfigurationFailure, otherFailure, 
                                             spare2, spare1}
 
+ReestabUE-Identity-CP-NB-r14 ::=            SEQUENCE {
+    s-TMSI-r14                          S-TMSI,
+    ul-NAS-MAC-r14                      BIT STRING (SIZE (16)),
+    ul-NAS-Count-r14                        BIT STRING (SIZE (5))
+}
+
 
 RRCConnectionReject-NB ::=              SEQUENCE {
     criticalExtensions                  CHOICE {
@@ -10149,15 +11479,29 @@ RRCConnectionRelease-NB-r13-IEs ::= SEQUENCE {
     extendedWaitTime-r13                INTEGER (1..1800)               OPTIONAL,   -- Need ON
     redirectedCarrierInfo-r13           RedirectedCarrierInfo-NB-r13    OPTIONAL,   -- Need ON
     lateNonCriticalExtension            OCTET STRING                    OPTIONAL,
-    nonCriticalExtension                SEQUENCE {}                     OPTIONAL
+    nonCriticalExtension                RRCConnectionRelease-NB-v1430-IEs       OPTIONAL
 }
 
+RRCConnectionRelease-NB-v1430-IEs ::=   SEQUENCE {
+    redirectedCarrierInfo-v1430         RedirectedCarrierInfo-NB-v1430  OPTIONAL,   -- Cond Redirection 
+    extendedWaitTime-CPdata-r14             INTEGER (1..1800)   OPTIONAL,   -- Cond NoExtendedWaitTime
+    nonCriticalExtension                SEQUENCE {}                     OPTIONAL
+}
 
 ReleaseCause-NB-r13 ::=                 ENUMERATED {loadBalancingTAUrequired, other, 
                                                     rrc-Suspend, spare1}
-
 RedirectedCarrierInfo-NB-r13::=         CarrierFreq-NB-r13
 
+RedirectedCarrierInfo-NB-v1430  ::=     SEQUENCE {
+    redirectedCarrierOffsetDedicated-r14    ENUMERATED{
+                                                dB1, dB2, dB3, dB4, dB5, dB6, dB8, dB10,
+                                                dB12, dB14, dB16, dB18, dB20, dB22, dB24, dB26},
+    t322-r14                                ENUMERATED{
+                                                min5, min10, min20, min30, min60, min120, min180,
+                                                spare1}
+}
+
+
 RRCConnectionRequest-NB ::=     SEQUENCE {
     criticalExtensions                  CHOICE {
         rrcConnectionRequest-r13            RRCConnectionRequest-NB-r13-IEs,
@@ -10259,7 +11603,21 @@ RRCConnectionSetupComplete-NB-r13-IEs ::= SEQUENCE {
     attachWithoutPDN-Connectivity-r13       ENUMERATED {true}               OPTIONAL,
     up-CIoT-EPS-Optimisation-r13            ENUMERATED {true}               OPTIONAL,
     lateNonCriticalExtension                OCTET STRING                    OPTIONAL,
-    nonCriticalExtension                    SEQUENCE {}                     OPTIONAL
+    nonCriticalExtension                    RRCConnectionSetupComplete-NB-v1430-IEs OPTIONAL
+}
+
+RRCConnectionSetupComplete-NB-v1430-IEs ::= SEQUENCE {
+    gummei-Type-r14                         ENUMERATED { mapped}    OPTIONAL,
+    dcn-ID-r14                              INTEGER (0..65535)          OPTIONAL,
+    nonCriticalExtension                        SEQUENCE {}                 OPTIONAL
+}
+
+
+SCPTMConfiguration-NB-r14 ::=       SEQUENCE {
+    sc-mtch-InfoList-r14            SC-MTCH-InfoList-NB-r14,
+    scptm-NeighbourCellList-r14     SCPTM-NeighbourCellList-NB-r14      OPTIONAL,   -- Need OP
+    lateNonCriticalExtension        OCTET STRING                        OPTIONAL,
+    nonCriticalExtension            SEQUENCE {}                         OPTIONAL
 }
 
 
@@ -10277,7 +11635,10 @@ SystemInformation-NB-r13-IEs ::=    SEQUENCE {
         sib5-r13                            SystemInformationBlockType5-NB-r13,
         sib14-r13                           SystemInformationBlockType14-NB-r13,
         sib16-r13                           SystemInformationBlockType16-NB-r13,
-        ...
+        ...,
+        sib15-v1430                         SystemInformationBlockType15-NB-r14,
+        sib20-v1430                         SystemInformationBlockType20-NB-r14,
+        sib22-v1430                         SystemInformationBlockType22-NB-r14
     },
     lateNonCriticalExtension            OCTET STRING                        OPTIONAL,
     nonCriticalExtension                SEQUENCE {}                         OPTIONAL
@@ -10315,6 +11676,16 @@ SystemInformationBlockType1-NB ::=  SEQUENCE {
     si-RadioFrameOffset-r13             INTEGER (1..15)     OPTIONAL,   -- Need OP 
     systemInfoValueTagList-r13          SystemInfoValueTagList-NB-r13   OPTIONAL,   -- Need OR
     lateNonCriticalExtension            OCTET STRING                    OPTIONAL,
+    nonCriticalExtension                SystemInformationBlockType1-NB-v1350    OPTIONAL
+}
+
+SystemInformationBlockType1-NB-v1350 ::=    SEQUENCE {
+    cellSelectionInfo-v1350             CellSelectionInfo-NB-v1350  OPTIONAL,   -- Cond Qrxlevmin
+    nonCriticalExtension                SystemInformationBlockType1-NB-v1430    OPTIONAL
+}
+
+SystemInformationBlockType1-NB-v1430 ::=    SEQUENCE {
+    cellSelectionInfo-v1430             CellSelectionInfo-NB-v1430      OPTIONAL,   -- Need OR
     nonCriticalExtension                SEQUENCE {}                     OPTIONAL
 }
 
@@ -10344,8 +11715,17 @@ SIB-MappingInfo-NB-r13 ::=          SEQUENCE (SIZE (0..maxSIB-1)) OF SIB-Type-NB
 
 SIB-Type-NB-r13 ::=                 ENUMERATED {
                                         sibType3-NB-r13, sibType4-NB-r13, sibType5-NB-r13, 
-                                        sibType14-NB-r13, sibType16-NB-r13, spare3, spare2, spare1}
+                                        sibType14-NB-r13, sibType16-NB-r13, sibType15-NB-r14, sibType20-NB-r14, 
+                                        sibType22-NB-r14}
 
+CellSelectionInfo-NB-v1350 ::=      SEQUENCE {
+    delta-RxLevMin-v1350                INTEGER (-8..-1)
+}
+
+CellSelectionInfo-NB-v1430 ::=      SEQUENCE {
+    powerClass14dBm-Offset-r14          ENUMERATED {dB-6, dB-3, dB3, dB6, dB9, dB12}    OPTIONAL,   --  Need OP
+    ce-authorisationOffset-r14          ENUMERATED {dB5, dB10, dB15, dB20, dB25, dB30, dB35}    OPTIONAL    --  Need OP
+}
 
 
 UECapabilityEnquiry-NB ::=  SEQUENCE {
@@ -10399,13 +11779,15 @@ SystemInformationBlockType2-NB-r13 ::=  SEQUENCE {
     radioResourceConfigCommon-r13           RadioResourceConfigCommonSIB-NB-r13,
     ue-TimersAndConstants-r13               UE-TimersAndConstants-NB-r13,
     freqInfo-r13                            SEQUENCE {
-        ul-CarrierFreq-r13                      CarrierFreq-NB-r13              OPTIONAL,-- Need OP
+        ul-CarrierFreq-r13                      CarrierFreq-NB-r13          OPTIONAL,   -- Need OP
         additionalSpectrumEmission-r13          AdditionalSpectrumEmission
     },
     timeAlignmentTimerCommon-r13            TimeAlignmentTimer,
-    multiBandInfoList-r13   SEQUENCE (SIZE (1..maxMultiBands)) OF AdditionalSpectrumEmission        OPTIONAL,-- Need OR
+    multiBandInfoList-r13   SEQUENCE (SIZE (1..maxMultiBands)) OF AdditionalSpectrumEmission        OPTIONAL,   -- Need OR
     lateNonCriticalExtension                    OCTET STRING                    OPTIONAL,
-    ...
+    ...,
+    [[  cp-Reestablishment-r14              ENUMERATED {true}               OPTIONAL        -- Need OP
+    ]]
 }
 
 
@@ -10430,7 +11812,26 @@ SystemInformationBlockType3-NB-r13 ::=  SEQUENCE {
     multiBandInfoList-r13                   SEQUENCE (SIZE (1..maxMultiBands)) OF 
                                                 NS-PmaxList-NB-r13          OPTIONAL,   -- Need OR
     lateNonCriticalExtension                    OCTET STRING                OPTIONAL,
-    ...
+    ...,
+    [[  intraFreqCellReselectionInfo-v1350      IntraFreqCellReselectionInfo-NB-v1350 OPTIONAL  -- Cond Qrxlevmin
+    ]], 
+    [[  intraFreqCellReselectionInfo-v1360      IntraFreqCellReselectionInfo-NB-v1360 OPTIONAL  -- Need OR
+    ]],
+    [[  intraFreqCellReselectionInfo-v1430  IntraFreqCellReselectionInfo-NB-v1430 OPTIONAL  -- Need OR 
+    ]]
+}
+
+IntraFreqCellReselectionInfo-NB-v1350 ::=   SEQUENCE {
+    delta-RxLevMin-v1350                        INTEGER (-8..-1)
+}
+
+IntraFreqCellReselectionInfo-NB-v1360 ::=   SEQUENCE {
+    s-IntraSearchP-v1360                            ReselectionThreshold-NB-v1360
+}
+
+IntraFreqCellReselectionInfo-NB-v1430 ::=   SEQUENCE {
+    powerClass14dBm-Offset-r14      ENUMERATED {dB-6, dB-3, dB3, dB6, dB9, dB12}    OPTIONAL,   -- Need OP
+    ce-AuthorisationOffset-r14      ENUMERATED {dB5, dB10, dB15, dB20, dB25, dB30, dB35}    OPTIONAL    -- Need OP
 }
 
 
@@ -10447,7 +11848,9 @@ SystemInformationBlockType5-NB-r13 ::=  SEQUENCE {
     interFreqCarrierFreqList-r13            InterFreqCarrierFreqList-NB-r13,
     t-Reselection-r13                       T-Reselection-NB-r13,
     lateNonCriticalExtension                OCTET STRING                    OPTIONAL,
-    ...
+    ...,
+    [[  scptm-FreqOffset-r14                INTEGER (1..8)                  OPTIONAL    -- Need OP
+    ]]
 }
 
 
@@ -10463,7 +11866,13 @@ InterFreqCarrierFreqInfo-NB-r13 ::= SEQUENCE {
     interFreqNeighCellList-r13          InterFreqNeighCellList-NB-r13   OPTIONAL,       -- Need OR
     interFreqBlackCellList-r13          InterFreqBlackCellList-NB-r13   OPTIONAL,       -- Need OR
     multiBandInfoList-r13               MultiBandInfoList-NB-r13        OPTIONAL,       -- Need OR
-    ...
+    ...,
+    [[  delta-RxLevMin-v1350                    INTEGER (-8..-1)        OPTIONAL    -- Cond Qrxlevmin
+    ]],
+    [[  powerClass14dBm-Offset-r14      ENUMERATED {dB-6, dB-3, dB3, dB6, dB9, dB12}
+OPTIONAL,   --  Need OP
+        ce-AuthorisationOffset-r14      ENUMERATED {dB5, dB10, dB15, dB20, dB25, dB30, dB35}    OPTIONAL    -- Need OP
+    ]]
 }
 
 InterFreqNeighCellList-NB-r13 ::=       SEQUENCE (SIZE (1..maxCellInter)) OF PhysCellId
@@ -10489,14 +11898,176 @@ AB-ConfigPLMN-NB-r13 ::=    SEQUENCE {
 AB-Config-NB-r13 ::=        SEQUENCE {
     ab-Category-r13                 ENUMERATED {a, b, c},
     ab-BarringBitmap-r13            BIT STRING (SIZE(10)),
-    ab-BarringExceptionData-r13     ENUMERATED {true}           OPTIONAL,   -- Need OP
+    ab-BarringForExceptionData-r13  ENUMERATED {true}           OPTIONAL,   -- Need OP
     ab-BarringForSpecialAC-r13      BIT STRING (SIZE(5))
 }
 
 
+SystemInformationBlockType15-NB-r14 ::= SEQUENCE {
+    mbms-SAI-IntraFreq-r14                  MBMS-SAI-List-r11               OPTIONAL,   -- Need OR
+    mbms-SAI-InterFreqList-r14              MBMS-SAI-InterFreqList-NB-r14   OPTIONAL,   -- Need OR
+    lateNonCriticalExtension                OCTET STRING                    OPTIONAL,
+    ...
+}
+
+MBMS-SAI-InterFreqList-NB-r14 ::=       SEQUENCE (SIZE (1..maxFreq)) OF MBMS-SAI-InterFreq-NB-r14
+
+MBMS-SAI-InterFreq-NB-r14 ::=           SEQUENCE {
+    dl-CarrierFreq-r14                      CarrierFreq-NB-r13,
+    mbms-SAI-List-r14                       MBMS-SAI-List-r11,
+    multiBandInfoList-r14                   AdditionalBandInfoList-NB-r14   OPTIONAL    -- Need OR
+}
+
+
 SystemInformationBlockType16-NB-r13 ::= SystemInformationBlockType16-r11
 
 
+SystemInformationBlockType20-NB-r14 ::= SEQUENCE {
+    npdcch-SC-MCCH-Config-r14               NPDCCH-SC-MCCH-Config-NB-r14,
+    sc-mcch-CarrierConfig-r14               CHOICE {
+        dl-CarrierConfig-r14                        DL-CarrierConfigCommon-NB-r14,
+        dl-CarrierIndex-r14                     INTEGER (0.. maxNonAnchorCarriers-NB-r14)
+    },
+    sc-mcch-RepetitionPeriod-r14                ENUMERATED {rf32, rf128, rf512, rf1024, 
+                                                        rf2048, rf4096, rf8192, rf16384},
+    sc-mcch-Offset-r14                      INTEGER (0..10),
+    sc-mcch-ModificationPeriod-r14          ENUMERATED { rf32, rf128, rf256, rf512, rf1024, 
+                                                    rf2048, rf4096, rf8192, rf16384, rf32768, 
+                                                    rf65536, rf131072, rf262144, rf524288, 
+                                                    rf1048576, spare1},
+    sc-mcch-SchedulingInfo-r14              SC-MCCH-SchedulingInfo-NB-r14       OPTIONAL,   -- Need OP
+    lateNonCriticalExtension                    OCTET STRING                        OPTIONAL,
+    ...
+}
+
+NPDCCH-SC-MCCH-Config-NB-r14 ::=    SEQUENCE {
+    npdcch-NumRepetitions-SC-MCCH-r14       ENUMERATED {r1, r2, r4, r8, r16, 
+                                                        r32, r64, r128, r256, 
+                                                        r512, r1024, r2048},
+    npdcch-StartSF-SC-MCCH-r14              ENUMERATED {v1dot5, v2, v4, v8,
+                                                        v16, v32, v48, v64},
+    npdcch-Offset-SC-MCCH-r14               ENUMERATED {zero, oneEighth, oneQuarter,
+                                                        threeEighth, oneHalf, fiveEighth,
+                                                        threeQuarter, sevenEighth}
+}
+
+SC-MCCH-SchedulingInfo-NB-r14::=    SEQUENCE    {
+    onDurationTimerSCPTM-r14                    ENUMERATED {
+                                                    pp1, pp2, pp3, pp4,
+                                                    pp8, pp16, pp32, spare},
+    drx-InactivityTimerSCPTM-r14                ENUMERATED {
+                                                    pp0, pp1, pp2, pp3,
+                                                    pp4, pp8, pp16, pp32},
+    schedulingPeriodStartOffsetSCPTM-r14        CHOICE {
+        sf10                                        INTEGER(0..9),
+        sf20                                        INTEGER(0..19),
+        sf32                                        INTEGER(0..31),
+        sf40                                        INTEGER(0..39),
+        sf64                                        INTEGER(0..63),
+        sf80                                        INTEGER(0..79),
+        sf128                                   INTEGER(0..127),
+        sf160                                   INTEGER(0..159),
+        sf256                                   INTEGER(0..255),
+        sf320                                   INTEGER(0..319),
+        sf512                                   INTEGER(0..511),
+        sf640                                   INTEGER(0..639),
+        sf1024                                  INTEGER(0..1023),
+        sf2048                                  INTEGER(0..2047),
+        sf4096                                  INTEGER(0..4095),
+        sf8192                                  INTEGER(0..8191)
+    },
+    ...
+}
+
+
+SystemInformationBlockType22-NB-r14 ::= SEQUENCE {
+    dl-ConfigList-r14                   DL-ConfigCommonList-NB-r14   OPTIONAL,  -- Need OR
+    ul-ConfigList-r14                   UL-ConfigCommonList-NB-r14   OPTIONAL,  -- Need OR
+    pagingWeightAnchor-r14              PagingWeight-NB-r14         OPTIONAL,   -- Cond pcch-config
+    nprach-ProbabilityAnchorList-r14        NPRACH-ProbabilityAnchorList-NB-r14 OPTIONAL,   -- Cond nprach-config
+    lateNonCriticalExtension            OCTET STRING                    OPTIONAL,
+    ...
+}
+
+DL-ConfigCommonList-NB-r14 ::=      SEQUENCE (SIZE (1.. maxNonAnchorCarriers-NB-r14)) OF 
+                                            DL-ConfigCommon-NB-r14 
+
+UL-ConfigCommonList-NB-r14 ::=      SEQUENCE (SIZE (1.. maxNonAnchorCarriers-NB-r14)) OF
+                                            UL-ConfigCommon-NB-r14
+
+
+DL-ConfigCommon-NB-r14 ::=          SEQUENCE {
+    dl-CarrierConfig-r14                    DL-CarrierConfigCommon-NB-r14,
+    pcch-Config-r14                     PCCH-Config-NB-r14          OPTIONAL, -- Need OR
+    ...
+}
+
+PCCH-Config-NB-r14 ::=              SEQUENCE {
+    npdcch-NumRepetitionPaging-r14      ENUMERATED {
+                                            r1, r2, r4, r8, r16, r32, r64, r128, 
+                                            r256, r512, r1024, r2048, 
+                                            spare4, spare3, spare2, spare1} OPTIONAL, -- Need OP
+    pagingWeight-r14                        PagingWeight-NB-r14     DEFAULT w1,
+    ...
+}
+
+PagingWeight-NB-r14 ::=             ENUMERATED {w1, w2, w3, w4, w5, w6, w7, w8,
+                                                w9, w10, w11, w12, w13, w14, w15, w16}
+
+UL-ConfigCommon-NB-r14 ::=          SEQUENCE {
+    ul-CarrierFreq-r14                  CarrierFreq-NB-r13,
+    nprach-ParametersList-r14           NPRACH-ParametersList-NB-r14    OPTIONAL, -- Need OR
+    ...
+}
+
+NPRACH-ParametersList-NB-r14 ::=        SEQUENCE (SIZE (1.. maxNPRACH-Resources-NB-r13)) OF 
+                                            NPRACH-Parameters-NB-r14
+
+
+NPRACH-Parameters-NB-r14 ::=            SEQUENCE {
+    nprach-Parameters-r14               SEQUENCE {
+        nprach-Periodicity-r14                  ENUMERATED {ms40, ms80, ms160, ms240, 
+                                                            ms320, ms640, ms1280, ms2560} 
+                                                    OPTIONAL,   -- NEED OP 
+        nprach-StartTime-r14                        ENUMERATED {ms8, ms16, ms32, ms64, 
+                                                            ms128, ms256, ms512, ms1024}
+                                                    OPTIONAL,   -- NEED OP
+        nprach-SubcarrierOffset-r14             ENUMERATED {n0, n12, n24, n36, n2, n18, n34, spare1} 
+                                                    OPTIONAL,   -- NEED OP
+        nprach-NumSubcarriers-r14               ENUMERATED {n12, n24, n36, n48} 
+                                                     OPTIONAL,  -- NEED OP
+        nprach-SubcarrierMSG3-RangeStart-r14        ENUMERATED {zero, oneThird, twoThird, one}
+                                                    OPTIONAL,   -- NEED OP
+        npdcch-NumRepetitions-RA-r14                ENUMERATED {r1, r2, r4, r8, r16, r32, r64, r128,
+                                                            r256, r512, r1024, r2048, 
+                                                            spare4, spare3, spare2, spare1} 
+                                                    OPTIONAL,   -- NEED OP
+        npdcch-StartSF-CSS-RA-r14               ENUMERATED {v1dot5, v2, v4, v8, v16, v32, v48, v64} 
+                                                        OPTIONAL,   -- NEED OP
+        npdcch-Offset-RA-r14                        ENUMERATED {zero, oneEighth, oneFourth, threeEighth}
+                                                    OPTIONAL,   -- NEED OP
+        nprach-NumCBRA-StartSubcarriers-r14     ENUMERATED {n8, n10, n11, n12, n20, n22, n23, n24,
+                                                            n32, n34, n35, n36, n40, n44, n46, n48}
+                                                    OPTIONAL,   -- NEED OP  
+        npdcch-CarrierIndex-r14                 INTEGER (1..maxNonAnchorCarriers-NB-r14) 
+                                                    OPTIONAL,   -- Need OP 
+        ...
+    }   OPTIONAL    -- Need OR
+}
+
+NPRACH-ProbabilityAnchorList-NB-r14 ::= SEQUENCE (SIZE (1.. maxNPRACH-Resources-NB-r13)) OF
+                                                NPRACH-ProbabilityAnchor-NB-r14
+
+NPRACH-ProbabilityAnchor-NB-r14 ::=     SEQUENCE {
+    nprach-ProbabilityAnchor-r14                ENUMERATED {
+                                                zero, oneSixteenth, oneFifteenth, oneFourteenth, 
+                                                oneThirteenth, oneTwelfth, oneEleventh, oneTenth,
+                                                oneNinth, oneEightth, oneSeventh, oneSixth,
+                                                oneFifth, oneFourth, oneThird, oneHalf} 
+                                                        OPTIONAL    -- Need OP 
+}
+
+
 CarrierConfigDedicated-NB-r13 ::=       SEQUENCE {
     dl-CarrierConfig-r13        DL-CarrierConfigDedicated-NB-r13,
     ul-CarrierConfig-r13        UL-CarrierConfigDedicated-NB-r13
@@ -10555,6 +12126,35 @@ DL-Bitmap-NB-r13 ::=            CHOICE {
 }
 
 
+DL-CarrierConfigCommon-NB-r14 ::=   SEQUENCE {
+    dl-CarrierFreq-r14                  CarrierFreq-NB-r13,
+    downlinkBitmapNonAnchor-r14         CHOICE {
+        useNoBitmap-r14                     NULL,
+        useAnchorBitmap-r14                 NULL,
+        explicitBitmapConfiguration-r14     DL-Bitmap-NB-r13
+    },
+    dl-GapNonAnchor-r14                 CHOICE {
+        useNoGap-r14                        NULL,
+        useAnchorGapConfig-r14              NULL,
+        explicitGapConfiguration-r14        DL-GapConfig-NB-r13
+    },  
+    inbandCarrierInfo-r14               SEQUENCE {
+        samePCI-Indicator-r14               CHOICE  {
+            samePCI-r14                         SEQUENCE {
+                indexToMidPRB-r14                   INTEGER (-55..54) 
+            },
+            differentPCI-r14                    SEQUENCE {
+                eutra-NumCRS-Ports-r14              ENUMERATED {same, four}
+            }
+        }   OPTIONAL,       -- Cond anchor-guardband
+        eutraControlRegionSize-r14      ENUMERATED {n1, n2, n3} 
+    }   OPTIONAL,       -- Cond non-anchor-inband
+    nrs-PowerOffsetNonAnchor-r14        ENUMERATED {dB-12, dB-10, dB-8, dB-6, 
+                                                    dB-4, dB-2, dB0, dB3}   DEFAULT dB0, 
+    ...
+}
+
+
 
 DL-GapConfig-NB-r13 ::=     SEQUENCE {
     dl-GapThreshold-r13         ENUMERATED {n32, n64, n128, n256},
@@ -10585,7 +12185,19 @@ MAC-MainConfig-NB-r13 ::=       SEQUENCE {
                                                     pp1024, pp2048, spare}
         }
     }                                                                   OPTIONAL,   -- Need ON 
-    ...
+    ...,
+    [[  rai-Activation-r14                  ENUMERATED {true}           OPTIONAL,   -- Need OR
+    dataInactivityTimerConfig-r14   CHOICE {
+            release                             NULL,
+            setup                               SEQUENCE {
+                dataInactivityTimer-r14             DataInactivityTimer-r14
+            }
+        }                                                               OPTIONAL    -- Need ON
+    ]],
+    [[  drx-Cycle-v1430         ENUMERATED {
+                                    sf1280, sf2560, sf5120, sf10240}    OPTIONAL    -- Need ON
+    ]]
+
 }
 
 PeriodicBSR-Timer-NB-r13 ::=        ENUMERATED {
@@ -10735,11 +12347,12 @@ PhysicalConfigDedicated-NB-r13 ::=  SEQUENCE {
     npdcch-ConfigDedicated-r13          NPDCCH-ConfigDedicated-NB-r13       OPTIONAL,   -- Need ON
     npusch-ConfigDedicated-r13          NPUSCH-ConfigDedicated-NB-r13       OPTIONAL,   -- Need ON
     uplinkPowerControlDedicated-r13     UplinkPowerControlDedicated-NB-r13  OPTIONAL,   -- Need ON
-    ...
+    ...,
+    [[  twoHARQ-ProcessesConfig-r14     ENUMERATED {true}   OPTIONAL    -- Need OR
+    ]]
 }
 
 
-
 RACH-ConfigCommon-NB-r13 ::=        SEQUENCE {
     preambleTransMax-CE-r13             PreambleTransMax,
     powerRampingParameters-r13          PowerRampingParameters,
@@ -10815,7 +12428,9 @@ SRB-ToAddMod-NB-r13 ::=             SEQUENCE {
         explicitValue                       LogicalChannelConfig-NB-r13,
         defaultValue                        NULL
     }       OPTIONAL,                                                           -- Cond Setup
-    ...
+    ...,
+    [[  rlc-Config-v1430                RLC-Config-NB-v1430         OPTIONAL    -- Need ON
+    ]]
 }
 
 DRB-ToAddModList-NB-r13 ::=         SEQUENCE (SIZE (1..maxDRB-NB-r13)) OF DRB-ToAddMod-NB-r13
@@ -10827,7 +12442,9 @@ DRB-ToAddMod-NB-r13 ::=             SEQUENCE {
     rlc-Config-r13                      RLC-Config-NB-r13           OPTIONAL,   -- Cond Setup
     logicalChannelIdentity-r13          INTEGER (3..10)             OPTIONAL,   -- Cond DRB-Setup
     logicalChannelConfig-r13            LogicalChannelConfig-NB-r13 OPTIONAL,   -- Cond Setup
-    ...
+    ...,
+    [[  rlc-Config-v1430                RLC-Config-NB-v1430         OPTIONAL    -- Need ON
+    ]]
 }
 
 DRB-ToReleaseList-NB-r13 ::=        SEQUENCE (SIZE (1..maxDRB-NB-r13)) OF DRB-Identity
@@ -10841,6 +12458,9 @@ RLC-Config-NB-r13 ::=   CHOICE  {
     ...
 }
 
+RLC-Config-NB-v1430 ::= SEQUENCE {
+    t-Reordering-r14            T-Reordering        OPTIONAL        -- Cond twoHARQ
+}
 
 UL-AM-RLC-NB-r13 ::=        SEQUENCE {
     t-PollRetransmit-r13        T-PollRetransmit-NB-r13,
@@ -10874,7 +12494,11 @@ RLF-TimersAndConstants-NB-r13 ::=   CHOICE {
                                                 ms20000, ms30000},
         n311-r13                            ENUMERATED {
                                                 n1, n2, n3, n4, n5, n6, n8, n10},
-        ...
+        ...,
+        [[ t311-v1350                       ENUMERATED {
+                                                ms40000, ms60000, ms90000, ms120000}
+                                                        OPTIONAL    -- Need OR
+        ]]
     }
 }
 
@@ -10891,6 +12515,9 @@ UplinkPowerControlDedicated-NB-r13 ::=  SEQUENCE {
 }
 
 
+AdditionalBandInfoList-NB-r14 ::=   SEQUENCE (SIZE (1..maxMultiBands)) OF FreqBandIndicator-NB-r13
+
+
 FreqBandIndicator-NB-r13 ::=            INTEGER (1.. maxFBI2)
 
 
@@ -10910,6 +12537,9 @@ NS-PmaxValue-NB-r13 ::=         SEQUENCE {
 }
 
 
+ReselectionThreshold-NB-v1360 ::=           INTEGER (32..63)
+
+
 T-Reselection-NB-r13 ::=        ENUMERATED {s0, s3, s6, s9, s12, s15, s18, s21} 
 
 
@@ -10925,10 +12555,17 @@ UE-Capability-NB-r13 ::=        SEQUENCE {
     pdcp-Parameters-r13             PDCP-Parameters-NB-r13              OPTIONAL,
     phyLayerParameters-r13          PhyLayerParameters-NB-r13,
     rf-Parameters-r13               RF-Parameters-NB-r13,
-    nonCriticalExtension            SEQUENCE {}                         OPTIONAL
+    nonCriticalExtension            UE-Capability-NB-v1430-IEs          OPTIONAL
 }
 
-AccessStratumRelease-NB-r13 ::=     ENUMERATED {rel13, spare7, spare6, spare5, spare4, spare3, spare2, spare1, ...}
+UE-Capability-NB-v1430-IEs ::=      SEQUENCE {
+    ue-Category-NB-r14                  ENUMERATED {nb2}                OPTIONAL,
+    mac-Parameters-r14                  MAC-Parameters-NB-r14           OPTIONAL,   phyLayerParameters-v1430            PhyLayerParameters-NB-v1430 OPTIONAL,
+    rf-Parameters-v1430                 RF-Parameters-NB-v1430,
+    nonCriticalExtension                SEQUENCE {}                     OPTIONAL
+}
+
+AccessStratumRelease-NB-r13 ::=     ENUMERATED {rel13, rel14, spare6, spare5, spare4, spare3, spare2, spare1, ...}
 
 PDCP-Parameters-NB-r13      ::= SEQUENCE {
     supportedROHC-Profiles-r13          SEQUENCE {
@@ -10944,16 +12581,30 @@ PDCP-Parameters-NB-r13      ::= SEQUENCE {
     ...
 }
 
+MAC-Parameters-NB-r14       ::=     SEQUENCE {
+    dataInactMon-r14                    ENUMERATED {supported}                  OPTIONAL,
+    rai-Support-r14                     ENUMERATED {supported}              OPTIONAL
+}
+
 PhyLayerParameters-NB-r13   ::=     SEQUENCE {
     multiTone-r13                       ENUMERATED {supported}          OPTIONAL,
     multiCarrier-r13                        ENUMERATED {supported}          OPTIONAL
     }
 
+PhyLayerParameters-NB-v1430 ::=     SEQUENCE {
+    multiCarrier-NPRACH-r14             ENUMERATED {supported}          OPTIONAL,
+    twoHARQ-Processes-r14               ENUMERATED {supported}          OPTIONAL
+}
+
 RF-Parameters-NB-r13    ::=         SEQUENCE {
     supportedBandList-r13               SupportedBandList-NB-r13,
     multiNS-Pmax-r13                    ENUMERATED {supported}      OPTIONAL
 }
 
+RF-Parameters-NB-v1430 ::=          SEQUENCE {
+    powerClassNB-14dBm-r14              ENUMERATED {supported}      OPTIONAL
+}
+
 SupportedBandList-NB-r13 ::=        SEQUENCE (SIZE (1..maxBands)) OF SupportedBand-NB-r13
 
 SupportedBand-NB-r13    ::=         SEQUENCE {
@@ -10962,10 +12613,11 @@ SupportedBand-NB-r13    ::=         SEQUENCE {
 }
 
 
-
 UE-RadioPagingInfo-NB-r13 ::=       SEQUENCE {
     ue-Category-NB-r13              ENUMERATED {nb1}            OPTIONAL,
-    ...
+    ...,
+    [[ multiCarrierPaging-r14       ENUMERATED {true}           OPTIONAL
+    ]]
 }
 
 
@@ -10985,13 +12637,81 @@ UE-TimersAndConstants-NB-r13 ::=    SEQUENCE {
                                             ms20000, ms30000},
     n311-r13                            ENUMERATED {
                                             n1, n2, n3, n4, n5, n6, n8, n10},
+    ...,
+    [[ t311-v1350                       ENUMERATED {
+                                            ms40000, ms60000, ms90000, ms120000}
+                                                        OPTIONAL    -- Need OR
+    ]]
+}
+
+
+SC-MTCH-InfoList-NB-r14 ::=         SEQUENCE (SIZE (0.. maxSC-MTCH-NB-r14)) OF SC-MTCH-Info-NB-r14
+
+SC-MTCH-Info-NB-r14 ::=                 SEQUENCE    {
+    sc-mtch-CarrierConfig-r14           CHOICE {
+        dl-CarrierConfig-r14                    DL-CarrierConfigCommon-NB-r14,
+        dl-CarrierIndex-r14                 INTEGER (0.. maxNonAnchorCarriers-NB-r14)
+    },
+    mbmsSessionInfo-r14                 MBMSSessionInfo-r13,
+    g-RNTI-r14                          BIT STRING(SIZE(16)),
+    sc-mtch-SchedulingInfo-r14          SC-MTCH-SchedulingInfo-NB-r14       OPTIONAL,   -- Need OP
+    sc-mtch-NeighbourCell-r14           BIT STRING (SIZE(maxNeighCell-SCPTM-NB-r14))    OPTIONAL,   -- Need OP
+    npdcch-NPDSCH-MaxTBS-SC-MTCH-r14        ENUMERATED {n680, n2536},
+    npdcch-NumRepetitions-SC-MTCH-r14   ENUMERATED {r1, r2, r4, r8, r16, 
+                                                    r32, r64, r128, r256, 
+                                                    r512, r1024, r2048, spare4, 
+                                                    spare3, spare2, spare1},
+    npdcch-StartSF-SC-MTCH-r14          ENUMERATED {v1dot5, v2, v4, v8,
+                                                    v16, v32, v48, v64},
+    npdcch-Offset-SC-MTCH-r14           ENUMERATED {zero, oneEight, oneQuarter,
+                                                    threeEight, oneHalf, fiveEight,
+                                                    threeQuarter, sevenEight},
+    ...
+}
+
+SC-MTCH-SchedulingInfo-NB-r14 ::=       SEQUENCE    {
+    onDurationTimerSCPTM-r14                ENUMERATED {
+                                                pp1, pp2, pp3, pp4,
+                                                pp8, pp16, pp32, spare},
+    drx-InactivityTimerSCPTM-r14            ENUMERATED {
+                                                pp0, pp1, pp2, pp3,
+                                                pp4, pp8, pp16, pp32},
+    schedulingPeriodStartOffsetSCPTM-r14    CHOICE {
+        sf10                                        INTEGER(0..9),
+        sf20                                        INTEGER(0..19),
+        sf32                                        INTEGER(0..31),
+        sf40                                        INTEGER(0..39),
+        sf64                                        INTEGER(0..63),
+        sf80                                        INTEGER(0..79),
+        sf128                                   INTEGER(0..127),
+        sf160                                   INTEGER(0..159),
+        sf256                                   INTEGER(0..255),
+        sf320                                   INTEGER(0..319),
+        sf512                                   INTEGER(0..511),
+        sf640                                   INTEGER(0..639),
+        sf1024                                  INTEGER(0..1023),
+        sf2048                                  INTEGER(0..2047),
+        sf4096                                  INTEGER(0..4095),
+        sf8192                                  INTEGER(0..8191)
+    },
     ...
 }
 
 
+SCPTM-NeighbourCellList-NB-r14 ::=      SEQUENCE (SIZE (1..maxNeighCell-SCPTM-NB-r14)) OF PCI-ARFCN-NB-r14
+
+PCI-ARFCN-NB-r14 ::=                    SEQUENCE {
+        physCellId-r14                      PhysCellId,
+        carrierFreq-r14                     CarrierFreq-NB-r13      OPTIONAL    -- Need OP
+}
+
+
 maxNPRACH-Resources-NB-r13  INTEGER ::= 3   -- Maximum number of NPRACH resources for NB-IoT
+maxNonAnchorCarriers-NB-r14 INTEGER ::= 15  -- Maximum number of non-anchor carriers for NB-IoT
 maxDRB-NB-r13               INTEGER ::= 2   -- Maximum number of Data Radio Bearers for NB-IoT
+maxNeighCell-SCPTM-NB-r14   INTEGER ::= 8   -- Maximum number of SCPTM neighbour cells
 maxNS-Pmax-NB-r13           INTEGER ::= 4   -- Maximum number of NS and P-Max values per band
+maxSC-MTCH-NB-r14           INTEGER ::= 64  -- Maximum number of SC-MTCHs in one cell for NB-IoT
 maxSI-Message-NB-r13        INTEGER ::= 8   -- Maximum number of SI messages for NB-IoT
 
 
@@ -11039,6 +12759,7 @@ IMPORTS
     RLF-Report-r9,
     TargetMBSFN-AreaList-r12,
     TraceReference-r10,
+    Tx-ResourcePoolMeasList-r14,
     VisitedCellInfoList-r12,
     maxCellMeas,
     maxCSI-RS-Meas-r12,
@@ -11048,8 +12769,9 @@ IMPORTS
     WLAN-CarrierInfo-r13,
     WLAN-Identifiers-r12,
     WLAN-Id-List-r13,
-    WLAN-Status-r13
-
+    WLAN-Status-r13,
+    WLAN-Status-v1430,
+    WLAN-SuspendConfig-r14
 
 FROM EUTRA-RRC-Definitions;
 
@@ -11139,6 +12861,7 @@ VarMeasReport ::=                   SEQUENCE {
     measId-v1250                        MeasId-v1250                    OPTIONAL,
     cellsTriggeredList                  CellsTriggeredList              OPTIONAL,
     csi-RS-TriggeredList-r12            CSI-RS-TriggeredList-r12        OPTIONAL,
+    poolsTriggeredList-r14              Tx-ResourcePoolMeasList-r14 OPTIONAL,
     numberOfReportsSent                 INTEGER
 }
 
@@ -11178,6 +12901,7 @@ VarShortMAC-Input ::=                   SEQUENCE {
     c-RNTI                                  C-RNTI
 }
 
+
 VarShortResumeMAC-Input-r13 ::=     SEQUENCE {
     cellIdentity-r13                        CellIdentity,
     physCellId-r13                          PhysCellId,
@@ -11188,12 +12912,14 @@ VarShortResumeMAC-Input-r13 ::=     SEQUENCE {
 
 VarWLAN-MobilityConfig ::=                  SEQUENCE {
     wlan-MobilitySet-r13                    WLAN-Id-List-r13            OPTIONAL,
-    successReportRequested                  ENUMERATED {true}           OPTIONAL
+    successReportRequested                  ENUMERATED {true}           OPTIONAL,
+    wlan-SuspendConfig-r14                  WLAN-SuspendConfig-r14      OPTIONAL
 }
 
 
 VarWLAN-Status-r13 ::=              SEQUENCE {
-    status-r13                              WLAN-Status-r13
+    status-r13                              WLAN-Status-r13,
+    status-r14                              WLAN-Status-v1430   OPTIONAL
 }
 
 
@@ -11219,7 +12945,6 @@ VarShortMAC-Input-NB-r13        ::=     VarShortMAC-Input
 VarShortResumeMAC-Input-NB-r13  ::=     VarShortResumeMAC-Input-r13
 
 
-
 END
 
 
@@ -11231,22 +12956,32 @@ IMPORTS
     AdditionalSpectrumEmission,
     ARFCN-ValueEUTRA-r9,
     FilterCoefficient,
+    maxCBR-Level-r14,
+    maxCBR-Level-1-r14,
     maxFreq,
+    maxFreqV2X-r14,
     maxSL-TxPool-r12,
     maxSL-CommRxPoolPreconf-v1310,
     maxSL-CommTxPoolPreconf-v1310,
     maxSL-DiscRxPoolPreconf-r13,
     maxSL-DiscTxPoolPreconf-r13,
+    maxSL-V2X-CBRConfig2-r14,
+    maxSL-V2X-CBRConfig2-1-r14,
     maxSL-V2X-RxPoolPreconf-r14,
+    maxSL-V2X-TxConfig2-r14,
+    maxSL-V2X-TxConfig2-1-r14,
     maxSL-V2X-TxPoolPreconf-r14,
     P-Max,
     ReselectionInfoRelay-r13,
+    SL-AnchorCarrierFreqList-V2X-r14,
+    SL-CBR-Levels-Config-r14,
+    SL-CBR-PSSCH-TxConfig-r14,
     SL-CommTxPoolSensingConfig-r14,
     SL-CP-Len-r12,
     SL-HoppingConfigComm-r12,
     SL-OffsetIndicator-r12,
     SL-OffsetIndicatorSync-r12,
-    SL-OffsetIndicatorSync-v14xy,
+    SL-OffsetIndicatorSync-v1430,
     SL-PeriodComm-r12,
     RSRP-RangeSL3-r12,
     SL-PriorityList-r13,
@@ -11256,7 +12991,12 @@ IMPORTS
     SL-ZoneConfig-r14,
     P0-SL-r12,
     TDD-ConfigSL-r12,
-    SubframeBitmapSL-r14
+    SubframeBitmapSL-r14,
+    SL-P2X-ResourceSelectionConfig-r14,
+    SL-RestrictResourceReservationPeriodList-r14,
+    SL-SyncAllowed-r14,
+    SL-OffsetIndicatorSync-r14,
+    SL-Priority-r13
 FROM EUTRA-RRC-Definitions;
 
 
@@ -11310,9 +13050,6 @@ SL-PreconfigSync-r12 ::=    SEQUENCE {
     syncRefDiffHyst-r12                 ENUMERATED {dB0, dB3, dB6, dB9, dB12, dBinf},
     ...,
     [[  syncTxPeriodic-r13                  ENUMERATED {true}           OPTIONAL
-    ]],
-    [[  syncOffsetIndicator1-v14xy      SL-OffsetIndicatorSync-v14xy    OPTIONAL,
-        syncOffsetIndicator2-v14xy      SL-OffsetIndicatorSync-v14xy    OPTIONAL
     ]]
 }
 
@@ -11362,15 +13099,31 @@ SL-PreconfigRelay-r13 ::=   SEQUENCE {
 }
 
 
-SL-V2X-Preconfiguration-r14 ::= SEQUENCE (SIZE (1..maxFreq)) OF SL-V2X-PreconfigFreqInfo-r14
+SL-V2X-Preconfiguration-r14 ::= SEQUENCE {
+    v2x-PreconfigFreqList-r14       SL-V2X-PreconfigFreqList-r14,
+    anchorCarrierFreqList-r14       SL-AnchorCarrierFreqList-V2X-r14                OPTIONAL,
+    cbr-PreconfigList-r14           SL-CBR-PreconfigTxConfigList-r14                OPTIONAL,
+    ...
+}
+
+SL-CBR-PreconfigTxConfigList-r14 ::=    SEQUENCE {
+    cbr-RangeCommonConfigList-r14   SEQUENCE (SIZE (1..maxSL-V2X-CBRConfig2-r14)) OF SL-CBR-Levels-Config-r14,
+    sl-CBR-PSSCH-TxConfigList-r14   SEQUENCE (SIZE (1..maxSL-V2X-TxConfig2-r14)) OF SL-CBR-PSSCH-TxConfig-r14
+}
+
+SL-V2X-PreconfigFreqList-r14 ::=    SEQUENCE (SIZE (1..maxFreqV2X-r14)) OF SL-V2X-PreconfigFreqInfo-r14
 
 SL-V2X-PreconfigFreqInfo-r14 ::=        SEQUENCE {
     v2x-CommPreconfigGeneral-r14        SL-PreconfigGeneral-r12,
-    v2x-CommPreconfigSync-r14           SL-PreconfigSync-r12,
+    v2x-CommPreconfigSync-r14           SL-PreconfigV2X-Sync-r14                OPTIONAL,
     v2x-CommRxPoolList-r14              SL-PreconfigV2X-RxPoolList-r14,
     v2x-CommTxPoolList-r14              SL-PreconfigV2X-TxPoolList-r14,
+    p2x-CommTxPoolList-r14              SL-PreconfigV2X-TxPoolList-r14,
     v2x-ResourceSelectionConfig-r14         SL-CommTxPoolSensingConfig-r14          OPTIONAL,
-    zoneConfig-r14                      SL-ZoneConfig-r14                       OPTIONAL,
+    zoneConfig-r14                      SL-ZoneConfig-r14                       OPTIONAL, 
+    syncPriority-r14                    ENUMERATED {gnss, enb},
+    thresSL-TxPrioritization-r14        SL-Priority-r13                         OPTIONAL,
+    offsetDFN-r14                       INTEGER (0..1000)                   OPTIONAL,
     ...
 }
 
@@ -11379,7 +13132,7 @@ SL-PreconfigV2X-RxPoolList-r14 ::=  SEQUENCE (SIZE (1..maxSL-V2X-RxPoolPreconf-r
 SL-PreconfigV2X-TxPoolList-r14 ::=  SEQUENCE (SIZE (1..maxSL-V2X-TxPoolPreconf-r14)) OF SL-V2X-PreconfigCommPool-r14
 
 SL-V2X-PreconfigCommPool-r14 ::=        SEQUENCE {
--- This IE is same as SL-V2X-CommResourcePool with rxParametersNCell absent
+-- This IE is same as SL-CommResourcePoolV2X with rxParametersNCell absent
     sl-OffsetIndicator-r14              SL-OffsetIndicator-r12      OPTIONAL,
     sl-Subframe-r14                     SubframeBitmapSL-r14,
     adjacencyPSCCH-PSSCH-r14            BOOLEAN,
@@ -11388,14 +13141,46 @@ SL-V2X-PreconfigCommPool-r14 ::=        SEQUENCE {
                                         n48, n50, n72, n75, n96, n100, spare13, spare12, spare11,
                                         spare10, spare9, spare8, spare7, spare6, spare5, spare4, 
                                         spare3, spare2, spare1},
-    numSubchannel-r14                   ENUMERATED {n1, n3, n5, n10, n15, n20, spare2, spare1},
+    numSubchannel-r14                   ENUMERATED {n1, n3, n5, n8, n10, n15, n20, spare1},
     startRB-Subchannel-r14              INTEGER (0..99),
     startRB-PSCCH-Pool-r14              INTEGER (0..99)             OPTIONAL,
-    dataTxParameters-r14                SL-TxParameters-r12         OPTIONAL,
+    dataTxParameters-r14                P0-SL-r12,
     zoneID-r14                          INTEGER (0..7)              OPTIONAL,
+    threshS-RSSI-CBR-r14                    INTEGER (0..45)             OPTIONAL,
+    cbr-pssch-TxConfigList-r14          SL-CBR-PPPP-TxPreconfigList-r14 OPTIONAL,
+    resourceSelectionConfigP2X-r14      SL-P2X-ResourceSelectionConfig-r14  OPTIONAL,
+    syncAllowed-r14                     SL-SyncAllowed-r14              OPTIONAL,
+    restrictResourceReservationPeriod-r14   SL-RestrictResourceReservationPeriodList-r14    OPTIONAL,   -- Need OR
+    ...
+}
+
+SL-PreconfigV2X-Sync-r14 ::=    SEQUENCE {
+    syncOffsetIndicators-r14            SL-V2X-SyncOffsetIndicators-r14,
+    syncTxParameters-r14                P0-SL-r12,
+    syncTxThreshOoC-r14                 RSRP-RangeSL3-r12,
+    filterCoefficient-r14               FilterCoefficient,
+    syncRefMinHyst-r14                  ENUMERATED {dB0, dB3, dB6, dB9, dB12},
+    syncRefDiffHyst-r14                 ENUMERATED {dB0, dB3, dB6, dB9, dB12, dBinf},
     ...
 }
 
+SL-V2X-SyncOffsetIndicators-r14 ::= SEQUENCE {
+    syncOffsetIndicator1-r14            SL-OffsetIndicatorSync-r14,
+    syncOffsetIndicator2-r14            SL-OffsetIndicatorSync-r14,
+    syncOffsetIndicator3-r14            SL-OffsetIndicatorSync-r14          OPTIONAL
+}
+
+SL-CBR-PPPP-TxPreconfigList-r14 ::= SEQUENCE (SIZE (1..8)) OF SL-PPPP-TxPreconfigIndex-r14
+
+SL-PPPP-TxPreconfigIndex-r14 ::=    SEQUENCE {
+    priorityThreshold-r14           SL-Priority-r13,
+    defaultTxConfigIndex-r14        INTEGER(0..maxCBR-Level-1-r14),
+    cbr-ConfigIndex-r14             INTEGER(0..maxSL-V2X-CBRConfig2-1-r14),
+    tx-ConfigIndexList-r14          SEQUENCE (SIZE (1..maxCBR-Level-r14)) OF Tx-PreconfigIndex-r14
+}
+
+Tx-PreconfigIndex-r14 ::=           INTEGER(0..maxSL-V2X-TxConfig2-1-r14)
+
 END
 
 
@@ -11416,6 +13201,7 @@ IMPORTS
     DRB-ToReleaseList,
     FreqBandIndicator-r11,
     InDeviceCoexIndication-r11,
+    LWA-Config-r13,
     MasterInformationBlock,
     maxBands,
     maxFreq,
@@ -11427,7 +13213,9 @@ IMPORTS
     MBMSInterestIndication-r11,
     MeasConfig,
     MeasGapConfig,
+    MeasGapConfigPerCC-List-r14,
     MeasResultForRSSI-r13,
+    MeasResultListWLAN-r13,
     OtherConfig-r9,
     PhysCellId,
     P-Max,
@@ -11507,7 +13295,7 @@ HandoverPreparationInformation-r8-IEs ::= SEQUENCE {
 HandoverPreparationInformation-v920-IEs ::= SEQUENCE {
     ue-ConfigRelease-r9                 ENUMERATED {
                                         rel9, rel10, rel11, rel12, v10j0, v11e0,
-                                        v1280, rel13, ...}          OPTIONAL,   -- Cond HO2
+                                        v1280, rel13, ..., rel14}           OPTIONAL,   -- Cond HO2
     nonCriticalExtension                HandoverPreparationInformation-v9d0-IEs     OPTIONAL
 }
 
@@ -11549,11 +13337,12 @@ HandoverPreparationInformation-v1250-IEs ::= SEQUENCE {
 HandoverPreparationInformation-v1320-IEs ::= SEQUENCE {
     as-Config-v1320                     AS-Config-v1320                 OPTIONAL,   -- Cond HO2 
     as-Context-v1320                    AS-Context-v1320                OPTIONAL,   -- Cond HO2
-    nonCriticalExtension                HandoverPreparationInformation-v14x0-IEs                        OPTIONAL
+    nonCriticalExtension                HandoverPreparationInformation-v1430-IEs                        OPTIONAL
 }
 
-HandoverPreparationInformation-v14x0-IEs ::= SEQUENCE {
-    as-Config-v14x0                 AS-Config-v14x0                     OPTIONAL,   -- Cond HO2 
+HandoverPreparationInformation-v1430-IEs ::= SEQUENCE {
+    as-Config-v1430                 AS-Config-v1430                     OPTIONAL,   -- Cond HO2
+    makeBeforeBreakReq-r14          ENUMERATED {true}               OPTIONAL,   -- Cond HO2
     nonCriticalExtension            SEQUENCE {}                         OPTIONAL
 }
 
@@ -11617,6 +13406,12 @@ SCG-ConfigInfo-v1310-IEs ::=        SEQUENCE {
 
 SCG-ConfigInfo-v1330-IEs ::=        SEQUENCE {
     measResultListRSSI-SCG-r13      MeasResultListRSSI-SCG-r13          OPTIONAL,
+    nonCriticalExtension            SCG-ConfigInfo-v1430-IEs                            OPTIONAL
+}
+
+SCG-ConfigInfo-v1430-IEs ::=        SEQUENCE {
+    makeBeforeBreakSCG-Req-r14      ENUMERATED {true}                   OPTIONAL,
+    measGapConfigPerCC-List         MeasGapConfigPerCC-List-r14         OPTIONAL,
     nonCriticalExtension            SEQUENCE {}                         OPTIONAL
 }
 
@@ -11787,8 +13582,10 @@ AS-Config-v1320 ::=             SEQUENCE {
     sourceRCLWI-Configuration-r13       RCLWI-Configuration-r13             OPTIONAL
 }
 
-AS-Config-v14x0 ::=             SEQUENCE {
-    sourceSL-V2X-CommConfig-r14         SL-V2X-ConfigDedicated-r14                  OPTIONAL
+AS-Config-v1430 ::=             SEQUENCE {
+    sourceSL-V2X-CommConfig-r14         SL-V2X-ConfigDedicated-r14                  OPTIONAL,
+    sourceLWA-Config-r14                LWA-Config-r13                      OPTIONAL,
+    sourceWLAN-MeasResult-r14           MeasResultListWLAN-r13              OPTIONAL
 }
 
 
diff --git a/openair2/RRC/LITE/MESSAGES/rtai_mem.c b/openair2/RRC/LITE/MESSAGES/rtai_mem.c
deleted file mode 100644
index 0319baafc35b722260261e5b1630e57aec56e571..0000000000000000000000000000000000000000
--- a/openair2/RRC/LITE/MESSAGES/rtai_mem.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file rtai_mem.c
-* \brief a wrapper for Unified RTAI real-time memory management.
-* \author Florian Kaltenberger
-* \date 2011-04-06
-* \version 0.1
-* \company Eurecom
-* \email: florian.kaltenberger@eurecom.fr
-* \note
-* \bug
-* \warning
-*/
-
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/delay.h>
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-
-#include <linux/slab.h>
-//#include <linux/config.h>
-#include <linux/version.h>
-#include <linux/kernel.h>
-#include <linux/fs.h>
-
-#include <linux/errno.h>
-
-#include <linux/slab.h>
-
-#include <asm/rtai.h>
-#include <rtai.h>
-#include <rtai_shm.h>
-#include <rtai_malloc.h>
-
-/*
-void* rt_alloc_wrapper(int size) {
-
-  unsigned long* tmp_ptr;
-  static unsigned long name = 0;
-
-  rt_shm_free(name);
-  tmp_ptr = (unsigned long*) rt_shm_alloc(name,size+sizeof(unsigned long),GFP_KERNEL);
-
-  if (!tmp_ptr) {
-    printk("rt_mem.c: failed to allocate %d bytes for name %ld at %p\n",size,name,tmp_ptr);
-    return NULL;
-  }
-
-  printk("rt_mem.c: allocated %d bytes for name %ld at %p\n",size,name,tmp_ptr+1);
-
-  tmp_ptr[0] = name;
-  name++;
-
-  return (void*) (tmp_ptr+1);
-
-}
-
-int rt_free_wrapper(void* ptr) {
-
-  unsigned long name;
-
-  printk("rt_mem.c: freeing memory at %p, ",ptr);
-
-  name = *(((unsigned long*) ptr)-1);
-
-  printk("name %ld\n",name);
-
-  return rt_shm_free(name);
-
-}
-
-void* rt_realloc_wrapper(void* oldptr, int size) {
-
-  void* newptr;
-
-  printk("rt_mem.c: reallocating %p with %d bytes\n",oldptr,size);
-
-  if (oldptr==NULL)
-    newptr = rt_alloc_wrapper(size);
-  else {
-    newptr = rt_alloc_wrapper(size);
-    memcpy(newptr,oldptr,size);
-    rt_free_wrapper(oldptr);
-  }
-
-  return newptr;
-}
-*/
-
-void* rt_realloc(void* oldptr, int size)
-{
-
-  void* newptr;
-
-  printk("rt_mem.c: reallocating %p with %d bytes\n",oldptr,size);
-
-  if (oldptr==NULL) {
-    newptr = rt_malloc(size);
-  } else {
-    newptr = rt_malloc(size);
-    memcpy(newptr,oldptr,size);
-    rt_free(oldptr);
-  }
-
-  return newptr;
-}
-
-void* rt_calloc(int nmemb, int size)
-{
-
-  void* newptr;
-
-  printk("rt_mem.c: allocating %d elements with %d bytes\n",nmemb,size);
-
-  newptr = rt_malloc(nmemb*size);
-  memset(newptr,0,nmemb*size);
-
-  return newptr;
-}
diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h
index 3d98d1d300b0c99c5af7d74e681786d0b7b06fc9..08ac30f8363f9453921c73598a3b8447fc7abc93 100644
--- a/openair2/RRC/LITE/defs.h
+++ b/openair2/RRC/LITE/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -31,11 +31,9 @@
 #ifndef __OPENAIR_RRC_DEFS_H__
 #define __OPENAIR_RRC_DEFS_H__
 
-#ifdef USER_MODE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#endif
 
 #include "collection/tree.h"
 #include "rrc_types.h"
@@ -47,11 +45,6 @@
 
 #include "LAYER2/MAC/defs.h"
 
-//#include "COMMON/openair_defs.h"
-#ifndef USER_MODE
-#include <rtai.h>
-#endif
-
 #include "SystemInformationBlockType1.h"
 #include "SystemInformation.h"
 #include "RRCConnectionReconfiguration.h"
@@ -72,6 +65,9 @@
 #include "UE-EUTRA-Capability.h"
 #include "MeasResults.h"
 
+/* for ImsiMobileIdentity_t */
+#include "MobileIdentity.h"
+
 /* correct Rel(8|10)/Rel14 differences
  * the code is in favor of Rel14, those defines do the translation
  */
@@ -242,7 +238,11 @@ typedef enum HO_STATE_e {
 // #define NUM_MAX_CBA_GROUP 4 // in the platform_constants
 
 /* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
+#if defined(USRP_REC_PLAY)
+#define RRC_TRANSACTION_IDENTIFIER_NUMBER  1
+#else
 #define RRC_TRANSACTION_IDENTIFIER_NUMBER  3
+#endif
 
 typedef struct {
   unsigned short transport_block_size;                  /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
@@ -292,12 +292,15 @@ typedef enum e_rab_satus_e {
   E_RAB_STATUS_DONE, // from the eNB perspective
   E_RAB_STATUS_ESTABLISHED, // get the reconfigurationcomplete form UE
   E_RAB_STATUS_FAILED,
+  E_RAB_STATUS_TORELEASE  // to release DRB between eNB and UE
 } e_rab_status_t;
 
 typedef struct e_rab_param_s {
   e_rab_t param;
   uint8_t status;
   uint8_t xid; // transaction_id
+  s1ap_Cause_t cause;
+  uint8_t cause_value;
 } __attribute__ ((__packed__)) e_rab_param_t;
 #endif
 
@@ -375,6 +378,7 @@ typedef struct eNB_RRC_UE_s {
   SRB_ToAddModList_t*                SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
   DRB_ToAddModList_t*                DRB_configList;
   DRB_ToAddModList_t*                DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
+  DRB_ToReleaseList_t*               DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
   uint8_t                            DRB_active[8];
   struct PhysicalConfigDedicated*    physicalConfigDedicated;
   struct SPS_Config*                 sps_Config;
@@ -390,10 +394,17 @@ typedef struct eNB_RRC_UE_s {
   SRB_INFO_TABLE_ENTRY               Srb2;
   MeasConfig_t*                      measConfig;
   HANDOVER_INFO*                     handover_info;
+  MeasResults_t*                     measResults;
+
+  UE_EUTRA_Capability_t*             UE_Capability;
+  ImsiMobileIdentity_t               imsi;
 
 #if defined(ENABLE_SECURITY)
   /* KeNB as derived from KASME received from EPC */
   uint8_t kenb[32];
+  int8_t  kenb_ncc;
+  uint8_t nh[32];
+  int8_t  nh_ncc;
 #endif
   /* Used integrity/ciphering algorithms */
   CipheringAlgorithm_r12_t                          ciphering_algorithm;
@@ -423,9 +434,15 @@ typedef struct eNB_RRC_UE_s {
   uint8_t                           setup_e_rabs;
   /* Number of e_rab to be setup in the list */
   uint8_t                            nb_of_e_rabs;
+  /* Number of e_rab to be modified in the list */
+  uint8_t                            nb_of_modify_e_rabs;
+  uint8_t                            nb_of_failed_e_rabs;
+  e_rab_param_t                      modify_e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
   /* list of e_rab to be setup by RRC layers */
   e_rab_param_t                      e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
-
+  //release e_rabs
+  uint8_t                            nb_release_of_e_rabs;
+  e_rab_failed_t                     e_rabs_release_failed[S1AP_MAX_E_RAB];
   // LG: For GTPV1 TUNNELS
   uint32_t                           enb_gtp_teid[S1AP_MAX_E_RAB];
   transport_layer_addr_t             enb_gtp_addrs[S1AP_MAX_E_RAB];
@@ -434,6 +451,13 @@ typedef struct eNB_RRC_UE_s {
   uint32_t                           ul_failure_timer;
   uint32_t                           ue_release_timer;
   uint32_t                           ue_release_timer_thres;
+  uint32_t                           ue_release_timer_s1;
+  uint32_t                           ue_release_timer_thres_s1;
+  uint32_t                           ue_release_timer_rrc;
+  uint32_t                           ue_release_timer_thres_rrc;
+  uint32_t                           ue_reestablishment_timer;
+  uint32_t                           ue_reestablishment_timer_thres;
+  uint8_t                            e_rab_release_command_flag;
 } eNB_RRC_UE_t;
 
 typedef uid_t ue_uid_t;
@@ -497,6 +521,8 @@ typedef struct {
 #endif
   SRB_INFO                          SI;
   SRB_INFO                          Srb0;
+  uint8_t                           *paging[NUMBER_OF_UE_MAX];
+  uint32_t                           sizeof_paging[NUMBER_OF_UE_MAX];
 } rrc_eNB_carrier_data_t;
 
 typedef struct eNB_RRC_INST_s {
@@ -624,6 +650,8 @@ typedef struct UE_RRC_INST_s {
 #if defined(ENABLE_SECURITY)
   /* KeNB as computed from parameters within USIM card */
   uint8_t kenb[32];
+  uint8_t nh[32];
+  int8_t  nh_ncc;
 #endif
 
   /* Used integrity/ciphering algorithms */
@@ -631,6 +659,14 @@ typedef struct UE_RRC_INST_s {
   e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
 } UE_RRC_INST;
 
+typedef struct UE_PF_PO_s {
+  boolean_t enable_flag;  /* flag indicate whether current object is used */
+  uint16_t ue_index_value;  /* UE index value */
+  uint8_t PF_min;  /* minimal value of Paging Frame (PF) */
+  uint8_t PO;  /* Paging Occasion (PO) */
+  uint32_t T;  /* DRX cycle */
+} UE_PF_PO_t;
+
 #include "proto.h"
 
 #endif
diff --git a/openair2/RRC/LITE/defs_NB_IoT.h b/openair2/RRC/LITE/defs_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..376b66c79a1e5c61ccedad1aca00806137da49bc
--- /dev/null
+++ b/openair2/RRC/LITE/defs_NB_IoT.h
@@ -0,0 +1,570 @@
+/* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file RRC/LITE/defs_NB_IoT.h
+* \brief NB-IoT RRC struct definitions and function prototypes
+* \author Navid Nikaein, Raymond Knopp and Michele Paffetti
+* \date 2010 - 2014, 2017
+* \version 1.0
+* \company Eurecom
+* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, michele.paffetti@studio.unibo.it
+*/
+
+#ifndef __OPENAIR_RRC_DEFS_NB_IOT_H__
+#define __OPENAIR_RRC_DEFS_NB_IOT_H__
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "collection/tree.h"
+#include "rrc_types_NB_IoT.h"
+#include "COMMON/platform_constants.h"
+#include "COMMON/platform_types.h"
+#include "targets/COMMON/openairinterface5g_limits.h"
+
+#include "COMMON/mac_rrc_primitives.h"
+
+//-----NB-IoT #include files-------
+
+//#include "SystemInformationBlockType1-NB.h"
+//#include "SystemInformation-NB.h"
+#include "RRCConnectionReconfiguration-NB.h"
+#include "RRCConnectionReconfigurationComplete-NB.h"
+#include "RRCConnectionSetup-NB.h"
+#include "RRCConnectionSetupComplete-NB.h"
+#include "RRCConnectionRequest-NB.h"
+#include "RRCConnectionReestablishmentRequest-NB.h"
+#include "BCCH-DL-SCH-Message-NB.h"
+#include "BCCH-BCH-Message-NB.h"
+#include "AS-Config-NB.h"
+#include "AS-Context-NB.h"
+#include "UE-Capability-NB-r13.h" //equivalent of UE-EUTRA-Capability.h
+//-------------------
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+#endif
+
+/* TODO: be sure this include is correct.
+ * It solves a problem of compilation of the RRH GW,
+ * issue #186.
+ */
+#if !defined(ENABLE_ITTI)
+# include "as_message.h"
+#endif
+
+#if defined(ENABLE_USE_MME)
+# include "commonDef.h"
+#endif
+
+#if ENABLE_RAL
+# include "collection/hashtable/obj_hashtable.h"
+#endif
+
+
+
+/*I will change the name of the structure for compile purposes--> hope not to undo this process*/
+
+typedef unsigned int uid_NB_IoT_t;
+#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NB_IoT (((NUMBER_OF_UE_MAX_NB_IoT/8)/sizeof(unsigned int)) + 1)
+
+typedef struct uid_linear_allocator_NB_IoT_s {
+  unsigned int   bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NB_IoT];
+} uid_allocator_NB_IoT_t;
+
+
+#define PROTOCOL_RRC_CTXT_UE_FMT           PROTOCOL_CTXT_FMT
+#define PROTOCOL_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp)
+
+#define PROTOCOL_RRC_CTXT_FMT           PROTOCOL_CTXT_FMT
+#define PROTOCOL_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp)
+
+
+//left as they are --> used in LAYER2/epenair2_proc.c and UE side
+typedef enum UE_STATE_NB_IoT_e {
+ RRC_INACTIVE_NB_IoT=0,
+ RRC_IDLE_NB_IoT,
+ RRC_SI_RECEIVED_NB_IoT,
+ RRC_CONNECTED_NB_IoT,
+ RRC_RECONFIGURED_NB_IoT,
+ RRC_HO_EXECUTION_NB_IoT //maybe not needed?
+} UE_STATE_NB_IoT_t;
+
+
+/** @defgroup _rrc RRC
+ * @ingroup _oai2
+ * @{
+ */
+typedef struct UE_RRC_INFO_NB_IoT_s {
+  UE_STATE_NB_IoT_t State;
+  uint8_t SIB1systemInfoValueTag;
+  uint32_t SIStatus;
+  uint32_t SIcnt;
+#if defined(Rel10) || defined(Rel14)
+  uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA
+#endif
+  uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40
+  uint8_t handoverTarget;
+  //HO_STATE_t ho_state;
+  uint16_t SIperiod; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120
+  unsigned short UE_index;
+  uint32_t T300_active;
+  uint32_t T300_cnt;
+  uint32_t T304_active;
+  uint32_t T304_cnt;
+  uint32_t T310_active;
+  uint32_t T310_cnt;
+  uint32_t N310_cnt;
+  uint32_t N311_cnt;
+  rnti_t   rnti;
+} __attribute__ ((__packed__)) UE_RRC_INFO_NB_IoT;
+
+//#define NUM_PRECONFIGURED_LCHAN (NB_CH_CX*2)  //BCCH, CCCH
+
+#define UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!!
+#define UE_INDEX_INVALID  ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1
+
+
+
+// HO_STATE is not supported by NB-IoT
+
+//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG
+#define RRM_FREE(p)       if ( (p) != NULL) { free(p) ; p=NULL ; }
+#define RRM_MALLOC(t,n)   (t *) malloc16( sizeof(t) * n )
+#define RRM_CALLOC(t,n)   (t *) malloc16( sizeof(t) * n)
+#define RRM_CALLOC2(t,s)  (t *) malloc16( s )
+
+//Measurement Report not supported in NB-IoT
+
+#define PAYLOAD_SIZE_MAX 1024
+#define RRC_BUF_SIZE 255
+#define UNDEF_SECURITY_MODE 0xff
+#define NO_SECURITY_MODE 0x20
+
+/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
+#define RRC_TRANSACTION_IDENTIFIER_NUMBER  3
+
+typedef struct UE_S_TMSI_NB_IoT_s {
+  boolean_t  presence;
+  mme_code_t mme_code;
+  m_tmsi_t   m_tmsi;
+} __attribute__ ((__packed__)) UE_S_TMSI_NB_IoT;
+
+
+typedef enum e_rab_satus_NB_IoT_e {
+  E_RAB_STATUS_NEW_NB_IoT,
+  E_RAB_STATUS_DONE_NB_IoT, // from the eNB perspective
+  E_RAB_STATUS_ESTABLISHED_NB_IoT, // get the reconfigurationcomplete form UE
+  E_RAB_STATUS_FAILED_NB_IoT,
+} e_rab_status_NB_IoT_t;
+
+typedef struct e_rab_param_NB_IoT_s {
+  e_rab_t param;
+  uint8_t status;
+  uint8_t xid; // transaction_id
+} __attribute__ ((__packed__)) e_rab_param_NB_IoT_t;
+
+
+//HANDOVER_INFO not implemented in NB-IoT delete
+
+
+#define RRC_HEADER_SIZE_MAX 64
+#define RRC_BUFFER_SIZE_MAX 1024
+
+typedef struct {
+  char Payload[RRC_BUFFER_SIZE_MAX];
+  char Header[RRC_HEADER_SIZE_MAX];
+  char payload_size;
+} RRC_BUFFER_NB_IoT;
+
+#define RRC_BUFFER_SIZE_NB_IoT sizeof(RRC_BUFFER_NB_IoT)
+
+
+typedef struct RB_INFO_NB_IoT_s {
+  uint16_t Rb_id;  //=Lchan_id
+  //LCHAN_DESC Lchan_desc[2]; no more used
+  //MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT
+} RB_INFO_NB_IoT;
+
+typedef struct SRB_INFO_NB_IoT_s {
+  uint16_t Srb_id;  //=Lchan_id---> useful for distinguish between SRB1 and SRB1bis?
+  RRC_BUFFER_NB_IoT Rx_buffer;
+  RRC_BUFFER_NB_IoT Tx_buffer;
+  //LCHAN_DESC Lchan_desc[2]; no more used
+  unsigned int Trans_id;
+  uint8_t Active;
+} SRB_INFO_NB_IoT;
+
+
+typedef struct RB_INFO_TABLE_ENTRY_NB_IoT_s {
+  RB_INFO_NB_IoT Rb_info;
+  uint8_t Active;
+  uint32_t Next_check_frame;
+  uint8_t Status;
+} RB_INFO_TABLE_ENTRY_NB_IoT;
+
+typedef struct SRB_INFO_TABLE_ENTRY_NB_IoT_s {
+  SRB_INFO_NB_IoT Srb_info;
+  uint8_t Active;
+  uint8_t Status;
+  uint32_t Next_check_frame;
+} SRB_INFO_TABLE_ENTRY_NB_IoT;
+
+//MEAS_REPORT_LIST_s not implemented in NB-IoT but is used at UE side
+//HANDOVER_INFO_UE not implemented in NB-IoT
+typedef struct HANDOVER_INFO_UE_NB_IoT_s {
+  PhysCellId_t targetCellId;
+  uint8_t measFlag;
+} HANDOVER_INFO_UE_NB_IoT;
+
+//NB-IoT eNB_RRC_UE_NB_IoT_s--(used as a context in eNB --> ue_context in rrc_eNB_ue_context)------
+typedef struct eNB_RRC_UE_NB_IoT_s {
+
+  EstablishmentCause_t               establishment_cause;
+  uint8_t                            primaryCC_id;
+  //in NB-IoT only SRB0, SRB1 and SRB1bis (until AS security activation) exist
+
+  /*MP: Concept behind List and List2
+   *
+   * SRB_configList --> is used for the actual list of SRBs that is managed/that should be send over the RRC message
+   * SRB_configList2--> refers to all the SRBs configured for that specific transaction identifier
+   * 					this because in a single transaction one or more SRBs could be established
+   * 					and you want to keep memory on what happen for every transaction
+   * Transaction ID (xid): is used to associate the proper RRC....Complete message received by the UE to the corresponding
+   * 					   message previously sent by the eNB (e.g. RRCConnectionSetup -- RRCConnectionSetupComplete)
+   * 					   this because it could happen that more messages are transmitted at the same time
+   */
+  SRB_ToAddModList_NB_r13_t*                SRB_configList;//for SRB1 and SRB1bis
+  SRB_ToAddModList_NB_r13_t*                SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
+  DRB_ToAddModList_NB_r13_t*                DRB_configList; //for all the DRBs
+  DRB_ToAddModList_NB_r13_t*                DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid
+  uint8_t                            		DRB_active[2];//in LTE was 8 --> at most 2 for NB-IoT
+
+  struct PhysicalConfigDedicated_NB_r13*    physicalConfigDedicated_NB_IoT;
+  MAC_MainConfig_NB_r13_t*           mac_MainConfig_NB_IoT;
+
+  //No SPS(semi-persistent scheduling) in NB-IoT
+  //No Measurement report in NB-IoT
+
+  SRB_INFO_NB_IoT                           SI;
+  SRB_INFO_NB_IoT                           Srb0;
+  SRB_INFO_TABLE_ENTRY_NB_IoT               Srb1;
+  SRB_INFO_TABLE_ENTRY_NB_IoT               Srb1bis;
+
+#if defined(ENABLE_SECURITY)
+  /* KeNB as derived from KASME received from EPC */
+  uint8_t kenb[32];
+#endif
+
+  /* Used integrity/ciphering algorithms--> maintained the same for NB-IoT */
+  e_CipheringAlgorithm_r12     ciphering_algorithm; //Specs. TS 36.331 V14.1.0 pag 432 Change position of chipering enumerative w.r.t previous version
+  e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
+
+  uint8_t                            Status;
+  rnti_t                             rnti;
+  uint64_t                           random_ue_identity;
+
+
+
+  /* Information from UE RRC ConnectionRequest-NB-r13_IE--> NB-IoT */
+  UE_S_TMSI_NB_IoT                          Initialue_identity_s_TMSI;
+  EstablishmentCause_NB_r13_t               establishment_cause_NB_IoT; //different set for NB-IoT
+
+  /* Information from UE RRC ConnectionReestablishmentRequest-NB--> NB-IoT */
+  ReestablishmentCause_NB_r13_t             reestablishment_cause_NB_IoT; //different set for NB_IoT
+
+  /* UE id for initial connection to S1AP */
+  uint16_t                           ue_initial_id;
+
+  /* Information from S1AP initial_context_setup_req */
+  uint32_t                           eNB_ue_s1ap_id :24;
+
+  security_capabilities_t            security_capabilities;
+
+  /* Total number of e_rab already setup in the list */ //NAS list?
+  uint8_t                           setup_e_rabs;
+  /* Number of e_rab to be setup in the list */ //NAS list?
+  uint8_t                            nb_of_e_rabs;
+  /* list of e_rab to be setup by RRC layers */
+  e_rab_param_NB_IoT_t                      e_rab[NB_RB_MAX_NB_IOT];//[S1AP_MAX_E_RAB];
+
+  // LG: For GTPV1 TUNNELS
+  uint32_t                           enb_gtp_teid[S1AP_MAX_E_RAB];
+  transport_layer_addr_t             enb_gtp_addrs[S1AP_MAX_E_RAB];
+  rb_id_t                            enb_gtp_ebi[S1AP_MAX_E_RAB];
+
+ //Which timers are referring to?
+  uint32_t                           ul_failure_timer;
+  uint32_t                           ue_release_timer;
+  //threshold of the release timer--> set in RRCConnectionRelease
+  uint32_t                           ue_release_timer_thres;
+} eNB_RRC_UE_NB_IoT_t;
+//--------------------------------------------------------------------------------
+
+typedef uid_NB_IoT_t ue_uid_t;
+
+
+//generally variable called: ue_context_pP
+typedef struct rrc_eNB_ue_context_NB_IoT_s {
+
+  /* Tree related data */
+  RB_ENTRY(rrc_eNB_ue_context_NB_IoT_s) entries;
+
+  /* Uniquely identifies the UE between MME and eNB within the eNB.
+   * This id is encoded on 24bits.
+   */
+  rnti_t         ue_id_rnti;
+
+  // another key for protocol layers but should not be used as a key for RB tree
+  ue_uid_t       local_uid;
+
+  /* UE id for initial connection to S1AP */
+  struct eNB_RRC_UE_NB_IoT_s   ue_context; //context of ue in the e-nB
+
+} rrc_eNB_ue_context_NB_IoT_t;
+
+
+
+//---NB-IoT (completely changed)-------------------------------
+//called "carrier"--> data from PHY layer
+typedef struct {
+
+  // buffer that contains the encoded messages
+  uint8_t							*MIB_NB_IoT;
+  uint8_t							sizeof_MIB_NB_IoT;
+
+  uint8_t                           *SIB1_NB_IoT;
+  uint8_t                           sizeof_SIB1_NB_IoT;
+  uint8_t                         	*SIB23_NB_IoT;
+  uint8_t                        	sizeof_SIB23_NB_IoT;
+
+
+  //not actually implemented in OAI
+  uint8_t                           *SIB4_NB_IoT;
+  uint8_t                           sizeof_SIB4_NB_IoT;
+  uint8_t                           *SIB5_NB_IoT;
+  uint8_t                           sizeof_SIB5_NB_IoT;
+  uint8_t                           *SIB14_NB_IoT;
+  uint8_t                           sizeof_SIB14_NB_IoT;
+  uint8_t                           *SIB16_NB_IoT;
+  uint8_t                           sizeof_SIB16_NB_IoT;
+
+  //TS 36.331 V14.2.1
+//  uint8_t                           *SIB15_NB;
+//  uint8_t                           sizeof_SIB15_NB;
+//  uint8_t                           *SIB20_NB;
+//  uint8_t                           sizeof_SIB20_NB;
+//  uint8_t                           *SIB22_NB;
+//  uint8_t                           sizeof_SIB22_NB;
+
+  //implicit parameters needed
+  int                               Ncp; //cyclic prefix for DL
+  int								Ncp_UL; //cyclic prefix for UL
+  int                               p_eNB; //number of tx antenna port
+  int								p_rx_eNB; //number of receiving antenna ports
+  uint32_t                          dl_CarrierFreq; //detected by the UE
+  uint32_t                          ul_CarrierFreq; //detected by the UE
+  uint16_t                          physCellId; //not stored in the MIB-NB but is getting through NPSS/NSSS
+
+  //are the only static one (memory has been already allocated)
+  BCCH_BCH_Message_NB_t                mib_NB_IoT;
+  BCCH_DL_SCH_Message_NB_t             siblock1_NB_IoT; //SIB1-NB
+  BCCH_DL_SCH_Message_NB_t             systemInformation_NB_IoT; //SI
+
+  SystemInformationBlockType1_NB_t     		*sib1_NB_IoT;
+  SystemInformationBlockType2_NB_r13_t   	*sib2_NB_IoT;
+  SystemInformationBlockType3_NB_r13_t   	*sib3_NB_IoT;
+  //not implemented yet
+  SystemInformationBlockType4_NB_r13_t    	*sib4_NB_IoT;
+  SystemInformationBlockType5_NB_r13_t     	*sib5_NB_IoT;
+  SystemInformationBlockType14_NB_r13_t     *sib14_NB_IoT;
+  SystemInformationBlockType16_NB_r13_t     *sib16_NB_IoT;
+
+
+  SRB_INFO_NB_IoT                          SI;
+  SRB_INFO_NB_IoT                          Srb0;
+
+  uint8_t                           **MCCH_MESSAGE; //  probably not needed , but added to remove errors
+  uint8_t                           sizeof_MCCH_MESSAGE[8];// but added to remove errors
+  SRB_INFO_NB_IoT                          MCCH_MESS[8];// MAX_MBSFN_AREA
+  /*future implementation TS 36.331 V14.2.1
+  SystemInformationBlockType15_NB_r14_t     *sib15;
+  SystemInformationBlockType20_NB_r14_t     *sib20;
+  SystemInformationBlockType22_NB_r14_t     *sib22;
+
+  uint8_t							SCPTM_flag;
+  uint8_t							sizeof_SC_MCHH_MESS[];
+  SC_MCCH_Message_NB_t				scptm;*/
+
+
+} rrc_eNB_carrier_data_NB_IoT_t;
+//---------------------------------------------------
+
+
+
+//---NB-IoT---(completely change)---------------------
+typedef struct eNB_RRC_INST_NB_IoT_s {
+
+  rrc_eNB_carrier_data_NB_IoT_t          carrier[MAX_NUM_CCs];
+
+  uid_allocator_NB_IoT_t                    uid_allocator; // for rrc_ue_head
+  RB_HEAD(rrc_ue_tree_NB_IoT_s, rrc_eNB_ue_context_NB_IoT_s)     rrc_ue_head; // ue_context tree key search by rnti
+
+  uint8_t                           Nb_ue;
+
+  hash_table_t                      *initial_id2_s1ap_ids; // key is    content is rrc_ue_s1ap_ids_t
+  hash_table_t                      *s1ap_id2_s1ap_ids   ; // key is    content is rrc_ue_s1ap_ids_t
+
+  //RRC configuration
+  RrcConfigurationReq configuration; //rrc_messages_types.h
+
+  // other PLMN parameters
+  /// Mobile country code
+  int mcc;
+  /// Mobile network code
+  int mnc;
+  /// number of mnc digits
+  int mnc_digit_length;
+
+  // other RAN parameters //FIXME: to be checked--> depends on APP layer
+  int srb1_timer_poll_retransmit;
+  int srb1_max_retx_threshold;
+  int srb1_timer_reordering;
+  int srb1_timer_status_prohibit;
+  int srs_enable[MAX_NUM_CCs];
+
+
+} eNB_RRC_INST_NB_IoT;
+
+#define RRC_HEADER_SIZE_MAX_NB_IoT 64
+#define MAX_UE_CAPABILITY_SIZE_NB_IoT 255
+
+//not needed for the moment
+typedef struct OAI_UECapability_NB_IoT_s {
+ uint8_t sdu[MAX_UE_CAPABILITY_SIZE_NB_IoT];
+ uint8_t sdu_size;
+////NB-IoT------
+  UE_Capability_NB_r13_t  UE_Capability_NB_IoT; //replace the UE_EUTRA_Capability of LTE
+} OAI_UECapability_NB_IoT_t;
+
+#define RRC_BUFFER_SIZE_MAX_NB_IoT 1024
+
+
+
+typedef struct UE_RRC_INST_NB_IoT_s {
+  Rrc_State_NB_IoT_t     RrcState;
+  Rrc_Sub_State_NB_IoT_t RrcSubState;
+# if defined(ENABLE_USE_MME)
+  plmn_t          plmnID;
+  Byte_t          rat;
+  as_nas_info_t   initialNasMsg;
+# endif
+  OAI_UECapability_NB_IoT_t *UECap;
+  uint8_t *UECapability;
+  uint8_t UECapability_size;
+
+  UE_RRC_INFO_NB_IoT Info[NB_SIG_CNX_UE];
+  
+  SRB_INFO_NB_IoT                 Srb0[NB_SIG_CNX_UE];
+  SRB_INFO_TABLE_ENTRY_NB_IoT     Srb1[NB_CNX_UE];
+  SRB_INFO_TABLE_ENTRY_NB_IoT     Srb2[NB_CNX_UE];
+  HANDOVER_INFO_UE_NB_IoT         HandoverInfoUe;
+  /*
+  uint8_t *SIB1[NB_CNX_UE];
+  uint8_t sizeof_SIB1[NB_CNX_UE];
+  uint8_t *SI[NB_CNX_UE];
+  uint8_t sizeof_SI[NB_CNX_UE];
+  uint8_t SIB1Status[NB_CNX_UE];
+  uint8_t SIStatus[NB_CNX_UE];
+  SystemInformationBlockType1_t *sib1[NB_CNX_UE];
+  SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI().
+  */
+  SystemInformationBlockType2_t *sib2[NB_CNX_UE];
+  /*
+  SystemInformationBlockType3_t *sib3[NB_CNX_UE];
+  SystemInformationBlockType4_t *sib4[NB_CNX_UE];
+  SystemInformationBlockType5_t *sib5[NB_CNX_UE];
+  SystemInformationBlockType6_t *sib6[NB_CNX_UE];
+  SystemInformationBlockType7_t *sib7[NB_CNX_UE];
+  SystemInformationBlockType8_t *sib8[NB_CNX_UE];
+  SystemInformationBlockType9_t *sib9[NB_CNX_UE];
+  SystemInformationBlockType10_t *sib10[NB_CNX_UE];
+  SystemInformationBlockType11_t *sib11[NB_CNX_UE];
+
+#if defined(Rel10) || defined(Rel14)
+  uint8_t                           MBMS_flag;
+  uint8_t *MCCH_MESSAGE[NB_CNX_UE];
+  uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE];
+  uint8_t MCCH_MESSAGEStatus[NB_CNX_UE];
+  MBSFNAreaConfiguration_r9_t       *mcch_message[NB_CNX_UE];
+  SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE];
+  SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE];
+#endif
+#ifdef CBA
+  uint8_t                         num_active_cba_groups;
+  uint16_t                        cba_rnti[NUM_MAX_CBA_GROUP];
+#endif
+  uint8_t                         num_srb;
+  struct SRB_ToAddMod             *SRB1_config[NB_CNX_UE];
+  struct SRB_ToAddMod             *SRB2_config[NB_CNX_UE];
+  struct DRB_ToAddMod             *DRB_config[NB_CNX_UE][8];
+  rb_id_t                         *defaultDRB; // remember the ID of the default DRB
+  MeasObjectToAddMod_t            *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
+  struct ReportConfigToAddMod     *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG];
+  */
+  struct QuantityConfig           *QuantityConfig[NB_CNX_UE];
+  /*
+  struct MeasIdToAddMod           *MeasId[NB_CNX_UE][MAX_MEAS_ID];
+  MEAS_REPORT_LIST      *measReportList[NB_CNX_UE][MAX_MEAS_ID];
+  uint32_t           measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells
+  RSRP_Range_t                    s_measure;
+  struct MeasConfig__speedStatePars *speedStatePars;
+  struct PhysicalConfigDedicated  *physicalConfigDedicated[NB_CNX_UE];
+  struct SPS_Config               *sps_Config[NB_CNX_UE];
+  MAC_MainConfig_t                *mac_MainConfig[NB_CNX_UE];
+  MeasGapConfig_t                 *measGapConfig[NB_CNX_UE];
+  double                          filter_coeff_rsrp; // [7] ???
+  double                          filter_coeff_rsrq; // [7] ???
+  float                           rsrp_db[7];
+  float                           rsrq_db[7];
+  float                           rsrp_db_filtered[7];
+  float                           rsrq_db_filtered[7];
+#if ENABLE_RAL
+  obj_hash_table_t               *ral_meas_thresholds;
+  ral_transaction_id_t            scan_transaction_id;
+#endif
+#if defined(ENABLE_SECURITY)
+  // KeNB as computed from parameters within USIM card //
+  uint8_t kenb[32];
+#endif
+
+  // Used integrity/ciphering algorithms //
+  CipheringAlgorithm_r12_t                          ciphering_algorithm;
+  e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
+  */
+} UE_RRC_INST_NB_IoT;
+
+
+#include "proto_NB_IoT.h" //should be put here otherwise compilation error
+
+#endif
+/** @} */
diff --git a/openair2/RRC/LITE/extern.h b/openair2/RRC/LITE/extern.h
index 2791efcd138f94a0be820d0b3773a43597c7f7aa..b45dbd11e9557db9667b6c2ea24f1906eb67f774 100644
--- a/openair2/RRC/LITE/extern.h
+++ b/openair2/RRC/LITE/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -74,8 +74,13 @@ extern uint16_t N310[8];
 extern uint16_t N311[8];
 extern uint32_t T304[8];
 extern uint32_t timeToTrigger_ms[16];
-extern float RSRP_meas_mapping[100];
-extern float RSRQ_meas_mapping[33];
+extern float RSRP_meas_mapping[98];
+extern float RSRQ_meas_mapping[35];
+
+extern UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+extern pthread_mutex_t ue_pf_po_mutex;
+
+extern uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2];
 
 #endif
 
diff --git a/openair2/RRC/LITE/extern_NB_IoT.h b/openair2/RRC/LITE/extern_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..f5e2f325756006d2841bb81f674d778ea68515f8
--- /dev/null
+++ b/openair2/RRC/LITE/extern_NB_IoT.h
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file vars.h
+* \brief rrc external vars
+* \author Navid Nikaein and Raymond Knopp, Michele Paffetti
+* \date 2011-2017
+* \version 1.0
+* \company Eurecom
+* \email: navid.nikaein@eurecom.fr, michele.paffetti@studio.unibo.it
+*/
+
+#ifndef __OPENAIR_RRC_EXTERN_NB_IOT_H__
+#define __OPENAIR_RRC_EXTERN_NB_IOT_H__
+#include "RRC/LITE/defs_NB_IoT.h"
+#include "PHY_INTERFACE/IF_Module_NB_IoT.h"
+#include "LAYER2/RLC/rlc.h"
+#include "LogicalChannelConfig-NB-r13.h"
+#include "LAYER2/MAC/defs_NB_IoT.h"
+
+#include "common/ran_context.h"
+
+
+//MP: NOTE:XXX some of the parameters defined in vars_nb_iot are called by the extern.h file so not replicated here
+
+extern UE_RRC_INST_NB_IoT 					*UE_rrc_inst_NB_IoT;
+
+extern eNB_RRC_INST_NB_IoT 					*eNB_rrc_inst_NB_IoT;
+extern PHY_Config_NB_IoT_t 						*config_INFO;
+
+extern rlc_info_t 							Rlc_info_am_NB_IoT,Rlc_info_am_config_NB_IoT;
+extern uint8_t 								DRB2LCHAN_NB_IoT[2];
+extern LogicalChannelConfig_NB_r13_t 		SRB1bis_logicalChannelConfig_defaultValue_NB_IoT;
+extern LogicalChannelConfig_NB_r13_t 		SRB1_logicalChannelConfig_defaultValue_NB_IoT;
+
+extern uint16_t 							T300_NB_IoT[8];
+extern uint16_t 							T301_NB_IoT[8];
+extern uint16_t 							T310_NB_IoT[8];
+extern uint16_t 							T311_NB_IoT[8];
+extern uint16_t 							N310_NB_IoT[8];
+extern uint16_t 							N311_NB_IoT[8];
+extern uint8_t *get_NB_IoT_MIB(struct eNB_RRC_INST_NB_IoT_s *nb_iot_rrc);
+#endif
+
+
diff --git a/openair2/RRC/LITE/mesh_top.c b/openair2/RRC/LITE/mesh_top.c
deleted file mode 100644
index 448d15bfae1e4c69b50b48a41acacde5da2af665..0000000000000000000000000000000000000000
--- a/openair2/RRC/LITE/mesh_top.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*________________________openair_rrc_top.c________________________
-
- Authors : Hicham Anouar
- Company : EURECOM
- Emails  : anouar@eurecom.fr
-________________________________________________________________*/
-
-
-#ifndef USER_MODE
-#define __NO_VERSION__
-
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/delay.h>
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-
-#include <linux/slab.h>
-#include <linux/version.h>
-#include <linux/kernel.h>
-#include <linux/fs.h>
-
-#include <linux/errno.h>
-#ifdef KERNEL2_6
-#include <linux/slab.h>
-#endif
-
-#ifdef KERNEL2_4
-#include <linux/malloc.h>
-#include <linux/wrapper.h>
-#endif
-
-#endif
-
-
-
-#include "defs.h"
-#include "vars.h"
-
-extern MAC_RLC_XFACE* mac_rrc_register(RRC_XFACE*);
-extern int mac_rrc_unregister(RRC_XFACE *);
-
-extern void *bigphys_malloc(int);
-
-
-
-
-#ifndef USER_MODE
-
-/*------------------------------------------------*/
-/*   Prototypes                                   */
-/*------------------------------------------------*/
-#ifdef KERNEL2_4
-static int   init_module( void );
-static void  cleanup_module(void);
-#else
-static int   openair_rrc_init_module( void );
-static void  openair_rrc_cleanup_module(void);
-#endif
-
-#ifdef KERNEL2_6
-static int __init openair_rrc_init_module( void )
-#else
-int init_module( void )
-#endif //KERNEL2_6
-{
-  printk("[OPENAIR][RRC][INIT] inserting module\n");
-
-
-  Rrc_xface = (RRC_XFACE*)malloc16(sizeof(RRC_XFACE));
-
-  if(Rrc_xface == NULL) {
-    printk("[RRC] FATAL EROOR: Could not allocate memory for Rrc_xface !!!\n");
-    return (-1);
-  }
-
-  Mac_rlc_xface=mac_rrc_register(Rrc_xface);
-
-  if( Mac_rlc_xface == NULL ) {
-    printk("[OPENAIR][RRC][INIT] Could not get RRC descriptor\n");
-    return -1;
-  } else {
-    printk("[OPENAIR][RRC][INIT] Got RRC descriptor , Rcc_xface %p,Mac_rlc_xface=%p \n",Rrc_xface,Mac_rlc_xface);
-  }
-
-  if(rrc_init_global_param()==-1) {
-    printk("[OPENAIR][RRC][INIT] FATAL ERROR: INIT_GLOBAL_PARAM_NOK\n");
-    return -1;
-  }
-
-  return 0;
-}
-
-#ifdef KERNEL2_6
-static void __exit openair_rrc_cleanup_module(void)
-#else
-void cleanup_module(void)
-#endif //KERNEL2_6
-{
-#ifndef NO_RRM
-  rtf_destroy(RRC2RRM_FIFO);
-  rtf_destroy(RRM2RRC_FIFO);
-#endif //NO_RRM
-  printk("[OPENAIR][RRC][CLEANUP] cleanup module\n");
-  mac_rrc_unregister(Rrc_xface);
-
-}
-
-MODULE_AUTHOR
-("Lionel GAUTHIER <lionel.gauthier@eurecom.fr>, Raymond KNOPP <raymond.knopp@eurecom.fr>, Aawatif MENOUNI <aawatif.menouni@eurecom.fr>,Dominique NUSSBAUM <dominique.nussbaum@eurecom.fr>, Michelle WETTERWALD <michelle.wetterwald@eurecom.fr>, Maxime GUILLAUD <maxime.guillaud@eurecom.fr, Hicham ANOUAR <hicham.anouar@eurecom.fr>");
-MODULE_DESCRIPTION ("openair RRC layer module");
-MODULE_LICENSE ("GPL");
-module_init (openair_rrc_init_module);
-module_exit (openair_rrc_cleanup_module);
-
-#endif //USER_MODE
-
-
diff --git a/openair2/RRC/LITE/plmn_data.h b/openair2/RRC/LITE/plmn_data.h
index 3994a851fb72a4baa6e3f6419b95b38e4bb58edb..97dc94343b613365709d2840c614ec03f3f73388 100644
--- a/openair2/RRC/LITE/plmn_data.h
+++ b/openair2/RRC/LITE/plmn_data.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/LITE/proto.h b/openair2/RRC/LITE/proto.h
index b0179bad8e630dc83120db28d40131446e9cee22..b92058741940a5aa8ee91b18b664f2cbd5bb0d46 100644
--- a/openair2/RRC/LITE/proto.h
+++ b/openair2/RRC/LITE/proto.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,6 +33,8 @@
 
 #include "RRC/LITE/defs.h"
 
+#include "flexran_agent_extern.h"
+
 //main.c
 int rrc_init_global_param(void);
 int L3_xface_init(void);
@@ -54,15 +56,30 @@ void rrc_config_buffer(SRB_INFO *srb_info, uint8_t Lchan_type, uint8_t Role);
 void
 openair_rrc_on(
   const protocol_ctxt_t* const ctxt_pP);
+void
+openair_rrc_on_ue(
+  const protocol_ctxt_t* const ctxt_pP);
+
 void rrc_top_cleanup(void);
 
-/** \brief Function to update timers every subframe.  For UE it updates T300,T304 and T310.
+/** \brief Function to update eNB timers every subframe.  
 @param ctxt_pP  running context
 @param enb_index
 @param CC_id
 */
 RRC_status_t
 rrc_rx_tx(
+  protocol_ctxt_t* const ctxt_pP,
+  const int          CC_id
+);
+
+/** \brief Function to update timers every subframe.  For UE it updates T300,T304 and T310.
+@param ctxt_pP  running context
+@param enb_index
+@param CC_id
+*/
+RRC_status_t
+rrc_rx_tx_ue(
   protocol_ctxt_t* const ctxt_pP,
   const uint8_t      enb_index,
   const int          CC_id
@@ -254,6 +271,17 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   const uint8_t                ho_state
 );
 
+
+void
+flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(
+							     const protocol_ctxt_t* const ctxt_pP,
+							     rrc_eNB_ue_context_t* const ue_context_pP,
+							     const uint8_t ho_state,
+							     agent_reconf_rrc * trig_param
+							     );
+
+int freq_to_arfcn10(int band, unsigned long freq);
+
 void
 rrc_eNB_generate_dedeicatedRRCConnectionReconfiguration(
   const protocol_ctxt_t* const ctxt_pP,
@@ -261,6 +289,18 @@ rrc_eNB_generate_dedeicatedRRCConnectionReconfiguration(
   const uint8_t                ho_state
 );
 
+/**\brief release Data Radio Bearer between ENB and UE
+   \param ctxt_pP Running context
+   \param ue_context_pP UE context of UE receiving the message*/
+void
+rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(
+  const protocol_ctxt_t*   const ctxt_pP,
+  rrc_eNB_ue_context_t*    const ue_context_pP,
+  uint8_t                  xid,
+  uint32_t                 nas_length,
+  uint8_t*                 nas_buffer
+);
+
 void 
 rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP,
 			  rrc_eNB_ue_context_t*  ue_context_pP);
@@ -296,8 +336,6 @@ mac_rrc_data_req(
   const rb_id_t     Srb_id,
   const uint8_t     Nb_tb,
   uint8_t*    const buffer_pP,
-  const eNB_flag_t  enb_flagP,
-  const uint8_t     eNB_index,
   const uint8_t     mbsfn_sync_area
 );
 
@@ -311,7 +349,31 @@ mac_rrc_data_ind(
   const rb_id_t         srb_idP,
   const uint8_t*        sduP,
   const sdu_size_t      sdu_lenP,
-  const eNB_flag_t      eNB_flagP,
+  const uint8_t         mbsfn_sync_areaP
+);
+
+int8_t
+mac_rrc_data_req_ue(
+  const module_id_t Mod_idP,
+  const int         CC_id,
+  const frame_t     frameP,
+  const rb_id_t     Srb_id,
+  const uint8_t     Nb_tb,
+  uint8_t*    const buffer_pP,
+  const mac_enb_index_t eNB_indexP,
+  const uint8_t     mbsfn_sync_area
+);
+
+int8_t
+mac_rrc_data_ind_ue(
+  const module_id_t     module_idP,
+  const int         CC_id,
+  const frame_t         frameP,
+  const sub_frame_t     sub_frameP,
+  const rnti_t          rntiP,
+  const rb_id_t         srb_idP,
+  const uint8_t*        sduP,
+  const sdu_size_t      sdu_lenP,
   const mac_enb_index_t eNB_indexP,
   const uint8_t         mbsfn_sync_areaP
 );
@@ -324,6 +386,12 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
 			    const sub_frame_t subframeP,
 			    const rnti_t rnti);
 
+void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
+                const int CC_id,
+                const frame_t frameP,
+                const sub_frame_t subframeP,
+                const rnti_t rnti);
+
 void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, 
 			    const int CC_id, 
 			    const frame_t frameP,
@@ -341,6 +409,19 @@ rrc_data_req(
   const pdcp_transmission_mode_t modeP
 );
 
+uint8_t
+
+rrc_data_req_ue(
+  const protocol_ctxt_t*   const ctxt_pP,
+  const rb_id_t                  rb_idP,
+  const mui_t                    muiP,
+  const confirm_t                confirmP,
+  const sdu_size_t               sdu_sizeP,
+  uint8_t*                 const buffer_pP,
+  const pdcp_transmission_mode_t modeP
+);
+
+
 void
 rrc_data_ind(
   const protocol_ctxt_t* const ctxt_pP,
@@ -408,7 +489,7 @@ rrc_eNB_generate_SecurityModeCommand(
 void
 rrc_eNB_process_MeasurementReport(
   const protocol_ctxt_t* const ctxt_pP,
-  rrc_eNB_ue_context_t*          const ue_context_pP,
+  rrc_eNB_ue_context_t*        ue_context_pP,
   const MeasResults_t*   const measResults2
 );
 
@@ -462,4 +543,12 @@ long binary_search_int(int elements[], long numElem, int value);
 long binary_search_float(float elements[], long numElem, float value);
 
 void openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active);
+
+void openair_rrc_top_init_ue(
+                        int eMBMS_active,
+                        char* uecap_xer,
+                        uint8_t cba_group_active,
+                        uint8_t HO_active
+);
+
 /** @}*/
diff --git a/openair2/RRC/LITE/proto_NB_IoT.h b/openair2/RRC/LITE/proto_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..b2218517fc8761da2f7311554e25821f02f9f06a
--- /dev/null
+++ b/openair2/RRC/LITE/proto_NB_IoT.h
@@ -0,0 +1,260 @@
+/* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file proto_NB_IoT.h
+ * \brief RRC functions prototypes for eNB and UE for NB-IoT
+ * \author Navid Nikaein, Raymond Knopp and Michele Paffetti
+ * \date 2010 - 2014
+ * \email navid.nikaein@eurecom.fr, michele.paffetti@studio.unibo.it
+ * \version 1.0
+
+ */
+/** \addtogroup _rrc
+ *  @{
+ */
+
+#include "RRC/LITE/defs_NB_IoT.h"
+#include "pdcp.h"
+#include "rlc.h"
+#include "extern_NB_IoT.h"
+#include "LAYER2/MAC/defs_NB_IoT.h"
+/*NOTE: no static function should be declared in this header file (e.g. init_SI_NB)*/
+
+/*------------------------common_nb_iot.c----------------------------------------*/
+
+/** \brief configure  BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
+ */
+void openair_rrc_on_NB_IoT(const protocol_ctxt_t* const ctxt_pP);
+
+void rrc_config_buffer_NB_IoT(SRB_INFO_NB_IoT *srb_info, uint8_t Lchan_type, uint8_t Role);
+
+int L3_xface_init_NB_IoT(void);
+
+void openair_rrc_top_init_eNB_NB_IoT(void);
+
+//void rrc_top_cleanup(void); -->seems not to be used
+
+//rrc_t310_expiration-->seems not to be used
+
+/** \brief Function to update timers every subframe.  For UE it updates T300,T304 and T310.
+@param ctxt_pP  running context
+@param enb_index
+@param CC_id
+*/
+RRC_status_t rrc_rx_tx_NB_IoT(protocol_ctxt_t* const ctxt_pP, const uint8_t  enb_index, const int CC_id);
+
+//long binary_search_int(int elements[], long numElem, int value);--> seems not to be used
+//long binary_search_float(float elements[], long numElem, float value);--> used only at UE side
+
+
+
+//---------------------------------------
+
+
+//defined in L2_interface
+//called by rx_sdu only in case of CCCH message (e.g RRCConnectionRequest-NB)
+int8_t mac_rrc_data_ind_eNB_NB_IoT(
+  const module_id_t     module_idP,
+  const int             CC_id,
+  const frame_t         frameP,
+  const sub_frame_t     sub_frameP,
+  const rnti_t          rntiP,
+  const rb_id_t         srb_idP,//could be skipped since always go through the CCCH channel
+  const uint8_t*        sduP,
+  const sdu_size_t      sdu_lenP
+);
+//-------------------------------------------
+
+//defined in L2_interface
+void dump_ue_list_NB_IoT(UE_list_NB_IoT_t *listP, int ul_flag);
+//-------------------------------------------
+
+
+//defined in L2_interface
+void mac_eNB_rrc_ul_failure_NB_IoT(
+		const module_id_t mod_idP,
+	    const int CC_idP,
+	    const frame_t frameP,
+	    const sub_frame_t subframeP,
+	    const rnti_t rntiP);
+//------------------------------------------
+
+//defined in eNB_scheduler_primitives.c
+int rrc_mac_remove_ue_NB_IoT(
+		module_id_t mod_idP,
+		rnti_t rntiP);
+//------------------------------------------
+//defined in L2_interface
+void mac_eNB_rrc_ul_in_sync_NB_IoT(
+				const module_id_t mod_idP,
+			    const int CC_idP,
+			    const frame_t frameP,
+			    const sub_frame_t subframeP,
+			    const rnti_t rntiP);
+//------------------------------------------
+//defined in L2_interface
+int mac_eNB_get_rrc_status_NB_IoT(
+  const module_id_t Mod_idP,
+  const rnti_t      rntiP
+);
+//---------------------------
+
+
+/*-----------eNB procedures (rrc_eNB_nb_iot.c)---------------*/
+
+//---Initialization--------------
+void openair_eNB_rrc_on_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP
+);
+
+void rrc_config_buffer_NB_IoT(
+  SRB_INFO_NB_IoT* Srb_info,
+  uint8_t Lchan_type,
+  uint8_t Role
+);
+
+char openair_rrc_eNB_configuration_NB_IoT(
+  const module_id_t enb_mod_idP,
+  NbIoTRrcConfigurationReq* configuration
+);
+
+//-----------------------------
+/**\brief RRC eNB task. (starting of the RRC state machine)
+   \param void *args_p Pointer on arguments to start the task. */
+void *rrc_enb_task_NB_IoT(void *args_p);
+
+/**\brief Entry routine to decode a UL-CCCH-Message-NB.  Invokes PER decoder and parses message.
+   \param ctxt_pP Running context
+   \param Srb_info Pointer to SRB0 information structure (buffer, etc.)*/
+int rrc_eNB_decode_ccch_NB_IoT(
+  protocol_ctxt_t* const ctxt_pP,
+  const SRB_INFO_NB_IoT*        const Srb_info,
+  const int              CC_id
+);
+
+/**\brief Entry routine to decode a UL-DCCH-Message-NB.  Invokes PER decoder and parses message.
+   \param ctxt_pP Context
+   \param Rx_sdu Pointer Received Message
+   \param sdu_size Size of incoming SDU*/
+int rrc_eNB_decode_dcch_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  const rb_id_t                Srb_id,
+  const uint8_t*    const      Rx_sdu,
+  const sdu_size_t             sdu_sizeP
+);
+
+/**\brief Generate RRCConnectionReestablishmentReject-NB
+   \param ctxt_pP       Running context
+   \param ue_context_pP UE context
+   \param CC_id         Component Carrier ID*/
+void rrc_eNB_generate_RRCConnectionReestablishmentReject_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*          const ue_context_pP,
+  const int                    CC_id
+);
+
+void rrc_eNB_generate_RRCConnectionReject_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*          const ue_context_pP,
+  const int                    CC_id
+);
+
+void rrc_eNB_generate_RRCConnectionSetup_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*          const ue_context_pP,
+  const int                    CC_id
+);
+
+void rrc_eNB_process_RRCConnectionReconfigurationComplete_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*        ue_context_pP,
+  const uint8_t xid //transaction identifier
+);
+
+
+void //was under ITTI
+rrc_eNB_reconfigure_DRBs_NB_IoT(const protocol_ctxt_t* const ctxt_pP,
+			       rrc_eNB_ue_context_NB_IoT_t*  ue_context_pP);
+
+void //was under ITTI
+rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB_IoT(
+		const protocol_ctxt_t* const ctxt_pP,
+	    rrc_eNB_ue_context_NB_IoT_t*          const ue_context_pP
+//            const uint8_t      ho_state
+	     );
+
+void rrc_eNB_process_RRCConnectionSetupComplete_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*         ue_context_pP,
+  RRCConnectionSetupComplete_NB_r13_IEs_t * rrcConnectionSetupComplete_NB
+);
+
+void rrc_eNB_generate_SecurityModeCommand_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*          const ue_context_pP
+);
+
+void rrc_eNB_generate_UECapabilityEnquiry_NB_IoT(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_NB_IoT_t*          const ue_context_pP
+);
+
+void rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB_IoT(const protocol_ctxt_t* const ctxt_pP,
+						                                                     rrc_eNB_ue_context_NB_IoT_t*          const ue_context_pP
+						                                                     //no HO flag
+						                                                    );
+
+
+/// Utilities------------------------------------------------
+
+void rrc_eNB_free_UE_NB_IoT(
+		const module_id_t enb_mod_idP,
+		const struct rrc_eNB_ue_context_NB_IoT_s*        const ue_context_pP
+		);
+
+void rrc_eNB_free_mem_UE_context_NB_IoT(
+  const protocol_ctxt_t*               const ctxt_pP,
+  struct rrc_eNB_ue_context_NB_IoT_s*         const ue_context_pP
+);
+
+
+
+/**\brief Function to get the next transaction identifier.
+   \param module_idP Instance ID for CH/eNB
+   \return a transaction identifier*/
+uint8_t rrc_eNB_get_next_transaction_identifier_NB_IoT(module_id_t module_idP);
+
+
+int rrc_init_global_param_NB_IoT(void);
+
+//L2_interface.c
+int8_t mac_rrc_data_req_eNB_NB_IoT(
+  const module_id_t Mod_idP,
+  const int         CC_id,
+  const frame_t     frameP,
+  const frame_t   h_frameP,
+  const sub_frame_t   subframeP, //need for the case in which both SIB1-NB_IoT and SIB23-NB_IoT will be scheduled in the same frame
+  const rb_id_t     Srb_id,
+  uint8_t* const buffer_pP,
+  uint8_t   flag
+);
+
+
+
diff --git a/openair2/RRC/LITE/rrc_2_rrm_msg.c b/openair2/RRC/LITE/rrc_2_rrm_msg.c
index 9a5c14f91eca5fd69e8e85c13f5440898b5f0834..87a0a3557b57a7ce4f636024e7d031f9352423f7 100644
--- a/openair2/RRC/LITE/rrc_2_rrm_msg.c
+++ b/openair2/RRC/LITE/rrc_2_rrm_msg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c
index 5cbc612b4801d3bc4aeb1ff4ba87478b33c102e3..3edf230ac2817ca736956c7affd80342980629f4 100644
--- a/openair2/RRC/LITE/rrc_UE.c
+++ b/openair2/RRC/LITE/rrc_UE.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -62,14 +62,8 @@
 #include "TDD-Config.h"
 #include "UECapabilityEnquiry.h"
 #include "UE-CapabilityRequest.h"
-#ifdef PHY_ABSTRACTION
-#include "OCG.h"
-#include "OCG_extern.h"
-#endif
-#ifdef USER_MODE
 #include "RRC/NAS/nas_config.h"
 #include "RRC/NAS/rb_config.h"
-#endif
 #if ENABLE_RAL
 #include "rrc_UE_ral.h"
 #endif
@@ -239,6 +233,30 @@ static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState )
   return (0);
 }
 
+//-----------------------------------------------------------------------------
+void
+openair_rrc_on_ue(
+  const protocol_ctxt_t* const ctxt_pP
+)
+//-----------------------------------------------------------------------------
+{
+  unsigned short i;
+
+
+    LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" UE?:OPENAIR RRC IN....\n",
+          PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+
+    for (i = 0; i < NB_eNB_INST; i++) {
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n",
+            PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i);
+      UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH;
+      memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+      memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+      rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1);
+      UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1;
+    }
+}
+
 //-----------------------------------------------------------------------------
 static void init_SI_UE( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index )
 {
@@ -345,7 +363,7 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_
 #endif
 
 #ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH
-  openair_rrc_on(&ctxt);
+  openair_rrc_on_ue(&ctxt);
 #endif
 #ifdef CBA
   int j;
@@ -436,6 +454,47 @@ static const char const nas_attach_req_guti[] = {
 };
 #endif
 
+//-----------------------------------------------------------------------------
+void
+rrc_t310_expiration(
+  const protocol_ctxt_t* const ctxt_pP,
+  const uint8_t                 eNB_index
+)
+//-----------------------------------------------------------------------------
+{
+
+  if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
+    LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
+    UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
+    UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].UE_index = 0xffff;
+    UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Rx_buffer.payload_size = 0;
+    UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = 0;
+    UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Rx_buffer.payload_size = 0;
+    UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size = 0;
+
+    if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) {
+      LOG_D (RRC,"[Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index,
+           UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
+      rrc_pdcp_config_req (ctxt_pP,
+                           SRB_FLAG_YES,
+                           CONFIG_ACTION_REMOVE,
+                           UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
+                           0);
+      rrc_rlc_config_req (ctxt_pP,
+                          SRB_FLAG_YES,
+                          MBMS_FLAG_NO,
+                          CONFIG_ACTION_REMOVE,
+                          UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
+                          Rlc_info_um);
+      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0;
+      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Status = IDLE;
+      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0;
+    }
+  } else { // Restablishment procedure
+    LOG_D(RRC, "Timer 310 expired, trying RRCRestablishment ...\n");
+  }
+}
+
 //-----------------------------------------------------------------------------
 static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id )
 {
@@ -460,7 +519,7 @@ static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* c
   LOG_D(RLC,
         "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
         ctxt_pP->frame, ctxt_pP->module_id+NB_eNB_INST, size, eNB_index, rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH);
-  rrc_data_req (
+  rrc_data_req_ue (
 		ctxt_pP,
 		DCCH,
 		rrc_mui++,
@@ -487,7 +546,7 @@ static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol
         rrc_mui,
         UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
         DCCH);
-  rrc_data_req (
+  rrc_data_req_ue (
 		ctxt_pP,
 		DCCH,
 		rrc_mui++,
@@ -730,13 +789,8 @@ rrc_ue_establish_drb(
    */
 #ifdef PDCP_USE_NETLINK
 #   if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
-#    ifdef OAI_EMU
-  ip_addr_offset3 = oai_emulation.info.nb_enb_local;
-  ip_addr_offset4 = NB_eNB_INST;
-#    else
   ip_addr_offset3 = 0;
-  ip_addr_offset4 = 8;
-#    endif
+  ip_addr_offset4 = 1;
   LOG_I(OIP,"[UE %d] trying to bring up the OAI interface oai%d, IP 10.0.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP,
         ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1);
   oip_ifup=nas_config(ip_addr_offset3+ue_mod_idP,   // interface_id
@@ -744,9 +798,6 @@ rrc_ue_establish_drb(
                       ip_addr_offset4+ue_mod_idP+1); // fourth_octet
 
   if (oip_ifup == 0 ) { // interface is up --> send a config the DRB
-#        ifdef OAI_EMU
-    oai_emulation.info.oai_ifup[ue_mod_idP]=1;
-#        endif
     LOG_I(OIP,"[UE %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
           ue_mod_idP,
           ip_addr_offset3+ue_mod_idP,
@@ -762,10 +813,6 @@ rrc_ue_establish_drb(
     LOG_D(RRC,"[UE %d] State = Attached (eNB %d)\n",ue_mod_idP,eNB_index);
   }
 
-#    else
-#        ifdef OAI_EMU
-  oai_emulation.info.oai_ifup[ue_mod_idP]=1;
-#        endif
 #    endif
 #endif
 
@@ -1540,17 +1587,6 @@ rrc_ue_process_radioResourceConfigDedicated(
   
   UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_CONNECTED;
   LOG_I(RRC,"[UE %d] State = RRC_CONNECTED (eNB %d)\n",ctxt_pP->module_id,eNB_index);
-#if !defined(ENABLE_USE_MME) && defined(OAI_EMU)
-#    ifdef OAI_EMU
-  rrc_eNB_emulation_notify_ue_module_id(
-    ctxt_pP->module_id,
-    ctxt_pP->rnti,
-    UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->cellAccessRelatedInfo.cellIdentity.buf[0],
-    UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->cellAccessRelatedInfo.cellIdentity.buf[1],
-    UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->cellAccessRelatedInfo.cellIdentity.buf[2],
-    UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->cellAccessRelatedInfo.cellIdentity.buf[3]);
-#    endif /* OAI_EMU */
-#endif
 }
 
 
@@ -1691,48 +1727,49 @@ rrc_ue_process_securityModeCommand(
 #endif //#if defined(ENABLE_SECURITY)
 
   if (securityModeCommand->criticalExtensions.present == SecurityModeCommand__criticalExtensions_PR_c1) {
-    if (securityModeCommand->criticalExtensions.choice.c1.present == SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8) {
-
-      ul_dcch_msg.message.choice.c1.choice.securityModeComplete.rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier;
-      ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1;
-      ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.choice.securityModeComplete_r8.nonCriticalExtension =NULL;
-
-      LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d)\n",
-            ctxt_pP->module_id,ctxt_pP->frame,eNB_index);
-
-      enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
-                                       (void*)&ul_dcch_msg,
-                                       buffer,
-                                       100);
-      AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
-                   enc_rval.failed_type->name, enc_rval.encoded);
-
+    if (securityModeCommand->criticalExtensions.choice.c1.present != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8)
+      LOG_W(RRC,"securityModeCommand->criticalExtensions.choice.c1.present (%d) != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8\n",
+	    securityModeCommand->criticalExtensions.choice.c1.present);
+    
+    
+    ul_dcch_msg.message.choice.c1.choice.securityModeComplete.rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier;
+    ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1;
+    ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.choice.securityModeComplete_r8.nonCriticalExtension =NULL;
+    
+    LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d)\n",
+	  ctxt_pP->module_id,ctxt_pP->frame,eNB_index);
+    
+    enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
+				     (void*)&ul_dcch_msg,
+				     buffer,
+				     100);
+    AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
+		 enc_rval.failed_type->name, enc_rval.encoded);
+    
 #ifdef XER_PRINT
-      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
+    xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
 #endif
-
+    
 #if defined(ENABLE_ITTI)
 # if !defined(DISABLE_XER_SPRINT)
-      {
-        char        message_string[20000];
-        size_t      message_string_size;
-
-        if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
-          MessageDef *msg_p;
-
-          msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
-          msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
-          memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
-
-          itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-        }
+    {
+      char        message_string[20000];
+      size_t      message_string_size;
+      
+      if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
+	MessageDef *msg_p;
+	
+	msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
+	msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
+	memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
+	
+	itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
       }
+    }
 # endif
 #endif
 
-#ifdef USER_MODE
       LOG_D(RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
-#endif
 
       for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) {
         LOG_T(RRC, "%02x.", buffer[i]);
@@ -1748,7 +1785,9 @@ rrc_ue_process_securityModeCommand(
 		    buffer,
 		    PDCP_TRANSMISSION_MODE_CONTROL);
     }
-  }
+    
+  else LOG_W(RRC,"securityModeCommand->criticalExtensions.present (%d) != SecurityModeCommand__criticalExtensions_PR_c1\n",
+	     securityModeCommand->criticalExtensions.present);
 }
 
 //-----------------------------------------------------------------------------
@@ -1792,68 +1831,71 @@ rrc_ue_process_ueCapabilityEnquiry(
   // ue_CapabilityRAT_Container.ueCapabilityRAT_Container.size = UE_rrc_inst[ue_mod_idP].UECapability_size;
 
 
-  if (UECapabilityEnquiry->criticalExtensions.present == UECapabilityEnquiry__criticalExtensions_PR_c1) {
-    if (UECapabilityEnquiry->criticalExtensions.choice.c1.present == UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8) {
-      ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present           = UECapabilityInformation__criticalExtensions_PR_c1;
-      ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.present =
-        UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8;
-      ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count
-        =0;
-
-      for (i=0; i<UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count; i++) {
-
-        if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i]
-            == RAT_Type_eutra) {
-          ASN_SEQUENCE_ADD(
-            &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list,
-            &ue_CapabilityRAT_Container);
-
-          enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100);
-          AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
-                       enc_rval.failed_type->name, enc_rval.encoded);
+  AssertFatal(UECapabilityEnquiry->criticalExtensions.present == UECapabilityEnquiry__criticalExtensions_PR_c1,
+	      "UECapabilityEnquiry->criticalExtensions.present (%d) != UECapabilityEnquiry__criticalExtensions_PR_c1 (%d)\n",
+	      UECapabilityEnquiry->criticalExtensions.present,UECapabilityEnquiry__criticalExtensions_PR_c1);
 
+  if (UECapabilityEnquiry->criticalExtensions.choice.c1.present != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8)
+    LOG_W(RRC,"UECapabilityEnquiry->criticalExtensions.choice.c1.present (%d) != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8)\n",
+	  UECapabilityEnquiry->criticalExtensions.choice.c1.present);
+  
+  ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present           = UECapabilityInformation__criticalExtensions_PR_c1;
+  ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.present =
+    UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8;
+  ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count
+    =0;
+  
+  for (i=0; i<UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count; i++) {
+    
+    if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i]
+	== RAT_Type_eutra) {
+      ASN_SEQUENCE_ADD(
+		       &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list,
+		       &ue_CapabilityRAT_Container);
+      
+      enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100);
+      AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
+		   enc_rval.failed_type->name, enc_rval.encoded);
+      
 #ifdef XER_PRINT
-          xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
+      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg);
 #endif
-
+      
 #if defined(ENABLE_ITTI)
 # if !defined(DISABLE_XER_SPRINT)
-          {
-            char        message_string[20000];
-            size_t      message_string_size;
-
-            if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
-              MessageDef *msg_p;
-
-              msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
-              msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
-              memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
-
-              itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-            }
-          }
+      {
+	char        message_string[20000];
+	size_t      message_string_size;
+	
+	if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
+	  MessageDef *msg_p;
+	  
+	  msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
+	  msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
+	  memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
+	  
+	  itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+	}
+      }
 # endif
 #endif
+	
 
-#ifdef USER_MODE
           LOG_D(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
 
           for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) {
             LOG_T(RRC, "%02x.", buffer[i]);
           }
-
-          LOG_T(RRC, "\n");
-          rrc_data_req (
-			ctxt_pP,
-			DCCH,
-			rrc_mui++,
-			SDU_CONFIRM_NO,
-			(enc_rval.encoded + 7) / 8,
-			buffer,
-			PDCP_TRANSMISSION_MODE_CONTROL);
-        }
-      }
+      
+      LOG_T(RRC, "\n");
+      rrc_data_req_ue (
+		    ctxt_pP,
+		    DCCH,
+		    rrc_mui++,
+		    SDU_CONFIRM_NO,
+		    (enc_rval.encoded + 7) / 8,
+		    buffer,
+		    PDCP_TRANSMISSION_MODE_CONTROL);
     }
   }
 }
@@ -2604,7 +2646,7 @@ static const char* SIB2mac_ContentionResolutionTimer( long value )
 }
 static const char* SIB2modificationPeriodCoeff( long value )
 {
-  static char temp[4] = {0};
+  static char temp[32] = {0};
 
   if (value < 0 || value > 3)
     return "ERR";
@@ -2614,7 +2656,7 @@ static const char* SIB2modificationPeriodCoeff( long value )
 }
 static const char* SIB2defaultPagingCycle( long value )
 {
-  static char temp[6] = {0};
+  static char temp[32] = {0};
 
   if (value < 0 || value > 3)
     return "ERR";
@@ -4246,10 +4288,6 @@ static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_i
 
 #endif // rel10
 
-#ifndef USER_MODE
-EXPORT_SYMBOL(Rlc_info_am_config);
-#endif
-
 #if defined(ENABLE_ITTI)
 //-----------------------------------------------------------------------------
 void *rrc_ue_task( void *args_p )
@@ -4274,6 +4312,7 @@ void *rrc_ue_task( void *args_p )
 
     switch (ITTI_MSG_ID(msg_p)) {
     case TERMINATE_MESSAGE:
+      LOG_W(RRC, " *** Exiting RRC thread\n");
       itti_exit_task ();
       break;
 
@@ -4540,7 +4579,7 @@ void *rrc_ue_task( void *args_p )
       // check if SRB2 is created, if yes request data_req on DCCH1 (SRB2) 
       if(UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL)
       {
-          rrc_data_req (&ctxt,
+          rrc_data_req_ue (&ctxt,
                   DCCH,
                   rrc_mui++,
                   SDU_CONFIRM_NO,
@@ -4549,7 +4588,7 @@ void *rrc_ue_task( void *args_p )
       }
       else
       {
-          rrc_data_req (&ctxt,
+          rrc_data_req_ue (&ctxt,
                   DCCH1,
                   rrc_mui++,
                   SDU_CONFIRM_NO,
@@ -4792,3 +4831,117 @@ rrc_top_cleanup_ue(
   
 
 }
+
+
+//-----------------------------------------------------------------------------
+RRC_status_t
+rrc_rx_tx_ue(
+  protocol_ctxt_t* const ctxt_pP,
+  const uint8_t      enb_indexP,
+  const int          CC_id
+)
+//-----------------------------------------------------------------------------
+{
+
+#ifdef LOCALIZATION
+  double                         estimated_distance;
+  protocol_ctxt_t                ctxt;
+#endif
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
+
+    // check timers
+
+    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
+      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
+        LOG_D(RRC,
+              "[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
+
+      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
+          == T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
+        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
+        // ALLOW CCCH to be used
+        UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
+        rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
+        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+        return (RRC_ConnSetup_failed);
+      }
+
+      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
+    }
+
+    if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
+      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
+          == N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
+	LOG_I(RRC,"Activating T310\n");
+        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
+      }
+    } else { // in case we have not received SIB2 yet
+      /*      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
+        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
+
+	}*/
+      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+      return RRC_OK;
+    }
+
+    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
+      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
+          == N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
+        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
+        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
+      }
+
+      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
+        LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
+      }
+
+      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt    == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
+        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
+        rrc_t310_expiration (ctxt_pP, enb_indexP);
+        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+	LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n"); 
+        return RRC_PHY_RESYNCH;
+      }
+
+      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
+    }
+
+    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
+      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
+        LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
+              UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
+
+      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
+        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
+        UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
+        LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
+              ctxt_pP->module_id);
+        //Implement 36.331, section 5.3.5.6 here
+        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+        return(RRC_Handover_failed);
+      }
+
+      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
+    }
+
+    // Layer 3 filtering of RRC measurements
+    if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
+      ue_meas_filtering(ctxt_pP,enb_indexP);
+    }
+
+    ue_measurement_report_triggering(ctxt_pP,enb_indexP);
+
+    if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
+      LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
+    }
+
+    if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION)   &&
+        (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
+      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
+      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+      return(RRC_HO_STARTED);
+    }
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+  return (RRC_OK);
+}
diff --git a/openair2/RRC/LITE/rrc_UE_ral.c b/openair2/RRC/LITE/rrc_UE_ral.c
index be327551db492816c36c63c762135433807637ad..0cb0943fcb67122d1e09fe45845c52aed9e7fd54 100644
--- a/openair2/RRC/LITE/rrc_UE_ral.c
+++ b/openair2/RRC/LITE/rrc_UE_ral.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/LITE/rrc_UE_ral.h b/openair2/RRC/LITE/rrc_UE_ral.h
index d403ba112b0f679a624d9b93ccea2afa3bee061d..e2b4a3dadb5debaaaf005ec143bb04ee505bd37d 100644
--- a/openair2/RRC/LITE/rrc_UE_ral.h
+++ b/openair2/RRC/LITE/rrc_UE_ral.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c
index 5c9d06f98630effb5175fd414decdd1c5953d20f..a6a2bbb613b8f2d46a554b422ca2cab4f78bbaac 100644
--- a/openair2/RRC/LITE/rrc_common.c
+++ b/openair2/RRC/LITE/rrc_common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -53,42 +53,6 @@ extern UE_MAC_INST *UE_mac_inst;
 
 extern mui_t rrc_eNB_mui;
 
-//configure  BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
-//-----------------------------------------------------------------------------
-void
-openair_rrc_on(
-  const protocol_ctxt_t* const ctxt_pP
-)
-//-----------------------------------------------------------------------------
-{
-  unsigned short i;
-  int            CC_id;
-
-  if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
-    LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" OPENAIR RRC IN....\n",
-          PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
-    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
-      rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
-      RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
-      rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
-      RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
-    }
-  } else {
-    LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" OPENAIR RRC IN....\n",
-          PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
-
-    for (i = 0; i < NB_eNB_INST; i++) {
-      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n",
-            PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i);
-      UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH;
-      memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
-      memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
-      rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1);
-      UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1;
-    }
-  }
-}
-
 //-----------------------------------------------------------------------------
 int
 rrc_init_global_param(
@@ -97,9 +61,7 @@ rrc_init_global_param(
 //-----------------------------------------------------------------------------
 {
 
-  //#ifdef USER_MODE
   //  Rrc_xface = (RRC_XFACE*)malloc16(sizeof(RRC_XFACE));
-  //#endif //USRE_MODE
 
   //  Rrc_xface->openair_rrc_top_init = openair_rrc_top_init;
   //  Rrc_xface->openair_rrc_eNB_init = openair_rrc_eNB_init;
@@ -170,241 +132,6 @@ rrc_config_buffer(
 }
 
 
-//-----------------------------------------------------------------------------
-void
-rrc_t310_expiration(
-  const protocol_ctxt_t* const ctxt_pP,
-  const uint8_t                 eNB_index
-)
-//-----------------------------------------------------------------------------
-{
-
-  if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
-    LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
-    UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
-    UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].UE_index = 0xffff;
-    UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Rx_buffer.payload_size = 0;
-    UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = 0;
-    UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Rx_buffer.payload_size = 0;
-    UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size = 0;
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) {
-      msg ("[RRC Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index,
-           UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
-      rrc_pdcp_config_req (ctxt_pP,
-                           SRB_FLAG_YES,
-                           CONFIG_ACTION_REMOVE,
-                           UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
-                           0);
-      rrc_rlc_config_req (ctxt_pP,
-                          SRB_FLAG_YES,
-                          MBMS_FLAG_NO,
-                          CONFIG_ACTION_REMOVE,
-                          UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
-                          Rlc_info_um);
-      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0;
-      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Status = IDLE;
-      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0;
-    }
-  } else { // Restablishment procedure
-    LOG_D(RRC, "Timer 310 expired, trying RRCRestablishment ...\n");
-  }
-}
-
-//-----------------------------------------------------------------------------
-RRC_status_t
-rrc_rx_tx(
-  protocol_ctxt_t* const ctxt_pP,
-  const uint8_t      enb_indexP,
-  const int          CC_id
-)
-//-----------------------------------------------------------------------------
-{
-  //uint8_t        UE_id;
-  int32_t        current_timestamp_ms, ref_timestamp_ms;
-  struct timeval ts;
-  struct rrc_eNB_ue_context_s   *ue_context_p = NULL,*ue_to_be_removed = NULL;
-
-#ifdef LOCALIZATION
-  double                         estimated_distance;
-  protocol_ctxt_t                ctxt;
-#endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
-
-  if(ctxt_pP->enb_flag == ENB_FLAG_NO) {
-    // check timers
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
-      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
-        LOG_D(RRC,
-              "[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
-
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
-          == T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
-        // ALLOW CCCH to be used
-        UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
-        rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
-        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-        return (RRC_ConnSetup_failed);
-      }
-
-      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
-    }
-
-    if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
-          == N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
-	LOG_I(RRC,"Activating T310\n");
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
-      }
-    } else { // in case we have not received SIB2 yet
-      /*      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
-
-	}*/
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-      return RRC_OK;
-    }
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
-          == N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
-      }
-
-      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
-        LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
-      }
-
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt    == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
-        rrc_t310_expiration (ctxt_pP, enb_indexP);
-        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-	LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n"); 
-        return RRC_PHY_RESYNCH;
-      }
-
-      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
-    }
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
-      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
-        LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
-              UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
-
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
-        UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
-        LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
-              ctxt_pP->module_id);
-        //Implement 36.331, section 5.3.5.6 here
-        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-        return(RRC_Handover_failed);
-      }
-
-      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
-    }
-
-    // Layer 3 filtering of RRC measurements
-    if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
-      ue_meas_filtering(ctxt_pP,enb_indexP);
-    }
-
-    ue_measurement_report_triggering(ctxt_pP,enb_indexP);
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
-      LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
-    }
-
-    if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION)   &&
-        (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
-      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-      return(RRC_HO_STARTED);
-    }
-
-  } else { // eNB
-    check_handovers(ctxt_pP);
-    // counetr, and get the value and aggregate
-
-    // check for UL failure
-    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
-      if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
-	if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
-	  LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n",
-		ue_context_p->ue_context.rnti,
-		ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
-		ue_context_p->ue_context.ul_failure_timer);
-	}
-	else {
-	  LOG_I(RRC,"UE rnti %x failure timer %d/20000\n",
-		ue_context_p->ue_context.rnti,
-		ue_context_p->ue_context.ul_failure_timer);
-	}
-      }
-      if (ue_context_p->ue_context.ul_failure_timer>0) {
-	ue_context_p->ue_context.ul_failure_timer++;
-	if (ue_context_p->ue_context.ul_failure_timer >= 20000) {
-	  // remove UE after 20 seconds after MAC has indicated UL failure
-	  LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
-	  ue_to_be_removed = ue_context_p;
-	  break;
-	}
-      }
-      if (ue_context_p->ue_context.ue_release_timer>0) {
-	ue_context_p->ue_context.ue_release_timer++;
-	if (ue_context_p->ue_context.ue_release_timer >= 
-	    ue_context_p->ue_context.ue_release_timer_thres) {
-	  LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
-	  ue_to_be_removed = ue_context_p;
-	  break;
-	}
-      }
-    }
-    if (ue_to_be_removed)
-      rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
-
-#ifdef RRC_LOCALIZATION
-
-    /* for the localization, only primary CC_id might be relevant*/
-    gettimeofday(&ts, NULL);
-    current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
-    ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms;
-    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
-      ctxt = *ctxt_pP;
-      ctxt.rnti = ue_context_p->ue_context.rnti;
-      estimated_distance = rrc_get_estimated_ue_distance(
-                             &ctxt,
-                             CC_id,
-                             RC.rrc[ctxt_pP->module_id]->loc_type);
-
-      if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) &&
-          estimated_distance != -1) {
-        LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
-              ctxt.rnti,
-              ctxt_pP->module_id,
-              current_timestamp_ms,
-              ctxt_pP->frame,
-              estimated_distance);
-        LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status);
-        push_front(&RC.rrc[ctxt_pP->module_id]->loc_list,
-                   estimated_distance);
-        RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
-      }
-    }
-
-#endif
-    (void)ts; /* remove gcc warning "unused variable" */
-    (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
-    (void)current_timestamp_ms; /* remove gcc warning "unused variable" */
-  }
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-  return (RRC_OK);
-}
-
 //-----------------------------------------------------------------------------
 long
 binary_search_int(
@@ -490,3 +217,110 @@ binary_search_float(
   return first;
 }
 
+typedef enum { BAND_TYPE_FDD, BAND_TYPE_TDD } band_type;
+
+typedef struct {
+  band_type t;
+  int band;
+  unsigned long ul_minfreq, ul_maxfreq;
+  unsigned long dl_minfreq, dl_maxfreq;
+} band_freq;
+
+static band_freq bands[] = {
+  { BAND_TYPE_FDD, 1, 1920000000UL, 1980000000UL, 2110000000UL, 2170000000UL },
+  { BAND_TYPE_FDD, 2, 1850000000UL, 1910000000UL, 1930000000UL, 1990000000UL },
+  { BAND_TYPE_FDD, 3, 1710000000UL, 1785000000UL, 1805000000UL, 1880000000UL },
+  { BAND_TYPE_FDD, 4, 1710000000UL, 1755000000UL, 2110000000UL, 2155000000UL },
+  { BAND_TYPE_FDD, 5, 824000000UL, 849000000UL, 869000000UL, 894000000UL },
+    /* to remove? */{ BAND_TYPE_FDD, 6, 830000000UL, 840000000UL, 875000000UL, 885000000UL },
+  { BAND_TYPE_FDD, 7, 2500000000UL, 2570000000UL, 2620000000UL, 2690000000UL },
+  { BAND_TYPE_FDD, 8, 880000000UL, 915000000UL, 925000000UL, 960000000UL },
+  { BAND_TYPE_FDD, 9, 1749900000UL, 1784900000UL, 1844900000UL, 1879900000UL },
+  { BAND_TYPE_FDD, 10, 1710000000UL, 1770000000UL, 2110000000UL, 2170000000UL },
+  { BAND_TYPE_FDD, 11, 1427900000UL, 1447900000UL, 1475900000UL, 1495900000UL },
+  { BAND_TYPE_FDD, 12, 699000000UL, 716000000UL, 729000000UL, 746000000UL },
+  { BAND_TYPE_FDD, 13, 777000000UL, 787000000UL, 746000000UL, 756000000UL },
+  { BAND_TYPE_FDD, 14, 788000000UL, 798000000UL, 758000000UL, 768000000UL },
+  { BAND_TYPE_FDD, 17, 704000000UL, 716000000UL, 734000000UL, 746000000UL },
+  { BAND_TYPE_FDD, 18, 815000000UL, 830000000UL, 860000000UL, 875000000UL },
+  { BAND_TYPE_FDD, 19, 830000000UL, 845000000UL, 875000000UL, 890000000UL },
+  { BAND_TYPE_FDD, 20, 832000000UL, 862000000UL, 791000000UL, 821000000UL },
+  { BAND_TYPE_FDD, 21, 1447900000UL, 1462900000UL, 1495900000UL, 1510900000UL },
+  { BAND_TYPE_FDD, 22, 3410000000UL, 3490000000UL, 3510000000UL, 3590000000UL },
+  { BAND_TYPE_FDD, 23, 2000000000UL, 2020000000UL, 2180000000UL, 2200000000UL },
+  { BAND_TYPE_FDD, 24, 1626500000UL, 1660500000UL, 1525000000UL, 1559000000UL },
+  { BAND_TYPE_FDD, 25, 1850000000UL, 1915000000UL, 1930000000UL, 1995000000UL },
+
+  { BAND_TYPE_TDD, 33, 1900000000UL, 1920000000UL, 1900000000UL, 1920000000UL },
+  { BAND_TYPE_TDD, 34, 2010000000UL, 2025000000UL, 2010000000UL, 2025000000UL },
+  { BAND_TYPE_TDD, 35, 1850000000UL, 1910000000UL, 1850000000UL, 1910000000UL },
+  { BAND_TYPE_TDD, 36, 1930000000UL, 1990000000UL, 1930000000UL, 1990000000UL },
+  { BAND_TYPE_TDD, 37, 1910000000UL, 1930000000UL, 1910000000UL, 1930000000UL },
+  { BAND_TYPE_TDD, 38, 2570000000UL, 2620000000UL, 2570000000UL, 2620000000UL },
+  { BAND_TYPE_TDD, 39, 1880000000UL, 1920000000UL, 1880000000UL, 1920000000UL },
+  { BAND_TYPE_TDD, 40, 2300000000UL, 2400000000UL, 2300000000UL, 2400000000UL },
+  { BAND_TYPE_TDD, 41, 2496000000UL, 2690000000UL, 2496000000UL, 2690000000UL },
+  { BAND_TYPE_TDD, 42, 3400000000UL, 3600000000UL, 3400000000UL, 3600000000UL },
+  { BAND_TYPE_TDD, 43, 3600000000UL, 3800000000UL, 3600000000UL, 3800000000UL },
+};
+
+typedef struct {
+  int band;
+  unsigned long dl_flow;
+  int dl_off;
+  int dl_offmin, dl_offmax;
+  unsigned long ul_flow;
+  int ul_off;
+  int ul_offmin, ul_offmax;
+} earfcn;
+
+static earfcn earfcn_table[] = {
+  { 1, 2110000000UL, 0, 0, 599, 1920000000UL, 18000, 18000, 18599 },
+  { 2, 1930000000UL, 600, 600, 1199, 1850000000UL, 18600, 18600, 19199 },
+  { 3, 1805000000UL, 1200, 1200, 1949, 1710000000UL, 19200, 19200, 19949 },
+  { 4, 2110000000UL, 1950, 1950, 2399, 1710000000UL, 19950, 19950, 20399 },
+  { 5, 869000000UL, 2400, 2400, 2649, 824000000UL, 20400, 20400, 20649 },
+  { 6, 875000000UL, 2650, 2650, 2749, 830000000UL, 20650, 20650, 20749 },
+  { 7, 2620000000UL, 2750, 2750, 3449, 2500000000UL, 20750, 20750, 21449 },
+  { 8, 925000000UL, 3450, 3450, 3799, 880000000UL, 21450, 21450, 21799 },
+  { 9, 1844900000UL, 3800, 3800, 4149, 1749900000UL, 21800, 21800, 22149 },
+  { 10, 2110000000UL, 4150, 4150, 4749, 1710000000UL, 22150, 22150, 22749 },
+  { 11, 1475900000UL, 4750, 4750, 4949, 1427900000UL, 22750, 22750, 22949 },
+  { 12, 729000000UL, 5010, 5010, 5179, 699000000UL, 23010, 23010, 23179 },
+  { 13, 746000000UL, 5180, 5180, 5279, 777000000UL, 23180, 23180, 23279 },
+  { 14, 758000000UL, 5280, 5280, 5379, 788000000UL, 23280, 23280, 23379 },
+  { 17, 734000000UL, 5730, 5730, 5849, 704000000UL, 23730, 23730, 23849 },
+  { 18, 860000000UL, 5850, 5850, 5999, 815000000UL, 23850, 23850, 23999 },
+  { 19, 875000000UL, 6000, 6000, 6149, 830000000UL, 24000, 24000, 24149 },
+  { 20, 791000000UL, 6150, 6150, 6449, 832000000UL, 24150, 24150, 24449 },
+  { 21, 1495900000UL, 6450, 6450, 6599, 1447900000UL, 24450, 24450, 24599 },
+  { 22, 3510000000UL, 6600, 6600, 7399, 3410000000UL, 24600, 24600, 25399 },
+  { 23, 2180000000UL, 7500, 7500, 7699, 2000000000UL, 25500, 25500, 25699 },
+  { 24, 1525000000UL, 7700, 7700, 8039, 1626500000UL, 25700, 25700, 26039 },
+  { 25, 1930000000UL, 8040, 8040, 8689, 1850000000UL, 26040, 26040, 26689 },
+  { 33, 1900000000UL, 36000, 36000, 36199, 1900000000UL, 36000, 36000, 36199 },
+  { 34, 2010000000UL, 36200, 36200, 36349, 2010000000UL, 36200, 36200, 36349 },
+  { 35, 1850000000UL, 36350, 36350, 36949, 1850000000UL, 36350, 36350, 36949 },
+  { 36, 1930000000UL, 36950, 36950, 37549, 1930000000UL, 36950, 36950, 37549 },
+  { 37, 1910000000UL, 37550, 37550, 37749, 1910000000UL, 37550, 37550, 37749 },
+  { 38, 2570000000UL, 37750, 37750, 38249, 2570000000UL, 37750, 37750, 38249 },
+  { 39, 1880000000UL, 38250, 38250, 38649, 1880000000UL, 38250, 38250, 38649 },
+  { 40, 2300000000UL, 38650, 38650, 39649, 2300000000UL, 38650, 38650, 39649 },
+  { 41, 2496000000UL, 39650, 39650, 41589, 2496000000UL, 39650, 39650, 41589 },
+  { 42, 3400000000UL, 41590, 41590, 43589, 3400000000UL, 41590, 41590, 43589 },
+  { 43, 3600000000UL, 43590, 43590, 45589, 3600000000UL, 43590, 43590, 45589 },
+};
+  
+int freq_to_arfcn10(int band, unsigned long freq)
+{ 
+  int N = sizeof(earfcn_table) / sizeof(earfcn_table[0]); 
+  int i;
+  
+  for (i = 0; i < N; i++) if (bands[i].band == band) break; 
+  if (i == N) return -1;
+  
+  if (!(bands[i].dl_minfreq < freq && freq < bands[i].dl_maxfreq))
+    return -1;
+  
+  return (freq - earfcn_table[i].dl_flow) / 100000UL + earfcn_table[i].dl_off;
+}
diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c
index fde39dc977edd3b42ec35bcec7bed4ac4dc9b959..9faa686ef6532afafa413a9c5f4ae633940dcff7 100644
--- a/openair2/RRC/LITE/rrc_eNB.c
+++ b/openair2/RRC/LITE/rrc_eNB.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -56,6 +56,7 @@
 #include "rrc_eNB_UE_context.h"
 #include "platform_types.h"
 #include "msc.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
 
 #include "T.h"
 
@@ -63,12 +64,10 @@
 #include "MeasResults.h"
 //#endif
 
-#ifdef USER_MODE
-#   include "RRC/NAS/nas_config.h"
-#   include "RRC/NAS/rb_config.h"
-#   include "OCG.h"
-#   include "OCG_extern.h"
-#endif
+#include "RRC/NAS/nas_config.h"
+#include "RRC/NAS/rb_config.h"
+#include "OCG.h"
+#include "OCG_extern.h"
 
 #if defined(ENABLE_SECURITY)
 #   include "UTIL/OSA/osa_defs.h"
@@ -84,6 +83,7 @@
 #endif
 
 #include "pdcp.h"
+#include "gtpv1u_eNB_task.h"
 
 #if defined(ENABLE_ITTI)
 #   include "intertask_interface.h"
@@ -95,9 +95,6 @@
 
 #include "SIMULATION/TOOLS/defs.h" // for taus
 
-#if defined(FLEXRAN_AGENT_SB_IF)
-#include "flexran_agent_extern.h"
-#endif
 //#define XER_PRINT
 
 extern RAN_CONTEXT_t RC;
@@ -115,6 +112,24 @@ extern uint16_t                     two_tier_hexagonal_cellIds[7];
 
 mui_t                               rrc_eNB_mui = 0;
 
+void
+openair_rrc_on(
+  const protocol_ctxt_t* const ctxt_pP
+)
+//-----------------------------------------------------------------------------
+{
+  int            CC_id;
+
+    LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" ENB:OPENAIR RRC IN....\n",
+          PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+      rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
+      RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
+      rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
+      RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
+    }
+}
+
 //-----------------------------------------------------------------------------
 static void
 init_SI(
@@ -135,6 +150,8 @@ init_SI(
   SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext=(SystemInformationBlockType1_v1310_IEs_t *)NULL;
 #endif
 
+  LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
+
   RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4);
   // copy basic parameters
   RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId      = configuration->Nid_cell[CC_id];
@@ -282,6 +299,8 @@ init_SI(
   }
 #endif
 
+  LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n");
+
   rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id,
 			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId,
 			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB,
@@ -393,7 +412,9 @@ init_MCCH(
 			 0,//rnti
 			 (BCCH_BCH_Message_t *)NULL,
 			 (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
 			 (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
 			 (struct PhysicalConfigDedicated *)NULL,
 #if defined(Rel10) || defined(Rel14)
 			 (SCellToAddMod_r10_t *)NULL,
@@ -571,6 +592,7 @@ rrc_eNB_get_next_free_ue_context(
 					ctxt_pP->rnti);
 
   if (ue_context_p == NULL) {
+#if 0
     RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
       if (ue_context_p->ue_context.random_ue_identity == ue_identityP) {
         LOG_D(RRC,
@@ -581,6 +603,7 @@ rrc_eNB_get_next_free_ue_context(
         return NULL;
       }
     }
+#endif
     ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]);
 
     if (ue_context_p == NULL) {
@@ -608,7 +631,7 @@ rrc_eNB_get_next_free_ue_context(
   }
 }
 
-#if !defined(ENABLE_USE_MME)
+#if 0 //!defined(ENABLE_USE_MME)
 void rrc_eNB_emulation_notify_ue_module_id(
   const module_id_t ue_module_idP,
   const rnti_t      rntiP,
@@ -679,11 +702,29 @@ rrc_eNB_free_mem_UE_context(
     ue_context_pP->ue_context.SRB_configList = NULL;
   }
 
+  for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){
+      if (ue_context_pP->ue_context.SRB_configList2[i]) {
+          free(ue_context_pP->ue_context.SRB_configList2[i]);
+          ue_context_pP->ue_context.SRB_configList2[i] = NULL;
+      }
+  }
+
   if (ue_context_pP->ue_context.DRB_configList) {
     ASN_STRUCT_FREE(asn_DEF_DRB_ToAddModList, ue_context_pP->ue_context.DRB_configList);
     ue_context_pP->ue_context.DRB_configList = NULL;
   }
 
+  for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){
+      if (ue_context_pP->ue_context.DRB_configList2[i]) {
+          free(ue_context_pP->ue_context.DRB_configList2[i]);
+          ue_context_pP->ue_context.DRB_configList2[i] = NULL;
+      }
+      if (ue_context_pP->ue_context.DRB_Release_configList2[i]) {
+          free(ue_context_pP->ue_context.DRB_Release_configList2[i]);
+          ue_context_pP->ue_context.DRB_Release_configList2[i] = NULL;
+      }
+  }
+
   memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active));
 
   if (ue_context_pP->ue_context.physicalConfigDedicated) {
@@ -720,10 +761,14 @@ rrc_eNB_free_mem_UE_context(
     ue_context_pP->ue_context.mac_MainConfig = NULL;
   }
 
-  if (ue_context_pP->ue_context.measGapConfig) {
+/*  if (ue_context_pP->ue_context.measGapConfig) {
     ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig);
     ue_context_pP->ue_context.measGapConfig = NULL;
-  }
+  }*/
+    if (ue_context_pP->ue_context.handover_info) {
+      ASN_STRUCT_FREE(asn_DEF_Handover, ue_context_pP->ue_context.handover_info);
+      ue_context_pP->ue_context.handover_info = NULL;
+    }
 
   //SRB_INFO                           SI;
   //SRB_INFO                           Srb0;
@@ -778,7 +823,12 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
   (void)ue_module_id;
 #endif
   rnti_t rnti = ue_context_pP->ue_context.rnti;
-
+  int i, j , CC_id, pdu_number;
+  LTE_eNB_ULSCH_t *ulsch = NULL;
+  LTE_eNB_DLSCH_t *dlsch = NULL;
+  nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
+  PHY_VARS_eNB *eNB_PHY = NULL;
+  eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP];
 
   AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti);
   /*  ue_context_p = rrc_eNB_get_ue_context(
@@ -791,6 +841,8 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
     LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti);
 
 #if defined(ENABLE_USE_MME)
+   if( ue_context_pP->ue_context.ul_failure_timer >= 8 ) {
+	LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti);
     rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost
     /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered)
      * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before
@@ -798,16 +850,47 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
      *  in order to allow the UE to perform the NAS recovery
      *  procedure, see TS 23.401 [17].
      */
-#else
-#if defined(OAI_EMU)
-    AssertFatal(ue_context_pP->local_uid < NUMBER_OF_UE_MAX, "local_uid invalid (%d<%d) for UE %x!", ue_context_pP->local_uid, NUMBER_OF_UE_MAX, rnti);
-    ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_mod_idP][ue_context_pP->local_uid];
-    AssertFatal(ue_module_id < NUMBER_OF_UE_MAX, "ue_module_id invalid (%d<%d) for UE %x!", ue_module_id, NUMBER_OF_UE_MAX, rnti);
-    oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_mod_idP][ue_context_pP->local_uid] = -1;
-    oai_emulation.info.eNB_ue_module_id_to_rnti[enb_mod_idP][ue_module_id] = NOT_A_RNTI;
-#endif
+     return;
+    }
 #endif
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+      eNB_PHY = RC.eNB[enb_mod_idP][CC_id];
+      for (i=0; i<NUMBER_OF_UE_MAX; i++) {
+        ulsch = eNB_PHY->ulsch[i];
+        if((ulsch != NULL) && (ulsch->rnti == rnti)){
+          LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti);
+          clean_eNb_ulsch(ulsch);
+        }
+      }
+      for (i=0; i<NUMBER_OF_UE_MAX; i++) {
+        dlsch = eNB_PHY->dlsch[i][0];
+        if((dlsch != NULL) && (dlsch->rnti == rnti)){
+          LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti);
+          clean_eNb_dlsch(dlsch);
+        }
+      }
+
+      if (rrc_agent_registered[enb_mod_idP]) {
+        agent_rrc_xface[enb_mod_idP]->flexran_agent_notify_ue_state_change(enb_mod_idP,
+                              rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+      }
 
+      for(j = 0; j < 10; j++){
+        ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
+        if(ul_req_tmp){
+          pdu_number = ul_req_tmp->number_of_pdus;
+          for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
+            if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){
+              LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number);
+              if(pdu_index < pdu_number -1){
+                memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
+              }
+              ul_req_tmp->number_of_pdus--;
+            }
+          }
+        }
+      }
+    }
     rrc_mac_remove_ue(enb_mod_idP,rnti);
     rrc_rlc_remove_ue(&ctxt);
     pdcp_remove_UE(&ctxt);
@@ -1023,222 +1106,1250 @@ rrc_eNB_generate_RRCConnectionReject(
 
 //-----------------------------------------------------------------------------
 void
-rrc_eNB_generate_RRCConnectionReestablishmentReject(
-  const protocol_ctxt_t* const ctxt_pP,
+rrc_eNB_generate_RRCConnectionReestablishment(
+  const protocol_ctxt_t*         const ctxt_pP,
   rrc_eNB_ue_context_t*          const ue_context_pP,
-  const int                    CC_id
+  const int                            CC_id
 )
 //-----------------------------------------------------------------------------
 {
-#ifdef RRC_MSG_PRINT
+  LogicalChannelConfig_t             *SRB1_logicalChannelConfig;
+  SRB_ToAddModList_t                 **SRB_configList;
+  SRB_ToAddMod_t                     *SRB1_config;
   int                                 cnt;
-#endif
 
-  T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+  T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
     T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
 
+  SRB_configList = &ue_context_pP->ue_context.SRB_configList;
   RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
-    do_RRCConnectionReestablishmentReject(ctxt_pP->module_id,
-                          (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload);
+    do_RRCConnectionReestablishment(ctxt_pP,
+                                    ue_context_pP,
+                                    CC_id,
+                                    (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
+                                    (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
+                                    rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
+                                    SRB_configList,
+                                    &ue_context_pP->ue_context.physicalConfigDedicated);
 
 #ifdef RRC_MSG_PRINT
-  LOG_F(RRC,"[MSG] RRCConnectionReestablishmentReject\n");
+  LOG_F(RRC,"[MSG] RRCConnectionReestablishment\n");
 
   for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) {
-    LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]);
+    LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]);
   }
 
   LOG_F(RRC,"\n");
 #endif
 
-  MSC_LOG_TX_MESSAGE(
-    MSC_RRC_ENB,
-    MSC_RRC_UE,
-    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
-    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
-    MSC_AS_TIME_FMT" RRCConnectionReestablishmentReject UE %x size %u",
-    MSC_AS_TIME_ARGS(ctxt_pP),
-    ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti,
-    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+  // configure SRB1 for UE
 
-  LOG_I(RRC,
-        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n",
-        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
-        RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
-}
+  if (*SRB_configList != NULL) {
+    for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) {
+      if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) {
+        SRB1_config = (*SRB_configList)->list.array[cnt];
 
-//-----------------------------------------------------------------------------
-void
-rrc_eNB_generate_RRCConnectionRelease(
-  const protocol_ctxt_t* const ctxt_pP,
-  rrc_eNB_ue_context_t*          const ue_context_pP
-)
-//-----------------------------------------------------------------------------
-{
+        if (SRB1_config->logicalChannelConfig) {
+          if (SRB1_config->logicalChannelConfig->present ==
+              SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
+            SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue;
+          } else {
+            SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+          }
+        } else {
+          SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+        }
 
-  uint8_t                             buffer[RRC_BUF_SIZE];
-  uint16_t                            size;
+        LOG_D(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ  (SRB1) ---> MAC_eNB\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+        rrc_mac_config_req_eNB(ctxt_pP->module_id,
+                           ue_context_pP->ue_context.primaryCC_id,
+                           0,0,0,0,0,
+#ifdef Rel14 
+			 0,
+#endif
+                           ctxt_pP->rnti,
+                           (BCCH_BCH_Message_t *) NULL, 
+                           (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
+                           (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
+                           (struct PhysicalConfigDedicated* ) ue_context_pP->ue_context.physicalConfigDedicated,
+#if defined(Rel10) || defined(Rel14)
+                           (SCellToAddMod_r10_t *)NULL,
+                           //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+                           (MeasObjectToAddMod_t **) NULL,
+                           ue_context_pP->ue_context.mac_MainConfig,
+                           1,
+                           SRB1_logicalChannelConfig,
+                           ue_context_pP->ue_context.measGapConfig,
+                           (TDD_Config_t *) NULL,
+                           NULL,
+                           (SchedulingInfoList_t *) NULL,
+                           0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
+#if defined(Rel10) || defined(Rel14)
+                           , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
+#endif
+#ifdef Rel14
+                           ,(SystemInformationBlockType1_v1310_IEs_t *)NULL 
+#endif
+        );
+        break;
+      }
+    }
+  }
 
-  T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
-    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+  MSC_LOG_TX_MESSAGE(MSC_RRC_ENB,
+                     MSC_RRC_UE,
+                     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
+                     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+                     MSC_AS_TIME_FMT" RRCConnectionReestablishment UE %x size %u",
+                     MSC_AS_TIME_ARGS(ctxt_pP),
+                     ue_context_pP->ue_context.rnti,
+                     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
 
-  memset(buffer, 0, RRC_BUF_SIZE);
 
-  size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id));
-  // set release timer
-  ue_context_pP->ue_context.ue_release_timer=1;
-  // remove UE after 10 frames after RRCConnectionRelease is triggered
-  ue_context_pP->ue_context.ue_release_timer_thres=100;
   LOG_I(RRC,
-        PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n",
-        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
-        size);
-
-  LOG_D(RRC,
-        PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n",
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishment (bytes %d)\n",
         PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
-        size,
-        rrc_eNB_mui,
-        DCCH);
-
-  MSC_LOG_TX_MESSAGE(
-    MSC_RRC_ENB,
-    MSC_RRC_UE,
-    buffer,
-    size,
-    MSC_AS_TIME_FMT" rrcConnectionRelease UE %x MUI %d size %u",
-    MSC_AS_TIME_ARGS(ctxt_pP),
-    ue_context_pP->ue_context.rnti,
-    rrc_eNB_mui,
-    size);
+        RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
 
-  rrc_data_req(
-	       ctxt_pP,
-	       DCCH,
-	       rrc_eNB_mui++,
-	       SDU_CONFIRM_NO,
-	       size,
-	       buffer,
-	       PDCP_TRANSMISSION_MODE_CONTROL);
+  // activate release timer, if RRCComplete not received after 10 frames, remove UE
+  //ue_context_pP->ue_context.ue_release_timer = 1;
+  // remove UE after 10 frames after RRCConnectionReestablishmentRelease is triggered
+  //ue_context_pP->ue_context.ue_release_timer_thres = 100;
+    // activate release timer, if RRCComplete not received after 100 frames, remove UE
+  int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
+  RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1;
+  // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered
+  RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000;
 }
 
-uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9};
-
-// TBD: this directive can be remived if we create a similar e_rab_param_t structure in RRC context
-#if defined(ENABLE_ITTI) 
 //-----------------------------------------------------------------------------
 void
-rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
-						     rrc_eNB_ue_context_t*          const ue_context_pP,
-						     const uint8_t                ho_state
-						     )
+rrc_eNB_process_RRCConnectionReestablishmentComplete(
+  const protocol_ctxt_t* const ctxt_pP,
+  const rnti_t reestablish_rnti,
+  rrc_eNB_ue_context_t*         ue_context_pP,
+  const uint8_t xid,
+  RRCConnectionReestablishmentComplete_r8_IEs_t * rrcConnectionReestablishmentComplete
+)
 //-----------------------------------------------------------------------------
 {
-  
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing RRCConnectionReestablishmentComplete from UE (SRB1 Active)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+
+  T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  DRB_ToAddModList_t*                 DRB_configList = ue_context_pP->ue_context.DRB_configList;
+  SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList;
+  SRB_ToAddModList_t**                SRB_configList2 = NULL;
+  DRB_ToAddModList_t**                DRB_configList2 = NULL;
+  struct SRB_ToAddMod                *SRB2_config = NULL;
+  struct DRB_ToAddMod                *DRB_config = NULL;
+  int i = 0;
+# if defined(ENABLE_USE_MME)
+  int j = 0;
+  hashtable_rc_t                      h_rc;
+#endif
   uint8_t                             buffer[RRC_BUF_SIZE];
   uint16_t                            size;
-  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;
-
+  MeasObjectToAddModList_t           *MeasObj_list                     = NULL;
+  MeasObjectToAddMod_t               *MeasObj                          = NULL;
+  ReportConfigToAddModList_t         *ReportConfig_list                = NULL;
+  ReportConfigToAddMod_t             *ReportConfig_per, *ReportConfig_A1,
+                                     *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
+  MeasIdToAddModList_t               *MeasId_list                      = NULL;
+  MeasIdToAddMod_t                   *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
+  RSRP_Range_t                       *rsrp                             = NULL;
+  struct MeasConfig__speedStatePars  *Sparams                          = NULL;
+  QuantityConfig_t                   *quantityConfig                   = NULL;
+  CellsToAddMod_t                    *CellToAdd                        = NULL;
+  CellsToAddModList_t                *CellsToAddModList                = NULL;
   struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
   DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
   /* for no gcc warnings */
   (void)dedicatedInfoNas;
+  C_RNTI_t                           *cba_RNTI                         = NULL;
+  uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);
+
+  ue_context_pP->ue_context.Status = RRC_CONNECTED;
+
+  SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid];
+  // get old configuration of SRB2
+  if (*SRB_configList2 != NULL) {
+    LOG_D(RRC, "SRB_configList2(%p) count is %d\n           SRB_configList2->list.array[0] addr is %p",
+          SRB_configList2, (*SRB_configList2)->list.count,  (*SRB_configList2)->list.array[0]);
+    for (i = 0; (i < (*SRB_configList2)->list.count) && (i < 3); i++) {
+      if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ){
+        LOG_D(RRC, "get SRB2_config from (ue_context_pP->ue_context.SRB_configList2[%d])\n", xid);
+        SRB2_config = (*SRB_configList2)->list.array[i];
+        break;
+      }
+    }
+  }
+  SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid];
+  DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid];
+
+  if (*SRB_configList2) {
+    free(*SRB_configList2);
+    LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid);
+  }
+  *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
+  if (SRB2_config != NULL) {
+    // Add SRB2 to SRB configuration list
+
+    ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
+    ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
+
+    LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList\n",
+            SRB2_config->srb_Identity);
+    LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList2[%d]\n",
+                SRB2_config->srb_Identity, next_xid);
+  } else {
+    // SRB configuration list only contains SRB1.
+    LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n");
+  }
+
 
-  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);
+    LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid);
   }
-  //*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));
+  *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
 
-  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;
+  if (DRB_configList != NULL) {
+    LOG_D(RRC, "get DRB_config from (ue_context_pP->ue_context.DRB_configList)\n");
+    for (i = 0; (i < DRB_configList->list.count) && (i < 3); i++) {
+      DRB_config = DRB_configList->list.array[i];
+
+      // Add DRB to DRB configuration list, for RRCConnectionReconfigurationComplete
+      ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
     }
-        
-    DRB_config = CALLOC(1, sizeof(*DRB_config));
+  }
+  ue_context_pP->ue_context.Srb1.Active = 1;
+  //ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2;
+
+# if defined(ENABLE_USE_MME)
+  rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL;
+  uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id;
+  uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
+  eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)];
+  if (eNB_ue_s1ap_id > 0) {
+    h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&rrc_ue_s1ap_ids_p);
+    if  (h_rc == HASH_TABLE_OK) {
+      rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
+    }
+  }
+  if (ue_initial_id != 0) {
+    h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&rrc_ue_s1ap_ids_p);
+    if  (h_rc == HASH_TABLE_OK) {
+      rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
+    }
+  }
 
-    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  
+  gtpv1u_enb_create_tunnel_req_t  create_tunnel_req;
 
-    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;  
+  /* Save e RAB information for later */
+  memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req));
 
-    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;
+  for (j = 0, i = 0; i < NB_RB_MAX; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED) {
+      create_tunnel_req.eps_bearer_id[j]       = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
+      create_tunnel_req.sgw_S1u_teid[j]        = ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
 
-    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;
+      memcpy(&create_tunnel_req.sgw_addr[j],
+             &ue_context_pP->ue_context.e_rab[i].param.sgw_addr,
+             sizeof(transport_layer_addr_t));
+      j++;
+    }
+  }
 
+  create_tunnel_req.rnti       = ctxt_pP->rnti; // warning put zero above
+  create_tunnel_req.num_tunnels    = j;
 
-    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
+  gtpv1u_update_s1u_tunnel(
+            ctxt_pP->instance,
+            &create_tunnel_req,
+            reestablish_rnti);
+#endif
+  /* Update RNTI in ue_context */
+  ue_context_pP->ue_id_rnti                    = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else
+  ue_context_pP->ue_context.rnti               = ctxt_pP->rnti;
+# if defined(ENABLE_USE_MME)
+  uint8_t send_security_mode_command = FALSE;
+  rrc_pdcp_config_security(
+      ctxt_pP,
+      ue_context_pP,
+      send_security_mode_command);
+  LOG_D(RRC, "set security successfully \n");
+#endif
+  // Measurement ID list
+  MeasId_list = CALLOC(1, sizeof(*MeasId_list));
+  memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
+
+  MeasId0 = CALLOC(1, sizeof(*MeasId0));
+  MeasId0->measId = 1;
+  MeasId0->measObjectId = 1;
+  MeasId0->reportConfigId = 1;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
+
+  MeasId1 = CALLOC(1, sizeof(*MeasId1));
+  MeasId1->measId = 2;
+  MeasId1->measObjectId = 1;
+  MeasId1->reportConfigId = 2;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1);
+
+  MeasId2 = CALLOC(1, sizeof(*MeasId2));
+  MeasId2->measId = 3;
+  MeasId2->measObjectId = 1;
+  MeasId2->reportConfigId = 3;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2);
+
+  MeasId3 = CALLOC(1, sizeof(*MeasId3));
+  MeasId3->measId = 4;
+  MeasId3->measObjectId = 1;
+  MeasId3->reportConfigId = 4;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3);
+
+  MeasId4 = CALLOC(1, sizeof(*MeasId4));
+  MeasId4->measId = 5;
+  MeasId4->measObjectId = 1;
+  MeasId4->reportConfigId = 5;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4);
+
+  MeasId5 = CALLOC(1, sizeof(*MeasId5));
+  MeasId5->measId = 6;
+  MeasId5->measObjectId = 1;
+  MeasId5->reportConfigId = 6;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
+
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
+
+  // Add one EUTRA Measurement Object
+  MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
+  memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
+
+  // Configure MeasObject
+
+  MeasObj = CALLOC(1, sizeof(*MeasObj));
+  memset((void *)MeasObj, 0, sizeof(*MeasObj));
+
+  MeasObj->measObjectId = 1;
+  MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
+  MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz
+  //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz
+  MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25;
+  MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
+  MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL;   // Default is 15 or 0dB
+
+  MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
+    (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
+
+  CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
+
+  // Add adjacent cell lists (6 per eNB)
+  for (i = 0; i < 6; i++) {
+    CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
+    CellToAdd->cellIndex = i + 1;
+    CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i);
+    CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
+
+    ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
+  }
+
+  ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
+
+  // Report Configurations for periodical, A1-A5 events
+  ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
+
+  ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
+
+  ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1));
+
+  ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2));
+
+  ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3));
+
+  ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4));
+
+  ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5));
+
+  ReportConfig_per->reportConfigId = 1;
+  ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_periodical;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
+    ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
+
+  ReportConfig_A1->reportConfigId = 2;
+  ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.choice.threshold_RSRP = 10;
+
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
+
+  if (RC.rrc[ctxt_pP->module_id]->HO_flag == 1 /*HO_MEASURMENT */ ) {
+    LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+    ReportConfig_A2->reportConfigId = 3;
+    ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA2.a2_Threshold.choice.threshold_RSRP = 10;
+
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2);
+
+    ReportConfig_A3->reportConfigId = 4;
+    ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1;   //10;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA3.reportOnLeave = 1;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long!
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger =
+      TimeToTrigger_ms40;
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3);
+
+    ReportConfig_A4->reportConfigId = 5;
+    ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA4.a4_Threshold.choice.threshold_RSRP = 10;
+
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4);
+
+    ReportConfig_A5->reportConfigId = 6;
+    ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold1.choice.threshold_RSRP = 10;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold2.choice.threshold_RSRP = 10;
+
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
+    //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
+
+    rsrp = CALLOC(1, sizeof(RSRP_Range_t));
+    *rsrp = 20;
+
+    Sparams = CALLOC(1, sizeof(*Sparams));
+    Sparams->present = MeasConfig__speedStatePars_PR_setup;
+    Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75;
+    Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5;
+    Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10;
+    Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5;
+    Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60;
+    Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120;
+
+    quantityConfig = CALLOC(1, sizeof(*quantityConfig));
+    memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
+    quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA));
+    memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA));
+    quantityConfig->quantityConfigCDMA2000 = NULL;
+    quantityConfig->quantityConfigGERAN = NULL;
+    quantityConfig->quantityConfigUTRA = NULL;
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)));
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)));
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
+
+    LOG_I(RRC,
+          "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+    // store the information in an intermediate structure for Hanodver management
+    //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof());
+    ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info)));
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2;
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = DRB_configList;
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL;
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig =
+      CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig));
+    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig,
+           (void *)ue_context_pP->ue_context.mac_MainConfig, sizeof(MAC_MainConfig_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated =
+      CALLOC(1, sizeof(PhysicalConfigDedicated_t));
+    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated,
+           (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL;
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t));
+
+  }
+
+#ifdef CBA
+  //struct PUSCH_CBAConfigDedicated_vlola  *pusch_CBAConfigDedicated_vlola;
+  uint8_t                            *cba_RNTI_buf;
+  cba_RNTI = CALLOC(1, sizeof(C_RNTI_t));
+  cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t));
+  cba_RNTI->buf = cba_RNTI_buf;
+  cba_RNTI->size = 2;
+  cba_RNTI->bits_unused = 0;
+
+  // associate UEs to the CBa groups as a function of their UE id
+  if (rrc_inst->num_active_cba_groups) {
+    cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff;
+    cba_RNTI->buf[1] = 0xff;
+    LOG_D(RRC,
+          "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n",
+          enb_mod_idP, frameP,
+          rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups],
+          ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP);
+  } else {
+    cba_RNTI->buf[0] = 0x0;
+    cba_RNTI->buf[1] = 0x0;
+    LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP);
+  }
+
+#endif
+
+#if defined(ENABLE_ITTI)
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  /* Add all NAS PDUs to the list */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+      memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+      OCTET_STRING_fromBuf(dedicatedInfoNas,
+         (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
+                           ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
+      LOG_D(RRC, "Add dedicatedInfoNas(%d) to dedicatedInfoNASList\n", i);
+      ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+    }
+
+    /* TODO parameters yet to process ... */
+    {
+      //      ue_context_pP->ue_context.e_rab[i].param.qos;
+      //      ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
+      //      ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
+    }
+
+    /* TODO should test if e RAB are Ok before! */
+    ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE;
+    LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n",
+    i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE");
+  }
+
+  /* If list is empty free the list and reset the address */
+  if (dedicatedInfoNASList->list.count == 0) {
+    free(dedicatedInfoNASList);
+    dedicatedInfoNASList = NULL;
+  }
+
+#endif
+
+  // send RRCConnectionReconfiguration
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+  size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                         buffer,
+                                         next_xid,   //Transaction_id,
+                                         (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList
+                                         (DRB_ToAddModList_t*)DRB_configList,
+                                         (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
+                                         (struct SPS_Config*)NULL,    // maybe ue_context_pP->ue_context.sps_Config,
+                                         (struct PhysicalConfigDedicated*)ue_context_pP->ue_context.physicalConfigDedicated,
+#ifdef EXMIMO_IOT
+                                         NULL, NULL, NULL,NULL,
+#else
+                                         (MeasObjectToAddModList_t*)MeasObj_list,  // MeasObj_list,
+                                         (ReportConfigToAddModList_t*)ReportConfig_list,  // ReportConfig_list,
+                                         (QuantityConfig_t*)quantityConfig,  //quantityConfig,
+                                         (MeasIdToAddModList_t*)NULL,
+#endif
+                                         (MAC_MainConfig_t*)ue_context_pP->ue_context.mac_MainConfig,
+                                         (MeasGapConfig_t*)NULL,
+                                         (MobilityControlInfo_t*)NULL,
+                                         (struct MeasConfig__speedStatePars*)Sparams, // Sparams,
+                                         (RSRP_Range_t*)rsrp, // rsrp,
+                                         (C_RNTI_t*)cba_RNTI,  // cba_RNTI
+                                         (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList //dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                         , (SCellToAddMod_r10_t*)NULL
+#endif
+                                        );
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  /* Free all NAS PDUs */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer);
+      ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
+    }
+  }
+
+#endif
+
+  LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+         ctxt_pP,
+         DCCH,
+         rrc_eNB_mui++,
+         SDU_CONFIRM_NO,
+         size,
+         buffer,
+         PDCP_TRANSMISSION_MODE_CONTROL);
+
+  // delete UE data of prior RNTI.  UE use current RNTI.
+  protocol_ctxt_t ctxt_prior = *ctxt_pP;
+  ctxt_prior.rnti = reestablish_rnti;
+
+  LTE_eNB_ULSCH_t *ulsch = NULL;
+  nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
+  PHY_VARS_eNB *eNB_PHY = NULL;
+  eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id];
+  for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id];
+    for (int i=0; i<NUMBER_OF_UE_MAX; i++) {
+      ulsch = eNB_PHY->ulsch[i];
+      if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){
+        LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti);
+        clean_eNb_ulsch(ulsch);
+        break;
+      }
+    }
+
+    for(int j = 0; j < 10; j++){
+      ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
+      if(ul_req_tmp){
+        int pdu_number = ul_req_tmp->number_of_pdus;
+        for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
+          if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti){
+            LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", ctxt_prior.rnti, pdu_index, pdu_number);
+            if(pdu_index < pdu_number -1){
+               memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
+            }
+            ul_req_tmp->number_of_pdus--;
+          }
+        }
+      }
+    }
+  }
+  rrc_mac_remove_ue(ctxt_prior.module_id, ctxt_prior.rnti);
+  rrc_rlc_remove_ue(&ctxt_prior);
+  pdcp_remove_UE(&ctxt_prior);
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_RRCConnectionReestablishmentReject(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP,
+  const int                    CC_id
+)
+//-----------------------------------------------------------------------------
+{
+#ifdef RRC_MSG_PRINT
+  int                                 cnt;
+#endif
+  int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
+  RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1;
+  RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 20;
+
+  T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+    do_RRCConnectionReestablishmentReject(ctxt_pP->module_id,
+                          (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload);
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRCConnectionReestablishmentReject\n");
+
+  for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]);
+  }
+
+  LOG_F(RRC,"\n");
+#endif
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+    MSC_AS_TIME_FMT" RRCConnectionReestablishmentReject UE %x size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_RRCConnectionRelease(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP
+)
+//-----------------------------------------------------------------------------
+{
+
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+
+  T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+  size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id));
+  // set release timer
+  //ue_context_pP->ue_context.ue_release_timer=1;
+  // remove UE after 10 frames after RRCConnectionRelease is triggered
+  //ue_context_pP->ue_context.ue_release_timer_thres=100;
+    // set release timer
+  ue_context_pP->ue_context.ue_release_timer_rrc = 1;
+  // remove UE after 10 frames after RRCConnectionRelease is triggered
+  ue_context_pP->ue_context.ue_release_timer_thres_rrc = 100;
+  ue_context_pP->ue_context.ue_reestablishment_timer = 0;
+  ue_context_pP->ue_context.ue_release_timer = 0;
+  ue_context_pP->ue_context.ue_release_timer_s1 = 0;
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        size);
+
+  LOG_D(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        size,
+        rrc_eNB_mui,
+        DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" rrcConnectionRelease UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+	       ctxt_pP,
+	       DCCH,
+	       rrc_eNB_mui++,
+	       SDU_CONFIRM_NO,
+	       size,
+	       buffer,
+	       PDCP_TRANSMISSION_MODE_CONTROL);
+}
+
+uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9};
+
+// TBD: this directive can be remived if we create a similar e_rab_param_t structure in RRC context
+#if defined(ENABLE_ITTI) 
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+						     rrc_eNB_ue_context_t*          const ue_context_pP,
+						     const uint8_t                ho_state
+						     )
+//-----------------------------------------------------------------------------
+{
+  
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  int i;
+  
+  struct DRB_ToAddMod                *DRB_config                       = NULL;
+  struct RLC_Config                  *DRB_rlc_config                   = NULL;
+  struct PDCP_Config                 *DRB_pdcp_config                  = NULL;
+  struct PDCP_Config__rlc_AM         *PDCP_rlc_AM                      = NULL;
+  struct PDCP_Config__rlc_UM         *PDCP_rlc_UM                      = NULL;
+  struct LogicalChannelConfig        *DRB_lchan_config                 = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+    *DRB_ul_SpecificParameters        = NULL;
+  //  DRB_ToAddModList_t**                DRB_configList=&ue_context_pP->ue_context.DRB_configList; 
+  DRB_ToAddModList_t*                DRB_configList=ue_context_pP->ue_context.DRB_configList; 
+  DRB_ToAddModList_t**                DRB_configList2=NULL;
+  //DRB_ToAddModList_t**                RRC_DRB_configList=&ue_context_pP->ue_context.DRB_configList;
+
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+  DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+  /* for no gcc warnings */
+  (void)dedicatedInfoNas;
+
+  long  *logicalchannelgroup_drb;
+//  int drb_identity_index=0;
+
+  uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);   //Transaction_id,
+  DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid];
+  if (*DRB_configList2) {
+    free(*DRB_configList2);
+  }
+  //*DRB_configList = CALLOC(1, sizeof(*DRB_configList));
+  *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); 
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  int e_rab_done=0;
+  
+  for ( i = 0  ;
+	i < ue_context_pP->ue_context.setup_e_rabs ;
+	i++){
+
+    if (e_rab_done >= ue_context_pP->ue_context.nb_of_e_rabs){
+        break;
+    }
+    
+    // bypass the new and already configured erabs
+    if (ue_context_pP->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE) {
+//      drb_identity_index++;
+      continue;
+    }
+        
+    DRB_config = CALLOC(1, sizeof(*DRB_config));
+
+    DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long));
+    // allowed value 5..15, value : x+4
+    *(DRB_config->eps_BearerIdentity) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation  
+
+ //   DRB_config->drb_Identity =  1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
+    // 1 + drb_identiy_index;  
+    DRB_config->drb_Identity = i+1;
+
+    DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
+    *(DRB_config->logicalChannelIdentity) = DRB_config->drb_Identity + 2; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+    
+    DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
+    DRB_config->rlc_Config = DRB_rlc_config;
+
+    DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+    DRB_config->pdcp_Config = DRB_pdcp_config;
+    DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+    *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
+    DRB_pdcp_config->rlc_AM = NULL;
+    DRB_pdcp_config->rlc_UM = NULL;
+
+
+    switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci){
+      /*
+       * type: realtime data with medium packer error rate
+       * action: swtich to RLC UM
+       */
+    case 1: // 100ms, 10^-2, p2, GBR
+    case 2: // 150ms, 10^-3, p4, GBR
+    case 3: // 50ms, 10^-3, p3, GBR
+    case 4:  // 300ms, 10^-6, p5 
+    case 7: // 100ms, 10^-3, p7, GBR
+    case 9: // 300ms, 10^-6, p9
+    case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR
+    case 66: // 100ms, 10^-2, p2, non-mission critical  voice , GBR
+      // RLC 
+      DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
+      DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+      DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+      DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
+      // PDCP
+      PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
+      DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+      PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+      break;
+      
+      /*
+       * type: non-realtime data with low packer error rate
+       * action: swtich to RLC AM
        */
+    case 5:  // 100ms, 10^-6, p1 , IMS signaling 
+    case 6:  // 300ms, 10^-6, p6 
+    case 8: // 300ms, 10^-6, p8 
+    case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority 
+    case 70: // 200ms, 10^-6, p5.5, mision critical data 
+      // RLC
+       DRB_rlc_config->present = RLC_Config_PR_am;
+       DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
+       DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
+       DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity;
+       DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
+       DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+       DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25;
+
+       // PDCP
+       PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
+       DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
+       PDCP_rlc_AM->statusReportRequired = FALSE;
+       
+       break;
+    default :
+      LOG_E(RRC,"not supported qci %d\n", ue_context_pP->ue_context.e_rab[i].param.qos.qci);
+      ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_FAILED; 
+      ue_context_pP->ue_context.e_rab[i].xid = xid;
+      e_rab_done++;
+      continue;
+    }
+
+    DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+    
+    DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
+    DRB_config->logicalChannelConfig = DRB_lchan_config;
+    DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+    DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+
+    if (ue_context_pP->ue_context.e_rab[i].param.qos.qci < 9 )
+      DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3; 
+    // ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level;
+    else 
+      DRB_ul_SpecificParameters->priority= 4;
+
+    DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
+      //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+    DRB_ul_SpecificParameters->bucketSizeDuration =
+      LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+    
+    logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+    *logicalchannelgroup_drb = 1;//(i+1) % 3;
+    DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+
+    ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config);
+    ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
+    //ue_context_pP->ue_context.DRB_configList2[drb_identity_index] = &(*DRB_configList);
+    
+    LOG_I(RRC,"EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n",
+	  *DRB_config->eps_BearerIdentity,
+	  DRB_config->drb_Identity, i,
+	  ue_context_pP->ue_context.e_rab[i].param.qos.qci,
+	  DRB_ul_SpecificParameters->priority,
+	  *(DRB_config->logicalChannelIdentity),
+	  *DRB_ul_SpecificParameters->logicalChannelGroup	  
+	  );
+
+    e_rab_done++;
+    ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; 
+    ue_context_pP->ue_context.e_rab[i].xid = xid;
+    
+    {
+      if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+	dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+	memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+	OCTET_STRING_fromBuf(dedicatedInfoNas, 
+			     (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
+			     ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
+	ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+	LOG_I(RRC,"add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length, i);
+      } 
+      else {
+	LOG_W(RRC,"Not received activate dedicated EPS bearer context request\n");
+      }
+      /* TODO parameters yet to process ... */
+      {
+	//      ue_context_pP->ue_context.e_rab[i].param.qos;
+	//      ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
+	//      ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
+      }
+    }
+    
+  }
+
+  /* If list is empty free the list and reset the address */
+  if (dedicatedInfoNASList != NULL) {
+    if (dedicatedInfoNASList->list.count == 0) {
+      free(dedicatedInfoNASList);
+      dedicatedInfoNASList = NULL;
+      LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n");
+    }				
+  } else {
+    LOG_W(RRC,"dedlicated NAS list is empty\n");
+  }
+
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+   size = do_RRCConnectionReconfiguration(ctxt_pP,
+					  buffer,
+					  xid,
+					  (SRB_ToAddModList_t*)NULL, 
+					  (DRB_ToAddModList_t*)*DRB_configList2,
+					  (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
+                                         (struct SPS_Config*)NULL,    // *sps_Config,
+					  NULL, NULL, NULL, NULL,NULL,
+					  NULL, NULL,  NULL, NULL, NULL, NULL, 
+					  (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                         , (SCellToAddMod_r10_t*)NULL
+#endif
+                                        );
+ 
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  /* Free all NAS PDUs */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer);
+      ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
+    }
+  }
+#endif
+
+ LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+    ctxt_pP,
+    DCCH,
+    rrc_eNB_mui++,
+    SDU_CONFIRM_NO,
+    size,
+    buffer,
+    PDCP_TRANSMISSION_MODE_CONTROL);
+
+
+}
+int
+rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+                             rrc_eNB_ue_context_t*          const ue_context_pP,
+                             const uint8_t                ho_state
+                             )
+//-----------------------------------------------------------------------------
+{
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  int i, j;
+
+  struct DRB_ToAddMod                *DRB_config                       = NULL;
+  struct RLC_Config                  *DRB_rlc_config                   = NULL;
+  struct PDCP_Config                 *DRB_pdcp_config                  = NULL;
+  struct PDCP_Config__rlc_AM         *PDCP_rlc_AM                      = NULL;
+  struct PDCP_Config__rlc_UM         *PDCP_rlc_UM                      = NULL;
+  struct LogicalChannelConfig        *DRB_lchan_config                 = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+  *DRB_ul_SpecificParameters        = NULL;
+  DRB_ToAddModList_t*                 DRB_configList = ue_context_pP->ue_context.DRB_configList;
+  DRB_ToAddModList_t*                DRB_configList2 = NULL;
+
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+  DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+  /* for no gcc warnings */
+  (void)dedicatedInfoNas;
+
+  uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);   // Transaction_id,
+  DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2));
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) {
+    // bypass the new and already configured erabs
+    if (ue_context_pP->ue_context.modify_e_rab[i].status >= E_RAB_STATUS_DONE) {
+      ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+      continue;
+    }
+
+    if (ue_context_pP->ue_context.modify_e_rab[i].cause != S1AP_CAUSE_NOTHING) {
+      // set xid of failure RAB
+      ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+      ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED;
+      continue;
+    }
+
+    DRB_config = NULL;
+    // search exist DRB_config
+    for (j = 0; j < DRB_configList->list.count; j++) {
+      if((uint8_t)*(DRB_configList->list.array[j]->eps_BearerIdentity) == ue_context_pP->ue_context.modify_e_rab[i].param.e_rab_id) {
+        DRB_config = DRB_configList->list.array[j];
+        break;
+      }
+    }
+    if (NULL == DRB_config) {
+      ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+      ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED;
+      // TODO use which cause
+      ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK;
+      ue_context_pP->ue_context.modify_e_rab[i].cause_value = 0;//S1ap_CauseRadioNetwork_unspecified;
+      ue_context_pP->ue_context.nb_of_failed_e_rabs++;
+      continue;
+    }
+
+    DRB_rlc_config = DRB_config->rlc_Config;
+
+    DRB_pdcp_config = DRB_config->pdcp_Config;
+    *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
+    switch (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci) {
+    /*
+     * type: realtime data with medium packer error rate
+     * action: swtich to RLC UM
+     */
     case 1: // 100ms, 10^-2, p2, GBR
     case 2: // 150ms, 10^-3, p4, GBR
     case 3: // 50ms, 10^-3, p3, GBR
-    case 4:  // 300ms, 10^-6, p5 
+    case 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 
+      // RLC
       DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
       DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
       DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
       DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
       // PDCP
+      if (DRB_pdcp_config->rlc_AM) {
+        free(DRB_pdcp_config->rlc_AM);
+        DRB_pdcp_config->rlc_AM = NULL;
+      }
+      if (DRB_pdcp_config->rlc_UM) {
+        free(DRB_pdcp_config->rlc_UM);
+        DRB_pdcp_config->rlc_UM = NULL;
+      }
       PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
       DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
       PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
       break;
-      
-      /*
-       * type: non-realtime data with low packer error rate
-       * action: swtich to RLC AM
-       */
-    case 5:  // 100ms, 10^-6, p1 , IMS signaling 
-    case 6:  // 300ms, 10^-6, p6 
-    case 8: // 300ms, 10^-6, p8 
-    case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority 
-    case 70: // 200ms, 10^-6, p5.5, mision critical data 
-      // RLC
+
+    /*
+     * 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;
@@ -1247,109 +2358,954 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co
        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;
-    }
+       // PDCP
+       if (DRB_pdcp_config->rlc_AM) {
+         free(DRB_pdcp_config->rlc_AM);
+         DRB_pdcp_config->rlc_AM = NULL;
+       }
+       if (DRB_pdcp_config->rlc_UM) {
+         free(DRB_pdcp_config->rlc_UM);
+         DRB_pdcp_config->rlc_UM = NULL;
+       }
+       PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
+       DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
+       PDCP_rlc_AM->statusReportRequired = FALSE;
+
+       break;
+    default :
+      LOG_E(RRC, "not supported qci %d\n", ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci);
+      ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED;
+      ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+      ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK;
+      ue_context_pP->ue_context.modify_e_rab[i].cause_value = 37;//S1ap_CauseRadioNetwork_not_supported_QCI_value;
+      ue_context_pP->ue_context.nb_of_failed_e_rabs++;
+      continue;
+    }
+
+    DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+
+    DRB_lchan_config = DRB_config->logicalChannelConfig;
+    DRB_ul_SpecificParameters = DRB_lchan_config->ul_SpecificParameters;
+
+    if (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci < 9 )
+      DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci-1] + 3;
+    else
+      DRB_ul_SpecificParameters->priority= 4;
+
+    DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
+
+    DRB_ul_SpecificParameters->bucketSizeDuration =
+      LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+    ASN_SEQUENCE_ADD(&(DRB_configList2)->list, DRB_config);
+
+    LOG_I(RRC, "EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n",
+      *DRB_config->eps_BearerIdentity,
+      DRB_config->drb_Identity, i,
+      ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci,
+      DRB_ul_SpecificParameters->priority,
+      *(DRB_config->logicalChannelIdentity),
+      *DRB_ul_SpecificParameters->logicalChannelGroup
+      );
+
+    //e_rab_done++;
+    ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_DONE;
+    ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+
+    {
+      if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) {
+        dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+        memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+        OCTET_STRING_fromBuf(dedicatedInfoNas,
+                 (char*)ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer,
+                 ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length);
+        ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+        LOG_I(RRC, "add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length, i);
+      }
+      else {
+        LOG_W(RRC, "Not received activate dedicated EPS bearer context request\n");
+      }
+    }
+  }
+
+  /* If list is empty free the list and reset the address */
+  if (dedicatedInfoNASList != NULL) {
+    if (dedicatedInfoNASList->list.count == 0) {
+      free(dedicatedInfoNASList);
+      dedicatedInfoNASList = NULL;
+      LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n");
+    }
+  } else {
+    LOG_W(RRC,"dedlicated NAS list is empty\n");
+  }
+
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+  size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                          buffer,
+                                          xid,
+                                          (SRB_ToAddModList_t*)NULL,
+                                          (DRB_ToAddModList_t*)DRB_configList2,
+                                          (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
+                                          (struct SPS_Config*)NULL,    // *sps_Config,
+                                          NULL, NULL, NULL, NULL,NULL,
+                                          NULL, NULL,  NULL, NULL, NULL, NULL,
+                                          (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                          , (SCellToAddMod_r10_t*)NULL
+#endif
+                                          );
+
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  /* Free all NAS PDUs */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) {
+    if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer);
+      ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer = NULL;
+    }
+  }
+#endif
+
+ LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+    ctxt_pP,
+    DCCH,
+    rrc_eNB_mui++,
+    SDU_CONFIRM_NO,
+    size,
+    buffer,
+    PDCP_TRANSMISSION_MODE_CONTROL);
+  return 0;
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(  const protocol_ctxt_t*   const ctxt_pP,
+        rrc_eNB_ue_context_t*    const ue_context_pP,
+        uint8_t                  xid,
+        uint32_t                 nas_length,
+        uint8_t*                 nas_buffer)
+//-----------------------------------------------------------------------------
+{
+    uint8_t                             buffer[RRC_BUF_SIZE];
+    int                                 i;
+    uint16_t                            size  = 0;
+    DRB_ToReleaseList_t**                DRB_Release_configList2=NULL;
+    DRB_Identity_t* DRB_release;
+    struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+
+    DRB_Release_configList2=&ue_context_pP->ue_context.DRB_Release_configList2[xid];
+    if (*DRB_Release_configList2) {
+      free(*DRB_Release_configList2);
+    }
+    *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2));
+
+    for(i = 0; i < NB_RB_MAX; i++){
+        if((ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_TORELEASE) && ue_context_pP->ue_context.e_rab[i].xid == xid){
+            DRB_release = CALLOC(1, sizeof(DRB_Identity_t));
+            *DRB_release = i+1;
+            ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release);
+            //free(DRB_release);
+        }
+    }
+
+    /* If list is empty free the list and reset the address */
+    if (nas_length > 0) {
+        DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+        dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+        dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+        memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+                       OCTET_STRING_fromBuf(dedicatedInfoNas,
+                              (char*)nas_buffer,
+                              nas_length);
+        ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+        LOG_I(RRC,"add NAS info with size %d\n",nas_length);
+    } else {
+      LOG_W(RRC,"dedlicated NAS list is empty\n");
+    }
+
+    memset(buffer, 0, RRC_BUF_SIZE);
+    size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                    buffer,
+                                    xid,
+                                    NULL,
+                                    NULL,
+                                    (DRB_ToReleaseList_t*)*DRB_Release_configList2,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                    , (SCellToAddMod_r10_t*)NULL
+#endif
+                                   );
+    ue_context_pP->ue_context.e_rab_release_command_flag = 1;
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+  /* Free all NAS PDUs */
+  if (nas_length > 0) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(nas_buffer);
+  }
+#endif
+
+  LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+    ctxt_pP,
+    DCCH,
+    rrc_eNB_mui++,
+    SDU_CONFIRM_NO,
+    size,
+    buffer,
+    PDCP_TRANSMISSION_MODE_CONTROL);
+
+}
+#endif 
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+						     rrc_eNB_ue_context_t*          const ue_context_pP,
+						     const uint8_t                ho_state
+						     )
+//-----------------------------------------------------------------------------
+{
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  int                                 i;
+
+  // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
+  eNB_RRC_INST*                       rrc_inst = RC.rrc[ctxt_pP->module_id];
+  struct PhysicalConfigDedicated**    physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated;
+
+  struct SRB_ToAddMod                *SRB2_config                      = NULL;
+  struct SRB_ToAddMod__rlc_Config    *SRB2_rlc_config                  = NULL;
+  struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config         = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+      *SRB2_ul_SpecificParameters       = NULL;
+  SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList;
+  SRB_ToAddModList_t                 **SRB_configList2                  = NULL;
+
+  struct DRB_ToAddMod                *DRB_config                       = NULL;
+  struct RLC_Config                  *DRB_rlc_config                   = NULL;
+  struct PDCP_Config                 *DRB_pdcp_config                  = NULL;
+  struct PDCP_Config__rlc_AM         *PDCP_rlc_AM                      = NULL;
+  struct PDCP_Config__rlc_UM         *PDCP_rlc_UM                      = NULL;
+  struct LogicalChannelConfig        *DRB_lchan_config                 = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+      *DRB_ul_SpecificParameters        = NULL;
+  DRB_ToAddModList_t**                DRB_configList = &ue_context_pP->ue_context.DRB_configList;
+  DRB_ToAddModList_t**                DRB_configList2 = NULL;
+   MAC_MainConfig_t                   *mac_MainConfig                   = NULL;
+  MeasObjectToAddModList_t           *MeasObj_list                     = NULL;
+  MeasObjectToAddMod_t               *MeasObj                          = NULL;
+  ReportConfigToAddModList_t         *ReportConfig_list                = NULL;
+  ReportConfigToAddMod_t             *ReportConfig_per, *ReportConfig_A1,
+                                     *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
+  MeasIdToAddModList_t               *MeasId_list                      = NULL;
+  MeasIdToAddMod_t                   *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
+#if defined(Rel10) || defined(Rel14)
+  long                               *sr_ProhibitTimer_r9              = NULL;
+  //     uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1);
+  //uint8_t                            sCellIndexToAdd = 0;
+#endif
+
+  long                               *logicalchannelgroup, *logicalchannelgroup_drb;
+  long                               *maxHARQ_Tx, *periodicBSR_Timer;
+
+  RSRP_Range_t                       *rsrp                             = NULL;
+  struct MeasConfig__speedStatePars  *Sparams                          = NULL;
+  QuantityConfig_t                   *quantityConfig                   = NULL;
+  CellsToAddMod_t                    *CellToAdd                        = NULL;
+  CellsToAddModList_t                *CellsToAddModList                = NULL;
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+  DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+  /* for no gcc warnings */
+  (void)dedicatedInfoNas;
+
+  C_RNTI_t                           *cba_RNTI                         = NULL;
+
+  uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);   //Transaction_id,
+
+#ifdef CBA
+  //struct PUSCH_CBAConfigDedicated_vlola  *pusch_CBAConfigDedicated_vlola;
+  uint8_t                            *cba_RNTI_buf;
+  cba_RNTI = CALLOC(1, sizeof(C_RNTI_t));
+  cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t));
+  cba_RNTI->buf = cba_RNTI_buf;
+  cba_RNTI->size = 2;
+  cba_RNTI->bits_unused = 0;
+
+  // associate UEs to the CBa groups as a function of their UE id
+  if (rrc_inst->num_active_cba_groups) {
+    cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff;
+    cba_RNTI->buf[1] = 0xff;
+    LOG_D(RRC,
+          "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n",
+          enb_mod_idP, frameP,
+          rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups],
+          ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP);
+  } else {
+    cba_RNTI->buf[0] = 0x0;
+    cba_RNTI->buf[1] = 0x0;
+    LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP);
+  }
+
+#endif
+
+  T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  // Configure SRB2
+  /// SRB2
+  SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid];
+  if (*SRB_configList2) {
+    free(*SRB_configList2);
+  }
+  *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
+  memset(*SRB_configList2, 0, sizeof(**SRB_configList2));
+  SRB2_config = CALLOC(1, sizeof(*SRB2_config));
+
+  SRB2_config->srb_Identity = 2;
+  SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config));
+  SRB2_config->rlc_Config = SRB2_rlc_config;
+
+  SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
+  SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32;
+  SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+  SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10;
+
+  SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config));
+  SRB2_config->logicalChannelConfig = SRB2_lchan_config;
+
+  SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
+
+  SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters));
+
+  SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs
+  SRB2_ul_SpecificParameters->prioritisedBitRate =
+    LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  SRB2_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  // LCG for CCCH and DCCH is 0 as defined in 36331
+  logicalchannelgroup = CALLOC(1, sizeof(long));
+  *logicalchannelgroup = 0;
+
+  SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
+
+  SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters;
+  // this list has the configuration for SRB1 and SRB2
+  ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
+  // this list has only the configuration for SRB2
+  ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
+
+  // Configure DRB
+  //*DRB_configList = CALLOC(1, sizeof(*DRB_configList));
+  // list for all the configured DRB
+  if (*DRB_configList) {
+    free(*DRB_configList);
+  }
+  *DRB_configList = CALLOC(1, sizeof(**DRB_configList));
+  memset(*DRB_configList, 0, sizeof(**DRB_configList));
+
+  // list for the configured DRB for a this xid
+  DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid];
+  if (*DRB_configList2) {
+    free(*DRB_configList2);
+  }
+  *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
+  memset(*DRB_configList2, 0, sizeof(**DRB_configList2));
+
+
+  /// DRB
+  DRB_config = CALLOC(1, sizeof(*DRB_config));
+
+  DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long));
+  *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4
+  // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32
+  // NN: this is the 1st DRB for this ue, so set it to 1
+  DRB_config->drb_Identity = (DRB_Identity_t) 1;  // (ue_mod_idP+1); //allowed values 1..32, value: x
+  DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
+  *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2
+  DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
+  DRB_config->rlc_Config = DRB_rlc_config;
+
+#ifdef RRC_DEFAULT_RAB_IS_AM
+  DRB_rlc_config->present = RLC_Config_PR_am;
+  DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
+  DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
+  DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity;
+  DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
+  DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+  DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25;
+#else
+  DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
+  DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+#ifdef CBA
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering   = T_Reordering_ms5;//T_Reordering_ms25;
+#else
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
+#endif
+#endif
+
+  DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+  DRB_config->pdcp_Config = DRB_pdcp_config;
+  DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+  *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
+  DRB_pdcp_config->rlc_AM = NULL;
+  DRB_pdcp_config->rlc_UM = NULL;
+
+  /* avoid gcc warnings */
+  (void)PDCP_rlc_AM;
+  (void)PDCP_rlc_UM;
+
+#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT
+  PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
+  DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
+  PDCP_rlc_AM->statusReportRequired = FALSE;
+#else
+  PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
+  DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+  PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+#endif
+  DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+
+  DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
+  DRB_config->logicalChannelConfig = DRB_lchan_config;
+  DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+  DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+
+  DRB_ul_SpecificParameters->priority = 12;    // lower priority than srb1, srb2 and other dedicated bearer
+  DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
+    //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  DRB_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
+  logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+  *logicalchannelgroup_drb = 1;
+  DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+
+  ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
+  ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
+
+  //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList);
+
+  mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig));
+  ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig;
+
+  mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config));
+
+  maxHARQ_Tx = CALLOC(1, sizeof(long));
+  *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
+  mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx;
+  periodicBSR_Timer = CALLOC(1, sizeof(long));
+  *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64;
+  mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer;
+  mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320;
+  mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE
+
+  mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity;
+
+  mac_MainConfig->drx_Config = NULL;
+
+  mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config));
+
+  mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup;
+  mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes
+
+  mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes
+
+  mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;  // Value dB1 =1 dB, dB3 = 3 dB
+
+#if defined(Rel10) || defined(Rel14)
+  sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long));
+  *sr_ProhibitTimer_r9 = 0;   // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR
+  mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1));
+  mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9;
+  //sps_RA_ConfigList_rlola = NULL;
+#endif
+
+  //change the transmission mode for the primary component carrier
+  //TODO: add codebook subset restriction here
+  //TODO: change TM for secondary CC in SCelltoaddmodlist
+  if (*physicalConfigDedicated) {
+    if ((*physicalConfigDedicated)->antennaInfo) {
+      (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0];
+      LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]);
+      if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) {
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) {
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
+
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) {
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) {
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+      }
+    }
+    else {
+      LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n");
+    }
+    if ((*physicalConfigDedicated)->cqi_ReportConfig) {
+      if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) ||
+	  (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) ||
+	  (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) {
+	//feedback mode needs to be set as well
+	//TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
+	printf("setting cqi reporting mode to rm31\n");
+#if defined(Rel10) || defined(Rel14)
+	*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31;
+#else
+	*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI
+#endif
+      }
+    }
+    else {
+      LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n");
+    }
+  }
+  else {
+    LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n");
+  }
+
+  // Measurement ID list
+  MeasId_list = CALLOC(1, sizeof(*MeasId_list));
+  memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
+
+  MeasId0 = CALLOC(1, sizeof(*MeasId0));
+  MeasId0->measId = 1;
+  MeasId0->measObjectId = 1;
+  MeasId0->reportConfigId = 1;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
+
+  MeasId1 = CALLOC(1, sizeof(*MeasId1));
+  MeasId1->measId = 2;
+  MeasId1->measObjectId = 1;
+  MeasId1->reportConfigId = 2;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1);
+
+  MeasId2 = CALLOC(1, sizeof(*MeasId2));
+  MeasId2->measId = 3;
+  MeasId2->measObjectId = 1;
+  MeasId2->reportConfigId = 3;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2);
+
+  MeasId3 = CALLOC(1, sizeof(*MeasId3));
+  MeasId3->measId = 4;
+  MeasId3->measObjectId = 1;
+  MeasId3->reportConfigId = 4;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3);
+
+  MeasId4 = CALLOC(1, sizeof(*MeasId4));
+  MeasId4->measId = 5;
+  MeasId4->measObjectId = 1;
+  MeasId4->reportConfigId = 5;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4);
+
+  MeasId5 = CALLOC(1, sizeof(*MeasId5));
+  MeasId5->measId = 6;
+  MeasId5->measObjectId = 1;
+  MeasId5->reportConfigId = 6;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
+
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
+
+  // Add one EUTRA Measurement Object
+  MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
+  memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
+
+  // Configure MeasObject
+
+  MeasObj = CALLOC(1, sizeof(*MeasObj));
+  memset((void *)MeasObj, 0, sizeof(*MeasObj));
+
+  MeasObj->measObjectId = 1;
+  MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
+  MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz
+  //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz
+  MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25;
+  MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
+  MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL;   // Default is 15 or 0dB
+
+  MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
+    (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
+
+  CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
+
+  // Add adjacent cell lists (6 per eNB)
+  for (i = 0; i < 6; i++) {
+    CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
+    CellToAdd->cellIndex = i + 1;
+    CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i);
+    CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
+
+    ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
+  }
+
+  ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
+
+  // Report Configurations for periodical, A1-A5 events
+  ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
+
+  ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
+
+  ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1));
+
+  ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2));
+
+  ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3));
+
+  ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4));
+
+  ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5));
+
+  ReportConfig_per->reportConfigId = 1;
+  ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_periodical;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
+    ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
+
+  ReportConfig_A1->reportConfigId = 2;
+  ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.choice.threshold_RSRP = 10;
+
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
+  
+  if (ho_state == 1 /*HO_MEASURMENT */ ) {
+    LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+    ReportConfig_A2->reportConfigId = 3;
+    ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA2.a2_Threshold.choice.threshold_RSRP = 10;
+
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
 
-    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;
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2);
 
-    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;
+    ReportConfig_A3->reportConfigId = 4;
+    ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3;
 
-    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;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1;   //10;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA3.reportOnLeave = 1;
 
-    ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config);
-    ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
-    //ue_context_pP->ue_context.DRB_configList2[drb_identity_index] = &(*DRB_configList);
-    
-    LOG_I(RRC,"EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n",
-	  *DRB_config->eps_BearerIdentity,
-	  DRB_config->drb_Identity, i,
-	  ue_context_pP->ue_context.e_rab[i].param.qos.qci,
-	  DRB_ul_SpecificParameters->priority,
-	  *(DRB_config->logicalChannelIdentity),
-	  *DRB_ul_SpecificParameters->logicalChannelGroup	  
-	  );
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
 
-    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;
-    
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long!
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger =
+      TimeToTrigger_ms40;
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3);
+
+    ReportConfig_A4->reportConfigId = 5;
+    ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA4.a4_Threshold.choice.threshold_RSRP = 10;
+
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4);
+
+    ReportConfig_A5->reportConfigId = 6;
+    ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold1.choice.threshold_RSRP = 10;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold2.choice.threshold_RSRP = 10;
+
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
+    //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
+
+    rsrp = CALLOC(1, sizeof(RSRP_Range_t));
+    *rsrp = 20;
+
+    Sparams = CALLOC(1, sizeof(*Sparams));
+    Sparams->present = MeasConfig__speedStatePars_PR_setup;
+    Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75;
+    Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5;
+    Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10;
+    Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5;
+    Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60;
+    Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120;
+
+    quantityConfig = CALLOC(1, sizeof(*quantityConfig));
+    memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
+    quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA));
+    memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA));
+    quantityConfig->quantityConfigCDMA2000 = NULL;
+    quantityConfig->quantityConfigGERAN = NULL;
+    quantityConfig->quantityConfigUTRA = NULL;
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)));
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)));
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
+
+    LOG_I(RRC,
+          "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+    // store the information in an intermediate structure for Hanodver management
+    //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof());
+    ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info)));
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2;
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList;
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL;
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig =
+      CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig));
+    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig,
+           (void *)mac_MainConfig, sizeof(MAC_MainConfig_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated =
+      CALLOC(1, sizeof(PhysicalConfigDedicated_t));
+    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated,
+           (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL;
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t));
+
+  }
+
+#if defined(ENABLE_ITTI)
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  /* Add all NAS PDUs to the list */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+      memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+      OCTET_STRING_fromBuf(dedicatedInfoNas, 
+			   (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
+                           ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
+      ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+    }
+
+    /* TODO parameters yet to process ... */
     {
-      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;
-      }
+      //      ue_context_pP->ue_context.e_rab[i].param.qos;
+      //      ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
+      //      ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
     }
-    
+
+    /* TODO should test if e RAB are Ok before! */
+    ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE;
+    LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", 
+	  i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE");
   }
 
   /* If list is empty free the list and reset the address */
-  if (dedicatedInfoNASList != 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");
+  if (dedicatedInfoNASList->list.count == 0) {
+    free(dedicatedInfoNASList);
+    dedicatedInfoNASList = NULL;
   }
 
+#endif
+
   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,
+  size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                         buffer,
+                                         xid,   //Transaction_id,
+                                         (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList
+                                         (DRB_ToAddModList_t*)*DRB_configList,
+                                         (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
                                          (struct SPS_Config*)NULL,    // *sps_Config,
-					  NULL, NULL, NULL, NULL,NULL,
-					  NULL, NULL,  NULL, NULL, NULL, NULL, 
-					  (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+                                         (struct PhysicalConfigDedicated*)*physicalConfigDedicated,
+#ifdef EXMIMO_IOT
+                                         NULL, NULL, NULL,NULL,
+#else
+                                         (MeasObjectToAddModList_t*)MeasObj_list,
+                                         (ReportConfigToAddModList_t*)ReportConfig_list,
+                                         (QuantityConfig_t*)quantityConfig,
+                                         (MeasIdToAddModList_t*)MeasId_list,
+#endif
+                                         (MAC_MainConfig_t*)mac_MainConfig,
+                                         (MeasGapConfig_t*)NULL,
+                                         (MobilityControlInfo_t*)NULL,
+                                         (struct MeasConfig__speedStatePars*)Sparams,
+                                         (RSRP_Range_t*)rsrp,
+                                         (C_RNTI_t*)cba_RNTI,
+                                         (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
 #if defined(Rel10) || defined(Rel14)
                                          , (SCellToAddMod_r10_t*)NULL
 #endif
                                         );
- 
 
 #ifdef RRC_MSG_PRINT
   LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
@@ -1370,10 +3326,11 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co
       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",
+  LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n",
         ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
 
   LOG_D(RRC,
@@ -1385,36 +3342,35 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co
     MSC_RRC_UE,
     buffer,
     size,
-    MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u",
     MSC_AS_TIME_ARGS(ctxt_pP),
     ue_context_pP->ue_context.rnti,
     rrc_eNB_mui,
     size);
 
   rrc_data_req(
-    ctxt_pP,
-    DCCH,
-    rrc_eNB_mui++,
-    SDU_CONFIRM_NO,
-    size,
-    buffer,
-    PDCP_TRANSMISSION_MODE_CONTROL);
-
-
+	       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
-						     )
+flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+                 rrc_eNB_ue_context_t*          const ue_context_pP,
+                 const uint8_t                ho_state,
+                 agent_reconf_rrc * trig_param
+                 )
 //-----------------------------------------------------------------------------
 {
   uint8_t                             buffer[RRC_BUF_SIZE];
   uint16_t                            size;
   int                                 i;
-
+ 
   // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
   eNB_RRC_INST*                       rrc_inst = RC.rrc[ctxt_pP->module_id];
   struct PhysicalConfigDedicated**    physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated;
@@ -1441,11 +3397,11 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
   MeasObjectToAddModList_t           *MeasObj_list                     = NULL;
   MeasObjectToAddMod_t               *MeasObj                          = NULL;
   ReportConfigToAddModList_t         *ReportConfig_list                = NULL;
-  ReportConfigToAddMod_t             *ReportConfig_per, *ReportConfig_A1,
-                                     *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
+  ReportConfigToAddMod_t             *ReportConfig_per;//, *ReportConfig_A1,
+                                     // *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
   MeasIdToAddModList_t               *MeasId_list                      = NULL;
-  MeasIdToAddMod_t                   *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
-#if defined(Rel10) || defined(Rel14)
+  MeasIdToAddMod_t                   *MeasId0; //, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
+#if Rel10
   long                               *sr_ProhibitTimer_r9              = NULL;
   //     uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1);
   //uint8_t                            sCellIndexToAdd = 0;
@@ -1639,7 +3595,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
   //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;
+  // ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig;
 
   mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config));
 
@@ -1665,7 +3621,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
 
   mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;  // Value dB1 =1 dB, dB3 = 3 dB
 
-#if defined(Rel10) || defined(Rel14)
+#ifdef Rel10
   sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long));
   *sr_ProhibitTimer_r9 = 0;   // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR
   mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1));
@@ -1681,45 +3637,45 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
       (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0];
       LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]);
       if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) {
-	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
-	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
-	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
-	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
-	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
-	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
-	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
-	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+  (*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;
+  (*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;
+  (*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;
+  (*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 {
@@ -1727,15 +3683,15 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
     }
     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");
+    (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) ||
+    (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) {
+  //feedback mode needs to be set as well
+  //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
+  printf("setting cqi reporting mode to rm31\n");
 #if defined(Rel10) || defined(Rel14)
-	*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31;
+  *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31;
 #else
-	*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI
+  *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI
 #endif
       }
     }
@@ -1757,43 +3713,14 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
   MeasId0->reportConfigId = 1;
   ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
 
-  MeasId1 = CALLOC(1, sizeof(*MeasId1));
-  MeasId1->measId = 2;
-  MeasId1->measObjectId = 1;
-  MeasId1->reportConfigId = 2;
-  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1);
-
-  MeasId2 = CALLOC(1, sizeof(*MeasId2));
-  MeasId2->measId = 3;
-  MeasId2->measObjectId = 1;
-  MeasId2->reportConfigId = 3;
-  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2);
-
-  MeasId3 = CALLOC(1, sizeof(*MeasId3));
-  MeasId3->measId = 4;
-  MeasId3->measObjectId = 1;
-  MeasId3->reportConfigId = 4;
-  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3);
-
-  MeasId4 = CALLOC(1, sizeof(*MeasId4));
-  MeasId4->measId = 5;
-  MeasId4->measObjectId = 1;
-  MeasId4->reportConfigId = 5;
-  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4);
-
-  MeasId5 = CALLOC(1, sizeof(*MeasId5));
-  MeasId5->measId = 6;
-  MeasId5->measObjectId = 1;
-  MeasId5->reportConfigId = 6;
-  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
-
-  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
+  /*
+   * Add one EUTRA Measurement Object
+  */
 
-  // Add one EUTRA Measurement Object
   MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
   memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
 
-  // Configure MeasObject
+  // Configure MeasObject 
 
   MeasObj = CALLOC(1, sizeof(*MeasObj));
   memset((void *)MeasObj, 0, sizeof(*MeasObj));
@@ -1829,155 +3756,65 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
   //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
 
   // Report Configurations for periodical, A1-A5 events
-  ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
-
-  ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
-
-  ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1));
-
-  ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2));
-
-  ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3));
 
-  ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4));
+  /* RRC Strategy Measurement */
 
-  ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5));
 
-  ReportConfig_per->reportConfigId = 1;
-  ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
-  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
-    ReportConfigEUTRA__triggerType_PR_periodical;
-  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
-    ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
-  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
-  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
-  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
-  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
-  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+  if (strcmp("one_shot", trig_param->trigger_policy) == 0){
 
-  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
+      trig_param->report_interval = 0;
+      trig_param->report_amount = 0;
 
-  ReportConfig_A1->reportConfigId = 2;
-  ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present =
-    ReportConfigEUTRA__triggerType_PR_event;
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
-    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1;
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
-  a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
-  a1_Threshold.choice.threshold_RSRP = 10;
+  }
 
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
-  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+  else if (strcmp("event_driven", trig_param->trigger_policy) == 0){
 
-  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
+      trig_param->report_interval = 6;
+      trig_param->report_amount = 2;
 
-  if (ho_state == 1 /*HO_MEASURMENT */ ) {
-    LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n",
-          ctxt_pP->module_id, ctxt_pP->frame);
-    ReportConfig_A2->reportConfigId = 3;
-    ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present =
-      ReportConfigEUTRA__triggerType_PR_event;
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
-      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2;
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA2.a2_Threshold.choice.threshold_RSRP = 10;
+  }
 
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
-      ReportConfigEUTRA__triggerQuantity_rsrp;
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
-    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+  else if (strcmp("periodical", trig_param->trigger_policy) == 0){
 
-    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2);
+      trig_param->report_interval = 1;
+      trig_param->report_amount = 7;
 
-    ReportConfig_A3->reportConfigId = 4;
-    ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present =
-      ReportConfigEUTRA__triggerType_PR_event;
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
-      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3;
+  }
 
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1;   //10;
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA3.reportOnLeave = 1;
+  else {
 
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
-      ReportConfigEUTRA__triggerQuantity_rsrp;
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+     LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!");
+  }
 
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long!
-    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger =
-      TimeToTrigger_ms40;
-    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3);
 
-    ReportConfig_A4->reportConfigId = 5;
-    ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present =
-      ReportConfigEUTRA__triggerType_PR_event;
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
-      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4;
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA4.a4_Threshold.choice.threshold_RSRP = 10;
 
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
-      ReportConfigEUTRA__triggerQuantity_rsrp;
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
-    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+  ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
 
-    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4);
+  ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
 
-    ReportConfig_A5->reportConfigId = 6;
-    ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present =
-      ReportConfigEUTRA__triggerType_PR_event;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
-      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA5.a5_Threshold1.choice.threshold_RSRP = 10;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
-    eventA5.a5_Threshold2.choice.threshold_RSRP = 10;
+    // Periodical Measurement Report
 
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
-      ReportConfigEUTRA__triggerQuantity_rsrp;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
-    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+  ReportConfig_per->reportConfigId = 1;
+  ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
 
-    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
-    //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
+    ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_periodical;
+
+    ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
+      ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
+
+    // ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40;  
+    ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+   ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+   ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+   ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms   
+
+   ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ...
+
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
 
-    rsrp = CALLOC(1, sizeof(RSRP_Range_t));
-    *rsrp = 20;
 
-    Sparams = CALLOC(1, sizeof(*Sparams));
-    Sparams->present = MeasConfig__speedStatePars_PR_setup;
-    Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75;
-    Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5;
-    Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10;
-    Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5;
-    Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60;
-    Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120;
 
     quantityConfig = CALLOC(1, sizeof(*quantityConfig));
     memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
@@ -1993,30 +3830,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
     *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
     *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
 
-    LOG_I(RRC,
-          "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",
-          ctxt_pP->module_id, ctxt_pP->frame);
-    // store the information in an intermediate structure for Hanodver management
-    //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof());
-    ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info)));
-    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t));
-    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2;
-    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t));
-    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList;
-    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL;
-    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig =
-      CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig));
-    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig,
-           (void *)mac_MainConfig, sizeof(MAC_MainConfig_t));
-    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated =
-      CALLOC(1, sizeof(PhysicalConfigDedicated_t));
-    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated,
-           (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t));
-    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL;
-    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t));
-
-  }
-
+  
 #if defined(ENABLE_ITTI)
   /* Initialize NAS list */
   dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
@@ -2027,22 +3841,22 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
       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,
+         (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
                            ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
       ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
     }
 
     /* TODO parameters yet to process ... */
-    {
+    // {
       //      ue_context_pP->ue_context.e_rab[i].param.qos;
       //      ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
       //      ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
-    }
+    // }
 
     /* TODO should test if e RAB are Ok before! */
     ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE;
     LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", 
-	  i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE");
+    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 */
@@ -2054,23 +3868,23 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
 #endif
 
   memset(buffer, 0, RRC_BUF_SIZE);
-
+  
   size = do_RRCConnectionReconfiguration(ctxt_pP,
                                          buffer,
                                          xid,   //Transaction_id,
-                                         (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList
-                                         (DRB_ToAddModList_t*)*DRB_configList,
+                                         (SRB_ToAddModList_t*)NULL, // SRB_configList
+                                         (DRB_ToAddModList_t*)NULL,
                                          (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
                                          (struct SPS_Config*)NULL,    // *sps_Config,
                                          (struct PhysicalConfigDedicated*)*physicalConfigDedicated,
-#ifdef EXMIMO_IOT
-                                         NULL, NULL, NULL,NULL,
-#else
+// #ifdef EXMIMO_IOT
+//                                          NULL, NULL, NULL,NULL,
+// #else
                                          (MeasObjectToAddModList_t*)MeasObj_list,
                                          (ReportConfigToAddModList_t*)ReportConfig_list,
                                          (QuantityConfig_t*)quantityConfig,
                                          (MeasIdToAddModList_t*)MeasId_list,
-#endif
+// #endif
                                          (MAC_MainConfig_t*)mac_MainConfig,
                                          (MeasGapConfig_t*)NULL,
                                          (MobilityControlInfo_t*)NULL,
@@ -2125,17 +3939,16 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
     size);
 
   rrc_data_req(
-	       ctxt_pP,
-	       DCCH,
-	       rrc_eNB_mui++,
-	       SDU_CONFIRM_NO,
-	       size,
-	       buffer,
-	       PDCP_TRANSMISSION_MODE_CONTROL);
+         ctxt_pP,
+         DCCH,
+         rrc_eNB_mui++,
+         SDU_CONFIRM_NO,
+         size,
+         buffer,
+         PDCP_TRANSMISSION_MODE_CONTROL);
 }
 
 
-
 //-----------------------------------------------------------------------------
 int
 rrc_eNB_generate_RRCConnectionReconfiguration_SCell(
@@ -2217,46 +4030,72 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell(
 void
 rrc_eNB_process_MeasurementReport(
   const protocol_ctxt_t* const ctxt_pP,
-  rrc_eNB_ue_context_t*          const ue_context_pP,
+  rrc_eNB_ue_context_t*         ue_context_pP,
   const MeasResults_t*   const measResults2
 )
 //-----------------------------------------------------------------------------
 {
+  int i=0;
+  int neighboring_cells=-1;
+  
   T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
     T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
 
+  if (measResults2 == NULL )
+    return;
+  
+  if (measResults2->measId > 0 ){
+     if (ue_context_pP->ue_context.measResults == NULL) {
+       ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(MeasResults_t));
+     }
+     ue_context_pP->ue_context.measResults->measId=measResults2->measId; 
+     ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult;
+     ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult;
+     LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140);
+     LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20);
+   }
+   if (measResults2->measResultNeighCells == NULL)
+     return;
+
+   if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) {
+     neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count;
+     
+     if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) {
+       
+       ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells);
+     }
+     ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells;
+     for (i=0; i < neighboring_cells; i++){
+       memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i],
+	       measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i],
+	       sizeof(MeasResultListEUTRA_t));
+       
+       LOG_D(RRC, "Physical Cell Id %d\n",
+	     (int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId);
+       LOG_D(RRC, "RSRP of Target %d\n",
+	     (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult));
+       LOG_D(RRC, "RSRQ of Target %d\n",
+	     (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult));
+     }
+   }
 
-  LOG_I(RRC, "[eNB %d] Frame %d: Process Measurement Report From UE %x (Measurement Id %d)\n",
-        ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId);
-
-  if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) {
-    LOG_I(RRC, "Physical Cell Id %d\n",
-          (int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId);
-    LOG_I(RRC, "RSRP of Target %d\n",
-          (int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
-                 measResult.rsrpResult));
-    LOG_I(RRC, "RSRQ of Target %d\n",
-          (int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
-                 measResult.rsrqResult));
-  }
-
-#if defined(Rel10) || defined(Rel14)
-  LOG_I(RRC, "RSRP of Source %ld\n", measResults2->measResultPCell.rsrpResult);
-  LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultPCell.rsrqResult);
-#else
-  LOG_I(RRC, "RSRP of Source %ld\n", measResults2->measResultServCell.rsrpResult);
-  LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultServCell.rsrqResult);
-#endif
+// #if defined(Rel10) || defined(Rel14)
 
-  if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) {
-    rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP,
-        ue_context_pP,
-        measResults2->measResultNeighCells->choice.
-        measResultListEUTRA.list.array[0]->physCellId);
-  } else {
-    LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame,
-          ctxt_pP->rnti);
-  }
+  
+// #else
+  // LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult);
+  // LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult);
+// #endif
+
+  // if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) {
+  //   rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP,
+  //       ue_context_pP,
+  //       measResults2->measResultNeighCells->choice.
+  //       measResultListEUTRA.list.array[0]->physCellId);
+  // } else {
+  //   LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame,
+  //         ctxt_pP->rnti);
+  // }
 
   //Look for IP address of the target eNB
   //Send Handover Request -> target eNB
@@ -2757,7 +4596,9 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
 			 ue_context_pP->ue_context.rnti,
 			 (BCCH_BCH_Message_t *) NULL,
 			 (RadioResourceConfigCommonSIB_t*) NULL,
+#ifdef Rel14
 			 (RadioResourceConfigCommonSIB_t*) NULL,
+#endif
 			 ue_context_pP->ue_context.physicalConfigDedicated,
 #if defined(Rel10) || defined(Rel14)
 			 (SCellToAddMod_r10_t *)NULL,
@@ -3336,7 +5177,9 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
 			 ue_context_pP->ue_context.rnti,
 			 (BCCH_BCH_Message_t *) NULL,
 			 (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
 			 (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
 			 ue_context_pP->ue_context.physicalConfigDedicated,
 #if defined(Rel10) || defined(Rel14)
 			 (SCellToAddMod_r10_t *)NULL,
@@ -3432,9 +5275,12 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
   uint8_t                            *kRRCenc = NULL;
   uint8_t                            *kRRCint = NULL;
   uint8_t                            *kUPenc = NULL;
+  ue_context_pP->ue_context.ue_reestablishment_timer = 0;
 
   DRB_ToAddModList_t*                 DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid];
   SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid];
+  DRB_ToReleaseList_t*                DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
+  DRB_Identity_t*                     drb_id_p      = NULL;
 
   T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
     T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
@@ -3468,7 +5314,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
     ctxt_pP,
     SRB_configList, //NULL,  //LG-RK 14/05/2014 SRB_configList,
     DRB_configList, 
-    (DRB_ToReleaseList_t *) NULL,
+//    (DRB_ToReleaseList_t *) NULL,
+    DRB_Release_configList2,
     /*RC.rrc[ctxt_pP->module_id]->ciphering_algorithm[ue_mod_idP] |
              (RC.rrc[ctxt_pP->module_id]->integrity_algorithm[ue_mod_idP] << 4),
      */
@@ -3485,7 +5332,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
     ctxt_pP,
     SRB_configList, // NULL,  //LG-RK 14/05/2014 SRB_configList,
     DRB_configList,
-    (DRB_ToReleaseList_t *) NULL
+//    (DRB_ToReleaseList_t *) NULL
+    DRB_Release_configList2
 #if defined(Rel10) || defined(Rel14)
     , (PMCH_InfoList_r9_t *) NULL
 #endif
@@ -3512,6 +5360,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
 	      SRB_configList->list.array[i]->srb_Identity);
       }
     }
+    free(SRB_configList);
+    ue_context_pP->ue_context.SRB_configList2[xid] = NULL;
   }
   
   // Loop through DRBs and establish if necessary
@@ -3561,12 +5411,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
                        ctxt_pP->module_id + 1);  // fourth octet
 
           if (oip_ifup == 0) {    // interface is up --> send a config the DRB
-#      ifdef OAI_EMU
-            oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1;
-            dest_ip_offset = NB_eNB_INST;
-#      else
             dest_ip_offset = 8;
-#      endif
             LOG_I(OIP,
                   "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
                   ctxt_pP->module_id, ctxt_pP->module_id,
@@ -3583,10 +5428,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
                   ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id);
           }
 
-#   else
-#      ifdef OAI_EMU
-          oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1;
-#      endif
 #   endif
 #endif
 
@@ -3608,7 +5449,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
 				 ue_context_pP->ue_context.rnti,
 				 (BCCH_BCH_Message_t *) NULL,
 				 (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
 				 (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
 				 ue_context_pP->ue_context.physicalConfigDedicated,
 #if defined(Rel10) || defined(Rel14)
 				 (SCellToAddMod_r10_t *)NULL,
@@ -3661,7 +5504,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
 				 ue_context_pP->ue_context.rnti,
 				 (BCCH_BCH_Message_t *) NULL,
 				 (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
 				 (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
 				 ue_context_pP->ue_context.physicalConfigDedicated,
 #if defined(Rel10) || defined(Rel14)
 				 (SCellToAddMod_r10_t *)NULL,
@@ -3687,6 +5532,22 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
         }
       }
     }
+   free(DRB_configList);
+    ue_context_pP->ue_context.DRB_configList2[xid] = NULL;
+  }
+
+  if(DRB_Release_configList2 != NULL){
+      for (i = 0; i < DRB_Release_configList2->list.count; i++) {
+          if (DRB_Release_configList2->list.array[i]) {
+              drb_id_p = DRB_Release_configList2->list.array[i];
+              drb_id = *drb_id_p;
+              if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
+                  ue_context_pP->ue_context.DRB_active[drb_id] = 0;
+              }
+          }
+      }
+      free(DRB_Release_configList2);
+      ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL;
   }
 }
 
@@ -3761,7 +5622,9 @@ rrc_eNB_generate_RRCConnectionSetup(
 			       ue_context_pP->ue_context.rnti,
 			       (BCCH_BCH_Message_t *) NULL,
 			       (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
 			       (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
 			       ue_context_pP->ue_context.physicalConfigDedicated,
 #if defined(Rel10) || defined(Rel14)
 			       (SCellToAddMod_r10_t *)NULL,
@@ -3806,9 +5669,13 @@ rrc_eNB_generate_RRCConnectionSetup(
         RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
 
   // activate release timer, if RRCSetupComplete not received after 10 frames, remove UE
-  ue_context_pP->ue_context.ue_release_timer=1;
+  //ue_context_pP->ue_context.ue_release_timer=1;
   // remove UE after 10 frames after RRCConnectionRelease is triggered
-  ue_context_pP->ue_context.ue_release_timer_thres=100;
+  //ue_context_pP->ue_context.ue_release_timer_thres=100;
+     // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
+   ue_context_pP->ue_context.ue_release_timer=1;
+   // remove UE after 10 frames after RRCConnectionRelease is triggered
+   ue_context_pP->ue_context.ue_release_timer_thres=1000;
 }
 
 
@@ -3931,6 +5798,10 @@ openair_rrc_eNB_init(
             , configuration
 #endif
            );
+    for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++) {
+        RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0;
+        RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256);
+    }
   }
 
   rrc_init_global_param();
@@ -4070,7 +5941,7 @@ rrc_eNB_decode_ccch(
         T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
 
 #ifdef RRC_MSG_PRINT
-      LOG_F(RRC,"[MSG] RRC Connection Reestablishement Request\n");
+      LOG_F(RRC,"[MSG] RRC Connection Reestablishment Request\n");
 
       for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) {
         LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]);
@@ -4105,9 +5976,157 @@ rrc_eNB_decode_ccch(
       }
       */
       /* reject all reestablishment attempts for the moment */
-      rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP,
-                       rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti),
-                       CC_id);
+//      rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP,
+//                       rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti),
+//                       CC_id);
+{
+      uint16_t                          c_rnti = 0;
+
+      if (rrcConnectionReestablishmentRequest->ue_Identity.physCellId != RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId) {
+        LOG_E(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), let's reject the UE\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+              rrcConnectionReestablishmentRequest->ue_Identity.physCellId,
+              RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId);
+        rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
+        break;
+      }
+      LOG_D(RRC, "physCellId is %ld\n", rrcConnectionReestablishmentRequest->ue_Identity.physCellId);
+
+      for (i = 0; i < rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.size; i++) {
+        LOG_D(RRC, "rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[%d] = %x\n",
+            i, rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[i]);
+      }
+
+      if (rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size == 0 ||
+          rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size > 2) {
+        LOG_E(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+        rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
+        break;
+
+      }
+
+      c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI);
+      LOG_D(RRC, "c_rnti is %x\n", c_rnti);
+
+      ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti);
+      if (ue_context_p == NULL) {
+        LOG_E(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+        rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
+        break;
+      }
+      int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti);
+      if(ue_context_p->ue_context.ue_reestablishment_timer > 0 || RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0){
+          LOG_I(RRC,
+                PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishment(Previous) don't complete, let's reject the UE\n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+          rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
+          break;
+      }
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            ue_context_p);
+      ue_context_p->ue_context.ul_failure_timer = 0;
+      ue_context_p->ue_context.ue_release_timer = 0;
+      ue_context_p->ue_context.ue_reestablishment_timer = 0;
+      ue_context_p->ue_context.ue_release_timer_s1 = 0;
+      ue_context_p->ue_context.ue_release_timer_rrc = 0;
+
+      /* reset timers */
+      ue_context_p->ue_context.ul_failure_timer = 0;
+      ue_context_p->ue_context.ue_release_timer = 0;
+
+      // insert C-RNTI to map
+      for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+        if (reestablish_rnti_map[i][0] == 0) {
+          reestablish_rnti_map[i][0] = ctxt_pP->rnti;
+          reestablish_rnti_map[i][1] = c_rnti;
+          break;
+        }
+      }
+      LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n",
+            i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]);
+
+#if defined(ENABLE_ITTI)
+      ue_context_p->ue_context.reestablishment_cause = rrcConnectionReestablishmentRequest->reestablishmentCause;
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection reestablishment request from UE physCellId %ld cause %ld\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            rrcConnectionReestablishmentRequest->ue_Identity.physCellId,
+            ue_context_p->ue_context.reestablishment_cause);
+#else
+        LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection restablishment request for UE\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+#endif
+
+#ifndef NO_RRM
+      send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id));
+#else
+
+      ue_context_p->ue_context.primaryCC_id = CC_id;
+
+      //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH;
+      Idx = DCCH;
+      // SRB1
+      ue_context_p->ue_context.Srb1.Active = 1;
+      ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx;
+      memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+      memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+
+      // SRB2: set  it to go through SRB1 with id 1 (DCCH)
+      ue_context_p->ue_context.Srb2.Active = 1;
+      ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx;
+      memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+      memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+
+      rrc_eNB_generate_RRCConnectionReestablishment(ctxt_pP, ue_context_p, CC_id);
+      LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            Idx);
+
+      MSC_LOG_TX_MESSAGE(MSC_RRC_ENB,
+                         MSC_PDCP_ENB,
+                         NULL,
+                         0,
+                         MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB",
+                         MSC_AS_TIME_ARGS(ctxt_pP),
+                         ue_context_p->ue_context.rnti);
+
+      rrc_pdcp_config_asn1_req(ctxt_pP,
+                               ue_context_p->ue_context.SRB_configList,
+                               (DRB_ToAddModList_t *) NULL,
+                               (DRB_ToReleaseList_t*) NULL,
+                               0xff,
+                               NULL,
+                               NULL,
+                               NULL
+#   if defined(Rel10) || defined(Rel14)
+                               , (PMCH_InfoList_r9_t *) NULL
+#   endif
+                               ,NULL);
+
+      rrc_rlc_config_asn1_req(ctxt_pP,
+                              ue_context_p->ue_context.SRB_configList,
+                              (DRB_ToAddModList_t*) NULL,
+                              (DRB_ToReleaseList_t*) NULL
+#   if defined(Rel10) || defined(Rel14)
+                              , (PMCH_InfoList_r9_t *) NULL
+#   endif
+                             );
+#endif //NO_RRM
+      }
       break;
 
     case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest:
@@ -4156,6 +6175,7 @@ rrc_eNB_decode_ccch(
             /* if there is already a registered UE (with another RNTI) with this random_value,
              * the current one must be removed from MAC/PHY (zombie UE)
              */
+#if 0
             if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) {
               LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n",
                     ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti);
@@ -4165,6 +6185,13 @@ rrc_eNB_decode_ccch(
             } else {
               ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
             }
+#endif
+            if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) {
+              LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n",
+                    ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti);
+              ue_context_p->ue_context.ul_failure_timer = 20000;
+            }
+            ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
           } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) {
             /* Save s-TMSI */
             S_TMSI_t   s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI;
@@ -4185,9 +6212,13 @@ rrc_eNB_decode_ccch(
               /* reset timers */
               ue_context_p->ue_context.ul_failure_timer = 0;
               ue_context_p->ue_context.ue_release_timer = 0;
+              ue_context_p->ue_context.ue_reestablishment_timer = 0;
+              ue_context_p->ue_context.ue_release_timer_s1 = 0;
+              ue_context_p->ue_context.ue_release_timer_rrc = 0;
             } else {
 	      LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %p => %x\n",ue_context_p,m_tmsi);
-              ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY);
+//              ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY);
+              ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP,random_value);
               if (ue_context_p == NULL)
                 LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__);
               if (ue_context_p != NULL) {
@@ -4233,6 +6264,7 @@ rrc_eNB_decode_ccch(
 
 #if defined(ENABLE_ITTI)
           ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause;
+          ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1;
 	  if (stmsi_received==0)
 	    LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n",
 		  PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
@@ -4256,6 +6288,11 @@ rrc_eNB_decode_ccch(
 
         } else {
           // no context available
+	  if (rrc_agent_registered[ctxt_pP->module_id]) {
+	    agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+										      ctxt_pP->rnti,
+										      PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+	  }
           LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n",
                 PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
                 random_value);
@@ -4362,9 +6399,14 @@ rrc_eNB_decode_dcch(
   asn_dec_rval_t                      dec_rval;
   //UL_DCCH_Message_t uldcchmsg;
   UL_DCCH_Message_t                  *ul_dcch_msg = NULL; //&uldcchmsg;
-  UE_EUTRA_Capability_t              *UE_EUTRA_Capability = NULL;
   int i;
   struct rrc_eNB_ue_context_s*        ue_context_p = NULL;
+#if defined(ENABLE_ITTI)
+#   if defined(ENABLE_USE_MME)
+  MessageDef *                        msg_delete_tunnels_p = NULL;
+  uint8_t                             xid;
+#endif
+#endif
 
   int dedicated_DRB=0; 
 
@@ -4512,25 +6554,71 @@ rrc_eNB_decode_dcch(
           ue_context_p,
 	  ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
 
-#if defined(FLEXRAN_AGENT_SB_IF)
 	//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]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+	if (rrc_agent_registered[ctxt_pP->module_id]) {
+	  agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
 										ue_context_p->ue_id_rnti,
 										PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED);
 	}
-#endif
       }
 #if defined(ENABLE_ITTI)
 #   if defined(ENABLE_USE_MME)
       if (EPC_MODE_ENABLED == 1) {
 	if (dedicated_DRB == 1){
-	  rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP,
-					     ue_context_p,
-					     ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+//	  rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP,
+//					     ue_context_p,
+//					     ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
+            rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(ctxt_pP,
+                             ue_context_p,
+                             ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+
+            ue_context_p->ue_context.nb_of_modify_e_rabs = 0;
+            ue_context_p->ue_context.nb_of_failed_e_rabs = 0;
+            memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab));
+            for(int i = 0; i < NB_RB_MAX; i++) {
+              ue_context_p->ue_context.modify_e_rab[i].xid = -1;
+            }
+
+          } else if(ue_context_p->ue_context.e_rab_release_command_flag == 1){
+            xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier;
+            ue_context_p->ue_context.e_rab_release_command_flag = 0;
+            //gtp tunnel delete
+            msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ);
+            memset(&GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
+            GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
+            for(i = 0; i < NB_RB_MAX; i++){
+               if(xid == ue_context_p->ue_context.e_rab[i].xid){
+                 GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i];
+                 ue_context_p->ue_context.enb_gtp_teid[i] = 0;
+                 memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i]));
+                 ue_context_p->ue_context.enb_gtp_ebi[i]  = 0;
+               }
+            }
+            itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p);
+            //S1AP_E_RAB_RELEASE_RESPONSE
+            rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(ctxt_pP,
+                    ue_context_p,
+                    xid);
+          } else {
+              rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP,
+                             ue_context_p,
+                             ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+          }
 	}else {
-	  rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
+          if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){
+	    rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
 						       ue_context_p);
+          } else {
+            ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1;
+            for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
+              if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) {
+                ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
+              } else {
+                ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED;
+              }
+            }
+          }
 	}
       }    
 #else  // establish a dedicated bearer 
@@ -4573,6 +6661,51 @@ rrc_eNB_decode_dcch(
             PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
             DCCH,
             sdu_sizeP);
+       {
+        int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
+        RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0;
+        rnti_t reestablish_rnti = 0;
+        // select C-RNTI from map
+        for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+          if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) {
+            reestablish_rnti = reestablish_rnti_map[i][1];
+            ue_context_p = rrc_eNB_get_ue_context(
+                              RC.rrc[ctxt_pP->module_id],
+                              reestablish_rnti);
+            // clear currentC-RNTI from map
+            reestablish_rnti_map[i][0] = 0;
+            reestablish_rnti_map[i][1] = 0;
+            break;
+          }
+        }
+        LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n",
+              i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]);
+
+        if (!ue_context_p) {
+          LOG_E(RRC,
+                PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE context, falt\n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+          break;
+        }
+
+        if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present ==
+            RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) {
+          rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p,
+              ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier,
+              &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8);
+
+          //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
+          if (mac_agent_registered[ctxt_pP->module_id]) {
+            agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+                                                                                      ue_context_p->ue_id_rnti,
+                                                                                      PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
+          }
+        }
+        //ue_context_p->ue_context.ue_release_timer = 0;
+        ue_context_p->ue_context.ue_reestablishment_timer = 1;
+        // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered
+        ue_context_p->ue_context.ue_reestablishment_timer_thres = 1000;
+      }
       break;
 
     case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete:
@@ -4616,14 +6749,12 @@ rrc_eNB_decode_dcch(
           LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n",
                 PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
 	  
-#if defined(FLEXRAN_AGENT_SB_IF)
 	  //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]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+	  if (rrc_agent_registered[ctxt_pP->module_id]) {
+	    agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
 										  ue_context_p->ue_id_rnti,
 										  PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
 	  }
-#endif
         }
       }
 
@@ -4753,18 +6884,33 @@ rrc_eNB_decode_dcch(
       xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
 #endif
       LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
+      if (ue_context_p->ue_context.UE_Capability) {
+        LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti);
+        asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability,
+              ue_context_p->ue_context.UE_Capability, 0);
+        ue_context_p->ue_context.UE_Capability = 0;
+      }
       dec_rval = uper_decode(NULL,
                              &asn_DEF_UE_EUTRA_Capability,
-                             (void **)&UE_EUTRA_Capability,
+                             (void **)&ue_context_p->ue_context.UE_Capability,
                              ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
                              choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
                              array[0]->ueCapabilityRAT_Container.buf,
                              ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
                              choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
                              array[0]->ueCapabilityRAT_Container.size, 0, 0);
-      //#ifdef XER_PRINT
-      //xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability);
-      //#endif
+#ifdef XER_PRINT
+      xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability);
+#endif
+
+      if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
+        LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+              dec_rval.consumed);
+        asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability,
+              ue_context_p->ue_context.UE_Capability, 0);
+        ue_context_p->ue_context.UE_Capability = 0;
+      }
 
 #if defined(ENABLE_USE_MME)
 
@@ -4798,6 +6944,7 @@ rrc_eNB_decode_dcch(
       T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
         T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
 
+      LOG_D(RRC,"[MSG] RRC UL Information Transfer \n");
 #ifdef RRC_MSG_PRINT
       LOG_F(RRC,"[MSG] RRC UL Information Transfer \n");
 
@@ -4951,6 +7098,7 @@ rrc_enb_task(
 
     switch (ITTI_MSG_ID(msg_p)) {
     case TERMINATE_MESSAGE:
+      LOG_W(RRC, " *** Exiting RRC thread\n");
       itti_exit_task();
       break;
 
@@ -5024,13 +7172,22 @@ rrc_enb_task(
       break;
 
     case S1AP_PAGING_IND:
-      LOG_E(RRC, "[eNB %d] Received not yet implemented message %s\n", instance, msg_name_p);
+      LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p);
+      rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance);
       break;
   
     case S1AP_E_RAB_SETUP_REQ: 
       rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance);
       LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p);
       break;
+
+    case S1AP_E_RAB_MODIFY_REQ:
+      rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(msg_p, msg_name_p, instance);
+      break;
+
+    case S1AP_E_RAB_RELEASE_COMMAND:
+      rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(msg_p, msg_name_p, instance);
+      break;
     
     case S1AP_UE_CONTEXT_RELEASE_REQ:
       rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance);
@@ -5044,6 +7201,11 @@ rrc_enb_task(
       /* Nothing to do. Apparently everything is done in S1AP processing */
       //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n",
       //instance, msg_name_p);
+      if (rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)
+          && rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) {
+        rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc =
+        rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc;
+      }
       break;
 
 #   endif
@@ -5123,3 +7285,143 @@ rrc_top_cleanup_eNB(
   free(RC.rrc);
 }
 
+
+//-----------------------------------------------------------------------------
+RRC_status_t
+rrc_rx_tx(
+  protocol_ctxt_t* const ctxt_pP,
+  const int          CC_id
+)
+//-----------------------------------------------------------------------------
+{
+  //uint8_t        UE_id;
+  int32_t        current_timestamp_ms, ref_timestamp_ms;
+  struct timeval ts;
+  struct rrc_eNB_ue_context_s   *ue_context_p = NULL,*ue_to_be_removed = NULL;
+
+#ifdef LOCALIZATION
+  double                         estimated_distance;
+  protocol_ctxt_t                ctxt;
+#endif
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
+
+    check_handovers(ctxt_pP);
+    // counetr, and get the value and aggregate
+
+    // check for UL failure
+    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+      if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
+	if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
+	  LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n",
+		ue_context_p->ue_context.rnti,
+		ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+		ue_context_p->ue_context.ul_failure_timer);
+	}
+	else {
+	  LOG_I(RRC,"UE rnti %x failure timer %d/8\n",
+		ue_context_p->ue_context.rnti,
+		ue_context_p->ue_context.ul_failure_timer);
+	}
+      }
+      if (ue_context_p->ue_context.ul_failure_timer>0) {
+	ue_context_p->ue_context.ul_failure_timer++;
+	if (ue_context_p->ue_context.ul_failure_timer >= 8) {
+	  // remove UE after 20 seconds after MAC has indicated UL failure
+	  LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
+	  ue_to_be_removed = ue_context_p;
+	  break;
+	}
+      }
+      if (ue_context_p->ue_context.ue_release_timer_s1>0) {
+        ue_context_p->ue_context.ue_release_timer_s1++;
+        if (ue_context_p->ue_context.ue_release_timer_s1 >=
+            ue_context_p->ue_context.ue_release_timer_thres_s1) {
+          LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n",
+                         ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1);
+          ue_to_be_removed = ue_context_p;
+          break;
+        }
+      }
+
+      if (ue_context_p->ue_context.ue_release_timer_rrc>0) {
+        ue_context_p->ue_context.ue_release_timer_rrc++;
+        if (ue_context_p->ue_context.ue_release_timer_rrc >=
+          ue_context_p->ue_context.ue_release_timer_thres_rrc) {
+          LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti);
+          ue_to_be_removed = ue_context_p;
+          break;
+        }
+      }
+
+      if (ue_context_p->ue_context.ue_reestablishment_timer>0) {
+        ue_context_p->ue_context.ue_reestablishment_timer++;
+        if (ue_context_p->ue_context.ue_reestablishment_timer >=
+            ue_context_p->ue_context.ue_reestablishment_timer_thres) {
+          LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti);
+          ue_context_p->ue_context.ul_failure_timer = 20000;
+          ue_to_be_removed = ue_context_p;
+          ue_context_p->ue_context.ue_reestablishment_timer = 0;
+          break;
+        }
+      }
+      if (ue_context_p->ue_context.ue_release_timer>0) {
+	ue_context_p->ue_context.ue_release_timer++;
+	if (ue_context_p->ue_context.ue_release_timer >= 
+	    ue_context_p->ue_context.ue_release_timer_thres) {
+	  LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
+	  ue_to_be_removed = ue_context_p;
+	  break;
+	}
+      }
+    }
+    if (ue_to_be_removed) {
+      if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) {
+          ue_to_be_removed->ue_context.ue_release_timer_s1 = 1;
+          ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100;
+          ue_to_be_removed->ue_context.ue_release_timer = 0;
+          ue_to_be_removed->ue_context.ue_reestablishment_timer = 0;
+      }
+      rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
+      if(ue_to_be_removed->ue_context.ul_failure_timer >= 8){
+        ue_to_be_removed->ue_context.ul_failure_timer = 0;
+      }
+    }
+
+#ifdef RRC_LOCALIZATION
+
+    /* for the localization, only primary CC_id might be relevant*/
+    gettimeofday(&ts, NULL);
+    current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
+    ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms;
+    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+      ctxt = *ctxt_pP;
+      ctxt.rnti = ue_context_p->ue_context.rnti;
+      estimated_distance = rrc_get_estimated_ue_distance(
+                             &ctxt,
+                             CC_id,
+                             RC.rrc[ctxt_pP->module_id]->loc_type);
+
+      if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) &&
+          estimated_distance != -1) {
+        LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
+              ctxt.rnti,
+              ctxt_pP->module_id,
+              current_timestamp_ms,
+              ctxt_pP->frame,
+              estimated_distance);
+        LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status);
+        push_front(&RC.rrc[ctxt_pP->module_id]->loc_list,
+                   estimated_distance);
+        RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
+      }
+    }
+
+#endif
+    (void)ts; /* remove gcc warning "unused variable" */
+    (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
+    (void)current_timestamp_ms; /* remove gcc warning "unused variable" */
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+  return (RRC_OK);
+}
+
diff --git a/openair2/RRC/LITE/rrc_eNB_GTPV1U.c b/openair2/RRC/LITE/rrc_eNB_GTPV1U.c
index 568af04fc70d7fae3c2fd27134d7ed5f85ca3a73..e5f2c5aaae1c469c4da1ffbcda1a41a0d7c264d4 100644
--- a/openair2/RRC/LITE/rrc_eNB_GTPV1U.c
+++ b/openair2/RRC/LITE/rrc_eNB_GTPV1U.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -47,7 +47,8 @@ extern RAN_CONTEXT_t RC;
 int
 rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
   const protocol_ctxt_t* const ctxt_pP,
-  const gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP
+  const gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP,
+  uint8_t                         *inde_list
 )
 {
   rnti_t                         rnti;
@@ -66,15 +67,18 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
 
     for (i = 0; i < create_tunnel_resp_pP->num_tunnels; i++) {
       
-      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];
+//      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];
+      ue_context_p->ue_context.enb_gtp_teid[inde_list[i]]  = create_tunnel_resp_pP->enb_S1u_teid[i];
+      ue_context_p->ue_context.enb_gtp_addrs[inde_list[i]] = create_tunnel_resp_pP->enb_addr;
+      ue_context_p->ue_context.enb_gtp_ebi[inde_list[i]]   = 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],
-	    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, 
+            ue_context_p->ue_context.enb_gtp_teid[inde_list[i]],            
+            inde_list[i],
 	    i,
             create_tunnel_resp_pP->eps_bearer_id[i],
 	    create_tunnel_resp_pP->enb_addr.length);
diff --git a/openair2/RRC/LITE/rrc_eNB_GTPV1U.h b/openair2/RRC/LITE/rrc_eNB_GTPV1U.h
index b0c713d6ef21a4b7d8fa36935db2cb1814517f6e..aedbdeac5e12bdd510ad5d286f3d82bf4cab83f2 100644
--- a/openair2/RRC/LITE/rrc_eNB_GTPV1U.h
+++ b/openair2/RRC/LITE/rrc_eNB_GTPV1U.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -43,7 +43,8 @@
 int
 rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
   const protocol_ctxt_t* const ctxt_pP,
-  const gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP
+  const gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP,
+  uint8_t                         *inde_list
 );
 
 #   endif
diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LITE/rrc_eNB_S1AP.c
index 301d4443c38f491213898e60c918db077857a09d..80ae1c9ba57e9e276f5f4581c6dea7c9c7e49bec 100644
--- a/openair2/RRC/LITE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LITE/rrc_eNB_S1AP.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -59,6 +59,10 @@
 #include "gtpv1u_eNB_task.h"
 #include "RRC/LITE/rrc_eNB_GTPV1U.h"
 
+#include "TLVDecoder.h"
+#include "S1ap-NAS-PDU.h"
+#include "flexran_agent_common_internal.h"
+
 extern RAN_CONTEXT_t RC;
 
 /* Value to indicate an invalid UE initial id */
@@ -82,8 +86,80 @@ static const uint16_t S1AP_INTEGRITY_EIA2_MASK = 0x4000;
 #endif
 #endif
 
+void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_context_pP)
+{
+  /* Process NAS message locally to get the IMSI */
+  nas_message_t nas_msg;
+  memset(&nas_msg, 0, sizeof(nas_message_t));
+
+  int size = 0;
 
+  nas_message_security_header_t *header = &nas_msg.header;
+  /* Decode the first octet of the header (security header type or EPS
+  * bearer identity, and protocol discriminator) */
+  DECODE_U8((char *) pdu_buf, *(uint8_t*) (header), size);
 
+  /* Decode NAS message only if decodable*/
+  if (!(header->security_header_type <= SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED
+      && header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE
+      && pdu_len > NAS_MESSAGE_SECURITY_HEADER_SIZE))
+    return;
+
+  if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
+    /* Decode the message authentication code */
+    DECODE_U32((char *) pdu_buf+size, header->message_authentication_code, size);
+    /* Decode the sequence number */
+    DECODE_U8((char *) pdu_buf+size, header->sequence_number, size);
+  }
+
+  /* Note: the value of the pointer (i.e. the address) is given by value, so we
+   * can modify it as we want. The callee retains the original address! */
+  pdu_buf += size;
+  pdu_len -= size;
+
+  /* Decode plain NAS message */
+  EMM_msg *e_msg = &nas_msg.plain.emm;
+  emm_msg_header_t *emm_header = &e_msg->header;
+
+  /* First decode the EMM message header */
+  int e_head_size = 0;
+
+  /* Check that buffer contains more than only the header */
+  if (pdu_len <= sizeof(emm_msg_header_t))
+    return;
+
+  /* Decode the security header type and the protocol discriminator */
+  DECODE_U8(pdu_buf + e_head_size, *(uint8_t *)(emm_header), e_head_size);
+  /* Decode the message type */
+  DECODE_U8(pdu_buf + e_head_size, emm_header->message_type, e_head_size);
+
+  /* Check that this is the right message */
+  if (emm_header->protocol_discriminator != EPS_MOBILITY_MANAGEMENT_MESSAGE)
+    return;
+
+  pdu_buf += e_head_size;
+  pdu_len -= e_head_size;
+
+  if (emm_header->message_type == IDENTITY_RESPONSE) {
+    decode_identity_response(&e_msg->identity_response, pdu_buf, pdu_len);
+
+    if (e_msg->identity_response.mobileidentity.imsi.typeofidentity == MOBILE_IDENTITY_IMSI) {
+      memcpy(&ue_context_pP->ue_context.imsi,
+             &e_msg->identity_response.mobileidentity.imsi,
+             sizeof(ImsiMobileIdentity_t));
+    }
+  } else if (emm_header->message_type == ATTACH_REQUEST) {
+    decode_attach_request(&e_msg->attach_request, pdu_buf, pdu_len);
+
+    if (e_msg->attach_request.oldgutiorimsi.imsi.typeofidentity == MOBILE_IDENTITY_IMSI) {
+      /* the following is very dirty, we cast (implicitly) from
+       * ImsiEpsMobileIdentity_t to ImsiMobileIdentity_t*/
+      memcpy(&ue_context_pP->ue_context.imsi,
+             &e_msg->attach_request.oldgutiorimsi.imsi,
+             sizeof(ImsiMobileIdentity_t));
+    }
+  }
+}
 
 # if defined(ENABLE_ITTI)
 //------------------------------------------------------------------------------
@@ -342,6 +418,8 @@ static void process_eNB_security_key (
 
   /* Saves the security key */
   memcpy (ue_context_pP->ue_context.kenb, security_key_pP, SECURITY_KEY_LENGTH);
+  memset (ue_context_pP->ue_context.nh, 0, SECURITY_KEY_LENGTH);
+  ue_context_pP->ue_context.nh_ncc = -1;
 
   for (i = 0; i < 32; i++) {
     sprintf(&ascii_buffer[2 * i], "%02X", ue_context_pP->ue_context.kenb[i]);
@@ -355,7 +433,7 @@ static void process_eNB_security_key (
 
 
 //------------------------------------------------------------------------------
-static void
+void
 rrc_pdcp_config_security(
   const protocol_ctxt_t* const ctxt_pP,
   rrc_eNB_ue_context_t*          const ue_context_pP,
@@ -390,8 +468,10 @@ rrc_pdcp_config_security(
                      ue_context_pP->ue_context.kenb,
                      &kRRCint);
 
+#if !defined(USRP_REC_PLAY)
 #define DEBUG_SECURITY 1
-
+#endif
+  
 #if defined (DEBUG_SECURITY)
 #undef msg
 #define msg printf
@@ -538,6 +618,10 @@ rrc_eNB_send_S1AP_UPLINK_NAS(
       S1AP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length;
       S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer;
 
+      extract_imsi(S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer,
+                   S1AP_UPLINK_NAS (msg_p).nas_pdu.length,
+                   ue_context_pP);
+
       itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
     }
   }
@@ -559,16 +643,17 @@ rrc_eNB_send_S1AP_UPLINK_NAS(
         &ulInformationTransfer->criticalExtensions.choice.
         c1.choice.ulInformationTransfer_r8;
 
-        if (ulInformationTransferR8->dedicatedInfoType.
-        present ==
-        ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)
+        if (ulInformationTransferR8->dedicatedInfoType.present ==
+            ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS) {
+
+          extract_imsi(ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf,
+                       ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size,
+                       ue_context_pP);
+
           s1ap_eNB_new_data_request (mod_id, ue_index,
-          ulInformationTransferR8->
-          dedicatedInfoType.choice.
-          dedicatedInfoNAS.buf,
-          ulInformationTransferR8->
-          dedicatedInfoType.choice.
-          dedicatedInfoNAS.size);
+              ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf,
+              ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size);
+        }
       }
     }
   }
@@ -670,6 +755,10 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ(
     rrcConnectionSetupComplete->dedicatedInfoNAS.buf;
     S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length = rrcConnectionSetupComplete->dedicatedInfoNAS.size;
 
+    extract_imsi(S1AP_NAS_FIRST_REQ (message_p).nas_pdu.buffer,
+                 S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length,
+                 ue_context_pP);
+
     /* Fill UE identities with available information */
     {
       S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask = UE_IDENTITIES_NONE;
@@ -890,6 +979,7 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
   //MessageDef                     *message_gtpv1u_p = NULL;
   gtpv1u_enb_create_tunnel_req_t  create_tunnel_req;
   gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp;
+  uint8_t                         inde_list[NB_RB_MAX - 3]={0};
 
   struct rrc_eNB_ue_context_s* ue_context_p = NULL;
   protocol_ctxt_t              ctxt;
@@ -935,10 +1025,12 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
         memcpy(&create_tunnel_req.sgw_addr[i],
                &S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].sgw_addr,
                sizeof(transport_layer_addr_t));
+        inde_list[create_tunnel_req.num_tunnels]= i;
+        create_tunnel_req.num_tunnels++;
       }
     
       create_tunnel_req.rnti       = ue_context_p->ue_context.rnti; // warning put zero above
-      create_tunnel_req.num_tunnels    = i;
+//      create_tunnel_req.num_tunnels    = i;
 
       gtpv1u_create_s1u_tunnel(
         instance,
@@ -947,7 +1039,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,
+          &inde_list[0]); 
       ue_context_p->ue_context.setup_e_rabs=ue_context_p->ue_context.nb_of_e_rabs;
     }
 
@@ -1189,6 +1282,7 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const ch
     }
     return (-1);
   } else {
+    ue_context_p->ue_context.ue_release_timer_s1 = 0;
     PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
     rrc_eNB_generate_RRCConnectionRelease(&ctxt, ue_context_p);
     /*
@@ -1263,9 +1357,12 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name
   uint32_t                        eNB_ue_s1ap_id;
   gtpv1u_enb_create_tunnel_req_t  create_tunnel_req;
   gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp;
+  uint8_t                         inde_list[NB_RB_MAX - 3]={0};
 
   struct rrc_eNB_ue_context_s* ue_context_p = NULL;
   protocol_ctxt_t              ctxt;
+  uint8_t                      e_rab_done;
+
   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);
@@ -1296,35 +1393,46 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name
 
       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;
+      e_rab_done = 0;
 
       // keep the previous bearer
       // the index for the rec
       for (i = 0; 
-	   i < nb_e_rabs_tosetup; 
+	  // i < nb_e_rabs_tosetup; 
+           i < NB_RB_MAX - 3;  // loop all e-rabs in e_rab[] 
 	   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];
-
+	//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");
+        // check e-rab status, if e rab status is greater than E_RAB_STATUS_DONE, don't not config this one
+        if(ue_context_p->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE)
+            continue;
+        //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];
+        ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW;
+        ue_context_p->ue_context.e_rab[i].param = S1AP_E_RAB_SETUP_REQ  (msg_p).e_rab_setup_params[e_rab_done];
 
-        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;
+        create_tunnel_req.eps_bearer_id[e_rab_done]       = S1AP_E_RAB_SETUP_REQ  (msg_p).e_rab_setup_params[e_rab_done].e_rab_id;
+        create_tunnel_req.sgw_S1u_teid[e_rab_done]        = S1AP_E_RAB_SETUP_REQ  (msg_p).e_rab_setup_params[e_rab_done].gtp_teid;
 
-        memcpy(&create_tunnel_req.sgw_addr[i],
-               & S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[i].sgw_addr,
+        memcpy(&create_tunnel_req.sgw_addr[e_rab_done],
+               & S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done].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],
+	      i,
+	      create_tunnel_req.sgw_S1u_teid[e_rab_done],
 	       create_tunnel_req.eps_bearer_id[i] );
+        inde_list[e_rab_done] = i;
+        e_rab_done++;        
+        if(e_rab_done >= nb_e_rabs_tosetup){
+            break;
+        }
       }
       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;
+      create_tunnel_req.num_tunnels    = e_rab_done;
       
       // NN: not sure if we should create a new tunnel: need to check teid, etc.
       gtpv1u_create_s1u_tunnel(
@@ -1334,7 +1442,8 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name
 
       rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
           &ctxt,
-          &create_tunnel_resp);
+          &create_tunnel_resp,
+          &inde_list[0]);
 
       ue_context_p->ue_context.setup_e_rabs+=nb_e_rabs_tosetup;
 
@@ -1398,12 +1507,17 @@ int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t* const ctxt_pP,
 	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 
+    } 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);
+    } 
+  }
       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",
@@ -1422,17 +1536,528 @@ int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t* const ctxt_pP,
 	
 	itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
       }
+  for(int i = 0; i < NB_RB_MAX; i++) {
+      ue_context_pP->ue_context.e_rab[i].xid = -1;
+  }
+  
+  return 0;
+}
+
+int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance)
+{
+  int                             i;
+  uint16_t                        ue_initial_id;
+  uint32_t                        eNB_ue_s1ap_id;
+  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
+  protocol_ctxt_t              ctxt;
+
+  ue_initial_id  = S1AP_E_RAB_MODIFY_REQ (msg_p).ue_initial_id;
+  eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_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_D(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_MODIFY_REQ (msg_p).nb_e_rabs_tomodify);
+
+  if (ue_context_p == NULL) {
+    /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */
+    LOG_W(RRC, "[eNB %d] In S1AP_E_RAB_MODIFY_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id);
+    int nb_of_e_rabs_failed = 0;
+    MessageDef *msg_fail_p = NULL;
+
+    msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP);
+
+    S1AP_E_RAB_MODIFY_RESP (msg_fail_p).eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id;
+    S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs = 0;
+
+    for (nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; nb_of_e_rabs_failed++) {
+      S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id =
+              S1AP_E_RAB_MODIFY_REQ (msg_p).e_rab_modify_params[nb_of_e_rabs_failed].e_rab_id;
+      S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause = S1AP_CAUSE_RADIO_NETWORK;
+      S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = 31;//S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances;
+    }
+    S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed;
 
+    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 = eNB_ue_s1ap_id;
+
+    /* Save e RAB information for later */
+    {
+      int j;
+      boolean_t is_treated[S1AP_MAX_E_RAB] = {FALSE};
+      uint8_t nb_of_failed_e_rabs = 0;
+
+      // keep the previous bearer
+      // the index for the rec
+      for (i = 0; i < S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; i++) {
+        if (is_treated[i] == TRUE) {
+          // already treated
+          continue;
+        }
+        for (j = i+1; j < S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; j++) {
+          if (is_treated[j] == FALSE &&
+            S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[j].e_rab_id == S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id) {
+            // handle multiple E-RAB ID
+            ue_context_p->ue_context.modify_e_rab[j].status = E_RAB_STATUS_NEW;
+            ue_context_p->ue_context.modify_e_rab[j].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[j].e_rab_id;
+            ue_context_p->ue_context.modify_e_rab[j].cause = S1AP_CAUSE_RADIO_NETWORK;
+            ue_context_p->ue_context.modify_e_rab[j].cause_value = 31;//S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances;
+            nb_of_failed_e_rabs++;
+            is_treated[i] = TRUE;
+            is_treated[j] = TRUE;
+          }
+        }
+        if (is_treated[i] == TRUE) {
+          // handle multiple E-RAB ID
+          ue_context_p->ue_context.modify_e_rab[i].status = E_RAB_STATUS_NEW;
+          ue_context_p->ue_context.modify_e_rab[i].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id;
+          ue_context_p->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK;
+          ue_context_p->ue_context.modify_e_rab[i].cause_value = 31;//S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances;
+          nb_of_failed_e_rabs++;
+          continue;
+        }
+
+        if (S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].nas_pdu.length == 0) {
+          // nas_pdu.length == 0
+          ue_context_p->ue_context.modify_e_rab[i].status = E_RAB_STATUS_NEW;
+          ue_context_p->ue_context.modify_e_rab[i].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id;
+          ue_context_p->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_NAS;
+          ue_context_p->ue_context.modify_e_rab[i].cause_value = 3;//S1ap_CauseNas_unspecified;
+          nb_of_failed_e_rabs++;
+          is_treated[i] = TRUE;
+          continue;
+        }
+
+        for (j = 0; j < NB_RB_MAX-3; j++) {
+          if (ue_context_p->ue_context.e_rab[j].param.e_rab_id == S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id) {
+            if(ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_TORELEASE || ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_DONE){
+              break;
+            }
+            ue_context_p->ue_context.modify_e_rab[i].status = E_RAB_STATUS_NEW;
+            ue_context_p->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_NOTHING;
+            ue_context_p->ue_context.modify_e_rab[i].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id;
+            ue_context_p->ue_context.modify_e_rab[i].param.qos =  S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].qos;
+            ue_context_p->ue_context.modify_e_rab[i].param.nas_pdu.length = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].nas_pdu.length;
+            ue_context_p->ue_context.modify_e_rab[i].param.nas_pdu.buffer = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].nas_pdu.buffer;
+            ue_context_p->ue_context.modify_e_rab[i].param.sgw_addr = ue_context_p->ue_context.e_rab[j].param.sgw_addr;
+            ue_context_p->ue_context.modify_e_rab[i].param.gtp_teid = ue_context_p->ue_context.e_rab[j].param.gtp_teid;
+
+            is_treated[i] = TRUE;
+            break;
+          }
+        }
+
+        if (is_treated[i] == FALSE) {
+          // handle Unknown E-RAB ID
+          ue_context_p->ue_context.modify_e_rab[i].status = E_RAB_STATUS_NEW;
+          ue_context_p->ue_context.modify_e_rab[i].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id;
+          ue_context_p->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK;
+          ue_context_p->ue_context.modify_e_rab[i].cause_value = 30;//S1ap_CauseRadioNetwork_unknown_E_RAB_ID;
+          nb_of_failed_e_rabs++;
+          is_treated[i] = TRUE;
+        }
+      }
+
+      ue_context_p->ue_context.nb_of_modify_e_rabs = S1AP_E_RAB_MODIFY_REQ  (msg_p).nb_e_rabs_tomodify;
+      ue_context_p->ue_context.nb_of_failed_e_rabs = nb_of_failed_e_rabs;
+    }
+
+    /* TODO parameters yet to process ... */
+    {
+      //      S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr;
+    }
+
+    if (ue_context_p->ue_context.nb_of_failed_e_rabs < ue_context_p->ue_context.nb_of_modify_e_rabs) {
+      if (0 == rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(&ctxt, ue_context_p, 0)) {
+        return (0);
+      }
+    }
+
+    {
+      int nb_of_e_rabs_failed = 0;
+      MessageDef *msg_fail_p = NULL;
+
+      msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP);
+
+      S1AP_E_RAB_MODIFY_RESP (msg_fail_p).eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id;
+//      S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[S1AP_MAX_E_RAB];
+      S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs = 0;
+
+      for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < ue_context_p->ue_context.nb_of_failed_e_rabs; nb_of_e_rabs_failed++) {
+        S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id =
+                ue_context_p->ue_context.modify_e_rab[nb_of_e_rabs_failed].param.e_rab_id;
+        S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause = ue_context_p->ue_context.modify_e_rab[nb_of_e_rabs_failed].cause;
+      }
+      S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed;
+
+      itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p);
+
+      ue_context_p->ue_context.nb_of_modify_e_rabs = 0;
+      ue_context_p->ue_context.nb_of_failed_e_rabs = 0;
+      memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab));
+
+      return (0);
+    }
+  }  // end of ue_context_p != NULL
+}
+
+/*NN: careful about the typcast of xid (long -> uint8_t*/
+int rrc_eNB_send_S1AP_E_RAB_MODIFY_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 i;
+  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_MODIFY_RESP);
+  S1AP_E_RAB_MODIFY_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.nb_of_modify_e_rabs; e_rab++) {
+
+    /* only respond to the corresponding transaction */
+    if (xid == ue_context_pP->ue_context.modify_e_rab[e_rab].xid) {
+      if (ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_DONE) {
+        for (i = 0; i < ue_context_pP->ue_context.setup_e_rabs; i++) {
+          if (ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id == ue_context_pP->ue_context.e_rab[i].param.e_rab_id) {
+            // Update ue_context_pP->ue_context.e_rab
+            ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_ESTABLISHED;
+            ue_context_pP->ue_context.e_rab[i].param.qos = ue_context_pP->ue_context.modify_e_rab[e_rab].param.qos;
+            ue_context_pP->ue_context.e_rab[i].cause = S1AP_CAUSE_NOTHING;
+            break;
+          }
+        }
+        if (i < ue_context_pP->ue_context.setup_e_rabs) {
+          S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id;
+              // TODO add other information from S1-U when it will be integrated
+
+          LOG_D (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d, xid %d): nb_of_modify_e_rabs %d,  e_rab_id %d \n ",
+              e_rabs_done,  e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid,
+              ue_context_pP->ue_context.nb_of_modify_e_rabs,
+              S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id);
+
+          e_rabs_done++;
+        } else {
+          // unexpected
+          S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id;
+
+          S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause = S1AP_CAUSE_RADIO_NETWORK;
+          S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause_value = 30;//S1ap_CauseRadioNetwork_unknown_E_RAB_ID;
+
+          e_rabs_failed++;
+        }
+      } else if ((ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_NEW) ||
+          (ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)){
+        LOG_D (RRC,"E-RAB is NEW or already ESTABLISHED\n");
+      } else {  /* status == E_RAB_STATUS_FAILED; */
+        S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id;
+        // add failure cause when defined
+        S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause = ue_context_pP->ue_context.modify_e_rab[e_rab].cause;
+
+        e_rabs_failed++;
+      }
     } else {
-      /*debug info for the xid */ 
+      /*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);
+             e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, ue_context_pP->ue_context.modify_e_rab[e_rab].xid);
     }
-    
   }
-  
+
+
+  S1AP_E_RAB_MODIFY_RESP (msg_p).nb_of_e_rabs = e_rabs_done;
+  S1AP_E_RAB_MODIFY_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed;
+  // NN: add conditions for e_rabs_failed
+  if (e_rabs_done > 0 || e_rabs_failed > 0) {
+    LOG_D(RRC,"S1AP_E_RAB_MODIFY_RESP: sending the message: nb_of_modify_e_rabs %d, total e_rabs %d, index %d\n",
+    ue_context_pP->ue_context.nb_of_modify_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_MODIFY_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_MODIFY_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);
+  }
+
   return 0;
 }
+int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *msg_name, instance_t instance){
+    uint16_t                        mme_ue_s1ap_id;
+    uint32_t                        eNB_ue_s1ap_id;
+    struct rrc_eNB_ue_context_s*    ue_context_p = NULL;
+    protocol_ctxt_t                 ctxt;
+    e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB];
+    uint8_t nb_e_rabs_torelease;
+    int erab;
+    int i;
+    uint8_t b_existed,is_existed;
+    uint8_t xid;
+    uint8_t e_rab_release_drb;
+    MessageDef *                    msg_delete_tunnels_p = NULL;
+    e_rab_release_drb = 0;
+    memcpy(&e_rab_release_params[0], &(S1AP_E_RAB_RELEASE_COMMAND (msg_p).e_rab_release_params[0]), sizeof(e_rab_release_t)*S1AP_MAX_E_RAB);
+
+    mme_ue_s1ap_id  = S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id;
+    eNB_ue_s1ap_id = S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id;
+    nb_e_rabs_torelease = S1AP_E_RAB_RELEASE_COMMAND (msg_p).nb_e_rabs_torelease;
+    ue_context_p   = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id);
+    if(ue_context_p != NULL){
+        PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
+
+        xid = rrc_eNB_get_next_transaction_identifier(ctxt.module_id);
+
+        LOG_D(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d  ENB_UE_S1AP_ID %d release_e_rabs %d \n",
+            mme_ue_s1ap_id, eNB_ue_s1ap_id,nb_e_rabs_torelease);
+        for(erab = 0; erab < nb_e_rabs_torelease; erab++){
+            b_existed = 0;
+            is_existed = 0;
+            for ( i = erab-1;  i>= 0; i--){
+                if (e_rab_release_params[erab].e_rab_id == e_rab_release_params[i].e_rab_id){
+                    is_existed = 1;
+                    break;
+                }
+            }
+            if(is_existed == 1){
+                //e_rab_id is existed
+                continue;
+            }
+            for ( i = 0;  i < NB_RB_MAX; i++){
+                if (e_rab_release_params[erab].e_rab_id == ue_context_p->ue_context.e_rab[i].param.e_rab_id){
+                    b_existed = 1;
+                    break;
+                }
+            }
+            if(b_existed == 0) {
+                //no e_rab_id
+                ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id;
+                ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK;
+                ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 30;
+                ue_context_p->ue_context.nb_release_of_e_rabs++;
+            } else {
+                if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_FAILED){
+                    ue_context_p->ue_context.e_rab[i].xid = xid;
+                    continue;
+                } else if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED){
+                    ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_TORELEASE;
+                    ue_context_p->ue_context.e_rab[i].xid = xid;
+                    e_rab_release_drb++;
+                }else{
+                    //e_rab_id status NG
+                    ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id;
+                    ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK;
+                    ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 0;
+                    ue_context_p->ue_context.nb_release_of_e_rabs++;
+                }
+            }
+        }
+        if(e_rab_release_drb > 0) {
+            //RRCConnectionReconfiguration To UE
+            rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(&ctxt, ue_context_p, xid, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.length, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.buffer);
+        } else {
+            //gtp tunnel delete
+            msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ);
+            memset(&GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
+            GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
+            for(i = 0; i < NB_RB_MAX; i++){
+               if(xid == ue_context_p->ue_context.e_rab[i].xid){
+                 GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i];
+                 ue_context_p->ue_context.enb_gtp_teid[i] = 0;
+                 memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i]));
+                 ue_context_p->ue_context.enb_gtp_ebi[i]  = 0;
+               }
+            }
+
+            itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p);
+
+            //S1AP_E_RAB_RELEASE_RESPONSE
+            rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid);
+        }
+    } else {
+        LOG_E(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d  ENB_UE_S1AP_ID %d  Error ue_context_p NULL \n",
+            S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id, S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id);
+         return -1;
+    }
+
+    return 0;
+}
+
+
+int rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, uint8_t xid){
+    int e_rabs_released = 0;
+    MessageDef   *msg_p;
+
+    msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_RELEASE_RESPONSE);
+    S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
+    
+    for (int i = 0;  i < NB_RB_MAX; i++){
+        if (xid == ue_context_pP->ue_context.e_rab[i].xid){
+            S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rab_release[e_rabs_released].e_rab_id = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
+            e_rabs_released++;
+            //clear
+            memset(&ue_context_pP->ue_context.e_rab[i],0,sizeof(e_rab_param_t));
+        }
+    }
+    S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_released = e_rabs_released;
+    S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_failed = ue_context_pP->ue_context.nb_release_of_e_rabs;
+    memcpy(&(S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rabs_failed[0]),&ue_context_pP->ue_context.e_rabs_release_failed[0],sizeof(e_rab_failed_t)*ue_context_pP->ue_context.nb_release_of_e_rabs);
+
+    ue_context_pP->ue_context.setup_e_rabs -= e_rabs_released;
+    LOG_I(RRC,"S1AP-E-RAB RELEASE RESPONSE: ENB_UE_S1AP_ID %d release_e_rabs %d setup_e_rabs %d \n",
+              S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id,
+              e_rabs_released, ue_context_pP->ue_context.setup_e_rabs);
+    
+    itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
+    //clear xid
+    for(int i = 0; i < NB_RB_MAX; i++) {
+        ue_context_pP->ue_context.e_rab[i].xid = -1;
+    }
+    //clear release e_rabs
+    ue_context_pP->ue_context.nb_release_of_e_rabs = 0;
+    memset(&ue_context_pP->ue_context.e_rabs_release_failed[0],0,sizeof(e_rab_failed_t)*S1AP_MAX_E_RAB);
+    return 0;
+}
+
+/*------------------------------------------------------------------------------*/
+int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance_t instance)
+{
+  const unsigned int Ttab[4] = {32,64,128,256};
+  uint8_t Tc,Tue;  /* DRX cycle of UE */
+  uint32_t pcch_nB;  /* 4T, 2T, T, T/2, T/4, T/8, T/16, T/32 */
+  uint32_t N;  /* N: min(T,nB). total count of PF in one DRX cycle */
+  uint32_t Ns = 0;  /* Ns: max(1,nB/T) */
+  uint8_t i_s;  /* i_s = floor(UE_ID/N) mod Ns */
+  uint32_t T;  /* DRX cycle */
+  for (uint16_t tai_size = 0; tai_size < S1AP_PAGING_IND(msg_p).tai_size; tai_size++) {
+       LOG_D(RRC,"[eNB %d] In S1AP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc,
+             S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, S1AP_PAGING_IND(msg_p).tac[tai_size]);
+      if (RC.rrc[instance]->configuration.mcc == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc
+          && RC.rrc[instance]->configuration.mnc == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc
+          && RC.rrc[instance]->configuration.tac == S1AP_PAGING_IND(msg_p).tac[tai_size]) {
+          for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+              lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type;
+              /* get nB from configuration */
+              /* get default DRX cycle from configuration */
+              Tc = (uint8_t)RC.rrc[instance]->configuration.pcch_defaultPagingCycle[CC_id];
+              if (Tc < PCCH_Config__defaultPagingCycle_rf32 || Tc > PCCH_Config__defaultPagingCycle_rf256) {
+                  continue;
+              }
+              Tue = (uint8_t)S1AP_PAGING_IND(msg_p).paging_drx;
+              /* set T = min(Tc,Tue) */
+              T = Tc < Tue ? Ttab[Tc] : Ttab[Tue];
+              /* set pcch_nB = PCCH-Config->nB */
+              pcch_nB = (uint32_t)RC.rrc[instance]->configuration.pcch_nB[CC_id];
+              switch (pcch_nB) {
+                case PCCH_Config__nB_fourT:
+                    Ns = 4;
+                    break;
+                case PCCH_Config__nB_twoT:
+                    Ns = 2;
+                    break;
+                default:
+                    Ns = 1;
+                    break;
+              }
+              /* set N = min(T,nB) */
+              if (pcch_nB > PCCH_Config__nB_oneT) {
+                switch (pcch_nB) {
+                case PCCH_Config__nB_halfT:
+                  N = T/2;
+                  break;
+                case PCCH_Config__nB_quarterT:
+                  N = T/4;
+                  break;
+                case PCCH_Config__nB_oneEighthT:
+                  N = T/8;
+                  break;
+                case PCCH_Config__nB_oneSixteenthT:
+                  N = T/16;
+                  break;
+                case PCCH_Config__nB_oneThirtySecondT:
+                  N = T/32;
+                  break;
+                default:
+                  /* pcch_nB error */
+                  LOG_E(RRC, "[eNB %d] In S1AP_PAGING_IND:  pcch_nB error (pcch_nB %d) \n",
+                      instance, pcch_nB);
+                  return (-1);
+                }
+              } else {
+                N = T;
+              }
+
+              /* insert data to UE_PF_PO or update data in UE_PF_PO */
+              pthread_mutex_lock(&ue_pf_po_mutex);
+              uint8_t i = 0;
+              for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+                if ((UE_PF_PO[CC_id][i].enable_flag == TRUE && UE_PF_PO[CC_id][i].ue_index_value == (uint16_t)(S1AP_PAGING_IND(msg_p).ue_index_value))
+                    || (UE_PF_PO[CC_id][i].enable_flag != TRUE)) {
+                    /* set T = min(Tc,Tue) */
+                    UE_PF_PO[CC_id][i].T = T;
+                    /* set UE_ID */
+                    UE_PF_PO[CC_id][i].ue_index_value = (uint16_t)S1AP_PAGING_IND(msg_p).ue_index_value;
+                    /* calculate PF and PO */
+                    /* set PF_min : SFN mod T = (T div N)*(UE_ID mod N) */
+                    UE_PF_PO[CC_id][i].PF_min = (T / N) * (UE_PF_PO[CC_id][i].ue_index_value % N);
+                    /* set PO */
+                    /* i_s = floor(UE_ID/N) mod Ns */
+                    i_s = (uint8_t)((UE_PF_PO[CC_id][i].ue_index_value / N) % Ns);
+                    if (Ns == 1) {
+                        UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? 9 : 0;
+                    } else if (Ns==2) {
+                        UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4+(5*i_s)) : (5*i_s);
+                    } else if (Ns==4) {
+                        UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4*(i_s&1)+(5*(i_s>>1))) : ((i_s&1)+(5*(i_s>>1)));
+                    }
+                    if (UE_PF_PO[CC_id][i].enable_flag == TRUE) {
+                        //paging exist UE log
+                        LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Update exist UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO);
+                    } else {
+                        /* set enable_flag */
+                        UE_PF_PO[CC_id][i].enable_flag = TRUE;
+                        //paging new UE log
+                        LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Insert a new UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO);
+                    }
+                    break;
+                }
+              }
+              pthread_mutex_unlock(&ue_pf_po_mutex);
+
+              uint32_t length;
+              uint8_t buffer[RRC_BUF_SIZE];
+              uint8_t *message_buffer;
+              /* Transfer data to PDCP */
+              MessageDef *message_p;
+              message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_PCCH_DATA_REQ);
+              /* Create message for PDCP (DLInformationTransfer_t) */
+              length = do_Paging (instance,
+                                  buffer,
+                                  S1AP_PAGING_IND(msg_p).ue_paging_identity,
+                                  S1AP_PAGING_IND(msg_p).cn_domain);
+              message_buffer = itti_malloc (TASK_RRC_ENB, TASK_PDCP_ENB, length);
+              /* Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). */
+              memcpy (message_buffer, buffer, length);
+              RRC_PCCH_DATA_REQ (message_p).sdu_size  = length;
+              RRC_PCCH_DATA_REQ (message_p).sdu_p     = message_buffer;
+              RRC_PCCH_DATA_REQ (message_p).mode      = PDCP_TRANSMISSION_MODE_TRANSPARENT;  /* not used */
+              RRC_PCCH_DATA_REQ (message_p).rnti      = P_RNTI;
+              RRC_PCCH_DATA_REQ (message_p).ue_index  = i;
+              RRC_PCCH_DATA_REQ (message_p).CC_id  = CC_id;
+              LOG_D(RRC, "[eNB %d] CC_id %d In S1AP_PAGING_IND: send encdoed buffer to PDCP buffer_size %d\n", instance, CC_id, length);
+              itti_send_msg_to_task (TASK_PDCP_ENB, instance, message_p);
+          }
+      }
+  }
+
+  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 a57002010c646f23b5b6d8b35735c29af5342c47..a924caf254c664159089e1bcf27579bbbb687b67 100644
--- a/openair2/RRC/LITE/rrc_eNB_S1AP.h
+++ b/openair2/RRC/LITE/rrc_eNB_S1AP.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -79,6 +79,11 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co
                                                      const uint8_t                ho_state
                                                      );
 
+int
+rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+                                                     rrc_eNB_ue_context_t*          const ue_context_pP,
+                                                     const uint8_t                ho_state
+                                                     );
 
 /*! \fn void rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(uint8_t mod_id, uint8_t ue_index)
  *\brief create a S1AP_INITIAL_CONTEXT_SETUP_RESP for S1AP.
@@ -186,6 +191,24 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name
  */
 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_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance);
+ *\brief process a S1AP dedicated E_RAB modify 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_MODIFY_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance);
+
+/*! \fn rrc_eNB_send_S1AP_E_RAB_MODIFY_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 modify 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_MODIFY_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.
@@ -213,6 +236,39 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ (MessageDef *msg_p, const char *
  */
 int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const char *msg_name, instance_t instance);
 
+/*! \fn rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance_t instance)
+ *\brief process a S1AP_PAGING_IND 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_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance_t instance);
+
+void
+rrc_pdcp_config_security(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP,
+  const uint8_t send_security_mode_command
+);
+/*! \fn rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *msg_name, instance_t instance);
+ *\brief process a S1AP dedicated E_RAB release command 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_RELEASE_COMMAND(MessageDef *msg_p, const char *msg_name, instance_t instance);
+
+/*! \fn rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(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 release 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_RELEASE_RESPONSE(const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t*  const ue_context_pP, uint8_t xid );
+
 #   endif
 # endif /* defined(ENABLE_USE_MME) */
 #endif /* RRC_ENB_S1AP_H_ */
diff --git a/openair2/RRC/LITE/rrc_eNB_UE_context.c b/openair2/RRC/LITE/rrc_eNB_UE_context.c
index 3672d23b7cd7bbf3ecc39987a4604bfe81203ce9..0ae3d7ca151fbed5b997f51ac09b5bde03f1e0c6 100644
--- a/openair2/RRC/LITE/rrc_eNB_UE_context.c
+++ b/openair2/RRC/LITE/rrc_eNB_UE_context.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -136,6 +136,10 @@ rrc_eNB_allocate_new_UE_context(
 
   memset(new_p, 0, sizeof(struct rrc_eNB_ue_context_s));
   new_p->local_uid = uid_linear_allocator_new(rrc_instance_pP);
+  for(int i = 0; i < NB_RB_MAX; i++) {
+      new_p->ue_context.e_rab[i].xid = -1;
+      new_p->ue_context.modify_e_rab[i].xid = -1;
+  }
   return new_p;
 }
 
@@ -151,7 +155,21 @@ rrc_eNB_get_ue_context(
   memset(&temp, 0, sizeof(struct rrc_eNB_ue_context_s));
   /* eNB ue rrc id = 24 bits wide */
   temp.ue_id_rnti = rntiP;
+#if 0
   return RB_FIND(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp);
+#endif
+  struct rrc_eNB_ue_context_s   *ue_context_p = NULL;
+  ue_context_p = RB_FIND(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp);
+  if ( ue_context_p != NULL) {
+    return ue_context_p;
+  } else {
+    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(rrc_instance_pP->rrc_ue_head)) {
+      if (ue_context_p->ue_context.rnti == rntiP) {
+        return ue_context_p;
+      }
+    }
+    return NULL;
+  }
 }
 
 
@@ -184,6 +202,7 @@ void rrc_eNB_remove_ue_context(
   rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_pP);
   uid_linear_allocator_free(rrc_instance_pP, ue_context_pP->local_uid);
   free(ue_context_pP);
+  rrc_instance_pP->Nb_ue --;
   LOG_I(RRC,
         PROTOCOL_RRC_CTXT_UE_FMT" Removed UE context\n",
         PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
diff --git a/openair2/RRC/LITE/rrc_eNB_UE_context.h b/openair2/RRC/LITE/rrc_eNB_UE_context.h
index 808628f67c569c0a608387afcfbb413ed4616e1e..0e813cdee526819145296ff477ee620f39b00b1d 100644
--- a/openair2/RRC/LITE/rrc_eNB_UE_context.h
+++ b/openair2/RRC/LITE/rrc_eNB_UE_context.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/LITE/rrc_eNB_ral.c b/openair2/RRC/LITE/rrc_eNB_ral.c
index 32160d8c42b414ce208e3d6364e9558f7d848d9f..94e25a6eebcb140a47e8032c2c7e4d22d8603949 100644
--- a/openair2/RRC/LITE/rrc_eNB_ral.c
+++ b/openair2/RRC/LITE/rrc_eNB_ral.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/LITE/rrc_eNB_ral.h b/openair2/RRC/LITE/rrc_eNB_ral.h
index 8501758ba3309f99224cbf441483ec736301704c..143537e45cb1bb8b32af540f675dc93d55851694 100644
--- a/openair2/RRC/LITE/rrc_eNB_ral.h
+++ b/openair2/RRC/LITE/rrc_eNB_ral.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/LITE/rrc_rrm_interface.c b/openair2/RRC/LITE/rrc_rrm_interface.c
index 79d0c5eee8e4618ceb926d2330e8324b433865af..9f4270be8941487cc8ffe55bd0f08f1a316a1865 100644
--- a/openair2/RRC/LITE/rrc_rrm_interface.c
+++ b/openair2/RRC/LITE/rrc_rrm_interface.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -292,10 +292,5 @@ int send_msg_fifo(int *s, msg_t *fmsg)
 
 int send_msg(void *s, msg_t *smsg)
 {
-#ifdef USER_MODE
   send_msg_sock((sock_rrm_t *)s, smsg);
-#else
-  send_msg_fifo((int *)s,smsg);
-#endif
-
 }
diff --git a/openair2/RRC/LITE/rrc_rrm_interface.h b/openair2/RRC/LITE/rrc_rrm_interface.h
index 6a566f150d7766f1a46a41fcf7c8fbde42d49dbe..0880859a59d6cd2c91ab4e339b4039bb71322227 100644
--- a/openair2/RRC/LITE/rrc_rrm_interface.h
+++ b/openair2/RRC/LITE/rrc_rrm_interface.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -101,8 +101,6 @@ extern "C" {
 #define START_MSG_PUSU 0xCC
 
 
-#ifdef USER_MODE
-
 #include <sys/socket.h>
 #include <sys/un.h>
 
@@ -128,16 +126,6 @@ char *recv_msg( sock_rrm_t *s ) ;
 }
 #endif
 
-#else //USER_MODE
-#include <rtai_fifos.h>
-
-#define RRC2RRM_FIFO 14
-#define RRM2RRC_FIFO 15
-int send_msg_fifo(int *s ,msg_t *msg ) ;
-#endif //USER_MODE
-
 int send_msg(void *, msg_t *);
 
-
-
 #endif
diff --git a/openair2/RRC/LITE/rrc_types.h b/openair2/RRC/LITE/rrc_types.h
index 64d143a2784fd4793c43ccf98a74f6783ba2d971..9c1e37494f1eda3b3546709d458fced10d5b6de3 100644
--- a/openair2/RRC/LITE/rrc_types.h
+++ b/openair2/RRC/LITE/rrc_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/LITE/rrc_types_NB_IoT.h b/openair2/RRC/LITE/rrc_types_NB_IoT.h
new file mode 100644
index 0000000000000000000000000000000000000000..0266572cd01dd91fc327eadcd579c7b069e63592
--- /dev/null
+++ b/openair2/RRC/LITE/rrc_types_NB_IoT.h
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file rrc_types.h
+* \brief rrc types and subtypes
+* \author Navid Nikaein and Raymond Knopp
+* \date 2011 - 2014
+* \version 1.0
+* \company Eurecom
+* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr
+*/
+
+#ifndef RRC_TYPES_NB_IOT_H_
+#define RRC_TYPES_NB_IOT_H_
+
+typedef enum Rrc_State_NB_IoT_e {
+  RRC_STATE_INACTIVE_NB_IoT=0,
+  RRC_STATE_IDLE_NB_IoT,
+  RRC_STATE_CONNECTED_NB_IoT,
+
+  RRC_STATE_FIRST_NB_IoT = RRC_STATE_INACTIVE_NB_IoT,
+  RRC_STATE_LAST_NB_IoT = RRC_STATE_CONNECTED_NB_IoT,
+} Rrc_State_NB_IoT_t;
+
+typedef enum Rrc_Sub_State_NB_IoT_e {
+  RRC_SUB_STATE_INACTIVE_NB_IoT=0,
+
+  RRC_SUB_STATE_IDLE_SEARCHING_NB_IoT,
+  RRC_SUB_STATE_IDLE_RECEIVING_SIB_NB_IoT,
+  RRC_SUB_STATE_IDLE_SIB_COMPLETE_NB_IoT,
+  RRC_SUB_STATE_IDLE_CONNECTING_NB_IoT,
+  RRC_SUB_STATE_IDLE_NB_IoT,
+
+  RRC_SUB_STATE_CONNECTED_NB_IoT,
+
+  RRC_SUB_STATE_INACTIVE_FIRST_NB_IoT = RRC_SUB_STATE_INACTIVE_NB_IoT,
+  RRC_SUB_STATE_INACTIVE_LAST_NB_IoT = RRC_SUB_STATE_INACTIVE_NB_IoT,
+
+  RRC_SUB_STATE_IDLE_FIRST_NB_IoT = RRC_SUB_STATE_IDLE_SEARCHING_NB_IoT,
+  RRC_SUB_STATE_IDLE_LAST_NB_IoT = RRC_SUB_STATE_IDLE_NB_IoT,
+
+  RRC_SUB_STATE_CONNECTED_FIRST_NB_IoT = RRC_SUB_STATE_CONNECTED_NB_IoT,
+  RRC_SUB_STATE_CONNECTED_LAST_NB_IoT = RRC_SUB_STATE_CONNECTED_NB_IoT,
+} Rrc_Sub_State_NB_IoT_t;
+
+#endif /* RRC_TYPES_H_ */
diff --git a/openair2/RRC/LITE/rrm_2_rrc_msg.c b/openair2/RRC/LITE/rrm_2_rrc_msg.c
index 738f2a70f6ea92d912b9f274691f9c060742c3c1..3ed3a9d8594a3f4fbc6f583b0a08d7531cda551d 100644
--- a/openair2/RRC/LITE/rrm_2_rrc_msg.c
+++ b/openair2/RRC/LITE/rrm_2_rrc_msg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -65,17 +65,12 @@ void  fn_rrc (void)
   /******************************************************************************/
 
   msg_head_t *Header ;
-#ifdef USER_MODE
   char *Data;
-#else
-  int bytes_read;
-#endif
 
   L2_ID Mac_id;
 
   while(1) {
 
-#ifdef USER_MODE
     Header = (msg_head_t *) recv_msg(&S_rrc) ;
 
     if(Header==NULL) {
@@ -83,52 +78,9 @@ void  fn_rrc (void)
     }
 
     Data_to_read=Header->size;
-#else
-
-    if(Header_read_idx < Header_size) {
-      bytes_read = rtf_get (RRM2RRC_FIFO,&Header_buf[Header_read_idx],Header_size-Header_read_idx);
-
-      if(bytes_read >0) {
-        msg("RRC: GET FIFOS RETURNS %d bytes, header %d\n",bytes_read,Header_read_idx);
-      }
-
-      Header_read_idx+=bytes_read;
-
-      if(Header_read_idx == Header_size) {
-        Header = (msg_head_t *) Header_buf;
-        Data_to_read=Header->size;
-        msg("RRC: Header read completed, data size %d\n",Data_to_read);
-      }
-      //msg("[fn_rrc]TTI %d: rcv_msg return Null\n",Rrc_xface->Frame_index);
-      else {
-        break;
-      }
-    }
-
-#endif
 
     if (Data_to_read > 0 ) {
-#ifdef USER_MODE
       Data = (char *) (Header +1) ;
-#else
-      bytes_read = rtf_get (RRM2RRC_FIFO,&Data[Data_read_idx],Data_to_read);
-
-      if(bytes_read >0) {
-        msg("RRC: GET FIFOS RETURNS %d bytes, Data_to_read %d\n",bytes_read,Data_to_read);
-      }
-
-      Data_to_read-=bytes_read;
-      Data_read_idx+=bytes_read;
-
-      if(Data_to_read > 0 ) {
-        break;
-      }
-
-      msg("RRC: DATA read completed, data size %d\n",Data_to_read);
-      Header_read_idx=0;
-      Data_read_idx=0;
-      Data_to_read=0;
-#endif
     }
 
     msg("Got MSG of Type %d on Inst %d\n",Header->msg_type,Header->inst);
diff --git a/openair2/RRC/LITE/utils.c b/openair2/RRC/LITE/utils.c
index 832a61979a8d2d7ffdd2a65f9e25525573d9ff9c..bbf97046bf5a0baba7f8b1eda2f866076610863f 100644
--- a/openair2/RRC/LITE/utils.c
+++ b/openair2/RRC/LITE/utils.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,25 +29,8 @@ ________________________________________________________________*/
 
 
 
-//#include "openair_types.h"
 #include "defs.h"
 #include "extern.h"
-//#include "openair_proto.h"
-
-
-#ifndef USER_MODE
-char bcmp(void *x, void *y,int Size )
-{
-  unsigned char i;
-
-  for(i=0; i<Size; i++)
-    if(*(char*)(x+i)!= *(char*)(y+i)) {
-      return 1;
-    }
-
-  return 0;
-}
-#endif
 
 
 //------------------------------------------------------------------------------------------------------------------//
@@ -63,7 +46,6 @@ uint16_t find_free_dtch_position(uint8_t Mod_id, uint16_t UE_CH_index)
 
   for(i=j; i<NB_RAB_MAX; i++) { //first RAB IS BROADCAST DTCH
 
-    //msg("i=%d\n",i);
     if(CH_rrc_inst[Mod_id].Rab[i][UE_CH_index].Active==0) {
       return( i);
     }
@@ -130,11 +112,7 @@ uint8_t find_rrc_info_index(uint8_t Mod_id,uint8_t CH_id)
     if(Rrc_inst[Mod_id].Rrc_info[i].Info.UE_info.CH_id == CH_id) return i;
   }
   error_msg("[OPENAIR][RRC] RRC_INFO_INDEX: FATAL ERROR: Not yet Pre_Synchronized with CH ???%d\n",CH_id);
-  #ifndef USER_MODE
-  //  mac_xface->macphy_exit();
-  #else
   exit(-1);
-  #endif
   */
 }
 /*
diff --git a/openair2/RRC/LITE/vars.h b/openair2/RRC/LITE/vars.h
index 906cb63ac427ea12adbe4d2baedefb0948da07c5..e3bab5f5eb48aa577400a62d92d1397ab2ed25cf 100644
--- a/openair2/RRC/LITE/vars.h
+++ b/openair2/RRC/LITE/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,6 +36,8 @@
 #include "COMMON/mac_rrc_primitives.h"
 #include "LAYER2/MAC/defs.h"
 
+UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+pthread_mutex_t ue_pf_po_mutex;
 UE_RRC_INST *UE_rrc_inst;
 #include "LAYER2/MAC/extern.h"
 #define MAX_U32 0xFFFFFFFF
@@ -236,4 +238,10 @@ float RSRQ_meas_mapping[35] = {
   -2
 };
 
+// only used for RRC connection re-establishment procedure TS36.331 5.3.7
+// [0]: current C-RNTI, [1]: prior C-RNTI
+// insert one when eNB received RRCConnectionReestablishmentRequest message
+// delete one when eNB received RRCConnectionReestablishmentComplete message
+uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2] = {{0}};
+
 #endif
diff --git a/openair2/RRC/NAS/nas_config.c b/openair2/RRC/NAS/nas_config.c
index 07d65312e5e7460bf5dcc16d79d77a156ec1b434..3f825760dae1c329591c9a4936e72ba36e0a1876 100644
--- a/openair2/RRC/NAS/nas_config.c
+++ b/openair2/RRC/NAS/nas_config.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/NAS/nas_config.h b/openair2/RRC/NAS/nas_config.h
index 227663858187b6e5d8eb86464f2eafaa214ece27..4426ca9a1aabfd2eb9be65ffb2bb9886f72534fe 100644
--- a/openair2/RRC/NAS/nas_config.h
+++ b/openair2/RRC/NAS/nas_config.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/NAS/rb_config.c b/openair2/RRC/NAS/rb_config.c
index da80ea108d674ae9963cba13ff4f1b0980ab2c3e..3431137f7419c36cab0166da47c654195894897b 100644
--- a/openair2/RRC/NAS/rb_config.c
+++ b/openair2/RRC/NAS/rb_config.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/RRC/NAS/rb_config.h b/openair2/RRC/NAS/rb_config.h
index a4525b2d65e81265bdc793448f9b16928f856b56..6af42bac455a1d74f3a1f128754a2df4ab0b7247 100644
--- a/openair2/RRC/NAS/rb_config.h
+++ b/openair2/RRC/NAS/rb_config.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c
index 235acef2471eb52c7c2bd6c30f25f79f8b1d93ff..52a4f90ce008b3996aeb1bb1e4ec8642f39a9b69 100644
--- a/openair2/UTIL/ASYNC_IF/link_manager.c
+++ b/openair2/UTIL/ASYNC_IF/link_manager.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h
index a25c072b41245d17915b044dfde7e01c669452fd..90ede6c3db61865692c72c4d2721da720cd9350c 100644
--- a/openair2/UTIL/ASYNC_IF/link_manager.h
+++ b/openair2/UTIL/ASYNC_IF/link_manager.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c
index ee6c92d852a670d276720e7038f043a06eee8d94..55b7a104cd1c271b9cd4925789d5b88ca7e897e3 100644
--- a/openair2/UTIL/ASYNC_IF/message_queue.c
+++ b/openair2/UTIL/ASYNC_IF/message_queue.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h
index 4e46ec08d673064702f025edd879405526b6fbe0..8fedddcc7751fa0233dcd5fbf133df88d6581062 100644
--- a/openair2/UTIL/ASYNC_IF/message_queue.h
+++ b/openair2/UTIL/ASYNC_IF/message_queue.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
index 047e3f716c67cba5558948356fdaa76518acf9db..b178d3a5d665d7d2864f762a2a39e3b7888cf2bd 100644
--- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
+++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -117,7 +117,7 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority) {
   return 0;
 }
 
-message_queue_t destroy_message_queue(message_queue_t *queue) {
+void destroy_message_queue(message_queue_t *queue) {
   struct lfds700_misc_prng_state ls;
 
   message_t *m;
diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
index 7dc4637404773c67457b8ec7680e5aedcbce167f..04414cbbb2b9618379ad1284a056943e04539c23 100644
--- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
+++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -48,6 +48,6 @@ typedef struct {
 message_queue_t * new_message_queue(int size);
 int message_put(message_queue_t *queue, void *data, int size, int priority);
 int message_get(message_queue_t *queue, void **data, int *size, int *priority);
-message_queue_t destroy_message_queue(message_queue_t *queue);
+void destroy_message_queue(message_queue_t *queue);
 
 #endif /* RINGBUFFER_QUEUE_H */
diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c
index 720a55398c5b719510c0a1dea304cecf416afbd8..60b03d7d4366c03f602457ca2776f88891cb4d91 100644
--- a/openair2/UTIL/ASYNC_IF/socket_link.c
+++ b/openair2/UTIL/ASYNC_IF/socket_link.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h
index 5b9f438c8aa0747eecd759fb02939e701ddc004d..dbe0a6937055e53c16e7a3bedcfecc8772c0cc79 100644
--- a/openair2/UTIL/ASYNC_IF/socket_link.h
+++ b/openair2/UTIL/ASYNC_IF/socket_link.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/BIGPHYS/bigphys.c b/openair2/UTIL/BIGPHYS/bigphys.c
index 92a0a8bef8896e1cb4a3a4ab9b5c3c0565515190..219a0c8d1b42eb99fb54abcefbc1bd65d73e45fb 100644
--- a/openair2/UTIL/BIGPHYS/bigphys.c
+++ b/openair2/UTIL/BIGPHYS/bigphys.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/BIGPHYS/defs.h b/openair2/UTIL/BIGPHYS/defs.h
index 01387cb0019ed0616ba091e79bad39827ee6fd41..69368a6d727f94fb9dfe16a90e6433bf6cd79382 100644
--- a/openair2/UTIL/BIGPHYS/defs.h
+++ b/openair2/UTIL/BIGPHYS/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/CLI/cli.c b/openair2/UTIL/CLI/cli.c
index bb193728c9939f2eb6f0f26307ebda90e522fba9..c6aa0ab0de16ef2d8b3e20aba79cd5e94786646d 100644
--- a/openair2/UTIL/CLI/cli.c
+++ b/openair2/UTIL/CLI/cli.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -215,7 +215,7 @@ int cli_login(const char *username, int maxnodes, int maxcmds)
 
 char *cli_prompt(void)
 {
-  static char promptstr[200];
+  static char promptstr[256];
   promptstr[0]='\0';
   snprintf(promptstr, 200,"%s@%s",username, cli_cfg->prompt);
   return promptstr;
diff --git a/openair2/UTIL/CLI/cli.h b/openair2/UTIL/CLI/cli.h
index 70aab5c4da87c5d393babcaada245c950b403bc5..c9052ead6f466eac771b93de0454a718c44fa166 100644
--- a/openair2/UTIL/CLI/cli.h
+++ b/openair2/UTIL/CLI/cli.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/CLI/cli_cmd.c b/openair2/UTIL/CLI/cli_cmd.c
index 366295bf1a063e70c77b6bbd37935b915cdc828d..a4902555743aac8c98bf576fbbc0457169b33a05 100644
--- a/openair2/UTIL/CLI/cli_cmd.c
+++ b/openair2/UTIL/CLI/cli_cmd.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -103,7 +103,7 @@ int prompt (char *arg)
     return 0;
 
   if (!arg || !*arg) { // no arg is provided, run get func
-    snprintf(buffer,200,"%s\n", cli_cfg->prompt);
+    snprintf(buffer,256,"%s\n", cli_cfg->prompt);
     send(cli_cfg->cfd, buffer, strlen(buffer), 0);
     // send(cli_cfg->cfd, cli_cfg->prompt, strlen(cli_cfg->prompt), 0);
   } else {// set func
diff --git a/openair2/UTIL/CLI/cli_if.h b/openair2/UTIL/CLI/cli_if.h
index 129176cd2c3af5e8d1873ae5020a4d06e858043b..539ecd465ab7ecac6227a0dd611ac8a48863a6a7 100644
--- a/openair2/UTIL/CLI/cli_if.h
+++ b/openair2/UTIL/CLI/cli_if.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/CLI/cli_server.c b/openair2/UTIL/CLI/cli_server.c
index 43ffac0a53f0bd23a3ecc828a5539d31aadc5dda..d4f97f15ba0f6e10ba18fdddda7d8783024c3b6a 100644
--- a/openair2/UTIL/CLI/cli_server.c
+++ b/openair2/UTIL/CLI/cli_server.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/FIFO/pad_list.c b/openair2/UTIL/FIFO/pad_list.c
index f60505f8ce20cd5f8331da4c8f2f5363c4980ccb..32a9f3519640a020df52ebc60add66f9a0fb3bac 100644
--- a/openair2/UTIL/FIFO/pad_list.c
+++ b/openair2/UTIL/FIFO/pad_list.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/FIFO/pad_list.h b/openair2/UTIL/FIFO/pad_list.h
index 4f755f9940e100e934f7e15ef3aa8074b650c4e7..ecafed7cc44afc06773781013c1a86952aa7ae05 100644
--- a/openair2/UTIL/FIFO/pad_list.h
+++ b/openair2/UTIL/FIFO/pad_list.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/FIFO/types.h b/openair2/UTIL/FIFO/types.h
index 23d69ff3a6782d3298c20d0d1a9cf5a7d86c1ee3..f949b2b72b97407ebee9e563ce216aa4d322aff5 100644
--- a/openair2/UTIL/FIFO/types.h
+++ b/openair2/UTIL/FIFO/types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/LISTS/list.c b/openair2/UTIL/LISTS/list.c
index 7040aeeef7fa6221f21ecf85e2976b09bf0628fa..65f70c0786a97d96395d79c705871ba0f0c3ccd4 100644
--- a/openair2/UTIL/LISTS/list.c
+++ b/openair2/UTIL/LISTS/list.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/LISTS/list.h b/openair2/UTIL/LISTS/list.h
index 189de84aeb68dfff13d811692ae9a414b0e59b22..864804c5913e750dbcb744b5bb38b8352d3f4d0d 100644
--- a/openair2/UTIL/LISTS/list.h
+++ b/openair2/UTIL/LISTS/list.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/LISTS/list2.c b/openair2/UTIL/LISTS/list2.c
index 8daa19bfa4515c3b00adb7deddfa90966655c9bd..3f0a59df53be4ca3548207f22a2c015bb772f4bb 100644
--- a/openair2/UTIL/LISTS/list2.c
+++ b/openair2/UTIL/LISTS/list2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -38,11 +38,7 @@
  ***************************************************************************/
 #define LIST2_C
 #include "list.h"
-#ifdef USER_MODE
 #include "assertions.h"
-#else
-#define NULL 0
-#endif
 
 #include <string.h>
 
@@ -336,9 +332,7 @@ list2_display (list2_t * listP)
           nb_elements++;
         }
         msg (" found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
-  #ifdef USER_MODE
         AssertFatal(nb_elements == listP->nb_elements, "Bad count of elements %d != %d", nb_elements, listP->nb_elements);
-  #endif
       }
     }*/
 }
diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c
index 7ce85f6d8a48c10034eb0b4d93409610bef5806a..ff6a5cd5739a85b1694324b88cb4785941805c33 100644
--- a/openair2/UTIL/LOG/log.c
+++ b/openair2/UTIL/LOG/log.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -34,6 +34,7 @@
 #define COMPONENT_LOG
 #define COMPONENT_LOG_IF
 #include <ctype.h>
+#define LOG_MAIN
 #include "log.h"
 #include "vcd_signal_dumper.h"
 #include "assertions.h"
@@ -42,20 +43,11 @@
 # include "intertask_interface.h"
 #endif
 
-#ifdef USER_MODE
 # include <pthread.h>
 # include <string.h>
-#endif
-#ifdef RTAI
-# include <rtai.h>
-# include <rtai_fifos.h>
-#    define FIFO_PRINTF_MAX_STRING_SIZE 1000
-#    define FIFO_PRINTF_NO              62
-#    define FIFO_PRINTF_SIZE            65536
-#endif
 #include "common/config/config_userapi.h"
 // main log variables
-log_t *g_log;
+
 
 mapping log_level_names[] = {
   {"emerg", LOG_EMERG},
@@ -92,9 +84,7 @@ int log_list_head = 0;
 int log_shutdown;
 #endif
 
-#ifndef RTAI
 static int gfd;
-#endif
 
 static char *log_level_highlight_start[] = {LOG_RED, LOG_RED, LOG_RED, LOG_RED, LOG_ORANGE, LOG_BLUE, "", ""};  /*!< \brief Optional start-format strings for highlighting */
 static char *log_level_highlight_end[]   = {LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET,LOG_RESET,  "",""};   /*!< \brief Optional end-format strings for highlighting */
@@ -164,24 +154,12 @@ void  log_getconfig(log_t *g_log) {
 
 int logInit (void)
 {
-#ifdef USER_MODE
-#ifndef RTAI
   int i;
-#endif
   g_log = calloc(1, sizeof(log_t));
 
-#else
-  g_log = kmalloc(sizeof(log_t), GFP_KERNEL);
-#endif
-
   if (g_log == NULL) {
-#ifdef USER_MODE
     perror ("cannot allocated memory for log generation module \n");
     exit(EXIT_FAILURE);
-#else
-    printk("cannot allocated memory for log generation module \n");
-    return(-1);
-#endif
   }
 
 
@@ -485,7 +463,6 @@ int logInit (void)
   g_log->level  = LOG_TRACE;
   g_log->flag   = LOG_LOW;
 
-#ifndef RTAI
   g_log->config.remote_ip      = 0;
   g_log->config.remote_level   = LOG_EMERG;
   g_log->config.facility       = LOG_LOCAL7;
@@ -513,19 +490,341 @@ int logInit (void)
     }
   }
 
+  printf("log init done\n");
+
+  return 0;
+}
+
+void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args)
+{
+  //logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args)
+  int len = 0;
+  log_component_t *c;
+  char *log_start;
+  char *log_end;
+  /* The main difference with the version above is the use of this local log_buffer.
+   * The other difference is the return value of snprintf which was not used
+   * correctly. It was not a big problem because in practice MAX_LOG_TOTAL is
+   * big enough so that the buffer is never full.
+   */
+  char log_buffer[MAX_LOG_TOTAL];
+
+  /* for no gcc warnings */
+  (void)log_start;
+  (void)log_end;
+
+  c = &g_log->log_component[comp];
+
+  // do not apply filtering for LOG_F
+  // only log messages which are enabled and are below the global log level and component's level threshold
+  if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level))) {
+    /* if ((level != LOG_FILE) &&
+          ((level > c->level) ||
+           (level > g_log->level) ||
+           ( c->level > g_log->level))) {
+    */
+    return;
+  }
+
+  //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD, VCD_FUNCTION_IN);
+
+  // adjust syslog level for TRACE messages
+  if (g_log->syslog) {
+    if (g_log->level > LOG_DEBUG) {
+      g_log->level = LOG_DEBUG;
+    }
+  }
+
+  // make sure that for log trace the extra info is only printed once, reset when the level changes
+  if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level == LOG_TRACE)) {
+    log_start = log_buffer;
+    len = vsnprintf(log_buffer, MAX_LOG_TOTAL, format, args);
+    if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+    log_end = log_buffer + len;
+  } else {
+    if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
+      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
+                      log_level_highlight_start[level]);
+      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+    }
+
+    log_start = log_buffer + len;
+
+    if ( (g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
+      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
+                      g_log->log_component[comp].name);
+      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+    }
+
+    if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
+      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
+                      g_log->level2string[level]);
+      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+    }
+
+    if ( (g_log->flag & FLAG_THREAD) || (c->flag & FLAG_THREAD) ) {
+#     define THREAD_NAME_LEN 128
+      char threadname[THREAD_NAME_LEN];
+      if (pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN) != 0)
+      {
+        perror("pthread_getname_np : ");
+      } else {
+        len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]", threadname);
+        if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+      }
+#     undef THREAD_NAME_LEN
+    }
+
+    if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
+      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
+                      func);
+      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+    }
+
+    if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
+      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
+                      file, line);
+      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+    }
+
+    //len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%08lx]", thread_id);
+    //if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+
+    len += vsnprintf(&log_buffer[len], MAX_LOG_TOTAL - len, format, args);
+    if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+    log_end = log_buffer + len;
+
+    if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
+      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
+          log_level_highlight_end[level]);
+      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
+    }
+  }
+
+  va_end(args);
+
+  // OAI printf compatibility
+  if ((g_log->onlinelog == 1) && (level != LOG_FILE))
+#ifdef RTAI
+    if (len > MAX_LOG_TOTAL) {
+      rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
+    }
+
+  if (len > 0) {
+    rtf_put (FIFO_PRINTF_NO, log_buffer, len);
+  }
+
 #else
-  g_log->syslog = 0;
-  g_log->filelog   = 0;
-  rtf_create (FIFO_PRINTF_NO, FIFO_PRINTF_SIZE);
+  fwrite(log_buffer, len, 1, stdout);
 #endif
 
-#ifdef USER_MODE
-  printf("log init done\n");
+#ifndef RTAI
+
+  if (g_log->syslog) {
+    syslog(g_log->level, "%s", log_buffer);
+  }
+
+  if (g_log->filelog) {
+    if (write(gfd, log_buffer, len) < len) {
+      // TODO assert ?
+    }
+  }
+
+  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
+    if (write(g_log->log_component[comp].fd, log_buffer, len) < len) {
+      // TODO assert ?
+    }
+  }
+
 #else
-  printk("log init done\n");
+
+  // online print messges
+  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
+    printf(log_buffer);
+  }
+
 #endif
 
-  return 0;
+#if defined(ENABLE_ITTI)
+
+  if (level <= LOG_DEBUG) {
+    task_id_t origin_task_id = TASK_UNKNOWN;
+    MessagesIds messages_id;
+    MessageDef *message_p;
+    size_t      message_string_size;
+    char       *message_msg_p;
+
+    message_string_size = log_end - log_start;
+
+#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
+
+    /* Try to identify sub task ID from log information (comp, log_instance_type) */
+    switch (comp) {
+    case PHY:
+      switch (log_instance_type) {
+      case LOG_INSTANCE_ENB:
+        origin_task_id = TASK_PHY_ENB;
+        break;
+
+      case LOG_INSTANCE_UE:
+        origin_task_id = TASK_PHY_UE;
+        break;
+
+      default:
+        break;
+      }
+
+      break;
+
+    case MAC:
+      switch (log_instance_type) {
+      case LOG_INSTANCE_ENB:
+        origin_task_id = TASK_MAC_ENB;
+        break;
+
+      case LOG_INSTANCE_UE:
+        origin_task_id = TASK_MAC_UE;
+
+      default:
+        break;
+      }
+
+      break;
+
+    case RLC:
+      switch (log_instance_type) {
+      case LOG_INSTANCE_ENB:
+        origin_task_id = TASK_RLC_ENB;
+        break;
+
+      case LOG_INSTANCE_UE:
+        origin_task_id = TASK_RLC_UE;
+
+      default:
+        break;
+      }
+
+      break;
+
+    case PDCP:
+      switch (log_instance_type) {
+      case LOG_INSTANCE_ENB:
+        origin_task_id = TASK_PDCP_ENB;
+        break;
+
+      case LOG_INSTANCE_UE:
+        origin_task_id = TASK_PDCP_UE;
+
+      default:
+        break;
+      }
+
+      break;
+
+    default:
+      break;
+    }
+
+#endif
+
+    switch (level) {
+    case LOG_EMERG:
+    case LOG_ALERT:
+    case LOG_CRIT:
+    case LOG_ERR:
+      messages_id = ERROR_LOG;
+      break;
+
+    case LOG_WARNING:
+      messages_id = WARNING_LOG;
+      break;
+
+    case LOG_NOTICE:
+      messages_id = NOTICE_LOG;
+      break;
+
+    case LOG_INFO:
+      messages_id = INFO_LOG;
+      break;
+
+    default:
+      messages_id = DEBUG_LOG;
+      break;
+    }
+
+    message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
+
+    switch (level) {
+    case LOG_EMERG:
+    case LOG_ALERT:
+    case LOG_CRIT:
+    case LOG_ERR:
+      message_msg_p = (char *) &message_p->ittiMsg.error_log;
+      break;
+
+    case LOG_WARNING:
+      message_msg_p = (char *) &message_p->ittiMsg.warning_log;
+      break;
+
+    case LOG_NOTICE:
+      message_msg_p = (char *) &message_p->ittiMsg.notice_log;
+      break;
+
+    case LOG_INFO:
+      message_msg_p = (char *) &message_p->ittiMsg.info_log;
+      break;
+
+    default:
+      message_msg_p = (char *) &message_p->ittiMsg.debug_log;
+      break;
+    }
+
+    memcpy(message_msg_p, log_start, message_string_size);
+
+    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+  }
+
+#endif
+#if 0
+  LOG_params log_params;
+  int        len;
+
+  len = vsnprintf(log_params.l_buff_info, MAX_LOG_INFO-1, format, args);
+
+  //2 first parameters must be passed as 'const' to the thread function
+  log_params.file = strdup(file);
+  log_params.func = strdup(func);
+  log_params.line = line;
+  log_params.comp = PHY;//comp;
+  log_params.level = 6; // INFO - level;
+  log_params.format = format;
+  log_params.len = len;
+
+  if (pthread_mutex_lock(&log_lock) != 0) {
+    return;
+  }
+
+  log_list_tail++;
+  log_list[log_list_tail - 1] = log_params;
+
+  if (log_list_tail >= 1000) {
+    log_list_tail = 0;
+  }
+
+  if (log_list_nb_elements < 1000) {
+    log_list_nb_elements++;
+  }
+
+  if(pthread_cond_signal(&log_notify) != 0) {
+    pthread_mutex_unlock(&log_lock);
+    return;
+  }
+
+  if(pthread_mutex_unlock(&log_lock) != 0) {
+    return;
+  }
+
+#endif
 }
 
 //log record: add to a list
@@ -650,23 +949,9 @@ void logRecord_thread_safe(const char *file, const char *func,
 
   // OAI printf compatibility
   if ((g_log->onlinelog == 1) && (level != LOG_FILE)) {
-#ifdef RTAI
-
-    if (len > MAX_LOG_TOTAL) {
-      rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
-    }
-
-    if (len > 0) {
-      rtf_put (FIFO_PRINTF_NO, log_buffer, len);
-    }
-
-#else
     fprintf(stdout, "%s", log_buffer);
-#endif
   }
 
-#ifndef RTAI
-
   if (g_log->syslog) {
     syslog(g_log->level, "%s", log_buffer);
   }
@@ -683,8 +968,6 @@ void logRecord_thread_safe(const char *file, const char *func,
     }
   }
 
-#endif
-
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
                                           VCD_FUNCTION_OUT);
 }
@@ -834,20 +1117,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
 
   // OAI printf compatibility
   if ((g_log->onlinelog == 1) && (level != LOG_FILE))
-#ifdef RTAI
-    if (len > MAX_LOG_TOTAL) {
-      rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
-    }
-
-  if (len > 0) {
-    rtf_put (FIFO_PRINTF_NO, c->log_buffer, len);
-  }
-
-#else
     fwrite(c->log_buffer, len, 1, stdout);
-#endif
-
-#ifndef RTAI
 
   if (g_log->syslog) {
     syslog(g_log->level, "%s", c->log_buffer);
@@ -865,15 +1135,6 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
     }
   }
 
-#else
-
-  // online print messges
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    printf(c->log_buffer);
-  }
-
-#endif
-
 #if defined(ENABLE_ITTI)
 
   if (level <= LOG_DEBUG) {
@@ -1132,20 +1393,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
 
   // OAI printf compatibility
   if ((g_log->onlinelog == 1) && (level != LOG_FILE))
-#ifdef RTAI
-    if (len > MAX_LOG_TOTAL) {
-      rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
-    }
-
-  if (len > 0) {
-    rtf_put (FIFO_PRINTF_NO, log_buffer, len);
-  }
-
-#else
     fwrite(log_buffer, len, 1, stdout);
-#endif
-
-#ifndef RTAI
 
   if (g_log->syslog) {
     syslog(g_log->level, "%s", log_buffer);
@@ -1163,15 +1411,6 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
     }
   }
 
-#else
-
-  // online print messges
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    printf(log_buffer);
-  }
-
-#endif
-
 #if defined(ENABLE_ITTI)
 
   if (level <= LOG_DEBUG) {
@@ -1324,7 +1563,7 @@ int set_log(int component, int level, int interval)
            component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
   DevCheck((level <= LOG_TRACE) && (level >= LOG_EMERG), level, LOG_TRACE,
            LOG_EMERG);
-  DevCheck((interval > 0) && (interval <= 0xFF), interval, 0, 0xFF);
+  DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
 
   g_log->log_component[component].level = level;
 
@@ -1358,7 +1597,7 @@ int set_comp_log(int component, int level, int verbosity, int interval)
            component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
   DevCheck((level <= LOG_TRACE) && (level >= LOG_EMERG), level, LOG_TRACE,
            LOG_EMERG);
-  DevCheck((interval > 0) && (interval <= 0xFF), interval, 0, 0xFF);
+  DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
 
 #if 0
   if ((verbosity == LOG_NONE) || (verbosity == LOG_LOW) ||
@@ -1398,16 +1637,11 @@ void set_component_filelog(int comp)
 {
   if (g_log->log_component[comp].filelog ==  0) {
     g_log->log_component[comp].filelog =  1;
-#ifndef RTAI
 
     if (g_log->log_component[comp].fd == 0) {
       g_log->log_component[comp].fd = open(g_log->log_component[comp].filelog_name,
                                            O_WRONLY | O_CREAT | O_TRUNC, 0666);
     }
-
-#else
-
-#endif
   }
 }
 
@@ -1463,9 +1697,6 @@ int is_newline( char *str, int size)
 
 void logClean (void)
 {
-#ifdef RTAI
-  rtf_destroy (FIFO_PRINTF_NO);
-#else
   int i;
 
   if (g_log->syslog) {
@@ -1481,9 +1712,6 @@ void logClean (void)
       close(g_log->log_component[i].fd);
     }
   }
-
-#endif
-
 }
 
 #if defined(ENABLE_ITTI)
diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h
index f1f4eb35c534e8a2ba218b01339596fd96da21b8..00bc334de5b3a25e8a00ead69f68889c18179a9b 100644
--- a/openair2/UTIL/LOG/log.h
+++ b/openair2/UTIL/LOG/log.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -32,7 +32,6 @@
 #    define __LOG_H__
 
 /*--- INCLUDES ---------------------------------------------------------------*/
-#ifdef USER_MODE
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -53,9 +52,6 @@
 #define _GNU_SOURCE
 #endif
 #include <pthread.h>
-#else
-#include "rtai_fifos.h"
-#endif
 
 /*----------------------------------------------------------------------------*/
 
@@ -257,7 +253,17 @@ typedef enum log_instance_type_e {
 void log_set_instance_type (log_instance_type_t instance);
 #endif
 
-
+#ifdef LOG_MAIN
+log_t *g_log;
+#else
+#ifdef __cplusplus
+   extern "C" {
+#endif
+extern log_t *g_log;
+#ifdef __cplusplus
+}
+#endif
+#endif
 /*--- INCLUDES ---------------------------------------------------------------*/
 #    include "log_if.h"
 /*----------------------------------------------------------------------------*/
@@ -282,19 +288,10 @@ void *log_thread_function(void * list);
  *  @ingroup _macro
  *  @brief Macro used to call tr_log_full_ex with file, function and line information
  * @{*/
-#ifdef USER_MODE
-//#define logIt(component, level, format, args...) do {logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args);} while(0);
 #ifdef LOG_NO_THREAD
-#define logIt(component, level, format, args...) logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args)
+#define logIt(component, level, format, args...) (g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
 #else //default
-#define logIt(component, level, format, args...) logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args)
-#endif
-#else
-#ifdef LOG_NO_THREAD
-#define logIt(component, level, format, args...) logRecord_mt(NULL, __FUNCTION__, __LINE__, component, level, format, ##args)
-#else // default
-#define logIt(component, level, format, args...) logRecord(NULL, __FUNCTION__, __LINE__, component, level, format, ##args)
-#endif
+#define logIt(component, level, format, args...) (g_log->log_component[component].interval?logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
 #endif
 /* @}*/
 
@@ -314,8 +311,8 @@ void *log_thread_function(void * list);
 /*   optname                              helpstr   paramflags    XXXptr	             defXXXval				      type	     numelt	*/
 /*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 #define LOG_GLOBALPARAMS_DESC { \
-{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL,    NULL,	    0,  	 strptr:(char **)&gloglevel, defstrval:log_level_names[2].name,       TYPE_STRING,  sizeof(gloglevel)}, \
-{LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,NULL,	    0,  	 strptr:(char **)&glogverbo, defstrval:log_verbosity_names[2].name,   TYPE_STRING,  sizeof(glogverbo)}, \
+{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL,    NULL,	    0,  	 strptr:(char **)&gloglevel, defstrval:log_level_names[2].name,       TYPE_STRING,  0}, \
+{LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,NULL,	    0,  	 strptr:(char **)&glogverbo, defstrval:log_verbosity_names[2].name,   TYPE_STRING,  0}, \
 {LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE,   NULL,	    0,  	 iptr:&(g_log->onlinelog),   defintval:1,                             TYPE_INT,      0,              }, \
 {LOG_CONFIG_STRING_GLOBAL_LOG_INFILE,   NULL,	    0,  	 iptr:&(g_log->filelog),     defintval:0,                             TYPE_INT,      0,              }, \
 }
@@ -326,7 +323,6 @@ void *log_thread_function(void * list);
  * @{*/
 
 // debugging macros
-#ifdef USER_MODE
 #  if T_TRACER
 #    include "T.h"
 #    define LOG_I(c, x...) T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x))
@@ -364,17 +360,6 @@ void *log_thread_function(void * list);
 #        define LOG_T(c, x...) logIt(c, LOG_TRACE, x)
 #    endif /*DISABLE_LOG_X*/
 #  endif /* T_TRACER */
-#else /* USER_MODE */
-#  define LOG_G(c, x...) printk(x)
-#  define LOG_A(c, x...) printk(x)
-#  define LOG_C(c, x...) printk(x)
-#  define LOG_E(c, x...) printk(x)
-#  define LOG_W(c, x...) printk(x)
-#  define LOG_N(c, x...) printk(x)
-#  define LOG_I(c, x...) printk(x)
-#  define LOG_D(c, x...) printk(x)
-#  define LOG_T(c, x...) printk(x)
-#endif
 /* @}*/
 
 
diff --git a/openair2/UTIL/LOG/log_extern.h b/openair2/UTIL/LOG/log_extern.h
index 39324de4e218d5cb075c6c9ba58324723509bc4c..611487ffea2b3e4796726986e48a54c349cac7db 100644
--- a/openair2/UTIL/LOG/log_extern.h
+++ b/openair2/UTIL/LOG/log_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/LOG/log_if.h b/openair2/UTIL/LOG/log_if.h
index 6338fab829cad69385f9471cc331594b65a05cc4..531b9df62e066ca609f5a779ea3984157f1c8dd7 100644
--- a/openair2/UTIL/LOG/log_if.h
+++ b/openair2/UTIL/LOG/log_if.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c
index dfd48c77f7c623e49faaa3503f72c9771a4a1e44..a026cfb081a70e1ffd8ab833dd711c329b6ee33e 100644
--- a/openair2/UTIL/LOG/vcd_signal_dumper.c
+++ b/openair2/UTIL/LOG/vcd_signal_dumper.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -48,10 +48,6 @@
 
 #include "vcd_signal_dumper.h"
 
-#if defined(ENABLE_RTAI_CLOCK)
-#include "rtai_lxrt.h"
-#endif
-
 #define VCDSIGNALDUMPER_VERSION_MAJOR 0
 #define VCDSIGNALDUMPER_VERSION_MINOR 1
 
@@ -402,6 +398,17 @@ const char* eurecomFunctionsNames[] = {
 
   "compress_if",
   "decompress_if",
+
+  "nfapi_subframe",
+  "generate_pcfich",
+  "generate_dci0",
+  "generate_dlsch",
+  "generate_phich",
+  "pdcch_scrambling",
+  "pdcch_modulation",
+  "pdcch_interleaving",
+  "pdcch_tx",
+
 };
 
 struct vcd_module_s vcd_modules[] = {
@@ -415,8 +422,6 @@ static inline unsigned long long int vcd_get_time(void);
 
 #if defined(ENABLE_USE_CPU_EXECUTION_TIME)
 struct timespec     g_time_start;
-#elif defined(ENABLE_RTAI_CLOCK)
-RTIME start;
 #endif
 
 
@@ -612,8 +617,6 @@ void vcd_signal_dumper_init(char *filename)
 
 #if defined(ENABLE_USE_CPU_EXECUTION_TIME)
     clock_gettime(CLOCK_MONOTONIC, &g_time_start);
-#elif defined(ENABLE_RTAI_CLOCK)
-    start=rt_get_time_ns();
 #endif
 
     vcd_signal_dumper_create_header();
@@ -666,9 +669,6 @@ static inline void vcd_signal_dumper_print_time_since_start(void)
     secondsSinceStart     = (long long unsigned int)time.tv_sec - (long long unsigned int)g_time_start.tv_sec;
     /* Write time in nanoseconds */
     fprintf(vcd_fd, "#%llu\n", nanosecondsSinceStart + (secondsSinceStart * 1000000000UL));
-#elif defined(ENABLE_RTAI_CLOCK)
-    /* Write time in nanoseconds */
-    fprintf(vcd_fd, "#%llu\n",rt_get_time_ns()-start);
 #endif
   }
 }
@@ -682,8 +682,6 @@ static inline unsigned long long int vcd_get_time(void)
 
   return (long long unsigned int)((time.tv_nsec - g_time_start.tv_nsec)) +
          ((long long unsigned int)time.tv_sec - (long long unsigned int)g_time_start.tv_sec) * 1000000000UL;
-#elif defined(ENABLE_RTAI_CLOCK)
-  return rt_get_time_ns() - start;
 #endif
 }
 
diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h
index e13ee7cfdc9d12faf37cdcba2812a72464f994a0..a47cdc059d1a8236b78255b28d457ad8979613e5 100644
--- a/openair2/UTIL/LOG/vcd_signal_dumper.h
+++ b/openair2/UTIL/LOG/vcd_signal_dumper.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -379,6 +379,16 @@ typedef enum {
   VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF,
   VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF,
 
+  VCD_SIGNAL_DUMPER_FUNCTIONS_NFAPI,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,
+
   VCD_SIGNAL_DUMPER_FUNCTIONS_END
 } vcd_signal_dump_functions;
 
diff --git a/openair2/UTIL/MATH/crc_byte.c b/openair2/UTIL/MATH/crc_byte.c
index b7e537163cb6958c5482cbc60a5e80a74639fffa..a3ff00fec19725498bc461270f3d20f6e03a2fff 100644
--- a/openair2/UTIL/MATH/crc_byte.c
+++ b/openair2/UTIL/MATH/crc_byte.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/MATH/oml.c b/openair2/UTIL/MATH/oml.c
index 5794b7876a0542522c96f40122dc17cf237bb001..70e1a87cdc356d703567cdb492cb54646f7b08a2 100644
--- a/openair2/UTIL/MATH/oml.c
+++ b/openair2/UTIL/MATH/oml.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/MATH/oml.h b/openair2/UTIL/MATH/oml.h
index 2a057a93fccc5e6bdfbae865ab36803d3938b671..70f677a559cfa0787641630a670d39f3d2bd0d3e 100644
--- a/openair2/UTIL/MATH/oml.h
+++ b/openair2/UTIL/MATH/oml.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/MATH/random.c b/openair2/UTIL/MATH/random.c
index c2db2876795ed2c23e4589c144ca6ca56b50b5e9..30a6e9b1abba957f3257b924c67bb789bbe8c35a 100644
--- a/openair2/UTIL/MATH/random.c
+++ b/openair2/UTIL/MATH/random.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,11 +29,7 @@
 #include "rtos_header.h"
 #include "platform_types.h"
 
-#ifdef USER_MODE
-#    include <sys/time.h>
-#else
-#include <rtai_sched.h>
-#endif
+#include <sys/time.h>
 
 
 /* Random generators */
@@ -47,7 +43,6 @@ static int      seed;
 void
 init_uniform (void)
 {
-#ifdef USER_MODE
   struct timeval  tv;
   struct timezone tz;
 
@@ -61,9 +56,6 @@ init_uniform (void)
 #warning TO DO seed = rgId
   //seed += rgId;
 #endif
-#else
-  seed = rt_get_time_ns();
-#endif
 }
 
 
diff --git a/openair2/UTIL/MATH/random_proto_extern.h b/openair2/UTIL/MATH/random_proto_extern.h
index 17ea22e461d15e74238123c91b44b69f79739a43..45db5652172af569ec6838651c653e4aabca9720 100644
--- a/openair2/UTIL/MATH/random_proto_extern.h
+++ b/openair2/UTIL/MATH/random_proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/MATH/taus.c b/openair2/UTIL/MATH/taus.c
index 1f3a64aa841362302fb2d9127179dd1265f2108a..632b1544dd0970b484fbe0a2ef4d585cae550604 100644
--- a/openair2/UTIL/MATH/taus.c
+++ b/openair2/UTIL/MATH/taus.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -29,21 +29,12 @@
 * @ingroup util
 */
 
-#ifndef RTAI_ENABLED
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <math.h>
 #include "oml.h"
-#else
-#include <asm/io.h>
-#include <asm/rtai.h>
-#include <rtai.h>
-#include <rtai_sched.h>
-#define time(x) (unsigned int)(rt_get_time_ns())
-#endif
-
 
 unsigned int s0[MAX_NUM_COMPS], s1[MAX_NUM_COMPS], s2[MAX_NUM_COMPS], b[MAX_NUM_COMPS], r[MAX_NUM_COMPS];
 
diff --git a/openair2/UTIL/MEM/mem_block.c b/openair2/UTIL/MEM/mem_block.c
index 81db9c28ddff0de614875d62683fa3942ac3f3dd..9c3a50467a785f4f218d3f2eef034e327d5dde78 100644
--- a/openair2/UTIL/MEM/mem_block.c
+++ b/openair2/UTIL/MEM/mem_block.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -54,7 +54,7 @@ static pthread_mutex_t mtex = PTHREAD_MUTEX_INITIALIZER;
 //#define DEBUG_MEM_MNGT_ALLOC_SIZE
 //#define DEBUG_MEM_MNGT_ALLOC
 //-----------------------------------------------------------------------------
-#if defined(USER_MODE) && defined(DEBUG_MEM_MNGT_ALLOC)
+#if defined(DEBUG_MEM_MNGT_ALLOC)
 uint32_t             counters[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 #endif
 //-----------------------------------------------------------------------------
@@ -269,10 +269,8 @@ get_free_mem_block (uint32_t sizeP, const char* caller)
 
 #ifdef DEBUG_MEM_MNGT_ALLOC
     LOG_E (RLC,"[MEM_MNGT][ERROR][MINOR] memory pool %d is empty trying next pool alloc count = %d\n", pool_selected, counters[pool_selected]);
-#ifdef USER_MODE
     //    display_mem_load ();
     //    check_mem_area ((void *)&mem_block_var);
-#endif
 #endif
   } while (pool_selected++ < 12);
 
diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h
index c3a2f5dff21735e286c2cbb9f85bfcb174ab7b67..e9673802698fac9094f450c0e858e341a67ab197 100644
--- a/openair2/UTIL/MEM/mem_block.h
+++ b/openair2/UTIL/MEM/mem_block.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -31,9 +31,7 @@
 #ifndef __MEM_BLOCK_H__
 #    define __MEM_BLOCK_H__
 
-#ifdef USER_MODE
 #include <stdint.h>
-#endif
 #ifdef MEM_BLOCK_C
 #    define public_mem_block(x) x
 #    define private_mem_block(x) x
@@ -63,19 +61,8 @@ public_mem_block(mem_block_t *copy_mem_block (mem_block_t * leP, mem_block_t * d
 public_mem_block(void         display_mem_load (void);)
 
 public_mem_block(void         check_mem_area (void);)
-#    ifdef USER_MODE
 private_mem_block(void        check_free_mem_block (mem_block_t * leP);)
-#    endif
-#ifdef USER_MODE
-//#    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
-#    else
-#        define MEM_SCALE 1
-#    endif
-#endif
 // definition of the size of the allocated memory area
 #    define MEM_MNGT_MB0_BLOCK_SIZE     64
 // 64
diff --git a/openair2/UTIL/MEM/mem_mngt.c b/openair2/UTIL/MEM/mem_mngt.c
index 9f4f57cdd2c77332e5fc9f24b98e6a0d5f37b586..57c90ea4f909268f0c6aadcbacb7305e51f5bf4f 100644
--- a/openair2/UTIL/MEM/mem_mngt.c
+++ b/openair2/UTIL/MEM/mem_mngt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -49,9 +49,7 @@
 //
 #endif
 //-----------------------------------------------------------------------------
-#ifdef USER_MODE
 uint32_t             counters[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-#endif
 //-----------------------------------------------------------------------------
 /*
  * initialize all ures
@@ -227,10 +225,8 @@ get_free_mem_block (uint16_t sizeP, __func__)
 
 #ifdef DEBUG_MEM_MNGT_ALLOC
     msg ("[MEM_MNGT][ERROR][MINOR] memory pool %d is empty trying next pool alloc count = %d\n", pool_selected, counters[pool_selected]);
-#    ifdef USER_MODE
     display_mem_load ();
     check_mem_area (mem);
-#    endif
 #endif
   } while (pool_selected++ < 9);
 
diff --git a/openair2/UTIL/MEM/mem_mngt_proto_extern.h b/openair2/UTIL/MEM/mem_mngt_proto_extern.h
index f4f8a2eaae5457619ab5f96625abeddaac5c8f52..4690bba42e5b91f4721d727b38d41da928e0c55a 100644
--- a/openair2/UTIL/MEM/mem_mngt_proto_extern.h
+++ b/openair2/UTIL/MEM/mem_mngt_proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/MEM/mem_pool.h b/openair2/UTIL/MEM/mem_pool.h
index 0e943081b0d257ea86c0cdc71f6e668f3bfd7e4b..cc0face78c673afa37a2b78367fe4d2193956732 100644
--- a/openair2/UTIL/MEM/mem_pool.h
+++ b/openair2/UTIL/MEM/mem_pool.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG.c b/openair2/UTIL/OCG/OCG.c
index a78b49dd847cd3f82124088265256870f7904bc1..c3665c93f5529c6cfd1f21a4a2f954af922fbbeb 100644
--- a/openair2/UTIL/OCG/OCG.c
+++ b/openair2/UTIL/OCG/OCG.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h
index 241148b0ab3c79f2f8303557ad5044a7d7c8f58c..855b7a99fdde30ef25bfb70c7c78c8a523104a2b 100644
--- a/openair2/UTIL/OCG/OCG.h
+++ b/openair2/UTIL/OCG/OCG.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_call_emu.c b/openair2/UTIL/OCG/OCG_call_emu.c
index 2ce1818b12be632e5123b69d1e3afcf11235026b..b6a2c924bf58b9ce692f2204d8f70eeab4706c2a 100644
--- a/openair2/UTIL/OCG/OCG_call_emu.c
+++ b/openair2/UTIL/OCG/OCG_call_emu.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_call_emu.h b/openair2/UTIL/OCG/OCG_call_emu.h
index c27f3c1b069969173b6caca969abccc17380735b..c7b2bb4327b1f58cb079bb13e20347dad91c16ff 100644
--- a/openair2/UTIL/OCG/OCG_call_emu.h
+++ b/openair2/UTIL/OCG/OCG_call_emu.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_config_mobi.c b/openair2/UTIL/OCG/OCG_config_mobi.c
index ae53b6195562591235e73a6628546c4a4390a842..cef4c5543b0705f90c9122c0ec6e69dd8d208417 100644
--- a/openair2/UTIL/OCG/OCG_config_mobi.c
+++ b/openair2/UTIL/OCG/OCG_config_mobi.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_config_mobi.h b/openair2/UTIL/OCG/OCG_config_mobi.h
index ab7048b2b0ff5532451c12693ff91c8bbdf99342..fbaeb4b281990c93cad4ceef9b35cc9464128a36 100644
--- a/openair2/UTIL/OCG/OCG_config_mobi.h
+++ b/openair2/UTIL/OCG/OCG_config_mobi.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_create_dir.c b/openair2/UTIL/OCG/OCG_create_dir.c
index cfbf26a21dd2ea512872d18550b28dc2ff92d12a..364887163b978b1b15f05d6588b2edef48101cb8 100644
--- a/openair2/UTIL/OCG/OCG_create_dir.c
+++ b/openair2/UTIL/OCG/OCG_create_dir.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_create_dir.h b/openair2/UTIL/OCG/OCG_create_dir.h
index c8f3729c47eff9a61e19b18bf200f0454a0b841c..692f4b095e73b165242ff68795e2fd32c597f29b 100644
--- a/openair2/UTIL/OCG/OCG_create_dir.h
+++ b/openair2/UTIL/OCG/OCG_create_dir.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_detect_file.c b/openair2/UTIL/OCG/OCG_detect_file.c
index a7226a67db1daaeb09075875a079b4c6a02879f5..034f173b77f8cb777a341025dcf6cce605f1ac7c 100644
--- a/openair2/UTIL/OCG/OCG_detect_file.c
+++ b/openair2/UTIL/OCG/OCG_detect_file.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_detect_file.h b/openair2/UTIL/OCG/OCG_detect_file.h
index 43aa22040ec667b31b4ccb840822d7ce76837907..3a43b505525f30769e95fb17e66a430fd0f10d06 100644
--- a/openair2/UTIL/OCG/OCG_detect_file.h
+++ b/openair2/UTIL/OCG/OCG_detect_file.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_extern.h b/openair2/UTIL/OCG/OCG_extern.h
index 58eac66263efd2555c33a8923b209022b794e0ad..25fea4e90e37ee23a3730803d28cc5fd4f0ba2aa 100644
--- a/openair2/UTIL/OCG/OCG_extern.h
+++ b/openair2/UTIL/OCG/OCG_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_generate_report.c b/openair2/UTIL/OCG/OCG_generate_report.c
index 320fa0c5df38cbe62190705b699d1140467c1724..fa1ed191e62afa1cc9fa7cb1d9b8a5f38ac9dcc6 100644
--- a/openair2/UTIL/OCG/OCG_generate_report.c
+++ b/openair2/UTIL/OCG/OCG_generate_report.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_generate_report.h b/openair2/UTIL/OCG/OCG_generate_report.h
index c3fd5f9540c6bfbe67c01cef100ffc5124e9fc0e..a67adf70c7619bd295ff44e8c47af157ba7b06d4 100644
--- a/openair2/UTIL/OCG/OCG_generate_report.h
+++ b/openair2/UTIL/OCG/OCG_generate_report.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_get_opt.c b/openair2/UTIL/OCG/OCG_get_opt.c
index 79bce055c6519c9146172f75344f5513e25f9f0c..0d52197d13273fd56af2a7d2150c8cdbdcc29c04 100644
--- a/openair2/UTIL/OCG/OCG_get_opt.c
+++ b/openair2/UTIL/OCG/OCG_get_opt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_get_opt.h b/openair2/UTIL/OCG/OCG_get_opt.h
index 5ae9d5162780dc43d245ab511cf9c1513969d0cc..7fdab0c574f86f87d5ce2283eeee806e471273f8 100644
--- a/openair2/UTIL/OCG/OCG_get_opt.h
+++ b/openair2/UTIL/OCG/OCG_get_opt.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_if.h b/openair2/UTIL/OCG/OCG_if.h
index 0635356a4d2c4eadd373bc72e401d5703c6a8a71..c515d9746dfbbf11d0769a597869f0d07dc091e1 100644
--- a/openair2/UTIL/OCG/OCG_if.h
+++ b/openair2/UTIL/OCG/OCG_if.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_parse_XML.c b/openair2/UTIL/OCG/OCG_parse_XML.c
index ea35db7c8db4f437866a91e93684b2991eedc931..e52bf402db7775454856baec6e3229f7289d00c6 100644
--- a/openair2/UTIL/OCG/OCG_parse_XML.c
+++ b/openair2/UTIL/OCG/OCG_parse_XML.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_parse_XML.h b/openair2/UTIL/OCG/OCG_parse_XML.h
index 3133f98a29fec684b541a7ac96171a5421680804..cb74a9fe1ea64945f521a8aaacfe0d6adce944e0 100644
--- a/openair2/UTIL/OCG/OCG_parse_XML.h
+++ b/openair2/UTIL/OCG/OCG_parse_XML.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_parse_filename.c b/openair2/UTIL/OCG/OCG_parse_filename.c
index 1ee3c1823339d4991b9e9d6da6f5b053146affaf..1ecad56e20aa0ac2ad779c2df07441576036ec5a 100644
--- a/openair2/UTIL/OCG/OCG_parse_filename.c
+++ b/openair2/UTIL/OCG/OCG_parse_filename.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_parse_filename.h b/openair2/UTIL/OCG/OCG_parse_filename.h
index 09ca9088b9884662ea1ad8238af0acd09126b9d5..bcc8cd11edca1b8aecc2670466f5a9b9d5de2b9c 100644
--- a/openair2/UTIL/OCG/OCG_parse_filename.h
+++ b/openair2/UTIL/OCG/OCG_parse_filename.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_save_XML.c b/openair2/UTIL/OCG/OCG_save_XML.c
index a7f88d364abcc4a3e93d9165084b7b2c55ae6d79..2b0d907cdfd017ca5a2fc3c9d45ce5ff2a669af9 100644
--- a/openair2/UTIL/OCG/OCG_save_XML.c
+++ b/openair2/UTIL/OCG/OCG_save_XML.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_save_XML.h b/openair2/UTIL/OCG/OCG_save_XML.h
index b90b2b30f72d68b336fcbe9592b59c0a0a9380cd..ba2d9240caba1f1a19caa16cf47b52f51a83572b 100644
--- a/openair2/UTIL/OCG/OCG_save_XML.h
+++ b/openair2/UTIL/OCG/OCG_save_XML.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/OCG_vars.h b/openair2/UTIL/OCG/OCG_vars.h
index 383e4e2551426ab8b426665982889437e8a3f925..947a90715c9785783bfa7c0b515c4b9b69c2f35b 100644
--- a/openair2/UTIL/OCG/OCG_vars.h
+++ b/openair2/UTIL/OCG/OCG_vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OCG/makefile b/openair2/UTIL/OCG/makefile
index 1e531f94941f71b8e680f5671012dc0b4ded936b..1ef4ec98dca850bf5ad3c5ab91f92a27f62d465b 100644
--- a/openair2/UTIL/OCG/makefile
+++ b/openair2/UTIL/OCG/makefile
@@ -7,7 +7,7 @@ OPENAIR2_TOP = ../../../openair2
 OPENAIR3_TOP = ../../../openair3
 OPENAIR3     = $(OPENAIR3_DIR)
 
-CFLAGS += -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat
+CFLAGS += -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat
 
 
 CFLAGS += -m32 -DOPENAIR_LTE -DOPENAIR2 #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE 
@@ -22,8 +22,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION
-
 #ifdef OCG
 CFLAGS += -I/usr/include/libxml2 -lxml2
 #endif
diff --git a/openair2/UTIL/OCG/readme.txt b/openair2/UTIL/OCG/readme.txt
index 88743539f846cc0ab9851b4938ac0e198ff9ba67..35300aa39f3b2c69d421d4876d008bc2676781da 100644
--- a/openair2/UTIL/OCG/readme.txt
+++ b/openair2/UTIL/OCG/readme.txt
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/common.c b/openair2/UTIL/OMG/common.c
index f1c850e689a82c1a276cbc190ddaa943227470a4..fa6e70df56dc30cc5aef23ae5420bb60d807be4f 100644
--- a/openair2/UTIL/OMG/common.c
+++ b/openair2/UTIL/OMG/common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/defs.h b/openair2/UTIL/OMG/defs.h
index 2a76d7dd6e7f069b010eb555853ee3f35b1fddd9..96700e6e9ce380ed07245df0a2914aba79c0da47 100644
--- a/openair2/UTIL/OMG/defs.h
+++ b/openair2/UTIL/OMG/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/grid.c b/openair2/UTIL/OMG/grid.c
index 4f2dbf24efab7f59d9570696509f3b260aa9c6c4..6cfcde663ba512df1270e41424bcd4108e00e1a6 100644
--- a/openair2/UTIL/OMG/grid.c
+++ b/openair2/UTIL/OMG/grid.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/grid.h b/openair2/UTIL/OMG/grid.h
index d7352491fe94619eb4200d8152d456aec809f8df..55c4857801f70f1542a78538242c1b7428f361e1 100644
--- a/openair2/UTIL/OMG/grid.h
+++ b/openair2/UTIL/OMG/grid.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/job.c b/openair2/UTIL/OMG/job.c
index 82a3096c035c196c0386fe1353e1c2f27030b7b7..1df44cb2c0e467c5cd4bbb636876170257c1239b 100644
--- a/openair2/UTIL/OMG/job.c
+++ b/openair2/UTIL/OMG/job.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/makefile b/openair2/UTIL/OMG/makefile
index 319b8296cd6f39e7ae019cd5818c71d86b6ba533..80ab8c6394f701b75416d15b9d42ce35c0277115 100644
--- a/openair2/UTIL/OMG/makefile
+++ b/openair2/UTIL/OMG/makefile
@@ -60,7 +60,7 @@ OPENAIR2_TOP = ../../../openair2
 OPENAIR3_TOP = ../../../openair3
 OPENAIR3     = $(OPENAIR3_DIR)
 
-CFLAGS += -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat
+CFLAGS += -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat
 
 
 CFLAGS += -DOPENAIR_LTE -DOPENAIR2 #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE 
@@ -75,8 +75,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION
-
 include $(OPENAIR1_DIR)/PHY/Makefile.inc
 include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
diff --git a/openair2/UTIL/OMG/makefile_old b/openair2/UTIL/OMG/makefile_old
index acc89254fb12228c799e3acf36f2d80ef3a6ef96..7bc551cb03c968ea5f174446e8f802c943e07b22 100644
--- a/openair2/UTIL/OMG/makefile_old
+++ b/openair2/UTIL/OMG/makefile_old
@@ -62,7 +62,7 @@ OPENAIR2_TOP = ../../../openair2
 OPENAIR3_TOP = ../../../openair3
 OPENAIR3     = $(OPENAIR3_DIR)
 
-CFLAGS += -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat
+CFLAGS += -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat
 
 
 CFLAGS += -DOPENAIR_LTE -DOPENAIR2 #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE 
@@ -77,8 +77,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION
-
 include $(OPENAIR1_DIR)/PHY/Makefile.inc
 include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
diff --git a/openair2/UTIL/OMG/makefile_standalone b/openair2/UTIL/OMG/makefile_standalone
index 68170543eedc73012c487ae70a3a9912485c9507..d612c018370da3fb0bf5cf9a9ac4168c8236fa49 100644
--- a/openair2/UTIL/OMG/makefile_standalone
+++ b/openair2/UTIL/OMG/makefile_standalone
@@ -8,7 +8,7 @@ OBJsumo = omg.c common.c sumo.c client_traci_OMG.c socket_traci_OMG.c storage_tr
 
 OBJ = omg.c common.c static.c job.c rwp.c rwalk.c trace.c steadystaterwp.c sumo.c grid.c mobility_parser.c hashtable.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c 
 
-CFLAGS += -DSTANDALONE -DUSER_MODE -g
+CFLAGS += -DSTANDALONE -g
 
 .PHONY: help staticOMG rwpOMG clean
 
diff --git a/openair2/UTIL/OMG/mobility_parser.c b/openair2/UTIL/OMG/mobility_parser.c
index 1013d6302ad31e77780fbe38fc5e283ad17e1183..31496af956cb9e0990664727e59b720ef5b0781a 100644
--- a/openair2/UTIL/OMG/mobility_parser.c
+++ b/openair2/UTIL/OMG/mobility_parser.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/mobility_parser.h b/openair2/UTIL/OMG/mobility_parser.h
index 84d40264f482d7cf22def5e9d023fe27992a763e..403d7886ceed78a7391cf61790e88abde208b988 100644
--- a/openair2/UTIL/OMG/mobility_parser.h
+++ b/openair2/UTIL/OMG/mobility_parser.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/omg.c b/openair2/UTIL/OMG/omg.c
index a6d4b74d17b9c6f723c69445c8e875a6868ed9f7..83f38f13d52d52d6dff87577b388feed9624a0a0 100644
--- a/openair2/UTIL/OMG/omg.c
+++ b/openair2/UTIL/OMG/omg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/omg.h b/openair2/UTIL/OMG/omg.h
index 9ff69730f08f6da9a14ef1e098c3652bf80cbcd4..07dbf1f750e98e039ce8deb65e2e1dff8868c727 100644
--- a/openair2/UTIL/OMG/omg.h
+++ b/openair2/UTIL/OMG/omg.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/omg_constants.h b/openair2/UTIL/OMG/omg_constants.h
index 0bee58db7a3b08cdb9925d81895afc5c15a930b0..1d70551b0320040a3b7bd59a0c89a1d4e207163d 100644
--- a/openair2/UTIL/OMG/omg_constants.h
+++ b/openair2/UTIL/OMG/omg_constants.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/omg_hashtable.c b/openair2/UTIL/OMG/omg_hashtable.c
index b237676e7159bbf6b4f7d6e921dfdd2da4474fa8..32b3840af3966e51dc32469e1dce68e04a51beaa 100644
--- a/openair2/UTIL/OMG/omg_hashtable.c
+++ b/openair2/UTIL/OMG/omg_hashtable.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/omg_hashtable.h b/openair2/UTIL/OMG/omg_hashtable.h
index 894a245efd8fd05297b8eab5149083b23ee0148d..238be879fde4ed2a735cb07503d41418c43ac379 100644
--- a/openair2/UTIL/OMG/omg_hashtable.h
+++ b/openair2/UTIL/OMG/omg_hashtable.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/omg_vars.h b/openair2/UTIL/OMG/omg_vars.h
index 861395771f33731d1e0a53c62ef65ef0e6bf7dcb..bf0a13e5b5e32ad164db1bc363ecd7cc310d998f 100644
--- a/openair2/UTIL/OMG/omg_vars.h
+++ b/openair2/UTIL/OMG/omg_vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/rwalk.c b/openair2/UTIL/OMG/rwalk.c
index 6e758dbfa79293c4e341d003400d185668a3e038..8c8840a91fdd0853f4a094433ee8866ed1a6666b 100644
--- a/openair2/UTIL/OMG/rwalk.c
+++ b/openair2/UTIL/OMG/rwalk.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/rwalk.h b/openair2/UTIL/OMG/rwalk.h
index 482cecd0c97b54a3448faa7f47b8503f91dc46ea..114f8a48f9a100d3f37d16f12ad92f3ba21c01bf 100644
--- a/openair2/UTIL/OMG/rwalk.h
+++ b/openair2/UTIL/OMG/rwalk.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/rwp.c b/openair2/UTIL/OMG/rwp.c
index 4a03dabc7891b27461e6d26ef3648cd63913775e..8e5ab43081b6d2b4bf6a0b9611c3defb7ee189a2 100644
--- a/openair2/UTIL/OMG/rwp.c
+++ b/openair2/UTIL/OMG/rwp.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/rwp.h b/openair2/UTIL/OMG/rwp.h
index 4d5695cc805cfec0b6916852b8fa257e35d78773..4a6c32cd5603281b4ce145a73d9ffc6b83b3d3af 100644
--- a/openair2/UTIL/OMG/rwp.h
+++ b/openair2/UTIL/OMG/rwp.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/static.c b/openair2/UTIL/OMG/static.c
index 8a94a74294b1d3ffc11d130354d11a9be691ad45..361fa969e94b6631636a519ebcba822bd98ec756 100644
--- a/openair2/UTIL/OMG/static.c
+++ b/openair2/UTIL/OMG/static.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/static.h b/openair2/UTIL/OMG/static.h
index b2c8904e8ade8198a04c4329d254743b0325d08d..b7fa800968db778cc986d0244a6dcb2e0e9b984a 100644
--- a/openair2/UTIL/OMG/static.h
+++ b/openair2/UTIL/OMG/static.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/steadystaterwp.c b/openair2/UTIL/OMG/steadystaterwp.c
index 428ad7dce7074a9ce9d0d968311a716eab5cd0a2..d4d2fde4e47f2273d8f0ab0cf7fd238cfbe7d4ed 100644
--- a/openair2/UTIL/OMG/steadystaterwp.c
+++ b/openair2/UTIL/OMG/steadystaterwp.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/steadystaterwp.h b/openair2/UTIL/OMG/steadystaterwp.h
index b73c7b1593c196f619574d5476ac5f81aa0227d0..08bca4d28e25ff559892c2b7648dc96271435740 100644
--- a/openair2/UTIL/OMG/steadystaterwp.h
+++ b/openair2/UTIL/OMG/steadystaterwp.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/trace.c b/openair2/UTIL/OMG/trace.c
index 4a71999fb90da0272ac931c9f127b8ca7b5c6e85..e86d8102e5e9f8f0b2a56e0379f85501e0928f16 100644
--- a/openair2/UTIL/OMG/trace.c
+++ b/openair2/UTIL/OMG/trace.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/trace.h b/openair2/UTIL/OMG/trace.h
index c7d0528d9412ed11adae9268c06d0512b08ffd5e..f1a4a4a274ba285a42e07e41f705e08579cb2cab 100644
--- a/openair2/UTIL/OMG/trace.h
+++ b/openair2/UTIL/OMG/trace.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/trace_hashtable.c b/openair2/UTIL/OMG/trace_hashtable.c
index 0595a1d432f60ad85502fe74dd6e13731ed4559c..9a7a67feef00a48c08d09d674ed16e62ab856498 100644
--- a/openair2/UTIL/OMG/trace_hashtable.c
+++ b/openair2/UTIL/OMG/trace_hashtable.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMG/trace_hashtable.h b/openair2/UTIL/OMG/trace_hashtable.h
index d57e65956fd542e59f148a27e7af86324bda25b4..b842880e2913f8cc8f611921b690a81a21ebdd59 100644
--- a/openair2/UTIL/OMG/trace_hashtable.h
+++ b/openair2/UTIL/OMG/trace_hashtable.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMV/communicationthread.cpp b/openair2/UTIL/OMV/communicationthread.cpp
index 4b30e32b718adbb5607e1d90f6e9108090a64168..17bc932a55c029d52d0cb26fa2e398211aad0384 100644
--- a/openair2/UTIL/OMV/communicationthread.cpp
+++ b/openair2/UTIL/OMV/communicationthread.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMV/communicationthread.h b/openair2/UTIL/OMV/communicationthread.h
index 19c1a242e59d7d7f3222a612b2d2b879c6fc6e45..b27f4024352708753b9800f26ce6b4d5186b18f9 100644
--- a/openair2/UTIL/OMV/communicationthread.h
+++ b/openair2/UTIL/OMV/communicationthread.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMV/mywindow.cpp b/openair2/UTIL/OMV/mywindow.cpp
index 4cbfbbacb1f87e9a6f4ea3c524a160e8758867e7..5a1c082975063d7efe7009d06cb0bb2de41bc8be 100644
--- a/openair2/UTIL/OMV/mywindow.cpp
+++ b/openair2/UTIL/OMV/mywindow.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMV/mywindow.h b/openair2/UTIL/OMV/mywindow.h
index a36beaf8c279a4370fe89a4dd0442246d67e3ac6..21cd001004a8e0c64b311becd6cadbaafec3a2f5 100644
--- a/openair2/UTIL/OMV/mywindow.h
+++ b/openair2/UTIL/OMV/mywindow.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMV/omv.cpp b/openair2/UTIL/OMV/omv.cpp
index c4fc5867831207ea0b1945fb91ade3d606dde97f..6d65d2a154a17aff345178e0d3600e8ac6cb843a 100644
--- a/openair2/UTIL/OMV/omv.cpp
+++ b/openair2/UTIL/OMV/omv.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMV/openglwidget.cpp b/openair2/UTIL/OMV/openglwidget.cpp
index d86767486db774a5362686fbf10b605f18b8bff1..ad0ce2b8355a0c821091b704a30af69e0bf93465 100644
--- a/openair2/UTIL/OMV/openglwidget.cpp
+++ b/openair2/UTIL/OMV/openglwidget.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMV/openglwidget.h b/openair2/UTIL/OMV/openglwidget.h
index b7069c63eaabf5afb392043b2dde423e13b5c9ae..a0e14b4db3060ad5912f023131f9a6ab74b4be3b 100644
--- a/openair2/UTIL/OMV/openglwidget.h
+++ b/openair2/UTIL/OMV/openglwidget.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OMV/structures.h b/openair2/UTIL/OMV/structures.h
index 434fa4c3836e888697328ae182b422b78fb1d1b0..ee3363205966b72c5ef5e69d7f00aafa95082c15 100644
--- a/openair2/UTIL/OMV/structures.h
+++ b/openair2/UTIL/OMV/structures.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h
index 0d2ab89e2a71e3c1d5797e9fd2dc94f813195a9a..b131d8053959f530d22dbb6d8d22d570490e89f4 100644
--- a/openair2/UTIL/OPT/opt.h
+++ b/openair2/UTIL/OPT/opt.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c
index 711436d2cd1ca9d703ce01e6fb4008f61720a1ab..ebc52bb1e04450d356de56054b01508a99aee915 100644
--- a/openair2/UTIL/OPT/probe.c
+++ b/openair2/UTIL/OPT/probe.c
@@ -410,18 +410,8 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
   /* PCAP Header                                                  */
   /* TODO: Timestamp might want to be relative to a more sensible
      base time... */
-#if defined(RTAI)
-  {
-    unsigned long long int current_ns;
-
-    current_ns = rt_get_time_ns();
-    packet_header.ts_sec  = current_ns / 1000000000UL;
-    packet_header.ts_usec = current_ns % 1000;
-  }
-#else
   packet_header.ts_sec = context->subframesSinceCaptureStart / 1000;
   packet_header.ts_usec = (context->subframesSinceCaptureStart % 1000) * 1000;
-#endif
   packet_header.incl_len = offset + length;
   packet_header.orig_len = offset + length;
 
diff --git a/openair2/UTIL/OPT/vars.h b/openair2/UTIL/OPT/vars.h
index e8ca8c5fc6adc514c3305bf7ad629367a53580de..0da315aa8b06b50fd96eded1f5bc4549c466d0c1 100644
--- a/openair2/UTIL/OPT/vars.h
+++ b/openair2/UTIL/OPT/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_defs.h b/openair2/UTIL/OSA/osa_defs.h
index ef714cdc0f0da3e4b60cc583aea4106dc4a812f6..4812d82d9166a12b2bc14e242b05071e7e910754 100644
--- a/openair2/UTIL/OSA/osa_defs.h
+++ b/openair2/UTIL/OSA/osa_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_internal.h b/openair2/UTIL/OSA/osa_internal.h
index 867b537826f790d1cade40618ea2cbb08c5b8d51..1f5aab5df8b88f3a0a283b49706f262198e9af46 100644
--- a/openair2/UTIL/OSA/osa_internal.h
+++ b/openair2/UTIL/OSA/osa_internal.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_key_deriver.c b/openair2/UTIL/OSA/osa_key_deriver.c
index 5bbaf5f17d08560ddf46115b55ec36f8ac9b9070..cf181b7a99a50e1709f15efa64a45f4e01a35219 100644
--- a/openair2/UTIL/OSA/osa_key_deriver.c
+++ b/openair2/UTIL/OSA/osa_key_deriver.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_rijndael.c b/openair2/UTIL/OSA/osa_rijndael.c
index a460ac35687356fb6c2121cd2075f20244b5779d..cbcbdab5be2653d7a4e840b73f7d1bd67d13736c 100644
--- a/openair2/UTIL/OSA/osa_rijndael.c
+++ b/openair2/UTIL/OSA/osa_rijndael.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_rijndael.h b/openair2/UTIL/OSA/osa_rijndael.h
index f8fcb1342755ff46ea56df5ef8f28d401607aa24..8c802b124774ff436aa2541208b4cda40ad53e79 100644
--- a/openair2/UTIL/OSA/osa_rijndael.h
+++ b/openair2/UTIL/OSA/osa_rijndael.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_snow3g.c b/openair2/UTIL/OSA/osa_snow3g.c
index 7d25c069fc656bcf92cc49824a4f21f45323c292..c69e80a1fb8794875953c80a30ec7d890f6159de 100644
--- a/openair2/UTIL/OSA/osa_snow3g.c
+++ b/openair2/UTIL/OSA/osa_snow3g.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_snow3g.h b/openair2/UTIL/OSA/osa_snow3g.h
index 7107317084904aa2d4ac54940426e286239b8e2d..5da81d23f3f49dc2445fad6133e0b8ed4752800c 100644
--- a/openair2/UTIL/OSA/osa_snow3g.h
+++ b/openair2/UTIL/OSA/osa_snow3g.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_stream_eea.c b/openair2/UTIL/OSA/osa_stream_eea.c
index 6aef6d2588ad26d22d15f44da7dbe7ab29dd7935..e922ed3c867b02a7b3cb443b5c3098076dd95b21 100644
--- a/openair2/UTIL/OSA/osa_stream_eea.c
+++ b/openair2/UTIL/OSA/osa_stream_eea.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSA/osa_stream_eia.c b/openair2/UTIL/OSA/osa_stream_eia.c
index 98305410061b2f1bb1e116866879daa8917a15e8..e58e280ef7568fc80c16f453d252669bde3a26e4 100644
--- a/openair2/UTIL/OSA/osa_stream_eia.c
+++ b/openair2/UTIL/OSA/osa_stream_eia.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OSD/recep.php b/openair2/UTIL/OSD/recep.php
index f824a327cf5acc67afdaf85f1b419dbfa60079b8..eb1036acad1ac8ba4c82698ca741a4250af28c45 100644
--- a/openair2/UTIL/OSD/recep.php
+++ b/openair2/UTIL/OSD/recep.php
@@ -4,7 +4,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/main.c b/openair2/UTIL/OTG/main.c
index 529755300a6e57666bf007985a8bd929d730e53a..1ee9b0edd7600df62ccd4acb8d9c1a2cc6194ecc 100644
--- a/openair2/UTIL/OTG/main.c
+++ b/openair2/UTIL/OTG/main.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg.c b/openair2/UTIL/OTG/otg.c
index 2043eb1048870fff87b075befc99a3a99662aab0..04e046397184feaa66dba338ccca19006292f2ee 100644
--- a/openair2/UTIL/OTG/otg.c
+++ b/openair2/UTIL/OTG/otg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg.h b/openair2/UTIL/OTG/otg.h
index 0cd64aeef2658838050c32d75da6eb904a39b270..7938a2a0d79091e52849e4dc7a42ce9b1ea44e86 100644
--- a/openair2/UTIL/OTG/otg.h
+++ b/openair2/UTIL/OTG/otg.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_config.h b/openair2/UTIL/OTG/otg_config.h
index 880f69bf164ceb93a800d55b412aa2c98c7f7956..2302c71f006a2cf83ef76d94e3d254e538516043 100644
--- a/openair2/UTIL/OTG/otg_config.h
+++ b/openair2/UTIL/OTG/otg_config.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_defs.h b/openair2/UTIL/OTG/otg_defs.h
index ebb3f299897031f17ae140f61091d177121aae60..fad0d9510ece3fc190b76889f819cb71aab4d080 100644
--- a/openair2/UTIL/OTG/otg_defs.h
+++ b/openair2/UTIL/OTG/otg_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_externs.h b/openair2/UTIL/OTG/otg_externs.h
index 053b8f55a10b82bb8132b71233139f2b92e59739..ea5943888f2aafea4d06f974652178ad7a19d102 100644
--- a/openair2/UTIL/OTG/otg_externs.h
+++ b/openair2/UTIL/OTG/otg_externs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_form.c b/openair2/UTIL/OTG/otg_form.c
index 7eb83b8ce403905d9ea40f8ce991c37e2d0bc244..6994e658961b9ec76795320b24c66f8b908ea631 100644
--- a/openair2/UTIL/OTG/otg_form.c
+++ b/openair2/UTIL/OTG/otg_form.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_form.h b/openair2/UTIL/OTG/otg_form.h
index e073f41457bb58db11e95fa4dc9c789f03f9c36e..1292184bdebb9cd64c1c7094428c5e4cc0f28208 100644
--- a/openair2/UTIL/OTG/otg_form.h
+++ b/openair2/UTIL/OTG/otg_form.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_kpi.c b/openair2/UTIL/OTG/otg_kpi.c
index 3f24d01ce6642b2ac656992e2ff9522e6c961166..94a0a53d5c54025b6e7c340cfa2a3dbe8af69010 100644
--- a/openair2/UTIL/OTG/otg_kpi.c
+++ b/openair2/UTIL/OTG/otg_kpi.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_kpi.h b/openair2/UTIL/OTG/otg_kpi.h
index d3e830fe12f98263fe208e9e8b041fb66c63f8de..2273d10c724efb82e4de897d3c7be2e77b0b2d48 100644
--- a/openair2/UTIL/OTG/otg_kpi.h
+++ b/openair2/UTIL/OTG/otg_kpi.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_models.c b/openair2/UTIL/OTG/otg_models.c
index f60cf926fe95dd3eb4100172fb82d1eb79fcc05d..d866713ecb1333d78e4c4193e78319708c6b3f43 100644
--- a/openair2/UTIL/OTG/otg_models.c
+++ b/openair2/UTIL/OTG/otg_models.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_models.h b/openair2/UTIL/OTG/otg_models.h
index 2e7351f400a854c26842ba3e19867316a198edb6..03b139d6586926374da06993dd1f1173dce62f28 100644
--- a/openair2/UTIL/OTG/otg_models.h
+++ b/openair2/UTIL/OTG/otg_models.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_rx.c b/openair2/UTIL/OTG/otg_rx.c
index 824439e8737284345a53ba14ae92267f0bae3bde..bcdcc5e35c6d6d6a807e376fccb74c07453bf39f 100644
--- a/openair2/UTIL/OTG/otg_rx.c
+++ b/openair2/UTIL/OTG/otg_rx.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -48,10 +48,11 @@ extern unsigned char NB_UE_INST;
 
 //#include "LAYER2/MAC/extern.h"
 
+#undef MAX
 #define MAX(x,y) ((x)>(y)?(x):(y))
+#undef MIN
 #define MIN(x,y) ((x)<(y)?(x):(y))
 
-
 // Check if the packet is well received or not and extract data
 int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buffer_tx, const unsigned int size)
 {
diff --git a/openair2/UTIL/OTG/otg_rx.h b/openair2/UTIL/OTG/otg_rx.h
index 2f92ab82ce300bb35000bbe227386a5cdb3490f2..770d053ada0df618bbd577fc89f123484954de85 100644
--- a/openair2/UTIL/OTG/otg_rx.h
+++ b/openair2/UTIL/OTG/otg_rx.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_rx_socket.c b/openair2/UTIL/OTG/otg_rx_socket.c
index 98e03532a15403982f9c1560d46cd3ab1beae798..88ecd3e9044909246483c97344e6e4c298a513ab 100644
--- a/openair2/UTIL/OTG/otg_rx_socket.c
+++ b/openair2/UTIL/OTG/otg_rx_socket.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_rx_socket.h b/openair2/UTIL/OTG/otg_rx_socket.h
index 5c64a79008e29d4a0adaf30391b6e95f44d5dacb..e7062aaf58c2cb62bc4dd1f978526782c9f199ec 100644
--- a/openair2/UTIL/OTG/otg_rx_socket.h
+++ b/openair2/UTIL/OTG/otg_rx_socket.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_tx.c b/openair2/UTIL/OTG/otg_tx.c
index d1ad2b2ed30e088ae687c3cef03812a21d3b2c56..ac3ffd0fb29b0bfdf7666c13e7122b9d7b76d6b8 100644
--- a/openair2/UTIL/OTG/otg_tx.c
+++ b/openair2/UTIL/OTG/otg_tx.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_tx.h b/openair2/UTIL/OTG/otg_tx.h
index 51bcfdd41a4472f78377db5bc2deaa9c751fc121..c5b0c01dfca48a6556aba7e2bf3fc9ec546fb35c 100644
--- a/openair2/UTIL/OTG/otg_tx.h
+++ b/openair2/UTIL/OTG/otg_tx.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_tx_socket.c b/openair2/UTIL/OTG/otg_tx_socket.c
index ae833395092ed3fa7c791001539c0888be33bd9a..026dc3e8b836344ea81099aa7b59a4df829acf3b 100644
--- a/openair2/UTIL/OTG/otg_tx_socket.c
+++ b/openair2/UTIL/OTG/otg_tx_socket.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_tx_socket.h b/openair2/UTIL/OTG/otg_tx_socket.h
index 4d9981b802c05d7b110f380a22f9ec9632ad61f2..17568244fa73cf33ffea5f79cf9bead75c39223f 100644
--- a/openair2/UTIL/OTG/otg_tx_socket.h
+++ b/openair2/UTIL/OTG/otg_tx_socket.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/otg_vars.h b/openair2/UTIL/OTG/otg_vars.h
index 1d50084c859e866c82626c0a64f0e60a246b2d36..a6bb48af5431c604a9857b7e848d08a906ae52a1 100644
--- a/openair2/UTIL/OTG/otg_vars.h
+++ b/openair2/UTIL/OTG/otg_vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/OTG/traffic_config.h b/openair2/UTIL/OTG/traffic_config.h
index 6f7df69e55b78edfdf2f80a5bba3c70da33adb5c..2f47682706bed8aa258e1c637dcbb12e03218d1b 100644
--- a/openair2/UTIL/OTG/traffic_config.h
+++ b/openair2/UTIL/OTG/traffic_config.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/TIMER/umts_timer.c b/openair2/UTIL/TIMER/umts_timer.c
index 9978419fb8f99761c59da05277eb659634ea3ab3..9bbb6c2df9198d030ca0d8e24c6a3374e5761862 100644
--- a/openair2/UTIL/TIMER/umts_timer.c
+++ b/openair2/UTIL/TIMER/umts_timer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/TIMER/umts_timer.h b/openair2/UTIL/TIMER/umts_timer.h
index d179a471e5e382ef98250e791b08b4f29ed31a26..077b55cf0c6bf3b5b249e861a7bfaa5046352993 100644
--- a/openair2/UTIL/TIMER/umts_timer.h
+++ b/openair2/UTIL/TIMER/umts_timer.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/TIMER/umts_timer_proto_extern.h b/openair2/UTIL/TIMER/umts_timer_proto_extern.h
index 807bba8a5510f6b8f119ff94c535b76b3011591f..b43b347e465360e1ded7332c41d1e9372e6e2533 100644
--- a/openair2/UTIL/TIMER/umts_timer_proto_extern.h
+++ b/openair2/UTIL/TIMER/umts_timer_proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/TIMER/umts_timer_struct.h b/openair2/UTIL/TIMER/umts_timer_struct.h
index 490a80c4e096fd923bbaca4a389c0d2dc1ce8a69..c4886c7f80241eac6e83cad74db6b98939f8f52f 100644
--- a/openair2/UTIL/TIMER/umts_timer_struct.h
+++ b/openair2/UTIL/TIMER/umts_timer_struct.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/TRACE/fifo_printf.c b/openair2/UTIL/TRACE/fifo_printf.c
index 4548eedd90c54762150b5cd181b1685c469fca68..2dc4da06371f923efca0d445e36a79558af4f9ee 100644
--- a/openair2/UTIL/TRACE/fifo_printf.c
+++ b/openair2/UTIL/TRACE/fifo_printf.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/TRACE/fifo_printf.h b/openair2/UTIL/TRACE/fifo_printf.h
index 92b5ab42cec31c713606ca7f0807a17e5a3ba18e..ce2702b19a9c74fc59d5c031a64b891137781c19 100644
--- a/openair2/UTIL/TRACE/fifo_printf.h
+++ b/openair2/UTIL/TRACE/fifo_printf.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/TRACE/fifo_printf_proto_extern.h b/openair2/UTIL/TRACE/fifo_printf_proto_extern.h
index 641af7f2241890a2a9ecafaae4eda48957e7c882..0855a8da93fae86ab950db4df8722a9f3f72ea29 100644
--- a/openair2/UTIL/TRACE/fifo_printf_proto_extern.h
+++ b/openair2/UTIL/TRACE/fifo_printf_proto_extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/UTIL/TRACE/print.h b/openair2/UTIL/TRACE/print.h
index cd177111fb085083daa1d16cedd5a38971f99c7c..72c43f20d473d51b20a842aa38ec3b3a80d2ae2b 100644
--- a/openair2/UTIL/TRACE/print.h
+++ b/openair2/UTIL/TRACE/print.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -28,14 +28,5 @@
  ***************************************************************************/
 #ifndef __PRINT_H__
 #    define __PRINT_H__
-#    ifdef USER_MODE
-#        define msg printf
-#    else
-#        ifdef FIFO_PRINTF
-#            include "fifo_printf_proto_extern.h"
-#            define msg fifo_printf
-#        else
-#                define msg fifo_printf_null
-#        endif
-#    endif
+#    define msg printf
 #endif
diff --git a/openair2/X2AP/MESSAGES/ASN1/asn1tostruct.py b/openair2/X2AP/MESSAGES/ASN1/asn1tostruct.py
index e8ebb03d6d2c7dd87b9655278fd9c98460ec02f1..8c0f7e8a16a52ca7588a40cefb73428156a14f7d 100644
--- a/openair2/X2AP/MESSAGES/ASN1/asn1tostruct.py
+++ b/openair2/X2AP/MESSAGES/ASN1/asn1tostruct.py
@@ -38,7 +38,7 @@ def outputHeaderToFile(f, filename):
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/X2AP/Makefile.inc b/openair2/X2AP/Makefile.inc
index 7369cf8dfa1b92421099fade99949ca65d10bd4c..a301a9934e924736868412284605a76a4946b668 100755
--- a/openair2/X2AP/Makefile.inc
+++ b/openair2/X2AP/Makefile.inc
@@ -28,7 +28,6 @@ CFLAGS =            \
 	-Wall           \
 	-DENB_MODE      \
 	-DENABLE_USE_MME    \
-	-DUSER_MODE     \
 	-I.        \
 	-I$(ASN1MESSAGESDIR)/ASN1/$(ASN1RELDIR) \
 	-I$(ASN1MESSAGESDIR) \
diff --git a/openair2/X2AP/x2ap.c b/openair2/X2AP/x2ap.c
index 699ad5ddbf31b0c92d95aedc110732b4297d3a7e..8002867e15c31c8b78ada0894c9bbef20ae2cef1 100644
--- a/openair2/X2AP/x2ap.c
+++ b/openair2/X2AP/x2ap.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -49,6 +49,7 @@ void *x2ap_task(void *arg)
 
     switch (ITTI_MSG_ID(received_msg)) {
     case TERMINATE_MESSAGE:
+      X2AP_WARN(" *** Exiting X2AP thread\n");
       itti_exit_task();
       break;
 
diff --git a/openair2/X2AP/x2ap.h b/openair2/X2AP/x2ap.h
index 6ef98b9909bb133d35357ae7c2537f38191da640..89e8540b97c75c3563cca8cbd899f4bf71db1701 100644
--- a/openair2/X2AP/x2ap.h
+++ b/openair2/X2AP/x2ap.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,10 +33,7 @@
 typedef struct x2ap_config_s {
 } x2ap_config_t;
 
-#if defined(OAI_EMU)
-#else
 extern x2ap_config_t x2ap_config;
-#endif
 
 void *x2ap_task(void *arg);
 
diff --git a/openair2/X2AP/x2ap_common.c b/openair2/X2AP/x2ap_common.c
index 2a59414ed94791a7ae75efcb7e508a70137ba2d5..d92f2c69bb31021f59bae16f4d73412a2bfa771a 100644
--- a/openair2/X2AP/x2ap_common.c
+++ b/openair2/X2AP/x2ap_common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair2/X2AP/x2ap_common.h b/openair2/X2AP/x2ap_common.h
index d2a2ca71371f2d2f7290dab003952059303593ac..b7c93614768daa5b8f7235f802299fb198807da6 100644
--- a/openair2/X2AP/x2ap_common.h
+++ b/openair2/X2AP/x2ap_common.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/common_types.h b/openair3/COMMON/common_types.h
index 9036ee8c13c087bbaa1ebc7fc106874faaee746b..80cc20df63f62343dddf031a63cb1f46853897e9 100644
--- a/openair3/COMMON/common_types.h
+++ b/openair3/COMMON/common_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/gtpv1_u_messages_def.h b/openair3/COMMON/gtpv1_u_messages_def.h
index eddf95c62b55bc4600bb344cb59e1d2548417e7f..4308853515aac828a59e3fec050507d80a48adde 100644
--- a/openair3/COMMON/gtpv1_u_messages_def.h
+++ b/openair3/COMMON/gtpv1_u_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/gtpv1_u_messages_types.h b/openair3/COMMON/gtpv1_u_messages_types.h
index f5358941e42eef46898c7b2ad165776103369a58..594325647b255092af0274c2d41bdbffc9a7d3b6 100644
--- a/openair3/COMMON/gtpv1_u_messages_types.h
+++ b/openair3/COMMON/gtpv1_u_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/intertask_interface_conf.h b/openair3/COMMON/intertask_interface_conf.h
index eca0c5d501335ef1b682291756172d9011316de3..6bb8a1edd5965ea448e8aacc38a6755c68672bfc 100644
--- a/openair3/COMMON/intertask_interface_conf.h
+++ b/openair3/COMMON/intertask_interface_conf.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/messages_def.h b/openair3/COMMON/messages_def.h
index 9e87b2632254e2a21abc30b1cf8453a7d77ac4c4..1c1cdbaf0f0dc32476c35e3e51f416de52899bdc 100644
--- a/openair3/COMMON/messages_def.h
+++ b/openair3/COMMON/messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/messages_types.h b/openair3/COMMON/messages_types.h
index 8717f2ad4e16e19a06334efecc1185502f465291..47d9d32f2b689a99aea9c0dc8d6de983a4061af1 100644
--- a/openair3/COMMON/messages_types.h
+++ b/openair3/COMMON/messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/nas_messages_def.h b/openair3/COMMON/nas_messages_def.h
index 679b997d6045accc67e1b7544ccf7242a41e4bcb..9bdcde4fdf06293338e7ef8659776b2a0fffaec1 100644
--- a/openair3/COMMON/nas_messages_def.h
+++ b/openair3/COMMON/nas_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -61,9 +61,3 @@ MESSAGE_DEF(NAS_PDN_CONNECTIVITY_FAIL,          MESSAGE_PRIORITY_MED,   nas_pdn_
 MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_RSP,       MESSAGE_PRIORITY_MED,   nas_auth_param_rsp_t,        nas_auth_param_rsp)
 MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_FAIL,      MESSAGE_PRIORITY_MED,   nas_auth_param_fail_t,       nas_auth_param_fail)
 
-#if defined(DISABLE_USE_NAS)
-MESSAGE_DEF(NAS_ATTACH_REQ,                     MESSAGE_PRIORITY_MED,   nas_attach_req_t,           nas_attach_req)
-MESSAGE_DEF(NAS_ATTACH_ACCEPT,                  MESSAGE_PRIORITY_MED,   nas_attach_accept_t,        nas_attach_accept)
-MESSAGE_DEF(NAS_AUTHENTICATION_RESP,            MESSAGE_PRIORITY_MED,   nas_auth_resp_t,            nas_auth_resp)
-MESSAGE_DEF(NAS_AUTHENTICATION_REQ,             MESSAGE_PRIORITY_MED,   nas_auth_req_t,             nas_auth_req)
-#endif
diff --git a/openair3/COMMON/nas_messages_types.h b/openair3/COMMON/nas_messages_types.h
index 7b93e9c617a6c87ba9f2f8c5820c52149392db4d..81a44fa4f4c42fe476822ca3d1f879f5468c4f6c 100644
--- a/openair3/COMMON/nas_messages_types.h
+++ b/openair3/COMMON/nas_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -233,17 +233,7 @@ typedef struct nas_conn_est_ind_s {
 typedef nas_establish_rsp_t nas_conn_est_rej_t;
 
 
-#if defined(DISABLE_USE_NAS)
-typedef struct nas_conn_est_cnf_s {
-  uint32_t ue_id;
-
-  nas_establish_cnf_t nas_establish_cnf;
-  /* Transparent message from MME_APP to S1AP */
-  s1ap_initial_ctxt_setup_req_t transparent;
-} nas_conn_est_cnf_t;
-#else
 typedef nas_establish_cnf_t nas_conn_est_cnf_t;
-#endif
 
 
 typedef struct nas_conn_rel_ind_s {
@@ -336,10 +326,4 @@ typedef struct nas_auth_param_fail_s {
 } nas_auth_param_fail_t;
 
 
-#if defined(DISABLE_USE_NAS)
-typedef struct nas_attach_accept_s {
-  s1ap_initial_ctxt_setup_req_t transparent;
-} nas_attach_accept_t;
-#endif
-
 #endif /* NAS_MESSAGES_TYPES_H_ */
diff --git a/openair3/COMMON/s1ap_messages_def.h b/openair3/COMMON/s1ap_messages_def.h
index e129ecf9505ee216b82fd70be6c61cbbd19e8068..f0d7ba086fea128509e94209e783629d9420228d 100644
--- a/openair3/COMMON/s1ap_messages_def.h
+++ b/openair3/COMMON/s1ap_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/s1ap_messages_types.h b/openair3/COMMON/s1ap_messages_types.h
index 0558c1711d941f6cc8d87d147d88d8453d84b9cb..e6c3bba504ae2c8f679b34710732561db7c79d52 100644
--- a/openair3/COMMON/s1ap_messages_types.h
+++ b/openair3/COMMON/s1ap_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/sctp_messages_def.h b/openair3/COMMON/sctp_messages_def.h
index 937bf09dd37495d4ecd52e5d6d6e23681048b44c..c2d51c91eb8d85fed748615a0fcfd3382263b6af 100644
--- a/openair3/COMMON/sctp_messages_def.h
+++ b/openair3/COMMON/sctp_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/sctp_messages_types.h b/openair3/COMMON/sctp_messages_types.h
index 459cff5d4083df29f0da3a819c03f214641a6ef6..98a92c66b64b9c82cdd6b50b095dd1e7058152df 100644
--- a/openair3/COMMON/sctp_messages_types.h
+++ b/openair3/COMMON/sctp_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/security_types.h b/openair3/COMMON/security_types.h
index bc64e32dedede43f048e8c5d235a728d9afd90dc..0eedc6201fa0cd01709a3b84abcb9e84796e4006 100644
--- a/openair3/COMMON/security_types.h
+++ b/openair3/COMMON/security_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/tasks_def.h b/openair3/COMMON/tasks_def.h
index 9124e0193c6b404573b6aa20ff9a88d271ccb75c..d1b7b8d75608667beafcaff1bbfdcf5c67ab167e 100644
--- a/openair3/COMMON/tasks_def.h
+++ b/openair3/COMMON/tasks_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/udp_messages_def.h b/openair3/COMMON/udp_messages_def.h
index 41b5e8aa52b551c52f3bfdd8d97e1c82922e4001..35322f2450cd270f417a66de1c170427dad75ea7 100644
--- a/openair3/COMMON/udp_messages_def.h
+++ b/openair3/COMMON/udp_messages_def.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/COMMON/udp_messages_types.h b/openair3/COMMON/udp_messages_types.h
index 1ec878782a23fb292fd6ef524253d49b61e75d8b..7825a924d1cb5e1fc2600aecbbcd97a8d7a46e80 100644
--- a/openair3/COMMON/udp_messages_types.h
+++ b/openair3/COMMON/udp_messages_types.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/DOCS/DOXYGEN/Makefile.am b/openair3/DOCS/DOXYGEN/Makefile.am
index b35915324fb71962acb5ea3e2e2f88a79d11cec4..a291a8817e68d7cab690c0df702b8d8eb57ecde2 100644
--- a/openair3/DOCS/DOXYGEN/Makefile.am
+++ b/openair3/DOCS/DOXYGEN/Makefile.am
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/DOCS/Latex/EPC/Makefile b/openair3/DOCS/Latex/EPC/Makefile
index 517bbe11f6ff13e93f0d73d16879498f8c44d380..0f0e799384356090b6176333f4ae703ece086b86 100644
--- a/openair3/DOCS/Latex/EPC/Makefile
+++ b/openair3/DOCS/Latex/EPC/Makefile
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/DOCS/Makefile.am b/openair3/DOCS/Makefile.am
index 28a422061111f486ea2626a6e4a01e80f8c038de..de8e4c619a5efadd00a17ce00e52b6dac247057d 100644
--- a/openair3/DOCS/Makefile.am
+++ b/openair3/DOCS/Makefile.am
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/GTPV1-U/Makefile.am b/openair3/GTPV1-U/Makefile.am
index 25d5658148c5ff42bc94a6be957717be0372e54c..30ea61d6c17508e90f0fa7d9f49acc4988ef1c6f 100644
--- a/openair3/GTPV1-U/Makefile.am
+++ b/openair3/GTPV1-U/Makefile.am
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/GTPV1-U/Makefile.eNB b/openair3/GTPV1-U/Makefile.eNB
index 6941959e81f3f02e1c6ba6e1c4c35e3edf8994dc..b469dc756d0d453c71fd13ebcfa59fdb5f6d3a81 100644
--- a/openair3/GTPV1-U/Makefile.eNB
+++ b/openair3/GTPV1-U/Makefile.eNB
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/GTPV1-U/gtpv1u.h b/openair3/GTPV1-U/gtpv1u.h
index 9f2f65db9a81123946ea3696ad94e87b935fea5f..9466f024bc0ce1c2131de57ae4a2e2282136d7bd 100644
--- a/openair3/GTPV1-U/gtpv1u.h
+++ b/openair3/GTPV1-U/gtpv1u.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c
index bafc8d2e86e71d47f156a034ba19104d79e1e38c..7f63e8c1ce6fdd179aa6a565bd61ef0dfbdc4ee1 100644
--- a/openair3/GTPV1-U/gtpv1u_eNB.c
+++ b/openair3/GTPV1-U/gtpv1u_eNB.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -49,9 +49,11 @@
 #include "COMMON/platform_constants.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "common/ran_context.h"
+#include "gtpv1u_eNB_defs.h"
 
 #undef GTP_DUMP_SOCKET
 
+/*
 extern boolean_t pdcp_data_req(
   const protocol_ctxt_t* const  ctxt_pP,
   const srb_flag_t     srb_flagP,
@@ -61,7 +63,7 @@ extern boolean_t pdcp_data_req(
   const sdu_size_t     sdu_buffer_sizeP,
   unsigned char *const sdu_buffer_pP,
   const pdcp_transmission_mode_t modeP);
-
+*/
 extern unsigned char NB_eNB_INST;
 extern RAN_CONTEXT_t RC;
 
@@ -766,6 +768,7 @@ gtpv1u_create_s1u_tunnel(
       gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB               = s1u_teid;
       gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB_stack_session = stack_req.apiInfo.createTunnelEndPointInfo.hStackSession;
       gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_sgw               = create_tunnel_req_pP->sgw_S1u_teid[i];
+      gtpv1u_ue_data_p->num_bearers++;
       create_tunnel_resp_pP->enb_S1u_teid[i] = s1u_teid;
 
     } else {
@@ -807,7 +810,88 @@ gtpv1u_create_s1u_tunnel(
   return 0;
 }
 
+int gtpv1u_update_s1u_tunnel(
+    const instance_t                              instanceP,
+    const gtpv1u_enb_create_tunnel_req_t * const  create_tunnel_req_pP,
+    const rnti_t                                  prior_rnti
+    )
+{
+
+  /* Local tunnel end-point identifier */
+  teid_t                   s1u_teid             = 0;
+  gtpv1u_teid_data_t      *gtpv1u_teid_data_p   = NULL;
+  gtpv1u_ue_data_t        *gtpv1u_ue_data_p     = NULL;
+  gtpv1u_ue_data_t        *gtpv1u_ue_data_new_p     = NULL;
+  //MessageDef              *message_p            = NULL;
+  hashtable_rc_t           hash_rc              = HASH_TABLE_KEY_NOT_EXISTS;
+  int                      i,j;
+  uint8_t                  bearers_num = 0,bearers_total = 0;
+
+  //-----------------------
+  // PDCP->GTPV1U mapping
+  //-----------------------
+  hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, prior_rnti, (void **)&gtpv1u_ue_data_p);
+  if(hash_rc != HASH_TABLE_OK){
+    LOG_E(GTPU,"Error get ue_mapping(rnti=%x) from GTPV1U hashtable error\n", prior_rnti);
+    return -1;
+  }
+
+  gtpv1u_ue_data_new_p = calloc (1, sizeof(gtpv1u_ue_data_t));
+  memcpy(gtpv1u_ue_data_new_p,gtpv1u_ue_data_p,sizeof(gtpv1u_ue_data_t));
+  gtpv1u_ue_data_new_p->ue_id       = create_tunnel_req_pP->rnti;
+
+  hash_rc = hashtable_insert(RC.gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, gtpv1u_ue_data_new_p);
+  AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable");
+  LOG_I(GTPU, "inserting ue_mapping(rnti=%x) in GTPV1U hashtable\n",
+      create_tunnel_req_pP->rnti);
+
+  hash_rc = hashtable_remove(RC.gtpv1u_data_g->ue_mapping, prior_rnti);
+  LOG_I(GTPU, "hashtable_remove ue_mapping(rnti=%x) in GTPV1U hashtable\n",
+		  prior_rnti);
+  //-----------------------
+  // GTPV1U->PDCP mapping
+  //-----------------------
+  bearers_total =gtpv1u_ue_data_new_p->num_bearers;
+  for(j = 0;j<GTPV1U_MAX_BEARERS_ID;j++){
+
+    if(gtpv1u_ue_data_new_p->bearers[j].state != BEARER_IN_CONFIG)
+      continue;
+
+    bearers_num++;
+    for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) {
+      if(j == (create_tunnel_req_pP->eps_bearer_id[i]-GTPV1U_BEARER_OFFSET))
+        break;
+    }
+    if(i < create_tunnel_req_pP->num_tunnels){
+      s1u_teid = gtpv1u_ue_data_new_p->bearers[j].teid_eNB;
+      hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, s1u_teid, (void**)&gtpv1u_teid_data_p);
+      if (hash_rc == HASH_TABLE_OK) {
+        gtpv1u_teid_data_p->ue_id         = create_tunnel_req_pP->rnti;
+        gtpv1u_teid_data_p->eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i];
+
+        LOG_I(GTPU, "updata teid_mapping te_id %u (prior_rnti %x rnti %x) in GTPV1U hashtable\n",
+              s1u_teid,prior_rnti,create_tunnel_req_pP->rnti);
+      }else{
+        LOG_W(GTPU, "Error get teid mapping(s1u_teid=%u) from GTPV1U hashtable", s1u_teid);
+      }
+    }else{
+      s1u_teid = gtpv1u_ue_data_new_p->bearers[j].teid_eNB;
+      hash_rc = hashtable_remove(RC.gtpv1u_data_g->teid_mapping, s1u_teid);
+
+      if (hash_rc != HASH_TABLE_OK) {
+        LOG_D(GTPU, "Removed user rnti %x , enb S1U teid %u not found\n", prior_rnti, s1u_teid);
+      }
+      gtpv1u_ue_data_new_p->bearers[j].state = BEARER_DOWN;
+      gtpv1u_ue_data_new_p->num_bearers--;
+      LOG_I(GTPU, "delete teid_mapping te_id %u (rnti%x) bearer_id %d in GTPV1U hashtable\n",
+            s1u_teid,prior_rnti,j+GTPV1U_BEARER_OFFSET);;
+    }
+    if(bearers_num > bearers_total)
+      break;
+  }
+  return 0;
 
+}
 
 //-----------------------------------------------------------------------------
 static int gtpv1u_delete_s1u_tunnel(
@@ -1136,6 +1220,7 @@ void *gtpv1u_eNB_task(void *args)
         hashtable_destroy (RC.gtpv1u_data_g->teid_mapping);
       }
 
+      LOG_W(GTPU, " *** Exiting GTPU thread\n");
       itti_exit_task();
     }
     break;
diff --git a/openair3/GTPV1-U/gtpv1u_eNB_defs.h b/openair3/GTPV1-U/gtpv1u_eNB_defs.h
index 91f045ace2ea3ef11c523cb53d98061e0f1c67ba..8f8cff2e87f242e11cf368aa91b22f80fa68b737 100644
--- a/openair3/GTPV1-U/gtpv1u_eNB_defs.h
+++ b/openair3/GTPV1-U/gtpv1u_eNB_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -33,6 +33,8 @@
 #ifndef GTPV1U_ENB_DEFS_H_
 #define GTPV1U_ENB_DEFS_H_
 
+#include "NwGtpv1u.h"
+
 #define GTPV1U_UDP_PORT (2152)
 #define GTPV1U_BEARER_OFFSET 3
 
diff --git a/openair3/GTPV1-U/gtpv1u_eNB_task.h b/openair3/GTPV1-U/gtpv1u_eNB_task.h
index 880719a0ad51fb0e7dd297a060e120a4b1c52cc7..5a7822fe8c7322e12a6a32d231cec8c6af1d1df6 100644
--- a/openair3/GTPV1-U/gtpv1u_eNB_task.h
+++ b/openair3/GTPV1-U/gtpv1u_eNB_task.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -49,5 +49,9 @@ gtpv1u_create_s1u_tunnel(
   const gtpv1u_enb_create_tunnel_req_t *  const create_tunnel_req_pP,
         gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP);
 
-
+int
+gtpv1u_update_s1u_tunnel(
+    const instance_t                              instanceP,
+    const gtpv1u_enb_create_tunnel_req_t * const  create_tunnel_req_pP,
+    const rnti_t                                  prior_rnti);
 #endif /* GTPV1U_ENB_TASK_H_ */
diff --git a/openair3/GTPV1-U/gtpv1u_sgw_defs.h b/openair3/GTPV1-U/gtpv1u_sgw_defs.h
index 218d0df96fc430be830771eae6849cf8c0bb7987..1d62c18bf62b1c2cdd140f1aac73cf0d7e30dec2 100644
--- a/openair3/GTPV1-U/gtpv1u_sgw_defs.h
+++ b/openair3/GTPV1-U/gtpv1u_sgw_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/GTPV1-U/gtpv1u_task.c b/openair3/GTPV1-U/gtpv1u_task.c
index f9397f21ca1b3e0dce873c1e9112a4344b2ab899..287c22b7e7ab28d162f6b36815b11eb14b629588 100644
--- a/openair3/GTPV1-U/gtpv1u_task.c
+++ b/openair3/GTPV1-U/gtpv1u_task.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -423,6 +423,7 @@ static void *gtpv1u_thread(void *args)
     switch (ITTI_MSG_ID(received_message_p)) {
 
     case TERMINATE_MESSAGE: {
+      GTPU_WARN(" *** Exiting GTPU thread\n");
       itti_exit_task();
     }
     break;
diff --git a/openair3/GTPV1-U/gtpv1u_teid_pool.c b/openair3/GTPV1-U/gtpv1u_teid_pool.c
index 6596a2b9a9c6ab9f4452e36f73102e67083ff7f7..ff0ac6f1839040f582ddbeaff7f91153b2a9a9e7 100644
--- a/openair3/GTPV1-U/gtpv1u_teid_pool.c
+++ b/openair3/GTPV1-U/gtpv1u_teid_pool.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/API/NETWORK/as_message.c b/openair3/NAS/COMMON/API/NETWORK/as_message.c
index 201ed441f302af3209f9cfb3729e28faa88a4b5f..fd3f15cb4ca840dd44a38359779d662a55cba9ea 100644
--- a/openair3/NAS/COMMON/API/NETWORK/as_message.c
+++ b/openair3/NAS/COMMON/API/NETWORK/as_message.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/API/NETWORK/l2_message.h b/openair3/NAS/COMMON/API/NETWORK/l2_message.h
index 39a2d18905358ddf5300b531f15a3dda8b1c3bf4..9cf65b7736db6c01c89ac0f8442e84114ab81916 100644
--- a/openair3/NAS/COMMON/API/NETWORK/l2_message.h
+++ b/openair3/NAS/COMMON/API/NETWORK/l2_message.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.c b/openair3/NAS/COMMON/API/NETWORK/nas_message.c
index c61ad6532f94f34fb55a5242249220df6b95a12e..4eea2c4d6bd7d2e45f5815098420099d997eb6e1 100644
--- a/openair3/NAS/COMMON/API/NETWORK/nas_message.c
+++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.h b/openair3/NAS/COMMON/API/NETWORK/nas_message.h
index 8094d31298001373747a38c0836ea183dbe44d86..8fde6eb97df57f3c17615e7912ad082d12ff1e9c 100644
--- a/openair3/NAS/COMMON/API/NETWORK/nas_message.h
+++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/API/NETWORK/network_api.c b/openair3/NAS/COMMON/API/NETWORK/network_api.c
index a9d5c48547b9e1684069ec70954e14f91d527a7a..160eb78e17c553bae71137928558943511c09f8d 100644
--- a/openair3/NAS/COMMON/API/NETWORK/network_api.c
+++ b/openair3/NAS/COMMON/API/NETWORK/network_api.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/API/NETWORK/network_api.h b/openair3/NAS/COMMON/API/NETWORK/network_api.h
index 22bf0f426e623b86f1ea51696cfa5f98d0dd306d..57abb2c4f6e82d22f8ee1860c1455e06892939c0 100644
--- a/openair3/NAS/COMMON/API/NETWORK/network_api.h
+++ b/openair3/NAS/COMMON/API/NETWORK/network_api.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c b/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c
index 727bacfa2dcbf316ad5a93b8e6beb6dfe4715609..8ac43cf7b13fd1c3e4c09a9c39db6e4649699c3d 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c
+++ b/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachAccept.h b/openair3/NAS/COMMON/EMM/MSG/AttachAccept.h
index ced696afdb8d0ee3c9ca7df4edcc8926f6745d2d..3d944e8bfb05dfba5c4ee686867f864954668c4d 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AttachAccept.h
+++ b/openair3/NAS/COMMON/EMM/MSG/AttachAccept.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachComplete.c b/openair3/NAS/COMMON/EMM/MSG/AttachComplete.c
index 80479b58c3e408f833d0855a9ccc6708631a28a5..26d4b6ddd7e8122cc955b641d1c566995f738596 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AttachComplete.c
+++ b/openair3/NAS/COMMON/EMM/MSG/AttachComplete.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachComplete.h b/openair3/NAS/COMMON/EMM/MSG/AttachComplete.h
index 309726b925432a5cc666c07cd8bdcb951f7b16a7..e11ad97156ce196af2fe11f3cde159f384139b35 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AttachComplete.h
+++ b/openair3/NAS/COMMON/EMM/MSG/AttachComplete.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachReject.c b/openair3/NAS/COMMON/EMM/MSG/AttachReject.c
index a15c6b624ccddd5636a39f35e61723f92e2bb2ec..c0b3208ff9cd9e9bd7031388c2be3ff3423faa60 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AttachReject.c
+++ b/openair3/NAS/COMMON/EMM/MSG/AttachReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachReject.h b/openair3/NAS/COMMON/EMM/MSG/AttachReject.h
index d5803baec278247c14a6494db4f4be5a656b3350..5ab3b573086d81e0c58dbd8da52eec83db83e7aa 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AttachReject.h
+++ b/openair3/NAS/COMMON/EMM/MSG/AttachReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachRequest.c b/openair3/NAS/COMMON/EMM/MSG/AttachRequest.c
index 7c50d2fcdd6bafa62fa95b9a7689d828fcd085f7..7448a334191e135d3dad90dd62eab23a50e88a48 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AttachRequest.c
+++ b/openair3/NAS/COMMON/EMM/MSG/AttachRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachRequest.h b/openair3/NAS/COMMON/EMM/MSG/AttachRequest.h
index caa19922ae57d24791eff0fe686036e91c39a575..a7e4c1f17c5e889d14eaeeba68b77ab32ef798d0 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AttachRequest.h
+++ b/openair3/NAS/COMMON/EMM/MSG/AttachRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.c b/openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.c
index 7b01d0f5abdc318855f50406649ea17e5a6a1ecf..89368d75235f55eeb7b4f6ae57b87f21006455ad 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.c
+++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.h b/openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.h
index 384f51471c641e732f57671d23abef7c4350bf18..5670b0a5c1dfb8a23856b6ab9e163a005ce61b7d 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.h
+++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.c b/openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.c
index dd848aef2eb92277803fc1fe857b7030314380aa..5ca9b1a503f774eae1fc072c9a9c4c7d5ccc13ca 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.c
+++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.h b/openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.h
index 5b468dcf2550c7fed4afabb8599621e3c1af2b99..2a2ca7b7d2822428b2b9d325a9e854ff00749e31 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.h
+++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c b/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c
index 3e0bffde2d1afd718288a1bcee40058096549220..0914353478a060535544801f11edaa77c5d81322 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c
+++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.h b/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.h
index e7cdc040175c928f24ad937a25391966ec8912fa..306c8bb4048dbd89f8ce00c10e939c0181f27800 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.h
+++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.c b/openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.c
index 4b870c620016645647d11f1a565fb7778117f925..4834348595288d3e82629c40ae3e1e0bd136cf66 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.c
+++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.h b/openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.h
index 710a43f043ed82231931b7cda2ac595813aa13fa..4d49518ba0e0f5cb0708fa03f8f67e4f03af2e9a 100644
--- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.h
+++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.c b/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.c
index 0d5a336eef004f52ee7e6fb24717298231d57116..20193ef0b6b5fc331a7142d2ced871b05a8ba01e 100644
--- a/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.c
+++ b/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h b/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h
index 48e6aaec752ff151053490497e1d710fae099cf7..c173d3b729319e275ac0e9779b7899ebd5a072c0 100644
--- a/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h
+++ b/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/DetachAccept.c b/openair3/NAS/COMMON/EMM/MSG/DetachAccept.c
index c31550fdca418d838fb36b912c439105e8b9b805..0ad1066c4caf86a2ba6fd0a00565db78a00aaa72 100644
--- a/openair3/NAS/COMMON/EMM/MSG/DetachAccept.c
+++ b/openair3/NAS/COMMON/EMM/MSG/DetachAccept.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/DetachAccept.h b/openair3/NAS/COMMON/EMM/MSG/DetachAccept.h
index 48e8e674e9282f90d45723b69c2f96c066a29596..73c4e8dcb6ba59183aec3a3f95c80b6600fbcf6b 100644
--- a/openair3/NAS/COMMON/EMM/MSG/DetachAccept.h
+++ b/openair3/NAS/COMMON/EMM/MSG/DetachAccept.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/DetachRequest.c b/openair3/NAS/COMMON/EMM/MSG/DetachRequest.c
index 6c84e7d4d3011653c2f85ba68b8c52006066cbbe..1697ea17e25e15ecb41d211f45c671d7ac1dcf02 100644
--- a/openair3/NAS/COMMON/EMM/MSG/DetachRequest.c
+++ b/openair3/NAS/COMMON/EMM/MSG/DetachRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/DetachRequest.h b/openair3/NAS/COMMON/EMM/MSG/DetachRequest.h
index 557d5117eb41a3a0563947b572c72994fba33914..93cdcab1ac82d8cefc963acbe0a580db687d61eb 100644
--- a/openair3/NAS/COMMON/EMM/MSG/DetachRequest.h
+++ b/openair3/NAS/COMMON/EMM/MSG/DetachRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c b/openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c
index b020f77af3be8a5f2eedf41420741aaca2331468..5dbce599029cd949a9188ee5f16676bde6f114c5 100644
--- a/openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c
+++ b/openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h b/openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h
index a9d926bb056b63d94a416dc0e4c1cb623043fe52..f41ce23b0ec7efc4a5708cb66a6d590f07164dec 100644
--- a/openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h
+++ b/openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/EmmInformation.c b/openair3/NAS/COMMON/EMM/MSG/EmmInformation.c
index e9d4400d5f19a3974101336ec3b5c9a2d3c75220..d18e115db9c29562e960c9e117a92039545e8924 100644
--- a/openair3/NAS/COMMON/EMM/MSG/EmmInformation.c
+++ b/openair3/NAS/COMMON/EMM/MSG/EmmInformation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/EmmInformation.h b/openair3/NAS/COMMON/EMM/MSG/EmmInformation.h
index cdbc22f201b8101c5bad620efec8244915a97ab9..79eec4ddce195b4fcef76cb711f94c999f87ab7b 100644
--- a/openair3/NAS/COMMON/EMM/MSG/EmmInformation.h
+++ b/openair3/NAS/COMMON/EMM/MSG/EmmInformation.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/EmmStatus.c b/openair3/NAS/COMMON/EMM/MSG/EmmStatus.c
index a46467e099671a47ec7bab3988ea30b8c1352f99..f283d64bc98800d588fa42a5931890ef5d44cadb 100644
--- a/openair3/NAS/COMMON/EMM/MSG/EmmStatus.c
+++ b/openair3/NAS/COMMON/EMM/MSG/EmmStatus.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/EmmStatus.h b/openair3/NAS/COMMON/EMM/MSG/EmmStatus.h
index 0fcd912218164ef4802a2cd2c9c88cb6418630b7..dc860acec74ee8497efe7713e83897c04e811d6e 100644
--- a/openair3/NAS/COMMON/EMM/MSG/EmmStatus.h
+++ b/openair3/NAS/COMMON/EMM/MSG/EmmStatus.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c b/openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c
index 33e05d2b3b5b00adc7c7d02caea2697afebaaa45..a7ff89245b28975fcdb4fb29d581a500b3a99573 100644
--- a/openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c
+++ b/openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h b/openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h
index 291d757996168a68c8f594bb8ac37d79c19820b6..defe200c0f39d7133aa5b0f7e076ac26c125e98e 100644
--- a/openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h
+++ b/openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c b/openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c
index 624829b8aa2a5cccc830fd42de0fceb8b18c53ff..fac3ddbca997d9b7306834f79aa7875203fbece5 100644
--- a/openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c
+++ b/openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h b/openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h
index 3ab7bd9ceaa6a72840bbcacb2cbd5937c6554a2c..11338ddc21d1668d963206a4b1941812f454fa45 100644
--- a/openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h
+++ b/openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c b/openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c
index 6c7db3a4371891b18929f2f59b4344ae55bc4191..16083176ae033fab585946568bd45898159b5613 100644
--- a/openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c
+++ b/openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h b/openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h
index 7c8393e2f58109433fbebbe652270883f2e80ef4..f0c41a3ac981037bae1b1608be580c9a9ae6b672 100644
--- a/openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h
+++ b/openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/IdentityRequest.c b/openair3/NAS/COMMON/EMM/MSG/IdentityRequest.c
index 1397dcaee7cd44f16d1c79048a14ee56fdee73ab..17e1d26722ef11ffc9bc448950dd4781ec1107e6 100644
--- a/openair3/NAS/COMMON/EMM/MSG/IdentityRequest.c
+++ b/openair3/NAS/COMMON/EMM/MSG/IdentityRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/IdentityRequest.h b/openair3/NAS/COMMON/EMM/MSG/IdentityRequest.h
index 81c01b24c951df8c280359af5489db3f3d5923d9..ddd339e88db63964b124a6c481f8f4790ca43441 100644
--- a/openair3/NAS/COMMON/EMM/MSG/IdentityRequest.h
+++ b/openair3/NAS/COMMON/EMM/MSG/IdentityRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/IdentityResponse.c b/openair3/NAS/COMMON/EMM/MSG/IdentityResponse.c
index 25b5933927140d9dc9b690a550d7d7daf5a60e9e..1743a29d208f65831fc7de3a31f782a006882694 100644
--- a/openair3/NAS/COMMON/EMM/MSG/IdentityResponse.c
+++ b/openair3/NAS/COMMON/EMM/MSG/IdentityResponse.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/IdentityResponse.h b/openair3/NAS/COMMON/EMM/MSG/IdentityResponse.h
index aeee34fe725459cd315ff2bd1d6599ffd0ddae21..61842cc6c255399ba274330b3aea0282a3652263 100644
--- a/openair3/NAS/COMMON/EMM/MSG/IdentityResponse.h
+++ b/openair3/NAS/COMMON/EMM/MSG/IdentityResponse.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h b/openair3/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h
index b1b7fd81de6d2ee346544b080a87b849bcdb6e87..9016024af6d7b42100a9db0a1a59840ba5733ff2 100644
--- a/openair3/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h
+++ b/openair3/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h b/openair3/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h
index a014e4d3bcc5b1418fbf7b5048cebe92f784ab01..938bb9e37188caaefcc73db2c39c32dd18312f31 100644
--- a/openair3/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h
+++ b/openair3/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c b/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c
index a1a34f94954ccfed88d36be7b5007e2eff9f972d..25181d8e798c000500067a34fb7cca0dc0512cfb 100644
--- a/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c
+++ b/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c b/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c
index 3258134febff5c6ae8cefb871fa0eb4b9cc88218..8dd8b2e1b7df36cfd93588ab1d598340ed703a3d 100644
--- a/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c
+++ b/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.c b/openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.c
index 76fad512d0fbfa2cd11cd7914bd22997a23ed373..5e49f4414d7adc965eaf5fdb1ab47817778abfa5 100644
--- a/openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.c
+++ b/openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.h b/openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.h
index cef69ef61aed7cbf064d82dbdf4ddfbb0113194e..5f9cf5bcd278eeea67d88192774caec19eb0fb33 100644
--- a/openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.h
+++ b/openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/ServiceReject.c b/openair3/NAS/COMMON/EMM/MSG/ServiceReject.c
index 0008a237200f9a566ed3f9635ac113d4c2128eac..0f703871ca77b2ef9722125e0b5fed0e8603cf1b 100644
--- a/openair3/NAS/COMMON/EMM/MSG/ServiceReject.c
+++ b/openair3/NAS/COMMON/EMM/MSG/ServiceReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/ServiceReject.h b/openair3/NAS/COMMON/EMM/MSG/ServiceReject.h
index 42929ac868e0c833ca4c18e4c597426d7414476d..67a0317afd57a7e8b5f3716570232eba25dec3a5 100644
--- a/openair3/NAS/COMMON/EMM/MSG/ServiceReject.h
+++ b/openair3/NAS/COMMON/EMM/MSG/ServiceReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/ServiceRequest.c b/openair3/NAS/COMMON/EMM/MSG/ServiceRequest.c
index 944cffdb4c12e665ce3619667951be86ef86b691..9a2faf2178e72d31d4a90ec57cb99982141c8787 100644
--- a/openair3/NAS/COMMON/EMM/MSG/ServiceRequest.c
+++ b/openair3/NAS/COMMON/EMM/MSG/ServiceRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/ServiceRequest.h b/openair3/NAS/COMMON/EMM/MSG/ServiceRequest.h
index 5ad605fa83d986b79daccecff04a4c7963f430f5..548eb933e3968e39e0b6ddbdfe78a066b13be0ea 100644
--- a/openair3/NAS/COMMON/EMM/MSG/ServiceRequest.h
+++ b/openair3/NAS/COMMON/EMM/MSG/ServiceRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c
index 36894d100698060cb09beeed99a94ed9ab2260bd..159175da1b196ab7440a952503080fa8467ffc26 100644
--- a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c
+++ b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h
index 5a3dae34b3cd0270d58a7331e4bcdbf66cb91445..8ce780aab19e3e402f4f37ef71b61989e8369ab5 100644
--- a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h
+++ b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c
index 5f504a503de794855bbfbdfcda6658070f0a19c0..bf8b80d5f2ae156788f28e69338b1686a3ccdb93 100644
--- a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c
+++ b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h
index c26f0508b6c1f04b0645c6521580596f36bac32e..1b5de76e2fd866d4a824b0b4445d1b1e810a1742 100644
--- a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h
+++ b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c
index 354262452b70d148617c4d75f182e9d36c0bf525..c0fbdf711a30715e7f072c8dbb5ab92a37bfca02 100644
--- a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c
+++ b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h
index 9b23b6fc1c602070251fc84193ab6cf17354a765..9066eb586a279942e9df95f0dd1e498fb72a64ce 100644
--- a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h
+++ b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c
index bc5bb351d83c46b8168a632f9cd1b858dd8316b2..49632057c09409322d530a5a771ea6da0e5e82bb 100644
--- a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c
+++ b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h
index 2a5a36fc0aad69b1507492fa265f36eb3a55ec26..6fe27261304dd61490d4c17a4e7c10c915fb7c02 100644
--- a/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h
+++ b/openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.c b/openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.c
index fe6244b9424688bfa30d017da1ddccafd34b8a41..0aaadc9316713400f7b169b120e776cd0f5a73a7 100644
--- a/openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.c
+++ b/openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.h b/openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.h
index 3c2522f623cc00c2710b8adf6ba33a188f6af968..f2e7cd392af0f084e632e39f70997724fd68fe61 100644
--- a/openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.h
+++ b/openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/emm_cause.h b/openair3/NAS/COMMON/EMM/MSG/emm_cause.h
index 2f65e2b11b97f795f7598f7cb55b00dff39ae102..4b7796c95c4983d41de9eafd643fcb6176cd6d2c 100644
--- a/openair3/NAS/COMMON/EMM/MSG/emm_cause.h
+++ b/openair3/NAS/COMMON/EMM/MSG/emm_cause.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
index c357e8784f803827e9e83041033472d1b571bb86..b9c9b93a9caf3625076d3351b7d0e35ba2261980 100644
--- a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
+++ b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/emm_msg.h b/openair3/NAS/COMMON/EMM/MSG/emm_msg.h
index 29f9975716dde44b14044bf32d968750c87c32d1..56985227ad8ab6af6490f8495de7866892e5dda1 100644
--- a/openair3/NAS/COMMON/EMM/MSG/emm_msg.h
+++ b/openair3/NAS/COMMON/EMM/MSG/emm_msg.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/EMM/MSG/emm_msgDef.h b/openair3/NAS/COMMON/EMM/MSG/emm_msgDef.h
index a5f114184bf22348c99d59580408ce7eafa2aaed..b95e140595588c04d39b3c4ca1a2bc263d8f2941 100644
--- a/openair3/NAS/COMMON/EMM/MSG/emm_msgDef.h
+++ b/openair3/NAS/COMMON/EMM/MSG/emm_msgDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
index af2da7d1ba18406ed7df7fa452890de7f8602029..e77e1d774909fc74a18dd7bf0a33f9e367d3f7f3 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h
index b248f2b9bd308b7fef80ecb8002ac393f241ced8..2bb3e7e4230cb2acadebe325d028fad7d77d6e52 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
index 63552adcae99447e22f3e91e8a94198dc9a40f15..1a1d6ffbdb6093dd94d4afd560e34fd7ac65bedb 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h
index 7ff7b761cc09447967afa35240a8eb75ffd63238..4b69cbc454d472bf2ba6db2426069e85671a7875 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c
index 0797001e8a5ef72fe1dabaa613623891cfe196e4..f4f0a3343cd011472c1de56d690ffd7e10752b91 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h
index 574a72a7c9a7147e492db646cb1ddc44d0a51c0a..3bf2794e1dad2c96d8a68a717c7209f124c23481 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c
index 8b58c38b5f9292c68d10daa070366b2eb218d9c6..d94c6f4652bd4b6807f3afef06b3c7d023d81454 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h
index 574b258feb36ac92712a41ee18b0b687ed4ffbf2..045ef495af8671216b0570ed060effc81f747853 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c
index e9a902ca947e91170cd64fa2d136f0ddf29adfd7..f5828ac87a28699803072c805510be07721c51c2 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h
index 9c74a869ed6d6172112baf3a26d7ece05e8677c0..abfda25f632247afc70c3cf823f7fadf54ccb056 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
index 02f293e9f0e7ccd440b69372fe8cd86743729827..068ee5db6ac4ca47186df04c8b685e46703d0697 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h
index 56e305fb7480e0826591142c0fff143d90e22439..6931038bd86007baa3c6bf27cb277d9289d9419c 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c b/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c
index a81a6325cebb7e9916930066c5868d03639ff69d..c7b42cc9b40e3e6d3ad0162db2c86f783ef5a79c 100644
--- a/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c
+++ b/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h b/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h
index d7cec7bfbe0fe27cc5e4368eb99a50416751217d..321b0e4ff59f817e78210a77f601236b3836ed37 100644
--- a/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h
+++ b/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c b/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c
index 3696012d7f38256bd86b709257f2d9377d749509..3fddc04983dd386b4b62221a3962fb429d7ed517 100644
--- a/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h b/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h
index 5428b03d513fbdc337c78be81543651a35b53be1..17283167f64adeb419188aca8567566c1158ca0d 100644
--- a/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c b/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c
index b0b143857bd6663d122b058dd7d34373e0311f8f..8b1ace65b852295bc01486c44df4bbc64540e6d7 100644
--- a/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c
+++ b/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h b/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h
index 26daab2c119d2328230f24012a3f9bf55525bb49..f437c709485a4262b7ed7bfac3e50ec77823dea9 100644
--- a/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h
+++ b/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c b/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c
index 2357006ef5fb3093313d6851929a962235d6120d..ff0a5294d9bf03b81abecac00e707ee8f6d826a5 100644
--- a/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h b/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h
index fda843206fd8a92285628e6599dddac2c3bd01bf..90a3ec59288dde15edbdb2cfe0f271acc1a171ae 100644
--- a/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c b/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c
index 6f958d14987e88283f2f62db88a5f1f81a366872..07ea8f7f688845a89edbb8c285900d02bf7a77b5 100644
--- a/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c
+++ b/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h b/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h
index c2aac073ebe104502b36410c50b1e2c905010f73..446a59a0853fa9852ece6c5786f3496230bf0be2 100644
--- a/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h
+++ b/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c b/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c
index 4854d2bd9896e006e340477d92ff5ef6cfd98c13..7a4647c57bbde54f3df8410df87678850810e3a8 100644
--- a/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h b/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h
index 4f86c50a6c502c334e0841f36eaa8976d6d68c80..72b39113f952afa884a68475644fbbc26b165243 100644
--- a/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/EsmInformationRequest.c b/openair3/NAS/COMMON/ESM/MSG/EsmInformationRequest.c
index 862046dc0e66bde00ac028b9b5a6ad9464f4e3fc..622135c312fc1a4b204783ef90487ece749752b9 100644
--- a/openair3/NAS/COMMON/ESM/MSG/EsmInformationRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/EsmInformationRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/EsmInformationRequest.h b/openair3/NAS/COMMON/ESM/MSG/EsmInformationRequest.h
index 20c668449b6d6d60026e22285e9f0d13d62d0d93..8d2b6511fdbf912cdbd84465fc16efe8e0cc883f 100644
--- a/openair3/NAS/COMMON/ESM/MSG/EsmInformationRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/EsmInformationRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.c b/openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.c
index 287e3efcb204451fc4d2377bbe8feeadbfcfbc82..e562d2a8143ce048326b3d4e9d1f73844dc07184 100644
--- a/openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.c
+++ b/openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.h b/openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.h
index fbb49542901c384d1e5d1641efaf47458fbf15d4..58751b54d384b62b846e769beb8a1743ed1b9945 100644
--- a/openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.h
+++ b/openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/EsmStatus.c b/openair3/NAS/COMMON/ESM/MSG/EsmStatus.c
index 0538722291f3fc4fd674f6d672f4d345e298d245..8c8bd62bd04048a91fea0ac6c9d0906274d0f8c3 100644
--- a/openair3/NAS/COMMON/ESM/MSG/EsmStatus.c
+++ b/openair3/NAS/COMMON/ESM/MSG/EsmStatus.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/EsmStatus.h b/openair3/NAS/COMMON/ESM/MSG/EsmStatus.h
index 125a50305f56a7c4009c0bf509df7d56c6050ae9..4f6e213ec86bdeaccfd16ddbcb9e11d090f710ed 100644
--- a/openair3/NAS/COMMON/ESM/MSG/EsmStatus.h
+++ b/openair3/NAS/COMMON/ESM/MSG/EsmStatus.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c
index 2fe1444d51190d95047594c819ddb4562a78206a..23a6ce5230e5ef0a944ded801a191fdf4902a30c 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h
index 8891de5954cff828efb8b9bfac773c89afb9e251..218c3cf8743be7565f6df7c32e4bb2043a31355b 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c
index 6c76f6c52d050dfc7c409393ad2cd692c962f894..71e05c06e6c36b1d97f1fabade10df1c2b79b571 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h
index 959fd2185d8a956eb4e3683f148c47018e069bac..b2d7cc56b7ca121034af89042b3783a9ae723fa1 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c
index b9cbdefbb2ca2d490d89a598396ada7b32a3481d..02b978b82276aeea26331c1778204813eca59bfb 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h
index 456d70d90f2ccd08cbe198cb5312a8cf6c58fcb5..2eb1ae8945005b73e164661ca1e99f1fced5513a 100644
--- a/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c b/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c
index 8658a850388466ecda707305da8fea813cf5fcfd..f7b1256f9d97f56bd0c07eb123757e586b9e5cd9 100644
--- a/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c
+++ b/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h b/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h
index b595e14f217c786aedcac8f21c28edf278df87b8..fb2fe9fa19aa28526ded0bdd6b3ea36d55466ee6 100644
--- a/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h
+++ b/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c b/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c
index f5b84430640b736f56c2da6d5125e8f851851fde..957d813cf1f3dbf2eab8fc64d3295d9aa72633b6 100644
--- a/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h b/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h
index ca28ea78b502dfeda08eec8fc543face7a9c8854..3cd791a5f8d143b0cd8be635a4eea4ccfad2b171 100644
--- a/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c b/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c
index 668c34d87285b4877204f31865e3a91e48177bc9..9081ee885e767245f0945230e7f8b4399004adb5 100644
--- a/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c
+++ b/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h b/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h
index c183e8ebe80769334c2ef3a8bcbd5eda8bf2b991..0c064617eeca6a88b749cbd6ecc9c4ca8342e5aa 100644
--- a/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h
+++ b/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c b/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c
index ee53ed7baadd8022555ab907384821e6c8bb1166..506cb2959eb0c7c3d63f1675e2ffa8e25dc637b2 100644
--- a/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c
+++ b/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h b/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h
index c8913e1db0d620db858cabae91811997b639232d..94c2c2c3bfba37ef1a2de0a14e26a41a38dbc9b1 100644
--- a/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h
+++ b/openair3/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/esm_cause.h b/openair3/NAS/COMMON/ESM/MSG/esm_cause.h
index 04ff141d2c8d9e7564b96f669e9d658bc19f0d29..124663e05b40ca7fae58c45196c69f2529160eec 100644
--- a/openair3/NAS/COMMON/ESM/MSG/esm_cause.h
+++ b/openair3/NAS/COMMON/ESM/MSG/esm_cause.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/esm_msg.c b/openair3/NAS/COMMON/ESM/MSG/esm_msg.c
index e5bf6035917050b7e9abbb70dd16bf20e8533e45..f4d3dd94ddca5ac0a1a44b5eeb903d159814d1ee 100644
--- a/openair3/NAS/COMMON/ESM/MSG/esm_msg.c
+++ b/openair3/NAS/COMMON/ESM/MSG/esm_msg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/esm_msg.h b/openair3/NAS/COMMON/ESM/MSG/esm_msg.h
index 410460ca1c8bc327076c5e24632a4f0d434c92a2..ef8c05dd95a110d8fa7fd131d70ee0903f4c8bc6 100644
--- a/openair3/NAS/COMMON/ESM/MSG/esm_msg.h
+++ b/openair3/NAS/COMMON/ESM/MSG/esm_msg.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/ESM/MSG/esm_msgDef.h b/openair3/NAS/COMMON/ESM/MSG/esm_msgDef.h
index 2dddfbfadd76919797e6e31741e401c6f841105f..48e6a18a90dc3c2cab814693cca11a907fbbcd58 100644
--- a/openair3/NAS/COMMON/ESM/MSG/esm_msgDef.h
+++ b/openair3/NAS/COMMON/ESM/MSG/esm_msgDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AccessPointName.c b/openair3/NAS/COMMON/IES/AccessPointName.c
index 43446270c9d87d31d1844e3cfe572d251ba90491..c63bb91222d0969c3a784c4e1eca2c19a5ed6864 100644
--- a/openair3/NAS/COMMON/IES/AccessPointName.c
+++ b/openair3/NAS/COMMON/IES/AccessPointName.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AccessPointName.h b/openair3/NAS/COMMON/IES/AccessPointName.h
index f0d20d199bec1a98641c22d2c4507b7a69aaab36..6c10a942b5b2fd361bc4aa67d1d4f0314be02a34 100644
--- a/openair3/NAS/COMMON/IES/AccessPointName.h
+++ b/openair3/NAS/COMMON/IES/AccessPointName.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AdditionalUpdateResult.c b/openair3/NAS/COMMON/IES/AdditionalUpdateResult.c
index f5208d3ff6f3de4c313eb60cfc9b914c685c5a05..1869155aba4088fab947d36c982e1d00b23bc95b 100644
--- a/openair3/NAS/COMMON/IES/AdditionalUpdateResult.c
+++ b/openair3/NAS/COMMON/IES/AdditionalUpdateResult.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AdditionalUpdateResult.h b/openair3/NAS/COMMON/IES/AdditionalUpdateResult.h
index 448e7c3fe2b3dcac6b49be00ebd7d0327d4f2e26..4f6cf5a4a0461f40279d3e3e72d4b60b6420ece4 100644
--- a/openair3/NAS/COMMON/IES/AdditionalUpdateResult.h
+++ b/openair3/NAS/COMMON/IES/AdditionalUpdateResult.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AdditionalUpdateType.c b/openair3/NAS/COMMON/IES/AdditionalUpdateType.c
index 48e7fb56762a3a885ec6efaab995e9872e000889..5bed4fdbb89a3fd56ed4850975826dbb11ab84f0 100644
--- a/openair3/NAS/COMMON/IES/AdditionalUpdateType.c
+++ b/openair3/NAS/COMMON/IES/AdditionalUpdateType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AdditionalUpdateType.h b/openair3/NAS/COMMON/IES/AdditionalUpdateType.h
index b5729f0c9d1696d0224dd7de20a7f96d2f1590a0..57a2f0e07517a69bdf6fcc549c12f1a49d70000f 100644
--- a/openair3/NAS/COMMON/IES/AdditionalUpdateType.h
+++ b/openair3/NAS/COMMON/IES/AdditionalUpdateType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.c b/openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.c
index cedc75b82cb60c220df7a7b9daf523bcc254d479..4d01fc5b46a455de8356c123d1129e1ccc5a28e0 100644
--- a/openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.c
+++ b/openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.h b/openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.h
index 24823b4006d444873183419b253559b9372e997e..82d3da4094ef005497a7996d6352cbcdd2811e25 100644
--- a/openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.h
+++ b/openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AuthenticationFailureParameter.c b/openair3/NAS/COMMON/IES/AuthenticationFailureParameter.c
index e0f016ba6adb6f98a7f1709b9803d0de1dd44b51..4989ae27fee3e3dff36376f505f0f4b096745991 100644
--- a/openair3/NAS/COMMON/IES/AuthenticationFailureParameter.c
+++ b/openair3/NAS/COMMON/IES/AuthenticationFailureParameter.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AuthenticationFailureParameter.h b/openair3/NAS/COMMON/IES/AuthenticationFailureParameter.h
index 24624d3c8c87beb31abcd3f70f37a9a4265aab81..81b943afe4a3cc0b2072704a4b48e535d9e0e26c 100644
--- a/openair3/NAS/COMMON/IES/AuthenticationFailureParameter.h
+++ b/openair3/NAS/COMMON/IES/AuthenticationFailureParameter.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AuthenticationParameterAutn.c b/openair3/NAS/COMMON/IES/AuthenticationParameterAutn.c
index 1cb31c940678a3c3b32fb35bf67656338765e19f..7de70359f7aa42a019e88cf6b0a086211452115a 100644
--- a/openair3/NAS/COMMON/IES/AuthenticationParameterAutn.c
+++ b/openair3/NAS/COMMON/IES/AuthenticationParameterAutn.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AuthenticationParameterAutn.h b/openair3/NAS/COMMON/IES/AuthenticationParameterAutn.h
index 2e5e51461b11316a2d1731fafc79874c26a178a9..63866642ebd97c4aef56908e7ddc20b984ab4a10 100644
--- a/openair3/NAS/COMMON/IES/AuthenticationParameterAutn.h
+++ b/openair3/NAS/COMMON/IES/AuthenticationParameterAutn.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AuthenticationParameterRand.c b/openair3/NAS/COMMON/IES/AuthenticationParameterRand.c
index c355eb54697374364102ced855873b693aa5c9d2..a63a03bec19df032eac46b8279b7ad5e43bc3ea6 100644
--- a/openair3/NAS/COMMON/IES/AuthenticationParameterRand.c
+++ b/openair3/NAS/COMMON/IES/AuthenticationParameterRand.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AuthenticationParameterRand.h b/openair3/NAS/COMMON/IES/AuthenticationParameterRand.h
index 45aea0affc87102a19491896529cfd00672bcb3d..bdea4e9eed953b4ffae2c1fc8ebbbd4e4c1f431f 100644
--- a/openair3/NAS/COMMON/IES/AuthenticationParameterRand.h
+++ b/openair3/NAS/COMMON/IES/AuthenticationParameterRand.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AuthenticationResponseParameter.c b/openair3/NAS/COMMON/IES/AuthenticationResponseParameter.c
index 46cda8adbc18050583e748b7703ca6d910e1ff3e..3ac3e60a3db61663db0c383a1ca56e7339da9b2f 100644
--- a/openair3/NAS/COMMON/IES/AuthenticationResponseParameter.c
+++ b/openair3/NAS/COMMON/IES/AuthenticationResponseParameter.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/AuthenticationResponseParameter.h b/openair3/NAS/COMMON/IES/AuthenticationResponseParameter.h
index 0ed254119b14fce55466aac0c4aeea6ea957d79f..4e3dd33d5bfebcf8eff6e2b129f6f83dedd3802a 100644
--- a/openair3/NAS/COMMON/IES/AuthenticationResponseParameter.h
+++ b/openair3/NAS/COMMON/IES/AuthenticationResponseParameter.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/CipheringKeySequenceNumber.c b/openair3/NAS/COMMON/IES/CipheringKeySequenceNumber.c
index dd59717b06e38eea533c1cf72757c39d0e144e48..e10fe42a77a98d2899874b478664bbd73e5f4fe8 100644
--- a/openair3/NAS/COMMON/IES/CipheringKeySequenceNumber.c
+++ b/openair3/NAS/COMMON/IES/CipheringKeySequenceNumber.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/CipheringKeySequenceNumber.h b/openair3/NAS/COMMON/IES/CipheringKeySequenceNumber.h
index cbcde08fb54e3afee9bf141abffcb0bad5274ebb..18955204c5989d710fcc9ca427157fa16e7513d6 100644
--- a/openair3/NAS/COMMON/IES/CipheringKeySequenceNumber.h
+++ b/openair3/NAS/COMMON/IES/CipheringKeySequenceNumber.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/Cli.c b/openair3/NAS/COMMON/IES/Cli.c
index 92ed87c020314b12822d4d24aac12062577f3242..e8878a26427fc3a1b9cb55dfe8eb98d15eef7972 100644
--- a/openair3/NAS/COMMON/IES/Cli.c
+++ b/openair3/NAS/COMMON/IES/Cli.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/Cli.h b/openair3/NAS/COMMON/IES/Cli.h
index f1c8809c3c6a81e3bcf95c41764a09198a03deb8..47b9c35838f54afa6f73f49b853f6a4eb24a06b6 100644
--- a/openair3/NAS/COMMON/IES/Cli.h
+++ b/openair3/NAS/COMMON/IES/Cli.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/CsfbResponse.c b/openair3/NAS/COMMON/IES/CsfbResponse.c
index 3cb05e0e8adcf5659fe20181113dbe528ffe8635..b5ab64ce8d9f7aa2c870a2056b051088160a6554 100644
--- a/openair3/NAS/COMMON/IES/CsfbResponse.c
+++ b/openair3/NAS/COMMON/IES/CsfbResponse.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/CsfbResponse.h b/openair3/NAS/COMMON/IES/CsfbResponse.h
index 78d984bf5a53c1ac6de8af55ba798ecf3389418f..05aba3bf8fdabd809e110d8fa8eed2149c83e837 100644
--- a/openair3/NAS/COMMON/IES/CsfbResponse.h
+++ b/openair3/NAS/COMMON/IES/CsfbResponse.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/DaylightSavingTime.c b/openair3/NAS/COMMON/IES/DaylightSavingTime.c
index 70fc1d199d34f6199386e1ca743389fdebc80c8c..b5c242414d5c352aea3a0ceb3600b411ab09b369 100644
--- a/openair3/NAS/COMMON/IES/DaylightSavingTime.c
+++ b/openair3/NAS/COMMON/IES/DaylightSavingTime.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/DaylightSavingTime.h b/openair3/NAS/COMMON/IES/DaylightSavingTime.h
index 3830fdce3a26e3fb3e72e1aa9b9f10e15f4ae8ad..993065c958b95ad95f626623eb57ad008030661f 100644
--- a/openair3/NAS/COMMON/IES/DaylightSavingTime.h
+++ b/openair3/NAS/COMMON/IES/DaylightSavingTime.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/DetachType.c b/openair3/NAS/COMMON/IES/DetachType.c
index 7ff9320008c8e69f0a07e81134bd6ea3af2c6a23..8a925eb7b47dd4a1f49c9b46144ed643ceaa0dfe 100644
--- a/openair3/NAS/COMMON/IES/DetachType.c
+++ b/openair3/NAS/COMMON/IES/DetachType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/DetachType.h b/openair3/NAS/COMMON/IES/DetachType.h
index e84a57d19d436e3ad13beb1d921b687c52d539c5..c1b1b2a37f4decb4e305306b5a748f86900ca48e 100644
--- a/openair3/NAS/COMMON/IES/DetachType.h
+++ b/openair3/NAS/COMMON/IES/DetachType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/DrxParameter.c b/openair3/NAS/COMMON/IES/DrxParameter.c
index 9b607f0e79019236158da3ddedad7aba3dd194b1..3734f8697672e7cea10c816fdac16d3ca64bdea5 100644
--- a/openair3/NAS/COMMON/IES/DrxParameter.c
+++ b/openair3/NAS/COMMON/IES/DrxParameter.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/DrxParameter.h b/openair3/NAS/COMMON/IES/DrxParameter.h
index e6d4aa284d4f20d3d6a45939480baba5bf8050ab..43af09f018d80edc501177382f9dba8624d3c79f 100644
--- a/openair3/NAS/COMMON/IES/DrxParameter.h
+++ b/openair3/NAS/COMMON/IES/DrxParameter.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EmergencyNumberList.c b/openair3/NAS/COMMON/IES/EmergencyNumberList.c
index 9330fdc312ef0107e29298554021bd03d1ae19db..ccf030b58398c0706a4d08524e945c72f50ce68f 100644
--- a/openair3/NAS/COMMON/IES/EmergencyNumberList.c
+++ b/openair3/NAS/COMMON/IES/EmergencyNumberList.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EmergencyNumberList.h b/openair3/NAS/COMMON/IES/EmergencyNumberList.h
index ab47c1ff06766208d0ff18153a05dc7fa6efb599..d8147eccde647b5f8e757c2852b7cd28a8145580 100644
--- a/openair3/NAS/COMMON/IES/EmergencyNumberList.h
+++ b/openair3/NAS/COMMON/IES/EmergencyNumberList.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EmmCause.c b/openair3/NAS/COMMON/IES/EmmCause.c
index 21e52fe2cf0667f46f59ea52042d8a6050619087..965f1e0f135d9b268de8785a98a4c62af8a7b361 100644
--- a/openair3/NAS/COMMON/IES/EmmCause.c
+++ b/openair3/NAS/COMMON/IES/EmmCause.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EmmCause.h b/openair3/NAS/COMMON/IES/EmmCause.h
index 584c23d930762b86e1f6e0e60295127e79acc857..11ac2489b98ffa434695272acc0fe0354eb9fd76 100644
--- a/openair3/NAS/COMMON/IES/EmmCause.h
+++ b/openair3/NAS/COMMON/IES/EmmCause.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsAttachResult.c b/openair3/NAS/COMMON/IES/EpsAttachResult.c
index b4d51663c996f459a77f56dd4f8d10e2e6eec356..b48b043ad3990645220c91b97bec29a14244fc3b 100644
--- a/openair3/NAS/COMMON/IES/EpsAttachResult.c
+++ b/openair3/NAS/COMMON/IES/EpsAttachResult.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsAttachResult.h b/openair3/NAS/COMMON/IES/EpsAttachResult.h
index 78e04ccf65ef64c645dd95b21ee7f675ea97cfc3..500ce053992aec47ab5d458c850509261082d02c 100644
--- a/openair3/NAS/COMMON/IES/EpsAttachResult.h
+++ b/openair3/NAS/COMMON/IES/EpsAttachResult.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsAttachType.c b/openair3/NAS/COMMON/IES/EpsAttachType.c
index 8c9635ea6b17be248afaec73e4105dd7aa079f15..aa07d0ba89548cef3b2ddd50a2884e36c03cfbfb 100644
--- a/openair3/NAS/COMMON/IES/EpsAttachType.c
+++ b/openair3/NAS/COMMON/IES/EpsAttachType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsAttachType.h b/openair3/NAS/COMMON/IES/EpsAttachType.h
index c6c9ffc23679865b59e79010afbc661460debd87..7f57077a4d83661fd4dc66f1475aacc9e8c80d11 100644
--- a/openair3/NAS/COMMON/IES/EpsAttachType.h
+++ b/openair3/NAS/COMMON/IES/EpsAttachType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsBearerContextStatus.c b/openair3/NAS/COMMON/IES/EpsBearerContextStatus.c
index ff21a2dc4b590cedf619948e3fee9e99fdb0e901..9984375dff9980f973d341da5fca6e6abe289007 100644
--- a/openair3/NAS/COMMON/IES/EpsBearerContextStatus.c
+++ b/openair3/NAS/COMMON/IES/EpsBearerContextStatus.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsBearerContextStatus.h b/openair3/NAS/COMMON/IES/EpsBearerContextStatus.h
index 8c0b475559e1f09f52e18d1f95a4a4a51afe35c1..fd29285cce956a784ce74ae98818c36b1ebd60b2 100644
--- a/openair3/NAS/COMMON/IES/EpsBearerContextStatus.h
+++ b/openair3/NAS/COMMON/IES/EpsBearerContextStatus.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsBearerIdentity.c b/openair3/NAS/COMMON/IES/EpsBearerIdentity.c
index 84d83ea09b97c7375ae0f15ec681526b01e6d843..3ad83c1eaf9ce3f5865f643652425ba99c2307d9 100644
--- a/openair3/NAS/COMMON/IES/EpsBearerIdentity.c
+++ b/openair3/NAS/COMMON/IES/EpsBearerIdentity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsBearerIdentity.h b/openair3/NAS/COMMON/IES/EpsBearerIdentity.h
index 24f0c106083297ab1ce46006b87398c5defb1402..d8f89751e0c0a8b5f47960eb6cc8dfc7b8d77f1e 100644
--- a/openair3/NAS/COMMON/IES/EpsBearerIdentity.h
+++ b/openair3/NAS/COMMON/IES/EpsBearerIdentity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsMobileIdentity.c b/openair3/NAS/COMMON/IES/EpsMobileIdentity.c
index 3d40801fec76a0786af4ff5ad13dbb90aeaf9abe..4437412b86136c3d20451f27f5857c7365a32eac 100644
--- a/openair3/NAS/COMMON/IES/EpsMobileIdentity.c
+++ b/openair3/NAS/COMMON/IES/EpsMobileIdentity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsMobileIdentity.h b/openair3/NAS/COMMON/IES/EpsMobileIdentity.h
index 7a1ff393c5531ec2c9ec99c34c4dd748d69b78b6..d9b13f250cb68118386edc188935a1ecbd256778 100644
--- a/openair3/NAS/COMMON/IES/EpsMobileIdentity.h
+++ b/openair3/NAS/COMMON/IES/EpsMobileIdentity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.c b/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.c
index 5f018143b5ee5a834ef0a919d73bf6fedc0e0d05..3a842406f0d66d36d4bde92340a358eba49c5484 100644
--- a/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.c
+++ b/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.h b/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.h
index 59e84a323b2366d664de3d443add72ddaf234c24..f367af6ac87c08ad8a4dbfcd3664d2d2113b1255 100644
--- a/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.h
+++ b/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsQualityOfService.c b/openair3/NAS/COMMON/IES/EpsQualityOfService.c
index b24e43e99c75d24f05571fe756d1d03c191923eb..ac45a9c0f55f6fbed172b3b7975abcfc26200047 100644
--- a/openair3/NAS/COMMON/IES/EpsQualityOfService.c
+++ b/openair3/NAS/COMMON/IES/EpsQualityOfService.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsQualityOfService.h b/openair3/NAS/COMMON/IES/EpsQualityOfService.h
index f4c5c5986e9ced4013af26c9aeb20fa6765b85b0..ab8f752838f44f98ded5c5e8aff8dd73aebe033b 100644
--- a/openair3/NAS/COMMON/IES/EpsQualityOfService.h
+++ b/openair3/NAS/COMMON/IES/EpsQualityOfService.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsUpdateResult.c b/openair3/NAS/COMMON/IES/EpsUpdateResult.c
index feecb5e37d166ba0bc5b30b4672922b9a269cf49..a91da63985bf209355b2463166685771e91adabd 100644
--- a/openair3/NAS/COMMON/IES/EpsUpdateResult.c
+++ b/openair3/NAS/COMMON/IES/EpsUpdateResult.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsUpdateResult.h b/openair3/NAS/COMMON/IES/EpsUpdateResult.h
index 019ac7a069988a0344c998931cba66d9a5023336..9f8b289248d6c66cb75d408aafc01b9b3b74ddca 100644
--- a/openair3/NAS/COMMON/IES/EpsUpdateResult.h
+++ b/openair3/NAS/COMMON/IES/EpsUpdateResult.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsUpdateType.c b/openair3/NAS/COMMON/IES/EpsUpdateType.c
index 7319cb5fe63fac7fe09bd3e68366c57de89bf76c..309031dcee2dce466af8a7a3bdeec0f6e0b444dc 100644
--- a/openair3/NAS/COMMON/IES/EpsUpdateType.c
+++ b/openair3/NAS/COMMON/IES/EpsUpdateType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EpsUpdateType.h b/openair3/NAS/COMMON/IES/EpsUpdateType.h
index 6bad9e064b7f6d48e2ed127a92754341748d2f83..fff1171dbc594ac041d7814dacc80e6d40fe8390 100644
--- a/openair3/NAS/COMMON/IES/EpsUpdateType.h
+++ b/openair3/NAS/COMMON/IES/EpsUpdateType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EsmCause.c b/openair3/NAS/COMMON/IES/EsmCause.c
index ba75d7b564d5310dcddc92ecf8d59816955a96c5..e703438c17869e01351109122209a71dc38024ba 100644
--- a/openair3/NAS/COMMON/IES/EsmCause.c
+++ b/openair3/NAS/COMMON/IES/EsmCause.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EsmCause.h b/openair3/NAS/COMMON/IES/EsmCause.h
index b405f6cd6208f0410b7afca60d367311e2391bdf..3590aaffecb397854cca96336a4c5f2af6722ac0 100644
--- a/openair3/NAS/COMMON/IES/EsmCause.h
+++ b/openair3/NAS/COMMON/IES/EsmCause.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EsmInformationTransferFlag.c b/openair3/NAS/COMMON/IES/EsmInformationTransferFlag.c
index 4ec00315fe96d83c46cf785a03cd37920b07fb28..5b4358499b99a109c03d742da8bc6b7d98fd83c6 100644
--- a/openair3/NAS/COMMON/IES/EsmInformationTransferFlag.c
+++ b/openair3/NAS/COMMON/IES/EsmInformationTransferFlag.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EsmInformationTransferFlag.h b/openair3/NAS/COMMON/IES/EsmInformationTransferFlag.h
index c8ec26041f2d8dec8dcb288800a2c4f53a2b3a2c..1b932b1a9939b6af5e5ba4a9157aac6029c0f247 100644
--- a/openair3/NAS/COMMON/IES/EsmInformationTransferFlag.h
+++ b/openair3/NAS/COMMON/IES/EsmInformationTransferFlag.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EsmMessageContainer.c b/openair3/NAS/COMMON/IES/EsmMessageContainer.c
index a223f36820ee1cd31689fcb7c358801a8afcecc2..2268b657f065f5d725920a7b3ae19f403ae67513 100644
--- a/openair3/NAS/COMMON/IES/EsmMessageContainer.c
+++ b/openair3/NAS/COMMON/IES/EsmMessageContainer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/EsmMessageContainer.h b/openair3/NAS/COMMON/IES/EsmMessageContainer.h
index c57f60a92bcc42558721d6c11f788541f189bc9e..c6fb827e132f4d0ee004052f7a490bfe2992b742 100644
--- a/openair3/NAS/COMMON/IES/EsmMessageContainer.h
+++ b/openair3/NAS/COMMON/IES/EsmMessageContainer.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/GprsTimer.c b/openair3/NAS/COMMON/IES/GprsTimer.c
index e2bc6ca3693fa0fb09817988e2d79cce26c0f7a1..52c1df17ee2d35eaa4ba2cacb65098603eb7a402 100644
--- a/openair3/NAS/COMMON/IES/GprsTimer.c
+++ b/openair3/NAS/COMMON/IES/GprsTimer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/GprsTimer.h b/openair3/NAS/COMMON/IES/GprsTimer.h
index 104af63a16834100185edad26d3954bb828f64c7..c8bb686fa3580c8052f4b6e00995603198624582 100644
--- a/openair3/NAS/COMMON/IES/GprsTimer.h
+++ b/openair3/NAS/COMMON/IES/GprsTimer.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/GutiType.c b/openair3/NAS/COMMON/IES/GutiType.c
index e5ecbdabcc448c27f8a4114e392e6e07f35b4162..a9921eedd8850ed4a01f0216a656076942c87f87 100644
--- a/openair3/NAS/COMMON/IES/GutiType.c
+++ b/openair3/NAS/COMMON/IES/GutiType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/GutiType.h b/openair3/NAS/COMMON/IES/GutiType.h
index b4230ead529db92f5220034f9b34057c51671f37..ad434f5ca57e3bdde2a4dd36cfd2cc95b32a9e03 100644
--- a/openair3/NAS/COMMON/IES/GutiType.h
+++ b/openair3/NAS/COMMON/IES/GutiType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/IdentityType2.c b/openair3/NAS/COMMON/IES/IdentityType2.c
index 96d1e5a8a036e709ee00ded0b9eeb6816a1ebae1..9623b5e58630bba9f1362f18d402ed920e40d498 100644
--- a/openair3/NAS/COMMON/IES/IdentityType2.c
+++ b/openair3/NAS/COMMON/IES/IdentityType2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/IdentityType2.h b/openair3/NAS/COMMON/IES/IdentityType2.h
index e7b8c80cc7bac4ed0290629e89f97bcf2f569840..5e3a01b061dd9515edfd111e0e5ddd4adbc57c0e 100644
--- a/openair3/NAS/COMMON/IES/IdentityType2.h
+++ b/openair3/NAS/COMMON/IES/IdentityType2.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ImeisvRequest.c b/openair3/NAS/COMMON/IES/ImeisvRequest.c
index 208d417e8fc9e5b24ba4ec2704ebc300a589e2d1..5c46b56f646b92e87e1d88c7929883f6267a42b6 100644
--- a/openair3/NAS/COMMON/IES/ImeisvRequest.c
+++ b/openair3/NAS/COMMON/IES/ImeisvRequest.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ImeisvRequest.h b/openair3/NAS/COMMON/IES/ImeisvRequest.h
index 2819844ea831f6446485adff99d43cfe6449b6e9..e41beeb994232c8f2a8c395c95c941c5b4dbafa7 100644
--- a/openair3/NAS/COMMON/IES/ImeisvRequest.h
+++ b/openair3/NAS/COMMON/IES/ImeisvRequest.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/KsiAndSequenceNumber.c b/openair3/NAS/COMMON/IES/KsiAndSequenceNumber.c
index 640c24fc1d026d015dadbdf721424300eb497e80..4a9ed5c247a4307fb5acb60ce611836eb7d78678 100644
--- a/openair3/NAS/COMMON/IES/KsiAndSequenceNumber.c
+++ b/openair3/NAS/COMMON/IES/KsiAndSequenceNumber.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/KsiAndSequenceNumber.h b/openair3/NAS/COMMON/IES/KsiAndSequenceNumber.h
index 7890e3f8f37bbcdf6c26ee60551349e1d32a2b3e..c739ca61e930a6c4d25bf965f849a0b65e9d7fcd 100644
--- a/openair3/NAS/COMMON/IES/KsiAndSequenceNumber.h
+++ b/openair3/NAS/COMMON/IES/KsiAndSequenceNumber.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LcsClientIdentity.c b/openair3/NAS/COMMON/IES/LcsClientIdentity.c
index 62a7a82feb9a598229e031c9c08a1d34e5835f47..89014ce46c8b647afbe77b50b6174fbfb921232d 100644
--- a/openair3/NAS/COMMON/IES/LcsClientIdentity.c
+++ b/openair3/NAS/COMMON/IES/LcsClientIdentity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LcsClientIdentity.h b/openair3/NAS/COMMON/IES/LcsClientIdentity.h
index 72089b6b91dbc737c15d3275f0fbaaf04970b376..7a8348c806e4a592b32325491620f772f4cb4505 100644
--- a/openair3/NAS/COMMON/IES/LcsClientIdentity.h
+++ b/openair3/NAS/COMMON/IES/LcsClientIdentity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LcsIndicator.c b/openair3/NAS/COMMON/IES/LcsIndicator.c
index 4d17629bff16caa0946d186369c6a5ee16990ef5..ee9a75d8bb5956589aef372710f214b2fabad825 100644
--- a/openair3/NAS/COMMON/IES/LcsIndicator.c
+++ b/openair3/NAS/COMMON/IES/LcsIndicator.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LcsIndicator.h b/openair3/NAS/COMMON/IES/LcsIndicator.h
index b8c018127f1aa8e76ce15d72404ebff2371f56bd..976d42eb1343d3940a9c7c9f094e0173b7496c97 100644
--- a/openair3/NAS/COMMON/IES/LcsIndicator.h
+++ b/openair3/NAS/COMMON/IES/LcsIndicator.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.c b/openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.c
index d2acc5dffe8fbb6c7ed6edbfba8b283b2344486b..88b8ee4f7e1b7e25cf76ac5bb2fd8e533c96183d 100644
--- a/openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.c
+++ b/openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.h b/openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.h
index 4d8cb883e21f1e22db2ce471407545f19c4b856a..58bbf11d3c634647806a00e08a154bb04232adf9 100644
--- a/openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.h
+++ b/openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.c b/openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.c
index 53b0e91cc39f4380cc9c8a33c52100cd822e1c46..51869784d97a9d945d465a601cbe00a775a032f8 100644
--- a/openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.c
+++ b/openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.h b/openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.h
index 46cd6a4e2458d7f54f34ddc4426bfe9eafb89ebd..35f1df710f485af6f2eb2828804cac0e6e62c77e 100644
--- a/openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.h
+++ b/openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LocationAreaIdentification.c b/openair3/NAS/COMMON/IES/LocationAreaIdentification.c
index 17c1053559d677e4316815be2505948445e1f9f6..27e31c3733394f4d7b3c5852441c778d9020fe7f 100644
--- a/openair3/NAS/COMMON/IES/LocationAreaIdentification.c
+++ b/openair3/NAS/COMMON/IES/LocationAreaIdentification.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/LocationAreaIdentification.h b/openair3/NAS/COMMON/IES/LocationAreaIdentification.h
index b3027d0d92a57db95ada02f6a239edff06e26e68..c09de9c9875c5c6e7dcd37695869d2a456739bc4 100644
--- a/openair3/NAS/COMMON/IES/LocationAreaIdentification.h
+++ b/openair3/NAS/COMMON/IES/LocationAreaIdentification.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MessageType.c b/openair3/NAS/COMMON/IES/MessageType.c
index 7874187dc3fb50dbc0871b419d5c693764b9ad75..83d134cdf56c770c714be4ed67fa05867d9d58dd 100644
--- a/openair3/NAS/COMMON/IES/MessageType.c
+++ b/openair3/NAS/COMMON/IES/MessageType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MessageType.h b/openair3/NAS/COMMON/IES/MessageType.h
index 2af029093c73e09e26647384723b7b25d120f0f1..d926f09cdc964a7e81ceeb69dea0a7ddec8ba7a4 100644
--- a/openair3/NAS/COMMON/IES/MessageType.h
+++ b/openair3/NAS/COMMON/IES/MessageType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MobileIdentity.c b/openair3/NAS/COMMON/IES/MobileIdentity.c
index 4651fa0047dffd5b757a1b16d9d50aef3c067403..fbe6d93e47a9e188eb761fa6cbed92076b5b4b64 100644
--- a/openair3/NAS/COMMON/IES/MobileIdentity.c
+++ b/openair3/NAS/COMMON/IES/MobileIdentity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MobileIdentity.h b/openair3/NAS/COMMON/IES/MobileIdentity.h
index 72abcb9ed47774178e509301717ffde8d5680a2f..37f4d4ac3018504964419786edf6f197ad11f6f0 100644
--- a/openair3/NAS/COMMON/IES/MobileIdentity.h
+++ b/openair3/NAS/COMMON/IES/MobileIdentity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MobileStationClassmark2.c b/openair3/NAS/COMMON/IES/MobileStationClassmark2.c
index 3707bbd636bb3a350c0041ba17ea7644c0010aca..e3a165bf3a783c6427013c39cf8908b56156e236 100644
--- a/openair3/NAS/COMMON/IES/MobileStationClassmark2.c
+++ b/openair3/NAS/COMMON/IES/MobileStationClassmark2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MobileStationClassmark2.h b/openair3/NAS/COMMON/IES/MobileStationClassmark2.h
index 55c40474d1dca32050436a17c82ac20c85354d3a..5cf7b9c46ed7b73297d280f6abde05d836c75594 100644
--- a/openair3/NAS/COMMON/IES/MobileStationClassmark2.h
+++ b/openair3/NAS/COMMON/IES/MobileStationClassmark2.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MobileStationClassmark3.c b/openair3/NAS/COMMON/IES/MobileStationClassmark3.c
index c9d6e37d844939461af957173a824085865adae6..9bd439fdfd48a4d07b1dcc4adee31eddbb12d9e2 100644
--- a/openair3/NAS/COMMON/IES/MobileStationClassmark3.c
+++ b/openair3/NAS/COMMON/IES/MobileStationClassmark3.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MobileStationClassmark3.h b/openair3/NAS/COMMON/IES/MobileStationClassmark3.h
index c3f199b2911a4401a874a6fd338421c3f62245bc..80c4d4e8e2f053bfaa0ecff7d89147f1c6b3bc5e 100644
--- a/openair3/NAS/COMMON/IES/MobileStationClassmark3.h
+++ b/openair3/NAS/COMMON/IES/MobileStationClassmark3.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MsNetworkCapability.c b/openair3/NAS/COMMON/IES/MsNetworkCapability.c
index 770270934fedc00c8b62aa55bdff90fc1f9d7be3..8c2955177ec13f518f2a392fabdff733c7ac51b9 100644
--- a/openair3/NAS/COMMON/IES/MsNetworkCapability.c
+++ b/openair3/NAS/COMMON/IES/MsNetworkCapability.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MsNetworkCapability.h b/openair3/NAS/COMMON/IES/MsNetworkCapability.h
index 8572cc6d47e9f05664f214845c75607156940510..f3799892419ccf8686e2da152d97fb7d7e62922e 100644
--- a/openair3/NAS/COMMON/IES/MsNetworkCapability.h
+++ b/openair3/NAS/COMMON/IES/MsNetworkCapability.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.c b/openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.c
index e96537ab166d8cb36b9410bff9f8b516c1182a12..6de2a05474512ed20e794b7f2e92eba4835d6370 100644
--- a/openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.c
+++ b/openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.h b/openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.h
index 84f20ed65d7ad872bbf1248867f0706cdefe0874..147c166beb5782d39326a50e45ff45749627f170 100644
--- a/openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.h
+++ b/openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NasKeySetIdentifier.c b/openair3/NAS/COMMON/IES/NasKeySetIdentifier.c
index 276953e34380cd8bbafa4722b2997e3d8a808a26..a547675675df956e4be12619dbc49482208a4697 100644
--- a/openair3/NAS/COMMON/IES/NasKeySetIdentifier.c
+++ b/openair3/NAS/COMMON/IES/NasKeySetIdentifier.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NasKeySetIdentifier.h b/openair3/NAS/COMMON/IES/NasKeySetIdentifier.h
index 3206ef1e9baf66b0c89596bdd21be43dd71ea089..09daf13a56333ccffc33dce682160d2dcb09c320 100644
--- a/openair3/NAS/COMMON/IES/NasKeySetIdentifier.h
+++ b/openair3/NAS/COMMON/IES/NasKeySetIdentifier.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NasMessageContainer.c b/openair3/NAS/COMMON/IES/NasMessageContainer.c
index 8847023c421f70ee608fb34ee020b1e65060fb4a..cccb8f7543bd96dc4e509fb0ae5c0c124a369417 100644
--- a/openair3/NAS/COMMON/IES/NasMessageContainer.c
+++ b/openair3/NAS/COMMON/IES/NasMessageContainer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NasMessageContainer.h b/openair3/NAS/COMMON/IES/NasMessageContainer.h
index 8f53a0a7e56a0f8e5a7814692b7fec38a75bd2a8..4e1ad971be8c73709670ed4128a406067eb72818 100644
--- a/openair3/NAS/COMMON/IES/NasMessageContainer.h
+++ b/openair3/NAS/COMMON/IES/NasMessageContainer.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NasRequestType.c b/openair3/NAS/COMMON/IES/NasRequestType.c
index 0bbe9ff3a8a411f525da6514afa15a68ac1efed9..cb85a38851e3809a6b4eba4ed9df63fd30efe2e2 100644
--- a/openair3/NAS/COMMON/IES/NasRequestType.c
+++ b/openair3/NAS/COMMON/IES/NasRequestType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NasRequestType.h b/openair3/NAS/COMMON/IES/NasRequestType.h
index 3f98a8ffd31dccb6a971d46ce4b14703d59c84a4..7eb98ff42baef14380e85a5e67199972a87eb8d1 100644
--- a/openair3/NAS/COMMON/IES/NasRequestType.h
+++ b/openair3/NAS/COMMON/IES/NasRequestType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NasSecurityAlgorithms.c b/openair3/NAS/COMMON/IES/NasSecurityAlgorithms.c
index 24e0d21f683f798db26d3f037e893b6cb4d3cf3c..7b57aab6a805aefafd9d290b3a9adc86497961b4 100644
--- a/openair3/NAS/COMMON/IES/NasSecurityAlgorithms.c
+++ b/openair3/NAS/COMMON/IES/NasSecurityAlgorithms.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NasSecurityAlgorithms.h b/openair3/NAS/COMMON/IES/NasSecurityAlgorithms.h
index 9008c023b15baf1788ae3fef1084863817186d42..69e5b3080ae6286e2932ce500959c9147b71e884 100644
--- a/openair3/NAS/COMMON/IES/NasSecurityAlgorithms.h
+++ b/openair3/NAS/COMMON/IES/NasSecurityAlgorithms.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NetworkName.c b/openair3/NAS/COMMON/IES/NetworkName.c
index 3516e5b7395035b3f0e9dab38787826093a4f961..d0d92dccbece59a49bdf685d4f18dca7a0dad5e9 100644
--- a/openair3/NAS/COMMON/IES/NetworkName.c
+++ b/openair3/NAS/COMMON/IES/NetworkName.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/NetworkName.h b/openair3/NAS/COMMON/IES/NetworkName.h
index b403edc337cfa1381a53b90f1d2142b77efdce54..7acae1b728fbd31467e5f9e5918154312764f2c7 100644
--- a/openair3/NAS/COMMON/IES/NetworkName.h
+++ b/openair3/NAS/COMMON/IES/NetworkName.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/Nonce.c b/openair3/NAS/COMMON/IES/Nonce.c
index 97b5c400109e2814745293146a5872a31022e417..d584346c56ce85a614adfe339dc6d7d428109fbd 100644
--- a/openair3/NAS/COMMON/IES/Nonce.c
+++ b/openair3/NAS/COMMON/IES/Nonce.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/Nonce.h b/openair3/NAS/COMMON/IES/Nonce.h
index d4df86b98bfcaf982a37bd08efd03e759c06b6e8..5bf3047a2435fe9dd28458752d15137b7c7dd121 100644
--- a/openair3/NAS/COMMON/IES/Nonce.h
+++ b/openair3/NAS/COMMON/IES/Nonce.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PTmsiSignature.c b/openair3/NAS/COMMON/IES/PTmsiSignature.c
index be37f869d7150ef7698584e452436a008206aaf1..2781cb77f2a87ba3c608083d53cd4abba893f223 100644
--- a/openair3/NAS/COMMON/IES/PTmsiSignature.c
+++ b/openair3/NAS/COMMON/IES/PTmsiSignature.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PTmsiSignature.h b/openair3/NAS/COMMON/IES/PTmsiSignature.h
index 70023fa92d69f55bb6c9d876146cb4a28723f55d..75abf9e4875f86d67483aa4252d38a045d5edcbb 100644
--- a/openair3/NAS/COMMON/IES/PTmsiSignature.h
+++ b/openair3/NAS/COMMON/IES/PTmsiSignature.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PacketFlowIdentifier.c b/openair3/NAS/COMMON/IES/PacketFlowIdentifier.c
index f19ba0547b8fd5b2c0cfd19f2bebe5e1eea8e7e2..fef2edd10d3e0bdf5d4ef4c24428da6a839d2530 100644
--- a/openair3/NAS/COMMON/IES/PacketFlowIdentifier.c
+++ b/openair3/NAS/COMMON/IES/PacketFlowIdentifier.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PacketFlowIdentifier.h b/openair3/NAS/COMMON/IES/PacketFlowIdentifier.h
index ffdb70b321568db9997dec2ced0733559d5b508b..7dff70c49c09283646363e5b96adeb4dcf5a2660 100644
--- a/openair3/NAS/COMMON/IES/PacketFlowIdentifier.h
+++ b/openair3/NAS/COMMON/IES/PacketFlowIdentifier.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PagingIdentity.c b/openair3/NAS/COMMON/IES/PagingIdentity.c
index e970f51d20a1bc9a0f0e1bb9764c247a85f3a302..e485fdc18a9008d965bf17275027f51284368705 100644
--- a/openair3/NAS/COMMON/IES/PagingIdentity.c
+++ b/openair3/NAS/COMMON/IES/PagingIdentity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PagingIdentity.h b/openair3/NAS/COMMON/IES/PagingIdentity.h
index 4f104400d310c58546390556a49d90c20abdc7db..e94a6a803a6caa21e97cc1c3675fc4918f9cc608 100644
--- a/openair3/NAS/COMMON/IES/PagingIdentity.h
+++ b/openair3/NAS/COMMON/IES/PagingIdentity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PdnAddress.c b/openair3/NAS/COMMON/IES/PdnAddress.c
index 797b9472d8ff66599892f200ebdc1055c72271c4..de64d410c5e21816910c2e9f275b331a6c10b1c8 100644
--- a/openair3/NAS/COMMON/IES/PdnAddress.c
+++ b/openair3/NAS/COMMON/IES/PdnAddress.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PdnAddress.h b/openair3/NAS/COMMON/IES/PdnAddress.h
index ee4fcd7e9806fca49530ba983a9623bd779a2582..20b6f1d690912f9a14fe0409ae48f6b1dc67d427 100644
--- a/openair3/NAS/COMMON/IES/PdnAddress.h
+++ b/openair3/NAS/COMMON/IES/PdnAddress.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PdnType.c b/openair3/NAS/COMMON/IES/PdnType.c
index c01baa1dd3f2f63cd54fd9d385899151f486d394..e9bbfb3b87bc6ee9a2cf9f113afc4e45821bffbe 100644
--- a/openair3/NAS/COMMON/IES/PdnType.c
+++ b/openair3/NAS/COMMON/IES/PdnType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PdnType.h b/openair3/NAS/COMMON/IES/PdnType.h
index 30d82f4a6a7b5709baadd60174805b8487a2e3fb..844b35f3c429383cb201db0e8c0ef12a1c03976c 100644
--- a/openair3/NAS/COMMON/IES/PdnType.h
+++ b/openair3/NAS/COMMON/IES/PdnType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PlmnList.c b/openair3/NAS/COMMON/IES/PlmnList.c
index ebaf5465ac85f68479d1e7a5fe4b14d32fb765dc..e6a3cecf4ddb90043623a65a67a9bbc78965e237 100644
--- a/openair3/NAS/COMMON/IES/PlmnList.c
+++ b/openair3/NAS/COMMON/IES/PlmnList.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/PlmnList.h b/openair3/NAS/COMMON/IES/PlmnList.h
index aa95673f674c58d779a0a3121d3b9335aa53ce46..6e6ac850c2cebf5cbeb52ccf3ae9d3b8f56b8558 100644
--- a/openair3/NAS/COMMON/IES/PlmnList.h
+++ b/openair3/NAS/COMMON/IES/PlmnList.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.c b/openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.c
index 09d4cbe3105cafc2018163d90429bed4108d579b..802c13a9070286f931cfbf581167de0ec23e0629 100644
--- a/openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.c
+++ b/openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.h b/openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.h
index 7aea7adae10a428d3d223d266c14ae3b2bacdac9..0f56e764d47e13a008aa28de87975cadd16bda16 100644
--- a/openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.h
+++ b/openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.c b/openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.c
index 006aa61e8e63f3db46824a7d7fc189e2e533b6e3..f4bd3e5e2c7d07036dbfc7a14567098074fd8ae6 100644
--- a/openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.c
+++ b/openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.h b/openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.h
index 71f989992c34d29a4db6d1bb5d1f3085ee382075..cbdeaaed0e398ff01ef444360146665b4fb1f7f2 100644
--- a/openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.h
+++ b/openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ProtocolDiscriminator.c b/openair3/NAS/COMMON/IES/ProtocolDiscriminator.c
index 6e1d6bd875308dc5c2ea718c4ead815d5f8f879d..41d2ada7ae92583a42f21b1019e9efd6f58d9b21 100644
--- a/openair3/NAS/COMMON/IES/ProtocolDiscriminator.c
+++ b/openair3/NAS/COMMON/IES/ProtocolDiscriminator.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ProtocolDiscriminator.h b/openair3/NAS/COMMON/IES/ProtocolDiscriminator.h
index 32cf11a28a3fdd246a63c9ef2ce6347325fadbe6..465baf21f4bef0442da7af7bc3f4bd66413caff0 100644
--- a/openair3/NAS/COMMON/IES/ProtocolDiscriminator.h
+++ b/openair3/NAS/COMMON/IES/ProtocolDiscriminator.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/QualityOfService.c b/openair3/NAS/COMMON/IES/QualityOfService.c
index fff81300822da1fd5cc7a302b4588cf8f1af82e1..02c4ceca299d2330b8ab368d01b2b8f4e483befa 100644
--- a/openair3/NAS/COMMON/IES/QualityOfService.c
+++ b/openair3/NAS/COMMON/IES/QualityOfService.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/QualityOfService.h b/openair3/NAS/COMMON/IES/QualityOfService.h
index 53f0e9e763191885792f04735eb96f79f68f8c1d..a7f455b23776a8f8b5d01e92c780b5c730a11839 100644
--- a/openair3/NAS/COMMON/IES/QualityOfService.h
+++ b/openair3/NAS/COMMON/IES/QualityOfService.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/RadioPriority.c b/openair3/NAS/COMMON/IES/RadioPriority.c
index c41b05cec95d151eb79fedb5f50acb050a6ea218..31780b8e8962a49bb321aea06217c85b4d542cb3 100644
--- a/openair3/NAS/COMMON/IES/RadioPriority.c
+++ b/openair3/NAS/COMMON/IES/RadioPriority.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/RadioPriority.h b/openair3/NAS/COMMON/IES/RadioPriority.h
index bbf3ac44504c944e904867763875f7a4a2f381e3..0f53fdaa778b17f480ec169fb29740c280720550 100644
--- a/openair3/NAS/COMMON/IES/RadioPriority.h
+++ b/openair3/NAS/COMMON/IES/RadioPriority.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/SecurityHeaderType.c b/openair3/NAS/COMMON/IES/SecurityHeaderType.c
index 75ae311db247616923bc523b7e8df6b37f63967e..0137e8cb9bfeedb54f532830309eb71c620e1f7a 100644
--- a/openair3/NAS/COMMON/IES/SecurityHeaderType.c
+++ b/openair3/NAS/COMMON/IES/SecurityHeaderType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/SecurityHeaderType.h b/openair3/NAS/COMMON/IES/SecurityHeaderType.h
index ee7635b3911ad8673a38cf9b5710f59eb3bf6b47..dcfaea6f8ac9d6dd37d22ae4690f73a00d3b0620 100644
--- a/openair3/NAS/COMMON/IES/SecurityHeaderType.h
+++ b/openair3/NAS/COMMON/IES/SecurityHeaderType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ServiceType.c b/openair3/NAS/COMMON/IES/ServiceType.c
index 6ced7364c8e268535fd3b9f6670b7b2cfc9893fb..23079a09ebc505f5c59d8059b91872ffe6fb5640 100644
--- a/openair3/NAS/COMMON/IES/ServiceType.c
+++ b/openair3/NAS/COMMON/IES/ServiceType.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ServiceType.h b/openair3/NAS/COMMON/IES/ServiceType.h
index 40778f82a600b17b605ce93453d816a3dda23b04..f6dab7733b3afda21ea4e4212b4ab4f46ef68211 100644
--- a/openair3/NAS/COMMON/IES/ServiceType.h
+++ b/openair3/NAS/COMMON/IES/ServiceType.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ShortMac.c b/openair3/NAS/COMMON/IES/ShortMac.c
index 4b7aff1a7670dcc52c111d17b2a6a342a28819c8..74bcd772c6ca344167e71988c3d832d37013e97c 100644
--- a/openair3/NAS/COMMON/IES/ShortMac.c
+++ b/openair3/NAS/COMMON/IES/ShortMac.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/ShortMac.h b/openair3/NAS/COMMON/IES/ShortMac.h
index 67ff8adf60086a0fa1c851c93431a4950ad8d2a5..f2b1c7032df27d71d43c2089a506bf9a499e2260 100644
--- a/openair3/NAS/COMMON/IES/ShortMac.h
+++ b/openair3/NAS/COMMON/IES/ShortMac.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/SsCode.c b/openair3/NAS/COMMON/IES/SsCode.c
index ab6d34a159626cbf4dbd8c31a9451d86fbde5f2b..255af689e3c906d070262346da1e8932473f9e1d 100644
--- a/openair3/NAS/COMMON/IES/SsCode.c
+++ b/openair3/NAS/COMMON/IES/SsCode.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/SsCode.h b/openair3/NAS/COMMON/IES/SsCode.h
index 6ba6fe377c1a8582e77bbab4427806fab1e423e5..8e6ae3b411a26ef58e8d76e52006121f49112429 100644
--- a/openair3/NAS/COMMON/IES/SsCode.h
+++ b/openair3/NAS/COMMON/IES/SsCode.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/SupportedCodecList.c b/openair3/NAS/COMMON/IES/SupportedCodecList.c
index 17a9284f5eae1971e1ceedd3c1db706ec91f73c8..3a69eee366a82822fa5edb2da8c3e48db92ea54c 100644
--- a/openair3/NAS/COMMON/IES/SupportedCodecList.c
+++ b/openair3/NAS/COMMON/IES/SupportedCodecList.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/SupportedCodecList.h b/openair3/NAS/COMMON/IES/SupportedCodecList.h
index 04445fdd10e744b36ff6e5883450704042fe17bc..c4b727cb94296a006db992a9b1d960a4a1ee8107 100644
--- a/openair3/NAS/COMMON/IES/SupportedCodecList.h
+++ b/openair3/NAS/COMMON/IES/SupportedCodecList.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TimeZone.c b/openair3/NAS/COMMON/IES/TimeZone.c
index 7b0bb54e218c1fcacdd84701ce3f3c32122a9edb..eb65ec929504c24290f46d7b93eb309500a5b63d 100644
--- a/openair3/NAS/COMMON/IES/TimeZone.c
+++ b/openair3/NAS/COMMON/IES/TimeZone.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TimeZone.h b/openair3/NAS/COMMON/IES/TimeZone.h
index 585e05bb1c4a14e3d8747ca76eca3f23a0dbdc2a..5da012b14efd401ff0997ad26d8fbeb136f32ba4 100644
--- a/openair3/NAS/COMMON/IES/TimeZone.h
+++ b/openair3/NAS/COMMON/IES/TimeZone.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TimeZoneAndTime.c b/openair3/NAS/COMMON/IES/TimeZoneAndTime.c
index c986ecfc7c8c153406a39ee3141457af34afc2a3..6a26eeac78578dfa4ccc523f888348793980cd71 100644
--- a/openair3/NAS/COMMON/IES/TimeZoneAndTime.c
+++ b/openair3/NAS/COMMON/IES/TimeZoneAndTime.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TimeZoneAndTime.h b/openair3/NAS/COMMON/IES/TimeZoneAndTime.h
index 6ddbf94ab80b0e99d99327ee662f37028d25104e..71cce4e881322e7e574ffd670c1b0867cc618f3b 100644
--- a/openair3/NAS/COMMON/IES/TimeZoneAndTime.h
+++ b/openair3/NAS/COMMON/IES/TimeZoneAndTime.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TmsiStatus.c b/openair3/NAS/COMMON/IES/TmsiStatus.c
index c4c328316f1984b8bc35f2f5c5249e63ee9b84c9..726e096c7869e0963b576241fd91bbf6b0c7837b 100644
--- a/openair3/NAS/COMMON/IES/TmsiStatus.c
+++ b/openair3/NAS/COMMON/IES/TmsiStatus.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TmsiStatus.h b/openair3/NAS/COMMON/IES/TmsiStatus.h
index dc7c3eaafd0aac859de3af663725a24bc76420c0..48611f9a0c8e91d603909daa723db35590f8acc6 100644
--- a/openair3/NAS/COMMON/IES/TmsiStatus.h
+++ b/openair3/NAS/COMMON/IES/TmsiStatus.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TrackingAreaIdentity.c b/openair3/NAS/COMMON/IES/TrackingAreaIdentity.c
index 20ade47268999ab5f018f2a4d16903a4e5b33dc0..a77419c80ca18b34b4ab24bfdafc7df7cb47f679 100644
--- a/openair3/NAS/COMMON/IES/TrackingAreaIdentity.c
+++ b/openair3/NAS/COMMON/IES/TrackingAreaIdentity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TrackingAreaIdentity.h b/openair3/NAS/COMMON/IES/TrackingAreaIdentity.h
index 72d5d44f0d4e37358c5f945c840416a9ec34005b..bc5810c895b3fbd3d3504d1a4c5033dad54d737d 100644
--- a/openair3/NAS/COMMON/IES/TrackingAreaIdentity.h
+++ b/openair3/NAS/COMMON/IES/TrackingAreaIdentity.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TrackingAreaIdentityList.c b/openair3/NAS/COMMON/IES/TrackingAreaIdentityList.c
index 47269add106e0500c804c432fa7aad3bf78cddd7..2e700abbee24fe3cc7de36cffd9cfe521acc1d19 100644
--- a/openair3/NAS/COMMON/IES/TrackingAreaIdentityList.c
+++ b/openair3/NAS/COMMON/IES/TrackingAreaIdentityList.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TrackingAreaIdentityList.h b/openair3/NAS/COMMON/IES/TrackingAreaIdentityList.h
index 1c58afbcb59d42ad83ff51fc74a5ceef1fe19cb3..d085e8436f54e5c1d45b60819322ffbbf5e9288b 100644
--- a/openair3/NAS/COMMON/IES/TrackingAreaIdentityList.h
+++ b/openair3/NAS/COMMON/IES/TrackingAreaIdentityList.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TrafficFlowAggregateDescription.c b/openair3/NAS/COMMON/IES/TrafficFlowAggregateDescription.c
index 296ecbe6f128b207e4cbead70483e45a98c25c11..ad7af4c6c161da2443165767870803b6c759a0f6 100644
--- a/openair3/NAS/COMMON/IES/TrafficFlowAggregateDescription.c
+++ b/openair3/NAS/COMMON/IES/TrafficFlowAggregateDescription.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TrafficFlowAggregateDescription.h b/openair3/NAS/COMMON/IES/TrafficFlowAggregateDescription.h
index 09e9450d8deadc1dd1fe91d20442fc57cfba4784..ae013cf3049fade0a41d430a1da849ee0e16cb8e 100644
--- a/openair3/NAS/COMMON/IES/TrafficFlowAggregateDescription.h
+++ b/openair3/NAS/COMMON/IES/TrafficFlowAggregateDescription.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TrafficFlowTemplate.c b/openair3/NAS/COMMON/IES/TrafficFlowTemplate.c
index 57f8d3ba0035499f4edcbfe074ec622201cf82af..d5ab249573291d6c4abc2cfaec4867eee44332c1 100644
--- a/openair3/NAS/COMMON/IES/TrafficFlowTemplate.c
+++ b/openair3/NAS/COMMON/IES/TrafficFlowTemplate.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TrafficFlowTemplate.h b/openair3/NAS/COMMON/IES/TrafficFlowTemplate.h
index 920caea056e24167d70409bf75b5c9d046384d86..651ec7ef5c8242b37b4e3c5538c4d5804abfb48e 100644
--- a/openair3/NAS/COMMON/IES/TrafficFlowTemplate.h
+++ b/openair3/NAS/COMMON/IES/TrafficFlowTemplate.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TransactionIdentifier.c b/openair3/NAS/COMMON/IES/TransactionIdentifier.c
index dbc2c68cabe756ef7a679a57830c2241483e8056..ce77d6ba34903131efd7b0ee26e69622719fc442 100644
--- a/openair3/NAS/COMMON/IES/TransactionIdentifier.c
+++ b/openair3/NAS/COMMON/IES/TransactionIdentifier.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/TransactionIdentifier.h b/openair3/NAS/COMMON/IES/TransactionIdentifier.h
index aaa0836f389b94d286d3b607c327e7a304eda65a..cf19a2f6f561b25aebf5d49b6ecc01bffca6da36 100644
--- a/openair3/NAS/COMMON/IES/TransactionIdentifier.h
+++ b/openair3/NAS/COMMON/IES/TransactionIdentifier.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/UeNetworkCapability.c b/openair3/NAS/COMMON/IES/UeNetworkCapability.c
index 46d07a0fdfa972301d6b4a9a3ff02b0baf78696f..65890751736f806a0a9e2659814aac015f027d4c 100644
--- a/openair3/NAS/COMMON/IES/UeNetworkCapability.c
+++ b/openair3/NAS/COMMON/IES/UeNetworkCapability.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/UeNetworkCapability.h b/openair3/NAS/COMMON/IES/UeNetworkCapability.h
index 5bf603532395057a30556393d880f33e670421cb..a93587c33c74d63e8cd51f1817b26f65ad531208 100644
--- a/openair3/NAS/COMMON/IES/UeNetworkCapability.h
+++ b/openair3/NAS/COMMON/IES/UeNetworkCapability.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c b/openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c
index 7d506881ee54b93f912341d876c3937a65d92a6a..a56400c54dee270864bca7abfa75669cb46b2715 100644
--- a/openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c
+++ b/openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h b/openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h
index fb25c0808a6666382c69a081d7644936ff412402..7ae83bd5ea734e4285d6677ae47a4e8ef16a41c2 100644
--- a/openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h
+++ b/openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/UeSecurityCapability.c b/openair3/NAS/COMMON/IES/UeSecurityCapability.c
index ee462594fd011adb8d75d332be00cd5837f193a0..9b40b1b85c43167922aca07d6e237b1a3c6f76dd 100644
--- a/openair3/NAS/COMMON/IES/UeSecurityCapability.c
+++ b/openair3/NAS/COMMON/IES/UeSecurityCapability.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/UeSecurityCapability.h b/openair3/NAS/COMMON/IES/UeSecurityCapability.h
index a15f74570dcef846f60d7dd201709f2d236475a2..d9726d76e0f40a942ea611455a24cf0da6396108 100644
--- a/openair3/NAS/COMMON/IES/UeSecurityCapability.h
+++ b/openair3/NAS/COMMON/IES/UeSecurityCapability.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c b/openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c
index 6c644dedf3faf71508baef8eb99c47179c1c6661..156c68d80febcaf5deaca9ee3cfc300de0a0c509 100644
--- a/openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c
+++ b/openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h b/openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h
index fd1353833d52a92153de4630c4fc8f6bdcb869c4..b7dbe35de499eb518427e4dc0f7a36ac34493b89 100644
--- a/openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h
+++ b/openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/OctetString.c b/openair3/NAS/COMMON/UTIL/OctetString.c
index 2763006126ce05a1f58aff0f7d8a3e1ec4690ddb..30830685851bea158e4b822e6b377eeae22e953e 100644
--- a/openair3/NAS/COMMON/UTIL/OctetString.c
+++ b/openair3/NAS/COMMON/UTIL/OctetString.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/OctetString.h b/openair3/NAS/COMMON/UTIL/OctetString.h
index c0c54fcb096adb9563a4f8e72a78fe59121739f9..2223b67ececdefd7295bbca851fac14932cc1afc 100644
--- a/openair3/NAS/COMMON/UTIL/OctetString.h
+++ b/openair3/NAS/COMMON/UTIL/OctetString.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/TLVDecoder.c b/openair3/NAS/COMMON/UTIL/TLVDecoder.c
index 9c27452bec75cd2c1d825f06b63d8356b618ca1a..353e16554d6ea93034d8eaccab02c3e1cb7a4bc3 100644
--- a/openair3/NAS/COMMON/UTIL/TLVDecoder.c
+++ b/openair3/NAS/COMMON/UTIL/TLVDecoder.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/TLVDecoder.h b/openair3/NAS/COMMON/UTIL/TLVDecoder.h
index 37834c5660253a8378bb080dffd6e6634fa12c06..e8dce87d8ddfb8ea3087a8968ccff4bcc197f565 100644
--- a/openair3/NAS/COMMON/UTIL/TLVDecoder.h
+++ b/openair3/NAS/COMMON/UTIL/TLVDecoder.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/TLVEncoder.c b/openair3/NAS/COMMON/UTIL/TLVEncoder.c
index 0facb0d5f781d8d73532957ea6478a46fb25f985..9d3a144989119e76f88ac9508bedf6e0d1c285b4 100644
--- a/openair3/NAS/COMMON/UTIL/TLVEncoder.c
+++ b/openair3/NAS/COMMON/UTIL/TLVEncoder.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/TLVEncoder.h b/openair3/NAS/COMMON/UTIL/TLVEncoder.h
index 976289f25b4fc09371c555bb9ad1989075960241..df5b58a07ff0928261c66e51ae7b32a0c38bfe64 100644
--- a/openair3/NAS/COMMON/UTIL/TLVEncoder.h
+++ b/openair3/NAS/COMMON/UTIL/TLVEncoder.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/device.c b/openair3/NAS/COMMON/UTIL/device.c
index 6643c6dfd982c081e862344e446236f96846f9db..7ad2879b9015d465b427c3e370d6f2cf06eddcbf 100644
--- a/openair3/NAS/COMMON/UTIL/device.c
+++ b/openair3/NAS/COMMON/UTIL/device.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/device.h b/openair3/NAS/COMMON/UTIL/device.h
index fb0a9add1361576b504dbc86f77c772f1cbf029d..975d7b1c8a74783580b9bfbc5b7f2e686d60020e 100644
--- a/openair3/NAS/COMMON/UTIL/device.h
+++ b/openair3/NAS/COMMON/UTIL/device.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/memory.c b/openair3/NAS/COMMON/UTIL/memory.c
index 3b3b6e7f9e1d47caf3e5a2f4736a38eb9f8a1e4b..334cdc5eb628221e5a8ef49106d44b654a8104e1 100644
--- a/openair3/NAS/COMMON/UTIL/memory.c
+++ b/openair3/NAS/COMMON/UTIL/memory.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/memory.h b/openair3/NAS/COMMON/UTIL/memory.h
index f7f0733044b50163c262036e5cc0abd9cc85fdc6..ec8406c93288555f276623b07013617c290af932 100644
--- a/openair3/NAS/COMMON/UTIL/memory.h
+++ b/openair3/NAS/COMMON/UTIL/memory.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/nas_log.c b/openair3/NAS/COMMON/UTIL/nas_log.c
index a1568c49d85f814ea2fab4fbc2c2654a1b6d7973..6af90c4be871ab88e0a698c0926efd43f9f87b09 100644
--- a/openair3/NAS/COMMON/UTIL/nas_log.c
+++ b/openair3/NAS/COMMON/UTIL/nas_log.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/nas_log.h b/openair3/NAS/COMMON/UTIL/nas_log.h
index c6e0fbcd80b494d458a7ed420e9d0e2ccf862901..47664c52d09ec056cb3747b3e67b6c8279e1c0d1 100644
--- a/openair3/NAS/COMMON/UTIL/nas_log.h
+++ b/openair3/NAS/COMMON/UTIL/nas_log.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/nas_timer.c b/openair3/NAS/COMMON/UTIL/nas_timer.c
index aa67c72b422f6c7a0f5081de43f4608dd927edd6..0b92ac4d9d55c6b376558f99efbc028ae3effaa5 100644
--- a/openair3/NAS/COMMON/UTIL/nas_timer.c
+++ b/openair3/NAS/COMMON/UTIL/nas_timer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/nas_timer.h b/openair3/NAS/COMMON/UTIL/nas_timer.h
index 007ea236b78aceb45e2f7bd24418943d54609e12..b1149f21c0035e7a00635c5c2e38859dee8180cb 100644
--- a/openair3/NAS/COMMON/UTIL/nas_timer.h
+++ b/openair3/NAS/COMMON/UTIL/nas_timer.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/parser.c b/openair3/NAS/COMMON/UTIL/parser.c
index e60e7eca88a5cb892473317bcd11ad4cfc0b9388..e27fb3819987e3dbfcfcfa4e737e98eb28b4e3e7 100644
--- a/openair3/NAS/COMMON/UTIL/parser.c
+++ b/openair3/NAS/COMMON/UTIL/parser.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/parser.h b/openair3/NAS/COMMON/UTIL/parser.h
index 2061c7201dcc1314f3f5bf3da0bfd50ef113f7d5..ae454ce36799fe9cb66fdba0307bb89bcba693a6 100644
--- a/openair3/NAS/COMMON/UTIL/parser.h
+++ b/openair3/NAS/COMMON/UTIL/parser.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/socket.c b/openair3/NAS/COMMON/UTIL/socket.c
index 6d272284154683cf3eb430cbcb3c3bb7a278239e..8ec3227e20a45831a9dc2404460014ef19efffe4 100644
--- a/openair3/NAS/COMMON/UTIL/socket.c
+++ b/openair3/NAS/COMMON/UTIL/socket.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/socket.h b/openair3/NAS/COMMON/UTIL/socket.h
index ae198a489c1d3fa64fe2de56d953c0437ef01bde..033046d98c08d04e39607740794f4b8cd2446737 100644
--- a/openair3/NAS/COMMON/UTIL/socket.h
+++ b/openair3/NAS/COMMON/UTIL/socket.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/stty.c b/openair3/NAS/COMMON/UTIL/stty.c
index 88b66eb09b3fd1dc16114a8d646f5886bfb06d0d..eceb0b06b139294326ef911f81de8e1aec8b68c0 100644
--- a/openair3/NAS/COMMON/UTIL/stty.c
+++ b/openair3/NAS/COMMON/UTIL/stty.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/UTIL/tst/timer.c b/openair3/NAS/COMMON/UTIL/tst/timer.c
index 449c4d749bb7617b4c956dad38dd6c9cf6637e3f..701c878f4de3f5cd728109d20c9d928de44e31c7 100644
--- a/openair3/NAS/COMMON/UTIL/tst/timer.c
+++ b/openair3/NAS/COMMON/UTIL/tst/timer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/securityDef.h b/openair3/NAS/COMMON/securityDef.h
index ef39d5533c5a9ec600e3469b8170dde0dde8fb37..30732f26f5b5a0bd8d968786bebc2c3d35038f03 100644
--- a/openair3/NAS/COMMON/securityDef.h
+++ b/openair3/NAS/COMMON/securityDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/COMMON/userDef.h b/openair3/NAS/COMMON/userDef.h
index c5989c8e45d2c698252d4ad98b1de041e4e81558..fdb8287b3b0ce7497b72710c3ea30ea49ba584dc 100644
--- a/openair3/NAS/COMMON/userDef.h
+++ b/openair3/NAS/COMMON/userDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/Makefile b/openair3/NAS/TEST/AS_SIMULATOR/Makefile
index 17710368e9391d65dd58b9047675621b2dc868d2..3d379c6d069e855e6c76e8def648ced946bb4c27 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/Makefile
+++ b/openair3/NAS/TEST/AS_SIMULATOR/Makefile
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_data.c b/openair3/NAS/TEST/AS_SIMULATOR/as_data.c
index 9316546bd473ead09a68e34139f4888d923a7324..56b00125a448135d442431ea84483e12ddacdb42 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/as_data.c
+++ b/openair3/NAS/TEST/AS_SIMULATOR/as_data.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_data.h b/openair3/NAS/TEST/AS_SIMULATOR/as_data.h
index c52ed83465719b68f7ce8286dd26c7468cd479a6..24c64737302d4c843c1c202181f1f8026a4c6d96 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/as_data.h
+++ b/openair3/NAS/TEST/AS_SIMULATOR/as_data.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_process.c b/openair3/NAS/TEST/AS_SIMULATOR/as_process.c
index e0f031c45ac89757061079c43e29f40338a2aada..21e484e40adbe7c1db70429f678f1f734107c56d 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/as_process.c
+++ b/openair3/NAS/TEST/AS_SIMULATOR/as_process.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_process.h b/openair3/NAS/TEST/AS_SIMULATOR/as_process.h
index 94053bdf9efdccbe6896a55da4a8e12629cfd113..75df1f0d88e7b662a99f426a7b0e5f6ce6bb29e6 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/as_process.h
+++ b/openair3/NAS/TEST/AS_SIMULATOR/as_process.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_simulator.c b/openair3/NAS/TEST/AS_SIMULATOR/as_simulator.c
index 370213bccdda607cdbe63942f23cbaf50fdb9fdd..efe2c1af72b567b0e84508f13711fe8065c71126 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/as_simulator.c
+++ b/openair3/NAS/TEST/AS_SIMULATOR/as_simulator.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_simulator_parser.c b/openair3/NAS/TEST/AS_SIMULATOR/as_simulator_parser.c
index 5f8743598bbbeaa56daf21a09005f419a85cb0c6..ff6720da5f6d5b24aec4aade0a49fea09e849e7a 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/as_simulator_parser.c
+++ b/openair3/NAS/TEST/AS_SIMULATOR/as_simulator_parser.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_simulator_parser.h b/openair3/NAS/TEST/AS_SIMULATOR/as_simulator_parser.h
index c08021723fd54bae8cf78934601df8f695998177..b15bf8f29ba1c5d95d8df2958716220c9c4a5b09 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/as_simulator_parser.h
+++ b/openair3/NAS/TEST/AS_SIMULATOR/as_simulator_parser.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/nas_data.c b/openair3/NAS/TEST/AS_SIMULATOR/nas_data.c
index 0aa6a57126fa0218dfb3e058e169b4204a71d42c..990a856a9d751c2b8ed8a98547dfd7289b30e87f 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/nas_data.c
+++ b/openair3/NAS/TEST/AS_SIMULATOR/nas_data.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/nas_data.h b/openair3/NAS/TEST/AS_SIMULATOR/nas_data.h
index 471cd199576f871bb3d34a7ff2435adcada54db1..ff5500701465a6bcca2ed16902694be7e66f050b 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/nas_data.h
+++ b/openair3/NAS/TEST/AS_SIMULATOR/nas_data.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/nas_process.c b/openair3/NAS/TEST/AS_SIMULATOR/nas_process.c
index 55c6c2494eea36f1249fbb54ec28738e41307883..17ad99715b9c17bd567fe497dbb4b15e8704adaf 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/nas_process.c
+++ b/openair3/NAS/TEST/AS_SIMULATOR/nas_process.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/AS_SIMULATOR/nas_process.h b/openair3/NAS/TEST/AS_SIMULATOR/nas_process.h
index 901e6ce45bac02b68289b4b96ca7c92b7a06d8eb..ae5baebafc746f34d0e3415c0863fcebdd38d717 100644
--- a/openair3/NAS/TEST/AS_SIMULATOR/nas_process.h
+++ b/openair3/NAS/TEST/AS_SIMULATOR/nas_process.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/NETWORK/Makefile b/openair3/NAS/TEST/NETWORK/Makefile
index 00a74ec5618d31620415a9eb0dfca5abf35895cd..b0b5516801fafd65f87ea118a9119900b48e3908 100644
--- a/openair3/NAS/TEST/NETWORK/Makefile
+++ b/openair3/NAS/TEST/NETWORK/Makefile
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/NAS/TEST/NETWORK/network_parser.c b/openair3/NAS/TEST/NETWORK/network_parser.c
index 0e001e0aeeb01edfd3da525698a624d17eeb3216..f540a8a99caab9c8160d5e79769df1b47b648c18 100644
--- a/openair3/NAS/TEST/NETWORK/network_parser.c
+++ b/openair3/NAS/TEST/NETWORK/network_parser.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/NETWORK/network_parser.h b/openair3/NAS/TEST/NETWORK/network_parser.h
index daaec64ffddda01024cd74b24813162e3c3cf39e..a20c313be30fa7e312f51241a5152364a458c89d 100644
--- a/openair3/NAS/TEST/NETWORK/network_parser.h
+++ b/openair3/NAS/TEST/NETWORK/network_parser.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/NETWORK/network_simulator.c b/openair3/NAS/TEST/NETWORK/network_simulator.c
index ef335af2ec4f75c388fbaa5b2e563e7d06758f13..294241a3845fbf6d663daad85365a16d707d6c34 100644
--- a/openair3/NAS/TEST/NETWORK/network_simulator.c
+++ b/openair3/NAS/TEST/NETWORK/network_simulator.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/USER/Makefile b/openair3/NAS/TEST/USER/Makefile
index 69a2a673879eca861813cd757b59acb8595fe724..6f613b3cc98fd3a3de0ceb7edd9a1c927220af51 100644
--- a/openair3/NAS/TEST/USER/Makefile
+++ b/openair3/NAS/TEST/USER/Makefile
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/NAS/TEST/USER/user_parser.c b/openair3/NAS/TEST/USER/user_parser.c
index ffa47a919cf98dcdd05395f68124afa532a67185..2b7afd5d040e6cbe981eba165344a361060f42b2 100644
--- a/openair3/NAS/TEST/USER/user_parser.c
+++ b/openair3/NAS/TEST/USER/user_parser.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/USER/user_parser.h b/openair3/NAS/TEST/USER/user_parser.h
index 40fa6182709c8099802a7c929cf89f08fa7ae5af..d1972de02894dbf80ec04f9c5d5d60d80501ca5c 100644
--- a/openair3/NAS/TEST/USER/user_parser.h
+++ b/openair3/NAS/TEST/USER/user_parser.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TEST/USER/user_simulator.c b/openair3/NAS/TEST/USER/user_simulator.c
index 2f0819f5971824fa89f28a3981c1954aa74ee213..ec16b3453f25dd10cd8ff15a0f72902aa31e9674 100644
--- a/openair3/NAS/TEST/USER/user_simulator.c
+++ b/openair3/NAS/TEST/USER/user_simulator.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TOOLS/network.h b/openair3/NAS/TOOLS/network.h
index d7044c8e51436792605078a8d79d04154e921107..cde82f4560cc6039f90ea85068e5d3f321af082a 100644
--- a/openair3/NAS/TOOLS/network.h
+++ b/openair3/NAS/TOOLS/network.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TOOLS/nvram.c b/openair3/NAS/TOOLS/nvram.c
index b10511f2fc94ca8f6acc92d2f08e235e54e61638..80d8b34893e7236638b89c2ff4941f3a437390d0 100644
--- a/openair3/NAS/TOOLS/nvram.c
+++ b/openair3/NAS/TOOLS/nvram.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/TOOLS/usim.c b/openair3/NAS/TOOLS/usim.c
index 242b30d65558e3a1c4f31aa89f61267bcac533a0..84b4cfbdf883186908bf4dbbeee665613f2cfb0a 100644
--- a/openair3/NAS/TOOLS/usim.c
+++ b/openair3/NAS/TOOLS/usim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/at_command.c b/openair3/NAS/UE/API/USER/at_command.c
index 8f40ba93c434f7f06e7765ff09774318db28f13e..ab85b2d2fa6fe994ffe6956e79d431c9e00a4e5c 100644
--- a/openair3/NAS/UE/API/USER/at_command.c
+++ b/openair3/NAS/UE/API/USER/at_command.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/at_command.h b/openair3/NAS/UE/API/USER/at_command.h
index 97cdeeb3a132097e9e0197a1ea60742e2439265a..b7bdb11b7543b34334a8a708b6fb991a9d48af20 100644
--- a/openair3/NAS/UE/API/USER/at_command.h
+++ b/openair3/NAS/UE/API/USER/at_command.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/at_error.c b/openair3/NAS/UE/API/USER/at_error.c
index 7548fb513effb3d502cac4ce593b1f55e7be55f1..d004c897368bc4d467954c02ac125ea0ef856985 100644
--- a/openair3/NAS/UE/API/USER/at_error.c
+++ b/openair3/NAS/UE/API/USER/at_error.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/at_error.h b/openair3/NAS/UE/API/USER/at_error.h
index de9284e94c34c9f007a280a365a5425f27ce04d5..a84875a43c39c208b28017a3de63407fa6057a80 100644
--- a/openair3/NAS/UE/API/USER/at_error.h
+++ b/openair3/NAS/UE/API/USER/at_error.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/at_response.c b/openair3/NAS/UE/API/USER/at_response.c
index 5c1dcc1a965109224e7db508475c0d4211cd4aa1..a488aa78d9f7c949564c3553150e040b36981fa8 100644
--- a/openair3/NAS/UE/API/USER/at_response.c
+++ b/openair3/NAS/UE/API/USER/at_response.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/at_response.h b/openair3/NAS/UE/API/USER/at_response.h
index 794af050902efb70e25025eb0ae6b448147afdb4..b0303c587584c469f73b3fbb6e1bed0a5dff4de4 100644
--- a/openair3/NAS/UE/API/USER/at_response.h
+++ b/openair3/NAS/UE/API/USER/at_response.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/tst/at_parser.c b/openair3/NAS/UE/API/USER/tst/at_parser.c
index e580c99ec5ccb0ff8864a6a0f7153653823a9c56..2039d81a630b9349cf42150de4855f290e71cb3c 100644
--- a/openair3/NAS/UE/API/USER/tst/at_parser.c
+++ b/openair3/NAS/UE/API/USER/tst/at_parser.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/user_api.c b/openair3/NAS/UE/API/USER/user_api.c
index a1300ea059d9dac26cfe107c3c6d9c0e02fc4f38..83839a90f30febe758c4d7b842a1bf0a8767cb7d 100644
--- a/openair3/NAS/UE/API/USER/user_api.c
+++ b/openair3/NAS/UE/API/USER/user_api.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/user_api.h b/openair3/NAS/UE/API/USER/user_api.h
index 6536144165b540bd9bf186d888aaf14c41eeb00b..e554b4ef0b7c6d3ab7dd6c3910da6e4a6a7c8dd7 100644
--- a/openair3/NAS/UE/API/USER/user_api.h
+++ b/openair3/NAS/UE/API/USER/user_api.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/user_indication.c b/openair3/NAS/UE/API/USER/user_indication.c
index 620596005df5d3fdd1513a85d947486d242d7ac8..2c102c1d462b95b4cc9e66bea6b94e447af68b0b 100644
--- a/openair3/NAS/UE/API/USER/user_indication.c
+++ b/openair3/NAS/UE/API/USER/user_indication.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USER/user_indication.h b/openair3/NAS/UE/API/USER/user_indication.h
index 39aba424e7a755f88ce91b3980d405dd5f819cba..d86ab43dcaad3a688dcc3b1b49c43d105c4ec69b 100644
--- a/openair3/NAS/UE/API/USER/user_indication.h
+++ b/openair3/NAS/UE/API/USER/user_indication.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USIM/aka_functions.c b/openair3/NAS/UE/API/USIM/aka_functions.c
index 4d8f4cd1d31b33370056cea6e4b9556319e5a369..88a9415e08d324233462cf2d28ad765746b79429 100644
--- a/openair3/NAS/UE/API/USIM/aka_functions.c
+++ b/openair3/NAS/UE/API/USIM/aka_functions.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USIM/aka_functions.h b/openair3/NAS/UE/API/USIM/aka_functions.h
index 8c370bb76c8df239839cf6ab7f810495418301a7..4e28ead86af845308ce9775f789b1448d7a0d7e6 100644
--- a/openair3/NAS/UE/API/USIM/aka_functions.h
+++ b/openair3/NAS/UE/API/USIM/aka_functions.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USIM/usim_api.c b/openair3/NAS/UE/API/USIM/usim_api.c
index efb0383596dfc885bf20137c2673c25aa48909ea..d8a3807ab3dfa5c944bc89f883790ef106fad173 100644
--- a/openair3/NAS/UE/API/USIM/usim_api.c
+++ b/openair3/NAS/UE/API/USIM/usim_api.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/API/USIM/usim_api.h b/openair3/NAS/UE/API/USIM/usim_api.h
index f2f80d610c5d0601be4baa837125f2d2bff6a8d5..f332b5ffc87170d2622f6bea0ef78c47bba57657 100644
--- a/openair3/NAS/UE/API/USIM/usim_api.h
+++ b/openair3/NAS/UE/API/USIM/usim_api.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/Attach.c b/openair3/NAS/UE/EMM/Attach.c
index c0c82b9b4ccf258567f414882fa368e513b1bcb9..4029c8f70217054f85416ed605e4fe97eb6ac24c 100644
--- a/openair3/NAS/UE/EMM/Attach.c
+++ b/openair3/NAS/UE/EMM/Attach.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c
index e49bdd2db7e5e36aa52835dd58b8f477bd3317a9..5b10e608935da20a2e83710ae75f82cdf8376637 100644
--- a/openair3/NAS/UE/EMM/Authentication.c
+++ b/openair3/NAS/UE/EMM/Authentication.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/Detach.c b/openair3/NAS/UE/EMM/Detach.c
index fd2db1b6174ae7a9624f875531eaf8b68a2d07b4..c18dc0ad28a7d1ef3b472692d032e5bee53502b0 100644
--- a/openair3/NAS/UE/EMM/Detach.c
+++ b/openair3/NAS/UE/EMM/Detach.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/EmmStatusHdl.c b/openair3/NAS/UE/EMM/EmmStatusHdl.c
index 89dd50207f05b80d454de9899d54434f255d6499..367d0327f4f1c6d6984adf44651c416da839b262 100644
--- a/openair3/NAS/UE/EMM/EmmStatusHdl.c
+++ b/openair3/NAS/UE/EMM/EmmStatusHdl.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/Identification.c b/openair3/NAS/UE/EMM/Identification.c
index 7cf2e765c61322a185618566632227270f083e6f..0d2d6644a130d7bce22767be29b68ec470718560 100644
--- a/openair3/NAS/UE/EMM/Identification.c
+++ b/openair3/NAS/UE/EMM/Identification.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/IdleMode.c b/openair3/NAS/UE/EMM/IdleMode.c
index 159a3b2a2ceba18bd0e76c2d32d1494f72b36a29..362d5e5b4af56ec9c677d7844ce51da9c0d7e007 100644
--- a/openair3/NAS/UE/EMM/IdleMode.c
+++ b/openair3/NAS/UE/EMM/IdleMode.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/IdleMode.h b/openair3/NAS/UE/EMM/IdleMode.h
index e80b4f91344931edd7117917a33ed5d38150f068..4584877974188f0b30d1171812fbf120b64b49d1 100644
--- a/openair3/NAS/UE/EMM/IdleMode.h
+++ b/openair3/NAS/UE/EMM/IdleMode.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/LowerLayer.c b/openair3/NAS/UE/EMM/LowerLayer.c
index b5555b2c2fa13b68a0180b3ede87474666662869..01b07fc35606b7662c6f7d545fb6c681fd1bcb9e 100644
--- a/openair3/NAS/UE/EMM/LowerLayer.c
+++ b/openair3/NAS/UE/EMM/LowerLayer.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/LowerLayer.h b/openair3/NAS/UE/EMM/LowerLayer.h
index 00e271feaa7e9c0dd3e3426401b6dd75c589f5e7..0d8eefc7f3830170be3625e420df6526e39e1db2 100644
--- a/openair3/NAS/UE/EMM/LowerLayer.h
+++ b/openair3/NAS/UE/EMM/LowerLayer.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregistered.c b/openair3/NAS/UE/EMM/SAP/EmmDeregistered.c
index a2a93c4d780a68e36c6b97ee3a7c3eb0ee64d8b5..71e2c4a49ca6f0ed570e0c414bcf5cf310977b1a 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregistered.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregistered.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
index cbdc470a0b844d996fcef9c23626a5543734ec87..834311be749ee3c2549fdbc7f508558fedce5872 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
index 7ddfac03db225bfc34cb83c093dcff0f121f911d..f58cf4b9e0928a01ab2abfe425ebad06985fc0db 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c
index d18b66a3162bc876043d649d78804973400aab6b..a44438a3a89a1b02f98c4c4393812d15b43b78d8 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c
index 394325441597f64991cedf81764e4408caaae0c9..4310f963cd41b87cffa509c059ef3f617e595df9 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
index af9ab5e5be773ccd0090a9986d506139bfe365be..84820568cc28c56c31209d675feadab5d29b44ca 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c
index 0f883c8109d3990939b755bdec22698dbe1013d5..6dc1d3304abefb9bc0322acec220f6d6b1279859 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c
index 3ec7a96ba8ab416ff73ba3f2ac2bfa332a369a70..fe18a98d38fa4d2d96625055acca0e9844c4d4ed 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
index ed41362f2f900563e5776fe2847408cab369b93b..8560b2a4bba3aef6b8077cab0e873e78b4adef40 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmNull.c b/openair3/NAS/UE/EMM/SAP/EmmNull.c
index 7b553f0a765474bc97e405d6c5d591874cdf0a2e..e2e45c99cc4587913c89c5ee606128109bb88dd8 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmNull.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmNull.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegistered.c b/openair3/NAS/UE/EMM/SAP/EmmRegistered.c
index dbc51e51554382af949dee6bd1c6116e334d5186..fbd3e1ce63e18fe14bd96b42102553111c323ea6 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegistered.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegistered.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
index 21654123d1462e3deeba854f5790acc9398e68a4..cf95cd3f56ecdca0925e984970b9a1e3713db7f8 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
index 6855843a25bbe01ba70e58913ada26d0d12983d1..26de1cd377b4899b8fd2c52f066f2b8bb190e8a8 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
index d10f0d1053c0c939408600b85fc8c5a2424ce0dc..36929fc4d7feb47b125b90d7ac92891812416327 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredLimitedService.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredLimitedService.c
index b4ea68f689573330e45d844b076f180e2c92f0e8..af60b566b80b4a038092ac7d9e0a438117997a15 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredLimitedService.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredLimitedService.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
index 0328ae81920f9eece5dddc709d377351222b09a9..5aa408a8f9fa851def676aabb0a916e848cc5f54 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredNormalService.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredNormalService.c
index 8b1c8721f2d6f091645c0db14a19d22611e5b0f9..4ee503ab9f8da4d880f68745640ce687b681cd04 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredNormalService.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredNormalService.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c
index 8ee92c4454cce5d18301cb6dbced9b0d8a7aab32..e300ac58db3975ea45cf86d3c6497ea91c39a339 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
index 2a81b488dce0dd9ce5d71ff3609d392a0b2ae413..dceb0a87d1f4f0773e119738ed87c3ca24c7f051 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmServiceRequestInitiated.c b/openair3/NAS/UE/EMM/SAP/EmmServiceRequestInitiated.c
index b556efb7f44fa02ef98c75eeb0b13b8620b6ada7..fa1944458e5a780b7fc23f5f353d437dc5ca872e 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmServiceRequestInitiated.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmServiceRequestInitiated.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c b/openair3/NAS/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
index 91bb660ee121f4b328a3d38a04d2590910e13244..610eb13b36f04c15808f6860331f716742ca8c8b 100644
--- a/openair3/NAS/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
+++ b/openair3/NAS/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.c b/openair3/NAS/UE/EMM/SAP/emm_as.c
index d833b5bba08178921e45151d3e2114c096d1bb06..fbb54d548be367ceb8743e885fc3753c7054cb24 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_as.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_as.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.h b/openair3/NAS/UE/EMM/SAP/emm_as.h
index 726a363d75c859d4ae8381a44e00c29b951f23e3..24ecef6926a6ef98b3b34fdc7c209e3d7a052a6e 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_as.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_as.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_asDef.h b/openair3/NAS/UE/EMM/SAP/emm_asDef.h
index 69ea979b6361328530af8557330a47ad33d55e67..7bd464ec04d377841818163f6636d724c7d626d4 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_asDef.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_asDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_esm.c b/openair3/NAS/UE/EMM/SAP/emm_esm.c
index 798e682b112c09f7d54ccebcb4b7dc6fec0492a9..5d45da8591bfa32aa0ca9ecf4454d8beabc3646c 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_esm.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_esm.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_esm.h b/openair3/NAS/UE/EMM/SAP/emm_esm.h
index 11aa42213f8f7681e9399104db26980741339149..e74e1f7dc00ec749de8cf0f1e2121c62fd6d946c 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_esm.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_esm.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_esmDef.h b/openair3/NAS/UE/EMM/SAP/emm_esmDef.h
index 811580ab2a65fa429baeda9bfcad57e92a7cbc37..aac37b46bfb6680df0dc907fd41a5eab0a150a58 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_esmDef.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_esmDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_fsm.c b/openair3/NAS/UE/EMM/SAP/emm_fsm.c
index be1517a7ccd21d4c051394ef0be29adac95658fa..a2ede7ae17cd691a7db76a124b98471e9db1c651 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_fsm.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_fsm.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_fsm.h b/openair3/NAS/UE/EMM/SAP/emm_fsm.h
index aba1ef327ca2e8f5f010ece712a501c2600dc625..bc1faf2f85db8b80ae57b6f0db7c632585c5994f 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_fsm.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_fsm.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.c b/openair3/NAS/UE/EMM/SAP/emm_recv.c
index 5b7c6d7dda34fe0c057da04071522ceeefffa69f..2c901eb49b5287d36de2f22fbb9ec3b898796fe0 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_recv.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_recv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.h b/openair3/NAS/UE/EMM/SAP/emm_recv.h
index ead59e3851bcfb44cf5224ac8942f218da24fc82..ccfc8fd2a259a31c7a882c0278083d5960e1b09b 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_recv.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_recv.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_reg.c b/openair3/NAS/UE/EMM/SAP/emm_reg.c
index 6cda066b584d89098421139fcf9f6f60d4dd7256..87c1f1bbd182e295ec15f47136dfb539bea67eb7 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_reg.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_reg.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_reg.h b/openair3/NAS/UE/EMM/SAP/emm_reg.h
index 9cd1132c7a333f148625db8049d6847289b8da97..96a68f1fce494d6d6dc90e3246e585eca0f0e4b3 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_reg.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_reg.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_regDef.h b/openair3/NAS/UE/EMM/SAP/emm_regDef.h
index de1b05b6a6aae95dbfeb691821d56ba16ed5262c..b66c0565ea6dfd0af0be73db21ae5c9c803bf82c 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_regDef.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_regDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_sap.c b/openair3/NAS/UE/EMM/SAP/emm_sap.c
index 429518d475c2c47e20ee86f215d38985de6fd6de..3f48cf3d8fccceb99175c42f76d978f37867c941 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_sap.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_sap.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_sap.h b/openair3/NAS/UE/EMM/SAP/emm_sap.h
index b84fd7808b4bf8ae217107041522dd22b2eabf95..98088a66f366a735e9e5dd981c611998ac826ef0 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_sap.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_sap.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_send.c b/openair3/NAS/UE/EMM/SAP/emm_send.c
index e3fc4fa7f990622aa6a78f922d863e6ca2074669..56708eded3e66ced87169b83e1e9b71eb74647bd 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_send.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_send.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SAP/emm_send.h b/openair3/NAS/UE/EMM/SAP/emm_send.h
index 1c04cd8dad76f0b12b7159ee0984b7f8575fbedf..7cd4fb132fe8e2e8d0586afceb90f288029c074e 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_send.h
+++ b/openair3/NAS/UE/EMM/SAP/emm_send.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/SecurityModeControl.c b/openair3/NAS/UE/EMM/SecurityModeControl.c
index 0991fb22bb4ff6a8a68aa7aa25e28141c3448229..7bdd21572e209f7d9001c6bd8dab771d0f69366f 100644
--- a/openair3/NAS/UE/EMM/SecurityModeControl.c
+++ b/openair3/NAS/UE/EMM/SecurityModeControl.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/ServiceRequestHdl.c b/openair3/NAS/UE/EMM/ServiceRequestHdl.c
index 93e66efdbdb2ae7ad387403fa58f60f08d745204..b305ee169090e4a23911ab3ab640f5003fc195c4 100644
--- a/openair3/NAS/UE/EMM/ServiceRequestHdl.c
+++ b/openair3/NAS/UE/EMM/ServiceRequestHdl.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/TrackingAreaUpdate.c b/openair3/NAS/UE/EMM/TrackingAreaUpdate.c
index bafddaf31739edf8f07cab807fb92215f91e73e6..b8632ef2573266c2619477ca0b56475eed96e6c9 100644
--- a/openair3/NAS/UE/EMM/TrackingAreaUpdate.c
+++ b/openair3/NAS/UE/EMM/TrackingAreaUpdate.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/emmData.h b/openair3/NAS/UE/EMM/emmData.h
index 84e58bb963023f393b3d6333eb743d4753b04455..dfdfb34e77ecd90f9d36f2a6c382d56b4f636bbe 100644
--- a/openair3/NAS/UE/EMM/emmData.h
+++ b/openair3/NAS/UE/EMM/emmData.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/emm_main.c b/openair3/NAS/UE/EMM/emm_main.c
index 8f3ed17e4cae7e03f61d9d4246ed1398ca9f358c..329b59fae6746c312b3692b53393278952876369 100644
--- a/openair3/NAS/UE/EMM/emm_main.c
+++ b/openair3/NAS/UE/EMM/emm_main.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/emm_main.h b/openair3/NAS/UE/EMM/emm_main.h
index aa98965b041245bb818efa4a1a5a3be93f972fd4..055127b15d41fd6d4a10b1c2ac487a35dd9f9357 100644
--- a/openair3/NAS/UE/EMM/emm_main.h
+++ b/openair3/NAS/UE/EMM/emm_main.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/EMM/emm_proc.h b/openair3/NAS/UE/EMM/emm_proc.h
index 45052573352c3402fb8f2dcb2e0e9a162f75fa6b..7d4024d9d63fd7a8ca228fe038db6f74e7311249 100644
--- a/openair3/NAS/UE/EMM/emm_proc.h
+++ b/openair3/NAS/UE/EMM/emm_proc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c b/openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c
index e2133563324f60c61df629acfeb0304d7211e6f1..21c3da3f195138e6dacbd6cba39c29b56b3c1a3c 100644
--- a/openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c
+++ b/openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c b/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c
index a438d65ddb28cac1c76f1240a236f5e163b36e46..7c528d75691bc7527513074ba2c03db974834a64 100644
--- a/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c
+++ b/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c b/openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c
index 6ba5e6e1cc2233f16faba458817d6d7ef477ac05..1a7328a81fd36e0cf6cf2791fedafaffac772a18 100644
--- a/openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c
+++ b/openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/EsmStatusHdl.c b/openair3/NAS/UE/ESM/EsmStatusHdl.c
index 4c8e0aafc1386f089e1a9a0c0f02ebc0df5401aa..def498a89b91ccc7d50cc6b4f6aa3d5cf7f5cebd 100644
--- a/openair3/NAS/UE/ESM/EsmStatusHdl.c
+++ b/openair3/NAS/UE/ESM/EsmStatusHdl.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/PdnConnectivity.c b/openair3/NAS/UE/ESM/PdnConnectivity.c
index f0a245e83e4036e5e8269fd2550c546e58ce7c57..2efed604f02afb05eb3b9427c0d02b4cb7a6c9bb 100644
--- a/openair3/NAS/UE/ESM/PdnConnectivity.c
+++ b/openair3/NAS/UE/ESM/PdnConnectivity.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/PdnDisconnect.c b/openair3/NAS/UE/ESM/PdnDisconnect.c
index 4b5c0f06e5b0bfe14d7cae3613c3393ea7350e5e..6665126e40a007983969db1277173129929cd37d 100644
--- a/openair3/NAS/UE/ESM/PdnDisconnect.c
+++ b/openair3/NAS/UE/ESM/PdnDisconnect.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/SAP/esm_recv.c b/openair3/NAS/UE/ESM/SAP/esm_recv.c
index 03a421558113c48500f8d5893fcfb21e842970ec..ca859f75f24ecdbcbdc8d0565c5426d5664fb43e 100644
--- a/openair3/NAS/UE/ESM/SAP/esm_recv.c
+++ b/openair3/NAS/UE/ESM/SAP/esm_recv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/SAP/esm_recv.h b/openair3/NAS/UE/ESM/SAP/esm_recv.h
index ae36d650e3c37310e90b517934011e0f07e46dc7..29fcb47092d8902199b772da84c0b38ad463b5ac 100644
--- a/openair3/NAS/UE/ESM/SAP/esm_recv.h
+++ b/openair3/NAS/UE/ESM/SAP/esm_recv.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/SAP/esm_sap.c b/openair3/NAS/UE/ESM/SAP/esm_sap.c
index 7ff1e57380bbb20b1dfb8b444593edd202809e87..42deac629eed73ca6e32d637abbbdd0027a41d98 100644
--- a/openair3/NAS/UE/ESM/SAP/esm_sap.c
+++ b/openair3/NAS/UE/ESM/SAP/esm_sap.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/SAP/esm_sap.h b/openair3/NAS/UE/ESM/SAP/esm_sap.h
index b464e18900a330bdaf05bb6b6998da2d69e164b9..28d6cda1db894aa075a21a39068837b91b8fbec5 100644
--- a/openair3/NAS/UE/ESM/SAP/esm_sap.h
+++ b/openair3/NAS/UE/ESM/SAP/esm_sap.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/SAP/esm_sapDef.h b/openair3/NAS/UE/ESM/SAP/esm_sapDef.h
index 4e1bed8bb5f891e75ec6b71ed8ebea19be20bad9..4ff7c7e9ddccd0b5b776e356e86e8d4c90ba2b5d 100644
--- a/openair3/NAS/UE/ESM/SAP/esm_sapDef.h
+++ b/openair3/NAS/UE/ESM/SAP/esm_sapDef.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/SAP/esm_send.c b/openair3/NAS/UE/ESM/SAP/esm_send.c
index eff200dc4e135ce65d968fc0c7588c513064990f..020d9d89e3c9c0188be205e4d6a30c9ad481f005 100644
--- a/openair3/NAS/UE/ESM/SAP/esm_send.c
+++ b/openair3/NAS/UE/ESM/SAP/esm_send.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/SAP/esm_send.h b/openair3/NAS/UE/ESM/SAP/esm_send.h
index 1a5abc869559dcf621ba1bbd48943195475f59f8..f97454027ae05dde8f7ec725949c0db26a3999a0 100644
--- a/openair3/NAS/UE/ESM/SAP/esm_send.h
+++ b/openair3/NAS/UE/ESM/SAP/esm_send.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esmData.h b/openair3/NAS/UE/ESM/esmData.h
index 7da659e801b2e9fec174c689f5817b1682299b6b..16f4707a3775b73b6c619078f654c6b2125098fd 100644
--- a/openair3/NAS/UE/ESM/esmData.h
+++ b/openair3/NAS/UE/ESM/esmData.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_ebr.c b/openair3/NAS/UE/ESM/esm_ebr.c
index 330da2fb23660d2182b70a4faf7a103b1c2fe961..a1d78bc62c0d8a47fc352c52c46357d3e91e7100 100644
--- a/openair3/NAS/UE/ESM/esm_ebr.c
+++ b/openair3/NAS/UE/ESM/esm_ebr.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_ebr.h b/openair3/NAS/UE/ESM/esm_ebr.h
index 8e1eaee1a4291dd76fcf66c37d4201efd419e9e9..dece5c3645bfe0d4218a65e0eb99ee3fc709bf0e 100644
--- a/openair3/NAS/UE/ESM/esm_ebr.h
+++ b/openair3/NAS/UE/ESM/esm_ebr.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c
index 4700187da179a45ffef1388623a12539881b8673..e2a327f4886c1fd4cf84c78d7901a1bb5bfcc307 100644
--- a/openair3/NAS/UE/ESM/esm_ebr_context.c
+++ b/openair3/NAS/UE/ESM/esm_ebr_context.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.h b/openair3/NAS/UE/ESM/esm_ebr_context.h
index a0016555a30233a9d5a3718dacae227b6e369692..d7dfb1da70f2c1a4f8861dadd1cf71e205eaa5b4 100644
--- a/openair3/NAS/UE/ESM/esm_ebr_context.h
+++ b/openair3/NAS/UE/ESM/esm_ebr_context.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_ip.c b/openair3/NAS/UE/ESM/esm_ip.c
index 0743307f6e65d99f24146836019e33403501d079..55be45d182f9a9d9cde15a71d5c8f60026ef294e 100644
--- a/openair3/NAS/UE/ESM/esm_ip.c
+++ b/openair3/NAS/UE/ESM/esm_ip.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_main.c b/openair3/NAS/UE/ESM/esm_main.c
index 6c110abb52ea34f708e278198a6e37a5b577f118..288e7486796f68a4efa0ce3b5af16ba34cf9555f 100644
--- a/openair3/NAS/UE/ESM/esm_main.c
+++ b/openair3/NAS/UE/ESM/esm_main.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_main.h b/openair3/NAS/UE/ESM/esm_main.h
index 42381c8d5b15b89d97ab2d008289dd40f5768a9b..6e6ecc0db4668b806449ecab5f2c90171adb9c48 100644
--- a/openair3/NAS/UE/ESM/esm_main.h
+++ b/openair3/NAS/UE/ESM/esm_main.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_proc.h b/openair3/NAS/UE/ESM/esm_proc.h
index 3d7260b83b7400c8a8d140dc648c7937fa9c6194..941cfa620db3f35fc87a2787a65238f8a29f34b1 100644
--- a/openair3/NAS/UE/ESM/esm_proc.h
+++ b/openair3/NAS/UE/ESM/esm_proc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_pt.c b/openair3/NAS/UE/ESM/esm_pt.c
index 9f8e948954ba7537e2abf6ada2303ef8e046ebc3..c372ad25f4554db093ccfc16b8f2d8938d6bb251 100644
--- a/openair3/NAS/UE/ESM/esm_pt.c
+++ b/openair3/NAS/UE/ESM/esm_pt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/ESM/esm_pt.h b/openair3/NAS/UE/ESM/esm_pt.h
index 8b8693efdaf6bb6d78130e8b4c817a383af27640..3179e0f47b7f044e105e2730cebf96859ccf7fa6 100644
--- a/openair3/NAS/UE/ESM/esm_pt.h
+++ b/openair3/NAS/UE/ESM/esm_pt.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/UEprocess.c b/openair3/NAS/UE/UEprocess.c
index 35d1b864898638bf469c29344e210952faa7bdba..6a70911e21d830616ec37303eb7ce981a72149b2 100644
--- a/openair3/NAS/UE/UEprocess.c
+++ b/openair3/NAS/UE/UEprocess.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c
index b6b2126dfb4800863a44473ac6dddb157416cd2b..0389106ec35e5a705a27352c4de8838efb74557a 100644
--- a/openair3/NAS/UE/nas_itti_messaging.c
+++ b/openair3/NAS/UE/nas_itti_messaging.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_itti_messaging.h b/openair3/NAS/UE/nas_itti_messaging.h
index f4f1f184143cc7e64f54293f04e9bb731da07b12..d958317e5a1301a87a30fc85e891738926b7ae2c 100644
--- a/openair3/NAS/UE/nas_itti_messaging.h
+++ b/openair3/NAS/UE/nas_itti_messaging.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_network.c b/openair3/NAS/UE/nas_network.c
index 6ca4a34c7ffaa13b85d9cabe8dd4f160f84fa72c..f7a292df3f8c6f3882529c7cc477355c83ef3bc2 100644
--- a/openair3/NAS/UE/nas_network.c
+++ b/openair3/NAS/UE/nas_network.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_network.h b/openair3/NAS/UE/nas_network.h
index fb05c8dd2a044b1c84a1ceb6c3891aa789960d60..1c13d67b633a22fc78f4b4de8d8f9cf66406328e 100644
--- a/openair3/NAS/UE/nas_network.h
+++ b/openair3/NAS/UE/nas_network.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_parser.c b/openair3/NAS/UE/nas_parser.c
index 148315eaa261a4bc6b81630f28740ae628853242..d62ebc352934786457e8837a3abe56e2f799ff75 100644
--- a/openair3/NAS/UE/nas_parser.c
+++ b/openair3/NAS/UE/nas_parser.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_parser.h b/openair3/NAS/UE/nas_parser.h
index b799f3a3f495a5d8e4efa9c64c7b460fbba7f5ec..0924654e3fb84f9d7d82f9ef192f364e2d6333fc 100644
--- a/openair3/NAS/UE/nas_parser.h
+++ b/openair3/NAS/UE/nas_parser.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_proc.c b/openair3/NAS/UE/nas_proc.c
index 97ecea8e5a7b4ca09b8eeb9653e7797ce021d73f..6312a7dc97225278ca01cd809f16b6186959b74e 100644
--- a/openair3/NAS/UE/nas_proc.c
+++ b/openair3/NAS/UE/nas_proc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_proc.h b/openair3/NAS/UE/nas_proc.h
index bf8dec9e58a19e81986a3d0eb4f598ea9ae5ea47..4e653549ae0698826f0fb69d41052a5fbbdc2429 100644
--- a/openair3/NAS/UE/nas_proc.h
+++ b/openair3/NAS/UE/nas_proc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c
index da9ae8879d90723902ad50d559f27a3e21aa022c..e41156d113113dba84c1e5012e8ce045c7858e79 100644
--- a/openair3/NAS/UE/nas_ue_task.c
+++ b/openair3/NAS/UE/nas_ue_task.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_ue_task.h b/openair3/NAS/UE/nas_ue_task.h
index 90ef26bd80ffbab5fdd6eac4d00938a8e4fcf706..c9890719cbcf51793c092a3c9d1a88eb2d5adc9f 100644
--- a/openair3/NAS/UE/nas_ue_task.h
+++ b/openair3/NAS/UE/nas_ue_task.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_user.c b/openair3/NAS/UE/nas_user.c
index b698e4d682dc4923a26e3793d7f111aedc0cda49..d3467eddd518349d3f8fc527bd6c27574870daeb 100644
--- a/openair3/NAS/UE/nas_user.c
+++ b/openair3/NAS/UE/nas_user.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/nas_user.h b/openair3/NAS/UE/nas_user.h
index eb7f94a671a0569b988d149fb2ff01fa6fa98235..1ded438ddd1c5982f42c10d3eb3121f2f1eb915a 100644
--- a/openair3/NAS/UE/nas_user.h
+++ b/openair3/NAS/UE/nas_user.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/NAS/UE/user_defs.h b/openair3/NAS/UE/user_defs.h
index c27cf1320ee1708e0f9d9e03760f6030e2e18728..5143a939b09b2986f996d8b9a68bf80c0cb01bf4 100644
--- a/openair3/NAS/UE/user_defs.h
+++ b/openair3/NAS/UE/user_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py b/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py
index 021e3f3cdb81c6016c2edf8571b7493efb672cdf..4603e869a658e1f9e83ecfdd768aea47c81c4d41 100644
--- a/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py
+++ b/openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py
@@ -38,7 +38,7 @@ def outputHeaderToFile(f, filename):
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_common.c b/openair3/S1AP/s1ap_common.c
index 2e4c31533de0e570e67a05d7df0d9564a1540f76..0bd132a228625f4371d97bd3ef9b2ffc1779ec85 100644
--- a/openair3/S1AP/s1ap_common.c
+++ b/openair3/S1AP/s1ap_common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h
index 8e5e5c033342f3f36704c37e522f94df49a8986e..003bdd2d62345371bf57fb520bf4ce545330bafb 100644
--- a/openair3/S1AP/s1ap_common.h
+++ b/openair3/S1AP/s1ap_common.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c
index 65b82055a34a2bfb45b027cd2002d2f939436647..8085c239c304d85cdefeb6671fe57b3e2561c18c 100644
--- a/openair3/S1AP/s1ap_eNB.c
+++ b/openair3/S1AP/s1ap_eNB.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -65,10 +65,7 @@
 #include "oaisim_mme_test_s1c.h"
 #endif
 
-
-#if !defined(OAI_EMU)
 s1ap_eNB_config_t s1ap_config;
-#endif
 
 static int s1ap_eNB_generate_s1_setup_request(
   s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p);
@@ -310,6 +307,7 @@ void *s1ap_eNB_task(void *arg)
 
     switch (ITTI_MSG_ID(received_msg)) {
     case TERMINATE_MESSAGE:
+      S1AP_WARN(" *** Exiting S1AP thread\n");
       itti_exit_task();
       break;
 
@@ -364,6 +362,12 @@ void *s1ap_eNB_task(void *arg)
 				&S1AP_E_RAB_SETUP_RESP(received_msg));
     }
     break;
+
+    case S1AP_E_RAB_MODIFY_RESP: {
+      s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+        &S1AP_E_RAB_MODIFY_RESP(received_msg));
+    }
+    break;
       
     case S1AP_NAS_NON_DELIVERY_IND: {
       s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
@@ -397,6 +401,12 @@ void *s1ap_eNB_task(void *arg)
     }
     break;
 
+   case S1AP_E_RAB_RELEASE_RESPONSE: {
+        s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+                                    &S1AP_E_RAB_RELEASE_RESPONSE(received_msg));
+    }
+    break;
+
     default:
       S1AP_ERROR("Received unhandled message: %d:%s\n",
                  ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
diff --git a/openair3/S1AP/s1ap_eNB.h b/openair3/S1AP/s1ap_eNB.h
index eca28a41016a54dbed37eda17d95b5c4111234e0..e122703d82f2dbda6d5cf42b1bcbf08446a270a4 100644
--- a/openair3/S1AP/s1ap_eNB.h
+++ b/openair3/S1AP/s1ap_eNB.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -35,13 +35,9 @@ typedef struct s1ap_eNB_config_s {
   unsigned char mme_enabled;          ///< MME enabled ?
 } s1ap_eNB_config_t;
 
-#if defined(OAI_EMU)
-# define EPC_MODE_ENABLED       oai_emulation.info.s1ap_config.mme_enabled
-#else
 extern s1ap_eNB_config_t s1ap_config;
 
-# define EPC_MODE_ENABLED       s1ap_config.mme_enabled
-#endif
+#define EPC_MODE_ENABLED       s1ap_config.mme_enabled
 
 void *s1ap_eNB_task(void *arg);
 
diff --git a/openair3/S1AP/s1ap_eNB_context_management_procedures.c b/openair3/S1AP/s1ap_eNB_context_management_procedures.c
index 19aa8516b78366d71fd0b7b173d0f688acbf9e1e..49c5ed28acdbc8b1fdf82edcc05f52a6d2cbbb39 100644
--- a/openair3/S1AP/s1ap_eNB_context_management_procedures.c
+++ b/openair3/S1AP/s1ap_eNB_context_management_procedures.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_context_management_procedures.h b/openair3/S1AP/s1ap_eNB_context_management_procedures.h
index 3e045a71ed05469513f925a8b8340b23394c3c25..c8f7532023867e558b3b7b81fc3110e712a43b6f 100644
--- a/openair3/S1AP/s1ap_eNB_context_management_procedures.h
+++ b/openair3/S1AP/s1ap_eNB_context_management_procedures.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_decoder.c b/openair3/S1AP/s1ap_eNB_decoder.c
index 12a494106ebd2cdbadb7a8cf1ab3687a725d82da..eac52c53ba6fc52cf13340267630a41d1de68c8c 100644
--- a/openair3/S1AP/s1ap_eNB_decoder.c
+++ b/openair3/S1AP/s1ap_eNB_decoder.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -108,7 +108,15 @@ static int s1ap_eNB_decode_initiating_message(s1ap_message *message,
     ret = s1ap_decode_s1ap_pagingies(
             &message->msg.s1ap_PagingIEs, &initiating_p->value);
     s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, message);
-    S1AP_ERROR("TODO Paging initiating message\n");
+    message_id = S1AP_PAGING_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_paging_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_paging_log.text, message_string, message_string_size);
+    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+    S1AP_INFO("Paging initiating message\n");
     free(message_string);
     break;
 
@@ -128,12 +136,36 @@ static int s1ap_eNB_decode_initiating_message(s1ap_message *message,
     free(message_string);
     S1AP_INFO("E_RABSetup initiating message\n");
     break;
+
+  case S1ap_ProcedureCode_id_E_RABModify:
+    ret = s1ap_decode_s1ap_e_rabmodifyrequesties(
+            &message->msg.s1ap_E_RABModifyRequestIEs, &initiating_p->value);
+    message_id = S1AP_E_RAB_MODIFY_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_modify_request_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_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_RABModify 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");
+    ret = s1ap_decode_s1ap_e_rabreleasecommandies(
+            &message->msg.s1ap_E_RABReleaseCommandIEs, &initiating_p->value);
+    s1ap_xer_print_s1ap_e_rabreleasecommand(s1ap_xer__print2sp, message_string, message);
+    message_id = S1AP_E_RAB_RELEASE_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_release_request_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, message_string, message_string_size);
+    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
     free(message_string);
+    S1AP_INFO("TODO  E_RABRelease nitiating message\n");    
     break;
 
   default:
diff --git a/openair3/S1AP/s1ap_eNB_decoder.h b/openair3/S1AP/s1ap_eNB_decoder.h
index 1585dc26303797c5c2f85eb96ff4235af5c23f63..f321f8227f14fc550ee944c7ef2871770252ec88 100644
--- a/openair3/S1AP/s1ap_eNB_decoder.h
+++ b/openair3/S1AP/s1ap_eNB_decoder.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_default_values.h b/openair3/S1AP/s1ap_eNB_default_values.h
index 827f3a80831a50ea7097b17464fae40e234f56e0..44521e8dbf2905c7e5fa418e28b31e0d632b9c13 100644
--- a/openair3/S1AP/s1ap_eNB_default_values.h
+++ b/openair3/S1AP/s1ap_eNB_default_values.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_defs.h b/openair3/S1AP/s1ap_eNB_defs.h
index 27a0209cc59f10383b77c267345c0f05da15580c..11e64703ec1625538daf17f375265e7380c63e85 100644
--- a/openair3/S1AP/s1ap_eNB_defs.h
+++ b/openair3/S1AP/s1ap_eNB_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_encoder.c b/openair3/S1AP/s1ap_eNB_encoder.c
index 17a5be7dc6a658d468a729223c53249c8ebafee5..7bd8bc09aabf6165dffe649bc2700678fd90a03b 100644
--- a/openair3/S1AP/s1ap_eNB_encoder.c
+++ b/openair3/S1AP/s1ap_eNB_encoder.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -100,6 +100,16 @@ int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t  *E_RABSet
 					 uint8_t                              **buffer,
 					 uint32_t                              *length);
 
+static inline
+int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t  *E_RABModifyResponseIEs,
+           uint8_t                              **buffer,
+           uint32_t                              *length);
+
+static inline
+int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t  *s1ap_E_RABReleaseResponseIEs,
+                     uint8_t                              **buffer,
+                     uint32_t                              *length);
+
 int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len)
 {
   DevAssert(message != NULL);
@@ -264,6 +274,32 @@ int s1ap_eNB_encode_successfull_outcome(s1ap_message *s1ap_message_p,
     free(message_string);
     S1AP_INFO("E_RABSetup successful message\n");
     break;
+
+  case S1ap_ProcedureCode_id_E_RABModify:
+    ret = s1ap_eNB_encode_e_rab_modify_response (
+           &s1ap_message_p->msg.s1ap_E_RABModifyResponseIEs, buffer, len);
+    message_id =  S1AP_E_RAB_MODIFY_RESPONSE_LOG ;
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_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_RABModify successful message\n");
+    break;
+
+  case S1ap_ProcedureCode_id_E_RABRelease:
+    ret = s1ap_eNB_encode_e_rab_release_response (
+           &s1ap_message_p->msg.s1ap_E_RABReleaseResponseIEs, buffer, len);
+    s1ap_xer_print_s1ap_e_rabreleaseresponse(s1ap_xer__print2sp, message_string, s1ap_message_p);
+    message_id =  S1AP_E_RAB_RELEASE_RESPONSE_LOG ;
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_e_rab_release_response_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_e_rab_release_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_RAB Release successful message\n");
+    break;
+
   default:
     S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n",
                (int)s1ap_message_p->procedureCode);
@@ -434,7 +470,7 @@ int s1ap_eNB_encode_initial_ue_message(
   return s1ap_generate_initiating_message(buffer,
                                           length,
                                           S1ap_ProcedureCode_id_initialUEMessage,
-                                          S1ap_Criticality_reject,
+                                          S1ap_Criticality_ignore,
                                           &asn_DEF_S1ap_InitialUEMessage,
                                           initialUEMessage_p);
 }
@@ -563,3 +599,48 @@ int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t  *s1ap_E_R
          &asn_DEF_S1ap_E_RABSetupResponse,
          e_rab_setup_response_p);
 }
+
+static inline
+int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t  *s1ap_E_RABModifyResponseIEs,
+           uint8_t                              **buffer,
+           uint32_t                              *length)
+{
+  S1ap_E_RABModifyResponse_t  e_rab_modify_response;
+  S1ap_E_RABModifyResponse_t  *e_rab_modify_response_p = &e_rab_modify_response;
+
+  memset((void *)e_rab_modify_response_p, 0,
+         sizeof(e_rab_modify_response));
+
+  if (s1ap_encode_s1ap_e_rabmodifyresponseies (e_rab_modify_response_p, s1ap_E_RABModifyResponseIEs) < 0) {
+    return -1;
+  }
+
+  return s1ap_generate_successfull_outcome(buffer,
+         length,
+         S1ap_ProcedureCode_id_E_RABModify,
+         S1ap_Criticality_reject,
+         &asn_DEF_S1ap_E_RABModifyResponse,
+         e_rab_modify_response_p);
+}
+static inline
+int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t  *s1ap_E_RABReleaseResponseIEs,
+                     uint8_t                              **buffer,
+                     uint32_t                              *length)
+{
+    S1ap_E_RABReleaseResponse_t  e_rab_release_response;
+    S1ap_E_RABReleaseResponse_t  *e_rab_release_response_p = &e_rab_release_response;
+
+  memset((void *)e_rab_release_response_p, 0,
+         sizeof(e_rab_release_response));
+
+  if (s1ap_encode_s1ap_e_rabreleaseresponseies (e_rab_release_response_p, s1ap_E_RABReleaseResponseIEs) < 0) {
+    return -1;
+  }
+
+  return s1ap_generate_successfull_outcome(buffer,
+         length,
+         S1ap_ProcedureCode_id_E_RABRelease,
+         S1ap_Criticality_reject,
+         &asn_DEF_S1ap_E_RABReleaseResponse,
+         e_rab_release_response_p);
+}
diff --git a/openair3/S1AP/s1ap_eNB_encoder.h b/openair3/S1AP/s1ap_eNB_encoder.h
index 6231958101558017301f741b16b0317f3dc22d6d..5b135a3f76c2c996811d338f1c53f8aac34cedd1 100644
--- a/openair3/S1AP/s1ap_eNB_encoder.h
+++ b/openair3/S1AP/s1ap_eNB_encoder.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c
index 3896cf37aecd19e01efde832bc4f981c6461ea72..0b02fc6db9ee4c0580ec108bdeb50bd162372d52 100644
--- a/openair3/S1AP/s1ap_eNB_handlers.c
+++ b/openair3/S1AP/s1ap_eNB_handlers.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -81,6 +81,20 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t               assoc_id,
 					uint32_t               stream,
 					struct s1ap_message_s *s1ap_message_p);
 
+static
+int s1ap_eNB_handle_paging(uint32_t               assoc_id,
+    uint32_t               stream,
+    struct s1ap_message_s *message_p);
+
+static
+int s1ap_eNB_handle_e_rab_modify_request(uint32_t               assoc_id,
+    uint32_t               stream,
+    struct s1ap_message_s *s1ap_message_p);
+
+static
+int s1ap_eNB_handle_e_rab_release_command(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] = {
@@ -90,11 +104,11 @@ s1ap_message_decoded_callback messages_callback[][3] = {
   { 0, 0, 0 }, /* PathSwitchRequest */
   { 0, 0, 0 }, /* HandoverCancel */
   { s1ap_eNB_handle_e_rab_setup_request, 0, 0 }, /* E_RABSetup */
-  { 0, 0, 0 }, /* E_RABModify */
-  { 0, 0, 0 }, /* E_RABRelease */
+  { s1ap_eNB_handle_e_rab_modify_request, 0, 0 }, /* E_RABModify */
+  { s1ap_eNB_handle_e_rab_release_command, 0, 0 }, /* E_RABRelease */
   { 0, 0, 0 }, /* E_RABReleaseIndication */
   { s1ap_eNB_handle_initial_context_request, 0, 0 }, /* InitialContextSetup */
-  { 0, 0, 0 }, /* Paging */
+  { s1ap_eNB_handle_paging, 0, 0 }, /* Paging */
   { s1ap_eNB_handle_nas_downlink, 0, 0 }, /* downlinkNASTransport */
   { 0, 0, 0 }, /* initialUEMessage */
   { 0, 0, 0 }, /* uplinkNASTransport */
@@ -950,7 +964,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t               assoc_id,
       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;
+      // return -1;
     }
 
     /* Set the transport layer address */
@@ -983,4 +997,382 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t               assoc_id,
   return 0;
 }
 
+static
+int s1ap_eNB_handle_paging(uint32_t               assoc_id,
+    uint32_t               stream,
+    struct s1ap_message_s *s1ap_message_p)
+{
+  S1ap_PagingIEs_t *paging_p;
+  s1ap_eNB_mme_data_t   *mme_desc_p        = NULL;
+  s1ap_eNB_instance_t   *s1ap_eNB_instance = NULL;
+  MessageDef            *message_p         = NULL;
+
+  DevAssert(s1ap_message_p != NULL);
+  // received Paging Message from MME
+  S1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id);
+
+  paging_p = &s1ap_message_p->msg.s1ap_PagingIEs;
+
+  /* Paging procedure -> stream != 0 */
+  if (stream == 0) {
+    S1AP_ERROR("[SCTP %d] Received Paging procedure on stream (%d)\n",
+               assoc_id, stream);
+    return -1;
+  }
+
+  if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
+    S1AP_ERROR("[SCTP %d] Received Paging for non "
+               "existing MME context\n", assoc_id);
+    return -1;
+  }
+
+  s1ap_eNB_instance = mme_desc_p->s1ap_eNB_instance;
+  if (s1ap_eNB_instance == NULL) {
+    S1AP_ERROR("[SCTP %d] Received Paging for non existing MME context : s1ap_eNB_instance is NULL\n",
+               assoc_id);
+    return -1;
+  }
+
+  message_p = itti_alloc_new_message(TASK_S1AP, S1AP_PAGING_IND);
+
+  /* convert S1ap_PagingIEs_t to s1ap_paging_ind_t */
+  /* convert UE Identity Index value */
+  S1AP_PAGING_IND(message_p).ue_index_value  = BIT_STRING_to_uint32(&paging_p->ueIdentityIndexValue);
+  S1AP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n",
+            assoc_id,(uint32_t)S1AP_PAGING_IND(message_p).ue_index_value);
+
+  S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0;
+  S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0;
+
+  /* convert UE Paging Identity */
+  if (paging_p->uePagingID.present == S1ap_UEPagingID_PR_s_TMSI) {
+      S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi;
+      OCTET_STRING_TO_INT8(&paging_p->uePagingID.choice.s_TMSI.mMEC, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code);
+      OCTET_STRING_TO_INT32(&paging_p->uePagingID.choice.s_TMSI.m_TMSI, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi);
+  } else if (paging_p->uePagingID.present == S1ap_UEPagingID_PR_iMSI) {
+      S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_imsi;
+      S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length = 0;
+      for (int i = 0; i < paging_p->uePagingID.choice.iMSI.size; i++) {
+          S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i] = (uint8_t)(paging_p->uePagingID.choice.iMSI.buf[i] & 0x0F );
+          S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++;
+          S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] = (uint8_t)((paging_p->uePagingID.choice.iMSI.buf[i]>>4) & 0x0F);
+          LOG_D(S1AP,"paging : i %d %d imsi %d %d \n",2*i,2*i+1,S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1]);
+          if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] == 0x0F) {
+              if(i != paging_p->uePagingID.choice.iMSI.size - 1){
+                  /* invalid paging_p->uePagingID.choise.iMSI.buffer */
+                  S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI error(i %d 0x0F)\n", assoc_id,i);
+                  return -1;
+              }
+          } else {
+              S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++;
+          }
+      }
+      if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length >= S1AP_IMSI_LENGTH) {
+          /* invalid paging_p->uePagingID.choise.iMSI.size */
+          S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI.size(%d) is over IMSI length(%d)\n", assoc_id, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, S1AP_IMSI_LENGTH);
+          return -1;
+      }  
+} else {
+      /* invalid paging_p->uePagingID.present */
+      S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.present(%d) is unknown\n", assoc_id, paging_p->uePagingID.present);
+      return -1;
+  }
+
+#if 0
+  /* convert Paging DRX(optional) */
+  if (paging_p->presenceMask & S1AP_PAGINGIES_PAGINGDRX_PRESENT) {
+      switch(paging_p->pagingDRX) {
+        case S1ap_PagingDRX_v32:
+          S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_32;
+         break;
+        case S1ap_PagingDRX_v64:
+          S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_64;
+        break;
+        case S1ap_PagingDRX_v128:
+          S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_128;
+        break;
+        case S1ap_PagingDRX_v256:
+          S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256;
+        break;
+        default:
+          // when UE Paging DRX is no value
+          S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256;
+        break;
+      }
+  }
+#endif
+  S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256;
+
+  /* convert cnDomain */
+  if (paging_p->cnDomain == S1ap_CNDomain_ps) {
+      S1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_PS;
+  } else if (paging_p->cnDomain == S1ap_CNDomain_cs) {
+      S1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_CS;
+  } else {
+      /* invalid paging_p->cnDomain */
+      S1AP_ERROR("[SCTP %d] Received Paging : cnDomain(%ld) is unknown\n", assoc_id, paging_p->cnDomain);
+      return -1;
+  }
+
+  memset (&S1AP_PAGING_IND(message_p).plmn_identity[0], 0, sizeof(plmn_identity_t)*256);
+  memset (&S1AP_PAGING_IND(message_p).tac[0], 0, sizeof(int16_t)*256);
+  S1AP_PAGING_IND(message_p).tai_size = 0;
+
+  for (int i = 0; i < paging_p->taiList.s1ap_TAIItem.count; i++) {
+     S1AP_INFO("[SCTP %d] Received Paging taiList: i %d, count %d\n", assoc_id, i, paging_p->taiList.s1ap_TAIItem.count);
+     S1ap_TAIItem_t s1ap_TAIItem;
+     memset (&s1ap_TAIItem, 0, sizeof(S1ap_TAIItem_t));
+
+     memcpy(&s1ap_TAIItem, paging_p->taiList.s1ap_TAIItem.array[i], sizeof(S1ap_TAIItem_t));
+
+     TBCD_TO_MCC_MNC(&s1ap_TAIItem.tAI.pLMNidentity, S1AP_PAGING_IND(message_p).plmn_identity[i].mcc,
+              S1AP_PAGING_IND(message_p).plmn_identity[i].mnc,
+              S1AP_PAGING_IND(message_p).plmn_identity[i].mnc_digit_length);
+     OCTET_STRING_TO_INT16(&s1ap_TAIItem.tAI.tAC, S1AP_PAGING_IND(message_p).tac[i]);
+     S1AP_PAGING_IND(message_p).tai_size++;
+     S1AP_DEBUG("[SCTP %d] Received Paging: MCC %d, MNC %d, TAC %d\n", assoc_id, S1AP_PAGING_IND(message_p).plmn_identity[i].mcc, S1AP_PAGING_IND(message_p).plmn_identity[i].mnc, S1AP_PAGING_IND(message_p).tac[i]);
+  }
+
+#if 0
+ // CSG Id(optional) List is not used
+  if (paging_p->presenceMask & S1AP_PAGINGIES_CSG_IDLIST_PRESENT) {
+      // TODO
+  }
+
+  /* convert pagingPriority (optional) if has value */
+  if (paging_p->presenceMask & S1AP_PAGINGIES_PAGINGPRIORITY_PRESENT) {
+      switch(paging_p->pagingPriority) {
+      case S1ap_PagingPriority_priolevel1:
+          S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL1;
+        break;
+      case S1ap_PagingPriority_priolevel2:
+          S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL2;
+        break;
+      case S1ap_PagingPriority_priolevel3:
+          S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL3;
+        break;
+      case S1ap_PagingPriority_priolevel4:
+          S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL4;
+        break;
+      case S1ap_PagingPriority_priolevel5:
+          S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL5;
+        break;
+      case S1ap_PagingPriority_priolevel6:
+          S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL6;
+        break;
+      case S1ap_PagingPriority_priolevel7:
+          S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL7;
+        break;
+      case S1ap_PagingPriority_priolevel8:
+          S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL8;
+        break;
+      default:
+        /* invalid paging_p->pagingPriority */
+        S1AP_ERROR("[SCTP %d] Received paging : pagingPriority(%ld) is invalid\n", assoc_id, paging_p->pagingPriority);
+        return -1;
+      }
+  }
+#endif
+  //paging parameter values
+  S1AP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d  cn_domain %d paging_drx %d paging_priority %d\n",assoc_id,
+          S1AP_PAGING_IND(message_p).ue_index_value, S1AP_PAGING_IND(message_p).cn_domain,
+          S1AP_PAGING_IND(message_p).paging_drx, S1AP_PAGING_IND(message_p).paging_priority);
+  S1AP_DEBUG("[SCTP %d] Received Paging parameters(ue): presenceMask %d  s_tmsi.m_tmsi %d s_tmsi.mme_code %d IMSI length %d (0-5) %d%d%d%d%d%d\n",assoc_id,
+          S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi,
+          S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length,
+          S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1],
+          S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3],
+          S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]);
+
+  /* send message to RRC */
+  itti_send_msg_to_task(TASK_RRC_ENB, s1ap_eNB_instance->instance, message_p);
+  
+   return 0;
+}
+
+static
+int s1ap_eNB_handle_e_rab_modify_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;
+  int nb_of_e_rabs_failed = 0;
+
+  S1ap_E_RABModifyRequestIEs_t         *s1ap_E_RABModifyRequest;
+  DevAssert(s1ap_message_p != NULL);
+
+  s1ap_E_RABModifyRequest = &s1ap_message_p->msg.s1ap_E_RABModifyRequestIEs;
+
+  if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
+    S1AP_ERROR("[SCTP %d] Received E-RAB modify 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_RABModifyRequest->eNB_UE_S1AP_ID)) == NULL) {
+    S1AP_ERROR("[SCTP %d] Received E-RAB modify request for non "
+               "existing UE context 0x%06lx\n", assoc_id,
+               s1ap_E_RABModifyRequest->eNB_UE_S1AP_ID);
+    return -1;
+  }
 
+  /* E-RAB modify 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_RABModifyRequest->mme_ue_s1ap_id){
+    S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)",
+        ue_desc_p->mme_ue_s1ap_id, s1ap_E_RABModifyRequest->mme_ue_s1ap_id);
+    message_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP);
+
+    S1AP_E_RAB_MODIFY_RESP (message_p).eNB_ue_s1ap_id = s1ap_E_RABModifyRequest->eNB_UE_S1AP_ID;
+//        S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[S1AP_MAX_E_RAB];
+    S1AP_E_RAB_MODIFY_RESP (message_p).nb_of_e_rabs = 0;
+
+    for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.count; nb_of_e_rabs_failed++) {
+      S1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id =
+            ((S1ap_E_RABToBeModifiedItemBearerModReq_t *)s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.array[nb_of_e_rabs_failed])->e_RAB_ID;
+      S1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].cause = S1AP_CAUSE_RADIO_NETWORK;
+      S1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = 13;//S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id;
+    }
+    S1AP_E_RAB_MODIFY_RESP (message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed;
+
+    s1ap_eNB_e_rab_modify_resp(mme_desc_p->s1ap_eNB_instance->instance,
+                               &S1AP_E_RAB_MODIFY_RESP(message_p));
+
+    message_p = NULL;
+    return -1;
+  }
+
+  message_p        = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_MODIFY_REQ);
+
+  S1AP_E_RAB_MODIFY_REQ(message_p).ue_initial_id  = ue_desc_p->ue_initial_id;
+
+  S1AP_E_RAB_MODIFY_REQ(message_p).mme_ue_s1ap_id  = s1ap_E_RABModifyRequest->mme_ue_s1ap_id;
+  S1AP_E_RAB_MODIFY_REQ(message_p).eNB_ue_s1ap_id  = s1ap_E_RABModifyRequest->eNB_UE_S1AP_ID;
+
+  S1AP_E_RAB_MODIFY_REQ(message_p).nb_e_rabs_tomodify =
+    s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.count;
+
+  for (i = 0; i < s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.count; i++) {
+    S1ap_E_RABToBeModifiedItemBearerModReq_t *item_p;
+
+    item_p = (S1ap_E_RABToBeModifiedItemBearerModReq_t *)s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.array[i];
+
+    S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_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_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size;
+
+      S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size);
+
+      memcpy(S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer,
+             item_p->nAS_PDU.buf, item_p->nAS_PDU.size);
+    } else {
+      S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = 0;
+      S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = NULL;
+      continue;
+    }
+
+    /* Set the QOS informations */
+    S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI;
+
+    S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.priority_level =
+      item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel;
+    S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_capability =
+      item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability;
+    S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_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;
+}
+// handle e-rab release command and send it to rrc_end
+static
+int s1ap_eNB_handle_e_rab_release_command(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_RABReleaseCommandIEs_t         *s1ap_E_RABReleaseCommand;
+  DevAssert(s1ap_message_p != NULL);
+  s1ap_E_RABReleaseCommand = &s1ap_message_p->msg.s1ap_E_RABReleaseCommandIEs;
+  
+  if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
+    S1AP_ERROR("[SCTP %d] Received E-RAB release command 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_RABReleaseCommand->eNB_UE_S1AP_ID)) == NULL) {
+    S1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id,
+               s1ap_E_RABReleaseCommand->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_RABReleaseCommand->mme_ue_s1ap_id){
+    S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)",
+          ue_desc_p->mme_ue_s1ap_id, s1ap_E_RABReleaseCommand->mme_ue_s1ap_id);
+  }
+
+  S1AP_DEBUG("[SCTP %d] Received E-RAB release command for eNB_UE_S1AP_ID %ld mme_ue_s1ap_id %ld\n",
+          assoc_id, s1ap_E_RABReleaseCommand->eNB_UE_S1AP_ID, s1ap_E_RABReleaseCommand->mme_ue_s1ap_id);
+
+  message_p        = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_RELEASE_COMMAND);
+
+  S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = s1ap_E_RABReleaseCommand->eNB_UE_S1AP_ID;
+  S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = s1ap_E_RABReleaseCommand->mme_ue_s1ap_id;
+  if(s1ap_E_RABReleaseCommand->nas_pdu.size > 0 ){
+    S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = s1ap_E_RABReleaseCommand->nas_pdu.size;
+
+    S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer =
+      malloc(sizeof(uint8_t) * s1ap_E_RABReleaseCommand->nas_pdu.size);
+
+    memcpy(S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer,
+    		s1ap_E_RABReleaseCommand->nas_pdu.buf,
+    		s1ap_E_RABReleaseCommand->nas_pdu.size);
+  } else {
+	  S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0;
+	  S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL;
+  }
+
+  S1AP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = s1ap_E_RABReleaseCommand->e_RABToBeReleasedList.s1ap_E_RABItem.count;
+  for(i=0; i < s1ap_E_RABReleaseCommand->e_RABToBeReleasedList.s1ap_E_RABItem.count; i++){
+	  S1ap_E_RABItem_t *item_p;
+	  item_p = (S1ap_E_RABItem_t*)s1ap_E_RABReleaseCommand->e_RABToBeReleasedList.s1ap_E_RABItem.array[i];
+	  S1AP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID;
+	  S1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID);
+  }
+
+  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_handlers.h b/openair3/S1AP/s1ap_eNB_handlers.h
index ef36b908cc0eeb08e2744e205dc4cdfb3c71750b..d0e93faa4d23b56d06be7aca06116fd2b93b5098 100644
--- a/openair3/S1AP/s1ap_eNB_handlers.h
+++ b/openair3/S1AP/s1ap_eNB_handlers.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_itti_messaging.c b/openair3/S1AP/s1ap_eNB_itti_messaging.c
index 352cb48d61995d608aa8bf381416f20cd805252b..a0cdfd2dbc7b9b321d06f385567809870a9f1504 100644
--- a/openair3/S1AP/s1ap_eNB_itti_messaging.c
+++ b/openair3/S1AP/s1ap_eNB_itti_messaging.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_itti_messaging.h b/openair3/S1AP/s1ap_eNB_itti_messaging.h
index d8572eef898513ca5db7deb83802055b8963e794..cd6b3cebcc0bc07cdbe3537310d9f4fe395d3168 100644
--- a/openair3/S1AP/s1ap_eNB_itti_messaging.h
+++ b/openair3/S1AP/s1ap_eNB_itti_messaging.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.c b/openair3/S1AP/s1ap_eNB_management_procedures.c
index d5f321770d01ec12b6de19f634c2228bb405330e..fc7ae70e4902073e3a5ceb70ccd9b4b93b4be2a8 100644
--- a/openair3/S1AP/s1ap_eNB_management_procedures.c
+++ b/openair3/S1AP/s1ap_eNB_management_procedures.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.h b/openair3/S1AP/s1ap_eNB_management_procedures.h
index 73d8698c164b6f114050e37387b2f7ea6247dfee..83df7f8919e179d0c43154fb88b2bcd01758b126 100644
--- a/openair3/S1AP/s1ap_eNB_management_procedures.h
+++ b/openair3/S1AP/s1ap_eNB_management_procedures.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c
index 426f38004a845942a24378bbd9106cbc2264f0ba..d6d9b52c07a2cd6719b9bc63fbcda72bf4d11c4a 100644
--- a/openair3/S1AP/s1ap_eNB_nas_procedures.c
+++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -837,3 +837,282 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
 
   return ret;
 }
+
+//------------------------------------------------------------------------------
+int s1ap_eNB_e_rab_modify_resp(instance_t instance,
+            s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p)
+//------------------------------------------------------------------------------
+{
+  s1ap_eNB_instance_t          *s1ap_eNB_instance_p = NULL;
+  struct s1ap_eNB_ue_context_s *ue_context_p        = NULL;
+
+  S1ap_E_RABModifyResponseIEs_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_modify_resp_p != NULL);
+  DevAssert(s1ap_eNB_instance_p != NULL);
+
+  if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
+                e_rab_modify_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_modify_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_modify_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_RABModify;
+  message.criticality   = S1ap_Criticality_reject;
+
+  initial_ies_p = &message.msg.s1ap_E_RABModifyResponseIEs;
+
+  initial_ies_p->eNB_UE_S1AP_ID = e_rab_modify_resp_p->eNB_ue_s1ap_id;
+  initial_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
+
+  if ( e_rab_modify_resp_p->nb_of_e_rabs >= 1 )
+    initial_ies_p->presenceMask |= S1AP_E_RABMODIFYRESPONSEIES_E_RABMODIFYLISTBEARERMODRES_PRESENT;
+
+  for (i = 0; i < e_rab_modify_resp_p->nb_of_e_rabs; i++) {
+    S1ap_E_RABModifyItemBearerModRes_t *modify_item;
+
+    modify_item = calloc(1, sizeof(S1ap_E_RABModifyItemBearerModRes_t));
+
+    modify_item->e_RAB_ID = e_rab_modify_resp_p->e_rabs[i].e_rab_id;
+
+    S1AP_DEBUG("e_rab_modify_resp: modified e_rab ID %ld\n",
+        modify_item->e_RAB_ID);
+
+    S1ap_IE_t *ie = s1ap_new_ie(S1ap_ProtocolIE_ID_id_E_RABModifyItemBearerModRes,
+        S1ap_Criticality_ignore,
+        &asn_DEF_S1ap_E_RABModifyItemBearerModRes,
+        modify_item);
+
+    ASN_SEQUENCE_ADD(&initial_ies_p->e_RABModifyListBearerModRes.s1ap_E_RABModifyItemBearerModRes,
+                     ie);
+  }
+
+  if ( e_rab_modify_resp_p->nb_of_e_rabs_failed >= 1 )
+    initial_ies_p->presenceMask |= S1AP_E_RABMODIFYRESPONSEIES_E_RABFAILEDTOMODIFYLIST_PRESENT;
+
+  for (i = 0; i < e_rab_modify_resp_p->nb_of_e_rabs_failed; i++) {
+    S1ap_E_RABItem_t *failed_item;
+
+    failed_item = calloc(1, sizeof(S1ap_E_RABItem_t));
+
+    failed_item->e_RAB_ID = e_rab_modify_resp_p->e_rabs_failed[i].e_rab_id;
+    switch(e_rab_modify_resp_p->e_rabs_failed[i].cause)
+    {
+    case S1AP_CAUSE_RADIO_NETWORK:
+        failed_item->cause.present = S1ap_Cause_PR_radioNetwork;
+        failed_item->cause.choice.radioNetwork = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
+        break;
+    case S1AP_CAUSE_TRANSPORT:
+        failed_item->cause.present = S1ap_Cause_PR_transport;
+        failed_item->cause.choice.transport = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
+        break;
+    case S1AP_CAUSE_NAS:
+        failed_item->cause.present = S1ap_Cause_PR_nas;
+        failed_item->cause.choice.nas = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
+        break;
+    case S1AP_CAUSE_PROTOCOL:
+        failed_item->cause.present = S1ap_Cause_PR_protocol;
+        failed_item->cause.choice.protocol = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
+        break;
+    case S1AP_CAUSE_MISC:
+        failed_item->cause.present = S1ap_Cause_PR_misc;
+        failed_item->cause.choice.misc = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
+        break;
+    default:
+        break;
+    }
+    S1AP_DEBUG("e_rab_modify_resp: failed e_rab ID %ld\n",
+        failed_item->e_RAB_ID);
+
+    S1ap_IE_t *ie = s1ap_new_ie(S1ap_ProtocolIE_ID_id_E_RABItem,
+        S1ap_Criticality_ignore,
+        &asn_DEF_S1ap_E_RABItem,
+        failed_item);
+
+    ASN_SEQUENCE_ADD(&initial_ies_p->e_RABFailedToModifyList.s1ap_E_RABItem,
+                     ie);
+  }
+
+  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 Modify successful Outcome 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;
+}
+//------------------------------------------------------------------------------
+int s1ap_eNB_e_rab_release_resp(instance_t instance,
+			      s1ap_e_rab_release_resp_t *e_rab_release_resp_p)
+//------------------------------------------------------------------------------
+{
+  s1ap_eNB_instance_t          *s1ap_eNB_instance_p = NULL;
+  struct s1ap_eNB_ue_context_s *ue_context_p        = NULL;
+
+  S1ap_E_RABReleaseResponseIEs_t  *release_response_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_release_resp_p != NULL);
+  DevAssert(s1ap_eNB_instance_p != NULL);
+
+  /* Prepare the S1AP message to encode */
+  memset(&message, 0, sizeof(s1ap_message));
+
+  message.direction     = S1AP_PDU_PR_successfulOutcome;
+  message.procedureCode = S1ap_ProcedureCode_id_E_RABRelease;
+  message.criticality = S1ap_Criticality_ignore;
+
+  if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
+          e_rab_release_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: %u\n",
+            e_rab_release_resp_p->eNB_ue_s1ap_id);
+    return -1;
+  }
+
+  release_response_ies_p = &message.msg.s1ap_E_RABReleaseResponseIEs;
+  release_response_ies_p->eNB_UE_S1AP_ID = e_rab_release_resp_p->eNB_ue_s1ap_id;
+  release_response_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
+
+  if ( e_rab_release_resp_p->nb_of_e_rabs_released > 0 )
+      release_response_ies_p->presenceMask |= S1AP_E_RABRELEASERESPONSEIES_E_RABRELEASELISTBEARERRELCOMP_PRESENT;
+
+  //release
+  for (i = 0; i < e_rab_release_resp_p->nb_of_e_rabs_released; i++) {
+
+    S1ap_E_RABReleaseItemBearerRelComp_t *new_item;
+
+    new_item = calloc(1, sizeof(S1ap_E_RABReleaseItemBearerRelComp_t));
+
+    new_item->e_RAB_ID = e_rab_release_resp_p->e_rab_release[i].e_rab_id;
+
+    S1AP_DEBUG("e_rab_release_resp: e_rab ID %ld\n",new_item->e_RAB_ID);
+
+    ASN_SEQUENCE_ADD(&release_response_ies_p->e_RABReleaseListBearerRelComp.s1ap_E_RABReleaseItemBearerRelComp,
+                     new_item);
+
+  }
+
+  if ( e_rab_release_resp_p->nb_of_e_rabs_failed > 0 )
+      release_response_ies_p->presenceMask |= S1AP_E_RABRELEASERESPONSEIES_E_RABFAILEDTORELEASELIST_PRESENT;
+
+  //release failed
+  for (i = 0; i < e_rab_release_resp_p->nb_of_e_rabs_failed; i++) {
+      S1ap_E_RABItem_t     *new_rabitem;
+      new_rabitem = calloc(1, sizeof(S1ap_E_RABItem_t));
+      //e_rab_id
+      new_rabitem->e_RAB_ID = e_rab_release_resp_p->e_rabs_failed[i].e_rab_id;
+      //cause
+      switch(e_rab_release_resp_p->e_rabs_failed[i].cause)
+      {
+        case S1AP_CAUSE_NOTHING:
+          new_rabitem->cause.present = S1ap_Cause_PR_NOTHING;
+        break;
+
+        case S1AP_CAUSE_RADIO_NETWORK:
+          new_rabitem->cause.present = S1ap_Cause_PR_radioNetwork;
+          new_rabitem->cause.choice.radioNetwork = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
+        break;
+
+        case S1AP_CAUSE_TRANSPORT:
+          new_rabitem->cause.present = S1ap_Cause_PR_transport;
+          new_rabitem->cause.choice.transport = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
+        break;
+
+        case S1AP_CAUSE_NAS:
+          new_rabitem->cause.present = S1ap_Cause_PR_nas;
+          new_rabitem->cause.choice.nas = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
+        break;
+
+        case S1AP_CAUSE_PROTOCOL:
+          new_rabitem->cause.present = S1ap_Cause_PR_protocol;
+          new_rabitem->cause.choice.protocol = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
+        break;
+
+        case S1AP_CAUSE_MISC:
+        default:
+          new_rabitem->cause.present = S1ap_Cause_PR_misc;
+          new_rabitem->cause.choice.misc = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
+        break;
+      }
+      S1AP_DEBUG("e_rab_release_resp: failed e_rab ID %ld\n",new_rabitem->e_RAB_ID);
+      ASN_SEQUENCE_ADD(&release_response_ies_p->e_RABFailedToReleaseList.s1ap_E_RABItem, new_rabitem);
+  }
+
+  fprintf(stderr, "start encode\n");
+  if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
+    S1AP_ERROR("Failed to encode release response\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 Release successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
+    0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
+    e_rab_release_resp_p->eNB_ue_s1ap_id,
+    ue_context_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);
+
+  S1AP_INFO("e_rab_release_response sended eNB_UE_S1AP_ID %d  mme_ue_s1ap_id %d nb_of_e_rabs_released %d nb_of_e_rabs_failed %d\n",
+          e_rab_release_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,e_rab_release_resp_p->nb_of_e_rabs_released,e_rab_release_resp_p->nb_of_e_rabs_failed);
+
+  return ret;
+}
diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.h b/openair3/S1AP/s1ap_eNB_nas_procedures.h
index 6ac4b06111b17c25099154d7d3576b32b817243e..bb2a0488bfd898fb5ec87a62e0d205767c19d467 100644
--- a/openair3/S1AP/s1ap_eNB_nas_procedures.h
+++ b/openair3/S1AP/s1ap_eNB_nas_procedures.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -44,4 +44,9 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
 int s1ap_eNB_e_rab_setup_resp(instance_t instance,
                               s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p);
 
+int s1ap_eNB_e_rab_modify_resp(instance_t instance,
+               s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p);
+
+int s1ap_eNB_e_rab_release_resp(instance_t instance,
+                  s1ap_e_rab_release_resp_t *e_rab_release_resp_p);
 #endif /* S1AP_ENB_NAS_PROCEDURES_H_ */
diff --git a/openair3/S1AP/s1ap_eNB_nnsf.c b/openair3/S1AP/s1ap_eNB_nnsf.c
index 3d4c96648d34b3411502e2adf807af15208a602f..8b7d65cb011194b3846dea521bf0e6bcd0c4bd89 100644
--- a/openair3/S1AP/s1ap_eNB_nnsf.c
+++ b/openair3/S1AP/s1ap_eNB_nnsf.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_nnsf.h b/openair3/S1AP/s1ap_eNB_nnsf.h
index 38d93febd8a685f721ada68fa1880bbdc956ad63..78405f34d1b17e0995cfa70e91c57b98cf087786 100644
--- a/openair3/S1AP/s1ap_eNB_nnsf.h
+++ b/openair3/S1AP/s1ap_eNB_nnsf.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_overload.c b/openair3/S1AP/s1ap_eNB_overload.c
index a56242d36387a722deb6f668b1f649ee4b54d7d2..82167bfeeb5112f9ac0712a24679f89f56358124 100644
--- a/openair3/S1AP/s1ap_eNB_overload.c
+++ b/openair3/S1AP/s1ap_eNB_overload.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_overload.h b/openair3/S1AP/s1ap_eNB_overload.h
index e15b241b9db49d1c66ff335cc4c09dc0bf3b1cb3..1b0ee443de3a23b07c8f6db71310501bc3c0f52d 100644
--- a/openair3/S1AP/s1ap_eNB_overload.h
+++ b/openair3/S1AP/s1ap_eNB_overload.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_trace.c b/openair3/S1AP/s1ap_eNB_trace.c
index 55ec5750f19eb687609a131695c091f823394b40..e640c9292a856e1cac8d99a38fc2a33cb7ecc8fb 100644
--- a/openair3/S1AP/s1ap_eNB_trace.c
+++ b/openair3/S1AP/s1ap_eNB_trace.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_trace.h b/openair3/S1AP/s1ap_eNB_trace.h
index fc321ce59464b4d10b0f40088cf4993a9ad1dfea..922197afb42d9cd120494365d4de17b4275f5dfb 100644
--- a/openair3/S1AP/s1ap_eNB_trace.h
+++ b/openair3/S1AP/s1ap_eNB_trace.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_ue_context.c b/openair3/S1AP/s1ap_eNB_ue_context.c
index 8dc050ec8b4c8d005be7ff7f7171f0a1cc66ca4a..9cc8910ac5a648115cef1b0823be654cb127ec19 100644
--- a/openair3/S1AP/s1ap_eNB_ue_context.c
+++ b/openair3/S1AP/s1ap_eNB_ue_context.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/S1AP/s1ap_eNB_ue_context.h b/openair3/S1AP/s1ap_eNB_ue_context.h
index 8c9ce6dea60314ae7c738e9c278aef07d0895245..d78c6f7f1a97d42e2654de02b5fb921439c98f21 100644
--- a/openair3/S1AP/s1ap_eNB_ue_context.h
+++ b/openair3/S1AP/s1ap_eNB_ue_context.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_common.c b/openair3/SCTP/sctp_common.c
index f384d832ffaf0637187b4a2718c0db5b2127ee16..c467290b3698b9687fb858b9df7e745262c74034 100644
--- a/openair3/SCTP/sctp_common.c
+++ b/openair3/SCTP/sctp_common.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_common.h b/openair3/SCTP/sctp_common.h
index dc0757d30fe7c9de9c8604e3b2ccd63f5c8e9f08..f88c07730ce4ab614097d795f959b36673bbb88c 100644
--- a/openair3/SCTP/sctp_common.h
+++ b/openair3/SCTP/sctp_common.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_default_values.h b/openair3/SCTP/sctp_default_values.h
index d22d50605a2949a8374f6f332eca93205c6259ed..5008ea0b72bf6d9202bc633f44595e3b415eccce 100644
--- a/openair3/SCTP/sctp_default_values.h
+++ b/openair3/SCTP/sctp_default_values.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_eNB_defs.h b/openair3/SCTP/sctp_eNB_defs.h
index 8e2347f80d7674dbb52074bafdbe66de807a5f15..9d3b4119b5a60c381b9d4a14c469b1aeb7b38fb7 100644
--- a/openair3/SCTP/sctp_eNB_defs.h
+++ b/openair3/SCTP/sctp_eNB_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.c b/openair3/SCTP/sctp_eNB_itti_messaging.c
index 1725bb5fa7b3fce3627f0c8c6cdf755261868440..3517c0597bb54bcba72bdcbdb680ebf21ef03d0d 100644
--- a/openair3/SCTP/sctp_eNB_itti_messaging.c
+++ b/openair3/SCTP/sctp_eNB_itti_messaging.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.h b/openair3/SCTP/sctp_eNB_itti_messaging.h
index 01c3b209e284166bf436a968e198024b8fb8e5e3..665c5f0e663ed111f1ea9abcfedc89353e872f9a 100644
--- a/openair3/SCTP/sctp_eNB_itti_messaging.h
+++ b/openair3/SCTP/sctp_eNB_itti_messaging.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c
index 1f166af74ccbe25d786e0189cec67f2fbb58ee94..256bee0cd12ecca1d8c8cd28a42f105e745da12d 100644
--- a/openair3/SCTP/sctp_eNB_task.c
+++ b/openair3/SCTP/sctp_eNB_task.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -841,6 +841,7 @@ void *sctp_eNB_task(void *arg)
         break;
 
       case TERMINATE_MESSAGE:
+        SCTP_WARN("*** Exiting SCTP thread\n");
         itti_exit_task();
         break;
 
diff --git a/openair3/SCTP/sctp_eNB_task.h b/openair3/SCTP/sctp_eNB_task.h
index 333aa20f5852770ee9515f95554cf776833048c2..31cb6831025e5eea879ebee904f24cc5dbf14276 100644
--- a/openair3/SCTP/sctp_eNB_task.h
+++ b/openair3/SCTP/sctp_eNB_task.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_primitives_client.c b/openair3/SCTP/sctp_primitives_client.c
index 43ca200c5a3c568ea7a468bf94c99ca90b8eb9f3..bb71a854e168d6782935bde1f92df2bd84c58076 100644
--- a/openair3/SCTP/sctp_primitives_client.c
+++ b/openair3/SCTP/sctp_primitives_client.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SCTP/sctp_primitives_client.h b/openair3/SCTP/sctp_primitives_client.h
index a50a8f1de6bedbb3401421ec5c2a7dc2b0e23bab..bec4d3ed95ac2e0d22702f03fe0f25a528a1b495 100644
--- a/openair3/SCTP/sctp_primitives_client.h
+++ b/openair3/SCTP/sctp_primitives_client.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/kdf.c b/openair3/SECU/kdf.c
index 98dfc55ae8acd922e9c71f1714e49145da952e89..1073df8ebedf7f0e6a647b183122e394ce141982 100644
--- a/openair3/SECU/kdf.c
+++ b/openair3/SECU/kdf.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -63,3 +63,43 @@ int derive_keNB(const uint8_t kasme[32], const uint32_t nas_count, uint8_t *keNB
 }
 #endif
 
+int derive_keNB_star(
+  const uint8_t *kenb_32,
+  const uint16_t pci,
+  const uint32_t earfcn_dl,
+  const bool     is_rel8_only,
+  uint8_t       *kenb_star)
+{
+  // see 33.401 section A.5 KeNB* derivation function
+  uint8_t                                 s[10] = {0};
+
+  // FC = 0x13
+  s[0] = FC_KENB_STAR;
+  // P0 = PCI (target physical cell id)
+  s[1] = (pci & 0x0000ff00) >> 8;
+  s[2] = (pci & 0x000000ff);
+  // L0 = length of PCI (i.e. 0x00 0x02)
+  s[3] = 0x00;
+  s[4] = 0x02;
+  // P1 = EARFCN-DL (target physical cell downlink frequency)
+  if (is_rel8_only) {
+    s[5] = (earfcn_dl & 0x0000ff00) >> 8;
+    s[6] = (earfcn_dl & 0x000000ff);
+	s[7] = 0x00;
+	s[8] = 0x02;
+	kdf (kenb_32, 32, s, 9, kenb_star, 32);
+  } else {
+	s[5] = (earfcn_dl & 0x00ff0000) >> 16;
+	s[6] = (earfcn_dl & 0x0000ff00) >> 8;
+	s[7] = (earfcn_dl & 0x000000ff);
+	s[8] = 0x00;
+	s[9] = 0x03;
+	kdf (kenb_32, 32, s, 10, kenb_star, 32);
+  }
+  // L1 length of EARFCN-DL (i.e. L1 = 0x00 0x02 if EARFCN-DL is between 0 and 65535, and L1 = 0x00 0x03 if EARFCN-DL is between 65536 and 262143)
+  // NOTE: The length of EARFCN-DL cannot be generally set to 3 bytes for backward compatibility reasons: A Rel-8
+  // entity (UE or eNB) would always assume an input parameter length of 2 bytes for the EARFCN-DL. This
+  // would lead to different derived keys if another entity assumed an input parameter length of 3 bytes for the
+  // EARFCN-DL.
+  return 0;
+}
diff --git a/openair3/SECU/key_nas_deriver.c b/openair3/SECU/key_nas_deriver.c
index 6268c41d4bb2c0098e77002338ff7b519cbcaedc..59546be0813c46f472dbc485173c5d72357770f7 100644
--- a/openair3/SECU/key_nas_deriver.c
+++ b/openair3/SECU/key_nas_deriver.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/key_nas_encryption.c b/openair3/SECU/key_nas_encryption.c
index 799aa020c1efe880c84bc0fdc64a5c08a8306f94..aa641137efbf987111fceb5cf016319209c83679 100644
--- a/openair3/SECU/key_nas_encryption.c
+++ b/openair3/SECU/key_nas_encryption.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/nas_stream_eea1.c b/openair3/SECU/nas_stream_eea1.c
index 095838da3759e0c24f49b4d451b598407055b674..efe924851f53a095330e40775a728c01f2ccbe96 100644
--- a/openair3/SECU/nas_stream_eea1.c
+++ b/openair3/SECU/nas_stream_eea1.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/nas_stream_eea2.c b/openair3/SECU/nas_stream_eea2.c
index 37f2e298fb2ff710ea515af1df434b8c45db6de0..0cd3d9176169fa21d3cd669e16de87b667e2c8e9 100644
--- a/openair3/SECU/nas_stream_eea2.c
+++ b/openair3/SECU/nas_stream_eea2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/nas_stream_eia1.c b/openair3/SECU/nas_stream_eia1.c
index 6f4991d63d4a406ee750e672c8597435ce393b30..629d40d612fc5323cd8756fc185d2240e17c9a91 100644
--- a/openair3/SECU/nas_stream_eia1.c
+++ b/openair3/SECU/nas_stream_eia1.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/nas_stream_eia2.c b/openair3/SECU/nas_stream_eia2.c
index 0c31767022dd797fc6e6ea8eeec9a71be69da479..a2ec6a6dd43a39c11c0677090eb854cf36bdc1a1 100644
--- a/openair3/SECU/nas_stream_eia2.c
+++ b/openair3/SECU/nas_stream_eia2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/rijndael.c b/openair3/SECU/rijndael.c
index facdced45a60d6c6baaa236daec67a8f53166db5..c245af80f19fdc233f795b4ce6cd432cf772ee0c 100644
--- a/openair3/SECU/rijndael.c
+++ b/openair3/SECU/rijndael.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/rijndael.h b/openair3/SECU/rijndael.h
index c2146c85ff5d3f21a61e5852c8da6fec8003548b..f0c090cc3f92c24bc12510ea85a4dbc85b582403 100644
--- a/openair3/SECU/rijndael.h
+++ b/openair3/SECU/rijndael.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/secu_defs.h b/openair3/SECU/secu_defs.h
index 7f8aa20e1798a0c62e7925a701cce02e632b4c35..8ec05f3dafe58afeb6ddb5cd9c542c3818487e6c 100644
--- a/openair3/SECU/secu_defs.h
+++ b/openair3/SECU/secu_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -23,6 +23,7 @@
 #define SECU_DEFS_H_
 
 #include "security_types.h"
+#include <stdbool.h>
 
 #define EIA0_ALG_ID     0x00
 #define EIA1_128_ALG_ID 0x01
@@ -44,6 +45,9 @@ void kdf(const uint8_t *key,
 
 int derive_keNB(const uint8_t kasme[32], const uint32_t nas_count, uint8_t *keNB);
 
+int derive_keNB_star(const uint8_t *kenb_32, const uint16_t pci, const uint32_t earfcn_dl,
+                      const bool is_rel8_only, uint8_t * kenb_star);
+
 int derive_key_nas(algorithm_type_dist_t nas_alg_type, uint8_t nas_enc_alg_id,
                    const uint8_t kasme[32], uint8_t *knas);
 
diff --git a/openair3/SECU/snow3g.c b/openair3/SECU/snow3g.c
index 89304b4aab4f3250fbbe9482040a658c4089405b..faab0135413a953956aea033ab00acfaea722691 100644
--- a/openair3/SECU/snow3g.c
+++ b/openair3/SECU/snow3g.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/SECU/snow3g.h b/openair3/SECU/snow3g.h
index 26b70e23859b4683e4feae01e12167c4b1b67fc8..fcad5e9f8d358ee374b9225ced9904b5ca7a96d8 100644
--- a/openair3/SECU/snow3g.h
+++ b/openair3/SECU/snow3g.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/generate_scenario.c b/openair3/TEST/EPC_TEST/generate_scenario.c
index 097cf37563bf3748d73f5d13425333a2855d753f..b8d9d9c5885d2a0c19eea56c0d1413db046e778e 100644
--- a/openair3/TEST/EPC_TEST/generate_scenario.c
+++ b/openair3/TEST/EPC_TEST/generate_scenario.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/generate_scenario.h b/openair3/TEST/EPC_TEST/generate_scenario.h
index 96b2adc7a304fbdcfec230e68add3b07dc80fd01..09fa5318ef06dc9f9d17ba8898ea85b990bc80e9 100644
--- a/openair3/TEST/EPC_TEST/generate_scenario.h
+++ b/openair3/TEST/EPC_TEST/generate_scenario.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario.c b/openair3/TEST/EPC_TEST/play_scenario.c
index 05c99d96ee6af91eab662294fb6aaf53147211fe..edb4323d5f732bcb8d78fd2cbc873ba214a1cef4 100644
--- a/openair3/TEST/EPC_TEST/play_scenario.c
+++ b/openair3/TEST/EPC_TEST/play_scenario.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario.h b/openair3/TEST/EPC_TEST/play_scenario.h
index a3a900cf7e35ce2326f8618e37ad6000840996e6..f9601fe9044aca63d522b3e4085220bec52b8d18 100644
--- a/openair3/TEST/EPC_TEST/play_scenario.h
+++ b/openair3/TEST/EPC_TEST/play_scenario.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario_decode.c b/openair3/TEST/EPC_TEST/play_scenario_decode.c
index ec5408e7696405e7dfffbe19212947955a985ac7..be63a171c5374ddeb6fa8457b9465a1a9b632155 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_decode.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_decode.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario_display.c b/openair3/TEST/EPC_TEST/play_scenario_display.c
index 294f277e7d5a194d22e2f1120b8a1f9d090ef822..e10cbdf9bf1b285d6965dcb77c3f4db80b284c84 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_display.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_display.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario_fsm.c b/openair3/TEST/EPC_TEST/play_scenario_fsm.c
index ba8edc185fb04f984f74969c704b96a9dfc584e1..1589b83cae6b58bc651f4b0debaed2e59b5a3505 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_fsm.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_fsm.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario_parse.c b/openair3/TEST/EPC_TEST/play_scenario_parse.c
index 8fb05cc9125f50d06d87e8d31c4d1cd8eb226f6f..040db30398495f51f3faf25b5bf6fb2a18604806 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_parse.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_parse.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c
index f1bbe393be8896fd2a6066b78a6073e1a677ee37..95df0fc306c0bf2ee72ca6275da11363166f693e 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -1089,6 +1089,7 @@ void *et_s1ap_eNB_task(void *arg)
 
     switch (ITTI_MSG_ID(received_msg)) {
     case TERMINATE_MESSAGE:
+      S1AP_WARN("*** Exiting S1AP thread\n");
       itti_exit_task();
       break;
 
diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
index f99f0b07763e96a77dae85987a7df9e033aefc91..08f79ef206dc245cc9ad20cbd2c4da6456d0f0cd 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h b/openair3/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h
index d7c1899c517eb7856ed222fc5f0503e8a112ddd5..532e14bb1d382c00b23cc6557c64453c59be1672 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h
+++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/EPC_TEST/play_scenario_sctp.c b/openair3/TEST/EPC_TEST/play_scenario_sctp.c
index 5bc4f918beb3378988ad181b51c7cff19108277c..8a9bc491c8d443a77ca03c2dbbb8b40f12429336 100644
--- a/openair3/TEST/EPC_TEST/play_scenario_sctp.c
+++ b/openair3/TEST/EPC_TEST/play_scenario_sctp.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/Makefile.am b/openair3/TEST/Makefile.am
index 55f7607585530498b5d7e8d307513be3739ca0b6..211c7e62f2f9c05c66474a7dd4f7046b7ad74af8 100644
--- a/openair3/TEST/Makefile.am
+++ b/openair3/TEST/Makefile.am
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/openair3/TEST/oaisim_mme_client_test.c b/openair3/TEST/oaisim_mme_client_test.c
index 75d163de210fc18871b6ca0a160a9b197e0d46de..0e89511865c71e89341cc4d27dfe144e2896ac25 100644
--- a/openair3/TEST/oaisim_mme_client_test.c
+++ b/openair3/TEST/oaisim_mme_client_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_itti_test.c b/openair3/TEST/oaisim_mme_itti_test.c
index e8de70f8e6ad1a09d257a410d811afce10b9a94c..243023e6103caeaaa18b352dc215bf9a2bffd74b 100644
--- a/openair3/TEST/oaisim_mme_itti_test.c
+++ b/openair3/TEST/oaisim_mme_itti_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_list_benchmark.c b/openair3/TEST/oaisim_mme_list_benchmark.c
index 0d5b8305b4335bba06eb265a44400c53c7e2cd1a..bfd9274b8a83bf937fa66595af1d194b329c5531 100644
--- a/openair3/TEST/oaisim_mme_list_benchmark.c
+++ b/openair3/TEST/oaisim_mme_list_benchmark.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_s1ap_test.c b/openair3/TEST/oaisim_mme_s1ap_test.c
index 968029191885ef5037717de854ca9fe7cc40b9ff..1f7c1d3bbf803f406feb710f4bed60b33e4271ed 100644
--- a/openair3/TEST/oaisim_mme_s1ap_test.c
+++ b/openair3/TEST/oaisim_mme_s1ap_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_sctp_test.c b/openair3/TEST/oaisim_mme_sctp_test.c
index 7fb56940c46d0160326b3498125739fca2c79c77..d810f9ee8f8f19936d14cb58f8c911ead3f5e1ca 100644
--- a/openair3/TEST/oaisim_mme_sctp_test.c
+++ b/openair3/TEST/oaisim_mme_sctp_test.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_test_s1c.c b/openair3/TEST/oaisim_mme_test_s1c.c
index 93275ea9feeec524716b69966b649edc508e5b2e..1f130af0d3631c052da335f450e2e3922b69a867 100644
--- a/openair3/TEST/oaisim_mme_test_s1c.c
+++ b/openair3/TEST/oaisim_mme_test_s1c.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_test_s1c.h b/openair3/TEST/oaisim_mme_test_s1c.h
index 7075f75515911c0362ad262db86840401e9fce2a..91e4472caf0ed2dccb4bf80f942072ebde9a3e6f 100644
--- a/openair3/TEST/oaisim_mme_test_s1c.h
+++ b/openair3/TEST/oaisim_mme_test_s1c.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_test_s1c_s1ap.c b/openair3/TEST/oaisim_mme_test_s1c_s1ap.c
index 16a22d3cb10dae4a48be565a16ea14231153338c..993fad2f89df6ab11e49dacfd8f82abcccded082 100644
--- a/openair3/TEST/oaisim_mme_test_s1c_s1ap.c
+++ b/openair3/TEST/oaisim_mme_test_s1c_s1ap.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_test_s1c_s1ap.h b/openair3/TEST/oaisim_mme_test_s1c_s1ap.h
index 72d808be9cd3fcfbc3acd8348ac2b465300e6d65..3633f11e867424c2d4dc904076f99d43aff9f10e 100644
--- a/openair3/TEST/oaisim_mme_test_s1c_s1ap.h
+++ b/openair3/TEST/oaisim_mme_test_s1c_s1ap.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_test_s1c_scenario.c b/openair3/TEST/oaisim_mme_test_s1c_scenario.c
index 25698edd1f89c46e6734a1745aafcdccb68fb8d4..60d74866c8cfa3b4bb8fb26127b9c6a7bb8fdb8c 100644
--- a/openair3/TEST/oaisim_mme_test_s1c_scenario.c
+++ b/openair3/TEST/oaisim_mme_test_s1c_scenario.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_test_s1c_scenario.h b/openair3/TEST/oaisim_mme_test_s1c_scenario.h
index 82950a93551170ba95729e18c1e612f7d06f2ae7..8c33f457418e8fa67ba0a84cc940a66634206d7d 100644
--- a/openair3/TEST/oaisim_mme_test_s1c_scenario.h
+++ b/openair3/TEST/oaisim_mme_test_s1c_scenario.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/oaisim_mme_test_s1c_scenario1.c b/openair3/TEST/oaisim_mme_test_s1c_scenario1.c
index 4589b2619180ec133132c259cdaeff5bd80bb555..87a63b876a3d2e774b6418b88dfc09f3f6c9e312 100644
--- a/openair3/TEST/oaisim_mme_test_s1c_scenario1.c
+++ b/openair3/TEST/oaisim_mme_test_s1c_scenario1.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_aes128_cmac_encrypt.c b/openair3/TEST/test_aes128_cmac_encrypt.c
index 085e00064782a44fa9e88af9e14a06a1da251666..666271d4e02706013ed95ff8732abad5bab9272c 100644
--- a/openair3/TEST/test_aes128_cmac_encrypt.c
+++ b/openair3/TEST/test_aes128_cmac_encrypt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_aes128_ctr_decrypt.c b/openair3/TEST/test_aes128_ctr_decrypt.c
index a30dc6c2f21c0d775cdf23775d4df44002265e01..928853c9ba67c3e2b5745c31d508fd747d321344 100644
--- a/openair3/TEST/test_aes128_ctr_decrypt.c
+++ b/openair3/TEST/test_aes128_ctr_decrypt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_aes128_ctr_encrypt.c b/openair3/TEST/test_aes128_ctr_encrypt.c
index 6c264a98a62653ff84a41482491d60469b766fff..071aa603a9aad4d5478a8ae3587a839db7dff177 100644
--- a/openair3/TEST/test_aes128_ctr_encrypt.c
+++ b/openair3/TEST/test_aes128_ctr_encrypt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_kdf.c b/openair3/TEST/test_kdf.c
index 42d91f48a588718c2a2dd214bb763d60ad8368f9..50a2ad347ab70d957778d86497cb953cf9e269ca 100644
--- a/openair3/TEST/test_kdf.c
+++ b/openair3/TEST/test_kdf.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_s1ap.c b/openair3/TEST/test_s1ap.c
index dec21ee1b6f59218efba56ad8db488b37505109a..a366796f77da1e201e73782be16e69da225f19f1 100644
--- a/openair3/TEST/test_s1ap.c
+++ b/openair3/TEST/test_s1ap.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_secu.c b/openair3/TEST/test_secu.c
index 2b1b101ae0ea47fd200a8857cdde2a092a25c624..244999e9be230ea47ecc58f98b5a0088758aef02 100644
--- a/openair3/TEST/test_secu.c
+++ b/openair3/TEST/test_secu.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_secu_kenb.c b/openair3/TEST/test_secu_kenb.c
index edab024549681c85370831818a4956621d4af834..9323062a1df5aea2b84c800f51549f63dd4c44ac 100644
--- a/openair3/TEST/test_secu_kenb.c
+++ b/openair3/TEST/test_secu_kenb.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_secu_knas.c b/openair3/TEST/test_secu_knas.c
index bcfac758ecdb6bfc7092c676864d6ba3e99f95e4..bc48eaaad191c9f3dacaffb69bfb8f76b0349a1b 100644
--- a/openair3/TEST/test_secu_knas.c
+++ b/openair3/TEST/test_secu_knas.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_secu_knas_encrypt_eea1.c b/openair3/TEST/test_secu_knas_encrypt_eea1.c
index 3335decb6e89f54e4e108eb3e51570f793d85203..aa1b57a6bab129a1b2cb840c50476bba6675d82d 100644
--- a/openair3/TEST/test_secu_knas_encrypt_eea1.c
+++ b/openair3/TEST/test_secu_knas_encrypt_eea1.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_secu_knas_encrypt_eea2.c b/openair3/TEST/test_secu_knas_encrypt_eea2.c
index e300b3b0eac4b9b7d688a9ba03bf445162dda24e..78a2b6fecc9edfee3d9d2ca6b395084ebf0e3055 100644
--- a/openair3/TEST/test_secu_knas_encrypt_eea2.c
+++ b/openair3/TEST/test_secu_knas_encrypt_eea2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_secu_knas_encrypt_eia1.c b/openair3/TEST/test_secu_knas_encrypt_eia1.c
index fbfbc35b71b1c62e69e586bdda331d468105e93a..b28d4f9888a0d17b3312157213fb3f90210e5927 100644
--- a/openair3/TEST/test_secu_knas_encrypt_eia1.c
+++ b/openair3/TEST/test_secu_knas_encrypt_eia1.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_secu_knas_encrypt_eia2.c b/openair3/TEST/test_secu_knas_encrypt_eia2.c
index 7e7517be77808a301c66ea6fca21150e2a4f39c4..9a9b7e102ee69f4f0f1ba4c237c8226c524de49d 100644
--- a/openair3/TEST/test_secu_knas_encrypt_eia2.c
+++ b/openair3/TEST/test_secu_knas_encrypt_eia2.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/TEST/test_secu_knas_stream_int.c b/openair3/TEST/test_secu_knas_stream_int.c
index 6773397085056034d28c7021a8a2e5fc75dbf86e..2fdf5fc791b2f2e7a0229438bf2f952c7ccc15f9 100644
--- a/openair3/TEST/test_secu_knas_stream_int.c
+++ b/openair3/TEST/test_secu_knas_stream_int.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UDP/udp_eNB_task.c b/openair3/UDP/udp_eNB_task.c
index de8a632111a446970db0a3a5559511a97013c46c..4d6bd6e033a45417a2044e2cfb39ffff3ac8d1c8 100644
--- a/openair3/UDP/udp_eNB_task.c
+++ b/openair3/UDP/udp_eNB_task.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -270,10 +270,21 @@ void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
             n, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
 #endif
 
-      if (itti_send_msg_to_task(udp_sock_pP->task_id, INSTANCE_DEFAULT, message_p) < 0) {
+      /* TODO: this is a hack. Let's accept failures and do nothing when
+       * it happens. Since itti_send_msg_to_task crashes when the message
+       * queue is full we wrote itti_try_send_msg_to_task that returns -1
+       * if the queue is full.
+       */
+      /* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */
+      //if (itti_send_msg_to_task(udp_sock_pP->task_id, INSTANCE_DEFAULT, message_p) < 0) {
+      if (itti_try_send_msg_to_task(udp_sock_pP->task_id, INSTANCE_DEFAULT, message_p) < 0) {
+#if 0
         LOG_I(UDP_, "Failed to send message %d to task %d\n",
               UDP_DATA_IND,
               udp_sock_pP->task_id);
+#endif
+        itti_free(TASK_UDP, message_p);
+        itti_free(TASK_UDP, forwarded_buffer);
         return;
       }
     }
@@ -389,7 +400,7 @@ void *udp_eNB_task(void *args_p)
       break;
 
       case TERMINATE_MESSAGE: {
-        LOG_W(UDP_, "Received TERMINATE_MESSAGE\n");
+        LOG_W(UDP_, " *** Exiting UDP thread\n");
         itti_exit_task();
       }
       break;
@@ -427,7 +438,7 @@ on_error:
   return NULL;
 }
 
-int udp_enb_init()
+int udp_enb_init(void)
 {
   LOG_I(UDP_, "Initializing UDP task interface\n");
   STAILQ_INIT(&udp_socket_list);
diff --git a/openair3/UDP/udp_eNB_task.h b/openair3/UDP/udp_eNB_task.h
index 2265a7a8b83bca6a71c549d8970ae7765c3aefa1..658516212574efbfb5115444d350c47e0c42828d 100644
--- a/openair3/UDP/udp_eNB_task.h
+++ b/openair3/UDP/udp_eNB_task.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/conversions.c b/openair3/UTILS/conversions.c
index 3b926de25905394b0bb9e98271f67922024cd6e9..2def84abb026a4d52780098602816d40cfa50660 100644
--- a/openair3/UTILS/conversions.c
+++ b/openair3/UTILS/conversions.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h
index da8461b390312bf2a8b5ab33ea23e00af9e4f90c..00287341b2a19f06af32ae4a136d329b73d694b2 100644
--- a/openair3/UTILS/conversions.h
+++ b/openair3/UTILS/conversions.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/enum_string.c b/openair3/UTILS/enum_string.c
index c4af7f9e0d3a0dbf685ba8fd4656d2b62c7c134c..c2eccc7a9e96fc5b099e83cd9b738ef1083aef71 100644
--- a/openair3/UTILS/enum_string.c
+++ b/openair3/UTILS/enum_string.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/enum_string.h b/openair3/UTILS/enum_string.h
index a16c33b71b936e98b7262bc63df0893540f9786f..7b53ab31e34e146addec1640416212e9aed679ac 100644
--- a/openair3/UTILS/enum_string.h
+++ b/openair3/UTILS/enum_string.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/log.c b/openair3/UTILS/log.c
index 9c7fe79ef8eeced4739579fb9775680b677cad65..5ddebd415c7e83f79248c7cbae5023641b5b84fe 100644
--- a/openair3/UTILS/log.c
+++ b/openair3/UTILS/log.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/log.h b/openair3/UTILS/log.h
index 729c12687a4908ae11aeddd49c8c810e6d8707fb..7b712df755437a9048c7204618ae5d4832c49f29 100644
--- a/openair3/UTILS/log.h
+++ b/openair3/UTILS/log.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/mcc_mnc_itu.c b/openair3/UTILS/mcc_mnc_itu.c
index 69ac1d90246c3d1ae6681011af93c34efca213ee..6b999c36df2b01e0abf8d4ab936e28fee5757aa2 100644
--- a/openair3/UTILS/mcc_mnc_itu.c
+++ b/openair3/UTILS/mcc_mnc_itu.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/mcc_mnc_itu.h b/openair3/UTILS/mcc_mnc_itu.h
index 22531aef4894e265498667d48dc0df8d4095a3f9..a6b7343b9938159e09041f2326c7921169add681 100644
--- a/openair3/UTILS/mcc_mnc_itu.h
+++ b/openair3/UTILS/mcc_mnc_itu.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/mme_config.c b/openair3/UTILS/mme_config.c
index 6b97cc674e7de02c9a209ae512aacf75d8752636..d2c25af10a25e5230cb69ac46e1ed9e3a5c0ea4d 100644
--- a/openair3/UTILS/mme_config.c
+++ b/openair3/UTILS/mme_config.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/mme_config.h b/openair3/UTILS/mme_config.h
index 448de959202df6ff06f9c2eb8ddeeb93d320a665..37b7dff8651359e6415351f3deee6bf30f1c70ab 100644
--- a/openair3/UTILS/mme_config.h
+++ b/openair3/UTILS/mme_config.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/openair3/UTILS/mme_default_values.h b/openair3/UTILS/mme_default_values.h
index 5c9ad7d3ecca1f74cbcd5eb1517f206b6acb9f01..6965c7c57c7f71fc9263aea610ed1163da478a15 100644
--- a/openair3/UTILS/mme_default_values.h
+++ b/openair3/UTILS/mme_default_values.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
index ccc559231c2557d259a3b1482cca9e983bf202fe..5ded228f6bd91428a472344c79bfde84894201d8 100644
--- a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
+++ b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h
index 11a4a98e57d266abce5390e02c1e3d0093c28d65..31a7173630801357386e9a478967ca68a20a8d4c 100644
--- a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h
+++ b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c
index a2e6d1071a05b2e2e02e7cdaa28b81f3baa963c8..7ff3b820dca5e121f585bd3b9c5a5827ddea1e95 100644
--- a/targets/ARCH/COMMON/common_lib.c
+++ b/targets/ARCH/COMMON/common_lib.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,6 +36,7 @@
 #include <string.h>
 
 #include "common_lib.h"
+#include "common/utils/load_module_shlib.h"
 
 int set_device(openair0_device *device) {
 
@@ -85,52 +86,26 @@ int set_transport(openair0_device *device) {
   }
   
 }
-
+typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *);
 /* look for the interface library and load it */
 int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * cfg, uint8_t flag) {
   
-  void *lib_handle;
-  oai_device_initfunc_t dp ;
-  oai_transport_initfunc_t tp ;
+  loader_shlibfunc_t shlib_fdesc[1];
   int ret=0;
-
+  char *libname;
   if (flag == RAU_LOCAL_RADIO_HEAD) {
-      lib_handle = dlopen(OAI_RF_LIBNAME, RTLD_LAZY);
-      if (!lib_handle) {
-		fprintf(stderr,"Unable to locate %s: HW device set to NONE_DEV.\n", OAI_RF_LIBNAME);
-		fprintf(stderr,"%s\n",dlerror());
-		return -1;
-      } 
-      
-      dp = dlsym(lib_handle,"device_init");
-      
-      if (dp != NULL ) {
-		ret = dp(device,openair0_cfg);
-		if (ret<0) {
-			fprintf(stderr, "%s %d:oai device intialization failed %s\n", __FILE__, __LINE__, dlerror());
-		}
-      } else {
-		fprintf(stderr, "%s %d:oai device intializing function not found %s\n", __FILE__, __LINE__, dlerror());
-		return -1;
-      }
+      libname=OAI_RF_LIBNAME;
+      shlib_fdesc[0].fname="device_init";
     } else {
-      lib_handle = dlopen(OAI_TP_LIBNAME, RTLD_LAZY);
-      if (!lib_handle) {
-	printf( "Unable to locate %s: transport protocol set to NONE_TP.\n", OAI_TP_LIBNAME);
-	printf( "%s\n",dlerror());
-	return -1;
-      } 
-      
-      tp = dlsym(lib_handle,"transport_init");
-      
-      if (tp != NULL ) {
-	tp(device,openair0_cfg,cfg);
-      } else {
-	fprintf(stderr, "%s %d:oai device intializing function not found %s\n", __FILE__, __LINE__, dlerror());
-	return -1;
-      }
+      libname=OAI_TP_LIBNAME;
+      shlib_fdesc[0].fname="transport_init";      
     } 
-    
+  ret=load_module_shlib(libname,shlib_fdesc,1);
+  if (ret < 0) {
+       fprintf(stderr,"Library %s couldn't be loaded\n",libname);
+  } else {
+       ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
+  }    
   return ret; 	       
 }
 
diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h
index 2603aa9b511e8bc5c81b69fbb43e09e4ca416a81..433e29e97db7b15322b51d8f3282daa91b922c09 100644
--- a/targets/ARCH/COMMON/common_lib.h
+++ b/targets/ARCH/COMMON/common_lib.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -36,9 +36,9 @@
 #include <sys/types.h>
 
 /* name of shared library implementing the radio front end */
-#define OAI_RF_LIBNAME        "liboai_device.so"
+#define OAI_RF_LIBNAME        "oai_device"
 /* name of shared library implementing the transport */
-#define OAI_TP_LIBNAME        "liboai_transpro.so"
+#define OAI_TP_LIBNAME        "oai_transpro"
 
 /* flags for BBU to determine whether the attached radio head is local or remote */
 #define RAU_LOCAL_RADIO_HEAD  0
@@ -207,6 +207,15 @@ typedef struct {
   int iq_rxrescale;
   //! Configuration file for LMS7002M
   char *configFilename;
+#if defined(USRP_REC_PLAY)
+  unsigned short sf_mode;           // 1=record, 2=replay
+  char           sf_filename[1024]; // subframes file path
+  unsigned int   sf_max;            // max number of recorded subframes
+  unsigned int   sf_loops;          // number of loops in replay mode
+  unsigned int   sf_read_delay;     // read delay in replay mode
+  unsigned int   sf_write_delay;    // write delay in replay mode
+  unsigned int   eth_mtu;           // ethernet MTU
+#endif  
 } openair0_config_t;
 
 /*! \brief RF mapping */ 
diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
index 604b260dde87bf6c6e9404fa5b365f480786ea9f..acb4c2ec9bfb7a8a7d6708c283356842f181ecf6 100644
--- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
+++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
index 82abda4d8a544555e63421607f8ebbdc606f91f1..ad5bbda3fe77e37982564880d265cd858d307a83 100644
--- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
+++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -235,7 +235,8 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
     packet_size = UDP_IF4p5_PULFFT_SIZE_BYTES(nblocks); 
   } else if (flags == IF4p5_PULTICK) {
     packet_size = UDP_IF4p5_PULTICK_SIZE_BYTES; 
-  } else if (flags == IF4p5_PRACH) {  
+  } else if ((flags >= IF4p5_PRACH)&&
+             (flags <= (IF4p5_PRACH+4))) {  
     packet_size = UDP_IF4p5_PRACH_SIZE_BYTES;   
   } else {
     printf("trx_eth_write_udp_IF4p5: unknown flags %d\n",flags);
diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
index f5bc5ea767818fcba6fb48b31db26cd7a606b20d..108c4ca069e07ee71c7b3625cb5b5b8f5c9740ad 100644
--- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
+++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -116,8 +116,8 @@ int trx_eth_start(openair0_device *device) {
     */
 
     /* adjust MTU wrt number of samples per packet */
-    /*if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0)  return -1;
-     */
+    if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0)  return -1;
+     
 
 
     
diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h
index 27e32aff115eed85ac348e89d80c5ef60736b781..8eb0e1651fb9b3dbcf5551df05d545941891404e 100644
--- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h
+++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h b/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h
index 6d0a7c02ee77c7f4afb532a3c565e2246b1eaffc..95d00290271218aa2ed72d41f03baedcd1e1b679 100644
--- a/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h
+++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DEFS/openair_device.h b/targets/ARCH/EXMIMO/DEFS/openair_device.h
index b22cf1879b6736c1452cd23aa14c19846e95ed84..f2f20d38ff051ccab5e1d3953bbc96ea39547ccb 100644
--- a/targets/ARCH/EXMIMO/DEFS/openair_device.h
+++ b/targets/ARCH/EXMIMO/DEFS/openair_device.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DEFS/pcie_interface.h b/targets/ARCH/EXMIMO/DEFS/pcie_interface.h
index 0485c154f96f9e495f2f128f4c958326c719c31c..cfc393466859cebd853abd15edfb5dfbfc1f4b71 100644
--- a/targets/ARCH/EXMIMO/DEFS/pcie_interface.h
+++ b/targets/ARCH/EXMIMO/DEFS/pcie_interface.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/defs.h b/targets/ARCH/EXMIMO/DRIVER/eurecom/defs.h
index 1665a76b081d90b1f6cf2900ee03cc1c3aa0e61c..c4adf28b82f79b006af744a7b1701a95a47e278e 100644
--- a/targets/ARCH/EXMIMO/DRIVER/eurecom/defs.h
+++ b/targets/ARCH/EXMIMO/DRIVER/eurecom/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/exmimo_fw.c b/targets/ARCH/EXMIMO/DRIVER/eurecom/exmimo_fw.c
index 766bb6eb74993c023111574f70f9099421a2dbe1..7cf5c95ecb3e8c3abe92aba71054e45dfa15a37a 100644
--- a/targets/ARCH/EXMIMO/DRIVER/eurecom/exmimo_fw.c
+++ b/targets/ARCH/EXMIMO/DRIVER/eurecom/exmimo_fw.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/extern.h b/targets/ARCH/EXMIMO/DRIVER/eurecom/extern.h
index 07e094b9664f81b689d02e6fe221e4ad23849b9e..5fc557e400629d9082c54a9c0f46269d3dcd0a22 100644
--- a/targets/ARCH/EXMIMO/DRIVER/eurecom/extern.h
+++ b/targets/ARCH/EXMIMO/DRIVER/eurecom/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c b/targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c
index 5002cccc9836730bd89e03e0387a03f716b01b4e..b5ef864b3064df8b7260428b3b13ca8eb8be7cc0 100644
--- a/targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c
+++ b/targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/irq.c b/targets/ARCH/EXMIMO/DRIVER/eurecom/irq.c
index 513adfaf96ba9ee8d64929559a70dadfd19570cb..cd21d94cb14fb223a87b3dcdee5fcbcc82031436 100644
--- a/targets/ARCH/EXMIMO/DRIVER/eurecom/irq.c
+++ b/targets/ARCH/EXMIMO/DRIVER/eurecom/irq.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/module_main.c b/targets/ARCH/EXMIMO/DRIVER/eurecom/module_main.c
index 706246b96e229eaae621bdb972aea6be998fd474..18dc9d846e438ea06f779fa40d6b37ffd7243e0f 100644
--- a/targets/ARCH/EXMIMO/DRIVER/eurecom/module_main.c
+++ b/targets/ARCH/EXMIMO/DRIVER/eurecom/module_main.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/vars.h b/targets/ARCH/EXMIMO/DRIVER/eurecom/vars.h
index 3cbaacfdcadc67421ada0de3bc73d0edd019c178..7c21bc25fcc879b70aae9b6b29e733f32bf39d54 100644
--- a/targets/ARCH/EXMIMO/DRIVER/eurecom/vars.h
+++ b/targets/ARCH/EXMIMO/DRIVER/eurecom/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/exmimo3/defs.h b/targets/ARCH/EXMIMO/DRIVER/exmimo3/defs.h
index 1665a76b081d90b1f6cf2900ee03cc1c3aa0e61c..c4adf28b82f79b006af744a7b1701a95a47e278e 100644
--- a/targets/ARCH/EXMIMO/DRIVER/exmimo3/defs.h
+++ b/targets/ARCH/EXMIMO/DRIVER/exmimo3/defs.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/exmimo3/exmimo_fw.c b/targets/ARCH/EXMIMO/DRIVER/exmimo3/exmimo_fw.c
index 6ce753cba65f02e90e47aa16a69690d6c43802b1..c6ffcb859b6f8cc6fc8f753761a3c2567cfb899b 100644
--- a/targets/ARCH/EXMIMO/DRIVER/exmimo3/exmimo_fw.c
+++ b/targets/ARCH/EXMIMO/DRIVER/exmimo3/exmimo_fw.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/exmimo3/extern.h b/targets/ARCH/EXMIMO/DRIVER/exmimo3/extern.h
index 07e094b9664f81b689d02e6fe221e4ad23849b9e..5fc557e400629d9082c54a9c0f46269d3dcd0a22 100644
--- a/targets/ARCH/EXMIMO/DRIVER/exmimo3/extern.h
+++ b/targets/ARCH/EXMIMO/DRIVER/exmimo3/extern.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/exmimo3/fileops.c b/targets/ARCH/EXMIMO/DRIVER/exmimo3/fileops.c
index 7e36b138e99410a70e3a14d27e46dab075d7ca8c..84bb83809784fb5c450bf7e5f24ed721c442c40e 100644
--- a/targets/ARCH/EXMIMO/DRIVER/exmimo3/fileops.c
+++ b/targets/ARCH/EXMIMO/DRIVER/exmimo3/fileops.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/exmimo3/irq.c b/targets/ARCH/EXMIMO/DRIVER/exmimo3/irq.c
index 513adfaf96ba9ee8d64929559a70dadfd19570cb..cd21d94cb14fb223a87b3dcdee5fcbcc82031436 100644
--- a/targets/ARCH/EXMIMO/DRIVER/exmimo3/irq.c
+++ b/targets/ARCH/EXMIMO/DRIVER/exmimo3/irq.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/exmimo3/module_main.c b/targets/ARCH/EXMIMO/DRIVER/exmimo3/module_main.c
index afea3f707c2de2b29d9ea6dd19256de12b897871..3bc6f7376691cac550b22374894cf33ba94c2eef 100644
--- a/targets/ARCH/EXMIMO/DRIVER/exmimo3/module_main.c
+++ b/targets/ARCH/EXMIMO/DRIVER/exmimo3/module_main.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/exmimo3/vars.h b/targets/ARCH/EXMIMO/DRIVER/exmimo3/vars.h
index 3cbaacfdcadc67421ada0de3bc73d0edd019c178..7c21bc25fcc879b70aae9b6b29e733f32bf39d54 100644
--- a/targets/ARCH/EXMIMO/DRIVER/exmimo3/vars.h
+++ b/targets/ARCH/EXMIMO/DRIVER/exmimo3/vars.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_dev.c b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_dev.c
index 93fe053ed1b2dbab89cb89ebda077aab83e196f2..e41b9bf6e937874133d7035a47769c867a30fbd0 100644
--- a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_dev.c
+++ b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_dev.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_drv.c b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_drv.c
index 0187959fab60600be306d1d84972dec13287e8b4..1abd44b019e577c24d666d29f1e08f56baec3195 100644
--- a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_drv.c
+++ b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_drv.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_drv.h b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_drv.h
index 6cf700400ae94ebf91ffc9c13dd96b73d4c67d42..82cb69babaf0b200a914764e4e9c1f5d58ab13b4 100644
--- a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_drv.h
+++ b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_drv.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_fifos.c b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_fifos.c
index 69103db99b57f76300f82fe837c7cdd97e07864b..6d5fa38ce4c79a941cf8c3eaffcaf23bb48aeccf 100644
--- a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_fifos.c
+++ b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_fifos.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_ioctl.c b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_ioctl.c
index 3f50766fccb151a1000c58bbdcbd7eebe384b62b..a2d4dccfb23d369dd9e4e394e5b9981a2fcddefa 100644
--- a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_ioctl.c
+++ b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_ioctl.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_mmap.c b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_mmap.c
index 065d8c9595f11323718a8cf58e442c70745d480e..48b17bbf2f7f4575f9c8561b50db2098d61b50a3 100644
--- a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_mmap.c
+++ b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_mmap.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_rw.c b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_rw.c
index d46ff92a70c28d316721be804f84bfdd90551df2..bf1be1a68f0b1cf022890426b3bfe0e68e68ea56 100644
--- a/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_rw.c
+++ b/targets/ARCH/EXMIMO/DRIVER/telecomparistech/em1_rw.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/example.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/example.c
index 1e081ae2bb665618bc4bfa897ec94d7e1baeb449..46ad06f67e59dc374b9efafb98a8fc96d30c9be3 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/LIB/example.c
+++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/example.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c
index 0b2c6afaa55c4f8ba347c7836ceaca4062b6c64f..449ac0a8e088a69565cd28752f20ebefc4dd03df 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c
+++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/gain_control.h b/targets/ARCH/EXMIMO/USERSPACE/LIB/gain_control.h
index 9524c912d70ca7633442c144a410fcc3452b220c..78f6173f3bc9b7301ded8b60bb6380940bd61e1a 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/LIB/gain_control.h
+++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/gain_control.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
index 8e07f7ac9ed66ef5c2c1db78a06ca870d27431e0..7d23cdeb8929391659e668f60c4edf118cd01891 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
+++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h
index 7c0e63290b1735fec313664645fc302640cbccd9..9211e67ec53d0e1c93b70573cb2b4dbecfde991c 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h
+++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c b/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c
index 04c0ffebbc6fd1680d5bf1b8075d6e08d043340c..1b2445fa72e512cb290a12ab3ebf80c97c3ab138 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c
+++ b/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.h b/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.h
index 1bcd2f99bed80956420bf12e517f2a983768d625..a167263969b3a9da864ddc22e40089195ecd7576 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.h
+++ b/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/Makefile b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/Makefile
index c9c5f82819e1bce3acef7db958e2a19b37bca99a..77b3d41f25fb2f39d20e77cb94723ce7021a7805 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/Makefile
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/Makefile
@@ -1,5 +1,5 @@
 CC = gcc
-CFLAGS = -DUSER_MODE -DEXMIMO -g 
+CFLAGS = -DEXMIMO -g 
 XTRA_CFLAGS = -msse -msse2 -mssse3 -fPIC
 
 #ifndef OPENAIR0_DIR
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/gpib_send.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/gpib_send.cc
index 64e795acc153fb07860637af5bf5e74ccf1aa86f..21bab68d951d297cea78a19bf7f5bf5a9566d6cd 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/gpib_send.cc
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/gpib_send.cc
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf.h b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf.h
index 204fca6afd6a84e56e89987204dab134037f4695..7b95444163def96613e6e4605502a0269ad30599 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf.h
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_config_exmimo.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_config_exmimo.cc
index 73a655075ceedecb1812c49922962f077d1350bc..ccfe306ef6bd5da0af16037d56fa66045eca41b8 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_config_exmimo.cc
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_config_exmimo.cc
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc
index b8ed0e92e5dc48619bffbdfddd053164798acad9..79facd431fc9dd550e3e70474252e2e040e8024f 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_num_detected_cards.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_num_detected_cards.cc
index 1a92096249dde4714ed6ed1685eb073cdc121f9d..2fa90ab6f2da8957a813bbf952459f1c0fb774e4 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_num_detected_cards.cc
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_num_detected_cards.cc
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_send_frame.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_send_frame.cc
index 5a425c9253bd7d3af72e83ef7c76596c1bf7f66c..1ebe3aeb4e306784f25d5d5f9430f2a495d9628c 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_send_frame.cc
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_send_frame.cc
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_stop.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_stop.cc
index 608b5d1b9b3ece54884b3c0b38420e601b76581c..b2d73c8329b3f09e7b1deec972946824dde5f5b6 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_stop.cc
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_stop.cc
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_stop_without_reset.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_stop_without_reset.cc
index 02ee33c84076ac96bcc90a49d312e75e1ac59ee3..05188405e6712461bac2644ad0762c32fd3f7104 100644
--- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_stop_without_reset.cc
+++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_stop_without_reset.cc
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
index 5cbc210586d37bbf7ff00409b4ad0dbb31b8b84e..e1a1b768b27cb1413a67cbe6fb54fdea4753d098 100644
--- a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
+++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp
index f8401dc391d5f73223b20dd0c8918c9c42e8b667..6f1afe47c0da98cda5b3bcea704d48d66fbd3f36 100644
--- a/targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp
+++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
index e9b8131d6ca1d7ce9ca67b2d28537dba07607601..a99c9d7a5d01d95060c9909486bf6528be2b547c 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -270,11 +270,52 @@ static int sync_to_gps(openair0_device *device)
     return EXIT_SUCCESS;
 }
 
+#if defined(USRP_REC_PLAY)
+#include "usrp_lib.h"
+static FILE    *pFile = NULL;
+int             mmapfd = 0;
+struct stat     sb;
+iqrec_t        *ms_sample = NULL;                      // memory for all subframes
+unsigned int    nb_samples = 0;
+unsigned int    cur_samples = 0;
+int64_t         wrap_count = 0;
+int64_t         wrap_ts = 0;
+unsigned int    u_sf_mode = 0;                         // 1=record, 2=replay
+unsigned int    u_sf_record = 0;                       // record mode
+unsigned int    u_sf_replay = 0;                       // replay mode
+char            u_sf_filename[1024] = "";              // subframes file path
+unsigned int    u_sf_max = DEF_NB_SF;                  // max number of recorded subframes
+unsigned int    u_sf_loops = DEF_SF_NB_LOOP;           // number of loops in replay mode
+unsigned int    u_sf_read_delay = DEF_SF_DELAY_READ;   // read delay in replay mode
+unsigned int    u_sf_write_delay = DEF_SF_DELAY_WRITE; // write delay in replay mode
+
+char config_opt_sf_file[] = CONFIG_OPT_SF_FILE;
+char config_def_sf_file[] = DEF_SF_FILE;
+char config_hlp_sf_file[] = CONFIG_HLP_SF_FILE;
+char config_opt_sf_rec[] = CONFIG_OPT_SF_REC;
+char config_hlp_sf_rec[] = CONFIG_HLP_SF_REC;
+char config_opt_sf_rep[] = CONFIG_OPT_SF_REP;
+char config_hlp_sf_rep[] = CONFIG_HLP_SF_REP;
+char config_opt_sf_max[] = CONFIG_OPT_SF_MAX;
+char config_hlp_sf_max[] = CONFIG_HLP_SF_MAX;
+char config_opt_sf_loops[] = CONFIG_OPT_SF_LOOPS;
+char config_hlp_sf_loops[] = CONFIG_HLP_SF_LOOPS;
+char config_opt_sf_rdelay[] = CONFIG_OPT_SF_RDELAY;
+char config_hlp_sf_rdelay[] = CONFIG_HLP_SF_RDELAY;
+char config_opt_sf_wdelay[] = CONFIG_OPT_SF_WDELAY;
+char config_hlp_sf_wdelay[] = CONFIG_HLP_SF_WDELAY;
+
+#endif
+
 /*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error
     @param device pointer to the device structure specific to the RF hardware target
 */
 static int trx_usrp_start(openair0_device *device) {
 
+#if defined(USRP_REC_PLAY)
+    if (u_sf_mode != 2) { // not replay mode
+#endif      
+
     usrp_state_t *s = (usrp_state_t*)device->priv;
 
 
@@ -313,12 +354,21 @@ static int trx_usrp_start(openair0_device *device) {
     s->rx_count = 0;
     s->tx_count = 0;
     s->rx_timestamp = 0;
+#if defined(USRP_REC_PLAY)
+    }
+#endif      
     return 0;
 }
 /*! \brief Terminate operation of the USRP transceiver -- free all associated resources
  * \param device the hardware to use
  */
 static void trx_usrp_end(openair0_device *device) {
+#if defined(USRP_REC_PLAY) // For some ugly reason, this can be called several times...
+  static int done = 0;
+  if (done == 1) return;
+  done = 1;
+  if (u_sf_mode != 2) { // not subframes replay
+#endif  
     usrp_state_t *s = (usrp_state_t*)device->priv;
 
     s->rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
@@ -326,19 +376,60 @@ static void trx_usrp_end(openair0_device *device) {
     s->tx_md.end_of_burst = true;
     s->tx_stream->send("", 0, s->tx_md);
     s->tx_md.end_of_burst = false;
-
+#if defined(USRP_REC_PLAY)
+    }
+#endif
+#if defined(USRP_REC_PLAY)
+    if (u_sf_mode == 1) { // subframes store
+      pFile = fopen (u_sf_filename,"wb+");
+      if (pFile == NULL) {
+	std::cerr << "Cannot open " << u_sf_filename << std::endl;
+      } else {
+	unsigned int i = 0;
+	unsigned int modu = 0;
+	if ((modu = nb_samples % 10) != 0) {
+	  nb_samples -= modu; // store entire number of frames
+	}
+	std::cerr << "Writing " << nb_samples << " subframes to " << u_sf_filename << " ..." << std::endl;
+	for (i = 0; i < nb_samples; i++) {
+	  fwrite(ms_sample+i, sizeof(unsigned char), sizeof(iqrec_t), pFile);
+	}
+	fclose (pFile);
+	std::cerr << "File " << u_sf_filename << " closed." << std::endl;
+      }
+    }
+    if (u_sf_mode == 1) { // record
+      if (ms_sample != NULL) {
+	free((void*)ms_sample);
+	ms_sample = NULL;
+      }
+    }
+    if (u_sf_mode == 2) { // replay
+      if (ms_sample != MAP_FAILED) {
+	munmap(ms_sample, sb.st_size);
+	ms_sample = NULL;
+      }
+      if (mmapfd != 0) {
+	close(mmapfd);
+	mmapfd = 0;
+      }
+    }
+#endif    
 }
 
 /*! \brief Called to send samples to the USRP RF target
       @param device pointer to the device structure specific to the RF hardware target
-      @param timestamp The timestamp at whicch the first sample MUST be sent
+      @param timestamp The timestamp at which the first sample MUST be sent
       @param buff Buffer which holds the samples
       @param nsamps number of samples to be sent
-      @param antenna_id index of the antenna if the device has multiple anteannas
+      @param antenna_id index of the antenna if the device has multiple antennas
       @param flags flags must be set to TRUE if timestamp parameter needs to be applied
 */
 static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
   int ret=0;
+#if defined(USRP_REC_PLAY)
+  if (u_sf_mode != 2) { // not replay mode
+#endif    
   usrp_state_t *s = (usrp_state_t*)device->priv;
   
   int nsamps2;  // aligned to upper 32 or 16 byte boundary
@@ -405,6 +496,15 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
   
   if (ret != nsamps)
     LOG_E(PHY,"[xmit] tx samples %d != %d\n",ret,nsamps);
+#if defined(USRP_REC_PLAY)
+  } else {
+    struct timespec req;
+    req.tv_sec = 0;
+    req.tv_nsec = u_sf_write_delay * 1000;
+    nanosleep(&req, NULL);
+    ret = nsamps;
+  }
+#endif    
 
   return ret;
 }
@@ -421,9 +521,12 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
  * \returns the number of sample read
 */
 static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
-    usrp_state_t *s = (usrp_state_t*)device->priv;
-    int samples_received=0,i,j;
-    int nsamps2;  // aligned to upper 32 or 16 byte boundary
+  usrp_state_t *s = (usrp_state_t*)device->priv;
+  int samples_received=0,i,j;
+  int nsamps2;  // aligned to upper 32 or 16 byte boundary
+#if defined(USRP_REC_PLAY)
+  if (u_sf_mode != 2) { // not replay mode
+#endif    
 #if defined(__x86_64) || defined(__i386__)
 #ifdef __AVX2__
     nsamps2 = (nsamps+7)>>3;
@@ -490,7 +593,45 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
     s->rx_count += nsamps;
     s->rx_timestamp = s->rx_md.time_spec.to_ticks(s->sample_rate);
     *ptimestamp = s->rx_timestamp;
-    return samples_received;
+#if defined (USRP_REC_PLAY)
+  }
+#endif    
+#if defined(USRP_REC_PLAY)
+  if (u_sf_mode == 1) { // record mode
+    // Copy subframes to memory (later dump on a file)
+    if (nb_samples < u_sf_max) {
+      (ms_sample+nb_samples)->header = BELL_LABS_IQ_HEADER; 
+      (ms_sample+nb_samples)->ts = *ptimestamp;
+      memcpy((ms_sample+nb_samples)->samples, buff[0], nsamps*4);
+      nb_samples++;
+    }
+  } else if (u_sf_mode == 2) { // replay mode
+    if (cur_samples == nb_samples) {
+      cur_samples = 0;
+      wrap_count++;
+      if (wrap_count == u_sf_loops) {
+	std::cerr << "USRP device terminating subframes replay mode after " << u_sf_loops << " loops." << std::endl;
+	return 0; // should make calling process exit
+      }
+      wrap_ts = wrap_count * (nb_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000));
+    }
+    if (cur_samples < nb_samples) {
+      *ptimestamp = (ms_sample[0].ts + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000))) + wrap_ts;
+      if (cur_samples == 0) {
+	std::cerr << "starting subframes file with wrap_count=" << wrap_count << " wrap_ts=" << wrap_ts
+		  << " ts=" << *ptimestamp << std::endl;
+      }
+      memcpy(buff[0], &ms_sample[cur_samples].samples[0], nsamps*4);
+      cur_samples++;
+    }
+    struct timespec req;
+    req.tv_sec = 0;
+    req.tv_nsec = u_sf_read_delay * 1000;
+    nanosleep(&req, NULL);
+    return nsamps;
+  }
+#endif
+  return samples_received;
 }
 
 /*! \brief Compares two variables within precision
@@ -684,12 +825,132 @@ int trx_usrp_reset_stats(openair0_device* device) {
     return(0);
 }
 
+#if defined(USRP_REC_PLAY)
+extern "C" {
+/*! \brief Initializer for USRP record/playback config
+ * \param parameter array description
+ * \returns  0 on success
+ */
+int trx_usrp_recplay_config_init(paramdef_t *usrp_recplay_params) {
+    // --subframes-file
+    memcpy(usrp_recplay_params[0].optname, config_opt_sf_file, strlen(config_opt_sf_file));
+    usrp_recplay_params[0].helpstr = config_hlp_sf_file;
+    usrp_recplay_params[0].paramflags=PARAMFLAG_NOFREE;
+    usrp_recplay_params[0].strptr=(char **)&u_sf_filename;
+    usrp_recplay_params[0].defstrval = NULL;
+    usrp_recplay_params[0].type=TYPE_STRING;
+    usrp_recplay_params[0].numelt=sizeof(u_sf_filename);
+    // --subframes-record
+    memcpy(usrp_recplay_params[1].optname, config_opt_sf_rec, strlen(config_opt_sf_rec));
+    usrp_recplay_params[1].helpstr = config_hlp_sf_rec;
+    usrp_recplay_params[1].paramflags=PARAMFLAG_BOOL;
+    usrp_recplay_params[1].uptr=&u_sf_record;
+    usrp_recplay_params[1].defuintval=0;
+    usrp_recplay_params[1].type=TYPE_UINT;
+    usrp_recplay_params[1].numelt=0;
+    // --subframes-replay
+    memcpy(usrp_recplay_params[2].optname, config_opt_sf_rep, strlen(config_opt_sf_rep));
+    usrp_recplay_params[2].helpstr = config_hlp_sf_rep;
+    usrp_recplay_params[2].paramflags=PARAMFLAG_BOOL;
+    usrp_recplay_params[2].uptr=&u_sf_replay;
+    usrp_recplay_params[2].defuintval=0;
+    usrp_recplay_params[2].type=TYPE_UINT;
+    usrp_recplay_params[2].numelt=0;
+    // --subframes-max
+    memcpy(usrp_recplay_params[3].optname, config_opt_sf_max, strlen(config_opt_sf_max));
+    usrp_recplay_params[3].helpstr = config_hlp_sf_max;
+    usrp_recplay_params[3].paramflags=0;
+    usrp_recplay_params[3].uptr=&u_sf_max;
+    usrp_recplay_params[3].defuintval=DEF_NB_SF;
+    usrp_recplay_params[3].type=TYPE_UINT;
+    usrp_recplay_params[3].numelt=0;
+    // --subframes-loops
+    memcpy(usrp_recplay_params[4].optname, config_opt_sf_loops, strlen(config_opt_sf_loops));
+    usrp_recplay_params[4].helpstr = config_hlp_sf_loops;
+    usrp_recplay_params[4].paramflags=0;
+    usrp_recplay_params[4].uptr=&u_sf_loops;
+    usrp_recplay_params[4].defuintval=DEF_SF_NB_LOOP;
+    usrp_recplay_params[4].type=TYPE_UINT;
+    usrp_recplay_params[4].numelt=0;
+    // --subframes-read-delay
+    memcpy(usrp_recplay_params[5].optname, config_opt_sf_rdelay, strlen(config_opt_sf_rdelay));
+    usrp_recplay_params[5].helpstr = config_hlp_sf_rdelay;
+    usrp_recplay_params[5].paramflags=0;
+    usrp_recplay_params[5].uptr=&u_sf_read_delay;
+    usrp_recplay_params[5].defuintval=DEF_SF_DELAY_READ;
+    usrp_recplay_params[5].type=TYPE_UINT;
+    usrp_recplay_params[5].numelt=0;
+    // --subframes-write-delay
+    memcpy(usrp_recplay_params[6].optname, config_opt_sf_wdelay, strlen(config_opt_sf_wdelay));
+    usrp_recplay_params[6].helpstr = config_hlp_sf_wdelay;
+    usrp_recplay_params[6].paramflags=0;
+    usrp_recplay_params[6].uptr=&u_sf_write_delay;
+    usrp_recplay_params[6].defuintval=DEF_SF_DELAY_WRITE;
+    usrp_recplay_params[6].type=TYPE_UINT;
+    usrp_recplay_params[6].numelt=0;
+
+    return 0; // always ok
+}
+}
+#endif
+
 extern "C" {
     /*! \brief Initialize Openair USRP target. It returns 0 if OK
     * \param device the hardware to use
          * \param openair0_cfg RF frontend parameters set by application
          */
     int device_init(openair0_device* device, openair0_config_t *openair0_cfg) {
+#if defined(USRP_REC_PLAY)
+      paramdef_t usrp_recplay_params[7];
+      // to check
+      static int done = 0;
+      if (done == 1) {
+	return 0;
+      } // prevent from multiple init
+      done = 1;
+      // end to check
+      memset(usrp_recplay_params, 0, 7*sizeof(paramdef_t));
+      memset(&u_sf_filename[0], 0, 1024);
+      if (trx_usrp_recplay_config_init(usrp_recplay_params) != 0) {
+	std::cerr << "USRP device record/replay mode configuration error exiting" << std::endl;
+	return -1;
+      }
+      config_process_cmdline(usrp_recplay_params,sizeof(usrp_recplay_params)/sizeof(paramdef_t),NULL);
+
+      if (strlen(u_sf_filename) == 0) {
+	(void) strcpy(u_sf_filename, DEF_SF_FILE);
+      }
+
+      if (u_sf_replay == 1) u_sf_mode = 2;
+      if (u_sf_record == 1) u_sf_mode = 1;
+      
+      if (u_sf_mode == 2) {
+	// Replay subframes from from file
+        int bw_gain_adjust=0;
+        device->openair0_cfg = openair0_cfg;
+	device->type = USRP_B200_DEV;
+	openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38;
+	bw_gain_adjust=1;
+	openair0_cfg[0].tx_sample_advance     = 80;
+	openair0_cfg[0].tx_bw                 = 20e6;
+	openair0_cfg[0].rx_bw                 = 20e6;
+        openair0_cfg[0].iq_txshift = 4;//shift
+        openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
+	set_rx_gain_offset(&openair0_cfg[0],0,bw_gain_adjust);
+        device->priv = NULL;
+        device->trx_start_func = trx_usrp_start;
+        device->trx_write_func = trx_usrp_write;
+        device->trx_read_func  = trx_usrp_read;
+        device->trx_get_stats_func = trx_usrp_get_stats;
+        device->trx_reset_stats_func = trx_usrp_reset_stats;
+        device->trx_end_func   = trx_usrp_end;
+        device->trx_stop_func  = trx_usrp_stop;
+        device->trx_set_freq_func = trx_usrp_set_freq;
+        device->trx_set_gains_func   = trx_usrp_set_gains;
+        device->openair0_cfg = openair0_cfg;
+	std::cerr << "USRP device initialized in subframes replay mode for " << u_sf_loops << " loops." << std::endl;
+      } else {
+#endif
         uhd::set_thread_priority_safe(1.0);
         usrp_state_t *s = (usrp_state_t*)calloc(sizeof(usrp_state_t),1);
         
@@ -705,6 +966,11 @@ extern "C" {
         int vers=0,subvers=0,subsubvers=0;
         int bw_gain_adjust=0;
 
+#if defined(USRP_REC_PLAY)
+	if (u_sf_mode == 1) {
+	  std::cerr << "USRP device initialized in subframes record mode" << std::endl;
+	}
+#endif	
         sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers);
         LOG_I(PHY,"Checking for USRPs : UHD %s (%d.%d.%d)\n",
               uhd::get_version_string().c_str(),vers,subvers,subsubvers);
@@ -748,6 +1014,12 @@ extern "C" {
 
             openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
 
+#if defined(USRP_REC_PLAY)
+	    std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; // Bell Labs info
+#endif
+
+            LOG_I(PHY,"%s() sample_rate:%u\n", __FUNCTION__, (int)openair0_cfg[0].sample_rate);
+
             switch ((int)openair0_cfg[0].sample_rate) {
 			case 122880000:
                 // from usrp_time_offset
@@ -820,9 +1092,15 @@ extern "C" {
             if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
                 openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
                 bw_gain_adjust=0;
+#if defined(USRP_REC_PLAY)
+		std::cerr << "-- Using calibration table: calib_table_b210" << std::endl; // Bell Labs info
+#endif		
             } else {
                 openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38;
                 bw_gain_adjust=1;
+#if defined(USRP_REC_PLAY)
+		std::cerr << "-- Using calibration table: calib_table_b210_38" << std::endl; // Bell Labs info
+#endif		
             }
 
             switch ((int)openair0_cfg[0].sample_rate) {
@@ -898,6 +1176,8 @@ extern "C" {
                 s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i);
                 s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i);
                 s->usrp->set_tx_gain(gain_range_tx.stop()-openair0_cfg[0].tx_gain[i],i);
+
+                LOG_I(PHY,"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf\n", gain_range_tx.stop()-openair0_cfg[0].tx_gain[i], gain_range_tx.stop(), openair0_cfg[0].tx_gain[i]);
             }
         }
 
@@ -984,6 +1264,45 @@ extern "C" {
            } 
         }
  
+#if defined(USRP_REC_PLAY)
+      }
+#endif
+#if defined(USRP_REC_PLAY)
+      if (u_sf_mode == 1) { // record mode	
+	ms_sample = (iqrec_t*) malloc(u_sf_max * sizeof(iqrec_t));
+	if (ms_sample == NULL) {
+	  std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl;
+	  exit(-1);
+	}
+	memset(ms_sample, 0, u_sf_max * BELL_LABS_IQ_BYTES_PER_SF);
+      }
+      if (u_sf_mode == 2) {
+	// use mmap
+	mmapfd = open(u_sf_filename, O_RDONLY | O_LARGEFILE);
+	if (mmapfd != 0) {
+	  fstat(mmapfd, &sb);
+	  std::cerr << "Loading subframes using mmap() from " << u_sf_filename << " size=" << (uint64_t)sb.st_size << " bytes ..." << std::endl;
+	  ms_sample = (iqrec_t*) mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, mmapfd, 0);
+	  if (ms_sample != MAP_FAILED) {
+	    nb_samples = (sb.st_size / sizeof(iqrec_t));
+	    int aligned = (((unsigned long)ms_sample & 31) == 0)? 1:0;
+	    std::cerr<< "Loaded "<< nb_samples << " subframes." << std::endl;
+	    if (aligned == 0) {
+	      std::cerr<< "mmap address is not 32 bytes aligned, exiting." << std::endl;
+	      close(mmapfd);
+	      exit(-1);
+	    }
+	  } else {
+	    std::cerr << "Cannot mmap file, exiting." << std::endl;
+	    close(mmapfd);
+	    exit(-1);
+	  }
+	} else {
+	    std::cerr << "Cannot open " << u_sf_filename << " , exiting." << std::endl;
+	    exit(-1);
+	}
+      }
+#endif	
         return 0;
     }
 }
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
new file mode 100644
index 0000000000000000000000000000000000000000..47ba171f1b9805973d2076629037bb9e920d22c9
--- /dev/null
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
@@ -0,0 +1,89 @@
+#ifndef __USRP_LIB_H
+#define __USRP_LIB_H
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/** usrp_lib.h
+ *
+ * \author: bruno.mongazon-cazavet@nokia-bell-labs.com
+ */
+
+#if defined (USRP_REC_PLAY)
+
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "common/config/config_paramdesc.h"
+#include "common/config/config_userapi.h"
+
+#define BELL_LABS_IQ_HEADER       0xabababababababab
+#define BELL_LABS_IQ_PER_SF       7680 // Up to 5MHz bw for now
+#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
+typedef struct {
+  int64_t       header;
+  int64_t       ts;
+  int64_t       rfu1;
+  int64_t       rfu2; // pad for 256 bits alignement required by AVX2
+  unsigned char samples[BELL_LABS_IQ_BYTES_PER_SF]; // iq's for one subframe
+} iqrec_t;
+#define DEF_NB_SF           120000               // default nb of sf or ms to capture (2 minutes at 5MHz)
+#define DEF_SF_FILE         "/home/nokia/iqfile" // default subframes file name
+#define DEF_SF_DELAY_READ   400                  // default read delay  µs (860=real)
+#define DEF_SF_DELAY_WRITE  15                   // default write delay µs (15=real)
+#define DEF_SF_NB_LOOP      5                    // default nb loops
+
+
+/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
+#define CONFIG_HLP_SF_FILE      "Path of the file used for subframes record or replay"
+#define CONFIG_HLP_SF_REC       "Record subframes from USRP driver into a file for later replay"
+#define CONFIG_HLP_SF_REP       "Replay subframes into USRP driver from a file"
+#define CONFIG_HLP_SF_MAX       "Maximum count of subframes to be recorded in subframe file"
+#define CONFIG_HLP_SF_LOOPS     "Number of loops to replay of the entire subframes file"
+#define CONFIG_HLP_SF_RDELAY    "Delay in microseconds to read a subframe in replay mode"
+#define CONFIG_HLP_SF_WDELAY    "Delay in microseconds to write a subframe in replay mode"
+
+/* keyword strings for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
+#define CONFIG_OPT_SF_FILE      "subframes-file"
+#define CONFIG_OPT_SF_REC       "subframes-record"
+#define CONFIG_OPT_SF_REP       "subframes-replay"
+#define CONFIG_OPT_SF_MAX       "subframes-max"
+#define CONFIG_OPT_SF_LOOPS     "subframes-loops"
+#define CONFIG_OPT_SF_RDELAY    "subframes-read-delay"
+#define CONFIG_OPT_SF_WDELAY    "subframes-write-delay"
+
+/* For information only - the macro is not usable in C++ */
+/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                            command line parameters for USRP record/playback                                                                               */
+/*   optname                     helpstr                paramflags                      XXXptr                  defXXXval                            type           numelt   */
+/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+#define USRP_RECPLAY_PARAMS_DESC {  \
+{"subframes-file",        	 CONFIG_HLP_SF_FILE,	0,		  strptr:(char **)&u_sf_filename,       defstrval:DEF_SF_FILE, 		   TYPE_STRING,   sizeof(u_sf_filename)}, \
+{"subframes-record",      	 CONFIG_HLP_SF_REC,	PARAMFLAG_BOOL,	  uptr:&u_sf_record,	                defuintval:0,			   TYPE_UINT,	  0}, \
+{"subframes-replay",      	 CONFIG_HLP_SF_REP,	PARAMFLAG_BOOL,	  uptr:&u_sf_replay,	                defuintval:0,			   TYPE_UINT,	  0}, \
+{"subframes-max",              	 CONFIG_HLP_SF_MAX,    	0,                uptr:&u_sf_max,			defintval:DEF_NB_SF,	       	   TYPE_UINT,	  0}, \
+{"subframes-loops",           	 CONFIG_HLP_SF_LOOPS,   0,                uptr:&u_sf_loops,			defintval:DEF_SF_NB_LOOP,	   TYPE_UINT,	  0}, \
+{"subframes-read-delay",         CONFIG_HLP_SF_RDELAY,  0,                uptr:&u_sf_read_delay,	      	defintval:DEF_SF_DELAY_READ,	   TYPE_UINT,	  0}, \
+{"subframes-write-delay",        CONFIG_HLP_SF_WDELAY,  0,                uptr:&u_sf_write_delay,		defintval:DEF_SF_DELAY_WRITE,	   TYPE_UINT,	  0}, \
+}
+#endif // BELL_LABS_MUST
+#endif // __USRP_LIB_H
+
diff --git a/targets/ARCH/mobipass/interface.c b/targets/ARCH/mobipass/interface.c
index 780dd4fbc3445fe7da5f5037699618055d64c065..db186a404cbe26a709eb8006dedf555bb0ede111 100644
--- a/targets/ARCH/mobipass/interface.c
+++ b/targets/ARCH/mobipass/interface.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/mobipass/mobipass.c b/targets/ARCH/mobipass/mobipass.c
index b0a9d345223898ee5fa619536576b29564b4a479..2a91068788f9cf6dbc8fce424df74b897d3046d8 100644
--- a/targets/ARCH/mobipass/mobipass.c
+++ b/targets/ARCH/mobipass/mobipass.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/mobipass/mobipass.h b/targets/ARCH/mobipass/mobipass.h
index aeaa94838ba520a3691bfabd558110a84c47107d..2210824c13226d08e8bf91d05823876d33e418d8 100644
--- a/targets/ARCH/mobipass/mobipass.h
+++ b/targets/ARCH/mobipass/mobipass.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/mobipass/queues.c b/targets/ARCH/mobipass/queues.c
index d38969616f991b2103883ab98020fb5a69cf6f46..27c9917084c8b5e6623d9e1cf2904a58e8d87749 100644
--- a/targets/ARCH/mobipass/queues.c
+++ b/targets/ARCH/mobipass/queues.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/ARCH/mobipass/queues.h b/targets/ARCH/mobipass/queues.h
index 714cf506e5fa8ff90f8bff757127ff5dde65bdcd..e47a62273087a60010d2b40fa44a4ee635056a4c 100644
--- a/targets/ARCH/mobipass/queues.h
+++ b/targets/ARCH/mobipass/queues.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c
index d72955e35fb5468c5b6a4c0fea2d3ad3c0582230..04c503cb361d38c8d953ea89a4681200beef4ec2 100644
--- a/targets/COMMON/create_tasks.c
+++ b/targets/COMMON/create_tasks.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -42,8 +42,10 @@
 
 extern int emulate_rf;
 
-int create_tasks(uint32_t enb_nb, uint32_t ue_nb)
+int create_tasks(uint32_t enb_nb)
 {
+  LOG_D(ENB_APP, "%s(enb_nb:%d\n", __FUNCTION__, enb_nb);
+
   itti_wait_ready(1);
   if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
     LOG_E(PDCP, "Create task for L2L1 failed\n");
@@ -58,11 +60,7 @@ int create_tasks(uint32_t enb_nb, uint32_t ue_nb)
     }
   }
 
-
-# ifdef OPENAIR2
-  {
 #   if defined(ENABLE_USE_MME)
-    {
       if (enb_nb > 0) {
         if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
           LOG_E(SCTP, "Create task for SCTP failed\n");
@@ -86,19 +84,7 @@ int create_tasks(uint32_t enb_nb, uint32_t ue_nb)
         }
       }
 
-#      if defined(NAS_BUILT_IN_UE)
-      if (ue_nb > 0) {
-        nas_user_container_t *users = calloc(1, sizeof(*users));
-        if (users == NULL) abort();
-        users->count = ue_nb;
-        if (itti_create_task (TASK_NAS_UE, nas_ue_task, users) < 0) {
-          LOG_E(NAS, "Create task for NAS UE failed\n");
-          return -1;
-        }
-      }
 #      endif
-    }
-#   endif
 
     if (enb_nb > 0) {
       LOG_I(RRC,"Creating RRC eNB Task\n");
@@ -107,27 +93,8 @@ int create_tasks(uint32_t enb_nb, uint32_t ue_nb)
         LOG_E(RRC, "Create task for RRC eNB failed\n");
         return -1;
       }
-
     }
 
-    if (ue_nb > 0) {
-      if (itti_create_task (TASK_RRC_UE, rrc_ue_task, NULL) < 0) {
-        LOG_E(RRC, "Create task for RRC UE failed\n");
-        return -1;
-      }
-
-#   if ENABLE_RAL
-
-      if (itti_create_task (TASK_RAL_UE, mRAL_task, NULL) < 0) {
-        LOG_E(RAL_UE, "Create task for RAL UE failed\n");
-        return -1;
-      }
-
-#   endif
-    }
-  }
-# endif // openair2: NN: should be openair3
-
 
   itti_wait_ready(0);
 
diff --git a/targets/COMMON/create_tasks.h b/targets/COMMON/create_tasks.h
index 6545f4b9d91a10023b0cd181f929b11498270455..ff1d9ace5199fbc0dbf3bf8b9cc7a52f1db983c5 100644
--- a/targets/COMMON/create_tasks.h
+++ b/targets/COMMON/create_tasks.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -26,7 +26,8 @@
 /* External declaration of L2L1 task that depend on the target */
 extern void *l2l1_task(void *arg);
 
-int create_tasks(uint32_t enb_nb, uint32_t ue_nb);
+int create_tasks(uint32_t enb_nb);
+int create_tasks_ue(uint32_t ue_nb);
 #endif
 
 #endif /* CREATE_TASKS_H_ */
diff --git a/targets/COMMON/create_tasks_ue.c b/targets/COMMON/create_tasks_ue.c
new file mode 100644
index 0000000000000000000000000000000000000000..bd36511b524a093504730643748f55bea95254ff
--- /dev/null
+++ b/targets/COMMON/create_tasks_ue.c
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+# include "create_tasks.h"
+# include "log.h"
+
+# ifdef OPENAIR2
+#   if defined(ENABLE_USE_MME)
+#     include "sctp_eNB_task.h"
+#     include "s1ap_eNB.h"
+#     include "nas_ue_task.h"
+#     include "udp_eNB_task.h"
+#     include "gtpv1u_eNB_task.h"
+#   endif
+#   if ENABLE_RAL
+#     include "lteRALue.h"
+#     include "lteRALenb.h"
+#   endif
+#   include "RRC/LITE/defs.h"
+# endif
+# include "enb_app.h"
+
+int create_tasks_ue(uint32_t ue_nb)
+{
+  LOG_D(ENB_APP, "%s(ue_nb:%d)\n", __FUNCTION__, 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 defined(ENABLE_USE_MME)
+#      if defined(NAS_BUILT_IN_UE)
+      if (ue_nb > 0) {
+        nas_user_container_t *users = calloc(1, sizeof(*users));
+        if (users == NULL) abort();
+        users->count = ue_nb;
+        if (itti_create_task (TASK_NAS_UE, nas_ue_task, users) < 0) {
+          LOG_E(NAS, "Create task for NAS UE failed\n");
+          return -1;
+        }
+      }
+#      endif
+#      endif
+
+    if (ue_nb > 0) {
+      if (itti_create_task (TASK_RRC_UE, rrc_ue_task, NULL) < 0) {
+        LOG_E(RRC, "Create task for RRC UE failed\n");
+        return -1;
+      }
+
+    }
+
+
+  itti_wait_ready(0);
+
+  return 0;
+}
+#endif
diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h
index 63f5b96c330357d670606d49d13e9e2ed587fc1d..98de4a024f5225e7d061dc3d1ba09c2ec8802bad 100644
--- a/targets/COMMON/openairinterface5g_limits.h
+++ b/targets/COMMON/openairinterface5g_limits.h
@@ -11,7 +11,6 @@
 #        define NUMBER_OF_RU_MAX 32
 #        define NUMBER_OF_UE_MAX 20
 #        define NUMBER_OF_CONNECTED_eNB_MAX 3
-
 #        if defined(STANDALONE) && STANDALONE==1
 #                undef  NUMBER_OF_eNB_MAX
 #                undef  NUMBER_OF_UE_MAX
diff --git a/targets/DOCS/oai_L1_L2_procedures.ipe b/targets/DOCS/oai_L1_L2_procedures.ipe
new file mode 100755
index 0000000000000000000000000000000000000000..2062240c14ad8249bcfa0bf34f04ced87c2f8c61
--- /dev/null
+++ b/targets/DOCS/oai_L1_L2_procedures.ipe
@@ -0,0 +1,12461 @@
+<?xml version="1.0"?>
+<!DOCTYPE ipe SYSTEM "ipe.dtd">
+<ipe version="70107" creator="Ipe 7.2.5">
+<info created="D:20160514115229" modified="D:20171018195314"/>
+<preamble>\usepackage{setspace}\usepackage{amsmath}\usepackage{stackrel}</preamble>
+<bitmap id="1" width="418" height="289" length="22283" ColorSpace="DeviceRGB" Filter="FlateDecode" BitsPerComponent="8" encoding="base64">
+eNrsnQV3G9m2rX/Uu+/dce49p0+fhnSHwbHDDN1Jh8GOmZllmZmZmRnFZmbLJFtmtvWmVIla
+LSdpx3YcyV5z7KFRKpVKVUu1vz1Xwd4yGYlEIpFIJBKJRCKRSCQSiUQikUgkEolEIpFIJBKJ
+RCKRSCQSiUQikUgkEolEIpFIpEOrra2toaEhDdwwzdwqEomkdRocHHr+/JVEMqVRWzU+PvHs
+2QuxWEx/EIlE2qMCAwMfPvw9ISFRo7YqMjIKWxUeHkF/EIlE2otGR8du375z48atBw9+m52d
+1ZCtgrG8d+8BturOnbsTE5P0N5FIpF0rKCj41q07ly9fxavm2LmoqGjlVpGdI5FIezRyV69e
+B0+uXbvx4MHvmmDnpqZg5O5je7BV2DbYOYlEQn8WiUTai5FjCqbj4xM0x8gptyosLJz+LBKJ
+tBcjxxTYp/v3H87MzHzDrWLOyDFGjilXr964c+cenZ0jkUh7NHJK4xQXF/8NtyoyMuqjW0V2
+jkQifamRAzpUjZwm2LntRk7Vzk1O0tk5Eom0I21tbbFYXqDZtWs31Xhy/fpNzP9WxikgIBC/
+jm346Fb5+vpjy+nvI5FIO6GcSNQoEAiSkpKVxunKlWtXrlzPzs7B/Obmlm+yVU1NTfj1tLR0
+VTuH6dTUNMxvamomypFIpC9Se3vHjRu3lJRDYjgy8u2fqOrt7VO1c5ju7e2hP4tEIu1CQqFI
+jXLd3d+eJ62tbWqUa2lpoT+LRCIR5UgkEokoRyKRiHJEORKJRJQjypFIJKIcUY5EIhHliHIk
+EokoR5QjkUhEORKJRCLKkUgkohxRjkQiEeWIciQSiShHlCORSEQ5ohyJRCLKEeVIJBJRDlpZ
+WVEdynB2dnZpaYmZXltb6+rqRvlU95sjI2Ls8tzcPB0MJNJBqqKiMioqmplG9UxISJyampbJ
+B2sYDQkJ9fBgeXh48PkC1a+sr6/HxycoR1Pt7OzMyso+IpTr7Oy6e/d+T8/7LQ8NDS8rK8NE
+c3OLpaW1l5e3m5uHlZXt8PCw6rc2NzcjIiJdXd28vX1MTc0qKyvpwCORDkwpKal37z7g8XhM
+ZbSwsJyYmJienjYyMsnPLxgcHBSJRM+fv+BwuMqvwLQwizFv6+vrAcMjQrmurq7ff39kZWW9
+vr6Gt8HBoUDWwsKCsbFxc3Mzs0xGRiab7a36rfT0TABwc3MD021t7TY2touLi3TskUgHo/T0
+DHd3TxMTc8abOTg4zc3NxcXFJyYmKZfp7+/v6OhUpZyDg8Pk5PtBS7lcro+P79/+kEjUqEa5
+np7eb777fX3923pE/9xWNTY2BgQEhYSExcTEKrxcWEMDp7a2zt8/UC2xVU7DIdvY2PX19akG
+kAaVIJEOTKBZaWlZbm4ei+WFt05OLlNTU6AW40yAPoFAgDQN7k41YwXllKen4AN3QjlN8HLY
+HX+F/PzeF1BddQhFTDs4OCo/ZUpgYBAM2AfKNfn6+gFib94YDAwMIHOHyy0oKExNTcWny8vL
+YWERyPTT0tIRJZVGwUlpfUkk0sFTLjs7FxOWlpbl5RXe3r5SqRQVGQ4NM5Gxoo6DaajssD0w
+fpmZWTB7Ci8nUXo5pGOq69zY2PD19XV2dnVwcFYWY2NTwE3JE0ybmZmrLuDq6l5WVv5VdxZ0
+EgiE4Daf/74gl1Qbwys9PV35KVOEQqES6aCcp6e8OeDz+XZ29gEBgdh9THt6spiUv7m5paGh
+AQksnKqLXK6AuYeHZ0tLq3IzAMbR0VE69kikA6NcRkYmk5a+fPnq3TujpaWlysoq2A/Ailmm
+urrazc1jaGgoP7+gsLAQjgWWj8fjM5/GxydGRkaqrhPp2MzMzNTU9JSKqqqqlbkh4+UAENUF
+YBeV1ysPTECQWsba3d31+bwboWCmIyOjbt68DWTBrdnY2IL/mMD8yspKfX3D+fn5aYVg6jDH
+0tJ6bGwMC1RX1zx//mJ8fJyOPRLpYBQTE5uamsZMw6rBzMDLYRqZF/xVXFw88i9LSyuATvVb
+XC7P2NgEn4aHR5qamo+Ojv3tDzU1NatlrDCH33z3v/TqA1LXkJAwZhq0NzExQygwDUrDANvZ
+OTo5OQOD7e3tal/Mz8+3t7dn/K3yEi2JRDoADQ8PK7MneLDGxsaVldUPPqe7pKQUWSRsyfYv
+joyIi4tLsMBHP92uw3GNFSFSWlxGyFKV0wjFwsLCp767urr6mU9JJJK2i559IJFIRDminIZo
+bm5OKBQq3/b3909MTK6vr1dX1xTKVVRf3/DRLyJ6cPjKuysnJiZUb6Hp6uqamZmh8JKIckS5
+b66ent5bt+5UVb0/GRsYGFRSUiqRSH777VFCQmJ8fIKHBysmJlb1rj9Mh4aGu7l5JCYm4VMn
+J5eVlZWysjJfX3/lMpgpEAgovCSiHFHum6iqqgomraOjY3R0tL9/wMDA0MDgHXPvd3h4eEVF
+5djYmJOTk3J5ff13yqf8oPLyCkBM+TY0NGx0dKymplZ5sQZisdiNjY1UF0hEOaLcwQv2zM7O
+MTU1/cGD3woKCgcHBwMCgvPyClxc5OCKjIwG5UC8d++MuFweFBcXHxgYqHrlxd/fv7S0TG21
+ZWXlRDkSUY4o9801MzNrbGzMXP+NjIzMzc0bGBhknoWxsbGrq6tPTU2DVZNKpX/88QTZq79/
+oIuLK9za+vo60AfvNzc3HxAQCOemtmbkuaqU8/T0EolEVBdIRDmi3AFrclJiZmbOnGTLyMjM
+y8sH5Tw8PPFWLBbjIxcXt9raWrWM1cHBicPhREZGeXl51dXV5eTkhodHqCSw5fX1DfjTVTsu
+cHBwQEZMdYF0WNXY2KRGud7evm++Ve3tHWqUa2trO2p/DRJPcCw5OQXtztu3BkVFxf39/YAY
+82lxccm9ew/h6MbGxt++fdsv10Bzc8vbt/qYUq5kelpqamqenZ2DT5HePn/+YmBgYHl52dDQ
+uLKyCjNhES0sLFX7MSCRlNo4FGpo4KpRrqW57ZtvlVDYqEY5gUCoLSFVPS22R0kkkuDgECSh
+LBYbXg55aHp6uvLT4OBQwH9paclNLg+Uj55hGx8fx0pYLJavrz/cIDNzcHAQbzEzMDAEbpCq
+81HW9PR0W2tneVlVfFwSDjYfHx8vtqeLq7OTs72tvYWNnXYXO3vLd0b6ly5dVfLk8qWrxiaG
+mP9tt8rQ2OCyylZhCzHn227VDguOClsHa2cXRzc3Z08vTzabHRoanpKS3lDP6+0ZUPaIssNm
+1MfHt7q6Go7L3NwcnKf6SNpHkybgNyYlprq5uzu42LizbWKSfUrrE5p687tGS3smyodna0YX
+6qbWeVPrXK0uy7KmSl7iubMXP8DkykWdS4LO7EVZ4zfcqiVZU31T+oXzutgeBnHnz+vWilIx
+XwuiusGTrHFG5moGpdXdY2Wd4hJBR05+RXRYrKezh6WTq7wbmdycgt6ezz0srOweoaenF6Dz
+9vbZfgWBRNqdOtq7o6PiHBxtWb52RdVxneJSHLeo8osy0YJMOCsTzGzxpFu86Q0czxzJWoO2
+lyWZqIKboEY5XkcmdvYbbhWiXdeUqka5GmEK5mtJYDk4QlBwqOCAmZMJFmQiHEV4HV+qF3Xn
+peQEO7hYurq6ZmfljYrVe0EB1ohppK+hqqo6V1d3Z3fL0roE8XztovywFOEQxRE7sVJ/WAto
+Vs6JV6Mcty0DFfMbbtW8TFgrSlGjXLUgGfO1O+Cr9WgcEdslWSNazK6xspTsYDtHC1/vgLbW
+930+p6amuri4MV1FkUj7paLCUlt7W78Ql46RkgW5ZxOhFT7EZCPKaUKZXG2Y2eLD4Em3+PVN
+GbaOJoGBgXl5BU5OLqurq1QrSfulluZ2JwfnoAj33olyOLdZGX9ytf6I8A0FvmJF1lTF335e
+LmtJfl6O8622alnW1NCcpka5usbUZfl5ucNmrZHhgt6rsuackojbt+96e/tRN1CkfdHi4mJo
+SIStg3lTXwFq9IyMf3TgxpSxpbreyfKJpfqCqig1ysE1jS3W9UnKx5frDnir8Iu9krLxxfqy
+hng1ypXUxWF+32TZwW/V1y7STZ54vsbS1rC0Pq6sLsHcyhz5BVVS0l7U1tppZWWTXx4zKxN8
+29TsG/oHZEx2TqZ37t69/+AeAxNlefDw/q3bt929baUbvIM0t9ik6XWui6fV7Tu37z+8r7pV
+mL7/4P7tu7ed3C2m1riTaw2H6b+Y2eTbu5hFJnjBrKLNHZmrYQc4env7kqkj7U452fkWViYd
+wyU4nCSHqLLs4txXblnEyRPndHQuqSIOReeC3pnTF8q5CXMHfh4Mv1hcG3v65Hlsg/pW6eid
+Onm+sDr6MJ2dm1itX5SJgqPcXFiWaHBxQI6v1M9s8RZkosLKWCsrq9aWdqqzpC9SaHCET6Cz
+ZJVzNC3cXy0EZ2qN88741dkP6aqyAHFWdkazm/yDt0z4RRhIMyuDM2d01Lbq7BkdE/O30g3u
+YWqb0NTmlIYbmb0ZX6pTveYFW4uP0BabWRhVVdJdJaQdaXNz09vLNzbFF62kdJN7xBH34QKr
+qKgm5ty5i3/JDfWuXNTRqxGlfCvLhN+t4CZeuKCnlrGeP69b1hC/cFiM3LhiT3kdWa/fPusQ
+F83KBOPLH7kCPrZQZ21vlpdbSFWY9LeIc3FyyywMX0SWus4hvqnbORXjxBi5mS3+tzr3Basm
+3YSd0z9zWmWrFEZuWv5YwSExcojwwFTF23cvqvhJaG4+RUIsNrXGdXK3TEvNoopM+ozc3b1y
+SqNWZM1IBAhuanausDrm3Nn3dk5PbuQufUMjp/QwFdyEC+f1PlxjVRo50SFpX9Y50+tcazuj
+xEx/ZKafvegsP003uyVwcrMoyC+mukz6qAL8gxMzAnAsEeI+e3ZOhzFy1vZGs9/OyKmenTO1
+1GfOzsFqGsuN3CE5I4fjcFEm8g12YvnZged/e1gCdDC3klWOlb1xXS2HajRJTYnxKSHRnorn
+HylR/czZuWjYOV3dy5pg5P58KENu53T1dC/DyJUeIiOHBjctL9jc2gDg2uFNzgDdrIw/Ol9n
+am7c1UlDY5P+FI8rtHEwmZUJjs4TW7vKnhoYO3fsp1PvjZwGmF7lxVZslfzS6vphMHKAFVhd
+35T6xuB570TZzNYX3Is+riB/50iJqbm5sscS0hGXRDJtbGI0MFU1u8UnlP2tnSuoijp18nyN
+SIOeFZVfbOUkYKtK6uIOx6VV+LGe8VIgrqE5DXu0/aLqTnxgUXWcF8ubKjgJcnFyq21MR646
+ThzbgZ0bnq2KTfUZX67TnLOXsHOji7XYKvF8zSEwclOwoysNZlb66QUhn7/isINzes7FRWVU
+x4+4Ksqr2QGOi/IrDhpxtlki74xOk0vD1AYHTmNqXWO3qkGzA/jXogij2jEA88bytfMPdQam
+9nJYSjd5owt1pmbGs7NzVNOPrJaWlnAMDE5XzWzyNCHtglMalJYPaHbBFg7OVAzSVu1TGZmv
+mpMJpje54x8yzfh0PxsHY+kGb+93bC7K7/+JDfAPpsp+ZBUVGZtVHLHrpGAfLRyO88LqKGs7
+Y3tHazcPR1cPBypHoDi6uNlb2Zp5+dv2TpbObPEX5B0yJxoYvRycrpTuR8sLZzu7JbBxMOno
+6Kb6fgQllc5YWJpMrXG/eUdkyFDi0rzfvjUsLa3o6Ozu6e3v6emjcgRKf3dPX1Nza0hwhIHh
+q6GZip7x0tf6z4Vd2fO7uuLwqRyB15bl5uZBVf4IKjYmIbvk2xs5JMu8jvS3b/U7u7onJicH
+h4YGBgepHJ0yPDIinZmJi0t2dDezsjfKr4hc3NdjcnINmYLQzsn886PkkA6hkZueMTU3HF+q
+1wQjFxzlGh0dL5ma6h8YoHIEC5q2oeHhP/54Hhbn/jWaXSTCtaJ0NtuPKv6RUk52flJm4Dc3
+cswR6BvkkJdXNDo2RvX9aBY4upERsaOTY4e4QLq1/xfCJIobpy2sjCcmJFT3j44cHR07xSUz
+GnAbMCjnF+JIlDvilBseHgHlWgZzp79OZ19o0JOzgtC4U90/IurrG7BzMp3bEmjCfa07oRxq
+gXh0VKvLiFi8dxogrROPHcI4HADl0KB3ikudnZ2p+h8RJcQn51fELGrGM91/SzlUgb7+/pra
+2qLikuISrSxFxcUNHO7eT161trWXlJRqaRCYOHC43G9COeZuJTsnc7QVRICjIFdX157x8q9x
+AuRrUA7zwbcXL16xWF5eXmxtLB4erJcvX4tEjcMjI7um3Nj4uKurm4WFpZYGQREHz5evXjc2
+NanF4QAoxyStKdlB1JnwUdDMzIyNvdmUxvRc8beUQ+1OTkmNiIjU6rC7uLjV1tbthXKIj62t
+3fDwsFbHwdnZta6+4ZtQblYmaOzJ86ErrUdAnAZ+QJjrogZcXd055VLT0kNDw7S+dtfV75Fy
+9vYO3d3afQ+/k5NLfQPnm1BuaoM7tlRn62C9srJCHDj0J+XKOUma09EiUY4odzCUYw42Z3eL
+nu4+4sDhVmBAUGNvvuaMP0iUI8odJOXC41g11fXEgcMtFzfnwemqaY0ZgvCrUi42Ns7JydnZ
+2cXBQT4C++joKGaKRCLMdHFxRY3D/OLiEtWvSCQSzE9NTVPOSU5O+bASJxbLC5VSSylXW1vr
+6Ig9cWUCEhAQKJFMYT7WiWigYD4W8PDw7O7+sy/xvr5+hM7GxhZ/weTkpFZTblEmKqiMTU3J
+JA4cYi0sLNo5WU2taVCn2V+Vck+fPj9x4tTdu/dRfv31xO+/P15cXMzPL/j++x9u3ryNmVeu
+XPv++x8DAoKUX8nNzfvf//3X9es3Z2dnmTkGBoa//HKcWQnWdvv2XYaWWke5iIhI7Di2XxmQ
+t2/1NzY2Ghoafvjh52vXbjDzz5w5j90HdvCVysqqM2fOXbhwkdl3zO/s7NJeys3JhPz27JCQ
+MELBIdbgwLCLu/WMjK85/dx+bcrBhDDTmZlZP/74s0jUWFlZefr02b6+vs3NTaAM7uX48ZPt
+7R1YZmtry9DQyNbWDgwsKytnvvjunRFAx0yXlpZiJXl5+dpIuejoGD29K8pz776+fseO/Qp7
+hpiAYF1d7/FVVFT03XffV1RUYUmg79mzF+PjE4gVl8vD24KCQu2lnFTG7xwp8fambtIPs7q7
+et1ZtnMywRGh3PPnL42MjEcU8vHx/fnnXzo7O8vLK0C5oaH3d4d2dHSCcmlp6Zju7e29fPlq
+T0+PubmFmZk5swDW8OLFK2YlYWHhP/10rKKiQhsph/z93DmdoKDgmJhYTIPkDx8+Wltb4/MF
+CIi7uycwGB+f8OrV63PnLojFYqT2iJiS9jJFt6tanbFKN3l9kxWentQLkwZpclLS1bWfZ5tb
+WzrcvW3m99bRtBZRztDQ+NSpM4AYsjN4MNi2zc0tuBFUauXpNUygUqN2YzoyMhpgVHi2sosX
+9SYm5KehrK1tlCv54YefLCwskfZqI+Wwj9gR7Bd2BMXZ2aW/X94ZUUMDBxHAfIQFO4igCQRC
+JgjweEKh8NBcfZje4A7NVLu6uhBbNEc1NbXe3j77uEIBv9EnyElzbpb72pR79erN06fPcnPz
+srKya2pqkJBiZk5OLqozjBmzTHt7O6o8ZjIZ7o0btzw9WZaW1phZVCQfot3ExOzBg9+wkuzs
+7IqKyo2NDS29+gCrpqt7aWxsjMfjX7hwEZRjAlJf3wCaISEdHBy6e/c+OD8zM4P5HA4XXk41
+Rc3IyOzp6dVeyk2tc8YW6x0c7IgtmiM0soGB+9llfX0dLzTac0nWdEQo9+TJMzs7e7WZ4BUo
+19bWNjc3D7dma2sHhzM6Otbb26ejo+vg4Ojm5s5ied26dcfc3JLJWGFv9hh5jaHc5fn5eUyn
+p6f/7//+Kzw8QnGYySnX0tIqU1yA/umnX0xNzRXXqhbu3XuAgh/FtzIzM//nf/4ZFRWt3ZRb
+qreztz3KVNG0m6L3nXJ1tdywGNbXptz4cp10i7fDs39flXJ37tx7985QbWZWVtZ33/0HQEOO
+dvbs+WPHfmXSVScnZ8xRWrWgoODvvvu+r69PX//dH388PQSUCwkJ/eWXExKJvI+1zc1NeNTv
+v/+hq6uLz+eDeHy+gFkMof5//+8fzIlKLpd76dJlZOsIF5LZd++M5ubmiHJaqpaWFhh4ZIhE
+uX04+7HOLamLq+QnzcmEf8u6r0q51NS07dcEOzo6goNDwsLCQ0LCgDK4F6bWJyYmFhYWKRdD
+5fP3D+js7ELempmZfQgoh0Q1PDxSeQVBLBb7+vohXR0dHUUcxOJR5SUGeDxQDjHB24mJidjY
+OD8//+zs3NXVVa0+L3dkKdfY2Igk5dq1G/fuPeTxeBq1bUKhaH/v+edxRZHx7A1Z+8wW7+NF
+xocNw5G2l7Iqa/YNdjp54pyjqzm3PXNeJlCwjp59oGcfiHIHLZGoEUkK+Hbz5u0rV65hwt/f
+Hw134SdUWVkJc7X3gtYTamtr6+zsbG/v+FRBKoH21MXFpbu75zOLtbe3d3V1j46O7aTk5Rb5
+BDr1j1W0DOR/qnSMFPVMlPaM776IZ6p9ghxPnTx/+tQFPb0rcta1Zc59gnVEOaIcUe5rSCAQ
+2NraK/l2+fJVply/fvPGjVufKLfxKb6yX+Xq1ev46b8t2KodLrbDcuXK51Z4+crVm7duPXh4
+7/6DPZSH9xDZS5eu4Of09C4rWceT+zqhGuuIcl9EuZ6eHqIcUe4zWlpaqqmptbGxVdDs9hfB
+4QMirh1w2fcfBXxAns8UXd3LF3UuXby4h6JzCVhTjRvDukt6V1w8LYWd2bMygXLY9B32L6ft
+lEPt3nv/cjh0+/r6tDoOjo7O36p/uSNCORwhr169vX//IbzZl/KNyt4LWIc09sxpHScPi0Fp
+JTNI4k76Ci4pLX327IW9g6MjaoIWFjs7B3lfwY177SvY3d3D0NBYS4PwPg7yvoKbiXJfVWtr
+a2VlZfr6hshV4ei2WzUkkp8pB2/k9j1j/XaIuwK+Xbiga2z2Nr8ianSxVqK49rqT0W36+vuF
+IlEDh9PA4Wpn4TQ1N+99oKvOri4Ol6u1QfhkHIhyX0Orq6slJaXv3qmz7vr1W3fu3MXMjxZQ
+br/yR6xn5+fu/nYx7MKtW3d2UrAXOhf0Tp2SXxf4TDlzek8Fa9DR0VOyV8G3Cxd19Cxs3lVw
+E6SbvAWZUHl7yQ7H8ELrr+1lX0ZnPpRxIMp9TdatFRUVIYdlWIc0Ni8vTyKRjH9MExMT+Dc6
+0ZruWd3d3XgRiUQ8Hv8zEgiE8fEJDg5OmOB/dkEOh1teXrGTEhIcbutoWlgek1UU9tGSXRKW
+lB0QleQdk7z7kpjhb2Khf+GCHuPfQDxLW8NqYfKMjC/n2187fdo55UbEYu0t+0U5rQ7Cp+JA
+lPvaWllZhq/T1ze4d+9hTU2Npt3rwjyDs28rFLZEJ/nIZN2LMtEnSiNeF/ZWZLL20BjPH/9z
+Qkfn0nu+bfHnVfzbLkad5vEF1fh7amu1sVRX14gaG1GX956x1tTWaWkQPhMHotxBsW4lKyur
+ublFo7ZKS599mJcJgiLc9A1fMP7tU3zb+UiFpWVlL1++cnZ2dXV108bi5OT8+vXb7SP0fenV
+B09PlomJqZYG4X0c3rxtam454lcfmE4SVN8yczY2NpaWliHmqZMjIi2lHJjWO1mG18/z7Yvu
+JAkLC6c7SWxsbHfXHzvdSaJRlBsaGjYyMhofn2DepqVlNDQ0zM/PGxqaID5oCxwcHNva2ohy
+mkw55nDaYafrdFcwPftwFCi3vr7OPEEMn4Y9vnbthouLG/NRaGh4SUnp2NiYmZnlikLt7R3G
+xqZ777NUK1Rfz/H3D9RGytEYXkQ5opxSnZ2dlpaWHh6eDg4OtbW1g4NDXl5sUC43N08mH48j
+qry8Ynx83M7OgVleLB61srJeWFg4CpTjcLh77M6LKEeUI8odMOU2N7emp6dbWlrz8vJBMB6P
+B3xxOByYNLi1nJwcUM7Hx3dqaur16zdSqTQxMQmUm5mZefz4D2ZouZcvX2PmISabRCJRDkmw
+sbHR3NyMaBDldkE5sVgcEBDo7x/g5+fPZnsXFRUxJ3UzMrJwjGGmt7cvkgVkCirH52ZlZSXa
+WR8fP6FQxMzs6Ojw9fVj1uPt7QNYaRflUIOwp9h47BQC0tvbh5nY68DAIMxE8fLyRn1cX/+z
+D2QccrGxcZ6erJiYWFRYZmZWVrYybmFh4RMTE0Q55eWD0dFRPl+Qk5MbGBjMYnlhNxEokKqm
+pratrd3KyoZZMj+/ICcnb3Bw0N1dPvZEYWERFo6JiauoqEQ8LSwsmV41+vsHHBycAMPDSjlE
+4OnTZ8zjivj/TUxMR0bERLldUK6xsfGnn37R0dG9cuXahQsXf/zx57i4OMxHA/rzz78wt2cf
+O/br5ctXcRxi/vLyMg6tH388hjn41rFjxxkjXVBQ+P33P+jpXcbyZ86cU/aUri2UQ2b0n//8
+yOwvNv7q1es4orq7e3755TjCgpm6upewgw4Ojmtra1i+tbX12rUbx4+fQhyw/M2bt8F5zH/z
+Rl8ZN0w8fvyEGc71CFJuaWlpeHi4vr4+KSkZjQV2Ci2Cv79/RkYmnBs+Uu02HxbOyMiYsS5o
+UJClYofd3N6flGOzfX777VFDAwcZKw4/5bfMzMyRyh1iO1dWVmZsbDIxMWlu/n5Px8cnRkZG
+EFUk+ES5Haq5ueXEiVNVVdU45ObnF5AF3Lv3ABXZwMDQyMhkaWkZRSgUyh86MzaRyTsJzwAN
+EhIScQzDwJiamj958gzLwwudOnWms7ML68GheOPGLeXAhVpBOdiG+/cfoq4xQ68C7CkpqaDK
+yZOni4tLEITZ2dmgoOAffvipoqIKtgR7ff36zY6OTmAf/gQMZLInff13hoZGG3Jtwteh1Sgp
+KT0ilFtcXMQBgCMhPj4eVt/DwwOYioiIgHlrbGxC/vX50UB4PL65uSUwaGhoiCYSTkZJORxp
+Dx/+Xltbh4z10aM/AD0UNEywgkyjc4gFF/HHH0+ZIVegsLCI589fhoZGoKruLmM6mpRDRS4s
+LJZKpTiufv/9Mcr6+jpqKzOuwYfG1PvSpSsKrJnheFPORx1nxuoqLi4G5QQCEdYD13f58hUT
+EzMtopyHh+fdu/cnJyex/ciYYMMyM7PgNxCc6ur3t8EDdDCr/v6BIM7x4ydhUZRfx7eYu7kM
+DN7p6xtIFYqOjoHpBRUPK+WQs7e3d8DGh4dHwoBhs319fSMjo+BAMB8R+JLTdJtoauGHEXMk
++wUFBcAX0y+98iTVwsICgtzf39/a2oai7Wdfdyjk6bdv30POxbwNCQlLTk6RKUZmAeSJcjtR
+S0vLxYt6587pMGkmKm9ubq4iY32riilUWCw2ODj09q2+iYnp9vXAsWAN585dwCsQcf68DhyR
+FlEONQuUPnv2PLYfBgyoB9J7enpBucrKKmUKBqPLYnm1tLRiPkzL9vXAjZw6dRYrOX36HDOg
+IRzy4aAcnNjkpEQgEOTl5eNIQ7sArwXPprguUNnb27eXmzqALxxj9vaOvr4Bbm4eexw449AI
+SEd1A+hev37DnPoICwtnBv8tLCyE7yXK7dDLoWq7urrFxyfExMQ2NTUx80E5VS+HVgM2Bm03
+vNxvvz1SzsexjSZ4bW29tLTs9Omzfn4BcXHxKLsbqu8bUo7FYl++fDU2Ng4lLS1dKpWPQtjW
+1qbq5RYW5rEM9hHIQXOAlFa1wWWGbTU2Nr1//wETTLQX8LpaevXB0cl+dXV1aGgYiWRqalpg
+YAjggyQxMDAYJpbD4Q4NDe19hAs1YZ09PT1qTz0cWSE9f/NGn0lLk5KSzMzM0dCEhIQyA6/g
+6PLx8SXK7ZByqLDMAMqqAuWMjExWFeru7rl69TozzhcOeFgUVHAmoXj58jVsG+oyqjkzlOFe
+/tZvSDk3N3fVTJxRe3s7KAeAIwgrKysJCYmweeXl5UivHj9+cuvWHcB8dXUN2/yf//zEDAr8
+9q2BmZnZHg/vb0458XzNq9cvwDQPD4/g4BAkR2DdxMTE7obZJe1OGRkZkZHRqidV+Hx+fn4h
+kyXV1NSonjMhyn1GIlHjP//5HRilNv/VqzfHjv3KdHQPfOnq6jHPLyMrsbCwQmW/fv2mjo7u
+L78cZ4buQhbz3Xffd3R0ainl7Ozs4dPUTmUjM8UO6upeQhCuXbsBvFtb2zIGRigUyfs7PXUG
+cUCgHjz4TSyWX+X/448nL1681HbKjS7WWVmb7+PdWaRdaHubsr6+vl8rP1KUQ8Vxd/fYjgV4
+Ng8PFovlhU+RpChH6JPJO1ldLygoREOPTxsb32e4ra2taGuUTx1qHeUKCgoQPbXjanR0FEmB
+lxcbe4qkPicnVxWD4+PjISFhzs4uUVHRSC6YmfB7ycnJ2k45ZKwODnbEmUMsevbhW4mefdCu
+a6wkohxRjihHlCMR5YhyRDmiHIkot/P+5fa3z+SDl4uL2977l7O1tVM+46zFtKeRCklEuW2U
+KywqevbshZubh7u7VhZXV7fnz18KhaI99hXs7OxiZmaupUFQxkHU2ESUIxHl1KpAb19ffX1D
+eUVlRaVWlvKKCi6P19ffv8dxH1rb2iorq7Q0CEwceDx+Xz+NbkMiyn2kFmj72FUoex/Da2h4
+WDw6evjiQJQjEeWoHO5ClCMR5agQ5YhyJO2mXLBjfn4xUY4oR5QjHVbK+YY45uTkj42PU30/
+spQbEY/a2tk2DxDlSIeQcvMyYVyatzc7YGp6mur70SwjYnFLS7upudGAtBwgIsqRDhnlpta5
+/VPlbw1eFRaWAnTjExNIXUfHqRyVMimRiEfHHOxdo1O80OR97WGCiXJEuYMv4yv1czIBty3d
+2FTfm+2flpqVnZWflZX3kZIpL0VFJTk5BfLprF2WzMy8vLzCwsLizD2s5JAVhCI/v6igoGiP
+McHXEViEd4fryc7Oj49PsbCw9g1x3PlI5UQ5knZRTgm6QWlFXLp3UKRLRAIrIv7jJSbZ28js
+TUCYS1QS+1PL/G3BStzY1lZ2hnEpPrteySErsSk+jq7m9i5me4xJXKqPpa2hu7c1gryT5cPj
+PAMjXco5cTgAvmquSpQjymlG6spZkImWZI14XdxWMHNN1jK6WHvvwd2imhiZrGNBJlz82JJ/
+W/DdwAhXA6OXK7KmZVnj7lZyyMqWrN3Z3cLO2XRT1ra025ggmMuyJn3DF0GRrgjyDr+Fn5uV
+8Q/sGCPKEeU0uSzKGkNjPH768eQb/ed4K9lV0z+zxe8cLb558+apk+dBS8BTG0OxvwU+it+R
+pXvxks4FvYaWNLzd9eXywuroUyfO37x1C0Ge2eJpYEtKlCPKaWyRbvJ6Jkrv3ruDmnj2jE5u
+WcTirgCFb/mHOgNxZ8/qvDN+PbX21c8FaXiZXJVf5nZytzh96sKZ0xdg50C5ydUvjgnCiGAa
+GL06e/bi6ZPnA8Nd0SoR5UhEuZ2XJZkIRg50unz56rmzF2HnJr/czsHIdYiL4TQu6ly6dOkK
+1kN2Tm7kOjMRDT29yyi6upcbWtJ3ca1zUWHkEFKsCuG9dfu2ws7xiXIkotyXGTkdPVAO9Wh3
+du69kTslRyVDy3fGr460nVMxckxM5HbOibFzX2bkJKswci8RUmY9aI8Cwlw0zc4R5YhyGn5G
+7vTJ9zVRxc417NzOKYxckdzIXbz0fj1H3s4pzsjJjRwsHBMTPT1MX2poSfsiO7fwwcghpMx6
+EGQNtHNEOaKc5hq5ScbIXVJS7rLCzuWURewcUAoj58LkvMpy9r2d4x5FOyc3cgJVI/ennXM2
+nd2xnZOscRRn5P40cn/auXDNsnNEOaKcJhs5NTrJ7dy592fndnKf1cwmr2O06JaqkVMU+dm5
+c0fUzsHI8TqymDNyqjFR2LkvODunekZOdT2MneuCndvkEeVIRLnPGLmusRLQCSxSo5ye7mWg
+L6s4bCeAWpAJfYIdj/96Vq0mMpbj7bsX8uR3jXN0EDe52jC7xbd3MTshj8lfAnL50tUTx89Z
+2xvNbPL/9mIrc8bgjcGL7c0QQo2A+4Y4aU4LQpQjymlggZ2IjGchV71586ZaTbx+/QbqkZHp
+m7Glus8DSrrJ7RAXPfjt/tWr169eu35ZpVJfuXLthmLNxXWxu75PTBvLzBaf35F58+YthPHq
+1WuqscXb6zduoDS0ps/+3Vm1OZkQThh/BMKIYKr+QVgNAv7w9wed4iLp1+xphChH0u6MdbW+
+Z7y0b6qc156J+qg8SX7m1IXYVJ9RaU2nuHh0sfbzlgOfDs9WAXRiaY2Lh+WZ0+9PQ124oPvs
++eOeidLusZL+qfJd3CSm1V5uUFqJmAxJq0wtDc5+OKWGxNPQ9PWQtLJztGhQWvG3McECCB0C
+2D1e+vT5Y50Luso/yMXTSiytxU8g+BoSW6IcUU4zC/PkF1inSrnTJ89nFIasy1p32B0ZahmS
+3zVZi5ef3ekPd5KcP6/78vXTmS3erIx/pNJV5e0fiMmyrMnKzvjMGZ33l2PO6JhZGSzJGhGW
+HV6RQegQQLi1F6+eXjivq/yD2P72a7JW/ITmNB9EOaKc5p6d2+J1jBSpUS41L2jpC6/fLcpE
+nj62qpR78eoJ6uBRfvwBebqlrZEq5Uwt9UGtL71fDq/PXz5RpRzL147ulyMR5YhyRDmiHIko
+R5QjyhHlSEQ5ohxRjihHIsoR5YhyRDmiHFGOKEeUIxHliHJEOaIciShHlCPKEeVIRDmiHFGO
+KEciyhHliHJEORJRjihHlCPKkYhyRDmiHFGOKEeUI8oR5UhEOaIcUY4oRzqylAMopja4Uxsc
+ReF+qqcdyRpHWXcUbOFoEeXmZcLF94PON36mq3Ds4KxMsKRYZnLP8BxfrpuR8ZnB7vEq7+dz
++SPLID7STS4mxpflnfeCUePL2kE5ZuOX3gdWHltsP2Z+qjdU5i+Y3uAS5UgHTLmxpbo+SVnn
+aHHXaEmnuPhTvSaOzFWPL9UpvzIyX60dlFuVM7m0Pi4u1Sc+zTcmxTurOAwY2b6P4PbMJq+c
+kxCRwMopCccCqI87B85HauUal9OaEZfmixKdxC6oit4+Ztn0GlfYld3UlzctH6OH0ztRVt+U
+uvMW5NtSDtvc2JOTkOHH7GNsqk/XaPH0Ovej29k6WIAFsBgOMzQl40Q50kFRbm5LgHr95Nkj
+a3tjKzsjY7O35Q0Js5sCNbOH4sqyEvXkSjd50i1+Q0uap6/tDrtY/LaUYyyZvuFLVFugJjTG
+IyU3CBBQIwnDNN9gJxtHk7gEXwdXM3OrdwNTFVPru++fE4bQxdMSUY1N9gmJcs8uCQd/1Mgp
+H/0nyj02zXdRJoTxqxWm4KcxoRWUwz8YFOFmYPQSOxgRzwqL9UQrObPF276RxTWxhiavI+JY
+geGu+NcqeUkzm3yiHOlgKIeamFkYyvKzW5CJlMgCl1SrCUM5S1tDfmcWPkIdrBEl2zmbKhb7
+ipTDNoBRyoLlWb7qlIM7QqKtupjaJmHO6GId2CVeqJXJumWyjmVZk3ihZnSxVhWPqIk5pRG2
+jibA/qqsBW8Dwly4bRl7GcEKK3H3tua0pstk/TJZ54qsubE3F7ZZNWVG2KMSvJKyAxYUlKtv
+SnNnWx8A5VQjxgRQjXJefnY40v4S2G2tCdqdoEi37JIwxQ52rMta5d3Xz1WrBnZqg9s7WQbE
+NffnrclasExuWQTs3y5GeiXKEeV2Tbns4jAvf3v4tzFFQjq+XFdSFydZb5j9MF4MQzkbB2NB
+VzZDudrGFEc3849SDl9H1VuWNS59KDiwh2aqVCl36sS5nLJwMGdJZbH5bcPTYFVgkbLMbQg8
+vG3UKIdtVltsbLFWrTrDO5lbv4tP9yuujc2vjBqeqargJuSVR06tcuCsUJiTSwhCen4wJsYV
+u4zd3IuRY2KLdeobvnD3snHxsOweK8ksDotJ9hZ15wDO+CHwdk3WGhnP2iHlwC7mFJ+ybMna
+bRxNT38YC+PM6QsWNu82ZW2q8cevwF/95XTZcr1qxJgAqlEOtnluQ6i6GLOkGuXg35w9LMvr
+E3LLIoXd2X2TZUhLATr5Od51DhPYsoZ4B1fzuQ9DxE5vcpEFUMZKOkjKFVXHPHh4HxAztdBH
+AoJD0SfIEfWuoSUdaQXgg2WQ31nbGwm7cxjK1TV9knKARlZRmH+YS0i0B1PC4zyxwqtXrynH
+GdS5oIc8LiqerVwGxgmW8i/malMAEBmZvsGSTLF1MPn98UNd3UvKgUdv3bplZW+EDVMuA5qh
+0g1IK5WAUjiQBhMLfZhPdqADEu3OkSJk5V5+9nEpPqKeHCRZ/I4soI8dYJ9TGs4YLdRBQF6R
+Xdbtxcvh50Jj3MGuSn7SxGI9KArKxaZ4l3MT4tJ8kSDz27Jik71TcgKZjJXTku7Ksvwo5bAj
+4vkaJN2wT8q4IU988uyRckTvizqXHj/5DTORmCuX8Q91rhIkSTfem1JAplNchFjBnDNBYwKI
+YCKkzHp0L1569Pg3WwdTZWBRcHhUC5JVM01QLiLe6/XbZ75BTm5e1vkVkUMzlZiIS/UpqIoa
+nK5EYLvHSgurYzCTGQgb8URUZ2V8uvpAOkjK5ZSEu7NtxLM1PROlg9JKzPQLcaoVpaCyVHAS
+kMS5sqzwkZ2TKbwcKiAqb40wxd7ZdEb2EcrhUIQVhHFKzg5kSlp+cGSC19Wr15WV6MI5XWcP
+i6z8MOUyjNFSpdzkijz3we8i32HK2Gyti+dfx/B68bhPUt4/Va5cpneiDHNU0QQ4wO/ZOJj0
+TpYjY1Jc5mtEfSyui60RpWQUhoTFeBqbvSmsigZq2AEOcJ7Yx1VZc0ZhaGZR6Owmf28Zq00Z
+Jx6/i3oNt4ZQCLqySuvj8ioikbjB9rT05WMm21/+u0j6gFm5ifrYqIvy1HuhBhucmOmvjFtG
+foh8VJoLesrmAzFJzw/BviiXAU45bRmqFwXGlmr/jNhkGRPAp88fX1AZwwt/+thsnepi+C+A
+WfwvahlrWl4QthyeDTvYOVocHs9CVg4ao5EyMX/rF+oMj2ds/nZ8qQ4HGxZrGyoICHfF2y8d
+N4coR5TbNeWyikJRu3H44SiaWueiCkQksIZnq3CgNvfnwdFxWtOn1jhYJiTKHekPlvQOdAiM
+cP3oLRlID1FJcfwvfCio44CnWsaaXYqMtUu5DJbfXrXlt7jIN+l9WZE1sXzt1DJWeb65yVVd
+TC3NZCiH6tbYm8cMGYYfyquIKKmPreAlgmNMQgcKDUxVoDJi35u78gAK1HpeW+Yez8sB5gAa
+s2t4TckJqm9Oyy2PKOfEA2vMbS3AsqmlPtyOf4gz/JKgM/tTPwovtCC/JebP2CI5BcDVMtYN
+WeuSyjL4FalaxqoghrIwAdx2Xs5+RdasFlg1LuFI8A1xjkr0WlAcCVgALhEBBBJxqCg8Gw/J
+KVwcjhYkC9zWjDpRqoHRS7R6s1sC8nKkg/NypeE+wU4MsnAYg3JRSWy07zHJ7MGZyjlkUvIb
+unjI7HCgWtsZW9ka2TuboW5+9J4BjbvGutqACh6d5N01VsIAEPvS0JrO78xEulrXmKpECiZ6
+JsoAcGt7YzCnqS9vTsbfS2yR5gu7srvHS5jruXjtEBcNTFdgDjjAbDYaBWzP0GxVdnE4YgKf
+80V3WXzba6wwujmlESV1sUwai/XgsCmqiUGjVlAZrTid+z4OaCWTswNsHE1snUxgYmfkW9hA
+lCMdDOWYMZ37p/4yQjGOUpCBef3z/k/5fSP1gs4s1FzJOmd6c6f3kmnCXcHyiv9hMWw240wU
+12f/3ItxxTkr0H5WcSpSfsZ+r3cF189syS9hMD+BV9gbeZVX/Lpq9BSj1grhu6a/cBR7Tbgr
+WHEk1P15Q84mlxk/V81RI6TYWqZ80eYR5Yhyey84yNWyPObm1e23sOJYld+ov/VlIxHTE170
+hBc94UX6tpSj51iJckQ5ElGOKEeUI8qRiHJEOaIcUY5ElCPKEeWIciSiHFGOKEeUI8oR5Yhy
+RDkSUY4oR5QjypGIckQ5ohxRjkSUI8oR5YhyJKIcUY4oR5QjEeWIckQ5ohyJKEeUI8oR5Yhy
+RDmiHFGOUECU0zTELcua+iXlf+1F83xWceiWrH12Z/2MoRqiOm/K2tj+9qdO/km5l6+fzss7
+LBLKuy4/SnAbV1R5xGRN1mJtb3L69AfKndYxtzZYlTXPywTyzp12sB6EbkHRJ5K8z+EPlMMf
+5B3gsClrx3zNaUSIckQ5DSwgGK8jq745raAq+tq1P3tEh+UICHcVduTUCFPUhnz6yLG9xumZ
+KKvkJwk7sq0djM+dfV+jdXT0Hj/5va4prVqY3DyQP7XGOTqUm5J3yFmMmPA7sgyMXp0/p6sk
+/xuDF7z2zCp+UvtI0d/GBAs09+cjgHVNqY/++B0hVf5BNg4m+IPwE72TZRoSW6IcUU4DC4xW
+eKzniePn9PTeuzhluXTpyqnT59++ezG+VPf5QZalm7wOcdGt27fOndNVjo+jLBcvXjp79mJx
+bexHx0o4rGV2i8/vyEQ0LlzQU4vJpUvy0R90dS81tKTP/t1ogMzYRmAawrj9Dzp37uLtO7c7
+xcXSPXQLT5QjHW7KIRtCrnr/wb3zH1IhZYGvQ+UqrIpakIl2ckYuOMrt5PFzaiuRn0E6dcHY
+/M30OnfySJ2dW5UDys3L+uSJj8Tk5InzTm7ykQEnVv/+VMDUOtfI9A3C+JH1HD8XEu2+uIM/
+iChHOsrn5RZljVFJ7FPbKtHZszrvjF8hFZLsIBuSykdkKL17787FDymV0m+An+WchIWPjbNz
+2O2coLE398rVa8qzne+bD93LCAu/M2uH5hatTFlDPMKo5gmRvd67fxfpqoYYOaIcUU5zrz5s
+cAemKx78dl85mp4yGyqqiVnYsU8ALUOjPZSXHlQvKUo3eEfxMqtiPC/FMNwX1Myts4cFnN4O
+L7MidPiPTMzfnv1woVZ5mTUs1kOjLrMS5YhyGluWYOcS2aqV8YuMnKqdu3P3jvIM+SW9Kxfk
+Ri7+CBq593ZOxpfbuSt/2jndLzRyH+ycUG7nVE57Ish372mWkSPKEeU0287x+qcqHjy8r6Ow
+c4yRK6z+AiOntHMh0e6nPtwvB+9hYgEjd8TOyG2zc+5sm9MnL/xp5Nwt5YNOfsn9cgjg9DrP
+WMXOIcihMR50vxyJKPcldk4EO8fkm2fPXPxSI7fdzqmckRMdUcR9uNja2JvD2Dm9XRk5lbNz
+cczZOcbI9UyWapSRI8odmGZmZvz9/aXSGeZtbW0dj8ff3Nz08fH19GR5enphQiwWq35lcHDI
+w4OFwmJ5BQYGT05KMLO7uyc3N0+5TH5+YVtbu+ZTDlxCDVpQGbd9h2VV1jy52vDk2aPz5y5e
+vHipRpS8JetgRiD9oiKTdcSn+Z45owPXYetkgtUiHd7F9nysCKVb36xST67Wz8j4uwjIoky0
+JWv3D3U+c1oHhR1gvylrX/zy3UcYEUwbB+OzitgmpPvJ5H/QvgRWNLtPtxbvC+Xm5uZ8ff0k
+kinmbX19Awom/Pz8UUOZKjw0NKT6leHhYQ+5mCocND4+jpn9/f05ObnKZYqKiltaWg4H5bCD
+N27cws4yb2Nj49LS0hcXF1+/ftPa2trT01NZWW1lZY05yq/U1NTa2Nj39PSiICwmJqZLS0tg
+o5ubm3IZFotdVlau4ZQD38QLNQVVEdHJrOgkr+jkLyvJWX76hs9Pnjh38/aNqCRWbCr7S9eA
+kpDu4x/mdPGi3pnT5+1djJMy/Xaxku0F25OQ6SPszlTc6n+gd8AyQ1EDcfUtKfHp3tiSL934
+xAxfTz+b8+d0zp3Tcfe2wtvdBQHBtHM2Pn36vK6uHoKMUO9DbBW7U9oQgwx6ZouvHJz6G1Ju
+cnLy2rUbLi7va19iYhLKysrKy5dvmptbUIVhXSwsLAFD5VcaGjio1Ioq3JOfX2BsbLqwsNDU
+1Ojk5KJcxtfXH6DTUqxhZ8F2Ly/v6OiYurp6iUSCXUMQyssr8GlSUnJ2ds78/LyNjZ3yK6am
+pmNjY6qUCwoKUomGX2VlZXt7u7e3j3JmUFAo06BoLOXmZEJOa5qhyRtnJ7e4uMSMjOz09C8r
+mZk5mVnZ9+49CAoKzssrTE/P+tI1KEpWYWGJvb3jixcvCwqLd7UG9YJ9SU3NDA4ONzI2Ru3e
+RSq9t1sKeeL5aleWhZmZeVhYVFpa5pfHNquoqMTE1Azbj4m9hAIhff78pYOjE4K82z9IJbCK
+15iYeHs7R3Prd+3DhfK7lJcPmnKonqh0MBIxMTGojNPT04oqbF1cXIJP4VJQlpeXbWz+XC3+
+C/g35VsOh+PvH6hSW4NLSkq7urq8vNjKmcHBoQwTtE5bW1vYkaioGDhYA4N3MTFxCBHmIAl9
+9UofPM9Evc3OWV1dff78FTLZwMBAKyurkJBQ1ZUgsPhI+bagoDAlJbWjowPwZOYAiYaGxrGx
+sX19fQsLixpIOekmr3Uw7+WrF4WFpZMSyfjExNj4+C7KxORkUXFxT28vVrK7NaBIpqdFjY2V
+VVVT09O7Xsn2gk0aGByytXGKSPA4sIu2yOKn17mObmbeXgFi8Sjis7uNRygaONz6hoY9xgRf
+R2ARXsn+xRZHy8SkJDEhzdRS/2+fc9kXyk1NTcGVwXQNDg7iLSpaaGg4qAUPFh4eOTMzg7QU
+NRr5F6bz8vJBuc3NzZcvUYUDUIXhWAICAlVXCMopaysExCUkJHZ3d7PZ3sqZISFhWko5JJ6g
++uLiEqZLS0vhbJHOOzg44W1GRibYlZWVgyQUDYGBgWFVVXV9fT1eYYYBLsAtNzevqamZw+Gq
+Ui49PQMFXk4ZIvhDU1N5U45Iurl5oISFhaelpWFVvb29Uql0Y2ODWVLAb4qMZ6/L2ibXGr6o
+04m9P6jF8rWJiU6YnpH2DwzspYyIxQNDg3tZQ19//9DwMNaDiT1uzPZt6+7pNTI2auzNPpgT
+70iQS+tj4CuAAuzUXmIyPDKCsseY4OsIArZkf2M7MDgIfrI8vWPTvOf20ILI+x9YbnBw/Avl
+1tbWwFGhUJiVlR0WFuGC6ufmASuC2jo6OgoHgprFpJ+oUHFx8ahQTBVGzfX29gXlUB/X19cN
+DY0qK6uUVRiHGNIrVGGRqBErR0Kq/EUYm+TklO7uLuWZK4XBC9nJSScNFLJ1pJ+jo2OK5DQF
+IUIzoUzGEYrXr/VBP5g6Ozt75bcQZGToiBXCjhAhqVd1d2gp2trax8bGkfYqZ9rZOfT19TMJ
+MhodLpeH7yJHBgnxr6Hp8fX1TU5O9fcPdvey6R8rH12snd7kAj6LilO7mMYBsJPOPXZ3xWF4
+vsrazry5uRX1aH/BomlFMjUVEBCakOlzMI814R8MjHBJSkqDizvcgRWPjlZX19m7mEu3uF/U
+QGNhHNvSLR5itSxrkqxxbW2tYNJQrVJT0/z8/D08PFBHAgODYckwUywWw3UoaxZDOeZqAmiG
+OgX/5uTkxHzq4eH56tUbpFdLS0uqGSsgmZ+fX1tbh2ooEAhRADHlpw4Ojk1NTTAnqMKbmxvK
+eg0DqaXn5cArS0tr5Jhv3xogqopds1Zmmjdu3M7NlXu5R4/+AAOTkpKjoqLNzc2x2J9pZl39
+q1ev8RH4D0LCDG9ubmE+vLGHBwtrZrN90KbAM390A9bW1pHLNDY2AadY/rX+czeWlY2DsZuX
+dUC4S2Kmf1l9fHNf3sB0xfSGnHtMmdnivefe6j5c2OqZLLFzsO7rkzfKh7syTkxOxMQkRiV7
+HRjlvPztiorKxGOjhzuwwyPDAkGjg7PV1PrfpCE4aHHIzcr4TJ9aMNX9U+W8jszs4rDQaA83
+lvXDh7+xWOzg4FCACC4COfHW1tZnqjAslrm5JSoaEi5UQ3g5Cwsrprqhnl6/fhN4hJf7448n
+sbHyKhwTE2tmZsFcSGXE4/FevHhfheFt4OuYr2MbYGmwZpgQbJKSeFqnnp4eGFeQKiIiEsn4
+yspqS0ur8tPW1lZYLwS5uroG5hYeGO3C/PzCX28+mS0tLcNHWIDH46t+hKYnP78AK9/hxggF
+zRHx7IUNUddYSX1zalZxWES8l5efvZ2zKYqjmzk70CE2xSe/MorbltEnKWduj1+UNcq5J+MD
+g7u4oI9DrneyxN7RRo1yTHYD8zMpkWhpwcaPjY+pZmcKyiXEpLIPjHLsAPvtlBscGtLeqCpj
+q3pWAZTj80VOrtbbKSe/J3mDqzhQRYoH0xp6JkprRSlpecEBYS5O7hZ2TvJjOzDcNaMgpFaU
+amVt+XmsbavCvchDUcti5IqFu2tpaVGuob29nTl9B+eG7FVRhQtmZ+fULkEqqzCHw1X9CGkX
+qnBNTa1W3zoCXMO+wriiOejt7dWEu4JXZM0gz4fbq4Tym5HkdquM35FVVB0DynkHOLh4WsLv
+2TubsvzsQmM8MotC65pSO0aKRhdqsDzTSs4pUl2J/BRfwy4oh+y1praW7Q0j6uPt46uNhcXy
+wpGrmoZrAuWAuI7OztCwcDbbW0sDi+3GgVFbV6eMrZJy0xuwag048OYUxyFex5fq2oYKK3mJ
+8em+PkGODi5mto4mSFWCo9xzSsPRXvdPV8DRMRnr9CZf7bzc3yo8PAJZraIKm3d1ddFNvx9V
+Q0NDWVnZ5OSkxj77wJh86RZPecuu/GTabFVzfx7y2aSsgMAIV2cPS7nlczLFRFCkW3J2YDkn
+vmUgf3iuGt9lvoWvS5Wp7t9RDu21q5u7r68fmjktLUhAjIxMUBOV+6UJlBsdG0NGYGhoXCqX
+tsYW3sCT5QVHp6Qcjydy9bCdlwnQ1Db35aFFjk5ie/jY2isOS3dvm6hEdmFVdGNv7sh8NY7D
+RcUByZx7YU687Pp+OS6Xi7xV9f4u0iF4wksxGgKHaTEXFGfqkBGIF2rahguRC2QUhoZEe3j6
+2No6mVjZGYF73kh1U32KamKFXdl9krKpDY7yiygD02XbKTcxOenm5t7U1KS98VxYWLC2toV3
+0jTKZefkBgeHaPWxilQOlENTqKRcU3OL/rs3Ht7WTJaBQy4uzbeCm9g6WDC2VMdYu3nFibhP
+5Rf0hBdRbid97DC32SsuzjZiYny5rneirKElPbcsAi0p0lt7FzM0rKCfl799RIJXdkk4rz1D
+1JNl72g7MDCkRjl3d4+GBo42P8kyoZmUy8nN8/cP0OpjtaqqmuXFVqWcSNRkam5YLUjqHith
+7qJR3CHAR1u8w/4WiHJEuV08O8mkugz3mIK3/ZJyUU9OcW1sXKqPX4iTi6eVmZXB7Tt3EhKT
+UAGJckS53VEOGauLu618KKLNXd71RJQjyu3X3fjyU3ybPKapZS7Odo0WmZgZcbl81TtX94Vy
+Kysr8/PzCwphQnn/89raGmZ/6u4aLKz6mCFRbrsQyYUPQiSXlpaY+Qgp5qyurn70Wwj77Owc
+Xr8G5T51jZUoRzpgyn107Ia+qVJHZ7uhoZF9z1jDwyMuXbqCoqd3WUdH948/nopEjTL5QzQl
+V65cV+saApqenvb09MLC58/rGBmZdHZ2EuU+qqam5lu37ly5cg2x0tW9dPXq9cTExK0tmVQq
+vX37bkpK6vavZGZm3717/9y5C/fuPcjPLyDKkY4O5T51jXVfKMdme4NXgYFBISGhwcEhqIwP
+H/4OH1JYWPjrryf7+/v/auEWX716c+LEKRbLCwuj8l64cHFoaJgot10CgQCBsrd3QGBR3r0z
++vnnX5uammDqzp49HxMTq7Y85vznPz8aG5sisG/evP2f//lXZmYWUY5ElNs75cArOAflWxsb
+W0APGVNJSenp0+cGBgZUF87Ly//hh5+Ki9/3byMUiry8vEEqotx2CYXC48dPtra2MW8rKiq+
+++77srLylZWVixf14uLiVReemJjQ0dFDKJi3ICECy+XyiHIkotzeKefn53/mzDn4t6dPn718
++Qo2A3Nkip5btlMOxg/518zMDF192AHlRGgv7ty59+jRHzDAV69ee/z4yfS0dHZ2djvl+Hz+
+r7+eYHoi+npXH4hypKNJOV9fP1RGGxu7u3fvnzp1Njs7h5mfn5+/nXIsFhspLeopUW4nlDt3
+7oKhoZGhofHPP//i6OjEXK+ZnJzcTjkejwfjV15eTpQjEeX2nXJeXmzwTabo+uDatRtPnz6X
+SqUKyuWBcmrPmyQlJaPCMpcnoJaWVn39d93dPUS5T2es8meu7e0dTp8+yzwuLZFIdHR01a4+
+DA4Ooonx8fFj3m5tbVlaWtN5ORJRbr/Oy92+fXdlZUWm6G70++9/dHPzYDJW1Lu0tPQqhUpL
+y1ATJybkfVnfuHELn5aVld279+DUqTNqfo8op0o55tFyuF+krrDBsHPz83OXLl1xcnJmAgv/
+xucLgDVXV/effjoWHh4BOjk5ufzP//wLbQpRjkSU2zvlsAaAi6Ec5OnJ+uGHn5qbmysqKo8d
+O/7rryeOHfsV5R//+N/w8EiFf2t58uQZ6iMWu3PnbkNDw15+/RBTjs/n//jjz8p/p76+AW+9
+vX1APDQTysD+61///u23RzJFt+EAHcCIwML4AXfKexeJciSi3F72SCwWd3V1Ke/+XV5ebmpq
+QvYK19Ha2tbxQci8mLHPoPX19fb2dqSrCwsLdF7uU0JwEDTVTsCQ2iOSaFC6u7sRQCawbW1t
+fX39ym6I+vsHmptbhodH6LwciShHT3jRE15EORJRjihHlCPKkQ4B5QQCofbGUyqd0diel4KC
+grX7WK2rJ8qRDgHlPDxZ6ekZvVorDodraWk9NDysaZTLLyh0dnbt1WYlJaWwvX2IciStphwO
+YDbbW1//HRydlhYrKxtTU3P54IkaRrnSsvI//nji5uahvbF980bfzz+AKEc6BBmrUCjS3njO
+zMxSxvqV1NDAoYyVRFcf6OoDXX0gypGIckQ5ohxRjihHlCPKEeVIRDnNpFx+fr6bm3t8fAJz
+7/3w8LC3t4+XF7urq5tZYG1tLSwsPDIySrVr9I2NjdLSMjc3DxbLa499oB1WynV2diKMCKZY
+LJYpekGPi4tHqAsKCpXLlJdXuLq6qfVB2tnZ5efnj/lpaenKTtSJciSi3K53x9ra5l//+vel
+S1eYvkcyM7O+++77H374qazsfRdAra1tP//8y/HjJ7u733NveXnZzs7+xx9/vnbthp7e5Z9/
+/hUY/NTwEEeWcsXFxQjj99//mJubJ1P096Kjo/vPf35na2uvbCmePn32X//135GR0cpv5ebm
+njhx6sKFi4gtwv7y5WvlU3VEORJRbndydHS6fv3mo0eP6+vlD92zWOxHj/5ALUMFYRZgs33e
+vjX4/fdHkZGRzJyUlFTU3+TklNXV1dnZWUtL66dPn++6x7nDSrny8nKE8fHjJz4+vnhbXV39
+22+PwC5nZ1dmAYFAcP/+QwsLy2fPnjNP5Q8ODp09e97ExGxiYhKxRYujq6u3F6tMlCMR5WSK
+fs9QEx0cnMLDI5C0GhgYMp1qMpRbXFy8fftuRUVlaGgYquTa2jpmYhmmDw1GqI9wd5Sxqglm
+GGH09vY1MjLB26CgYEdHZ4QazQqzgIeHJ3xda2vrmTPnmHuBgLVjx35taWlVrmSPo6QR5UhE
+OQi554sXL2HPYMl6e/tev36TlyfvIpihXG1t3Y0btzAxMDBw5sz5pqZmTD979oKpuXT14fOU
+gzHLzy949ep1X1+fubllamrakyfPGMqhXbh7935lZRWmYZ7ZbG9MxMXFnzt3YXh4iK4+kIhy
++0s5VD3g6+XL1yEhoQ4Ojo2NTSdPnkGGhU+RXiHtCggI9PJinzx5OiwsHDPfvTN6+PB35Rq6
+u7tLS0t3becOMeVOnTrD5wtsbOxg5N68Mejo6Hj69Jm9vSPTfPz660kYacT23r37v//+WHFS
+Lg9errm5RWmSc3Nz1fpqJsqRiHJfKtRBeLOFhYW3b/V1dHRhJ7q6uk6cOFVf34BaduvWHeSn
+ICHoB8vx6NHjjY2N7OycH374KTExCWSbmJiAFYQDkUimiHLbKHe2t7cXIUVg37zRn5+fRwwR
+SXzq6uqO2Do5OSO25uYWCCAamqmpKUzAJ4+PjyO20dEx//jHP4uKiohyJKLcXiiHOsUM+mBr
+a/9f//XfXC4PFfO77/7T0NBQVCS/Sjg4+D6Bwtv//u9/VFRUrq+vg40//njsypVr58/r/Prr
+iZycXMpY1VRYWPTvf/+nt7evvr7+//yf/wugYebt23dtbGxBs+PHT0ZGRjFLgn5wfWAdphFJ
+NDFgHWKL4CPOyj6ciXIkotzulJ2dDVcmUzzz6O3tMzMzOz097ePj29/fX1xcgpq4sfH+FhHM
+xwIVFRUyxV0QJSWlnp4sLNnS0kLn5bYL+SmCI1UIcePx5JdK4+MTENW+vn4Wi616m1xaWnpY
+WASaD5niRjv8roeHZ15ePjOHKEciytGzD/TsA1GORJQjyhHliHIkohxRjihHlCNpGuVmZmc9
+PDz5fIH2xnN2ds7KykbTKDc2Pl5QWBQQEKjVx2p9fYOHJ4soR9JeyolHR+MTEh4+/M3MzMLN
+zV1Li7m5paWltUb1FQzk4tVWfifhU+0NrIuL6+vXb4OCQ4hyJK2mnImpGY/HHx4e7tdavX2r
+X1NbOzwyopKGf2PKDQ0PC0UixFYsHtXewHp7+7DZ3kMqJpkoR9I6ysH/2NjajY2Na3U8HRwc
+m5qbARZNo5y94vZd7VVyckp8fMLU9LQysEQ5kpZSTq13Mq2TnZ09kKKBlLOzd9DqwCYkJMbE
+xE5MThLlSEQ5ohxRjihHIsoR5YhyRDmi3OGgXEBAoJ3dx2t3Xl6+qan5HvvoPrKUW1lZMTIy
+Bnk++imb7b3v9+YR5UhEuY/KzMz8wYPf1Gaurq6mp2ecOnXm7t178/PzRLldCK2Dru4lLy+2
+2nypVOrl5f3vf/9gv9/WkShHIsp9VDY2tk+ePFObGRsbp6Oj9/Tps99/f7ywsECU2x3lbty4
+5efnrzbf1NTs1q07t2/fZTotIcqRNEE8jtA/1GVR1nh0KFdfX49fjYqKRmUkyu0j5ZiuXWDn
+DAwMEXmiHElD1NLc7uFjOy8T7fo40TrKMQoMDCLK7buXY/TixStbWzutoNz0Bnd4tsbZxZFQ
+cIjV3dXr4WU3JxNOrjYcSso9e/aCKPc1KHf9+s2goOCPfvry5WttoZx0k9c3WeHm4UYoOMQa
+HBxxZdnNygSHknJgzoMHv3Up1NkpL8oBHYhye6Qcoufo6PQhtp19ff3KQWy1iHIzW/zOkRI2
+m00oOMSam5tzcrGe3uBJ1g6nl/v3v384duw4yk8/HUNRDrbCZntfvKhH11h3p8XFxVu37iCe
+TGy///6H69dvYSbz6cOHj0xMTLWCcnMygbArJzgohFBwuOXkbD8yVzO9wT18lAPTiopKyhQq
+LZWXmZn3w0nDflRVVe2xj+4jS7mNjY26urqSklImtsXFJbW1dcxg0zJFd/SNjY1aQTn8KSW1
+CUmJqcSBwy1fX9+WgYJZGZ+efSDKaay+EuUWZKLYFN/ysiriwOFWdHRctSB1QSYkyhHljh7l
+Gl1ZVu1tncSBwy00ZFGJ3gd5y9xnKCcWj2p1MO3tHTSTctre81JSUvK+U06y3iBZ49o6Wu37
+6VmSpkksHrNxNJ3dOrjLrJ+inLmFZVtb+7z2am7e3MxCMylnZm6JzdNehYWFR0VF7y/lZrb4
+HSPFXl5eBIFDr62tLScXp6GZ6ulN3gFTrr9/ULWvYB8fX0NDY2trGy0toLSFhWVnVxfTCbkK
+5RIPknJe/vbFxeWqPaJ3dXdbWVmbm1tqaWCtrGzevNEvKi4eGx/fR8rhH8kri0pNySAIHAWF
+h0fWCA/u1Bwo1zdVamtv1dXdqwoETPf09nb3aG/pAbRVx+tBmZRMRkbGRiezlg7knAAo5x3o
+kJdXNDo2ptwGZquwedob2L7+frXADo+M8PlCO0fzqQ3Obii3Kr/04M62aW1pJwIcBYmETR7e
+tgsHYjZQkBrjsLSxN62padheGbW9qNZEBeUkzs5uueVh8wfSiOBXYlK8ggJDVTsPPxyx3R7Y
+zMw8N7b17m4PQOaC/MXG1lp5Awzp0AuZwaC0SnpQSSt8Y3KOv7WVA3IQgO5w8E2twJpOS6X5
+eUUm5vqjCzWSdc4BBHZ6g9c+XPDm7RuBsHFySsKMmXj4yvjEBPydgYFhjShxdou/y3S1PDoh
+Ppnq/tER/u68sugDu9I6udaAvNXT19bS0raultPXN4DSe1iKfHf6Bzu7euLikl++es5rT5+T
+CSaWD+gSNuxcXkX46zdvMtJzurp7+/oPW2zxWl5ebaBvFJXE2p1DRjYxJxPaOZn29w1S3T86
+GhkZNbcynl7nStY4B3Z2Dq1wRlGwhY2RlY2Fq7uzq5vTISnuzk4uDhaWpm5sq/aRAjniDrBj
+KwZ0gq5MJ/nwsKbYkkMWW2tbSys746LaqLndPn+NLzb3F7i50EP6R04BAcGK24NFB1YZcYjO
+ywlQ1zdV2ic5VKVXUjI4UzEj40u3eAeMuPe3SSh+ekBafsgCKy9TpZK1+l23HZOK6w6ePnY8
+rpBq/VHTQP+QtZ2J/Ma5A3xyX5m9okgOUWF25yB77ftoIyI5jIGdkgd294forPw2uRI7O3uq
+8kdTbJY37NziAdo5KlQOtKzKrzuw/R04DXyq70dT4pFRUzPDyZWG6XUu1Qgqh68syIS89ixn
+Jxeq7EdZKSkZCekBywc7EgQVKgdzwWt6nWduZTjQP0Q1/ShrY2PDwsKqY6RkXiYYp6pB5RCV
+JVljUmZQXEwCVXNSR3uXuZWRZJVzkF1rUqHylXNVkaAzx8rCZt+7TiVpqbIycwPD3dD2HeR4
+EFSofK37arZ4owt1JqZGI8OjVLtJSrFY3gWVMcsHOyA1FSr7/9TbOnd2S+Dgal5RXkP1mqSq
+lZUVKyubWmH6El2JoKK1RbLGQa6KxCQuNokqNWm7pqdnzM3NhV25BDoqWoo4JCPx6f6BATRK
+F+mTEo+MmZmbCDpyCHRUtO6+kUWZKDEziM32pYpM+rxGxWMWFlaV3GSATrJGFyOoaHoZX66X
+bvHmZMLQaM8Af3JxpB1pfn7e0dEpuyRyQdYo3aTbS6hodJmXCSdXOO5smxi6NY70JVpfXw/w
+D/bycxhfqj/IYQ2pUPmiE3HIOFr6CyysjAvyi6naknahgrxiS2uTpt58HEvTZOqoaFKZkwlm
+ZcKckkgbG5uurl6qraRdq7u7z8HOMTSaNbZQtyhrPJiOvqlQ+UyRbvHQ7Lb2F9o5mYWFRq6s
+rFA9Je1dWVl5VtZmJTXx0+vcRZloilhH5Rs91AC+DUmrw2O97OztG0UtVDdJ+6iJcQnaTRs7
+i/zy6PFl+aPQszI+PRFG5WDuEpmXCXHI9U1WRMR5WVlb5eUWUpUkfSWNjU5ER8Vb25r//y1f
+N+PG4z3Agu4ruLgb7cmOIuoiYAX67s8ZYOH2FbS9+vSpq5unzurs6OrYs2v/r1+/RnPiKKA1
+ePcOdCVfX19fW1f9lj2Lrj3c8+YnaGcNMEECkyWw0AOmT9CJ1r9Ogy9jHUWjiAACJhXQcXB/
+zwATD6TZ9un/+aefjp2+thnYeGtta5g1a+6Z0+dHs94ooD948ODx5k3bpk6d1t7VMnFa68ad
+849f3HDjyd7HH468+AaskU99+Hf2/SgaRYQQMKm8+Hbi4dvDVx7sOnBq9fJ107v6Gts72ubP
+W3DwwJFPnz6N5rVRMODgz58/d27fO3L4+Lq1G+bOndvW0VpTV11VXV5YkldYnDuKRhEuVFSS
+V1yWX1NXVddQ09fXs2DBoi2btwObbU+ePBvNVpgAADfb3Qk=
+</bitmap>
+<bitmap id="2" width="325" height="558" length="35723" ColorSpace="DeviceRGB" Filter="FlateDecode" BitsPerComponent="8" encoding="base64">
+eNrsnQVYHHf6x7metHe1VK5tHHdd3HaXZY31mRXcHQJBAsEhgjtrWLRpY40QJ+5pFFjYxUKa
+5urX1NL04vOfBWp3aa/t/xJ26ft5vk+e2WFm9jfvbz47ml0MAwAAAAAAAAAAAAAAAAAAAAAA
+AIDfL7dv3zp88OjubQd2b4dAdDvb9nfvPnzlyhXQ9qcYGRybafY0LdmQEguB6HToScaW/s+m
+p6WDtj+FumeEHGz2+qeSFVfFEIguZ90/Q5JW2WdmZIG2P4Wmb9RXZNo6irT0CiAQXU7biCha
+ZpuVmQ3ags4Q0Bl0hkBAZ9AZAgGdQWcIBHQGnSGgM+gMOkNAZ9B5uqUPkfUj8gFEqvp+pFSF
+SL+fQDAxwURkql+xZHw5Pz+NtG88KugI0Bl0/h+4LO8X1B5nVRxhN/Yg8nFV5RpU1ito7pl0
+ufkir+poQOUJds0pdsURVu1ZPj7yFyxZ0HyeW/c2t/lnp2lRaZdfd5Lb1APmgs6g8/9vv6zi
+Ztc5kdlz3Bjz6NnORafwjUdY/qabL8sm5xBPge+L1cL6vb6MkLn2Hi+bOL1CYBmHKOmKK+LO
+dyQrxkQKXP9+tH10/OVVcceYeMUVkVIj7HhH3DkmrNrum9BOrFOJOi6LO65IOsdEMq2/aPsV
+fGJJ27Cw+Rg1pdaz+ABjwRKf8gtI67AIH98+IsQPDGQaYftlcSf+chiVgs6gM+j83yIdEMqO
+ED18TZJ2ctv6OJmdnvlH+XUHyNzQuXOtTDIO8ZTqifogrVfQguW2rDjnGg1uK1rXTQ5KtmAW
+uJW9jTQf8w+vcuRFmzIS7UU51tQct7y3iMJkm4RNAbX7yGnrKFUHaUkNBFGyBbfQo/IS0nyC
+Gp5tRY+zWbibXSy3NjR8SbDcK62OXNuPlK1y848wDaonNWrQ8s3eEcsduJEW4R3U5oHftdGg
+M+j8i6JCFL3sxAJrd5F5SJ1HzpYAuRqtP80u3030Q2zT93IVP9C5sNKOk+RSNyxRnqXxuPO8
+g829ubMcEzzL1jsbEg1DqxxcjF7xW0RgBc52S3SML7F2iXVOb7Sj5ziXvOlGoM6WVLvSaSYh
+DZTsNhdaqj0SOc8t0j6rw9WbbBhR48og26evdXMPMguuc+OGGolWU7NLjK2FlvHl9h4+ltkH
+tMcJoDNoCzr/l+CHyiNo7VFmXrubJ32+aHUAflTcfsaPyLX+oc7KMbSgwo6T6FI3Gtiy28PC
+6RWvKAtGtCk3z7dwnav9AreGgQAJzTrzID9vuRmtgqQ85UeUOCTU2nOKXIvecGem2lVfFi5M
+sBEt9s1e7xVW5y6OmmsvssrdSAyKdMjfTkZ4DuF5puRCr5UfhRQq7ezzPDLKLTm15A4NU+Br
+kdr1XUtAZwB0/smD7fp9RLTMOXsbs+4wDUk3pctoHVfEyuMkT6rlgt0/0PkKmrfEhhFFqB2W
+yI6RqYhF4iZG0Vqv8DbakjcI5vHO1eeoPE+LtD2czCITdi1ZeojoKbCPq7Rl5DoXrHWlJdgs
+VwuSI63FGW6cNENiiVd2rTWBb5a+zofNNY2TebD87ZNlDoQw66zt1NAkY3ozOavMjFlBlF+g
+st3NQGfQGXT+JQfb0h52VrMTiTnXlW0U1ESqvoTIB1D5GZokyzXvME8+eYiLKIaRJR3uUeU+
+dQNCpQZZttbNnzXHKdgqdQendrdPQJVv3QVmXIpL/mFukZIQvYYmPUGVFHhmr/KIkvku7SJG
+VLlX9wtyl7klKan5Kwje7Hm0NCvmYqeCg4yoDAt6qn1omlflJV5mtR2BOYeZ41bZixS3EqJW
+UmUXmTHJzosPfNcS0BkAnX/2RpUaVWjGo0a1V557tCOVg+PD303Wg+/KtdNMvMRnwSdQ4rP0
+I1IV2qpBtMoPaWeR4ZPh6k0sAR9Wa2894zOOX6xG5WrtxwX+J4VG2IpPgP9pUIi/r2IQlfZp
+J1OOt+T75UwsVgVXtkFn0PmXSy34RbeS/22W/8/bPYrFgs6gM2wwENAZdIZAQGfQGQIBnUFn
+COgMgM4Q0Bl0hkBAZ9AZAgGdH6/ORIlZ51WhXI1CILqcFe9IYpV2oPPPoO4dtia/WHrYJ3+X
+NwSiyyk7RGIXzkxOSgFtf4qPPvqYj3CFQVw0EPKrExiGioL5UIfHE3wr5aGsjo4O0BZ4FHz5
++Q0oAgBMD8rLyy9cuAB1AAB956uvvpo3b15ubi6UAgD0ne7ubgMDAyKReOfOHagGAOg16enp
+uM4vv/zy2bNnoRoAoL/885//dHBwMBhn2bJlUBAA0F+OHTtmaGj49NNPz507NyYmBo63AUB/
+uX79ukaj4XA4Fy9eHB0dvXv3LtQEAPSa0NDQb775BuoAAPrOvXv3goKCPvvsMygFAIDOAADo
+DiEhITduwHOeAKDf4BZ/9NFHCIJcvnz5008/vX//PtQEAPSUPXv2GBkZPfPMM/i/ERERt27d
+gpoAgJ7yzjvvzJ49e+IxksLCQigIAOg1UVFRuMszZsw4deoUVAMA9JpNmzbhOvv4+MCRNqA7
+3PrX7a8+/+YG5FdG0z/y4vMvL0heePPLW1CNxxB8K7154xZcdfwZrr37HsHdliIgkHmQXxku
+YZbxC06+Zn58qMbjCEXg7OZnXVFRAdr+FAM9I67c2dIhVv3FAMivSsMlVsFWSvUZfACq8Tgi
+G+SGNJqmLUgHbX8K7fdsi03bxrQ/Kwz5tZH1ayPtE0ApHkPaL4tj5PA92/9NZ/ja/EfxA80Q
++Np80BkCAZ1BZwjoDDqDzhDQGXSGQEBn0BkCAZ1BZwjoDDqDzo8mUtXkfWeZarJ6ky/H70RP
+TvPdvekfv/zhNBDQGXSe8jRf4tWeYlcdY9ee48vHhW06z60+zq46wWnuQxT4mH5UpuLXHGdX
+n+bJBlAZ7m8Pv+40pwofc4YnHZh0HAI6g85TGRXa3s8OjjU0953lwp7jHGaZ1s2XHyF6+L5q
+z5jjQp/rn+dWdg5VngtIyLN0Zs5xYhsHtfnLxtDsPDMbj9ecWXMcWKaRK+gyDQrFBJ1B5ynX
+uaOPwRJbhqxirfpAXCS1c070qNzt5cayKzqHtPUFBMaYccq8U8ut/dPca/rRuh3erCxCyQVu
+aryZuILcdi2wepMHJcC66Dyq6Id6gs6g81TrrGLyAs0CyrxL9vpH5pj75PnW7vH2FDiUnkc7
+rogqV7swo0xoYWap+3gdQyh+ptx8ni8b5qckmjLSnAt205KX2voHOi7rQeUqqCfoDDpPsc6d
+/QF84RwT3zneYkNShlPpObR5p5eHwHHJJeGKd8XL2wjMaHNWgnniLm7nqFAxKFT2CWQj/AVJ
+881dZnqKDD3DbDP3cBRqKDvoDDrrwsE2PQC1DHudvfr9wPYRoXJIVL/dw4lilbEvoHovmRNp
+Ftjil1lp4x3sWHSEVbzWnb3YZUkvLyXGTFLt1/GPoM5RkWIAag46g8668B+ptCfIkYudkzax
+FIPay1nSAbTlCNmfO4cQMMeFMZ9X7VOjEiousJMLrVzxMUKzqLV0+aggZ6lTfJu/VI3CNW3Q
+GXTWqcg1Pz7z7UNwteXae8qoQq29LSVVIQrN+JgBfIz2tpRMrX0JpQOdQWc9+M/O2u8xEPzb
+8yH/OQYCOoPOENAZdAadIaAz6AyBgM6gMwQCOoPOEAjoDDpDQGcAdIaAztNMZ6LErOMdoXwA
+hUB0OZ1XJLFKO9D5Z1D3DttSXl52glTcTdSdLD9CLTvop1NN+n2mpJu47Ai19ABZJ7aK4xRe
+6eyU5FTQ9qf48MOPWBwGX8LkiXQmYqYniUDnkHSoSb/XcIV0Es2TJfDXhcbwxcwAHlWpVIK2
++sWirMU7tu+COkw5d27dS05M7bnYB6UAfhuff/65jY1NREQElGLKOXPmzBNPPLFmzRooBfDb
+6O7uxjchExOTzz77DKoxtTQ3NxsYGCAI8uDBA6gG8BvIz8/HN6Gnnnpq586dUI0p5NatW25u
+bnhfzJgx49q1a1AQ4Nfy6aef4vtlg3Gio6NhpzCFXLhw4Q9/+MNEX7S0tEBBgF9LT09PQEDA
+7Nmz8f1Camoqfh4NNZkqNm3axGAwDA0NbWxsSkpK7t27BzUBfhX/+te/bt68GRUVdfz48S+/
+/PLu3btQk6niq6++unHjRmZm5oYNG7755hv9P1L6Bhscwr66ox28cxO7/j52H479HgeJiYm9
+vb1QB10gPz9/9+7d+r8e97H2NOxZG+zYR9pX/ziDbSrG4HDjsRAfH3/+/Hmogy6Qm5vb1dWl
+3+vw2WVseSz2/F8wA1vszD+1Yz7pxdbkYNdvQP+CzqCzXnEPk+Vi/igWz8eetMJOjet85zPs
+6Gbsg0+hfx8DYampbw8OQh10Qufi4q4DB/R7Hd69ht14gHWVYH8wntRZN1GrsWPHpl9quNyh
+9vZpuWp6l9zg4K6KCj1ehUuXJmVZv1jXdaZSMQMDCOTRJdfAoEuvV8HWVm90TknBTE2nXz5+
+7rlbc+dOy1XTpzg6Yh4epbNmHbGwwJyd9XIV8JafOPG9zgZGOq3zgwfTMglxcefPnZuua6cv
+2bd3r1wmo9NoSYmJ27dtu3/3rl6uyHesXYgZvIwd+wSuhzxmYhMSzn13ygNMEfVNTQbfwubx
+7uv7+rynxroOYNdvQ8/CjarfIdeuXZsxYwbu8l//+tdp8SQJADr/fnnw4AGKorjOM2fOvH79
+OhQEAJ31mrVr1+I6L1y4EEoBgM76zpUrV/BdM/zHcwB0/s189NHHo4NXRzTvTHkGeofTkrJ2
+b+/WhcaMqN+5MnLtyy+/BEFAZ705Y72PkSjeHjwjX6G5LzrVEZqTxJZEkcXUtwQ1J0ksbH1n
+5ufngyCgs75w/w7mz/OouUhtG0OVI8iUp+0y2qoDzcCz6j1xbJv1wvQMEAR01iOd6QLvipNU
+WT/80hD8qA3oDDqDzgDoDDqDzgDoDDqDzgDoDDqDzqAz6Aw6A6Az6Aw6A6CznujcJ5CO57f4
+8ptn/G+LBZ1BZ9D5V+vchygGUfkAIhtAFRpUrvq5ifFp5N8tvw+Rq7+dUY3K/jcCIvIBVKZC
+pCoEdAadQedfpbO0H5WfprED5xEC5rqy5geUeS49K8DdVA4JZbi8GnwAlQ0IO96RrBgTtw4L
+Fjc7Rq7wlw4g+N5TMSgoecODicxxYRqKa4m1vYi0D1EOi1a8I24dRPGFywdFbaPiDvylGmlR
+oe0jovYxSeeoUIq/tQptG5OsuCJWDiDNPQLpAIq/RceoUNnLzniDlL/Rf0G5b2UPotBo37pj
+RIivVNuwqP2yuHNM9PMfOKAz6Pz71XlAKD3k60oxT3yLUXuMKo41peYTW1Scws2U6kuCmp20
+wi3M6iPU2GLH4FpivVqQvtgkoNJXpkYVQ2jVOjdisFXSRkZFFxFNsojfHNAxipSt9RAXOGXv
+ZCs0gmXbyelK97Bil7wjvJYzzPS1vrFVThFtfo39QnkPK6PWKWi5R+lJvnJQ2HyaHlfslLye
+WbvD08b7777ZLplySr1G2HzMP7rQIaKD0niOvWgDMaGeENzgU3kekalAZ9AZdH6ozkRvvl3u
+SaTzXXHNOldWvH1hF5EdaZp7DsnLs2eIHMMyrQPirNzY8+gyv6ylFrxaokwj6hjhxSda8QpI
+iqtipQZtOM2uO8cvWePsIjThLLAghVhk7A+Ijp9lF2QpCDXyCXMvetNlvvdcVq61O8swfjNt
+YaENCTXyD5pHiHWtvsiOijP34Ri6ITaxDS6O1FfdQsyoVMeyY3REaOwfb02JMWdl21rT55LS
+bYjcOfxGP/zz5JefsIPOoPPvS2eebc4xQfs74vpN7qwE27ztJEGSReEltGiJEyeYkNTskdjs
+6kp/xSbfK7PcclxnYfsoLyHZRlzqp3hHhJ87t46IWwc4kSnzac20jR+JIvItfGt8ExeZBL7O
+bj1CYvjZp69ytY93rrssTF9sKql1Jfu/ahlgRA6c7yxwKN5F9KJbLDwswD8Wmo/4cYpso6Ve
+QoSQ0elkIXFseD+4aaMn0XLm/HD7gl7x0npLWqF7U78QdAadQeeH6HzQ151pnXWY36piR2aY
+M/OJzaf8aEGGSbtZKamWXkRjQoBVyiZK6AIj+xyPtDJzThV+sC1UjqBLZI6uEutFR/jSM4z4
+ckLWroDUIlO3XK+WC0wkzpjTSk7MMg56PaB5pzeD4rBwpYtdsnP1AD8py0TS5MENMQ9ewWg4
+4h8t86s9TvHzN4laQ82R+izq9KSmm4uWuXDZTjkb3B1plnmnePlNju4+80zj7PPOIQWVFvRi
+D9AZdAadH3YpTCg/SSHTZtrS5jjT5pAynYtOIx2D3IRcE3vyXD+JpTjLRZBoQuCa+IeY+GV5
+LKizC5b74btjqQpV9nNSq+09SLMIlLnMbNdlF9GWk1RBtJG9/+yAxW6VFzipRZbRG1nN+0jC
+YJecNz198z1q+vnpZVYR6+iVGzypAa850udxa8ktg0hhi5OHxysOXJv8/cy4RaY23rP9A12r
+VPxFS23d8OVH26au8qQsJuSfRUqkdsJaH9AZdAadfypNF7g1J9hVJziNPYj2PlQfIuvl153i
+NFzgS/sQaQ+v+gSn4SK/+RK/uQfPtzOqEEW/oP6kdsZmfBaV9o6V7KJ24qY+RK4SjE+vnbL5
+kqClRzA5PL4EuRppfJtdfYor7dfek5IPCOpPceovasdLL/HqznAbL/JbxsfXnWTXnucrBhB8
+ado3/WEDQGfQGXR+yD4akY3nu10ebrF2jEo7BtdtclilHf+j3WLff8yo+v7ldxPjM373tMn3
+I384Y59g4i2+X4LqB8tXae+LTd6J/rcGgM6gM+gMD3kCoDPoDDoDoDPoDDoDoDPoDDqDzqAz
+BHQGnUFn0BkAnUFn0BkAnUFn0BkAnf9DZwbiXXue0T4qah0SQr7LqmuB8e32oDPorE8638Wc
+fayilRZp65xT1xAg3yVzk6tf2otJiUkgCOisR5SVlcUnxOlIklNwgRJ0pDFx8XGbNm0CQUBn
+4DfyAEoAgM7TgVu3blVXV2s0GigFADrrO2q1esaMGXB8C4DO04A1a9YYGBikpaVBKQDQWa+5
+f/8+n8/HdX7ttdc+/fRTKAgAOusvly9ffvLJJ3Gd//SnP23ZsgUKAoDO+suGDRsMDQ2fffZZ
+/PQZP97Gd9ZQEwB01t+9c29vb3R0dENDAz4MOgOgs75TWFjY3d0NdQBA52lAbm5uV1cX1AEA
+nUFnAACdQWcAdAZAZwB0BkBn4BGRkpIyMDAAddAF4Mo28Jv58ssv1Wq1SCTatGnT8PDw7du3
+oSZTxfvvv49/qMbGxspksrGxMSgI8Gs5c+aMwbf4+Ph88cUXUJOpQqFQ/OEPf5joi/DwcCgI
+8Gu5ceOGh4fHxCaUlZUFBZlCRkZGXnjhBXhmG/j/UFlZiW9Czz///NGjR6EaUwuCIHhfGBoa
+fvLJJ1AN4Ddw4sSJp556ytLS8tatW1CNqaWjowPXOSkJvm0P+I3gFru7u6empkIpppyhoaGX
+X35548aNUArgN1NStOTwwWNQhynnzq175UsrR4evQCn0gg8/+JDGpHBEVLZQV8IRUn38Xehc
+ou406fcb1J/M8GDwSDrSHq6YSqETz5+/AOY+FHXvsD317xVn/MoOknUn5cdpS49QdKpJv9Mc
+Ipcfoy49rCubR+0FqrPohW2bdoK5D0XTN0oUm3W8g8oHEAhEx7P6PQk10WjHlr1g7k/p7Csy
+bR2FXzeD6EFWXBX7xxuCzqAzBHQGnSEQ0Bl0hkBAZ9AZAgGdQWcI6Aw6g84Q0Bl0hmjTI5D2
+o51XJSvG03FZKMNHqtC2IaGsb3IaqQppvSzW/nVUKIWKgc6gs65G2o80HvaXpFsy4szpcRaS
+SmJtv7DlODVxNaninECmEkgHUGkPO22ZLT3OPLjer16F4iOhbqAz6KyDkQ+iy1cSLDxM49eS
+cl735PBNJI20xt3uhHirxSeQVg2qvBgQkWNJSXNMkrlywkxELeQWXPA+KB3oDDrrns4atGKd
+i42noajcJa6eEICYRbQzGvd6eKXZ5p9E2keFy1e7kjm2pX3i1e+KG49Qc7fSG3sR0Bl0Bp11
+Vmdrt3mCPGtbm2edUz3l1wKbt7t5LtDq3DGKlipd6IGuDWMiea9AMSJq06D46TbUDXQGnXVT
+56WrXDxC3GUfB9W+4eLFt8w5KZTudvfMcFiqCnzjk2DpLh9ygNmCo+jr70mqd5PTX6dq985Q
+OtAZdNZJnZetcnYREio1ohUjvMg4I59F3rXd3k7Uv7sGmlKjLOLWUNKa7d3YhtQoY2+eadQ6
+mkyNQt1AZ9BZF69s9wkaz7CXdLOa+rRXuZtOMUv2MhsucEs2ERe0eqUovfP3c5RqwZINxBSl
+V95ONu4ynDiDzqCz7hqtQpSa8ePnHoFsAFWqEWkfohwStY1ooxhAWvoQxfhL5SAKh9mgM+gM
+gYDOoDMEdAadIRDQGXSGQEBn0BkCAZ1BZwjoDIDOENAZdIZAQGfdRN0zQgoyXftPSec7Ip2J
+eDwiiI50x4qrEh3pkQ1fhNBTDbdv3gPmPpTR4bFZZs9TYoxI4YY6EkqkiV+Ese6053cev0hj
+Wqw5OUInthBanPEs67/u3dUN5j6UO3funHv7wtEDp48d1JXs3Nrdveuw7rTnd57Nb25HuYHd
+u47oQmOO7j/99qlzN76+AebqCxs3bhwZGYE66AjHjh2zsrJ67733oBTAr+Xjjz+eNWuWVCqF
+UugI6enpBgYG7e3tUArg13L48GF845FIJPfv34dqTDlffPGFm5sb3iMCgQB6BPi1xMfH4xvP
+iy++ePnyZajGlLNv3z6DcWbOnDk4OAgFAX7VvsDS0nJi+1m5ciUUZMopKip66qmn/vSnP+H/
+dnZ2QkGAX87GjRv/8Ic/TOhMpVLv3bsHNZlCHjx4cOLEiV27dpHJ5DfffLO/vx9qAvxyxsbG
+Dh06lJWVlZKScvr0aThZ0xHCw8Nv374NdQB+A2vWrJHL5VAH3dlHBwcHX79+HUoB/AZaW1vr
+6+uhDqAzADoD/3NCQkI+//xzqAMAOk8DQkNDb9yA5yoB0Fm/qaysdHZ2fvHFF+3s7FatWgUF
+AUBn/aWjo2PivuETTzyxZw/8t0QAdNZjxsbGDA0NcZ19fX1v3boFBQFAZ70mJCQE1zk7OxtK
+AYDO+o5MJnvmmWfOnj0LpQBAZ33niy++iIqKgjoAoPNvY9XKVcuXVOpIlpQsD5aE4f/qQmOW
+lVVUVlRfu3YNNAGd9YL7dzEHNwt+8bzgKougiqlPcKVlVIN9UKVONCaqxXqu2x+3v7UTNAGd
+9UPnOxgD9WnoZa64KukYE0N+mPWfhTBSjbvegi/mBZ31Rme6wLviJFXWD19+Dt+zDTqDzqAz
+ADqDzqAzADqDzqAzADqDzqAz6Aw6g84A6Aw6g84A6Aw6g84A6KxDOjf3CORDQuUg2tKDv0SU
+wyJFv0CmFrZpkPEx4+nRjmkdRKU/nlExLF4xJpJODA+J8GFZn3a4RYW0jgrlqsl5pQNo+zuS
+FVclbfi7gM4A6PzIdJZrBMvWExdtoDcPoNKLnMWrvUuP85Z1kRI2MmUaVIFHjSqH0KqdpMyN
+1JZBkWJgvAF9AkU/v3CFm6TBt64PVaqRsjc9A2u8qy4gcryF51k5MmLFeQFut2xQ2HiMGrXI
+MiDJbsHmAKkaAZ0B0PnR6Iy0XhGkLzDn5/u0fxy6eogVFDM/ajOnaq9f8pYAhYa/bAdtyQFW
+oxopqLUip9rn72BUnObJcKNVSOcQLyz4JYMnX8k4gqwc4SK+z/zJYl7BGWHHmKhqraMlYaaw
+g9nxjqjlMJkVb87NI8SU2fuHmid1sZX/a6NBZ9AZdJ7UeQzJzjN3ZRiLywhBi61cGXOTd3EX
+K5wodaT8Jgd34jxv7jxCjmeuws6FPYfEnevMt8s/zMf32h0abuQC09fMXuatZsiPEQluL1kL
+zfNPCVeMchNz7JB0O3SRe+NVNCvXiprs3nQ1aOUYumwrOX8vS9oPOoPOoPOj0nlRnrmzvyGS
+7yjMtHCmzk3Zzc1qsndNt6OEWGccFlS+TnBMc81qtPFNcWpQs8X+ZmFKhnxY2KFmh6fZ+IZa
+UBe5L6yzp8SbBSRZLT4rVnR7kaJsst70ocdYpnWzF2TaiUspiqtCaR9+Qi1S9gua4WAbdAad
+H5XOgoxsK1EZsQM/2B5mh6cYJ2znZDc7uC3AVbXJfVvUtN3NPcsts96WXewuHeKEsCyj2yZ1
+Dkm24RV7hkTNNnc3iaxw5i+wKjiP5tdbmTq+4s6fZ2H/KrOFkl/j4BvhWDkcuPoKUrKRuHhH
+gHQA9s6gM+j8yHTOtOTleDYNi+Xn6OIYI1xnXF7XUq+s5XZk1NyfP9sk2SWr0Zax2LVZww6k
+W0S2TuocFG8lrPeLSX7lzxaGmeu9+SmWi3bQAlOtEvfwO0ZFjft9qBGOxQeo4gxzT4EJLcSY
+FGadeYCrBJ1BZ9D50VzZlvYLag8ylx9it6gQaQ+vvJtefZZfe5xZdoxbs58cuNCahM51zvWs
+OslafpjV0sev2MmoPMmTqhAZPtzNLD/Oqz1Mz98d0Hies3w/s+Y0p7I7oFmFyvAJ+vlVO5h1
+PYj8PGuRwiNB6lN6hCeHK9sA6PzoHiPR3lNGFeqJu8yIXIObqL3L3KHm5cgJfpGmlAzH/EM8
+hUaoGDdRPojK+7VzNWtvcuHDiPYm9RCKC65Qay3GR357exrBJ5b24Z8YKH7W3D4qUqgRuO8M
+gM5T8lSYXCPUft0HrqFuP4oGOoPOoDM85AmAzqAz6AyAzqAz6AyAzqAz6Aw6g86gMwA6g86g
+MwA6g86gMwA6/xKdGYh3Yz9z1T8knVfFU54VVyUrdKAZE9nwZQhjgVHXZvjheNBZP3hwD3Px
+tPcOmUWJMfSLmvrQ481ocaa60BJtY5KMZ1o/uWfnPtAEdNYXei71HthzbP/uo7qQRen5dZXN
+OtKY7l1Hjh0++dVXX4ImoDPwG8jIyGhqaoI6AKCzvnP9+nW7cW7fvj1NVumbb7B7D8bPau5j
+N29it+5qf4L365vY3fvQ3aDz9Ka7u9vAwODpp5/WaDTTYX3eKsVcKFj/V9rhr/sxL2csrQvT
+rMdsXbDtw9DdoPP0Jj8/H9f5iSeeWLJkiZ6vyhfY2grs5Sew5y2wvhvaETdVmOGr2IIubGA1
+9twr2KYh6O5HQdO6dctbW6EOU84nDx48b2pqMI49hfK1Xq/MznKMGIDRXTAzAtY7vnd+8DGW
+FoptU2OfXcIk8VjvdR1q7ddfY01N0yOnJJLDAsG0WR39zXs5OTlPPrnQwABP+SuvfFZaqrfr
+Uo8FCbANO7C9xZihDdaj8xfGGQzMwAACgfxk/vInLJGAOXjqgc5xcRiKTo9ccXIasbObNquj
+7+k3N//A03M6rAubjcXYY/b6oPM0onnt2gqFAuqgI6SVlLx18OA0WZn1C7H5NqDzY72y3dZW
+39AAddARcnNzu3bsmCYr0x6BPTsLO/8FdOtjY+XKlS0tLVAHHaGgoGDfvunyjHTPTqxein1w
+C7r1MTA6Orply5aEhISwsLADBw7cuXMHajKFfPzxx7t27eLxeDk5OXv37v3888+hJsAv5+jR
+o88999zEjU6RSPTgwQOoydTqbGxsPNEdrq6uoDPwq7h58yaBQJjYfrZu3QoFmXJSU1MnumPh
+woVQDeDXUlxcjG88L7300tWrV6EaU86OHTvw7njyySePHDkC1QB+LWfOnMG3H/z0GUqhC3zy
+ySempqYmJiZff/01VAP4DZBJ5I0bN0IddIT09IXFRcVQB73gxo0bLc3SmoqGmkqdSNXyWj5H
+uHBBto6053ee2soGHgsJEoXpSpMqGhrrm9977z0w96EM9o/MtH4yqMpMVKYTES8xi6hxCC63
+0pH2QMJr7MOq7HSkMWF1lrNdnti+ZReY+1DUvaN+weZrP5Z0XBFDIDqe9Z+HMhYYd70FX8z7
+cDR9o74i09ZR+EpnCHzPNugMgYDOoDMEAjqDzhDQGXQGnSGgM+gMgYDOoDMEAjqDzhAI6Aw6
+P8IoBkWtA0hzzy+dHp9SNihacUUk7xsf1gg78WGVdlg6IGwbQqXfTikdQDve0f7oaqsGegF0
+Bp0feWS9vKLNvou6OYpvf0Jd2o8o1KisH5H2ITIV0tInkA+gsj6BVIW/1E4g70fKt/gE13iV
+n0eUGrRmDzms2rPsFF8xiNYf9M/YQmvs0xot16BNR6jhOdachQ4Ld7MVaugI0Bl0fpTpQ5S9
+nJDM+VQZrXMY1dqtRqVn2aW76NXnBNJLvPrzPGkvv+40t+GSoOUct/5tXrMKaR9Gs4vmGxg8
+G7qes+o9YVL0a3+Y8WL8HsHaK4LkEhMTV9OCE4K2YWFDNwmJM2XnEcILbYgim8xdHDkYDTqD
+zo9Y54g8E1YrvWMI3yOjjcf9+bHGDsw5lBSnzHYXRqFr2V5fF6dXhEr/lDx7STVFOixqH0Ky
+Km1nzX2BXEtW9ND9Wa8a+c5JPYi0n6BIcm146dbBK2krRgUJJZbei32U14JWjiGl60kFe9my
+fugL0Bl0fkw6K4eRjFJT5wx3+ZAgNteMWOIiTrANzbezmvm092JHTqZ17FYufmrcNshPW+bo
+I7EgpztntBBoiWb0OLP0g/zSVkdyilv+G27kEKdaFT+6xJLZylh5GcXfpe2ySNEvaOmBmoPO
+oPOj1LmHE55vyl/HXv9x0NoPRAvzjTwLvVd/IEldYuG+nFhQa2njPY8RbmHLnOkRbld2Uajs
+R7Q6l9r7Z3rEZRhZucwTFblKMs0X7GRGx8yd5zXLnTXTmDA/ZTsnp8HWI9mt5WrQKu3emZy3
+h6M9E4eag86g8yPTubWfG5k+x4hhzEm25Jd55m/28Qs2IkaYEAPN0/bzqlfZPT/zxdBVPj5m
+Tzul+yguC6V9Wp1TC20oi3wXVRk98cLLkev8QtPNQmsIzCTnZecErUOCxTUOnMUeNSfpwfFG
+HuHmjEgTr2D7vAM8+QD0BegMOj/KK9sqQeUeSlKze0ydW0I7ua4Prd/nF1fvvngPW65BW86y
+CzdSq87xlndRyk7y5KrJWaoPMksPcBpOMnM20+ou8Cr20ZceYCw9xcXPjmUDqPQ8e9lBZlO/
+UPo2M7XZLabRq/gED65sg86g82OIXCPsuCzG0z4ilPVp7yPjw62a8dvHKrR1RChXIYohkRLf
+t3578itTo7ie0n60bViIH0Lj4svxMRM73x6BVIX/VTs7PkG7dsnj80KpQWfQGQI6A6AzBHQG
+nSEQ0Bl0hkBAZ9AZAgGdQWcI6Aw6QyCgM+gMgYDOU4S6d4QcbPb6p9r/Pq8bkax8V3caA9H2
+yHh0ojEbvwxlLDDq2rwHzH0oI4OXXzN7mp5i6B+nE6ElGLFSLXSkMRA8ASnmzGQzXWlMmvFM
+m7/s3gF754dz6/atgwcO79zSvXOrTkTe2O7t5qcjjYHs2tadHJdekFOqI+3ZsWXf/r2Hvvji
+czBXL/jHP/4RHx8PddAdkpOTc3NzoQ7Ab7k0p9FERkZCHXSEjz76yNTU1MjI6MaNG1ANAHTW
+a7q6ugwMDP7yl78cPnwYqgGAznpNYmKiwTipqanTZZ1uY3tWYOnpWONG7Kv70MWg8++Ejz/+
+2MLC4oknnvjjH//o6en56aef6v0qPfgKq4jBXpqBzZiBPT0D4xdjn4PRjxD16GhodDTUQRf4
+8LPPdnR3sxAku6Bg94EDn339td6v0vv7MQMDLLQNe4BhqxZgBq9g3dd0tKmffTYNMvz228nB
+wdNjXfQ+X36J3b5dvmjRka1b8QHsiy/0fo3+9TG24yB2bfxzaUsR9owhdvA9XXR57Vrs+een
+Qe4/88w3f/7z9FiX6ZF/Pfnknb/9bZqsztLySV+GdmGWL2D+RZhuXrA3NNQeRUAgkJ/LE9iN
+G9jIIczsBcwEwYZ09XGUsTFscHAaZGz37nyBABsamh6rMw1SFxt7SC6fJqszMoJpdmJO8zFS
+DvYFXB155Fz5+OOwpCSog+6QUVi4tbt7mqzM/X9gfjO1++iQbKyqHFtaiQ18BF38KLh161Ze
+Xp67u/trr71GIpF27twJNdEFcnNzu7q6psnKXHoDM34Vm/kq9sxfsT//GXvqBWyTCrr4kdwS
+fPAgJibG4FtOnjwJNQGd/8fcuYV9fRO7+V2+we7BfedHxd69e2fMmIG7zGQyb9++DQUBnQH9
+5euvv7a1tcV1rqmpgWqAzoC+k5iYiO+gL168CKUAnQF95+23z4pEYqiD7lBaWnrk8BGog54c
+395oa+1orpM31+tEivLKaH6slgaFjrRH2qjcu+dxf5XN5s1v6U4FiF6UmIgEHWlMU51cIWv9
+4IMPwNyHMjgw+prlk+JlpkihiS5EVGoRWmGvI40RlpqREl+mMsiPs0ce3MMc3CyY2bPRYp3o
+FLw7ApdY6UiPBFVYzCI80bVlF5j7UNS9o37B5ms/Cey8Iob8W1a/F1R2hCgJFTzOHrl/B2Oi
+Po19ASuvQaf8ezZ8HspcYNz1FnyT58OB79n+mSjUaN5OL3HI49aZLvCuOEmV9UOnwPdsg86g
+M+gMOsPWAjqDzqAz6Aw6g86gM+gMOoPOoDPoDDoDoDPoDDqDzqAz6Aw6TyOdewSK4cnfBu28
+LJT1CVr60dYRoVyNKgaQ76aRDwqV6l+2EfYhylGhXKWdq7kXaR39duGj4wv/X3Q9vljFiFDb
+vJ5pqfP3RWsfQaU9AqlaqNSgeI/Iv11lbWGHhMoBpPm/VgCfHe/QIaF0fBjvnbYrksmFD6PS
+3v9ZjygHf1l7QOdHqbNMLShb6yHOteNn2ga1kOp60aaj9GwFZflhxrLjHGmfdnZZv2D5VlLe
+ngCpCpENaLcrmQrBh7UbQ58AH8D/nRyPb6jnWYtb/cpP8/FhRR8vt91NmGOLLzxESqzrRfCR
+2in7EXzJE9undNxxab/25YTv+AK1f5rY5r+dTDs8MX4AVfRz85Wkor0cmQaVDYzPqPp2xoHx
+Zar0Vme8wj2cRUoX4SJbfpZ9wmpayxBavYu8aAut6mDA8qOcloHx0l3i5mwk5x/m4iv7fY/0
+T/YIPqzttfHxcjXScIS2aAOl9hIy0TvplQ5oFt4jdvGv01vGZ/z3Hun9vkcmekc20Tvji53o
+nYlVmOypAUTRw8l+k7hoP1c5iE6877czavtL1j/Zy6DzI9YZ3xFwI9E5XlF2SS2ufhHGbAVN
+diYgW+4bGm/KK/Np6McVQxTDgpQsw4BKonJEWHeUWdYd0IDvec/zcNekPfzGs7yWfqT2GHPJ
+voDGAaH8FJnuYp62m6cYFHb00Cm0OW6RthGVTow4U04TRdovqD/BwjdLaT+/6gBj2TGu1kd8
+2zjHXnaQ1dSr3TxaLnCW7GVUnOLJcVt7eOX7GRUneNotpJdX3s0oP8VXanh5MmLhXk7zJX7d
+SdZSvD0XtYbiMy7fz6w+zWu6yNdTnaX4h9UJClkyk7TYNbXBwZdqmbqNU7efsvgtUliiJSPf
+t2lIiAvScZ5OjjXlrgpYOTbZI42XBI1v85rxJfQK6s/wpAOCifEtQ6KadQRytFXJOSF+0NWw
+14fk+Hd6HiFqmR0ZtUp8g4n3SN1x1vIjHFkfv3I/Y/lRLt4GvFOaz3KWHWI14r2vRhpPscr2
+MmovTBZ56T5GzQU+3jst5zhLuxk155E2FTfrdWLWPg7eRzXHAvAZm/BPgAGk6TRryYGAunO8
+ph7Q+XHorBzhxoQaUlKdFrR5sMKNgt5kSff7Cdgm1nbPmZAsi99GWvEjvRFBWr4p0kKq2EJE
+Qo2IQSbcMhdxvn36UUHDNh/JIteCLT78RBMiaiJaRqo75c8jW2Xs1ercfpHKkNimHRB13Y9Y
+KrcnJLhl1Vu7UGZTsp1ji+x9/Gc5iEzD3gyQnaUL4owsvWfSa0hN5wKSllh7BhuRw50K9wek
+19u6BMy1RyxTdgfkLLfxZM91Epln7qMlxDumb6IvSLfyohkS/GcTC7zrL7GiF5kQePPcyMaB
+1RTpiPBn9gg6rfNJCj1yHmOJZ6bUyUNsnXWIX77WWVxo4+P4/Ewvq5KzSOuwqOMCg55qKX4z
+oHaPLzPMhCg0EVc6ixPtFx/h1+/2Zhd4FLzpIww3IoqNec1+S95wDUi1LcV1HhbW7vARiG2r
+rkXsvC1JijYTVvhmVTgQPOfQMpyjKuzxrnFhm8ZtYLacoQUmzLf0mMVbRqw+ThWnmBMDDVnF
+7suOM8NSzV15s71DCWWH6OG5Zi7s2S4xhCXHA0KXOQavIkekzXcXGroS54qbqE2nqeyg+Q68
++R6oUfx2TpsGAZ0fi85zHbkm/Cxrd7859GJy5TYfdoC1OMYiopnSMiCoxz/z+/lpheaSRg9U
+ONuUNJ8imWPoNJ+WYitZ7rtQRhA3+4ZJXjWlzPcTzzF2MkzbQhZSrSd07uhlBHBmW9HnUyKM
+XSSmMduYmUUmpEKfxgM+DjTzrONI1VpnL4FTapONQ4rzsoO0jK3UvCZbK+uXfSJN7O3/Ts91
+FcTNdYy2DVnukrDZP0QyxyPWPryEkLnLL5RrFb+aGhdhzlxEaj7m6xRnHbHckRnlWDXIj40w
+4xaQpKN6q/Npf3rgTOdwK3ShuRN5TuR6ZrHUll9MCEq351X7y0eQhvN8+Wk6I90qaI1/cOxM
+Q7/5FPHs+cS5zAwrtJm8qNYxXOmNisZ7KnDOPGfj6DoCZ6HdhM6NB4h+Ti86i00oQfPdxHZF
+J9npqZbUZJ+6g94eEtOFx4W1bxAIKQ6JZbaUKIeS/Yy8NeSYXKNZrrMpYYZmLq8J6t3J5Dn0
+RU7BBR5F6719eDP9shzFy9wKu+m8bCuO1EcSPS94A6tc4eLPdoyttvYrIcouMASh88PWs9oH
+QedHr/MwJybMPHkLvwuLrFQ4efGcS7t8eTwbNNw8tsO/WOrkzJwTUOiVWGoVVOPCCDSmlnkX
+vkVKkJOL13pQBDOdmNZ5R+lBAXNZZd4Fm4mJLb7L9vvx/Sb3zvjBNkNgwihwz1zjm7MzQHkZ
+ySgyQ1ooDV0eFlzr0sEgxU4vCt0+psLSOcddPiKqO8vOKrX2ZFpmbKNmyDyyNlPzVnpENriL
+ki0YuR45K71im9yD0s1ZS10DUZuktf7x0bbB1XTlGbJ7ul1ovj07xk1+PTA7y1ZUTGrR272z
+/AiZnmmV3RO2FwvJzDRmVZGKZPZIiZM42U7YSCtaS3AOmENf7ETJsAlcQZYkzKUu8yneTExo
+I+at96H7zbSS2BXtpbKDjfxLvIu24D1FWtzuzPx271y/15fhNy9Y6pO50rfoMLfzGj810UZU
+SKnZ5e4RbFGsDm3f7+mQZBeRbUWPc20eEzeeZoSnzXdLdync6pck9czdSUtvdotrcOWGmgY2
+EzOV7rHNbsxQ/JPfl5dnw5X6RCw0Sz3Ar+5wYyNOEUvMmY3UtVf4EQtNw9ezYO/8eM6do8Sz
+bJnG3HRL/PM5sJ1Ru9WbSbMNyzRzRmwKj/Gb8fPQAX5qjgm/0XdxI8E/0JSTYEbK8azvYXH8
+Z8ziODWPovlN9qRIc3asOWuBe/lRCtvTIn3P+MH2Jao/zzJ6I3flNUnr4PhBe55JQBVR0csK
+izbzlZj5hhgxaim1+4m+gUYenDmEZNfS3WRhoillgZW/2CZtnV90oYVnuDmZZyoq84jMMPcL
+MfcNNeXXeUg4VvGrKLGhVqKlVPlJokOMbfoWP0mqCS3V0tVxNqvAT6a/e+dT/hT0FcdgS/4C
+c1+uVdZ+bnGTDbvYOaHA2o5hU3CS19wjUJymURItRK8zCjucvAPNuDFmjEK3mktsPmXGbD6h
+ZUyYV+foL9H2lF+hV94KZ3qiTcnkwbY3i2VReEm8ckyk1KDtY7zkWCvuQpJskB2YYeYmNqUI
+jQTN5OrdvszAua6s2d6pTovWefqHmnFSzKnpDou2kflhpsQ4C3KYWbjMA0k2JSZY+LItUjuJ
+rCwrVpN3SLJxwl5epdKFFkAo3OVLCTKlp5o5EWdFbGTD3vlxXNnuF5RvJ8XVuUZUuCSspTYN
+oM2nWSVvMauPM9LaiUtPCxTaa6eCqn3UsiNcxQCvoMM9ssaz5DhfOYRU7fQv3s+W9qMKFS9v
+lUdktWfpCb68l1u6kVZ9lq+9DN7DLdlGW36SJ528KCqo7qaWHmLL1ELpOWZanUvsSkpDL9qq
+QSq7SNH4Yo/ytJvcfkpUpUvqG4yWQWHLaUZyvWuswq9+QCh9m7Gg1jW6g9LQxy/fSq84wanY
+QV96kCu9yM7byajr4ZescUfSzFy9DQNrqbIRoVQfr2xrry7yitf7xFS7RFS4Zm4NkA2j9Ufo
+pQdZDSfo6Uri0lN87cXkXl7xbtqS0/zWAV5ex3jlj/NbNYLyHbSi3WypGlX0f9tTJ/nStwNK
+dtHrLyEyFdL0Nrt0C632ouDbK8/8yl30sj1s6aBQfpaZWusS306p70WVg3iPEKPrPIqO8tuH
+kaUbfCKr3HL3shVDaG03JabKZcFGhmxQWLefEo0Pv8nAt5CyvfTSI+zle6iVZ/mNxwJKtgY0
+93Ky6h0ZMSbuPKPkXdxWNej8OO47ywdFHWNibYbHbw2rEOWQ9v5C+6hIrpqcBhdQe59Xe08Z
+n1I0cYdRPijETZy4m9k6oh0/fqsaUQxP3jnS3o7EF9UvmLxB/N1yxm+GtuHvOKJ9x2bcL20b
+Jhcr0wjxxrSN3xXFJ2vHJxu/Z/2DWRC5drGIfBBVqLWtasNHnqFHZlmSQ4xZRZ4VFwRyFaK/
+952Vw5M90jaEamuF77LV2htAkz0yfkNfqREq+scrPzpZ+ckeGZzske96qkWF4jviyfvOKkQx
+9IMHAPBq4zXUTPYIXur2bx8PmNgqtD2Cl2u8PRN9Pdk7Q9oF4r35XU8pNNoHFeQaoXyipy4L
+a/eSRLHG5CDT0Ba/BtV/uVcFOsNTYf+2X8MP71uHRa1Dkx8m8FTY1Eaq3S+I2kZEysH//rwK
+6Aw6w0Oe8JAn6AwBnUFn0Bl0Bp1BZ9AZdAadQWfQGXQGnQHQGXQGnacT6t5RcpDZqvfFbSMi
+yL9lxTuSkgO+4sf+tfkM1KfuIkN7rxZ64cdZ90kwPcWo6y3Q+Sd07huZT3g6eY19XKudLiSp
+wynzDW9daUynA79sNpX5WH/U5v5dzMnTMqTBNKFdJzoleYVzYoejjvRI2hsEE9Jftm3eCeY+
+lM8++yw7e9HChRk6kvDwCCtLK91pD5729vbH3Cm1tbW6s/qhIWEJ8Qm60x6c0dFRMFcv+OD9
+D+PjEqAOuoNS0drdvR/qAPyWS3MaTWRkJNRBR3jw4AGbzY6IiIBSAKCzvtPf3//CCy/Mmzfv
++vXrUA0AdNZrVq1aZWBg8Je//GXXLvhJZQB01mPu3r3r7+9vMM406pS72MF12OI8bMVR6GLQ
++ffD2NjY/Pnzn3zyyb/97W9EIvHTTz/V/2sB/8JaUrGXn8X++lfs6dewrDXY7QfQ0Y8O9eho
+aHQ01EEX+OzGDdXgYFBERFV9fa9G89WtW3q/SvevYF6mGL0cw25hIdbYn1jYh/d1tKk3bkyD
+DF24kBAaOj3WRe9z8yZ+wL0kJ+fAtm3YnTval/q+Rtg9rFeF9WuwRSJsphHWdADTzZ1zZyf2
+979Pg9x74YWvnnpqeqzL9MjXf/vb7eeemyarU1gybsv7mJCEvTobW7gO+5dO+lxcjBkYQCCQ
+n0tQMPbdKcP2Euyvf8d26OoDZr29+p2+Pqy//90dO0r4fHwAU6n0fo2mRRqjoo40N0+T1bm8
+B3MjYSv7tL5cbMOe/xO26hJcJHkkVykw7A7+mXT5siQmBj8A+hdURDdYWFS0Zf90ecjz+kVs
+/jPYfApWXY1RzLA5DGzsBnTxo+DevXtFRUWOjo6vvPKKp6fnkSNHoCa6QG5ubldX1/RZn8uH
+MKaN9sDbKQw7fw3699FRWlo68dDCH//4R41GAwUBnR/NnuNf2JdfYregbx8tKpUK3zXjOkdH
+R9+/fx8KAjoDenz6fP++n58frnNHRwdUA3QG9J2Kior58+ePjY1BKUBnQN8ZHBxMTU2FOugO
+paWlhw8fhjroBTdvfr1yxWp5c7uiRSdSW9EYH52ilHbqRHua21tlnQf2H3jMnbJ9W5eypUOh
+G51C9qHiPaIjm4e8qb2jbeVHH30I5j6UoYHR1yyeRIqNubk6EX6eqajYSkcaI8g38Yl9icp4
+rF/99+Ae5uBqQUufxcvTiSIEltkKiyx0pEdEZWYzHZ7o2robzH0o6t5RvxDz1/8Z2PmOREey
+Qmdasua9oCVHiZLH/sW8TNSnSRWw6lqgjnSH7vTIhi9CmQuMu97aA+Y+FPjafPjafPjafNAZ
+dAadQWfQGXTWKZ1lA4i0D/8XVWi0kX/7pjL15BgFPoEKkWu+fan50c/ca2dUo/gSQGfQGXSe
+Yp17+PWnuE2X+LXHA8p20Yp20CrP8JUaFB9fc5SJjyneQS09wKo7zS7bSS3dy1i2l168g151
+hjfhL/5RUHeMuaSb1dSHSEFn0Bl0njqdpf2o9BRFwLLP30GhMWdZ0+Z68uZ6xdimdfPkJ8h+
+zjNsmPO8kPnERS65b3pT0Xm27i/Mdn3VjWeasJ4pV6P4/rpuN5HDnm3lOT9QSVcMo1LQGXQG
+nadQ55N+LF+bRZt9/RCbjIOCNf8QZiyxIca5Vx4kUv3mJe3mynv5zZfwKZGOK6KcegufSmLH
+mFgxfrCtGBWWtztSwi34i2xoZWTFmFAGOoPOoPOU6szxs815i+gvtEnbw227LG7a481LsMre
+RqLYPWtGnu0aMA8t92seFLYOIlk1Fj7LffD98sReGN87V+30cnZ73ohtu+S8QNbDbwadp6/O
+eL8rBn5wXUX98LeQqhDFf2y3MjXyw+stE5Npz9dUiFyNgM7/e51FtpkHBavek9Rt8mBF2i3e
+RmQyDFP28pQqQdOl8VJofqSzbABtOUrhR1hEdRDFkvmObPOUTQEyzSM/gwadp0RnaQ+/+khA
+9Rk+7qBUJag7zqo4xm3+j+uf+F8bz3EqT3Fb+n44kl97jF13jv/9SHyyC7ymi/zGU+zl+9hN
+qsd04WX663yCzHCzyt7k60M1lkjJJVuIgnhTdrlf40FfkteclP2CjsHJq9a4zhnlpq4lXt/p
+3HSYzObPD1vjn5JnOOOl55BOhnwQBZ2nn87SAVR5nu7v++z8UOeGIUlbD41s+Zwl4tIwKm4f
+EbWPilrHNxKZRrjiXUnpSoJjtkfziLhNu9tFlJfFHYMBQWzLmA6G8rKobVTUjo9RcxManRK3
+cpr2+CXX+DUOaxfSPiLU7v1VqPaHvIe1L+Uq0PnXdBP+qfg2PSHHc8khRvhCcw/E0Asx4lV4
+V/UJW475Ry12KjjO/+7AST6AlKxzC13tj7dK62wfgo+p2OpFCzYkpzmnd7hHtZHrepBHfccK
+dJ4SnRVnaTTOs89YGBe+LWrc4TL3xb858d0aBnlJBVbufKOQFnLzIFq+zs1fYOzJm2eX51W8
+zj1+NVXaw0rK8Sg9Qgtm4TrTl3f5MIONiHG2aW1u9vbPmCYSijf6pdb4Ld3pyxPN84i3XXSI
+jx/y8RbbM2ONfFKcSk/x5f9TBab/jao+RDkilKmQ1lFRx2Xth2TbkFA2flLTOiLCPx6bf3QG
+JGzVID8+JxJOfK4qh4RKNQo3qqarzvIT/uxMIxeOUcR66qJia2+qESfMLaHBxjneMfcNL0aY
+SaDcix9kHqEghqQY2S72zFhmzljiI+uhczwt0rdTwwTWCe2U+EoCusSZK5rtGW5JiTbkdlKX
+ylz93Y3deGaSet8FlTaukW6lm92MSEZRa4iisHn8JopCg4LO8FQY6Py/1tmPlW0hWOZECzcn
+JdpK0p2QcII43YjXRt/8sSiqzJoQZ+kRR6i6HFT5pot7kefC5RacGlKbOgDxt87cqdU5VkqK
+b3GJaHTnS2Z7xVpzFltF7uHVr/YgW898TWRXog5aedqP4Wu3cLWbYzKhclCYVWzKqyfJ1aDz
+5Hlx67BQm0FU9lPnID3aU2Dl0PgJb4+217QT9z18Jy7/j0e/pP3Id5c6J6NCtG3uQ/C6yfpA
+52mk8zEyJdk06nUi6bU/vsS3SatyCRAQkqR2zlF2aa1utFCTsE5fNMRMUukpiplnke6Rr7R1
+ElkmtzgRbIzTd9GCmZZR5a6+IXOZ5Z4xGUYEkSkt3si/llQidaV6mnijZshSz9hSK7d499JN
+buYRDkv7BAuyDVk1oPPESbGg4VRA3npSxkrf7M20RhX60KsK2kuUx5hle1mNfdrHOJtOs0p2
+M+suCf5dW/zlRW7VkYD6i9//CR+oP81edpz7w8uV+GR153gtF7glexmVZ/lSFeg8LXTGP6Xf
+ZiS0ehQcYaUW2wY1Ucq3+SVV+TWpuWnLbH0kppHt/i2Dwpoub16wKSPVTrKC1nKeEZZsxkiz
+jyjxXHqClV3ulbcrYLHUkRxqKix1CpF6Zylc2Iudc9aRU+v8Kg6QReFGxDTH/OOC5iOUwBZi
+dZ+gZKVb6iaGDM6d+5C2IUFGqeVcx1nkaFNfkRG1xLvy0vjj1oNCJR71xH0BpPUKkr5gzgsv
+vZp2BFk1hqQunP3nebMXHkPwk2jtZEPa57fxXXDbmFh2lMyPNcs4hKwYFeG7XXzX3zEmzGm2
+c8z1kg6LWscX2/6uaFm7S3CFT+NFdnybd8FxftvI+Ntpn/FG5Jrx4SGh4v93nxF0npr7zn1I
+65AQ3x6Ul8Xtw6hMjbaO4Ad1iHJE1HlF3DZ+gKe9kHJF3DEmbh9EtRvhmLhDeylbe2VGMX7V
+WjGknVh7MXwY3xJEHaNCuQZVjqDyARSfsfOySNGPH+Ch7eOPF8oHRcr/9S1pfdV5kJ+cb+u/
+2G/Vl6EdF/xpTJP4Lezmo/6hCcakCMu4jUxcUmmfVufMdMNXXnqOJmN2DgQgfs//2dU46yh/
+yVpnD/Yc7zhC6SlBywkqP9qYIJjrJjbL7mamVTvlHuPXrPeJKfBNUzgQ8r3rT1BDMs28xSYh
+9d7C4Fdnm87N2EKNkHotPsjKXmbtxppDX+ZddY6TXmkTEGfmwzWJeZ0hU//2+4ygMzwV9jvU
+OaXQlpzpKxsTtY4K0habSaReIaHzHQKMaUGzZ7mYLT4tXP1u4JqPhFmLLElMQ2qie+E2b3+2
+kW2qfVSjG51nmvAWNX6hZUCac1ixFbXYe3GroxfXNGs3VRJjmLSfXyEl0FmE5DYn12KfpW+5
+I6XO0Yst7ByNBbHmzHiXumP+3gmW9IU2nkK7vD1+gkgzzhJPYeRs6nKf7OV2PkzH8gGhQgU6
+g86g8y/eOxfie2dy5yfBK0c4EVHmMVIPP95cjwT70DLHwFKPTJkbNdiYXegem2ETtMiRl2nu
+E24mKieQcuzQDDsqh9D8WVjLJhdajAktwTRqF/J6D1WYZpnR5R+UaJJ2HK1pc2GhLiltTm4l
+XkWdbmHLXaMLrAgEU3GStaTAR3mJ7pdi5RJm4lpEfvNfQXm5dsxgB0m2eeJeXtMGDzrNYWk/
+6Aw6g86/VOf2IX5yroUlyzrtDWJskZV7lNOyM+zYhVacPLcMhQu3zKt0HyPndVLhPkZCvHnQ
+Mq+wlJkGBi+lrPbxSLIOV3hyJUbCWnc0zIyf75lUY+eT6BBZZOlINcw5xApLmOubQQiONnbn
+OifLHRwLPZJSjNwDbZMbHF1c53NjzYki25JdZM94S06BI4lrES11pYSaoQ0+wUmGkds4datd
+yT52oDPoDDr/4iAKNbJ0vSc9ypQSbkpf6LT4EFcxJGw5TY9aaOoXY5OylSUfFLYOizquoKWd
+3ou2MJa96SHIcy8/wYxv8y05I6ju8mZEmrIKvSovocpLrLhCa0qKTViDV8VFpHqrFzfSXFzq
+mt7qX7yDHP0GvaabjB9j8/MJ0RXuuZtIoXmOaW9SEjuJxad4pe0E/3BTiZLSeImb2+aRf5TX
+2O2fUkWqUf3221igM+j8e7tR1dwjkGuEK66Of2XfmEg5gGhvK/ejbVfwMeLWby8YaicbEio1
+iHxQ1HlFJFMhbUPaB2VlGqH2e/Yujz8ehh+6XxavGL8gKdM+lyvqvCppvyxqHUblamH7ICod
+EOJjtE+UXRYpNcL2MbFSg+LLUfQjimER3oaOYVTap72qqb1uOYC2jgqlcGUbdAadIaAz6Aw6
+g86gMwR0Bp31TufeUVKg2cr3RJOP+EJ+kM4r4uL9PuLH/rX5DMS77gJj/BQVeuFHWfdxMD3Z
+qOst0PnhqPuGjVyfSVvvlLTCUReyYLVzziZfXWnMGgK6fC4twO+x6nwXI3hbRUjNU1brRKcs
+XOeettZVR3oka7OLGeXJbZt2grkP5fr162lpC5JTknUkwcFBlpYWutMePDKZ7DF3Snn5ct1Z
+fQ6HIwmU6FCPJCcPDw+DuXrB++99EBcXD3XQHepq69e/uR7qAPyWc3mNJjIyEuqgI9y9e9ff
+359MJj948ACqAYDOes2lS5eefvrpZ5999urVq1ANAHTWaxQKhYGBwRNPPNHa2grVAEBn/eXW
+rVseHh4G49BoNPzAG2oCgM56yuXLly0sLJ555pkXX3yRRCK9//77UBMAdNZT8N3xzZs3s7Ky
+Nm3ahA/cu3cPagKAznpNXl7e7t27oQ4A6DwNyM3N7erqgjoAoDPoDPyeuXr1amxsLNQBdAb0
+mjt37gwODm7evJnL5fb29l67dg1qAjoDesrdu3fT0tJefPHFv/71r3//+9937NgBNQGdAf1F
+JpNNPLTw/PPPv/POO1AQ0BnQXz744ANTU1Nc5wULFkA1QGdA3+FwOH/84x/XrFkDpQCdAX1n
+w4YNBALh+vXrUAodoaCgYO9e+DIf/eD+/fv/ePf90cF3L+tGtm7aSSUFjGqu6kh7rgxfu/7p
+4/5s+efHH304qvlwRK0LSY0IXi1t1JHGfDg88OHVK7fv3AFzH8qVsasmNrNJEnNfVFfizjUi
+Ci10oSVEkYULc744UPRYu+TBfQ8/2tP+wU8zI55mhE95/uwX+CQ1RBdaog075mkL52MH94O5
+D0XdM+IjMlrxPqIcFuhCWkcQ7e8p6EZjOq6ghfs90UDuY+2Su7dtAoQGmz4z6H5gsPfu1Gf/
+A4N993WiJXhOYQai/ENb4MuOHg58z7aufc82rrMDW2yw7j2DHTcMtn8B+VEO4TrnHt62CcwF
+nUFn0Bl0Bp1BZ9B5euss7Uekff8/X/oQ+cC3C/nh8C+bV6b6pW2WDaC/buG6rvOXBjtvGuz6
+xmDHV9qXXV9NDvz2/HAJ3y5cm5sGXV/+aEr8Jf52eHb+knf8cnL6X968nf/X3nuAVZWlaaPv
+nX/uzJ2emb/vzPx3pqu7q7urrLLUKktLy4yoKJLDIeeckZxzTpIElYyiIBmUHEUyCAKSJQoq
+KjlIFjh373PAwtLqruqectBa77Oe8+yz99prr/Wt9a7vW9/69jmzb3koofPPT+fAu8KBDSJ/
+C52D7gn71goFNYuy/iFUxK9WKLDhR3JZ9EKdoE+l4IWmH8HlVlG/Cj73O4LUDPAh0DnjBXJm
+EduFiDakTtLH6aNIGfkbuDyNm2N0CTdZx7cmkfAQUa2IaEXkA6SMv06uSdyaQNJTxA79OdK9
+SjcnkTKE+Me4+SMyZ71A0iCu9rGqQej8rujczAhpF1BT3aF2nZca8OwzoV0SUf1SEd1iF1sY
+Yay/CQ5upf/n9xL12SsZxfpbYfovhvskI/vov/oN6RR3DfvqPz79L+VkwejHkq5hu3+/8z+V
+UwTDH4iFdbOKYv0vcGivRGSfZBTrlkvt4hG9kpEPJSP7JfxyTmiHHfdtlYh8SGeIZP9rcItY
+BJ1ZMryL/m/ioPuilzvEvNM5OAV+v4P7E5VU/ld/bfze0nkG2ZPwjgKPErhEwfDH9XEEXYf6
+JeQyUfySVoV5KyhmonCZplvuCu2Xpr7mvKDngaJVFFLZVpFJKc1ZFDDpS0VriMqGfCDiJpG7
+hMR74OMFhyzOyIPLFBcfIm+ZzkaXuYSLebDNxuV6mN1B3ip9bxETeYu067uIejpFyQX6TPEa
+8ldwtQgOBQirhGsu0hdoRz1VSN4CzdbcZRSu0jlz51hTxBRtDMTdg6AivpGEWSXy5gmd3x2d
+OwQUJLYpRPOEdND8Da7jN/D9+pTy59KBpwKqedRDjjpUi12q4FIO5/Qo49Ww2cWt9qVRlkBg
+Gbea+W4e3T0m2UIRvRLOoV/98//9T5yuJyIfMVSVfve/f/P/KqUJRTbz67l/zaX8udTFUxca
++A1svhHU2X5cf69djYhX6lFpi13cMtsVw7nPF54yiOF0TDqparaHV327sCuHf7v4pSpuaYPt
+J/S+Ugo+6lbLuNzKCOtiWJ/fwyG1W9ryc+GQM9Rc8X7TOXsBIengNUXkMArHYXQRro24EAN+
+BTDMoJ2I1BE4h0HEEHrpSBuBWxQ0XSBkieCHSO2GVgiUbCAZhBuTuDkIM0+IO8D/IaIzIOaO
+2EmauddvQ8YAoc+ROYW0CdrwvtEEBRNIuOJKH9QU8Ud+mGfCvg7hRdD0gLgF3Eth7AWVq0if
+QeQdSOtD3AdXHkFfG9s5YREP71Kas9a+4NeEcxWypuCdDC0vSJjAs5m2rimC5y0hKAF8+tD1
+gmIa8pcInd8lnZWkP1O6QtP5Uoe4z60jAqZfydnv3P3VJ/qpZxR0dqrG8zoH7eU5t0faavtu
+oW28sh/vFP1cK/jA4a8/lgk75VMrEtYlZnt5/74THx8w+9Y568RZ9T99y/iT5i1B/0wObp2v
+5ex2fHP6j/rJJ/j2/Y7H4ZC82fYjxofPuXy2W3S7TvCB00JfyFjt4jf/Ws9lz/5vtmmGHTgo
++ZlCEs85t53HDb/VdNnxDe+nZuVi4e2Myx0Mz8QD3+z69U6l/V6NjOBGkfeZztPIWYCDB7Ru
+0YOfvYClzviH45QSHBNw/Bw0rkPBFQa+OCoBl3JIikAhFDqOOBmCmFJ8IgKzFEhpwbQAZtY4
+qQIxDezWgusNyJxfp3NCLU4dwwEGOCXA6Yi4MeiZ4ZAKZC1hdQsm7uC2gd5FcEXC3g3HzGDm
+g6+UYZcCESV434WBPzQuQEgSsjFw9IaoFcy8oegBC6qStnCPBb8RXOugogWhAFi4gd8CCdRS
+fYbWzrEV4DiEfQaIpSz8CZbxT+j8zuj8uWosH2XohvWKe6UcU3Lfr+a868s/fqyRJnw+8cBZ
+k938el8pXDjOUP5ot9R2EcMdZy326Qcd4Bf4xrNLMrxNNLSTYX1h3wn1b6TO7RJU3iFssEfC
+eLtaCr9PFoeU5wE1+517OH+vHsspJbXHoVEyvJiTl+srRYddchdPXR2WNLDdxqX6majdXj3X
+bwXlDoc9FBEx2yl8kVPWdJtavnhsw2kxk52mdxgRXeKBhZw88rt0rhw+JfmHA4q7DHMEQzsY
+77F2zlmE2wUo3qAtasowzmH5mrzDoOCPokVagUqEwiQWlgE4LASbImicw4UniMzHYX9EleOg
+M1IX4ewPvevgkwKnDhTtoRAEjxuQ3qDz9RLImyJijLbPb71A7jyCbkHSCqqesMmEbQRUYuCa
+DN5oOAdBrxAJVdhnh+QZmJnBOhfWcbCMgwgDYtEIiIZxHHxioeIKBWucq0UzE/JukI6HsRuc
+OpFcDnFDXGM9Je0BpMxhnwVRbZw4B/cm5C4QOr8bOod2CsgJ/UHA5ZhjNrdbuYCRxeeHxXaZ
+xB45uudj6TC+yHY+Pu7/85tT2x1qBDVsvuD14HRPP64SfNQ85OAZzt0uLWIhLTSdLc9/fUT9
+iJnvp3//j//C43lcyehT5SQ+c6/PdijuNos5eIz7dzIRHAyuP4kHHNdx23VU56C+x45Dyl+Z
+x3Hwi2+XMNspYPG1tv0+HsaBiw8EeXW3C0ec1nXawWV31DT46yOMzy3KxSg6B2QdO3r8c8pg
+UNf5/T//5/9RThEI6xR7j+mcNY9rZeBRgU0BQktoani2wS8MUu7ImYSIPb5VxTFr+OXgrAz0
+UqGsAd9eXEzHfh/aDN5tjYQpWLtCOwn6jtBJQkQl9FPhHw9RF1yfpMOuKGNbRAEutYhoREgD
+kp/QFNa7CmN78DjAJBACdtC/DK5wOJ6HRiZiivG1I5LGYGAIk0gcV4dRBvTNcNYf5yMh6QCz
+81Byh1EQuD1xKR+ChrApg541bO8jNg9COiw6LyClBWfl4VQJaxv879/BtIJekhM6vyPtLGxk
+t+Og0B8Oi/7xtN4hp6yTQnKfcGl9KXbuK90EvuhHYho6H+/RPHypXzKo9LS46ieHBLcpXzvj
+nXVK1eKoVzPjcrPo5XaGy41jcr5cntlHj8vvNCngM7+wzyRfKLCAU1D6jyd0vxSx3qMdd5zB
+8cdDYp9w6O9xqBe19fniW/6POYQ/l4vk9sk6rnH5qFXUcXWXExfbhdQDD2hlCoXePStj/MUR
+id9/I/qZVaVYWDvjUquo89UDXEJ/OGP7rZ7/Ie3IUwGtYj9+x2rrucKmkT2LsHzaSD4jRxM2
+bRbh+bBOQ9YkTJNgnQllIwjZQskXtsVwjED4Y1ypgdotxDZDOR7JU/BPhss9WhuqGeKUBqyr
+cb0W5ilImKRN99QuKOuASx6nFejk0UBfFVMBnwn8HyC+AbIWUA6BYQmCMuByF/FNUE6kHeAe
+UQhohMMFcOtAxRsaKYhtgaIFNM7DMZteyBvY45QMLAtxcxTO1xHQi8QGmEUhgbVqyHqBiEKI
+qoBxHs43aDWdMkO77Aid38FGVZNoSJdERI9EeJcEpe8utYmF9UiEPRAP65GM7BY1d9+1+9Sn
+RreFw9pob3ZYl0R4t0Qoy7Md2iV2caME+q5O+mRkr0RIK7XOpf3htPebVVREr1Ro7Wlhri/N
+S0Sj+yUi+sTM3XYIeR8P7ZdmPzG0Q+xyu1joAzGqqNBO8fBOUZcbh4WUP+cQ/kTU/Zhvi9gl
+Fm2pYsO66QJDH4iHtDHe/33nadohlv+STnkLtDM5c37dLqU+c9mXlpC/jJw55CzRjMicRf48
+7dnOX6TzU7fnzNIn81iF5M7Rx7msom5NsrKtoODl+iMolmXO0Weo42zWXfRzF5E3R5sKVDl0
+ftbTsxfpDNQSgLqXMtqpurEz04sC1hY5dZIqh7KrqQUCtWqgKJzByp+xydHHrjx9yxxxhW2F
+qLBLLaLeedwO+QIXW/+2MikyNgn7lAgENIhS+pRKAdUCPtVCwT+gW6kMfmU81vEnLVPP+jcy
+qGqQqDASFUbo/N/A6HZadV6kI8co7SlOa0ZKn/41/GJQNjnN5VbqdsZlqpx2RnDTnwlUox/3
+1z7rw6UzpUApfZfHSjnzPyG8hNK2GazPzB+O62AHfVGPyJoldP4g6fxKXQZW89unnDKLO2GR
+wu3X9FdqTKoc/yoB37tCXrm8XhXCF1tIzPZP4vI0UodwuQq+JfArwaX7SJv+EQFdVJ5xXBuk
+N7KjuhD7/AcCNdkRZeNIHkB0H7219GNCxQid30M6U6taC5/tfzjyEafsp4f5PxH3OO7XJk6t
+tcO7xCmahHSKh7HW3WzlSy2u6VCuFlqzh7GOWetcRkinRPSAmJH9dsnLnNYXjlveFAhnBX2F
+d4tfbhW92EItzKkyaQPgUjOh89sStXz2i8Z2bgjpQlALaqFIekGvrNkpd5YOFGGHYFHr2ew5
++pNewDKR04MTdvBqgnMegh7SAV30mnqZrhWl6+kVNLXIXUTAVdiWI7YBziW4Obe+6M6ZW1+b
+57GeQi2TbxI6v990DulgGHlt57rMnbKgHFN14qTS5+eyeI2cd55Q+EIp6pS579cnFbYJ+5/w
+bxUPKDzJI/fHA9rfON8VPZ9+jI/x8SGNr0wKhMI7RU29dx+U/vQg328lQk9Y+XIYhXEou3zJ
+p7iNU2G3dano5WpuMfVPDyhsF3f51qGSEdrKIHR+g84L8IoEdxCSh5HwmNakWZPwDAevKiQ9
+YFuJy2XQzEHWGJxi4VMDq0DwakArHund4LSBVyPsMqEfCj4VnJEFjxkiHtD72nSeOKQ8hsBJ
+fCUFr3y4lOBGBxR0waUCzybE36f3wkR1IOyOK8PIfkHo/H7TuZNh6v35Lukdav4HpfW3nzHd
+71LMdVbwI5FLXGbeX+0+8DtuzW3b9n0kHnhC3vIzDssDSh57VcIPcwttkwo6Yejz5UGlb20T
+D3IofnkukVOI8XvxyxzK4rskjb8+Jvp7uaiTiorbBQ2PaHjuOmV1xCJkz0G+PxkWM8LbCZ3f
+SJQm9YvCn47glCxOSkMzARF3cEYVPmUQ0YJgHLxu4EgwckegbgntaOiEwDwA3/DB8zZOu8Cv
+Frw20MpHXDNUzCERhegqqF2AeSD2nqF3vc3N6cCSgDhIuUHKEpJRCEoCjw1sYnBaDG4lEDGG
+XBYrhpzQ+f2ms5nX559y/1FQf6eg6X77MtFLladENLdbVoqaOH3+p9PbpJ32ipnsNY45zq/9
+J5l0kcQRmcCbBz8X2+XQLhNdcZLv5FcqbjtOOxyJeCpj4bFDOvyYqtxX0mZ7hQ13ObaK29rt
+FVbeJ2b5mVKG6I3Ws5LGXxgWihI6v107e0ZBJB5lTJoLpUyabpwe9IFjNKQS4JWAU5EonoaO
+AzQuwSoGlsE4JACPQprOvnch4gqbJoQXwyALeUxcKYRhOCwv4iA3PDvh6gbLUkRmQsIKvPrw
+GELjAs7aQdEfSk7IWIK2H8RTCZ0/AGPbwHXb0fOnrj+VvfJQklrkBt0+wSf3iUGJqFvkfi6F
+3abJnJL235pm8ihbf35Qd4+IwS5R70OCEp8JOR1Ssf3ikPYhl1tHOeW/kA86dIbnNyJBx5TF
+donp7+bR3G7TwDA3/lJA5aB2wG4OvX3aXl8eFPjUuIRo57dq50V4XsY3hvAugEc2vGsRUQFR
+LZjHQ0ATkqkIz8K3irC6Dl45CCjRMdUuCeDkg2UijtnAuwaCtjipj5MarHepKNvbBVw6cEnC
+8dOwqoGbG0R94RENaU8oOkDQG04Xwe8I+2sQN0bqDJRdIZy0/r4VofN7S+dLrQynxCPqCWep
+A3rTqoURVM1jcPEQtcgNbxc29919QvZTEWrt3CIeXH5GXO8zTt39TncZgYUnxZU/PWnyjW2Z
+SPgDhmPUt1yqXwhb7zXNPmsdyGESxakfftSjkeF6heNc2Nng+/yqtrs4ZP6wT3ibWRmh81tf
+Ip7HlTKI6UFQh07CXrgyiuhCKJjiqAoEE1E4BVMPOsjTMhkBFVA3g7w7TMIRUA3zLET2wuEm
+5O0hogsRPch6IayRziPnBuPLCOhA3F0oecI1C+6VSBmArg2EjHGhC/EtcExF+jQ88+BQz4oe
+IXR+j+kc3ERHZIVvfuWB9Vr05RbRoPuM0G7JqIdSkV3r29ORfVLRffSli23iEf1SUXScGP3C
+csgDiah+ycheydA2RkiXOHsX+xI1VzwQj+gTc4s/LCDz6THBTyV8jvtthIEROn//BwSyFmgW
+sN9ZLl5F1jSyl1DJhN1ViCXRvuhC9hvKy7RlXsh6A7pgld6hLliio8LylugXk9klFK3S3u+i
+V3lm6Zg06piyAXIX6AoXsrLR5+dotzbbPMibo6tBXGHvNZ1/7tQsGlgr4J7P41rEf6GZcamF
+bFT9xJQ2ipQxEhVG6LxF0sVmxuV2MXbkGAkj+ekRJn/7j4wROhM6k1/y3Bp0JjHbHx6d7/ec
+kP78ymOJUNY7RyRtTlF9kvaFHJLy75zOglJIHkMB6zcKSNqcqCW/tG1JehJh7lvR3ty17dC/
+mqbuPxe7bysko/iDNjdPbJHKGCd8K+Xzx7P8p94tnZf/eOgk7LPhXQavO//zKbCG9nJvhZpQ
+KfgeDkoUpJI/tXk7xsbGtLQ0NTTVt0iSkBL/Ysf2rVMfdU21wMDAd9wpjk5OqhpaqppbInGc
+OMV1lmeLVIZO6uqdHR2Eue8Fnjwe0lDXJHLYOrCztvLz8SZyIPhr1vIdHcrKykQOWwTT09N7
+9uz5+uuvl8lfKhMQOr/nKCkp+bu/+7t/+qd/qq+vJ9IgIHR+r2Fvbw8WXFxciDQICJ3fX0xO
+Tm7bto1N5yNHjszPz38oS4h+5pUrzLZh0sWEzr8cPHny5MKFCxwcHHJycuHh4ePj4x9Es1aY
+bgwmwIxoIF38c6P12TNxLS0ih62ANdanoavrzYqKV1/fezzIZP4GTPyaGd+6dSvZ1cXU1PwA
+0qSkZOn27R9GWz6EpKVVt3fvIx4e6uBDaE55GlNNlLnzG+Z//Yl57f7WpbOiIm0/kEQSSX8m
+/fP/xTx2jplzlfnZp8wrjVuXzk+fMu3t3+/k4EClMT29jD17mI6O9Nf3vUUfRCo+erRLSur9
+b4gDU+oE85+3MUvGmEOZzN//gRnbRtZTPzf6Zmak9PWJHLYO9J2dk0tLP4SWBCgx8b+YX+xm
+fvIR8+//nvmbr5mJ90n//kxYWlpKSUkxNTXdv3+/v79/XV0dkclWgKWlZUZGxofg0E69xFSU
+Z4oxmCe/oem8V5BZ0EX69+cS98qKrKwsNpCfn09kQuj8s2Agg/nFTmZaH+ncnxXp6en/8A//
+QHH58OHDMzMzRCCEzj8LXs4zh4eZ8yQK/efFyMjIzp07KTrb29sTaRA6E7zvUFFRoRT07du3
+iSgInQned6SmpnJwcCwuLhJRbBHY2Njk5uYSObwXWFtbffpsrLt/q6TCknoDU6e+wYktUp/e
+gbGpqel33Cnj45M9D7dKj8irGASHxG2VEdI39nhobOUlWfa+HX39j/d/9f8pi/xaWWBLJFWh
+f1MS2CqVURb6tSTXr+XlJN9lj6yuMXm5OeR5f60suCWEIH36H+V4/nmr9Ijorw999eui2+WE
+uW/FvfsDmoJg3gezesuk2i1Tk3o8S4Cc5Nl32SOLL5kS/LtWCraMHO5upR7pgIsC4lOKCXPf
+isaWQU3hf2DWgVlK0hupCg9joSjL/47pLC2050U2mOWkC95ITXBSQFJ6CWEuoTOhM6EzoTOh
+M6EzofOHQ+cKMCtZqeKddFnFppFc8RNHNZW57EfnrPxLmX8hdC7b6N/KDQFu/lq+6WvFGwIs
+J3R+z+i8kI/hdDxNxWg2qwd/1v66g8VCrNxhDaoyrBRh8fZPuHcqFwu3fwSjK7BWjNEMrBA6
+l2KtBDNZeJaGp2kYz1//+pT1dTIfczl4mo6JLIzexPAtvLyzweU7tAAXb//o+ZPQ+X+czhR5
+s6DLAdHTUOSD/BlkhmC5ih7nzEYw77G6tZZ1XLs+/unj+o0ZvobudLrwKtZxA+uzjHXjPdZB
+Oetk48YsUYm1TKh/AhNz1vksSOyGoimrwHpWthrWLXWsq+yn1LKOG1gH+UjwQnMm6+s91mc5
+yx3KrlI1qzIsLi/nI04eQofgaovl6l82nevR4wqhXZDlgSIP/IPR7giBryDP+hoegCJbyHPh
+6G6cOQ4DJTwuXO+stHMQOAwDI0yXvUNGEzr/jXROheoZ3L1Fs6POFIZimK3DdALOq8DdACNF
+aPOHjTyu+mCtBhPX4SQJD2OM3sFMPPKDsVKBRle0XUH5JXio4KofPfmnGMBWB48KwMzDdV3Y
+q6ExhfWsaqzchPq/Yzsfxmsxdh5/+HfwG9O3pFvAWgGZ4TRnrzrAk3q6KaZL0Xse4ZowUUTW
+NTBLkBGIlgSUeuGSJpy1MViI8Wg4SyLQHDfDNyaNaizGwV4YwRbQUMZ8zS+bzvfQZAotcYyV
+YrWU7uVqXejKYaYcq3c2pug8uo/iYzcmbcrkLoAtN8KNYaSB3sJ3tQojdP7b6ZwJuT3g4wTv
+PpzmQPkNrGbBXQCastDmgNZZCH0LO23YSqEpEoaSOG+HaBVYOaDdGyaaWKpBNBeSHGHCgKwy
+7mej1ATnFOEnjxvuiNSFhABshcAngvZ8eotzPgmBXBDjwt1YpGiAcRJqThgIg5MuwlTBOITm
+SHAdha8DguTg6YEEUcjzIdUZkqJovgY1JcT6wZAbXva4IAI7aTiKIcoRzgwI6LC2UFmNWsiF
+PS927kNlGq1Z1sftL5XOHXY4/geIn4bMadTcQpsVjnwCyTOQOYOaRJbQcuGkgcRYlnXEsrTX
+7uCaJHbsREo0Lc8VYmy/L3ROg+ZZ3E3DXRvICuJ5NeYjIbMNRipwUIS/GS6rwVUDF41x0wza
+SphtAjMBvGq44wZnI9qWSxTCLWdYaOEqpUBbcIUPUf5gtoGZDZMzkBKDkwqMddGTR0/+s/EI
+YiDKGE5acNCCmxG07fAwAglOuKIK/u2oCoWeASbvYjYaIpqIUEBqAJidCDmBbA8Y6CDeD76q
+6CpHnzW0vwK/Cv3QvgvQMt4w9cuQpIEAF1yRgSwvbvhipeoXTef75tARx+N8zOTjZR3uGkBf
+Fs8LMZOHlyUszZsDRw0kXGctWMrozzxjnDdHtCnEeeDrhuXKd2VvEzr/zca2wkk05NBcCGXA
+0BAzqfBgID8Ozb6IN4bPORQG0crO8Rx0JJEYgkITaJmg5zIURFAWCeN9iHOGkRouR9DhZzlq
+sNBDlgOiHeGriQs+eHwFsR4YKabp/CIO7tyoCsfuf4W4ONJdoWCFdDmYaKHOF9J7UHABUnxI
+CsFNPVjbI1kWpkpoioCqAGojoaGCGG94KqClGPcNYMoBPQaKwhGpBikDlqIpo1fQ4cII8Ea3
+P7b/K7TMsVT7C6ZzAxqMoM7ANNsl0oBKLWjJYqFmY21SQU+8Fkq4FvMdna9Jw0oXT2Jw8r/A
+LYcFQuf3gs4VtD/qsgF6c2kuTFyFtx6eFONxKLR5oMZAww0UWUNJAO4WGC1B3yVonYGRIh5k
+06y5pgIdCfip03Z4jCsK4+lClm7hojykhFCaiIUUuIhAgRcpIViuoIfTQjrSjfA4EwEiuOiL
+zkgEBeJpJM7xwE4DflqoCYYIP/1Eax1MVCBHCnKHoSCJpCjaDR7qhLIo3HLC4G30e+OmE/rC
+4SAGuZNgGG8Y2xV4kQRPGaiII9MbMW54XPAD3Pkl0LkW/b4It8Js2bprscsTkfZYrNhgaDnt
+r7jhjPKU7wi+nImrClAWoefhNBt0Zb+r5TOh89+4UVW2YaPe2XBWl214qmvX/Vf0cTWr39nn
+aza2L2s3srGoyt7doI9fnazYyFO5aTfzlfu6atOWd+26j3otASKK6Cpad3enUJa5AyvmvGpd
+cdC3sJ3VrKoWOcBMFsoSSIna9JTKjXrWsG78JbvC7rAkUP0DX1+NgerX61OxSYDVxLNNosI2
+DZVX6c0zb6S1YgxlYGljY/rFLXqv+e0jv4z2dT+OQ/VltCX/Vepjq9H5TVm94675M9nePCZ0
+/kXRuWKT8n01DCo2vpZvnHyl2cs2hTBtYtxf4GkVS7NXfRBBnuy4rLINKf38Ma7rj/vzAYGV
+m7R59Yb3+8fPGITOHwCdK1AfAN8AlBtBlAOyZyDLj5wE9AdA4Cjr62lcdUagCqRPgPcIJLno
+LbClyncbg7R16FxOWxrXtCBykhaOlBCSw/GSPR82bMTzsGN46jZoUr8Rn1O+cbJqw5C+t+FG
+qGPlYU+V7OMqlr3NWhaFyNMbhdTjzHTQnrWx5HkVMrQxtWbrQ0Yeo6wnluhDkR9Dr0quZZV2
+dyOqh13huo3AntvI8MGdRNYxOzSoaiPKqH6jhoTO7wWdK5FnCzkr3BCDvSXm7mC2APMVyDbG
+aVXMlWIuD3P5mCxAjx+EpVCdgIkCrJW920puHTpX0Ju/NooICaPjXuhJjx8DJWAWocAGoQ4Y
+vo35ZHrnKCWQte9WjrseCDZCVwYdBHI/CPOleJKAuiSMxyPXCUn+WK1EVwDCTFmewArc80Oo
+Ke6nbCjlQhicQlQgnhXQAWAaCli5h6FIhJqg6JUXgkXnGEng31GUSB9r7MTHv8NgCTou45Ix
+bl+lZ4+BEGQ74aIVevOwlo3aQFwzRMZFupJVoWhJw2ACsn1od1x9Csvd4YgrLrh3GS9K3pi9
+CZ23Kp2pXtN0QJoUjn0LHQasVDFWgWorfPYldMRgoIjWTHoaX4iBmjYGiv5ag/mDoXMRXMVw
+mguaQvR2uZcL5sqRroZzwjBmQF0WxjJQEIOyGHJuoNID0iLwVYKJKiouwPYQrTFvmkPFDjla
+4DmDpDCaywbHocMLB0vUnYcuA9YSUD6DlmyWBi+EBT+yr9NuxtVknJdGdjAdC2QuB2Ve3Ihm
+aViWPk0wA+d+XPHFcDi0T0DtOGrD6FgCDxVIHkVnFqJOQuIsXJWgrINGP4gehbM6dE4gPwDW
+mogIxVUNHBeArwr0lZBshXOy8FaA0B50FL6x4iB03sJ01rBHijSMddB8He2xWKpCkQVOS6M5
+Fi3XMV1EW2sz0VDRRG/+O4wk3Jp0zoOLMny9UWgErgNoKaLPSO4FQwCGotAWgqsqTYdLFrgd
+AT8ZRF+jB7+9GuyMcP4sxiuRbw89R+QaIvgCmO24pQUdHfpgrgShp3GSA8aSkOOjNxDp9S+L
+zpkxLNqmIVAB5zXoiddYCircCAxERyiSXXD/Oq5Zw8YITnoI0IKnEjz4UR2JW65IMgTXb1B6
+A3GSyI6mjWfP47hiAn9TMB+g2xGe+rDURkwYrhjDPoBujrsEFA6g6iZ97H2WFShI6Pye0Dnf
+DgrWiJegFc362xnVyDKBgB5rCFWv75FNR0FWFT2EzjmwU8WNeHpIxylBwxBLBbAUQNoVTKch
+3hnXnHE7DH6isNREoAZs3TB7i1bZEa5wPIF7qQhVgbod8gwQ7E8LvMQI6pLojUOmKyJk6TA5
+anVDzbGDuSxDqBBG3EiOpF9RKbKEuTrK3KGlQ8+xtQGoScIda9gpIjcYESa0D+TyIfxuP274
+IJAXl5XoIIHOaGjtQcFVXBfBBWeMJ0KbFzcdYCKPvgLcVEaQKR0rGHUZEcawDaAnDVcZ6J/F
+9UsYiYTeMXQUEDq/N66wKm/YeiBXG+HeGz6QKpQ7Qc/qNU/p7HVYmWKwgGhnXDTBzTjaU7SU
+CBM+NNzCUDCMTkKMB+E+yLaBxEloi6IhCSMpsBSExFFcdqP9Eslq4OeAgTwC/FBhj7jLtK5c
+uIVgYfDsRZArRtPgJgnJ43A1wCQ7wKAEPiLgPQZpLugo414GVovp4DqxE9BXRUcWzSz2T8yl
+WONqNEq1wHsWPTcQKYNKf2hxwlAGRnzIj0GiAB1sLyqImCg8D4XyCchSlaHWVhm4aIG0KKQ6
+IigEzFsIM0ZNFHzkoc8H4a9Z0QWEzu/PvvMaK25h7c2Tf+nML/PXSNZeiaKcdgu/ZPFuOR8z
+Bev+q7lczBVt7P0VYzpvw5lchtm8jVeVXxXC4uxs/nr+NSp/LtY2/f7DWgntkJzOwVLJRjl3
+MJOL5Tuv1W29Vq8CA1iRQpTl8KKA9bUKIZyIdsMMK6D0iR/MVNCfzQoCrKQzr21qF/X05zHw
+Vcc5AVipYayMuMLeHzq/NUrhrXEIZYTOb8ihfNNB+cbVitfPV2zarK/YtJVf9rY8m483X91c
+ZtkbeTb3Y/mmH4Qp/y4NRuJp5vrm9XwGHsTj5eY6b06VGIlDgg3iXDD01shbQuctHhVGfivs
+x9P5PU21GxtbdzaF4P6Z2BX2TnoF2XcmdCZ0Jj/994unc/1fiJT+haZqDMT9z9B5NmfDrCVp
+c7oPZ0LnH8a9+wOqfKyYui0y/Zb9T4SL/LB2HrwOGYkz75jOYrw75raOdi7fSnbCfdjLkH/B
++EE8HHhy6Js/ygr+VpZ/SyRJ7v/kO/KrLVIZWYHfMrh+q6qi8C57ZHWNKSxwRopnq/SIDN9H
+cgK/2yo9IvTbI9/89k5ZFWHuD2Btanr+6fDc05Etke6UNwqKym+RylDp+djcwsK7/nfaubmF
+Z6NbRALzgcFXElPzqIMtUZ/huYmpubXVVcLb9wLd3d2qqqpEDlsHKioqxsbGRA4EfwU6OjqU
+lZWJHLYIhoeHd+7c+dvf/vbFixdEGgSEzu81MjMzAfzqV7+qqiLLVQJC5/cblJkNFnR1dT+U
+Nq0wnz9m9vSwUi/zxSLpZULnXwKePXv2L//yL2w6f/nllxMTEx9Cq5YHmEI7mMB6im0iHU3o
+/AtZOCclJZ3l4dHT00tNTZ2cnPwQWjV0m/nlHqZbPPN2ETM7h/l4inT0z4fWZ8/EtLWJHLaQ
+ve3hkVVT8+G0J8+b+ZvjzFsVzPq2rVvJvj6mgcEHkCbk5Yt27Pgw2vJhpKr9+/sFBT+Q5jTU
+MkP0mH/3K+a/Upb2/2Ke0Wf2TG9FOispfbccIIkkkt6aOA8yr3oyDfyYLW3M4nDm//PPTNmI
+rUjnR4+YFhbvfbKymtDQyPvqK+qAaWn5IbTo/U+lBw/2MBgfSHMaKpjpUczc+yzOvGDu3cbc
+acRcIyuq/36w4/Y6RkclWHsiJIxvi0Df2TmltPRDac1LpsZu5q/2MxseMVtvMv/j35k6caSL
+fw4sLS1dvXpVVVX1yy+/tLKyqqurIzLZCrC0tMzIyPhw2tNdzDz1Bcv2/kcmlzFzcJ508c8E
+IyMjbIDQmdD558JkP/NaNDMpmzlNbMCfEWVlZf/2b/9GcZnBYCwvLxOBEDoTvL9YXFzcv38/
+RWc/Pz8iDUJngvcdFhYWH330UWNjIxEFoTPB+47CwsKTJ08uLCwQUWwRmJmZ3bx5k8iB4K/A
+s2fPrl+/TuSwdeDo6JiTk0PkQEDwAWB2dnZpaYnIgYCAgICAgIBgi+NxQ5ars7O7l5eHu6uz
+5/XW528x4Z62Fp2nrlJw8c1ofEKdmemuCvN0p884e6RW9K0tjd3Orx+apQMAxjpbq4q6iCFI
+QPDuMdpbn5QQY3DqlLKRT0JKyeNZJnNxvKuj8+nMq4iRtYJw3bMWgQUU0kLktZyLH892XXNT
+l7HOoM7kxFqamcXn39KR9Sx9Qt/ScuWyqXzsNJEsAcH/EIrs7BJKaLW7OtITbqIrpyAja+Nf
+Osj+oci1O9fM+I3cExKTbyVcUjX0rng615fsqyljEpOQdCvtip2NXXpJrplWYNVTms7tN6Id
+tJNniEx/PF5OVeenRIWHUohJLBn5yZbNUkdVbnRkGHV7+JWcAarTloYLUq+zygtNzm+h9xfn
+nze0t4+xfoJr4ml3VfdzIvUPF3O3zM2jszupo+o4TyGT5DUms9jH2dSpmD2ySmNMudSt/B10
+9n58JKDsKXWmI9ZTSUTL18ti7659Vqm9zIUWHSX/2ucr1KWuxBgnjUSinX+KhVQjtpdP3zUk
+Ojo6LvH284XVlZXF6cnpl9TsujgzNj7Dflnw5crSzNTkHCXjlYWp6U0vKawNWkkrqVgFUrf7
+WVvbOqT0tGQLcir6RFEnwq2VTSIyOl4+u61mb1M+TGe/e/P8We9s8gLiB0znm2ZmUSw637nq
+ImifRx3UBXmbWeayf1Gx8Lq1ZX4fdVByyVnLPW2OUsHRfoFBt6kzbbd81a2vjM70uMhZ5va8
+pG8M89XXo/MQ/FiM3VU6oex7o7CioqLl2ezi4G01TXklPZfk7HQ3C2VJhoZvTMPMk2pVXU1F
+RRlFQ6/4K0EKEiqR5X3r7yqsDjppmDiEZVXV3iu6GmRpENXWnK8oYZNaXlnXUBdqbO4Xc295
+uMLAw7V6hM5+LztI7EIBofMHTOd0Y+OIjHbqaLqnzl1VU89YT87YMaV5dH3tfNVcN+EufTjd
+ZCipHFnzuDM2wMMthebsy8fe6op2yfUtmSHGJsZWVoYyOlZx94aITH8CJu4pHOGW1DS1srK6
+VNQ10Z56UsWr88XwNQ2t88mtC1MdburmSbeuC2s61zzpC2KoeCW29Rb5qfnFravttSEXZQWG
+mrEm4/C2/SqVoyurD/MEOEQNLA25937KaxBLL3wG83Xd3WrH6OyNeRdFA/MJnT9crE4MDo5M
+rttvC8Od+dk59wa/+8XXqdFHA+Oz65qkp/fh0OTc2POnQxNs7TD5/GHLAJV5paexNCsr+97D
+MSLQn4bhalVu+8rhDWnfTxJwT5xYGQoU0ouvocS+EG1nEBoXregT+2RlNEbB5WbN9FhDuNKF
+uEl2B6z2Oeiez+mhDvq9dfWiyoeWe/LV9RKohdJ4bayulnvTONVt1drmtkXPWMZ2ipuwP6Ez
+AcHPROcK6cPnMtrX/6FmsjHuhEX40NpKU6KPtr6pm62NkWFM691UfuvQ/sWn4QybpIqJ5zUX
+pHyubtC511LJ/iprOhgsChWTdiq+k6qkHDJIM3Y21kpT2fnmC+Zs7sXzpob2fn4uelrn4uoH
+idQJCH4WLI7fq2h9PvOS/W156klV+0OWqbR0vyQ5Mupm98QKc3G4pv3h3OriQH3n0Pjy4kT/
+vZ5Hy+vG9mxH04NH4yw/x8pkS13Ng4cDzc2D86yri8MPqutaaNNqbepuxvWIiKg7TWQpREBA
+QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA
+QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA
+QEBAQEBA8K6xOPWsvrI0P+cV8hu7R8af9d69P7j0Mzzu2YN66hl1D8f+TJ6x4aHnL5Z/4OLK
+8EBHxZ0idl0LbtePLq5fmH7aU9PYv/DmDTND9xrujyysvXHhRefdxocj8z+1CQsTQ02VZRsS
+y73bMcw6vfysd+D5xMJ/i5RWXwxVFuRWdQ6t/rj8a2sLkzMLtHAGex6OvPjxD5oZ6qstK8nd
+6Pvi+s7XO325/34FLefy1tnvVeXl6N07BdSlu22P31Lu0lR7Q3Vx/kbBeWUD4+wOXR1/0l1R
+WvxqtFU09G8qeLm7sZJ+XFn98ze65eWL4Y6Ovsmltbe3ZHluZm5+5Uc0ebS/MS+ndGB04YOk
+c3uy88cf7VExNNuATWzBg4H2spi0urn/5kcttRVEmhubmpmZ6hk4xKY1L76Vy00pDEW5S3fH
+f6CQcR9Frm0HRdbramZuaH3hTtckdeFp653opKo3h/LqcEt8QlrX1BvMWB7Jj0ms6Zn8qc1o
+izH97Pe7lY3W5aWjdC74ZsMqczxQQi8w+cF/xwz7LNxAU1rFODSv6eWPY3NNrI9H3D1qprmk
+K6gaWf2jn7SWbSP6h52cBht9r6iseM4vZ5TFvJXR9qBAH1sne+q8uZGFkUtgSe80+7ah+qIg
+S2dre1vqkpWZpa1X6uPXx8rig5tHtm3nV1ov2ERTVVHXNr97ihoDkQZCH+/hNV5/oKm6rLzd
+1WK63KXnWYHuFlZ0mdZOzg6Wnrn3Hm0uc6Q8eP8BqVsDb53nl0tCfX3jG/5igyc7cxWlZPWt
+Aqp7pj5IOt+PdTjEY/P0exRYXlpYXGbPg2MDDxqbHoy/mB0fn1p4uTo/OTo8/oJ1aW1ucmxk
+YnZ5cW5qYmL0SW9TW9cUPT+uPepubWxsH3+drmtjTTbatllddMfPlF3i5lErG3ltpl1ZmLqX
+k3rjqqeAkGhYA4tlL+cGunqeTW8uaMRDTljBp+xVP+YHmpyS9+x6wVxbWV5cWlmam3o2PbdR
+7urU6OT07MLS0hJr3l4b6W1vbGx8+GyWfZVu5Aq7KbN9bY2NzRvKfXludPLFwsJMX3vT/Y7H
+37NSmiPPHRQyH9r4+qIu4tA3UrltnWFKJsEpbDqvPOunH/TgKWvMrC2NT07PLc4/6W5pbO59
+8arRi+OdTY2NLT0vNpN2Zf5heRT3jjOBOd1sRTTe39nYeP/xNFvzrM5OTExNjvZ2NHc+mVhb
+t6/6PYU4hY3CB54Ph5pKaEcUDXa2NN7vnNo08Cee9lL1eTT+PZ23estS5JR+xCbjqVT2GG9Y
+PTWXjlw0VBCxS3y+3viZNF89EfPQ52vM1aFKLW5Jr7j77KevTXbaySuaRNzd3JfzrSlch6Wy
+v6Pj6g1rJX7dhFXmaqSehKhVxnfN7UnlOSKX0fviwS3X45Kur6RaHmonbXJtbFOho5WXDh2V
+y368vDhDWSILM88GmhqbBlnm0OJUpzEPj4he5MNRVs/OjVHSb+p9xp7B56enJ8Ynh1hdH+ui
+svO0Zd0Ye9Zf7Gu/T8t2k6ZeHn1M3Tow+d2Z2ee99Jnn8+8FnZvjnA6ftRp8/WR1jONZ9chZ
+5mp3SbSWmpa6tq2jscLOvRoVoy/yHaW4DcJY4lhKslMTMYvrr0sU38+lb2WuZu1Z2/+8Lu6C
+lo62urqOiVN4ff/MpoG6PL+4riK7MvxFlOyaJ16j88xAY/qN3MHBqnMyEiH1Eyyq9Ed7+me3
+jGy2lbwUhKWds7+7c67ZgEssun68N8uXVz2ipTFNXsW/myX7tdEqfQOnhMQoZRX9kifTLaVx
+5tr6Ghrqmqqm1+sGmC/7bAXkQ0uGVib7IjycdLXV1OX1zM9fbR1dYQ7fkeLn0Xa/6GenI83Q
+8Awpmd5kxrVEGx7kN+p6xcHnxZz7BaIqGyJUzS6m9zFXJ0uuhVubn9PU1JTXtk8q7FtZ6jaW
+4ZGw8r/sbawsrmzlnjayyFwa6brm4Wygp6GhqqrlcqXl1Zph/kmUs+IXv/nstIRDaefju4UR
+RqqUMNW1TFyyG6hemr+qIcojom1moW15pZQ94Y40ZUjv+nTHIYmrOfVRpoxTjHMu9ibqchKq
+nnG9tE2y8iA3zsJQV11dw8DCM61is228mmHNOKl98buRutimefiAfd6jpfYkAU654s2z/Nzz
++82d88y16hDdw8r+m42n2ac9jZ1PNs9J822ppw+Lp3R8R4piX70Dwn5LzLUrBlLCponfdd9k
+jdB+vtDakdYY40+PK+d1DL26tLS4vNmiGq28fIRDqWTqZV2QwVkejYv+ATrqcuKGbsV9kyPN
+t7i+2L7zgHDYnf6ZRw1BzhZUZyrqmwfGFFPjr/KS6d7jso5WJupqyvwn93+07Yi6f/zTkcHi
+q7765/Q1NbUMDFxy2p5Rjxi4f8tcS0tVXVnJ1CO3gVpDrXXcSbU2oOSvZWToFE+NmS2PznT3
+P330JUNRlQ1T9zSKSLVXbU+pRQ/2lypL6KT30COtKc78008lSoZf5NiIHNe6yKbzDUt53nPX
++qujD39+LKadlS3RlVfei02/lgRPWYfop99btE53+9kqf7vrrFd65/etYuYau9s0JMTW6fy2
+pc/36bz20EGQ0zS5tTvLm1M6eHh+0Eda8XIZPRB70wM0rUI6G9NkZLWy6+6YKMteZT1z/lFD
+Zdsj5kKX+RnpiLKuMl9TOdNrLDtyMspCQcE1feJ5pcieffrRtPG22nVL+qhM9sPvVHTrFaNv
+udRK+5+yMJh7wURQxX9oYSREwTg05/FUZ4qqcQB7PulKdJNWch+c6DHk2i/qmEUP+Ll7useF
+r90f70hzO6USwaLAWl1l7YOxTRbIeJ3OKdX8J8zZ5gRBMeM7w/RU8jDL9+xZq7aRsQiFo0fV
+QpfWl8zrKiXZRMEghLKxV8O1ePlMb7Ae/tiaoeqf83imL0tMRLuIReKF5hR5HbuKoVdtWc20
+ETsq79pFN+T5xOR4TazD4ePa1WPLLTFW+7gdHr5lLToVJMPNcLz5F9wLbalc3wqE3u6myh0e
+nRjuKtXh4dQOuUs9MfKcxBnNywPUhWfDE1NjxRd0DvMY0rbYi0eXLWQOfnVQiCGmbehd0PLo
++x3PovOdqdWa83Lbv1GpZ5lv8TaagsZUZdYi9bSML7VQsvNVUTS72sieZ320jS7ndpWF6H5+
+wrCHZau03jzPpRhOib3r1iVdsxi2sim4qHfGKnHuRZ8ln4BFUht1piHcTlrv8oPmQk0RtfR+
+lp3Ym6krb1E9tNVX3K0JznsPKWbUtbLR2fecanf1VXs+3St5CU5cWqHra4ynxSL8evmPp3Lt
+xE7qXmbTOcFaScAotr8i8vQpiULaIbQYqXp8t4R5WlpyUlJKUrDxtq9lc7/nUXs597C7425O
+mIKSaU7bSGfD7SQaaTWtz9bH5vOKn0jnAUdBDsPE5u4c35MyF+i5KMJBxTjp5dpMmL2BV9bA
+Sl+6hJRmUW9/jIejpesFn4sRxY0sY2Sx05JfOSL1pgGfbED+us4aLjx/Rsqqvr1Y+oR4eA2r
+DpP39CUEA6q+sxA64qx3/PYLQRl5FlTMfGI7hykCjV6QMbiY3ru2OlVflBIaGJGSmeKuwXtA
+2qpjqN1IQMguqYd192MPVUHrrO6J5iwLPetA36DQazd7Xl/Xrz0pUz+hlNU9luetdtYybUM5
+tmgdE4uqao3R5hb3zHxdJrOx+tLaAcUUjUKNxPTi6tnzZriSqtOV6sYrRjsOMEJT0igp30wM
+OLb7hFPmKy2zluco+YfP9ktT7ZAR3r1zB5eGd+MT2l6tCjXdd9Zp8C2euIkAKW5x54w3LwzU
+s7sy6Xbz04W+nBPbP+cQpAvm59jz2V6hkMymWXpyWLhqxvjdjmNy1AVJgT1fbBfRv/xg9JUJ
+t/bofmXqtWB9BeGD3xw3Cr6zsPamdl6p9lXkVPVluzwawpzEpS/MUw3XUjMMvrcydof/64O6
+XtdSkpKS01KtRM5I6EWmBVlyKwSyzYnGBFdO6cDntIP06Z206xcjYm6lxGpKnNyjea33fsKJ
+/QoF7Cns5fzkxGR1tOWOPcIhybTo0pMvCe7fa57Zt9WN7RtOh7gt+l7vuKorFJ2js2JtT+mF
+r9P5SZGwgH7B48lsa2q1FcryfKyk2KvSdK6M4jrOyKWXPXPhiqePiGq5uThRcPfy9g/NfjS7
+9sr9unkJbCMsahBUVJEdTWd18ki93bP619F5sk7lpEDY3dHeTO8T0gHUpLLck6evZZlVkmsu
+a9FAWYcdCaJiyvm0McXsrc5wcbBUlpXSdsscmem2F1YLT0hUOyMdWPh0w3D2PSluVt1SJM0p
+Glz6fJ3OksL+lcPfM7YffN/v/zRQxjAsd2C4JVmOV8QpOK25/3F3fpCAsHppT7OJoIBFbDt7
+wHqoC5umtLGthKzwQFsDZV5xveslPa/TWTmre/imoyy3TfoGZVt0OERCSpsoOou6pH+Pztf1
+pNbpbMjQjKpi8+6SopLD1cq7YWaHDwvZs7rExd3T53zMvYEXrxnbWsF0b65O5kTZcYqbVz6h
+7YThykieE0rlo697KQcfTS2vlgaqHdUInnltApp79LivMo3dlU5RRV0vum5xHxZP7qDNhJH2
+vHPivDbXatmehjA9SSHTBLqvl0ay/LUFFKzv08ycK46OKWj+zoR/VHBx3w6xrIcLb6XzMXkP
+dn80hDtJyAbOMRdCNFUNLza8fF7Ey3FYwczZmaqHs5u3j19mRXu2nxGntM96forOskHU2GrL
+DOQVUApKLOgceF513eGUTODdyphj+xQLHn63aKiJsNr5pZC9O0t0bp7nL4RVPJze+nQ+wGXS
+Mfc9Ottxa13taEqTkrJvZkl0uCTw4Ncyhc+X7oXpHNMMYpmGL4I1BHiM4x5WRp3iEM15QhO8
+LNxczi5hfay059n4Jj7c8EvND9zR03Jap8VS6zlx5YC8wbdUiKYz48/Q2VNeWPF8+auRVB5i
+dkTStXdxrSPVnVM6gKbl2nCwtT7naWFplxxq2Cy0xDMkVLJ7xgd7B9Z9R/Vhe/fr3etvdRRU
+jC5tSbPS0fHMZRdX6KMtZhb17Em5+DGhdTpP1OtLCgVUvU5nPoOOhTfpbBxd3FsTrH1aK4R9
+qilSZ9th2er+FhMB/u/orCZsntY2O/aoa2TdwL6iyC9ulbS8ic5qnAq3uuYfl1w6K+3SyRpf
+8003+Dj0qh49jVLnEvk+neeu60mci6D4shpqIKrxis4KCtYRdc/qrsmoO/avG8Fd3h4XSwbn
+NtFZ9ITmhQ1uTl01ZXwj4T5IKaiXg16q4tIemRuXliri3RXMg/sWmcsDRXInxQNzejcM68eh
+liYWQcWr33OFHRRLbF2fN56WhZ3YfTq4lJpSX4bpSQga31hv7OqzQIXTJ1XCKJWR46x4Rj1w
+eEMKIxVXZM5a1I283Eznw8fW6Xx0g873wig6X5hjLoaoqpmFdFDGj4WyVlDF+rRQEnYpPqOl
+INiYU+o7Oh+XDZ5mLkcZi/G6VbCzJVqKfXXGY/BZk94pMf9S2gybq7+houaSnhKjLWPftt6w
+h8E+vqUDs1uczo0x1rsO67a9Xs3yMLODUpdmmEt1ib7GFk6e3qGB5grbPpHIebSy8KhcQ05B
+3dozNi5C68QBvnPXespCDu3jyXi0yprjuyOtTI0d3D09HQzULaLSml++Us4r44Xh3nZuPp6e
+ni5urv6RGc/fuufwrFSen/dCLatH5oeyrsVX9m7eSxrzkOH8jEPOw5OGv4eXuYVPZiPNu4Y4
++2+FvNhG86Nc74/+Y5dXOa2SXzTG8AnJZ7Z13fSzMrR1o+5ytbVyvHF3fv6BMYdQYNGTuf5K
+W30zOzd3T0cXXROX7I4p5nAB99en/YpZGn28Vk3gjFf581c1aArV2nVCs/X723hDPsKaF249
+nO6/raEqr27j6X/lioeB4J/4NSq7GnS5ThlcaV1fGsidMUnreNKcqWNo4UHJycfRxPh8ceOz
+73Tdo9ty+8Xim2eZy0NxQbZ6xk6enl7mhiaBydTac+6C5MGztknf229qTnIW4ddIzCn11hVS
+CWXPdeMB4gw9X+p4ruCCq6GZA9VwMwMTt/M5YyuvTJvVVGOebxXOf7dnM9Gsc/yIhGs2xeIX
+PaVWFiaWjlQVPd3tHXTM7RLqn7DvbM+OMVY3t/P2pi652VrpmoY2P39tG2OuJeHwl7yxTa90
+2WpJgN5ODt2mobEIbREunZhXps3Ks0rJg0e0wqpezvXdcLezd/TwovvV28neIaGi57WNqrLA
+r7+RLJxcqXCX2CvmyO6Pu8HW/EKeVP2bIjz5ebWii7sf1SabGJtRytTJysrY9nzj09lib/V9
+gq7s/HXX7fYLnx+jlgbl12V5FS09PcMjo40luHZwulKKoLkgQlXLjBpa+poGPmEVL5nz+VG+
+eka2VI3szIyNLuaMvFzb4nSeGequrO148brTY+JxV+39gcXFuZnpiY768sys8rbbMVJGHndZ
+bpnpwab46zF5Ne1DfX3tHU9mJx7VVt8bfrXOeTlWmpMUExNX/fDNveOVB7WFMTExaRWdyz+4
+6zre0tAwwN5lWRytzC1sfrLZsns50FaTnhwfw0JiWvnwwtvCSBZH6+91snfKWGEkzWNUeS/H
+y7KoisXklLezhtPsqzCStamB/OSYmNjCx9OsuXh+pL6q/iH7/uWptob6/onvbOuZR+2VdW0v
+vu8mWuxvbHv4jCb5xEDjjesx8fnVz8dGuvp6RmemOurrO5+wVdVCT3N9B2unbKq7PoWqTVxK
+49Dru+UL4y01TU+n2RJaaCm4SdWsrIsdePPy4f2ae93P3tjSHytPTi2q6uh90Nz2mG3YLA/c
+b+roZ9+13FaTRze8off1RdXa8wf3aloebnZKj/U2FZS1rZtULyfrC1KpG+NvVX4v7OLlRE9G
+cix1qaC6c+ktoTvPaqsans5sKnhppKq0rHt0+knn/fr218JjnnXWFtc9YGVd6qgouE4VmpLV
+8fz7UQlLEwNV1ffHXq5N9N2vbuphP3RqsLuhsY8+XhouyEjOrKPtvRcPm1OvxVzbGBsjva3V
+7DxU/iF6kLCLHmospZ5183brxOTz5uYB9vT8vKmMen7GvVdr5JW+u7To8qu7VpnvN+b6yy30
+bC5fTUlPTwxwdAlPurvEJCAgeE+xNtJZdeW8j4+Pf3pdPxEHAQEBAQEBAQEBAQEBAQEBAQEB
+AQEBAQEBAQEBAQEBAQEBAQEBAQEBARv/PyjEf5A=
+</bitmap>
+<bitmap id="3" width="723" height="430" length="111248" ColorSpace="DeviceRGB" Filter="FlateDecode" BitsPerComponent="8" encoding="base64">
+eNrsnQdcU1f7x+m2fdu+o7u1rXa4ESegKCKIAoIs2Xs4WLL3DiRh7703yN4j7L33FBDFASoq
+Khsy/ie5ev9pEiBabdXen+eD4eaMe0/Ifb73Oec8h0RChAgRIkSIECFChAgRIkSIECFChAgR
+IkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgR
+IkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSI3jBNT097e3urMNLg4CB1zvHxcRUmVFtb
+S9MEqGfdUuHh4fTntm4pLBZLX8rY2HjdgiAPTSlwAsxc3dTUFE3BrKysdUvR9CQQ6KV1S4Ga
+aUqB1l9RTzLsTHCEmYL0zTHTmS/Wk/R/XYgQIUKECAEPBDwQ8EDAAxEiRGvLngkB80RfEBxc
+tyB9KXCHWbcUMIg0pSorK9ct1dnZSVPq2rVrzFwdqJzGHDNTit40MNMnDHsyOjr6BXryzwtc
+OAsLi4WFRSWdaD6CmZmZSiY0OTlJzzbrlqI3zdC5rS36jxuosbFx3YIgDz0dMXN1CwsL9H9g
+65ai/2MGvbRuKVAzTSnQ+ivqSYadCY4wU5C+OWY688V6kv6vCxEiRG+QgKWD74csTGjTpk30
+lYCD6xakL6WqqrpuKfq7LrC865YCF8XQsK4rGrMOWmemFLiQF+gThj3Jw8PzAj35ssCDvt/+
+Lu3cuZPlperbb78FfLhhwwaWV6CLFy++oprBabO8SomJiTk4OLyUqj777DOGBIgIESJENDp2
+7Bhs3Jl5rqF/SGTy6fLvfSBi5nGb/umSmUfL1Z4u1+0Thj3JzNPlPwE8vv/+e2BztbW1US9P
+iYmJQ0NDGAwG9bIF1ezs7PzSay4vL6+urka9SlVT9OfrsbKy2rVr11/MHgYGBrKysshtHBGi
+Nxc8EP1j9RqCB6COzZs3v0HskZWV9TqDwVvJHjw8PAw9h4gQIULAAxECHs8LHkZGRsCQvUHs
+UVFR8SqqRdgDAQ9EiBDwQISAx18DHpAhe1PYw9/f/xUhDcIeCHggQoSAB6K3Hjxm5pZcoipp
+UvvgrfuP5mjKVreN0WQLTm0EOSennqzWXM/wJMh2/FwoSFD+4fEphuDxZrHHq3OnIOyBgAci
+RAh4IPq7CIHhKuOXDh6AHD48aEWfvuVzApxAXRaQA8OcOyQ8AVcALKFpCxQHldBkBjlXAw+E
+PRD2QMADESIEPBD9XYJWE7/0j4x58IASNXusBh4wflB7M0BB6rdAYgY8Xil7vPTVKAh7ULPH
+K425gYAHIkQIeCB6K8EjsbAT/AoSzBgAGOjBAxyEsoF0wSkTLg5ew5kh0viWzymvegA6ArAE
+0Ah1Hobg8erY41WsRkHYA/7IbG1tEfBAhAgRU+BBBP/ICejR7Mzde/du3br9+PGTleWVheXl
+2YWFhbn5pbmFhfmF2YX52fm5+fnZuYXZWXKaA0fA70Agz8LcwuLcIsgGXsyTM8/Nzc8sgjQ3
+B96ZWVxYWllaXl66/+jB7cmJmbl5IvKRvH7gAV7Dx9kVA9YAD+o66b0ZcJ1Spglrnw9D8Hhe
+9oiNVWMmdXZmJCScZzIz86mszOvGjfZXUTNIXV3ZIL2KmqmbKC52eYGCbm5W1J+CpKTkqxtw
+QcADEaK3CjwIBDyRiKcQSGJaujvG1c7O3sEdnZCaVFJf09Lc2lnV2FpRX1ldU9JQU15XU11T
+Xl5XXlpfgWuoLK2vqqyrrquuaaysbaxsaqxsralpqq2pr6ypqq6vrK8pq68uaaitqW1qq29u
+wdWURySFWaNtUSiH1MKiBQL+n/xxDIzdpbbyryF4nNKKYBI8AG/QgMfw+BR0BNDLi4EH8+xx
+8+ZPJBILc+k3EimY6czPlQRIpCwSacOrqdyBklheZTJ4gVIrK+9TfxB2dnavbrIHAh6IEL1V
+4AGwg0DxehBIsYHh9koXPSytrdxsdC0vWdtYZYbFNOQWVVZV5lWX5+KKC0tw5B8lBYW4wgJc
+YX5pYSGuCFdcXFpUUlZUWlJSllVRmlNeWlxUVJVfWFdQXF6Gy6uuzC8syfQLt7I01bHR8ra3
+Q13QjUq9vEhc+Sd/HKm4Hhrz/deABxTZlXo4fjXwYJXyppmSwRA8ZuaWYI+HuW8RvRvkglPm
+Gste1gAPiD2++eabr9bU8jLL/Pw7bm6frJv8/X/MzVVhJid9Ak3g8SxrZGhu9goJ2cZ8hbW1
+H/T2vs9k5uvXKyIi9jCZubDwQ0AFKSkbmD+Z5ORTz9UbCQkbHjx4Jzf3I5rP4osvvvj888/L
+ysoQ8HguwQOXq31ToHfXrQRad7baWjO4FZrE8F2a1WfUkjJNAN9uOYuk17Y/oTMECfQG86VA
+j6Xiutddqbdurz5vKYYZJqYer/1BPFdzr6XHg0QgkFYooy0JEVHmR09b7eN201SNtLP2sLMx
+MdJDYxwSEqLLS0saqmvqSqsqi8urSsqrissqi0srSkrLS3GlpaUlZbiysoLSivzCqsL8qhJw
+56nFVdVXNuYVV/okJJi7ONgaXPI0MPA00goQV7ThPJWZmYnHI+DxN4AHwz9gmjke4PYFz9yg
+XqtCP8cD5IfdHeAggBA4M3iLenIpuBXQL3tZFzyANm7ceP78+fjVRSC8t7T0STwTys/PHx0d
+jX8hgSZAQ2tkuHPnDg6HY77C7m7x0dGjTGYGHcV8zQ0N5wF44HBWz3My3c/VG7dv74acHunp
+ATRvHTly5FVEiXmLwYP6C0gz9Zo6w7d8TgyLgy8d+LbCnE+z1ow6J30e+HGDfoY5wzOh9nCe
+0op4bbsUvikxCR7QfYy6f6BbFjNlV+t5eG4bvcCdkDozQ8gJSGlgOGmfvt3XnD06Ozvp90Mh
+D7AQSbMk0iMSmT1i46NsJaRstu1z+npzzAG+RAtrR0tDQws9UytDF1entKTEzuLK6vLa0pLK
+yqKKmqKK2qKKyhLAHaXFZQBB8svKc6tKCxrKS1vKyXwSlZRi6u6hY2drY2qAOq/pJyiB3cJm
+uJXNhlcoJzON8M8Gj+sT02v/Yf8t4EGznJbmu7PGqhbwRaP/doCvM81yWmqXCPPggcVir6wu
+IvE9PP7zK0zo+vXrjx8/vvJCAk2AhtbIMDc3d/PmTeYrvH9f9/FjCSYzg45ivubJSSxAgps3
+45/nZO4/V2/MzbFD4DE2VkHz1tmzZxHw+DNfQPrvyBrgAb6hq+HEGnOxEPCgcY+sdk97MfCA
+02qtU0/IXy0bDB6rncmbAh6riUggzVHYgwieqqJDnc+p2vPyeG/fFbTjgL+4NPrISX959QBX
+lAnGwtDOJCogoKi6GtfQWFpeVVFcUVNIdn2UA/Iow5WUlVRVlHdV1jUX4VKiIp3Q9oZm+hbm
+Rv4ox+gzCuhNbKY/b/XeuUf/xDFLeenL2ZeXCcvI+NfrDB5hGc00OVcDD5qFKtRKLuqi+WLS
+4BYCHgh4/MNF/wWk8Q2uBh7UD86QeYIj+0E+kNXA46CCPxTTD0rgkQGKIghnAF9Smhg+byt4
+UFMHuHxNx3RQBBqpeV7wAKWgzoem5dODH00ROMgAw2zU4MHwQt508CAtURJ5yIUUFxfmJHwG
+tZ/dQuSIrapooIGWJzuv+zdswUdE/PQvufmgzNDmdj6ukZmXy+pqauvqKkvLyotx5cUl1RWV
+1XXNtWUN2dGXXdDOWmgTXXcjrMm5+BOn/dmOOv6y22cnh50Iv6eiCPq0kCPvqaS81BXSCnLP
+eQ2HWuDRk19FXFcDD2ioBdyaqCdyrNEE9T2N5r4Kg0dISIibmxsCHgh4IOBBY/JWAw/q7xT4
+2jKsmWH+2o5ra9vQte31WwMe1E9SoAjNkAfDoWFmOg10L8NZc7AfGL5nwmXp3cU04EE/4PIW
+gAdh6Sl9hMWHWQoKm21nvcCx3UZBOMTFGqOpjGLndv1xD+pHVg9hsUBrY0cbM1sbcy9P18ys
+tJq6qqqqysaa2prK6oTkTFcXb2MrC0t7cwc3S5Shqiv7/tj//ei/ebuhCK+7knSEgqwP/zHM
+zgNO7MdS89MIBAQ8XjvwgP6G4fmiNN4J+sml1M9ca3/HV8sJg0dNTc3du3cjIyMR8Hgx8Ojr
+66+pbc4vrBq96oCAx5sIHtBTNv13hCF4UBvNNbwTrxo84A0RQKKHH/CtN/ctgjMwnOh1/fZD
+cBzOA8wx9VQxqBJwEM7A8GLdY6rh4oAfmASP1aIaPpfoO21i6vEa4AH7WEB3wa/pH9xg8ICv
+heZu/BYMtTwhkh6TV7eQ4mMitOXPavNzO+7YHbjrsLeGurmSlL6MiMkpXgzrQf8fdgayHYrX
+vhRlbo7V17M1NfDwds3Kz8nOzsO6eRiaGJvoa7t6oUJNjJy5eDw2bY/5lTWY86Aj/xEzBRGH
+U3yhv+6N+H6r7UFOwzOnU/LS8Ah4/B3gweSqFhjLGUYupfYNwuOV1EwObh00d4/VbmvU4AHO
+7cGDB8XFxeuCR2xCltI5Z+5TJifFUQ+nP792/Ttzm5DM7NKXCB4tbR2uXrGiUlZc/MZC0q6j
+136afvSpoXlQUkrR0NDQi4FHVXWjT0DSxUteatq+RWXig1eOl1XWDw4O/nnw6O3tS7pcoKHl
+clLUOiNHAyDBtWvRCHi8ceAB8zn1t4kheNCvYf+LwYNbIwQ+B4YTVFYbmaWZxAIPTDA01tRz
+1FfzCNHkgQhk3QuhfhRi6C96YfDoGZ5cbeIo+JV6eAU+c/rRFhg8wHnCTVDfjd94jweRtPh0
+sIWUFhFlLSiOOiHod+aMB/dJH0l5Jy4+i90HUDw8QVLi/ieOu/66xXvbAW8uviAVtVCUnaOj
+lbaRrpaRkaOrq6uzlYe0RIKSSuJ+Xovvf7HZuzdCRMRHVND5IKcrKzv2V1abbTv9ThxzlZE0
+FBK6nJOOJ+L/5Gk/C3v2F/XSy1V91/W1V2z97XE8oOW01GtV1l1OCzM5qAdayzYzt0jDJzRf
+cxg88vPzi4qK4uPjAXsAW+zl5UUNHgMDZOtcXd2ore+5j+sC2yFtPjE3SfUYRd20kWtbWrsO
+SGlECElhxOWdUNjopqbWFwOP9vZu8PNyWrGkvC0r+7mDPKYC0r4y5xOV9TLautmv3/xZRjNS
+WMZFXduzoqqBGfCATruruzcyJktO1XHfET0eEayEaqSiTmpSpjKuiue0NFbHKDA6Lq+jo/vF
+wAPAjLNrlKC4xQEeEwEpH5lzcVqmAUVlh/TNXQNDMxoaWxHweIPAA/wK7DLDcHw04MEQEgCr
+rLEqFi4Sl9++dgZmwAOaNw5ZeYYDqdAAKzzzgfoJBb71wZYXXDWUDdQG34XyqgeocQV6l8ZF
+QI1q1Mix7oWsFpXoz4PHJdec1fwYcKPwrRIuTuMLgsED9AbcD9Rd96aAB7gbMNxxjEgiEwBk
+V1PDojwPi/j8wo7iOmwhKuBnauhyRsLt591hP+/xPcrteOqoleBR5927g77/JeCX7Z6ikv56
+xgbKyvrnNPxMreyFBdx37owVEA89KmjBL3BehA/Fzx25lS12I6vt7gMu3DxW/EdQpw/7HeZx
+38+blJe5QoKClv1/wlMSEfqF8CxBR1coP6EjREomIuHZ0ZfEBOQ6nyUSTSKQm6PO8KfbXHc5
+LUAOAAkMFyL9NeCBCi2j+fqs9lWl3pYFYnLqeyn1Ri1r7NWCRqPd3d2zs7MbGxu7urqAKUxO
+TobBw9E97riQIYABTj6r03KBcheTAQwo6aYraKeq6ieo6icqaF+Wu5gkez5OTNFPWAZtbBn8
+vODRemVsz6ELHDw6rJxa3EJO4ioRAA9AK4BtQOXaFqHaFmFQK1LqEaelndV1PNcFj/ikAj0j
+71Oi5oBhBGX8ZS+QGUZJLx3UDE4b1CZPOWcJ5UDFc95Yz8TauhbmwQPAD9Y9huO4/lEhlKgS
++dyUL2WCPlHUSZPXSpY9Hy+pGnxW2c3WKTI3v3JtvwoCHq8PeJDopijQgwccoI/GttK7IKi/
+bgzXXzDMwAx4gASveoMeNOiRgObZCh5ZgJ/coVvKak4buCE4P/yYA/cVVCfoHPj5iPp2tMaF
+wCfzssCD5l7HcNEi/C788LXaaAs1eFA/uNETy2sOHutGLiWvaomLcVZWs+M6avn7b45cRzwN
+dD1EJTHcxzHHjjrs2un/+27sYS4sP1+AkCB6336jzb867Oey1VCzVpT23n3AYdNWJ77jISb6
+3hKilrzHTI9w2LPt9N9zIJJfyFZI0OUIj+fufUG//O60Y5eLuGRsbvoStKqFYschUU6DzBME
+Ijm0yNOEp0rQEfAuEWTDE0nLIP1F4EGiAQ/in2wXgAfzy8z/FvAobRqBj0N3mDWeEaijeYC7
+zWorZehX3dKsagHIUVFRAV4UFhY+efKkvr5+06ZNADwsUCmHT5hJqEapGxWqG+WrGmQrX8og
+G26tFPDzadJJBTYXJLmLCfIX454XPLJy605JuB0TtJHWjNcwLqK0kqUCWtGhtPL/DZFbAcCg
+oJW0PniklIvKOokoBFNOuwCctop+BqAO+T/Ulqqomy53MVHufNwl8wjmweOUqOVRQZT0uQQV
+/SxwquDyFbQuw9WCJK9NPm3ZczGnZVwu6vvX1La8ueBhYGAgKyv7DwEP6qd4+NtEDR7U36+/
+CzxYpbypD8KWkZ4i4MhmsJGF64chARSnuTPQdwvNNUI3K+icz+jHPO+YEfUta+0PCDp56sRw
+yGONQAQ0uEjd4mqjLTTgQe1YhqDlTQcPIgGIbO5J5MmlUSbnVe0UJVHHDzkdOhQkpxpygN+K
+i8tURdhF5ETEtv0hm/e4H+SykxHDqkjbcXFYHuS4pKloJHvGj3WP19ET1hqKLuY6kUeOuP76
+i92e7Rh+Ljc1eQcZCVtObt/N+zx+2+G/bZvVGV79c7KXs57N8SCukBOBkiivAVEsU35fpk1E
+QLTLFDcHxe0BUGWF9DTy2UseVKFhDjzsaKHCtZcCHn9mUtPLAg9oJR2UaCZmwMehP3XqLyD9
+dwp+C/IZQkdO60VB/k9z3yJmAogB23316lV3d3fwOiws7NatW83NzeHh4QmXK83t400dMi3R
+Rcq6aaoGeRomherGuSoGmYq6qTAYACRQNchVM8zXMMx6gaEWY5skU9t4R7c8e1fQSqqKfjZo
+RcM4V9UgU4ni94BaUbmUDZKaQea64FFR3R4WXeQfVhKZUKtvnaOinwNXSMEDUFsK+Zz1c9SM
+Cs6ZZEUlVjMPHt4BOUa2GcqXMgHSqBnmgDqV9dL/CGNkRlLSywR9As4/K7caiePxRoAH9YAL
+MNZrD7VQT5kABhH6DjKcNgkfvOSas7YNfYFVLfRPJQCZoHWpawS4AHmoQ/1Qx92i396axncK
+jRNBr7UwWQyh4qUMtdBPVmHYq+BiwWcB/Qoy0E9yox5sgvsfLkIzBk0DHtQDT9Dw95sOHgQS
+YY5EhGJqJERF2fAKe+zidDvE6S18+rKOMeb4KbPtrA4HD9gdP+R67Igb33Fr1q1hmzam79yB
+5uRyEJGz1dG20lJ3FJMy5OE25zuEVpYPPCbgv48XzceH5uUMO3TIZfsurT1sqENc7sInzQUO
+Wp04an2UNzMzlYiHmGH5D4lIToAoiCRAIDSJvLkLAXI2QDRAzkV8aQ4PqoEdwh+HelaeJapx
+nbcHPP5e8fPzw+Dh6uo6NTV148aNycnJuLg4aPwlKirq0aNHBbg2db3Q5IwaYNoamnrdA8s1
+jTKV9NI1TAqAHVczzAaWV8OoUEk3XcMoA+OLq2vqegHwsMNknNMPzytspsz36PUPrzhvQm5F
+3ShfwzhP3SiH8qJQ0ygrNLaqu7d/XfBobulxcrucV9REmf85mJnX7OBeoqqfoQmoyShHzQBU
+WKh8KcvEIT86qaa5tfe55ngApCkoaSzEtbn6l2kYZpBPzJRcrcqlDABjgDpAzYBn1A0ysL5l
++SXtjKbEIuDxmoIHtfWEDNZq4MHQbjKcevpKl9PC1hlukRp+oBkasOWlrj8qu5UGTiD7S23u
+qcEDTtRxz14APKinpK59vQCBqMOeQGtn1ui0X0VcGd7b1wg1Rj86Qw8eNAMub4HH4+kmcQA8
+YmIc5VWsD3E5bt0eeJA7TF7d5aSwi4CAw/Ej1my7Qrbuw+xjxwgJ+PGddNm1z3YXK4qT21hN
+SV9NxuUQuy3rdrvjXFHGRkESMmZ7OB33c3jsZfNk2x1+jActImR2iMN534HAbaxYVnbsKZHo
+gtRlsu0GphwaXqGaPPHs5VOR4J9PDxPIXEJGkyVKIkDvk56WgF9Ar5kbY6GIQB7Aofh/yD+p
+E/kI5VTJ7VJOmEh6CUMt4E4Sk9v2DwcPaWnppqYmX19fgBnBwcEPHz6MoKiurq6npycrK2vH
+jh2xsbHV9YPn9cOiEyv/6E/o1DVP1LdOs8KUuAWUJaY3lld1/plVLbbOqVrGkZez6qgP1tR3
+XTSKs3TKdvTABURWpuU0d3X1M7mqpbG5G+OZlpVX/4fJJO19/qHFKI+igIiqnKK2xuaewcGh
+F1jV4h+aV1jSCL3u7OovKW8Pi63SMkszsCsydCh28a+MTq4rLmvr6OxHIpe+ieBx/fZD6hUf
+NOCRVdEH+wrO6MfQsMRfAB47Jb2Wlp8uEJiYenxMIwQqq4vNBke8E2qfOmR8CuGCYoZxNPVD
+NczMLbb23bQOKKbuh76RO9AFgp9Xrt9be4qFgHYkfARUBffMGhcCGoXPB+QHrfcM//9aP/B6
+jZjna3eae0w1dETOIgmeXQ8fBG0BqKBOoCB8pZUto2uAB+guVbvUNRYBvVlzPJaJTzdsi0iM
+0RMTNz10yFb0uKWmpIuBju8RAevfWU0597mJ8AdKi9qfPO60bQd23+/owzvR4sLWCkrntFT0
+Lii6Scu7HDtjyXPC+oKCDxeH6342C5njtgonHY9yO7AdtN+9z2svJ0r4ZNBZkRAeQXse/tSi
+jBcx3BRrT8ATVvAryyTiPIE4hycQqOCBAEEC8TlqfpoZ/MQT5qemhuobussr+qpreiur+8qr
++surBksruoqKr3d1EBbnKGuOCYQ/7+8gkQrrhtb+w/7LJpf+vfr++++tra3v3LkD6AKwx+XL
+lx88eNDa2uro6Ojk5AReXL16tbi4+OrV8aqq1vZOWp+AqV1yaVkrk+ZyXfBobe1uaurq7e2n
+H4JpaOpezxYzXtXS1tbT3UNbYVR8aVt7L/OGniF45OTV1jV0/HG6aUtodPELRClBwOM1BA+a
+kX36AGI0y0ghPwDNGhMmwYN6dui6O5VQz44w9y2iHiyAL4F6ICM4tZFmMxTYRoMXZt4FkO+C
+fpYI9dgEeA2FN6RZ+ULtaaF2qjAZuZRmVgz1gM7zRi6F2wKwQT/FlOHQ2BqgyBA8INHEeH9T
+PR7k+GFPwSMhJsZCQMxqK5vdjm2+EqJRTg7u6ipoLm7nbayoXbuCuI56q8jYn+L22fJ78M+/
+OLDt8xWTd9LVcdC/4C8qid6xG7trl7e6moeKElpJCS0vjWHfG/nzlvBfd9gIHPdSPBusIo86
+eUyPnV37OLdFgmdJT015R01xa2VBa0V+W0VRd01Jf335leamka7u0f4rN0bHbl+/de/2vYf3
+pmemZ+dnF5bm8fglZgz+87k7SORJrWT+mpntSEvH+QW2xCU0R0Q3hkQ0BITW+wQ2enhVOqNy
+nRyvtTRSspNJh0DmlFf7ef1ly2n/dvAwMjJKSEhYXFwsLS0F7OHj4zM6Onr79u3Q0FDwq5aW
+FsAScIShBTSxTaLxJ7yKAGKGVgml5S0vAB6rCYBHU0v3nwQPRutcWsNjSxHweGvAg3pk/wX2
+aqHx3q8NHs+7Vws0oECT4FkKcMAKaptOP9RCP30CCmayGhgwtLY0eZiM47GaHX/hvVqo26IJ
+70aNiAx3fIMntMALZtcAD5q+fXM9HrCdjo+KNhE/a8lzzHvn7rCt7OEKGg6SkjbCpxx4ubF7
+9yZ/yxq497CNlIj90RO+e7ldtu7y3HnAQUnJQk4yhJXVY882Rz7OmIs6UQoaVpz8rr9xhO/Y
+G8i5z4trn70Evz0/j/3ufZcO72PX5N1/jn+PuSS7o+QBp7P70TJ7XWV3e8jt8VPaHai8J0SF
+I0iTO+jCiVBtwXA9iSgT5QRrnTRn02wPh/xAv4r4uMac/J7K2istfdcGb92ZePT48fLcAnnE
+5cUEDa5Qrn68vt5PSqbM2YXU3Ueqb8KXVi0Wls5mFS6lpC0mxjdhUAWemNl7E7CXhEB8tWFE
+/lHgAQCjoaFhYWGhv7/f1dUV/FpVVTU9PV1UVLRx40Y/P7/h4WGGFtDMLjEn/5WDh7FtQnnl
+ywSP6ITS5tZXAh5hMTgEPN4sAUsEB/ZkmAEK/nlaL2rtSQjU8x+geQg007nhAKGtfTdXOweG
+0xhoBMUR1cVmA+yB26WPSgoMIvW7oAl4sgQ8oxUUOajgD582FHeUpjnIxUF9afROAwHtSLgG
++AxXC3NKL3Aa0KyJNXpvDW5h2BZ8HLyAz2e1jxiKtkodADYV1w3vpEOfH/IgrZHhDQAPPAH/
+bFVLVGyMsYiYAy8vVvKUuRC/u4I6mpPHZNd2Gz52P+nTvny8Tjv3ObCyubFuiz7O5S4ppntS
+UFdN3kheHHWC3/2MmKPQSTcVlbBD/JhNu4059nnKCAUInUAd2GPDts/l1z3ae/ecVOP52U/2
+fzb8G/WOf2p9+APnwx9hjnzkfuwTL75PfQU+9T/9WZDIhgixDyPFN0SKfRIp/km42EdhZz4I
+EX4n8PT7fmc+8zv7tZ/ML36KbL4ax3y1FSNsTJI8XNNDo4rTshpx1X3N3WMD1yfHHz56sLQ4
+TyISGI7VEJ69eDpVFU/Gh4Xbd1NNLMwPsseqq91Lz5zPzH8QkXQvOPaOf9h9L68pF/SIEypP
+X683NweKIkIkvPLoZf808IDW0t6+fXtqaio+Ph78Ghsbe/fu3by8PG9v7zUseF1D16sGj8i4
+0pa27pcIHqUVLd3d/S8dPF5YCHggQoToLwYPytxJsmJiYiwFxaxY91pyHzSVPO1qYYaVlLTd
+uR2z5VdPzgOYU8etBflRe/eHbNocsWWL1Qnei6Ji+ueVzdVlrIWFbA9xY3YfdFdUcxeUwB4R
+NDhzwlGQM/z3X31/2WK2j9v7iLDz8VNKJziOKB/ZbM73H8dT7zue+BDL9y+34x+7HvnIifMD
+a46PLY5+bsH3sc3xD1DHPnHh/bcn3+e+/J+EnH4vRoIlUfadFPmPUqQ/TD77cZL0x/FSG6Il
+PokQ2wBAJVDwP0Ei3wdIbPOR4fJVPRtqoBfvhM4OjC5NLGkpar3SNnr76sMnDwj4P2yGC6hj
+gURaWSESlwmkpaUuv2iLfUeTTI0HU6N6wgJuBMVccwi6buF23cJ6xNJozNjg3iXzHiWdYl3T
+h8PkyT8EyvTW55pMgoDHuuCBwWAAGzQ0NDx69Ki2thZa55KVlTU5ObnaUMtz6c/s1cKELX6+
+vVqeSwh4IOCBCNHbBB4rRMIC5B0gkuLiYi3OaZgf53H7eWv0rr0x51XQ4lKWfKI2J0Wsd7LG
+fLcl4AC7w0kuV9HTzuwcmJ9/89/OYSmnYqAgF7CL3fOn3SghEXdzA3dxIRQXpyP7Hocdm124
+9rlJCpoLCvqy84btPBT+/U7DfWxyWlJnMFoiAfp7MbI/Yk5/7iPwXtAplhCBd8NE3g8W+8RL
+6GMXvndduN/FHnrH+eC7KPYP7Dk+tjn0L+tDn9gc/MSR8zOXI5/68mwIP/leovC7WRLvZIm/
+my76TsqZdxNEP4gT/zBS4oNgsY+Cxb8KktrkL8MapMoXaaBx2RlbEHG5Iq+lvenqteGpmQcr
+sMOCSLpRXe3NJeQicHa4DHenp77Qz63DxWfYGDNy3mhE62LvOdV+ecUhQekGTsHAHexl7p74
+xQXyyhrCGwkeoEJQc2dn52vyZ0kTx8PPz+/WrVtxcXHAiINTBb9u3LgRvADMgIAHAh7IbRwR
+orcDPPAEwhLxKXgkR0TbKyhhxUXdjx724jyceFYhfPcxxwNHLJWkbUSFI7ZwBP663Yl9L1ry
+tLuMKPbQQTc2TmMlZR0lOa/9hzx5jmPUpL0Mz4VzHfHevAW1Z4fbcQ4/BQlHqVPmRw5id2xH
+bd0cuPlXh1NHtBRkYlNSrtwey+koccoPUkm04w7V3hKk9E2g5GeBov8KPv1RmND7ceLvpsq8
+myL1cZzoV6FCP3kf/9aNe4M7z3uuR95z5ngfdfA91IF3UfvfQ3N8gOL8yJnrYzeej334Pg0W
++iT8zIZo8Y/iz76TLMWSIsOSJMMSK8kSJPLvAMmffWT3eCuJBGhfirT1ywutqC++Mtb76MFE
+goK6ww6OxvDYoY6O8orStLCQSpTzoJ5hm7hE9WmBvMOHM3ewpXy/OfGbn/z/920IF/ft2moS
+ZXebVzq99C/bnfa1Ag9ohAUQAgaDaWpqmp6elpWV7e7uRsADAQ8EPBAheuMEHnIZr80kh+Z6
+GpQrISrankcYw8Zhxr3fQlYqwtghgJPPcdsma66t1tz7PA/zuPEJWO3e77Htt/ADbFZHuc3F
+ZUyMNK30FVxFhE2OHXA9xOorL+V7XMBnH7+N4Gn0ce7EnRxBm7fr791txXcwTFs0R0siWPmU
+qaRARHjA/ds3CUtzS/jlqUcPRm5eq+xpjSnPdEz3V4414w5SZfVU2OSu8I2n3H/9JP8TLPxl
+5KlPE0+zZJxlyZR+P036kySp/8ZIfBkk/G/Pkx+487G48ryDOfIOiuN9+4Pv2+7/0O7ABruD
+H9lxfozi/i+G70sXvnfN9nyAPvJ5nARLgsh7EYL/9Tv1X8+T29zFhIPOu7mYOO3cn2tuPjN+
+E1fb4p2UmZNXXOnh0aymlLZja+jGH3y/+i7gq+/Cvvs66fuvs775LvbLH+q0DJYm7r7qWR7/
+WPAAKikpAdQBXqSnp5uZmQ0ODoJ+QMADAQ/kNo4I0dshApEcxwOKyRmWEG0pJWvDesB2028e
+R3g8L160k5J2FhG24thtveWHkF+3Yo7wOQsLBxw+GPDzZuefd6K5hMy11c01pd0PHTP+bbvV
+of1+Fno+ClI2HEdMOLns2A56/cLhv43H6oS4ydGjMQrCA7YXGoylUnSFw21Vct2t6iMD23Oz
+r3f1zk3PQCczv7Bw79HdkTtDTQNtWRW4wOwU88sBUnFWHBFqvwVLbfQX/9r7zJc+ol8GiH8Z
+LPlFmNR/omXfS5FnSVV457LsBynSHyVKfhAj8mGU0AchJz725vsPmvcHa+6Nuvs+OPPFR1q/
+fRUj8lG+JEuxOEuRKEuhCEuW8MdhgmKn9oSdEb3XUb+4spJR3e4Un1vfPTKUk1d3QT1hy+/e
+n34Z8uWm0O9+iti0MXXz9xXfbyz736aU39mvJGW96s/lnwweQBMTE+3t7dAmcaATxsbGEPD4
+J4MHIkSI3ibhifh5EmXfFDwpISrG9rymueAJl/37A/bu95M448jN53xS1FFA1PbwsaCdB7Db
+fvfjPRJ05gyKkxO1fxd6z0EzORU9OVn0QU67fbzGEnJujibeIoet9/5sfGSnFud+PUllVx2U
+haSRJtsJw127fQUOZJkK1WLEceZ8efonCs0ly1HncViTAh9UWVJoW23BrVv9K/jH/++MWcI/
+mZu/9niq8e6VstGGws6ChOpEj7xA48sYpXgrnlCt3X6qv3nJ/+gh+63n2f95iX3uL/6vELFP
+wsU3RIu9Eyf5XpzUF9Gy3/qK/svu8GdefJ8kibHknGHJP/NOhsiHGWLv5kl+HS0ufGR7uqkx
+aerm0vJyx9jtvJae6/emF66NN9o5ZPKcDPtmS8r/tmZ9tz1x068pv26u2crauutIAht3ZUDo
+ysoyAh4vETySk5PDw8Nh8ADGi0Ag9Pb2srOz37t37+rVqwh4IOCBCBGit0PEFcIKgRJAjEhK
+i4yxFpY04GB3EjnuqSgdpHvJ7dhxu61bMGwHvAXE/GTlMfxcLjt2hmzf57lvv7Ukv42CpJmG
+uqmGkpvCWT+es/57hf2UlGxOsWqd2GzlIa9lLq4ozOds4mDjkyCiZcB/+qSc0gl92f1JmpyD
+aLFmFG+ZJXudMWeXKV+PtXijgyzOVSXXVzsvBt1Qln11uGN67i6BhKejpMWlpbmZ+UdTs1N9
+94ZrhlvKW6sLqgri8hM80wJtk931EhyVIs3FgvV4QrX3h2mxBWuyBqntCFDeEqS4yf/sj/7i
+P4RI/uh9ZpuLyK/eYnvdJc+cPRYR7PF46ub1sf72rpqR0eZ7d4ZWHt3tT83IVbh4eRdXxqe/
+4b7anc/KmXeUr5hXKOeEGM7MZryvd46IR+Z4vETwqK+vX1pays/PB699fX1xOFxiYuLy8vLs
+7CwgkJGREQQ8EPBAhAjR2+LxIO8LC23S5pcQaSQobL91j9OOHZ6iYt5YZzNdTXPeI27bf/Pc
+sjH08H43RWUrYaGwrdtSvtmE3sHhKK5ge0kTq6MQLizpsZkj5Jf9UXJSIRYyFqqc5p7iXjl6
+phe51E8e1HHEnAsKVjKzltXV1uA7aXhsf7CZWL27Qpu3ZKvbqXp7jipztmor9ib0yQ4PmVbX
+89XOukUuWqXhVp24sImRuoXHE4SlldXJiTJctLKyDIhkaf7BwqNbM3evPhgfvHu169ZQ9WhH
+/mB9Tn9NZld5RkNBdlXu5eqsqIrkaFxibHliauXlovJcXHX5nRvj1aXxEV7K+eHqxckWwwPV
+90av5lui8o7xle9kr+IUyhaUipdWSTynn27tNFJfDxqcJa3gSW/eqpbp6enKysrJycnXDTzq
+6uoAXUxMTPT29gLwACYM/MzIyBgbG2ttbX0p5hUBDwQ8EP29mplbggKkv+ZhrxD9BeCxSAEP
+8PweGh+lIyyC5uF12r3bjZPLX1nN7bSko4CA2UkuuyN7Qn7f6cLGbi8qgOLlDDjMgWU94Lj3
+mJmqopmcmB/rITQHr6H4CbS2cEmQco4j70WNrx0iTzkFiBno8CkKCeoZWTp5RRvbBF/SRGtI
+aoVHhA+3lpfHY3M8lOu8xfv8zvS7CTRaHqsx4Wm2Oj2AOXvVW27QW6YOK4ZzU66IcGzHpY+P
+DM7MzBAIVG4Gyg5zS0RKRI61fDrUiUi+YALxCYG4SMCTCCtLy8s9fcMjY2Plxd6xThwFzjuT
+XY6UV0eOTtwq9gkqOH2i7MzJyyoqKWaWWQFh+Sk5GYmZ3e2dROIK/tlioDcLPF7bOB4FBQW5
+ublYLLavrw/gB4CQkpISaH4p8iV9/cQDgQeJxODvMycnB+kgRAxFv4ktordbq65qebrjKlk3
+RkYvBwVjDfT0RIUuHjsaLqMSx3rcZROr1XEeN0VZb15+7M7tqF2sjnv3eAsdw0rzm/Dxaqtq
+aijLWQjw2MqJnVM8bnH+dIwTb5HPTrPzX1yw3GoXJeYYpGh88dTpY4cuatmiXdKN0clqRn72
+nkm13UMTU5MDbeVVUU6lWLU2d5VRP41Bd9l2J94aC7Zqs31tKN4hX6nBIOUWX8UaL0Wcl2ZF
+FKqvPG1ybGBudvaprwFPDuW1SHHXkFfmrDzb2B5PgravJRKfbWxP2duNMnZDDr/xmESap1z7
+0tJyd9+VgasjFUXeqVhOnNPmdNSenHRsZWtndmxmkp5OvqM5LjG6pqigoryypKImPTuvo6OL
+SCA+3VP3lQkQAmCP6enpfwh4ODs7e3l5RUVFgdf5+fnz8/Pg8dnJyWnjxo2ARhCPB+LxQPTn
+vQ1vN3jQh1v/K/X3tv7aatXIpTQYQiD09HT7+vlqqqlaaWo6CIk6srE7b9nluf+A5/EjjieP
+YfZyRfy0JXbTD9ijbEYCQlrndHTUVR2FT5pzH9JiP4CWUfQw4Uny3Rzlskvz4s/W/sKOkVJO
+UWIXTQTExaUNDLwdvC/ruMQqWfgbOHrHZhRcuXF35smTq511FXEuxW6aDa6yI/7iNwPPDHgI
+1tlyl5ly1tpw97mdvu4vcTNQfNhTpBYlUuyuUZHo1dtU8eDhNOGp54OMGQQ8xZdBCeuFJ5KW
+yeABSINAIQTyaBI4RiCnFYhHIGhYWlpq7+ju7u4oTnULt9qfYPJ1ovk2XCKmoaEvt7Adl1fa
+3ljX0trS2NzU0NjU2tZaUFjY3t4Bx3p94/Q6Ry4FGhsba29vB7wREBAAOAH8evToUQQ8ngs8
+rl6tB+ktAw9Qp7e3N3IbfwHlVQ9AG5Ews2PaGwoepU0j0H4uf/0VDY9PXXDKhHZ4Qf7YXhg8
+IC0uLXe3tof6+ly4pKGmJm7Iz43eust/8y63g1xevIJhQrz+B393++Unjx1HzeU1baTl4ndw
+Wmzm4t0iZSB4zk32YJHHdlz4r1iL39X1D9snKZrHcWESxS2w6rGp+dEZdWYeUfro+HNWvuet
+PK09YzJKmybvPyKtzNzuq2lK8ShxO1eDURj0U5oMUbjjLzHofKLG7GiBEU+No8iAz9lroYpX
+AhUa3WSKXNQKYzwGupqm7txaXl6i8t8QyeMgADPwc6TlJyT8PInMIGTyWKR4ORb/GH8DgEdL
+S3trc31BkkOQ6bYY4/8mWG+tyXTp7R0sreqsr6/v7+vs7evv6yerqakpLy9vcHDwzf0zeM3B
+w9fXF3TvxMREWFgY+LW5uXl8fDwnJ2cNI/jkidAzt/+6aQ+wYExnft5USTUA8dIT6ZXVDCX7
+FyuIxPF4/fVcW7W+oeChhclabXvfN9qH8w8BD2Cz8Xg8Af90Lcns7GxlW517mLuhrrIOD5fd
+bnavbZzovYfR0ifQasft+fa77ztmK6dioiqF5jqktEP2l58M+Lees2DbU+3wY0P4F7k+2y5q
+bdP2E7PN5jeMYnPLkooriewdf+AXk+DgnmHhnaPuEK5qG6ztHOESnlHZ1PtoljzT5P74cAcu
+FxfoXI7W6ERLT/grTAUp3vaVbnQ4nWEumGUhWI0W6/OXvxaqNOQl2oQSLPfVb8mNvN7b+GT6
+/rPrIJAIM6SVh6SVRyTCIpFIWKbszLJIDjdKJhBa8GjrGOjtqMlxibDamWD1baL9roZCj7Gx
+KzVNba0d9deuDYyP37h27TowggUFBb09PYuLi6SnW9Qi4PFywAOLxaampsL4UVpaOj09XVxc
+DF6rq6uD12s4ExYXdwAL+Pix5P37umun6Wns4mLTutkYJiLxIxLpnTUyLC8PP37sy3yFCwts
+8/PsTGYGHcV8zcvLP4D0XFc3N1fwXPlB/Qh4IOCBgAcCHi/L40GgiEggRxWDjkw/fFDbUIn2
+tD+nIIHlE7Hafwi9bXvgATbLEwetxYUdLmk5XFKylzjNt/3819+bsn1pob1FLNvgfz3R39SF
+fhPquvUSStQ5V9k4ldUwabd9gmZcQdTg1QEHTJKZR7pVcN5FTLyafeQFx2gT19igRFzH4E2o
+1Yd37vXVV1XG+JRiL7SgRG97CD8OkbodItfnKlxvdbTMaH+DBfu4+4npoDNj3hLNGPEqV+Xq
+cLtO3OXbI31z8/BUFvKCnXlAUBTqIBDxJMI8OVEFOwfg0djc2tHaWJXpFmnLGe+wIw59uKU0
+8M7kzdbu3r4rnfcf3gIP3bW1teXl5eAFxBtEIhEBj5cIHhgMBvxxDgwMeHl5QewRGRl548aN
+7u7ubdu2hYeHT01NrQYewHwDC3jjRtIrHWrB4z8nEt97iUMtDx+qAAv+KoZa5ubYQUIil76h
+ot7SfXh8Ct6uXc4iaTXDB+/nDm1AD082gLahBwchywgNB5BrTnu6PX1e9QB9u9SbzsMHqReh
+0GwiD17T7CAPtQttLk+ibBAPZWNopuH930GGNWahgIuCRjSoN6+H3gIFfxVxhauF2yVR7U0P
+zj+xsBMqCK2pYbit/FmTePoN7sFZ0TQNEigFVULfva19N+F+g88EGpSBr5Thxw1ODKoQRkTw
+AUFH4Eum6eq3xuMBvyAQyetsSc+iZN15ch9XW4oyN7IQFQ3YfzTuu12ojb9bHefVM1CzPS8T
+cvCk5DcaP3xlseM/Hkqc5t4aO/rifq0J3VATtSXKS8kxUheN49VJZLVOPYNOkOwdqh0YuuXk
+n2TqFu0UmmvqdVnTNlzLKUbfJcnKMyW3oPzR1NPFnnOzczcGOtuyQ0t9dWucz4xgeB77n1oO
+FXzozT3syF5serQAJdPmrTQeqnInRHbUVbDJ8VSFh2Z5SlBnW/PU3TtQJeAK5oikRXA9+GXS
+8jQJPwOBBwQPeDy+f2CopDA/I9wpEiUe7sgT5izcXXd5ZXFxZGxi/Pb1G7fGSkpKMjIygBF8
+8uTJ8vLym0sdr/NQi4eHR1dX17179xITEyH2CAsLe/DgwcjISHBwMDiOgAcCHv8oBwVk7KDX
+UAKmEyQaSqHOAFtAyJjCVp4m+SbVwU3AVVEbUJqD1EcAljCsk/rEqOkCGFlq0qAHj1NaEdAR
+agqiEbgcmq6gPiv6t+DK4beAWYffhdbzUv8KNwQBDLVrCLxLXz99JdSptuMa/CFSu0Hg/NT9
+CecEHQs3BJ0A6NJ1u/qt8Xj8P4SQV9qSF4asEJ8tFSGRmgc6/TDOtmLSKK6Tdgd5rA/x6SlL
+m8qKeLHyyX9zYctnNj994KYoE5Psg+1MYK+JYWkN+aI+UCQoxAqbLm9XIKQbv8cjlzci1ZpA
+ItyanApLSLdA+2GCLjsFZWg7Rpy3jzRySbHBBgeFRjS1dy2vPB3xWcYv35q80VqbXxtlW4aW
+bXU+dctHcCZcYjxIrsRBPMtcqMj8ZJsD34T36ekgsRt+ki0uUqVY5ZJAy+b8+MnhDsL8NGX0
+hbwjzcrK0goeT3wmAoEAwGP8xo2aykpcWkJBnFtyiGGohzYuN/Hm9cmBgfH6xqac3OzkpOSy
+srKGhoa2tjbwGL609FdMDgcfFoAExguR3kbwgJSfnz89PV1VVQVdO8C8W7duhYeHT0xMIOCB
+gMc/CjygJ1xgg2BbDz0a09t3kBNYbWDXYA6BnqlX83hUtl6lMYvAslMbdMhnAn5CZeFsoBU4
+2yXXHHAC1GcLuw6oTwxul6HHAxT5ls9p3WEganqBLD548Kd2a6zm8aC+dug0II8H8+BBXQOo
+FrwFXTXsNmHo8XgB8KDuK9DE9dsP4TOEnCEwO/0tI0p/GXgsk0hPKIlsZVdIpDnyIYACdyYm
+Y+29TMVV9TXOG4lJ2yor259XMhGXF/jFnHWD49csaHnl3P7WsaYk6ba0fzX6fTAQxlYQpR+R
+jHXIkrXJ5zKP5HRPlMttTAO1PpmZKSitsHPxdfSOcovKM3ZLVLMO18Cma3tlmnnFxqdm37w+
+Bk0FxVNO48njR+MjvQ0FifmBlsVYxWFv8YVwselA/muYo40WHMWm3CVWAs0uZ8cCFW4HyQz5
+yda4ypa6KjfG2I/WZj6aHINoauVpPI+nAqatr6+3uqK6DldViysoxSXlZEelpSRmXi5KScqN
+jo9PTb9cXFRcXl5eXFwM8GNgYGB+fv4v+Lz+aXE8YAUHB4OrBkAIuhogBxsbGxaLHR4eRsAD
+AY9/GnjAQw8Qe0DWk94mUrvfYfsFD7jQz/GYmVukcWVAPABXCD1Tg2phw0dTFfVgAbWLhgY8
+aJwq9OABlaXJs0afUA8DMTPHg5oKqAGDSfCgtvXU2dad4/EC4EHjykjFddPPzIEB7A1yejwv
+eKyQiHNE8hpUImVB6jKeuIgn4okE/CKp0Smp3jaxvKgamAkJYQFNZUkXezfRfZFb3nf/9j1X
+vkPB/S23mjIsutJ+rQ/4tCvsq9a44+UFUa7pVo5FYtaJvC7pohbxMvUdZeRW8Cst3X0uQbGm
+rpHOUUUWAQXydulKzjnGPrnW7tFuXiGVFdWL83PQhI2n4y/LK7fu3uluqysNsWhyEhrHHJ4P
+FpyJkr/qL9eElSix4C8xPdZof3LAS+xGmOy1IOluN7FatEyFn1FTTsyNoV7YX4Enz2QhCzxT
+93T3tzT2Vdc2ldbjcDVFOFxpSUFFblZBbmF2WRWupqa6tqamsbGxt6/37t27hFcbK/2fDh5A
+GAwGmLDp6emUlBSGcTyaWzuzcsrCIrNCwnOujx8EFnBwMOo1B4/BwcH2ju6Kqsb8wuoiXP3N
+W7L37um8LPDo7unNzi3DuMVoGfhdG98+eYe1pq4ZAY83GjyojSxks6jBg9qKQY/wUIKLw4aS
+4eRS2CJD2aA8sLcfIgHY0wK7MhiiDrV/Y7UjDM009BrYembmvcDWGRhferO7LnjQEAuT4EHP
+VK8OPGjmpgakNFD7sqAEfyKvwzzhVwQe5JEJPJEScIu0TCTOEslTNJdIhOGrk+XnQx97tRKX
+iEO3rtt6oiNjQga7b8rzFH3L4vvDBo/9Xzs3FAwPNsQ3xR3sSfi5LvDj/sSv6rNNipuqbZK0
+fcoFzRMF0aXCrhGaQ8NdUFNjd+4HJhVfwkQ7hBa7hpeaouLOW4aZuqVZeWdaYCIj4zKGh8dI
+lDChBNLTaKHg5/17E3VleVlhrhku2jVu8uN+EnNhYjNBwjc9TrXZcpeacFRYcHY5Hb/ue2Yi
+WP6Kn1I1Wr7U5XxVrEdvS82T6Sl4lgZ+ZXH2yczk5MzQ9cm2a0PNo70dQ4N9fcN9Pf1Dg91D
+Az0jo1fHbtyauvdg/snsMn4ZT56BiyfPgqGcBiV+Kjl+CAEaj4Jmn5IT8emQ1bOwqQh4MAke
+QDU1NUNDQ5OTk8nJyV5eXvS2r7e3V+2i036uC00te1+dx6O/v9/YwnvvoQvXxr9aWXn/z3s8
+mpradPQ9pJUcrl0/+1I8HiWlNTaOoadEzTl4zQVl/GXOJ3b37+nsZRWRddUxDoiOy2tp7UDA
+400ED5qZBjTgsdr8DXp7yrBCGhMGGWh4PgPUClSQHnVojPUa4EG/0IM6M9QWtfOE+Tke4Fdq
+/FgXPGjmZDIJHjSTLl4peNCgEXRFq6W3GTwgs0ogvyBQInQtEwnAyLY3dtdeSpv2GwIUskLC
+17U1jIxcuTH+RJg745t3XH7/0HPLO4EpYaO3x4dL4gWv5Xzb4L2hK+FfDbH7r3R0pOBSXVKP
+m2SIeFaIumcfd0+4NDb59JQezyzmlTXbuITZeyZ4RBVb+maq2Uadd0qy8s+zcItHecbklzXe
+n366cS0Rv0LAk6OkL+KJdx7PdPd1lmVG5PnolTqf7fGQvBUscz9U+m6w5LCrQKMlV7kRe7X5
+0R4Xkeu+Zyf9RPtcRYqxikUBZl1lqfcnrlFisIO0BIBidolwb3np9vLi7cXFezOLM48Wlx7O
+L0/PzyziH5EniJAjgiyQFmZJMwTwP4WA8OQBKALoCTxxBVq0S3YKkaex4leIK+R1NHhyDLNn
+c2QQ8FgHPNBodEhICLRnXG5uLkCOkpKSiYkJ6t1pQyMzhCXN2TgvAlN7Ws5X18y6sWW7pq5n
+bGLuSwSP4LC00xLmu9nPc/JZnpb1D4tXzC06LKmIcXKJ7ujofl7w6O7ujUvMO6fjeviE0VEh
+R3HlIHc/9bTMwMamthcDj4HhYQd0hIVt0EEeA15RFwnVKEWdVOVLmUq6aTqWYdoWYfJayXLn
+4yRUAhXOeaPd4nGldQh4vJXgAU8toEmwm4JhhfAwCrQmBbaGkG8BGuWh9n7QzAP58+ABzztl
+xuNBolpaQm1/4fmo64IHzUDJawgeNE3A4MHww6VZd/NWgQeN/4Mi8Lxfi6sZ9mh5EDRGmiMt
+Ls83NdSNXLkyMjZ1ijvxWxbMro+CN7HEWehVPnq80FRs2xO/cTDs+xrfz3rS/11/+dLE2NXU
+qhDHQkmjGC5Ulrh7iSQ2Sb2xpxZYfUoTxDv37hdWN2NC0619ku2Dc638c3TRCbrOcRaeqTbe
+yejAxMTs0r6ha7Nz5Ogc5IAjoMwKkWzeV/Bzs4/u3xoZ78ANFIW0xNu0BJzv81Ec8ZW77it5
+zVO4H3Oq2eFUlYNwA0qw15m331Wo3f1snbdGXYrvYE/rvak7i0uLRMjNs7JMwC9SArEvEojz
+gDGIhBU8nhyGjNwifn6JtPh4+tHdkZt3RsfuXr16Z+zq3aujU6OjU1evLT56Ai0IWiARFiiD
+OeQw7URotIr4OoDH5OQksAsjIyOvIXgEBgaGh4fX1dX19/ffvXs3Ly8PHNy4cWNcXFxza6+Z
+TbCEIobntD2/hJuYSjh4tFfQSVXUSVPQvgyMrOz5OEnVYCnVgIuGoWj3xMjY3O6evucCj7b2
+rksmfqZWgZJKWB5hB34Jd3GVCFnQijbUSqqCdor8xUQpjUhZjUBzu8jA0Mx1waOgqNrKPlxV
+y++MnIegtI+kerTcxWRQG0jgnKU1o+U0Q3XNYuwxCVGxecW42h66c14NPLq7+9V1grRNovVt
+C1QuZaoZ5qoaZCvrpQP8AB2ioHVZHvwkp1RlvQzwQsskEQGPtwk8JqYeQ9Mywc/SppE/2ujF
+pWU8fYWajn/Y9uiYRghUp6J1Cnhh5l0ADl6//RCqFvwKVQ6O0BQBydgzf2l5BToNAe1I+OBz
+gQc4T1W7VPCaXTGgZ3itbSupz+HK9XtyFkk09UNmGpwteJcZ8IB7D6SwjGa45i+PO1L3vC42
+G8rDKuVd23GNYQ/DV3RQwR8+CLoaPgjagg66x1QzDx7ROa3wEiSa3rj/aO4N+nsGd4M/s/EH
+tAZk+vF0dUXNnYSRqaBR0jwZPBrqa4eHhq6O3RM8GvsDi//uDbE/siSLHo+euPVg+npnWSD3
+3fxNrYGftcR90Ry7ubvYa55I9M+y868XvRB11CLrVEijgn20ZG5tDEAaineF/Mc8t7CMq223
+dY80dYlxjSlzisBdQMWq2UZY+OegQgtMsdFeoZmt3aMreIoxX6QkUBoPuWeeumqezC8Mj16t
+K8nBhTsXu6g1YyXHvETvB5y57ycwgj7abMFeYcJRbnuq2FkuWIc/0/VCSQx2sLF05v4UNJZD
+INe6PEeaWSI9JkPEMnkfvUXy6eGfDI9V+MdUBSe2xya2hIS2+Qe2+/o3uXvirB2aAsNW7pG/
+IwtEaDYuNMTyzHP0GoDH6yZq8EhLS2tpaYHil9bX1wcEBEDggcViQyLyRRW8lfTSNIwL1Y0K
+VA2yVPUzgZGV10oBCbKwFEJIV9RNU9bLVNJJjU8ufS7waGrpAtwipeqjqJ0MTLm6caGaYY6q
+QSaw5hS2gVohJ4ANKpfACWSvCx5Jl3GqujFqBtmaJsVqRnngtFUuZTytDapQJ1VJN11JNw3U
+JqUeHh1fyPxQS1hMSUp6JXhRWdMZEFGlY5GtbpivYZKvbpSjop8JOAR0lJJepqFtTmRiXWNz
+LwIebxN40Iy2QGsuoKAQNDMhabKBDJAppF5hynAyKj05UA95AJNKvaaD4XKbtcEDOgKog2ZR
+DMM+gReV0C87hWdE0KygWQM8aC4TKsVwIIM+GxwMhN55AmUAiAI7lGhKMQ8e1KtaoCgo4MJp
+onz8EwSBx/jNG/VV9dNpNx6EXKWAx9wz8Lh7+mjMTyzhrBvifmRJPbIzuLfzOmlpqSpBezj7
+s6HEDyv9/nst43+V4WL3Jm5UNpa4FJ52qRfUDOPC4sT8qgXtIkRru3DkSREEInH56dTNwdGb
+3pEZ+k7hdkE5rok1ht5Z8pYROthU5/AyG49UK0xUc+fQs5EXAtn9AYqSiEuU8Y6lp2NF5FCo
+8zOPrvV3NOfHV4RY4dDybegz1z2EbviJD3ifbXSTDlLnvHDkm2gDoVpX+UKUXF6QU1tdzd2p
++4AcyKRBDrS+vEgiezyIENgsPGp384kWUx7LKyb29OLLKoh5hcSsnIW01Lsh4bWmVleyiiih
+ygB7kJ0mlIghBGibOgQ86BUXF+fi4oJGo4uLi0tKSurq6mgme0DgASysgXV8Vn6jW0CZhiGZ
+LjRNizRNARtkQWAAEuANNcN8Jb0MNYMMBw9cR1ff8w61GFnG65hGpWbVJ2U06NvmKumlgwrP
+mRVTTHkGaBRqReVStpp+JsqjbF3wyCusi04sr6rtDI6uvmSVo2KQc860WNMEEAiZmkAiV2WY
+r2aQ6eRVml3Q2tMzwDx4hEQVJ1z+f7vf2TWQmtV4yQqcXpamSZGWZZ5HUEUhrq2/f/AtmOPR
+2dnZ2NiIgAfNaALDOB40dhZeFQsnCDyoj68WqYPepc8wrgUNYDwXeHjF164b+ZPa+jNcL1Pa
+NLJ2HA968ABsQHMhoEL65bTQmtm1e5gmA+QbgVegwD3McD3sGnFloYhnb/QEj5cCHkB9A30p
+MSkjHs0Pgq8CW7qMX2ysr7kyNHRt/J4od8KPLNG7Pon8mSV159dBZQV9oFRHRVht3GcTxR9U
++34ykfqfhpA9jWWJd+/ds49V8qoXRBWKnA/f710r5FF0xjlabWC8jdwQeQ+3Zcg/8PDJXGph
+nalLlKlHkmtCtV14mYZ9rLpVlF1AATa0EOUT19jVP7dEXtxKIC6tEObxxCUKH1HmfeLnifiH
+FBIhCxj+R9MPR/o7qosycqI8sz10a11lR/2k0i7u0Tj2M0aDf9RXdjZKrtVDLN1JKjPYvK06
+5/G9u5C3YhYgDWVAB2isvDCMl9/70LFqL/cHpcVTCUkzoRFP/AImvDzuenr1GJmXWzg8GR4n
+kWeNrCw8pQ0iAh6riYOD49atW+7u7g0NDcB2Nzc3A9hIpQiKKgaBR1JqhalDMmzdUjIajOzz
+VfTSwXP9ObMikDRNi1X1M/WscyMTa1czteuCh7FNkrZJVE3d0ykcldUdGJ9SNYM0gBwAP86b
+lQDaAa1gfHC9vYPMzPHIyq1Oy6p7tvBkICu/2dGj6JxJloZxAahQzShP3yYnPK62tqH7BSaX
+hsfikikeD2r5BeemZdenZTc1Nncju9O+iQLmCQoWQT0fcmZuCTpIb3RANuhZGI47Sh/cEgr7
+Cce4oB4mgBI1YABTCx9fLZQoyH9aLwqqjb45cIS+2tXeAo/2cHOrOT2YuUZgpumnQKx9IdD+
+blARaKqqd0ItTc/DlcNBUMEL+uuCgntA78IDQ9QRXMFHwPBDZPhxU39wcM1QPW9W9LCXQh3g
+RXdfT0td05Bbfb9Fzc3e249mHnS0NY+Ojg4MjgtzxGxiidvxr6BN7yVu+iA8NaKb3G83Wwuj
+WW/j3u8I/fdg8Bcjmd/lx8vOzz3KqomzTjgZ3CRhknJUN4Y7pE3BKZPfI8F44j5lhI6wQiBv
+d09ucYlAbOi6gg1OMcKEO4cVesRVG7qmqltHGLunOgSkm7sGxuZnXr8HwecSkRwRfZFEntqJ
+XyAQnhApO7WQsWSFQBnEIVL2iZt6Mjc81N9Ukl4ag0m2k0uyEC1Dy13zlFgKF8PHn34SxTvg
+eaQMJVzu7zRa3TLz+DGBEnsd6Mm1a3EqamgOjvZA/4746L7YqDEfv5u2TrcsbUaszEdNzcZ0
+jUtlVLuCI0mLSwQC/hmtkChzSxHwYDzUEhUVNTQ0BDCjpaVlaWmpuLjY29u7q6sLUEdHR8eu
+XbsAeCSklOtbJ9CY+5yCeoULEar6qeoG6WgvXEVN95+cXHrJIv6cQTiu/A8TPnv7B9V1Is8Z
+pWoaZWB8Sytru5hf1ZKRXZWUVkNzMC65wtA61calKL+kra9v8MUmlwK1d/R0dvXSrNgNCCti
+xsWBgAciRIjeiHEWsp+tsx3cYOdz7/abVNVm1lfUFudkpZfiSjPSi06whv3GkrDtM89NH8b8
+9E6yj00HfnllGf8Ql2bYn/HNePI39a6fXC/6sDR2050bQ4/n7odn26LTBIIalS9EHjfN4Q5s
+k7SOlQzN8pyZf0TxM5DHNijb1ZHx48ad+zFpBWbOQbZeSd7xVfbBxWq2UQYeyaiwLEMXf0xo
+VH1H78IiJbw7cYmAnycQlmYJxMeU2R+UMZI5EiARytgHZSrJ03Cgj+fmezsaq1IDSgLMSp0U
+mlDCA1iee37cs2GnHoTLdLgqljhpVyf6373aS0aHpcUyjJfttgMZ5pZTw1c6i0sqXVxGnbBj
+2sbXzuv1XLzQIiPXeko8i+1QIr/QFOQWpoAHZW4HMsdjVfAwMjKqpghgxsjICHjh5+dXUVGR
+np4OLOmBAwcAeBQVN/iF5g8O0voTLBySIIPLjLlcFzxCowqDwguaW/9gzds7e40sE5mwxQzA
+o6qmFVfeQnMw8XJ5XuHzbVtPYi6AGOgH/9DCjs4+BDwQIUL0drAH+NnU0rSwuDCbNXHff/jR
+xOPm9lpvT7f42LiK8mZJrtRfWKK3fY7ZvCH8e5ZMC42m+dn7JNJ8R1VNXTDno6J/1fu915f6
+WUf6f/vaCygsMegWY+hZrObaIK4QudWuVCy4+YJFlFBOTcISZYM68qayK4uExUXiCpl5FpZW
+qhs7HNzCzLAx2JgKp7haNaeYS57JmIhyO+9MK3RESgbu1gQ0pZm8KcsKIBDykA2BSCLgyR4P
+st8CT6BgycrcCmEZ2ogGgMEsMBnXrgw0FDZlhZaGoIpdLpWhVBoxUn3eon1e/DhrgRSMzmhP
+5XBhAXo/b5iI0lhZfU37QHZOcQnK+aqVw4iCVofA2TzuY0nbWVO+3pzw7++8vvq2yMJsaQYi
+KMjZ8bqAx2u7nPbq1auzs7Pgep2dnVtaWtrb28PDw/v7+3ft2hUcHMwwcmlaVrWZfTLz5vLF
+Aoi1tHYbWCZ2d/W+AHgwVHxKRU5+w6sBj6GAsAL6yS0IeCBChOgNFYFAAOABLPjD1Ot3/YaA
+2V5amSspzu/s6JiYfCzHn/UjS+L2z923fBzyA0vuefGyR/dvk0hLk+MPccGyDwrf74nbUBP0
+35sFn9XhrCEb3NDahgrVDWgSti49qBp2zLtaO7BGxD5KvKaznMI6BNLKEhFQCHlbtiVoxujw
+2M3g2Ex9p0DbkEzbqBJlu+iLtknOAZWYIJypUxTWP6m+Y2AJDwXtmietPCERlikrbqEwGkTy
++hTC0gp5VOZpwlNt97ayvPRw6uG1wdGemprG9PCqSNPqQOUKV7Vk24vpzqah4uJoTp4r2UW3
+r08FZ9VHZlfWxsR2mDvWnzqb+NMmn+82hnyxOe0/P5Z++UPyf76M2Ml2NS2LvP6Wct6E548g
+Bu7ePDw8k5OT/xDwSE1NxePxT548yczM9PHx6erq6u7uHh0dFRERAbQwPj7OEDzMHVL+GvDo
+Ws+aMw8eCSkV2XmvxOMxNDRUhGvqQ4ZaECFC9Hroz8TxgNwd4Kbd2UWe2XI/dWzSq5/0hAwe
+bW2NV0dHb03clxa4/D1L7q5Pg1g/Cf6JpfAsd+rt6zfJnoqFxepMq+G4z+8UfIfz+vRW9ke1
+GQKzi2SKWF4gpucmOSWcCO0UMLp8WitUOLpd2rP4GCpedWC8m+K6IK9zIayAf3N44ixkux8+
+epxbVm7jFWQTnO0UXaeHSlI3CzP1zHWKqLLwTjfHhqdkl9y9e59SfIm4soJfXsGv4Cmh36FA
+XkQibShRBliwvLQ4ff/OjetXbg333a6vildXN9u2vdDRDj8zPXTvkc/l6rCMiuGurmb3kGIh
+qYAvPwn49ofEb9mKvv2l6tvvKr798fKXvxTLnH8ydoNIGdd5GqXsNdDrCR7Ozs4DAwM3btyY
+nZ3t7OwEHAKOAGu4srLi5+cHDcFc+dP6MyHTX2yo5WWJ9Dx7tbyAkFUtiBAhej3BAzx15ubn
+riyvPM68dc//CmmGtLg809BYfWVocOLOA7nTqd+x5O78VwgAj80sxXw7I/u7RqCyo11ZdUG/
+3C/7b0Pwpz0Rnzenbr95cxSq+cGj+4GpJi7ZIkFNarrRXJap7FFd0qh0Eb8Uuzv371DcHotE
+4hPyEMkKgfRswgQgiY7hEWvvOFRIkU9clbVPppp1xDmn/2PvPACbqPcHHudDfK73ngtRcYAs
+feoT11+f8sSBOFEEZO9N2bultIVSuujee680TZNmp2lGm902aZs23XvvkX33/91dG0NboIgo
+4n35Ga+Xu9+Npvf95DsTHMOYLsHkE+eDvANjlYVlZtRHg1QZs2CwAf06/d+uKj383ieH/vN+
+BYUMQyPNw72CInWBvHB4cLiaKmKs353871din5iZ+fQCysyZ2S89z37zHdLr/41ftrpZroLR
+cFYcPK4NHm5uboAKmEwm0FxarVYgELS2toI1AwMDABWEQuFvol5x8MDreOCCCy5/LvBQqVTE
+rEwBO6/KS9LlXwm+yRtMOgAemrLSjq7+jd+nzyBkzHsgaMEDQS8RmItmBAk5Kmz3vo56buT3
+dZR7KpIfzL30WGnav2R5UUhlDPRdTZ3aNWq/H3uNj2jZ9sh55+hfhso2nIn5Mp7qNzA8iBYT
+HbKYzEiRDhNWAHTUcSFRaY86hZx2j/WOYzuH5Wx3jl1/JuyED+liGN3BM+GUS2BqNrujD8wA
+j6l9zO9huq7bAyvTil014mBi5LltO5rq5FMlkvb2NBWX5VWo6J11sv6erv7Kdu6Zi5QvPk15
+/FnKrPk5b80nfvph4ufLUr5fowiOM/QMYHVFkPxeC3Q7fAxuW4sHOKX09PT8/HyxWNzZ2alW
+q729vZFSGNnZRUVFgENw8MDBA3+M44LLXwc8MPbg8/n1DfXlypLCs0zVUW57RYfOOCxXFFSU
+a9o6ejcsT3mGkDJ3WvD8aYGzCcxXHw6hpCgwFa/XmYRUb3n8g13M6Vz3x2pTH2ImrOzpakdR
+AAnI4MvynCPXBYt/cmD/b1P4W5d434RKl56NXsoQkUxmNEIC6XiCxIdCyKLJZDEivVPMFlmx
+9kJA3EFnf5cw0sW43COXSetOhe88l+AcynYKIh06H3QpNFlZUWsaA4qx6mLQdS8WGov90JRr
+N6/ddXKXPTGSolaUV9eo4yJOpfmuYUbv41Bj+5rayzKpmWtXMl5/j/PxstQfPovY8nPc/oN5
+l4MGapEk32E0swayWHDwuAZ4YLXCAHgIBIL4+Pje3t6IiAiwpry8/MKFC8nJyYAZcPDAwQN/
+jOOCy18KPMBzlclkAo1gMVu6k2vUR7g8Ip8npJOz0jlsDovDX/5p8POEpLl/C5k/LWgOgT77
+3ojIy/loPiyi5itKFezAN7o598giHq6Pf5QbOatUyYAR64MBoQGdIZ0aey5hZUDxisOkD3dG
+vxZU9Ikvf4lT1BZ5mRpFBhMEDWPAgDbNNUJjfpfGju4YEv3ohaDTl5MvRueeC8/d6hC/6XTM
+Cf9sl2jGUc+EE+7hREZe92iDOaQ0KtpN5Re0uLYUlZQt+eyHhQv/t3nrGX5BSW1tcVLw7hSX
+t1OdFyUE7q4uV1TKxNF7NlO//ilrk12Ky+ms6KCc+Hh2GrGrFSErHXKN0KixBgeP64GHSCTy
+8fGprq4Gn7fS0lK5XA40TlFREe5qwcEDBw9ccPmrgUdzczODwRgaGgLLvWl1HT4VvY39EjnP
+x/tSXGysXKnatjplJiFq7t9CFzwQNO+unBcJCU6H6AY0iBQo+N7uIUHM4Uri3XU5D2pCHytL
+fTA3/cjQYB9a1hypv9HZ0eObcP4CbZlv4bJdcf+2S/pPuGqlK+U7t9hTtW3NKG8MjlkqsChR
+k9VpojOZ8+Ql53xiDl+Icg1nukULjniQ1p0K230x2TmS6RiUceR8gF9EcmlFrdmCRX0gMkX2
+GBgeSclibN53dtXWk/RcWWNdUWbIVqLzgizn2Ule3/PZCYI8VqSrfc5JJ0kijc1hM/PY2ZTs
+bAq1ua0NHq1YakFqiUC4xeP64FFQUAAWXF1dOzuRGoYUCmXmzJmAeBsaGnDwwMEDf4zjgstf
+CjxUKlV+fr7JhBQU7U6tafPRwHp4RD+Yy2UoFYoRveXYHtoMQujc+8MBeMy/O+cFAmnjt/E9
+3V2Y8jWY4FIOWRI1o1swTR78WDftQWbIO01VQjTpA6lTCgiivLrcKW6tB2+Jd8GPW4I/PE1e
+GqZa5ZCyLDz7Uu9gO+pxgcaKcY2yB4T0ox8tDlrb0hmVzjziHHLGM9kzlnsujL3JIW7T6QiH
+wOxLkbQzntH2bmHUXHnv4Gj1sKkbPXQWqKS2NT6bx+AWlClYSZ4ro47OjDn6j5RLn4lZiXyh
+kELOUHMEEr6aJVEKi4u4+aJMOq2+tQWGb7smcX8K8AgMDOzt7a2srASccP78eQ8Pj/b2dhw8
+cPDAH+O44PLXAQ+goAUCgVKphNE4ydE6HsOwwTwklghK1SUGM2x/iPUsIfSVe8MWTg+efzf1
+BQLt0ze81cVFaMdZJJCjvbJWGPh5G40giPz7UM4j0sjHZQwvk8msRwCiH7YYLBYoV045HvWV
+r3itE+PnDcFvXuB/EVq4wj56WVZuFGAeVI1b80MgCK2oajYbjAYDVlh12GDOE6tcvCKPXwi/
+EMa+EC09cDFzw/FQO9dEtyimS3D2ofPRQTFZNdU1SC9bNHD0euyBlRBBNq5q7RCI8ot5GfHn
+fww+9FzY4cfTPb4uE7FkMi2FJyhUqYoKq4rUFYUlZQwej8JhdvSgKb1IMg4OHlMCj8zMTKw7
+rYuLS2FhIThJjUZTXFyMMQMOHjh44I9xXHD564CHTqfLyMggEokDA0jr5P7Mxg4fDZJOaxgW
+iXglKrUFgl1Ocp4jhMy+N/LV6aHz7ia/SGC+Pcs1i5iFeDbQMAf9oF6Z4qJJuFeS8mBLymNN
+mY/kRK1u72pHOs1beiBzC1DSI3p9AivyePw3wYU/HyW/uyVqga9kuT9vpWP4Wqmah54LIAyg
+yyELlh5rMZiNIyaD3mjQW8yjQRQ19S3hCaTDTuEnvLI8Y0Rn/ZlbT8dss4+xD6Q7R+aeuBR9
+0dMvTyAaHtFfYfeYQCDQ6IsOgkcAeVQ3txTKZbVyRqrHz6En5kTZv5TuvapWJq4o7WLkK4uq
+yxprW2tKK/M4PAaLXdtYj7SoBSdrxM73hv0sf0HwCAsLo1AoERERgYGBly5dAuwBFgYHB80A
+Lg2G4ZsW8DEG+Dp8awScpF6vv0WTw2iQ1a0To9F4gxf7IQYeIyNl494Cv7W0tDQcPHDBBZdf
+AR5YfxZMKbe2toJvo0Ap8AX87q6uwezmbr9KeAgGD1qxgF+iLgXbeDgzn7079MW7U+f/LXLe
+PakvEaiLnvUIC4w1W/SIaQLto6JRslnh86qID8n8H9HRnqCHzc5XphkhoKIBmQxYIMQJ0t7T
+E5By7gLpv0FFS3Ynvron/v1g5WY35ncXY7bXNVQh5UXhQQOMJLtAiNViAGnAYsGCTiGrUUGn
+N3BFckevkOPnwy6FcC9FSvefJ687Eb3HM905nnfCL+PwhdCYNFoLEv8JLtNotpiQxBMIDT4d
+YxHMnQMhWSkIotQ0tIkE+aUF1GS/jWGO86Oc56X5rW8tlbbWd4lkRfXdNeDrOZcuEotkvX19
+o0iDJbP8quiOvyB4YAL4FhBCaWlpfX09WOjt7aXT6W1tbY03LWCSoaGhxlsjgDo6Ojpu0eTg
+RjXeSunv77/Bi30PA4/W1oJxb4HPbWxsLA4euOCCy68AD0AdWAQmWC4pKcnLywNaoFhVxKXm
+qN15HZ4a2AibTHqJQFBchNTrCL7Mfe6+8BfvIs+7P3r+/cmzCZR3n/P3uRTRO4DEWKIBpHB7
+Zz0t5uemzEeZl/7WQ3yykPivjMxdw8NoSVIEI8xojTC4uqH8QsyGS/TPfOXfbI7497HMpSGq
+DeczVoQmufYMNlhggwHJrUVrqkMjmB9kUqmqqw2Lzzx2LtLei+oRKz8ZwNxwNnydU/SJiDzn
+KO6hC6FuvuH1Dc2oP8SMGEwsEFZwA7KJIzEjiSkIEXX2DItE8hxiQqzv/ojzn4Wcez8tZOdA
+o2qkZ7BUo9U2qDIyM5i0/MbGdr1eZ711v1puEXiAL6TgGU6j0W5b8HBxcUlJSQEfOYC7gDrI
+ZLKrqyue1YK7WnDwwAWXv4jFAyOQ/Px8qVQK1gD1XFteUXSJo7Jj1Srrewd6iqQSTVn50PCg
+27m0F++PePku6vxpUQvuT5xDoL0zM/iSU2hVTQliNjAhyR0mk0HODKxJf0Lgf1955KMtnH9m
+hX3SrNXAWPAGwhJGCCl9YRYo80+F77wsXHkh77PN4W84M38IEW87F706jRtqsGD9VSxI8IgF
+uqL0+Ziuh8bMHwPDekae0tEz/tD56AsRdNdo5q7zsetPhx+5TLwQRT/tFXc5LKm9uw9zqiDF
+UaHR4BH4lyXE1QLIpKtvpFhdyaQyqMlRpLAL0e674gMPlyv4LXUdMrmKTE/PyszMz1VIChTq
+ElV3d/dNssdfqjut02Ti7Ozs5uaWkZGRnp6OgwcOHjh44ILLn07s7OxutOMYpjcHBgY4HI5W
+q4VhrOkZ3JfdUH44j58lYfLpmUmJZDJFJBPZHwuf/0j0SwTagumR8/8WO4fA+s8T4e7nYpUK
+EdogBR6B9WDnpooideJLpUn3sb3v62U/qgh7RUYJQ9NakJRT2GyEoF6AH0YTnM7NOR61LkD2
+46nsRdsjF/nkr/cVrTkVvk5UjAV7mFDwuOrJm80Wg3G0clhFTWNIUuYhlwB770SfeO4ZP9Km
+M6E7XOIdI9gnvJI8Q5JVmprR7vUWK8iMGTxQV4vJbGxoa8+XFbFYAi6dJ6RyeaT07NQgUmoC
+KYOeEE9MzUjkMhm51DwWjSMUCZuamrAMIBw8fjV4YAI0Tn19Pd6rBQcPHDxwweWOF6vFo6Wl
+hclkglcMPCDY0kuq7/aq6G8dVKglwZcvR0TE1DfXJ8XkvfpExPME6oLpYQsfiH6ZwHnt0Rhv
+50xhLtukG7TA5n5ID1S4cXBIkbSklT2N4nt3a9qjPUlPcSLWd/V3IoiAZMdaYIsBRjAE7hsa
+CckKdkz7OlDx+eGUd/cmfeBbvMKVuto1yq62QYVCAnSNXBGASCaDGQADhLp5+oeGWUKps2f0
+6QuRnhFUl3D6NqeEn8/EnQ5mHr8YY38xjMbJHxhGXCrW6uYQhJYKAZeMBLtYeof7y6orCxRK
+gUAq5Mryc0XCXDqTRs8isUgkJptFL8jLk/LEComiQqvFonBvRnDwwGTmzJnZ2dng44eDxxRF
+q1W1tHiB1zsJPMCc3t7e+GMZF1zuePDAvrBrNBo2mz00NISiCFLBvIdU1+lRhhTgMOuEHE5B
+vhRsxqYpX3sq9DkCbeGDIfOmhbxI4M5/MNHXhSnk5HU1N5jhwX7YqEdnlmTYtedN58feo/J5
+yEh5LC/8jeIiDpL4YUFriZnRlFmsKmlng0fyXrecrwMkq7bFvHaI+nZo0drzKd+Hp5/p6W8z
+WyCjxQRdDT1GvSUAPIYs0BA2YVVdW3R8zgmnAEfflPPR3IM+OVucEi+EM84HEo87BwTHZtY0
+dWC7IvVBzCYI6W+LmGvAPwOkHzD0tQ+0NbY3VtbUlJZpSktKSksq1CXVanUl0ly1qrq1rqm7
+s2tEp4Nt/D44eNwkeLi6ujY1NU2qAaurRRB0H6YEpzBeBxpsyhvf6MgF38tv2eTwLZsZG2d/
+3Y6/G3jgggsufx0B3/UlqIzRCGJjAODRcakU7keCSwslYlVRCXgrly1f9HzYswTmgr8Hzp8e
+OIcgevm+ZE8HTgFPWq4uhuCBEchsMqHN5nhx5VmPVFD/JnT622DWQ0XJT9HS7Q2mbqSLigke
+DdtA2ANQiK6oin8uatdl9lo3/tJ14S86534UJl3hErcikxNjsphNFv212r4iRzMh+bDQMATr
+MRAYGBzJFSnO+0Yfd4s6H8E47JW+xT78tG+mawj5xMUIZ584vqzUYMbaw4EzNiJBp+gZmZFU
+Gp0ZHjZA/SPm3kFd/8DgMJitf0A30D8yPKQz6Y1IMzubOBMcPH4r8LjGt3sYvguC7gXfwa87
+dLq1JlP2VLacOMAhwIGusYHZrNDrd059QqPxGZPp8SluDCPptFOd2WB4ESCBXj/vRk4m9Ibu
+htn8MA4euOCCy62weIBXg8FAIpHi4+NbWlrMZqw9yi/gYTTqpEJBoaIYbCkVl/x3XvRMAnvh
+3/0XTvefSxDPuYe8d01cbFg8l8O2wAakzAai0c0NlUpR1As9vEcK3B+oinywmf54dvji5kYZ
+lkkDYYdGAMcAHrdA+TML6PYR64Ly19pTPtoW8cJl8dc+eevORG1uaK8yW4zXugQYa2VrtqDZ
+skiHFhRSwP/rmttiUyknz/s7BxEPehHXngzbcz72YkTOWd/Uo+eDk8jczr4hbBKzxZoQC6He
+ICMWbop5cGxu1xXL0E0XSMfBYyrgAQSC7gF68Fa7WsAhwIF+Q1dLV9fe/v7lt8LV0trqCpCg
+sTHuTnK14IILLn8d8GhoaGAwGFgBST6frynX6PX6vqyGDvcyqB82GEekAn6hoghsWaqqXroo
+aQaBteBBXzBeIUhmEbI3fRullMpZXFZ7fx+ijw0jJrNhcKg/L2p1Y8oD9RkPcdwfbqH8XZXy
+Ty7pwpBxxALrLRDaggVsbIIgA5JIY7LoxGU8jxQ7T+aPTtSlO2PfO8f93lOwMobhpDfoYSsW
+YM1rRxU+EqkxVmcM3cCMpcgCAEGa24J5jUZjY2NzbAb9lG/aySDaER/KTueE/a7xZy6nOXjH
+X/CNTaGwtPVNRjMCSxBW4MMyNrAaJ2jSD2qZMWGsZEYKu1qsSTFXjisWryve3t6zZs3Cajj8
+hlJQUACmvRUlnnDwuLPBQ5BfHJ8qSiWJpXI1Dh644ILLVORXVC4FylWhUABVNfrd32xWFik5
+1JwSj7wOjxJ4GAYUIRMKiguRUM/62pafPk1/ipA9/8GghdN95iHgwVzzaWRbc6swn68uKUU1
+r8WCVuAokVEFIa/00p4sCJyhjLxrKOcuZuCHheX5yDa2URtA5ZuMEBprWtOidYk56Ere6M5d
+vzVy0TnWR+6U5bSCFAum/k1oFTIzmmA7CgPm67IVdlFypdI3KOLoxdizQSyHAOaOs7E7HKLs
+A7LOBKcf8AiLSqe2dXShYGMyIYk5BqzDPXRFC5axemNIPCpKKRPGKBRB1orvf8zH4PYvIIaD
+x+0GHnJlySV/9rp9xPX7MzfYZW0+QEwm2RmM9/+e4FFYWGh9EOGCCy53MHgMDQ3xeLySkhKr
+AQRo+XptVaErp+QAp1pe29PXVSyVqIpKB4cG8vJE338c9wwhe860wAXT/RYQ8mcR6N+8G1Bf
+3VhaquIL+GOWCMRa0NfbxI7+rjH1yeqMp+ju9w5lPSqLeS6LdgF1xVxhIQA8YUH8KYiGl5Tl
+O4Tv9mT/6MT8cHvoW76cTc6xq1VVCK5YgM43YvEhWONa81RUu9Un0tnVnUTlnvSKPuOd6BJC
+OeKWuvVU+CGP1LMhOcddo7yCE4o11SYkyQcyg38wNLrveIy5Zk+WK40fOHjcJHhoNBoevyA8
+imQ03mcw3ELwEAqloZHEwaFHLJZ7fxPwUCqLGSxBVfXmvr7vfxPwKC5WJ6XknLAPWr/t0p4j
+4ckZWwASCEVeKlXJzYMHiSrde4q06UD22j1pa3angLFub8bGA2RnL6eq2pfxdFpccMHltwUP
+8DhisVjgcQ2PFjId9S6M0NurjovYaXwqm5yVkkwkZvPyOaSsrJVfxM0gpM++P3jh9MD5d+W9
+SGAsWehXUdLQ0trEYDAMBgNsk6Ur5fjJw2Z1cR5he/+9PurJJspDqbFfNbU02yplaNS9geSv
+wLABLDEljDNR3/oKlp5M/cKZvMo1+yuflAMtXbWo0QMzchiRMWWPBhq4gogBMivKK3yiEk5f
+Cj3vT3L0oew8HbPPMdUpgH7KPeGUW2ROnmwQbe+COl3MKOFgHWOuwIprmFdsieMP4o47BzxI
+FM7G7S5v/t+uzq6H2jv+yWLzbwV4+AYkLf3uyJsf7tNUPDM49ACRxLpJ8JBIFAHBKd+vdkjL
+XNLe/tVNgodYrDjhEPi/ZUfe/eTkstX+q3Ykrtubfsn/JACPg6ePrdvu5eGTlMvL/3XgUVhU
+6h3CXbsnfcN+EoYcNiMVsMe2w7ExydSyMg0OHrjggstvBR5geyyRFmMAAB4mMxJ/0ZPV0Oul
+HWrXKYol/h6XgkPCq+uqensHjuygPUmIeeX+iFenhyy4m/0igf7eLB9lQfVA/2i7DdimIWxT
+g4Ye8kkTdXpp9FNiz4d6Wffyo+cVCqlXWiQgFAzQuAo0jlRvMmVwYuwjvwkQ/Hgo4b/BijUO
+scuSmf7DZiPaNA5G630Zfulhex2LB2QyIZYMk9lgsSCtuHqHBnO4IhevmDNuiU4+1EPnUref
+iT3mmXXmcubR8xHRaYymtu5RcIBMY63qfrF3mK2xJFcfWFEzyx/0Mfizg0dhYbHzhfD/+2Tv
+q+/s+PBLp2/Xh/qF773kt+vLFS6rN7n6BaWq1eqbBw8mW7h936XX39/++vt7l3zv/uPmaP+I
+/dFJK79ccX7F+gupGfQbBY/y8vJ0ImPvIa//W3Lw/z4/+/WaoJPnHc+5bT52JiSNyCwpKf0V
+4HHCIejz704s/tr1h02Ra/ekrd9PHDNKpK7Zk/rzrqRVO+JWbA77fo3b0TOhqRnMMo1miuBR
+rCrNpkkP2JNtDR0Tx7p9GRvtss5czMkTFOLggQsuuNw8eAB1rFKppFIptoxoZ0RHIy6M3qyG
+TnckxsNsNgg5bKlEjpgOTJDjEfoMQtic+2JeezBy/j05LxJobzzpy2eW6w26vLy8srIy2KY8
+iN5somW6FMc915X5LN1jWiP5nvr4J7jJp4aNVzSN/aV7rAkN/4ChvoGhCKKnc8rnJ9L+72zO
+5yGidY6R64UqoRHCXCcjkMWAQIF5Spc51hMOXJnBuk95VWN4EtXBPcrBI/6YR/p2x0S780kO
+PhnHz4f6hiaVlVeP7ov0gEO8L1hpdTMa3mFGDC7gNgFOAsxkQS0jyEA2RJJ2kIBZHDxuFDyS
+0mmZWax1W5xff2/Hmx8e/HS514qtsev3ZYABvpIDJbh6Z8JPWyO/Wun27arzJxxCBQLJjYKH
+urRy/xHvwPD0L789+uq7O95dcnrZ6oBVOxOBQl+3Nx3Tvz/vTFi5LerrlRcPHAugMfKuCx55
+fLFQJPULSv5xjcPr7+/75DuEYcBs4LQBHoBzXrk16uvVHtv2+QaFEQvE8hsCj3XbvJZvCNty
+OGfTQfLGA+Ak09bsSvl5V7LVKAHwA9wchEC2x/6wITCDxJ0KeOSLVceccsAZTmbomDD2IKaP
+rQczeIIiHDxwwQWXXwEev2h5NMCDRqPx+Xxb44MF1bI95Pr2iyq4DzYa9UqxuLhQjW3j7cJ+
+7t6Al++JX/hA9Ny7iS8RaK//I4SSruof6M3ISOfxeDZ+B+QoRWWFHP9PBklPcSOmKaIeGEp9
+jBn2v4o6JYwWPEe1tI1HwoS4Q2DTCFhq7mj2STzpQl62PeJN77wVntQNF6IOV7dVoiygt5iM
+QOtDN6rasdiQsb0G9YY8qcIjJPKIW8Rx78z9LnH7HMMcPOKOOHifcfQSiOQjeiN6njDSksUC
+YSeLmHPQVnfoqwn6JdAUMcdACLghmb0wVkQeB48pg8f+I0EL39754ZdO362PAPpu04Gs9fvS
+gZ611YDI667kn3cmLl/v/+3PF28UPOKSaO/878Rr7+5eglBNPJh/08EsAAk2qtx6lKQfNgYt
+W3H+uuARHkNd9N9973/m8M3aMDDPpoMkFDmumA2s/xmdcMUG98BQ4tTBIyqOGRLFtr9IA6cK
+8GPL4Wx0/nRszjGjBHHTQSo46MnzOaKCwqmAx+Ug2urdpJ93p1+fOn4xfRC3HspkcZU4eOCC
+Cy43Ax7gEZ2QkBAZGSmVStvb20eVM9pTZRQ8kHRanUwoVKJ1PICE++W+ON33BULCwr/FLrg3
+bTaBuvChKI9zWfkiQXJyEoVCwcI8RmcC8+hNrPBj9QlPlVEfo3tMG8p4QhL9nIgfMGZjGQMP
+LDwCNSJAJh0MI84ObW31xdSNpzKW7o5+NzB/k1PiqmjqhSF9O7KrCTKbLDfWjB5CqcM4FrUx
+Vou9sa01ico+5RF1/FLkiYtRhx2DV2899f3Pe4/Ye6RmcTq6kO5yFow3ENBAKORKp4plfOiH
+0WxBo0qua48BT2/wsL3R9jp3Knh4+GVt3hP48864DXakzYeomw5mbzxI2rA/Y80eVMn+QiCp
+6/ZmrN+fufUw9UbBo6BAtn5X5M6DYev3JG6wI246QAFHAap8g13GWsRzkWzV5mv3pG20Q9wQ
+1wWPLGqBq2fq7qPJu09kbz5EwU57ox0Rm9DmnNOB7t58kHLEPmnq4OEfRqGzxGCBnVvoHczd
+djgD3JktRyibD5E3HsjcdJCM/Hgw3TOQw+Aopx7jUSApOeWStXJr1A9bEhCzydTYY/0+4kGH
+nMg4Lg4euOCCyw2Bh600NzczGIyysjIej5eZmVlQUNDb24sp6auBR1K0aO5jfrMISa9NS351
+WjIAj9n3R57an1hTU11XV2MN88DAA1PSaj45P+SlZvqjTI8HqpOfrMl8mJW6rW9gBKWgK8AD
+6HaDGa3mZdYj2ALDcTSvi5QN++IXH0//MES0yj78S444FQu2MJtGLJD+hi0eKDWg9guDyaI3
+YyEjZrOsRBMUm+boHrbvpPe7n659a/GqrYfdTrqGBEWmVtY0oKcKoAjpvguZTK0lajWVWkKn
+q2k5qpwcNY2uptOLaDlFzNy+pk7E0oGevOV6XHSLCoj9ScEjncTffTg8NIrJylXau+Zs3A9U
+f9a2Y/QtR7IRL8O+NJQH0jceyN5gl7VhX/o5D+aviPGwd0ndfSQ8NUPAFxY7e9E32aUDfbrt
+KDgKZdOBzPX70gEwrEeySklbDhHd/NjXBY98cZGnHzGdJFAUlsYmC484ZiPGgaO0rUeyATWt
+RVwhaRsPAE4g7z5O8gvnAaU/dfDwC6XkMMTWH6VydVQif+vBFHAHAHUcd6FFJwnFUtWNZrU0
+NbX29w8LCzQHTqV+uz5q9c6pgcd+4tKfLn/2nQMGHtr6zvnLPbGx4mi89dcNlsGahJxC64/W
+dy9G5oK3cPDABZe/LHgAjV9SUiIUChHNq9eXl5ezWCwqlVpTU4MYQ6iN7W6IqwUBD5GoUKnC
+9qJkKF5/OngWIXnh3+Ln3x83m0B76d4Yr3Mc8NbwyDCbzdZoNGN2FazDGzzQ3cqM+Lw+bbo6
+9lFe8CMdOQ8wwj4qRaNBLBBa0WMsXcQM6wxwH0APWAfOCemdUl6ncojaco66bk/c6xfo7/rT
+l7uF76+qqUQOYRm0wEOwlVpsrA7jk0rG0GZsG6w8KVq5bDSJB1nb3duXm690uBj25coDX685
+duR8lFsY+bRbuMvlaGlROYwZPmC4raws19dPGRFTEpekiohRBEfKAkPFfkH5l/0ozu6syCTj
+wPDoEa9nj8HBwxY8iGTR1v1hMck8TDkWFZUFRPB2HAMwkLHlMHXr0Zztx5kb7Ig7jpJ8Q3Nl
+CvWvCy4945K+42B4amYB9mOppiIygb/nZNb6/RlbjuQAzgFjo12muz9risGlADzOe6aRKAVj
+KcDlVIb8gg8TnOfWw9TtxxibDpDsL9KTifmFRaU3GlwaHJFDZ10RylIgVrpfzszKkZJpsnHJ
+JlMHD21lXV1DT1//yPCwLjSGt2Jz1I/XNH2gMJYBqGPef7Z++JkdBh4KTdP9i04BwMjOKwM4
+AaAC+3WPQ5HF20LAwMEDF1z+4uCB5brqdDqBQFBYWGhdD56r4KGUQ6OWFhe3p1X2eJQD8Bgx
+DueLBEVjFg8hV/v+S5HPEVIXTAuaf1/sHILohXtj3E6zYaTnmlEkEmE9X8aiOS1YGQ05w08a
+/VQT9WGG+zRt5gMFCbNk7FAINulgNI/FjCSpQGazER6wwMNoRVMkiBOC9CazKZUWczZ229nM
+pfsi5vtyVl9M/zmU6Dg40oXktkAj0KghQ49koIw6T5AgT5PV04EGhZqQEiAWm5CQsZQYjFkg
+zAeD/FTf1JFBETi6RZ1yCb0Yku2aINrvm37IPYLDl5qB9A4w7c8HrljZQCZbxMV6al4fLa8t
+m9WWRu6PT28NjCaeOK0WcscOgls8bgA8UjMFm/YEh8XljtOYB08lrN8bv9Eu49BZchpZcpPp
+tMcdU7bsC0lME45bv/tw5LaDyVsPER3dc9i8wqmn04oKihxdk9JJ4yeMiGUdPpvpEchh5ip/
+dTqtXFGsUl2BK5xcWUQc+1eUR7MFj+qahu6egcqqxura1r7+YUVRjd3J1B82xf68axL2wMJu
+v1jh9crrG+e+uemjLw7Zggd4HRw2AJwISkVqfwEOwcwdVsDAwQMXXG4rAX+w1q8Jvxt4WGM8
+BgYGGAwGVsHDVlpamwUstuActd5eam4z6Uw6oVhUrFSjrDKQmsh5+/mAWQTiwum+C6fFvEJQ
+zLo71sGOYkGdC2VlZRwOx2AwoAcBelpvRrV9V30VM/SjKvKj4sAHJNGPlpGe4idsHuzpHE2L
+NUMw4loB4KG7wlCBSm9fXwTJ+1z8ijNJSw5EfeCXu8Y1YSMnP3uUKhDYQMFjLJYTGgMPCwzb
+2FIQ9rg6B6B7jL1vMlk0lU2RCZQjziGHLhPPxnOPBaQfvRiiKamqzCB7fviJ62efSny8TVRO
+b0x6Q2RiVURMXWBYp4d/v7OX4uDR7LNnRlrRKujXC379i4DHxo0bly9ffl3wYHGlFzzTs8ZM
+B1Y5fCaORBFoNFP6dn9d8IiKZ/kGZXFypePWHzgZyxfKr9e+ZBLwUBaWJKVyuHnyCeDBEEuL
+pg4G8NQql3J5stBo5s2CR22jQlWfkSXMovB7+4Y1FQ2NTZ0XPLN/3BS5ckeyjekDMXSs2Brz
+/menX3lj09w3N8/7z5Zx4DHOvgEWjvvQMLsH5m3BwQOXP5G0dg7scCZafYhg+TecXFvfCf4W
+sD8QTACu/7aHmIqAv9xr/BneavBobm6m0+ngKQ2PlfyyjJkERoaGm5IrynbSJclCiUaRJ+JJ
+82XKIgWbl5MSz/j8jZhZhLT5030WTIuZS5A9T0g4so2o1yExpS0tLTk5Oa2tregRTBA0YIKM
+iNI3mPIzLoljXtJmPsK//FgVcSYn7MOqQhlqrTAgVdBNEFqXFBp3qtgptXTXBxPPnov7/kTM
+h+dSv3GM3OzofbquuWXUdIHQh8U0ZuX4xZ1iAx4TI0DH3RR4rAuMtVppd/8IX1rsHRh3/FyA
+fUDG8WBS8MXwgG+Xu3/5P2lMWHFcfJ1/SJunb6W9g9bhTPXpU/WHj7XuO9K64yDv+zWa6DjY
+Wv7jdweP21BWrlz5008//bqS6UfsEyfSyG9eMv3gqfiJNHIzJdMj41gSafFvDh7gJMOiGTcJ
+HmASYYGmtLxJo22pa+ikMaVt7b2FqprwWN6GXTHfb4xdsyd13d40ML5c6fPae3vmvL5+Hkod
+E8ED0AX2oMYe2mABIw1sAQcPXP5Egmlk8HkGC9j4bS0D2J8MGHnyGutfhPWv42oCzuc3P43f
+Hzys3ha1Wp2XlzdaJh0VazotYo1htXWeK6oVVGXxsj183EP8Q3PzuI2tNbWVHWs+S3+WkIiU
+TJ8WNY8gBuCxa3Xi4MAwZkXBwjyg0cqfw2ZIh2W5NJdo6UGfaSkPiDynlUc/Lk14sSA7FAnx
+QEwRBhjSm2GjaQIjoeCBnGFtc3lw+lGn6GXr7N/+eO2Cdce/jaPF6UxGjBqQHrcwYi4xWqlj
+zJEyWlfdfO0K65C1zQqEVuowYaYUCOpt68xlCM9djjvmlXBxs4P9m29nu59qrSwTZ1AKnFxb
+nJxrdu2o2rahetumivUbin5cUfjJUsYrbyd9/q2hue66v4W/Dnhcmz2uDR5HHRIzs0W3Hjzi
+OLny2x885AoVkyO9SfCQyYvjEhkZWcKi0qbK6jaeoLhUU5fDEKZnckkUqU8w66ctMT9tjf3g
+C4e5b2565Y2NGHKAMf+t7Yu/PDbO1YLxBiAQ8PUNC/YAA3ytA8vW749gYXDYAJ6xtmGoOHjg
+cluJbajS1VQ2+CRPaiexNWtMuo0t2Nii+DjwAPuCGWzXgA1uFDzAgX5P8Ji6GAwGoVCIBXjY
+xGMgr0gVChjqptZ3XiyFe6GOga7k9GQ6hWk0Ilq+u2Nw+4/pzxCi500D4BE5/+785wnJG7+N
+6+lB0k7BNvn5+XK5HMuURdwn0LAORoweugEDJ+GsLPmx0qjpRf5/1xAf4SSs7B4tnw6U/IgZ
+1pkn+FnQcupI81qwprpZdiFky6dr31r4+XPfH3vtTMxaoSoHs3kA5BiydbdYfvGgmNEOtqOZ
+r9ctdw6hPe6Q+u1Iwi5SGwypC2ZpbO1ikXlOn6yJ3rGnXMbjSBTZ6Qymq2fJsePatWuKPv9U
+9OF/yf/+T8zc2THPzEh+dIb/ky8q/XwtI/04eEyFPa7bJG7qcjNN4qbQKf7GmsTdkMA30iTu
+JsEDqaWmLuMLC5PSuDxBkaCgRKWuotKFuXnyUk2NtrLp25Xu//ng4Ox/r587ZuhAqGPR9s+/
+OxkYmm4FD/D4wh5xACcwqLC1G1sDP7A8F8wGMu6haitgTm9vb1z94fKHiG1g0kTBjHWYKc8K
+z9ZwJmxH8LdgtfVNCtjYnwxG4BhLjAMP7C8FMxJifyngR6tDE9t9Yr6YQFlrPRzG+dhpWH06
+2I7Y9wKwpS14YCuv8Vf5Wwlm4hgaGmIymfX19ePAA6vvCUHmHmpDp2sJ3AUPW3QSuaSkuBTb
+fWhw5OCmjJmE8PnTAhdOi5xL4D1PSF/5WWx72+iZY8m5iOUE0AISNzGih/V6lAiq5PmM0De0
+6dMLPO8vSbmLnfB8dWHumNrXW+ARywRXC/o/M+KLQW0bhaVC+0uOW06t3On3uiP5PZ+07a1t
+WvCG3gIZLVbbxWRIYUENMNeI9vylEYsZjTU1IRGpYC8j1hUGHiqQXP7oKy03r7yh6XIaI5Gc
+lxefLjx+kvHpZ3Eznov8x9NBj80IfurpmKcfJz/1PPGRF5iLvwXfIXHwmAp74ODx+4PHWOpQ
+SXIaOzGV19k1wBcqKqsa2bnSQlXN8tXuCxftGEcdb3+0j0zJvXUFxHDB5Q+Ua3g9MLqwmhGA
+7k5lFmNUAJat9g3b+A2wfqKZwqrx8+Q1KIHobQ8KmME28dw2L8w6FdjGyvZW4IkmyzEawWwp
+AGzgMb8ntiN2XOzcwLvW0xh3XbcaPIA0NzfHxcVZVZ6txQPJL4Us3dSGDgAe3UCnG/IlojK1
+BjMhmEy6c4ezZ90VPvd+AB4R8wic5wnE5YtjWpo7YDRTRigUJiYmjoyMQFhfEwjwh9EAD0Gw
+ebh3iJNgJ45/RBHykDLmbmHaw1JaoEWPFfk0g82gyaMxUbsFCgJAlCrNpfCzHuTvQhRLziYt
+SWH6mSwG7FhDHW0t5eq2Um1rWXVLpba1sqy1srStUt3f3oxWHL32fbGNDhlryWKBzGZYD1uG
+OmpIOzfEr15l1huKW3u8kukJOQJtYSnf63L8p0t9/jEz8O9PRj39ctJTz2c9/SxjxsvCf87P
+e/Zd/gkXHDymwh44ePxR4IEJj6+QyKtyhRUKZQWXJy1W1y5f7fHqO7vGwGPrgrd3vf3xXiZb
+eEtLpuOCy+0JHuMiQoGm9k/OH+easRoAsQG2nzibrakBbADoxfagmDUD231cXpj1KBixYMyA
+YQZ2Mhj8gLes0SO2V2T1itqeBjbV70MdVikqKgoMDGQwGGq1uqenx5ZJMEXfQ23sdtfAPXBL
+V0tyRjKdwhgaHsIUc6Abb/bfImbfG7DwgbB5dzGfIxC/+b8Yrba6paVJIBCkpqbGxMT09fWZ
+xpJpYaScx5Ae7geqXyNm0UPfKk6YURD8sDRtLjPxcCdat9MIm9EQE2gyIoBQWwwSe4o6PmC+
+POd87Hp/3nJv/o9nEzYU1YjAZsMNrbLEWE7gZV5wBDswihEcwvbzzfXyyL10URAVCY/Zc64P
+HhAWa4qmAY/CDqyik+xem5PjfNpgMdb2D/OLyqVlFXqDrig7K2Xj5vD5b0T869nEp1/IeuoF
++tMvMV5cKFjwnuidpbknnXDwmAp74ODxx4IHFjoSl5zrG8LQaJs0FY3fr/JY+PZOAB7z39q+
+YNHOZSvsWWzRrW4Shwsufyx4XM3VMi7KwhY8bLU5UO6YlwQbE9NVxgVXbHRIHQcetrtPavHA
+NsNCpwB7AHoBwzWSa33LFiRswcP2uNiP1w64uhWCRWJIJEhJBDqdTqVSAYdY8QOjiyFOe/t5
+VVV+dSaX7OnrFRIQyhfyK6pLjaah1AjFgodjXrzLZ8G00Hn3MGYRsha/GhQfn8Rm06VSWXd3
+t0gkam5uNpqHjVA/aslALCUAPIywaaCjnxt7PD/6aYHfzDSXRWGXlmrKEGwwwCbED2Ka1N4B
+G5F3jJAFeUEqkkP9LEm2ffiWi/yf7Sk/xFG9DP39otCY5P272xiUAb60I0fQSmF0p2UOxCYM
+RcUUXHBrKdGMXdkUwGOsIDridIFMsMnULFNS/HxUXFpHa52kUKwultfWaHoH29vKi5hn7dMX
+f5owY1bWjJncl+cL/v0e98P/pX71OeXQrrIc8h8CHmBCMLNthZbbnD1w8PjDwQMTOkuiLK6r
+b+pdvtrz1bd3zV+04613Nrz5/trYtCt69eLggcudJ9r6TkAO2XllN2TxGGdGuPYhxm2z3y3L
+NtD0avaHceCBOXFso0rOBrGsM1zN4jERPKyBH7/bHR4ZGWGxWFiAh16vLysry8nJAfgBVBWG
+HyODQ3UJ6pIdNFlygbyiMFeQKxFJ1aUlZGqWVJ4bcpnyxuPxLxDCFjwQNv9e1guEnPde9k5N
+JnV1dYyZU4q12ioI1pngXsRXgdbUMFp0BmgEMsPlEk6cz8uuux7b/tErTvveUEjiLUgFD7MZ
+KWOOmDTG0ktGX8H/EfCA9Ei8BRL1OQg4BcAHRUw7mrDOgfxzaMpJXoRfyIo15z9aUh4dB4mK
++4j0juSU3oSE/vCI4cDQckdXnre/eXAQwsqYm0ZbrFizbK/GHuCf2TICjejgYQBN5prqhlq1
+JCbgULLPTmLECSYnor+zrCI9nrLqZ/Ki95n/WcT+9EvSNyszNmyJOmHHpcb39bb+IeBxu9Xx
+uC574OBxm4AHUpZEqSZTxT+s8f73e3vfendtzrrn3vtoRXwGEwcPXO54wSIzrdGbrZ0DGIdM
+jPHA1o9DBdt4TiyN69rggZX8tYKHbXMBDIQmxR5rjKj1oJ5xfOv5j4vxwK5lUvCwLliv91eL
+nZ3dVDqOgUcQk8kca8uCCHiilpSUsNlsLpdbUqIu4AvEl9g1x4X6mhGg7KVySVkRElza0dFV
+Wqb2v5zw5ozI5wnx8x8Mn38P5wUC68M5vkWFWtRZg1xyTU19cXHJaFe2seoZgC7MFiRRt6+v
+LShy/fKlj69+e37QiTfzsk7193abkJwUowHJTzFbMIeKxYJ1VcFYxPqfBTJjNUgBxGTLsy5E
+7fd333D+q0UeH31MPX1RHJrYHJvR6uVXc8Gp/IKjxsmx+tTZ2kP27O27m3ORUE8TmEMPIWkw
+JqxgKlZYDLqqGQQcCsmpMYNtSss661X56T7LspznxTm9FRW5o7omryaPkbh5e9JXK7J+WJu2
+93Cyqzc1Mo6UkCiRFPT29/0hfz5/FvCwsgcOHrcPeGCSTszdauez4tMvKnY+hIMHLn81h8vE
+AmJYejiWLWIb3mkLHrZZLZOmiowDAPD9edI+R9juVlsExifWY2FEYX0X7IKZXybOMC7+ZNLT
+sJYavpmbNsU6HhqNBgAGlh5rNv/SmF6v1+fk5Li6uWakpVRHq/q8tHA/+K6vE4r4RdIi6+5c
+tviDOWEzCeFzHwxacA/jRQLzvRe9RMIilC6QQho9PX0yuRK+0reB2DMso+mxUjn5wtGvvHa+
+zAp8jBn1WXMVuGrzCGwcQUufW8Yar5gxA4XZYqUXzGSBVViHkGQWY5EsO3DDV8defSH52KGu
+snJZGkl5yaPV4Wzjnv3aPfuqDhyu3XlQu2or8YPFbLu9hu42pEyHyWgxow1nx1k8JgcPLDnX
+BM5Do+mqLeZn+3/Bcn4u/dzC6NAtPCFRymIlObimHnHI8wqUpGTm07kiNo9BpUsksq7ubhw8
+psIejz32GA4etxV4AHELTP2dwQOv44HL7eN2mdTrMZVQTLDvzWSnAq6Y9ChXqw1yNZ/O73m7
+pgIeFotFKBQqFArbYEuAH+CJzefzGQyGVCYp4Asklzj1ZySWFpMeMkkk+WoFUjK9u7dLXSJN
+Skpf8kbws3f5v/Kgz4L7yC8S6G8/58Fly1BFjVQPNZksYrF04nGtlVH7OjoY4afzAp9rzSXw
+Ip8qz4+DLEakiBjW3gQ9KTDRCBLdAWF1OKwkAGFlNsaMFB25NN+3Pwj65gdZHltcpmQmxfPP
+2TeePNGwZlvFj+uU36woWLyUMveNoCdm+M6bp06Igy0mA2zoh00jowaUa5EH5u/BcmwtkKlQ
+WV2aT0u++FHGgb/H2j0b6bOJy6cK8qSsNIaUkVcslqqk8kKRpFAq4/PzCqSS9jHfEw4e15Y3
+3niD8BvJ3LlzHR0dCbdGwC19/fXXb9HkhYWFhFspO3bsuKHt737kpWX/918AHgvf/OKu6U+O
+ezczMxMHD1xwwWWK4KHX69lstu1m9fX1YE12dnZ+fn57ezvieRkcqk1Qq7dTZWkFBRoFj58r
+4YsLC5WZ5HSxLFet1mz8LnXmXR5zpnsvuJ/0MoH72uMegT4pWA0xTCRimcFwRc/6X0qFIJU5
+IDWHKAieNyQhFKfdLyM7GkZ04yqam9BipEbUxnEleEAwWiEEyEhtTfLPG90XflgWRypsqAtg
+UkgZGXlel4uPnhR+8W3qwjcjZr0U9tSMiH8+Hjdzpu+/nkj76ofBkhIzbO6EDQMwmrxrulZl
+c6znC/auwaDLIjHUfEqs0wfJ++6LO/BknM9mqUIgVpSzuHJ5iVaiLZeVqUvLylRqVQ6DrlAV
+9Q0O/CEfg98KPIJSCxZvC/k9o49wuX0khshf+fmXADw++N8qnqTsdzgiDh644HKnggcW4DEw
+gOjE1tZWoKRIJJJIJGppaTGZTKPaHYaHuO1tjsoaUSVZkON52TPCPyxfwK+sqdDpR8wm+NgO
+2sy7Ls2ednnB/ZmzCcJ/Px7g5hLN4QjE4vyeXsTKpJAru7o6x4EHZmAxowq/v70tL2pjWcrf
+y9Ifp/tv7ahsgnR680iPqX/YNKC3DCNuIPCfEQmxMNu2eUXAA62xYRoc4bt6np3zesbxc/qe
+EUljq2tKRiqZUcaS5J6+mLR4iesTT7j/4x8hjz+e9NTTpOdnZTzzYvTT82VObsZ+QEiWQTTL
+F6nVYe1jO0HMSDH30YMbjCM0OrtayY91/SLpxKMJZ55NDt5eqhaXlNfl5iuLtNUlTbXlzXXF
+FWU0DitXyB8eGbFA0G0CHphTDxtTr74Ltrx/0anftk3AX1wmDTnDwQMHD1xwubPBo7Kyks/n
+A8wQCoUAOcBrW1sbFu8xRgiI+6GX3tx9SQP3wu29HWkZKdwctl6ns27jepI76/5LL93vveBv
+6S8RRK/9IzQ9id/e3pGby6FQMxRKeWFhUUND3VW0OTyIujjqpBSy8ztZZxdGHvqO4u1fEB+f
+HxOVFxIDBi80tqkYedYZTSakuAd0BcFgP5bxJadfe8/l/Y+kBQKAOOUd3SQ2nylSdrcZJRHE
+jJ9W+bzwUui/ZmQ8+Rzlqedpz8wWzF5EfvE94vLNXdpyExLFil6oZTTH5SqnakECWbHgWMgo
+lshLxPw4zzXRTi9HOC9IDd/XWF1YX18vlyubGhu6u9uUpUVkDlNSrBwcGf4DPwYTwQMouxVH
+47HSu7b5Vjh4/J5ibWWCgwcOHrjgMonGMZkNI4aRId21h25IZxwxDvUP3yanPRXw4PF4Xl5e
+TCazqqpqcHDQbEa+7tsGYGAJpQA8Oi8ilUtHTDqRSKBWqGCs8jiq9RPDRfP/5fLC/Y4LHgx5
+icBY8HBAclwejDSUN/X0dmu15dHRMUqlctITwCqBWXQ6SUJi8Ko1mqigASGzk5LdlZbelZDS
+FhvXER5T5R7IP+texRLoh0dMltH28tBoOVHEZwN+bFCVH136w8ZPvhCVKip76/P5xCJOQrmc
+0dRc3a4p5zucJf5vacqMubQZrzD+/S71k68zl/5E2Xm4msI2DgxCFgirhGqtFjapIAktkBEh
+H+SopvKqWnIGOTHUMSZgTcDFFUmhTk3Vpa2tDSqVXKMq5NMY5AwSV8gvKStraWpGfUvXsXh4
+e3uDJ21jY+OtBg8rRVhTt07708G4EMH9fFc4eGtweNQvlsos3uKYDlYecCdvPZduCx7RZPmu
+C5ngrW/sosFKlXY0f4ojqcR2weKrWzr7bQ8BJgTrs3JLx50kWA8Ogc2GpYNNOo9PohAcVFYy
+eoucQtjgxxY0zio7rwzMsPpE4g4XIti+qw/5M/RLEsVTlWD9RodU8CNYD84BbIPNOellhmZI
+wJwcSZX1MsFb68+kgIWJ95YlrsQmB3OCmbHLRE+p33qG2Hqw5U4XonUzcI3/3RIM7id4xdZY
+jwW2Aa/Ww1nvG1gJbk5iTiF2o8CPAmUtDh644HKHCVC+I4O67paeJm1LtbJWI64ok1xtlJdJ
+y6sVNSKiOCuW+icCj+HhYXVJCTUnh8Xm1NXV6fQ667VD1pKdMNxDb+64pAbgMWAcFgr5ankx
+qvoNaCdYWMAt/mCu0/P3H1rwsOvLhOR5D3slRSO6Y2RkuLq6gsViiAukev0VJuWx8hzYD4Oq
+1BSXj74K/PoHyaWTbRlpdcGMJu/wVs+L9RedWs65dDq4lRxw9Fu2OsDRdUhvHOUV1PliQDq3
+jRo9SiqqAsLiSsTKejUvxmtNkstHyeeWEGMPt7XLy1nkuLXryJ9/w1z6XcrWjUm+l+JjQ4ls
+StcQoiCQumAQ1lQOdaVclRCMCCWhjAJZjMWlWg4rP49FyWOlMEnJ2YkpGYnJKenJYQnhMYlx
+NDK47twcGo1FZ8hE+UhnvOuBx+9Zx2MceGC9h8i8UrDGShcJOYXYNgpNE5bDZX1rhzMRLGMN
+o61vYcHbL33tBr7Lg/XgFTOq2B4Cq34zzsxy3IdmPRA24dXmsZ4SPFbhB1vG1mN5bWBysIxl
+pQEFDZbB/NYeTFZrA7Z+KpcJNgYqHlsYd28xdxXmLsFCx7FrsZ0ZOyuwmVecwLoZOHnrltga
+67Gsvx1sGTsf7FaAZXBbJt5bHDxwweUOEJPB1NnYVS7TasXVxZxSGV0hYcildIWMrrQOqXWB
+plAw5SpOkfeRwC2L90Wcj/2zgIdVEfYMD+bLFZnZFI6QW9dUbzAhD1IT0owNDCRftZvd2OAn
+M/VbOo16kVBULlGgKtpktiBblhRrvljk8dxdXvOnRcwmEOf+3SfMn97c3Mhm00mkLIWiyIT5
+bsbiMSALrEdKcUFG1LjQp1IGf7/C/pOvNdmk0pwYaZCn9mJg49FzzfsPNRw6VGlnV7Fvv2aX
+XeqS7wK22OkNJit4jJYUhUZNL2BujbahpLCiRsUj+/1Ac5mbff7NlPBd+VKqnMXyP3TUf/ue
+ZPuzjIRYBpeWTMnIYNPae5EKaRYzYjUZzWixXN3kMVZHDM2ohZpb2+WyIqEgT5DH4efy+Bwe
+i8EkU8kkahaLy8nLE/EF4FYJ5XJ5Q139KGzdxuCBaTFbfwrmjrFqW0xRYm/ZkoZVaYK3wJqn
+PnG21cvWpgDYISbNAhs3G6aXrz2PFR6sDU8xFY81YbduA8DDtlIxODp4F6urY738a18mVgXo
+bBDLCjO2gs0D1ttWGbIeHbst2HWBLV9d4W2bID/OdWU9FtZE3no462zYuYErGvcrw8EDF1zu
+AOnvGiiVlGmkWkVuEcIb2GDKkMFQWIeYoZAwZRKGTMkqLmaW+Z0IXvPfbbuXHQ93i79NLuSq
+4KGzwMMW5FWPDgNqutDD3U09Mr6YnUpWsgW9da3QsBn5ig82G4SHMmua3HnmHlOv0SgWFmjF
+SLasCUI0NvKwbWpctSRsJiF27t3kOQT6Kw8GHDsQzOWylYXi/r5B9JB6tMntWL81CBwcGkHD
+Jcy9/bSTjsdfW0R0v1yrLefRMyke58qcz9Ru29u8elvNqk3yn1YyvviU/M67Ec/PY51whK9Z
+aqO2tkVcXF4oZxDdPycdeyzx6DPRfpu5uVQxm0+KTQZziwX5IqRAvJjF5rDZnO7uHtja9/YG
+xWgwdnd3NzY2VlVXV1RUlJaVlZSUlJaWlpWWaTQarVZbV1fX2tra19en1+unMuHtBh6YVrVa
+J2zfGqf1rG8BNgBfycfp5XHAMCl4jHvrGvNg2hycFVYVx3aDia0NMM8Rtg3WBQkLq7DaWK57
+mbbTTuy2AKACK9FjezMxkrF2QLBu+RHqW7GumQgekzZ3sL05YGMcPHDB5Q4T/bChra5dI9Yq
+uSoZSyljK2VMhYwhl4PBBEMhZyjkTKUCDPAuMuQKlkKao3A/5Ltu8c6tX9jt/upYmNvtbfEo
+N/Qm1Hcl1PUgo74ntqYvvnYQjNhaXVKLPqmjxbNYuCNNvI/UHlA+ENM4Et/Um1zTdZzZ48CE
+OyC90SgR5pfJEPDQIxmxZlQFGw6sy3iWEP7KXdQ5BO6cBwLdnFMHBwfH6nwBwNCZzViPlVGz
+h8GC1uMwQ5oU0slFH4Rs212vKOHmidPSSCQfX5m9o+KntYJ3P6YteCvhpTkRM56JeeLpiH/M
+jPn2B+PQ1et/QlBVZT2vQCHITY9z+jjJ7pEou6fi/TbK5ZxCiZzHYJcVq9XFqqKiYsAHbA6H
+yWIBKvjV4DFqHDOZAFfodLqhoaEBVMCFg2Wwxmg0Wq7TBPf3AI/e3l7AHuNq2E4FPKz+FFvl
+bssk1u/vtj9azRqDwwZbK8c1FCW2+zhHxtXmsXpSbKv8WU0u42a2BQ/s0qxFj62Xf43LxGDg
+uvG3mJXDikbY5OMMKeiF6G03mxQ8Jh4LBw9ccLmDpbO1ixrPIgZnx3mnxHglxXqlgIW0QBI5
+PIcSwaBGMqmRLGzQorlgUKM5OXEcdiLP61jgWoQ6Dm1benD314fDLkXf1uBRMNzpUd3kU9Xq
+U93uXdXiqW33qOjxrOjyLu/21vZ61gxcru/2qG5xKW27oCk/KFTuYDSHKPv9C/SZVfAAPGw0
+5Ofnq+VI5JtuNB4TaWFyZk/WC3cHzSEwZhOErzwYEoH2qYEgo9lktiAFvnQWC4RFhBjQ2AwL
+Yv6A+pUloct+Orv4M21uXntLd2RKTnQKXUjiChwuUj/5IvAfj/s8+s/Axx+PeeKJrMdn0p58
+OfjlhRpy5tVa2kOQpaq6Ll9RLM3PjnX5IvnoM/HHX04P2VaqzgPEweMjcZ4VWm1VVRWPx6PR
+aFqtFmDDddrUXlNuiCv+KPCYKNiXcaDmJlowbLUhpuKtX8Ntgx+A+sZiDLC3bBnmv1uCrUV6
+rdEO11aU2GzWA2E4cbV5rDraVk1r6zuxlZi3BQvYGAcemGsG63Rga6O4xmVaQykm7WoNj/VN
+sDp3rI4ka7ay7ZZng1i2m1knx67X9li2h8PBAxdc7mBprm0BsOF93N/rZKDXKTACwGuKd5bX
+oSDnnR4uu7yuGDu9nHd7Oe/y9DoY7LzNe8sn+3d8cWj7Fwf3fHU0zC3mtr5OpGoGBPfDcA+M
+vA6gy30WU7/ePGCE+0yWHgN4hYcgeMDSV9XBz2Tmcws7q3phNOy016DPKygoViqs2r65uUUh
+UZ7YHTfvIf85BM5sgmz29OBQfwYGHmj4BAIe0Gi6KmLuwPJV9f09qQeP7HlyVpajs2VouKNn
+IJnGS8wWNmu7C4PjKN8s958xw/upx0OffSZt5nOMx5/n/evl9OcX0Pbs13d2XA08Kqoq8+VK
+lZKT4LEq8fSr8WfezA7fV1MlKa2pFCqklQ11LR1tykIlAI+W5maMN341eNju+Es9tDG5ncED
+qGmrPd8aI2FVf7ZVwrDS/Zg2HPcWoAVMTdt2KwAiUNZaOxSM66J4jbbLtrNhjHG1eeCxNovj
+ZgP8gJlBMFWOBXzudSXZ2hysdhJwXbauE9vLtI3xwN4a15HBVmyPaGussA3SGHdo282snRTG
+Hcv2cLb3DVwLuKKp3M87ADwOHDiwatUqXDHhcmdLe1NHgm+a7+kgX/tQX4cQMPwcQtL9sgNO
+RXoeCpxkHAn0OBQYeCrm0p6ArUsAeBwEY++yY+G3jatlcukzW7rMg/ltvTl1Q0Xdln7LQGWX
+oW1ID5sHYYsJHWakRKfZhMZQdgx1ZUukmfRcsaKora9vwGwWSqVlaqRkent7i1AoIpNyChXF
+CWG5i2Z4v4yAh2LOg0HhAUz0YFhXOCB6a/orPFbyvL1O6/zTDxc++VRJJA/pdT2Dnepqjbqq
+xqSDO/gy5s7dye+8Hf70M3Ezns+cOZvz/ELR3Ldz3lksOHlmuK3tahfX1NzM4uZRsxIi3DZF
+OyyOPLuEEn2mt7umvrtNXl7aPtCjqdbS6fSW5hbEDmO5qYpe4+jiJqnj9wQPXK4hEyNdf4Vg
+fpap10i5/eX3Bw9ccPkrSFdbT6Jfhu/pQAw8fOyDwUj1y6JGsHMi2dQIzriRHcmmRHIY0fyL
++303Ldn7ZwEPSDEwmNTY4arq8ahodS4cYndpQ2UD7HqghEfGckmRMAx0YCp0wGjQamvYjFwK
+nVkgkbAYTD6XK1dKydSMXC6vtqYRfNVXybWL57vPItBfIsjmPBgQFczCwAMaTRLRI5MaRvu/
+IhVAYGiwv0Mj4FRxmFpFcW1zQ4EwXZAbUVxIbaopMdTXF3h6U5Z9R5zxCvmZ+blvfMT54POs
+Jcsytm7rKVYgTHQVi0d/X79criITU1NCnZK8t4c4r0kLO9/SWN3W31NYUSYtUqaRMhlMRqm6
+pL6mdmho+CZR4bcVHDz+KMGMKpghZdLslanLDmciFjQyqWsGBw9ccMHlCktAV39SIPHymQDM
+3IGBR5xnSrIPMdknY+JI8slM9CGm+Wef3+29Zcm+Pw14FPT1B1cNnNPoHKv7T5XpaL3V7pLh
+7AbYiBo4LGN2CevASmtZ4JGB4dqKaiE7N9TXPzw0RFDAr6rT6nWj+RotjfUrFns/S8h6kVAw
+/2HfuAgeutpoBQ9EuWPNUNDZAJGYkFgPeLi3s0SlrdJWZEYcibrwaczlHzLizg40ldeycjPX
+bOe+/wXz/z4nL/0hdd3m5BPHMyOCDPqr1mezWEzNDU3igkIeh8ejpXOzQykpfikxoSQSicpi
+phAz4pOTMkiZLBaTxWRKC8Tt7R2T2i5w8PgLgoc1KsM2mOTXGUzG9bbGwQMXXHC5Knh090d5
+J/icDfJBwQMbkRfjY92TY8C4lBTjjo5LSdhynFsqWIj3Sju/03Pbn8jV0mTqz+3qPFfatbdo
+4HyVWaGv9ZLoqA2QGTVF/FIdY2yY0UiNsTBK/cBQtaa8uqpSb9CNRpaiJTqM+s4DG6KfJ2S9
+QOC9+g+f5FgRotBtwMOCdJtF6nRh3haTBUnVBUtdnR2FxbU1mlJOxLZMlzlJbguj/VeWyCha
+oTRq79GYH5Zn7NhGdnSkRIVmUzIzciiDQ8NWWhjv7LCYuzq6lXKNgC8T8nh8HpXLzWHQOZkk
+ekpqWkpKMjk7m8Vhs9kcoVBYqlb39fbeVr+ZWwQeYEIwc2FhIf43jgsOHrjgcnuBRw8Aj0Rf
+x1/AA3W1kMjh9KxQ2sRBDmGAV0oky2O/39Yl+3d+cXDnnwI8LHCbuk1zWT6Y1tFwuaiT1VgW
+JBzg1gAdboRHq4mODQgarUxuGYbNQ5AJi/oY1fJYT3ozBBACqR0K67wcs+fcF/sigfHvfwam
+peSjW6F1PhA+MOpheAC26MEMZgQ7TJAFrRQK9XT1KJRVlcWFvPDtWQ7PJjo8E+f1PY+WmM/J
+Sw4Kzgz05GcmFuTSckVculhAYeUO9A5cDTyQOuZGc1/vSEN9e3l5lbpErShUSuRqqbxEIpbI
+JBKlXFFUVKQp0zQ3Nw8MDGC5wHc8eGB1PE6cOJF7dRmXbItl4F5XJp6qTqe77l6TIlBBQcG1
+9wIbTNwLTHXdw01KYlO5ut4ruRRroXhdGXcnp3gzNRrNpL+4W3EnJ72Z172TJ518Fi96R7Xt
+CvCY4uekdwLhT+Vm4qY/XP4S4NE7EOWd5OsY7OMQPGrxsA9OukwkBuZkBFCR4Y+OsWViALI+
+K4Thbue36ZM92z4/AMaeZcdvnzoeUVFRvZN9qR9o7G4VVBsbDN359V2ShhZR1XBtN2S+WpYq
+xh6QeVyZc9R1ArjCAJtG0IwXYqL0jX96vEQgvf1kNIUqGd0TrQcK5h5B+tqbAafARiNsMBgh
+0xDqdent6JUWqIok+UTv7eH7ZoQfeDrhwhopi5kvllKZVLm0QKGQyeQysUwqLyxkc7j9ff3X
+ASsLICTziE4H0KKnp7e9s6utraO9vb2zs7Orq6u3p2d4eBhrSXO7CaYQdTbd934TAVqGcD0Z
+V14MY5XrCiCliZdw3b0+/vjjiSc5a9asa+81aWYlmOq6h7sa4F1XxkELuEVT2WvcnZzizdy4
+cePE87xFd3LSmzmVOwmEu+ZBW/CY4udkIv5N5WZO/HThgsudJ+CrdPTlZF/HECt4BJ4L9zgQ
+sHvZkb3fHN/79SRj15dHzm508zoQvH7xrs2f7gNj59LDIa63dx0PoJoNSNlQwAHQsAUaNEM6
+pPWZyQiZb7AoBTTap9VkQdrFw0px20fzA58kxH7wXFQBXzUpwEAWM2wC9GE0QRYd1gWms0+U
+r1KIxRm+O0IO/Sv8+CPJHivU+fxCVTkzj6cqUaPFQMu0Wq1MKsvLyzOZTNc8JWiydbdRBOkf
+Ijf6PR23eOAWjz+vxSMzM/PsBJkIhBj/nL2eTHH+cUKj0Sb+Nm03mPQ3jstfUAb7B2N9U3zP
+/mLx8HcMC7SPctru6bzTa9JxbrvH5aNh7nYBaz/evvHTXWBs/3x/8IWI2x08MI+JYaymBpLA
+AhnAuJFyWBAyAYS4UowWWIfo9K5208qv4v5JcP/kBc/8TF53Q3N7dX17TXVHtbajurqnttEy
+ZECOZbGY0GAPrMF8S2e3SKYpLVJnBu2OPPtklNP0RN+lFUWCisrGPJEE8EZjY0N9fb1MJmMy
+mROf6lfDj0kxA1tvLbiBf+ZxwWWK4h7MXLPWSbjzlds8xgMQ1Ouvvz5F69Cvs5ht3LjxunvZ
+2dld2842d+7cO+BTAZ6hNU19/IIGfkEdt6CGK6rniGrZwkqWoJL5/+y9d1gcSZboe/943333
+ze7szO7M9ExPt9S923dm2o3pVsuilvfegaAstnxRhZEA4YT33pvyFu+99x6EFUhCICFhJCSE
+9/AiK6Xs6sIIkGkEdb7z5ZeVGelORkX8MuLEicK7Gfl30/PupOa2pea0JWW3JmW1JmbeTki/
+HZvaFJPcHJ3cEJXQGJHQII2vk8TckkTXiqNrhJHVgohqLlBxNVtYzRJWhAnKwviVoeyKQHZx
+ECcvIr7q6bORjfTPGh0eFQVE+1r9BB4+lsERfvFJ7JxEVhbQJJkqrKdwcxwNPTUOauKPEIDq
+HqcGOYStc/CYnJ+ahLtOZHO1z80D5JgZhyJ4rEJm5+fG52emwGnGoU4U2HfDzjz+y/9Noak4
+5/nxCkJZmYHBGUH+mQE+We5eGfZe7amFAHEA7IzB88DKuju6XwxkV9SUFBRGBRmF234Z7viJ
+OOhKV3tdd8+zmrr6vr5eABvgAy0pKenevXvzK4j3BaPFwpiibx5nQylK2YRS0/DYxiMXR48F
+iqVKLmI8YjNq1+3dwp04Xl5eK2kdWluL2e3bt1971N27d5dpZwNotDGCsrZ2DMRm3hXGAW3h
+xjZzottYEbdDJY0h4sYgYWMgt96f2+DDvuUZXuMeWuUaVOkcWOHgV27rXWrtUWLplmfhkn/D
+sdDEPvu6TbaxVbaBRQb9RjrVNJ10PZVolKbLTNFiJGrSEjCkWBQ5FqefQLiepH8j3ie05N7D
+0XVlh+mZWbxlxK92WcAxkFel/7zizvON8LN82dXiZx0KwEPsFRsXmBYbmLqIBiUDTQxLdzb0
+VN+PwxzWBap9nBK47sFjam56AjADIIU5SKFGiPmZGWi5ihYPGXjMTs5B0TnmJmEv0vni5FKd
+v2oIMc6DhVUjxaX9mRlPUhKexMc+EUTccw/OMXN6VN04OzMzBjWVvGxsGZgcK2+pS4iPFAfY
+8lzVgh0O8wKZjzrbh4aG2+40d3Z2ZGfnRERElJaWgmcZGRlZPkq5fChRhfVF430pq5X1L7UN
+j209cs0cMgvKOiYnZ5QGeW9yr/OZd2gphhqtyUjAUCPRlAgMLVqTmaTJiBbF3Op/ProO7xkG
+j0WBYf3IBogGf7ezLyq1PkhYHigqCxaVBvMr/Xnlfpxi3/BS75Byr+Ayz8BSj4BiN79CR98i
+e59cG6+cmx6ZVm4ZFq5pZo5p123TrtmkGFmlMs2TGWZxDJNY2rVYilEM0TBKVz9Skx6hSYvE
+kCVogviqjkCdyNMxiqLeSKTfSKKZxpOM4hk3YuubH60fa1S3PPqPvdb/vtviV7stVwse36l5
+CgOjFcBD4h2XEJwRH5S+iIakAE1mZTobeKruRaEOagLFHyX42wevc/CYk00CPwcPl517pa+m
+e18F5slGyU7Pzk/OAggBpdBoR36a776Tvipnm7jimbLKgeiYoQjJMI8/HMQa8Qkrp93gEhjt
+dbdmX43bnYMiow5UtZXm5CbkxsRnSzhR4c7cYL+sjMJbt6rz8pPj4+Ok0oi0tLT8/Hy421dJ
+C5tHbt994hZYhKXF4PXjcfQ4PCPB0iWrorZLaZk3l+X/Rb1PhjnSGk1mDMAMDDUKIIe8Yukx
+WgZJoBZobutTgsdmA4/B4aniik5ebEVYVHVYZENYRG2otCpYXBskqArgl/lxyn1ZVd6hVV4h
+Ze7BJe5B+S4BgD0K7LzzbT1zrd2zLV2zzJzSr9unXbdON7ROZlgkMUxTaGZxVJM4snEswTBK
+hxkFwANPjcCQJBiymHgt2sgm1cQh3cQx7Zp9qrFdynW7NBO7rBv20unpqXVik/zqdoAQv9pl
+8WsVq48O2a1KD2gHS0Pi/SyC5cGD5SgSuEXzXSMXUTcpULFXjB3N5bKKuvo+jPp+DPawtq9d
+wDoHDwg6kPGySKzSuVeBSldeds1B4DEyD3RmZn5s4llzhImu5487c03MC/1DOoURD/yCuhxc
+e63sesyse0ysHhhaso6eLQvnzs2+jFUGrvfseX91c15uQUpRallZallBek5yfFaEJE0iEgh4
+AZGRkoyMjKysLLDMycm5f//+BgYP2P1sYJ1FF/mlpKCsQ4vx84qPGgnYA3AIoJHbd54oTfQu
+ZHhkIi6tmWKSoGWQDEytgBzyitOPo5mnllY9XFf/SCV4vDsBtURR2V3PwNyb7lk2npk23pk2
+ntnW7rk3PbKs3LPMnTKu2Sabu6Sb2CZdv5lk6pB6Dah9krFdwjXrFCPrZEPrJAOrJAPzZLp5
+AsU0Vo8pJVyP1DOM0KVJdA0jtQ0jdQwitJkR2vpSbaoER5NgqRKmVZKdb4G9V66NWxZ0UY8s
+G58sU48MFEN44Ny1gtyIkZHn6wc8gB4mhhVU31+VVjU/ihek+ZkD6vgJPLguUql3/BIaJ/VO
+iPZPdqC7nN9z+co+1JX9KI3DeG87v/UOHj8P1YHo/KoKEKjJYnZqbm5Y5mU6PzlaHe5rtvM7
+PpXyora+KiqhyMW7w8X3Ht20h2zURaK16ui2aGASDh5PoxqOP4Y+lMagTp/56dHx3iftbe13
+Gyu7aosai4sKCkoq8gvr87MLivIzi4sLi4qKysvLa2tr29rahoeHN3CZr4xcCsvQ8ERMSpOe
+cSKWFr2wvgMcArX260eHCqu6eweVqPC2ZGZmFsDedbt0TWYijh67DHL81PRBi8HR45z9Cpta
+e5XgseHBIyu/BU9laRA4KKoQTRFjyDwsmYMl87FkEYYo1DeLtPFM06QKLOwTLB3iwF40RYSi
+iHAUHo7Cx1EEQPEUAZYixFD4ukyBo3c6xUxCNZU6eabqMkQYighPFeFoYCnGUURYmhionpHE
+1C7Fxb/INajYNajENbTc2DHpEMr1v/cw9pw1SIrwevSwbV2Bh7qpeA2HJ4jSAq3CfF85l3pb
+BIk9Y+OD0+OC0hbT1Lig9OTwHCeG29mdFy79qAb06kG0p63vOgePOVlADjiEuXxw9NV1tEAn
+mZ6em56U8UpfbqHn3mMuxy5XpxXW1TYXRCem3HRus3K5q6V/X1Wr4uTZuJ07Iv/6l7BPPvf4
+2z8b+FLo2wqwx5zM42RybHR8crh/9llP/6PeljuPWtvaHz+429vV/hDc/6NHj/r7+4eGhsbH
+xze2Y4YSPKanZ3OK2g2tU0Hdt7CF/+dVXrQWM4lkkhCV1DQ4NKHEhjeU+uYeB+98vH4cnhG/
+EuSQ48BIGahEB/EqHj5+8UGCR1vbfHX1T/r4sWICsNHBAdK2tkVbKqFd/v7z3d0bFTwmp2er
+6x9o0/loqhhDFeAAIVClWKpYhgp8LE2IJvD50or7vaNUY15hRWdFQweOyMHQRFi6AE8X4ugi
+PA1SHE2AowmxFP4Nu+jegSmPoCyv4PzH/eNmVpEYsgBPE4K9eJoATxVqyg7BUMRgC8082tG/
+wCW0VNNY8PcjZp/u0P9sN13lvFF6tM/jB60bADzihSnBN1kwePhYBQPwEHnGAMZY3Lk0MCU2
+MC0pLMuJ6XZmx7kLey8DVT2g7mHjtd7BQ4YKC4Ojrwo85qBxMdNTsqEwM/fuJOAwZn/fkctO
+aLk3wE3JjYpNzPUNrjO8UXL6SuRX21if/c3/oz8GfPxf7E8+CfrT55LTV4Zabs9AfTRzE7LZ
+6JAmlJm5kYnZ0cmpmenJuanx6ampKXlvUiV4bGCpaXh80z0HVHx4/ZXWfVh6rCYzycA6Navg
+7uTk9LxSVtNgOS/zxs8rafdnlWFpUZqMRNiDdA0KO53qGsWJYut/WafTtYDH3r3z/+t/zf/l
+Lz9pQsLP9iLbQTIdnZ8BCbwdSSMQbEjwiE6pI5pEaZABckjwFCkebpegivAUEZYqwNJ5OBI7
+v7S9tfMZgc5Ky2m53ztAMhCiyRIMxBIiWAFOQEqWoCl8j+DMwYkZK6cEG7fMwck5d78UdQIX
+gApOn4+j8/FUgewSAsA2WCrAD4GWgeg4xuOzXbRPduhv3WO0ZTdT5bxhWoz344cbATwSRanB
+1qxXE7VA4CH0iI4PTl8KPOIC0pLDsh0M3I5vP3N2z8WzKhcv7VNzs/Zc5+Dxlgqu2fG5ySmA
+AYNjNU6ODn/7LOqa6cDTkVsdTzzEkfyUjNvZ+eVmFrH7Djn/5g9+v/sT/5NPRJ/9Of6Trcl/
+/IL1yZflNx1mh15MQSeZUw5U2MzgMTU90w6NniiBKq811X04/XhNRoKFc2Z5zUNlLlq5ZOW1
+2nrkoKnxeGB2WtTakGOh06m+eXJK1i9WHawRPIAi4uPz00+YKJCGDn9/iD1guujuhnZdvDiP
+9P8CJgFbVtDuwWQy1dXVP6CsEsAu1jGMx9LEAAY0qWJNGsQGOJoYQ5OggZK4ZrbRvc8nRfEV
+GrosF5/0p6PTPqF5Gjo8LA2AhAgD9ZtArIKlSvFUCZbKL6npar7bR2IIyYYRzfeellR34Mkc
+wDB4Ol+TLsTSpODkOKoQWtIEeIpEg8L95/Ebn+7S/3Sv/hYVxpbdDJXzRqmxADw2QldLkkQR
+PATuUa8Bj9Ase6bbkR9Ont59FuiFHy+5WrltBvCYl7V4gO+m1qJKo23bTf7+1b2UzLnZ+Yf9
+vbE5qelVNc8edzfweVEXLoT/z1/FH/0p/pM/Jv/hT8V/+qLi8+8SvtwpvKA6eLsZasOYnJI5
+uyplM4JHRe1DS5dsbWbsoqMnVqHyfqd3lX6nK5K84ns8abWBVQqOHqWqJ0GRI96cPWCnUzwz
+MVRY/bhn6IMEj4wMiB/mZX0oADPkWz9gugD4AcTYGEqm4HUGOGR9u5esTUJ5xQSjOBk2iHBQ
+I4YMJ+gSdYpETYdLM+LXND1u63xONRGiAGDocwsq2+93D12ziFTXY6OpEohP6AIMUKoUTRTe
+dE5+OjjtFZQO+YGQeZ5BmS9GZkSRFRhCGIbIw5PFeBpILMTSAdhIMTQhgBw0lf/dKatP9+hv
++ZGxRYW5ZZcMPGI2CHgkS9PkwCMEBo9lulpkLR5ZDgbuh7cdP7nzJNBzKudcLF02BXjMzc7J
+JqatySt1xesG6RLuFVU+fzHS1VX3oKP0QW/n+OxIR21xvD41ftePcb//Y/yWjzP/+k35dz8W
+7jqScOJCvpPjeO9DqHtnanrVsdqV4LEhhCcp1zGI1aDEaZCj3kqVB/ud4mhST2Pre3b7Ou1V
+Npfa7bpD/c820q9Xos3E3xQUt9g5i2wcxZ4BaRbOGQA81AiSt/Ii0JRIbcNUIkOy6KXv6P+h
+h607NzX+LjLV2sED8fHQ1YX4AYiDw0sCWQmubGgJFhRrG8epE4VXSXw1El+dKACqpsfWILIs
+7GNqm7ta7j83tYlS1w5RJwmvEsPoJpz61t6G2z3QRr0wNJEL0l/V46nrscjGvMr6R0G8QnVi
+uDpBCJ2TEBrKL+l+NhGdUksx4qN0w9F6HBSRhyZwUUSuBpGPIXHRFPF3p20/2a3/+R7GVhXm
+VlmLR9pGBA8fy+DlwSMmCCyTk8Iy7Q1dD2w7dHTn8WM7T5xWOetk6bxOcktPT8/yM5u8IXnM
+zUzOzk5PTUxODI7cLq9rrLnTdLdVwjZI8VNPDzPIzAl90N9YmyCNv6yRuv1g3JmLAryWhMGM
+srRKZoU+e9Y3Pjc3Oj839V7cNib72p9E3+jhEt+i9grp/UmOb1GjjY7Rfvjf9wTX3+5p1602
+s2+k2+lFmWrzGLggAsqRbIQlct78uxtDjcTRY2n6XCeycQPhv1ZYEW9sbV2wpZj4l3r9/8k3
+2M0y1PQwNjYx9bFylHoF5xhaJWozo68SJBpk6dqQA+CfBkl8QtVzzzGLRW6G8ts28n+0Uf/z
+WabPOgKPrVvnCQRIv/tu/uDBl9sXBY+hoeXAY2hoQ4JHILvoul1aRHx1ZFJNRFJNVGJNdGJl
+dmHLnXt9I2OTdzv7EtLrJHEVUUlVUUk10qRacWJVfHpNR1f/4OhUbf2D+JSayISaxMyW2qbH
+TwZGm1sfSuMqpYnV0Qk1MQk1YEUSX15Q2tg3MPx0YLS26VFSRhO4UFQSuFx1dFK1JK6KZhb9
+3QmrLbvpW/bob93D2GAtHulRWStv8YgOAuyRBMDDztBl/7aDR3aeAHp8zxl7S6fNQcFz87PT
+M7LZ7YG0t3XWNTy81XIrIgib4fB1+s3vpSE6pQ2pJdnpArpJjO61zABBelxKZmZOXFJKTHp2
+78jo9LxsPtzp1Q6nWYs8jbNW1j7rX+PM9bC0SDU9CerN2j1w9JgzqIAdB4yLtD9WWhXo8K0k
+hX9E+/2fBX4cGZ3MK2wI46QyrgW6eMd5BedhqdJL2sKVc6CM92I0SJKjl9z+uYf21Ta9ExfN
+F/4TkVsC5PmOvrYWnZZuFV0tKiov/TQW7WpBEsNYIt/VAtbBFmPjjVfW+4QVOvjnT/6saRqa
+BnxqZnJyZqlvW6h0n5qamvlpLo65mdmpqenJpb40Z+fmpkHquWlZrfCqlgGfjXPzNq6p3x22
+3LqbsUVF/zO4xePCxgGPvKQCZFQLHMfjteCRHJZlb+gmA49jQI/vOWlv6bBpwANkkrkx2cDc
+jvbO6rqOiqoysdflhBt/jL72schHI6cgLi87P4MtqotJqyqoKSmoLC6uysorScvIHxiQTfQz
+JZur7t2Dx+zYiz4xs8vz1HrWIv2vBed+ddfx0ArTb7DKsZ7ySRKX6+6fZmqfdkVHpE6UrKmt
+I0adKD560eWrH/S+3Kbb0/t8XimL1wqL/OuePB2URuXTDH3b7nY3tfa4+OWq6gov64heix/A
+7BhK5KmrPtv2GQCzf7lNJzAs+cXgyPsHj7WIAngAooC7WuZfOZci7SewcymMIrBzKUiAeJOu
+2Ln0gxPf8EJ7n7wXozMjkzMjE3OjE3NjEzOzMn6YnJkbHBofGh0fmZwcnp4dm5ydGJ8dm5ga
+HZseHB6dgIKLQuEpx6dmx2dm5mRhsodHpsfAGcZnhydmgI5OzID1F8MTI2NT8LSlIOXwxNzI
++Nzo5CzY9nxo1to59btjN7eokLf+SPtMxXDrHuaeCwapMb5ZuUXj62A42xuCR1F6SfDNcF/L
+tYHHUaDH95zYNOAhc9CYmx+FhsNO3r97p7i0uSA/l2t3Ssj4Fdvw9yIfrcryotLShuLsguZb
+1RW3Gm7VNTXeasrJy09PyxgeGIRG5EKzxczOKqOgy2QzD6cFWaC9ozeYlaxD8XT3jY1KrMPT
+I9SJK2/th5ADrJxU8/5+L/Orbbp7DjOCwpNmZ5XuQ6uWx93PK6ruJKZUPBsYzcxtMbNPvaQt
+VNUTLxVQBegFbMjOwyZfQcihdwl1MzWjcqmTfwDgUVj4M7pQGGwr36ABgER+EO7GHU4bxC2i
+WyQ4emY4eac5+QBNd/VN40hKqhofDU3O1DV3ePtn2rpn2PumO3lnO/pm2PoluXqmZhc1Dk7O
+3LnfHx1f6+GX6xuan1V8u/fFWFF5m51LipNnpqNPqqNPupNPhq1riiCioKd/pO/FREZ+q29o
+gZN3hrNPqrNPmotPuoNXuq6x+PuT1lt36X++h7lFxWiLiv7eM/qpMd5HNe1/tcvi4yMOR0nh
+rtz88sZfZlzbG4JHeXZlCAQeQYibB8814rVdLQ5Gbge2Hdic4DE9Nz8OIerU/Tvt1RVt1SUF
+IuczPNPfhpl/EhlIvFNf13DrfmFhRfOdhub7rW2tbUWFBalpqU1NDdNTUEvH9Pz02DxgYuWA
+2s0OHrCMjU0VljR5+kU/6h7IKWzD0qQXtYQaJOnr4meCui/qHCZ4x6FroO4DehXv0PVIObZl
++fbK5WR6erqu/n59Y4esAXw+ObOJZhp7UUug/vN3ASx/RZuz94TVN9sJX23TO3TmOl+SNTa2
+XDy39QgebW2KkcGqq3+2Bfz094egYtHWDDi82Gq8Sj448AgWlOkYJ6jr8q7qsq4QwlUJHDVd
+PvipzeT6hBa0dbwoLu8gMAWXtMNV9fiXdTkahODIuMoHvcOShEradQmKEK4ONmpzNMlsS4eo
+6qYuW7eky/ggNT3WVQLromagrVvyna7nRdXtN+2TNIk8DT32VbBLj6NO4GjostT1wtSp7O9P
+W23Zxdi6x/DjXdQtO/WoBpZpErfdqubIbGuAQD46aPubvVYAQkJiKlo73l8J8IbgUV/aGGbP
+8Vk7eBw/sfvUzeu26yS3cDic9zbxx/P+yY6WJz23q2ND1SI8/hLj+XW+hDH1pGOwb6y1pWt4
+dPjJ067GxnogY2NjymJ/UYEnzh4fH9/kdhgbmywpu11b3952r887pFCDKF7K2QBDg9w5Lmux
+VI5bfL2dAD63j50zEUfljU9MKbPTW3gR45Ndj5/1PYHi0g8OTQqjqnSYkTL30Ui4V+sMyv/v
+O8kAObbvp7n7RvU9eX1psx7B473LhwcevHI9oxQ8NIWKEIroRRPjKGIsRaJBFqJ0uFY2sfe7
+n5c1PtRm8DFUIY7MlsbXPBuZ8Q/Jw+mwsCQ+li6EophSpViyFKUX7hGU1fNs/KZLAgbsIvGt
+XZJ6Xkyk57fo0AFmQIHW0bLhtGiqFC0LdqpFE6Gp4u9O3/x4D/XPO8nfHCDr6FsKuS4JEndV
+fS9Q3QPeUJiS/rd7rX93wObzU84054T3QCBvCB63a++EOwtWBx7hmfZGrgdkPh6Hdxw5qXJG
+yBKvk9zyjuN4IF9NUGv2i4HRrs7evq77zXWpTVWi21WSjua8sYEno4OjfX3PAWx0d3e1t98b
+HFROrqGUFcmDrqcTst7bW02PbNwyVHWEGuQIJLwYXPGp6QkOnrX/difpq226O/bTvAJin/a/
+UJru7cqzZ8OdD54+lzllhbDzjl/2BiiIIkuOX/b4dgfpmx90r1uGt95ZaRO3Ejw+SPDgluoZ
+x2OhkBpSKHIpRaxFEeBpAhRdDEXn0GU7uscODE2HCIvVCGxrp/j+4SleXLUqgYOmCjRpUHx1
+CFqoEixNiqVLcXRew90nFQ2P8PpCLQNxZUN3Q1uvNp2tQQS8AahGAgUco4sA2KAp0LomTYii
+SP95zPazHXqn1A3cPJxiJV6xQpfOjtrZWai1vLzxoSs3/ygp/Dd7rf5w0PbXKlZyEGIGCOSv
+591CYioGht7VN90bgsed+naWiyJ4LBVADIBHLACPULjF49Dh7cdO/HjS3sp+YmK9zBzxzsFD
+KUp5l9Ld/fxBVz+8nld0R4su1iBJ4VYODZL4mGz0xJfbdL/doWdhy2nv6FZa7N1Jb99Ab++A
+q1fSwVOOJy667pT1ah09Z1JS1rSq87xr8Kirq7O2tn5b5V5371BP39sfIfvBgUcgu1CLEYmm
+C7CyEOhYSAU4mgBQAUpfpEGX4CmcipqOW629WlRWXHJjd98QzVSsTpFgqZF4iBwEcMhTHE2C
+o0lRFH4QK+fFyLSJfYylS+Kz4Wn/0HQNIgtHh86MowvhqeI0qXw8jYeFAplKNIj845fN6cYW
+ApZ7gsApgnWzqbZw0Vu91dbtKy7eqx38axXL3x+wkW8D+c99NwEYgATrDTzam++Huwm8X00S
+B8CD7xaRGJoZH5wGNCE4HSi8Ds0cF5IWH5KSEp7taOx+4LtDx3aedLR2mpxcR/NVKcFjoahe
+EyYVtLyLM9958LTm9iOgYEVp57clAOMfdvV3PXoG1g3NhMcuuKvpcE+r+23bZwC5c3yvQ9T3
+rqptUxrq/Uh13f1r5qIjZ+z+voN4Ts2qpfXBas/wrsHjbc1OOz4xnZF/x9gm7ZptWnbhvYm3
+OnTigwOPxrYez8A8DQIHR42QRUoXo+gSDDRviwQn6xZBEQXSuNre55PU6/zyuq7mtm4tcrgm
+RaJFlUKdLDSxbEY5KR6ABzT3itDCKX5wYt4nOD0wNO/ZyKypXTSKIsRDaSCeAXiDoUlkhwhA
+YiyVf90iMMjXM1boEcmxiRa61VZlTU+9pqodGBqPyKg/z+QBAgHUgRDIHw7abkf7F1TfXz/g
+0dnygOMs9rEM87UKBepjFRLuwBd7RoHHBSqSqRBRzwihhzTCO+4m3enQjqM3DCwmJ9dXz/La
+wMOZnff1JQ9YQTW6wUpO8FDcxOpFgQR5aliDIsuQvcAOCntB+uHRlzkf5OGDeiEg18G7wAqw
+obKSeovy4sXog65+qgH72DnXQ6dsZe4cupfRtmmZVUrjrE3eZCBZOC/H3IY/s6aAwx8EeFTX
+P7Z0ycIzEnD0WBw9DqzcdMupbXy8OcFjfHK6pb1vcmrO0T0BpctGk7kYsgBDEqPIQixJgCVz
+MJRwdRLL0DrOn12iSeM6+Wc7+2VgiCywCwsFRedrkAUokgAFlhQeisxBk3gEQ3Egv9TwRqSh
+eYwfq1iPKUJR+GAvmsJBkbkaZD5IDJZ4MkvfMMjVPUjC847l2UtZjplJwp6ezlXdPyCQkJiK
+z085f3TQFsGPjw7ZAfx4W60fbwgeD1ofRvnGhznyw51gFYQ78sPseeFAHXhhMg1/paHQksNx
+ETsYud00tRkeHllvGWZt4DE8OmnikwZsKEqte21iol0sqGrf50MBHngTIloKPAA5wKcFioAE
+YgGwEfwEZoETAK4AP+Hz9DwdAgeC9DBCg5/gqJWYTimrla5Hz4LCsxkYxhlVS6Eke3R0QmmT
+D07WP3hk5t/F0KIBbKApyHyFkZqMBAw1yp9T/uDRW3DX/4DAIyG/ecsJJ2nGLbD+pH/IwzfG
+0Mz3+o1AM/NgE4sgU5mamQeYWgQam/kbGvuYmgcZmfgZmvqbWQTDe8EWsEQSv1w3CzI08jU1
+C7x2I8Dwmp/JjQBTK1l6SyRx4HWLIDv7AE6of5TQRcK6GSvxrKvOGRtde89XeePD80zef+2z
+kW/9CIoq+8XBY2hgqKm2ub6ysaGyCWijbLmMQgkqmhqrmybG1mMZuOauFrhiXUnlDtfX7/Oh
+Vn5vawAPefqCcUIePOTbMQCEkB3j3vx+5EU5quU1H+lT4x03t0EBwA3+e3qwV2kQJXi8XfAY
+HJqQxtdrGyQsOl8hPBOQrlFcRELDi8E3+pN+EODR2vFkr3bwH2StBI6s3OK6jpb7fWB7d09H
+TXlmRUFCRWFiRVFyRVFSZWFiZVFCRVHiyy2FMi1KroT2ylYKk2QboSW0EayAZUGy7EBovVx2
+CLwuSw+dtqIgsao4qaootro07kF77fzc26lkO7uf61hH/e6A7b/JBsL8h4qVbUj2LwseG0ze
+CnhEZtYT7WLvPHiqek0IKmKwhH0YwBKurEFKeDtyOPjeB1vkE8OSVNCCnAScHCzBmeFd8DrY
+CPYiG4Miy+DzAIUdM8DNIFcEipy8oPo+fGYk5VIXXSF4wIiyDHiAdRg8wE2CXW/Fb0QZx2N5
+GSgIR6qtp3HWSoMoweNtgcf0zGx+yX1DqxSt182SjKXFgDSG1im5xe3T02sMT7f+wSM8rupP
+h+1eumXuu/nxEQdeUs1Gyoe9/UOgAP+dzPv0P/fZ/OOK15uMulWCx1sHD39pKVwFg42I+8cy
+4AGwAe6VAIlhxwkYDwCNgO1gC9gO9iIHytfyQMEuGDxAMuSi8DkBXSwKHvCZQRokJdLTsehF
+VwIe4FrypLEQPMA5gWXmX3W1AH3z7hUleCwvoKpCqq1eHklpECV4vBXwaG7rc/TJx+nH4/Xj
+VxgpFy9LbO+d33h7LS1v6xk8BobGz+hz/vDKHeJPR+w9BYUbNTcC2PjyosfLJz1sB3BLCR7r
+CjxA9SpflSM9C4vW1/JumWAvDBLICtIQoQAeCp4bCmNDwF5ADvOLdW0onFne7URhF3x7y4AH
+zDkwosi34cDgAQMMAlQNd3qQvbBPyML2FiV4KMFDKesWPPqeDrPE1Th6tCYzEQkRs/KJgTQZ
+ieDYUEFVd+/qHA/WLXiAivhv593+bbcl3A6wHe3f2z+0sTMkeORPjjnAjwxwC3NDsobJX5Tg
+8S7AA8ED5AMf+fZXAA+4yoY9MGGFE3Q+fg43WSiwhEKLx8I7AZcDJ4EdSuEECuABswTAIeSK
+8D2AA+FdCy+6FHjID0uBIUcBPORHtSAkhgi4B/hYedRRgocSPJSyDsFjfGJGGF1Pvh6vyUzC
+0KLXPhUyDUBLMvFafFxq88jI5AcNHqCo3HLcEa5APz5i/+aeDx+KDAyNg2/Jjw5BjTy/+dF6
+n3bwatlDCR7vGjzgunsp8JCvvuW1qLZjYWW9PHgkFbTAJ4d3LQUe8M+FV4THnix0fF2Jjwfc
+XyPfdiHf1QI7iiyKSfNyPU1K8FCCh1LWLXikZrfoGKXj9OPWjBw/n5w3FgCMiV16SeWDD3TK
+y6TClo+POsC15+ennN9FlK11Lt6iYtgC/77bYrXsoQSPXxY84D6IhScE4AFOuLD3ZBnwUOgl
+gZ06FoIH7Nu56KASOOXCi67Ex0PhQRR8POC2FPBQi1pvzSN9lOChBA8leLwf8BBIiy9ig9UJ
+QqiHZZWdLEs6fjDiAYG4BRa13fvAQggC6vhU1tYB6tzv1H3eXWjxdS6gYN96wmkN7KEED4X/
+4NomiVszeMB9Igu7IbqfDir4fsB191LgAVf0CE7ID25VAA/AFUuFHIFPIr/rtT4eyE9wWsSr
+ZH4x51LYlxW+NyV4KMFDKSsHj3tGW3958JAUnlT1PKPhfxEbCk17R4t6K+wBOX4wEzUZMfXN
+H0yLASgV4S/9f9ttuYZehg0mt9q618AeSvB4c1EIILY8eMAOFSDrIrChEE0LpITbHODqGD4n
+EqFrKfCAPUngFg+wDrc/wAkW+q/Ce+VHsiDri150hcNpYSPAD7IQPMBd7dcJhkEI3CdIJh9b
+bG2RS5XgoQSPzQAedyj/edfgk9G2dzJWYuXgcfqq72kN/7NovwNn7K9oc9BkKeYtNX1gadH6
+FhmJ6fXNbX1v67meDIwVVz9Ky+1IzbuXnHM3Kft+Qta9+MzW2PTWmLS26OTWqORWaWKLJKFZ
+FNcojG3kRzfwoho4EXUsUV24uC5EUBXErw7gVASwKvzDynxDS72DSjyCiu288y/qiU/h+Kfw
+HDWiyNYlz8Y1z8Yjx8knK5BdWF3fNbf5siioAcWpDda++ebuee7skqScdpm178ZlAGu3xaQC
+U9+OTL4tTWgRJzQDUwtiG294ZP2/281Byb8LFRAqrAzhVwfyqiBrh1f4hZX5hJR4AWsHFrsF
+FLv6Fjv5FDl65zl45Nu55tu45tp6Zjv7ZfEjK5+/2NQRnBRCpgPwkB/foQAeMCHAXhZI44C8
+pwdYh5kEHn6LbIddMZEmBYVRJAjSIInBXiQBch6k3UMh4DninrHoRSMz6xc+9aKdRAjtwH4d
+CjihYSoGFwKKuKTCF1pzvHQleCjBY6PK2PhUfHqzuXN2fmz8s3SPyZ53Nb1OT08PoI7XtvRC
+LR5qPsfV/LjS4qs4sx9P255WD7iqJ3wb7AHNm3wOHfQvFWZq5psOsX8+OAY0r+weS1oRKCwL
+EVaECCr8eRX+3FJfVrlPaJlXSJlnUKkHqNH8ih39ihx88my9cm56ZFu5Z1q4ZNxwTje1zzCx
+SzW+mWJgkcK8EccwjaVdiyMbxxAMo3X0o7XokXhqJJYsRRMlV3WEqjpcLF2qdy2eYppAMooi
+GEZ5Bufdud+3eTLqg+6BxKymYGFZkLA8RFgeDFubU+obXu4dWuYJrB0IWdsFWNu3wN4Hwoab
+HlmmTqn7cSH7sSFaxlHGNsmGVqlM8ySGWaz+9VjqtTiSUbSeAbB2lCYtEkeNwJAkaIJEVZuv
+psfDMyKJJglU0ziCQaSzT5ayoFiVgHpZoXsFnjFtYUr57Supo5eKCArOo+C8AY9/WdjLs8zN
+vM3iTnb1N5weTgkeSvDYeDI1PZtb3G5sm/5y6hP9ODvPvLqmX7gnAoDHqau+J9R8jaxi9S2k
+Ry57aupzVI5dP4cKQIF6Ya34gaVFY2hRZ1ABX/+g+7fvtGISit7kJp8+G4lKqwEaKq0KldaF
+SitDxBXBwppAPqgNS/zZ5T5hVd6hFV7BZR5B4Gu6wAmAh2++nXeejWe2lVuWpasMPBzTTezS
+jK3TmObJDNMkumkc7Xoc2SiGYBClw4jSpEvxlEhQFWroCXE0Mdk03tAmxcg2xRCAinWKoWWq
+wY1kM7u4pIyKDZ9RR8enK+s6+fEVoZKa0IjaUElFsLgyWFgdwC/355b4sSq8Q6u8Qsq9goC1
+i1wDCp18C+198229cm+6ZwNTmzmlmzikmdimXbNON7BKZtxIYZgmAGsD8CAbxugxI7X1I4G1
+cSCfEMUoglCLEUG3SDSyTTWySTG4mWJolWJgnhzCz3wxOKIsNN6dwPFA3u4UgR+6KMFDCR4b
+TGobHtt65uHlYnPB4S8w1Cjv0JJ7Hc9+QfA4rQ51tZxUDzyHZx9T9ZHEVRL0XX48aXtaIwgO
+kL7KcbVROHrMZS32nmPmX36v/eX3Wl9t04lNLF706kwmU11dffk77Op+wY+q8eEUQcor82ZX
+eoeXe7FKPMLKXIOKnQLyXYIKwEe3o1e+vW+urXeOrXfGTY9MK9ccS+dsC+dMM8dMU7uM67Zp
+RnYpBlZJ9BvxFJM4qmEcySSGYBytZxSlaxipox+pTZPiqBIcVQoqQQu37Jtu2VYuGaAatXBL
+N3dPu+GRRbFI+vG800lVZmVF1sTE8EbNqI2t3cLoOl9WiQ+3yJcL7FzpzSrzDC/xCC11BowR
+mO8cWODgDTTfzgdYO9vWK93aHdgKmDrb3CkDmPqabaqhXTLTPBGYmmYRRzGOoxjFEa5D1tY1
+itIxANaO0KJJsVSxJj0SoJ2VR85NVwgOLV0yLNzTzN3TaVZJ3x+kiETc4aHHc3OzytLjrQjR
+LjYosgxxhFjYt6IUJXgowWPDyN2OfoAWUJgLxiKxuUA1rWWQpMWI4Uhrep/+AtUZAh7nsCEX
+tNgnr/piqQJtpvikmi+W6HHiipeqNhdLjVpJzwtIA5BDnSA8dM7h2x3Ev/4LD8ADUMcy4LF8
+HI/Z2fmcwmaDGxIthljXIEKmIl2mWJcp1TOI0GFEkI2lZBOpHlNKvyYmG4m0GRJNRoQmU6LN
+EOroi4Fqv1xKtekSPFhnCPUMhbpMAdVIpCmbpB5Ph1QTmndejKVJcHQJ0yre3ivPxb/I0TfP
+0bfQObDYyjtLlR72zZEbn/xAPqlmGMF3v9tWvfEy6vjEND+imGjA19IX6RgCU0t1DYR6TIku
+M0KPCawtpV6XEo2lRKZU30RMMBBrMaXA2lpMkQ5D9MrOYmBnLWBSfTGBKSJdE+EZfJKhkMQU
+4WgiHLAz2EWDTI2TWRucwcQ+GRjZxa/Q0Tffya/QOajomkvSD+ds/nGQ4uflkJMa9OzZBzyc
+ua6ubv3MOCbvsyHv3aEURPLy8gB7rG0gkhI8lLJOBIAEW1KtyYhe0bwnBklUs6T65p5fFjxO
+afidRgefxbGOq/rYucccOONw7Irn0Use0HhbSuQy+AGQAyxPqnr9S4UuQw4tGDnWDB5jE9PB
+7DwtGl8DmlBegCFLgWLJAhyFj6XyMWQJmiDgSivSS+7p6nOyS9p5kSUoPQ4a4ARVgKcKcFQh
+jiKEllQBFloKUSS2tVMCL7oqkFtcVH6fzBRiyUI8DdoFlniqCNSJoH7EUkQE4wgrt0zP8HIv
+dpWRY8p+VafPdutv3UX9dDf5NMYsXuzdWl+8wfLq7Px8GK8QTeKiKMDakHmBYsl8HIWHpQjQ
+ZIkOXZRTci9EVMY0ldS19lk5xWkQ+WiqCEfl42nAwiKZwcEKpGhSeLiwtKDqAclIkJrXFhFb
+jSNxobdAg1Rmc8AhIpzsKNqNaHuffC92pVt4ua6p9PuTFlt2Uf953CA4wC0z2r3v8QfcF7Dm
+OB5KUYoSPJSycpmbm+vsGkjJbnP2L9Y1gsJZrLyrAqTUNUzwCi3NK7nf0/emAbqHh4dBoffa
+Dy6BGBrVclLd92WLh7rveVwoWDmh5n0BzwLU4RWShdFzPXLR7RI+8NRVH0AgKDLkOAq7j4J7
+1iCKz6IDfzxh9Y/dFMAbCsixNvDoeTJ0zT5Fg8jDgLqJIoaoQKZQVUURYWhCDJVLNhTdbu/P
+Kb2jTQ4vrLjf2N4DvrLRZBGWJoC+r2lQYjyEHGI8BXxfC9AUblRSbUR8rVdwQf/IlINHogaB
+iwWVIJ2Po/GhxDSQHtSbYqwMRbSNxIfUXb7Yy/x0l/6WPQZbdjM+3UU5jTaJk3i2NZZssHwb
+KixFk4C1ga0k+Jd2gwwIiAJDE6DIbBvn5P7BKX9Orr6x8EHfcGx6HYbAB29HztpC6CiKGE3l
+6xoKbt3uKavtxJP4qXl32h89pxgBehHIrM3D0QQyzIMOAVfEUoRa+iIck7/9jBUAvE93MYCp
+/3WMERTokhXr2df9AVfcHxB4vPkMa0pRgodSfhGpb+mx987D6cfJHDki1xwBA89IxNCivUKK
+73Wu3fdjhcNp+aICBDwuQl0tPgh4nMeHH7/ieVIj6CyOfVkzOCa59NRlU0Ag59CBqjpcCDlI
+kqOXXP+xiyzfq7KorhY8OrueE40TcFRQCYo1IQzgQ1RAA5WgVIMq0SAJdajs7KK2h30jTEvw
+U3DdNubx8/GEjEYckQN9sNMlGJoYow9qOjGGGgFqQ3Vdtk9IXv/QrLl9vDaNn1N8p6tn2Ngi
+Aq3HAtWlJtTyL8bSQTUKDpRioZpRqE5mf3PUdMse/U9/pH+qwtgCVYi0M+jrEHg0vTXwCIos
+W4mD3wqTLQeio5PLDGFw9cuXWVukCSEBXxMyuBgNW5vANzQT3+16UVx1H0/noEn8AE7e87E5
+d/9MlC4bQCCWJsWAVwNZW4IBjEfipmTefvx0zNw2CkMUMM0i7j8aLKm4r03jYEkc2SWAtUUy
+awNTi2VtJsKzWgH/s5e5RYX+6V79T3czvjvGCA50zorzfNLduXnAA55Sdv7VKFRkJKyCwLPM
+v+EIDnlZGCXjTYRoFwvPcrvo3qSClivGAvkHAQoHDFn+qRd9cMBLSFx32GtFfi84rbJHSQke
+G1si4mrVSZFYesJbCYIBqnUtZpImI5otqel9shbfj1WCh985XOhFba4MPMJegocmBB4whxxX
+9SZdBzfGP3bF8wwq8MhZh5NXPH7YbwiQ42/faS2DHGsFj2e61+IwVCmaIkFTRWiqEE0TAdUg
+81V1OXr6vNScxt4X056BGSgCC02XaJBDw4R5/cMzPHExmhgON5VoUIUoCk+dwEURw3xCs3ue
+TSVlN2JpfA0SX/+GuOluf9O9pzdsIzV0wtEELpYCUEoIdSuAb3zo412gTuZ/fdTi0z2Mz1UM
+tgLdLQMPzHWFFg+4mJUvP1cl8MzjbyvZ8pXLMuEcnf1zMFQJmiJGwdaWLa+SeGo67GtW0vrW
+ntsdL4wsAOPx0HSRJj00t7St68morWu8mm44hgwZTYMKdYphyKzY1PonA9O+rGwUiYOigEPY
+jj6pfQNTGQWtZEOuug4LS+RiqdALwlAFaAq0BEh5Viv08x+NX1obgMdx/aBA5+zYTQQecIwL
+OA4nTAKLwgAcv2upKOVvAsBvi2SQwB1L7f3irMvLXPcqYgkcjmyZp170weEJdgFswE6z4Cj5
+eGXzr4KcKEfuKMFjA0tJZaebfy7ROE5VDxS20rcUgCtGk5lENUtOSG8ZHZt6d+BxSt3vuLrP
+cUzwCTWfC4uBB/h5ChV8XpN9QtULAo8z9nuP3vjbd5qvRY41t3gQriWhqVwsmYuicNEkLo4M
+KclQ6B2UVd/yuK2z39EzGaUThCWGY0lQfYchBnKEBY+fjKRkNxmZizVJoILja9MkVs6JqXmN
+j56ORMRW4knhGBIXQ+Kr6YXRTUQlVe33Hg0KYyqMzaO0SSI8iYcnsXFkNo7ExlPC1UnCbyHw
+oG3dQ9+qor91F2PLLqjFI/bn4AF/3IFyDw7MuNqRAusEPFz98zFUHqAvDWBtChdL5OEpXAMz
+KV9a2vHoeUlNB9NUBFmbxMaSeShiqB4jLKegpatniCUsAjgB7IYhCoiGEZHJNfcfDXj4panr
+hGAoHByJD96dqm6IvXti6/2nt1r7fMOyaUZSTaIQB94piYUjc7AkliaVe1Yr/H9+NNyyh/bZ
+Hn0EPKAWj57NAh7yNSYyC/zCVwZvfOvg8RYFhnAEJxbCw3a0n/xTIxFTl3nqRR/8ODl84SXg
+SyNtJuC/udR0ckpRgscGkKi4In3jADefBEfvbC1GjKquWOYL8TZmXtOP0zVON2QEZVqhuzxP
+rVA9Nf4BwCOSsnP5ZP50IhS5FBW4+zD9i2+OHbrsdg7PuqDNO6nmowAe5/EyIIHB46zDvuOW
+K6QOoLaekVevsRfqR1u+/Lff/H6RXUZs45sp4Ns5p6g1q7Als6A5p6gJaGt778TUzOzsfNWt
+9uTs+oyC5uyipqzC5rSi1rSilrS8+s6u/rn5+Y6ugdzi25kFLZX1j/uHJ2cByTzsycypTs9v
+ySpoATVmelFLam5dQcmt/sGR6fn5h31DRZX3MgtvZ4JrFbZkF99OyGjUM5R8e9hs6x79LXsY
+W1SYW3Yv3tUijwRwEEX5XLEwzhJSxsJl42rBA5xNoSG6/8XoSr5VlwcPN/+cqMTanFcWyMpv
+KihvfdgDufcPDY3nlTQn59RnFrVkFTUBK6UVt6YWNOcWNw0MjU/NzTe0PAavILuotfFu//js
+bH3D3bSs6gzoVM15BS3ZBS1phS1pOdVVt1rHZ2bHZucBgeSWtGUV3s4AFypqyS5p4Ugrz2sG
+/d+9hlsA4O2BTP1TV8vmAA+4uUOh7wMOtdFw5yeHc/gTXmG2FLhCBxuBLqyIwRawXZhSu0xi
+uBsObEdWFDpHkCwKbgY+dplmBBg84G6RRXth5LcvBA/4qRV8ThZ9cDhkuoLIB3tfbaOHcjjt
+xgMPpP8OaFb53aX2LvXBCPIP+JsgLA30irFAIXMiPYYLFS7/FTauoWF8Genre8ERZOiQ3Y1u
+hHoGplq5ZGCokWoEyZtHHcfSo89jg3cfMbe/uA95769Vp4P/B/yJBOd+tXwyL9QJGXgEHD5v
+89dvjx+84HTggu3+K67HVL0uaLIWAQ81rzPoVYPHD+csPzu+iP6f//rs//n/frtw+1dn7G44
+pz8ZGJMz8KxM52ZmJydnphYN7gA2gh1TUzM/3zg9OTM5Mwv4YpGo54BipqFpdMEu6ChZCmjx
+fGSWcSPim/1mW3czt+yR6S7Gp7teAx7g8wrJwDCEyM8nLl/FIJOVyx++TM84vAvO4fLlKrgK
++H5UKL3lqzBwcviWlgcPF/+crt4XCuacm5+ZnpmYmp1eNFz8jCwm3vT0zM/tCTBvZn7xtzM3
+NQNeH7A2/Crn5169kbqWJ5fwAV/sNgZ23irz4/0Oci7dROAhH5B8Xm6ONrBRfmYTuOJWmMEN
+mUhFIbPBdS6yC8mi8BQtcGL4JPI+HgpgMP/zaOogs8EJlpoYDjkD3LghX+PD9wN7ZSwDHvBT
+K9zDwgeHky11A/JZfZm/lRI8Njx4IP13QHVuRi+1d9GyEe4KRA5HVCHxommQbkH5G4D1XTTB
+3bvf4+4dRTHwi00s9Q3Jum6bekVXvDb8wMKRuDRZKsfMv/pB78vvdezP73h34HFI1XP/JfdT
+GgH/2on67C97D15yOytr34DB4+RV3/P4cGhFzfsMOujoasDjn7tJZLPwVYKHvZlLVs/AwiE5
+c9Pzc5PTc7Oz8wtAYg7CkrnZqempubmfMAPUnmALAiNzcoeBmhWqOmdnZxYwyYvhWaZZ1DcH
+b2zZQ9myl/aZiuHWPYwtu6mnMddipZ5tjaUKpRxCs8hcmci8XfDMnnApDdMIUhpPTs0g4LE8
+CctXE3CRDrdyyL5SJ+QvsRA85Ge7WBI8AnI7ewcXWntybm5qanbuJdYpWBtg3szM9OTcPDJ/
+HECL6ZnZn78SBFQAAgJrQ1afU3h5dc1PLuODv4BaPChb9+p/tofxr+P0oCDn7BivJz0PNgN4
+KEQvR2pY8E7lS0v4LSuAh3wrB9xcAO+Ci004Q06++gMsGsFDHjzgae6RNjT5yWdB/jT3T5cv
+k5cBD3hFng3gQCLw9uXBY2FU1YUPDm6A7Bi3EvBYeW+LEjw2NnggzkUrAQ+YruVhA9Y/HbZb
+LXjIJ3h3gftAndjY/EAozQX4YesiYYlKyddjL2oJ1Ffs+IGhQsihpsc/cNb+2x2kL7fp7Tqo
+HxiW+Oz54MpvYxU+Hup+Z1CBKuedVM45ntEIOHrJZfsB8hFVz13HjY9c9riAZ13U4rwJeOw4
+QI9PXnwYyFI+Hh0P+w1uJkck1Kfm3E7Jbk7NbsnMg7Th9uPBMfBRPVddfy8hrT4puyUptyUt
+uy0ltzkprzEltbG2sX1qdn54eKqxpTsj905R9f3uZ8OgzO189Dw141Zyegs4W3JOc1p2a0Ja
+Y25R0/OhCQA3dx4+yym6m5x9OzWnCZwqLbc5JrlJz0j87RHzrXuon+9lbFW5tkVF/887CCeu
+GsUsAA+QkeD254Vfi3ApilQrIKVCsQ+DB9guTx1IYzhQuOJQKMPl5+fqfjoof4m1gYerf44o
+tjYlpyU1uxle5hW33n3QPzE7/2JkLLe4GZgrKfd2cm5Les6d5LzGpKzG9IzG9ke9gDKePh0p
+r36QnttW09w1MjVT3/QgMfVWSmYreGvJwJ45zalZrfFpdVV17RMz8y8mZ2619qTntcqs3ZgK
+rJ13O1xUeVEr+IsfDbeqUD9XMdiyh/H3g5QAf+esOO9N4lyq0B0gX8MiY0CQul4BPOQFnATJ
+CXB6hV4G+eayRcFDAU4QWoC3I43V8CGLdmEg/wI4W8pPm4sw9vLgocDhiz74ysFjGUZSgsem
+Ag+gCsXvUuAB8p58A4V8Pi+91blw0kbk5DBpILowzdsaO7aUDA2P5+TfMrEMu932qOPhM5ao
+HEORXNISvtbvFCCHbJiq2z/30L78Xu+b7brmNpz2+6uO37gq8DglCyB2UZtzWsN/xxm7A5c9
+T6MCv/7XuUOX3I5q+J7ChwPwuADAQxMCj7OY1YHH9v201YJHZ9dz3evxaAIXpcfR0AtXJ4aj
+iVygegZCJ7/UkpqHdzqeefllXdUKUyOwrxL4akS2ml6Ad0DGna7+klsdzt5pJKYAo8fVovDM
+7aLi0mrvdw/EJFVpkdlXdcM0SKzL2sFMM0nZrfttD57xRGVMk0gckYsigKuwMAQ2UBQpTJUS
+/u1Rs627DD7fbfCJiv4nO4h/30e4dt02WeLe2lC0aFeLfMsDXNzBzbzyRa5CxlNo9F4GPOQP
+RNKDjdvRfvKXWBt4OAfkA2tr6LE1COFXieEaBBaGxKOaiIMFhU33ntXc6rpuHn1FK/QqkXuV
+wLtCDMOTg6MSqu/3vUjKbrxhF6tD5WF0uUSmQBhTdvdhv29Ihrp2KGRqIkudFH5ZK9jZJ7X1
+wdOqhkfgrZGYYiyR88raLLQeC0UJP6Md8MVew627DD/bw/xkFwmlZSpmuaVHuPR1b4oAYgoZ
+QL6G1bSKhOtuhAcUwAPkFvnJYeULN/irDexFHEWQnj5wKgQJFMBD3r1T4aLysU+XKkXl8Rvh
+nKDIMuScKwEPOP0yDw4eRAkeSvBYLXgo0PKi4IGMn1pht8hKoOK9gcfLFvvBsbr6Dp4oa+DF
+WG3DA7eAvKsE0WUd0VJ+pxha1Cl13237DL7cpvvl9zoEmldl9Rqnr10DeFzQYoP1g5c9jmv4
+nwIrF52OqXp/+/2lb/donrjqe16TfVGL+3bBYykB4KF3LVWTIoVia1P5KJoIQ5ECRZHEV/XY
+enRRQkrD05FJX3auBpGDpYlRRE4AK//Z0FRc8i0ijaehx0FBAzaFWLIEpcfHEoKcfVMe9U9k
+FbVp0vgYMs/AIqLtwfO61scmN6UobS6KJEBT+WgaWEqgIB5QFAuBOpn77THTT1Tof95J37pD
+75iaoZO7S5TII5bnfLthcR8P+c86+Y9N+f6URVs84C7sZQyyFHiAlc7Hz+UTKAAGcubXDact
+wkPWFsmsLcRQJcDaGkSBuh7byCymtuFRe8+gsU20BpEPxZmncNLzbvc9n/QLzsYDMiRxgPWw
+4FgiIIowYWzV06HpUEEhhsTBUYRg6RaY8WRoKjGrnsjgobT5KDIfQwPWFsqszcNT+Xi68KxW
+0H/vY366h/HnHZT9F5kSoVcU1ylF4vq0b7N0tSwFHv7SUvBm5VsP5PcivpRLzTkLz2i/A+OP
+bAGHIOHT4S4VBfBA+vLg9hP5i0Zm1st/0CEdi0uBB9LdI9+CsRLwQB5kqQcHt7dvMefS+Z87
+pSjBQwkeCFqADKPAEouCB8g8yMalQsqsc/B42XHQ2dfQ1Dkp84isrO20dEq7rCO4SpDIR/yA
+nEhp0YcvOH+1TQ/oFYxdWmblm1x0beABeAPqW9HmAv7Zdc4B7Nq5n/jXf50/ftV33wX7oxp+
+J6/6vB/wIBgn46DoUmI8VYKjSDQpQqA4mghFF2NIAh0COzW7rvvZhKF1lDqJY24b3ftiMiGn
+GRotS+RpQrE0oUnfZCGqIrAU0VXdcGe/tP6RaXOnJG2GqKjqwd2uF7TrInU9LhT8CoozJsLQ
+RWjANjLa0aJJ1IniL49YfvwD4fsTZMZ1Kz7fJ1rkHMm2ys8SDL54shAJkPIcrMj70sM1PpwG
+LkWRorX/xShy+PLssSh4wFcB4CF/CcSFD7n0inw8/ApwsllUAH4Ag+PJYk0qFH4NDYyjx2Ma
+8Vvv91be6sbp89AkTigvf2By3iMkR12HjaPwNaFQ8xKgWKoUmFqDGBadUtc3OGXhFK9O5Bta
+xjzsG8ssvI0lslBEAYYuRlPFwNTA5iDbo+CoZTTpGTx76x7DLTt1D16hBwS6RbAtEyK9H3bc
+mp6e+nALavAfXOHEH0v5eMy/8guS9z5V6HGQf62wS8bCwu04OVxh6BPcOoc4HiscBTcygDyp
+0MG3cFzA8uAB50bYoxW5gRWCB7j6Mg8+LxvVsrC/CR75Iv9VizT6KcFjk4NHaEyFQu2/KHgg
+kLDC4SfrFjxg6e55/qj7ObyemddKMYnRIEkx1Ch4Otcr2pwfT1h9/YPe4TPX+eLssbGJNy/0
+VgQe4iIF8IADiJ286nsGG3JM1VPlvPORqz6nNAL+8vWRv31/CWx/D+DR8aBfxzBWFgxTgJNN
+oSJrheDjaAI0XYzSF2qQBQZmwu6+keiUejSRlZDe1NU7TDGLUCODb3YpqAo14SCcVKhOBPgB
+fV9TONmFrayIipueqc+Gp/1DM9UJLCwd4g2whCcv0wRf7jRQOUKEo6bH33bU+BLWyMfbJUHk
+HsWxiRV6NFTlTk3Jj7WZl2/llu8NhItNZFyh/MgXJH1VUxfsH4IUyEv5Hcknk/9ABlfZjvZb
+9BJw+Y8MtFkePBy9c8BTv7I2MAXU7IMFRqOLgLXViRyvwLTBkRk771Q9fWHLvf6iqnZ1Ck+D
+CtGdbIo9OOQpNPWbBpVPuS7q6BpIzW1RI7GF8TV9z8YMbghRZB5ibdklwNvhQxelg2tJTmOC
+vj9MJdDMOaEeMTz7kuyYgWePN0+RruBaLF/DDo9OwKUWkrUUuiTkd8Efa8jIa+SESH8NUlPD
+4AFfdCF4ILlUfugKSHzNKwX5CYjoteAx/6q7XD5jrxA8YGhZ6sGB2IZkK4QLgwlHob5Y+QBG
+JXhsbPAA32jIunxb31LgIf+PkA8UqZCjkPTyowyWSvP+wQPIyMjYw67+vieQj6goovTweber
+uoKrBOHBc45/30X+apueJtGt98nbmRtxheAhjig+jw0/hQo4qR54UZsnBx4+FzVZRy97bDth
+dUzW87L/jMX3+0lQHA80FEDsnYJH39Ph69ZJV/VY4AMZC5GDCEWHFCub2BRUXiiaFEfml9d0
+Nt19SjJgt91/XlF9F0dk4SmRmtSIl/ORQbHQwQc13PQhUSeyA1g5ablNoqiKZ0PTBuZCDEUI
+8QY0cxn/1dwuUIULxfAki4jMQOubTiKuRyzfLoJlm53Ke7LKeUPgpo+l/g5vK1MtdYlVBaIM
+F5aqE9gYugQHwYMITROjYWuDdWBtqkTfJOLJ87HIxJrrltLRyXkWPwetx9OiRkLmhQwokGGb
+RNY1JsGQw/NL7tx/PEA2YNc2ddc1PcZRwmSNVwBOBD+3NtS9haPyaYberq7OUUL3aO7NzEQW
+NNJoM4m8C8TCGlZheOnCLglk4DZ8HnnnUrgMvGDAX5gYCT++EDzglpOFpPrFWRfEK2mZ0azy
+dwufSr4JQt4DBC6N5Rte5P8ayz9499NBJEoqogsLdgV8UoLHpgWP+VfDyZEOl4XgIe8TIp+X
+FAa5KMDzokNaFk3zi4AHLM8Hhnt6Bzw9Ig+fdj5+3vmHfYZffq/75ffa18xDn/a/eFtXqaur
+A/+j1/6JevtemNnGAszQYQp/PGV5DArcAcCDc0LNCwogdtkD/LyozTmm6nEKE3JJh/9+wAPI
+495BG+cYtC4LSxJjKCI0VQopBfCGBEfhYWhsDRI3mFeRnHdPh8lLKbgXLizBEFg4igAPJRah
+KBI05BYClkI0hYemiFAk4Q3HlHBxhV9ocWr+PV0DCYoqwlAEGCofTRGAdVC9oihiHJmrTQ0z
+swllh/nEC1wj2Y6xYt+mxrKpqfENXKSAz2oHt3iULhdLFmOoQjRZiqJC0wHjoRYkDprKwdOF
+KTl3g/hldDNpWUOPhUMshsjFUwRYYFiq+JW1xWgKH1qS+AG88oyie2SmMDbtNltSjYZj0b+0
+thAFxWYHh4hwZDaBEebgEiTmeMXzXaQsx9QE9gu5nqzNIwr1o3z9Ozw6qYCXCuAKDgQFGkIR
+8mO64UBh4P0iGACHFFMYkLLQYQNsWciu4JsRPuEyWLswaJ7C3SJ7EV8R+S0K/UHLP/gyT4T0
+s6zQwUMJHpsBPOQRAo60r7AXaWdTgASkZXsZqJAHYAUyXw/gAUuR6XFrdfUz56x+2EvTJruX
+lDX/UncyMzNTVnm3+lY7ge62/5zLSY3gs3jWqas+rwKIhV3UYh9T9Tx0xesiHDJ9leDx/V5K
+XNJaZlV7MTjGFeYTGSF69GCiPgsogRlKYIQSmSEERpAe2M4IIYOf+qEkg1ACM4QIaSiRAake
+M1SPATbKlrKf0Hb9EBIDHAuWYGMI0SAMOiF0thA4mS4zxNg00M87QML3iuTYSzl22emivu6H
+m6FUefZ82MUrXpsaoKcfSKKzAA8QZDaRWSwYmBoYkAQZMJRkCIwZTIRMB1kVNq8uvCKzOUn2
+UsCrIejL3oh+qMzOoT9ZG3ovIQSDEEurwLAg/yiBWwTbJkrgWlacOjo8uDlL9ZW7IihlxTg9
+ufLmDiV4bBLwQAatgC3wdD9LdbUs2qb3xVmXNbRmrB/w6LRXAa9PqHso0H29lDaFpa0YYqil
+S8qBU9cPX3S9qMU5/rIBBBpFe1GT9TJkugw8fjxmsRLq+Ho7YfdhRuwS4MHhcLy8vBbb81N8
+qc6HfZERQgk3BFJemJgXLuGFSrihEl6ImBsi4gSLueFCTpiIGy7bBRKEvVoBW8IkYJ0PbwyT
+gDQccGCoiBsm4oRCybhhr5ZAofPHSkLTYvxSYzwKsvjdj1o2W9lSV98ijRSIOcHASi+NxoNM
+DRmNEwIZjRsu4AADvrIwV2bhl9YOf3UIsHOYmA2ZWswNFQJr/5QsTLYEJw+R8sMSIoJTY3zS
+Yr0qS+KHh7o3ecH+5jPyKEVeiHaxqwpPrQSPzQAe83IdLvKNFfKNG8uMatkY4HHPcMtoW+H6
+eU3Pnw/3Pn1hYOJ/+KLHcXV/WeTSl+BxQRZAbFXg8c12ohrO4c69R/eWiEOyVBwPRVvdqy5I
+FwAtyhAWZgiLM0XFmYLiLGERpCLZT3FRpghal2khWM8QylS2IvtZnA1tL5YdDlKCXdCBsvTR
+0mA3d2cHF3s3N8fkWHZOKq+6LGV4qH9zFi89j2+X5kQUAmtnCovShWEhXi6udk6u9h5eTnnp
+AsjUWeLCV6aDrA1bOB1aFsJmzxZBx2YCU0PWlr0OcfFPh0DrcMqCDCGwdltjydTk+LxSlPKL
+CvgOAiVST0+P0hQbGzzmFzhmyO+FA+ciXSoKXZBK8Hh30vGg39Ej2cAs9OB5lzOYsEs6vNWC
+x9c/EL7ZQTqnZtn1eDkXxxWCx3sQQLn/ttsSZIzPTzl3vhp8pBRvUfFHh2yBWT46ZKecXny1
+sn///l27dh1YVhZWc3D1t7zU1Sl2H6Slpb32KJBGETJ7eg6sQJycnBb+c18rTCZzoU3U1dVf
+e+DCo8ANvPaotVly4aMpZTOAB9LJsuhepNED3mXikwZH7AfY8KfDdqsCD3jiRfnum4UzOSrB
+Q15yixqPXfZWJ7D2nbGHXD5eRS6FJ4lbCjy+/kHvmx3kPYeZgWFJg0Ojy19i/YDH+OT0F2dd
+4bzxt/NuA0PKD/D5pMKWT487AoP87oCtCydfaZDVip2d3TuqLpXgoQQPJXi8CXjM/zwu+mvn
+alnziJX3M0ncRgKPqanZ+OSa5MzqqzjbgxfcT2gEX5BFLl0aPHS/2UH6dgeBynS737Gi5sr1
+Ax7QG+l+/tfzbnDe+LuqV2//0GYuZIKiyv942B6Y4jc/WmNuSJSlrlKUogSPjQQesO/xamen
+/dNhO0AO8kFslOChQPsrieOxEhFFlahpBzMthLuPmpxUgyKXLgSPr7cTv9lOxOm5Fpc1Xbhw
+YdGPnXUOHjB7bDnh+HIqwzMut9o2qbujVWAG3KL42x+tLxkJlEWuUpSilA8RPOblRm0v3NXz
+dGiZvcjhyMxZQJvu9i51/kVnEJBPoDB4XAker5WOzidlVbcvaDicuup/Fht85OxPPh5w38qR
+syaSqLypqZczpHt5ea3ETWu9gYdCu8fHR+yFKbWbqmwZn5w+o8/5/UFbuK1DSR1KUYpSPmjw
+UMqHCx5Aimo7/u9xp9MaPhc12cfOO0Pg8YMuQI4f9tFcvSP7nymGXwCX/te//tXV1fVhgQfM
+Hn9X9fr33RawU6XqNeEmcfkob3z4xVlX2Mn2dwdslT0sSlGKUpTgoQSPXxA8wLewKze/7Fan
+KLLsKt5333Hrr7fr0Y0Dmlo6lzqkp6dHR0fngwMPIIA0DhPCfrPXClTBoCL+5JhDREb9xs6Q
+/KSaj2QNHUD/fNRB6U2qFKUoRQkeSvD4ZcHjZ/XywKhfUGpBUcNrU6alpamrqy81R+e6BQ9Y
+mG5JHx2yg+vi3x+w2Y7236heHwCrfrffBqasz085lzc+VP5DlaIUpSjBQwkevzh4+IqL1xDj
+QiKR7Nq16/bt2x8ceMzL4uv+8bA93PQB9A8HbfGWEcjMFxtAEvKb/3reDWCV7Ok2Ub/Se5CK
+igprmSwMhglPpfRaURg2C86zkqMW/uvBltceBUqMhY/g5eW1/FGLRh4Gp3rt5RZ+jKzkJhca
+c22WlH09Dbz2qLi4uIVP944sueiLAzewkqdTMObaLKkEDyV4rEPwgEPcq5uK13Ds06dP/fz8
+QFZPS0ubnp7+gMADyPTMbFpJ2zWvlP8+7fIfKlb/Z6f5F2dczP0zJGm3uvpefHAZDzxOdcsj
+d14hziLio0O2v1ax+tUuC7CkOsXfe9iv/GO+Rdm/fz+TyVSCxyYHj7a2xxevOFtZuSrBQylK
+8Hif4CFfjsmPdgGlQVlZ2Qf01oAR/nHFC+AH3ADy0UHbz085r60h6P3LrbZuHeuo/9pv89u9
+1vD9/8deqz8ctLvhn65s5XhH4KGc+EMpYWEZO3cageV6vkk4RNu6Ao+gyDI4yCdYsuIq5Qvh
+pSYjXpv0PB0ClzioFwJU9ZpQPkbHexNwA19f8ngPAdU3J3gAAaTx5ZdfviPnk/cjdqE5/7XP
+BgkI82sVK/BTlFr3oGdgYnJ6YfqR8anyukep2fdSc9oSs9sSM+8mZLXGZTTFpjVFJzdGJTdG
+JDZIExrEcbdEsbeEMbcEUXW8yBquuIYtqWaJK8IEVSGCiiBeWTC7PIhVEhBe7Bda6BNS6BVc
+5BlQ5Oaf7+qb6+KV7+iRa+eZ7uSdHJlQMzj8E0gMjkw4hOd+fMThD698R6EAHf8/e2cBHsXx
+BfAKhbb8WygtlBYpVShWvLhTnAaJO8Tvklw8uYu768Xd3d2Iu7s7cU8IIcH+cxm63V6EEEJy
+gX3f+/bbzM7OSm53fvvmzXsnlQGBYMiBgQcmGHgA4eLiAv0F7YAH7G5gZmHAA+vPqSH52kDv
+PIekJ6BBEZ3gyeXgEDACGJLOfsECfMmYRCLHArQDs+Vi4EElHT1Dp+5Zz0tci/7+/qUerLix
+rQ8w2JfHAXIogx/tikOkB9MMuww8fJ6Q1egeXOHiD7TE3q/Mwbvc1rPEyr3QwqWI7FBgal9o
+ZJunb5Ota5WpbZ6hQU5XN05TMU5V0ktR0E8i6cQRtRJkNBKkVKMllWLE5aNFiZE42QhBqXA+
+yVBesTBukSAOoQAWPl9WIf+74iGCsiGixCBLp6zmjn+J4oKALYIcayesNIauyaNTMRImGHhg
+goHHooMHvZQb0inD6OVIkvrJ4DE5h+xkAfUvCtpNtnVA6kDnT6GypUwZ72vKI84mMhh6R8g5
+M1SersHZXO87Ax7zLrKysnR0dNNNeFkSAvpu59C8g6zkVSeUKxu6qLYOP3ycmlvr6JNr4ZZl
+5ZFh5ZZh5ZJt5pRJdkg1tcswts40tEzXN0/VMUvWME1WN7mvYhSnpB+joBtN0omU1YqUUY+U
+Vo2UUooQVwwnEENF5QJFZAJwUoGCEn68BN97wj5cwt6cOG8WPg9GHhd2vLugbKCwfJgwKVRY
+LlhQIlhKMTAkqvDpM8qZnOW1Abzx9WnVe0q+7204Vgw8MFlE8DCziHRwcDh7/iL05RgdpS1L
+I02BB+QBBC0AeFwSskfwAA0eoGsGW2EPDskkr+IBYrWA7YB1GPx8/Tk1qo5exiQSNMWvFjDl
+aUArBJInDjZ+kNUMHAgeERpkXqCCqyOFsAS0DE8MnCdiUQEK2iF7pSPR2mFMVOSSQWV4CHSD
+yHVNPjpNgQdMGjXZpepNBPRZ8/uZHBgYuGfPnvk9yUWRjp6hvsFH6JK6pv7gqFI733Q73wIb
+7yIbrzwrzxwrt3wLl2yyc4aZQ6aJXa6hVYaeZYqeRaI2GbBHkppRoopBvKJenLxOrJxWtIxW
+lAwFPCLFlEJFiWGisqE42UAh6UB+CX9eMd97or5ceC8OIS8OnKeIfIisRrSsZpSsZoSMZoSU
+ejj4U0o1lpHH0tEt8NmzcWWr2ODEMqwLwMADk8UCj11/0IGe/Zdtuz6YEB4BYQw8phOYmB4J
+Yw5623vKfhAwAEugwQMWAkKAkAARAmZ/A43Afh/040m59aC/3kVvRDVAA20p8ECImwdQsAsC
+LWAr2AQbhIlXoPMJkuEFJroFxwJb4RGRk4SnBNZBg2AJKsDzBM2m5DdAfoD+KlQXBddBOVwH
+K0jOF6qj0xp4TJbZZHicHOccyXp54NDRj7744fufds4y8SXAiVcey9HREbyZDx8+PKVH/VKF
+kO4hF690Re1wolYkSSeColrRRIpGAjaQVAoVUw6WUQsXk/eXUA4RUwZ/BhIUgsTkQ0RJwaKk
+IFFisIhsMF42UFAugF/C966oO4+U911h93t4j7ti3twE77sEL25RL268Jxfekx3ngScFaZql
+qBvGq+jHqhjEqRrHqZjFCauHXGAj//SnMI4gl58d/OjRIPb+x8ADk0UEj40bj0LkWPnFKrC8
+wy6Igcd0AnthNHgIagZCrw/Yj8N+GfTmVBYDaOiA2d+Qbh1pc/JQCxo80CnhENgAuALKoWEE
+ksPP13XgvshACagDtoI6oAJch+ldqGwpkC4gmcAd0UMtyEVBwECGmeBVg8apyl85TEM74AF/
+Wq8UqlclHLJ5pUwmh4SEhFfupaSkBGqOjo6CcxMQEKA18+McJCaxnKTuz8RryyzgxCzoxirg
+zibgyC7gyCboyibgzsrvqqofoaQfyY1zMba6zy/uwSLkzirkyiHkzC7kwiHkyk5Zf7lkFXQW
+l/c1tku8J+airBemYxTJiXNlx7lz4P9RIbD0uEvwIGpG6lqk6Vql6ttkalikcUo4/3GZuPFP
+3MY/BSXkVOOCTbs6mrD3PwYemCyKmJkFA/C4fEMcwAZ46XlGF4GlsJQyBh6vBR4v/hkZQQwC
+sC+GvAEV6eghAEBbwQzgAW0jcBiFCkXgOSAtAwUoggYPaGxBdkHXhPYNtCMKwiEQb2YPHvBP
+cDlU5cjRaR883lDma1bLdGJpaXn48OGl+6Ju7xly8U4HjMEi4MaG92THu3IBMMB5c+A8OCm0
+4MKGc7+Lc80rbk3ObRSWdG7vH1PUDmEXBptcOSlLD068OyfebUIpXMHCb+/gnto5+IRA9IpO
+qi2r7uLFO02AhxtlF9A+zh3syA6OIuxGUAzQtkwhGcRcZDP88Shh45+iW44JbzwiKEFUTwox
+68bAAwMPTBZJtLTcAXiw8+hzCsms/N8qCB46xtY0dZI0BR7Q2jAZPJBeHvbRyGgI1e5w7AP6
+QiBbpwQP2KmhnUsR8IDDPWgmgRgwGTwgvVBNSKECD6QyYo2ZDjzgRQGFuW5hOWQeDDzekhQU
+FOzZs2fyqM2SEHWTSDa8G6ugOxsgDSEvLiFPCkgANsC5cQi5s+FdWXGOItKeD7pG/CMK+PAO
+lfU9hlbxbDhPNgpITFgwJipz4jw4hCjcwiLkFJ1UXveg/x7exT2gsHNwVFTWjUXQlVJfxHmC
+PdwpiALax7mz41zZhJ33XSZtOITbdERs8zHxTUdENx3GSRBVEsMAeGAh0N8j8Jg5zTcmCywy
+MuYAPPhELC/cYNm45Vcjx1DQxfuFxGDgMZ3AMRR0r42AB4IKcCvs9CFgQKdNdM8Oe20ID2DH
+9efUJlMK1XRaZKiFypQBG5wSPBDHUSQSyGTwgBYYuAvingELkaEipD407MAGEdh4b8GjsKoN
+XDheO/itHqW/v//SpUtwCGZpibRyyF2CHwfOk2KywLlx4YG6cFKgwoMV58GG92Tlt3Pyyuge
+GidpBbDyOboHZAdGl7LwOrPjXTiEQQVoyvBkx3lx4j2Y+Z1k1QLbe8d8g3PZeJ1J6sHt/Y+9
+g3JZeO0mkMOFS9iDHe8JcIWdgiuuXDiPm7zWv56U2HRUZONxkY1HRSngcQQvQVJKDDfr7sTA
+gybAA7qmUyl8WaEn9E1XebqayEcT+uUJ16fz2MdkwQSH0wHgISrrsnv/sZ37jyno2YMuvqSi
+FgOPGQR24ogBJD6rFm0PQQcQg06kyHMBXSkQ+wPs0+G6gnk0lQUDCvQFBS1Ajw70JFbQJigE
+7cMpJIBqjNxS0KeBbgGcMGgfntjkKGdgE2gHlsMdwV6gELQPCqnqU10UPDSogPyJPvq7DR4L
+KQA8Tp8+vbRm2sqpBd8l+LLjfNhxHhz/DIhwCHuy4j0ZBdwZ79rpm0Z0Dj4Jiixkwzmy4N2F
+ZF2LqzsFCS6M/M6sOE82YQ9WERc2YTdWIU8mHgeclEdReWdZXbeorDurkBuboINnYPbA8FMj
+y1hWHms2gYlxHGEXduGXwzqAcG7z2v16WmrTMZHNxwmbjhJeggdROQGzeNASeCABVSYreHGh
+Z+jPUJmqJlhHTNCTa2L/iMUVJmY5AB4kzeCNW369cIMFJ6MJuvjhkUcYeMwg6ABimMyjYOAx
+syQkJOzZs2cJBVSX1QjhFPVh5Hdl5HOh53dm4Hdm5AXrzgw8dryiLvZuyc2dw8HRZVyCNkw8
+9kwCLgz3LP1Cc1OyaglyHsx8dix8Toy8Lgw8juxCdir6gUVVncUVXWIKXvQ8Dky87gy8zsz8
+tn5hxc3dI87eGQJizqw89iw8Tiy8zkx8jkx8TuyCTrd5nX87I7vxqMiWo4TNx0Q3U4ZaKOCR
+GIqBx+KIo6MjFTyjWQJxRUNsFOgoSejKr6yJuNLByoiD/UKGYcRkOrlyDQ/B45PlKziFZJjv
+EVZ+sYrWTpLWwOMFKmQ6Ju8zeDS29R3hsCB7L9wvAXwtnj592tLScmlYPFTDREjB8lrBilrB
+RO0gea1ABfVAFe1gB/e00oq2kdFn0feL5dV9iGq+Cpr+ChrBclrB2sYhnT0PG1sH7FwSlScK
+jayS49Nrex6OVda06psEyyj7yWsHKmkGyWsES2sEyKt7Rcbm9Y08Ka3rcvbMUtWOUtQMVtAM
+VNQKkFX1o+dz2npaatNR/KZjwpuQoRZo8cCGWmhD0OCBuGEMj4wh9gr0uC1SeeaaSPTFKUMh
+zWNKC0zmJsdPcQHwEJf3AD27mKLhhRssv/2+CwMPTDDwmI0sgHPpZBkdHRUQEPD09KT9+yOh
+6Gflkt4/+Lh/cLR38FE3WA6M9A0PP33x/MWLZ6OPH7f1DHb2P+oeGO0ZetQ9NNI5ONo+8HBg
+IqnK+NMXPUOPewYfjTyhRBodf/Gkt6+vq7ePUnNwpK9/tH/gURdoc2Cos6d35PHYc0qdF32P
+HnYPgfLhvoePCyu7OfAOW09KUwZZjoqhh1oSMfCgbfB48Y8r2ivBY8qa6DYx0zQNyt79dwB4
+CIrbUiazWPnt3n/s6KkLS/FCMPDAwOM9AQ8ooqKiFRNCy/eHoBhg75Mzqfjp02dPxp6Ojz97
+NtVOz549fzE+Pvbs+VOk5OnTsfEnYzMc6Omz50+ePn3y4glYRQqbO0a4cE5bTwDwENl0THTz
+McLmI6KbD2M+HksDPKAf+2zAY8qaaIdSbD7LAkhCQsLRk+fNnV/al9raeo2Mgsemieq89ffL
+ADxus6oC8LD1S1733eY7TOyTq4FGMjIq0SVPnj2nvCDeRfCAE68Qfaunza8WAGNrzG13GJUd
+bUsEJfC059zmdAKHR9GjqHO4sTNncsHAY/bS3t5+eEICAwNp9v6IKwZYumb1Dj/pHx7rHRrr
+HRzvGxwfHB4Dbw/w7hh9/KSzd6i7/2Hv8GjPw8cDQ+MDQ6O9/Y96BoaeTjDJ46eUHUfGx0Hl
+J89f9PaPdveO9g+O9Q2OTRhDRvsHxnr6R7t6hh89piRgGX3xrP/hWPfgeO/Q44GHYyWVfVx4
+l62npTcdE9x8XGTzMYkfjopsPCJIIColhJl3d7RgnQXNggecvQIL0V73k8FjuppoHw84k2Xe
+X4mYQOnv79/35wkY/3DVmnVlNRSkDwvLBmiRlzfFRBXw+G/ceBRsPf0XHuziHlX4yfIVciTF
+yTVVVb2kpBz+/e/n5fOJyAFVUFSikaQS8wgeaG8lKrSegwyPjFn6ZEyX2hUdnnTOzyzaVwoZ
+7pzZgQr0mFNOopmBOuBo6Zt4toAjIjFA3iXwYCV6LtbzDoSOjo5AINDm/ZFRCxYmBZDUQ0ka
+wST1QKJmIEkjUEUnxM49Nb+8tW9kLC6pRFk9RFo1WFYrhKQeIasdqKIbVFTd3DM0nphaTbZO
+UNSIMLKKi0+r6Bp8XF7bZmAWJqMUSFIPImoEkjSDZdVAs/6R9wv7Hj4pqe5w9MhU0QknaQTJ
+awYqaAZLqQTS89sC8Nh8RHTLUbGNxyU2HRHaeOAuSV41IdQUCyBGg+Ax2WWU6j02g3Pp5Dfe
+5Fkt4D32JlksMZks4CtCgCD35Vfrfvpt5y879m/+ZefJv249e/Z8BvAIiYiD4HH4xN2Pl30i
+reMM8MPBwWFm8ACfWuu+20SJr/6/VfsOHV++fIWv3+JPi55f8IDWuXmxeEzOV/tWwQOZ5z5z
+m68b1XzOUdAntzPDJPqlOKsFsEdHzyK/yoyMjCYnlKEJ8NAM5xLxZeFxZaLMNLG/w+8wMbHF
+jZHXkUfMxcY5s6ntYXhcObuQPT2PEwOf6+27dk5eacU1nVrG4RxCjmAXZl4n1ntOXIJ2Krr+
+OaUPiqs6JBV97nDbMPE5MvDaM/FZ+0cUNXYPufik40U9WXgdmfkcmPgcmPmcWHgdmAXsb/HZ
+bD0jufkIYdMRsfWH+Lce5+fgJ7rZG8Z463e1N2K9Bq2BB1rBu2LKOB6zrAkFpoGgqox5fcyj
+POgaWrVm3ef/oyRbYeAm2Polf7J8hbGV03TgkZOTwyssvX79PrB1284rADxWfLZy1Zq12dnZ
+M4MHgI3te4+JyhugE0wsemTFeQcPql8v6NzBzxUGJ4fdDTIzKyW/AV0HlkN7AqiMROWacpAC
+ggfY69Q9K8QEAVPCwcaRZwSG8kCfDxxVmYz6yPkjAzFIshhII4gREn058IgwWW1OaQvcBOOE
+UNUfHhmDJ0B1UaFJ5chpg0YaW/vQbaLfA+8SeNCI0OZMW1m1iHuEQE6cF8dEHA92vAc7zpOT
+ElPUk0XQje2ek4FRROfQo8CYElZBR3YhV5ykW2ltt7isN+s9Bw6cG7sw3MWbXdCTmddGUNIl
+r6ytsrGHQPRiF3TlEHT2Cs7vHn6iT45k4bFj4Xdjw7uzCruxCbuz4jw48W7cwp63eZx+PSP9
+3WGhTUf4z9ARlLR0vD0MfBxV74fbDvZ3YT+bhZeZ43igLRjobFZTWjxmrokIDGSExo95+YbC
+BEpgYCAAgN/3Hr3FJgiQwzk0m5VfGqCIu0f8ZPAAryklJSUZGZnftu347vvtYMcVn35++jK9
+jIaFlpZWTU3NdODBxYv/Zv2m0IxGQSmNz//3JQy0/t3mXwaHR94x8IChtNApWZEs9tDADukC
+9Kon71m9QIUShQMKECdmCR5gK52YC5K9BdSEs87hVthro3EIsZPMDB5IvhjQ3cMwqrAmFUjA
+6Kbw0uDjDFAKifIHgQddHzSLzk8HrwtGcUfuCaijah2HbhOeG1Vu36UOHv1Do6o2cTQyOw96
+fRgZGaFLwOO8mBYP1VBuMR9KPHNKKFEvLkAdQm7cOBd2vBsLJcyXKyuPnaN7Qv/QU3ndEGZ+
+B8+A7KC4Mno+Z1CBUhnnRQmWjvNgF/Zix3sxCjhIKvu29o76hhUw8DvLaYV29o+7+WUy8tiy
+4dzZRDzYhD05AKjgPdiEPDjw7lx4j1v3XH8+LrH7NL8AQd7Z3iDQU8/LXvV+hNPwQ0Adz7Fe
+g9bAA74Z4FtiyjkpVD4eM9SkEvi5hFTGgiHMl4yOjq7fsPnCDeaE0v7te4/9umN/dF7H5l92
+MjBLUoEHpA60HCdYyFgFIn+qqalRectD8LB1dANIY+4eCyOra1r48klS8CO3uPptM9Ur40W/
+JR8PdKo1qhjjiNsGug4shPlcYH2qoRYY1RMJBIrsBft6pBq0ZsAnBT4jcwaPKZPGotfhUcBj
+C+pDlvCJKaKKxjPZCgRTxlDldkETxSE2MrpNuAme0nSfJ5hz6ZsLgUBgYmKCMZpOnz4NnlPw
+vC8aeKgEsb+0QriBlQl1Yxd2ncii4s4s4s6M8xCWdm/tGPaPKOQVcaqq7zOyjGPD+XAK+Uwk
+hnPlwgEC8eDEA/DwZAVNCdpH3y9taB24K+rgEZTb2ftIVNaZDefKQcko5w5ansgFA+o7g/bZ
+cZ4Mdy1vs8vo6GoFuOn5O6r5uWjmpUWNj41i/QUtgwfyUoJv4Ckjl76y5szv9rmFVsZkOnMr
+nBXrGV0ECIFLWMHWL/mXrX+iwQNNHcrKynBli2SQUmQDgA2AHMhWtNcoAA8+fkPQppQqGTQO
+YIOVXxriB9ne621f1wLH8Zjs40HliUH158/XdcA6uhDdvU5OjIJYVNBNocEDSZ6CBp43Bw+0
+5WFya+j0BxA80M8muj7AJCRLwpRJ5ZDbgm4TA48FE09Pz8OHD/Py8sJh0C1btoCvkkU5k+yC
+RjW9UGYeOzYBD06cNzvegxXwg7Anu5AXp5AnB56S3I1LyDW3uC01txkn7dI5MK6iHcIt5MmF
+82LDU1LLUbK0ICM1OE9mfkd7j8zOwSeSRPe45NqSqh5uEWdKfhacG4zHTjF3UHK7uLEKuvGK
+OWhqm3rYGwW46ng6qESFOLQ0lWPdxJIAD3QEsCkjl85cE6bwpjo0ev4LBh7zKxzcvKvWrAvN
+aBSVN4ADLnsPn9u3TwCCR2RkJMIV+vr6L9dUVJcR7gPweDERF1FLSwupg3wrAfD46Zdzl29z
+Red1/Lpj/8GTlwF+fPnVOjY+sQW4qEUBD3QJFWnMYPF4JXhQyWTwgPsiLiILAB7wctDGCirz
+y+SjI5NTqMAD/cWxi95o8pAKPKXpjKIYeMyXkMlktAuWgMCiRbYBvxNr+1h+EQcWXns2IUd2
+ATdWoIIu7ALO7IL2rIK2zIL2JM0wRe0wLpyjjkUcn5gLu6Aju6ATq6Azi6ALi4ALZUXIkUXA
+kVXQiU3ASUTOV9c8jgfvJKceoqQdzo5zZhUC6sgq5MAq6MgysRenkB1R3sLaytzfVdfXQdXX
+xSAv6/7jsRGsg1gq4PECFRYM/bKdOYAYUhM9ygwtzMgIOFRsau38Cvi02fTjr8iAy8/b998V
+VVm3YS8ADzhgAUVXV9fc3PzlH9qGFItH+EuTSHt7u56eHlITeo0C8Ph+yx+AOs5dY/76203+
+iVU//b5/575jCxPKg9bAYwYfj8nggXZ+mD14QO8I+KSgbSOIt8Z04IFsBSszgAfSGnhOgSJH
+BAoKXwkeEI2Q9LvIs4/28WAjeaHbRL8ipnvqMfCYFwEv9tWrV3/wX1mkARfK++Hp0+cFxQ16
+Jl6yiiaKShZKKpaKqpaKKpZKKhZQifJmRJKZkrKlDMlUQZlS4aW+rPbPUpWylJe3IMqZKilb
+EBXIRHmygoq5kqrVy/rKFooqQM21tM29nE19XdQ9HdViI5xbmiuxroGWwWP9OTWoVJ8qKlax
+sBy8WPzjStCVZ67Z2NYHPnzAn+j5LODPn6/rgPdSbGYN9o+Yd2lubj7w59Fr9Nw+cWVHzlw5
+e0Pgmw079x84LicnpzSjqKmpGRkZWVtb29raamhoIOUqGto//LyHjp3454m/Tl28qWcT+NvO
+/QJ4sf6BBZpFuMDg4RNTBBRdArpmp5DcnoF/v5iqGrtACdkrHSyb2vqp6oAlWM8pbUF2hzUn
+HwvZq7VzENkFPBegPjgHsIIUtnUPwiOCQmQveCB0kBC4CRZSbQUryHU1tvbB1mDj6MsB1IE+
+mcn3BH0m6HKwI9LI8Mjjnv6H6DbhQcGDL2EQNt2dX3LgMfr4SWJuHbgu2jmlJ0+egAf58OHD
+VOwB/lz0UGP9/Z0PmqoeNJQ/aKx40FA5sZxYh9pQ2dJI0Qf/KiisoKz8u0SvVFDqN6DrU7QF
+bmoobX9QPfKwH+sRaBw83qogARWx4KULY/fYsOXXE3/dTCjt3/jTrmtcVh8vW37x0lWEJQBX
+GBoaqqioUJw6/vH0mFJEJGRXfLbyHB3nnmO3bzALmLvHLlu+Qk3HdCEvB8vV8m4Iv1rAzFHL
+luJ02syS5v4hGnVWTEhIEBAQQBPIIjqaYoLJwoMHJvMuGRkZWlpaFy9enPJlkpaV98nyFUQd
+u9vsQt9MTJgVVTBQek0hkeS/Wrth255jUrpu6zb97p9Y9fW3m67fZl3gK8XA4z2RJQcegDqW
+HyTeU/Kl8fMMDAwED9Gnn366iI6mmGCCgcd00t7eXjAh7u7ujo6OKSkpyKasrCzCVAJqTq5j
+YGDg+I+gG3lDgc6fADbAO+TAwT9FCJLCBElOTq4pKwsQiKvWrCMoUxLAbdl2UF7T9HXBQ1RU
+9Ot132/6ecfv+y8cPse0fe+xH37dufAvLgw8MPCgTaFZ59IpBbydENMH1fx08GL5YBYCnsTJ
+zb5yr9OnT0/eCyDQK3ec7lXwSoGziREBFzubvSZ/wXFycr5yr8kz/dE3k4mJCXuuMfCA0tTU
+BNDC19cXQQJ7pTCSgA54QK5d+pvpJgfzLQ48p5QYj7yGONldJ8ZDN9ZTL9ZeI8iQaG9EdDAi
+ORjLOxgrOJooOJoqOtlr+QeYJwVaJAdZJnsYR5qruZiruapK6RNF1IiiaiRRNRNV+0jnzCiX
+rGjXLD1Fi9MTcu3KdYgo2traAE7Kyspmc+aysrLgx0xSVGtq7+/oGwWaU1j5ww9bpqw8ODyy
+5ded33y78au1m4VFJcAD4oiSyMhI8KB5hkSflnXaI+3FYn5/i2QQnVEcVeBl8Aifv3QdPkSf
+/29VXd0ixErCwAMDDww83lzAa2f16tVUE9aQx3zmbxB+MUWgBpZuk1MQvvL7BbxtXkz4FSMu
+yu3dQ1uvKv18kSQpO9OOU5puQDnY6zqXwgVWeaBgBTby7SkiUFAC1qk+jiZHLppSJneIm/9S
+gQ3OIJNxBbmZWyYEe67fW/AAnamhoSHo5a9evAGePrBk/JuNl0lUjlfbTiEUUAdQB5VwR9Vw
+J7UIZ41IF80oV60oV+1oN50YBDw89eO8DOK8DeN9jO77Gt/3NUnwM03wN0sMICch4BFslRJs
+nRJikxpqmxZmnx7ukB7hmBHhlImAR7Rbdox7dqxHTpRbpr2ht4ORj56SmZKUlpGadaJ/QVJA
+YVJgIcAhSCNT5l/LyMj4448/1DT1IHgA3fzDD9P9KxMyixhZuWa4M5EVvR8QEj8QS7zjWAZW
+tqhmTlnt/v37Nh4R1bV1i/Lvw8ADAw8MPOYFPObWD06ZION18xQj855eoAJOzsHlj2peJDJv
+Cz0FbL5k/Tm1N2lwzjf8HRZRUVEaTCr05lJWVga+5clkMui7zcT9yBL+5pL+uiJOBA5FFQEz
+XREHK9kga7lgG2KwDSnEVj50scAjzjM3zis33jvvvk/efd/8BL8CBDxCXBJMNW1U5XR4uQXB
+T1dISAhcCxpC+PkFdA1NEfBgYmGH3xRzEMesdgp4EBK5PCrBcr1i+nQ1nz5btAjDGHhg4EGb
+UtnQtfKIPJEc9Z6AB4zkj4TQnyHf38zg8WIiRs0cwlYjh4YTt2FAfgw8MFkUGRsbc3d3l5OT
+A//oW1cYOW8J4JjllPnICHiYSwVYSAdYSgdayQTRPngkBxWlBBelhhSnhpakh5d624Uaa1r5
+OIRnRZdnxVS4WQX+/vsOiBw3bzMcOPgnJzfvdG4erxSlyAYEPFbLpYIVGvz/YuCBgQcmtAAe
+VMF70QFkSmrbpzRfwPmMk8FjugOBdmZGl8nAg8SyowKPyaNCs79euBcGHphQCZLITF/AQ1/Q
+k+eOmAyHjrGwt7GIj4mojynB11TM790Aj/SI0ozIssyocggeu3fuDY9JAtQBluu/+46RkXHr
+tm0bNmyY220U8K2G4HHVpmSLaiZYaR8ao7X/dUVFxSunAWLggYEHJosCHjDJ4JQ5x2E1JEki
+Ah4weDU6uQ86fyg6nTFaYAWqOL1UWyEnpOQ3oIdj0A1SHRemMECGjWD6IWQvDDwweTHhFBoc
+HKyqqnrh7F+XL1xX4bbS4/eA4GEg5GWI83rnwUNRSouBkRWaO7Zv3+VhG+xhF6CmoHPzxm3w
+I3/dsTOjxBZIHUDXkNJWSCWDlc0qGQ29S2/CHQYeGHgsvLxvQy0w6x9ieUDCUwMYCEksQ0ey
+ffHPsAgcE0Fn8ppMMmhTBo+K33R0MfNgCnrrRUE72BqS4hmdKnE6goIeOxA5kB0x8Hhvpays
+zNDQ8PL5a0BZr/MKMygqcVrq8Lrr8rm/V+CRElqw4ftNxZWNgDpUNXRZ6bnzEqrzE6sLkmoK
+k2oyYoqLUuqKU+tK0upL0+u1tbXj4+OHh4enu6v9j568pA4xynKFZDJQuC4bVr/kfiQYeGDg
+sfDy3jqXgk4ZHS8XqYZ069VN3VRZNtBYQgUecC8YXG545DH8c7p86LMBj/Xn1JBQdUgSMdjg
+DOCBJGdEdsQsHu+tqLE7892U5rspQ2Q10+R21brrqn3PTZvH7T0ED5bbnIA3AHUA9vh9285o
+vzQ0eBQm1yLgUZBcZUd2FcWJXzh/wcLCore3d/KNRdxKP5FIAstl4kmfSibDkj16uRh4YIKB
+BwYeVJ0+TMQD+QHt0QGgAj20ATYhKYqQOmgfDzR4IIiCNDidZWOWFg/YIPr00DvOAB6T28fA
+4z0R0EVGRkbKy8uzXxNSYXVSZXMC4KHO4azO6aLB5fI+g4eLecDePQdg+A52zntyYsq596um
+A4/S9PrSjIayzIaitBpDLbMrl6/w8PDAdG+IMLmUQ8z4TikdrqyUTtmgnPHhhNFjyY22YOCB
+gQcGHm8bPGB/TWUZgH+SPdPRFg+YWHk24IFYJGYJHq/08YCWCgw8aFNoLY5HWVmZtrb2+TN/
+MVziFqJTVGK2w8ADDR5H/zzp4RsMqCMuKWvbb9tz4ytnAx7lWY0V2U2Vuc2hPtEBHuHVBf+m
+/Vo1MYflM6kUaPH4TjF9DTFtmUTSFzIp4E/LtFYMPDDBwGNmWSoh0+cXPBBUgMMZcL2texAN
+HsguyFALlXPpdEMtja19cBOAOqrTQFxBQFPgHGAhWIGHmG6oBfHcgA1S0QUaZqi8QeCObwIe
+jo6ORkZG2HNNm+ABkOPyuRvXzt/kvS5DZLBUYnJQZnZUYXHEwAMBDx1F04uXrkGf0r17DziY
+eb8ueFTlNVfntwDwqCl8UFv0gEfeEtDF/2SSP5dOXqdAsXgA6viKmPqLRtbKCfCgsy+lnd8q
+DFeIgQcGHrTJHjSbJO4tgQeaAUDvDPtuHhU/ZLQFVoP9OCiEoTbg1pmdS0G1g6xmM0QnQ0+T
+QXSyvQI6l6KPizSIPivkhGELSFgz9I7zGxgEE9oBD/x1NYmbhgr0dooM9oqM9hh4UIFHYlDe
+hu83Qp9SY7L1jcu3c+Iq3xA8uC0zAF18RIj/VcRlh8p96FO6SjaVzr7kD71csL5cMmn0yTMa
++a1icTww8MBkccGDahYq7MFh9w2noK4/p2bpk4GuBme7IF05jDj6yum0oJ2Z45KhJ94is2Ze
+/DNPdvJ0WrCCbhAxy8Byqum0SFhUsISXg4HHOwMeY2NjkZGRIte15eisiTdtSLds5O/YYeAx
+HXjwsOPEJYmAOpra+zds2BTpnfLm4LFdjQIe64ipy8QSV4jFgfWNMlFXLfNWSqeskEoGS1AS
+WdGLgQcmGHjMIB09Q6fuWbuF5y+Js32rlv+27sEpy6ubumcfwgvUnK6dyTVfGRwMiV02JUoh
+gzVTbsUexncJPIaHh93d3S+cuXTrPBvhuh4tg4eZvDsaPCR4FST4FCX5FFnucLLe4ZISUAIq
+LaiEBg+yirO/ecL8goe/Q/RPP/0KfUp5+XBignLZsRVvCB6JaS+jle7VynKIrDmgnTVh/UhY
+LhpjmdYaXNrztXwaKGF1rcDAAxMMPGaQpeVcigkm7xt49Pb22tjYAOS4c4GbcNVA9oYVoA6a
+Ag99KUcVYWMBNnH6v1lOnz7Nys5VWNNZVNtVXNdVUt+la2Sua2ShZ2zhFxoXHJ1sbGGnb2Jp
+YGJZ86C/9kF/XWt/fduAgBAe7Pg33U12Rm4FgpalpluwbfIbgsfp4+cdXX2gT+kfu/amhBW+
+OXjo+FHms2xVy1hHTP1EImm1LGUW7Ta1jAvGuZ9JJX8qmbxVM3uGhHEYeGCCgQcGHphgQuPg
+oa2tDZCD8QKf2BVD6WuWMtetaA08rt+g4+DmJUgSyXbuIXGZ+dUdBdWdaPAore8ua+gpb+yp
+aOoFWtncV9XcV93ShwaPhvaBxvbBvJKa6IQ0LV1DQZwwCyvbm4CHl034qdPnoU/p6dPnjTVs
+smIq3hw8jutRuOIL6WQBp2LH6JqjE3+umJjbQvIpV/GvOG2U++GEScQtgibe/xh4YOCBgQcm
+S04KCgoyMjKw+7Ao4CFxkXz3gqzYJWOpKxbSVy0WHTyMJdxl7mly3uEPjM1OK3mQXtqaUdqW
+WdaWVd6WXdGeU9GeV9XxJuDR1DHY3DnY0jXU2j3c1jPc3jvc0fuws28kLSuPjxOnLmvgaR42
+S/CQECSlZhUC6nB09Tlz4gLM1fKG4FGa1wKQgxIaXTHtO/nUTYppa4mUebXr5VPprQr+J528
+TS1zHTH1q4nJtnu41AkEQlNTEwYemGDggYEHJq8lWByPhQeP9vZ2sQtm4n+ZAfCQvGQuedl8
+YcBDmkVv/ZqNU4KHIr8xMx3XpctXhMVlTW08olLLDCzdzvx1TV7daAHAo+FBV3h0vKa2LgMD
+I+NtFgNlyyj3zJnBQ4hfHPEpDfdMnhfwcIuqAUTxlWwK4I3LpnkXTXLXyFFcSb+USflZJf0n
+lYyrZnn7tLNg4SHdbCtz26tXrpLJ5LGxRUseh4EHBh60KaNjT3SdEgur2rD/HSYYeCwueJSV
+lQkJCd0+y7ko4PHl56u3b9mnI+ikzmcHwcNU3EecU+XqxRt3GJiNrd3jc+qSi1pSilrcgxOj
+08vXffvdZ5+vDIzJetvg0dU/0j3wqGfgUe/gaHxiipiEJN3NmyRx1RCnxCnBI8T5vqKKJgAP
+cUkiLwceyU77huDBbFUAB1aumeUZBVWq+5Xv1aI4l34mmQzY44Z5vmlYjWFoNSAQGE29qLyj
+srhOQ1VLX18fAw9MMPDABBMMPGgKPHp7e1VVVc+fvsR5VlrsvOnCg8efv59e/smn+nj3H9b/
+unXzbggeDt5RAngJW/fQxPzmxILmpMJmCB5fr133w0+/GNt4fP3N2h279y4kePQNjfYNj1bV
+NWnr6hWWlE8JHn+duZqQmptTWPnjlp+TgvPnBTxK8pq/nBhnIXqW7tLIXCaeBHjjjEEOZTqt
+Qpp9TO1hvewVkpSkLX+Z5h3Wo5SrBlZ2NPV2NPdlpeY/e7Y4kT0w8MDAg2bF1CO1sa0P6wcX
+RpJy6+ml3KYLL4bd8PcQPCIjIwFyMJ4WEDlrSDhnuijg8cmy5Yzn+BnO8n780cfK9yxE5TRs
+PKOCE4rPXLz+zdpv165br6JvBcBDTtVQl+xEVDNctfordh78yXOX1n77nbGN+wKDR//DxwMP
+Hw+OjA2NjA0/GovzyYn2zIDgYaphf/jw8Y6+0YsXr2krmMAkcW8OHkaBFZSZs+KJezUzrcKq
+6kvbsnOb6czz4ezaL2VSZL3Kais7C4rbtIOrPpeiIMpPKhkQPDpb+rpb+7vbBl5MRGLBwGOp
+SH1Tn7ZZkqldelvHEAYe894Pvg+5WmhHYIzT6dK1YDec9gVwwgw5019LfMxjeFjwzKfwgqe1
+Rc6YiJ41WRTw0OR1BLwhw6n7v8+/PHr87F0hqU8//dzY3v+7DZv2HjhCUjfRJbvKqOjfE5IU
+kpBftuwTnLjC9l17v/hylYiU0m/bdrByCwDwsHbx57gnICwugyPI8OPEbzGwBsekLQx4VFTX
+6eroK0irKkvrXLhwpbii0cMniMAvi2SnfUPwyM1s2iCfulwiic++cJd65gaF1MM6Wd/Jp+7W
+oIyqfEtMFXMr3aiYtl0985Bu9jfE1L8tC/brUCa8KAVUocGjpKBSV1vP1NSsqKgIAw/alNHR
+8dLKTjf/Qnmd++x4X3a8Hzven1PEX9kg0Te0tLK2e2z8KQYeGHgsjFQ1dgFgOHnP6iCrGdBd
+9EbQRhSaVE4v5XbqnhUACVB4T9mvsbUvPKXioqAdl6KPqnUc2PTzdZ1DbGSYjYVZ1gNUg9FN
+QR238HzQDlgBSvZKA0tQH1Qrrm6/LuIEo6+D9lPyG963G/4+iNAJQ9wJQ/xJI+FTRiKnjRcR
+PKSYdD9d8SkvTvyjjz4ydQw6dPT05i0/+0TnfLxsmaGNd0JeU2J+Mwu30KrVX+mQnZYtW7b3
+4JHzl//+8edfceKk33f8se/QUQAeylomASHRHX2jVQ0dh4+esHDwXjCLx8PR8ZHR8aqa+h9+
+2AKODs4BLyiBJIl7c/C4Z1dIiYUukXTbPN8xsrqupLW+tK2yuPWcUS60eACV9Sprqel6UNtV
+Ud6hHVy1e8L94xOJpKqabgQ8etoHezsG66uaxAjigoKC7e3tb/s3RpWrpadvRNc8RUEnNjmj
+4ck/cd1BV4WAx0C623v7PI6NPY1NqhVXjuAihLILB7AKeVMph3AAFyFEViMmKaP+6dNnNHXy
+GHi8k/0gkogNBgsFN214ZAzeOiRqOsxmC+o4heTCcpjTjV8tAJ3hRcYkElYD66ARJOcLqOAe
+UQAUHu6GqNMLVGB2DDzeJWlqajKQdqQd8BCiJ3744YeRmfVfr13PyiNCkNP8+OOPgxKL13+/
+8ceft4YmluiSXb5c9dWqr9ZwC4iBJR0D+w8//rJq9RpevBTAjluMHGjwAMrAxKaua7rA4MHD
+y6draAqOXlzZiL83n+CxdmKiyjpi6h7NTDWfcrvw6jsWBWuJqRA8NiikGQRXXTTJW0tKZbcv
+so+t43UuWUdK/WZisq1qUBUVePR1DvV3Dbk4ud2ku5mSkrIwP7mRR2Mh0RU4uRAOkUBOkSCg
+aoYJBSUv5xR0ByrVSf/S6UF4Pj76fj6Sre2DSnrxnKLB4P5MRg6U+kzcvUAN48TCsnbaOX8s
+ZPq71w9CNgC9P1WIcmTQBKayhQnaQDUIHlQpYhF4oBpqQcADIgdSQiJHwWaRbLkYeLwbUlBQ
+cO70Ba7j8jQCHnqC7tyceAAeFm4RR09dWLf++5jshk0//MR6F+8RmvbVmm8++OCD5ctXfPbZ
+54raZHo2ns9X/k9Z1/ybtd9+/c26mwwcu/YckFHShuDh6OrDK4CHUcoheywYeGRk5eza/QfE
+nus3bsoSFOcLPMyDKN4dv6tmRCfV3yTnrZRO/lg8CRCITmBFalYzdC5trupIz3sg7FYK2GOF
+JCWiqYBLqV5oNdi6UzNrSvDo7x4uyC0C7JGenv5Wf2/Pnj1PyWqU04jmEg1BelU2nA/4kw3n
+a2qXUdfY+54/ktV13VIqUYA6wG2ZkTq8/717BHj30uuaaOLuYbNa3r1+EKLCZLPDlHlmJ4MH
+wi0zgwdV2tz159TQbWLg8W5IfHz82dMXWI9LCh7TpxHw0OZ3tnQPX/vtd/sPn/SLL/xk+Qoe
+vGx4WpVPdE58bqOhjfdHH30E2MPCJQjOagmOz9+85eeNm7fgJRTWfL0WkIlrQCwEj42bNksS
+1S5evo6wh4ae6cKAB6COuKQscNCAkOgTJ09lpRVkRM4PeJyfmLryLTH1J+V0SbeSpPTGupJW
+k5Cq6+Q8SjwxscRPJZOO6GYD/MC5libmtLTWdWcWtkl4lm9STF82EdS0sKJzSvAY6BlurGvp
+6ewfHX1bdoaSig5N00QOkQBO0SDwtT6pA/XlIoTeFQtw8s7v6n74Hj6PbR1D9h65nCJ+HMKB
+s0GO/9w9vC+3WOhdgr+zd35n9/DiXshSBI/CqrbRsScYeEwniMmCyuKBDJpQ1X9D8ICHI3ul
+v7c3/F0VSpa3U5e5jioIHNWnHfAITasNS6/Vs/ICgKFqaC+nYXby3JXYnMa43EYAHpx8hE8+
+WQ42yaoYINNpOflEz1/+e9/BI/sPHbtKxwin05raengExeVXd5jbef2XPczeNnhYWdsxsbBD
+cwcgkOycvPEnz7ISitIjSt4QPFJTG5ZLJH0kRgmTLulakpjWUFfcCn08TEOqTk0wCSW4h2SS
+kGtpQk7Lg9ouAB6t9d1ZRW1EvwoYTd3ufsN04DHY+3Cob2S4f2R8fHx+f2zNrQOWTlkcwn4T
+3+Yzfciz4/0BfgjJBAdFlj8cGXvnH8PnE8vunoeufoWCMsHchFB2vN/rUsd/7p5YGJ4YGhJd
+sYh3b8mBB6AO0M0JagZi4DGDID4egArgqEp1UzckBKCWPhkIMwyPjM0GPKARA+3jgbZpgK2H
+2MgvzYATB8LAg3ZEVFR0Dm6BhoaGF0/euHtEnf+IHu2AR0haDQSPiMy6M5foVq/5Jjq7ISa7
+AQGPrdt3f73222/WrT9x9hICHqnFD1R0zbfv2vv1N+tiMysnx/Ewt/+XPf6+Sa9navv2wONB
+e+evv20trmwEx1LT1MMLi4yNPwXg8fTZ8ze3eIg7FwNyuGqSG5VUx+9QtFE+bYd6xmHdbMAh
+18l5ZqFVEDzSc1tkvcp+UcnYppZx0zJ/l1bWJsV0YfeykAzKWIyUT8UrwWN44JGNjc28uJv2
+DTzyCCjikQgEOME26y51wnMyVFIlIiGt/gmNeU7OuwSGFYrKh7IJA+QImDNyTOF3qh7d2NKP
+gcfsP+cx59JXfKtGFED2QBRyAnQcRUZbYPnM4BGaVI40AiBkSvBA3EVgm6DaYt1wR0dHIyMj
+DDbQMoc4HuA2Xj1Bz/unNt9hPdoBDxyDnG98EQIewckV56/cRoNHcELx55+vvHSd/iYj5xdf
+rkKDR0hCgYS8prmj33Qh0y0cvCF7AAUrNs4+bwk8hPDCgDegT+lvv23t6OyB4PFo9LGosHhK
+aOGbgMdPSpQ093ZhVQA8hJ2KAXj8opK+VzOTCjxqytvJETU3LApWSif/ppb5lVzKJbN8y5i6
+pvqey+SCC6b5swIPK1smJqY3YY+2jqGo+9UipFBusVB2Yf85dKAv/U6NEvKLW2GbA+luPaGa
+75jmFDxw8syUVo0Al8zA5zkv7AH9TqVUo6vqejDwwMBjvqS9e0jGJBLgBL2UG2LigJAA8AOU
+gyUszyltAaiA1BkeGQN/ouEBTsKF9hNk6/B/zXR2AdnwWGAT1RAPJksOPO4eUuc5pM33py7t
+gIc0m87Va38HJJUj4BGZWR+VVY8GD2kl/dVfrdExc7ZwDvpk+XJLlyAEPGaTJE5d15SBiQ3m
+TJlgD995B4/UjOwDBw9B0wonN6+pmfnjsaeIxYNEkjfQMZkzeITHUZKz/E86+XfVjJ+U0gF4
+UA21XCe/DCC2lph6wzzfPKIGGWpxiKunsyxYR0o9bpALlrMBj4eDj2ysbRkYGAYGBl7fyjHq
+GVTMLxXC9ep5GbPwnJzwOzWxTa8qKqvGf41Mtn03NIdvfWx0hoy8nYKai5FljLRaJCOfF7OA
+17zgB6doELdoQGdhAgCAhdR6xT2VGHhgln9MMPD4R+4d0OY5qMN7SJemwIP7prCsqgF6qGUy
+ePyx788PUELHwP5a4FFc16Wh9y97XLpCYY/5BY/jJ07CObxxSVm7d/8xOvYEDR75+fkszKzZ
+CSVzAw9F9xLIFdo+5dUFLTWFD2qLHkDwiE1rvGtfBLPTAt2nnbVRIU3MvSwjvxWCR1tDT3tj
+T1V1F50VJQaIc2LjbMBjZGjUgmzJxcX16NGj1/pNOntlCchEMfL7MgvMy8f7P36non4mwsKl
+AmveJfCIEz+dL/JLCIldnKDNJ2ysrOVhaBl3l+DH9MbsAZiNRdDr7A3NdPxWwAALqRQ+xK+p
+IXy3tHw88NrBS+JsCQQCExPTgh1ufPxpb/dwdVl7YWYDbWpBRkNJXnN/78PnzzEioDnwqKmp
+ubtfmzbB49pfdHa+92cAD2uPiC++XLVu/Xe//LZ9284967/f+Olnn8Vl174WeJTUA/YwQ7OH
+rYvffIGHu5fvlas3XvqU7vojMyuXCjyePXt+7dq1pJjMrLjSOYDHHbO8NbIp8h4lv6tmbJBP
+FXYq9oqpkfcs/Vk5HaiCV1lOXgsEDzidFoDHJsW0HRqZ2sFV3smNHA7F60ipZ00oKWt3ambN
+EjweDT/WUNcAL7rXmuqSX9JiSA5X1IkWkAqi5/VgFpyf73d2vB/ADzlhvSixy7USmxe4M31L
+6sB1Fq6UKx4NUBYUENDQM/a1ckzglQi4dddtjqYPnA/HxNjW8YsK2/bdS+X+doFpqlp4bRXu
+a2w67dKVJ0+e9nQP15S1ZyXVxAcWRbhlhztnhjum06yGOWZEuOckR5ZVFD3o7RkGL1vsn0gL
+4EHJwHLyMtcBNRoED21el/PnLwSn1swAHheu3oKGDoAcn32+Eqx8+OGH94QkXhc8Suu7NfX/
+ZY8jx054B8W8OXh09Axs3vwD9Ck1MbdhZeN49PjJZPAAPbins392YskcwONHxTS8QxEMmS7j
+VgLYY5l40lpiqohLcVZOc0NZW2N5OwIezdWdLTVdGfmt7HZFq2RTQE1AILqh1U0NvbphlCEb
+56SmWYLHo4ePlZSUSSTS81l/TkTH5fPiDIkqTnqmwZpGsZwifnd4PFgE58X04cMjGXmb28HX
+wWOBhw/eksb7/OdCWguSEiITJInWlvYx+uYJTPwed+65v9ato4RVx/neYLU4eEZq234e1gt0
+5YQfFoWpGpT2vrch4JaogEe8q2OwMLMxMawk0jMXwEaEc2aMW1ace1acRzYtazxYumdFuWSC
+cwZnnhpdXlbQ0tU++PRdd02nZfAoKysD1MFxQJE2LR4q3FY36G7PAB5W7hErV36+fMVHO3Zv
+3Xfw2KXr9EdPXQD4seLTz+Kza18XPMoaeuQU1XkF8DCgOmCP4KikNwQPgrgUSVENNvjrb1vr
+G5unBA95eXlHa9eclOLXBY+AqOqPxRKVvUqvmuSulUu5Rc5zi6qpLXrgF1/HYk0JW/qXcS7i
+XJpX+EAzsHKHeuYmxTRxj7KkvAdtDT2O8fV0VoXrSKkCrmUwktjswWOwf9jTw6ujo2OW7AE+
+l4pLGhTUnLgF9CTkbCzsY9UM4thw3gy8nm82WcMPgMfZG5q7D+PMbcLe4Yf6fmKhqWVQb99I
+Vl4jSTPiNrcrPa/HLJDDl13Y7xaX3dG/SNsP8P2+n1dBRncRmWoJUUdjW98RDguyd8b7at94
+3t0+XFnUlp1QE+dTEO2WE++Rm+idBzTJJz/ROz/RZymo9z9Lr7w4j5xot9xY74L06MqqkvbH
+j55gqLDA4DE2NsbBwcFwSOTuPi3aBA9FLvOZwWP/4RMfffTh6tUfbN68fNv2P77+Zt3HHy/7
+dv2GDz74gImTfw7gUd7YgxeTkZAmIewREp08Z/DIzi/auWs39CnlE8Rr6+qPjI5PCR7a2toW
+JjY5KUVZsa8HHuf0swF4nNDLNvQvL8ltpvLxqC9tsw6vBuyBxPFgsyuKymhGnEuhj0dHU29V
+TTefS+knEwE99CPrZgkeoyNjjx+NjY2O9/e/xvTMJ0+f1da1a+l7kq2DbRwi9clRkspht+66
+Mb7+xA3wFQ+og47D5vB5uW37eLYfuBcQkvpuP9etbX3hUTmpGRW9/SPhMaWipOCb3K7T3To2
+nC+HsD8Dj8upa6o7Dwls28977BwB3PZHjx5jb8jZyNJyLn1zefToUWFhUUlJWVZ6YbBvkqtt
+tINZmL1RsJNxiKtZqLt5GFC3payUSyCHuZHDnE1CHIyC3W2jk+/nVlZUl5SU5uUVFBQUjjwa
+mf3wMebNOwfwIJPJ146ycO/VolnwULtre/HSlenAg6huCgdZVq368OLFD46fOnSVjukOy71v
+1n0LCj9etizkfsEcwKOiqZeKPUKjk2cPHuVVDfXNHRA8rl677ujqA31KDxw81NM/NB14wKEW
+CnjElc0ePPwjKaaMHWoZX0onXzXJNQqooAIPq7Dq6+S8LyfCp4OaJw1y1pJSeRxLYORSNHh4
+JDft18k+bkhBlHXyaW2t/a8FHm1tbXMw3tbUtWvqe9wTMnTxuB8QViwoTfFemKXzJOxS79x1
+OnFZacdBfvAVz8Gnl5ZZ9u4Yt6ff9HDkcVFJQ1NLN1gffjjuFZjPI+Z7k9sNHfSVDefDIeLP
+LOBx4ZbuH0fx2/bx7vqTV0HNub6xHXs3YuAxndTU1OBvy8vQ60jd0ZK4qUVk0acoqwFKDRdW
+DV6pJDYjeXZjebB8fZVjNhCj05Rj0pWh15Zj0rt7RTSvIK+mugYDj7cEHoDtKIMse1VpGTyg
+c6lHVO5k8PCKzP5y1Vcff7xs05afAWbs3fvB/gOrvtuwaeX/vti99xA96z1QuO/Q0bmBB1Bh
+8f+yR0zyLMFDQBC/7ttvDYxMXT19Lv/jU3rs+MmIqFiYJG5K8AC9cHZyEQCP7Pjy2YPHOX1K
+Unvb4MrK3GZD/3I42sJsVaAfUI6Ms5iGVFWVtG1USIMBxPIKW5X8Kn5RzQAq51vuk9zI61wK
+nUtjclu7W/t3alLy1WqE1rwWePT29Lm4uMzhV/r48Xjc/QIHl8iW1v6a+i6yfTKbkOctbjeW
+6f1O2SY8JJn43M7+rbX7sBD4it9/Aqdj5PO+Ddr2Dzxsbunp7KJMam7rGLJwSGER8AA8Bu4P
+u7AfgJArjCb7TxK27efZtu8ev6hJXkE19lbEwGNmqa6ukWLQ0uG2NxJyNhR0MhRwUrxjqkRv
+hqj8bRM5OoOFUdItI/Shp1RlBrLU39qiV5QlrqpJXVadrOJX1cSn2QR2kbyhqcpsAS5Ti8vG
+FOcucFEmJze7umq2TwoGHq8FHsPDw+dOXmTaL8m1R5PGwYPtbz5NU+fJ4LFr76HPPl+5dccf
+n3++8rsN31+8+JGh4TJVXc0bd9hA+YZNW+4wcwP2UNG1mBt4VDb38eMIRAVVGPJr3/6DyVnF
+swEPb7/gnbt2c3Lzrlq1OqewEuzu6Opz9foNJDvtlOABqAOCx+yHWvwmzB0rJJLy0htgdtqo
+xDp2m4LVMimfSSWvJaYIORUlZzRB51IEPKBzaUFxG96t9Cu51E/Ek35UTlcLqqqq6YZJ4pyT
+mqDRo71tYPbgMTz0kJGRcc5JbEUJkgzM+MiYXMAOVTVduuT79DxTeU5OIAdgkkv0hnuPi/y+
+j+f3/fckiDbllU3v7WPe1T3Y1NwDIASss9y1uMFiwSLg+Te71Z9nZX7fz/v7fh4GDvWY+3nY
++/BNwIOV6LkkzvbN+0HwsS/LqqMv4KjNY6vDa2eEc1ZkMFViNIOqQG8sw6yhI2y5AKorYiXH
+qUW8Y6DESEZOYLKqMJkLXSZJ3NAg0OsIMOsJUimTrsRtHYnbumCFapMAsy6BXpdwTUXrrq2J
+qKsGlzVZ3BN/g5ibl1tThVk83gp4jI2NMewX4/pDg/bBQ5RJmYsXTwUefnGFq9d8veLTz7b8
+vPXzlSullfTbe+irm9a0dN4z9cr0iy1Y/dXX3363YfXX3/7viy/9ozPv5zbhtEMQ8Lgj6T4b
+8Khq7rvNwGJCtgHwABDiyLETKdnFrwSP1o6+VatWwVCocILM5s0/1NQ3zwY8XiuOxzk9irmD
+wzIfgIecawmMHibhWpyY2lBb9CAmpUHAsRjwxmGdbP3Ayg0T4BGd3mgQUnXaKHctKZXXqQQ6
+l/qnNjHaFq2SSZH8J2T6S6NHWO3swWPs8XhRYTEdHd3rRvaAwsXFBSixta23sbkbTndz9c0F
+7MGKyt4y4UHqe53F/OBpSdCfAmXn0UlKK8aedCDtHf15IW4M7KZ/3dA5c0VlxyHK2NNfN2Td
+vONHH49h9+cN2aOjZ2nExpwn8NDV43NUZiGrslsaCDmhwYN020AdZxxikxhslfC2Ncw22UjO
+Vva27ivBQ/iKAvG65nFlu9WFFWtyy/7VvLLV2UW3+Axu4UxXZxWCP9FbV+WVnlCyk7ympsVt
+q8tnR7pjYoRzFf6blJefW1Ndi4HH2wAPjl3qnLs1lgR46PC5Xjx/xc7vPpXF48CRU3/sPwxU
+Skk/PrfxloSppc9+c69jApp+tsF5V4Ss9x4+8/1PO/cePEJ29MsobTsvYBeRXgPB44Kg/SzB
+o7ql7w7jf9gjNbvklc6lx46/DBcG9/r1t63KqmrTgcej0ceB3uGvCx6J9ylTX5dLJMm6FP+q
+nMZpXRAUW1Od3zLZudQzrvaOZcGHYokT0U1T6K0KXePrJzuXdjT3SflUAPzgci6V86+CRo+O
+9oHZg8f42BMSkZSTkzNn8HhBcfx43lRbX5WZBNaDI4vp7zpSPEiF/djx/jc5bY9eIG4/AL7i
+ea/eIvkHpTx58hR7zBGpEvjCg/MwP5PkmSuKJ/8SNyL7d3X3Y7flvZJ5AQ8ZForFQ1+Qoob/
+tXjI3zGSYVc3lXM0kXV422pGdJLn0Za7rf9K8MBfUZC9qXOPXf9vgjmdKEoJ5n+LkPGMujhm
+vb9FzOj+u/VvUXOwi8QNdU0uG2NRFw1uazMxT/wNDDzeoiwh8IC5Wti5+WeIXEoyj2Umeifm
+XdB2OCptLA/A4yyfraRRJJ24m5BWsIVfjlN4oaptgrV/jmtkEQCPg2xkEb1QUb0woK8Ej5oH
+/VTskZZTMjN4SMuSJGVIEDyAAgjZtPmHXbv/mBI8HBwccYLCrwsejOQ8wAafSSbfNM2NS6iD
+Qy2TwSMsqYHVpnAtMRXUBPUP62ZP51wKwKOzpa+2vkcvovaYYe7yiektmmG1rwUelRVV1tbW
+z18/SuC/4DE+2qxztoBndWWo/cORp9fpDa4xmNzmsjt1VRV+xR+/QLC0CxscHMGe4sngAbRU
+dq+5bWRmTgV2Q+ZF+odGVW3iFjH/6SKAB7OOgaCTmbi7KcHNCO+iSG+K7ugV6I2Jtw0XRkm3
+jZRnpA7E4iF3XfMU0XJtSu66hKx/NTF7bXz6bR69O/xGa2PTwJ/orWsTM0+SrCSvqQHwsJDy
+MBRyspTyxl0nToAHNtQyz9Lb28u6S3lpgYe+gMftqyzKupbTgcdpXhu/+xUKFvpneNlP8fDs
+YzHdP6EOofn7Wc0AeOC0Q4DidSg6B/ConcQe6bklM4BHSHj0/oOHQH26W/Trvv0WIIcQXnhK
+59K29o6bdLfiwpMBdWRGzzZXS0hUFQCDj8UT18ilHNfN8o2qpgKPxLQGKbeSn5XTt6tlqPuV
+5+S1THYuhZFLC8s6pgQPGGV9nXxaVWPf7MHjyfhTfT39hw8fvu7PMjAwUElJCax0ehBgB/rA
+U7awuJGezfjyTf2j52S37efZc0RATce9+UHXm/z+HR0dT89CCgoK/vM2rqmZzV6RkZHUIyDt
+7a/cS0tLa8oX2sxCIBAmg8fVX5Yd/mHlK/el2hGcwGyubnJaQFFR0de9ky8mIha+ci/wb5rh
+TiYkJCzkOMt7lasFAQ9TMTcTUVcq8FBkMJW5oy3HpEtk0lsAlWXQId42eCV44K8oyNBpc3Ab
+XJew+lvcEq03COaiDLp8rPrXxSyoNoESfraXFg9zSQ8DQUcMPN6eyMvL0x3kW3Lgocpjc+mv
+Kx7hWVOCR3xu4w2Ci4ln5sjozy9efFDaYKvjnPLjVZ3U4gfn+G3TS1vP8dtllrVZ++dA8Hit
+oRYIHuX1HX9dvubhGwzYIzWrcN+Bg7XNXRW1DxxcPCeDR1tn/5Vr15lZ2e2dXKrqmmB22imH
+WmxsbB2sXLOSCinmjvjSWYLH2QnvDnaL/LLMBpugij/UM26a5dmFVuZmNmn7lv+pnbVRPk3A
+sTgmtaG+tG1K59IHtV0xmS3sE8HSL5nlW8XUNTX0IkMtwVmtvR2DB/RywC4sDiWvBR5kM3JL
+S8vzOaVG6E+yQ2Jrj7VXgZLGpm5z65gbjJrS8ral5Q1z/tlzcXHB9wMGHksdPD744APIqBh4
+LDx4kG4bKvLquRuEuOkFv2111w+xVnYXvaGsPAsfD4nratvJnqvySr7KLER0dXbRmsTMe7dU
+TijarMoq+Cqr6N+tWUWr0vP+FjSUuo6Bx1sX8P48d/Ivtl2qSw489AU9Fe+SfbzTpwQPq4Cc
+fcymCXlNV/AkeqnbN8XvSRpFAnUIzUeDB6AO64Bc79jSg2xkj+hiz+ji9JIHswSPutb+ioaO
+i/+wR1xSlrK69o6du48eOzGbJHFTgkd5RZWYiCSgDgp4JBbPMjutsU8p4IEvpJITE2phyPTS
+rEYmi7y1xNQPxRJ/UU7X9a9A+3hMBx7IUIuMT/mPKhlg32sWBejstEnFHSsmBmjC8tpmDx7Z
+Wdm5ublzMHo8qs+mJPKYoI6eUE2kvLNrMDQip7au9U1++Qh4vPNDLfWkHe/2ZWLgsdjgoeum
+H+KqF/y2FRzFStlN9O9XgwfuirzsLT1JNlNRLrIoJ5WayTOYSDObgJXJm+SYTcX/Y/HwEbom
+l4uBx3wL+I64cYiLfaf6UgQPAyEvB/XgKcFjL7MpBA+P6NzMkt/zKtZXNRt6xpSwKfiyK/gC
+8MBph1j555wXsMuuaL8p4SqiGyqiF8qt7D/7oRYYQKyy8V/2wItKqmrozRk8ysqrLl+6HOgV
+TgGPxMKM6NLZgEd2Uu2PihSEkHEqhJFLPSOq9mtkXjXONfQvT0tvJLqX/DSRG07eszQzu2kG
+8EjKfYB3K9ukmH5UP0cntDqntIPDsXiTUrqUb2V+ZTeMXCoz4WX6m3pmZ9fQLMHj6fjTtra2
+2QdRh/JksKNO+hfYdbZaMc/7Lx8DDww8MPCYl6EW6dtacow6coy6C6AyDNoT02lfMdQiek0Z
+f0VB8pqa1BXVySp+XU1imk0S19VFr6lg4PG2RUhIiGGP+NIFD2MRb2Nhb3uf2MkWj9O8NgA8
+AH5IGqqf4WUffPhFdGbUj1d1LHyzAXhY+uXImEYdYDUD4KHtlAzjeHhGF78ueDS0D1Q1diLs
+ERASPSV4/CWT8ErwuEl3y9zIOjOxMCuhMD2qJCOybDbgIWpXAEhgm3J6dGy1kG3BBlLqH+oZ
+buFVVD4e0cn13LZFa4mppwxy9AIrqAKIaQZV7VDPhAHEsora0D4e+eWdADw2K6Uf0MsxiKqr
+auj7VT0T7CjmVzV78Hj29Blgj2fPZhvOCzqUwn6zQXn/s0cDGHhg4EEj4PG+OZdWV9VI0Wvr
+8ToaC7sa4VwMBJzlb5oq3DZDVPE2WeGW2WRVnG+daJOseIescPs/J0ClimB5y1SOznBuKn/L
+RJ3Vmizmoc/naCHuI3hJNicvpxqL4/Fm9g10Bo3e3t6zp86z7VRZuuBhiPPSE3K5dYXxLr+w
+T3QO2scDgscZXtvEgubj3KL0Urcj084fYDXRc0kB4OETVw7A46drOucF7JRt4t8EPBrbB++n
+5uzYtftB1zAVeADegArejcj6lOCRcb8gITI9M6EgE1BHZEl6ROlswCMutgpONtmikAaQA4BH
+THxNeVZjRXbTdLNaHKNq7lgUfCmdDJ1F92hlrSWlstsVRWc2TzmrBRlqic5v43YpWyefdsKY
+Mn3mU8nk1PLu1wKP2f9Qu3xlYKdZI74RunYsUfDIq3hQ3dSNgce7BB5LS968H2yobyDyaagL
+mmjgTIGq40xV+Axno8po5V0YNZhQyhFVeF/qHBpRFTDSFiWr40y0RMjS3MplFWVNjbMNSEgg
+EJiYmLAfHlqo4nhYW1tfO8TBvkNtSYOHsbC3sYiPsoCZJE5BVJykZWznF5MLwcMxJF/GNBqA
+h7ZzQkiSoLz5mcKqgwQDsortfQ37JOuA3PCJOB53Vfx1nJN1XZIljCLnAB6+QVG79+zl5cdJ
+SJM4uHh4+YUAeFiGVAHG0PUqk5IlDT583Ds42t0/AvPIgHLbiNr2zt7QsAhjE7O02NyM+/kA
+PAB1pEcVpkUUp4eXzgY8oqMqf5kYZFknlzLBHqkX9LNF7AvJAeU5aQ3TgQccaqktbdulQTFc
+mIRVTfbxoAKP2vresJxW9dAaHteyvTrZH4snfSpJoZ3vFdOTyrpmAx6tD1olJCQGBl5tuBjv
+e9BqzQZ7TI+/P39L1DF78DByS/n5ug5Y/vsQ3bMCOsujbL9lcIbXerqtBZWtZK90DDyWFni0
+dA7wqwd4RxW9J+Dx9OnTgYF+RDo6uhvrW8uL6wuzq7MSSzJiizJiChHNBBo7sXyVZqBWMlAr
+GVPVnFxnPrQgI7ogPWZCY4syE0ry0ysqShra27v6B/r7gEwswLU/nRCMH+YLPG7/Icq8U+Hd
+AA8TUR9Tgq+jRqihiuWNa3RMLBwxWbUJeU2J+c0APJIKm5OLWupawdvpg/Ena3MqC+YWMn06
+iwdVADHEygGkuLavZ+DR6Nh439AoAh5AL126rKWqlxydnREPqCM/OagoJbgoNaQ4NbRkluCx
+VYlCHfRmucWpdQnxNTJOhd+RUmHO2c8kk/AORfeT6qcDj8by9sO6lIkw3gn1M4BHSGbLHu1s
+2CbQTySSGO2L3VJbBnqGxfwozh6rZFNqHwzOxuIhJCSUlJQ0NDRTvMcngx2gl4TdZSTfLzCO
+x+KCh7ZDwvKDRLBEswTQsfGneRUPhkfG2ruHLH0yqMwaSbn17hEFYCsaPEBNWI5UJpGjQAXY
+DmIhmdwaBh40BR7vm4/H4MBgTET8/ZjkUL84O9NAM20fUw0vcw0vSy1vGx0fG913R620vcF1
+mev4+rlFp9zPjI9JigqNiwyLAQQyNDj0ApN5Ag/W31XZtqu9S+BhKuZnIRPgZRplZ+ge7BwP
+FA0eKUUtfUOnwYtq8OGRtwcekCvSSzs6+0aQFyOQ9p5hNHgkRWWlx+WnA+qIz0+LLnhd8CA5
+FYJ+/xvZlPi4anSSuLDYalaLfDj+AnSrSrqKd2ledvNrgUdjXbdVTN1fZvkIcpwzzSfH1qNz
+tXR2De2eYJI79iWzAQ9tLW1/f/+Ojo7pfpzPx0dbDK8gfaUANystg0dKfgMop5dyg3+CdRmT
+lzNnAWmAP2E5Ah6AKJASsBXgByhcf04NrCPtg9bgjmDJrxbwJlc3/PBxcFQ5HmdFFFKNkqbD
+wOO9BY83l8rKasFrJKkbOtI3dWRu6iowG8kx6MsxGCBKZDRcSJVjNEAffUr9p7LBXJTeQPy6
+FrhYyRtaxNsGHGfx2TnZVZVVLzDBwGN68DAT9yNL+NurhPjZxALwCHG+r6VgKCatYO7oG5tZ
+lV1eMP5kLXhXtXRJvFXw6Oh9OXu0eYCCyr2DL80dRmQnWCEtLg+AR1psfkpoQVJg4WuBR2x0
+xdeylOEVVdciquy0cDpt9P3aK8a5y8T/z957gLVxpYvf+z33frv3+d8t3/9uNutNdu/du8lu
+yu5m0+zEiZM4jh3b4IILLtg0m14MxnSwqab33nvvvYMQvYvee5FAQkL0KvwdcfDJWBIgMAiw
+531e9Ixmzsw5M4zm/OY973lfIiKHUw7VzsntW4JHXFH/JQ8SDGoK9L/0Smwzulu6aHA6LUd2
+2pJW2n+slYysGNkSPAIDAv39/clk8tLSEs+bE/l1dKr+bpHSgSKXHmTwAFBBoU0hqIDWD4QN
+cBmCx/TsInRHxJpBsBYPWBh8gvWAYcDyzuweLNYqsaxP0yRDSj1VXDVeUi1ZXCXWxa+8b5Dx
+qj7WeEb5wMFjt4Q9q+WWtZ1ckLNqqJNqiKPy2qyWG65IDa456F6xFYSK2OpdtV+r1A3bAA41
+uemucdFc9fwTzfMm2meecKuGkKmGEO9NYJeHF83M73q5PAizkfH3UI9SFNKt2Y5zKS6vM3i4
+a8a7ayX4GCZ5aie6aEab6dsq3FM5++M5cSmZsJiHADzYUcV6U3cdPCBUUOjT4PIGBoeX1K+/
+4BdnV4NutDCpAhYoya4tyaojJpMK40nEhPrtgoeYa82/ifi8+yCVI0kcBI+QsHJPP2J7zWBj
+9YBVTOvnlhX/fs4JDcGIepISCD0c4EGoHpIOaPy1TjECld8blGhGt3V107BxPDjAY4oxq5fY
+yS78uJTOmN0cPGJiYhwcHAB4LCwscN+ZzLIwFChsuj71GSZk+gEED4ANEDzQemjlAAiBFrCF
+0aHAMjRogE+wxi2qDC6gI4BPVAYdhH9p6RizcimSeJAo+SAJpdK7qxwLIERGIzEioWFich5/
+DL6sBaCP+p/HDfXdsl4f8GBnp5UPfCrlZXHPhztXi664hYtuoLPOnqurXvBjGRu961vnalE+
+b6B92VJBwvHWQ9/b6i+qmo/aLbsHtx3AAsemW+o+YBeNi6aW0r6OKsGmdz1d1CO2m6sFl83B
+o7Ky8tLn919t8PDQTgDg4aWT5KWbFO2SkxpK8HEI1VEzjI/9iO3ssfTLlr7UXQQPm4haABVa
+JmbQuKGuqulk4cOmjqQq8LUkuwZSR1F6LSG+tiC2jhC3DfBIiKoKCykNCy0LDyv7T8XUn1/x
+/UrcMzKiIiqyMjqqMia6Kj2JhCwemmZJWOfSvwhZG0Q0v2VYirjit3rFcDrtbZ/6P2DW/0a3
+WCKgMa96mHtWC0/woI1PwwGXpDrK5uCRkZFhZGQEwGN2ljOpysJQAwoURks0QmBwcMADDaN0
+DtAgHmwXPOTNEqBBA5bhCR5gGVQEjgkVOX7wI2O0Gf/IWim1eCn1lLuYBL5IxVXAplQ1w9Rc
+YtfSMgt/GOKyHfBgZ6c1uetuJsEjO60ZOzstIcmrYK81zZfoqOvDZ3Zadq6Wx75vVDa+WUr6
+Scvq3yiuuS5jd03R+Y2iavAVu/W3ZaSThj4oO62hqLOjcth2s9Pis1o2B4/k5OQLx8RfH/Dw
+0U8OsUqPcc9NDipICy8kD3wF2IO18nNS6RMbE+fLF0Vk5JXMrJ2s7N2sHNzjMwgJGQRSBxkL
+HqV17anZRak5RWm5xem5xXHJWY6uXi09IxA8AFFck3eCyDHGmCNGVMDl4qxqIomMXDvyomry
+o2sLYrYNHkdFndh6g61/FXF4/4rjsRvOx26u6xdAbzkj8IiPq8GCx1+FrZNT6lJSSR5RVWIe
+tb/WKUKkAfXfHxGvedX75/ZsMp2WJ3hMT8x2D0+apHdvafGoq6tTUlIC4MHhX8qaYyKH0iEH
+ISwY7Cl4WFpa8vN8gKQBkCA8g4S4AlABGmqBYyhwqAUBBvdQC+QKUBiNyyDwoNCmwHo4vAKH
+WmC9fJ7I0vJKSnabsm4Ke2xFJY4bObAKjSEmdvmkZjL+PMSF36EWMWt7hSAHlWAH5WBHFQ6L
+h5O2mJm1mqcA1EbdS0/y6VoAMT6y04pYS0nYXdD0vPDoRdVwV75lo3Tb9sJDd85NjzykJdZz
+tbg8DLWS8XXXiFLGs9PuKngEBgZe/Fz6IICH4Q0ftasWcpd1FUQMEHjo3HK8KyHFka9BSEhY
++ooKNmS68k09w3uO9qqRW4KHt14yYA8fgxRfw9Qg8/Qo55y+totwzKUs1zPMK8HbMdhQywSq
+xB1poAkhWTlxJTnxJbnxpZcvXRG5dEXy7j2k96XkjHTNMmLXo3PQmPOFMaWFyZWFyevIUZhR
+TXy+DC74S4LHaSmvsJBSONQirRnhH1CMzdUSE1119r4PAI9zMj5Qz8v65mQ0IvA4LubK1juu
+5s5ZfS3k4JzuX2mz8eNPT0rtUzq628c2mU67OXjwGcdjanKqvLwcgMfk5CT2nsQ6lGIDhe01
+ePAvAAng2AdUUa0wthXrOXigoRPoLwooAq2BWyF4QK5AzqUQPFKJrXAZWk6wXqmwFn4kKLpO
+Sj1FQjVhc+TAjLzESKmliKvEegRWDo0w8aciPtSyNXhsmp32iair/hUHwajhNWfjW/xmpz2l
+43Ekv+IP2aVI38opO5JZdP2+7Q1Zhz9kEP+QU4bdeiSn9KQenp12zy0eF49K7hd4qFwyEzuv
+ePnMzfNCQueFhO/LKT0xt/EOjkYjHVXN/VnEamRwaB+gdwwy6juGCkpq2cMcwxO9I8zm7pGn
+gMSVVMD/+rLIFdELd+RvPtK7Z7MlePg9TvU3SgNamS0HwING/mvw08zMqCKgWTHFWbHF2Wwt
+YVPHc/DITSjNA5pYBjQ/CWh5fnJ5QXI5xImpuSXvkMLxyYWkpMr5xZXUkIqZuSWIHEkhFZTx
+OVgMXPYdgwfy8SjOan3nvFVeaiMWPJCPRzWxq6aoq61qwM49D2vx4J7V8jfTcgAeQi61W8bx
+2BXwWGWtkteEwfjJyxHrULow1MAxFHJAwAPiBOAK7ERXNNQC1oD1oAC2PCgMXUmxAcTgXFq4
+Eo3FgJVgd+x0WnBMfqJirrBYPf3jjt6lEqqJd5Ri+KQODscPOc2k2JSmqekF/NnIvxwu59KX
+t/xvFTLdWUvU4omk/RNJBwGowV0bnas2xnxYPLRFrG4pOJ8zCBDS939BdbzVr1tJSzuc0/Pj
+2HROz1f+ji2enXZPwaO4uFjoi9uCBA/Niy4QPMqbRwKj0529QyOT88ubBmvaR9ddLLqwLha0
+5j4aB3iw/SuGGAg8oIvFmn/FFKmlO7ew1MXdOyUjl0KfgeDh8DDMTTNuE/AIMEkvjNdhsf5t
+uOfzcJuUMOusaOe8OI/8RJ+CRB9Cki8hI7w4yj4v2iE/xrEg1qkgK6o0O7o0B2hMGVAUryPJ
+iQg+xS5IhTkXpnsVRbgSkaEjObiCNrmwbu6IrAFrdgYefzln+Q7Q80CtuPVdIbbGxlSFhJad
+k/Epym398rbL5uDxoRkbPH50qhEweKBZLVPVscihFCxz+2AcHPDgFg4fDwHLwDDTwqVIRiMR
+wMMOqOMnxw9VtuPHI6MMQmkv/nh8JcFDAEniTBQc4t1z4lyz91rj3XICLWP5zE6recn8I+eI
+Nyrqf1dS95OW1r2ZVyZzzeykoc8bJbUvbCqpe4NYdUXREc9Ou6fg0dLScvarKwIAD6XzZrfO
+yAmdunLuvBCxtq+saQSARzl7KiuF7djZTtkV8BiiTg3T1uN3AfAYZbAjlgeGhIPb4LaI1ENJ
+I2fNCJ7gEWia3l5z/tmzn9FH34lziQy1yg6zzgm3zomwyY20zY20y8OCR6wzIc6FEO9amOBG
+THAnQpwItiqCmHFLSIoyvh6eNCOoYmpuCYVJf7b6LDei+uUtHkWZLQAz/PyLSMSugIBinrNa
+3hWyDo+o0DRLCo+s0DJP0nqaBMBD2yJZ2zLZzCkLgcdfTMoAeFzzrBMweMDbD+tQSo3V4b5X
+cfDYRFy880Xl4m7Kx/D0I92uSj5IknyQWFk7dEgfa/h02n0ED8PrjgbSVr6mUT4me66+ptFO
+uv7ql022zk573lDnqs3j646GV2y51O7JDZcNNtk+ueH88JIZZ5K4Whw8XkpIJNL8/Pp8OgqF
+cvqE0J6Cx70fdS+cunbh4uXH5nYRyYSSxqHSxmFBggd1YpZMZeYSii2tbIWFhe/dULZW9+MG
+j0j7qGnm7wF7gM+0AA/+wSPRowhyxdzCcpBNiaaOAegr0wPK0jyK4fqskMrs0MrssKqc8CoA
+HnmRNS8JHlKPIq4rBdUVdualNgICyU9r5AaPL265GNulJyTUaponnZf1BeCh9TQZgsfxO64I
+PP5sxAaPW14kwYBHRkZGfHw8BI+NHEoPEXigyKX7UntlTYenf8E91eCLd/3FFKNfnj0AwCjo
+pOcX95JHpw/dY03AAcQqmgYBeNw3in29wENp3cfDSTWUw8dD95qNzjVrgamhqOOWPh4AHlSE
+HmtcMOWp6hdMH26w6eFFU/WLpmzw0GKDh5d2LJ6ddteFnSFub8BD6rSmyNXrdyXvu/nHEEmD
+RfWDxQ1D+wIe7OSwk+ys9EOU8ZCwyBs3b16/eNvbIBELHkFmGTFOEfTRd8AzbHHhl8Up+vyD
+R5JnETJrYDUjqAJcYQAe4HO3wMPXl/jOecvirFYAHj9Ke6s9iasv6r6nHVWQ0YQFDxnd6Jtq
+Ie01gwA8tMyTsCHTheT9sOChmyqnEJInGPCAkUsheAy7XuHpUIoVS0tL8BM+yD+ffUwARyaP
+sy/jyLi7b+5VyQAxpZg7L236EFeJP3PV7todKxw8+GGPianDERHl5fvBjvbOh1fMLSR9beUD
+bGT9re756V100L/siNRAxMngsuBUX8QJWztvFXHSu+yge8leb5sKdtEXcTS+6eaoEmwp7eus
+Eib3o3Z1TVVnRycOHrslt4D802DXwSOvpj84viAkoYBQx06VckDAgzE1PzE9z5xZKC2vmppd
+5ACP4KeZ4TYpIz2fw3kutJEPcsJc+ASPZK/iZO/iFJ+SVN/SNP+y9ICyjMByAB6ZwRW7aPEg
+pje/c87SyS2vltBp4ZB57IYzdC41tEw9dtOZI3KphlmisV2GnH7MJuAhEeIOznRk4n+HugYF
+AB4wVwsAj9E4Q+RQOtdbtV83P5/TaTcSA7csNFVW8NI3QFlZWR1nTNPGJ+OSqi7f9bl2L2zH
+7HFXOVZCNf5bIZP3PpY6JazFUVcqsRXGFYGesUjAGjT5F7rIQkOQ4Ief8Oy0e9oPDg8P2z12
+c33i72q0psb+zo99D6ga+rB1fXldnbatPs5PfN1NA8CZupkEWOs79/T2kEfIArvgr7xYWVld
++VRpt8BD9pRxTjXKSj9g5RocmVbKD3gYWToLEjwmZxbWU9LPLVo/8nXVj4DgEWKRFWqZVZn9
+YG7mvyB+DLR9n+gZc0DA46iok6phbE1BR3hY2TvnrZLjatCslrP3vG+oBEPwOCfj88Utl4+u
+2GuaJW0OHmbxpG7a/7Az19A19xo8aFSakJAQoI5BQghyKGWWhe3jzc9nALGN5J2L1ruYzW3b
+1u/ekbn55frmwa7esWfPVovL2tR0Ii6I+YjKRm7L6wMUBshxSz781GWLv30s+cFn909f5PS3
+QZOCsVFYAYSgScEQQuAymTa5s5irhwg8RsenvrvvHZZe95qAx9TkZDGhpIRYVpBdnJqQnxSd
+mxyTmxKTlxqblxYHNP8AKWhSbN4Ly7HsdvKj7JIxucnROUkxubkZRWXFFSWFZYX5RYWE4snJ
+SX4ya+PgwadkZmaePy768uCh9L21yPd3r924nVBQD8EjNrvmyFt/5BM8vvrmlLGl876AR0xc
+grDwBetHPgg8Qq2yY5wSWspvrSz/HDzSwGdDsUycS+a+g4fko3DkXIr02E3nH+95g893haye
+WKcB8PDwLSzKaW2rGoBDLX8VtsYq1sejv40yOpAOznF19ReUgdJdAY/mFkpuYSd9fIoDPDLS
+M/T09IYbSzpU3tjEofQQgQfqczeSTZgEbRpnzu6s9p4+yvzCytLScl8/ZXB4fII5Mzs7n5xW
+I6UUePGu/23FaH7wQ0I17o5SzPkbTp+ceACo4/1P720EHpA3EF08W8tnJ2+WgKKXvFbg8bo5
+l7a3dygIG2hdZM9j1b1q++S2o76ovZ4oJiPbDQdB6pYZ4kDb1ouJ7lA1LljqiNhoXrQyuOYg
+/r1KVXUl/0nicPDYUqanp7//7tTdf5i8DHhInNQUvnjZyMotvawTWTy+//GSrKpOdkXnpet3
+NwEPZQ19r5D4lPzq377xZm5po+DBY2Z+aZg8Ki0l424YhcADOpcme4cNdX0NTR8zk0dKU0z3
+FzxQHI/E2Jq6wk4SsQsbxyM9iYQNmQ7Bw8Q+w9QhE2vxENMIw4LHQPvoNFOS7dky/9lLgkdz
+K8UrsEJBO0laPV7/aXZ6dts4fQaBh4mJSWxYQJfu+8ihdHVpn4fIXwY8UBAwOAYBFmAvDKN+
+wTWwAIoDBvPYolhkoCv3jCk/8oPZzgZrRscYcwusxpahnLzqsKgsyhhzemZuhEwjU+huPjm3
+7vtduxe6Ns02ZgN3jjhx1TgRce8vTmm/94n0e59IAeSAupHFAyaaQacD1gB8Al+xp4yDxysJ
+HtC51E4+yPkBO0mcE1eSOP1r9gJKEnfFVu+qHT9J4h5eNFNZSxKn88Nj7dMvqM7pxzBJnM5p
+HpvWksSZmot7uaqH28r6ezyMUhLS21aSOBw8uCUwMHBiYoJjtOXWR7o7Bo+73z28fOV6WGpp
+VmVvdlUfBA9776h3//ZhQe0AoA4xaSUseNh7hpnaeKQVkiB4BESlAeQgVHU80je9dPXmvoDH
+7PxSQ2PLJWERjyfRWPCAzqWFcZaT9D9B/KAOfZwb4bvv4FFL6OQGDw4fDwgeKI4HAg9sHA8I
+HsNdHSsrb4Kzm2Jo7Qw8SPVDjl7FkqqxUupp4irx4F1b8kGSlHrKwyfp8enNY7QpAB5CQkKd
+1meRQ+ny5Oi+/xZeBjxgPwsjfcFkLpA9oCME5Aq0CXbNKAdcKrEVYYm+6wth0vmXxpbe/sHR
+GlJfflF7HaljaXmls2vYNyhjZmZ+dm7B3TdbRSv0xr1AUdkIDscP6M4hej/4GyHjDz+XYQ+v
+rBk6tgQP+AmJAjQYLsPrQKFN4eDxaoOH7h1rW/lAc0mvp9I+Di/majG87qgnYelmEOKmH7zX
+6mEY+kTOVu8aP0niDHUuW8lKO13TCxLVeUGvaweoitmr3nEECxybrukEyko7wyRxDspBpnc8
+XNS2nSQOBw9u4chOC2XHQy131qgjMrMys7IXCx4yKjpAg+ILjrz1x5yKLrkHupdF7+ZXdf/9
+o0//53/fFb58w9DcMTm/5h//+qyqjXJbUlZKTjWntPHPf3l3v8BjbmE5NS1d+PwF1ychPON4
+kAqVlhZ+CfGjv/UcIdbjlQGPwY5R6nAkPLUJquu2wKOqesDWvUhcJYZXlpAYiQfs8Faq+qmZ
+OfWBcscPgkPpXgy1QLqAyVmeYbLFYXttjvUo421jJ2VnwUDq6nt8A1Nj4nJJDV2tnZSmlsG+
+gbHw6PyhEfrc3FJeYV1pZaeTR5a0csDFu3635KMADUJ3jtsKkaevWH/0pRIaW+HQTYZakMUD
+nhQK/w44BIFHRz8VoggOHq8WeMAkcR5mEl48ksQpOSZ7FyR55u+1pvoQHbaTJO6koc+bpaQj
+xNqftKj294RKURm764pOvy+oBF+xW98sqvnewPt5kjh/Q1EXJ5VtJ4nDZU/BQ/xbLUAdERmV
+GRU9HODx9ckfTe18DC1cT529VFg3+Mtf/Topr1ZeTff0uUtoqMXC0ecPb//J1i3QxTfiq29O
+1XaM/urXvymq7dwv8FhYWiktrRC7cTfCLodnHI9Ej5TOumuwgwY6O3WkuVwuOzTmFQCPwc4x
+xpgLPC/GmA8/4FFW3mfpRAB0AdDi7maJyUBnlyirkeiqeL9U4a8APCZKQ/m8V/d6Ou3uggd3
+mlrs184BGk/wgPaBHYDHyspKQ/NgcnpFSERODam/sWVwmDweGUsgj9IJRbVRsdl+gQmxiSUl
+FR0xiRXi8v43ZcPA/0L4lutn36gD5HjvE2lu5AD696MKP1423Ag8oKEDJqNJJbaiISSwFa4E
+y7d1I/jPMnNIwWN+cdkmqLC+g/z6gAdMEueoys4Qx50kTuu2uaWqu6XKnquVqoeuxDaSxElK
+2p3X8RbSflE1PZVu2SiK2YIFjk3ntb3ALs+TxIVZy/i6P9p2kjhc+AQPNntsHzwSiW3R2bXp
+5T3c4PGnP78TGFcgKacuKa+ekFt75K0/FtUPfnPqrLGNOwKP+0qPrt6UUNbQT8mveuvtPwHw
++OfHn4XEZuwjeCwusZaWWZnRxVGOuRvF8cgIjGyvEZuf/S9EILSRT+oI+ql++YcaPIa6qJPj
+htDRlD4avRF4gE9icZe5fYG4ShwbOZRj+ZytKf0wVUY5yMXYsX9ogn8w2NMAYnsEHjA7LRw9
+mZ5dRIlodxc8kLR3jsYllpaWN/T2kaPiCFQaMyevPD6xoJbUER2XPUabWFxaNDAOPXPJ6ptz
+T97/RPq9j6V4IgekDkk5G+/AdI4qwLmgwSCYmwbbYDii9GwtnQ1YcAwrFvxjDZ9OKwAfD5gk
+zlk9lCtJnBs7SZyIgwBUT2R7SeJ+0HJ/O7v0jxnFGC15O61Q9L7tTRmHt1MIf8wswW59O7Po
+lK7nSyaJw4VP8FhcXBQ+Lib+kSn/4JFS2pVa2p1W1s0TPKDFQ9vY7twl0cK6wf/67e8yipsf
+GVoIXRaF4OEeGPfI4Omf//KurVugV0j8Z8e+OggWDwgeyyuslMDCLQOIlabYDrSdX1n5OcQP
+1srPBzuECqKjDy94DHdTpxhakD0mqCEc4DE6zMjN7zCyzlvL7pHCJ3JwpAWRfpgmrR7vFVzV
+1Tv+qoIHyk6LEtfCeR97BB5AenpHXTzio+MIWXk1ADxS0ojEkjrKKD0mnj0QA9aYWcecPGf6
+8VcqGxk6PvhM5u/HFDT0vBYXlw/jY03w4OESUdJPZrwmvQYfSeKeGkk7GEk77rUaSzsaitvq
+XLXmL0mcpaiS6xmjoLNPAl9QfV/1a1aS9xzPPA7g2HTG0F/ujq3myyWJw4V/i4ehoeGVo3K7
+BR4ScuoyKjo+EZn//ed3ciq67kgrid65n1nS8snR43//6FPhyzd++8abgD0AeJTU90vJqYpJ
+yuWUNr719p/20ccDCx4rrNUQywx+Ipem+WfUFejRRj6B+LG0+MvuBvGCmPhDCh4jPbTZ6VvP
+J/KoQ/AY7hvPyGw1sMhh+2yo7QQ5OMJjSqunST6Ic/Etbe2kHl7wQLQAX/mx+WThuz8gDR3n
+TLQeOkLAEOtoFxhui59ctJvLBHMut6DRO4CdqL2zezA7t5Q6zswrqMwrqKKNT9q5JJ88b/bp
+iQc8nTo+PCr/96Py9xTtZ2bmD+ljDffx2EfwMLhmb6rokOCZF++Wu9ea4J4XZBXHf5K4jx3D
+f19Sd6Sw5icl1v4hu1T2mtkpfe/fE6vZrh2YTb8vqLyq4IiDh8DAo6ur64dvf5T4lxk/4CEl
+orU5eFi6BP/rsy8LagdOnb0kJf8wt7IrLJEAZ7UA9gBPiYTsCmJdX0ZRQ1hiHoCQ7JJGY0vn
+s8IiBwQ8mpqab16/zX/I9GSv4tyI2I7ae8gBdYb5P8Ndws3l2qVpoYcLPEZ6acxxu9XVX6xF
+jz/R3typZZItqZYMdFfykaHpnGsjNTH2XiUNrZTDCB4HUAYGx2vr+9NymhJSa9o6BuMScgqL
+ahmM6ac2cTzB48PPZf9+TPHcFf345OKVlRX88YiDxw7Aw/C6o76UpZdxhJdR+N5rhIO278PL
+pnwkiTPQvmJtdNXhySXrJ5dsOFXU+ck13puMRDdIEteBg8fugwcQU1PTS19K8AMe8jL6m4NH
+Xk0/AA9tY7tUYtPHnx/HTqf9w1t/+p//fdc9MA5Op716S8LWLRCAx1tv/ykhq+TgWDxkZGQ8
+7QNjHPO2FTI9PypuqFN4afGXyAMEjsLQRz/raZStI7gUxhMOPniQ+8bHKVmstTm27e03bslF
+ikiFiPEXk2p7kbqfO4pYuxJJzRQcPHZFSA0Dnv75Du5ZWXkNzS3dE8wZK/t4AB6ffK2KwOPD
+z2UAchz7TtXJPYHBmMIfjDh4bAkeDkrBGyeJYw9/CChJ3FVrQ1GnLX08NC6Zqwg9eXiRnQyO
+W9Uv8F7/cC1JHAQPj50miVNXV3+ZXAyvG3gsLi46OTkB9pD82HwT8JD56uljS9ctwSMhj3T6
+vAhH5FJHn4jzl0VNbTzOXriKjVx64849j8CYfYlcuhF4lJSU3pOQzYoujnbK30HI9PyotNLU
+wNoC69ZKzd5mCXLvOcbop3Mzf1hl/dvy4q+mme/QKcdHekX6WuTbqk1aq6zqi/0aSvyq81Kr
+czPLMmr2HTzYzqWDI0y6+9Li+6Nj9TmEJnv3HIVHUTdkgq/fD7utuKv4oRwr8SARgI3swwht
+o7Dw2HLBgEdiYqKjo+Mr+TNfWloZGPqgqNRuhDIxRp20cUyG4PHBZzIffi77vbCOloFPdl7N
+OH0SfyTuQJq7R/9ywfqJR85rcr6gyzBWsndQ93PSCnDSDHB8FGCp4GGliFVPnmq5B7p2WI8N
+VWFN2cue68sKHhbbVLC7jaq3q26wo4a/m26I/v2nLa3N/X39fF4uPI7HtsADiqur64WvxDYB
+D7ETGnZeUVuCR37NQEHtAEeSuE+OHnfzjy1rGmHHKS1v268kcfyAx/z8wukfTufElaQEEHcx
+V8uPOgRFZ18FhZ95ev6MRPoZ1jDygpGE9YtJ+lGglH6J4W7lvlajtprg9tqQ3QWPoa6GscGE
+sSGgidThRCbNbIqhNTWhNT2hPcNUW5z/enHhxNzsqaXlkf6h8a4eyvLKckNTv51Lxo17vhfv
++N+Sj3q5jKgx4qpx4ipx16T9vxUy/vsxub/+SwK8kus+8RMMeOzuKzDy3wjPIPEMCAYdP3Yl
+twu3VwkvAZdO6hnb5YPi6pX94yXLT0+ofy+kGRaVN7+wiD8JXx8JDAx8ScBeWloiAxn5SSlk
+ysgwubdroL66vTS/vji7tjizpiSrpiy7tiznJy3dB61ZU+zyZlqSXV2UWV2UU1NGqCdVt3W2
+9w4Pj5DXZGR4ZGSE/QmWwRVYXubX7xoHjx2Ax+LiYl1d3SbgcfuEmr1PzA7AIzm/DvQj4veV
+7ytq/M//vusVmnSQwYPFWgX3DwCPzIji3QIPQB1AwUXIj66lMWYLYuv+4z9+dvLkz/T9rfvb
+FAbaFRhjXzPHjy4v/WojINlIFxf+OMP8cmZyXWeBTgE9DnRuGqMzx6HzxrZ0ebmlp4/a0DIE
+75CVlZX2jmFnz6zbMn4X7vjf3Al+xEisIccVSd8T543+cUz+bx8D5FifcKFvHCBI8ECBsLC6
+3YPAWSpwxgo8AoQQCAnYMjrOmS/fZo55NJuDB5Syik6/4Jy5uQX8GbgrUt9Bnj8kM4B2tx+c
+nJzr66bWlvcWpDRmRddkhlXmRVblR1UXRFfnH05ltzwKvBVWgXPJjKgipDX1do6xVlefn/Hq
+/l7w1wQ8oOwFeMir6X7x9cl7ihoAPCRkVLSfWAkSPECPv0PwiNod8EDUweHjAdbATVgfj6qc
+8uaKwJbKoMGOh8PdyuMUoSnGsdmpD7bLDJsra+XX87NfLQCdA/r1NFMeWTymJh5PT+gvL/2T
+HSptrmhxcXloeJRQVEdnzOQQmufm2L3q0DDNO6Dgrrw/OzamAn/4sRY8U1wlVkTC5+uzj/9+
+VHYtfuYLczwFDB4w2YqoVhiMbQ6/vgx4ANJAwbU4MGYHodF3CzxebTEyMiIQCAKrDlAHuP6K
+FomvCXhQx6j+bmGhnrFeNuGW2r7mmj6W2n62ev52+gH2BgdWA7erDuBTPwCcl4WWn4t5aJRf
+UqhXTIBLhJdTwPDIMJVKxcHjZcxuHLlaeAqLxdoIPMRPaFu5hW4XPPIqu/7rjd8B8Pjk6PFP
+jx4/c/7y2QtXBQAesE+HPT5a5hM8JO5IA/AA+vLgAeutaBl7tjb1D8jU7AIAD7gMqoYFduxc
+2lGb09sc0Qe0JbK/NbK/LWqgLXqwI3qoE2jMUFfMcHfsSE8suSeut7l3cx8Pct/wBM11Zfm/
+IZzMz30P2lxS0ZVX2OgXmOjmGU1q7AH4wZiYLiptnJ2bGyHTPXxzb9/3uSYVeFMuciP8gPG6
+7yrHXhb3+upHfZglhOfsTgGDx0ZdOSQQmI5kenYRRs2CZIKGS8IzSGANwAkd50xsjA54HBhF
+HKV04RgfAQtgL23HdI4aKbQpsF7eLAHVAneEVePgwftU8em0e9kPtrd3KAk91r3k8FjU8ckN
+Z9M7rvrXHPSvr6vBdQfD604G1xwFo+y6rjui2jfUaw46V211rtiyP7n1Cu9Numub9K7aaV+0
+1b9ir3PR1kjUVeK7BxVVFe1t7Th4CECmp6d//PaS5FEjTufSr58aWrhsFzxUtYz+/tGn9xQf
+uvnHRiXZaRoYfnni+2JS/56CB0IONNQCO3qwkh/wyI5lUwf43C3wAFc1LbICfOZH1/7suZDH
+Z7ktHvviXEru7ZpiaMHJLEABe0wy7Lva+2tJ7VW1nQUlnZSxqbr6zt5+yvz80gh53CcwvaG5
+l7W6Sh2fDAovNLKIl30QfFUqQFQmnCMpqrhKLACSi3c8vjytC9BiI+Q4UOCBHXkBRAHDhqMc
+JQAPciu6YKI3lLIEO9Ty7HkGW2wSW1QFBBWw/p2L1ig7LdwR1gK3ovVoJUpPj4MHDh4C6wfZ
+uVrErO0Vg9nZaR+EOKm+GLn0hqvuNRvd6wJSnWvWawHbt5hOqyZszI4hds5Y96S+7vcYXfv6
+SMj0kZCJ7vcG3Fu1zhmrXTC2kPR214iwlQ/w1IxWEsaz0wpUwsPDz3576d4xc47ptGoPTbcF
+Hrlr5g4RUfFPjh7/+OO1NK+0fxe5+uFDXdO9Aw/Ym1MnZqem5wF4zMwuYsEDKJ/gkehT+JLg
+AavLCa8qbx7Li6yB4FHROAotHnDr/k6nJffVzDAlkfvH0sLnEzRfGLm0p4Pi45/hF5iam19J
+pU329NPikqtrST1kCt0vMKOhqZc+MUMbZ8YnF1bWdsWn1jw2j5N9EHTpjs8thai7KrHQ0HHt
+XsAXp7QBbGyOHGz9XAaBx16LpaUlmvXGEzyweWNR1jPIDOEZJLeoMuTLAUdqOMCDYxlVAUOb
+wn2L6/pQLQhynr0Y5hRVDWpBqWBx8MDBQ6DgwU4SF2B618Nc0suBM0mcg+E9a/+nsf7mMXut
+gRbxZiqOetdst87Vct5Q77L1bRWP7zzSTrqlYvU7l2Q5SUdZaZfvXJI4Nn3rliKm4vHoIjtJ
+nJ1igNEtN2fV8LUkcbV4dlpBiqurK2CP+188xYKH+LUH2wIP0Tv3wZPh/GVRYxv3xBwilf4p
+eFQMDf8/Z8/938zihr0AD2TrAEJjzjX3MuiT86P0af7BIzu2GILHtuJ4cIMHtiWpEetZWaOi
+S0BFYM384sr+gsfoQPrc9Hnk9TE/I0QbyeRIEtfZSiEQWoLDcpLS6+ubB6vrOodGGBPM2ZDI
+3K6ekZa23tCIjMiYLG+/2OCwjJyCeiqNGZ1QdkPK/bp0wG2FCKFbLh8dV94SOWBkiQ8/lzUw
+CRbMvY2N47GRxQNrEsEaN8BXRYtEZKzgdi7dBDxAMWS7gCHTYVY17sLwgPJmCRx2FRw89hc8
+oI+HilXy6wUe8oFmkl5Ppb25wcNEwT7OPSfWNWuvNcEjz1bLg9/stJcsz2t6/jWJ+Ld4wk+a
+UPjX2DwxKVsxWUewAL5it76bQBB65KG5Bh62Cv5Pbro6qYapbDM7LQ4euyJmZmbnvhWR+fIp
+Ao8b3yj4xRXwCR4ewUngsaCqZWTh6PfF1yd//otf/PaNNxWV/3t2lv1+XVz65/ruht0FD9iV
+jzJmqtqp6LkEhH+LR3RMTIBrxMuDB6KO5LCq2fll6M5BrBpOj6oEywWxdevUsR8BxGjDngtz
+n0HeWF39xQxTktJf+0IcjxdztfR2jRUVtccllnv4JmbmlLe29YVHF3R0DQ8OjyWnEbNyykco
+4/GJeQ2NnSzWKpXGkFNxP33B4puzj9/7RPq9T6Q2RQ52/EywoKzhlkeoIxTVHzTw6BygocT3
+4RkkbvDA+nhsCzz6RxhoqgtP8PCMKUcmEZh+7nUDDwptCpwyMvscBPA4XLJrSeIUgpzV2EMt
+HNlpH4s6a998aiLjZHJ/z9VUxlnn9lNDUQf+stNa3ZRzPGEdfsIy7Ce1Cj9hESJzx/q+uN2J
+p8Hsr9itlmFgl0cX2SHTXR+F28r7e2hGbzc7LQ4euyX29vZnvjsvfdwUgof0CcPb4vf4AY9U
+YtORt/6oa2Iv/0AXLFg6+cEkcSFxOY90jq2w2BnWVlb+X/K4JqlzYNfBAzZ+kMl+ZNEn16mj
+f2Zhc/Do7e07d/ZchE8CAA/+Q6ZzgAesgjm9OLuwHB1UCatOiqiOC65A3h2wjIAjl/Y2A7Cw
+Wl7603NHjjcnxzWHuzt5BBDjlZ12sIdWXt7pG5DhF5QRm1g6QmG0d/SHhKcWldTRGVMJSQUx
+8Xl9A6O9/RTlhz4/CJsf++7RxonJ1pHjH8fkVB+5Vda0C/iu5h88ICqAfh86e8CSblFlEAkA
+ivD08UDLoAD0TUVVoIOYeOWCBehxyhM84AKoJZXYejAtHnAACKscSWo4LilHSaBw+ImjMEAy
+dGTkSwMK8wyEgoOHIMBDMchFg0fIdHaeuOsuepft9UT2Xi/bG1x12jxeOtbiIfzA+f2IrA9C
+MzCa+X5Impi07V0pu/eDUj8Iy8RufT8sXUjDXfPiWsh0dnbaneRqwcGDW0gk0vz8TlJBRURE
+APZASeIufH/9sYXLluBx7pLoz3/+iw//+SmgjtjM8pLGIQge5c0j1i4BR7/436Sk/7PuV7D8
+Zg858OXBY316SAM7/nZZM3V0kAnbD5bB0wl8wgIbOZfOzM4rKipZGtnDoZY4t4Ltggc8fpIb
+sZc8FRZUmBRUCcAjOagiJawKIQdoDyxGiGPnLRUMePS1kBhjGqyVXz/PZ/fuONlpsGNgw8il
+vMCDMTY1QZ0aHWZUV/f4BeXWNw2A9pdXtZaWkWZm5onFtRnZJQNDoyMUupZByCkh8y9OavJO
+TLaGHP86rqCp711L6tyX3wIHeEAX0I2GWpDDJ/QvBSUbOykoCy0cDeEGD3hYCAnYKiDAgK9H
+fjCDuWt57giKgX4Wm+sWruRu7T6CB7wyPJUjaAnytuVWsAnNQYby7X0vniXhRd5f8OgnM45L
+eLhFl7924MErV8tjUSftW08tlN0tlPZcLZXdTWQdNUUs+MlOq3XZ4ryO9xduCV+6xP2krvHH
+7SNVr1pcV3Y9xl4Tj9ka/4VTjLSE3UsmicPBg1v4jOPBLaurq+w4bmQyBA+5byyvnLuZVNS2
+OXhEppU6+UQ7+0ZnFDfDXC0IPMpbyJ5B8Z7B8dlE15nnNv/pua86BvN3DB6wNx8eXvflGB2f
+GSSzwaOoYRQOtWw+nXZ6Zl5LS0tV4WEWmzqKM6OKox22l6vF0LoIHD/cqSzJvWjdyhFUER1S
+kRRUlRRWgagjLLoUgYcALB79bYRJ+g3kOzo/89XYYMDWIdM3Bo8J2jRzfJpBnTQxc4yKLXD2
+yg6LrSyrbM/KKQ0OSxkYHB0apqk88vtBmAd4QOT49ISSgUlQY0vfPv4Wtpurhee7Nj+RSDcq
+A17zx5mzO656S8cHAYMHdvYNUmzLsdN80BQhLHugktB7E66E84gBw8DyBwE8XkPn0k3AQ/+q
+vbmyU4pPYbIXYa81xbsw1C5J7ZIRP9lpAXh88zTk/eTi9xOIP2li0QdRuYrXLS5oer2XWAi+
+Yje9H1cgJueEZ6c9OOABZWZmBrAHAA+lbxxUvnN00Y7cVsh0DvDAxvEYGLVeej6Rc3xSsrW/
+eVvgsY4co1Owcx9jzI0ymHCZSCKPT86hoY2NAohNzcxpQuqIKYbgwTZ3bHOoBYIHqCvClTg9
+t8S2eIRUUhlzsCUpQdVTc0sonAi4nntq8eio6yL3uk0zzyLf0SnGjaGuHH5ztWwFHuTnUlHV
+GhRe+MQiNiS6srNneHJqdnhkXOWRLxxqwSQmkwPI8cVJVRPL0PaOwS1vNktLS/DMPDjgcdhE
+0OCBPF6gXwpU7olCHCuh4wqHNQOu5MYMgGooJCwOHgcEPAyvO+nefeqo5e+g6bfXCmqxVHXT
+EDHnJzut5mVLk0u2pmefmp7jUIvH1x2NLttyrWer0TUH9YumnNlpcfDYV/B4thZbzMXGS/4b
+a+VvHDTPu7npRW0XPJQskwF4OEWWQ/CQNIqDzqUN3R2X1LXhi/kK6zejDEMNh+TY/JbNwcMl
+sQ104jTm/CB1CoDH8NAkeXQdOfrJk6MDTI7RDZ7gMT278Jw6iiB4JPoURNjk7sDHAzuNBUl2
+WFXS8+ClgslOSxvWXGX9AkUonaDK9LeVby9J3MbgQSXTyRhhMpmASHv7aVHxFRXVPc/YQWDm
+NfSCTgk9B4/PZf5xTPHr0+rWDtG9fRT+wQDPTnsYwWMjxuC5EvrPcIAHRySTrU8VB489Bw+b
+jbPTuhlcd9S9Yqt7xU4AqnfV7nkcjw0VgIe2iJWasLHGRTOe+nBNN9qkedliLTttpINSEDs7
+rTAOHvsPHkAqKytPnzwr+a2uyreOqt85Sp7U0TS0SCps5gc8xB/HmvgU/CDv9zSAeFrBD4DH
+aUU/NKvFIpBo7B0+NXsK9phP/c5nlPpsDh5sh425pcJ+5uDYzPziSn//JPgcGmbOzC2t4wdz
+ijI+Bzv9iWm2fws3eIxQxjQf6GVGF0HwSPApCLfO2Rl4pPmve5amBFXMzS8vLrGQiSM3ohrU
+DsADfO4ReAx0eE9Qr688d+SYnTo+NmjR3diyk+y0vMCjqa5VTlY+JCQEUQfnM6pnrLKmp6is
+7YF26JmLVgA8Pvhc7th3ao7uCYPD1G3dZjh4vALggY0SzxM80KgKdlwGzhJCM4kOJnjc0Y88
+FPcBiUQqL38pd5T29g7li4+NbrmYSbibirsb33HTFLLSFLZGqnXB5icVfv65h2qtuZVqX7DR
+vmD7QsP4VrCv3lV7SxlvYzFXKxnfez88rK6p6mzvfIbLvoIHkPr6ejExMdHvZFW+s1c+aXvt
+e2nhi5c9Q1M2Bw8j73wRjbCyphEEHg7hpUfvuh6963ZdM/yBbaq0SbyabZq6XVpLb8TC0l+t
+Ar76Xlb8pIzMCWn9/OoibvAAvfk7X0sC2ICMMTw6NTLAHB6dpmAMHUPMmdFJJgIPnhaPjCgi
+oA4IHvHeBWHWOS8DHnA6LeINbHbavMiavbB49Ld5Mcauryz/Go2qTFBvdjfUbity6ZbgERed
+ICIisgl1IOntpwaFEm9Kupw4o3v+ij6hqGFnYICDx2EEDzR6AsOdbQIe07OLPLkFSyNgPfK/
+PSDgAVs4Oj71mvQa4+PjUYFxsYHJbA1iaxx/Git4DUxiK3Y5MClm25oYG5S03v7A5MiAWMoo
+hU6n4/yw7+CxurpKoVDAj/3syQuyJ00efO/88LrlZeEr9+VVEwsaNgIPRcukvKq+KxphADy+
+lvb8ywWbq4/CQ7MaVG1Sw7Mb/ZJqI3MagVoFFUHnUkN3g5C0r2rbjgAFT5eZ+R8odL/uYQoW
+PFwT29CIRv/AFGV8dn15lNlPZqLen85k2zo4wINYXGpt7JQRSYTgEW6bHeeRH2qVvSvgwZ2d
+dtfBo7shbJwstrz4O0wEsA8p/Y+76kt2EDJ9E/Do7x55qKYhKytbU1MDkYNKpc7NzW1+kwwO
+0zNyaumMHT6fDx14iGqFocjqYBlN0wCdFHbO6Y48RQ8BeECX0aN3XNFXDmDYxLmU+7LAYLBY
+19NNUuwRCIRdeazhwlOWl5cnGBMTdIwymAdVJ9YUu7xTXTtTxpqCK7CysoLfCfsOHlAWFxez
+s7NFRUXFv9fQ+NHF/kG4hpzB+bPC+qa2yYRGnkMtSpbJJj4FMXktQen1IRkNR++6mvsXAvBI
+JLadUfTPq+7Nr+79UckfgoeGfXpsfsvgWPTk7NWfcqqyfjM5Iz00VoSGWuYWlgFmjDHmn2c/
+mR4ZZqKQ6TA7LczVgsCjurb+iZHxVZHrbjb+EDyCn2aGWGSFWmYdfPDoJIXSRm4vvcgb5F7D
+jtqil8nVshF4xEbGi4iIODg4IEPH6OjoltSxK2BwuMADpYRDnSboTGGAdDhqADaB3pbnvIxX
+ADywik1yxw0eHESh45zJ7TLa0U/lPjIM8brvMjE1b+qTxx2oBBdcnq1lYnV0dMSvw96Bx7M1
+X9ORkZGGhgbQH6n/4GJwzcteO0DmrpLqfS1u8IjKbfqLsHVZ04i2c5ayVYquS3ZmebeqTQpA
+jtqOUQP3HItAYkBynbpdWmBq3UP79LPKATKmCY8c0o298zuHekcZ9ovLf0W97dLy32hMB9ek
+emTWwCpo2xiDPVeRAzxSM7LkFRSEhS480TZPDs1LB9QRSQy3zT744NFSmTg2KLm0+Aa6Aguz
+fxkdeNBek7MrSeJ4gkdNeb2SklJ5eTmiDjqdDv7pArhXDyl4YLtjFHoUO46wd7L2f1mFBkl2
+QNpnUivg6+qzdWWtKXvbytpasLyyylp/jwNLu2LxOPKDGTxf7phgHBYP9HUTRw5oLMKyx1bR
+SwQ0znKInEtxEbDgcTwEAB5Q5ufnwVsw6JUennaR/9HUUi7I1yw+yCY5yDYZgEd8diUEDxGN
+UAgennHVADzAJuhcCsEjIrvxulb4PZN4wCcP7dKsg4ti85tj81viClrOKQcg59LBUeLkjDSL
+9RvY+S4ufzDGiOeZnRaAB9biEZeYcumCyO0bd+1M3NLCC9Mj1jSSmBxECLHMPJjgUUso6iS5
+UgYkFube/sm+MfsXSr9qW3X27man5Qke2Nkr4F88MzMjsHtVkNlpdxE8AGzAKKMQNmC4dUH1
+mGycYEzPsVjL0OLBerbyDJEHIIvn1uK5+YWpGbbNamVpcWCENr+y9PIWD3i+PvGV3D4bHOCB
+oqjxwx5AUNTWbU11wcEDFxw8Xm3wgG9bQMDrsAiQU2KPLts7qkfYKIUG2ybfE5P/8cxZVQ1d
+W4+wb+95AvBQtkpWs0v3jq9xCC+9phlu7l+IZrUcE3dr6KYC8IjJb0ZxPLDgAZ1Le0dGxxj+
+cwun10N/s34/NatBYTRvBB4pIQUulr4+9qGpYYS0sEIAHinBhOTAggjH7EDT9CCzjIMDHtW5
+eX2tOjTyeSxssO0b82+PDUo2V2TuenZaDvAY6KR4uftirRxzc3MMBgMaOrAhrzlCU0JPBmwn
+AjsXMm0SLfM/0HAYwQPrEol8EtAcjc0dFV5e5haWYhLyOtkTlllsn6iZmytrRMFiLUEmAZ/z
+i4uMybnlpaXwTGJ5M3uGYHVbj71fDH1yes1O8rLgMc6cRddho8iliMGwET84IpdyCPYa4uCx
+LXn5WS244OBxYMEDyeLioqurq5CQ0M3TsqrnbLSEPLSFPbyeRj5Wt7x3R/6tr5Ru35U8dt3U
+1DPj8zuuADyQxcMioFDaJP6dizaAPW5oR2wOHmg67RgjennlvzHjLx9NzdxsblMMCla5dEFE
+Q1knJbgAUAfQ1FACW8PAZ2GcZ16IZYa/UVqASfpBAI/yzLyWSsehznvM8aNY2GCxfjFJPzbc
+o9xckbgX2Wk5wKO/nRwZEisqKqqpqQmHz7inrkDeAPwAJy9gE8cjIMGCByiDwGOjkNevmMUD
+dEywO0YXB6xBcz22nKOxEzMHe0iFZeQQ7R+ZvzaCsgJunlHapWE6s6yiDRDj/OxyTzc7gsr8
+0nJiZkV9W/8glSqu69g9wp7j7BqZq2IRBIrtgDy4p6UgSEBpaDYCj2cvjtSgleBa9Y8wsLVg
+Z8rg4IH3g/gFx8GDW5aXl5ubm62trQF+XD8tpXreSvuCp6tOTJBN8pdX7Iy1Pd87rasgaxKS
+0XD1Ubh1YIGQvMuPsu4PbFMjcxphrpaHdmlfiLudVQ44t6ZfSrhvHrm0uz+gueXLpaV/w/ba
+QBnUD3tar5FKtQuSgwB1+OgnB1tkBBin+z1OBdSxv+BRV+jT0/RgbOjs/Oxb2DYvLrwxOnCj
+q8G8sTR+77LTcoBHR0Ofp4uPiIiInp4e1tbB7cuNTTjC8fYK3+ixfetrCB7YE+cYbtgjfw/o
+xtHU1XtCzGx0YhYs51Y2s6l1VcLaN7G5a3B2flHXJvaEmHlSXiMoP0Cm6tqGrjxb1naMdo/J
+AWtG6NOf3DKg0CdXnm3b6rF5HI8to4phZ84iCwnY652L1jDBDdZZdyP/UiMjIwKBILB/9OFy
+LsX7QfyC77sEBgZOTEwIoKLV1dXp6emenh4vLy/wBv1I2EXnopf+Ve8vz9q46cRYGUaHOaaG
+OaVpaYUE2iVIicmeEroH/l9C54Rl5JVk5JW/vfpQQdsSWTxE1APsnDzsnD3tnT3NrezlFVWA
+KiiqWFjbx/vlJPjnBjnHGWiYuFr4Z8Q41pep9bVfZNLf5YCQleWfk3v/QSJezwk3iLL3Fzx4
+lCSnNJVaDHaITY7/k6Nty0u/Yox9PdCu0FTqX5pG2rvstNzg0dM8ZGluAxARPL2RlQN6dExN
+TXGb36HFA73Co8cvnEMKC6De4fW0eKAktuBCwby0cCW8YnwGxdqOsOEwsaj+W0nb+QX29BAz
+32T2TbUirmjss7Sy0DtAfe+czr+umYupezxbXWZMTalZBM6xWFqOMd5JRFB+cnbx6G3DPgqD
+9WzbLqY8wQOQJ7c7KE/wePZi1HR4O22UeI4jMAgSPDst3g/iFxwXJCwWC3Re0O8UiO4lLz0R
+b6D6V3ys5EI9DeMei/o9ueEf7pIeAdQ1w9821t7IC6iDsbfb0+Aoj8xooJ5Z/nbRWiqGUPXU
+jJ3NfNlq7utlEwrBA2hiANC8xMC8JKBB+XHeOTFuKZlhFhVZ4n3NX0wx3uTo6+em/+9Q12ek
+QrGccNOsEKuMIMeXB4/CuNDyDLfWSrUu0v2uehk65VP66KdTjL9xVL2eEW/ivZGe6+01JtW5
+iQLITrsReID/C4DD1tZWLHJMTk5uNHUF6+OBLBtwnAV+hZ4eryd4YLtISF/YkOCwd971OB5r
+bqOsHvL417fNugdG2f1+egl0LrUNTKtt7e0ZHv/qrpWyUcxNJRfW6kpOcX1WcX3fCFXJyHOY
+Ng7KF9d3nVe0np9f2AF4oBAlHLYIbOgSSAvoKwd4TM8uok2QXlBWX+z1BHzCM1HLvoBHRdPg
+xNT8obgt8X4Qv+Cvp4C35sXFxZmZGQAhTU1N5iYWajI694Q1H11xhODx5Ka/yZ1AW6UIR7Uo
+V+0YN91YD704H+NEH5NEH+MET8N4L8N478cJviaJIXZpQINtUoMsU4KsUoOtUwPMk51Uo50e
+xDirxbg9ivPQTXDXjnd7FO+uGe+uleChneCpneilk+SlmxRgFBVl75Xq97QwXr0m725L5YX+
+ti/Hht6bnnhzeuL3gEM4zCMzzN8jZdL+TB3617oOA/2YtqbTzLdnp47MTa+H1Fic/83s1B8m
+x/9Kp3wCqIPce3q4W3ikW7i7Qba7UbazTq25zKy2wLs0LZUQW7WnuVp4gkd9WXtCZJqznbu1
+hW0JoRw7YwX8a+h0+vT09MLCwuZOhrDjWFxaeWSfduQHs8ZOtufAbd0IsAw+oYLlx+7ZYH1T
+NwX0GqWkfrDsFlkG1gsqfNbWYmlpefPmzV08IOArpNOzC2j9OHMWXKXiuj4IYLv/+2L/xFjg
+r661Lzg2d2iEtrjEntUyNn5lena2b5g6t7QcnVpu5pqYklfHYq1OTM4sLS11dQ6NMyZXV5dG
+RqgxWWXdI7Rnz3bkXbpngi7mljl8BQweJaR+cFeLG0Th/SAu+AU/RDI7O0sgEMTExM79cEH6
+wkP9G55GtwKMbweaiAWa3AkyvRtkJh5sLhFsLhnyVCrEQjrU8l6o1f0wK5kwa9lwG7lwW/kI
+O4UIO8VIe6UoB+UoBB4u6rEuD+NcNeJ4goe3XrKPfrKPQYqvYeqWPh7xblF5kXb5UXb50fYF
+MfaV2dot5ZItFWxtrQQq1VbF1orMpyXJzqUpLvsSuZRP8Gip7g32ibgnJQPjgGHHUzYJe745
+eKBl+ArPkZUDvu3C91zwogp4g+csmP2VVzVk+sLSyjI7Ogfb4rHIWoY2jEZSTyaxMbOg6nkp
+OM12mbW6zFqfb3uIAzPiSeI27wePHDlCeC7cM1xIJBKBD5mf57Tw9PX1bbkX98g+hULZci9Q
+hmMvUPuWe1VXV3OfPj+nBq4Ax17gKvGzI3d1bW1tH3/8MQ4eB1bm5uZGR0eJRKK5ufnAwMBB
+A49DETKdH/CoL+0QEhJSU1OLj4/H8gb4aTOZzOXl5e3+42rbhpHFGyAHHDrhGEABBbBrCNU9
+4RkknqPzOHjsgf0DcgUAD8nVVdby8sIUczExpcInvNDdP4dJn2OtLK/Nt11mF1tlsW0lzwQS
+Eg4Hj/2Qc+fOYTNlc9/zgEx+xodwz0oA13zLvbh758DAwC33AmW4IWfLvUCPz/Pe2FLAFeDY
+C1wlfnbk+VQB699//328iz+4j8jV1dnZWTr9pxzr4GX8wpmrsiLaurdccPDYMXhU5DVkxOWj
+q4r13xgbG6NSqTMzM6zD3dXg4LF1bwxDpg+P0k2cMz4XsfjoivHn1y31rOJaWwdftVMVLHj0
+kxnHJTzcog9HcAwOuwRu8dhriwdYDz7x/h0rgplOu11ZWVmBEyhAz5iXl2dtbS0qKip85rLU
+5Qe6Yk44ePAJHsT0Klc7b9l7CmfOnMHmkMWaOBYXF/FfwWsFHo1dw//f58rvn3/8nbj1vy5b
+//xjFe8YIg4euOCCy2sOHhyyvLwMOkrAnK6urmJiYiIiIgrXdHDw2Ag8ogKSdTQMAKqBCwUe
+vykpKQMDAzt24Tg4kpiYuKe9yWsCHu395N+dUA7LqFxeXCqp7H3vwuPkwgYcPHDBBRccPDgE
+vJhPTk6OjY3BkQKsP6TWHSu1W8am971fW/AoyazPSyqH4AEuSHx8vL+/P0pYj4ZUNpkSe1gs
+EocrSdzBBI8BMvPICQ0RBU+XgIIb6sG//Ey5rY+Kg8fLSHsf9T+PG+q7ZeEdCi64vErggbV+
+zMzMjI+PUygU2KVmZmaCh4zomkhdUda4a2arFPLKg0dcUIanfeATHTOxW+JCQkKANMi8ZHR0
+lEajTU1NcUccxcHj9QSPxYUFFdOIhxaxNgG5mvYpKmbR3T0jOHi8jOBJ4nDB5dUGDySrq6vY
+93foiQpe9g0NDc+cOUMkEhF4OKiFvzLgkRCcI3bz7smTJ2VlZcGjFfAGNp45djBlcXFxfn7+
+VXIZxcFjV8BjaXHR3Dmyu3e8vW+otXswKrksv4j0qp0qDh644IKDx94LHIsBb/fIEoIE9NFC
+QkKiF+/cv6GqfEfHUNbOVNHNXTvuIINHtE96sFv8U0N7Uz1rJQUVdC4DAwOAqbgtG2NrIsgk
+9Th4HFLwoDIYobGFbR1DJbWtpKae7KIGYkXr/NIcQBL2nNrVV+FUBZyrBQcPXHB5PcEDydLS
+Eoy6CTpiQCOov87Ly4uPj3d1ddXT01NSUjpz5kx3dzcCj0f3jC3UPNn60Etg4BHnneNvH+3v
+EI3AIzO8TERE5OTJk5KSkqCRoLX+/v5lZWU8x1CAgNMEJzs3N/cKjKTg4CEY8Cis6jR3imdM
+z66wfyyr8ZnlviGZlLFxdhCPVwU8BCwVTYMAPO4bxeKXAhdcXk/w2Eiw4UG4xdzcXGlNZGVl
+T67J1Ys3sOChIfP4keyayj3RlHvy9JGLo0GAk2EAFjxcjINdjYPdTIKdjQJ0VUz0VE2BYsFD
+4tY9idv3IFoAAQuwUmxLOOKIIqHRfgotzmKxXgfSwMFjL8AjOavawjmuf4ganUisKO9MyKpJ
+yqqqqGxZu7EOWpT0w8QehyVXCy644OAhYFlck6mpqcnJSWgVAZ04z46eY0TD9UXR1NTkZgYl
+jKCS2AJ5a4KN37WJQIMGk8mcmZnBo20IADza2tq4gym9KrK6HjJ9eSmTUFta1TZKpg8O08gj
+o40dvcSalqq67gVwj8FA6WuhS3H+wAUXXHDwEIAAIJmYmADdPY1GI++lwHnBiC6AcAf0w0XA
+4PFKCwuCB405ZWAXVVjaMjU5s8JiMZmT/f1Uv/CcyIRCCo2+VpAdLh0Hj23J6PjUd/e9w9Lr
+8EuBCy44eOwFmfAUbBkIEpsUWFxc3EFKFFxw8Hh58OjqHdU2DconNrW3DYbF5iVmVFRUdccl
+l+cSG8vrOmZXWAsrK7ifx3YFdy7FBRccPHDBweP1kdXnummh9aGWtIzqtKyKwWFaTUtfcRu5
+tofa1jtGLG/s6h+NS6+o66XWdjD7yfOz8zBt3GElEAKBIMjHGg4euOCyLVFTU+POv4MLLjh4
+HCLwYP0EIAgzuLHhZ4sr4n6xRUGxxKbO0bYBZsvIfNPQRM/YRE5RfVZeXWJmVVUnjdjMKGgg
+13bR24en5pfmDyl64HE8cMEFF1xwwcFjr4S1CkljgbVCZi629dNbeqkdg4zukckeymQPebKf
+OkOmz4PeeIR2TVTdzco9k9QyVtM6lFnUQizv7uqj5+S1ZOc02brFh6XWtQxOF7SMOsS2n5NL
+JDUNrK4uHEa7Bw4euOBySGV6drG2bRjoHh0fHPnDq/ZAN6+CQpsCv2ugGxXoHKDBdkIFXw/s
+JYXnaxVAAMuiWmFgGXxuucttwT7QdJwzQaXg86BdPZhgek+Pf3hntZCZC1W9E3lN1JyGsdwG
+Wk4DfU3BwlhO41h+0yjojXsGLpk5J7kFFpRWD1fUU9KLerLKuuvaKKRWakY2KTGr1iU4I7di
+SFQz/79PBR8TdkpJLWCx5nDw2FLmF5dtggrrOw5xBkZccDkgAvpHgPGgD9o78ADHB8oTPAD2
+wK4ZKCgDO2ue8r2sNzwO1CM/mIEdDyZ+YM8FNht8brnLWUW/PW0VQLvwDBLH9dyyYa+kReWQ
+xfFYi7lRUj/sk9pa2EkvaqcXNo4Rm6jEJvA5SmweBctFQJtpZR1U0Bt39pxNzq9PzKyOz6jJ
+Lh+JJZJjigdKGsiFFe1eoVnVLRRCRYtjUMl15ZibClb6RkapaRkrK6y1MZxVTsXBAxdccHnl
+wANuhT01P+ABSoIFoAA84NcDyB4HEDyQ3QmtAdcNtPAgG45w8MBKXnXvSemoO0aFEYTBktbJ
+4mZmcQujuIVW1EIrbmYUsb9OlrQyQG88RL7iH1NeWtU+MDxRVt1d2TTcSV6oaeyvaujxicpu
+H2J2DowVlDbllzX5B/qG+Pr39fSsIcYyO5o6VlcP+pwswYOHS0RJP5mB9xq44LLX4LHdgRiO
+8ltaPOB62EFvCR6oB69uHoKH5RjFgLWDt3vu9/2NTgRu2rILRkfgODhY09RN4R880JgRT/DY
+qJE89+JoHjwFniUR4PHzv9uolj0dksPBY3Nhzo5HJeZckbH9VsLbKJDknNzvmNjlmNTulNLp
+nNLjmjpgGtqg71UCemPy2BUn/9SY5NLWdmpDbV9kNMHEKr6Q2NzaRrF2j0/NI1XV9xaUtQQl
+EpoHGVWkMSpjDhpWYHSP57rCjjK2eqDnvOA+Hrjg8uqBB3QDgP07WGjspGC9F7Dv0bAv5igP
+DfubgwcHV/APHkDkzRKwLQfVYWvHei/A0Ry4CRwBdtCgLnguaBM4IM+qQXnsEVCN2H2x4z4b
+gQcogMpjLxHc5dhdNzScBL6mEltR7dhhJuz1hw1AZwGKmXrncR+fo/EQ1TicT0B12Lbpu2ai
+hsGLiW0bN9fh4LF3wloL87WwONvb1Z6YnOISnBGU1R1ZOBSe3xde0BtZ2B9BGAonDEUV9lv5
+FoDeeHDkQkx2TX0PndTa3949VlI/6BKQWVTe1NI2QuoaT8qprGzoLq/qik6rKCANWgW2+MdV
+jDNmO4cn2gd/0o4hZufQRNcQvY8ySZ9ZZq0+T38MFlhrM2sOwEAMDh644HKQZZM4HhuBB1oP
+Oi+4DD5hX496f9Afoa/c5WEPtXfgAZ8D8MhoGRwBEQjsu0HfCncEX7HtR41E5wXUM6Z8o6ph
+/wsKY3eHuCJjEodt20bgAdoJFkAVYIGDmsDCkR/MwEoEM9hN8AjYdkKiQG2ABcCZWgYUcB8f
+LCNsAAuQr7ANQ1cPHAEcE3yCxkC6QI0Be6HaD6BL6qsKHmsWB9jFs8hjcxXN42Xt4xUdzLI2
+emnruha3TpR3TFV3UBIzy0Bv3Ddy2SKgWtOhJKu8r7Gd0k9eItPnqxo7a5oG+8fmalr76zuH
+0gtqajroFn5ZEoZZLhHVBc30/HpqAUbz68egFjRQi1vojT2MUcYc2xWE3RDWAfEAwcEDF1xe
+MfCAPQ56JQc91CW1IPjT4+gTYRnu8rAf5wCPpm4Kz2kpOwAP7JEhXSCTBTwpaIXgeEmH7YQe
+DqB7RTiE+ISjXnAK8AjcgyOoC56eXeC+FJv7eEBjEbos0OKBjA/ovFDt07OLWDsPB/xw8xLH
+8bmHWrAN4z53SEHoXNCF3egq7aLs9ayWw2fxYK20DVJJfcyKFlpRI5XYTCU2ja8p7bmONfTP
+RaeV1TT2gN54YORSeHrHI+tiK/+K4prh0GhiQnZjSf1IXtlgSnZ9am59clZdbkVnUEJtYGJ1
+YFJtVdckoZX+4gE5dDy/YaysY6S2a5zURWODEOtAXBkcPHDB5VUCD9BNoxdtqMgJAfWwsAzc
+kWd52PlygMc7F63Rq/dLggfqlFHtyPUUNQa0E1UHFTUGgseWAMZh5IECeQZrxsHCxibgAY6G
+pvBgj8DhXAoLgBPk7uix7eRuMxwx4T7+5uDBPaUI/Jt4boI17il44NlpOWRx+Znc0wxh9axI
+wlhFD72slVbcQgVaxPYsHQefFe3jFc0jsSmlLZ0joDdu7rhg6llGbCAXNQ2T2odTsyvTipur
+O0Zr2unVzdS0/IbweGJLH7WsdrC7fyIgutAnqb0QHKFzoqRlvKSFBrS4ZXxN1ysqbR2v7pqO
+KBg+K5csrhVBHR99tsQ6CJ4fAgaPw5urBfxsgW4SrGC7B6luHuLnaKAM3EsATIitiJ/zBa9y
+sBh6pxOAgP4IO7UQBw+ODnecOQunjVj6E4rr+qA2dLInsEdlN4D139330nZMBwtukWUblQfa
+P8LgAI/yhgG4Cdy6LwMeZQ39kGGgNwJoD1iWMIzG1g6qyCrtgGcXk9OA3bS4tALBg0ybhAcU
+eRgCSl7XDOWoF57m0TuuqCTWxBGSVgu+TkzNwdOHD6WNwAM20ie+El4WDovHt/e84MFBs8HR
+gDZ3jRp55MDaQYPh1gfWyfD68/zf/eWCNc/jbw4esGEyJnHrPd3Syp/OWcCvOHjss7nj2coq
+a6W2uV/FNOrEnYArDzPtozu907o9kzvdUzrd0zr8MjsyKsmAH3KLW/KIHaA3bh+4ElsyVNVF
+q2oj17YNkbro1R2Mug5qQ8dYXRe9rnuisLY3Lbe2trG/e5Da2Dnw1Kv0gka2nE2xW3q3Z1q7
+V2oXUO+1T68UoJ320S0/Kib/U9jz/G1r/cdWRCJhfv5ApIYX/KwWyvjU8spumnuauingOQaU
+w0F9d2XzYAUmXrngCQBfWMBj59v7XsjBbKODXNUIAQ8lflhlE5928JyJzm7YLbLiNsVvDjx8
++gC8jIDnMOh3gK73WfX98MH++swl3BI84H8NKfhfQP8NaGaH3gXoAiLzAvaO4i4PHRe3nE6L
+fUNHDdgIPFAZrKvDM8zwBPRSgM6Q2B2RhwYsgL1XkYUEKE9I5janYK8bWAN+g9j5NRuBB9Zb
+A9WIwAOZZThm63DUjm0n9+8a3NU8j4/+C5v7eKCrgWxBOHjsr7B9KVZZy0tLw/29GbklYVnN
+KZXDaTXk9GpyWvVIRnV/Vee4TyQxjUhq7aUTitpAb1xUdyazrK+ufaR5cLK4jVbQwh5GKW2h
+1nczqtqGajuHG3tp1Y3DecSGqrru+lZqVGplQTPNO707tZaaWTeaCT5raRm1tPSasbRqcmbt
+aFrNWFB6m7tHiKeLc3ZW1tjYGIt1IMZaAHXs6agch9R3kMHNr2iRuIvHFED3t2VHDB6MaCQa
+PsZ5PoH56c23BR7glLE251cPPATwtDzU4IFFDmyUUY5ZKgiD0S4cToYc5WEHt3nkUrSVQ7lL
+ojhjUM8p+XNAAsesFuy/m2NaB/SIgBYPOPbBMceEQ7CzWrBHRv078ohAtz3PyKWohbAN2MsC
+zwhtxc4R5q6d+x+BCsubJ/A8/rPnozwIabhntSAAY+8eW859LqjGLQOx4uCxm+jxbHVyfr6l
+b6KsjV7WzgAIUdy8NhTSPF7VOVVY3e/ik9DRx2juoBWWNTf2PA1O8X3qVfrIoSowdyCrnpxb
+T8utp+aSxgoaxso7R0uaB0id1MYeRnZJa3Jue2hcXXouKY5Q1zC8sDbOQl37hOMstLWK6MWt
+tJJuakkjrbC8u6uHApPGrLBeu+S2e+HjsXn3B37F8HUjMrMeO4iA9eniGFZAu4DfO4djGz/M
+sMm8e+xBwtLrsEeDLvfw0QQagFqIeAA8xKCLO2oVKAD6C/Dk5DgdnqcPFJ0gOhT2aJuAByiA
+mgcH37mvPCzwyD5to9qxXQO64GAlnCOJrQIdBL7kovkLoDz34A7PcwGSX9kNi2Ev7CsGHvzc
+ii8Tx0PAAqNYbNQwrI0L+XjAqTdbW1nXinHPJAXHxI7C8HN9Nt+60WTVTTbxefwtz5TPS7Gn
+goMHVpYWl5p7qNW944QmOofPZ2ETraydWVhHLmkYaO6drG6hkDr6usgzhEaqkV/tRzdjP7+T
+qOVVo+9L0vOtBarrU2MYUOOS1BaQ3eGd0PHYqdjErSwgtbWqYySrvKW6e3oj59LCZmpB82hh
+83hJG72mm15cP0Slz7122CFw8ECmWmiBBN0QUA6LBHJvg0827C5Yp3T+wWOTl3TsQc4q+qE2
+oMluqFLumYNYMzXchA0RwF0dOi+0O6wX++6GFjr6qZuAB9ayjQ1TiTUCo6MhBMIa2DkaiU4Q
+yy3YKrCefki53R15ngsEDEWLRNSwQx3E4GXA41UVDudSXA6I7DV4JCYmOjo6HparwZyZE5GP
+e+zXUNL5/7d37sFVVHke9z+namfArXJ2tGpntBQc1NHCUSlhZyQlpeyMCzgIjkhE16AriouE
+AIpCCPIGuQl5EFDCU4KARh6KPBRCEsIjiIDkKYFCzOURcjFjDI5A9pf8an/183Tfvp2b5HIf
+30/9Cm5u9zl9um+f098+53d+x7enwrfryLlm+6rZdrb8u7/su72VdYVl3gPV9flHLiQvLOk+
+ZPXY7N0fFHybtbY6b/fpvN3ej3Z/S5ZX7M3bc3bT3pqtJac27D3zzqbS9ftPzv2w7Nlpnxce
+rd9fdaHwaC3nbFqz9vDuqvLuOnZ+Wm75XY8uX5u3/4cf62Ptzgyl8BABwMqhR3wGSQ4ycWtn
+pcEO9vopL0lYD3CntEvhIY5hAX08RHjIKC0/smXI23banQzHU+HJ6MnL8wqtPg/SV8AdHbyS
+V5Nlkh2f49INJQ7Cg4ok+ct8BEN4sKi7td8sw2mfD0r/Wictcv7cj6EP0X/UUslfwk3QZw6V
+aR1eN86FrxsLD94kR/fXLwThAeEBwl94RBaXr/z05tydtz7yzhOvfbqu6BTJj91ldUVlpDTq
+dpXWFZTWFR09X1B2fnvpubm5Zb2Hbbqu18IHnlmbs6V6f0XdvvILtLXw6PmiFmseQCk9U3j0
+bNGRM7tKawsqzxZUnsnN/6bH0x/GPb9pxorSLV/W7T7qKyqtK2RrPpCPrbD8/LqS00MnFdz4
+5+z7B76dmpn+9fGKWPst2Mdj5Mz1IRAe/O5Mjx7uQH4wIZu73JvUlLcmFbXAmkQHWdIP4kFJ
+K6Rv31Z1+IvSYys8rF4c2nnM2GqcrIOPhxGcQQs//e7PGdJj2tnHg4MnSBREQ3joiAq8Sa6k
+7UkZgsE4hKgXa/eRPqK/c+GtLDykYAFnXkB4RBBUWx99JQfXAcIjvLl0oqr8zbdX3N4v84H4
+D0dnfJGUdWBM5qExGYcSM75ssUNjsw48Nj7/170Xd/lrzpjskh1H64rKfTsPO8TlOLfjyLnP
+v2q2wvKzuTuqew1deUv/Vf1f256Y+cWYjIPNmac3Zz4mg/899Gr6oZ7xa7o+OO+J/5k5MSUl
+Z/GC6uPV+G06TnjoTng2eiyyb5V+nOnA0dYk4o6lH8QygUV7agVUHf6EhzXKQduFh3MvkBY5
+boSHhFIU53x/woMf9xJfWj/onYMP6EO4FB7+zgXCAwAIj3Dghwvnv9i/J2vB8ldGZ418fcGI
+N1JHvJbx4vj0F8bOfz4p7fmk1OFjZg9I8AyIf3vk2Kyhb3y2dNuJomMXCsvOBxQeBeV1uytr
+J8zfmzgx7dlXZgwZ4Rk+Pmv4uFTONiHRwzY80fPcqHlPPj8lcdzkebNSVue+d+jw0Ybvf8BP
+09E9HrYyQAIo8biG6AeHJM5DLaI6nENM2AoP6yyYjuvxEMdX6SXgfoNX52zwJzwkgCQPP2nX
+WeuVl1ESfz0eVhXX9P8xneQQpBncCA9/58LKB8IjDKFfKmg3G4e00bECGoRHFHKl6WJD4/GK
+0o0f5mame9JS56Slzk1Pm5c+f17G/HmZ8z2ZmanZizKzsuanZ+T0GvxulwErR3j2flxyZm/V
+d82xxcrOF5c3255mq2Urpn+/9m0+cOal6Ttvemhx8ox5Oe+kL3lnceb8tOac097OoGzTU9kW
+pKflZGYtzlm4fNXizz/fdvJszY+XLzZdufozakMcx+NETV3PYVkZ77fnULs8jHiyv8yYkAc6
+uxkcrvRaZQk7QsjT2UjS1OK+GFB4yAs+T8MXcyk8JEIjB6lmJwr3woPL7+DjQVt5YILdTmSY
+g5trvg5rth7yJzzk+c5eFrY9HuyDQfmTCtJ9SnJ0OSntZ6IXLNOHsPZ4yCZ/Ph76XLgAUSM8
+ogb2tCGrvdAQdFrrfR7cnG5dT8m0pOE5ZdqMyb+0M485stFnCREG4QHh8TPd0bIqyqVLl8+e
+O1tRUVlaWlrWQnl5eWVlBVlV1dfHqo/Rn+UV5Ws3bhnwYvZNjyzqlbB+2tryZTuOL992cun2
+U8s+O7Vs+6nlW0+t3P7te5/VrMg/NW3N0fue+uD6Bxb87YVZ6Z75u4uKqqurKyuIcvq32RTV
+x74+efJkjdf7fcP3LWvHhMWkligImS4tjzEDoskSuUinkkeh8b2RxE1cC73ek15f0qXwaPr5
+/BSZoOFGeFAbyHEXrbNajPU05bg6ZoIckZ4FDkMtegTKVnhIhjq0lz4pYwlR68XUh9DCQ1xt
+nWe16HPhAkB4hKHw4N8oOOGhHcLbLjyst42xVI2/W1cclbW1ak5uFJOXl9ehTxN6ZBcXR5J/
++JUW3Ox56fLlGu/JjRvyJkzOenBIZu9nMp5MWvb3xPcGjVn9eOLqQYm5jyfm0ufBSasfH5/b
+66n53f8y/amXp06bPfXjT9afPn26NUUKiysTBcJDYjvYvqTwognUmMxbUWD71mOd6SBJ6F1G
+miOHEOISbNwwf+9ZnIkRx4NDXlD7Jktp84iPEcncGshi6YYS7mmxvTgSSUO/1knQDDpNOX2H
+kOkSK4N2lgLowtAO/A6Y9/lX+uh09TghbdWXznox9SE4BIdsIu3BP4dtHA/bc2lScTz0a2wb
+I96DNsJTsdo3bVuEB92WW3ZXGEvKykAn9xOKDjGm29MmcUGH8AhZj0pkrdXSKv55qen0uQt7
+9hQsW54zbcbsSSnTJ6dMeytlSou9NXnK1GZLmTppyqzJKSkzp05PfXvWp1s+Plt35tLlyOtw
+wyJx4YZLdxEAIvHeZnnAscJkPjtpQuNupz9ZYepodVpaHK708lZb4SHJ/bmF2IapMYSHrbAJ
+6EAOIDyC6RtpCSpK1tDY8M03J0pKSgoKiwqI/HyyXWS7drIV5BcU7NpRWLDrwIED5+vqmsJk
+udlIEB5DJ+SiEhnNIDuoSOTqWA4SDqJVdcjAhDzc9biGhMk1JpfZdmvopXINrycdhU+Hi/cn
+PGRGla3wEBcs3eMRoTFhIDzCWntcuSIDIVcuX7586dJP9vyT/7t0KYI9i0K/SBxpj9O19ahE
+1mZQhps7dD0FAMJEeEgEOe04JA7ePI2FezwM4UFS4YY+b9EmPRTCm/R0Kh3szrbGUUUbn/qJ
+sWidFEa/CIiPBy9eL1UVXkMQHiAihAfw1yxjViCwMmrUKK/XGx13uLXHQ/cqGMJDD75Yxzv6
+j1oqLzLWGdbi26PXl/cn9fUyRk0W51JZmU7gpd8cVisAEB4grISHr75xyqLt8PEDwCVRE8fD
+QXjo4DB6NpZ0KWjhwVFfZIVrvUlPVdNrG/kTHiRyeE1Y2xC70p1iKy1oq8iP/V99gxu1qWXW
+SYeudQ7hAeERHHAuDR/Ywc+2p4UjZmizXdlT5u/Qy6m8YwIIj7YID4ZnY8kgiFYX7ASSMHmd
+VXhIz4lx91oLIz4eFSfOcnJxBdFlE4cT50UQlm4owY3ahNVpAYQHCIS1S1nPHbaGJdFtryyn
+a3gGAgiPNgoP66iHNX4L7dkjPsO4FUWTGDPCbCWxdi6VUHu8p1E2qQtcMNpZSigxPbbtqcKN
+CuEBIDyAS+HBvdmPjV6uw4/LBEPu0NDvnroppjafd6DWGMIDwqNdhAd9aawKRPekITzk/rSO
+p4gO4Rz8+X9q4SFyhQdcnNdO0jNuRJP/o+EiblQIDwDhET6Nre2a9S0vYhf1EAa3rtY9+Xvb
+wQ7GNrCSGz9V3ZxKh7PRsMs7o26obQe+dUQv5wKD2BQeHBmPrPZCAweLE88K3iTB9lkw8PQu
+CWHHaeVWH/LaKt6BQ+XrTToHw3FU4JB04jXKScjopjXKxq0Wb92YX6ozJ6PdcJ9DeIDWEhcX
+t2TJkpAdLnacS6lF0p7zMkOWGi5usp6dtEYGOHTob2NEQ79YSWMomVDLySHTdSod9Z1zsJ1R
+qPXDiW/rHIRHk13XtG2IszVbD+kCo35BeAAIDwgPAEIDPZ3poU8SS0QFv17JOMXwlHW621ZG
+NGS8Q4aeSVQY8QQkE0oS/8Zq/ZTXqaTb2Vl4kNhIyd5mHdcWJz2JsMQFkwmMnETLD16dlqWU
+fmcEEB4AwqOD8ufvA+Lz+XSq5ORkN6mMF3OqjG5SWccR3CSkE7GeHWkt51S2YiwuLs5NOYO7
+kta5S3SVWnslQ8yeIyd99Y1RXwf10AM/uI1F3/7RcFGCIrJHPc8T1HMGtbO9eOzz6iTyufZC
+g0MqIyqjVXjI4m5aJ1idS0nP6AEdHbhJ9+f0iM/Q69QDCA8A4dFe0PPO1jGAF6cLSGNjozW3
+gBw8+LN+XVIvblJZH81uEtKJWM/O4/E4p6IdrKnoKe+mnMFdSWuLRFeptVcyxKqDnlMJyWuj
+vg7So1/Ggv0tc2+dRSjxjqxBF7V/ne1Ksno6oSEhHIQH943YCg/e5BDKgA4n8oOTS/eLdv4H
+EB4AwgOAq0WMOJfyabIPBq9f2VrhYZUQboSHVa4EFB5cqoTJ6/TyEzqVeJb6GzrR8a5PfFtH
+kkO0FrQHhAeA8AAAwiMEeFYW0Gne2m/Wtj1VG/NL//Olxa0VHrUXGu4a7KHP/ztr/dINJWR9
+R7xLfw5puXT+hEfNue948SxJ1Tsh243wKD125oY+b5HlfLTfmv/hSq8Uhv4cnrKOduD8M1bv
+5k1csFWbDxZ8cfzjgnJ2eV358Re459tdeLjp1bR2bFImblLZdvYGTGU7ehuwizj03eZWCZeb
+mxvKbvPgrmSHdpsbng8uL6a125yubffu3SE8QBhyoqau57CsjPejf2FHGYOgD+waKrMF9Zqb
+xpQT/lNmwhqzWiQigc7ESMWzC/Wh/QkP7poQ94wFa4o5H54zaBSMA1kbnq7WgrHEwvpZHYob
+Py6rKxc9TdyksnVvC5gqLi7OmiqgU1zoHQWtEmLAgAGhdBQM7kp2qKOgVYy5uZhWgcQ3WLdu
+3VBDAbiK2EbYCAJ/kUDcHFr7tbb72dkWLIjSAgAAACBCmZmzQyaVyJpZ1oAbAAAAQCxQfvzs
+v/R8c0LGp7gUHYQOq6jnmwAAAAAxCNZq6Wg25pdyOGgO+4x5JQAAACA8IDwAAAAAAOEBAAAA
+gGgidiKXAgAAACBMtEcsrNUCAAAAAAAAAACA2OF0bX3vhIWIpA0AAACAEADnUgAAAABAeAAA
+AAAAwgMAEN34fL6HH+lzTeu57fddjTVqAQAAwgOUlZVd+4trg3isjBuXhKsX9WzevLlL11vS
+3n19X+X77m1OVtJ//OkB68rsAABgpfHHn2Yv3fllRQ0uReyQl5d319139unba+X6We4fLq8k
+xd/f417SLbiA0dkUNDaStvxT3P2bixa2SnLcfmfXfv0f9Xq9uIYAAADaV37krJl6z7135eQs
+xtWLMkhP3nf/PaQtg5Ac6OgAAKDHA3Sc/PisJGfAoIcHPzHQ5/Ph6kUH+/btveMPt7nXn5Ac
+AIC2AB8PEIT8mO4Z3aXrLcXFxbh0kQ4JyH6P9S08shKSAwAA4QHCWX5sLlrY/Y93wOM0omFX
+0g+2pUFyAAAgPEBEyA94nEYo7l1J0959nSTHb37zbx6PZwcAICZp37H1UAoP/HYRxKuvvnrt
+L64l+bF+RwY8TqOMVrmS9h/Up0fP7jAYLGbtli6/e+GF59uxCQrZWi30LOvU+Vf4BSPOpntG
+w+M0msjMymiVKykMBotxmzRzxNPD4iOxuSPhQU8x/IJRbPA4DWeqqqpmzZ758uhhqYsmFJeu
+wu0K82fTPKMmTn9xybpp7Zjntn3vUp7tni0sQoWHt7b+5RkffbTjKIRHe1nuprmtql+0J+1P
+lb19izF3wVjKlgoTynPfeXDZxOkjRo99cdGihefOncPjPrLcOWBXxeIe7vHbm280rAMr6ZfL
+nHego19zzTUjEp9sx4Mu/3AGB0Bu32xhESo8QubjEc7Cw6jy1A6s25oadG5jJv53q+oX7Un7
+t3tT0/3ebpQtFeaqXFI4fkSiOwfsqhhXVW4EOlp43P3H3wdsmiA8YBAeoREezUtc3X4zf2ij
+DIDwgOMH3Dlgra2q9G8IjtXpul9CeMAgPMJHeCxcNbnZh3/wQ1xBqKZAeMDxI0LhFWafGPqo
+y8hgsPAUHnEP96DvxyY/918D4+hf/jJlzkj6ko3aK909S3/Kl5xW+m8pOR+ImhrOM6DwkANR
+hnqkZuCQh+X7T4qy+XvOnw5nLQyEB4SHwZcVNSQ8Rs5cD+HBwoNlACHVmWofV2GuVgtWJBuu
+FHor1UpDeEj19ze0KsKDjshVlWztpx7eSoeTL8moMNZGif+k5LwPlzxMhIeEGtu6dQv0QGgI
+boVZWBgKD26aeAduUuTNSHfPUiuks5LxGt6Bc5aWLaAA0AeVTER7UMJO1/1S8pdiW1+g9HlB
+eEB4YFaLbUVLnvkS1V/+LLWM64uuyKwQRNJLReattL8WHvEJ/XirIVdshYduK6R66mFf3iRK
+w+gRlarNfTXhIzzY/ja4L+KMwY8U5sbHQ/oNpNY/99JAakPovYP/pIZF3jX0416y4lZC99/S
+iw/9S5qB0vKfzu0h/UtH/KQo2zgEleG9DbO5weE9uXGD8IDwgPAIQngIXKmlG0FqClVV3pN3
+kEZAejvpG/ogwoNkjJu6Jm8irHaoxaDP9/X8g2gb6czkZkReMSJLeGzalQV3U/iRwhyEh2DU
+cXkPMjQA94haa70kN9oEq48HfRaTlyOjYbEqik8Ks6mto+/1nhAeEB7uOVFT13NYVsb7xRAe
+t91+M9URa7cGyw+qlVLRuCrRW4mtbwYLDxInRqPB0kXXdH7psFZY+izCo7maF2VTtaXdjCNG
+lvCAu2lHO3V07tyJ2gc0kpE71EI1l00aH6OOWwdljAd6a4WHfufSvawOwoMkhx5qgfCA8IBz
+adt9PKT/kAWD7sw0xkz9jcyy8BABI/0Vuvbp1sBZePAcf12AyBUebP0efyhCe+3Q4wG7Kj4e
+boRHcD0eInX04Iuz8KAPvXrfY90TwgPCA8IjaOGhfaukW0PGO3RVchYe0uOh3byNmu6vJ1OE
+B28Sf1FrC4AeDwAfj9gRHuwzRl9K68HDr4aPh7Pw0H2wbqbT6maHM+RN8o7Gf/IYMcGertRg
+6oYUwgPCA8LDQXhozw3ZJHNJdFUSxy3ZSq8MelZLq3w8bIUHNyPSUBiNjOFVbkwEho8HZrWg
+wYwy4SFPc54Sa/VFDyg8brjxet4h4KwWW+HBBaBMqLUxjk4vR+Iiy2WD8IDwcBYeQyfkQnjo
+wRTx8ZBxFl3RuCpJI8DfcF0zZrWIGHAzq8UqPCQ5z6g1hlq4N0YfHbNagLh8II5HpBgPpxpd
+o3pSm35Yc4AO3VLprUZW3Cmhe0gGDe3rZjqtzpZ926TZiU/oxz4eY5OfM/aUbl7+UhdGSgLh
+AeEh2uN0bX2MCw9teiKJTLDl7416bW0EeFaL1C+eCOMcA9mo11yePn95gLWNeLzTB67Xsqex
+lYsqjQwXDHE8YhlELo1WY4fz4FZ2CDqhntXinD9+IAgPTKdtu1FV0j6i7dgIuDHK2SFz561X
+3RC5FB6nMBgMwuNnXbL1jVMWbc8vqYbwgMGVFB6nMBgMBudSWCQaVqeFxykMBoPwgPCAhcZe
+SYq/v8e9cCWFxykMBoPwsLLnyEkSHgnJayE8YO3lRzpuXBKe8vA4hcFgEB4O2sNX3wjhAYMf
+KTxOrRb/3ACquTAYLGbtli6/Gzbs6Qid1dKp86/wC0acTZ41En6ksexxOicr6d9/e+NNN920
+ZMmSHQCAmMTr9UZoW4ffLoJITk7u3LkzCY+AffLwI410j9MPtqW56Wsl+fH0sPjjx4/jugEA
+AGhfffjnB3uR5HCItgo/0qjB5/P1e6yvS3dTyA8AAABXS3LAjzRq2Ldvb6vcTVl+DH7i8YMH
+D+LqAQAACIK8vLy77r7TpeSAH2n0EUSA06meUbff2bVf/0chPwAAALRWcvTp28vlCy/8SKMb
+9vogUUES1L0Nefavd9zRDQoEAACAg9i4/tf/OnrCM+4fLnDngPCA8AAAAADhAQAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+wJn/A5vjFyA=
+</bitmap>
+<ipestyle name="basic">
+<symbol name="arrow/arc(spx)">
+<path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/farc(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/ptarc(spx)">
+<path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-0.8 0 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/fptarc(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-0.8 0 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="mark/circle(sx)" transformations="translations">
+<path fill="sym-stroke">
+0.6 0 0 0.6 0 0 e
+0.4 0 0 0.4 0 0 e
+</path>
+</symbol>
+<symbol name="mark/disk(sx)" transformations="translations">
+<path fill="sym-stroke">
+0.6 0 0 0.6 0 0 e
+</path>
+</symbol>
+<symbol name="mark/fdisk(sfx)" transformations="translations">
+<group>
+<path fill="sym-fill">
+0.5 0 0 0.5 0 0 e
+</path>
+<path fill="sym-stroke" fillrule="eofill">
+0.6 0 0 0.6 0 0 e
+0.4 0 0 0.4 0 0 e
+</path>
+</group>
+</symbol>
+<symbol name="mark/box(sx)" transformations="translations">
+<path fill="sym-stroke" fillrule="eofill">
+-0.6 -0.6 m
+0.6 -0.6 l
+0.6 0.6 l
+-0.6 0.6 l
+h
+-0.4 -0.4 m
+0.4 -0.4 l
+0.4 0.4 l
+-0.4 0.4 l
+h
+</path>
+</symbol>
+<symbol name="mark/square(sx)" transformations="translations">
+<path fill="sym-stroke">
+-0.6 -0.6 m
+0.6 -0.6 l
+0.6 0.6 l
+-0.6 0.6 l
+h
+</path>
+</symbol>
+<symbol name="mark/fsquare(sfx)" transformations="translations">
+<group>
+<path fill="sym-fill">
+-0.5 -0.5 m
+0.5 -0.5 l
+0.5 0.5 l
+-0.5 0.5 l
+h
+</path>
+<path fill="sym-stroke" fillrule="eofill">
+-0.6 -0.6 m
+0.6 -0.6 l
+0.6 0.6 l
+-0.6 0.6 l
+h
+-0.4 -0.4 m
+0.4 -0.4 l
+0.4 0.4 l
+-0.4 0.4 l
+h
+</path>
+</group>
+</symbol>
+<symbol name="mark/cross(sx)" transformations="translations">
+<group>
+<path fill="sym-stroke">
+-0.43 -0.57 m
+0.57 0.43 l
+0.43 0.57 l
+-0.57 -0.43 l
+h
+</path>
+<path fill="sym-stroke">
+-0.43 0.57 m
+0.57 -0.43 l
+0.43 -0.57 l
+-0.57 0.43 l
+h
+</path>
+</group>
+</symbol>
+<symbol name="arrow/fnormal(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/pointed(spx)">
+<path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-0.8 0 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/fpointed(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-0.8 0 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/linear(spx)">
+<path stroke="sym-stroke" pen="sym-pen">
+-1 0.333 m
+0 0 l
+-1 -0.333 l
+</path>
+</symbol>
+<symbol name="arrow/fdouble(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+-1 0 m
+-2 0.333 l
+-2 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/double(spx)">
+<path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+-1 0 m
+-2 0.333 l
+-2 -0.333 l
+h
+</path>
+</symbol>
+<pen name="heavier" value="0.8"/>
+<pen name="fat" value="1.2"/>
+<pen name="ultrafat" value="2"/>
+<symbolsize name="large" value="5"/>
+<symbolsize name="small" value="2"/>
+<symbolsize name="tiny" value="1.1"/>
+<arrowsize name="large" value="10"/>
+<arrowsize name="small" value="5"/>
+<arrowsize name="tiny" value="3"/>
+<color name="red" value="1 0 0"/>
+<color name="green" value="0 1 0"/>
+<color name="blue" value="0 0 1"/>
+<color name="yellow" value="1 1 0"/>
+<color name="orange" value="1 0.647 0"/>
+<color name="gold" value="1 0.843 0"/>
+<color name="purple" value="0.627 0.125 0.941"/>
+<color name="gray" value="0.745"/>
+<color name="brown" value="0.647 0.165 0.165"/>
+<color name="navy" value="0 0 0.502"/>
+<color name="pink" value="1 0.753 0.796"/>
+<color name="seagreen" value="0.18 0.545 0.341"/>
+<color name="turquoise" value="0.251 0.878 0.816"/>
+<color name="violet" value="0.933 0.51 0.933"/>
+<color name="darkblue" value="0 0 0.545"/>
+<color name="darkcyan" value="0 0.545 0.545"/>
+<color name="darkgray" value="0.663"/>
+<color name="darkgreen" value="0 0.392 0"/>
+<color name="darkmagenta" value="0.545 0 0.545"/>
+<color name="darkorange" value="1 0.549 0"/>
+<color name="darkred" value="0.545 0 0"/>
+<color name="lightblue" value="0.678 0.847 0.902"/>
+<color name="lightcyan" value="0.878 1 1"/>
+<color name="lightgray" value="0.827"/>
+<color name="lightgreen" value="0.565 0.933 0.565"/>
+<color name="lightyellow" value="1 1 0.878"/>
+<dashstyle name="dashed" value="[4] 0"/>
+<dashstyle name="dotted" value="[1 3] 0"/>
+<dashstyle name="dash dotted" value="[4 2 1 2] 0"/>
+<dashstyle name="dash dot dotted" value="[4 2 1 2 1 2] 0"/>
+<textsize name="large" value="\large"/>
+<textsize name="Large" value="\Large"/>
+<textsize name="LARGE" value="\LARGE"/>
+<textsize name="huge" value="\huge"/>
+<textsize name="Huge" value="\Huge"/>
+<textsize name="small" value="\small"/>
+<textsize name="footnote" value="\footnotesize"/>
+<textsize name="tiny" value="\tiny"/>
+<textstyle name="center" begin="\begin{center}" end="\end{center}"/>
+<textstyle name="itemize" begin="\begin{itemize}" end="\end{itemize}"/>
+<textstyle name="item" begin="\begin{itemize}\item{}" end="\end{itemize}"/>
+<gridsize name="4 pts" value="4"/>
+<gridsize name="8 pts (~3 mm)" value="8"/>
+<gridsize name="16 pts (~6 mm)" value="16"/>
+<gridsize name="32 pts (~12 mm)" value="32"/>
+<gridsize name="10 pts (~3.5 mm)" value="10"/>
+<gridsize name="20 pts (~7 mm)" value="20"/>
+<gridsize name="14 pts (~5 mm)" value="14"/>
+<gridsize name="28 pts (~10 mm)" value="28"/>
+<gridsize name="56 pts (~20 mm)" value="56"/>
+<anglesize name="90 deg" value="90"/>
+<anglesize name="60 deg" value="60"/>
+<anglesize name="45 deg" value="45"/>
+<anglesize name="30 deg" value="30"/>
+<anglesize name="22.5 deg" value="22.5"/>
+<tiling name="falling" angle="-60" step="4" width="1"/>
+<tiling name="rising" angle="30" step="4" width="1"/>
+</ipestyle>
+<ipestyle name="presentation">
+<symbol name="arrow/arc(spx)">
+<path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/farc(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="mark/circle(sx)" transformations="translations">
+<path fill="sym-stroke">
+0.6 0 0 0.6 0 0 e
+0.4 0 0 0.4 0 0 e
+</path>
+</symbol>
+<symbol name="mark/disk(sx)" transformations="translations">
+<path fill="sym-stroke">
+0.6 0 0 0.6 0 0 e
+</path>
+</symbol>
+<symbol name="mark/fdisk(sfx)" transformations="translations">
+<group>
+<path fill="sym-fill">
+0.5 0 0 0.5 0 0 e
+</path>
+<path fill="sym-stroke" fillrule="eofill">
+0.6 0 0 0.6 0 0 e
+0.4 0 0 0.4 0 0 e
+</path>
+</group>
+</symbol>
+<symbol name="mark/box(sx)" transformations="translations">
+<path fill="sym-stroke" fillrule="eofill">
+-0.6 -0.6 m
+0.6 -0.6 l
+0.6 0.6 l
+-0.6 0.6 l
+h
+-0.4 -0.4 m
+0.4 -0.4 l
+0.4 0.4 l
+-0.4 0.4 l
+h
+</path>
+</symbol>
+<symbol name="mark/square(sx)" transformations="translations">
+<path fill="sym-stroke">
+-0.6 -0.6 m
+0.6 -0.6 l
+0.6 0.6 l
+-0.6 0.6 l
+h
+</path>
+</symbol>
+<symbol name="mark/fsquare(sfx)" transformations="translations">
+<group>
+<path fill="sym-fill">
+-0.5 -0.5 m
+0.5 -0.5 l
+0.5 0.5 l
+-0.5 0.5 l
+h
+</path>
+<path fill="sym-stroke" fillrule="eofill">
+-0.6 -0.6 m
+0.6 -0.6 l
+0.6 0.6 l
+-0.6 0.6 l
+h
+-0.4 -0.4 m
+0.4 -0.4 l
+0.4 0.4 l
+-0.4 0.4 l
+h
+</path>
+</group>
+</symbol>
+<symbol name="mark/cross(sx)" transformations="translations">
+<group>
+<path fill="sym-stroke">
+-0.43 -0.57 m
+0.57 0.43 l
+0.43 0.57 l
+-0.57 -0.43 l
+h
+</path>
+<path fill="sym-stroke">
+-0.43 0.57 m
+0.57 -0.43 l
+0.43 -0.57 l
+-0.57 0.43 l
+h
+</path>
+</group>
+</symbol>
+<symbol name="arrow/fnormal(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/pointed(spx)">
+<path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-0.8 0 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/fpointed(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-0.8 0 l
+-1 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/linear(spx)">
+<path stroke="sym-stroke" pen="sym-pen">
+-1 0.333 m
+0 0 l
+-1 -0.333 l
+</path>
+</symbol>
+<symbol name="arrow/fdouble(spx)">
+<path stroke="sym-stroke" fill="white" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+-1 0 m
+-2 0.333 l
+-2 -0.333 l
+h
+</path>
+</symbol>
+<symbol name="arrow/double(spx)">
+<path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen">
+0 0 m
+-1 0.333 l
+-1 -0.333 l
+h
+-1 0 m
+-2 0.333 l
+-2 -0.333 l
+h
+</path>
+</symbol>
+<pen name="normal" value="1.2"/>
+<pen name="heavier" value="2.4"/>
+<pen name="fat" value="3.6"/>
+<pen name="ultrafat" value="6"/>
+<symbolsize name="normal" value="9"/>
+<symbolsize name="large" value="15"/>
+<symbolsize name="small" value="6"/>
+<symbolsize name="tiny" value="3.3"/>
+<arrowsize name="normal" value="15"/>
+<arrowsize name="large" value="20"/>
+<arrowsize name="small" value="10"/>
+<arrowsize name="tiny" value="6"/>
+<color name="red" value="1 0 0"/>
+<color name="green" value="0 1 0"/>
+<color name="blue" value="0 0 1"/>
+<color name="yellow" value="1 1 0"/>
+<color name="orange" value="1 0.647 0"/>
+<color name="gold" value="1 0.843 0"/>
+<color name="purple" value="0.627 0.125 0.941"/>
+<color name="gray" value="0.745"/>
+<color name="brown" value="0.647 0.165 0.165"/>
+<color name="navy" value="0 0 0.502"/>
+<color name="pink" value="1 0.753 0.796"/>
+<color name="seagreen" value="0.18 0.545 0.341"/>
+<color name="turquoise" value="0.251 0.878 0.816"/>
+<color name="violet" value="0.933 0.51 0.933"/>
+<color name="darkblue" value="0 0 0.545"/>
+<color name="darkcyan" value="0 0.545 0.545"/>
+<color name="darkgray" value="0.663"/>
+<color name="darkgreen" value="0 0.392 0"/>
+<color name="darkmagenta" value="0.545 0 0.545"/>
+<color name="darkorange" value="1 0.549 0"/>
+<color name="darkred" value="0.545 0 0"/>
+<color name="lightblue" value="0.678 0.847 0.902"/>
+<color name="lightcyan" value="0.878 1 1"/>
+<color name="lightgray" value="0.827"/>
+<color name="lightgreen" value="0.565 0.933 0.565"/>
+<color name="lightyellow" value="1 1 0.878"/>
+<color name="title" value="0.4 0 0.4"/>
+<dashstyle name="dashed" value="[4] 0"/>
+<dashstyle name="dotted" value="[1 3] 0"/>
+<dashstyle name="dash dotted" value="[4 2 1 2] 0"/>
+<dashstyle name="dash dot dotted" value="[4 2 1 2 1 2] 0"/>
+<textsize name="normal" value="\normalsize"/>
+<textsize name="large" value="\large"/>
+<textsize name="huge" value="\LARGE"/>
+<textsize name="small" value="\normalsize"/>
+<textstretch name="normal" value="2.8"/>
+<textstretch name="large" value="2.8"/>
+<textstretch name="huge" value="2.8"/>
+<textstretch name="small" value="2.4"/>
+<textstyle name="normal" begin="\begin{flushleft}" end="\end{flushleft}"/>
+<textstyle name="center" begin="\begin{center}" end="\end{center}"/>
+<textstyle name="itemize" begin="\begin{flushleft}\begin{itemize}" end="\end{itemize}\end{flushleft}"/>
+<textstyle name="item" begin="\begin{flushleft}\begin{itemize}\item{}" end="\end{itemize}\end{flushleft}"/>
+<gridsize name="16 pts (~6 mm)" value="16"/>
+<gridsize name="32 pts (~12 mm)" value="32"/>
+<gridsize name="10 pts (~3.5 mm)" value="10"/>
+<gridsize name="20 pts (~7 mm)" value="20"/>
+<gridsize name="14 pts (~5 mm)" value="14"/>
+<gridsize name="28 pts (~10 mm)" value="28"/>
+<gridsize name="56 pts (~20 mm)" value="56"/>
+<anglesize name="90 deg" value="90"/>
+<anglesize name="60 deg" value="60"/>
+<anglesize name="45 deg" value="45"/>
+<anglesize name="30 deg" value="30"/>
+<anglesize name="22.5 deg" value="22.5"/>
+<preamble>
+\renewcommand\rmdefault{cmss}
+\makeatletter
+\leftmargini 1.5em
+\leftmargin \leftmargini
+\leftmarginii  1.2em
+\leftmarginiii 1em
+\def\@listI{\leftmargin\leftmargini
+            \parsep \z@
+	    \partopsep 3pt
+	    \topsep \z@
+            \itemsep \z@}
+\@listI
+\def\@listii {\leftmargin\leftmarginii
+              \labelwidth\leftmarginii
+              \advance\labelwidth-\labelsep
+              \topsep    \z@
+              \parsep    \z@
+              \itemsep   \parsep}
+\def\@listiii{\leftmargin\leftmarginiii
+              \labelwidth\leftmarginiii
+              \advance\labelwidth-\labelsep
+              \topsep    \z@
+              \parsep    \z@
+              \partopsep \z@
+              \itemsep   \topsep}
+\makeatother
+</preamble>
+<layout paper="800 600" origin="32 0" frame="736 528" skip="32" crop="no"/>
+<titlestyle pos="368 554" size="large" color="title"  halign="center" valign="baseline"/>
+<tiling name="falling" angle="-60" step="12" width="3"/>
+<tiling name="rising" angle="30" step="12" width="3"/>
+</ipestyle>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="221.536" height="19.3704" depth="0" halign="center" valign="baseline">Some Preliminaries</text>
+<text transformations="translations" pos="16 512" stroke="black" type="minipage" width="704" height="116.909" depth="105.192" valign="top" size="small">\begin{itemize}
+\item This description corresponds to the {\tt RU-RAU-split} branch for RAN infrastructure components (located in {\tt targets/DOCS/oai\_L1\_L2\_procedures.pdf}, editable with {\tt ipe})
+\item we describe
+\begin{enumerate}
+\item node functions
+\item current functional splits and packet formats
+\item RAN procedures
+\item process scheduling
+\end{enumerate}
+\end{itemize}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<image layer="alpha" matrix="0.910864 0 0 0.743119 40 12" rect="0 0 723 430" bitmap="3"/>
+<text matrix="1 0 0 1 185 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="326.802" height="19.3704" depth="0" halign="center" valign="baseline">NGFI Harmonization in OAI</text>
+<text transformations="translations" pos="0 528" stroke="black" type="minipage" width="736" height="100.324" depth="86.576" valign="top">\small
+\begin{itemize}
+\item New descriptions for OAI RAN infrastructure Node Functions
+\begin{itemize}
+\item{\tt NGFI\_RCC} : Radio Cloud Center
+\item{\tt NGFI\_RAU} : Radio Aggregation Unit
+\item{\tt NGFI\_RRU} : Remote Radio Unit
+\item{\tt 3GPP\_BBU} : Baseband Unit
+\item{\tt 3GPP\_eNodeB} : Complete eNodeB
+\end{itemize}
+\end{itemize} </text>
+<text transformations="translations" pos="320 16" stroke="black" type="label" width="420.913" height="6.229" depth="1.99" valign="baseline" size="tiny">\small Source: China Mobile - {\tt http://www.windriver.com.cn/windforum/download/wf2015\_networking03.pdf}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<image layer="alpha" matrix="0.852308 0 0 0.885714 64 16" rect="0 0 325 558" bitmap="2"/>
+<text matrix="0.809524 0 0 1.02381 36.1429 4.19048" transformations="translations" pos="384 496" stroke="black" type="minipage" width="384" height="139.135" depth="127.464" valign="top" size="small">\small\begin{itemize}
+\item Current OAI implementation (RRU/RCC) supports either
+\begin{itemize}
+\item IF5 time-domain fronthaul ($&gt;$ 1 GbE required)
+\item IF4.5 split (FFTs) (280 Mbit/s/antenna port fronthaul – 20 MHz carrier) per carrier/sector
+\item Soon IF2 (NFAPI)
+\item IF1’ for “PDCP/RRC” soon (3GPP Fh-C/Fh-U)
+\end{itemize}
+\end{itemize}</text>
+<text matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="209.37" height="19.3928" depth="5.404" halign="center" valign="baseline">NGFI split points
+</text>
+<image matrix="0.866029 0 0 0.805556 358 8" rect="0 0 418 289" bitmap="1"/>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 188.731 -293.27" transformations="translations" pos="176 556" stroke="black" type="label" width="373.372" height="19.3704" depth="0" halign="center" valign="baseline">OAI RAN Software Architecture</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 90 -216" stroke="black">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 86 -212" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 82 -208" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 78 -204" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 10 -136" stroke="black">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 6 -132" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 2 -128" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -2 -124" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 86 -48" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 83 -44" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 80 -40" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 77 -36" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 10 45" stroke="black">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 6 49" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 2 53" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -2 57" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 64 18" transformations="translations" stroke="black" fill="1">
+528 64 m
+528 32 l
+640 32 l
+640 64 l
+h
+</path>
+<path matrix="1 0 0 1 56 26" transformations="translations" stroke="black" fill="1">
+528 64 m
+528 32 l
+640 32 l
+640 64 l
+h
+</path>
+<path transformations="translations" stroke="blue" dash="dashed" pen="heavier">
+528 101 m
+528 48 l
+736 48 l
+736 101 l
+h
+</path>
+<path matrix="1 0 0 1 0 -101" stroke="black" fill="white">
+392 376 m
+392 296 l
+512 296 l
+512 376 l
+h
+</path>
+<path matrix="1 0 0 1 -160 -135" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -168 -127" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -168 -127" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -168 -127" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -168 -127" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -168 -127" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1.25 0 0 1 -455.019 -129" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 0 74" stroke="black" fill="white">
+392 376 m
+392 296 l
+512 296 l
+512 376 l
+h
+</path>
+<path stroke="black">
+136 312 m
+136 272 l
+200 272 l
+200 312 l
+h
+</path>
+<path matrix="1.25 0 0 1 -456.019 50" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -161 42" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -168 48" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -6 61" stroke="black" fill="white">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -6 54" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -6 54" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<text matrix="1 0 0 1 -6 50" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf LTE\\
+MODEM</text>
+<path matrix="1 0 0 1 -176 58" stroke="black">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -176 58" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -176 58" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 -176 58" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -176 58" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 -304 58" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -304 58" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path stroke="black">
+96 408 m
+96 360 l
+208 360 l
+208 408 l
+h
+</path>
+<path matrix="1 0 0 1 -460 21" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -460 21" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<text matrix="1 0 0 1 -472 15" transformations="translations" pos="576 384" stroke="black" type="minipage" width="96" height="20.5912" depth="6.608" valign="top" style="center">\tiny\bf LTE/NR/NB\\
+PDCP</text>
+<path stroke="black" fill="1">
+128 320 m
+128 280 l
+192 280 l
+192 320 l
+h
+</path>
+<path matrix="1 0 0 1 -314 -86" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -314 -86" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<text matrix="1 0 0 1 -449 -71" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf LTE\\
+RRC</text>
+<path matrix="1 0 0 1 0 53" stroke="black">
+112 464 m
+112 440 l
+648 440 l
+648 464 l
+h
+</path>
+<path matrix="1 0 0 1 -122 42" stroke="black">
+432 224 m
+432 224 l
+432 224 l
+432 224 l
+h
+</path>
+<text matrix="1 0 0 1 -35 37" transformations="translations" pos="192 480" stroke="black" type="minipage" width="448" height="17.9352" depth="5.976" valign="top" size="small" style="center">\bf OSS/BSS/MEC</text>
+<path stroke="green" arrow="normal/small">
+192 296 m
+232 296 l
+232 404 l
+256 404 l
+</path>
+<path matrix="1 0 0 1 15 37" stroke="green" arrow="normal/small">
+144 288 m
+144 320 l
+</path>
+<path matrix="1 0 0 1 -48 58" stroke="red" arrow="normal/small" rarrow="normal/small">
+384 368 m
+448 368 l
+</path>
+<path matrix="1 0 0 1 -48 58" stroke="green" arrow="normal/small" rarrow="normal/small">
+384 352 m
+448 352 l
+</path>
+<path matrix="1 0 0 1 0 37" stroke="blue" arrow="normal/small" rarrow="normal/small">
+152 456 m
+152 368 l
+</path>
+<path matrix="1 0 0 1 0 37" stroke="blue" arrow="normal/small" rarrow="normal/small">
+304 456 m
+304 408 l
+</path>
+<path matrix="1 0 0 1 0 37" stroke="blue" arrow="normal/small" rarrow="normal/small">
+456 456 m
+456 416 l
+</path>
+<path matrix="1 0 0 1 0 37" stroke="blue" arrow="normal/small" rarrow="normal/small">
+600 456 m
+600 409 l
+</path>
+<path matrix="1 0 0 1 -6 54" stroke="red" arrow="normal/small" rarrow="normal/small">
+512 368 m
+576 368 l
+</path>
+<path matrix="1 0 0 1 -6 54" stroke="green" arrow="normal/small" rarrow="normal/small">
+512 352 m
+576 352 l
+</path>
+<path stroke="red" arrow="normal/small" rarrow="normal/small">
+88 384 m
+8 384 l
+</path>
+<path matrix="1 0 0 1 0 37" stroke="red" arrow="normal/small" rarrow="normal/small">
+128 264 m
+8 264 l
+</path>
+<text matrix="1 0 0 1 140.731 -13.2696" transformations="translations" pos="176 556" stroke="black" type="label" width="250.205" height="19.3928" depth="5.404" halign="center" valign="baseline">OAI Functional Splits</text>
+<path matrix="1 0 0 1 -176 58" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 1 -176 42" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="11.816" depth="0" valign="top" style="center">\bf\tiny LTE-L1</text>
+<path matrix="1 0 0 1 426 194" stroke="blue" arrow="normal/small" rarrow="normal/small">
+192 368 m
+96 368 l
+</path>
+<path matrix="1 0 0 1 426 178" stroke="red" arrow="normal/small" rarrow="normal/small">
+192 368 m
+96 368 l
+</path>
+<path matrix="1 0 0 1 426 162" stroke="green" arrow="normal/small" rarrow="normal/small">
+192 368 m
+96 368 l
+</path>
+<text matrix="1 0 0 1 9 392" transformations="translations" pos="608 176" stroke="black" type="minipage" width="112" height="11.292" depth="0" valign="top" size="small">\bf\tiny Management</text>
+<text matrix="1 0 0 1 11 375.418" transformations="translations" pos="608 176" stroke="black" type="minipage" width="144" height="11.9544" depth="0" valign="top" size="small">\bf\tiny data (user/control plane)</text>
+<text matrix="1 0 0 1 9 360" transformations="translations" pos="608 176" stroke="black" type="minipage" width="112" height="11.292" depth="0" valign="top" size="small">\bf\tiny configuration</text>
+<path matrix="1.25 0 0 1 -463 58" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 0.705114 -319 161.518" transformations="translations" pos="576 384" stroke="black" type="minipage" width="80" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf LTE\\
+MAC-RLC</text>
+<path matrix="1 0 0 1 -76 21" stroke="black">
+288 432 m
+288 432 l
+288 432 l
+288 432 l
+h
+</path>
+<path stroke="blue" dash="dashed" pen="heavier">
+240 460 m
+240 40 l
+520 40 l
+520 460 l
+h
+</path>
+<path matrix="1 0 0 1 -48 21" stroke="black">
+384 416 m
+384 416 l
+384 416 l
+384 416 l
+h
+</path>
+<path matrix="1 0 0 1 0 37" stroke="blue" dash="dashed" pen="heavier">
+560 416 m
+560 336 l
+656 336 l
+656 416 l
+h
+</path>
+<path stroke="blue" dash="dashed" pen="heavier">
+88 456 m
+88 40 l
+216 40 l
+216 221 l
+216 261 l
+216 456 l
+100.8 456 l
+88 456 l
+</path>
+<text matrix="1 0 0 1 -79 -148" transformations="translations" pos="160 176" stroke="blue" type="minipage" width="192" height="13.9468" depth="0" valign="top">\bf\tiny Radio-Cloud Center (RCC)</text>
+<text matrix="1 0 0 1 -113 -258" transformations="translations" pos="480 288" stroke="blue" type="minipage" width="192" height="13.9468" depth="0" valign="top">\tiny\bf Radio-Access Unit (RAU)</text>
+<path stroke="black">
+136 248 m
+136 208 l
+200 208 l
+200 248 l
+h
+</path>
+<path stroke="black" fill="1">
+128 256 m
+128 216 l
+192 216 l
+192 256 l
+h
+</path>
+<text matrix="1 0 0 1 -448 -134" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf NR\\
+RRC</text>
+<path stroke="green" arrow="normal/small">
+128 229 m
+112 229 l
+112 261 l
+112 360 l
+</path>
+<path matrix="1 0 0 1 0 74" stroke="black" fill="white">
+488 368 m
+488 304 l
+504 304 l
+504 368 l
+h
+</path>
+<path matrix="1.25 0 0 1 -463.019 -121" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -176 -117" stroke="black">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -176 -117" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -176 -117" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 -176 -117" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -176 -117" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 -304 -117" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -304 -117" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 -48 -117" stroke="red" arrow="normal/small" rarrow="normal/small">
+384 368 m
+448 368 l
+</path>
+<path matrix="1 0 0 1 -48 -117" stroke="green" arrow="normal/small" rarrow="normal/small">
+384 352 m
+448 352 l
+</path>
+<path matrix="1 0 0 1 -176 -117" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 1 -176 -136" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="11.816" depth="0" valign="top" style="center">\bf\tiny NR-L1</text>
+<text matrix="1 0 0 0.705114 -318 -17.482" transformations="translations" pos="576 384" stroke="black" type="minipage" width="80" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf NR\\
+MAC-RLC</text>
+<path matrix="1 0 0 1 0 -101" stroke="black" fill="white">
+488 368 m
+488 304 l
+504 304 l
+504 368 l
+h
+</path>
+<text matrix="0 1 -1 0 724 -196" pos="576 224" stroke="black" type="label" width="58.2408" height="8.3016" depth="0" valign="baseline" size="small">\tiny PRECODE</text>
+<text matrix="0 1 -1 0 724 -371" pos="576 224" stroke="black" type="label" width="58.2408" height="8.3016" depth="0" valign="baseline" size="small">\tiny PRECODE</text>
+<path matrix="1 0 0 1 -6 -120" stroke="black" fill="white">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -6 -120" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -6 -120" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<text matrix="1 0 0 1 -6 -131" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf NR\\
+MODEM</text>
+<path matrix="1 0 0 1 -6 -124" stroke="red" arrow="normal/small" rarrow="normal/small">
+512 368 m
+576 368 l
+</path>
+<path matrix="1 0 0 1 -6 -123" stroke="green" arrow="normal/small" rarrow="normal/small">
+512 352 m
+576 352 l
+</path>
+<path matrix="1 0 0 1 0 38" stroke="blue" dash="dashed" pen="heavier">
+560 231 m
+560 160 l
+656 160 l
+656 231 l
+h
+</path>
+<path matrix="1.25 0 0 1 -456.019 -44" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -22 -50" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -29 -44" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -34" stroke="black">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -34" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -34" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -34" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -34" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 -304 -36" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -304 -36" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 0 53" stroke="red" arrow="normal/small" rarrow="normal/small">
+336 264 m
+536 264 l
+</path>
+<path matrix="1 0 0 1 0 83" stroke="green" arrow="normal/small" rarrow="normal/small">
+336 248 m
+536 248 l
+</path>
+<path matrix="1 0 0 1 -37 -34" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 1 -37 -50" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="11.816" depth="0" valign="top" style="center">\bf\tiny LTE-L1</text>
+<path matrix="1.25 0 0 1 -463 -36" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 0.705114 -319 67.518" transformations="translations" pos="576 384" stroke="black" type="minipage" width="80" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf LTE\\
+MAC-RLC</text>
+<path matrix="1 0 0 1 139 -18" stroke="black" fill="white">
+488 368 m
+488 304 l
+504 304 l
+504 368 l
+h
+</path>
+<text matrix="0 1 -1 0 863 -288" pos="576 224" stroke="black" type="label" width="58.2408" height="8.3016" depth="0" valign="baseline" size="small">\tiny PRECODE</text>
+<path matrix="1 0 0 1 74 -34" stroke="black" fill="white">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 74 -34" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 74 -34" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<text matrix="1 0 0 1 74 -45" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf LTE\\
+MODEM</text>
+<path matrix="1 0 0 1 0 68" transformations="translations" stroke="green" fill="white" arrow="normal/small">
+232 264 m
+256 264 l
+</path>
+<path transformations="translations" stroke="red" arrow="normal/small" rarrow="normal/small">
+256 424 m
+224 424 l
+224 316 l
+256 316 l
+</path>
+<path matrix="1 0 0 1 0 37" transformations="translations" stroke="red" cap="1">
+64 264 m
+64 264 l
+</path>
+<path matrix="1 0 0 1 0 70" stroke="blue" dash="dashed" pen="heavier">
+528 288 m
+528 208 l
+736 208 l
+736 288 l
+h
+</path>
+<path matrix="1.25 0 0 1 -456.019 -204" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1.25 0 0 1 -463 -196" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 0.705114 -319 -92.482" transformations="translations" pos="576 384" stroke="black" type="minipage" width="80" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf NR\\
+MAC-RLC</text>
+<path matrix="1.25 0 0 1 -463 -283" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 0.705114 -319 -179.482" transformations="translations" pos="576 384" stroke="black" type="minipage" width="80" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf NB-IoT\\
+MAC-RLC</text>
+<path matrix="1 0 0 1 0 -22" stroke="red" arrow="normal/small" rarrow="normal/small">
+128 264 m
+8 264 l
+</path>
+<path matrix="1 0 0 1 -22 -217" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -29 -211" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -201" stroke="black">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -201" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -201" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -201" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 -37 -201" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<path matrix="1 0 0 1 0 -115" stroke="red" arrow="normal/small" rarrow="normal/small">
+336 264 m
+536 264 l
+</path>
+<path matrix="1 0 0 1 0 -83" stroke="green" arrow="normal/small" rarrow="normal/small">
+336 248 m
+536 248 l
+</path>
+<path matrix="1 0 0 1 -37 -201" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 1 -37 -217" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="11.816" depth="0" valign="top" style="center">\bf\tiny NR-L1</text>
+<path matrix="1 0 0 1 139 -185" stroke="black" fill="white">
+488 368 m
+488 304 l
+504 304 l
+504 368 l
+h
+</path>
+<text matrix="0 1 -1 0 863 -455" pos="576 224" stroke="black" type="label" width="58.2408" height="8.3016" depth="0" valign="baseline" size="small">\tiny PRECODE</text>
+<path matrix="1 0 0 1 74 -201" stroke="black" fill="white">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 74 -201" stroke="black">
+624 336 m
+624 336 l
+624 336 l
+624 336 l
+h
+</path>
+<path matrix="1 0 0 1 74 -201" stroke="black">
+608 336 m
+608 336 l
+608 336 l
+608 336 l
+h
+</path>
+<text matrix="1 0 0 1 74 -212" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf NR\\
+MODEM</text>
+<path matrix="1 0 0 1 0 -97" stroke="blue" dash="dashed" pen="heavier">
+528 288 m
+528 208 l
+736 208 l
+736 288 l
+h
+</path>
+<text matrix="1 0 0 1 71 -258" transformations="translations" pos="480 288" stroke="blue" type="minipage" width="192" height="13.9468" depth="0" valign="top">\tiny\bf Remote Radio-Unit (RRU)</text>
+<path stroke="red" arrow="normal/small" rarrow="normal/small">
+336 72 m
+576 72 l
+</path>
+<path stroke="green" arrow="normal/small" rarrow="normal/small">
+336 86 m
+576 88 l
+</path>
+<path matrix="1 0 0 1 -452 -282" stroke="black" fill="1">
+576 384 m
+576 336 l
+640 336 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 1 -452 -293" transformations="translations" pos="576 384" stroke="black" type="minipage" width="64" height="20.1796" depth="6.244" valign="top" style="center">\tiny\bf NB-IoT\\
+RRC</text>
+<path matrix="1 0 0 1 -8 -193" stroke="red" arrow="normal/small" rarrow="normal/small">
+128 264 m
+8 264 l
+</path>
+<path transformations="translations" stroke="green" rarrow="normal/small">
+104 360 m
+104 88 l
+120 88 l
+</path>
+<path transformations="translations" stroke="green" arrow="normal/small">
+192 88 m
+256 88 l
+</path>
+<path matrix="1 0 0 1 48 34" transformations="translations" stroke="black" fill="white">
+528 64 m
+528 32 l
+640 32 l
+640 64 l
+h
+</path>
+<text matrix="1 0 0 1 2 -288" transformations="translations" pos="576 384" stroke="black" type="minipage" width="104" height="21.9296" depth="7.98" valign="top" style="center">\tiny\bf NB-IoT\\
+L1/MODEM</text>
+<path transformations="translations" stroke="red" fill="white" arrow="normal/small">
+224 384 m
+208 384 l
+</path>
+<path transformations="translations" stroke="green" fill="white" arrow="normal/small">
+192 240 m
+256 240 l
+</path>
+<path transformations="translations" stroke="green" arrow="normal/small">
+232 240 m
+232 168 l
+256 168 l
+</path>
+<path transformations="translations" stroke="green" cap="1">
+224 192 m
+224 192 l
+</path>
+<path transformations="translations" stroke="green" cap="1">
+224 192 m
+224 192 l
+</path>
+<path transformations="translations" stroke="green" arrow="normal/small">
+224 312 m
+224 72 l
+256 72 l
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 188.731 2.73037" transformations="translations" pos="176 556" stroke="black" type="label" width="250.205" height="19.3928" depth="5.404" halign="center" valign="baseline">OAI Functional Splits</text>
+<text transformations="translations" pos="14.7471 512.821" stroke="black" type="minipage" width="707.342" height="140.266" depth="128.592" valign="top" size="small">\tiny\begin{itemize}
+\item OAI currently implements the following entities in openairinterface5g
+\begin{itemize}
+\item LTE-MODEM (eNB 36.211 OFDM modulation/demodulation)
+\item LTE-L1 (eNB 36.211/212/213)
+\item LTE-MACRLC (eNB 36.321/322)
+\item LTE-PDCP (eNB PDCP/GTPU 36.323)
+\item LTE-RRC (eNB RRC/SCTP 36.331)
+\end{itemize}
+\item Each entity comprises
+\begin{itemize}
+\item a northbound interface (backhaul/midhaul/fronthaul and configuration)
+\item a southbound interface (midaul/fronthaul and configuration)
+\item one or two management interfaces
+\item Three computing nodes
+\begin{itemize}
+\item {\bf Radio Cloud Center (RCC)} : multiple RRC/PDCP entities
+\item {\bf Radio-Access Unit (RAU)}: multiple MACRLC entities with medium-latency midhaul and L1 entities with low-latency fronthaul. 
+\item {\bf Remote Radio-Unit (RRU)}: Equipment at radio site. Varying degrees of processing elements depending on fronthaul/midhaul interface.
+\end{itemize}
+\end{itemize}
+\item Each entity has a configuration which is a local file or received via the management interface
+\item default interface between all entities is implemented using a UDP socket. Transport is configurable via a dynamically-loadable networking device
+\end{itemize}</text>
+<path stroke="black">
+288 192 m
+288 64 l
+432 64 l
+432 192 l
+h
+</path>
+<text transformations="translations" pos="288 144" stroke="black" type="minipage" width="144" height="19.3928" depth="5.404" valign="top" style="center">OAI entity</text>
+<path matrix="1 0 0 1 0 23" stroke="red" arrow="normal/small" rarrow="normal/small">
+336 171 m
+336 208 l
+</path>
+<path matrix="1 0 0 1 0 23" stroke="green" arrow="normal/small" rarrow="normal/small">
+384 171 m
+384 208 l
+</path>
+<path matrix="1 0 0 1 0 -144" stroke="red" arrow="normal/small" rarrow="normal/small">
+336 171 m
+336 208 l
+</path>
+<path matrix="1 0 0 1 0 -144" stroke="green" arrow="normal/small" rarrow="normal/small">
+384 171 m
+384 208 l
+</path>
+<path matrix="1 0 0 1 0 47" stroke="blue" arrow="normal/small" rarrow="normal/small">
+240 80 m
+288 80 l
+</path>
+<path matrix="1 0 0 1 0 71" stroke="blue" arrow="normal/small" rarrow="normal/small">
+240 80 m
+288 80 l
+</path>
+<path matrix="5.5 0 0 0.5 -1224 100" stroke="blue">
+16 0 0 16 288 224 e
+</path>
+<path matrix="5.5 0 0 0.5 -1224 -60" stroke="blue">
+16 0 0 16 288 224 e
+</path>
+<text transformations="translations" pos="464 224" stroke="blue" type="minipage" width="144" height="10.128" depth="0" valign="top" size="small">\tiny\bf Northbound interface</text>
+<text matrix="1 0 0 1 0 -160" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="144" height="10.128" depth="0" valign="top" size="small">\tiny\bf Southbound interface</text>
+<text matrix="1 0 0 1 -144 -199" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="32" height="10.128" depth="0" valign="top" size="small">\tiny\bf data</text>
+<text matrix="1 0 0 1 -144 16" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="32" height="10.128" depth="0" valign="top" size="small">\tiny\bf data</text>
+<text matrix="1 0 0 1 -96 -199" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="112" height="18.468" depth="6.504" valign="top" size="small">\tiny\bf in-band configuration</text>
+<text matrix="1 0 0 1 -96 34" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="112" height="18.468" depth="6.504" valign="top" size="small">\tiny\bf in-band configuration</text>
+<text matrix="1 0 0 1 -288 -55" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="64" height="11.9544" depth="0" valign="top" size="small">\tiny\bf OSS/BSS</text>
+<text matrix="1 0 0 1 -288 -79" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="64" height="10.128" depth="0" valign="top" size="small">\tiny\bf FlexRAN</text>
+<path matrix="1 0 0 1 0 -1" stroke="blue" arrow="normal/small" rarrow="normal/small">
+240 80 m
+288 80 l
+</path>
+<text matrix="1 0 0 1 -248 -127" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="64" height="9.6312" depth="0" valign="top" size="small">\tiny\tt .conf</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="0.92926 0 0 1.00204 -473.9 3.55763" stroke="black" fill="lightgray">
+511.895 513.539 m
+511.895 14.2386 l
+734.284 14.2386 l
+734.284 513.539 l
+h
+</path>
+<path matrix="0.880259 0 0 1.00521 -236.182 1.22986" stroke="black" fill="lightgray">
+511.895 513.539 m
+511.895 14.2386 l
+734.284 14.2386 l
+734.284 513.539 l
+h
+</path>
+<path matrix="1 0 0 1.00204 -98.2818 2.84025" stroke="black" fill="lightgray">
+511.895 513.539 m
+511.895 14.2386 l
+734.284 14.2386 l
+734.284 513.539 l
+h
+</path>
+<path matrix="1 0 0 1.1 208 -43.2" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<path matrix="1 0 0 1.1 0 -43.2" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<text matrix="1 0 0 1 185 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="313.978" height="20.9244" depth="6.972" halign="center" valign="baseline">Functional Splits (Current)</text>
+<path matrix="0.791667 0 0 1 -126.042 -156.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 139 -128.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -126.25 -109" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 -126.25 -64" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 133.792 -35.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 138.792 -80.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -174.042 -156.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 91 -128.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -174.25 -109" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 -174.25 -64" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 85.792 -35.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 90.792 -80.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -222.25 -64" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 37.792 -35.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RRC
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -222.25 -16" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 37.792 7.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-C
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.991372 -469.028 -12.3492" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 108.792 6.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-U
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -126.042 -204.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 139 -176.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -174.042 -204.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 91 -176.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 -255 31" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<path matrix="1 0 0 1 -326 31" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<path matrix="1.68745 0 0 0.646102 -469.028 -103.883" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 101.792 -228.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt rf\_device}
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 81.958 -157.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 347 -129.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 81.75 -110" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 81.75 -65" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 341.792 -36.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 346.792 -81.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 33.958 -157.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 299 -129.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 33.75 -110" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 33.75 -65" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 293.792 -36.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 298.792 -81.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -14.25 -65" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 245.792 -36.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RRC
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -14.25 -17" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 245.792 6.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-C
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.991372 -261.028 -13.3492" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 316.792 5.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-U
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 81.958 -205.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 347 -177.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 33.958 -205.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 299 -177.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -261.028 -101.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 309.792 -229.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -70 -65" transformations="translations" pos="176 556" stroke="black" type="label" width="170.52" height="19.3704" depth="0" halign="center" valign="baseline">3GPP\_eNodeB</text>
+<text matrix="1 0 0 1 138 -65" transformations="translations" pos="176 556" stroke="black" type="label" width="134.604" height="19.3704" depth="0" halign="center" valign="baseline">3GPP\_BBU</text>
+<text matrix="1 0 0 1 -13 0" transformations="translations" pos="48 480" stroke="black" type="minipage" width="48" height="10.128" depth="0" valign="top" size="small">\tiny to MME</text>
+<text matrix="1 0 0 1 51 0" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to S-PGw</text>
+<path matrix="1 0 0 1 -47 31" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<path matrix="1 0 0 1 -118 31" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="1 0 0 1 195 0" transformations="translations" pos="48 480" stroke="black" type="minipage" width="48" height="10.128" depth="0" valign="top" size="small">\tiny to MME</text>
+<text matrix="1 0 0 1 259 0" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to S-PGw</text>
+<path stroke="black" fill="lightblue">
+160 112 m
+160 112 l
+160 112 l
+160 112 l
+h
+</path>
+<path stroke="black" fill="lightblue">
+144 112 m
+144 112 l
+144 112 l
+144 112 l
+h
+</path>
+<path matrix="1.68745 0 0 0.991372 -469.028 -289.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 101.792 -264.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="16.8048" depth="4.848" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt USB3 or PCIe}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.991372 -261.028 -289.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 300.792 -264.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="74" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF5 / ethernet}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1.1 416 -43.2" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<path matrix="0.791667 0 0 1 289.958 -157.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 555 -129.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 289.75 -110" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 289.75 -65" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 549.792 -36.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 554.792 -81.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 241.958 -157.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 507 -129.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 241.75 -110" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 241.75 -65" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 501.792 -36.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 506.792 -81.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 193.75 -65" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 453.792 -36.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RRC
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 193.75 -17" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 453.792 6.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-C
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.991372 -53.028 -13.3492" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 524.792 5.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-U
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 289.958 -205.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 241.958 -205.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 507 -163.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="27.4872" depth="15.552" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY RX
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -53.028 -101.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 517.792 -229.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 346 -65" transformations="translations" pos="176 556" stroke="black" type="label" width="215.964" height="20.9244" depth="6.972" halign="center" valign="baseline">NGFI\_RCC (IF4.5)</text>
+<path matrix="1 0 0 1 161 31" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<path matrix="1 0 0 1 90 31" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="1 0 0 1 403 0" transformations="translations" pos="48 480" stroke="black" type="minipage" width="48" height="10.128" depth="0" valign="top" size="small">\tiny to MME</text>
+<text matrix="1 0 0 1 467 0" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to S-PGw</text>
+<path matrix="1.68745 0 0 0.991372 -53.028 -289.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 508.792 -264.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="74" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF4p5 / ethernet}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 555 -163.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="27.4872" depth="15.552" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY TX
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 163 -334" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 406.604 -432" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to NGFI\_RRU</text>
+<path matrix="1 0 0 1 -45 -334" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 198.604 -432" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="18.468" depth="6.504" valign="top" size="small">\tiny to NGFI\_RRU or RRH\_gw</text>
+<path matrix="1 0 0 1 -253.457 -333.956" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 -11.8528 -430.956" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to RF Device</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1.01725 0 0 0.848434 249.573 104.961" stroke="black" fill="lightgray">
+1.83417 462.604 m
+1.83417 50.8252 l
+207.006 50.8252 l
+207.006 462.604 l
+h
+</path>
+<path matrix="1.00369 0 0 1.08732 29.991 -6.98372" stroke="black" fill="lightgray">
+1.83417 462.604 m
+1.83417 50.8252 l
+207.006 50.8252 l
+207.006 462.604 l
+h
+</path>
+<path matrix="1 0 0 0.900567 29 11.9552" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<path matrix="0.791667 0 0 1 -97.042 -189.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 168 -161.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -97.25 -142" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 -97.25 -97" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 162.792 -68.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 167.792 -113.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -145.042 -189.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 120 -161.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -145.25 -142" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 -145.25 -97" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 114.792 -68.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 119.792 -113.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -193.25 -97" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 66.792 -68.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RRC
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 -193.25 -49" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 66.792 -25.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-C
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.991372 -440.028 -45.3492" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 137.792 -26.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-U
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -440.028 -78.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 130.792 -206.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -41 -97" transformations="translations" pos="176 556" stroke="black" type="label" width="208.216" height="20.9244" depth="6.972" halign="center" valign="baseline">NGFI\_RCC (IF1&apos;&apos;)</text>
+<path matrix="1 0 0 1 -226 -1" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<path matrix="1 0 0 1 -297 -1" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="1 0 0 1 16 -32" transformations="translations" pos="48 480" stroke="black" type="minipage" width="48" height="10.128" depth="0" valign="top" size="small">\tiny to MME</text>
+<text matrix="1 0 0 1 80 -32" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to S-PGw</text>
+<path matrix="1.68745 0 0 0.991372 -440.028 -266.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 113.792 -241.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="90" height="17.6496" depth="5.664" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF1pp} / ethernet
+\end{tiny}
+</text>
+<path matrix="1 0 0 0.651275 253 119.649" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<path matrix="0.791667 0 0 1 126.75 -97" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 386.792 -68.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 78.75 -97" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 338.792 -68.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 30.75 -97" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 290.792 -68.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RRC
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 30.75 -49" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 290.792 -25.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-C
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.991372 -216.028 -45.3492" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 361.792 -26.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+GTP-U
+\end{tiny}
+</text>
+<path matrix="2.69329 0 0 0.638421 -595.954 13.42" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 334.792 -114.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 183 -97" transformations="translations" pos="176 556" stroke="black" type="label" width="202.017" height="20.9244" depth="6.972" halign="center" valign="baseline">NGFI\_RCC (IF1&apos;)</text>
+<path matrix="1 0 0 1 -2 -1" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<path matrix="1 0 0 1 -73 -1" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="1 0 0 1 240 -32" transformations="translations" pos="48 480" stroke="black" type="minipage" width="48" height="10.128" depth="0" valign="top" size="small">\tiny to MME</text>
+<text matrix="1 0 0 1 304 -32" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to S-PGw</text>
+<path matrix="1.68745 0 0 0.991372 -216.028 -174.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 337.792 -149.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="90" height="17.6496" depth="5.664" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF1p} / ethernet
+\end{tiny}
+</text>
+<text matrix="2.11243 0 0 1 36.6036 -461" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to NGFI\_RRU</text>
+<path matrix="1 0 0 1 -226 -313" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 15.604 -408" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to NGFI\_RAU</text>
+<path matrix="1 0 0 1 -1 -222" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 240.604 -317" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to NGFI\_RAU</text>
+<text matrix="1 0 0 1 185 -0.999538" transformations="translations" pos="176 556" stroke="black" type="label" width="313.978" height="20.9244" depth="6.972" halign="center" valign="baseline">Functional Splits (Current)</text>
+<path matrix="1.00369 0 0 1.08732 500.993 -5.7664" stroke="black" fill="lightgray">
+1.83417 462.604 m
+1.83417 50.8252 l
+207.006 50.8252 l
+207.006 462.604 l
+h
+</path>
+<path matrix="0.727273 0 0 0.742424 530.364 32.2727" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<path matrix="0.791667 0 0 1 351.958 -178.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 303.958 -178.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 569 -136.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="27.4872" depth="15.552" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY RX
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 8.972 -74.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 579.792 -202.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 433 -92" transformations="translations" pos="176 556" stroke="black" type="label" width="200.276" height="20.9244" depth="6.972" halign="center" valign="baseline">NGFI\_RAU(IF1&apos;&apos;)</text>
+<path matrix="1.68745 0 0 0.991372 8.972 -262.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 570.792 -237.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="74" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF4p5 / ethernet}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 617 -136.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="27.4872" depth="15.552" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY TX
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 7.934 21.42" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 581.792 -106.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.991372 8.972 -82.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.769443 0 0 0.141445 570.792 268.279" transformations="translations" pos="0 474" stroke="black" type="minipage" width="74" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF1pp / ethernet}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 223 -40" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 464.604 -71" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to NGFI\_RCC</text>
+<path matrix="1 0 0 1 223 -312" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 464.604 -407" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to NGFI\_RRU</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1.0663 0 0 1.11251 444.141 -16.4274" stroke="black" fill="lightgray">
+1.83417 462.604 m
+1.83417 50.8252 l
+207.006 50.8252 l
+207.006 462.604 l
+h
+</path>
+<path matrix="1.06788 0 0 1.10769 212.939 -13.7478" stroke="black" fill="lightgray">
+1.83417 462.604 m
+1.83417 50.8252 l
+207.006 50.8252 l
+207.006 462.604 l
+h
+</path>
+<path matrix="1 0 0 1 0 37" stroke="black" fill="lightgray">
+1.83417 462.604 m
+1.83417 50.8252 l
+207.006 50.8252 l
+207.006 462.604 l
+h
+</path>
+<path matrix="0.727273 0 0 0.546841 27.364 94.7646" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -494.028 5.42" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 76.792 -122.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -72 -92" transformations="translations" pos="176 556" stroke="black" type="label" width="195.818" height="20.9244" depth="6.972" halign="center" valign="baseline">NGFI\_RRU (IF5)</text>
+<path matrix="1.68745 0 0 0.991372 -494.028 -100.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 67.792 -75.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="74" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF5/ ethernet}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -494.028 -27.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 76.792 -155.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt rf\_device}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 147 -92" transformations="translations" pos="176 556" stroke="black" type="label" width="217.515" height="20.9244" depth="6.972" halign="center" valign="baseline">NGFI\_RRU (IF4.5)</text>
+<path matrix="1 0 0 1 -279.958 -59.1734" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 -59.355 -78.1734" transformations="translations" pos="48 480" stroke="black" type="minipage" width="128" height="18.0648" depth="6.12" valign="top" size="small" style="center">\tiny to NGFI\_RCC, NGFI\_RAU,3GPP\_BBU</text>
+<path matrix="1 0 0 1 -280 -274" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 -38.396 -369" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to RF Device</text>
+<path matrix="1.67303 0 0 1.24455 -489.268 -322.215" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 76.792 -188.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="23.9736" depth="12.024" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt USB3, PCIe, CPRI}
+\end{tiny}
+</text>
+<path matrix="0.7308 0 0 0.711699 250.308 23.5462" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -271.028 5.42" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 299.792 -122.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.991372 -271.028 -100.349" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 290.792 -75.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="74" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF4p5/ ethernet}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -271.028 -77.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 299.792 -205.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt rf\_device}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 -56.958 -59.1734" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 163.645 -78.1734" transformations="translations" pos="48 480" stroke="black" type="minipage" width="128" height="17.2968" depth="5.352" valign="top" size="small" style="center">\tiny to NGFI\_RCC, NGFI\_RAU</text>
+<path matrix="1 0 0 1 -57 -320" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 184.604 -424" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to RF Device</text>
+<path matrix="1.67303 0 0 1.24455 -266.268 -372.215" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 299.792 -238.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="23.9736" depth="12.024" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt USB3, PCIe, CPRI}
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 71.958 -189.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 23.958 -189.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 289 -154.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="24.4656" depth="12.528" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+lower-PHY RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 337 -154.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="24.4656" depth="12.528" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+lower-PHY TX
+\end{tiny}
+</text>
+<path matrix="0.754883 0 0 0.844765 480.935 6.70954" stroke="black" fill="lightyellow">
+16 432 m
+16 112 l
+192 112 l
+192 432 l
+h
+</path>
+<path matrix="0.791667 0 0 1 303.97 -144.528" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.74239 0 0 0.607628 -58.1448 -70.7751" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 530.804 -210.953" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 569.012 -102.277" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="27.4872" depth="15.552" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY TX
+\end{tiny}
+</text>
+<path matrix="1.7325 0 0 0.638421 -53.9193 44.2159" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 534.804 -83.9531" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1.79658 0 0 0.968027 -76.0285 -53.4485" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.769443 0 0 0.141445 521.804 288.075" transformations="translations" pos="0 474" stroke="black" type="minipage" width="74" height="20.832" depth="8.856" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF1pp\_4P5 / ethernet}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 174.012 -21.2041" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<text matrix="2.11243 0 0 1 385.616 -56.2041" transformations="translations" pos="48 480" stroke="black" type="minipage" width="143.13" height="10.896" depth="0" valign="top" size="small">\tiny to NGFI\_RCC, NGFI\_RAU</text>
+<path matrix="0.924035 0 0 1 204.183 -321.204" stroke="black" fill="lightblue" arrow="normal/normal" rarrow="normal/normal">
+384 432 m
+384 384 l
+</path>
+<path matrix="1.67303 0 0 1.24455 -34.3906 -373.77" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 531.669 -240.304" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="23.9736" depth="12.024" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt USB3, PCIe, CPRI}
+\end{tiny}
+</text>
+<text matrix="2.11243 0 0 1 420.344 -422.726" transformations="translations" pos="48 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny to RF Device</text>
+<text matrix="1 0 0 1 185 -0.999076" transformations="translations" pos="176 556" stroke="black" type="label" width="313.978" height="20.9244" depth="6.972" halign="center" valign="baseline">Functional Splits (Current)</text>
+<text matrix="1 0 0 1 0 33" transformations="translations" pos="453.069 456.148" stroke="black" type="minipage" width="204.455" height="36.8592" depth="22.96" valign="top" style="center">NGFI\_RRU\par
+(IF1&apos;&apos;)</text>
+<path matrix="0.791667 0 0 1 303.674 -194.932" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 255.674 -194.932" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 520.716 -159.681" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="24.4656" depth="12.528" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+lower-PHY RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 568.716 -159.681" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="24.4656" depth="12.528" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+lower-PHY TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 255.97 -144.528" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 521.012 -102.277" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="27.4872" depth="15.552" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY RX
+\end{tiny}
+</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 188.731 2.73037" transformations="translations" pos="176 556" stroke="black" type="label" width="352.257" height="19.3928" depth="5.404" halign="center" valign="baseline">Some Notes on usage of splits</text>
+<text transformations="translations" pos="14.7471 512.821" stroke="black" type="minipage" width="707.342" height="239.641" depth="226.212" valign="top">\tiny\begin{itemize}
+\item IF4p5 corresponds to the split-point at the input (TX) and output (RX) of the OFDM symbol generator (i.e. frequency-domain signals). According to NGFI, IF4 is &quot;Resource mapping and IFFT&quot; and &quot;FFT and Resource demapping&quot;. We currently do not try to exploit multiplexing gains for unused spectral components. So, IF4p5 is simply compressed transmitted or received resource elements in the usable channel band.
+\item The simplest deployment for DAS (indoor) is one NGFI\_RCC (IF4p5) and many NGFI\_RRU (IF4p5). Spatio-temportal filtering (Precoding, later) is done in RCC and RRU perform IFFT/FFT and signal generation/acquisition. Fronthaul rates in this case are feasible with 1GbE copper links.  This allows for PoE in addition to fronthaul data.
+\item More complex indoor, for instance with RCC in a common data center with outdoor RRS, could be
+\begin{enumerate}
+ \item RCC-RAU with IF1&apos;&apos;, RAU-RRU with IF4p5.  Spatio-temporal filtering is done in frequency-domain in RAU along with full TX and RX processing (L1/L2) for the indoor RRS. Note that IF1&apos; fronthaul on TX to RRU would be difficult because spatio-temporal filtering should be used. RRU does only IFFT/FFT and signal generation/acquisition
+\item RCC-RAU with IF1&apos;, RAU-RRU with IF4p5. Here RCC does L2, RAU does L1 and precoding for RRS.
+\end{enumerate}
+\item A massive-MIMO solution would consist either of 
+\begin{enumerate} 
+\item an embedded RAU with processing (Spatio-temporal in frequency-domain, lower/upper PHY TX/RX) like the IF1&apos; DAS solution above
+\item or more simply a high-speed fronthaul (IF4p5) with an RAU for multiple sites
+\item directly connected to RCC via high-speed IF4p5 (several virtual cells, precoder and IFFT/FFT in array).
+\end{enumerate}
+\item RCC solution with IF1&apos;&apos; would cater to evolved-PDCP for heterogenity (4G,5G,WIFI,IoT)
+\item Currently supported node functionalities
+\begin{enumerate}
+\item {\tt 3GPP\_eNodeB}
+\item {\tt 3GPP\_eNodeB\_BBU} [NGFI\_IF5]
+\item {\tt NGFI\_RCC} [NGFI\_IF4p5]
+\item {\tt NGFI\_RRU} [NGFI\_IF5]
+\item {\tt NGFI\_RRU} [NGFI\_IF4p5]
+\end{enumerate}
+\end{itemize}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 188.731 2.73037" transformations="translations" pos="176 556" stroke="black" type="label" width="233.391" height="19.3928" depth="5.404" halign="center" valign="baseline">RU - L1 negotiation</text>
+<path matrix="1 0 0 1 -16 64" stroke="black" fill="lightblue">
+64 448 m
+64 256 l
+256 256 l
+256 448 l
+h
+</path>
+<path matrix="1 0 0 1 368 64" stroke="black" fill="lightblue">
+64 448 m
+64 256 l
+256 256 l
+256 448 l
+h
+</path>
+<text matrix="1 0 0 1 -16 16" transformations="translations" pos="64 416" stroke="black" type="minipage" width="192" height="19.3928" depth="5.404" valign="top" style="center">RRU Entity</text>
+<text matrix="1 0 0 1 368 32" transformations="translations" pos="64 416" stroke="black" type="minipage" width="192" height="36.8592" depth="22.96" valign="top" style="center">RAU/RCC Entity</text>
+<path matrix="1 0 0 1 -16 64" stroke="black" fill="lightblue" arrow="normal/normal">
+544 192 m
+544 256 l
+</path>
+<path matrix="1 0 0 1 -16 64" stroke="red" fill="lightblue" arrow="normal/normal">
+256 320 m
+448 320 l
+</path>
+<path matrix="1 0 0 1 -16 64" stroke="red" fill="lightblue" arrow="normal/normal">
+448 288 m
+256 288 l
+</path>
+<path matrix="1 0 0 1 -400 64" stroke="black" fill="lightblue" arrow="normal/normal">
+544 192 m
+544 256 l
+</path>
+<text matrix="1 0 0 1 -312 33" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="64" height="11.2364" depth="0" valign="top">\tiny\tt .conf</text>
+<text matrix="1 0 0 1 72 33" transformations="translations" pos="464 224" stroke="blue" type="minipage" width="64" height="11.2364" depth="0" valign="top">\tiny\tt .conf</text>
+<text matrix="1 0 0 1 -199 158" transformations="translations" pos="464 224" stroke="black" type="minipage" width="160" height="21.1652" depth="7.196" valign="top">\tiny\tt fronthaul data (IF5,IF4p5)</text>
+<path matrix="1 0 0 1 -16 160" stroke="green" fill="lightblue" arrow="normal/normal">
+256 320 m
+448 320 l
+</path>
+<path matrix="1 0 0 1 -16 160" stroke="green" fill="lightblue" arrow="normal/normal">
+448 288 m
+256 288 l
+</path>
+<text matrix="1 0 0 1 -215 235" transformations="translations" pos="464 224" stroke="black" type="minipage" width="176" height="13.3672" depth="0" valign="top">\tiny\tt RRU control/config</text>
+<text matrix="1 0 0 1 0 80" transformations="translations" pos="32 160" stroke="black" type="minipage" width="672" height="116.743" depth="105.024" valign="top" size="small">\begin{small}
+Control and Configuration protocol
+\begin{enumerate}
+\item RAU$\rightarrow$ RRU : heartbeat (capabilities request)
+\item RRU$\rightarrow$ RAU: capabilities indication
+\item RAU$\rightarrow$ RRU: configuration (band, dl\_Carrier,ul\_Carrier, dl\_RS\_EPRE, rx/tx attenuation)
+\end{enumerate}
+\end{small}
+During steady state, the control port manages the link quality and status (packet losses, synchronization state, start/stop, etc.)</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" transformations="translations" pos="16 512" stroke="black" type="minipage" width="704" height="186.004" depth="172.452" valign="top">\begin{small}
+\begin{itemize}
+\item IF5 interface
+\begin{itemize}
+\item DL subframes with timestamp (16-bit samples)
+\item UL subframes with timestamp (16-bit samples)
+\item optional A-law compression (13$\rightarrow$8bit)
+\end{itemize}
+\item IF4p5 interface
+\begin{itemize}
+\item DL packets, ofdm symbols with frame/subframe/symbol count
+\item UL packets, ofdm symbols with frame/subframe/symbol count (16-bit)
+\item UL PRACH packets with frame/subframe count (16-bit)
+\item optional A-law compression (13$\rightarrow$8bit) 
+\end{itemize}
+\end{itemize}
+\end{small}</text>
+<text matrix="1 0 0 1 188.731 2.73037" transformations="translations" pos="176 556" stroke="black" type="label" width="225.333" height="19.3928" depth="5.404" halign="center" valign="baseline">RU - L1 data plane</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="3.99386 0 0 1 -2166.33 147.732" stroke="black" fill="darkgray">
+544 288 m
+544 256 l
+704 256 l
+704 288 l
+h
+</path>
+<text matrix="1 0 0 1 185 -0.999076" transformations="translations" pos="176 556" stroke="black" type="label" width="317.156" height="20.9244" depth="6.972" halign="center" valign="baseline">IF5 Packet Format (16-bit)</text>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 102.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 262.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 422.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<text matrix="1 0 0 1 -53.6718 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">0</text>
+<text matrix="1 0 0 1 106.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">16</text>
+<text matrix="1 0 0 1 266.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">32</text>
+<text matrix="1 0 0 1 426.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">48</text>
+<text matrix="1 0 0 1 73.3282 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">15</text>
+<text matrix="1 0 0 1 233.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">31</text>
+<text matrix="1 0 0 1 393.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">47</text>
+<text matrix="1 0 0 1 553.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">63</text>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="violet">
+64 320 m
+64 288 l
+544 288 l
+544 320 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="orange">
+544 320 m
+544 288 l
+704 288 l
+704 320 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="orange">
+64 288 m
+64 256 l
+384 256 l
+384 288 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="lightyellow">
+384 288 m
+384 256 l
+544 256 l
+544 288 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="lightgreen">
+544 288 m
+544 256 l
+704 256 l
+704 288 l
+h
+</path>
+<text matrix="1 0 0 1 45.3282 250.732" transformations="translations" pos="96 224" stroke="black" type="label" width="184.702" height="14.9448" depth="0" valign="baseline" size="small">\small Destination Address</text>
+<text matrix="1 0 0 1 435.328 250.732" transformations="translations" pos="96 224" stroke="black" type="label" width="61.9848" height="14.9448" depth="0" valign="baseline" size="small">\small Source</text>
+<text matrix="1 0 0 1 237.328 221.732" transformations="translations" pos="96 224" stroke="black" type="label" width="135.391" height="16.1424" depth="5.376" valign="baseline" size="small">\small Type (0x1234)</text>
+<text matrix="1 0 0 1 421.328 221.732" transformations="translations" pos="96 224" stroke="black" type="label" width="93.8976" height="14.952" depth="4.176" valign="baseline" size="small">\small RF Config</text>
+<text matrix="1 0 0 1 30.3282 218.732" transformations="translations" pos="96 224" stroke="black" type="label" width="71.9664" height="14.9448" depth="0" valign="baseline" size="small">\small Address</text>
+<path matrix="1 0 0 1 -57.6718 162.732" stroke="black" fill="red">
+64 160 m
+64 128 l
+384 128 l
+384 160 l
+h
+</path>
+<text matrix="1 0 0 1 -52.6718 75.7323" transformations="translations" pos="96 224" stroke="black" type="label" width="214.279" height="14.952" depth="4.176" valign="baseline" size="small">\small Frame Check Sequence</text>
+<path matrix="1 0 0 1 0.328186 99.7323" stroke="black">
+256 240 m
+256 240 l
+256 240 l
+</path>
+<text matrix="1 0 0 1 176.328 189.732" transformations="translations" pos="96 224" stroke="black" type="label" width="103.87" height="14.952" depth="4.176" valign="baseline" size="small">\small Timestamp</text>
+<path matrix="1 0 0 1 1.3282 309" stroke="black" fill="lightblue" tiling="falling">
+5 63.5079 m
+5 46.9999 l
+645 46.9999 l
+645 63.5079 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 148" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 262 148" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 262 100" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 100" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 0 100" stroke="black">
+256 240 m
+256 240 l
+256 240 l
+</path>
+<path matrix="1 0 0 1 0 100" stroke="black">
+166 304 m
+165.917 272.508 l
+166.247 272.508 l
+</path>
+<path matrix="1 0 0 1 0 100" stroke="black">
+486 304 m
+486.316 272.508 l
+485.986 272.508 l
+</path>
+<path matrix="1 0 0 1 0 100" stroke="black">
+486.316 256 m
+486.646 224 l
+485.657 224 l
+</path>
+<path matrix="1 0 0 1 -320.398 99.9995" stroke="black">
+486.316 256 m
+486.646 224 l
+485.657 224 l
+</path>
+<text matrix="1 0 0 1 17 137" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_0$</text>
+<text matrix="1 0 0 1 166 137" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_0$</text>
+<text matrix="1 0 0 1 335 137" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_1$</text>
+<text matrix="1 0 0 1 492 137" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_1$</text>
+<text matrix="1 0 0 1 -3 89" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="13.0848" depth="1.128" valign="top" size="small">\tiny $Q_{N-2}$</text>
+<text matrix="1 0 0 1 150 89" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="13.0848" depth="1.128" valign="top" size="small">\tiny $Q_{N-2}$</text>
+<text matrix="1 0 0 1 320 89" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="13.0848" depth="1.128" valign="top" size="small">\tiny $I_{N-1}$</text>
+<text matrix="1 0 0 1 477 89" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="13.0848" depth="1.128" valign="top" size="small">\tiny $Q_{N-1}$</text>
+<text matrix="1 0 0 1 0 43" transformations="translations" pos="0 240" stroke="black" type="minipage" width="736" height="43.8816" depth="31.968" valign="top" size="small">\tiny
+\begin{itemize}
+\item {\bf Type:} 2 byte (16 bit) field that specifies the RoE protocol
+\item {\bf RX Config:} 16-bit.  Currently just antenna index (0-7). Can later be used for gain/timing adjustments.
+\item {\bf Timstamp:} Timestamp in samples of the first sample of the received packet. 
+\end{itemize}
+\begin{itemize}
+\item {\bf data block :} Uncompressed IQ samples, 16-bit resolution for each real and imaginary component. $N$ complex samples per packet. $N$ can be configured at initialization.
+\end{itemize}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 185 -0.999076" transformations="translations" pos="176 556" stroke="black" type="label" width="303.209" height="20.9244" depth="6.972" halign="center" valign="baseline">IF5 Packet Format (8-bit)</text>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 102.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 262.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 422.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<text matrix="1 0 0 1 -53.6718 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">0</text>
+<text matrix="1 0 0 1 106.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">16</text>
+<text matrix="1 0 0 1 266.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">32</text>
+<text matrix="1 0 0 1 426.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">48</text>
+<text matrix="1 0 0 1 73.3282 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">15</text>
+<text matrix="1 0 0 1 233.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">31</text>
+<text matrix="1 0 0 1 393.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">47</text>
+<text matrix="1 0 0 1 553.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">63</text>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="violet">
+64 320 m
+64 288 l
+544 288 l
+544 320 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="orange">
+544 320 m
+544 288 l
+704 288 l
+704 320 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="orange">
+64 288 m
+64 256 l
+384 256 l
+384 288 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="lightyellow">
+384 288 m
+384 256 l
+544 256 l
+544 288 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="darkgray">
+544 288 m
+544 256 l
+704 256 l
+704 288 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="lightblue">
+384 256 m
+384 224 l
+704 224 l
+704 256 l
+h
+</path>
+<text matrix="1 0 0 1 45.3282 250.732" transformations="translations" pos="96 224" stroke="black" type="label" width="184.702" height="14.9448" depth="0" valign="baseline" size="small">\small Destination Address</text>
+<text matrix="1 0 0 1 430.328 250.732" transformations="translations" pos="96 224" stroke="black" type="label" width="61.9848" height="14.9448" depth="0" valign="baseline" size="small">\small Source</text>
+<text matrix="1 0 0 1 237.328 221.732" transformations="translations" pos="96 224" stroke="black" type="label" width="145.154" height="16.1424" depth="5.376" valign="baseline" size="small">\small Type (0xBEEF)</text>
+<text matrix="1 0 0 1 427.328 221.732" transformations="translations" pos="96 224" stroke="black" type="label" width="84.5928" height="14.952" depth="4.176" valign="baseline" size="small">\small RX Flags</text>
+<text matrix="1 0 0 1 30.3282 218.732" transformations="translations" pos="96 224" stroke="black" type="label" width="71.9664" height="14.9448" depth="0" valign="baseline" size="small">\small Address</text>
+<path matrix="1 0 0 1 -537.672 147.732" stroke="black" fill="darkgray">
+544 288 m
+544 256 l
+704 256 l
+704 288 l
+h
+</path>
+<text matrix="1 0 0 1 -62.672 189.732" transformations="translations" pos="96 224" stroke="black" type="label" width="110.182" height="14.9448" depth="0" valign="baseline" size="small">\small FIFO\_status</text>
+<path matrix="1 0 0 1 -377.672 147.732" stroke="black" fill="darkgray">
+544 288 m
+544 256 l
+704 256 l
+704 288 l
+h
+</path>
+<text matrix="1 0 0 1 81.328 192.732" transformations="translations" pos="96 224" stroke="black" type="label" width="52.3516" height="9.7104" depth="2.688" valign="baseline" size="large">\tiny SeqNum</text>
+<text matrix="1 0 0 1 175.328 192.732" transformations="translations" pos="96 224" stroke="black" type="label" width="25.2224" height="9.6852" depth="0" valign="baseline" size="large">\tiny rsvd</text>
+<path matrix="1 0 0 1 -5 0" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<text matrix="1 0 0 1 358.328 189.732" transformations="translations" pos="96 224" stroke="black" type="label" width="60.7872" height="14.9448" depth="0" valign="baseline" size="small">\small Word0</text>
+<path matrix="1 0 0 1 1 242" stroke="black" fill="lightblue" tiling="falling">
+5 63.5079 m
+5 46.9999 l
+645 46.9999 l
+645 63.5079 l
+h
+</path>
+<path matrix="1 0 0 1 262 148" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 -58 81" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 -58 33" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 320 100" stroke="black">
+166 304 m
+165.917 272.508 l
+166.247 272.508 l
+</path>
+<path matrix="1 0 0 1 -320 33" stroke="black">
+486 304 m
+486.316 272.508 l
+485.986 272.508 l
+</path>
+<path matrix="1 0 0 1 -320 33" stroke="black">
+486.316 256 m
+486.646 224 l
+485.657 224 l
+</path>
+<text matrix="1 0 0 1 288 137" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_0$</text>
+<path matrix="1 0 0 1 154 -32" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 315 -32" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -167 -99" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -7 -99" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -167 -147" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -7 -147" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<text matrix="1 0 0 1 371 137" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_0$</text>
+<text matrix="1 0 0 1 446 137" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_1$</text>
+<text matrix="1 0 0 1 529 137" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_1$</text>
+<text matrix="1 0 0 1 -32 70" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_2$</text>
+<text matrix="1 0 0 1 51 70" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_2$</text>
+<text matrix="1 0 0 1 128 70" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_3$</text>
+<text matrix="1 0 0 1 211 70" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_3$</text>
+<text matrix="1 0 0 1 -32 22" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_{638}$</text>
+<text matrix="1 0 0 1 51 22" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_{638}$</text>
+<text matrix="1 0 0 1 128 22" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_{639}$</text>
+<text matrix="1 0 0 1 211 22" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_{639}$</text>
+<text matrix="1 0 0 1 0 -24" transformations="translations" pos="0 240" stroke="black" type="minipage" width="736" height="65.3664" depth="53.52" valign="top" size="small">\tiny
+\begin{itemize}
+\item {\bf Type:} 2 byte (16 bit) field that specifies the RoE protocol
+\item {\bf RX Flags:} overrun indicator. should be &apos;0&apos;.
+\item {\bf FIFO status:} 2 bytes. should be &apos;0&apos;.
+\item {\bf SeqNum:} 1 byte. Sequence number of the ethernet packet. 
+\item {\bf rsvd:} 1 byte. shoult be &apos;0&apos;. \item {\bf Word0:} 4 byte (32-bit). should be &apos;0&apos;.
+\item {\bf Timstamp:} Timestamp in samples of the first sample of the received packet. \end{itemize}
+\begin{itemize}
+\item {\bf data block :} Uncompressed IQ samples, 8-bit resolution for each real and imaginary component. 640 complex samples per packet.
+\end{itemize}</text>
+<path matrix="1 0 0 1 -377.672 147.732" stroke="black" fill="lightblue">
+384 256 m
+384 224 l
+704 224 l
+704 256 l
+h
+</path>
+<text matrix="1 0 0 1 17.328 157.732" transformations="translations" pos="96 224" stroke="black" type="label" width="103.87" height="14.952" depth="4.176" valign="baseline" size="small">\small Timestamp</text>
+<path matrix="1 0 0 1 262 81" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 0 33" stroke="black">
+486 304 m
+486.316 272.508 l
+485.986 272.508 l
+</path>
+<path matrix="1 0 0 1 153 -99" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 313 -99" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<text matrix="1 0 0 1 288 70" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_4$</text>
+<text matrix="1 0 0 1 371 70" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_4$</text>
+<text matrix="1 0 0 1 448 70" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $I_5$</text>
+<text matrix="1 0 0 1 531 70" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="11.856" depth="0" valign="top" size="small">\tiny $Q_5$</text>
+<path matrix="1 0 0 1 262.328 128.732" stroke="black" fill="red">
+64 160 m
+64 128 l
+384 128 l
+384 160 l
+h
+</path>
+<text matrix="1 0 0 1 283.328 40.7323" transformations="translations" pos="96 224" stroke="black" type="label" width="214.279" height="14.952" depth="4.176" valign="baseline" size="small">\small Frame Check Sequence</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 185 -0.999076" transformations="translations" pos="176 556" stroke="black" type="label" width="347.724" height="20.9244" depth="6.972" halign="center" valign="baseline">IF4p5 Packet Formats (RAW)</text>
+<path stroke="black">
+272 512 m
+272 512 l
+272 512 l
+272 512 l
+h
+</path>
+<path matrix="1 0 0 1 -58 144" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 102 144" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 262 144" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 422 144" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<text matrix="1 0 0 1 -54 150" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">0</text>
+<text matrix="1 0 0 1 106 150" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">16</text>
+<text matrix="1 0 0 1 266 150" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">32</text>
+<text matrix="1 0 0 1 426 150" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">48</text>
+<text matrix="1 0 0 1 73 150" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">15</text>
+<text matrix="1 0 0 1 233 150" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">31</text>
+<text matrix="1 0 0 1 393 150" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">47</text>
+<text matrix="1 0 0 1 553 150" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">63</text>
+<path matrix="1 0 0 1 -58 144" stroke="black" fill="violet">
+64 320 m
+64 288 l
+544 288 l
+544 320 l
+h
+</path>
+<path matrix="1 0 0 1 -58 144" stroke="black" fill="orange">
+544 320 m
+544 288 l
+704 288 l
+704 320 l
+h
+</path>
+<path matrix="1 0 0 1 -58 144" stroke="black" fill="orange">
+64 288 m
+64 256 l
+384 256 l
+384 288 l
+h
+</path>
+<path matrix="1 0 0 1 -58 144" stroke="black" fill="lightyellow">
+384 288 m
+384 256 l
+544 256 l
+544 288 l
+h
+</path>
+<path matrix="1 0 0 1 -58 144" stroke="black" fill="darkgray">
+544 288 m
+544 256 l
+704 256 l
+704 288 l
+h
+</path>
+<path matrix="1 0 0 1 -58 144" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 -58 144" stroke="black" fill="lightblue">
+384 256 m
+384 224 l
+704 224 l
+704 256 l
+h
+</path>
+<path matrix="1 0 0 1 -58 207" stroke="black" fill="lightblue">
+64 160 m
+64 96 l
+704 96 l
+704 160 l
+h
+</path>
+<text matrix="1 0 0 1 45 215" transformations="translations" pos="96 224" stroke="black" type="label" width="184.702" height="14.9448" depth="0" valign="baseline" size="small">\small Destination Address</text>
+<text matrix="1 0 0 1 430 215" transformations="translations" pos="96 224" stroke="black" type="label" width="61.9848" height="14.9448" depth="0" valign="baseline" size="small">\small Source</text>
+<text matrix="1 0 0 1 237 186" transformations="translations" pos="96 224" stroke="black" type="label" width="139.111" height="16.1424" depth="5.376" valign="baseline" size="small">\small Type (0x080A)</text>
+<text matrix="1 0 0 1 391 186" transformations="translations" pos="96 224" stroke="black" type="label" width="164.63" height="16.1424" depth="5.376" valign="baseline" size="small">\small Subtype (0x0021)</text>
+<text matrix="1 0 0 1 30 183" transformations="translations" pos="96 224" stroke="black" type="label" width="71.9664" height="14.9448" depth="0" valign="baseline" size="small">\small Address</text>
+<text matrix="1 0 0 1 239 151" transformations="translations" pos="96 224" stroke="black" type="label" width="250.642" height="14.952" depth="4.176" valign="baseline" size="small">\small LTE PRACH Configuration</text>
+<text matrix="1 0 0 1 30 151" transformations="translations" pos="96 224" stroke="black" type="label" width="81.4704" height="14.9448" depth="0" valign="baseline" size="small">\small Reserved</text>
+<text matrix="1 0 0 1 47 105" transformations="translations" pos="96 224" stroke="black" type="label" width="314.436" height="16.1424" depth="5.376" valign="baseline" size="small">\small PRACH data block (one antenna)</text>
+<path matrix="1 0 0 1 -58 144" stroke="black" fill="red">
+64 160 m
+64 128 l
+384 128 l
+384 160 l
+h
+</path>
+<text matrix="1 0 0 1 -53 57" transformations="translations" pos="96 224" stroke="black" type="label" width="214.279" height="14.952" depth="4.176" valign="baseline" size="small">\small Frame Check Sequence</text>
+<path matrix="1 0 0 1 -58 144" stroke="black">
+384 160 m
+384 128 l
+704 128 l
+704 160 l
+h
+</path>
+<text matrix="1 0 0 1 -58 118" transformations="translations" pos="64 384" stroke="black" type="label" width="423.247" height="17.9352" depth="5.976" valign="baseline" size="small">IF4p5 PRACH Packet (RRU$\rightarrow$ RAU,RCC)</text>
+<text matrix="1 0 0 1 0 27" transformations="translations" pos="0 240" stroke="black" type="minipage" width="736" height="98.2224" depth="86.472" valign="top" size="small">\tiny
+\begin{itemize}
+\item {\bf Type:} 2 byte (16 bit) field that specifies the RoE protocol
+\item {\bf Subtype:} 2 byte (16 bit) field that specifies the packet subtype
+\item {\bf Reserved:} 4 byte (32 bit) field reserved
+\item {\bf LTE PRACH conf:} 4 byte (32-bit) field that details the configuration of the LTE PRACH packet
+\end{itemize}
+\vskip 3pt
+\begin{tabular}{|c|c|}
+\hline
+{\bf field (0 is LSB, 31 is MSB)} &amp; {\bf description}\\ \hline
+rsvd (0:2) &amp; Reserved.\\ \hline
+ant (3:5) &amp; 3-bit Antenna index of LTE PRACH packet\\ \hline
+RF Num (6:21) &amp; 16-bit field indicating the Radio Frame number of this received PRACH packet\\ \hline
+SF Num (22:25) &amp; 4-bit field indicating the sub-frame number in the radio frame for the LTE PRACH packet\\
+ &amp; Valid range of 0 to 9.\\ \hline
+Exponent (26:31) &amp; FFT exponent output (0 if unscaled) \\
+\hline
+\end{tabular}
+\begin{itemize}
+\item {\bf PRACH data block:} Uncompressed IQ samples
+\end{itemize}</text>
+<path matrix="1 0 0 1 -58 -176.508" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 262 -176.508" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<text matrix="1 0 0 1 -63 -167.508" transformations="translations" pos="96 224" stroke="black" type="label" width="63.5328" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny RE 0  (Real)</text>
+<text matrix="1 0 0 1 93 -167.508" transformations="translations" pos="96 224" stroke="black" type="label" width="66.6048" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny RE 0  (Imag)</text>
+<text matrix="1 0 0 1 257 -167.508" transformations="translations" pos="96 224" stroke="black" type="label" width="63.5328" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny RE 1  (Real)</text>
+<text matrix="1 0 0 1 417 -167.508" transformations="translations" pos="96 224" stroke="black" type="label" width="66.6048" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny RE 1  (Imag)</text>
+<path matrix="1 0 0 1 -0.000004 -224.508" stroke="black">
+166 304 m
+165.917 272.508 l
+166.247 272.508 l
+</path>
+<path matrix="1 0 0 1 -0.000004 -224.508" stroke="black">
+486 304 m
+486.316 272.508 l
+485.986 272.508 l
+</path>
+<path matrix="1 0 0 1 -58 -224" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 262 -224" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<text matrix="1 0 0 1 -63 -215" transformations="translations" pos="96 224" stroke="black" type="label" width="76.236" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny RE 837  (Real)</text>
+<text matrix="1 0 0 1 93 -215" transformations="translations" pos="96 224" stroke="black" type="label" width="79.308" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny RE 837  (Imag)</text>
+<text matrix="1 0 0 1 257 -215" transformations="translations" pos="96 224" stroke="black" type="label" width="76.236" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny RE 838  (Real)</text>
+<text matrix="1 0 0 1 417 -215" transformations="translations" pos="96 224" stroke="black" type="label" width="79.308" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny RE 838  (Imag)</text>
+<path matrix="1 0 0 1 -0.000014 -272" stroke="black">
+166 304 m
+165.917 272.508 l
+166.247 272.508 l
+</path>
+<path matrix="1 0 0 1 -0.000014 -272" stroke="black">
+486 304 m
+486.316 272.508 l
+485.986 272.508 l
+</path>
+<path stroke="black" fill="lightblue" tiling="falling">
+6.00001 47.492 m
+6.00001 32 l
+646 32 l
+646 47.492 l
+h
+</path>
+<path stroke="black">
+528 16 m
+528 16 l
+528 16 l
+528 16 l
+h
+</path>
+<path stroke="black">
+560 16 m
+560 16 l
+560 16 l
+560 16 l
+h
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+64 224 m
+64 192 l
+224 192 l
+224 224 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+224 224 m
+224 192 l
+384 192 l
+384 224 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+384 224 m
+384 192 l
+544 192 l
+544 224 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+544 224 m
+544 192 l
+704 192 l
+704 224 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+64 192 m
+64 160 l
+224 160 l
+224 192 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+224 192 m
+224 160 l
+384 160 l
+384 192 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+384 192 m
+384 160 l
+544 160 l
+544 192 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+544 192 m
+544 160 l
+704 160 l
+704 192 l
+h
+</path>
+<text matrix="1 0 0 1 -42 155" transformations="translations" pos="96 224" stroke="black" type="label" width="60.5064" height="14.9448" depth="0" valign="baseline" size="small">\small Gain 0</text>
+<text matrix="1 0 0 1 118 155" transformations="translations" pos="96 224" stroke="black" type="label" width="60.5064" height="14.9448" depth="0" valign="baseline" size="small">\small Gain 1</text>
+<text matrix="1 0 0 1 -42 123" transformations="translations" pos="96 224" stroke="black" type="label" width="60.5064" height="14.9448" depth="0" valign="baseline" size="small">\small Gain 4</text>
+<text matrix="1 0 0 1 118 123" transformations="translations" pos="96 224" stroke="black" type="label" width="60.5064" height="14.9448" depth="0" valign="baseline" size="small">\small Gain 5</text>
+<text matrix="1 0 0 1 278 155" transformations="translations" pos="96 224" stroke="black" type="label" width="60.5064" height="14.9448" depth="0" valign="baseline" size="small">\small Gain 2</text>
+<text matrix="1 0 0 1 438 155" transformations="translations" pos="96 224" stroke="black" type="label" width="60.5064" height="14.9448" depth="0" valign="baseline" size="small">\small Gain 3</text>
+<text matrix="1 0 0 1 278 123" transformations="translations" pos="96 224" stroke="black" type="label" width="60.5064" height="14.9448" depth="0" valign="baseline" size="small">\small Gain 6</text>
+<text matrix="1 0 0 1 438 123" transformations="translations" pos="96 224" stroke="black" type="label" width="60.5064" height="14.9448" depth="0" valign="baseline" size="small">\small Gain 7</text>
+<path matrix="1 0 0 1 0 36" stroke="black">
+272 512 m
+272 512 l
+272 512 l
+272 512 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 102 180" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 262 180" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 422 180" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<text matrix="1 0 0 1 -54 186" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">0</text>
+<text matrix="1 0 0 1 106 186" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">16</text>
+<text matrix="1 0 0 1 266 186" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">32</text>
+<text matrix="1 0 0 1 426 186" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">48</text>
+<text matrix="1 0 0 1 73 186" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">15</text>
+<text matrix="1 0 0 1 233 186" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">31</text>
+<text matrix="1 0 0 1 393 186" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">47</text>
+<text matrix="1 0 0 1 553 186" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">63</text>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="violet">
+64 320 m
+64 288 l
+544 288 l
+544 320 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="orange">
+544 320 m
+544 288 l
+704 288 l
+704 320 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="orange">
+64 288 m
+64 256 l
+384 256 l
+384 288 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightyellow">
+384 288 m
+384 256 l
+544 256 l
+544 288 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="darkgray">
+544 288 m
+544 256 l
+704 256 l
+704 288 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 -58 180" stroke="black" fill="lightblue">
+384 256 m
+384 224 l
+704 224 l
+704 256 l
+h
+</path>
+<text matrix="1 0 0 1 45 251" transformations="translations" pos="96 224" stroke="black" type="label" width="184.702" height="14.9448" depth="0" valign="baseline" size="small">\small Destination Address</text>
+<text matrix="1 0 0 1 430 251" transformations="translations" pos="96 224" stroke="black" type="label" width="61.9848" height="14.9448" depth="0" valign="baseline" size="small">\small Source</text>
+<text matrix="1 0 0 1 237 222" transformations="translations" pos="96 224" stroke="black" type="label" width="139.111" height="16.1424" depth="5.376" valign="baseline" size="small">\small Type (0x080A)</text>
+<text matrix="1 0 0 1 391 222" transformations="translations" pos="96 224" stroke="black" type="label" width="164.63" height="16.1424" depth="5.376" valign="baseline" size="small">\small Subtype (0x0019)</text>
+<text matrix="1 0 0 1 30 219" transformations="translations" pos="96 224" stroke="black" type="label" width="71.9664" height="14.9448" depth="0" valign="baseline" size="small">\small Address</text>
+<text matrix="1 0 0 1 239 187" transformations="translations" pos="96 224" stroke="black" type="label" width="119.986" height="14.9448" depth="0" valign="baseline" size="small">\small Frame status</text>
+<text matrix="1 0 0 1 30 187" transformations="translations" pos="96 224" stroke="black" type="label" width="81.4704" height="14.9448" depth="0" valign="baseline" size="small">\small Reserved</text>
+<path matrix="1 0 0 1 -58 99" stroke="black" fill="red">
+64 160 m
+64 128 l
+384 128 l
+384 160 l
+h
+</path>
+<text matrix="1 0 0 1 -53 12" transformations="translations" pos="96 224" stroke="black" type="label" width="214.279" height="14.952" depth="4.176" valign="baseline" size="small">\small Frame Check Sequence</text>
+<text matrix="1 0 0 1 0 -12" transformations="translations" pos="0 240" stroke="black" type="minipage" width="736" height="116.527" depth="104.808" valign="top" size="small">\tiny
+\begin{itemize}
+\item {\bf Type:} 2 byte (16 bit) field that specifies the RoE protocol
+\item {\bf Subtype:} 2 byte (16 bit) field that specifies the packet subtype
+\item {\bf Reserved:} 4 byte (32 bit) field reserved
+\item {\bf Frame Status:} 4 byte (32 bit) field
+\end{itemize}
+\vskip 3pt
+\begin{tabular}{|c|c|}
+\hline
+{\bf field (0 is LSB, 31 is MSB)} &amp; {\bf description}\\ \hline
+{\bf ant} (0:2) &amp; The number of Antenna Carriers represented in the packet. Antenna numbers \\
+&amp; range from 0 to 7 with valid inputs being 0,1, 3 and 7 (1,2,4,8 antennas)\\ \hline
+{\bf ant start} (3:5) &amp; starting antenna number\\ \hline
+{\bf RF Num} (6:21) &amp; 16-bit field indicating the Radio Frame number of the UL\_RE samples\\ \hline
+{\bf SF Num} (22:25) &amp; 4-bit field indicating the sub-frame number in the radio frame for the UL\_RE samples\\
+ &amp; Valid range of 0 to 9.\\ \hline
+{\bf Sym Num:} (26:29) &amp; Symbol number. Valid range of 0 to 13. \\
+{\bf rsvd:} (30:31) &amp; reserved\\
+\hline
+\end{tabular}
+\begin{itemize}
+\item {\bf ULRE data block:} compressed IQ samples (8-bit A-law). $N$ is the number of resource elements $N_{\mathrm{RB}}^{\mathrm{UL}}$.
+\end{itemize}</text>
+<path matrix="1 0 0 1 1 245" stroke="black" fill="lightblue" tiling="falling">
+5 63.5079 m
+5 46.9999 l
+645 46.9999 l
+645 63.5079 l
+h
+</path>
+<path matrix="1 0 0 1 -58 84" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 262 84" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 262 36" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 -58 36" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<text matrix="1 0 0 1 38 166" transformations="translations" pos="64 384" stroke="black" type="label" width="589.005" height="25.102" depth="8.372" valign="baseline" size="large">IF4p5 Packets : ULRE (RRU$\rightarrow$ RAU,RCC)</text>
+<path matrix="1 0 0 1 0 36" stroke="black">
+256 240 m
+256 240 l
+256 240 l
+</path>
+<path matrix="1 0 0 1 0 36" stroke="black">
+166 304 m
+165.917 272.508 l
+166.247 272.508 l
+</path>
+<path matrix="1 0 0 1 0 36" stroke="black">
+486 304 m
+486.316 272.508 l
+485.986 272.508 l
+</path>
+<path matrix="1 0 0 1 0 36" stroke="black">
+486.316 256 m
+486.646 224 l
+485.657 224 l
+</path>
+<path matrix="1 0 0 1 -320.398 35.9995" stroke="black">
+486.316 256 m
+486.646 224 l
+485.657 224 l
+</path>
+<path matrix="1 0 0 1 0 36" stroke="black" cap="1">
+258.16 141.771 m
+258.16 141.771 l
+</path>
+<path matrix="1 0 0 1 0 36" stroke="black" cap="1">
+418.597 191.907 m
+418.597 191.907 l
+</path>
+<path matrix="1 0 0 1 0 36" stroke="black" cap="1">
+429.181 79.9357 m
+429.181 79.9357 l
+</path>
+<text matrix="1 0 0 1 -56 84" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 0\\Ant 1 (Re)</text>
+<text matrix="1 0 0 1 24 84" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 0\\Ant 1 (Im)</text>
+<text matrix="1 0 0 1 104 84" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 1\\Ant 1 (Re)</text>
+<text matrix="1 0 0 1 184 84" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 1\\Ant 1 (Im)</text>
+<text matrix="1 0 0 1 264 84" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 2\\Ant 1 (Re)</text>
+<text matrix="1 0 0 1 344 84" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 2\\Ant 1 (Im)</text>
+<text matrix="1 0 0 1 424 84" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 3\\Ant 1 (Re)</text>
+<text matrix="1 0 0 1 504 84" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 3\\Ant 1 (Im)</text>
+<text matrix="1 0 0 1 -56 36" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-4$\\Ant $R$ (Re)</text>
+<text matrix="1 0 0 1 24 36" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-4$\\Ant $R$ (Im)</text>
+<text matrix="1 0 0 1 104 36" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-3$\\Ant $R$ (Re)</text>
+<text matrix="1 0 0 1 184 36" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-3$\\Ant $R$ (Im)</text>
+<text matrix="1 0 0 1 264 36" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-2$\\Ant $R$ (Re)</text>
+<text matrix="1 0 0 1 344 36" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-2$\\Ant $R$ (Im)</text>
+<text matrix="1 0 0 1 424 36" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-1$\\Ant $R$ (Re)</text>
+<text matrix="1 0 0 1 504 36" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-1$\\Ant $R$ (Im)</text>
+<path matrix="1 0 0 1 -166 -96" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -6 -96" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 153 -96" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 313 -96" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -166 -144" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -6 -144" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 153 -144" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 313 -144" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 0.328186 35.7323" stroke="black">
+272 512 m
+272 512 l
+272 512 l
+272 512 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 102.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 262.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<path matrix="1 0 0 1 422.328 179.732" stroke="black">
+64 352 m
+64 320 l
+224 320 l
+224 352 l
+h
+</path>
+<text matrix="1 0 0 1 -53.6718 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">0</text>
+<text matrix="1 0 0 1 106.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">16</text>
+<text matrix="1 0 0 1 266.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">32</text>
+<text matrix="1 0 0 1 426.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">48</text>
+<text matrix="1 0 0 1 73.3282 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">15</text>
+<text matrix="1 0 0 1 233.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">31</text>
+<text matrix="1 0 0 1 393.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">47</text>
+<text matrix="1 0 0 1 553.328 185.732" transformations="translations" pos="64 336" stroke="black" type="minipage" width="32" height="13.8264" depth="1.848" valign="top" size="small">63</text>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="violet">
+64 320 m
+64 288 l
+544 288 l
+544 320 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="orange">
+544 320 m
+544 288 l
+704 288 l
+704 320 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="orange">
+64 288 m
+64 256 l
+384 256 l
+384 288 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="lightyellow">
+384 288 m
+384 256 l
+544 256 l
+544 288 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="darkgray">
+544 288 m
+544 256 l
+704 256 l
+704 288 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 -57.6718 179.732" stroke="black" fill="lightblue">
+384 256 m
+384 224 l
+704 224 l
+704 256 l
+h
+</path>
+<text matrix="1 0 0 1 45.3282 250.732" transformations="translations" pos="96 224" stroke="black" type="label" width="184.702" height="14.9448" depth="0" valign="baseline" size="small">\small Destination Address</text>
+<text matrix="1 0 0 1 430.328 250.732" transformations="translations" pos="96 224" stroke="black" type="label" width="61.9848" height="14.9448" depth="0" valign="baseline" size="small">\small Source</text>
+<text matrix="1 0 0 1 237.328 221.732" transformations="translations" pos="96 224" stroke="black" type="label" width="139.111" height="16.1424" depth="5.376" valign="baseline" size="small">\small Type (0x080A)</text>
+<text matrix="1 0 0 1 391.328 221.732" transformations="translations" pos="96 224" stroke="black" type="label" width="164.63" height="16.1424" depth="5.376" valign="baseline" size="small">\small Subtype (0x0020)</text>
+<text matrix="1 0 0 1 30.3282 218.732" transformations="translations" pos="96 224" stroke="black" type="label" width="71.9664" height="14.9448" depth="0" valign="baseline" size="small">\small Address</text>
+<text matrix="1 0 0 1 239.328 186.732" transformations="translations" pos="96 224" stroke="black" type="label" width="119.986" height="14.9448" depth="0" valign="baseline" size="small">\small Frame status</text>
+<text matrix="1 0 0 1 30.3282 186.732" transformations="translations" pos="96 224" stroke="black" type="label" width="81.4704" height="14.9448" depth="0" valign="baseline" size="small">\small Reserved</text>
+<path matrix="1 0 0 1 -57.6718 162.732" stroke="black" fill="red">
+64 160 m
+64 128 l
+384 128 l
+384 160 l
+h
+</path>
+<text matrix="1 0 0 1 -52.6718 75.7323" transformations="translations" pos="96 224" stroke="black" type="label" width="214.279" height="14.952" depth="4.176" valign="baseline" size="small">\small Frame Check Sequence</text>
+<text matrix="1 0 0 1 0.328186 51.7323" transformations="translations" pos="0 240" stroke="black" type="minipage" width="736" height="116.527" depth="104.808" valign="top" size="small">\tiny
+\begin{itemize}
+\item {\bf Type:} 2 byte (16 bit) field that specifies the RoE protocol
+\item {\bf Subtype:} 2 byte (16 bit) field that specifies the packet subtype
+\item {\bf Reserved:} 4 byte (32 bit) field reserved
+\item {\bf Frame Status:} 4 byte (32 bit) field
+\end{itemize}
+\vskip 3pt
+\begin{tabular}{|c|c|}
+\hline
+{\bf field (0 is LSB, 31 is MSB)} &amp; {\bf description}\\ \hline
+{\bf ant} (0:2) &amp; The number of Antenna Carriers represented in the packet. Antenna numbers \\
+&amp; range from 0 to 7 with valid inputs being 0,1, 3 and 7 (1,2,4,8 antennas)\\ \hline
+{\bf ant start} (3:5) &amp; starting antenna number\\ \hline
+{\bf RF Num} (6:21) &amp; 16-bit field indicating the Radio Frame number of this DLRE packet\\ \hline
+{\bf SF Num} (22:25) &amp; 4-bit field indicating the sub-frame number in the radio frame for the DLRE packet\\
+ &amp; Valid range of 0 to 9.\\ \hline
+{\bf Sym Num:} (26:29) &amp; Symbol number. Valid range of 0 to 13. \\
+{\bf rsvd:} (30:31) &amp; reserved\\
+\hline
+\end{tabular}
+\begin{itemize}
+\item DLRE data block : compressed IQ samples (8-bit A-law). $N$ is the number of resource elements $N_{\mathrm{RB}}^{\mathrm{DL}}$.
+\end{itemize}</text>
+<text matrix="1 0 0 1 38.3282 165.732" transformations="translations" pos="64 384" stroke="black" type="label" width="590.262" height="25.102" depth="8.372" valign="baseline" size="large">IF4p5 Packets : DLRE (RAU,RCC $\rightarrow$RRU)</text>
+<path matrix="1 0 0 1 0.328186 99.7323" stroke="black" cap="1">
+258.16 141.771 m
+258.16 141.771 l
+</path>
+<path matrix="1 0 0 1 0.328186 99.7323" stroke="black" cap="1">
+418.597 191.907 m
+418.597 191.907 l
+</path>
+<path matrix="1 0 0 1 0.328186 99.7323" stroke="black" cap="1">
+429.181 79.9357 m
+429.181 79.9357 l
+</path>
+<path matrix="1 0 0 1 1 309" stroke="black" fill="lightblue" tiling="falling">
+5 63.5079 m
+5 46.9999 l
+645 46.9999 l
+645 63.5079 l
+h
+</path>
+<path matrix="1 0 0 1 -58 148" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 262 148" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 262 100" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 -58 100" stroke="black" fill="lightblue">
+64 256 m
+64 224 l
+384 224 l
+384 256 l
+h
+</path>
+<path matrix="1 0 0 1 0 100" stroke="black">
+166 304 m
+165.917 272.508 l
+166.247 272.508 l
+</path>
+<path matrix="1 0 0 1 0 100" stroke="black">
+486 304 m
+486.316 272.508 l
+485.986 272.508 l
+</path>
+<path matrix="1 0 0 1 0 100" stroke="black">
+486.316 256 m
+486.646 224 l
+485.657 224 l
+</path>
+<path matrix="1 0 0 1 -320.398 99.9995" stroke="black">
+486.316 256 m
+486.646 224 l
+485.657 224 l
+</path>
+<text matrix="1 0 0 1 -56 148" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 0\\Ant 1 (Re)</text>
+<text matrix="1 0 0 1 24 148" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 0\\Ant 1 (Im)</text>
+<text matrix="1 0 0 1 104 148" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 1\\Ant 1 (Re)</text>
+<text matrix="1 0 0 1 184 148" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 1\\Ant 1 (Im)</text>
+<text matrix="1 0 0 1 264 148" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 2\\Ant 1 (Re)</text>
+<text matrix="1 0 0 1 344 148" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 2\\Ant 1 (Im)</text>
+<text matrix="1 0 0 1 424 148" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 3\\Ant 1 (Re)</text>
+<text matrix="1 0 0 1 504 148" transformations="translations" pos="64 256" stroke="black" type="minipage" width="80" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE 3\\Ant 1 (Im)</text>
+<text matrix="1 0 0 1 -56 100" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-4$\\Ant $R$ (Re)</text>
+<text matrix="1 0 0 1 24 100" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-4$\\Ant $R$ (Im)</text>
+<text matrix="1 0 0 1 104 100" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-3$\\Ant $R$ (Re)</text>
+<text matrix="1 0 0 1 184 100" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-3$\\Ant $R$ (Im)</text>
+<text matrix="1 0 0 1 264 100" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-2$\\Ant $R$ (Re)</text>
+<text matrix="1 0 0 1 344 100" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-2$\\Ant $R$ (Im)</text>
+<text matrix="1 0 0 1 424 100" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-1$\\Ant $R$ (Re)</text>
+<text matrix="1 0 0 1 504 100" transformations="translations" pos="64 256" stroke="black" type="minipage" width="96" height="18.7968" depth="6.84" valign="top" size="small">\tiny RE $N-1$\\Ant $R$ (Im)</text>
+<path matrix="1 0 0 1 -166 -32" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -6 -32" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 153 -32" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 313 -32" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -166 -80" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 -6 -80" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 153 -80" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+<path matrix="1 0 0 1 313 -80" stroke="black">
+248.997 435.732 m
+248.997 403.732 l
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" stroke="black" fill="violet">
+640 128 m
+640 32 l
+704 32 l
+704 128 l
+h
+</path>
+<path stroke="black" fill="violet">
+640 480 m
+640 176 l
+720 176 l
+720 480 l
+h
+</path>
+<path matrix="0.782649 0 0 1 194.326 12" fill="lightgray">
+328.159 119.72 m
+328.159 15.3556 l
+554.022 15.3556 l
+554.022 119.72 l
+h
+</path>
+<path matrix="0.898058 0 0 0.385515 103.608 -169.189" fill="lightyellow" fillrule="eofill">
+96 784 m
+96 496 l
+224 496 l
+224 784 l
+h
+</path>
+<path matrix="1 0 0 1 -69 -4" stroke="black">
+-192 928 m
+-192 944 l
+-192 944 l
+-192 928 l
+h
+</path>
+<path matrix="0.956412 0 0 1.08596 98.2256 -362.832" fill="lightyellow">
+96 784 m
+96 496 l
+224 496 l
+224 784 l
+h
+</path>
+<text matrix="1 0 0 1 147 -22" transformations="translations" pos="48 512" stroke="black" type="label" width="124.692" height="14.9448" depth="0" valign="baseline" size="small">\begin{small}L1 Instance 0\end{small}</text>
+<text matrix="1 0 0 1 144 -377" transformations="translations" pos="48 512" stroke="black" type="label" width="128.453" height="16.6032" depth="0" valign="baseline" size="small">LI instance 1</text>
+<text matrix="1 0 0 1 406 -26" transformations="translations" pos="48 512" stroke="black" type="label" width="270.245" height="16.1424" depth="5.376" valign="baseline" size="small">\begin{small}MAC/RLC/PDCP Instance 0\end{small}</text>
+<path matrix="1 0 0 1 -46 -4" stroke="black">
+364 518 m
+364 518 l
+364 518 l
+364 518 l
+h
+</path>
+<path matrix="1.39392 0 0 1.07237 321.184 -356.09" fill="lightgray">
+96 784 m
+96 496 l
+224 496 l
+224 784 l
+h
+</path>
+<path matrix="0.835391 0 0 0.672703 360.137 -36.0947" fill="lightblue">
+128 768 m
+128 704 l
+192 704 l
+192 768 l
+h
+</path>
+<text matrix="1.36111 0 0 0.829268 467.799 77.5985" transformations="translations" pos="0 474" stroke="black" type="minipage" width="52" height="17.6496" depth="5.664" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+DL/UL Scheduler
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 200.75 -1" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 465.792 27.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 250.75 -1" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 393.75 -1" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 653.792 27.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 270.958 48.6756" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 536 76.927" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 320.75 49" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 392.75 49" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 652.792 77.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 127 14" stroke="blue" arrow="normal/normal">
+180 460 m
+340 460 l
+</path>
+<path matrix="1 0 0 1 127 -13" stroke="red" rarrow="normal/normal">
+180 460 m
+340 460 l
+</path>
+<text matrix="1 0 0 1 152 4" transformations="translations" pos="200 480" stroke="blue" type="minipage" width="128" height="10.128" depth="0" valign="top" size="small">\begin{tiny}1ms TICK\end{tiny}</text>
+<path matrix="1 0 0 1 75 -1" stroke="red" arrow="normal/normal">
+392.067 448.35 m
+232.502 360 l
+</path>
+<text matrix="1 0 0 1 87 -9" transformations="translations" pos="230 460" stroke="red" type="label" width="144.917" height="8.3136" depth="3.576" valign="baseline" size="small">\begin{tiny}$\mathrm{DCI}_0$, Transport Blocks\end{tiny}
+</text>
+<text matrix="0.883494 0.468443 -0.468443 0.883494 345.823 -153.876" pos="230 460" stroke="red" type="label" width="46.6752" height="8.1384" depth="3.576" valign="baseline" size="small">\begin{tiny}$\mathrm{DCI}_1$\end{tiny}
+</text>
+<text matrix="0.660422 0.750895 -0.750895 0.660422 585.762 -107.641" pos="230 460" stroke="red" type="label" width="46.6752" height="8.1384" depth="3.576" valign="baseline" size="small">\begin{tiny}$\mathrm{DCI}_2$\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 515.792 27.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 585.792 77.2514" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC TX
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -547.5 -1" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 200.252 29.0442" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_0$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -547.502 -101" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 200.252 -70.9558" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_1$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -547.502 -203.29" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 200.252 -173.245" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_2$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -547.502 49" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 200.252 79.0442" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_0$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -547.502 -51" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 200.252 -20.9558" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_1$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -547.502 -149" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 200.252 -118.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_2$
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 75 -1" stroke="blue" arrow="normal/normal">
+234.502 211.006 m
+387 210 l
+</path>
+<path matrix="1 0 0 1 130 -4" stroke="black" cap="1">
+243.386 213.48 m
+243.386 213.48 l
+</path>
+<path matrix="1 0 0 1 75 9" stroke="red" rarrow="normal/normal">
+232.502 250.102 m
+387.004 250.371 l
+</path>
+<path matrix="1 0 0 1 75 -1" stroke="blue" arrow="normal/normal">
+232.502 310 m
+387 310 l
+</path>
+<path matrix="1 0 0 1 75 8" stroke="red" rarrow="normal/normal">
+232.502 346.88 m
+387 347 l
+</path>
+<path matrix="1.06124 0 0 1.05601 109.366 -29.2854" stroke="red" arrow="normal/normal">
+336.917 451.424 m
+185.872 274.589 l
+</path>
+<path matrix="1 0 0 1 75 -1" stroke="blue" arrow="normal/normal">
+232.5 410 m
+386.079 409.083 l
+</path>
+<text matrix="1 0 0 1 132.165 -102.466" transformations="translations" pos="230 460" stroke="red" type="label" width="98.448" height="8.3232" depth="2.304" valign="baseline" size="small">\begin{tiny}Transport Blocks\end{tiny}
+</text>
+<text matrix="1 0 0 1 131.548 -196.94" transformations="translations" pos="230 460" stroke="red" type="label" width="98.448" height="8.3232" depth="2.304" valign="baseline" size="small">\begin{tiny}Transport Blocks\end{tiny}
+</text>
+<text matrix="1 0 0 1 117 0" transformations="translations" pos="191.31 225.577" stroke="blue" type="minipage" width="124.891" height="19.9872" depth="8.04" valign="top" size="small">\setstretch{.5}\begin{tiny}CQI/SR/ACK/NAK/PHR\\Transport Blocks\end{tiny}</text>
+<text matrix="1 0 0 1 115.548 97.0652" transformations="translations" pos="191.31 225.577" stroke="blue" type="minipage" width="124.891" height="19.9872" depth="8.04" valign="top" size="small">\setstretch{.5}\begin{tiny}CQI/SR/ACK/NAK/PHR\\Transport Blocks\end{tiny}</text>
+<text matrix="1 0 0 1 116.852 197.782" transformations="translations" pos="191.31 225.577" stroke="blue" type="minipage" width="124.891" height="19.9872" depth="8.04" valign="top" size="small">\setstretch{.5}\begin{tiny}CQI/SR/ACK/NAK/PHR\\Transport Blocks\end{tiny}</text>
+<path matrix="1 0 0 1 123.894 -343.063" stroke="blue" arrow="normal/normal">
+180 460 m
+340 460 l
+</path>
+<path matrix="1 0 0 1 123.894 -370.063" stroke="red" rarrow="normal/normal">
+180 460 m
+340 460 l
+</path>
+<text matrix="1 0 0 1 148.894 -353.063" transformations="translations" pos="200 480" stroke="blue" type="minipage" width="128" height="10.128" depth="0" valign="top" size="small">\begin{tiny}1ms TICK\end{tiny}</text>
+<text matrix="1 0 0 1 88.894 -366.063" transformations="translations" pos="230 460" stroke="red" type="label" width="144.917" height="8.3136" depth="3.576" valign="baseline" size="small">\begin{tiny}$\mathrm{DCI}_0$, Transport Blocks\end{tiny}
+</text>
+<path matrix="1.05698 0 0 1.52948 107.055 -427.707" stroke="blue" arrow="normal/normal">
+184.502 313 m
+332 313 l
+</path>
+<text matrix="1 0 0 1 405.673 -373.496" transformations="translations" pos="48 512" stroke="black" type="label" width="270.245" height="16.1424" depth="5.376" valign="baseline" size="small">\begin{small}MAC/RLC/PDCP Instance 1\end{small}</text>
+<path matrix="0.791667 0 0 1 202.166 -54.3244" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 467.208 -26.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 251.958 -54" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 394.958 -54" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 655 -25.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 517 -25.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 202.166 -149.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 467.208 -121.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 251.958 -149" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 394.958 -149" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 655 -120.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 517 -120.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 201.958 -101" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 467 -72.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 251.958 -101" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 394.958 -101" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 655 -72.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 517 -72.7486" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 201.75 -199" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 466.792 -170.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 251.75 -199" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 394.75 -199" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 654.792 -170.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 516.792 -170.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC RX
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -549.88 -359" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 197.872 -328.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX \\
+$\mathrm{eNB}_0$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -549.882 -309" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 197.872 -278.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX \\
+$\mathrm{eNB}_0$
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 114 -159" transformations="translations" pos="191.31 225.577" stroke="blue" type="minipage" width="124.891" height="19.9872" depth="8.04" valign="top" size="small">\setstretch{.5}\begin{tiny}CQI/SR/ACK/NAK/PHR\\Transport Blocks\end{tiny}</text>
+<path matrix="0.835391 0 0 0.672703 356.345 -392.095" fill="lightblue">
+128 768 m
+128 704 l
+192 704 l
+192 768 l
+h
+</path>
+<text matrix="1.36111 0 0 0.829268 464.007 -278.401" transformations="translations" pos="0 474" stroke="black" type="minipage" width="52" height="17.6496" depth="5.664" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+DL/UL Scheduler
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 196.958 -357" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 462 -328.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 246.958 -357" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 390.958 -357" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 651 -328.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP RX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 267.166 -307.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 532.208 -279.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC TX
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 316.958 -307" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 389.958 -307" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 650 -278.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="42" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PDCP TX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 512 -328.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC RX
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 582 -278.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC TX
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="489.023" height="20.9244" depth="6.972" halign="center" valign="baseline">RU/L1 Instances and Component Carriers</text>
+<path matrix="0.972035 0 0 0.364588 -79.4938 -158.809" fill="lightyellow" fillrule="eofill">
+96 784 m
+96 496 l
+224 496 l
+224 784 l
+h
+</path>
+<path matrix="0.956412 0 0 1.08596 -77.7744 -362.832" fill="lightyellow">
+96 784 m
+96 496 l
+224 496 l
+224 784 l
+h
+</path>
+<path matrix="1 0 0 1 -222 -4" stroke="black">
+364 518 m
+364 518 l
+364 518 l
+364 518 l
+h
+</path>
+<path matrix="2.25001 0 0 1.17344 -723.502 -213.245" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 24.252 -119.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_3$
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 0 -1" stroke="black">
+144 480 m
+144 32 l
+176 32 l
+176 480 l
+h
+</path>
+<path stroke="black" cap="1">
+176 432 m
+176 432 l
+</path>
+<path matrix="1 0 0 1 0 -7" stroke="0 0 1">
+192 464 m
+176 464 l
+</path>
+<path stroke="blue" cap="1">
+190.041 464 m
+190.041 464 l
+</path>
+<path stroke="blue" cap="1">
+190.041 464 m
+190.041 464 l
+</path>
+<path matrix="1 0 0 1 0 -105" stroke="0 0 1">
+192 464 m
+176 464 l
+</path>
+<path matrix="1 0 0 1 0 -203" stroke="0 0 1">
+192 464 m
+176 464 l
+</path>
+<path matrix="1 0 0 1 0 -363" stroke="0 0 1">
+192 464 m
+176 464 l
+</path>
+<path matrix="1 0 0 1 -0.041 -55" stroke="red">
+192 464 m
+176 464 l
+</path>
+<path matrix="1 0 0 1 0.918 -156" stroke="red">
+192 464 m
+176 464 l
+</path>
+<path matrix="1 0 0 1 -0.041848 -260.196" stroke="red">
+192 464 m
+176 464 l
+</path>
+<path matrix="1 0 0 1 -0.083 -414" stroke="red">
+192 464 m
+176 464 l
+</path>
+<path matrix="2.25001 0 0 1.17344 -723.502 -21.245" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 24.252 72.544" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_0$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1.17344 -723.502 -85.245" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 24.252 8.544" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_1$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1.17344 -723.502 -149.245" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 24.252 -55.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_2$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1.17344 -723.502 -277.245" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 24.252 -183.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_4$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1.17344 -723.502 -382.245" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 24.252 -288.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_5$
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1.17344 -723.502 -432.245" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 24.252 -337.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_6$
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 0 3" stroke="0 0 1">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -13" stroke="1 0 0">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -61" stroke="0 0 1">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -77" stroke="1 0 0">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -125" stroke="0 0 1">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -141" stroke="1 0 0">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -189" stroke="0 0 1">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -205" stroke="1 0 0">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -253" stroke="0 0 1">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -269" stroke="1 0 0">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -359" stroke="0 0 1">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -375" stroke="1 0 0">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -406" stroke="0 0 1">
+144 464 m
+129.959 464 l
+</path>
+<path matrix="1 0 0 1 0 -424" stroke="1 0 0">
+144 464 m
+129.959 464 l
+</path>
+<path stroke="black" fill="violet">
+640 400 m
+640 400 l
+640 400 l
+640 400 l
+h
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 -512 70" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="267.199" depth="255.84" valign="top" size="small">\small\begin{itemize}
+\item {\em Radio Unit} (RU) is
+\begin{itemize}
+\item an entity managing a set of {\bf physical} antennas. It can  have a {\em local RF unit} or {\em remote RF unit} 
+\item performs precoding of multiple eNB TX streams and OFDM modulation (TX) and demodulation (RX) (part of 36.211)
+\end{itemize}
+\item {\em L1 Instance} (indexed by {\tt Mod\_id}, or {\tt enb\_mod\_id}) is a separate set of threads and contexts for the eNB/gNB procedures. There is one MAC/RLC entity associated to all :1 component carriers. 
+\item {\em L1 Component Carrier} (indexed by {\tt CC\_id}) is 
+\begin{itemize} 
+\item a software entity managing the L1 procedures (36.213,36.212,36.211) and can act on
+\begin{itemize} 
+\item sectored antenna component
+\item Rel10+ component carrier
+\item virtual cell for DAS or Massive-MIMO array
+\end{itemize}
+\item each L1 instance is managed by one or two threads which operate on a subframe (TX and RX) and can have a {\em local RU} or {\em remote RU}
+\item if a remote radio unit the eNB performs the 36.213 specifications only (HARQ, etc.) and connects to the remainder via the IF2 midhaul interface.
+\end{itemize}
+\end{itemize} </text>
+<text matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="489.023" height="20.9244" depth="6.972" halign="center" valign="baseline">RU/L1 Instances and Component Carriers</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="489.023" height="20.9244" depth="6.972" halign="center" valign="baseline">RU/L1 Instances and Component Carriers</text>
+<text matrix="1 0 0 1 -512 62" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="252.574" depth="241.176" valign="top" size="small">\small\begin{itemize}
+\item RU may have both an {\tt if\_device} for fronthaul and an {\tt rf\_device} for interconnection with a local RF unit
+\item if the {\tt rf\_device} is absent, it must have a southbound fronthaul interface (either IF5 or IF4p5) depending on the local processing of the remote RU
+\item if the {\tt if\_device} is absent, it must have a southbound RF interface and {\tt rf\_device}.
+\item three types of L1 processing are performed by the RU \begin{itemize}
+\item subset of common L1 procedures from 36.211 specifications
+\item fronthaul compression/decompression
+\item framing
+\end{itemize}
+\item on TX
+\begin{itemize}
+\item A-law compression for (NGFI\_RAU\_IF4p5, NGFI\_RAU\_IF5)
+\item A-law decompression (for NGFI\_RRU\_IF4p5 and NGFI\_RRU\_IF5)
+\item OFDM modulation and cyclic prefix insertion (for NGFI\_RRU\_IF4p5,NGFI\_RAU\_IF5,3GPP\_eNodeB\_BBU,3GPP\_eNodeB)
+\item Precoding (for NGFI\_RAU\_IF5, NGFI\_RAU\_IF4p5,3GPP\_eNodeB\_BBU,3GPP\_eNodeB)
+\end{itemize}
+\end{itemize}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="489.023" height="20.9244" depth="6.972" halign="center" valign="baseline">RU/L1 Instances and Component Carriers</text>
+<text matrix="1 0 0 1 -512 62" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="183.014" depth="171.456" valign="top" size="small">\small\begin{itemize}
+\item on RX
+\begin{itemize}
+\item A-law compression for (NGFI\_RRU\_IF4p5, NGFI\_RRU\_IF5)
+\item A-law decompression (for NGFI\_RAU\_IF4p5 and 3GPP\_eNodeB\_BBU)
+\item cyclic prefix removal, frequency-shifting, OFDM demodulation, PRACH DFT (for NGFI\_RRU\_IF4p5, NGFI\_RAU\_IF5, 3GPP\_eNodeB\_BBU, 3GPP\_eNodeB)
+\end{itemize}
+\item On TX path
+\begin{itemize}
+\item L1 instances/component carriers operate on a set of logical antenna ports (0-3 for TM1-6, 4 for eMBMS, 5 for TM7, 6 for positioning, 7-8 for TM8, etc.)
+\item each L1 instance has a list of RUs and the logical antenna ports are mapped to the physical antennas attached to the RUs via the precoding function
+\end{itemize}
+\end{itemize}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 -512 87" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="165.41" depth="153.792" valign="top" size="small">\small\begin{itemize}
+\item Example configurations
+\begin{itemize}
+\item {\em itsolated eNB:} one instance and one or several component carriers (multiple-frequencies or antenna sectors). Potentially multiple radio-units (for CoMP). Here there is a common MACRLC instnance driving multiple L1 procedures
+\item {\em indoor DAS system (RCC split with L1/L2 RAU) Multiple layer 2 instances each driving one or more component carriers}  here the RAU implements multiple L1/L2 instances  and precoding function. Usually with IF2/IF1&apos;&apos; xhaul to RCC or potentially also MAC/RLC in RAU with IF1&apos; xhaul to RCC. 
+\item {\em massive-MIMO array} same as 2nd indoor DAS system (i.e. integrated L1/L2 RAU with array)
+\end{itemize}
+\end{itemize} </text>
+<text matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="489.023" height="20.9244" depth="6.972" halign="center" valign="baseline">RU/L1 Instances and Component Carriers</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 -117 31" stroke="black" fill="lightyellow">
+288 384 m
+288 96 l
+672 96 l
+672 384 l
+h
+</path>
+<path matrix="1 0 0 1 -117 119" fill="lightblue">
+301.83 142.941 m
+301.83 103.286 l
+648 104 l
+648 144 l
+h
+</path>
+<path matrix="1.19584 0 0 1.2081 -102.418 -199.483" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -372.028 -59.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 198.792 -187.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 -117 31" fill="lightblue">
+301.83 142.941 m
+301.83 103.286 l
+648 104 l
+648 144 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 277.792 -244.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="162" height="11.4576" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF4p5 / ethernet}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 299 -81.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="48" height="24.4656" depth="12.528" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY TX (212,213)
+\end{tiny}
+</text>
+<path matrix="1.84415 0 0 0.573526 -364.777 112.325" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 260.792 -43.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1.23792 0 0 0.982021 -258.579 37.7599" fill="lightblue">
+389.83 375.941 m
+389.83 336.286 l
+616 336 l
+616 376 l
+h
+</path>
+<text matrix="0.769443 0 0 0.141445 327.792 331.279" transformations="translations" pos="0 474" stroke="black" type="minipage" width="74" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NFGI\_IF1pp / ethernet}
+\end{tiny}
+</text>
+<path matrix="1.88415 0 0 0.573526 -235.977 112.325" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 402.792 -43.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="0.769443 0 0 0.141445 300.792 187.279" transformations="translations" pos="0 474" stroke="black" type="minipage" width="122" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+TX PRECODING\\RX COMBINING
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -284.028 -59.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 286.792 -187.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -196.028 -59.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 374.792 -187.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -108.028 -59.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 462.792 -187.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -512 63" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="45.4008" depth="33.504" valign="top" size="small">\small\begin{itemize}
+\item Example: RAU with {\tt NGFI\_IF1pp} xhaul (MAC/PHY split) northbound, {\tt NGFI\_IF4p5} fronthaul southbound, 2 vCell logical interfaces (2 L1/L2 instances, or 1 L2 instance and 2 CCs), 4 RRUs with {\tt NGFI\_IF4p5} 
+
+\end{itemize} </text>
+<path matrix="1.19584 0 0 1.2081 -166.418 -199.483" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 235 -81.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="48" height="24.4656" depth="12.528" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY RX (212,213)
+\end{tiny}
+</text>
+<path matrix="1.19584 0 0 1.2081 -22.418 -199.483" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 379 -81.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="48" height="24.4656" depth="12.528" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY RX (212,213)
+\end{tiny}
+</text>
+<path matrix="1.19584 0 0 1.2081 41.582 -199.483" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 443 -81.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="48" height="24.4656" depth="12.528" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+upper-PHY TX (212,213)
+\end{tiny}
+</text>
+<path matrix="0.734203 0 0 0.68606 60.2968 67.2928" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<path matrix="0.734203 0 0 0.68606 147.297 67.2928" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<path matrix="0.734203 0 0 0.68606 235.297 67.2928" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<path matrix="0.734203 0 0 0.68606 323.297 67.2928" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 197.792 -224.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_0$
+\end{tiny}
+</text>
+<text matrix="1.12743 0 0 0.829268 283.792 -224.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_1$
+\end{tiny}
+</text>
+<text matrix="1.12743 0 0 0.829268 373.792 -224.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_2$
+\end{tiny}
+</text>
+<text matrix="1.12743 0 0 0.829268 460.792 -223.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_3$
+\end{tiny}
+</text>
+<path matrix="1.16776 0 0 0.634205 24.369 185.93" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 241.792 -63.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{eNB}_0$
+\end{tiny}
+</text>
+<path matrix="1.16776 0 0 0.634205 166.576 185.93" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 383.999 -63.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{eNB}_1$
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="247.341" height="20.9244" depth="6.972" halign="center" valign="baseline">RAU Example (DAS)</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" stroke="black" fill="lightyellow">
+168 416 m
+168 32 l
+576 32 l
+576 416 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -375.028 -139.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -380.028 -144.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 -28.042 -200.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 -76.042 -200.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 189 -172.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX0
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -384.028 -149.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 186.792 -277.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 0 -82" fill="lightblue">
+176 176 m
+176 136 l
+552 136 l
+552 176 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 277.792 -317.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="162" height="11.4576" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NGFI\_IF4p5 / ethernet}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 237 -173.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX0
+\end{tiny}</text>
+<path fill="lightblue">
+184 360 m
+184 336 l
+552 336 l
+552 360 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 329.792 -42.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path fill="lightblue">
+184 408 m
+184 368 l
+552 368 l
+552 408 l
+h
+</path>
+<text matrix="0.769443 0 0 0.141445 295.792 324.279" transformations="translations" pos="0 474" stroke="black" type="minipage" width="130" height="11.4576" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt NGFI\_IF1p / ethernet}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 0 -82" fill="lightblue">
+184 264 m
+184 224 l
+552 224 l
+552 264 l
+h
+</path>
+<text matrix="0.769443 0 0 0.141445 300.792 105.279" transformations="translations" pos="0 474" stroke="black" type="minipage" width="122" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+TX PRECODING\\RX COMBINING
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -512 63" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="42.1128" depth="30.216" valign="top" size="small">\small\begin{itemize}
+\item Example: massive-MIMO RAU with {\tt NGFI\_IF1p} fronthaul northbound, 8 L1 component carriers,1 L2 instances, many local RRUs with {\tt NGFI\_IF4p5} southbound 
+
+\end{itemize} </text>
+<path matrix="1.68745 0 0 0.638421 -279.028 -139.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -284.028 -144.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -288.028 -149.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 282.792 -277.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -183.028 -139.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -188.028 -144.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -192.028 -149.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 378.792 -277.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="1.68745 0 0 0.638421 -87.028 -139.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -92.028 -144.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.68745 0 0 0.638421 -96.028 -149.58" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 474.792 -277.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="9.6312" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+{\tt if\_device}
+\end{tiny}
+</text>
+<path matrix="0.791667 0 0 1 67.958 -200.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 19.958 -200.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 285 -172.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX1
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 333 -173.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX1
+\end{tiny}</text>
+<path matrix="0.791667 0 0 1 251.958 -200.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.791667 0 0 1 203.958 -200.324" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 469 -172.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX7
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 517 -173.073" transformations="translations" pos="0 474" stroke="black" type="minipage" width="32" height="17.2968" depth="5.352" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX7
+\end{tiny}</text>
+<path fill="lightblue">
+184 320 m
+184 288 l
+552 288 l
+552 320 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 329.792 -84.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+RLC
+\end{tiny}
+</text>
+<path fill="lightblue">
+184 280 m
+184 248 l
+552 248 l
+552 280 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 331.792 -123.749" transformations="translations" pos="0 474" stroke="black" type="minipage" width="58" height="10.128" depth="0" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+MAC
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 6 0" stroke="black" dash="dashed">
+376 208 m
+448 208 l
+</path>
+<path matrix="0.993512 0 0 0.664471 1.76482 65.9478" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 188.792 -228.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{eNB}_0$
+\end{tiny}
+</text>
+<path matrix="0.993512 0 0 0.664471 97.7648 65.9478" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 284.792 -205.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{eNB}_1$
+\end{tiny}
+</text>
+<path matrix="0.993512 0 0 0.664471 281.765 65.9478" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 468.792 -228.749" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{eNB}_7$
+\end{tiny}
+</text>
+<path matrix="0.917752 0 0 0.481451 6.3714 0.0229267" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 177.792 -296.724" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="14.9568" depth="2.976" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_{0\cdots 15}$
+\end{tiny}
+</text>
+<path matrix="0.917752 0 0 0.481451 102.371 0.0229267" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 273.792 -296.724" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="14.9568" depth="2.976" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_{16\cdots 31}$
+\end{tiny}
+</text>
+<path matrix="0.917752 0 0 0.481451 198.371 0.0229267" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 369.792 -296.724" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="14.9568" depth="2.976" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_{32\cdots 47}$
+\end{tiny}
+</text>
+<path matrix="0.917752 0 0 0.481451 294.371 0.0229267" stroke="red" dash="dashed">
+184.83 261.941 m
+184.83 128 l
+272 128 l
+272 261.941 l
+h
+</path>
+<text matrix="1.12743 0 0 0.829268 465.792 -296.724" transformations="translations" pos="0 474" stroke="red" type="minipage" width="58" height="14.9568" depth="2.976" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_{48\cdots 63}$
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="371.398" height="20.9244" depth="6.972" halign="center" valign="baseline">RAU Example (Massive-MIMO)</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="9.32238 0 0 7.538 -3010.38 -2934.28" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1.42158 0 0 1.03726 -243.165 -111.108" stroke="black" fill="violet">
+232 384 m
+232 256 l
+543.99 256 l
+543.99 384 l
+h
+</path>
+<path matrix="0.99836 0 0 1.3492 -9.1566 -33.1014" stroke="black" fill="gold">
+96 136 m
+96 48 l
+540 48 l
+540 136 l
+h
+</path>
+<path matrix="1 0 0 0.95491 6.23114 90.842" fill="lightgray">
+88 192 m
+88 80 l
+248 80 l
+248 192 l
+h
+</path>
+<path matrix="0.967606 0 0 0.857143 10.0338 -17.5714" fill="lightgray">
+88 192 m
+88 80 l
+248 80 l
+248 192 l
+h
+</path>
+<path matrix="0.459459 0 0 1.28571 41.514 -49.285" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 -512 63" transformations="translations" pos="512 464" stroke="black" type="minipage" width="740" height="114.648" depth="102.936" valign="top" size="small">\small\begin{itemize}
+\item IF5 transports packets of size equal to a subframe and corresponding to a 1ms chunk of signal in the time-domain. This is done via the functions send\_if5 and recv\_if5, in the layer1 transport procedures ({\tt openair1/PHY/LTE\_TRANSPORT/if5\_tools.c}). A timestamp is given along with the samples, corresponding to the time (in samples) of the first sample of the packet.
+\item each block can be compressed with A-law compression, yielding a compression rate of .5.
+\end{itemize} </text>
+<text matrix="1 0 0 1 169 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="315.42" height="20.9244" depth="6.972" halign="center" valign="baseline">RU Procedures (NGFI\_IF5)</text>
+<path matrix="2.25001 0 0 1 -120.88 -377" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 627.252 -346.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_2$ (211,212)
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -120.502 -228" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 627.252 -197.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_2$ (211,212)
+\end{tiny}
+</text>
+<path matrix="0.876018 0 0 0.636058 450.853 -13.2664" stroke="black">
+144 480 m
+144 32 l
+176 32 l
+176 480 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 66.928 -374.838" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_0$
+\end{tiny}
+</text>
+<path matrix="-0.360709 0 0 -1 738.691 287.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="0.360709 0 0 1 486.749 -75.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="2.25001 0 0 1 -120.88 -329" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 627.252 -298.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_1$ (211,212)
+\end{tiny}
+</text>
+<path matrix="0.360709 0 0 1 486.749 -27.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="2.25001 0 0 1 -120.88 -281" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 627.252 -250.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_0$ (211,212)
+\end{tiny}
+</text>
+<path matrix="0.360709 0 0 1 486.749 20.663" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="2.25001 0 0 1 -119.035 -179" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 628.719 -148.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_1$ (211,212)
+\end{tiny}
+</text>
+<path matrix="-0.360709 0 0 -1 740.158 336.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="2.25001 0 0 1 -119.035 -131" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 628.719 -100.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_0$ (211,212)
+\end{tiny}
+</text>
+<path matrix="-0.360709 0 0 -1 740.158 384.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="1 0 0 1 143.432 -152.618" fill="turquoise">
+132 294 m
+132 208 l
+384 208 l
+384 294 l
+h
+</path>
+<path matrix="1 0 0 1 2 -29" stroke="black" arrow="normal/small">
+144.991 145.396 m
+289.432 145.382 l
+</path>
+<path matrix="1 0 0 1 2 -29" stroke="black" arrow="normal/small">
+144.991 120.982 m
+289.432 121.382 l
+</path>
+<text matrix="1 0 0 1 -447.936 88.75" pos="596 32" stroke="black" type="label" width="131.599" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt RU-&gt;ru\_time.rxdata[0]}</text>
+<text matrix="1 0 0 1 -446.936 64.75" pos="596 32" stroke="black" type="label" width="144.3" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt RU-&gt;ru\_time.rxdata[R-1]}</text>
+<path matrix="1 0 0 1 188.432 -100.618" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 213.433 -336.618" transformations="translations" pos="128 440" stroke="black" type="minipage" width="76" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny slot\_fep\_ul\par36.211</text>
+<path matrix="0.459459 0 0 1.28571 223.135 -158.904" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<path matrix="1 0 0 1 143.432 -152.618" stroke="black" arrow="normal/tiny">
+184 268 m
+196 268 l
+</path>
+<path matrix="1 0 0 1 143.432 -152.618" stroke="black" arrow="normal/tiny">
+184 244 m
+196 244 l
+</path>
+<text matrix="1 0 0 1 -177.839 90.285" pos="596 32" stroke="black" type="label" width="169.706" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt eNB-&gt;common\_vars.rxdataF[0]}</text>
+<text matrix="1 0 0 1 -176.839 66.285" pos="596 32" stroke="black" type="label" width="182.407" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt eNB-&gt;common\_vars.rxdataF[R-1]}</text>
+<path matrix="1.14711 0 0 0.643127 105.368 -57.0842" stroke="black" arrow="normal/small">
+273 269 m
+412 268 l
+</path>
+<path matrix="1 0 0 1 2 -29" stroke="black" arrow="normal/small">
+415.263 120.984 m
+575 120.608 l
+</path>
+<path matrix="0.459459 0 0 1.28571 42.234 -159.285" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="0 1 -1 0 166.559 -528.915" pos="596 32" stroke="black" type="label" width="71.16" height="12.8064" depth="2.976" valign="baseline" size="small">\tiny $\mathrm{Alaw}^{-1}()$</text>
+<path matrix="1 0 0 1 2 -29" stroke="black" arrow="normal/tiny">
+56 128 m
+110.531 128.542 l
+</path>
+<text matrix="1 0 0 1 -591.936 75.75" pos="596 32" stroke="black" type="label" width="105.653" height="8.3016" depth="0" valign="baseline" size="small">\tiny from IF5 {\tt if\_device}</text>
+<path matrix="1 0 0 1 248 -71.02" stroke="black">
+680 104 m
+680 104 l
+680 104 l
+680 104 l
+h
+</path>
+<path matrix="0.632607 0 0 0.581545 154.85 73.761" stroke="black" fill="lightgreen">
+544 324 m
+544 144 l
+576 144 l
+576 324 l
+h
+</path>
+<text matrix="0.923166 0 0 0.436636 -9.1365 120.386" transformations="translations" pos="548 304" stroke="black" type="minipage" width="24" height="48.3768" depth="36.504" valign="top" size="small" style="center">\setstretch{.5}\tt\tiny P\\R\\E\\C\\O\\D\\I\\N\\G\\</text>
+<path matrix="-1.00596 0 0 0.723429 1093.07 21.2483" stroke="black" fill="white">
+632 360 m
+632 188 l
+660 188 l
+660 360 l
+h
+</path>
+<text matrix="1 0 0 1 -325.616 204.83" pos="596 32" stroke="black" type="label" width="131.599" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt RU-&gt;ru\_time.txdata[0]}</text>
+<path matrix="-7.98213 0 0 0.926402 6014.38 -11.5901" stroke="black" arrow="normal/tiny">
+700 264 m
+735.133 264 l
+</path>
+<path matrix="-1 0 0 1 1129.13 -52.02" stroke="black" arrow="normal/tiny">
+632 264.556 m
+671.833 265 l
+</path>
+<text matrix="0 1 -1 0 712.677 -464.953" pos="636 280" stroke="black" type="minipage" width="84" height="16.6824" depth="4.704" valign="top" size="small" style="center">\setstretch{.5}\tt\tiny do\_ofdm\_mod\_rt()\par 36.211</text>
+<text matrix="0.781914 0 0 0.829268 337.809 -371.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="200.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt openair1/SCHED/ru-procedures.c}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 2 11" stroke="red" rarrow="normal/small">
+517.232 240.387 m
+576.078 240 l
+576.078 240 l
+</path>
+<path matrix="1 0 0 1 1.635 2.903" stroke="red" rarrow="normal/small">
+517.232 240.387 m
+576.078 240 l
+576.078 240 l
+</path>
+<path matrix="1 0 0 1 1.635 -5.097" stroke="red" rarrow="normal/small">
+517.232 240.387 m
+576.078 240 l
+576.078 240 l
+</path>
+<path matrix="1 0 0 1 1.635 -69.097" stroke="red" rarrow="normal/small">
+517.232 240.387 m
+576.078 240 l
+576.078 240 l
+</path>
+<text matrix="0 1 -1 0 164.559 -406.915" pos="596 32" stroke="black" type="label" width="48.876" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny $\mathrm{Alaw}()$</text>
+<text matrix="1 0 0 1 -592.594 184.743" pos="596 32" stroke="black" type="label" width="91.9344" height="8.3016" depth="0" valign="baseline" size="small">\tiny to IF5 {\tt if\_device}</text>
+<path matrix="0.179243 0 0 -1.07565 47.9624 469.155" stroke="black" rarrow="normal/tiny">
+56 240 m
+356.214 240.281 l
+</path>
+<path matrix="-8.02443 0 0 0.926402 6046.55 -49.554" stroke="black" arrow="normal/tiny">
+700 264 m
+735.133 264 l
+</path>
+<text matrix="1 0 0 1 -325.616 167.83" pos="596 32" stroke="black" type="label" width="144.3" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt RU-&gt;ru\_time.txdata[T-1]}</text>
+<text matrix="0.781914 0 0 0.829268 187.809 -330.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="10.6272" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt recv\_IF5()}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 192.04 -214.271" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="10.6272" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt send\_IF5()}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 445.373 -326.074" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt ru\_fep\_full()}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 212 -261" transformations="translations" pos="176 556" stroke="red" type="label" width="203.946" height="19.3704" depth="0" halign="center" valign="baseline">IF5 RU eNB end </text>
+<text matrix="0 1 -1 0 344.559 -523.915" pos="596 32" stroke="black" type="label" width="62.2848" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny $\mathrm{7.5kHz}()$</text>
+<text matrix="0.781914 0 0 0.829268 86.9372 -348.796" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="10.6272" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt ru\_thread()}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 90.7769 -227.271" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt ru\_thread\_asynch\_rxtx()}
+\end{tiny}
+</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="9.40249 0 0 8.45522 -3042.82 -3293.1" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="0.99836 0 0 3.12886 -15.8426 -122.662" stroke="black" fill="gold">
+96 136 m
+96 48 l
+540 48 l
+540 136 l
+h
+</path>
+<path matrix="1 0 0 1 153.231 103.185" fill="lightgray">
+88 192 m
+88 80 l
+248 80 l
+248 192 l
+h
+</path>
+<path matrix="0.975001 0 0 1.09355 6.19995 -41.9606" fill="lightgray">
+88 192 m
+88 80 l
+248 80 l
+248 192 l
+h
+</path>
+<path matrix="0.459459 0 0 1.28571 286.514 -28.285" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 -512 55" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="86.8968" depth="75.096" valign="top" size="small">\small\begin{itemize}
+\item IF4p5 transports packets of size equal to an OFDM symbol (for DLRE and ULRE) indexed by the symbol, subframe and frame number. This is done via the functions send\_if4p5 and recv\_if4p5, in the layer1 transport procedures ({\tt openair1/PHY/LTE\_TRANSPORT/if4\_tools.c}).
+\item each block are compressed with A-law compression, yielding a compression rate of .5.
+\end{itemize} </text>
+<text matrix="1 0 0 1 169 -9" transformations="translations" pos="176 556" stroke="black" type="label" width="343.781" height="20.9244" depth="6.972" halign="center" valign="baseline">RU Procedures (NGFI\_IF4p5)</text>
+<path matrix="2.25001 0 0 1 -122.88 -356" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 625.252 -325.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_2$ (211,212)
+\end{tiny}
+</text>
+<path matrix="2.25001 0 0 1 -122.502 -207" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 625.252 -176.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_2$ (211,212)
+\end{tiny}
+</text>
+<path matrix="0.876018 0 0 0.636058 448.853 7.7336" stroke="black">
+144 480 m
+144 32 l
+176 32 l
+176 480 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 64.928 -375.838" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_0$
+\end{tiny}
+</text>
+<path matrix="-0.360709 0 0 -1 736.691 308.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="0.360709 0 0 1 484.749 -54.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="2.25001 0 0 1 -122.88 -308" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 625.252 -277.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_1$ (211,212)
+\end{tiny}
+</text>
+<path matrix="0.360709 0 0 1 484.749 -6.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="2.25001 0 0 1 -122.88 -260" fill="lightgreen">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 625.252 -229.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY RX $n$\\
+$\mathrm{eNB}_0$ (211,212)
+\end{tiny}
+</text>
+<path matrix="0.360709 0 0 1 484.749 41.663" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="2.25001 0 0 1 -121.035 -158" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 626.719 -127.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_1$ (211,212)
+\end{tiny}
+</text>
+<path matrix="-0.360709 0 0 -1 738.158 357.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path matrix="2.25001 0 0 1 -121.035 -110" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 626.719 -79.956" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="19.1064" depth="7.128" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+PHY TX $n+4$\\
+$\mathrm{eNB}_0$ (211,212)
+\end{tiny}
+</text>
+<path matrix="-0.360709 0 0 -1 738.158 405.337" stroke="red" rarrow="normal/small">
+371.001 106.337 m
+323.502 106.337 l
+323.502 106.337 l
+</path>
+<path stroke="black" arrow="normal/small">
+175.991 137.396 m
+575 138.93 l
+</path>
+<path stroke="black" arrow="normal/small">
+175.991 112.982 m
+575 114.329 l
+</path>
+<path matrix="0.459459 0 0 1.28571 71.234 -138.285" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="0 1 -1 0 195.559 -507.915" pos="596 32" stroke="black" type="label" width="71.16" height="12.8064" depth="2.976" valign="baseline" size="small">\tiny $\mathrm{Alaw}^{-1}()$</text>
+<path stroke="black" arrow="normal/tiny">
+56 120 m
+141.531 120.07 l
+</path>
+<text matrix="1 0 0 1 -593.936 96.75" pos="596 32" stroke="black" type="label" width="118.562" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny from IF4p5 {\tt if\_device}</text>
+<path matrix="1 0 0 1 248 -79.02" stroke="black">
+680 104 m
+680 104 l
+680 104 l
+680 104 l
+h
+</path>
+<path matrix="0.632607 0 0 0.581545 152.85 94.761" stroke="black" fill="lightgreen">
+544 324 m
+544 144 l
+576 144 l
+576 324 l
+h
+</path>
+<text matrix="0.923166 0 0 0.436636 -11.1365 141.386" transformations="translations" pos="548 304" stroke="black" type="minipage" width="24" height="48.3768" depth="36.504" valign="top" size="small" style="center">\setstretch{.5}\tt\tiny P\\R\\E\\C\\O\\D\\I\\N\\G\\</text>
+<path matrix="-2.98839 0 0 1.00696 2588.86 -11.5723" stroke="black" arrow="normal/tiny">
+700 264 m
+735.133 264 l
+</path>
+<text matrix="0.781914 0 0 0.829268 335.809 -372.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="208.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt openair1/SCHED/ru-procedures.c}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 0 32" stroke="red" rarrow="normal/small">
+517.232 240.387 m
+576.078 240 l
+576.078 240 l
+</path>
+<path matrix="1 0 0 1 -0.365 23.903" stroke="red" rarrow="normal/small">
+517.232 240.387 m
+576.078 240 l
+576.078 240 l
+</path>
+<path matrix="1 0 0 1 -0.365 15.903" stroke="red" rarrow="normal/small">
+517.232 240.387 m
+576.078 240 l
+576.078 240 l
+</path>
+<path matrix="1 0 0 1 -0.365 -48.097" stroke="red" rarrow="normal/small">
+517.232 240.387 m
+576.078 240 l
+576.078 240 l
+</path>
+<text matrix="0 1 -1 0 409.559 -385.915" pos="596 32" stroke="black" type="label" width="48.876" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny $\mathrm{Alaw}()$</text>
+<text matrix="1 0 0 1 -594.594 205.743" pos="596 32" stroke="black" type="label" width="104.844" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny to IF4p5 {\tt if\_device}</text>
+<path matrix="1 0 0 1 0 -8" stroke="black" rarrow="normal/tiny">
+56 240 m
+356.214 240.281 l
+</path>
+<path matrix="-2.98839 0 0 1.00696 2589.82 -52.8376" stroke="black" arrow="normal/tiny">
+700 264 m
+735.133 264 l
+</path>
+<text matrix="0.786462 0 0 0.829268 173.831 -335.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt recv\_IF4p5()}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 326.04 -198.271" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt send\_IF4p5()}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 56 -237" transformations="translations" pos="176 556" stroke="red" type="label" width="232.308" height="19.3928" depth="5.404" halign="center" valign="baseline">IF4p5 RU eNB end </text>
+<path matrix="0.459459 0 0 0.399205 71.703 -11.0389" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<path stroke="black" arrow="normal/tiny">
+111.191 120.045 m
+112 70 l
+142 69.9344 l
+</path>
+<path stroke="black" cap="1">
+-36 68 m
+-36 68 l
+</path>
+<path matrix="1 0 0 1 -0.527 -43.483" stroke="black" arrow="normal/small">
+175.991 112.982 m
+575 114.329 l
+</path>
+<text matrix="1 0 0 1 -343.839 111.285" pos="596 32" stroke="black" type="label" width="169.706" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt eNB-&gt;common\_vars.rxdataF[0]}</text>
+<text matrix="1 0 0 1 -343.839 87.285" pos="596 32" stroke="black" type="label" width="182.407" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt eNB-&gt;common\_vars.rxdataF[R-1]}</text>
+<text matrix="1 0 0 1 -343.839 43.285" pos="596 32" stroke="black" type="label" width="207.648" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt eNB-&gt;prach\_vars.prachF[0$\cdots$ R-1]}</text>
+<text matrix="0.781914 0 0 0.829268 81.3732 -352.933" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="10.6272" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt ru\_thread()}
+\end{tiny}
+</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="12.8399 0 0 9.34249 -4172.16 -3617.58" fill="lightcyan">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<path matrix="1 0 0 1.01102 0 0.424041" stroke="black" fill="violet">
+232 384 m
+232 256 l
+543.99 256 l
+543.99 384 l
+h
+</path>
+<path matrix="1 0 0 1.04447 0 -2.13433" stroke="black" fill="gold">
+96 136 m
+96 48 l
+540 48 l
+540 136 l
+h
+</path>
+<path matrix="1.1248 0 0 1 74.4712 -158" fill="turquoise">
+132 294 m
+132 208 l
+384 208 l
+384 294 l
+h
+</path>
+<path fill="lightyellow">
+96 384 m
+96 148 l
+544 148 l
+544 256 l
+224 256 l
+224 384 l
+h
+</path>
+<path matrix="1 0 0 1.17279 1 166.419" fill="lightgray">
+444 164 m
+444 84.382 l
+522.222 84.382 l
+522.222 164 l
+h
+</path>
+<path matrix="1 0 0 1 143.432 -48.618" fill="turquoise">
+132 294 m
+132 208 l
+384 208 l
+384 294 l
+h
+</path>
+<path matrix="1 0 0 1 2 77" fill="lightgray">
+444 164 m
+444 84.382 l
+522.222 84.382 l
+522.222 164 l
+h
+</path>
+<path matrix="0.459459 0 0 1.28571 379.514 54.715" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 161 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="343.781" height="20.9244" depth="6.972" halign="center" valign="baseline">RU Procedures (NGFI\_IF4p5)</text>
+<text matrix="0.781914 0 0 0.829268 67.928 -354.838" transformations="translations" pos="0 474" stroke="black" type="minipage" width="102" height="11.8344" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+$\mathrm{RU}_0$
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 2 75" stroke="black" arrow="normal/tiny">
+144.991 145.396 m
+289.432 145.382 l
+</path>
+<path matrix="1 0 0 1 2 75" stroke="black" arrow="normal/tiny">
+144.991 120.982 m
+289.432 121.382 l
+</path>
+<text matrix="1 0 0 1 -447.936 192.75" pos="596 32" stroke="black" type="label" width="131.599" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt RU-&gt;ru\_time.rxdata[0]}</text>
+<text matrix="1 0 0 1 -446.936 168.75" pos="596 32" stroke="black" type="label" width="144.3" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt RU-&gt;ru\_time.rxdata[R-1]}</text>
+<path matrix="1 0 0 1 188.432 3.382" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 213.433 -232.618" transformations="translations" pos="128 440" stroke="black" type="minipage" width="76" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny slot\_fep\_ul\par36.211</text>
+<path matrix="0.459459 0 0 1.28571 223.135 -54.904" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<path matrix="1 0 0 1 143.432 -48.618" stroke="black" arrow="normal/tiny">
+184 268 m
+196 268 l
+</path>
+<path matrix="1 0 0 1 143.432 -48.618" stroke="black" arrow="normal/tiny">
+184 244 m
+196 244 l
+</path>
+<path matrix="0.248499 0 0 0.662073 349.697 42.5354" stroke="black" arrow="normal/small">
+273 269 m
+412 268 l
+</path>
+<path matrix="0.21663 0 0 1.02946 327.304 71.447" stroke="black" arrow="normal/small">
+415.263 120.984 m
+575 120.608 l
+</path>
+<path matrix="1 0 0 1 2 75" stroke="black" arrow="normal/tiny">
+56 128 m
+110.531 128.542 l
+</path>
+<text matrix="1 0 0 1 -591.936 179.75" pos="596 32" stroke="black" type="label" width="84.276" height="8.3016" depth="0" valign="baseline" size="small">\tiny from {\tt rf\_device}</text>
+<path matrix="1 0 0 1 240 -71.02" stroke="black">
+680 104 m
+680 104 l
+680 104 l
+680 104 l
+h
+</path>
+<path matrix="-1.00596 0 0 0.723429 1044.07 125.248" stroke="black" fill="white">
+632 360 m
+632 188 l
+660 188 l
+660 360 l
+h
+</path>
+<text matrix="1 0 0 1 -352.616 267.83" pos="596 32" stroke="black" type="label" width="131.599" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt RU-&gt;ru\_time.txdata[0]}</text>
+<path stroke="black" arrow="normal/tiny">
+380.13 336.98 m
+149.46 336.349 l
+</path>
+<path matrix="-1 0 0 1 1080.13 51.98" stroke="black" arrow="normal/tiny">
+632 264.556 m
+671.833 265 l
+</path>
+<text matrix="0 1 -1 0 663.677 -360.953" pos="636 280" stroke="black" type="minipage" width="84" height="16.6824" depth="4.704" valign="top" size="small" style="center">\setstretch{.5}\tt\tiny do\_ofdm\_mod\_rt()\par 36.211</text>
+<text matrix="0.781914 0 0 0.829268 510.809 -351.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="200.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt openair1/SCHED/ru-procedures.c}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -592.594 288.743" pos="596 32" stroke="black" type="label" width="70.5552" height="7.3056" depth="0" valign="baseline" size="small">\tiny to {\tt rf\_device}</text>
+<path matrix="1 0 0 1 0 75" stroke="black" rarrow="normal/tiny">
+58 240 m
+114.121 240.053 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+380.45 296 m
+149.46 295.058 l
+</path>
+<text matrix="1 0 0 1 -362.967 310.18" pos="596 32" stroke="black" type="label" width="144.3" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt RU-&gt;ru\_time.txdata[T-1]}</text>
+<text matrix="0.781914 0 0 0.829268 278.373 -223.074" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt ru\_fep\_full()}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -5 -65" transformations="translations" pos="176 556" stroke="red" type="label" width="262.063" height="19.3928" depth="5.404" halign="center" valign="baseline">IF4p5 RU remote-end </text>
+<path matrix="0.459459 0 0 1.28571 44.014 -55.285" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="0 1 -1 0 502.559 -313.915" pos="596 32" stroke="black" type="label" width="71.16" height="12.8064" depth="2.976" valign="baseline" size="small">\tiny $\mathrm{Alaw}^{-1}()$</text>
+<path matrix="0.45771 0 0 1.1354 381.353 -25.8312" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="0 1 -1 0 504.559 -414.915" pos="596 32" stroke="black" type="label" width="48.876" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny $\mathrm{Alaw}()$</text>
+<text matrix="0 1 -1 0 345.559 -418.915" pos="596 32" stroke="black" type="label" width="62.2848" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny $\mathrm{7.5kHz}()$</text>
+<path matrix="0.459459 0 0 1.28571 44.703 54.165" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 449.809 -118.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt recv\_IF4p5()}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 450.012 -220.947" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt send\_IF4p5()}
+\end{tiny}
+</text>
+<path matrix="1 0 0 1 0 75" stroke="black" arrow="normal/tiny">
+485.71 128.939 m
+581.963 129.331 l
+</path>
+<text matrix="1 0 0 1 -46.936 178.75" pos="596 32" stroke="black" type="label" width="70.5552" height="7.3056" depth="0" valign="baseline" size="small">\tiny to {\tt if\_device}</text>
+<text matrix="1 0 0 1 -46.372 286.887" pos="596 32" stroke="black" type="label" width="84.276" height="8.3016" depth="0" valign="baseline" size="small">\tiny from {\tt if\_device}</text>
+<path matrix="1 0 0 1 465.222 73.1439" stroke="black" rarrow="normal/tiny">
+58 240 m
+114.121 240.053 l
+</path>
+<path matrix="1 0 0 1 105.674 -234" stroke="black" fill="1">
+131 344 m
+131 316 l
+276 316 l
+276 344 l
+h
+</path>
+<text matrix="1 0 0 1 123.675 -345" transformations="translations" pos="128 440" stroke="black" type="minipage" width="126.578" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ru\_prach\_procedures\par36.211</text>
+<path matrix="1 0 0 1 -58.326 -234" stroke="black" arrow="normal/tiny">
+440.514 328 m
+477 327.572 l
+</path>
+<text matrix="0.762991 0 0 1 1.41573 -218" transformations="translations" pos="300 280" stroke="black" type="minipage" width="268" height="11.4576" depth="0" valign="top" size="small">\tt\tiny ru\_prach\_procedures()</text>
+<path matrix="1 0 0 1 267.865 -110" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 292.866 -346" transformations="translations" pos="128 440" stroke="black" type="minipage" width="76" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny rx\_prachl\par36.211</text>
+<path stroke="black" arrow="normal/tiny">
+199.412 220.391 m
+200 104 l
+236.674 103.978 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+178.262 196.069 m
+179.06 92 l
+236.674 91.6468 l
+</path>
+<path stroke="black" fill="gold">
+65.0054 121.159 m
+65.0054 121.159 l
+65.0054 121.159 l
+65.0054 121.159 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 98.1012 -330.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt ru\_thread\_prach()}
+\end{tiny}
+</text>
+<text matrix="0.781914 0 0 0.829268 99.672 -232.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="10.6272" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt ru\_thread()}
+\end{tiny}
+</text>
+<path stroke="black" fill="violet">
+65.0054 357.66 m
+65.0054 357.66 l
+65.0054 357.66 l
+65.0054 357.66 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 234.605 -119.456" transformations="translations" pos="0 474" stroke="black" type="minipage" width="168.119" height="11.4576" depth="0" valign="top" size="small">\setstretch{.5}\begin{tiny}
+{\tt ru\_thread\_asynch\_rxtx()}
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -39.936 67.75" pos="596 32" stroke="black" type="label" width="70.5552" height="7.3056" depth="0" valign="baseline" size="small">\tiny to {\tt if\_device}</text>
+<path matrix="1 0 0 1 9.642 -35.284" stroke="black" arrow="normal/tiny">
+485.71 128.939 m
+581.963 129.331 l
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 9.83755 0" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="1 0 0 1 161 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="231.997" height="19.3928" depth="5.404" halign="center" valign="baseline">OAI IF1pp Interface</text>
+<text matrix="1 0 0 1 -512 55" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="30.296" depth="16.352" valign="top">\tiny\begin{itemize}
+\item OAI IF1pp is the interface between the 36.213 Physical Layer Procedures (HARQ, SR, CSI, etc.) and the transport/physical channel processing
+\item it can be networked, although this is not used as an xhaul interface at the moment. 
+\end{itemize} </text>
+<path matrix="1 0 0 1 32 60" stroke="black" fill="lightgray">
+96 384 m
+96 320 l
+640 320 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 32 60" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<path matrix="1 0 0 1 288 60" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<text matrix="1 0 0 1 -399.345 376.743" pos="596 32" stroke="black" type="label" width="151.668" height="7.3224" depth="2.64" valign="baseline" size="small">\tiny {\tt phy\_procedures\_lte\_eNB\_TX}</text>
+<text matrix="1 0 0 1 -140.021 376.743" pos="596 32" stroke="black" type="label" width="151.668" height="7.3224" depth="2.64" valign="baseline" size="small">\tiny {\tt phy\_procedures\_lte\_eNB\_RX}</text>
+<path matrix="1 0 0 1 33 -256" stroke="black" fill="lightgray">
+96 384 m
+96 320 l
+640 320 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 1 -414.345 60.743" pos="596 32" stroke="black" type="label" width="439.776" height="14.952" depth="4.176" valign="baseline" size="small">\small PHY transport and physical channel procedures</text>
+<text matrix="0 1 -1 0 208.848 -455.114" pos="596 32" stroke="black" type="label" width="161.575" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt common\_signal\_procedures()}</text>
+<text matrix="0 1 -1 0 232.621 -455.114" pos="596 32" stroke="black" type="label" width="106.193" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt pmch\_procedures()}</text>
+<text matrix="0 1 -1 0 256.394 -455.114" pos="596 32" stroke="black" type="label" width="221.532" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt generate\_dlsch\_parameters\_from\_dci()}</text>
+<text matrix="0 1 -1 0 280.167 -455.114" pos="596 32" stroke="black" type="label" width="221.532" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt generate\_ulsch\_parameters\_from\_dci()}</text>
+<text matrix="0 1 -1 0 303.94 -455.114" pos="596 32" stroke="black" type="label" width="172.5" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt phy\_config\_dedicated\_step2()}</text>
+<text matrix="0 1 -1 0 327.713 -455.114" pos="596 32" stroke="black" type="label" width="110.765" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt generate\_dci\_top()}</text>
+<text matrix="0 1 -1 0 351.486 -455.114" pos="596 32" stroke="black" type="label" width="123.468" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt generate\_phich\_top()}</text>
+<text matrix="0 1 -1 0 375.259 -455.114" pos="596 32" stroke="black" type="label" width="112.543" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt pdsch\_procedures()}</text>
+<path matrix="1 0 0 1 33.6108 -0.419" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 1 57.3839 -0.419" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 1 81.1569 -0.419" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 1 104.93 -0.419" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 1 128.703 -0.419" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 1 152.476 -0.419" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 1 176.249 -0.419" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 1 265.346 -0.419" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 464.848 -455.114" pos="596 32" stroke="black" type="label" width="112.543" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt pucch\_procedures()}</text>
+<text matrix="0 1 -1 0 487.637 -455.114" pos="596 32" stroke="black" type="label" width="87.1392" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt process\_Msg3()}</text>
+<path matrix="1 0 0 1 288.134 0.491" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 511.251 -455.114" pos="596 32" stroke="black" type="label" width="61.7352" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt rx\_ulsch()}</text>
+<path matrix="1 0 0 1 310.923 0.509" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 533.214 -455.114" pos="596 32" stroke="black" type="label" width="99.8424" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt ulsch\_decoding()}</text>
+<path matrix="1 0 0 1 333.711 0.608" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 556.002 -455.114" pos="596 32" stroke="black" type="label" width="80.7888" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt extract\_cqi()}</text>
+<path matrix="1 0 0 1 356.5 0.411" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 578.791 -455.114" pos="596 32" stroke="black" type="label" width="121.69" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt get\_Msg3\_alloc\_ret()}</text>
+<path matrix="1 0 0 1 379.288 0.924" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 601.579 -455.114" pos="596 32" stroke="black" type="label" width="183.425" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt lte\_est\_timing\_advance\_pusch()}</text>
+<path matrix="1 0 0 1 402.077 1.339" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 625.193 -455.114" pos="596 32" stroke="black" type="label" width="153.446" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt lte\_eNB\_I0\_measurements()}</text>
+<path matrix="1 0 0 1 424.865 1.187" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 647.156 -455.114" pos="596 32" stroke="black" type="label" width="117.118" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt process\_HARQ\_info()}</text>
+<path matrix="1 0 0 1 447.654 1.187" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="1 0 0 1 16 -48" transformations="translations" pos="0 448" stroke="black" type="minipage" width="128" height="28.0824" depth="16.152" valign="top" size="small">\small {\tt 36.213}\par
+{\tt openair1/SCHED}</text>
+<text matrix="1 0 0 1 1 -368" transformations="translations" pos="0 448" stroke="black" type="minipage" width="128" height="28.9872" depth="17.04" valign="top" size="small">\small {\tt 36.211/212}\par
+{\tt openair1/PHY}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 0 -1" fill="lightgray">
+120 528 m
+120 0 l
+592 0 l
+592 528 l
+h
+</path>
+<path fill="turquoise">
+180 524 m
+180 476 l
+588 476 l
+588 524 l
+h
+</path>
+<path matrix="1 0 0 1 0 5" stroke="black" fill="white">
+248 520 m
+248 483.903 l
+400 484 l
+400 520 l
+h
+</path>
+<path matrix="1 0 0 1 0 -19" fill="lightcyan">
+180 493.216 m
+180 452 l
+536 452 l
+536 493.216 l
+h
+</path>
+<path matrix="1 0 0 1 0 -19" stroke="black">
+404 480 m
+404 472 l
+404 472 l
+404 480 l
+h
+</path>
+<path matrix="1 0 0 1 0 -19" fill="white">
+340 488 m
+340 464 l
+444 464 l
+444 488 l
+h
+</path>
+<path matrix="1 0 0 1 20.9996 13.2948" stroke="black" fill="1">
+312 456 m
+312 432 l
+424 432 l
+424.001 456 l
+h
+</path>
+<path matrix="1 0 0 1 1 -19" fill="lightgreen">
+144 448 m
+144 360 l
+536 360 l
+536 448 l
+h
+</path>
+<path matrix="1 0 0 1 1 -15" fill="lightblue">
+144 260 m
+144 116 l
+536 116 l
+536 260 l
+h
+</path>
+<path matrix="1 0 0 1 1 -16" fill="lightblue">
+144 344 m
+144 264 l
+536 264 l
+536 344 l
+h
+</path>
+<path matrix="1.16667 0 0 1 7.66667 -19" stroke="black" fill="white">
+128 440 m
+128 384 l
+224 384 l
+224 440 l
+h
+</path>
+<text matrix="1 0 0 1 30 -41.7052" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="14.484" depth="2.52" valign="center" size="small">\tt\tiny generate\_dci\_top()</text>
+<text matrix="1 0 0 1 -15 -15" transformations="translations" pos="240 144" stroke="black" type="minipage" width="8" height="5.9784" depth="0" valign="top" size="small"></text>
+<path fill="gold" tiling="rising">
+0 424 m
+0 32 l
+48 32 l
+48 424 l
+h
+</path>
+<text matrix="1 0 0 1 -17 -127" transformations="translations" pos="32 416" stroke="black" type="minipage" width="32" height="50.1172" depth="36.204" valign="top" style="center">M\\
+A\\
+C</text>
+<path matrix="1 0 0 1 -16 -21" stroke="black" arrow="normal/small">
+64 416 m
+172 416 l
+</path>
+<text matrix="1 0 0 1 -16 -21" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="15.3664" depth="1.372" valign="top">\tt\tiny DCI\_PDU</text>
+<path matrix="1.16667 0 0 1 7.6667 -120" stroke="black" fill="1">
+128 440 m
+128 384 l
+224 384 l
+224 440 l
+h
+</path>
+<text matrix="1 0 0 1 37.0006 -148" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_coding()\par36.212</text>
+<path matrix="1 0 0 1 -16 -123" stroke="black" arrow="normal/small">
+64 416 m
+172 416 l
+</path>
+<text matrix="1 0 0 1 -16 -123" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="15.3664" depth="1.372" valign="top">\tt\tiny DLSCH\_PDU\_0</text>
+<path matrix="1.16667 0 0 1 7.6667 -199" stroke="black" fill="1">
+128 440 m
+128 384 l
+224 384 l
+224 440 l
+h
+</path>
+<path matrix="1 0 0 1 -16 -203" stroke="black" arrow="normal/small">
+64 416 m
+172 416 l
+</path>
+<text matrix="1 0 0 1 -16 -203" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="15.3664" depth="1.372" valign="top">\tt\tiny DLSCH\_PDU\_1\_0</text>
+<path matrix="1.16667 0 0 1 7.6667 -263" stroke="black" fill="1">
+128 440 m
+128 384 l
+224 384 l
+224 440 l
+h
+</path>
+<path matrix="1 0 0 1 -16 -266" stroke="black" arrow="normal/small">
+64 416 m
+172 416 l
+</path>
+<text matrix="1 0 0 1 -16 -266" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="15.3664" depth="1.372" valign="top">\tt\tiny DLSCH\_PDU\_1\_1</text>
+<path matrix="1 0 0 1 -18.0004 -34.7052" stroke="black" fill="1">
+312 456 m
+312 432 l
+424 432 l
+424.001 456 l
+h
+</path>
+<text matrix="1 0 0 1 166 -30.7052" transformations="translations" pos="128 440" stroke="black" type="minipage" width="112" height="17.1312" depth="5.184" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny generate\_pcfich()\par36.212,36.211</text>
+<path matrix="1 0 0 1 -9 -19" stroke="black" fill="1">
+304 408 m
+304 384 l
+400 384 l
+400 408 l
+h
+</path>
+<text matrix="1 0 0 1 167 -63.2264" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny generate\_dci0()\par36.212</text>
+<path matrix="1 0 0 1 1 2.77362" stroke="black" fill="1">
+408 400 m
+408 352 l
+520 352 l
+520 400 l
+h
+</path>
+<text matrix="1 0 0 1 281 -61.2264" transformations="translations" pos="128 440" stroke="black" type="minipage" width="112" height="29.8512" depth="17.904" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny pdcch\_scrambling()\par pdcch\_modulation\par pdcch\_interleaving\par36.211</text>
+<text matrix="1 0 0 1 37.0006 -227" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_coding()\par36.212</text>
+<text matrix="1 0 0 1 37.0006 -291" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_coding()\par36.212</text>
+<path matrix="1 0 0 1 1 -19" stroke="black" fill="white" arrow="normal/tiny">
+268 426.729 m
+293 426.729 l
+</path>
+<path matrix="1 0 0 1 1 -21.3964" stroke="black" fill="white" arrow="normal/tiny">
+268 399.17 m
+293 399.17 l
+</path>
+<path matrix="1 0 0 1 -14 -18.5991" stroke="black" fill="white" arrow="normal/tiny">
+405 397.373 m
+421 397.373 l
+</path>
+<path matrix="1 0 0 1 1 -17" stroke="black" fill="1">
+294 320 m
+294 296 l
+392 296 l
+392 320 l
+h
+</path>
+<text matrix="1.16993 0 0 1 145.249 -149.226" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="17.5032" depth="5.544" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_encoding()\par36.212</text>
+<path matrix="1 0 0 1 1 -107.396" stroke="black" arrow="normal/tiny">
+268 399.17 m
+293 399.17 l
+</path>
+<path matrix="1 0 0 1 1 -14" stroke="black" fill="1">
+408 322.774 m
+408 288 l
+520 288 l
+520 322.774 l
+h
+</path>
+<text matrix="1 0 0 1 281 -147.226" transformations="translations" pos="128 440" stroke="black" type="minipage" width="112" height="23.3352" depth="11.4" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_scrambling()\par dlsch\_modulation()\par36.211</text>
+<path matrix="1 0 0 1 -12 -105.599" stroke="black" arrow="normal/tiny">
+405 397.373 m
+421 397.373 l
+</path>
+<path matrix="1 0 0 1 1 -95" stroke="black" fill="1">
+294 320 m
+294 296 l
+392 296 l
+392 320 l
+h
+</path>
+<text matrix="1.16993 0 0 1 145.249 -227.226" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="17.5032" depth="5.544" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_encoding()\par36.212</text>
+<path matrix="1 0 0 1 1 -14.726" stroke="black" fill="1">
+408 251 m
+408 144 l
+520 144 l
+520 251 l
+h
+</path>
+<text matrix="1 0 0 1 281 -257.226" transformations="translations" pos="128 440" stroke="black" type="minipage" width="112" height="30.0144" depth="18.072" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_scrambling()\par dlsch\_modulation()\par[2-4 layers]\par 36.211</text>
+<path matrix="1 0 0 1 -12 -183.599" stroke="black" arrow="normal/tiny">
+405 397.373 m
+421 397.373 l
+</path>
+<path matrix="1 0 0 1 1 -159" stroke="black" fill="1">
+294 320 m
+294 296 l
+392 296 l
+392 320 l
+h
+</path>
+<text matrix="1.16993 0 0 1 145.249 -291.226" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="17.5032" depth="5.544" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_encoding()\par36.212</text>
+<path matrix="1 0 0 1 -12 -247.599" stroke="black" arrow="normal/tiny">
+405 397.373 m
+421 397.373 l
+</path>
+<path matrix="1 0 0 1 1 -187.396" stroke="black" arrow="normal/tiny">
+268 399.17 m
+293 399.17 l
+</path>
+<path matrix="1 0 0 1 1 -251.396" stroke="black" arrow="normal/tiny">
+268 399.17 m
+293 399.17 l
+</path>
+<path matrix="1 0 0 1 1 -19" stroke="black" cap="1">
+552 428 m
+552 428 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+405 409 m
+600 408.924 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+520 381 m
+600 380.885 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+521 292.923 m
+600 293.648 l
+</path>
+<text matrix="1 0 0 1 -124 -14" transformations="translations" pos="300 280" stroke="black" type="minipage" width="360.737" height="14.484" depth="2.52" valign="top" size="small">\tt\tiny openair1/SCHED/phy\_procedures\_lte\_eNb.c:pdsch\_procedures()</text>
+<text matrix="1 0 0 1 -124 -162" transformations="translations" pos="300 280" stroke="black" type="minipage" width="359.972" height="14.484" depth="2.52" valign="top" size="small">\tt\tiny openair1/SCHED/phy\_procedures\_lte\_eNb.c:pdsch\_procedures()</text>
+<text matrix="1 0 0 1 1 -19" transformations="translations" pos="168 372" stroke="black" type="minipage" width="364" height="11.4576" depth="0" valign="top" size="small">\tt\tiny openair1/PHY/LTE\_TRANSPORT/dci.c</text>
+<path matrix="1 0 0 1 0 -9" stroke="black">
+360 104 m
+360 104 l
+360 104 l
+360 104 l
+h
+</path>
+<path matrix="1 0 0 1 1 -249" fill="pink">
+144 344 m
+144 264 l
+536 264 l
+536 344 l
+h
+</path>
+<path matrix="1.16667 0 0 1 7.6667 -354" stroke="black" fill="1">
+128 440 m
+128 384 l
+224 384 l
+224 440 l
+h
+</path>
+<text matrix="1 0 0 1 37.0006 -382" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_coding()\par36.212</text>
+<text matrix="1 0 0 1 -16 -353" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="15.3664" depth="1.372" valign="top">\tt\tiny MCH\_PDU</text>
+<path matrix="1 0 0 1 1 -251" stroke="black" fill="1">
+294 320 m
+294 296 l
+392 296 l
+392 320 l
+h
+</path>
+<text matrix="1.16993 0 0 1 145.249 -383.226" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="17.5032" depth="5.544" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_encoding()\par36.212</text>
+<path matrix="1 0 0 1 1 -341.396" stroke="black" arrow="normal/tiny">
+268 399.17 m
+293 399.17 l
+</path>
+<path matrix="1 0 0 1 1 -248" stroke="black" fill="1">
+408 322.774 m
+408 288 l
+520 288 l
+520 322.774 l
+h
+</path>
+<text matrix="1 0 0 1 281 -381.226" transformations="translations" pos="128 440" stroke="black" type="minipage" width="112" height="23.3352" depth="11.4" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny dlsch\_scrambling()\par mch\_modulation()\par36.211</text>
+<path matrix="1 0 0 1 -12 -339.599" stroke="black" arrow="normal/tiny">
+405 397.373 m
+421 397.373 l
+</path>
+<text matrix="1 0 0 1 -124 -251" transformations="translations" pos="300 280" stroke="black" type="minipage" width="360.737" height="11.4576" depth="0" valign="top" size="small">\tt\tiny openair1/SCHED/phy\_procedures\_lte\_eNb.c:pmch\_procedures()</text>
+<path matrix="1 0 0 1 -16 -358" stroke="black" arrow="normal/small">
+64 416 m
+172 416 l
+</path>
+<path matrix="1 0 0 1 0 -10" stroke="black" fill="white">
+128 488 m
+128 452 l
+172 452 l
+172 488 l
+h
+</path>
+<path matrix="1 0 0 1 0 -10" stroke="black">
+140 472 m
+140 472 l
+140 472 l
+140 472 l
+h
+</path>
+<text matrix="1 0 0 1 0 -3" transformations="translations" pos="128 476" stroke="black" type="minipage" width="44" height="19.332" depth="7.368" valign="top" size="small" style="center">\setstretch{.5}\tt\tiny UL CNTL\\36.213</text>
+<path matrix="1 0 0 1 0 -10" stroke="black" fill="white">
+188 476 m
+188 460 l
+316 460 l
+316 476 l
+h
+</path>
+<text matrix="1 0 0 1 63 18.2948" transformations="translations" pos="128 440" stroke="black" type="minipage" width="128" height="11.4576" depth="0" valign="center" size="small">\tt\tiny generate\_phich\_top()</text>
+<path matrix="1 0 0 1 0 -10" stroke="black" arrow="normal/tiny">
+172 468 m
+188 468 l
+</path>
+<text matrix="1 0 0 1 206 17.2948" transformations="translations" pos="128 440" stroke="black" type="minipage" width="112" height="17.1312" depth="5.184" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny generate\_phich()\par36.212,36.211</text>
+<path matrix="1 0 0 1 -88 60.401" stroke="black" arrow="normal/tiny">
+405 397.373 m
+421 397.373 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+445 457 m
+600 456.672 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+520.262 58 m
+600 58.7558 l
+</path>
+<text matrix="1 0 0 1 40 70" transformations="translations" pos="168 372" stroke="black" type="minipage" width="364" height="11.4576" depth="0" valign="top" size="small">\tt\tiny openair1/PHY/LTE\_TRANSPORT/phich.c</text>
+<text matrix="1 0 0 1 51 -27" transformations="translations" pos="468 488" stroke="black" type="label" width="62.6328" height="8.3016" depth="0" valign="baseline" size="small">\tiny PHICH REs</text>
+<text matrix="1 0 0 1 51 -75" transformations="translations" pos="468 488" stroke="black" type="label" width="69.0456" height="8.3016" depth="0" valign="baseline" size="small">\tiny PCFICH REs</text>
+<text matrix="1 0 0 1 55 -105" transformations="translations" pos="468 488" stroke="black" type="label" width="67.428" height="8.3016" depth="0" valign="baseline" size="small">\tiny PDCCH REs</text>
+<text matrix="1 0 0 1 38 -160" transformations="translations" pos="468 488" stroke="black" type="label" width="66.3696" height="8.3016" depth="0" valign="baseline" size="small">\tiny PDSCH REs</text>
+<path matrix="0.0772642 0 0 0.976417 547.24 -8.88888" stroke="black">
+104.077 0 0 104.077 528 236 e
+</path>
+<text matrix="1 0 0 1 55 -426" transformations="translations" pos="468 488" stroke="black" type="label" width="61.2216" height="8.3016" depth="0" valign="baseline" size="small">\tiny PMCH REs</text>
+<text matrix="1 0 0 1 126.793 67.9996" transformations="translations" pos="128 440" stroke="black" type="minipage" width="112" height="24.18" depth="12.216" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny generate\_pilots\_slot()\par generate\_pss/sss/pbch()\par36.211</text>
+<path stroke="black">
+248 488.695 m
+248 488.695 l
+248 488.695 l
+248 488.695 l
+h
+</path>
+<text matrix="1 0 0 1 -120 208" transformations="translations" pos="300 280" stroke="black" type="minipage" width="428" height="11.4576" depth="0" valign="top" size="small">\tt\tiny openair1/SCHED/phy\_procedures\_lte\_eNb.c:common\_signal\_procedures()</text>
+<path stroke="black" arrow="normal/tiny">
+401 507 m
+600.424 507.963 l
+</path>
+<text matrix="1 0 0 1 -41 21" transformations="translations" pos="468 488" stroke="black" type="label" width="155.743" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny CS-RS/PSS/SSS/PBCH REs</text>
+<path matrix="1 0 0 1 -8 -7" stroke="black" arrow="normal/tiny">
+576 332 m
+592 324 l
+</path>
+<text matrix="1 0 0 1 -97 -262" transformations="translations" pos="300 280" stroke="black" type="minipage" width="387.452" height="14.484" depth="2.52" valign="top" size="small">\tt\tiny openair1/SCHED/phy\_procedures\_lte\_eNb.c:phy\_procedures\_eNB\_TX()</text>
+<text matrix="1 0 0 1 191 4" transformations="translations" pos="176 556" stroke="black" type="label" width="235.25" height="19.3704" depth="0" halign="center" valign="baseline">eNB TX Procedures</text>
+<text matrix="1 0 0 1 -484 12" transformations="translations" pos="608 516" stroke="black" type="minipage" width="96" height="18.468" depth="6.504" valign="top" size="small">\tiny eNodeB\_3GPP or NGFI\_RCC\_IF4p5</text>
+<path matrix="1 0 0 1 -101 288" fill="red">
+232 276 m
+232 240 l
+240 240 l
+240 276 l
+h
+</path>
+<text matrix="1.34783 0 0 1 -218.435 173" transformations="translations" pos="168 372" stroke="black" type="minipage" width="124" height="10.9584" depth="0" valign="top" size="small">\tt\tiny IF2 split points</text>
+<path matrix="1 0 0 10.3333 -185 -2439" fill="red">
+232 276 m
+232 240 l
+240 240 l
+240 276 l
+h
+</path>
+<path matrix="1 0 0 1 -0.061 -69.254" stroke="black" arrow="normal/tiny">
+521 292.923 m
+600 293.648 l
+</path>
+<path matrix="1 0 0 1 -0.061 -149.254" stroke="black" arrow="normal/tiny">
+521 292.923 m
+600 293.648 l
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 4 0" stroke="black" arrow="normal/small">
+539.766 93 m
+539.306 79.0026 l
+340 79.7439 l
+</path>
+<path matrix="1 0 0 1 4 0" fill="lightblue">
+447.064 116 m
+447.064 92 l
+632 92 l
+632 116 l
+h
+</path>
+<path matrix="1.21414 0.582107 -1.21414 0.582107 363.61 -219.929" fill="lightgray">
+304 384 m
+304 320 l
+368 320 l
+368 384 l
+h
+</path>
+<path matrix="1 0 0 1 4 -3" fill="lightblue">
+225.588 267.631 m
+225.588 257.004 l
+451.999 257.004 l
+451.999 267.631 l
+h
+</path>
+<path matrix="1 0 0 1 -5.33315 0" fill="lightblue">
+286.577 417.212 m
+286.577 407.581 l
+412.989 407.581 l
+412.989 417.212 l
+h
+</path>
+<path matrix="1 0 0 1 4 0" stroke="black">
+-66.4757 363.53 m
+-66.4757 358.467 l
+-65.4632 358.467 l
+-65.4632 363.53 l
+h
+</path>
+<path matrix="8.74693 0 0 0.672878 -2760.71 189.213" fill="lightblue">
+330 430 m
+330 390 l
+380 390 l
+380 430 l
+h
+</path>
+<text matrix="0.781914 0 0 0.829268 129.776 77.4777" transformations="translations" pos="0 474" stroke="black" type="minipage" width="429.348" height="11.4576" depth="0" halign="center" valign="top" size="small" style="center">\begin{tiny}
+\tt {\bf phy\_procedures\_eNB\_TX}(sched\_subframe,eNB,abstraction\_flag,r\_type,rn)
+\end{tiny}
+</text>
+<text matrix="1 0 0 1 -143 3" transformations="translations" pos="362.664 511.871" stroke="red" type="label" width="207.355" height="8.3232" depth="2.304" valign="baseline" size="small">\begin{tiny} eNB instance and component carriers \end{tiny}</text>
+<text matrix="1 0 0 1 -351.27 2.39657" transformations="translations" pos="362.664 511.871" stroke="red" type="label" width="191.82" height="8.3016" depth="0" valign="baseline" size="small">\begin{tiny} subframe where TX was scheduled \end{tiny}</text>
+<path matrix="1 0 0 1 4 0" stroke="red" arrow="normal/small">
+293.168 472.33 m
+189.522 511.272 l
+</path>
+<path matrix="1 0 0 1 4 0" stroke="red" arrow="normal/small">
+372.849 474.127 m
+310.542 512.47 l
+</path>
+<text matrix="1.00926 0 0 0.961538 41.9142 43.5872" transformations="translations" pos="385.43 499.889" stroke="red" type="minipage" width="222.269" height="19.1256" depth="7.176" valign="top" size="small">\setstretch{.5}\begin{tiny} Flag to indicate 212/213 Split\\(transport channels, no 211 procedures) \end{tiny}</text>
+<path matrix="1 0 0 1 4 0" stroke="red" arrow="normal/small">
+432.16 473.528 m
+526.22 499.29 l
+</path>
+<path matrix="1.28305 0 0 0.427959 -151.6 291.984" stroke="red">
+27.6629 0 0 27.6629 531.612 404.032 e
+</path>
+<path matrix="1 0 0 1 4 0" stroke="red" arrow="normal/small">
+526.819 478.92 m
+598.712 484.312 l
+</path>
+<text matrix="1 0 0 1 -6.1848 4.19374" transformations="translations" pos="606.5 493.299" stroke="red" type="minipage" width="138.992" height="11.9544" depth="0" valign="top" size="small">\begin{tiny} Experimental (for relays)\end{tiny}</text>
+<text matrix="1 0 0 1 -5.33315 0" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="126.411" height="9.6312" depth="0" halign="center" valign="top" size="small">\begin{tiny}
+\bf\tt Check for dead UEs
+\end{tiny}</text>
+<path matrix="1.21414 0.582107 -1.21414 0.582107 363.876 -64.4895" fill="lightgray">
+304 384 m
+304 320 l
+368 320 l
+368 384 l
+h
+</path>
+<path matrix="1 0 0 1 4 0" stroke="black" arrow="normal/small">
+340.45 451.636 m
+340.45 417.212 l
+</path>
+<text matrix="1 0 0 1 -16 -23" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="11.2364" depth="0" halign="center" valign="top" style="center">\begin{tiny}\tt eNB$\rightarrow$CC\_id==0?\end{tiny}</text>
+<text matrix="1 0 0 1 -56.9892 -152.581" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="10.6272" depth="0" halign="center" valign="top" size="small">\begin{tiny}
+\bf\tt Call eNB\_dlsch\_ulsch\_scheduler [MAC]
+\end{tiny}</text>
+<path matrix="1 0 0 1 3.55 -44.424" stroke="black" arrow="normal/small">
+340.45 451.636 m
+340.45 417.212 l
+</path>
+<path matrix="1 0 0 1 3.55 -152.424" stroke="black" arrow="normal/small">
+340.45 451.636 m
+340.45 417.212 l
+</path>
+<path matrix="1 0 0 1 3.55 -197.424" stroke="black" arrow="normal/small">
+340.45 451.636 m
+340.45 417.212 l
+</path>
+<path matrix="1 0 0 1 4 0" stroke="black" arrow="normal/small">
+418.155 336 m
+528 336 l
+528 248 l
+340 247.665 l
+</path>
+<text matrix="1 0 0 1 4 0" transformations="translations" pos="420 344" stroke="black" type="label" width="12.9096" height="5.3136" depth="0" valign="baseline" size="small">\tiny no</text>
+<path matrix="0.573318 0 0 1.1292 147.381 -192.209" fill="lightblue">
+225.588 267.631 m
+225.588 257.004 l
+451.999 257.004 l
+451.999 267.631 l
+h
+</path>
+<text matrix="1 0 0 1 -22 -177.724" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="129.761" height="9.6312" depth="0" halign="center" valign="top" size="small" style="center">\begin{tiny}\tt is PMCH subframe?\end{tiny}</text>
+<text matrix="1 0 0 1 -56.9892 -308.305" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="10.9584" depth="0" halign="center" valign="top" size="small" style="center">\begin{tiny}
+\bf\tt Call pmch\_procedures
+\end{tiny}</text>
+<path matrix="1 0 0 1 3.55 -308.424" stroke="black" arrow="normal/small">
+340.45 451.636 m
+340.45 417.212 l
+</path>
+<path matrix="1 0 0 1 4 1" stroke="black" arrow="normal/small">
+340 97.4877 m
+340 52 l
+</path>
+<text matrix="1 0 0 1 4 -155.724" transformations="translations" pos="420 344" stroke="black" type="label" width="12.9096" height="5.3136" depth="0" valign="baseline" size="small">\tiny no</text>
+<text matrix="1 0 0 1 164.487 -301.212" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="17.2968" depth="5.352" valign="top" size="small">\setstretch{.5}
+\begin{tiny}
+\bf\tt Call common\_signal\_procedures\\
+(CS-RS/PSS/SSS/PBCH)
+\end{tiny}</text>
+<path matrix="1 0 0 1 4 0" stroke="black" arrow="normal/small">
+417.889 180.561 m
+540 180 l
+539.532 116 l
+</path>
+<path matrix="1 0 0 1 -24.1093 40" fill="lightgreen">
+352 0 m
+352 12 l
+384 12 l
+384 12 l
+384 0 l
+368 -12 l
+368 -12 l
+h
+</path>
+<text matrix="1 0 0 1 199 0" transformations="translations" pos="176 556" stroke="black" type="label" width="219.988" height="19.3704" depth="0" halign="center" valign="baseline">eNB TX Flowchart</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="0.611694 0 0 2.48525 137.723 -162.718" fill="lightblue">
+225.588 267.631 m
+225.588 257.004 l
+451.999 257.004 l
+451.999 267.631 l
+h
+</path>
+<text matrix="1 0 0 1 -54.8216 84.695" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="17.2968" depth="5.352" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call get\_dci\_sdu [MAC]\\ dci=first\_dci
+\end{tiny}</text>
+<path matrix="1 0 0 1 -23.3752 0" stroke="black" rarrow="normal/small">
+368.672 502.411 m
+368 524 l
+</path>
+<path matrix="1.21414 0.582107 -1.21414 0.582107 364.387 16.9945" fill="lightgray">
+304 384 m
+304 320 l
+368 320 l
+368 384 l
+h
+</path>
+<text matrix="1 0 0 1 -14.4181 67.484" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="19.6056" depth="5.656" halign="center" valign="top" style="center">\setstretch{.5}\begin{tiny}\tt dci not empty and DL dci?\end{tiny}</text>
+<path matrix="1 0 0 1 -23.3751 -48.205" stroke="black" rarrow="normal/small">
+368.672 502.411 m
+368 524 l
+</path>
+<path matrix="1 0 0 1 -23 0" stroke="black" rarrow="normal/small">
+368.297 357.206 m
+368 380 l
+</path>
+<path matrix="1 0 0 1 -23 0" fill="lightblue">
+260 356 m
+260 328 l
+476 328 l
+476 356 l
+h
+</path>
+<text matrix="1 0 0 1 -54.7825 -63.7328" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="17.2968" depth="5.352" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call generate\_dlsch\_params\_from\_dci\\
+dci=next(dci)
+\end{tiny}</text>
+<text matrix="1 0 0 1 -43 0" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="8.5512" depth="0" valign="top" size="small" style="center">\tt\tiny no</text>
+<path matrix="1 0 0 1 -23 0" stroke="black" arrow="normal/small">
+260 342 m
+240.242 342 l
+240 472 l
+368 472 l
+</path>
+<path matrix="1 0 0 1 -23 0" stroke="black" arrow="normal/small">
+445.666 417.484 m
+512.662 417.484 l
+512.662 303.725 l
+367.862 303.725 l
+367.862 288.454 l
+</path>
+<path matrix="1 0 0 1 -23 -68" fill="lightblue">
+260 356 m
+260 328 l
+476 328 l
+476 356 l
+h
+</path>
+<text matrix="1 0 0 1 -54.7825 -131.733" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="16.8048" depth="4.848" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call phy\_config\_dedicated\_step2\\
+dci=first\_dci
+\end{tiny}</text>
+<path fill="lightgray">
+272 200 m
+344.961 161.229 l
+416 200 l
+344.961 235.739 l
+h
+</path>
+<text matrix="1 0 0 1 -14.4181 -151.516" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="19.6056" depth="5.656" halign="center" valign="top" style="center">\setstretch{.5}\begin{tiny}\tt dci not empty and UL dci?\end{tiny}</text>
+<path matrix="1 0 0 1 -23 -219" stroke="black" rarrow="normal/small">
+368.297 357.206 m
+368 380 l
+</path>
+<path matrix="1 0 0 1 -23 -219" fill="lightblue">
+260 356 m
+260 328 l
+476 328 l
+476 356 l
+h
+</path>
+<text matrix="1 0 0 1 -54.7825 -282.733" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="17.2968" depth="5.352" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call generate\_ulsch\_params\_from\_dci\\
+dci=next(dci)
+\end{tiny}</text>
+<text matrix="1 0 0 1 -43 -219" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="8.5512" depth="0" valign="top" size="small" style="center">\tt\tiny no</text>
+<path matrix="1 0 0 1 -23 0" stroke="black" arrow="normal/small">
+260 123 m
+240.242 123 l
+240 252 l
+368 252 l
+</path>
+<path stroke="black" arrow="normal/small">
+416 200 m
+488 200 l
+489 96 l
+345 96 l
+344.862 77.0895 l
+</path>
+<path fill="lightblue">
+272 80 m
+272 48 l
+416 48 l
+416 80 l
+h
+</path>
+<text matrix="1 0 0 1 -54.7825 -343.733" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="18.1416" depth="6.168" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call generate\_dci\_top\\
+Call generate\_phich\_top
+\end{tiny}</text>
+<path matrix="1 0 0 1 -23.297 -121.206" stroke="black" rarrow="normal/small">
+368.297 357.206 m
+368 380 l
+</path>
+<path matrix="1 0 0 1 -23 12" fill="lightgreen">
+352 0 m
+352 12 l
+384 12 l
+384 12 l
+384 0 l
+368 -12 l
+368 -12 l
+h
+</path>
+<path stroke="black" rarrow="normal/small">
+344 24 m
+344 48 l
+</path>
+<text matrix="1 0 0 1 40 56" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="9.8808" depth="0" valign="top" size="small" style="center">\tt\tiny yes</text>
+<text matrix="1 0 0 1 41 -164" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="9.8808" depth="0" valign="top" size="small" style="center">\tt\tiny yes</text>
+<text matrix="1 0 0 1 179 0" transformations="translations" pos="176 556" stroke="black" type="label" width="219.988" height="19.3704" depth="0" halign="center" valign="baseline">eNB TX Flowchart</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 0 15" fill="lightblue">
+240 96 m
+240 56 l
+496 56 l
+496 96 l
+h
+</path>
+<text matrix="1 0 0 1 -47.7825 -306.39" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="258.411" height="23.6472" depth="11.688" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt dlsch\_eNB[UE].subframe\_active=false\par [no PUCCH ACK to be checked in TTI n+k]\par
+UE=next(UE)
+\end{tiny}</text>
+<path matrix="1 0 0 1 0 -161" fill="lightgray">
+288 464 m
+368 432 l
+448 464 l
+368 496 l
+h
+</path>
+<path matrix="1 0 0 1 0 -73" fill="lightgray">
+288 464 m
+368 432 l
+448 464 l
+368 496 l
+h
+</path>
+<path stroke="black" arrow="normal/small">
+368 528 m
+368 512 l
+</path>
+<path matrix="1 0 0 1 0 15" fill="lightgray">
+288 464 m
+368 432 l
+448 464 l
+368 496 l
+h
+</path>
+<text matrix="1 0 0 1 9.5819 128.484" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="19.6056" depth="5.656" halign="center" valign="top" style="center">\setstretch{.5}\begin{tiny}\tt is dlsch\_SI active?\end{tiny}</text>
+<path matrix="1 0 0 1 0 -81" stroke="black" arrow="normal/small">
+368 528 m
+368 504 l
+</path>
+<text matrix="1 0 0 1 9.5819 26.484" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="19.6056" depth="5.656" halign="center" valign="center" style="center">\setstretch{.5}\begin{tiny}\tt is dlsch\_P active?\end{tiny}</text>
+<path matrix="1 0 0 1 0 -169" stroke="black" arrow="normal/small">
+368 528 m
+368 504 l
+</path>
+<text matrix="1 0 0 1 9.5819 -48.516" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="19.6056" depth="5.656" halign="center" valign="top" style="center">\setstretch{.5}\begin{tiny}\tt is dlsch\_RA active?\end{tiny}</text>
+<text matrix="1 0 0 1 -57 63" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="8.5512" depth="0" valign="top" size="small" style="center">\tt\tiny no</text>
+<text matrix="1 0 0 1 -57 -33" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="8.5512" depth="0" valign="top" size="small" style="center">\tt\tiny no</text>
+<text matrix="1 0 0 1 -54 -107" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="8.5512" depth="0" valign="top" size="small" style="center">\tt\tiny no</text>
+<path matrix="1 0 0 1 0 -257" stroke="black" arrow="normal/small">
+368 528 m
+368 504 l
+</path>
+<path matrix="1 0 0 1 -16 -17" fill="lightblue">
+456 480 m
+456 464 l
+648 464 l
+648 480 l
+h
+</path>
+<text matrix="1 0 0 1 137.178 43.695" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="11.4576" depth="0" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call pdsch\_procedures(dlsch\_SI)
+\end{tiny}</text>
+<path matrix="1 0 0 1 0 15" stroke="black" arrow="normal/small">
+448 464 m
+536 464 l
+536 448 l
+</path>
+<path matrix="1 0 0 1 0 15" stroke="black" arrow="normal/small">
+536 432 m
+536 424 l
+368 424 l
+</path>
+<text matrix="1 0 0 1 64 119" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="9.8808" depth="0" valign="top" size="small" style="center">\tt\tiny yes</text>
+<path matrix="1 0 0 1 -16 -105" fill="lightblue">
+456 480 m
+456 464 l
+648 464 l
+648 480 l
+h
+</path>
+<text matrix="1 0 0 1 137.178 -44.305" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="11.4576" depth="0" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call pdsch\_procedures(dlsch\_P)
+\end{tiny}</text>
+<path matrix="1 0 0 1 0 -73" stroke="black" arrow="normal/small">
+448 464 m
+536 464 l
+536 448 l
+</path>
+<path matrix="1 0 0 1 0 -73" stroke="black" arrow="normal/small">
+536 432 m
+536 424 l
+368 424 l
+</path>
+<text matrix="1 0 0 1 64 31" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="9.8808" depth="0" valign="top" size="small" style="center">\tt\tiny yes</text>
+<path matrix="1 0 0 1 -16 -193" fill="lightblue">
+456 480 m
+456 464 l
+648 464 l
+648 480 l
+h
+</path>
+<text matrix="1 0 0 1 137.178 -132.305" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="11.4576" depth="0" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call pdsch\_procedures(dlsch\_RA)
+\end{tiny}</text>
+<path matrix="1 0 0 1 0 -161" stroke="black" arrow="normal/small">
+448 464 m
+536 464 l
+536 448 l
+</path>
+<path matrix="1 0 0 1 0 -161" stroke="black" arrow="normal/small">
+536 432 m
+536 424 l
+368 424 l
+</path>
+<text matrix="1 0 0 1 64 -57" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="9.8808" depth="0" valign="top" size="small" style="center">\tt\tiny yes</text>
+<path matrix="1 0 0 1 0 15" fill="lightblue">
+256 232 m
+256 208 l
+480 208 l
+480 232 l
+h
+</path>
+<text matrix="1 0 0 1 -30.822 -172.305" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="17.2968" depth="5.352" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt UE=first\_UE from UE\_list \par [list of UE with t-CRNTI or CRNTI]
+\end{tiny}</text>
+<path matrix="1 0 0 1 0 -297" fill="lightgray">
+288 464 m
+368 432 l
+448 464 l
+368 496 l
+h
+</path>
+<text matrix="1 0 0 1 9.5819 -185.516" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="19.6056" depth="5.656" halign="center" valign="top" style="center">\setstretch{.5}\begin{tiny}\tt is dlsch\_UE active?\end{tiny}</text>
+<path matrix="1 0 0 1 0 -305" stroke="black" arrow="normal/small">
+368 528 m
+368 504 l
+</path>
+<path matrix="1 0 0 1 0 -392" stroke="black" arrow="normal/small">
+368 528 m
+368 504 l
+</path>
+<path matrix="1 0 0 1 -16 -327" fill="lightblue">
+456 480 m
+456 464 l
+648 464 l
+648 480 l
+h
+</path>
+<text matrix="1 0 0 1 137.178 -267.305" transformations="translations" pos="286.577 417.212" stroke="black" type="minipage" width="226.411" height="11.4576" depth="0" halign="center" valign="top" size="small" style="center">\setstretch{.5}\begin{tiny}
+\bf\tt Call pdsch\_procedures(dlsch\_UE)
+\end{tiny}</text>
+<text matrix="1 0 0 1 64 -192" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="9.8808" depth="0" valign="top" size="small" style="center">\tt\tiny yes</text>
+<path matrix="1 0 0 1 0 -297" stroke="black" arrow="normal/small">
+448 464 m
+536 464 l
+536 448 l
+</path>
+<path matrix="1 0 0 1 0 -297" stroke="black" arrow="normal/small">
+536 432 m
+536 424 l
+368 424 l
+</path>
+<text matrix="1 0 0 1 -54 -243" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="8.5512" depth="0" valign="top" size="small" style="center">\tt\tiny no</text>
+<path matrix="1 0 0 1 0 15" stroke="black">
+416 88 m
+416 88 l
+416 88 l
+416 88 l
+h
+</path>
+<path matrix="1 0 0 1 0 8" fill="lightgray">
+320 32 m
+368 16 l
+416 32 l
+368 48 l
+h
+</path>
+<text matrix="1 0 0 1 9.5819 -318.516" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="11.2364" depth="0" halign="center" valign="top" style="center">\setstretch{.5}\begin{tiny}\tt UE=NULL?\end{tiny}</text>
+<path stroke="black" arrow="normal/small">
+368 72 m
+368 56 l
+</path>
+<path stroke="black" arrow="normal/small">
+320 40 m
+224 40 l
+224 168 l
+288 168 l
+</path>
+<text matrix="1 0 0 1 -94 -323" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="8.5512" depth="0" valign="top" size="small" style="center">\tt\tiny no</text>
+<path matrix="1 0 0 1 273 15" fill="lightgreen">
+352 0 m
+352 12 l
+384 12 l
+384 12 l
+384 0 l
+368 -12 l
+368 -12 l
+h
+</path>
+<path stroke="black" arrow="normal/small">
+416 40 m
+640 40 l
+640 24 l
+</path>
+<text matrix="1 0 0 1 32 -320" transformations="translations" pos="384 376" stroke="black" type="minipage" width="32" height="9.8808" depth="0" valign="top" size="small" style="center">\tt\tiny yes</text>
+<path fill="blue">
+512 48 m
+512 32 l
+544 32 l
+544 48 l
+h
+</path>
+<path stroke="red" pen="fat" arrow="normal/small">
+528 80 m
+528 48 l
+</path>
+<text matrix="1 0 0 1 -27 0" transformations="translations" pos="528 112" stroke="red" type="minipage" width="256" height="18.468" depth="6.504" valign="top" size="small">\bf\setstretch{.5}\tiny IF4p5 \par [All Frequency-domain Signals are created]</text>
+<text matrix="1 0 0 1 183 0" transformations="translations" pos="176 556" stroke="black" type="label" width="219.988" height="19.3704" depth="0" halign="center" valign="baseline">eNB TX Flowchart</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 0 16" fill="lightgray">
+130 527 m
+130 -1 l
+608 0 l
+608 528 l
+h
+</path>
+<path matrix="1 0 0 1 21 16" fill="gold">
+388 288 m
+388 208 l
+584 208 l
+584 288 l
+h
+</path>
+<path matrix="1 0 0 1 0 16" fill="lightgreen">
+141 449 m
+141 361 l
+580.427 361 l
+580 448 l
+h
+</path>
+<path matrix="1 0 0 1 0 16" stroke="black" fill="white">
+464 428 m
+464 396 l
+576 396 l
+576 428 l
+h
+</path>
+<path matrix="1 0 0 1 -148 100" fill="lightyellow">
+462.358 361 m
+462.358 287.368 l
+602 287.368 l
+602 361 l
+h
+</path>
+<path matrix="1 0 0 1 0 16" fill="lightcyan">
+462.358 361 m
+462.358 287.368 l
+602 287.368 l
+602 361 l
+h
+</path>
+<path matrix="1 0 0 1 0 16" fill="pink">
+492 200 m
+492 16 l
+596 16 l
+596 200 l
+h
+</path>
+<path matrix="1 0 0 1 0 19" fill="lightblue">
+130 202.157 m
+130 16 l
+484 16 l
+484 204 l
+h
+</path>
+<text matrix="1 0 0 1 -168 -251" transformations="translations" pos="300 280" stroke="black" type="minipage" width="397.2" height="11.4576" depth="0" valign="top" size="small">\tt\tiny openair1/SCHED/phy\_procedures\_lte\_eNb.c:phy\_procedures\_eNB\_RX()</text>
+<path matrix="1 0 0 1 687 40" fill="gold" tiling="rising">
+0 424 m
+0 32 l
+48 32 l
+48 424 l
+h
+</path>
+<text matrix="1 0 0 1 670 -91" transformations="translations" pos="32 416" stroke="black" type="minipage" width="32" height="50.1172" depth="36.204" valign="top" style="center">M\\
+A\\
+C</text>
+<path matrix="1 0 0 1 515 12" stroke="black" arrow="normal/small">
+64 416 m
+172 416 l
+</path>
+<text matrix="1 0 0 1 515 12" transformations="translations" pos="72 440" stroke="black" type="minipage" width="96" height="16.898" depth="2.94" valign="top">\setstretch{.5}\tt\tiny RACH Preamble</text>
+<path matrix="1 0 0 1 0 9" stroke="black" arrow="normal/small">
+534 125.858 m
+688 126 l
+</path>
+<text matrix="1 0 0 1 491 -280" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="15.9404" depth="1.96" valign="top">\tt\tiny ULSCH\_SDU(UE\_id)</text>
+<text matrix="1 0 0 1 -523.368 259.368" pos="596 32" stroke="black" type="label" width="156.192" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny eNB\_common\_vars.rxdataF[0]</text>
+<text matrix="1 0 0 1 -530.368 235.368" pos="596 32" stroke="black" type="label" width="168.646" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny eNB\_common\_vars.rxdataF[R-1]</text>
+<path matrix="2.16129 0 0 1 -478.452 16" stroke="black" arrow="normal/small">
+273 269 m
+412 268 l
+</path>
+<path matrix="2.14286 0 0 1 -469.857 12" stroke="black" arrow="normal/small">
+273 245 m
+412 244 l
+</path>
+<path matrix="1 0 0 1 -53 16" stroke="black" fill="1">
+184 128 m
+184 100 l
+276 100 l
+276 128 l
+h
+</path>
+<text matrix="1 0 0 1 3.0006 -311" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="15.492" depth="3.504" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny rx\_ulsch(UE\_id)\par36.211</text>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/tiny">
+208 240 m
+208 128 l
+</path>
+<text matrix="1 0 0 1 147 25" transformations="translations" pos="168 372" stroke="black" type="minipage" width="364" height="11.4576" depth="0" valign="top" size="small">\tt\tiny LTE\_TRANSPORT/prach.c</text>
+<text matrix="1 0 0 1 -27 -327" transformations="translations" pos="168 372" stroke="black" type="minipage" width="364" height="11.4576" depth="0" valign="top" size="small">\tt\tiny openair1/PHY/LTE\_TRANSPORT/ulsch\_demodulation.c</text>
+<path matrix="1 0 0 1 21 16" stroke="black" fill="white">
+393 285 m
+393 229 l
+552 228 l
+552 284 l
+h
+</path>
+<text matrix="1 0 0 1 287 -161.705" transformations="translations" pos="128 440" stroke="black" type="minipage" width="161" height="10.6272" depth="0" valign="center" size="small">\tt\tiny lte\_eNB\_I0\_measurements()</text>
+<group matrix="1 0 0 1 -49 16">
+<group>
+<path stroke="black" fill="white">
+280 32 m
+280 199 l
+308 199 l
+308 32 l
+h
+</path>
+<text matrix="0 1 -1 0 734.001 -92" pos="128 440" stroke="black" type="minipage" width="164" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_extract\_rbs\_single()\par36.211</text>
+</group>
+</group>
+<group matrix="1 0 0 1 -65 16">
+<path stroke="black" fill="white">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 786.001 -95" pos="128 440" stroke="black" type="minipage" width="164" height="16.6824" depth="4.704" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny lte\_ul\_channel\_estimation()\par36.211</text>
+</group>
+<group matrix="1 0 0 1 -93 16">
+<path matrix="1 0 0 1 100 0" stroke="black" fill="white">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 886.001 -95" pos="128 440" stroke="black" type="minipage" width="164" height="15.492" depth="3.504" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_detection\_mrc()\par36.211</text>
+</group>
+<group matrix="1 0 0 1 -101 16">
+<path matrix="1 0 0 1 144 0" stroke="black" fill="white">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 930.001 -95" pos="128 440" stroke="black" type="minipage" width="164" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny frequency\_equalization()\par36.211</text>
+</group>
+<group matrix="1 0 0 1 -46 16">
+<path matrix="1 0 0 1 125 0" stroke="black" fill="white">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 911.001 -95" pos="128 440" stroke="black" type="minipage" width="164" height="15.492" depth="3.504" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny lte\_idft()\par36.211</text>
+</group>
+<group matrix="1 0 0 1 -54 16">
+<path matrix="1 0 0 1 169 0" stroke="black" fill="white">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 955.001 -95" pos="128 440" stroke="black" type="minipage" width="164" height="15.492" depth="3.504" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_XXX\_llr()\par36.211</text>
+</group>
+<group matrix="1 0 0 1 -39 16">
+<path matrix="1 0 0 1 213 0" stroke="black" fill="white">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 1001 -95" pos="128 440" stroke="black" type="minipage" width="164" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_decoding()\par36.212</text>
+</group>
+<group matrix="1 0 0 1 -20 16">
+<path matrix="1 0 0 1 -9 0" stroke="black" fill="white">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<group>
+<text matrix="0 1 -1 0 777.001 -96" pos="128 440" stroke="black" type="minipage" width="164" height="17.5032" depth="5.544" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_channel\_compensation()\par36.211</text>
+</group>
+</group>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/small">
+476 118 m
+504.475 118 l
+</path>
+<path matrix="1 0 0 1 0 16" stroke="black">
+564 220 m
+564 220 l
+564 220 l
+564 220 l
+h
+</path>
+<text matrix="1 0 0 1 326 -327" transformations="translations" pos="168 372" stroke="black" type="minipage" width="112.095" height="10.9584" depth="0" valign="top" size="small">\tt\tiny ulsch\_decoding.c</text>
+<path matrix="1 0 0 1 60.209 86" stroke="black" arrow="normal/small">
+476 118 m
+504.475 118 l
+</path>
+<text matrix="1 0 0 1 472.783 -208" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="16.3212" depth="2.352" valign="top">\tt\tiny ACK/NAK,RI,CQI</text>
+<path matrix="1 0 0 1 164 16" stroke="black" fill="1">
+131 344 m
+131 316 l
+276 316 l
+276 344 l
+h
+</path>
+<text matrix="1 0 0 1 167.001 -95" transformations="translations" pos="128 440" stroke="black" type="minipage" width="146.013" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny pucch\_procedures(UE\_id)\par36.211</text>
+<path matrix="1 0 0 1 324 140" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 349.001 -96" transformations="translations" pos="128 440" stroke="black" type="minipage" width="76" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny rx\_pucchl\par36.211</text>
+<path matrix="1 0 0 1 77.275 242" stroke="black" arrow="normal/small">
+476 118 m
+504.475 118 l
+</path>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/small">
+551.76 312.126 m
+687 312.231 l
+</path>
+<text matrix="1 0 0 1 510.907 -68" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="15.9404" depth="1.96" valign="top">\tt\tiny ACK/NAK</text>
+<text matrix="1 0 0 1 510.907 -100" transformations="translations" pos="72 440" stroke="black" type="minipage" width="48" height="11.2364" depth="0" valign="top">\tt\tiny SR</text>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/small">
+440.514 328 m
+477 327.572 l
+</path>
+<text matrix="1 0 0 1 295.239 -57.6321" transformations="translations" pos="168 372" stroke="black" type="minipage" width="112.095" height="11.4576" depth="0" valign="top" size="small">\tt\tiny TRANSPORT/pucch.c</text>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/tiny">
+373.112 244.28 m
+373.112 316 l
+</path>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/tiny">
+344.968 268.786 m
+345.381 316 l
+</path>
+<path matrix="1 0 0 1 16 100" stroke="black" fill="1">
+131 344 m
+131 316 l
+276 316 l
+276 344 l
+h
+</path>
+<text matrix="1 0 0 1 43.001 -11" transformations="translations" pos="128 440" stroke="black" type="minipage" width="111.289" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny prach\_procedures\par36.211</text>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/small">
+405.275 413 m
+464 412.625 l
+</path>
+<path matrix="1 0 0 1 -148 100" stroke="black" arrow="normal/small">
+440.514 328 m
+477 327.572 l
+</path>
+<text matrix="1 0 0 1 -159.361 103" transformations="translations" pos="300 280" stroke="black" type="minipage" width="370.438" height="11.4576" depth="0" valign="top" size="small">\tt\tiny openair1/SCHED/phy\_procedures\_lte\_eNb.c:prach\_procedures()</text>
+<path matrix="1 0 0 1 178.191 224" stroke="black" fill="1">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 203.192 -12" transformations="translations" pos="128 440" stroke="black" type="minipage" width="76" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny rx\_prachl\par36.211</text>
+<text matrix="1 0 0 1 354 -12" transformations="translations" pos="128 440" stroke="black" type="minipage" width="76" height="14.484" depth="2.52" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny E\_PRACH&gt;Lmin\par36.211</text>
+<text matrix="1 0 0 1 240.239 -135.632" transformations="translations" pos="168 372" stroke="black" type="minipage" width="250.621" height="10.6272" depth="0" valign="top" size="small">\tt\tiny LTE\_ESTIMATION/lte\_eNB\_I0\_measurements.c</text>
+<text matrix="1 0 0 1 203 20" transformations="translations" pos="176 556" stroke="black" type="label" width="299.76" height="19.3704" depth="0" halign="center" valign="baseline">eNB PHY RX Procedures</text>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/small">
+0 416 m
+144 416 l
+</path>
+<text matrix="1 0 0 1 -592.839 419.285" pos="596 32" stroke="black" type="label" width="207.648" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt eNB-&gt;prach\_vars.prachF[0$\cdots$ R-1]}</text>
+<path matrix="1 0 0 1 0 16" stroke="black" arrow="normal/tiny">
+160 268 m
+160 128 l
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="0.999446 0 0 2 -0.592063 -512" fill="turquoise">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<path matrix="0.999446 0 0 0.875 -0.592063 -151" fill="gold">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<path matrix="0.999446 0 0 1 0.407937 -156" fill="pink">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<path matrix="0.999446 0 0 1 0.407937 -124" fill="lightyellow">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<path matrix="0.999446 0 0 1.125 0.407937 -125" fill="lightgreen">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<path matrix="0.999446 0 0 0.75 0.407937 10" fill="lightgray">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<path matrix="1 0 0 1 0 -32" fill="lightcyan">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<path fill="lightblue">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<path matrix="1 0 0 1 -5 324" stroke="black" fill="1">
+184 128 m
+184 100 l
+276 100 l
+276 128 l
+h
+</path>
+<text matrix="1 0 0 1 51.0006 -3" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="15.492" depth="3.504" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny rx\_ulsch(UE\_id)\par36.211</text>
+<text matrix="1 0 0 1 -69 -7" transformations="translations" pos="68 284" stroke="black" type="label" width="742.558" height="8.9712" depth="8.232" valign="baseline" size="small">\tiny$\mathbf{R}_{r,l}=\mathrm{DFT}_{N_{\mathrm{fft}}}(\mathbf{r}_{r,l}\odot\mathbf{F}_{7.5}),r=0,1,\cdots,R-1,l=0,1,\cdots,N_{\mathrm{symb}}-1$ (\tt\bf eNB\_common\_vars$\rightarrow$rxdataF[][])%,N_{\mathrm{fft}}=2^{1+\left\lceil\log_2 12N^{\mathrm{RB}}_{\mathrm{DL}}\right\rceil$</text>
+<path matrix="1 0 0 1 -84 232" stroke="black" fill="lightblue">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 -58.9994 -4" transformations="translations" pos="128 440" stroke="black" type="minipage" width="76" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny slot\_fep\_ul\par36.211</text>
+<path stroke="black" arrow="normal/tiny">
+144 440 m
+176 440 l
+</path>
+<path stroke="black" cap="1">
+272 328 m
+272 328 l
+</path>
+<path matrix="1 0 0 1 -108 -4" stroke="black" arrow="normal/tiny">
+144 440 m
+176 440 l
+</path>
+<text transformations="translations" pos="28 468" stroke="black" type="label" width="32.0432" height="6.2048" depth="7.588" valign="baseline">\tiny $\mathbf{r}_{r,l}$</text>
+<text matrix="1 0 0 1 128 4" transformations="translations" pos="28 468" stroke="black" type="label" width="38.7464" height="9.576" depth="7.588" valign="baseline">\tiny $\mathbf{R}_{r,l}$</text>
+<text matrix="1 0 0 1 276 -132" transformations="translations" pos="28 468" stroke="black" type="label" width="71.1956" height="9.576" depth="7.588" valign="baseline">\tiny $\mathbf{R}_{\mathrm{ext},r,l}$</text>
+<text matrix="1 0 0 1 -24 -224" transformations="translations" pos="28 468" stroke="black" type="label" width="693.216" height="8.9712" depth="6.504" valign="baseline" size="small">\tiny $R_{\mathrm{ext},r,l}(n)={R}_{r,l}(12\mathrm{firstPRB}+n),n=0,1,\cdots,12N_{\mathrm{PRB}}-1$ (\tt\bf eNB\_pusch\_vars$\rightarrow$ulsch\_rxdataF\_ext[][])</text>
+<text matrix="1 0 0 1 340 -156" transformations="translations" pos="28 468" stroke="black" type="label" width="39.4436" height="13.062" depth="7.588" valign="baseline">\tiny $\mathbf{\hat{H}}_{r,l}$</text>
+<text matrix="1 0 0 1 -28 -246" transformations="translations" pos="28 468" stroke="black" type="label" width="631.046" height="11.196" depth="9.12" valign="baseline" size="small">\tiny $\mathbf{\hat{H}}_{r,l} = \mathbf{R}_{\mathrm{ext},r,l}\odot\mathbf{DRS}^*_{l}(\mathrm{cyclicShift},n_{\mathrm{DMRS}^{(2)}},n_{\mathrm{PRS}})$, (\tt\bf eNB\_pusch\_vars$\rightarrow$drs\_ch\_estimates[])</text>
+<text matrix="1 0 0 1 392 -128" transformations="translations" pos="28 468" stroke="black" type="label" width="88.9196" height="9.576" depth="7.588" valign="baseline">\tiny $\mathbf{R}_{\mathrm{comp},r,l}$</text>
+<text matrix="1 0 0 1 452 -156" transformations="translations" pos="28 468" stroke="black" type="label" width="89.5328" height="9.576" depth="7.588" valign="baseline">\tiny $\mathbf{R}_{\mathrm{comp},0,l}$</text>
+<text matrix="1 0 0 1 -28 -320" transformations="translations" pos="28 468" stroke="black" type="label" width="247.932" height="14.2848" depth="6.504" valign="baseline" size="small">\tiny $\mathbf{R}_{\mathrm{comp},0,l}=\frac{1}{R}\sum_{r=0}^{R-1}\mathbf{R}_{\mathrm{comp},r,l}$</text>
+<text matrix="1 0 0 1 512 -128" transformations="translations" pos="28 468" stroke="black" type="label" width="89.5328" height="9.576" depth="7.588" valign="baseline">\tiny $\mathbf{R}_{\mathrm{comp},0,l}$</text>
+<text matrix="1 0 0 1 572 -156" transformations="translations" pos="28 468" stroke="black" type="label" width="82.8324" height="6.2048" depth="7.588" valign="baseline">\tiny $\mathbf{r}_{\mathrm{comp},0,l}$</text>
+<text matrix="1 0 0 1 -28 -345" transformations="translations" pos="28 468" stroke="black" type="label" width="528.362" height="17.3352" depth="12.792" valign="baseline" size="small">\tiny $R_{\mathrm{comp},0,l}(n)=R_{\mathrm{comp},0,l}(n)\dot Q_8\left(\frac{1}{|\hat{H}(n)|^2+I_0}\right), \hat{H}(n)=\sum_{r=0}^{R-1}\hat{H}_{r}(n)$</text>
+<text matrix="1 0 0 1 -3 15" transformations="translations" pos="4 192" stroke="black" type="minipage" width="728" height="23.3184" depth="11.376" valign="top" size="small">\tiny $\mathbf{R}_{\mathrm{comp},r,l}=\mathbf{\hat{H}}_r\odot\mathbf{R}_{\mathrm{ext},r,l}2^{-\log_2|H_\mathrm{max}|}, \mathbf{\hat{H}}_r = \frac{1}{2}(\mathbf{\hat{H}}_{r,3}+\mathbf{\hat{H}}_{r,10})$\par (\tt\bf eNB\_pusch\_vars$\rightarrow$ulsch\_rxdataF\_comp)</text>
+<text matrix="1 0 0 1 624 -124" transformations="translations" pos="28 468" stroke="black" type="label" width="19.8156" height="9.6964" depth="4.872" valign="baseline">\tiny $\mathbf{\lambda}_{l}$</text>
+<text matrix="1 0 0 1 -28 -402" transformations="translations" pos="28 468" stroke="black" type="label" width="636.775" height="8.9712" depth="6.504" valign="baseline" size="small">\tiny QPSK : $\lambda_l(2n)=\mathrm{Re}(r_{\mathrm{comp},0,l}(n)), \lambda_l(2n+1)=\mathrm{Im}(r_{\mathrm{comp},0,l}(n))$ (\tt\bf eNB\_pusch\_vars$\rightarrow$ulsch\_llr)</text>
+<text matrix="1 0 0 1 -28 -374" transformations="translations" pos="28 468" stroke="black" type="label" width="287.525" height="8.9616" depth="8.064" valign="baseline" size="small">\tiny ${\mathbf r}_{\mathrm{comp},0,l} = \mathrm{IDFT}_{12N_{\mathrm{PRB}}}({\mathbf R}_{\mathrm{comp},0,l})$</text>
+<text matrix="1 0 0 1 0 23" transformations="translations" pos="4 28" stroke="black" type="minipage" width="720" height="24.1008" depth="12.144" valign="top" size="small">\tiny 16QAM : $\lambda_l(4n)=\mathrm{Re}(r_{\mathrm{comp},0,l}(n)), \lambda_l(4n+2)=\mathrm{Im}(r_{\mathrm{comp},0,l}(n))$\par$\lambda_l(4n+1)=|\mathrm{Re}(r_{\mathrm{comp},0,l}(n))|-2\overline{|h(n)|},\lambda_l(4n+3)=|\mathrm{Im}(r_{\mathrm{comp},0,l}(n))|-2\overline{|h(n)|}$</text>
+<path matrix="1 0 0 1 -1 324" stroke="black" fill="lightcyan">
+280 32 m
+280 199 l
+308 199 l
+308 32 l
+h
+</path>
+<text matrix="0 1 -1 0 733.001 232" pos="128 440" stroke="black" type="minipage" width="164" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_extract\_rbs\_single()\par36.211</text>
+<path matrix="1 0 0 1 5 324" stroke="black" fill="lightgray">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 791.001 229" pos="128 440" stroke="black" type="minipage" width="164" height="16.6824" depth="4.704" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny lte\_ul\_channel\_estimation()\par36.211</text>
+<path matrix="1 0 0 1 63 324" stroke="black" fill="lightgreen">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<group matrix="1 0 0 1 72 324">
+<text matrix="0 1 -1 0 777.001 -96" pos="128 440" stroke="black" type="minipage" width="164" height="17.5032" depth="5.544" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_channel\_compensation()\par36.211</text>
+</group>
+<path matrix="1 0 0 1 121 324" stroke="black" fill="lightyellow">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 907.001 229" pos="128 440" stroke="black" type="minipage" width="164" height="15.492" depth="3.504" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_detection\_mrc()\par36.211</text>
+<path matrix="1 0 0 1 179 324" stroke="black" fill="pink">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 965.001 229" pos="128 440" stroke="black" type="minipage" width="164" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny frequency\_equalization()\par36.211</text>
+<path matrix="1 0 0 1 237 324" stroke="black" fill="gold">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 1023 229" pos="128 440" stroke="black" type="minipage" width="164" height="15.492" depth="3.504" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny lte\_idft()\par36.211</text>
+<path matrix="1 0 0 1 295 324" stroke="black" fill="turquoise">
+332 32 m
+332 199 l
+360 199 l
+360 32 l
+h
+</path>
+<text matrix="0 1 -1 0 1081 229" pos="128 440" stroke="black" type="minipage" width="164" height="15.492" depth="3.504" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny ulsch\_XXX\_llr()\par36.211</text>
+<path stroke="black">
+304 236 m
+304 236 l
+304 236 l
+304 236 l
+h
+</path>
+<text matrix="1 0 0 1 199 0" transformations="translations" pos="176 556" stroke="black" type="label" width="320.138" height="19.3704" depth="0" halign="center" valign="baseline">eNB ULSCH Demodulation</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 199 0" transformations="translations" pos="176 556" stroke="black" type="label" width="273.104" height="19.3704" depth="0" halign="center" valign="baseline">eNB PRACH Detection</text>
+<path matrix="1 0 0 1 0.643 45" fill="lightblue">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<text matrix="1 0 0 1 -68.357 38" transformations="translations" pos="68 284" stroke="black" type="label" width="505.402" height="8.9616" depth="8.064" valign="baseline" size="small">\tiny$\mathbf{R}_{r}=\mathrm{DFT}_{N_{\mathrm{PRACH}}}(\mathbf{r}_{r}),r=0,1,\cdots,R-1$ (\tt\bf lte\_eNB\_prach\_vars$\rightarrow$rxsigF[])%,N_{\mathrm{fft}}=2^{1+\left\lceil\log_2 12N^{\mathrm{RB}}_{\mathrm{DL}}\right\rceil$</text>
+<path matrix="1 0 0 1 -0.879076 13" fill="lightcyan">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<text matrix="1 0 0 1 -69.8791 6" transformations="translations" pos="68 284" stroke="black" type="label" width="501.238" height="10.392" depth="4.776" valign="baseline" size="small">\tiny$\mathbf{R}_{\mathrm{comp},r}=\mathbf{R}_{r}\odot \mathbf{X}^*_u[i],r=0,1,\cdots,R-1$ (\tt\bf lte\_eNB\_prach\_vars$\rightarrow$prachF[])%,N_{\mathrm{fft}}=2^{1+\left\lceil\log_2 12N^{\mathrm{RB}}_{\mathrm{DL}}\right\rceil$</text>
+<path matrix="1 0 0 1 -1.80008 -19" fill="lightgray">
+0 296 m
+0 264 l
+736 264 l
+736 296 l
+h
+</path>
+<text matrix="1 0 0 1 -70.8001 -26" transformations="translations" pos="68 284" stroke="black" type="label" width="569.174" height="10.1688" depth="5.904" valign="baseline" size="small">\tiny$\mathbf{r}_{839,r}=\mathrm{IDFT}_{1024}\left(\mathbf{R}_{\mathrm{comp},r}\right), r=0,1,\cdots,R-1$ (\tt\bf lte\_eNB\_prach\_vars$\rightarrow$prach\_ifft[])</text>
+<path matrix="1 0 0 1 -61 -2" fill="lightblue">
+112 460 m
+112 400 l
+176 400 l
+176 460 l
+h
+</path>
+<text matrix="1 0 0 1 -25 -8" transformations="translations" pos="28 468" stroke="black" type="label" width="19.922" height="6.216" depth="2.772" valign="baseline">\tiny $\mathbf{r}_{r}$</text>
+<path matrix="1 0 0 1 -127.121 -8" stroke="black" arrow="normal/tiny">
+144 440 m
+176 440 l
+</path>
+<text matrix="1 0 0 1 -54 -2" transformations="translations" pos="112 439.386" stroke="black" type="minipage" width="64" height="14.2992" depth="2.304" valign="top" size="small">DFT</text>
+<text matrix="1 0 0 1 95 -8" transformations="translations" pos="28 468" stroke="black" type="label" width="26.6224" height="9.5872" depth="2.772" valign="baseline">\tiny $\mathbf{R}_{r}$</text>
+<path matrix="1 0 0 1 -61 -66" fill="lightcyan">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<text matrix="1 0 0 1 -55 -64" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="32" height="13.9488" depth="1.992" valign="top" size="small">$\odot$</text>
+<path matrix="1 0 0 1 -61 -1" stroke="black" arrow="normal/tiny">
+176 428 m
+208 428 l
+208 456 l
+268 456 l
+</path>
+<path matrix="1 0 0 1 -61 0" stroke="black" arrow="normal/tiny">
+208 428 m
+208 400 l
+268 400 l
+</path>
+<text matrix="1 0 0 1 187 16" transformations="translations" pos="28 468" stroke="black" type="label" width="53.3344" height="12.124" depth="5.572" valign="baseline">\tiny $\mathbf{X}^*_{u}(0)$</text>
+<text matrix="1 0 0 1 187 -112" transformations="translations" pos="28 468" stroke="black" type="label" width="53.3344" height="12.124" depth="5.572" valign="baseline">\tiny $\mathbf{X}^*_{u}(1)$</text>
+<path matrix="1 0 0 1 -61 0" stroke="black" arrow="normal/tiny">
+284 480 m
+284 468 l
+</path>
+<path matrix="1 0 0 1 -61 0" stroke="black" arrow="normal/tiny">
+284 372 m
+284 384 l
+</path>
+<path matrix="2.375 0 0 1.25 -361.5 -125" fill="lightgray">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<text matrix="1 0 0 1 11 -1" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="32" height="19.0224" depth="7.08" valign="top" size="small">\tiny$R\times\mathrm{IDFT}_{1024}$</text>
+<path matrix="1 0 0 1 -61 0" stroke="black" arrow="normal/tiny">
+300 456 m
+336 456 l
+</path>
+<path matrix="1 0 0 1 -61 -56" stroke="black" arrow="normal/tiny">
+300 456 m
+336 456 l
+</path>
+<path matrix="2.375 0 0 1.25 -361.5 -181" fill="lightgray">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<text matrix="1 0 0 1 11 -57" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="32" height="19.0224" depth="7.08" valign="top" size="small">\tiny$R\times\mathrm{IDFT}_{1024}$</text>
+<group matrix="1 0 0 1 -73 -1">
+<path matrix="1.88154 0 0 1 -53.5314 -8" stroke="black">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<group>
+<group>
+<text matrix="1 0 0 1 183 -6" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="64" height="14.3376" depth="2.376" valign="top" size="small">\tiny$\sum_{r}|\cdot|^2$</text>
+</group>
+</group>
+</group>
+<group matrix="1 0 0 1 -73 -57">
+<path matrix="1.88154 0 0 1 -53.5314 -8" stroke="black">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<group>
+<group>
+<text matrix="1 0 0 1 183 -6" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="64" height="14.3376" depth="2.376" valign="top" size="small">\tiny$\sum_{r}|\cdot|^2$</text>
+</group>
+</group>
+</group>
+<group matrix="1 0 0 1 -61 10">
+<path matrix="2.84167 0 0 1.68966 -230.567 -338.034" stroke="black">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<text matrix="1 0 0 1 263 -6" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="92" height="25.6392" depth="13.68" valign="top" size="small">\tiny max peak in size $\mathrm{NCS}_2$ window, keep delay</text>
+</group>
+<path matrix="1 0 0 1 -61 0" stroke="black" arrow="normal/tiny">
+412 456 m
+440 456 l
+</path>
+<path matrix="1 0 0 1 -61 0" stroke="black" arrow="normal/tiny">
+412 400 m
+440 400 l
+</path>
+<path matrix="1 0 0 1 -61 -3" stroke="black" arrow="normal/tiny">
+500 460 m
+532 460 l
+</path>
+<path matrix="1 0 0 1 -61 -3" stroke="black" arrow="normal/tiny">
+500 460 m
+532 460 l
+</path>
+<path matrix="1 0 0 1 -61 -59" stroke="black" arrow="normal/tiny">
+500 460 m
+532 460 l
+</path>
+<path matrix="1 0 0 1 -61 1" stroke="black" arrow="normal/tiny">
+624 456 m
+672 456 l
+</path>
+<path matrix="1 0 0 1 -61 -55" stroke="black" arrow="normal/tiny">
+624 456 m
+672 456 l
+</path>
+<path matrix="2.84167 0 0 1.68966 -291.567 -384.034" stroke="black">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<text matrix="1 0 0 1 202 -52" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="92" height="25.6392" depth="13.68" valign="top" size="small">\tiny max peak in size $\mathrm{NCS}_2$ window, keep delay</text>
+<text matrix="1 0 0 1 322 -20" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="92" height="21.6528" depth="9.696" valign="top" size="small">\tiny\tt preamble\_energy\_list[]\par preamble\_delay\_list[]</text>
+<text matrix="1 0 0 1 311 -104" transformations="translations" pos="28 468" stroke="black" type="label" width="54.7904" height="6.2076" depth="6.888" valign="baseline">\tiny $\mathbf{r}_{839,r}$</text>
+<text transformations="translations" pos="16 224" stroke="black" type="minipage" width="700" height="104.215" depth="92.448" valign="top" size="small">\small\begin{itemize}
+\item PRACH detection is a quasi-optimal non-coherent receiver for vector observations (multiple antennas)
+\item correlation is done in the frequency-domain, number of correlations (in the example above 2) depends on {\em zeroCorrelationConfig} configuration parameter
+\item peak-detection (for delay estimation) is performed in each NCS time-window
+\end{itemize}</text>
+<group>
+<path matrix="1 0 0 1 -61 -12" fill="lightcyan">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<text matrix="1 0 0 1 -55 -10" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="32" height="13.9488" depth="1.992" valign="top" size="small">$\odot$</text>
+</group>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" fill="lightgreen">
+340 416 m
+340 340 l
+564 340 l
+564 416 l
+h
+</path>
+<path matrix="6.93939 0 0 1 -1513.76 -18" fill="lightcyan">
+268 480 m
+268 452 l
+300 452 l
+300 480 l
+h
+</path>
+<text matrix="1 0 0 1 145 -13" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="92" height="15.5088" depth="3.528" valign="top" size="small">\tiny$\sum_{r,l,i}|\cdot|^2$</text>
+<text matrix="1 0 0 1 171 101" transformations="translations" pos="301.598 362.627" stroke="black" type="minipage" width="115.562" height="19.572" depth="5.628" halign="center" valign="top" style="center">\begin{tiny}$\stackbin{&lt;}{&gt;}\sigma^2[\mathrm{dB}]$\end{tiny}</text>
+<text matrix="1 0 0 1 199 0" transformations="translations" pos="176 556" stroke="black" type="label" width="288.215" height="19.3704" depth="0" halign="center" valign="baseline">eNB PUCCH1 Detection</text>
+<path matrix="1 0 0 1 31 336" stroke="black" fill="1">
+184 128 m
+184 100 l
+276 100 l
+276 128 l
+h
+</path>
+<text matrix="1 0 0 1 87.0006 9" transformations="translations" pos="128 440" stroke="black" type="minipage" width="96" height="16.3128" depth="4.344" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny rx\_pucch()\par36.211</text>
+<path matrix="1 0 0 1 -48 244" stroke="black" fill="lightblue">
+153 232 m
+153 176 l
+228 176 l
+228 232 l
+h
+</path>
+<text matrix="1 0 0 1 -22.9994 8" transformations="translations" pos="128 440" stroke="black" type="minipage" width="76" height="15.8184" depth="3.84" valign="center" size="small" style="center">\setstretch{.5}\tt\tiny slot\_fep\_ul\par36.211</text>
+<path matrix="1 0 0 1 36 12" stroke="black" arrow="normal/tiny">
+144 440 m
+176 440 l
+</path>
+<path matrix="1 0 0 1 -72 8" stroke="black" arrow="normal/tiny">
+144 440 m
+176 440 l
+</path>
+<text matrix="1 0 0 1 36 12" transformations="translations" pos="28 468" stroke="black" type="label" width="32.0432" height="6.2048" depth="7.588" valign="baseline">\tiny $\mathbf{r}_{r,l}$</text>
+<text matrix="1 0 0 1 164 16" transformations="translations" pos="28 468" stroke="black" type="label" width="38.7464" height="9.576" depth="7.588" valign="baseline">\tiny $\mathbf{R}_{r,l}$</text>
+<text matrix="1 0 0 1 252 22" transformations="translations" pos="28 468" stroke="black" type="label" width="229.617" height="16.1084" depth="6.748" valign="baseline">\tiny $\mathbf{Z}^*_{l}e^{-j2\pi f/16},-3\leq f\leq 2$</text>
+<path stroke="black" arrow="normal/tiny">
+308 448 m
+352 448 l
+</path>
+<text matrix="1 0 0 1 84 -16" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="32" height="13.9488" depth="1.992" valign="top" size="small">$\odot$</text>
+<path matrix="1 0 0 1 63 2" stroke="black" arrow="normal/tiny">
+308 448 m
+352 448 l
+</path>
+<path matrix="1 0 0 1 -31 0" stroke="black" arrow="normal/tiny">
+392 484 m
+392 456 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+328 448 m
+328 400 l
+352 400 l
+</path>
+<text matrix="1 0 0 1 83 -64" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="32" height="13.9488" depth="1.992" valign="top" size="small">$\odot$</text>
+<path matrix="1 0 0 1 -31 -93" stroke="black" rarrow="normal/tiny">
+392 484 m
+392 456 l
+</path>
+<text matrix="1 0 0 1 321 -116" transformations="translations" pos="28 468" stroke="black" type="label" width="24.486" height="12.138" depth="6.748" valign="baseline">\tiny $\mathbf{Z}^*_{l}$</text>
+<path stroke="black">
+288 496 m
+288 496 l
+288 496 l
+288 496 l
+h
+</path>
+<path matrix="1 0 0 1 60 -48" stroke="black" arrow="normal/tiny">
+308 448 m
+352 448 l
+</path>
+<path matrix="0.307692 0 0 1 285.231 0" stroke="black">
+412 408 m
+412 392 l
+464 392 l
+464 408 l
+h
+</path>
+<text transformations="translations" pos="412 408" stroke="black" type="minipage" width="52" height="11.5728" depth="0" valign="top" size="small">\tiny$\mathbf{\hat{H}}$</text>
+<text matrix="1 0 0 1 143 -96" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="32" height="13.9488" depth="1.992" valign="top" size="small">$\odot$</text>
+<path stroke="black" arrow="normal/tiny">
+420 392 m
+420 376 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+384 400 m
+384 368 l
+412 368 l
+</path>
+<path stroke="black" arrow="normal/tiny">
+428 368 m
+464 368 l
+</path>
+<text matrix="1 0 0 1 201 -93" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="92" height="11.9544" depth="0" valign="top" size="small">\tiny$\mathrm{sgn}(\mathrm{Re}(\cdot))$</text>
+<path stroke="black" arrow="normal/tiny">
+444 368 m
+444 352 l
+464 352 l
+</path>
+<text matrix="1 0 0 1 201 -109" transformations="translations" pos="268 471.863" stroke="black" type="minipage" width="92" height="11.9544" depth="0" valign="top" size="small">\tiny$\mathrm{sgn}(\mathrm{Im}(\cdot))$</text>
+<path stroke="black">
+532 408 m
+532 408 l
+532 408 l
+532 408 l
+h
+</path>
+<text matrix="1 0 0 1 0 -6" transformations="translations" pos="432 472" stroke="black" type="label" width="165.809" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny PUCCH1 (Scheduling Request)</text>
+<text matrix="1 0 0 1 0 -54" transformations="translations" pos="432 472" stroke="black" type="label" width="145.519" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny PUCCH1a/1b (ACK/NAK)</text>
+<text matrix="1 0 0 1 24 92" transformations="translations" pos="16 224" stroke="black" type="minipage" width="700" height="93.756" depth="81.984" valign="top" size="small">\small\begin{itemize}
+\item PUCCH1 detection is a quasi-optimal non-coherent receiver (energy detector) for vector observations (multiple antennas) for scheduling request. Care is taken to handle residual frequency-offset.
+\item PUCCH1A/1B detection is quasi-coherent based on a rough channel estimate obtained on the 3 symbols without data modulation. \item In both cases, correlation is done in the frequency-domain
+\end{itemize}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 -512 62" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="265.102" depth="253.752" valign="top" size="small">\small\begin{itemize}
+\item Threads (all in {\tt targets/RT/USER/lte-ru.c})
+\begin{itemize}
+\item {\tt ru\_thread}: Thread per RU which sequentially 
+performs
+\begin{itemize}
+\item read from south interface (RF or IF fronthaul)
+\item RX processing for subframe $n$ (if necessary).
+\item wakeup eNBs that are waiting for signal (if necessary)
+\item wait for eNB task completion (if necessary)
+\item do TX processing for subframe $n+4$ (if necessary). Note that this can spawn multiple worker threads for very high order spatial processing (e.g. massive-MIMO or DAS for UDN)
+\item do outgoing fronthaul (RF or IF fronthaul)
+\end{itemize}
+\item {\tt ru\_thread\_prach}: Thread for PRACH processing in remote RU (DFT on RX, IF4p5 RRU)
+\item {\tt ru\_thread\_asynch}: Thread for asynchronous reception from fronthaul interface (TX direction in RRU). %Allows for some jitter so as not to block the RRU real-time processing.
+\end{itemize}
+\item Synchronization on fronthaul interface
+\begin{itemize}
+\item {\em synch\_to\_ext\_device} : synchronizes to incoming samples from RF or Fronthaul interface using blocking read
+\item {\em synch\_to\_other} : synchronizes via POSIX mechanism to other source (other CC, timer) which maintains real-time.  
+\end{itemize}
+\end{itemize} </text>
+<text matrix="1 0 0 1 201 -17" transformations="translations" pos="176 556" stroke="black" type="label" width="140.33" height="19.3704" depth="0" halign="center" valign="baseline">RU Threads</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 -512 78" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="166.006" depth="154.392" valign="top" size="small">\small\begin{itemize}
+\item Threads (all in {\tt targets/RT/USER/lte-enb.c})
+\begin{itemize} 
+\item multi RX/TX thread mode (optional)
+\begin{itemize}
+\item {\tt eNB\_thread\_rxtx}: 2 threads per CC/Instance which do both RX procedures for subframe $n$ and TX procedures for subframe $n+4$. One operates on even subframes, one on odd. This allows 1ms subframe processing to use multiple-cores.
+\end{itemize}
+\item common RU-eNB RX/TX thread (default if single RU/eNB)
+\begin{itemize}
+\item calls {\tt eNB\_top}: procedure per CC/Instance which sequentially 
+\begin{itemize}
+\item blocks on signal from RU
+\item RX/TX processing for subframe $n$ and $n+4$
+\item signals completion to RU
+\end{itemize}
+\end{itemize}
+\item {\tt eNB\_prach}: Thread per CC\_id/Instance for PRACH processing
+\end{itemize}
+\end{itemize} </text>
+<text matrix="1 0 0 1 201 -1" transformations="translations" pos="176 556" stroke="black" type="label" width="153.891" height="19.3704" depth="0" halign="center" valign="baseline">eNB Threads</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 64 0" stroke="white" fill="lightblue">
+400 400 m
+400 388 l
+520 388 l
+520 400 l
+h
+</path>
+<path matrix="1 0 0 1 64 0" fill="lightgreen">
+400 432 m
+400 420 l
+520 420 l
+520 432 l
+h
+</path>
+<path matrix="0.46875 0 0 1 336.5 0" fill="pink">
+400 448 m
+400 436 l
+528 436 l
+528 448 l
+h
+</path>
+<path matrix="0.46875 0 0 1 276.5 0" fill="lightyellow">
+400 448 m
+400 436 l
+528 436 l
+528 448 l
+h
+</path>
+<path matrix="0.7 0 0 0.5 -7.4 198" fill="lightblue">
+192 388 m
+192 364 l
+272 364 l
+272 388 l
+h
+</path>
+<path matrix="0.15 0 0 1 107.2 -28" stroke="black" fill="lightgreen">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 183 0" transformations="translations" pos="176 556" stroke="black" type="label" width="390.382" height="20.9244" depth="6.972" halign="center" valign="baseline">eNB Timing (multi-thread mode)</text>
+<path matrix="1 0 0 1 80 0" stroke="black">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 80 0" transformations="translations" pos="32 480" stroke="black" type="minipage" width="80" height="11.124" depth="0" valign="top" size="small">\tiny SF $n+1$</text>
+<path matrix="1 0 0 1 160 0" stroke="black">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 160 0" transformations="translations" pos="32 480" stroke="black" type="minipage" width="80" height="11.124" depth="0" valign="top" size="small">\tiny SF $n+2$</text>
+<path matrix="1 0 0 1 240 0" stroke="black">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 240 0" transformations="translations" pos="32 480" stroke="black" type="minipage" width="80" height="11.124" depth="0" valign="top" size="small">\tiny SF $n+3$</text>
+<text matrix="0.15 0 0 0.5 107.2 207" transformations="translations" pos="32 480" stroke="black" type="minipage" width="12" height="8.5512" depth="0" valign="top" size="small">\tiny $n$</text>
+<path matrix="0.493671 0 0 1 167.203 -28" stroke="black" fill="pink">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 151 -30" transformations="translations" pos="32 480" stroke="black" type="minipage" width="40" height="10.9584" depth="0" valign="top" size="small">\tiny$n+4$</text>
+<path matrix="1 0 0 1 320 0" stroke="black">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 320 0" transformations="translations" pos="32 480" stroke="black" type="minipage" width="80" height="11.124" depth="0" valign="top" size="small">\tiny SF $n+4$</text>
+<path stroke="red" arrow="normal/tiny">
+32 480 m
+212 572
+352 480 c
+</path>
+<path stroke="black" cap="1">
+384 464 m
+384 464 l
+</path>
+<path stroke="black" cap="1">
+380 472 m
+380 472 l
+</path>
+<text matrix="1 0 0 1 -16 0" transformations="translations" pos="32 364" stroke="black" type="minipage" width="704" height="72.0944" depth="58.24" valign="top">\tiny\begin{itemize}
+\item The current processing requires approximately 1ms peak in each direction (basically 1 core RX, 1core TX).  The current architecture will work on a single core if the sum of RX and TX procedures is limited to 1ms. It can fit on 2 cores if the sum of RX,TX and PRACH is less than 2ms.
+\item three threads, RX-TX even, RX-TX odd and PRACH. RX-TX blocks until woken by the RU thread with a new RX subframe $n$ that is linked to this eNB process. The RX-TX thread performs ue-specific processing for subframe $n$ and then TX common and ue-specific processing for subframe $n+4$ (frequency-domain generation only).  This insures the data dependency between TX $n+4$ and RX $n$ is respected. The duration of this thread should be less than 2ms which can compensate some jitter on the RX processing.
+\end{itemize}</text>
+<path stroke="black">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text transformations="translations" pos="32 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny SF $n$</text>
+<text transformations="translations" pos="328 512" stroke="red" type="label" width="270.986" height="8.9784" depth="2.976" valign="baseline" size="small">\tiny LTE HARQ periodicity (FDD, TDD can be longer)</text>
+<text matrix="1 0 0 1 96 -88" transformations="translations" pos="32 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny PRACH $n$</text>
+<path matrix="0.7 0 0 1 103.6 -28" stroke="black" fill="lightyellow">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<path matrix="0.15 0 0 1 187.2 -64" stroke="black" fill="lightgreen">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="0.15 0 0 0.5 191.2 153" transformations="translations" pos="32 480" stroke="black" type="minipage" width="68" height="10.9584" depth="0" valign="top" size="small">\tiny $n+1$</text>
+<text matrix="0.15 0 0 0.5 121.2 207" transformations="translations" pos="32 480" stroke="black" type="minipage" width="12" height="8.5512" depth="0" valign="top" size="small">\tiny $n$</text>
+<path matrix="0.493671 0 0 1 249.203 -64" stroke="black" fill="pink">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 233 -66" transformations="translations" pos="32 480" stroke="black" type="minipage" width="40" height="10.9584" depth="0" valign="top" size="small">\tiny$n+5$</text>
+<path matrix="0.7 0 0 1 185.6 -64" stroke="black" fill="lightyellow">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="0.15 0 0 0.5 203.2 173" transformations="translations" pos="32 480" stroke="black" type="minipage" width="32" height="10.9584" depth="0" valign="top" size="small">\tiny $n+1$</text>
+<path stroke="black" arrow="normal/tiny">
+124 424 m
+172 416
+152 392 c
+</path>
+<path stroke="black" arrow="normal/tiny">
+204 424 m
+228 424
+236 416 c
+</path>
+<path matrix="1 0 0 1 0 -12" stroke="black" arrow="normal/tiny">
+192 396 m
+196 416 l
+</path>
+<path matrix="0.15 0 0 1 27.2 -64" stroke="black" fill="lightgreen">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="0.15 0 0 0.5 31.2 153" transformations="translations" pos="32 480" stroke="black" type="minipage" width="68" height="10.9584" depth="0" valign="top" size="small">\tiny $n-1$</text>
+<path matrix="0.493671 0 0 1 89.203 -64" stroke="black" fill="pink">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 73 -66" transformations="translations" pos="32 480" stroke="black" type="minipage" width="40" height="10.9584" depth="0" valign="top" size="small">\tiny$n+3$</text>
+<path matrix="0.7 0 0 1 25.6 -64" stroke="black" fill="lightyellow">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="0.15 0 0 0.5 43.2 173" transformations="translations" pos="32 480" stroke="black" type="minipage" width="32" height="10.9584" depth="0" valign="top" size="small">\tiny $n-1$</text>
+<path matrix="0.7 0 0 1 267.6 -28" stroke="black" fill="lightyellow">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="0.15 0 0 0.5 285.2 209" transformations="translations" pos="32 480" stroke="black" type="minipage" width="56" height="10.9584" depth="0" valign="top" size="small">\tiny $n+2$</text>
+<path matrix="0.493671 0 0 1 329.203 -28" stroke="black" fill="pink">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<text matrix="1 0 0 1 313 -30" transformations="translations" pos="32 480" stroke="black" type="minipage" width="40" height="10.9584" depth="0" valign="top" size="small">\tiny$n+6$</text>
+<path matrix="0.15 0 0 1 271.2 -28" stroke="black" fill="lightgreen">
+32 480 m
+32 464 l
+112 464 l
+112 480 l
+h
+</path>
+<path stroke="black" arrow="normal/tiny">
+284 424 m
+308 424
+316 436 c
+</path>
+<text matrix="0.15 0 0 0.5 229.2 221" transformations="translations" pos="32 480" stroke="black" type="minipage" width="68" height="10.9584" depth="0" valign="top" size="small">\tiny $n+2$</text>
+<path matrix="1 0 0 1 7 6" stroke="black" arrow="normal/tiny">
+268 452 m
+276 436 l
+</path>
+<text matrix="1 0 0 1 63 0" transformations="translations" pos="400 432" stroke="black" type="minipage" width="144" height="10.128" depth="0" valign="top" size="small">\tiny RU thread</text>
+<text matrix="1 0 0 1 63 16" transformations="translations" pos="400 432" stroke="black" type="minipage" width="144" height="11.9544" depth="0" valign="top" size="small">\tiny RX-TX thread (even)</text>
+<path matrix="0.46875 0 0 1 336.5 -32" fill="pink">
+400 448 m
+400 436 l
+528 436 l
+528 448 l
+h
+</path>
+<path matrix="0.46875 0 0 1 276.5 -32" fill="lightyellow">
+400 448 m
+400 436 l
+528 436 l
+528 448 l
+h
+</path>
+<text matrix="1 0 0 1 63 -16" transformations="translations" pos="400 432" stroke="black" type="minipage" width="144" height="11.9544" depth="0" valign="top" size="small">\tiny RX-TX thread (odd)</text>
+<text matrix="1 0 0 1 432 -80" transformations="translations" pos="32 480" stroke="black" type="minipage" width="80" height="10.128" depth="0" valign="top" size="small">\tiny PRACH</text>
+<path matrix="1 0 0 1 -160 -12" stroke="black" arrow="normal/tiny">
+192 396 m
+196 416 l
+</path>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 111 -311" stroke="black" fill="lightgray">
+96 384 m
+96 320 l
+640 320 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 95 -303" stroke="black" fill="lightgray">
+96 384 m
+96 320 l
+640 320 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 87 -295" stroke="black" fill="lightgray">
+96 384 m
+96 320 l
+640 320 l
+640 384 l
+h
+</path>
+<path matrix="1 0 0 1 86 68" stroke="black" fill="lightgray">
+96 384 m
+96 320 l
+640 320 l
+640 384 l
+h
+</path>
+<path matrix="0.232141 0 0 0.927995 612.286 93.6201" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<path matrix="0.573927 0 0 0.908562 397.291 100.149" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<path matrix="1 0 0 0.673921 67.8375 132.347" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="1 0 0 1 161 7" transformations="translations" pos="176 556" stroke="black" type="label" width="412" height="20.9244" depth="6.972" halign="center" valign="baseline">OAI IF1&apos;&apos; Interface (can be NFAPI)</text>
+<text matrix="1 0 0 1 -512 63" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="37.2932" depth="23.38" valign="top">\tiny\begin{itemize}
+\item OAI IF1&apos;&apos; is the interface between the 36.321 Medium-Access (MAC) Layer Procedures and the 36.213 Physical Layer Procedures. It links several PHY instances to one MAC instance.
+\item It is a configurable (dynamically loadable) module which can implement an (N)FAPI P5/P7 or a simpler interface.
+\end{itemize} </text>
+<path matrix="0.441741 0 0 0.919575 158.74 96.2351" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<text matrix="1 0 0 1 -372.87 383.775" pos="596 32" stroke="black" type="label" width="83.256" height="8.3016" depth="0" valign="baseline" size="small">\tiny Random-Access</text>
+<text matrix="1 0 0 1 54.4342 383.743" pos="596 32" stroke="black" type="label" width="35.1312" height="8.3016" depth="0" valign="baseline" size="small">\tiny Events</text>
+<text matrix="1 0 0 1 -216.173 19.612" pos="596 32" stroke="black" type="label" width="150.346" height="14.952" depth="4.176" valign="baseline" size="small">\small PHY procedures</text>
+<text matrix="0 1 -1 0 266.848 -324.389" pos="596 32" stroke="black" type="label" width="110.765" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt initiate\_ra\_proc()}</text>
+<text matrix="0 1 -1 0 290.621 -330.742" pos="596 32" stroke="black" type="label" width="117.118" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt terminate\_ra\_proc()}</text>
+<text matrix="0 1 -1 0 314.394 -311.688" pos="596 32" stroke="black" type="label" width="98.064" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt cancel\_ra\_proc()}</text>
+<text matrix="0 1 -1 0 367.94 -349.796" pos="596 32" stroke="black" type="label" width="136.171" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt phy\_config\_dedicated()}</text>
+<text matrix="0 1 -1 0 412.713 -318.039" pos="596 32" stroke="black" type="label" width="104.414" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt phy\_config\_sib1()}</text>
+<text matrix="0 1 -1 0 436.486 -318.039" pos="596 32" stroke="black" type="label" width="104.414" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt phy\_config\_sib2()}</text>
+<text matrix="0 1 -1 0 460.259 -324.389" pos="596 32" stroke="black" type="label" width="110.765" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt phy\_config\_sib13()}</text>
+<path matrix="1 0 0 0.673921 91.6108 132.064" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.673921 115.384 132.064" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.673921 168.93 132.064" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.673921 213.703 132.064" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.673921 237.476 132.064" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.673921 261.249 132.064" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.673921 302.346 132.064" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 501.848 -379.774" pos="596 32" stroke="black" type="label" width="166.15" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt eNB\_dlsch\_ulsch\_scheduler()}</text>
+<text matrix="0 1 -1 0 524.637 -298.985" pos="596 32" stroke="black" type="label" width="85.3608" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt get\_dcii\_sdu()}</text>
+<path matrix="1 0 0 0.673921 325.134 132.678" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 548.251 -305.336" pos="596 32" stroke="black" type="label" width="91.7112" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt get\_dlsch\_sdu()}</text>
+<path matrix="1 0 0 0.673921 347.923 132.69" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 570.214 -262.656" pos="596 32" stroke="black" type="label" width="49.032" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt rx\_sdu()}</text>
+<path matrix="1 0 0 0.673921 370.711 132.757" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 593.002 -292.635" pos="596 32" stroke="black" type="label" width="79.0104" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt get\_mch\_sdu()}</text>
+<path matrix="1 0 0 0.673921 393.5 132.624" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="0 1 -1 0 701.156 -307.114" pos="596 32" stroke="black" type="label" width="93.4896" height="8.3136" depth="0.984" valign="baseline" size="small">\tiny {\tt SR\_indication()}</text>
+<path matrix="1 0 0 0.673921 501.654 133.147" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="0.494718 0 0 0.92251 268.305 95.0367" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<text matrix="1 0 0 1 -248.565 384.751" pos="596 32" stroke="black" type="label" width="63.9696" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny PHY Config</text>
+<text matrix="1 0 0 1 -92.464 384.743" pos="596 32" stroke="black" type="label" width="56.9952" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny Scheduling</text>
+<text matrix="1 0 0 1 0 -16" transformations="translations" pos="0 416" stroke="black" type="minipage" width="224" height="28.9872" depth="17.04" valign="top" size="small">\small {\tt 36.213/36.321}\\
+{\tt openair2/LAYER2/MAC}</text>
+<text matrix="1 0 0 1 23 -384" transformations="translations" pos="0 448" stroke="black" type="minipage" width="152" height="28.9872" depth="17.04" valign="top" size="small">\small {\tt 36.211/212}\par
+{\tt openair1/PHY}</text>
+<path matrix="1 0 0 1 87 -167" stroke="black" fill="lightgray">
+96 384 m
+96 320 l
+640 320 l
+640 384 l
+h
+</path>
+<text matrix="1 0 0 1 -216.173 147.612" pos="596 32" stroke="black" type="label" width="178.164" height="14.9448" depth="0" valign="baseline" size="small">\small OAI MAC interface</text>
+<text matrix="0 1 -1 0 391.713 -312.039" pos="596 32" stroke="black" type="label" width="98.064" height="8.3184" depth="2.64" valign="baseline" size="small">\tiny {\tt phy\_config\_mib()}</text>
+<path matrix="1 0 0 0.673921 192.703 132.064" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.250151 84.8376 58.5896" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.250151 221.838 58.5896" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.250151 756.838 -125.41" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="1 0 0 0.250151 348.838 58.5896" stroke="black" fill="lightgray" arrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<text matrix="1 0 0 1 -333.87 87.775" pos="596 32" stroke="black" type="label" width="125.146" height="14.9448" depth="0" valign="baseline" size="small">\small UL-Indication</text>
+<text matrix="1 0 0 1 -194.87 87.775" pos="596 32" stroke="black" type="label" width="102.482" height="14.952" depth="4.176" valign="baseline" size="small">\small Config-Req</text>
+<text matrix="1 0 0 1 -69.87 87.775" pos="596 32" stroke="black" type="label" width="132.761" height="14.952" depth="4.176" valign="baseline" size="small">\small Schedule-Resp</text>
+<text matrix="1 0 0 1 -53 0" transformations="translations" pos="104 232" stroke="black" type="minipage" width="216" height="11.816" depth="0" valign="top">\tiny Northbound interface</text>
+<text matrix="1 0 0 1 -53 -80" transformations="translations" pos="104 232" stroke="black" type="minipage" width="216" height="11.816" depth="0" valign="top">\tiny Southbound interface</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 161 7" transformations="translations" pos="176 556" stroke="black" type="label" width="217.12" height="19.3704" depth="0" halign="center" valign="baseline">OAI IF1&apos;&apos; Interface</text>
+<text matrix="1 0 0 2.62963 -511 -694.148" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="229.141" depth="215.712" valign="top">\tiny\begin{itemize}
+\item The PHY end uses three basic messages
+\begin{itemize}
+\item {\tt CONFIG\_REQ}: this provides the cell configuration and UE-specific configuration to the PHY instances. This comprises the following FAPI P5/P7 messages
+\begin{enumerate}
+\item CONFIG.request
+\item UE\_CONFIG.request (**not used in OAI PHY)
+\end{enumerate}
+\item {\tt UL\_INDICATION} This is an uplink indication that sends all UL information received in one TTI, including PRACH, if available. It also provides the subframe indication for the DL scheduler. It maps to the following FAPI P7 messages
+\begin{enumerate}
+\item {\tt SUBFRAME.indication}
+\item {\tt HARQ.indication}
+\item {\tt CRC.indication }  
+\item {\tt RX\_ULSCH.indication} 
+\item {\tt RX\_SR.indication} 
+\item {\tt RX\_CQI.indication} 
+\item {\tt RACH.indication} 
+\item {\tt SRS.indication} 
+\end{enumerate}
+\item {\tt SCHEDULE\_REQUEST} This message contains the scheduling response information and comprises the following FAPI P7 messages
+\begin{enumerate}
+\item {\tt DL\_CONFIG.request}
+\item {\tt UL\_CONFIG.request}
+\item {\tt TX.request}
+\item {\tt HI\_DCI0.request}
+\end{enumerate}
+\end{itemize} 
+\item The module is registered both by PHY and MAC and can implement different types of transport (NFAPI, function call, FAPI over UDP, etc.). During registration, fuction pointers for the different messages are provided for the module to interact with either PHY or MAC or both if they are executing in the same machine. Note that for a networked implementation (e.g. NFAPI), there are north and south components running in different machines.
+\end{itemize} </text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 161 7" transformations="translations" pos="176 556" stroke="black" type="label" width="217.12" height="19.3704" depth="0" halign="center" valign="baseline">OAI IF1&apos;&apos; Interface</text>
+<text matrix="1 0 0 2.62963 -511 -694.148" transformations="translations" pos="512 464" stroke="black" type="minipage" width="732" height="261.064" depth="247.716" valign="top">\small\begin{itemize}
+\item The PHY-layer timing is assumed to be
+\begin{enumerate}
+\item wait for subframe indication $n$ from HW
+\item trigger PRACH if $n$ has PRACH (parallel thread)
+\item trigger UE specific RX procedures for $n$ if $n$ is UL
+\item assemble {\tt UL\_INDICATION} and send to MAC
+\item wait for {\tt SCHEDULE\_REQUEST}
+\item do TX procedures if $n+4$ is TX and RX programming if  $n+4+k$ is UL
+\end{enumerate}
+\item The MAC-layer timing is assumed to be
+\begin{enumerate}
+\item do all UL processing for subframe $n$ if $n$ is UL after unraveling of UL\_INDICATION in MAC module
+\item wait for call to {\tt eNB\_dlsch\_ulsch\_scheduler}
+\item do DL scheduling for $n+4$ if it is DL
+\item do UL scheduling for $n+8$ if it is UL
+\item return from eNB\_dlsch\_ulsch\_scheduler
+\item let MAC module form SCHEDULE\_REQUEST
+\end{enumerate}
+\end{itemize} </text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1 0 0 1 86 -220" stroke="black" fill="lightgray">
+96 384 m
+96 320 l
+640 320 l
+640 384 l
+h
+</path>
+<path matrix="0.232141 0 0 0.927995 612.286 -194.38" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<path matrix="0.573927 0 0 0.908562 397.291 -187.851" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<text matrix="1 0 0 1 161 7" transformations="translations" pos="176 556" stroke="black" type="label" width="115.455" height="19.3704" depth="0" halign="center" valign="baseline">OAI MAC</text>
+<path matrix="0.441741 0 0 0.919575 158.74 -191.765" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<text matrix="1 0 0 1 -372.87 95.775" pos="596 32" stroke="black" type="label" width="83.256" height="8.3016" depth="0" valign="baseline" size="small">\tiny Random-Access</text>
+<text matrix="1 0 0 1 54.4342 95.743" pos="596 32" stroke="black" type="label" width="35.1312" height="8.3016" depth="0" valign="baseline" size="small">\tiny Events</text>
+<path matrix="0.494718 0 0 0.92251 268.305 -192.963" stroke="black" fill="1">
+128 368 m
+128 336 l
+352 336 l
+352 368 l
+h
+</path>
+<text matrix="1 0 0 1 -248.565 96.751" pos="596 32" stroke="black" type="label" width="63.9696" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny PHY Config</text>
+<text matrix="1 0 0 1 -92.464 96.743" pos="596 32" stroke="black" type="label" width="56.9952" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny Scheduling</text>
+<text matrix="1 0 0 1 16 -368" transformations="translations" pos="0 416" stroke="black" type="minipage" width="224" height="28.0824" depth="16.152" valign="top" size="small">\small {\tt 36.321}\\
+{\tt openair2/LAYER2/MAC}</text>
+<path matrix="1 0 0 0.250151 756.838 -125.41" stroke="black" fill="lightgray" rarrow="normal/small">
+175.695 380 m
+176.42 128 l
+</path>
+<path matrix="0.5 0 0 1 241 0" stroke="black">
+176 496 m
+176 384 l
+400 384 l
+400 496 l
+h
+</path>
+<path matrix="1 0 0 1 320 0" stroke="black">
+176 496 m
+176 384 l
+400 384 l
+400 496 l
+h
+</path>
+<text matrix="1 0 0 1 -228.87 399.775" pos="596 32" stroke="black" type="label" width="42.7896" height="14.9448" depth="0" valign="baseline" size="small">\small RRC</text>
+<path stroke="black" arrow="normal/normal" rarrow="normal/normal">
+384 384 m
+272 144 l
+</path>
+<path stroke="black" arrow="normal/normal" rarrow="normal/normal">
+384 384 m
+384 144 l
+</path>
+<path stroke="black" arrow="normal/normal" rarrow="normal/normal">
+384 384 m
+528 144 l
+</path>
+<path stroke="black" arrow="normal/normal" rarrow="normal/normal">
+608 384 m
+528 144 l
+</path>
+<text matrix="1 0 0 1 -4.87 399.775" pos="596 32" stroke="black" type="label" width="40.5144" height="14.9448" depth="0" valign="baseline" size="small">\small RLC</text>
+<path matrix="1 0 0 1 -128 -128" stroke="black">
+176 496 m
+176 384 l
+400 384 l
+400 496 l
+h
+</path>
+<text matrix="1 0 0 1 -495.87 271.775" pos="596 32" stroke="black" type="label" width="116.184" height="14.952" depth="4.176" valign="baseline" size="small">\small Preprocessor</text>
+<path stroke="black" arrow="normal/normal" rarrow="normal/normal">
+160 256 m
+528 144 l
+</path>
+<path stroke="black" arrow="normal/normal" rarrow="normal/normal">
+272 312 m
+608 384 l
+</path>
+<path stroke="black" pen="heavier">
+472 504 m
+472 232 l
+152 232 l
+152 40 l
+728 40 l
+736 40 l
+736 504 l
+h
+</path>
+<text matrix="1 0 0 1 504 72" transformations="translations" pos="0 416" stroke="black" type="minipage" width="224" height="28.0824" depth="16.152" valign="top" size="small">\small {\tt 36.322}\\
+{\tt openair2/LAYER2/RLC}</text>
+<text matrix="1 0 0 1 32 0" transformations="translations" pos="0 416" stroke="black" type="minipage" width="224" height="28.0824" depth="16.152" valign="top" size="small">\small {\tt user customizable scheduling module}</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 199 -16" transformations="translations" pos="176 556" stroke="black" type="label" width="163.19" height="19.3928" depth="5.404" halign="center" valign="baseline">TX Precoding</text>
+<text matrix="1 0 0 1 0 12" transformations="translations" pos="16 512" stroke="black" type="minipage" width="704" height="162.125" depth="150.504" valign="top" size="small">\small\begin{itemize}
+\item Spatio-temporal filtering for muli-cell (vCell) and multi-user transmission. Input and output are frequency-domain signals.
+\item can be applied to Rel-10/11/12/13 physical channels and Rel-8 common channels
+\begin{itemize}
+\item UE-specific precoding (TM7-10)
+\item vCell-specific precoding (PDCCH + TM1-6) for groups of UEs
+\item PMCH vCells
+\end{itemize}
+\item Precoding applicable to
+\begin{enumerate}
+\item indoor DAS
+\item outdoor co-localized arrays (e,g, Massive-MIMO)
+\item outdoor CoMP
+\end{enumerate}
+\end{itemize}</text>
+<path matrix="0.470395 0 0 0.4 159.158 0" stroke="black" fill="lightgray">
+208 480 m
+208 80 l
+512 80 l
+512 480 l
+h
+</path>
+<path matrix="1 0 0 1 49 -275" stroke="pink" pen="fat" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 49 -323" stroke="darkgray" pen="fat" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 49 -387" stroke="gold" pen="fat" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 0 -37" stroke="lightcyan" fill="gold">
+400 160
+480 192
+528 160
+400 160
+400 160 u
+</path>
+<path matrix="0.866025 -0.5 0.5 0.866025 9.3796 241.005" stroke="lightyellow" fill="darkgray">
+400 96
+448 128
+512 144
+576 96
+496 80
+400 96
+400 96 u
+</path>
+<path stroke="black">
+480 160 m
+480 160 l
+</path>
+<path stroke="black">
+496 160 m
+496 160 l
+</path>
+<path matrix="0.866025 0.5 -0.5 0.866025 102.38 -159.995" stroke="lightyellow" fill="pink">
+400 96
+448 128
+512 144
+576 96
+496 80
+400 96
+400 96 u
+</path>
+<text transformations="translations" pos="512 144" stroke="black" type="label" width="28.4928" height="14.9448" depth="0" valign="baseline" size="small">\small UE</text>
+<text matrix="1 0 0 1 16 64" transformations="translations" pos="512 144" stroke="black" type="label" width="44.7144" height="14.9448" depth="0" valign="baseline" size="small">\small vCell</text>
+<text matrix="1 0 0 1 32 -96" transformations="translations" pos="512 144" stroke="black" type="label" width="44.7144" height="14.9448" depth="0" valign="baseline" size="small">\small vCell</text>
+<text matrix="1 0 0 1 0 -22" transformations="translations" pos="256 144" stroke="black" type="minipage" width="144" height="16.6224" depth="4.632" valign="top" size="small">TX Precoding</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<path layer="alpha" matrix="1.18986 0 0 0.837002 -253.249 49.0308" stroke="0" fill="lightyellow">
+608 516 m
+607 37 l
+679 37 l
+680 516 l
+h
+</path>
+<path matrix="1 0 0 1 -133 -21" stroke="black" fill="white">
+632 360 m
+632 188 l
+660 188 l
+660 360 l
+h
+</path>
+<text matrix="1 0 0 1 199 -16" transformations="translations" pos="176 556" stroke="black" type="label" width="341.835" height="20.9244" depth="6.972" halign="center" valign="baseline">TX Precoding (to RF device)</text>
+<path matrix="1 0 0 1 -63 0" stroke="black" fill="lightgray">
+208 480 m
+208 80 l
+512 80 l
+512 480 l
+h
+</path>
+<path matrix="1 0 0 1 -63 -35" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 -63 -99" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 -63 -291" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<text matrix="1 0 0 1 -63 -15" transformations="translations" pos="96 464" stroke="black" type="minipage" width="81.789" height="15.2856" depth="3.312" valign="top" size="small">\tt eNB[0]</text>
+<text matrix="1 0 0 1 -63 -79" transformations="translations" pos="96 464" stroke="black" type="minipage" width="81.789" height="15.2856" depth="3.312" valign="top" size="small">\tt eNB[1]</text>
+<text matrix="1 0 0 1 -89.2484 -270.814" transformations="translations" pos="96 464" stroke="black" type="minipage" width="129.789" height="21.324" depth="9.36" valign="top" size="small">\tt eNB[CC\_max]</text>
+<path matrix="1 0 0 1 424.037 -0.368" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 424.714 -64.365" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 424.714 -320.365" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 424.815 -16.205" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 424.816 -16.2378" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 424.816 -80.2378" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 423.542 -304.438" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1.5 0 0 1.06426 -160 -29.8163" stroke="black">
+528 464 m
+528 416 l
+592 416 l
+592 464 l
+h
+</path>
+<text matrix="1 0 0 1 110 -15" transformations="translations" pos="528 464" stroke="black" type="minipage" width="64" height="13.6632" depth="1.68" valign="top" size="small">\tiny\tt rf\_device[0]</text>
+<path matrix="1.49204 0 0 1 -156.224 -64" stroke="black">
+528 464 m
+528 416 l
+592 416 l
+592 464 l
+h
+</path>
+<text matrix="1 0 0 1 109.571 -78" transformations="translations" pos="528 464" stroke="black" type="minipage" width="64" height="13.6632" depth="1.68" valign="top" size="small">\tiny\tt rf\_device[1]</text>
+<path matrix="1.53737 0 0 1 -180.161 -304" stroke="black">
+528 464 m
+528 416 l
+592 416 l
+592 464 l
+h
+</path>
+<text matrix="1 0 0 1 107.571 -317" transformations="translations" pos="528 464" stroke="black" type="minipage" width="64" height="13.6632" depth="1.68" valign="top" size="small">\tiny\tt rf\_device[N-1]</text>
+<path matrix="2.60074 0 0 1 -307.342 -22" stroke="black" fill="lightblue">
+192 432 m
+192 368 l
+272 368 l
+272 432 l
+h
+</path>
+<path matrix="2.60024 0 0 1 -307.263 -118" stroke="black" fill="lightblue">
+192 432 m
+192 368 l
+272 368 l
+272 432 l
+h
+</path>
+<path matrix="2.60024 0 0 1 -307.263 -214" stroke="black" fill="lightblue">
+192 432 m
+192 368 l
+272 368 l
+272 432 l
+h
+</path>
+<text matrix="1 0 0 1 0 -33" transformations="translations" pos="192 432" stroke="black" type="minipage" width="208" height="24.4656" depth="12.528" valign="top" size="small" style="center">\tiny\tt common signal precoding(vCell)\\ PBCH,PSS/SSS,PCFICH/PHICH/PDCCH\\
+PDSCH - TM1-6</text>
+<text matrix="1 0 0 1 0 -129" transformations="translations" pos="192 432" stroke="black" type="minipage" width="208" height="24.7944" depth="12.864" valign="top" size="small" style="center">\tiny\tt UE-specific signal precoding(vCell)\\ 
+UE-RS,PDSCH - TM7-10</text>
+<text matrix="1 0 0 1 0 -243" transformations="translations" pos="192 432" stroke="black" type="minipage" width="208" height="10.9584" depth="0" valign="top" size="small" style="center">\tiny\tt PMCH precoding</text>
+<path stroke="black" arrow="normal/normal">
+145 413.44 m
+192 384 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 413.44 m
+192 288 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 413.44 m
+192 192 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 349.44 m
+192 384 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 349.44 m
+191.982 288.048 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 349.44 m
+191.982 192.084 l
+</path>
+<path stroke="black">
+145 157.44 m
+192 384 l
+192 384 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 157.44 m
+191.982 288.048 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 157.44 m
+191.982 192.084 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400 384 m
+449 447.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 431.796 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 383.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 367.763 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 143.57 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 127.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400 288 m
+449 383.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+449 367.763 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+449 143.57 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+449 127.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400 192 m
+449 447.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+449 447.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+448.966 431.763 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 192.005 m
+449 367.763 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 192.005 m
+449 143.57 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 192.005 m
+449 127.637 l
+</path>
+<text matrix="0 1 -1 0 517.304 -343.285" pos="596 32" stroke="black" type="label" width="116.59" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny phy\_vars\_eNB.txdataF</text>
+<text matrix="0 1 -1 0 569.304 -343.285" pos="596 32" stroke="black" type="label" width="109.325" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny phy\_vars\_eNB.txdata</text>
+<path matrix="1 0 0 1 -176 -16" stroke="black" arrow="normal/tiny">
+632 264.556 m
+671.833 265 l
+</path>
+<text matrix="0 1 -1 0 779.067 -428.933" pos="636 280" stroke="black" type="minipage" width="84" height="16.6824" depth="4.704" valign="top" size="small" style="center">\setstretch{.5}\tt\tiny do\_ofdm\_mod\_rt()\par 36.211</text>
+</page>
+<page>
+<layer name="alpha"/>
+<view layers="alpha" active="alpha"/>
+<text layer="alpha" matrix="1 0 0 1 199 -16" transformations="translations" pos="176 556" stroke="black" type="label" width="499.453" height="20.9244" depth="6.972" halign="center" valign="baseline">TX Precoding (to IF device, NGFI\_IFv4p5)</text>
+<path matrix="1 0 0 1 -63 0" stroke="black" fill="lightgray">
+208 480 m
+208 80 l
+512 80 l
+512 480 l
+h
+</path>
+<path matrix="1 0 0 1 -63 -35" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 -63 -99" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 -63 -291" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<text matrix="1 0 0 1 -63 -15" transformations="translations" pos="96 464" stroke="black" type="minipage" width="89.789" height="15.2856" depth="3.312" valign="top" size="small">\tt eNB[0]</text>
+<text matrix="1 0 0 1 -63 -79" transformations="translations" pos="96 464" stroke="black" type="minipage" width="97.789" height="15.2856" depth="3.312" valign="top" size="small">\tt eNB[1]</text>
+<text matrix="1 0 0 1 -89.2484 -270.814" transformations="translations" pos="96 464" stroke="black" type="minipage" width="137.789" height="15.2856" depth="3.312" valign="top" size="small">\tt eNB[CC\_max]</text>
+<path matrix="1 0 0 1 320.037 -0.368" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 320.714 -64.365" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 320.714 -320.365" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 320.815 -16.205" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 320.816 -16.2378" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 320.816 -80.2378" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1 0 0 1 319.542 -304.438" stroke="black" arrow="normal/normal">
+128 448 m
+208 448.44 l
+</path>
+<path matrix="1.5 0 0 1.06426 -264 -29.8163" stroke="black">
+528 464 m
+528 416 l
+592 416 l
+592 464 l
+h
+</path>
+<text matrix="1 0 0 1 6 -15" transformations="translations" pos="528 464" stroke="black" type="minipage" width="88" height="10.6272" depth="0" valign="top" size="small">\tiny\tt if\_device[0]</text>
+<path matrix="1.49204 0 0 1 -260.224 -64" stroke="black">
+528 464 m
+528 416 l
+592 416 l
+592 464 l
+h
+</path>
+<text matrix="1 0 0 1 5.571 -78" transformations="translations" pos="528 464" stroke="black" type="minipage" width="88" height="10.6272" depth="0" valign="top" size="small">\tiny\tt if\_device[1]</text>
+<path matrix="1.53737 0 0 1 -284.161 -304" stroke="black">
+528 464 m
+528 416 l
+592 416 l
+592 464 l
+h
+</path>
+<text matrix="1 0 0 1 3.571 -317" transformations="translations" pos="528 464" stroke="black" type="minipage" width="96" height="10.6272" depth="0" valign="top" size="small">\tiny\tt if\_device[N-1]</text>
+<path matrix="2.60074 0 0 1 -307.342 -22" stroke="black" fill="lightblue">
+192 432 m
+192 368 l
+272 368 l
+272 432 l
+h
+</path>
+<path matrix="2.60024 0 0 1 -307.263 -118" stroke="black" fill="lightblue">
+192 432 m
+192 368 l
+272 368 l
+272 432 l
+h
+</path>
+<path matrix="2.60024 0 0 1 -307.263 -214" stroke="black" fill="lightblue">
+192 432 m
+192 368 l
+272 368 l
+272 432 l
+h
+</path>
+<text matrix="1 0 0 1 0 -33" transformations="translations" pos="192 432" stroke="black" type="minipage" width="208" height="24.4656" depth="12.528" valign="top" size="small" style="center">\tiny\tt common signal precoding(vCell)\\ PBCH,PSS/SSS,PCFICH/PHICH/PDCCH\\
+PDSCH - TM1-6</text>
+<text matrix="1 0 0 1 0 -129" transformations="translations" pos="192 432" stroke="black" type="minipage" width="208" height="24.7944" depth="12.864" valign="top" size="small" style="center">\tiny\tt UE-specific signal precoding(vCell)\\ 
+UE-RS,PDSCH - TM7-10</text>
+<text matrix="1 0 0 1 0 -243" transformations="translations" pos="192 432" stroke="black" type="minipage" width="208" height="10.9584" depth="0" valign="top" size="small" style="center">\tiny\tt PMCH precoding</text>
+<path stroke="black" arrow="normal/normal">
+145 413.44 m
+192 384 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 413.44 m
+192 288 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 413.44 m
+192 192 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 349.44 m
+192 384 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 349.44 m
+191.982 288.048 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 349.44 m
+191.982 192.084 l
+</path>
+<path stroke="black">
+145 157.44 m
+192 384 l
+192 384 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 157.44 m
+191.982 288.048 l
+</path>
+<path stroke="black" arrow="normal/normal">
+145 157.44 m
+191.982 192.084 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400 384 m
+449 447.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 431.796 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 383.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 367.763 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 143.57 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.059 384.077 m
+449 127.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400 288 m
+449 383.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+449 367.763 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+449 143.57 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+449 127.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400 192 m
+449 447.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+449 447.637 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 288.002 m
+448.966 431.763 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 192.005 m
+449 367.763 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 192.005 m
+449 143.57 l
+</path>
+<path stroke="black" arrow="normal/normal">
+400.001 192.005 m
+449 127.637 l
+</path>
+<path stroke="black" cap="1">
+448 544 m
+448 544 l
+</path>
+<path stroke="black" cap="1">
+432 544 m
+432 544 l
+</path>
+<path matrix="1 0 0 1 0 8" stroke="black" arrow="normal/normal">
+624 432 m
+672 432 l
+</path>
+<path matrix="1 0 0 1 0 -56" stroke="black" arrow="normal/normal">
+624 432 m
+672 432 l
+</path>
+<path matrix="1 0 0 1 1 -296" stroke="black" arrow="normal/normal">
+624 432 m
+672 432 l
+</path>
+<text matrix="1 0 0 1 -6 -14" transformations="translations" pos="672 464" stroke="black" type="label" width="68.7072" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny NGFI\_IFv4p5</text>
+<text matrix="1 0 0 1 -6 -78" transformations="translations" pos="672 464" stroke="black" type="label" width="68.7072" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny NGFI\_IFv4p5</text>
+<text matrix="1 0 0 1 -6 -318" transformations="translations" pos="672 464" stroke="black" type="label" width="68.7072" height="8.3232" depth="2.304" valign="baseline" size="small">\tiny NGFI\_IFv4p5</text>
+</page>
+</ipe>
diff --git a/targets/DOCS/oai_L1_L2_procedures.pdf b/targets/DOCS/oai_L1_L2_procedures.pdf
old mode 100755
new mode 100644
index 369efc3b479b960c74e89b7e73e427a15cea8de9..4e8059f503d8a4fedd634dc014c4f572275a5be8
Binary files a/targets/DOCS/oai_L1_L2_procedures.pdf and b/targets/DOCS/oai_L1_L2_procedures.pdf differ
diff --git a/targets/Makefile b/targets/Makefile
deleted file mode 100644
index b604898d2aef8230ad3a23c4d669a6a9303079eb..0000000000000000000000000000000000000000
--- a/targets/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-build: 
-	./build_oai.bash -c  -m
-
-build_rtai:
-	./build_oai.bash -c -b -eRTAI -tSOFTMODEM  -m
-
-build_usrp_rtai:
-	./build_oai.bash -c -b -eRTAI -tSOFTMODEM -wUSRP -m
-
-
-help:
-	@echo make check1 performs a simple sanity check
-	@echo make check2 performs another simple sanity check
-	@echo make check does both the above checks
-
-all: help
-
-check1:
-	@echo Doing 1 eNB 1 UE test
-	(cd SIMU/EXAMPLES/VIRT_EMUL_1eNB && make one_eNB_one_UE )
-
-check2:
-	@echo Doing 1 eNB 4 UE test
-	(cd SIMU/EXAMPLES/VIRT_EMUL_1eNB && make one_eNB_four_UE )
-
-install:
-	@echo Generating ASN1 files
-	@sh SCRIPTS/install_asn1.sh 
-
-check: check1 check2
-
-clean:
-	(cd SIMU/USER && make clean)
diff --git a/targets/Makefile.common b/targets/Makefile.common
index 042a36bf4562946b77087d306e123838fd28c714..ac0771770ba8c4737370a8f7670a71be2dc1b01e 100644
--- a/targets/Makefile.common
+++ b/targets/Makefile.common
@@ -86,7 +86,6 @@ endif
 
 ifeq ($(ENABLE_ITTI),1)
 COMMON_CFLAGS		+= -DENABLE_ITTI
-COMMON_CFLAGS		+= -DUSER_MODE
 COMMON_CFLAGS		+= -I$(OPENAIR1_DIR)
 COMMON_CFLAGS		+= -I$(OPENAIR2_DIR)/NAS
 COMMON_CFLAGS 	 	+= $(L2_incl)
diff --git a/targets/PROJECTS/E-MBMS/build_all.bash b/targets/PROJECTS/E-MBMS/build_all.bash
index a4f00d49af345d04919e0d90321034697f27c7fa..bac9b33736853980953114bfb326de1d72a79131 100755
--- a/targets/PROJECTS/E-MBMS/build_all.bash
+++ b/targets/PROJECTS/E-MBMS/build_all.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
@@ -61,8 +61,8 @@ echo_success "\n###############################"
 echo_success "# COMPILE oaisim"
 echo_success "###############################"
 cd $OPENAIR_TARGETS/SIMU/USER
-echo_success "Executing: make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1  Rel10=1 -j`grep -c ^processor /proc/cpuinfo `"
-make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1  Rel10=1 -j`grep -c ^processor /proc/cpuinfo `
+echo_success "Executing: make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1  Rel10=1 -j`grep -c ^processor /proc/cpuinfo `"
+make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1  Rel10=1 -j`grep -c ^processor /proc/cpuinfo `
 if [[ $? -eq 2 ]] ; then
     exit 1
 fi
diff --git a/targets/PROJECTS/E-MBMS/start_enb.bash b/targets/PROJECTS/E-MBMS/start_enb.bash
index 5e8d8e4b4578b67f3258a2d6f0912257c161621f..8e62c8e09c3086253dcddd66d758e16a4d88fa1d 100755
--- a/targets/PROJECTS/E-MBMS/start_enb.bash
+++ b/targets/PROJECTS/E-MBMS/start_enb.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/PROJECTS/E-MBMS/start_ue.bash b/targets/PROJECTS/E-MBMS/start_ue.bash
index 25e2816fcc3bebbf262c6a81df16d02705053d73..7e856a8ef453c0b556192ab52256ce915b21f857 100755
--- a/targets/PROJECTS/E-MBMS/start_ue.bash
+++ b/targets/PROJECTS/E-MBMS/start_ue.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/PROJECTS/E-MBMS/utils.bash b/targets/PROJECTS/E-MBMS/utils.bash
index 0da6363a1952b00d6258c5e336515d551fa584a3..a2fe556c2964d8be36313e89493542fd2dc3adf9 100755
--- a/targets/PROJECTS/E-MBMS/utils.bash
+++ b/targets/PROJECTS/E-MBMS/utils.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf
index 9d1aa464e98fb1ebf868399a11d1de1bdedee4b8..cfbfa51cab275669015604756f7e00f9436121e1 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
@@ -50,7 +50,7 @@ eNBs =
       prach_zero_correlation  			      = 1;
       prach_freq_offset       			      = 2;
       pucch_delta_shift       			      = 1;
-      pucch_nRB_CQI           			      = 1;
+      pucch_nRB_CQI           			      = 0;
       pucch_nCS_AN            			      = 0;
       pucch_n1_AN             			      = 32;
       pdsch_referenceSignalPower 			      = -27;
@@ -190,6 +190,16 @@ RUs = (
     }
 );  
 
+NETWORK_CONTROLLER :
+{
+    FLEXRAN_ENABLED        = "no";
+    FLEXRAN_INTERFACE_NAME = "lo";
+    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_PORT           = 2210;
+    FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
+    FLEXRAN_AWAIT_RECONF   = "no";
+};
+
      log_config :
      {
        global_log_level                      ="info";
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf
index f97cd0ad8ba0c0e4a82d1c11520dfea2a71634cc..9393872b308ad72f67f4128a47a64e5460193b02 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf
@@ -1,3 +1,20 @@
+log_config = {
+  global_log_level                      ="debug";
+  global_log_verbosity                  ="medium";
+  hw_log_level                          ="info";
+  hw_log_verbosity                      ="medium";
+  phy_log_level                         ="info";
+  phy_log_verbosity                     ="low";
+  mac_log_level                         ="info";
+  mac_log_verbosity                     ="medium";
+  rlc_log_level                         ="info";
+  rlc_log_verbosity                     ="medium";
+  pdcp_log_level                        ="info";
+  pdcp_log_verbosity                    ="medium";
+  rrc_log_level                         ="info";
+  rrc_log_verbosity                     ="medium";
+};
+
 L1s = (
     	{
 	num_cc = 1;
@@ -6,9 +23,9 @@ L1s = (
       	remote_n_address = "127.0.0.2";
     	local_n_address  = "127.0.0.1"; 
     	local_n_portc    = 50000;	
-    	remote_n_portc   = 50000;
-    	local_n_portd    = 50001;	
-    	remote_n_portd   = 50001;
+        remote_n_portc   = 50001;
+        local_n_portd    = 50010;
+        remote_n_portd   = 50011;
         }  
 );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf
index 1e2cd126168553bad3d65b67b331a063a90da2d7..bc2b3b219c316d8750846a61a16d96aeb90e926a 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -10,7 +10,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
@@ -50,7 +50,7 @@ eNBs =
       prach_zero_correlation  			      = 1;
       prach_freq_offset       			      = 2;
       pucch_delta_shift       			      = 1;
-      pucch_nRB_CQI           			      = 1;
+      pucch_nRB_CQI           			      = 0;
       pucch_nCS_AN            			      = 0;
       pucch_n1_AN             			      = 32;
       pdsch_referenceSignalPower 			      = -27;
@@ -156,8 +156,25 @@ eNBs =
         ENB_IPV4_ADDRESS_FOR_S1U                 = "127.0.0.5/24";
         ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
     };
+  }
+);
 
-    log_config :
+MACRLCs = (
+	{
+	num_cc = 1;
+      	local_s_if_name  = "lo";			  
+      	remote_s_address = "127.0.0.1";
+    	local_s_address  = "127.0.0.2"; 
+    	local_s_portc    = 50001;	
+    	remote_s_portc   = 50000;
+    	local_s_portd    = 50011;	
+    	remote_s_portd   = 50010;
+	tr_s_preference = "nfapi";
+	tr_n_preference = "local_RRC";
+        }  
+);
+
+log_config =
     {
       global_log_level                      ="info";
       global_log_verbosity                  ="medium";
@@ -174,21 +191,3 @@ eNBs =
       rrc_log_level                         ="info";
       rrc_log_verbosity                     ="medium";
    };
-  }
-);
-
-MACRLCs = (
-	{
-	num_cc = 1;
-      	local_s_if_name  = "lo";			  
-      	remote_s_address = "127.0.0.1";
-    	local_s_address  = "127.0.0.2"; 
-    	local_s_portc    = 50000;	
-    	remote_s_portc   = 50000;
-    	local_s_portd    = 50001;	
-    	remote_s_portd   = 50001;
-	tr_s_preference = "nfapi";
-	tr_n_preference = "local_RRC";
-        }  
-);
-
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.conf
index c3c9629bbcdbac60d8cec931806bc1ad76c00d7a..42ab1e81c73435fd281af578355a27dcbc81b1ff 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -13,7 +13,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
@@ -53,7 +53,7 @@ eNBs =
       prach_zero_correlation  			      = 1;
       prach_freq_offset       			      = 2;
       pucch_delta_shift       			      = 1;
-      pucch_nRB_CQI           			      = 1;
+      pucch_nRB_CQI           			      = 0;
       pucch_nCS_AN            			      = 0;
       pucch_n1_AN             			      = 32;
       pdsch_referenceSignalPower 			      = -27;
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf
index e877e4d1ddd969ac8a0a509ae8655a7e0100190c..aacc87e5b0c49c18d2432224e849121879a48b8a 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf
@@ -1,4 +1,4 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
 # Asn1_verbosity, choice in: none, info, annoying
 Asn1_verbosity = "none";
 
@@ -13,7 +13,7 @@ eNBs =
 
     cell_type =  "CELL_MACRO_ENB";
 
-    eNB_name  =  "eNB_Eurecom_LTEBox";
+    eNB_name  =  "eNB-Eurecom-LTEBox";
 
     // Tracking area code, 0x0000 and 0xfffe are reserved values
     tracking_area_code  =  "1";
@@ -53,7 +53,7 @@ eNBs =
       prach_zero_correlation  			      = 1;
       prach_freq_offset       			      = 2;
       pucch_delta_shift       			      = 1;
-      pucch_nRB_CQI           			      = 1;
+      pucch_nRB_CQI           			      = 0;
       pucch_nCS_AN            			      = 0;
       pucch_n1_AN             			      = 32;
       pdsch_referenceSignalPower 			      = -27;
@@ -197,13 +197,13 @@ RUs = (
 );  
 
 log_config = { 
-      global_log_level                      ="debug";
+      global_log_level                      ="info";
       global_log_verbosity                  ="medium";
       hw_log_level                          ="info";
       hw_log_verbosity                      ="medium";
-      phy_log_level                         ="debug";
+      phy_log_level                         ="info";
       phy_log_verbosity                     ="medium";
-      mac_log_level                         ="debug";
+      mac_log_level                         ="info";
       mac_log_verbosity                     ="high";
       rlc_log_level                         ="info";
       rlc_log_verbosity                     ="medium";
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf
index af262223f01f574c3890062c85192e7fce2156d9..24ae36a0a4c7c671f0cc4ad4754f1d6b233397a6 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf
@@ -17,3 +17,20 @@ RUs = (
     }
 );  
 
+log_config = { 
+      global_log_level                      ="debug";
+      global_log_verbosity                  ="medium";
+      hw_log_level                          ="info";
+      hw_log_verbosity                      ="medium";
+      phy_log_level                         ="debug";
+      phy_log_verbosity                     ="medium";
+      mac_log_level                         ="debug";
+      mac_log_verbosity                     ="high";
+      rlc_log_level                         ="info";
+      rlc_log_verbosity                     ="medium";
+      pdcp_log_level                        ="info";
+      pdcp_log_verbosity                    ="medium";
+      rrc_log_level                         ="info";
+      rrc_log_verbosity                     ="medium";
+};
+
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/interfaces.bash b/targets/PROJECTS/GENERIC-LTE-EPC/interfaces.bash
index 4c753dc3728a8be6c769ef9513a89781a8f8a43c..bfcae67e4a9c4077c9275313020b2b2d76337029 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/interfaces.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/interfaces.bash
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/networks.bash b/targets/PROJECTS/GENERIC-LTE-EPC/networks.bash
index 8e1538599f0571a61c319c994be27b7f27adead9..6db4c9f58039b988ea61472e88ff54aa6c3a73fd 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/networks.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/networks.bash
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/start_enb_and_ue_virt.bash b/targets/PROJECTS/GENERIC-LTE-EPC/start_enb_and_ue_virt.bash
index 6ea2d5bb0afe0efc6d64bc08b06b5e1c503b45bc..1c6d87bc8fe1db5b216a8f0e4482399bdc7d8096 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/start_enb_and_ue_virt.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/start_enb_and_ue_virt.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/start_ue.bash b/targets/PROJECTS/GENERIC-LTE-EPC/start_ue.bash
index ff16e27982a0e42954149bab6d3dbbf938bbf1f2..8b76dc9cc0fea4f0a7d53d3d0b8c136c25d3d737 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/start_ue.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/start_ue.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/utils.bash b/targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
index 23231f2fe6ca3067e738a353f65409e1f2ed7754..93441ec9e9aaeca3fe1ae7b460eedff6ae3f6aae 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/virtual_box.bash b/targets/PROJECTS/GENERIC-LTE-EPC/virtual_box.bash
index 7813f4edea048dc8364720edd3eb0f47f05ad7bf..72fcea2281b19194e1067b15260a8668c668421b 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/virtual_box.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/virtual_box.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/RT/Makefile b/targets/RT/Makefile
deleted file mode 100644
index 1be49d2db80ce4595fd0263eebb15f35c2aa2163..0000000000000000000000000000000000000000
--- a/targets/RT/Makefile
+++ /dev/null
@@ -1,124 +0,0 @@
-# command line flags are automatically exported and thus passed down to any sub-make. 
-# here we set the default flags in case on command line flags are provided
-# these flags have to be explicitely exported so that the sub-make is aware of them
-
-
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-ifndef OPENAIR_LTE
-export OPENAIR_LTE=1
-export OPENAIR_EMU=0
-endif
-
-ifndef OPENAIR1
-export OPENAIR1=0
-endif
-
-ifndef OPENAIR2
-export OPENAIR2=0
-endif
-
-ifndef OPENAIR3
-export OPENAIR3=0
-endif
-
-ifndef EMOS
-export EMOS=0
-endif
-
-ifndef rrc_cellular
-export rrc_cellular = 0
-export rrc_cellular_eNB = 0
-export rrc_cellular_UE = 0
-else
- export rrc_cellular = 1	
-  ifeq ($(eNB_flag),1)
-    export rrc_cellular_eNB=1
-  endif
-  ifeq ($(UE_flag),1)
-    export rrc_cellular_UE=1
-  endif
-endif
-
-all: openair_rf_cbmimo1_softmodem.ko asn1_msg_kern.ko nasmesh.ko rb_tool openair_rf scope
-
-openair_rf_cbmimo1_softmodem.ko:  
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
-
-oai_user_cbmimo1.ko:
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 BIT8_TX=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
-
-oai_user_exmimo.ko:
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
-
-asn1_msg_kern.ko:
-	(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) -C $(KERNEL_DIR)/build V=0 M=`pwd` RTAI=1 -j2 && mv asn1_msg_kern.ko $(CURDIR)/asn1_msg_kern.ko)
-
-nasmesh.ko:
-	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build M=`pwd` && mv nasmesh.ko $(CURDIR)/nasmesh.ko)
-
-rb_tool:
-	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
-
-openair_rf:
-	(cd $(OPENAIR1_DIR)/USERSPACE_TOOLS/OPENAIR_RF && $(MAKE) clean CBMIMO1=1 && $(MAKE) all CBMIMO1=1 && $(MAKE) clean CBMIMO1=1)
-
-scope:
-	(cd $(OPENAIR1_DIR)/USERSPACE_TOOLS/SCOPE && $(MAKE) clean && $(MAKE) all && $(MAKE) clean )	
-
-#Remove all but source files
-cleanall: 
-	(cd $(OPENAIR1_DIR) && $(MAKE) cleanall)
-	(cd $(OPENAIR2_DIR) && $(MAKE) cleanall)
-
-fifos:
-	@for i in `seq 0 64`;\
-	do \
-	have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
-	if [ "$$have_rtfX" -eq 0 ] ;then \
-	mknod -m 666 /dev/rtf$$i c 150 $$i; \
-	fi;\
-	done
-
-openair0:
-	mknod /dev/openair0 c 127 0
-	chmod a+rw /dev/openair0
-
-install_oai_user:
-	make fifos
-	insmod openair_rf_softmodem.ko
-
-updatefw:
-	$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 
-
-boot_exmimo:
-	sudo make install_oai_user
-	$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 
-	sleep 1
-	sudo rmmod openair_rf
-	sudo make install_oai_user
-
-reboot_exmimo:
-	$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 -b
-	sudo rmmod openair_rf
-	sudo make install_oai_user
-
-install_softmodem:
-	make fifos
-ifeq ($(OPENAIR2),1)
-	insmod asn1_msg_kern.ko
-endif
-	insmod openair_rf_softmodem.ko
-
-remove:
-	rmmod openair_rf
-ifeq ($(OPENAIR2),1)
-	rmmod asn1_msg_kern
-endif
-
-test:
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) test RTAI=1 CBMIMO1=1)	
-	(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) test)
-
-clean:
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) clean RTAI=1 CBMIMO1=1)
-	(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) clean)
diff --git a/targets/RT/USER/Makefile b/targets/RT/USER/Makefile
deleted file mode 100644
index 8c413d4e2e254048621c62d66f5d05634dcca154..0000000000000000000000000000000000000000
--- a/targets/RT/USER/Makefile
+++ /dev/null
@@ -1,447 +0,0 @@
-# Include some shared directives
-include $(OPENAIR_TARGETS)/Makerules
-
-default: lte-softmodem
-all: lte-softmodem rrh
-
-include $(OPENAIR_TARGETS)/Makefile.common
-
-KERNEL_VERSION:=$(shell echo `uname -r | cut -d. -f-2`)
-KERNEL_TYPE:=$(shell echo `uname -r | cut -d. -f-3 | cut -d- -f3`)
-DEADLINE_SCHEDULER_KERNEL:=$(shell if [ $(KERNEL_TYPE) = "lowlatency" ]; then echo "1" ; else echo "0" ; fi)
-
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-ifdef EXMIMO
-#ifdef DEADLINE_SCHEDULER # this ifdef is to be removed after the debugging
-ifeq ($(DEADLINE_SCHEDULER_KERNEL),1)
-CFLAGS+=-DDEADLINE_SCHEDULER
-endif 
-#endif 
-endif
-
-ifndef USRP
-USRP=0
-endif
-
-CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/COMMON  -I.
-
-ifndef OPENAIR2
-OPENAIR2=1
-endif
-
-ifdef DEBUG
-DISABLE_XER_PRINT=0
-MSG_PRINT=1
-endif
-
-ifdef Rel10
-CFLAGS += -DRel10
-endif
-
-ifeq ($(EXMIMO),1)
-  CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO
-endif
-
-ifeq ($(ETHERNET),1)
-  CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/ETHERNET/USERSPACE/LIB/ -DETHERNET
-endif
-
-ifeq ($(DEBUG),1)	
-CFLAGS += -g -ggdb
-#CFLAGS += -DRRC_MSG_PRINT
-#CFLAGS += -DPDCP_MSG_PRINT
-else 
-CFLAGS += -O2 
-endif
-
-ifdef ($(MSG_PRINT),1)
-CFLAGS += -DRRC_MSG_PRINT
-CFLAGS += -DPDCP_MSG_PRINT
-endif
-
-SRC = synctest.c condtest.c 
-
-ifndef RTAI
-RTAI=1
-endif
-
-ifeq ($(LOCALIZATION), 1)
-CFLAGS += -DLOCALIZATION
-endif
-
-ifeq ($(LINUX_LIST), 1)
-CFLAGS += -DLINUX_LIST
-endif
-
-ifeq ($(RTAI),1)
-CFLAGS += -DENABLE_RTAI_CLOCK
-CFLAGS += -DCONFIG_RTAI_LXRT_INLINE  #remend the RTAI warning
-RTAI_OBJ = sched_dlsch.o sched_rx_pdsch.o rt_wrapper.o 
-else #RTAI
-CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
-OBJ += sched_dlsch.o sched_rx_pdsch.o rt_wrapper.o
-endif
-
-OBJ += $(OPENAIR1_DIR)/SIMULATION/TOOLS/taus.o $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o 
-
-ifeq ($(EXMIMO),1)
-OBJ += $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/gain_control.o
-CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS 
-endif
-
-CFLAGS += -DENABLE_VCD_FIFO
-
-
-TOP_DIR = $(OPENAIR1_DIR)
-include $(OPENAIR1_DIR)/PHY/Makefile.inc
-include $(OPENAIR1_DIR)/SCHED/Makefile.inc
-
-OBJ += $(PHY_OBJS)
-ifeq ($(RTAI),1)
-RTAI_OBJ += $(SCHED_OBJS)
-else
-OBJ += $(SCHED_OBJS)
-endif
-
-OPENAIR2_TOP = $(OPENAIR2_DIR)
-include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
-include $(OPENAIR2_DIR)/UTIL/Makefile.inc
-include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
-include $(OPENAIR2_DIR)/ENB_APP/Makefile.inc
-
-ifeq ($(USRP),1)
-
-include $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/Makefile.inc
-#CFLAGS += -I/opt/include/uhd -L/opt/lib -luhd -lpthread -lstdc++
-CFLAGS += -I/usr/include/uhd -L/usr/lib -luhd -lpthread -lstdc++
-CFLAGS += -DOAI_USRP
-#LDFLAGS += -L/opt/lib -luhd -lpthread -lstdc++ 
-LDFLAGS += -L/usr/lib/ -luhd -lpthread -lstdc++
-endif
-
-ifeq ($(ETHERNET),1)
-include $(OPENAIR_TARGETS)/ARCH/ETHERNET/USERSPACE/LIB/Makefile.inc
-LDFLAGS += -lpthread
-endif
-
-OBJ +=  $(ENB_APP_OBJS)
-
-ifeq ($(RTAI),1)
-CFLAGS += -I/usr/realtime/include -I/usr/realtime/include/asm
-LOG_OBJS=
-RTAI_OBJ+=$(LOG_DIR)/vcd_signal_dumper.o
-RTAI_OBJ+=$(LOG_DIR)/log.o
-endif
-
-
-OBJ += $(LOG_OBJS) 
-
-ifeq ($(OPENAIR2),1)
-ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
-OBJ += $(L2_OBJS) $(LIST_OBJ) $(TIMER_OBJ) $(MEM_OBJ) $(OTG_OBJS) $(MATH_OBJS)  $(OSA_OBJS) $(OPT_OBJS) 
-OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
-#OBJ += $(PDCP_DIR)/pdcp_thread.o
-CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
-endif
-
-#ifdef ENABLE_ITTI
-RTAI_OBJ += $(UTILS_OBJS)
-#else
-#OBJ += $(UTILS_OBJS)
-#endif
-
-ifdef SPECTRA
-CFLAGS += -DSPECTRA
-endif
-
-#ifdef ENABLE_ITTI
-CFLAGS += -DEXMIMO_IOT
-#endif
-
-CFLAGS += $(L2_incl) $(ENB_APP_incl) $(UTIL_incl) $(UTILS_incl)
-
-CFLAGS += -I$(OPENAIR1_DIR) -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES	#-I$(OPENAIR3_DIR)/MESH -I$(OPENAIR3_DIR)/MESH/RRM
-
-CFLAGS += -DNEW_FFT -DLOG_NO_THREAD
-
-ifeq ($(XFORMS),1)
-CFLAGS += -DXFORMS -I/usr/include/X11
-LDFLAGS += -lforms
-OBJ += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
-OBJ += stats.o
-endif
-
-OBJ_SYNC = $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o rt_wrapper.o $(OPENAIR2_DIR)/UTIL/LOG/log.o $(OPENAIR2_DIR)/UTIL/LOG/vcd_signal_dumper.o 
-
-ifdef SMBV
-CFLAGS += -DSMBV
-endif
-
-CFLAGS += -DPHYSIM -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 
-CFLAGS += -DOPENAIR_LTE -DENABLE_FXP -DOPENAIR1 #-DDLSCH_THREAD #-DULSCH_THREAD
-
-
-ifeq ($(EXMIMO),1)
-CFLAGS += -DEXMIMO
-#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=138 #this is for ExpressMIMO 1
-#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=45 #this is for ExpressMIMO 2
-endif
-
-ifeq ($(HARD_RT),1)
-CFLAGS += -DHARD_RT
-endif
-
-ifeq ($(EMOS),1)
-CFLAGS += -D_FILE_OFFSET_BITS=64 #-DEMOS -DEMOS_CHANNEL
-LDFLAGS += -lgps
-endif
-
-
-ifeq ($(LINK_ENB_PDCP_TO_GTPV1U), 1)
-CFLAGS += -DLINK_ENB_PDCP_TO_GTPV1U 
-endif
-
-ifeq ($(LINK_ENB_PDCP_TO_IP_DRIVER), 1)
-CFLAGS += -DPDCP_USE_NETLINK -DLINUX
-OBJ += $(NAS_OBJS)
-NAS_FLAG=1
-endif
-
-LDFLAGS += -lpthread -lm -lforms -lconfig -lrt
-ifeq ($(RTAI),1)
-RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags) -DRTAI
-LDFLAGS += $(shell rtai-config --lxrt-ldflags)
-endif
-
-#ifeq ($(USRP),1)
-#CFLAGS += -I/opt/uhd/include -L/opt/uhd/lib -luhd -lpthread -lstdc++
-#CFLAGS += -DOAI_USRP
-#endif
-#CFLAGS += -I/usr/include/c++/4.6 -I/usr/include/c++/4.6/x86_64-linux-gnu -I/usr/include/rtai/
-
-LFDS_OBJ_DIR		 = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(LFDS_DIR))
-LFDS_LIB		 = $(LFDS_OBJ_DIR)/bin/liblfds611.a
-LIBS 			+= $(LFDS_LIB)
-SHARED_DEPENDENCIES 	+= $(LFDS_LIB)
-
--include $(OBJ:.o=.d)
--include $(ASN1_MSG_OBJS1:.o=.d)
--include $(RTAI_OBJ:.o=.d)
--include lte-softmodem.d
--include lte-ue.d
--include rrh.d
-
-$(LFDS_LIB):
-	@if [ ! -d $(LFDS_OBJ_DIR)/bin ]; then mkdir -p $(LFDS_OBJ_DIR)/bin; fi;
-	@if [ ! -d $(LFDS_OBJ_DIR)/obj ]; then mkdir -p $(LFDS_OBJ_DIR)/obj; fi;
-	$(MAKE) -C $(LFDS_DIR) -f makefile.linux OUTDIR=$(LFDS_OBJ_DIR)
-
-ifeq ($(USRP),1)
-$(USRP_OBJ):$(USRP_FILE_OBJ)
-	@echo Compiling $<
-	@$(CXX) -c  -g -ggdb $(USRP_CFLAGS) $(USRP_FILE_OBJ) -o $(USRP_OBJ)
-endif
-
-ifeq ($(ETHERNET),1)
-$(ETHERNET_OBJ):$(ETHERNET_FILE_OBJ)
-	@echo Compiling $<
-	@$(CC) -c -g -ggdb $(ETHERNET_CFLAGS) $(ETHERNET_FILE_OBJ) -o $(ETHERNET_OBJ)
-endif
-
-ifeq ($(RTAI),1)
-$(RTAI_OBJ) lte-softmodem.o lte-ue.o: %.o : %.c
-else
-$(RTAI_OBJ): %.o : %.c
-endif
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
-	@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $< > $*.d
-	@mv -f $*.d $*.d.tmp
-	@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
-	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
-	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
-	@rm -f $*.d.tmp
-
-ifdef ENABLE_ITTI
-$(OBJ) $(RTAI_OBJ): $(ITTI_MESSAGES_H)
-endif
-
-ifeq ($(RTAI),1)
-$(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
-else
-$(OBJ) $(ASN1_MSG_OBJS1) lte-softmodem.o lte-ue.o: %.o : %.c
-endif
-
-rrh.o: %.o : %.c
-
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
-	@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $< > $*.d
-	@mv -f $*.d $*.d.tmp
-	@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
-	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
-	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
-	@rm -f $*.d.tmp
-
-OBJ_EMOS = $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/gain_control.o rt_wrapper.o $(OPENAIR2_DIR)/UTIL/LOG/log.o $(OPENAIR2_DIR)/UTIL/LOG/vcd_signal_dumper.o $(OPENAIR1_DIR)/PHY/TOOLS/signal_energy.o $(OPENAIR1_DIR)/PHY/TOOLS/dB_routines.o
-ifeq ($(XFORMS),1)
-OBJ_EMOS+=lte_scope.o
-endif
-
-condtest: condtest.c 
-	$(CC) $(CFLAGS) $(LDFLAGS) condtest.c -o condtest
-
-synctest: $(OBJ_SYNC) $(SHARED_DEPENDENCIES) synctest.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_SYNC) -o synctest synctest.c $(LDFLAGS) $(LIBS)
-
-sleeptest: rt_wrapper.o sleeptest.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) rt_wrapper.o -o sleeptest sleeptest.c $(LDFLAGS) 
-
-lte-softmodem: $(OBJ) $(USRP_OBJ) $(ETHERNET_OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) lte-ue.o lte-softmodem.o $(SHARED_DEPENDENCIES)
-	@echo Linking $@
-	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(USRP_OBJ) $(ETHERNET_OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) lte-ue.o lte-softmodem.o -o lte-softmodem $(LDFLAGS) $(LIBS)
-
-rrh: rrh.o
-	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) rrh.o -o rrh -lpthread -lrt
-
-emos-raw: $(SHARED_DEPENDENCIES) $(OBJ_EMOS) emos-raw.c
-	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_EMOS) -o emos-raw emos-raw.c $(LDFLAGS) $(LIBS)
-
-
-synctest_eNB: synctest
-	cp synctest synctest_eNB
-
-synctest_UE: synctest
-	cp synctest synctest_UE
-
-drivers:
-#	cd $(OPENAIR2_DIR) && make clean && make nasmesh_netlink.ko
-#	cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && make clean && make
-	cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/DRIVER/eurecom && make clean && make 
-	cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT && make clean && make 
-	cp $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw $(OPENAIR_TARGETS)/bin/.
-
-run: condtest
-	rtai-load condtest --verbose
-
-run_eNB_test: 
-	rtai-load eNB_test --verbose
-
-run_eNB: 
-	rtai-load eNB --verbose
-
-run_UE: 
-	rtai-load UE --verbose
-
-run_UE0:
-	rtai-load UE0 --verbose
-
-run_UE0_smbv:
-	rtai-load UE0_smbv --verbose
-
-run_UE850:
-	rtai-load UE850 --verbose
-
-run_eNB850:
-	rtai-load eNB850 --verbose
-
-run_UE0prach:
-	rtai-load UE0prach --verbose
-
-run_UE1prach:
-	rtai-load UE1prach --verbose
-
-run_UE2prach:
-	rtai-load UE2prach --verbose
-
-run_UE0noL2:
-	rtai-load UE0noL2 -- verbose
-
-run_UE1noL2: 
-	rtai-load UE1noL2 --verbose
-
-run_UE2noL2: 
-	rtai-load UE2noL2 --verbose
-
-run_UE0calib:
-	rtai-load UE0calib --verbose
-
-run_UE0calibmed:
-	rtai-load UE0calibmed --verbose
-
-run_UE0calibbyp:
-	rtai-load UE0calibbyp --verbose
-
-run_UE1: 
-	rtai-load UE1 --verbose
-
-run_UE2: 
-	rtai-load UE2 --verbose
-
-run_eNB0:
-	rtai-load eNB0 --verbose
-
-run_eNB1:
-	rtai-load eNB1 --verbose
-
-run_eNB2:
-	rtai-load eNB2 --verbose
-
-clean: cleanmodem common-clean
-
-cleanmodem:
-	@$(RM_F_V) $(OBJ) $(RTAI_OBJ) $(OBJ_EMOS) $(OBJ_SYNC) $(USRP_OBJ) $(ETHERNET_OBJ)
-	@$(RM_F_V) $(OBJ:.o=.d) $(RTAI_OBJ:.o=.d) $(OBJ_EMOS:.o=.d) $(OBJ_SYNC:.o=.d)
-	@$(RM_F_V) $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1_msg.o $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1_msg.d
-	@$(RM_F_V) lte-ue.o lte-ue.d rrh.o rrh.d lte-softmodem.o lte-softmodem.d
-	@$(RM_F_V) rrh.o lte-ue.o lte-softmodem.o
-
-cleanasn1:
-	rm -f $(ASN1_MSG_OBJS1)
-	$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) *.o *.d )
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel*
-
-cleancell:
-	rm -f $(OPENAIR2_DIR)/RRC/CELLULAR/*.o
-	rm -f $(OPENAIR2_DIR)/RRC/CELLULAR/*.d
-	rm -f $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.o
-	rm -f $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.d
-	rm -f $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.o
-	rm -f $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.d
-
-cleanalmostall: cleanmodem 
-	rm -f $(ASN1_MSG_OBJS1)
-	rm -rf condtest synctest lte-softmodem rrh
-	rm -rf synctest_eNB synctest_UE
-
-cleanall: common-cleanall clean cleanasn1
-	rm -rf condtest synctest lte-softmodem rrh
-	rm -rf synctest_eNB synctest_UE
-
-show:
-	@echo $(CFLAGS)
-	@echo $(EXTRA_CFLAGS)
-	@echo $(OBJ) $(RTAI_OBJ) 
-	@echo $(USRP_OBJ)
-	@echo $(ETHERNET_OBJ)
-	@echo $(ETHERNET_FILE_OBJ)
-	@echo IS_REL8 is $(IS_REL8)
-	@echo IS_REL10 is $(IS_REL10)
-	@echo openssl $(OPENSSL_FOUND) 
-	@echo nettle $(NETTLE_FOUND)
-	@echo lowlatency kernel: $(DEADLINE_SCHEDULER_KERNEL)
-
-beautiful:
-	astyle --style=gnu -s2 $(SRC)
-
-fifos:
-	@for i in `seq 0 64`;\
-	do \
-	have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
-	if [ "$$have_rtfX" -eq 0 ] ;then \
-	mknod -m 666 /dev/rtf$$i c 150 $$i; \
-	fi;\
-	done
diff --git a/targets/RT/USER/Makefile.agilent b/targets/RT/USER/Makefile.agilent
deleted file mode 100644
index 061c15a31cc4067ed7897916429781b6da6a19f6..0000000000000000000000000000000000000000
--- a/targets/RT/USER/Makefile.agilent
+++ /dev/null
@@ -1,243 +0,0 @@
-include $(OPENAIR_TARGETS)/Makerules
-
-include $(OPENAIR_TARGETS)/Makefile.common
-
-CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO -DEXMIMO_IOT
-
-SRC = lte-enb.c
-
-ifndef RTAI
-RTAI=1
-endif
-
-ifeq ($(RTAI),1)
-CFLAGS += -DENABLE_RTAI_CLOCK -DRTAI
-RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o lte-enb.o rt_wrapper.o 
-else
-OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o lte-enb.o rt_wrapper.o
-CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
-endif
-
-OBJ += $(OPENAIR1_DIR)/SIMULATION/TOOLS/taus.o $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o
-
-TOP_DIR = $(OPENAIR1_DIR)
-include $(OPENAIR1_DIR)/PHY/Makefile.inc
-include $(OPENAIR1_DIR)/SCHED/Makefile.inc
-
-OBJ += $(PHY_OBJS)
-ifeq ($(RTAI),1)
-RTAI_OBJ += $(SCHED_OBJS)
-else
-OBJ += $(SCHED_OBJS)
-endif
-
-#ifndef rrc_cellular
-ifeq ($(rrc_cellular),0)
-rrc_cellular = 0
-rrc_cellular_eNB = 0
-rrc_cellular_UE = 0
-else
-  ifeq ($(eNB_flag),1)
-    rrc_cellular_eNB=1
-  endif
-  ifeq ($(UE_flag),1)
-    rrc_cellular_UE=1
-  endif
-endif
-
-export rrc_cellular
-
-OPENAIR2_TOP = $(OPENAIR2_DIR)
-include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
-include $(OPENAIR2_DIR)/UTIL/Makefile.inc
-include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
-
-ifeq ($(RTAI),1)
-LOG_OBJS=
-RTAI_OBJ+=$(LOG_DIR)/vcd_signal_dumper.o
-RTAI_OBJ+=$(LOG_DIR)/log.o
-endif
-
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-OBJ += $(LOG_OBJS) 
-
-ifndef OPENAIR2
-OPENAIR2=1
-endif
-ifeq ($(OPENAIR2),1)
-ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
-OBJ += $(L2_OBJS) $(LIST_OBJ) $(TIMER_OBJ) $(MEM_OBJ) $(OTG_OBJS) $(MATH_OBJS) 
-OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
-OBJ += $(PDCP_DIR)/pdcp_thread.o
-CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
-endif
-
-CFLAGS += $(L2_incl) $(UTIL_incl) $(UTILS_incl)
-
-CFLAGS += -I$(OPENAIR1_DIR) -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES	#-I$(OPENAIR3_DIR)/MESH -I$(OPENAIR3_DIR)/MESH/RRM
-
-CFLAGS += -DNEW_FFT -DLOG_NO_THREAD
-
-ifeq ($(XFORMS),1)
-CFLAGS += -DXFORMS -I/usr/include/X11
-LDFLAGS += -lforms
-OBJ += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
-OBJ += stats.o
-endif
-
-ifdef SMBV
-CFLAGS += -DSMBV
-endif
-
-CFLAGS += -DPHYSIM -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1
-CFLAGS += -DOPENAIR_LTE -DENABLE_FXP -DOPENAIR1 -DDLSCH_THREAD #-DULSCH_THREAD
-
-#only for CBMIMO1
-ifdef CBMIMO1
-CFLAGS += -DFW2011 -DBIT8_TX -DCBMIMO1
-else
-#only for EXPRESS MIMO
-CFLAGS += -DEXMIMO
-#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=138 #this is for ExpressMIMO 1
-#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=45 #this is for ExpressMIMO 2
-endif
-
-ifndef HARD_RT
-HARD_RT=1
-endif
-
-ifeq ($(HARD_RT),1)
-CFLAGS += -DHARD_RT
-endif
-
-ifeq ($(EMOS),1)
-CFLAGS += -DEMOS -DEMOS_CHANNEL
-LDFLAGS += -lgps
-endif
-
-ifndef NAS
-NAS=1
-endif
-
-ifeq ($(NAS),1)
-CFLAGS += -DPDCP_USE_NETLINK -DLINUX
-OBJ += $(NAS_OBJS)
-endif
-
-RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags)
-CFLAGS += -I/usr/realtime/include -DRTAI
-LDFLAGS += -lpthread -lm -lforms
-ifeq ($(RTAI),1)
-LDFLAGS += $(shell rtai-config --lxrt-ldflags) 
-else
-LDFLAGS += -lrt
-endif
-
-#ifndef USE_MME
-#  USE_MME=R8
-#endif
-
-ifdef USE_MME
-  include $(OPENAIR2_DIR)/S1AP/Makefile.inc
-  include $(OPENAIR2_DIR)/S1AP/MESSAGES/Makefile.inc
-  CFLAGS += -DENABLE_USE_MME -DENB_MODE
-  LDFLAGS += -lsctp
-  CFLAGS_S1AP += -DENB_MODE -DENABLE_USE_MME -DEMIT_ASN_DEBUG=1 -DUSER_MODE
-  S1AP_BUILT_OBJS += $(S1AP_OBJS) $(addprefix $(OPENAIR2_DIR)/S1AP/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
-  S1AP_BUILT_OBJS += $(OPENAIR3_DIR)/OPENAIRMME/SCTP/sctp_primitives_client.o
-endif
-
-
-ASN1RELDIR=R9.8
-ifeq ($(USE_MME), R8)
-  ASN1RELDIR=R8.10
-else
-  CFLAGS_S1AP += -DUPDATE_RELEASE_9
-endif
-S1AP_DIR=$(OPENAIR2_DIR)/S1AP
-ASN1MESSAGESDIR=$(S1AP_DIR)/MESSAGES
-ASN1DIR=$(ASN1MESSAGESDIR)/ASN1
-
-all: lte-enb
-
-$(LFDS_DIR)/bin/liblfds611.a:
-	$(MAKE) -C $(LFDS_DIR) -f makefile.linux
-
-
-$(RTAI_OBJ): %.o : %.c
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
-
-$(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
-
-$(S1AP_BUILT_OBJS): %.o : %.c
-	@echo Compiling $<
-	@$(CC) -Wall -c $(CFLAGS_S1AP) $(S1AP_Incl) $(UTIL_incl) -o $@ $<
-
-$(ASN1MESSAGESDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
-	echo Timestamp > $@
-	(cd $(ASN1DIR) && python $(ASN1DIR)/asn1tostruct.py -f$<)
-
-$(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-CommonDataTypes.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU.asn
-	echo Timestamp > $@
-	(cd $(ASN1MESSAGESDIR) && asn1c -gen-PER -fnative-types -fskeletons-copy $^)
-
-$(S1AP_DIR)/libs1ap.a: $(ASN1MESSAGESDIR)/s1ap_ieregen.stamp $(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp $(S1AP_BUILT_OBJS)
-	@echo Creating $@
-	$(AR) rcs $@ $^
-
-$(LFDS_DIR)/bin/liblfds611.a:
-	$(MAKE) -C $(LFDS_DIR) -f makefile.linux
-
-ifdef USE_MME
-  lte-enb: $(OBJ) $(S1AP_DIR)/libs1ap.a $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(LFDS_DIR)/bin/liblfds611.a
-else
-  lte-enb: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(LFDS_DIR)/bin/liblfds611.a
-endif
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-enb $(LDFLAGS) $(LFDS_DIR)/bin/liblfds611.a
-
-
-
-nasmesh:
-	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
-	(cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink.ko)
-	(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
-rb_tool:
-	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
-
-nasmesh_install:
-	(sudo rmmod nasmesh)
-	(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
-
-clean:
-	rm -rf $(OBJ) $(RTAI_OBJ)
-	rm -f $(S1AP_BUILT_OBJS)
-	rm -f $(ASN1MESSAGESDIR)/libs1ap.a
-
-cleanasn1:
-	rm -f $(ASN1_MSG_OBJS1)
-	$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) *.o *.d )
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10
-
-cleanall: clean cleanasn1
-	rm -rf condtest synctest lte-softmodem
-	rm -rf synctest_eNB synctest_UE
-
-show:
-	@echo $(CFLAGS)
-	@echo $(EXTRA_CFLAGS)
-	@echo $(OBJ) $(RTAI_OBJ)
-	@echo rrc_cellular variable is $(rrc_cellular)
-	@echo eNB_flag is $(eNB_flag)
-	@echo UE_flag is $(UE_flag)
-	@echo IS_REL8 is $(IS_REL8)
-	@echo IS_REL10 is $(IS_REL10)
-
-beautiful:
-	astyle --style=gnu -s2 $(SRC)
diff --git a/targets/RT/USER/Makefile.msg_many b/targets/RT/USER/Makefile.msg_many
deleted file mode 100644
index bc7840c1e574c63a7fb8344e9dea882db9883a4c..0000000000000000000000000000000000000000
--- a/targets/RT/USER/Makefile.msg_many
+++ /dev/null
@@ -1,21 +0,0 @@
-CFLAGS = $(shell rtai-config --lxrt-cflags)
-LDFLAGS = $(shell rtai-config --lxrt-ldflags) -lpthread -llxrt -lm
-
-CFLAGS += -D__IN_RTAI__ -Wall -O2 -I.
-
-OBJS = msg_many.o msg_helper.o
-
-all: msg_many
-
-msg_many: $(OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJS)
-
-$(OBJS): msg_many.h
-
-run: msg_many
-	rtai-load msg_many --verbose
-
-.PHONY: clean
-clean:
-	rm -f msg_many $(OBJS)
-
diff --git a/targets/RT/USER/TOOLS/thread_ipc.c b/targets/RT/USER/TOOLS/thread_ipc.c
index 5e9adb0bcc0df545c18ec6dc39cf8e75730c2255..7eda3e843175e816fac2eed8987556e616e3b4b8 100644
--- a/targets/RT/USER/TOOLS/thread_ipc.c
+++ b/targets/RT/USER/TOOLS/thread_ipc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/RT/USER/TOOLS/thread_ipc.h b/targets/RT/USER/TOOLS/thread_ipc.h
index a39f8d22fbd80d7465f3dff3e65fd565a4859c85..ec008c30df21efb6f633d30ed9359c25c000232e 100644
--- a/targets/RT/USER/TOOLS/thread_ipc.h
+++ b/targets/RT/USER/TOOLS/thread_ipc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/RT/USER/UE_transport_IQ.c b/targets/RT/USER/UE_transport_IQ.c
deleted file mode 100644
index 05dd2bbf798e64c276856d7313cc29911075f5d9..0000000000000000000000000000000000000000
--- a/targets/RT/USER/UE_transport_IQ.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file UE_transport_IQ.c
- * \brief UE transport IQ sampels 
- * \author  Katerina Trilyraki, Navid Nikaein, Raymond Knopp
- * \date 2015
- * \version 0.1
- * \company Eurecom
- * \maintainer:  navid.nikaein@eurecom.fr
- * \note
- * \warning very experimental 
- */
-
-#include <unistd.h>
-#include <time.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include "common_lib.h"
-#include "PHY/defs.h"
-#include "rrh_gw.h"
-#include "rrh_gw_externs.h"
-
-#define START_CMD 1
-#define RRH_UE_PORT 51000
-#define RRH_UE_DEST_IP "127.0.0.1"
-#define PRINTF_PERIOD 3750
-
-/******************************************************************************
- **                               FUNCTION PROTOTYPES                        **
- ******************************************************************************/
-void *rrh_proc_UE_thread(void *);
-void *rrh_UE_thread(void *);
-void *rrh_UE_rx_thread(void *);
-void *rrh_UE_tx_thread(void *);
-
-
-
-openair0_timestamp	timestamp_UE_tx[4]= {0,0,0,0},timestamp_UE_rx[4]= {0,0,0,0};
-openair0_timestamp 	nrt_UE_counter[4]= {0,0,0,0};
-
-pthread_t		main_rrh_UE_thread,main_rrh_proc_UE_thread;
-pthread_attr_t 		attr, attr_proc;
-struct sched_param 	sched_param_rrh, sched_param_rrh_proc;
-pthread_cond_t 		sync_UE_cond[4];
-pthread_mutex_t 	sync_UE_mutex[4];
-
-int32_t 		overflow_rx_buffer_UE[4]= {0,0,0,0};
-int32_t 		nsamps_UE[4]= {0,0,0,0};
-int32_t 		UE_tx_started=0,UE_rx_started=0;
-int32_t 		RT_flag_UE=0, NRT_flag_UE=1;
-int32_t 		counter_UE_rx[4]= {0,0,0,0};
-int32_t 		counter_UE_tx[4]= {0,0,0,0};
-int32_t			**tx_buffer_UE, **rx_buffer_UE;
-
-int 			sync_UE_rx[4]= {-1,-1,-1,-1};
-void 			*rrh_UE_thread_status;
-
-
-void *rx_ue[2]; // FIXME hard coded array size; indexed by lte_frame_parms.nb_antennas_rx
-void *tx_ue[2]; // FIXME hard coded array size; indexed by lte_frame_parms.nb_antennas_tx
-
-
-void config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag,uint8_t NRT_flag) {
-
-  int 	  i;
-  int 	  error_code_UE, error_code_proc_UE;
-  
-  RT_flag_UE=RT_flag;
-  NRT_flag_UE=NRT_flag;
-  
-  pthread_attr_init(&attr);
-  sched_param_rrh.sched_priority = sched_get_priority_max(SCHED_FIFO);
-  pthread_attr_init(&attr_proc);
-  sched_param_rrh_proc.sched_priority = sched_get_priority_max(SCHED_FIFO-1);
-  
-  pthread_attr_setschedparam(&attr,&sched_param_rrh);
-  pthread_attr_setschedpolicy(&attr,SCHED_FIFO);
-  pthread_attr_setschedparam(&attr_proc,&sched_param_rrh_proc);
-  pthread_attr_setschedpolicy(&attr_proc,SCHED_FIFO-1);
-  
-  
-  for (i=0; i<4; i++) {
-    pthread_mutex_init(&sync_UE_mutex[i],NULL);
-    pthread_cond_init(&sync_UE_cond[i],NULL);
-  }
-  
-  error_code_UE = pthread_create(&main_rrh_UE_thread, &attr, rrh_UE_thread, (void *)dev_ue);
-  error_code_proc_UE = pthread_create(&main_rrh_proc_UE_thread, &attr_proc, rrh_proc_UE_thread, (void *)dev_ue);
-  
-  if (error_code_UE) {
-    printf("Error while creating UE thread\n");
-    exit(-1);
-  }
-  
-  if (error_code_proc_UE) {
-    printf("Error while creating UE proc thread\n");
-    exit(-1);
-  }
-  
-}
-
-
-/*! \fn void *rrh_proc_UE_thread((void *)dev_ue)
-* \brief this function
-* \param[in]
-* \param[out]
-* \return
-* \note
-* @ingroup  _oai
-*/
-void *rrh_proc_UE_thread(void * arg) {
-  
-  int				antenna_index,i;
-  openair0_timestamp 		truncated_timestamp, truncated_timestamp_final, last_hw_counter=0;
-  struct			timespec time_req, time_rem;
-  int16_t       		*txp,*rxp;
-  unsigned int                  samples_per_frame=0;
-  rrh_module_t 	*dev=(rrh_module_t *)arg;
-  
-  samples_per_frame= dev->eth_dev.openair0_cfg->samples_per_frame;
-  AssertFatal(samples_per_frame <=0, "invalide samples_per_frame !%u\n",samples_per_frame);
-
-  time_req.tv_sec = 0;
-  time_req.tv_nsec = 1000;
-  
-  while (rrh_exit==0) {
-    //wait until some data has been copied
-    for (antenna_index=0; antenna_index<4; antenna_index++) {
-      if (sync_UE_rx[antenna_index]==0) {
-	if (!UE_tx_started) {
-	  UE_tx_started=1;  //Set this flag to 1 to indicate that a UE started retrieving data
-	  if (RT_flag_UE==1) {
-	    last_hw_counter=hw_counter;
-	  }
-	} else {
-	  if (RT_flag_UE==1) {
-	    if (hw_counter > last_hw_counter+1) {
-	      printf("L1");
-	      //              goto end_copy_UE;
-	    } else {
-	      while (hw_counter < last_hw_counter+1)
-		nanosleep(&time_req,&time_rem);
-	    }
-	  }
-	}
-	
-	truncated_timestamp = timestamp_UE_tx[antenna_index]%(samples_per_frame);
-	truncated_timestamp_final =  (timestamp_UE_tx[antenna_index]+nsamps_UE[antenna_index])%samples_per_frame;
-	
-	if ((truncated_timestamp + nsamps_UE[antenna_index]) > samples_per_frame) {
-	  if ((timestamp_eNB_rx[antenna_index]%samples_per_frame < nsamps_UE[antenna_index]) && (eNB_rx_started==1)) {
-	    overflow_rx_buffer_eNB[antenna_index]++;
-	    printf("eNB Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_eNB[antenna_index],(int)truncated_timestamp);
-	    
-	    if (NRT_flag_UE==1) {
-	      while ((timestamp_eNB_rx[antenna_index]%samples_per_frame) < nsamps_UE[antenna_index])
-		nanosleep(&time_req,&time_rem);
-	    }
-	  }
-	  
-	  rxp = (int16_t*)&rx_buffer_eNB[antenna_index][truncated_timestamp];
-	  txp = (int16_t*)&tx_buffer_UE[antenna_index][truncated_timestamp];
-	  
-	  for (i=0; i<(samples_per_frame<<1)-(truncated_timestamp<<1); i++) {
-	    rxp[i] = txp[i]>>6;
-	  }
-	  
-	  rxp = (int16_t*)&rx_buffer_eNB[antenna_index][0];
-	  txp = (int16_t*)&tx_buffer_UE[antenna_index][0];
-	  
-	  for (i=0; i<nsamps_eNB[antenna_index]-(samples_per_frame)+(truncated_timestamp); i++) {
-	    rxp[i] = txp[i]>>6;
-	  }
-	  
-	} else {
-	  if (((truncated_timestamp < (timestamp_eNB_rx[antenna_index]%samples_per_frame)) && 
-	       (truncated_timestamp_final >  (timestamp_eNB_rx[antenna_index]%samples_per_frame))) && 
-	      (eNB_rx_started==1)) {
-	    overflow_rx_buffer_eNB[antenna_index]++;
-	    printf("eNB Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_eNB[antenna_index],(int)truncated_timestamp);
-	    
-	    if (NRT_flag_UE==1) {
-	      while (truncated_timestamp_final >  timestamp_eNB_rx[antenna_index]%samples_per_frame)
-		nanosleep(&time_req,&time_rem);
-	    }
-	  }
-	  
-	  rxp = (int16_t*)&rx_buffer_eNB[antenna_index][truncated_timestamp];
-	  txp = (int16_t*)&tx_buffer_UE[antenna_index][truncated_timestamp];
-	  
-	  for (i=0; i<(nsamps_eNB[antenna_index]); i++) {
-	    rxp[i] =txp[i]>>6;
-	  }
-		  
-	}
-	//end_copy_UE :
-	last_hw_counter=hw_counter;
-	pthread_mutex_lock(&sync_UE_mutex[antenna_index]);
-	sync_UE_rx[antenna_index]--;
-	pthread_mutex_unlock(&sync_UE_mutex[antenna_index]);
-	
-      }
-    }
-
-  }
-  
-  return(0);
-}
-
-/*! \fn void *rrh_UE_thread(void *arg)
-* \brief this function
-* \param[in]
-* \param[out]
-* \return
-* \note
-* @ingroup  _oai
-*/
-void *rrh_UE_thread(void *arg) {
-  
-  rrh_module_t 	*dev=(rrh_module_t *)arg;
-
-  struct sched_param 	sched_param_UE_rx, sched_param_UE_tx;
-  int16_t		i,cmd;   //,nsamps,antenna_index;
-  //struct timespec 	time_req_1us;
-  pthread_t 		UE_rx_thread, UE_tx_thread;
-  pthread_attr_t 	attr_UE_rx, attr_UE_tx;
-  int 			error_code_UE_rx, error_code_UE_tx;
-  void 			*tmp;
-  unsigned int          samples_per_frame=0;
-  
-  samples_per_frame= dev->eth_dev.openair0_cfg->samples_per_frame;
-  //time_req_1us.tv_sec = 0;
-  //time_req_1us.tv_nsec = 1000;
-  
-  while (rrh_exit==0) {
-    
-    cmd=dev->eth_dev.trx_start_func(&dev->eth_dev);
-    
-    /* allocate memory for TX/RX buffers */
-    rx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*));
-    tx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*));
-    
-    for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
-      tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4));
-      memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4));
-      rx_buffer_UE[i]=(tmp+4*sizeof(int32_t));  
-    }
-    
-    for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
-      tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4));
-      memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4));
-      tx_buffer_UE[i]=(tmp+4*sizeof(int32_t));  
-    }
-    
-    printf("Client %s:%d is connected (DL_RB=%d) rt=%d|%d. \n" ,   dev->eth_dev.openair0_cfg->remote_addr,
-	   dev->eth_dev.openair0_cfg->remote_port,
-	   dev->eth_dev.openair0_cfg->num_rb_dl,
-	   dev->eth_dev.openair0_cfg->rx_num_channels,
-	   dev->eth_dev.openair0_cfg->tx_num_channels);
-    
-    if (cmd==START_CMD) {
-      
-      pthread_attr_init(&attr_UE_rx);
-      pthread_attr_init(&attr_UE_tx);
-      sched_param_UE_rx.sched_priority = sched_get_priority_max(SCHED_FIFO);
-      sched_param_UE_tx.sched_priority = sched_get_priority_max(SCHED_FIFO);
-      pthread_attr_setschedparam(&attr_UE_rx,&sched_param_UE_rx);
-      pthread_attr_setschedparam(&attr_UE_tx,&sched_param_UE_tx);
-      pthread_attr_setschedpolicy(&attr_UE_rx,SCHED_FIFO);
-      pthread_attr_setschedpolicy(&attr_UE_tx,SCHED_FIFO);
-      
-      error_code_UE_rx = pthread_create(&UE_rx_thread, &attr_UE_rx, rrh_UE_rx_thread, (void *)&dev);
-      error_code_UE_tx = pthread_create(&UE_tx_thread, &attr_UE_tx, rrh_UE_tx_thread, (void *)&dev);
-      
-      if (error_code_UE_rx) {
-	printf("Error while creating UE RX thread\n");
-	exit(-1);
-      }
-
-      if (error_code_UE_tx) {
-	printf("Error while creating UE TX thread\n");
-	exit(-1);
-      }
-      
-      while (rrh_exit==0)
-	sleep(1);
-    }
-  }
-  
-  
-  rrh_UE_thread_status = 0;
-  pthread_exit(&rrh_UE_thread_status);
-  
-  return(0);
-}
-
-
-/*! \fn void *rrh_UE_rx_thread(void *arg)
-* \brief this function
-* \param[in]
-* \param[out]
-* \return
-* \note
-* @ingroup  _oai
-*/
-void *rrh_UE_rx_thread(void *arg) {
-
-  rrh_module_t        *dev = (rrh_module_t *)arg;
-  struct 	      timespec time0,time1,time2;
-  struct 	      timespec time_req_1us, time_rem_1us;
-  ssize_t	      bytes_sent;
-  int 		      antenna_index, nsamps;
-  int 		      trace_cnt=0;
-  unsigned long long  max_rx_time=0, min_rx_time=133333, total_rx_time=0, average_rx_time=133333, s_period=0, trial=0;
-  unsigned int        samples_per_frame=0;
-  openair0_timestamp  last_hw_counter=0;
-  
-  antenna_index     = 0;
-  nsamps	    = dev->eth_dev.openair0_cfg->samples_per_packet;
-  samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
-  
-  /* TODO: check if setting time0 has to be done here */
-  clock_gettime(CLOCK_MONOTONIC,&time0);
-
-  while (rrh_exit == 0) {
-    if (!UE_rx_started) {
-      UE_rx_started=1;  //Set this flag to 1 to indicate that a UE started retrieving data
-      
-      if (RT_flag_UE==1) {
-	last_hw_counter=hw_counter;
-      }
-    } else {
-      if (RT_flag_UE==1) {
-	if (hw_counter > last_hw_counter+1) {
-	  printf("L1");
-	  //goto end_copy_UE;
-	} else {
-	  while (hw_counter < last_hw_counter+1)
-	    nanosleep(&time_req_1us,&time_rem_1us);
-	}
-      }
-    }
-    
-    clock_gettime(CLOCK_MONOTONIC,&time1);
-    
-    // send return
-    
-    if ((timestamp_UE_rx[antenna_index]%(samples_per_frame)+nsamps) > samples_per_frame) { // Wrap around if nsamps exceeds the buffer limit
-      if (((timestamp_eNB_tx[antenna_index]%(samples_per_frame)) < ((timestamp_UE_rx[antenna_index]+nsamps)%(samples_per_frame))) && (eNB_tx_started==1)) {
-	printf("UE underflow wraparound timestamp_UE_rx : %d, timestamp_eNB_tx : %d\n",
-	       (int)(timestamp_UE_rx[antenna_index]%(samples_per_frame)),
-	       (int)(timestamp_eNB_tx[antenna_index]%samples_per_frame));
-	
-	if (NRT_flag_UE==1) {
-	  while ((timestamp_eNB_tx[antenna_index]%samples_per_frame) < ((timestamp_UE_rx[antenna_index]+nsamps)%(samples_per_frame)))
-	    nanosleep(&time_req_1us,&time_rem_1us);
-	}
-      }
-      
-      rx_ue[antenna_index]=(void*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(samples_per_frame)];
-      if ((bytes_sent =dev->eth_dev.trx_write_func (dev,
-						    timestamp_UE_rx[antenna_index],
-						    rx_ue,
-						    ( samples_per_frame- (timestamp_eNB_rx[antenna_index]%(samples_per_frame)) ),
-					antenna_index,
-						    0))<0)
-	perror("RRH UE : sendto for RX");
-      
-      rx_ue[antenna_index]=(void*)&rx_buffer_UE[antenna_index][3];
-      if ((bytes_sent  =dev->eth_dev.trx_write_func (dev,
-						     timestamp_UE_rx[antenna_index],
-						     rx_ue,
-						     (nsamps - samples_per_frame + (timestamp_eNB_rx[antenna_index]%(samples_per_frame))),
-						     antenna_index,
-						     0))<0)
-	perror("RRH UE : sendto for RX");
-      
-    } else {
-      if (((timestamp_UE_rx[antenna_index]%samples_per_frame)< timestamp_eNB_tx[antenna_index]%samples_per_frame) && 
-	  (((timestamp_UE_rx[antenna_index]+nsamps)%samples_per_frame) > (timestamp_eNB_tx[antenna_index]%samples_per_frame)) && 
-	  (eNB_tx_started==1) ) {
-	printf("UE underflow timestamp_UE_rx : %d, timestamp_eNB_tx : %d\n",
-	       (int)(timestamp_UE_rx[antenna_index]%samples_per_frame),
-	       (int)(timestamp_eNB_tx[antenna_index]%samples_per_frame));
-	
-	if (NRT_flag_UE==1) {
-	  while (((timestamp_UE_rx[antenna_index]+nsamps)%samples_per_frame) > (timestamp_eNB_tx[antenna_index]%samples_per_frame)) {
-	    nanosleep(&time_req_1us,&time_rem_1us);
-	  }
-	}
-      }
-      
-      rx_ue[antenna_index]=(void*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(samples_per_frame)];
-      if ((bytes_sent = dev->eth_dev.trx_write_func (dev,
-						     timestamp_UE_rx[antenna_index],
-						     rx_ue,
-						     nsamps,
-						     antenna_index,
-						     0))<0)
-	perror("RRH UE thread: sendto for RX");
-    }
-    
-    timestamp_UE_rx[antenna_index]+=nsamps;
-    last_hw_counter=hw_counter;
-    
-    clock_gettime(CLOCK_MONOTONIC,&time2);
-    
-    if (trace_cnt++ > 10) {
-      total_rx_time = (unsigned int)(time2.tv_nsec - time0.tv_nsec);
-      
-      if (total_rx_time < 0) total_rx_time=1000000000-total_rx_time;
-      
-      if ((total_rx_time > 0) && (total_rx_time < 1000000000)) {
-	trial++;
-	
-	if (total_rx_time < min_rx_time)
-	  min_rx_time = total_rx_time;
-	
-	if (total_rx_time > max_rx_time)
-	  max_rx_time = total_rx_time;
-	
-	average_rx_time = (long long unsigned int)((average_rx_time*trial)+total_rx_time)/(trial+1);
-      }
-      
-      if (s_period++ == PRINTF_PERIOD) {
-	s_period=0;
-	printf("Average UE RX time : %llu\tMax RX time : %llu\tMin RX time : %llu\n",average_rx_time,max_rx_time,min_rx_time);
-	
-      }
-      
-      //printf("RX: t1 %llu (time from last send), t2 %llu (sendto of %lu bytes) total time : %llu\n",(long long unsigned int)(time1.tv_nsec  - time0.tv_nsec), (long long unsigned int)(time2.tv_nsec - time1.tv_nsec),
-      //   (nsamps<<2)+sizeof(openair0_timestamp),(long long unsigned int)(time2.tv_nsec - time0.tv_nsec));
-      
-    }
-    
-    memcpy(&time0,&time2,sizeof(struct timespec));
-    
-  }  //while (UE_exit==0)
-  
-  return(0);
-  
-}
-
-
-/*! \fn void *rrh_UE_tx_thread(void *arg)
-* \brief this function
-* \param[in]
-* \param[out]
-* \return
-* \note
-* @ingroup  _oai
-*/
-void *rrh_UE_tx_thread(void *arg) {
-  
-  struct timespec 	time0a,time0,time1,time2;
-  struct timespec 	time_req_1us, time_rem_1us;
-  
-  
-  rrh_module_t    	*dev = (rrh_module_t *)arg;
-  ssize_t 		bytes_received;
-  int 			antenna_index, nsamps;
-  unsigned int          samples_per_frame=0;
-  
-  antenna_index    = 0;
-  nsamps 	   = dev->eth_dev.openair0_cfg->samples_per_packet;
-  samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
-  
-  
-  while (rrh_exit == 0) {
-    
-    clock_gettime(CLOCK_MONOTONIC,&time0a);
-    
-    bytes_received = dev->eth_dev.trx_read_func(dev,
-						&timestamp_UE_tx[antenna_index],
-						tx_ue,
-						nsamps,
-						antenna_index);
-    
-    clock_gettime(CLOCK_MONOTONIC,&time1);
-    
-    if (NRT_flag_UE==1) {
-      nrt_UE_counter[antenna_index]++;
-    }
-    printf(" first part size: %d   second part size: %"PRId64" idx=%"PRId64"\n",
-	   (int32_t)(((samples_per_frame)<<2)-((timestamp_UE_tx[antenna_index]%(samples_per_frame))<<2)),
-	   (nsamps<<2)-((samples_per_frame)<<2)+((timestamp_UE_tx[antenna_index]%(samples_per_frame))<<2),
-	   timestamp_UE_tx[antenna_index]%(samples_per_frame));
-    if ((timestamp_UE_tx[antenna_index]%(samples_per_frame)+nsamps) > samples_per_frame) { // Wrap around if nsamps exceeds the buffer limit
-      memcpy(&tx_buffer_UE[antenna_index][timestamp_UE_tx[antenna_index]%(samples_per_frame)],(void*)(tx_ue[antenna_index]),
-	     (samples_per_frame<<2)-((timestamp_UE_tx[antenna_index]%(samples_per_frame))<<2));
-      
-      memcpy(&tx_buffer_UE[antenna_index][0], (void*)(tx_ue[antenna_index]+(samples_per_frame*4)-((timestamp_UE_tx[antenna_index]%(samples_per_frame))<<2)),
-             (nsamps<<2)-((samples_per_frame-(timestamp_UE_tx[antenna_index]%(samples_per_frame)))<<2));
-      //printf("Received UE TX samples for antenna %d, nsamps %d (%d)\n",antenna_index,nsamps,(int)(bytes_received>>2));
-    } else {
-      memcpy(&tx_buffer_UE[antenna_index][timestamp_UE_tx[antenna_index]%(samples_per_frame)], (void*)(tx_ue[antenna_index]),(nsamps<<2));
-    }
-    
-    while (sync_UE_rx[antenna_index]==0)
-      nanosleep(&time_req_1us,&time_rem_1us);
-    
-    pthread_mutex_lock(&sync_UE_mutex[antenna_index]);
-    sync_UE_rx[antenna_index]++;
-    
-    if (!sync_UE_rx[antenna_index]) {
-      counter_UE_tx[antenna_index]=(counter_UE_tx[antenna_index]+nsamps)%samples_per_frame;
-      nsamps_UE[antenna_index]=nsamps;
-    } else {
-      printf("rrh_eNB_proc thread is busy, will exit\n");
-      exit(-1);
-    }
-    
-    pthread_mutex_unlock(&sync_UE_mutex[antenna_index]);
-    
-    clock_gettime(CLOCK_MONOTONIC,&time2);
-    
-    memcpy(&time0,&time2,sizeof(struct timespec));
-    
-  }
-  
-  return(0);
-  
-}
-
-
diff --git a/targets/RT/USER/condtest.c b/targets/RT/USER/condtest.c
deleted file mode 100644
index 23b5d23a5b7a276ea945777241a3fed8498ed859..0000000000000000000000000000000000000000
--- a/targets/RT/USER/condtest.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-
-
-#include <rtai_lxrt.h>
-#include <rtai_sem.h>
-#include <rtai_msg.h>
-
-#define PERIOD 100000000
-#define THRESHOLD 1
-
-static SEM *mutex;
-static CND *cond;
-
-static int thread0;
-static int thread1;
-
-static int instance_cnt=-1; //0 means worker is busy, -1 means its free
-
-static void *fun0(void *arg)
-{
-  RT_TASK *task;
-  int done1=0, cnt1=0;
-  RTIME right_now;
-  int ret;
-
-  task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  rt_make_hard_real_time();
-
-  while (cnt1 < THRESHOLD) {
-    rt_sem_wait(mutex);
-    rt_printk("fun0: Hello World %d, instance_cnt %d!\n",cnt1,instance_cnt);
-
-    while (instance_cnt<0) {
-      ret = rt_cond_wait(cond, mutex);
-
-      if (ret != 0) {
-        rt_printk("error in rt_cond_wait, code %d\n",ret);
-
-        switch (ret) {
-        case RTE_PERM:
-          rt_printk("error RTE_PERM %d\n",ret);
-          break;
-
-        case RTE_UNBLKD:
-          rt_printk("error RTE_UNBLKD %d\n",ret);
-          break;
-
-        case RTE_OBJREM:
-          rt_printk("error RTE_OBJREM %d\n",ret);
-          break;
-
-        default:
-          rt_printk("unknown error code %d\n",ret);
-          break;
-        }
-
-        break;
-      }
-    }
-
-    rt_sem_signal(mutex);
-
-    // do some work here
-    cnt1++;
-
-    rt_sem_wait(mutex);
-    instance_cnt--;
-    rt_sem_signal(mutex);
-
-  }
-
-  // makes task soft real time
-  rt_make_soft_real_time();
-
-  printf("Back to soft RT\n");
-  // clean task
-  rt_task_delete(task);
-  printf("Task deleted. returning\n");
-  return 0;
-}
-
-
-int main(void)
-{
-  RT_TASK *task;
-  RTIME now;
-  int cnt=0;
-
-  // make main thread LXRT soft realtime
-  task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  // start realtime timer and scheduler
-  //rt_set_oneshot_mode();
-  rt_set_periodic_mode();
-  start_rt_timer(0);
-
-  now = rt_get_time() + 10*PERIOD;
-  rt_task_make_periodic(task, now, PERIOD);
-
-  printf("Init mutex and cond.\n");
-  mutex = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if (mutex==0)
-    printf("Error init mutex\n");
-
-  cond = rt_cond_init(nam2num("CONDITION"));
-
-  if (cond==0)
-    printf("Error init cond\n");
-
-  thread0 = rt_thread_create(fun0, NULL, 10000);
-  //thread1 = rt_thread_create(fun1, NULL, 20000);
-
-  //rt_sleep(PERIOD);
-
-  while (cnt < THRESHOLD) {
-    rt_task_wait_period();
-    rt_printk("main: Hello World %d!\n",cnt);
-    rt_sem_wait(mutex); //now the mutex should have value 0
-
-    if (instance_cnt==0) {
-      rt_sem_signal(mutex); //now the mutex should have vaule 1
-      rt_printk("worker thread busy!\n");
-    } else {
-      instance_cnt++;
-      rt_cond_signal(cond);
-      rt_sem_signal(mutex); //now the mutex should have vaule 1
-      rt_printk("signaling worker thread to start!\n");
-    }
-
-    cnt++;
-  }
-
-  // wait for end of program
-  printf("TYPE <ENTER> TO TERMINATE\n");
-  getchar();
-
-  // cleanup
-  stop_rt_timer();
-  return 0;
-}
diff --git a/targets/RT/USER/eNB_transport_IQ.c b/targets/RT/USER/eNB_transport_IQ.c
deleted file mode 100644
index b57a201fb5f901417d919bbed85bdf919f6b51ff..0000000000000000000000000000000000000000
--- a/targets/RT/USER/eNB_transport_IQ.c
+++ /dev/null
@@ -1,744 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file eNB_transport_IQ.c
- * \brief eNB transport IQ samples 
- * \author  Katerina Trilyraki, Navid Nikaein, Raymond Knopp
- * \date 2015
- * \version 0.1
- * \company Eurecom
- * \maintainer:  navid.nikaein@eurecom.fr
- * \note
- * \warning very experimental 
- */
-#include <unistd.h>
-#include <time.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include "common_lib.h"
-#include "PHY/defs.h"
-#include "rrh_gw.h"
-#include "rrh_gw_externs.h"
-#include "rt_wrapper.h"
-
-#define PRINTF_PERIOD    3750
-#define HEADER_SIZE      ((sizeof(int32_t) + sizeof(openair0_timestamp))>>2)
-
-pthread_cond_t          sync_eNB_cond[4];
-pthread_mutex_t         sync_eNB_mutex[4];
-pthread_mutex_t         sync_trx_mutex=PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t          sync_trx_cond=PTHREAD_COND_INITIALIZER;
-
-openair0_timestamp 	nrt_eNB_counter[4]= {0,0,0,0};
-int32_t 	overflow_rx_buffer_eNB[4]= {0,0,0,0};
-int32_t 	nsamps_eNB[4]= {0,0,0,0};
-int32_t 	eNB_tx_started=0,eNB_rx_started=0;
-int32_t 	counter_eNB_rx[4]= {0,0,0,0};
-int32_t 	counter_eNB_tx[4]= {0,0,0,0};
-uint8_t		RT_flag_eNB,NRT_flag_eNB;
-void 		*rrh_eNB_thread_status;
-int 	        sync_eNB_rx[4]= {-1,-1,-1,-1};
-unsigned int    sync_trx=0;
-
-int32_t		**tx_buffer_eNB;
-int32_t         **rx_buffer_eNB;
-void 		**rx_eNB; //was fixed to 2 ant
-void 		**tx_eNB; //was fixed to 2 ant
-
-openair0_timestamp	timestamp_eNB_tx[4]= {0,0,0,0};// all antennas must have the same ts
-openair0_timestamp      timestamp_eNB_rx[4]= {0,0,0,0};
-openair0_timestamp	timestamp_rx=0,timestamp_tx=0;
-
-unsigned int   rx_pos=0, next_rx_pos=0;
-unsigned int   tx_pos=0, tx_pos_rf=0, prev_tx_pos=0;
-unsigned int   rt_period=0;
-
-struct itimerspec       timerspec;
-pthread_mutex_t         timer_mutex;
-
-
-
-/*! \fn void *rrh_eNB_rx_thread(void *arg)
- * \brief this function
- * \param[in]
- * \return none
- * \note
- * @ingroup  _oai
- */
-void *rrh_eNB_rx_thread(void *);
-/*! \fn void *rrh_eNB_tx_thread(void *arg)
- * \brief this function
- * \param[in]
- * \return none
- * \note
- * @ingroup  _oai
- */
-void *rrh_eNB_tx_thread(void *);
-/*! \fn void *rrh_eNB_thread(void *arg)
- * \brief this function
- * \param[in]
- * \return none
- * \note
- * @ingroup  _oai
- */
-void *rrh_eNB_thread(void *);
-/*! \fn  void check_dev_config( rrh_module_t *mod_enb)
- * \brief this function
- * \param[in] *mod_enb
- * \return none
- * \note
- * @ingroup  _oai
- */
-static void check_dev_config( rrh_module_t *mod_enb);
-/*! \fn void calc_rt_period_ns( openair0_config_t openair0_cfg)
- * \brief this function
- * \param[in] openair0_cfg
- * \return none
- * \note
- * @ingroup  _oai
- */
-static void calc_rt_period_ns( openair0_config_t *openair0_cfg);
-
-
-
-void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag) {
-  
-  int 	             error_code_eNB;
-  pthread_t	     main_rrh_eNB_thread;
-  pthread_attr_t     attr;
-  struct sched_param sched_param_rrh;
-  
-  RT_flag_eNB=RT_flag;
-  NRT_flag_eNB=NRT_flag;
-  
-  /* init socket and have handshake-like msg with client to exchange parameters */
-  mod_enb->eth_dev.trx_start_func(&mod_enb->eth_dev);//change port  make it plus_id
-
-  mod_enb->devs->openair0_cfg = mod_enb->eth_dev.openair0_cfg;
-
-  /* check sanity of configuration parameters and print */
-  check_dev_config(mod_enb);  
-  if (rf_config_file[0] == '\0')  
-    mod_enb->devs->openair0_cfg->configFilename = NULL;
-  else
-    mod_enb->devs->openair0_cfg->configFilename = rf_config_file;
-  /* initialize and configure the RF device */
-  if (openair0_device_load(mod_enb->devs, mod_enb->devs->openair0_cfg)<0) {
-    LOG_E(RRH,"Exiting, cannot initialize RF device.\n");
-    exit(-1);
-  } else {   
-    if (mod_enb->devs->type != NONE_DEV) {
-      /* start RF device */
-      if (mod_enb->devs->type == EXMIMO_DEV) {
-	//call start function for exmino
-      } else {
-
-	if (mod_enb->devs->trx_start_func(mod_enb->devs)!=0)
-	  LOG_E(RRH,"Unable to initiate RF device.\n");
-	else
-	  LOG_I(RRH,"RF device has been initiated.\n");
-      }
-      
-    }
-  }  
-  
-  /* create main eNB module thread
-     main_rrh_eNB_thread allocates memory 
-     for TX/RX buffers and creates TX/RX
-     threads for every eNB module */ 
-  pthread_attr_init(&attr);
-  sched_param_rrh.sched_priority = sched_get_priority_max(SCHED_FIFO);
-  pthread_attr_setschedparam(&attr,&sched_param_rrh);
-  pthread_attr_setschedpolicy(&attr,SCHED_FIFO);
-  error_code_eNB = pthread_create(&main_rrh_eNB_thread, &attr, rrh_eNB_thread, (void *)mod_enb);
-
-  if (error_code_eNB) {
-    LOG_E(RRH,"Error while creating eNB thread\n");
-    exit(-1);
-  }
-  
-}
-
-
-void *rrh_eNB_thread(void *arg) {
-
-  rrh_module_t 	       	*dev=(rrh_module_t *)arg;
-  pthread_t  	      	eNB_rx_thread, eNB_tx_thread;  
-  int 	      		error_code_eNB_rx, error_code_eNB_tx;
-  int32_t	        i,j;   		
-  void 			*tmp;
-  unsigned int          samples_per_frame=0;
-  
-  samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;    
-
-  while (rrh_exit==0) {
-    
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TRX, 1 );    
-    
-    /* calculate packet period */
-    calc_rt_period_ns(dev->eth_dev.openair0_cfg);
-        
-    /* allocate memory for TX/RX buffers
-       each antenna port has a TX and a RX buffer
-       each TX and RX buffer is of (samples_per_frame + HEADER_SIZE) samples (size of samples is 4 bytes) */
-    rx_buffer_eNB = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*));
-    tx_buffer_eNB = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*));    
-    LOG_D(RRH,"rx_buffer_eNB address =%p tx_buffer_eNB address =%p  \n",rx_buffer_eNB,tx_buffer_eNB);
-    
-    /* rx_buffer_eNB points to the beginning of data */
-    for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
-      tmp=(void *)malloc16(sizeof(int32_t)*(samples_per_frame + 32));
-      memset(tmp,0,sizeof(int32_t)*(samples_per_frame + 32));
-      rx_buffer_eNB[i]=( tmp + (32*sizeof(int32_t)) );  
-      LOG_D(RRH,"i=%d rx_buffer_eNB[i]=%p tmp= %p\n",i,rx_buffer_eNB[i],tmp);
-    }
-    /* tx_buffer_eNB points to the beginning of data */
-    for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
-      tmp=(void *)malloc16(sizeof(int32_t)*(samples_per_frame + 32));
-      memset(tmp,0,sizeof(int32_t)*(samples_per_frame + 32));
-      tx_buffer_eNB[i]=( tmp + (32*sizeof(int32_t)) );  
-      LOG_D(RRH,"i= %d tx_buffer_eNB[i]=%p tmp= %p \n",i,tx_buffer_eNB[i],tmp);
-    }
-    /* dummy initialization for TX/RX buffers */
-    for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
-      for (j=0; j<samples_per_frame; j++) {
-	rx_buffer_eNB[i][j]=32+i; 
-      } 
-    }
-    /* dummy initialization for TX/RX buffers */
-    for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
-      for (j=0; j<samples_per_frame; j++) {
-	tx_buffer_eNB[i][j]=12+i; 
-      } 
-    }    
-    /* allocate TX/RX buffers pointers used in write/read operations */
-    rx_eNB = (void**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*));
-    tx_eNB = (void**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*));
-
-    /* init mutexes */    
-    for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
-      pthread_mutex_init(&sync_eNB_mutex[i],NULL);
-      pthread_cond_init(&sync_eNB_cond[i],NULL);
-    }
-    /* init mutexes */    
-    pthread_mutex_init(&sync_trx_mutex,NULL);
-
-    /* create eNB module's TX/RX threads */    
-#ifdef DEADLINE_SCHEDULER
-    error_code_eNB_rx = pthread_create(&eNB_rx_thread, NULL, rrh_eNB_rx_thread, (void *)dev);
-    error_code_eNB_tx = pthread_create(&eNB_tx_thread, NULL, rrh_eNB_tx_thread, (void *)dev);
-    LOG_I(RRH,"[eNB][SCHED] deadline scheduling applied to eNB TX/RX threads\n");	
-#else
-    pthread_attr_t	attr_eNB_rx, attr_eNB_tx;
-    struct sched_param 	sched_param_eNB_rx, sched_param_eNB_tx;
-
-    pthread_attr_init(&attr_eNB_rx);
-    pthread_attr_init(&attr_eNB_tx);	
-    sched_param_eNB_rx.sched_priority = sched_get_priority_max(SCHED_FIFO);
-    sched_param_eNB_tx.sched_priority = sched_get_priority_max(SCHED_FIFO);
-    pthread_attr_setschedparam(&attr_eNB_rx,&sched_param_eNB_rx);
-    pthread_attr_setschedparam(&attr_eNB_tx,&sched_param_eNB_tx);
-    pthread_attr_setschedpolicy(&attr_eNB_rx,SCHED_FIFO);
-    pthread_attr_setschedpolicy(&attr_eNB_tx,SCHED_FIFO);
-    
-    error_code_eNB_rx = pthread_create(&eNB_rx_thread, &attr_eNB_rx, rrh_eNB_rx_thread, (void *)dev);
-    error_code_eNB_tx = pthread_create(&eNB_tx_thread, &attr_eNB_tx, rrh_eNB_tx_thread, (void *)dev);
-    LOG_I(RRH,"[eNB][SCHED] FIFO scheduling applied to eNB TX/RX threads\n");		
-#endif
-
-    if (error_code_eNB_rx) {
-      LOG_E(RRH,"[eNB] Error while creating eNB RX thread\n");
-      exit(-1);
-    }
-    if (error_code_eNB_tx) {
-      LOG_E(RRH,"[eNB] Error while creating eNB TX thread\n");
-      exit(-1);
-    }
-   
-    /* create timer thread; when no RF device is present a software clock is generated */    
-    if (dev->devs->type == NONE_DEV) {
-
-      int 			error_code_timer;
-      pthread_t 		main_timer_proc_thread;
-      
-      LOG_I(RRH,"Creating timer thread with rt period  %d ns.\n",rt_period);
-      
-      /* setup the timer to generate an interrupt:
-	 -for the first time in (sample_per_packet/sample_rate) ns
-	 -and then every (sample_per_packet/sample_rate) ns */
-      timerspec.it_value.tv_sec =     rt_period/1000000000;
-      timerspec.it_value.tv_nsec =    rt_period%1000000000;
-      timerspec.it_interval.tv_sec =  rt_period/1000000000;
-      timerspec.it_interval.tv_nsec = rt_period%1000000000;
-      
-      
-#ifdef DEADLINE_SCHEDULER
-      error_code_timer = pthread_create(&main_timer_proc_thread, NULL, timer_proc, (void *)&timerspec);
-      LOG_I(RRH,"[eNB][SCHED] deadline scheduling applied to timer thread \n");
-#else 
-      pthread_attr_t attr_timer;
-      struct sched_param sched_param_timer;
-      
-      pthread_attr_init(&attr_timer);
-      sched_param_timer.sched_priority = sched_get_priority_max(SCHED_FIFO-1);
-      pthread_attr_setschedparam(&attr_timer,&sched_param_timer);
-      pthread_attr_setschedpolicy(&attr_timer,SCHED_FIFO-1);
-      
-      pthread_mutex_init(&timer_mutex,NULL);
-      
-      error_code_timer = pthread_create(&main_timer_proc_thread, &attr_timer, timer_proc, (void *)&timerspec);
-      LOG_I(RRH,"[eNB][SCHED] FIFO scheduling applied to timer thread \n");   	
-#endif	
-      
-      if (error_code_timer) {
-	LOG_E(RRH,"Error while creating timer proc thread\n");
-	exit(-1);
-      }
-      
-    }
-    
-    while (rrh_exit==0)
-      sleep(1);
-    
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TRX,0 );
-  }  
-  
-  rrh_eNB_thread_status = 0;
-  pthread_exit(&rrh_eNB_thread_status);
-  return(0);
-}
-
-/* Receive from RF and transmit to RRH */
-
-void *rrh_eNB_rx_thread(void *arg) {
-
-  /* measurement related vars */
-  struct timespec time0,time1,time2;
-  unsigned long long max_rx_time=0, min_rx_time=rt_period, total_rx_time=0, average_rx_time=rt_period, s_period=0, trial=0;
-  int trace_cnt=0;
-
-  struct timespec time_req_1us, time_rem_1us;
-  rrh_module_t *dev = (rrh_module_t *)arg;
-  ssize_t bytes_sent;
-  int i=0 ,pck_rx=0, s_cnt=0;
-  openair0_timestamp last_hw_counter=0;  //volatile int64_t
-  unsigned int samples_per_frame=0,samples_per_subframe=0, spp_rf=0, spp_eth=0;
-  uint8_t loopback=0,measurements=0;
-  unsigned int subframe=0;
-  unsigned int frame=0;
-
-  time_req_1us.tv_sec = 0;
-  time_req_1us.tv_nsec =1000;  //time_req_1us.tv_nsec = (int)rt_period/2;--->granularity issue
-  spp_eth =  dev->eth_dev.openair0_cfg->samples_per_packet;
-  spp_rf  =  dev->devs->openair0_cfg->samples_per_packet;
-
-  samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
-  samples_per_subframe = (unsigned int)samples_per_frame/10;
-  loopback = dev->loopback;
-  measurements = dev->measurements;
-  next_rx_pos = spp_eth;
-
-#ifdef DEADLINE_SCHEDULER
-  struct sched_attr attr;
-  unsigned int flags = 0;
-
-  attr.size = sizeof(attr);
-  attr.sched_flags = 0;
-  attr.sched_nice = 0;
-  attr.sched_priority = 0;
-
-  attr.sched_policy   = SCHED_DEADLINE;
-  attr.sched_runtime  = (0.8 * 100) * 10000;//4 * 10000;
-  attr.sched_deadline = (0.9 * 100) * 10000;//rt_period-2000;
-  attr.sched_period   = 1 * 1000000;//rt_period;
-  
-  if (sched_setattr(0, &attr, flags) < 0 ) {
-    perror("[SCHED] eNB RX thread: sched_setattr failed (run with sudo)\n");
-    exit(-1);
-  }
-#endif
-
-  while (rrh_exit == 0) {    
-    while (rx_pos <(1 + subframe)*samples_per_subframe) {
-      //LOG_D(RRH,"starting a new send:%d  %d\n",sync_trx,frame);
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX, 1 );
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME_RX, frame);
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME_RX, subframe );  
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_PCK, pck_rx );
-      LOG_D(RRH,"pack=%d    rx_pos=%d    subframe=%d frame=%d\n ",pck_rx, rx_pos, subframe,frame);
-      
-      if (dev->devs->type == NONE_DEV) {	
-	VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_HWCNT, hw_counter );
-	VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_LHWCNT, last_hw_counter );
-	VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_CNT, s_cnt );
-	if (!eNB_rx_started) {
-	  eNB_rx_started=1; // set this flag to 1 to indicate that eNB started
-	  if (RT_flag_eNB==1) {
-	    last_hw_counter=hw_counter;//get current counter
-	  }
-	} else {
-	  if (RT_flag_eNB==1) {
-	    if (hw_counter > last_hw_counter+1) {
-	      printf("LR");
-	    } else {
-	      while ((hw_counter < last_hw_counter+1)) {
-		VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX_SLEEP, 1 );
-		nanosleep(&time_req_1us,&time_rem_1us);	//rt_sleep_ns(sleep_ns);
-		s_cnt++;	
-		VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX_SLEEP, 0 );
-	      } 
-	    }
-	  }
-	}
-      }
-      
-
-      if (measurements == 1 ) clock_gettime(CLOCK_MONOTONIC,&time1);      
-    
-      if (loopback == 1 ) {
-	if (sync_eNB_rx[i]==0) {
-	  rx_eNB[i] = (void*)&tx_buffer_eNB[i][tx_pos];
-	  LOG_I(RRH,"tx_buffer_eNB[i][tx_pos]=%d ,tx_pos=%d\n",tx_buffer_eNB[i][tx_pos],tx_pos);			
-	} else {
-	  rx_eNB[i] = (void*)&rx_buffer_eNB[i][rx_pos];
-	  LOG_I(RRH,"rx_buffer_eNB[i][rx_pos]=%d ,rx_pos=%d\n",rx_buffer_eNB[i][rx_pos],rx_pos);	
-	}
-       }
-       
-       for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
-	 rx_eNB[i] = (void*)&rx_buffer_eNB[i][rx_pos];
-	 LOG_D(RRH," rx_eNB[i]=%p rx_buffer_eNB[i][rx_pos]=%p ,rx_pos=%d, i=%d ts=%d\n",rx_eNB[i],&rx_buffer_eNB[i][rx_pos],rx_pos,i,timestamp_rx);	 
-       }  
-       VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RXCNT, rx_pos );
-       if (dev->devs->type != NONE_DEV) {
-	 VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_RF, 1 ); 
-	 /* Read operation to RF device (RX)*/
-	 if ( dev->devs->trx_read_func (dev->devs,
-					&timestamp_rx,
-					rx_eNB,
-					spp_rf,
-					dev->devs->openair0_cfg->rx_num_channels
-					)<0) {
-	   perror("RRH eNB : USRP read");
-	 }
-	 VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_RF, 0 );	
-       }
-       VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_TS, timestamp_rx&0xffffffff );
-
-       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); 
-       if ((bytes_sent = dev->eth_dev.trx_write_func (&dev->eth_dev,
-						      timestamp_rx,
-						      rx_eNB,
-						      spp_eth,
-						      dev->eth_dev.openair0_cfg->rx_num_channels,
-						      0))<0) {
-	 perror("RRH eNB : ETHERNET write");
-       }    
-       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
-
-       /* when there is no RF timestamp is updated by number of samples */
-       if (dev->devs->type == NONE_DEV) {
-	 timestamp_rx+=spp_eth;
-	 last_hw_counter=hw_counter;
-       }
-       
-       if (measurements == 1 ) {
-
-	 clock_gettime(CLOCK_MONOTONIC,&time2);
-	 
-	 if (trace_cnt++ > 10) {
-	   total_rx_time = (unsigned int)(time2.tv_nsec - time0.tv_nsec);
-	   if (total_rx_time < 0)
-	     total_rx_time=1000000000-total_rx_time;
-	   
-	   if ((total_rx_time > 0) && (total_rx_time < 1000000000)) {
-	     trial++;
-	     if (total_rx_time < min_rx_time)
-	       min_rx_time = total_rx_time;
-	     if (total_rx_time > max_rx_time){
-	       max_rx_time = total_rx_time;
-	       LOG_I(RRH,"Max value %d update at rx_position %d \n",total_rx_time,timestamp_rx);
-	     }
-	     average_rx_time = (long long unsigned int)((average_rx_time*trial)+total_rx_time)/(trial+1);
-	   }
-	   if (s_period++ == PRINTF_PERIOD) {
-	     s_period=0;
-	     LOG_I(RRH,"Average eNB RX time : %lu ns\tMax RX time : %lu ns\tMin RXX time : %lu ns\n",average_rx_time,max_rx_time,min_rx_time);
-	   }
-	 }
-	 
-	 memcpy(&time0,&time2,sizeof(struct timespec));
-       }
-       
-       if (loopback == 1 ) {
-	 pthread_mutex_lock(&sync_eNB_mutex[i]);
-	 sync_eNB_rx[i]--;
-	 pthread_mutex_unlock(&sync_eNB_mutex[i]);
-       }
-       
-       rx_pos += spp_eth;    
-       pck_rx++;
-       next_rx_pos=(rx_pos+spp_eth);
-       
-       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX, 0 );
-       /*
-       if (frame>50) {
-	 pthread_mutex_lock(&sync_trx_mutex);
-	 while (sync_trx) {
-	   pthread_cond_wait(&sync_trx_cond,&sync_trx_mutex);
-	 }
-	 sync_trx=1;
-	 LOG_D(RRH,"out of while send:%d  %d\n",sync_trx,frame);
-	 pthread_cond_signal(&sync_trx_cond);
-	 pthread_mutex_unlock(&sync_trx_mutex);
-	 }*/
-    } // while 
-    
-    subframe++;
-    s_cnt=0;
-    
-    /* wrap around rx buffer index */
-    if (next_rx_pos >= samples_per_frame)
-      next_rx_pos -= samples_per_frame;  
-    if (rx_pos >= samples_per_frame)
-      rx_pos -= samples_per_frame;
-    /* wrap around subframe number */       
-    if (subframe == 10 ) {
-      subframe = 0; 
-      frame++;
-    }   
-   
-    
-  }  //while (eNB_exit==0)
-  return 0;
-}
-
-/* Receive from eNB and transmit to RF */
-
-void *rrh_eNB_tx_thread(void *arg) {
-
-  struct timespec time0,time1,time2;
-
-  rrh_module_t *dev = (rrh_module_t *)arg;
-  struct timespec time_req_1us, time_rem_1us;
-  ssize_t bytes_received;
-  int i;
-  //openair0_timestamp last_hw_counter=0;
-  unsigned int samples_per_frame=0,samples_per_subframe=0;
-  unsigned int  spp_rf=0, spp_eth=0;
-  uint8_t loopback=0,measurements=0;
-  unsigned int subframe=0,frame=0;
-  unsigned int pck_tx=0;
-  
-#ifdef DEADLINE_SCHEDULER
-  struct sched_attr attr;
-  unsigned int flags = 0;
-  
-  attr.size = sizeof(attr);
-  attr.sched_flags = 0;
-  attr.sched_nice = 0;
-  attr.sched_priority = 0;
-  
-  attr.sched_policy   = SCHED_DEADLINE;
-  attr.sched_runtime  = (0.8 * 100) * 10000;
-  attr.sched_deadline = (0.9 * 100) * 10000;
-  attr.sched_period   = 1 * 1000000;
-  
-  if (sched_setattr(0, &attr, flags) < 0 ) {
-    perror("[SCHED] eNB TX thread: sched_setattr failed\n");
-    exit(-1);
-  }
-#endif	
-  
-  time_req_1us.tv_sec = 1;
-  time_req_1us.tv_nsec = 0;
-  spp_eth = dev->eth_dev.openair0_cfg->samples_per_packet;
-  spp_rf =  dev->devs->openair0_cfg->samples_per_packet;
-  samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
-  samples_per_subframe = (unsigned int)samples_per_frame/10;
-  tx_pos=0;
-
-  loopback = dev->loopback;
-  measurements = dev->measurements;
-  
-  while (rrh_exit == 0) {     
-    while (tx_pos < (1 + subframe)*samples_per_subframe) {
-      
-      //LOG_D(RRH,"bef lock read:%d  %d\n",sync_trx,frame);
-      //pthread_mutex_lock(&sync_trx_mutex);
-      
-      //while (!sync_trx) {
-      //LOG_D(RRH,"in sync read:%d  %d\n",sync_trx,frame);
-      //pthread_cond_wait(&sync_trx_cond,&sync_trx_mutex);
-      //}
-      //LOG_D(RRH,"out of while read:%d  %d\n",sync_trx,frame);
-      
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX, 1 );
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME, frame);
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME, subframe );
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_PCK, pck_tx );
-          
-      if (measurements == 1 ) 	clock_gettime(CLOCK_MONOTONIC,&time1); 
-      for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) tx_eNB[i] = (void*)&tx_buffer_eNB[i][tx_pos];		
-      
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TXCNT, tx_pos );
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 );
-      
-      /* Read operation to ETHERNET device */
-      if (( bytes_received = dev->eth_dev.trx_read_func(&dev->eth_dev,
-							&timestamp_tx,
-							tx_eNB,
-							spp_eth,
-							dev->eth_dev.openair0_cfg->tx_num_channels))<0) {
-	perror("RRH eNB : ETHERNET read");
-      }		
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );	
-      
-      if (dev->devs->type != NONE_DEV) {  
-	LOG_D(RRH," tx_buffer_eNB[i][tx_pos]=%x t_buffer_eNB[i][tx_pos+1]=%x t_buffer_eNB[i][tx_pos+2]=%x \n",tx_buffer_eNB[0][tx_pos],tx_buffer_eNB[0][tx_pos+1],tx_buffer_eNB[0][tx_pos+2]);	 
-	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_RF, 1 );    
-	/* Write operation to RF device (TX)*/
-	if ( dev->devs->trx_write_func (dev->devs,
-					timestamp_tx,
-					tx_eNB,
-					spp_rf,
-					dev->devs->openair0_cfg->tx_num_channels,
-					1)<0){
-	  perror("RRH eNB : USRP write");
-	}
-	VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_RF, 0 );
-      }
-      
-      VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_TS, timestamp_tx&0xffffffff ); 
-      
-            
-      //if (dev->devs->type == NONE_DEV)	last_hw_counter=hw_counter;
-    
-    
-      if (loopback ==1 ) { 
-	while (sync_eNB_rx[i]==0)
-	  nanosleep(&time_req_1us,&time_rem_1us);
-	
-	pthread_mutex_lock(&sync_eNB_mutex[i]);
-	sync_eNB_rx[i]++;
-	pthread_mutex_unlock(&sync_eNB_mutex[i]);
-      }      
-      
-      if (measurements == 1 ) {
-	clock_gettime(CLOCK_MONOTONIC,&time2);
-	memcpy(&time0,&time2,sizeof(struct timespec));
-      }   
-      
-      prev_tx_pos=tx_pos;
-      tx_pos += spp_eth;
-      pck_tx++;   
-      
-      //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX, 0 );
-      //sync_trx=0;
-      //pthread_cond_signal(&sync_trx_cond);
-      //pthread_mutex_unlock(&sync_trx_mutex);
-    }
-
-    /* wrap around tx buffer index */
-    if (tx_pos >= samples_per_frame)
-      tx_pos -= samples_per_frame;    
-    /* wrap around subframe number */ 
-    subframe++;
-    if (subframe == 10 ) {
-      subframe = 0; // the radio frame is complete, start over
-      frame++;
-    }
-    
-  } //while (eNB_exit==0)   
-  return 0;
-}
-
-
-static void calc_rt_period_ns( openair0_config_t *openair0_cfg) {
-
-  rt_period= (double)(openair0_cfg->samples_per_packet/(openair0_cfg->samples_per_frame/10.0)*1000000);
-  AssertFatal(rt_period > 0, "Invalid rt period !%u\n", rt_period);
-  LOG_I(RRH,"[eNB] Real time period is set to %u ns\n", rt_period);	
-}
-
-
-static void check_dev_config( rrh_module_t *mod_enb) {
-    
- AssertFatal( (mod_enb->devs->openair0_cfg->num_rb_dl==100 || mod_enb->devs->openair0_cfg->num_rb_dl==50 || mod_enb->devs->openair0_cfg->num_rb_dl==25 || mod_enb->devs->openair0_cfg->num_rb_dl==6) , "Invalid number of resource blocks! %d\n", mod_enb->devs->openair0_cfg->num_rb_dl);
- AssertFatal( mod_enb->devs->openair0_cfg->samples_per_frame  > 0 ,  "Invalid number of samples per frame! %d\n",mod_enb->devs->openair0_cfg->samples_per_frame); 
- AssertFatal( mod_enb->devs->openair0_cfg->sample_rate        > 0.0, "Invalid sample rate! %f\n", mod_enb->devs->openair0_cfg->sample_rate);
- AssertFatal( mod_enb->devs->openair0_cfg->samples_per_packet > 0 ,  "Invalid number of samples per packet! %d\n",mod_enb->devs->openair0_cfg->samples_per_packet);
- AssertFatal( mod_enb->devs->openair0_cfg->rx_num_channels    > 0 ,  "Invalid number of RX antennas! %d\n", mod_enb->devs->openair0_cfg->rx_num_channels); 
- AssertFatal( mod_enb->devs->openair0_cfg->tx_num_channels    > 0 ,  "Invalid number of TX antennas! %d\n", mod_enb->devs->openair0_cfg->tx_num_channels);
- AssertFatal( mod_enb->devs->openair0_cfg->rx_freq[0]         > 0.0 ,"Invalid RX frequency! %f\n", mod_enb->devs->openair0_cfg->rx_freq[0]); 
- AssertFatal( mod_enb->devs->openair0_cfg->tx_freq[0]         > 0.0 ,"Invalid TX frequency! %f\n", mod_enb->devs->openair0_cfg->tx_freq[0]);
- AssertFatal( mod_enb->devs->openair0_cfg->rx_gain[0]         > 0.0 ,"Invalid RX gain! %f\n", mod_enb->devs->openair0_cfg->rx_gain[0]); 
- AssertFatal( mod_enb->devs->openair0_cfg->tx_gain[0]         > 0.0 ,"Invalid TX gain! %f\n", mod_enb->devs->openair0_cfg->tx_gain[0]);
- AssertFatal( mod_enb->devs->openair0_cfg->rx_bw              > 0.0 ,"Invalid RX bw! %f\n", mod_enb->devs->openair0_cfg->rx_bw); 
- AssertFatal( mod_enb->devs->openair0_cfg->tx_bw              > 0.0 ,"Invalid RX bw! %f\n", mod_enb->devs->openair0_cfg->tx_bw);
- AssertFatal( mod_enb->devs->openair0_cfg->autocal[0]         > 0 ,  "Invalid auto calibration choice! %d\n", mod_enb->devs->openair0_cfg->autocal[0]);
- 
- printf("\n---------------------RF device configuration parameters---------------------\n");
- 
- printf("\tMod_id=%d\n \tlog level=%d\n \tDL_RB=%d\n \tsamples_per_frame=%d\n \tsample_rate=%f\n \tsamples_per_packet=%d\n \ttx_sample_advance=%d\n \trx_num_channels=%d\n \ttx_num_channels=%d\n \trx_freq_0=%f\n \ttx_freq_0=%f\n \trx_freq_1=%f\n \ttx_freq_1=%f\n \trx_freq_2=%f\n \ttx_freq_2=%f\n \trx_freq_3=%f\n \ttx_freq_3=%f\n \trxg_mode=%d\n \trx_gain_0=%f\n \ttx_gain_0=%f\n  \trx_gain_1=%f\n \ttx_gain_1=%f\n  \trx_gain_2=%f\n \ttx_gain_2=%f\n  \trx_gain_3=%f\n \ttx_gain_3=%f\n \trx_gain_offset_2=%f\n \ttx_gain_offset_3=%f\n  \trx_bw=%f\n \ttx_bw=%f\n \tautocal=%d\n",	
-	mod_enb->devs->openair0_cfg->Mod_id,
-	mod_enb->devs->openair0_cfg->log_level,
-	mod_enb->devs->openair0_cfg->num_rb_dl,
-	mod_enb->devs->openair0_cfg->samples_per_frame,
-	mod_enb->devs->openair0_cfg->sample_rate,
-	mod_enb->devs->openair0_cfg->samples_per_packet,
-	mod_enb->devs->openair0_cfg->tx_sample_advance,
-	mod_enb->devs->openair0_cfg->rx_num_channels,
-	mod_enb->devs->openair0_cfg->tx_num_channels,
-	mod_enb->devs->openair0_cfg->rx_freq[0],
-	mod_enb->devs->openair0_cfg->tx_freq[0],
-	mod_enb->devs->openair0_cfg->rx_freq[1],
-	mod_enb->devs->openair0_cfg->tx_freq[1],
-	mod_enb->devs->openair0_cfg->rx_freq[2],
-	mod_enb->devs->openair0_cfg->tx_freq[2],
-	mod_enb->devs->openair0_cfg->rx_freq[3],
-	mod_enb->devs->openair0_cfg->tx_freq[3],
-	mod_enb->devs->openair0_cfg->rxg_mode[0],
-	mod_enb->devs->openair0_cfg->tx_gain[0],
-	mod_enb->devs->openair0_cfg->tx_gain[0],
-	mod_enb->devs->openair0_cfg->rx_gain[1],
-	mod_enb->devs->openair0_cfg->tx_gain[1],
-	mod_enb->devs->openair0_cfg->rx_gain[2],
-	mod_enb->devs->openair0_cfg->tx_gain[2],
-	mod_enb->devs->openair0_cfg->rx_gain[3],
-	mod_enb->devs->openair0_cfg->tx_gain[3],
-	//mod_enb->devs->openair0_cfg->rx_gain_offset[0],
-	//mod_enb->devs->openair0_cfg->rx_gain_offset[1],
-	mod_enb->devs->openair0_cfg->rx_gain_offset[2],
-	mod_enb->devs->openair0_cfg->rx_gain_offset[3],
-	mod_enb->devs->openair0_cfg->rx_bw,
-	mod_enb->devs->openair0_cfg->tx_bw,
-	mod_enb->devs->openair0_cfg->autocal[0]  
-	);
- 
- printf("----------------------------------------------------------------------------\n");
- 
- 
-}
diff --git a/targets/RT/USER/emos-raw.c b/targets/RT/USER/emos-raw.c
deleted file mode 100644
index 16709da7cf52841a73df4385a0b86235d2b3c6d7..0000000000000000000000000000000000000000
--- a/targets/RT/USER/emos-raw.c
+++ /dev/null
@@ -1,1603 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file lte-softmodem.c
-* \brief main program to control HW and scheduling
-* \author R. Knopp, F. Kaltenberger
-* \date 2012
-* \version 0.1
-* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
-* \note
-* \warning
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <signal.h>
-#include <execinfo.h>
-#include <getopt.h>
-
-#include "rt_wrapper.h"
-
-#include "PHY/types.h"
-#include "PHY/TOOLS/defs.h"
-#include "openair0_lib.h"
-
-#include "UTIL/LOG/log.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-
-#include "gain_control.h"
-
-#if defined(ENABLE_ITTI)
-# include "intertask_interface_init.h"
-# include "timer.h"
-# if defined(ENABLE_USE_MME)
-#   include "s1ap_eNB.h"
-#   include "sctp_eNB_task.h"
-# endif
-#endif
-
-#define OPENAIR_THREAD_PRIORITY       255
-#define OPENAIR_THREAD_STACK_SIZE    8192
-
-#ifdef XFORMS
-/*
-#include "PHY/TOOLS/lte_phy_scope.h"
-#include "stats.h"
-// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
-// at eNB 0, an UL scope for every UE
-FD_lte_phy_scope_ue  *form_ue[NUMBER_OF_UE_MAX];
-FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
-FD_stats_form *form_stats=NULL;
-char title[255];
-unsigned char scope_enb_num_ue = 1;
-*/
-#include "lte_scope.h"
-FD_lte_scope *form_lte;
-char title[255];
-#endif //XFORMS
-
-#ifdef EMOS
-#include <gps.h>
-struct gps_fix_t dummy_gps_data;
-#ifdef RTAI
-#include <rtai_fifos.h>
-#endif
-
-//#define CHANSOUNDER_FIFO_SIZE 10485760  //  10 Mbytes FIFO
-//#define CHANSOUNDER_FIFO_SIZE 20971520  //  20 Mbytes FIFO
-#define CHANSOUNDER_FIFO_SIZE 52428800  //  50 Mbytes FIFO
-//#define CHANSOUNDER_FIFO_SIZE 104857600 // 100 Mbytes FIFO
-//#define CHANSOUNDER_FIFO_SIZE 1073741824 // 1Gbyte FIFO
-#define CHANSOUNDER_FIFO_MINOR 4               // minor of the FIFO device - this is /dev/rtf3
-#define CHANSOUNDER_FIFO_DEV "/dev/rtf4"
-#endif
-
-#define FRAME_PERIOD 100000000ULL
-#define DAQ_PERIOD 66667ULL
-#define LTE_SLOTS_PER_FRAME  20
-//#define RESAMPLING_FACTOR 0
-#define SAMPLES_PER_SLOT 15360
-#define FRAME_LENGTH_COMPLEX_SAMPLES (SAMPLES_PER_SLOT*LTE_SLOTS_PER_FRAME)
-#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
-
-#ifdef RTAI
-static SEM *mutex;
-//static CND *cond;
-
-static long int thread0;
-//static long int thread1;
-//static long int sync_thread;
-#else
-pthread_t thread0;
-//pthread_t thread1;
-pthread_attr_t attr_dlsch_threads;
-struct sched_param sched_param_dlsch;
-#endif
-
-pthread_t  thread2; //xforms
-pthread_t  thread3; //emos
-pthread_t  thread4; //GPS
-pthread_t  thread5; //log
-
-/*
-static int instance_cnt=-1; //0 means worker is busy, -1 means its free
-int instance_cnt_ptr_kern,*instance_cnt_ptr_user;
-int pci_interface_ptr_kern;
-*/
-//extern unsigned int bigphys_top;
-//extern unsigned int mem_base;
-
-int number_of_cards = 1;
-exmimo_config_t *p_exmimo_config;
-exmimo_id_t     *p_exmimo_id;
-volatile unsigned int *DAQ_MBOX;
-
-int oai_exit = 0;
-
-//int time_offset[4] = {-138,-138,-138,-138};
-//int time_offset[4] = {-145,-145,-145,-145};
-int time_offset[4] = {0,0,0,0};
-
-int fs4_test=0;
-char UE_flag=0;
-uint8_t  eNB_id=0,UE_id=0;
-
-// this array sets the bandwidth used for each card (and applies to all chains on one card).
-exmimo_bw_t bandwidth[MAX_CARDS]    = {BW5,BW5,BW5,BW5};
-// the array  carrier_freq sets the frequency for each chain of each card. A 0 means that the chain is disabled.
-// Please make sure that the total number of channels enabled per card is in accordance with the following rules:
-// BW20: one channel, BW10: 2 channels, BW5: 4 channels
-//uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0}};
-//uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0},{0,0,0,0}};
-uint32_t      carrier_freq[MAX_CARDS][4] = {{771500000,771500000,771500000,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};
-
-// the following paramters set the aquisition time and period. These parameters have to be set in accordance with the write speed of your harddisk and the required throughput according to the setting above (see also channel_buffer_size which is computed later).
-#define AQU_LENGTH_FRAMES 100 //Aquisition time in frames
-#define AQU_PERIOD_FRAMES 100 //Repetition time of aquisition in frames
-#define AQU_LENGTH_SLOTS (AQU_LENGTH_FRAMES*LTE_SLOTS_PER_FRAME) //Aquisition time in slots
-#define AQU_PERIOD_SLOTS (AQU_PERIOD_FRAMES*LTE_SLOTS_PER_FRAME) //Repetition time of aquisition in slots
-
-int32_t rx_total_gain_dB[3] = {-112, -124, -136};
-
-/*
-// this array sets the bandwidth used for each card (and applies to all chains on one card).
-exmimo_bw_t bandwidth[MAX_CARDS]    = {BW20,BW20,BW10,BW5};
-// the array  carrier_freq sets the frequency for each chain of each card. A 0 means that the chain is disabled.
-// Please make sure that the total number of channels enabled per card is in accordance with the following rules:
-// BW20: one channel, BW10: 2 channels, BW5: 4 channels
-uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0}};
-//uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0},{0,0,0,0}};
-//uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};
-
-// the following paramters set the aquisition time and period. These parameters have to be set in accordance with the write speed of your harddisk and the required throughput according to the setting above (see also channel_buffer_size which is computed later).
-#define AQU_LENGTH_FRAMES 100 //Aquisition time in frames
-#define AQU_PERIOD_FRAMES 200 //Repetition time of aquisition in frames
-#define AQU_LENGTH_SLOTS (AQU_LENGTH_FRAMES*LTE_SLOTS_PER_FRAME) //Aquisition time in slots
-#define AQU_PERIOD_SLOTS (AQU_PERIOD_FRAMES*LTE_SLOTS_PER_FRAME) //Repetition time of aquisition in slots
-
-int32_t rx_total_gain_dB[3] = {-105, -110, -115};
-*/
-
-char dumpfile_dir[256] = "/mnt/emos";
-
-char *conf_config_file_name = NULL;
-
-unsigned int lost_bytes=0;
-unsigned int rssi_lin[MAX_CARDS][4],rssi_lin_max[MAX_CARDS],rssi_lin_avg[MAX_CARDS];
-uint8_t rssi_avg_dB[MAX_CARDS];
-long long unsigned int total_bytes=0;
-
-struct timing_info_t {
-  //unsigned int frame, hw_slot, last_slot, next_slot;
-  RTIME time_min, time_max, time_avg, time_last, time_now;
-  //unsigned int mbox0, mbox1, mbox2, mbox_target;
-  unsigned int n_samples;
-} timing_info;
-
-extern int16_t* sync_corr_ue0;
-extern int16_t prach_ifft[4][1024*2];
-
-unsigned int frame;
-int rx_input_level_dBm;
-#ifdef XFORMS
-extern int otg_enabled;
-#else
-int otg_enabled;
-#endif
-
-int mbox_bounds[20] = {8,16,24,30,38,46,54,60,68,76,84,90,98,106,114,120,128,136,144, 0}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
-//int mbox_bounds[20] = {6,14,22,28,36,44,52,58,66,74,82,88,96,104,112,118,126,134,142, 148}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
-
-//void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
-//void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
-void test_config(int card, int ant, unsigned int rf_mode, int UE_flag);
-
-unsigned int build_rflocal(int txi, int txq, int rxi, int rxq)
-{
-  return (txi + (txq<<6) + (rxi<<12) + (rxq<<18));
-}
-unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe)
-{
-  return (dcoff_i_rxfe + (dcoff_q_rxfe<<8));
-}
-
-void signal_handler(int sig)
-{
-  void *array[10];
-  size_t size;
-
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    oai_exit=1;
-  }
-}
-
-void exit_fun(const char* s)
-{
-  void *array[10];
-  size_t size;
-
-  printf("Exiting: %s\n",s);
-
-  oai_exit=1;
-  //rt_sleep_ns(FRAME_PERIOD);
-
-  //exit (-1);
-}
-
-#ifdef XFORMS
-extern void ia_receiver_on_off( FL_OBJECT * form, long arg) {}
-
-
-void *scope_thread(void *arg)
-{
-  int16_t prach_corr[1024];
-  char stats_buffer[16384];
-  //FILE *UE_stats, *eNB_stats;
-  int i,len=0;
-  float rxsig_t_dB[4][FRAME_LENGTH_COMPLEX_SAMPLES];
-  float time[FRAME_LENGTH_COMPLEX_SAMPLES];
-  struct sched_param sched_param;
-  int card,ant,idx;
-
-  sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("Scope thread has priority %d\n",sched_param.sched_priority);
-
-  /*
-    if (UE_flag==1)
-    UE_stats  = fopen("UE_stats.txt", "w");
-    else
-    eNB_stats = fopen("eNB_stats.txt", "w");
-  */
-
-  while (!oai_exit) {
-    /*
-      if (UE_flag==1) {
-          len = dump_ue_stats (PHY_vars_UE_g[0], stats_buffer, 0, mode,rx_input_level_dBm);
-          fl_set_object_label(form_stats->stats_text, stats_buffer);
-          //rewind (UE_stats);
-          //fwrite (stats_buffer, 1, len, UE_stats);
-
-          phy_scope_UE(form_ue[UE_id],
-                       PHY_vars_UE_g[UE_id],
-                       eNB_id,
-                       UE_id,7);
-
-      } else {
-          len = dump_eNB_stats (PHY_vars_eNB_g[0], stats_buffer, 0);
-          fl_set_object_label(form_stats->stats_text, stats_buffer);
-          //rewind (eNB_stats);
-          //fwrite (stats_buffer, 1, len, eNB_stats);
-          for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
-              phy_scope_eNB(form_enb[UE_id],
-                            PHY_vars_eNB_g[eNB_id],
-                            UE_id);
-          }
-
-      }
-    */
-
-    idx = 0;
-
-    for (card=0; card<number_of_cards; card++) {
-      for (ant=0; ant<4; ant++) {
-        if ((carrier_freq[card][ant] != 0) && (idx<4)) {
-          len = FRAME_LENGTH_COMPLEX_SAMPLES/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[ant]);
-
-          for (i=0; i<len; i++) {
-            //rxsig_t_dB[0][i] = 10*log10(1.0+(float) ((((int16_t*) openair0_exmimo_pci[card].adc_head[0])[2*i])*(((int16_t*) openair0_exmimo_pci[card].adc_head[0])[2*i])+(((int16_t*) openair0_exmimo_pci[card].adc_head[0])[2*i+1])*(((int16_t*) openair0_exmimo_pci[card].adc_head[0])[2*i+1])));
-            rxsig_t_dB[0][i] = (float) ((((int16_t*) openair0_exmimo_pci[card].adc_head[ant])[2*i]));
-            rxsig_t_dB[1][i] = (float) ((((int16_t*) openair0_exmimo_pci[card].adc_head[ant])[2*i+1]));
-            time[i] = (float) i;
-          }
-
-          fl_set_xyplot_data(form_lte->channel_t_re[idx],time,rxsig_t_dB[0],len,"","","");
-          fl_set_xyplot_data(form_lte->channel_t_im[idx],time,rxsig_t_dB[1],len,"","","");
-          idx++;
-        }
-      }
-    }
-
-    //printf("doing forms\n");
-    usleep(100000);
-  }
-
-  //fclose (UE_stats);
-  //fclose (eNB_stats);
-
-  pthread_exit((void*)arg);
-}
-#endif
-
-int dummy_tx_buffer[3840*4] __attribute__((aligned(16)));
-
-
-#ifdef EMOS
-void* gps_thread (void *arg)
-{
-
-  struct gps_data_t gps_data;
-  struct gps_data_t *gps_data_ptr = &gps_data;
-  struct sched_param sched_param;
-  int ret;
-
-  sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("GPS thread has priority %d\n",sched_param.sched_priority);
-
-  memset(&dummy_gps_data,0,sizeof(struct gps_fix_t));
-
-#if GPSD_API_MAJOR_VERSION>=5
-  ret = gps_open("127.0.0.1","2947",gps_data_ptr);
-
-  if (ret!=0)
-#else
-  gps_data_ptr = gps_open("127.0.0.1","2947");
-
-  if (gps_data_ptr == NULL)
-#endif
-  {
-    printf("[EMOS] Could not open GPS\n");
-    pthread_exit((void*)arg);
-  }
-
-#if GPSD_API_MAJOR_VERSION>=4
-  else if (gps_stream(gps_data_ptr, WATCH_ENABLE,NULL) != 0)
-#else
-  else if (gps_query(gps_data_ptr, "w+x") != 0)
-#endif
-  {
-    printf("[EMOS] Error sending command to GPS\n");
-    pthread_exit((void*) arg);
-  } else
-    printf("[EMOS] Opened GPS, gps_data=%p\n", gps_data_ptr);
-
-
-  while (!oai_exit) {
-    printf("[EMOS] polling data from gps\n");
-#if GPSD_API_MAJOR_VERSION>=5
-
-    if (gps_waiting(gps_data_ptr,500)) {
-      if (gps_read(gps_data_ptr) <= 0) {
-#else
-
-    if (gps_waiting(gps_data_ptr)) {
-      if (gps_poll(gps_data_ptr) != 0) {
-#endif
-        printf("[EMOS] problem polling data from gps\n");
-      } else {
-        memcpy(&dummy_gps_data,&(gps_data_ptr->fix),sizeof(struct gps_fix_t));
-        printf("[EMOS] lat %g, lon %g\n",gps_data_ptr->fix.latitude,gps_data_ptr->fix.longitude);
-      }
-    } //gps_waiting
-    else {
-      printf("[EMOS] WARNING: No GPS data available, storing dummy packet\n");
-    }
-
-    //rt_sleep_ns(1000000000LL);
-    sleep(1);
-  } //oai_exit
-
-  pthread_exit((void*) arg);
-
-}
-
-void *log_thread (void *arg)
-{
-  //struct tm now_sec;
-  struct timeval now;
-  int card;
-  FILE *logfile_id;
-  char logfile_name[1024];
-  time_t starttime_tmp;
-  struct tm starttime;
-
-  //open file
-  time(&starttime_tmp);
-  localtime_r(&starttime_tmp,&starttime);
-  snprintf(logfile_name,1024,"%s/%s_data_%d%02d%02d_%02d%02d%02d.log",
-           dumpfile_dir,
-           (UE_flag==0) ? "eNB" : "UE",
-           1900+starttime.tm_year, starttime.tm_mon+1, starttime.tm_mday, starttime.tm_hour, starttime.tm_min, starttime.tm_sec);
-  logfile_id = fopen(logfile_name,"w");
-
-  if ((logfile_id == NULL)) {
-    fprintf(stderr, "[EMOS] Error opening logfile %s\n",logfile_name);
-    exit(EXIT_FAILURE);
-  }
-
-  fprintf(logfile_id,
-          "#time, frame, total bytes wrote, total bytes lost, GPS time, GPS mode, lat, lon, alt, speed, rssi_lin_max[0], rssi_lin_avg[0], rssi_avg_dBm[0], rssi_avg_dB[0], rx_gain[0], LNA[0], ...\n");
-
-  while (!oai_exit) {
-    gettimeofday(&now,NULL);
-    //localtime_r(&(now.tv_sec),&now_sec);
-    fprintf(logfile_id,"%d.%06d, %d, %llu, %u, %e, %d, %e, %e, %e, %e, ",
-            (int) now.tv_sec, (int)now.tv_usec,
-            frame, total_bytes,lost_bytes,
-            dummy_gps_data.time, dummy_gps_data.mode, dummy_gps_data.latitude, dummy_gps_data.longitude, dummy_gps_data.altitude, dummy_gps_data.speed);
-
-    for (card=0; card<number_of_cards; card++)
-      if (carrier_freq[card][0] != 0)
-        fprintf(logfile_id,"%d, %d, %d, %d, %d, %d, ", rssi_lin_max[card], rssi_lin_avg[card],
-                rssi_avg_dB[card] + rx_total_gain_dB[((openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0] & LNAGAINMASK) >> 14)-1] - openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0],
-                rssi_avg_dB[card], openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0], (openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0] & LNAGAINMASK) >> 14);
-
-    fprintf(logfile_id,"\n");
-    usleep(10000);
-  }
-
-  //close file
-  fclose(logfile_id);
-
-  pthread_exit((void*) arg);
-
-}
-
-void *emos_thread (void *arg)
-{
-  char c;
-  char *fifo2file_buffer, *fifo2file_ptr;
-
-  int fifo, counter=0, bytes;
-
-  FILE  *dumpfile_id;
-  char  dumpfile_name[1024];
-  time_t starttime_tmp;
-  struct tm starttime;
-
-  //time_t timer;
-  struct tm now_sec;
-  struct timeval now;
-
-  struct sched_param sched_param;
-  int ret;
-
-  int card, ant;
-  int channel_buffer_size=0; //in bytes
-
-  pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
-
-  sched_param.sched_priority = sched_get_priority_max(SCHED_FIFO)-1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("EMOS thread has priority %d\n",sched_param.sched_priority);
-
-  //timer = time(NULL);
-  //now = localtime(&timer);
-
-  for (card=0; card<number_of_cards; card++)
-    for (ant=0; ant<4; ant++)
-      if (carrier_freq[card][ant] != 0) {
-        printf("card %d, ant %d: freq %u, BW %d\n",card,ant,carrier_freq[card][ant],bandwidth[card]);
-        channel_buffer_size += SAMPLES_PER_SLOT/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[ant]);
-      }
-
-  channel_buffer_size *= 4; //4 bytes per sample
-
-  // allocate memory for NO_FRAMES_DISK channes estimations
-  fifo2file_buffer = malloc(AQU_LENGTH_SLOTS*channel_buffer_size);
-  fifo2file_ptr = fifo2file_buffer;
-
-  if (fifo2file_buffer == NULL) {
-    printf("[EMOS] Cound not allocate memory for fifo2file_buffer\n");
-    exit(EXIT_FAILURE);
-  }
-
-  if ((fifo = open(CHANSOUNDER_FIFO_DEV, O_RDONLY)) < 0) {
-    fprintf(stderr, "[EMOS] Error opening the fifo\n");
-    exit(EXIT_FAILURE);
-  }
-
-
-  time(&starttime_tmp);
-  localtime_r(&starttime_tmp,&starttime);
-  snprintf(dumpfile_name,1024,"%s/%s_data_%d%02d%02d_%02d%02d%02d.EMOS",
-           dumpfile_dir,
-           (UE_flag==0) ? "eNB" : "UE",
-           1900+starttime.tm_year, starttime.tm_mon+1, starttime.tm_mday, starttime.tm_hour, starttime.tm_min, starttime.tm_sec);
-
-  dumpfile_id = fopen(dumpfile_name,"w");
-
-  if ((dumpfile_id == NULL)) {
-    fprintf(stderr, "[EMOS] Error opening dumpfile %s\n",dumpfile_name);
-    exit(EXIT_FAILURE);
-  }
-
-  printf("[EMOS] starting dump, channel_buffer_size=%d ...\n",channel_buffer_size);
-
-  while (!oai_exit) {
-    //bytes = rtf_read_timed(fifo, fifo2file_ptr, channel_buffer_size,100);
-    bytes = rtf_read_all_at_once(fifo, fifo2file_ptr, channel_buffer_size);
-
-    if (bytes<=0) {
-      usleep(100);
-      continue;
-    }
-
-    if (bytes != channel_buffer_size) {
-      printf("[EMOS] Frame %d: ERROR! Only got %d bytes instead of %d!\n",frame,bytes,channel_buffer_size);
-    }
-
-    /*
-    if (UE_flag==0)
-    printf("eNB: count %d, frame %d, read: %d bytes from the fifo\n",counter, ((fifo_dump_emos_eNB*)fifo2file_ptr)->frame_tx,bytes);
-    else
-    printf("UE: count %d, frame %d, read: %d bytes from the fifo\n",counter, ((fifo_dump_emos_UE*)fifo2file_ptr)->frame_rx,bytes);
-    */
-
-    fifo2file_ptr += channel_buffer_size;
-    counter ++;
-    total_bytes += bytes;
-
-    if ((counter%AQU_LENGTH_SLOTS)==0) {
-      //reset stuff
-      fifo2file_ptr = fifo2file_buffer;
-      //counter = 0;
-
-      printf("[EMOS] Frame %d: start writing %d bytes to disk\n",frame,AQU_LENGTH_SLOTS*channel_buffer_size);
-
-      //flush buffer to disk
-      if (fwrite(fifo2file_buffer, sizeof(char), AQU_LENGTH_SLOTS*channel_buffer_size, dumpfile_id) != AQU_LENGTH_SLOTS*channel_buffer_size) {
-        fprintf(stderr, "[EMOS] Error writing to dumpfile\n");
-        exit(EXIT_FAILURE);
-      } else
-        printf("[EMOS] Frame %d: wrote %d bytes to disk\n",frame,AQU_LENGTH_SLOTS*channel_buffer_size);
-
-    }
-
-    if ((counter%AQU_LENGTH_SLOTS)==0) {
-      //time(&starttime_tmp);
-      gettimeofday(&now,NULL);
-      localtime_r(&(now.tv_sec),&now_sec);
-      printf("[EMOS] %02d:%02d:%02d.%03d, frame %d, total bytes wrote %llu, bytes lost %u\n",
-             now_sec.tm_hour, now_sec.tm_min, now_sec.tm_sec, (int)(now.tv_usec/1000), frame, total_bytes,lost_bytes);
-
-      for (card=0; card<number_of_cards; card++)
-        if (carrier_freq[card][0] != 0)
-          printf("[EMOS] %02d:%02d:%02d.%03d, card %d, rssi_lin_max %d, rssi_lin_avg %d, rssi_avg_dBm %d (rssi_avg_dB %d, rx_gain %d, LNA %d)\n",
-                 now_sec.tm_hour, now_sec.tm_min, now_sec.tm_sec, (int)(now.tv_usec/1000), card, rssi_lin_max[card], rssi_lin_avg[card],
-                 rssi_avg_dB[card] + rx_total_gain_dB[((openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0] & LNAGAINMASK) >> 14)-1] - openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0],
-                 rssi_avg_dB[card], openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0], (openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0] & LNAGAINMASK) >> 14);
-
-      //printf("[EMOS] %02d:%02d:%02d, frame %d, GPS time %e, GPS mode %d, lat %e, lon %e, alt %e, speed %e\n", starttime.tm_hour, starttime.tm_min, starttime.tm_sec, counter/20, dummy_gps_data.time, dummy_gps_data.mode, dummy_gps_data.latitude, dummy_gps_data.longitude, dummy_gps_data.altitude, dummy_gps_data.speed);
-    }
-  }
-
-  free(fifo2file_buffer);
-  fclose(dumpfile_id);
-  close(fifo);
-
-  pthread_exit((void*) arg);
-
-}
-#endif
-
-/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
-static void *eNB_thread(void *arg)
-{
-#ifdef RTAI
-  RT_TASK *task;
-#endif
-  unsigned char slot=0,last_slot, next_slot, hw_slot;
-  unsigned int msg1;
-  unsigned int aa,slot_offset, slot_offset_F;
-  int diff;
-  int delay_cnt;
-  RTIME time_in, time_diff;
-  int mbox_target=0,mbox_current=0;
-  int i,ret;
-  int tx_offset;
-  int bytes, bytes_tot=0, bytes_len;
-  long long int k1=1000;
-  long long int k2=1024-k1;
-  int ant,len,card = 0;
-
-#ifdef RTAI
-  task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
-  LOG_D(HW,"Started eNB thread (id %p)\n",task);
-#endif
-
-#ifdef HARD_RT
-  rt_make_hard_real_time();
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  timing_info.time_min = 100000000ULL;
-  timing_info.time_max = 0;
-  timing_info.time_avg = 0;
-  timing_info.n_samples = 0;
-
-  while (!oai_exit) {
-    hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
-    //LOG_D(HW,"eNB frame %d, time %llu: slot %d, hw_slot %d (mbox %d)\n",frame,rt_get_time_ns(),slot,hw_slot,((unsigned int *)DAQ_MBOX)[0]);
-    //this is the mbox counter where we should be
-    //mbox_target = ((((slot+1)%20)*15+1)>>1)%150;
-    mbox_target = mbox_bounds[slot];
-    //this is the mbox counter where we are
-    mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
-
-    //this is the time we need to sleep in order to synchronize with the hw (in multiples of DAQ_PERIOD)
-    if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround
-      diff = 150-mbox_current+mbox_target;
-    else if ((mbox_current<15) && (mbox_target>=135))
-      diff = -150+mbox_target-mbox_current;
-    else
-      diff = mbox_target - mbox_current;
-
-    if (diff < (-7)) {
-      // at the eNB, even slots have double as much time since most of the processing is done here and almost nothing in odd slots
-      LOG_D(HW,"eNB Frame %d, time %llu: missed slot, proceeding with next one (slot %d, hw_slot %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, diff);
-      slot++;
-
-      //if (frame>0)
-      //oai_exit=1;
-      if (slot==20) {
-        slot=0;
-        frame++;
-      }
-
-      continue;
-    }
-
-    if (diff>8)
-      LOG_D(HW,"eNB Frame %d, time %llu: skipped slot, waiting for hw to catch up (slot %d, hw_slot %d, mbox_current %d, mbox_target %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, mbox_current,
-            mbox_target, diff);
-
-    delay_cnt = 0;
-
-    while ((diff>0) && (!oai_exit)) {
-      time_in = rt_get_time_ns();
-      //LOG_D(HW,"eNB Frame %d delaycnt %d : hw_slot %d (%d), slot %d, (slot+1)*15=%d, diff %d, time %llu\n",frame,delay_cnt,hw_slot,((unsigned int *)DAQ_MBOX)[0],slot,(((slot+1)*15)>>1),diff,time_in);
-      //LOG_D(HW,"eNB Frame %d, time %llu: sleeping for %llu (slot %d, hw_slot %d, diff %d, mbox %d, delay_cnt %d)\n", frame, time_in, diff*DAQ_PERIOD,slot,hw_slot,diff,((volatile unsigned int *)DAQ_MBOX)[0],delay_cnt);
-      ret = rt_sleep_ns(diff*DAQ_PERIOD);
-
-      if (ret)
-        LOG_D(HW,"eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame, time_in);
-
-      hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
-      //LOG_D(HW,"eNB Frame %d : hw_slot %d, time %llu\n",frame,hw_slot,rt_get_time_ns());
-      delay_cnt++;
-
-      if (delay_cnt == 10) {
-        oai_exit = 1;
-        LOG_D(HW,"eNB Frame %d: HW stopped ... \n",frame);
-      }
-
-      mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
-
-      if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround
-        diff = 150-mbox_current+mbox_target;
-      else if ((mbox_current<15) && (mbox_target>=135))
-        diff = -150+mbox_target-mbox_current;
-      else
-        diff = mbox_target - mbox_current;
-    }
-
-    last_slot = (slot)%LTE_SLOTS_PER_FRAME;
-
-    if (last_slot <0)
-      last_slot+=20;
-
-    next_slot = (slot+3)%LTE_SLOTS_PER_FRAME;
-
-    if (frame>=AQU_LENGTH_FRAMES) {
-      timing_info.time_last = timing_info.time_now;
-      timing_info.time_now = rt_get_time_ns();
-
-      if (timing_info.n_samples>0) {
-        time_diff = timing_info.time_now - timing_info.time_last;
-
-        if (time_diff < timing_info.time_min)
-          timing_info.time_min = time_diff;
-
-        if (time_diff > timing_info.time_max)
-          timing_info.time_max = time_diff;
-
-        timing_info.time_avg += time_diff;
-      }
-
-      timing_info.n_samples++;
-
-      // do measurements for rssi
-      if (last_slot==0) {
-        for (card=0; card<number_of_cards; card++) {
-          len = SAMPLES_PER_SLOT/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[0]);
-          rssi_lin_max[card] = 0;
-
-          for (ant=0; ant<4; ant++) {
-            if (carrier_freq[card][ant] != 0) {
-              rssi_lin[card][ant] = signal_energy(&(((int32_t*) openair0_exmimo_pci[card].adc_head[ant])[last_slot*len]), len);
-              rssi_lin_max[card] = max(rssi_lin_max[card],rssi_lin[card][ant]);
-            }
-          }
-
-          rssi_lin_avg[card] = (int) ((k1*((long long int)(rssi_lin_avg[card])) + (k2*((long long int)(rssi_lin_max[card]))))>>10);
-          rssi_avg_dB[card] = dB_fixed(rssi_lin_avg[card]);
-
-          if (frame%100==0) {
-            gain_control_all(rssi_avg_dB[card],card);
-            //printf("AGC for card %d: rx_power_fil_dB=%d, rx_gain=%d, LNA=%d (1=Byp,2=Med,3=Max)\n",card,rssi_avg_dB,openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0],(openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0]&LNAGAINMASK)>>14);
-          }
-        }
-      }
-
-#ifdef EMOS
-
-      // save raw samples here
-      if ((last_slot==0) && ((frame%AQU_PERIOD_FRAMES)==0)) {
-        printf("[EMOS] Frame %d: start writing to FIFO\n",frame);
-        bytes_tot=0;
-      }
-
-      if ((frame%AQU_PERIOD_FRAMES)<AQU_LENGTH_FRAMES) {
-        for (card=0; card<number_of_cards; card++) {
-          for (ant=0; ant<4; ant++) {
-            if (carrier_freq[card][ant] != 0) {
-              len = SAMPLES_PER_SLOT/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[ant]);
-              bytes_len = len*4;
-              bytes = rtf_put(CHANSOUNDER_FIFO_MINOR, &(((int32_t*) openair0_exmimo_pci[card].adc_head[ant])[last_slot*len]), bytes_len);
-              bytes_tot += bytes;
-
-              if (bytes!=bytes_len) {
-                lost_bytes += bytes_len - bytes;
-                LOG_W(PHY,"Frame %d, slot %d: Problem writing EMOS data to FIFO (bytes=%d, size=%d)\n",
-                      frame, last_slot, bytes, bytes_len);
-              }
-            }
-          }
-        }
-
-        if ((last_slot==19) && ((frame%AQU_PERIOD_FRAMES)==99))
-          printf("[EMOS] Frame %d: sent %d bytes to FIFO\n",frame,bytes_tot);
-
-      }
-
-#endif
-    }
-
-    slot++;
-
-    if (slot==20) {
-      slot=0;
-      frame++;
-    }
-
-#if defined(ENABLE_ITTI)
-    itti_update_lte_time(frame, slot);
-#endif
-  }
-
-  LOG_D(HW,"eNB_thread: finished, ran %d times.\n",frame);
-
-#ifdef HARD_RT
-  rt_make_soft_real_time();
-#endif
-
-  // clean task
-#ifdef RTAI
-  rt_task_delete(task);
-#endif
-  LOG_D(HW,"Task deleted. returning\n");
-  return 0;
-}
-
-
-int main(int argc, char **argv)
-{
-
-#ifdef RTAI
-  RT_TASK *task;
-#endif
-  int i,j,aa;
-  void *status;
-  int card = 0;
-
-  uint32_t rf_mode_base   = TXLPFNORM + TXLPFEN  + RXLPFNORM + RXLPFEN + LNA1ON +LNAMax + RFBBNORM;
-  uint32_t rf_local[4]    = {8255000,8255000,8255000,8255000}; // UE zepto
-  //{8254617, 8254617, 8254617, 8254617}; //eNB khalifa
-  //{8255067,8254810,8257340,8257340}; // eNB PETRONAS
-  uint32_t rf_vcocal[4]   = {910,910,910,910};
-  uint32_t rf_vcocal_850[4] = {2015, 2015, 2015, 2015};
-  uint32_t rf_rxdc[4]     = {32896,32896,32896,32896};
-  uint32_t rxgain[4]      = {30,30,30,30};
-  uint32_t txgain[4]      = {0,0,0,0};
-
-  uint16_t Nid_cell = 0;
-  uint8_t  cooperation_flag=0, transmission_mode=1, abstraction_flag=0;
-  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
-
-  int c;
-  char do_forms=0;
-  unsigned int fd;
-  unsigned int tcxo = 114;
-
-  int amp;
-  uint8_t prach_fmt;
-  int N_ZC;
-
-  char rxg_fname[100];
-  char txg_fname[100];
-  char rflo_fname[100];
-  char rfdc_fname[100];
-  FILE *rxg_fd=NULL;
-  FILE *txg_fd=NULL;
-  FILE *rflo_fd=NULL;
-  FILE *rfdc_fd=NULL;
-  unsigned int rxg_max[4]= {133,133,133,133}, rxg_med[4]= {127,127,127,127}, rxg_byp[4]= {120,120,120,120};
-  int tx_max_power=0;
-
-  char line[1000];
-  int l;
-  int ret, ant;
-  int ant_offset=0;
-
-  int error_code;
-  char *itti_dump_file = NULL;
-
-  const struct option long_options[] = {
-    {"calib-ue-rx", required_argument, NULL, 256},
-    {"calib-ue-rx-med", required_argument, NULL, 257},
-    {"calib-ue-rx-byp", required_argument, NULL, 258},
-    {"debug-ue-prach", no_argument, NULL, 259},
-    {"no-L2-connect", no_argument, NULL, 260},
-    {NULL, 0, NULL, 0}
-  };
-
-  //mode = normal_txrx;
-
-
-  while ((c = getopt_long (argc, argv, "C:K:O:ST:UdF:V",long_options,NULL)) != -1) {
-    switch (c) {
-    case 'V':
-      ouput_vcd = 1;
-      break;
-
-    case 'd':
-      do_forms=1;
-      break;
-
-    case 'U':
-      UE_flag = 1;
-      break;
-
-    case 'C':
-      for (card=0; card<MAX_CARDS; card++) {
-        carrier_freq[card][0] = atof(optarg);
-        carrier_freq[card][1] = atof(optarg);
-        carrier_freq[card][2] = atof(optarg);
-        carrier_freq[card][3] = atof(optarg);
-      }
-
-      break;
-
-    case 'S':
-      fs4_test=1;
-      break;
-
-    case 'T':
-      tcxo=atoi(optarg);
-      break;
-
-    case 'K':
-#if defined(ENABLE_ITTI)
-      itti_dump_file = strdup(optarg);
-#else
-      printf("-K option is disabled when ENABLE_ITTI is not defined\n");
-#endif
-      break;
-
-    case 'O':
-      conf_config_file_name = optarg;
-      break;
-
-    case 'F':
-      sprintf(rxg_fname,"%srxg.lime",optarg);
-      rxg_fd = fopen(rxg_fname,"r");
-
-      if (rxg_fd) {
-        printf("Loading RX Gain parameters from %s\n",rxg_fname);
-        l=0;
-
-        while (fgets(line, sizeof(line), rxg_fd)) {
-          if ((strlen(line)==0) || (*line == '#')) continue; //ignore empty or comment lines
-          else {
-            if (l==0) sscanf(line,"%d %d %d %d",&rxg_max[0],&rxg_max[1],&rxg_max[2],&rxg_max[3]);
-
-            if (l==1) sscanf(line,"%d %d %d %d",&rxg_med[0],&rxg_med[1],&rxg_med[2],&rxg_med[3]);
-
-            if (l==2) sscanf(line,"%d %d %d %d",&rxg_byp[0],&rxg_byp[1],&rxg_byp[2],&rxg_byp[3]);
-
-            l++;
-          }
-        }
-      } else
-        printf("%s not found, running with defaults\n",rxg_fname);
-
-      sprintf(txg_fname,"%stxg.lime",optarg);
-      txg_fd = fopen(txg_fname,"r");
-
-      if (txg_fd) {
-        printf("Loading TX Gain parameters from %s\n",txg_fname);
-        l=0;
-
-        while (fgets(line, sizeof(line), txg_fd)) {
-          if ((strlen(line)==0) || (*line == '#')) {
-            continue; //ignore empty or comment lines
-          } else {
-            if (l==0) sscanf(line,"%d %d %d %d",&txgain[0],&txgain[1],&txgain[2],&txgain[3]);
-
-            if (l==1) sscanf(line,"%d",&tx_max_power);
-
-            l++;
-          }
-        }
-      } else
-        printf("%s not found, running with defaults\n",txg_fname);
-
-      sprintf(rflo_fname,"%srflo.lime",optarg);
-      rflo_fd = fopen(rflo_fname,"r");
-
-      if (rflo_fd) {
-        printf("Loading RF LO parameters from %s\n",rflo_fname);
-        fscanf(rflo_fd,"%d %d %d %d",&rf_local[0],&rf_local[1],&rf_local[2],&rf_local[3]);
-      } else
-        printf("%s not found, running with defaults\n",rflo_fname);
-
-      sprintf(rfdc_fname,"%srfdc.lime",optarg);
-      rfdc_fd = fopen(rfdc_fname,"r");
-
-      if (rfdc_fd) {
-        printf("Loading RF DC parameters from %s\n",rfdc_fname);
-        fscanf(rfdc_fd,"%d %d %d %d",&rf_rxdc[0],&rf_rxdc[1],&rf_rxdc[2],&rf_rxdc[3]);
-      } else
-        printf("%s not found, running with defaults\n",rfdc_fname);
-
-      break;
-
-      /*
-      case 256:
-      mode = rx_calib_ue;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 257:
-      mode = rx_calib_ue_med;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 258:
-      mode = rx_calib_ue_byp;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 259:
-      mode = debug_prach;
-      break;
-      case 260:
-      mode = no_L2_connect;
-      break;
-      */
-    default:
-      break;
-    }
-  }
-
-  if (UE_flag==1)
-    printf("configuring for UE\n");
-  else
-    printf("configuring for eNB\n");
-
-  //randominit (0);
-  //set_taus_seed (0);
-
-  // initialize the log (see log.h for details)
-  logInit();
-
-#if defined(ENABLE_ITTI)
-  itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, itti_dump_file);
-
-# if defined(ENABLE_USE_MME)
-
-  if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing SCTP task interface: FAILED\n");
-    return -1;
-  }
-
-  if (itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing S1AP task interface: FAILED\n");
-    return -1;
-  }
-
-# endif
-
-  if (itti_create_task(TASK_L2L1, l2l1_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing L2L1 task interface: FAILED\n");
-    return -1;
-  }
-
-  // Handle signals until all tasks are terminated
-  //   itti_wait_tasks_end();
-#endif
-
-  if (ouput_vcd) {
-    if (UE_flag==1)
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_UE.vcd");
-    else
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_eNB.vcd");
-  }
-
-#ifdef PDCP_USE_NETLINK
-  netlink_init();
-#endif
-
-  // to make a graceful exit when ctrl-c is pressed
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-
-#ifndef RTAI
-  check_clock();
-#endif
-
-  g_log->log_component[HW].level = LOG_DEBUG;
-  g_log->log_component[HW].flag  = LOG_HIGH;
-#ifdef OPENAIR2
-  g_log->log_component[PHY].level = LOG_INFO;
-#else
-  g_log->log_component[PHY].level = LOG_DEBUG;
-#endif
-  g_log->log_component[PHY].flag  = LOG_HIGH;
-  g_log->log_component[MAC].level = LOG_INFO;
-  g_log->log_component[MAC].flag  = LOG_HIGH;
-  g_log->log_component[RLC].level = LOG_INFO;
-  g_log->log_component[RLC].flag  = LOG_HIGH;
-  g_log->log_component[PDCP].level = LOG_INFO;
-  g_log->log_component[PDCP].flag  = LOG_HIGH;
-  g_log->log_component[OTG].level = LOG_INFO;
-  g_log->log_component[OTG].flag  = LOG_HIGH;
-  g_log->log_component[RRC].level = LOG_INFO;
-  g_log->log_component[RRC].flag  = LOG_HIGH;
-
-
-  // Initialize card
-  ret = openair0_open();
-
-  if ( ret != 0 ) {
-    if (ret == -1)
-      printf("Error opening /dev/openair0");
-
-    if (ret == -2)
-      printf("Error mapping bigshm");
-
-    if (ret == -3)
-      printf("Error mapping RX or TX buffer");
-
-    return(ret);
-  }
-
-  number_of_cards = openair0_num_detected_cards;
-
-  for (card=0; card<number_of_cards; card++) {
-    printf ("Configuring card %d of %d (number of antennas %d).\n", card, openair0_num_detected_cards, openair0_num_antennas[card]);
-
-    p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
-    p_exmimo_id     = openair0_exmimo_pci[card].exmimo_id_ptr;
-
-    printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev);
-
-    if (p_exmimo_id->board_swrev>=BOARD_SWREV_CNTL2)
-      p_exmimo_config->framing.eNB_flag   = 0;
-    else
-      p_exmimo_config->framing.eNB_flag   = !UE_flag;
-
-    if (card==0)
-      p_exmimo_config->framing.multicard_syncmode = SYNCMODE_MASTER;
-    else
-      p_exmimo_config->framing.multicard_syncmode = SYNCMODE_SLAVE;
-
-    //p_exmimo_config->framing.multicard_syncmode = SYNCMODE_FREE;
-
-
-    p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_TESTRX; //TXRXSWITCH_LSB;
-
-    /*
-      for (ant=0;ant<max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant++)
-      p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
-      for (ant=0;ant<frame_parms->nb_antennas_tx;ant++)
-      p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
-      for (ant=0;ant<frame_parms->nb_antennas_rx;ant++)
-      p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
-      for (ant=max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant<4;ant++) {
-      p_exmimo_config->rf.rf_mode[ant] = 0;
-      carrier_freq[ant] = 0; //this turns off all other LIMEs
-      }
-    */
-
-    for (ant=0; ant<4; ant++) {
-      if (carrier_freq[card][ant] != 0) {
-        p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
-
-        switch (bandwidth[card]) {
-        case BW20:
-          p_exmimo_config->framing.resampling_factor[ant] = 0;
-          p_exmimo_config->rf.rf_mode[ant] += RXLPF10 + TXLPF10;
-          break;
-
-        case BW10:
-          p_exmimo_config->framing.resampling_factor[ant] = 1;
-          p_exmimo_config->rf.rf_mode[ant] += RXLPF5 + TXLPF5;
-          break;
-
-        case BW5:
-          p_exmimo_config->framing.resampling_factor[ant] = 2;
-          p_exmimo_config->rf.rf_mode[ant] += RXLPF25 + TXLPF25;
-          break;
-        }
-
-        //p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
-        p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
-      } else {
-        p_exmimo_config->rf.rf_mode[ant] = 0;
-      }
-    }
-
-    for (ant = 0; ant<4; ant++) {
-      p_exmimo_config->rf.do_autocal[ant] = 1;
-      p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[card][ant];
-      p_exmimo_config->rf.rf_freq_tx[ant] = carrier_freq[card][ant];
-      p_exmimo_config->rf.rx_gain[ant][0] = rxgain[ant];
-      p_exmimo_config->rf.tx_gain[ant][0] = txgain[ant];
-
-      p_exmimo_config->rf.rf_local[ant]   = rf_local[ant];
-      p_exmimo_config->rf.rf_rxdc[ant]    = rf_rxdc[ant];
-
-      if ((carrier_freq[card][ant] >= 850000000) && (carrier_freq[card][ant] <= 865000000)) {
-        p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal_850[ant];
-        p_exmimo_config->rf.rffe_band_mode[ant] = DD_TDD;
-      } else if ((carrier_freq[card][ant] >= 1900000000) && (carrier_freq[card][ant] <= 2000000000)) {
-        p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal[ant];
-        p_exmimo_config->rf.rffe_band_mode[ant] = B19G_TDD;
-      } else {
-        p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal[ant];
-        p_exmimo_config->rf.rffe_band_mode[ant] = 0;
-      }
-
-      p_exmimo_config->rf.rffe_gain_txlow[ant] = 31;
-      p_exmimo_config->rf.rffe_gain_txhigh[ant] = 31;
-      p_exmimo_config->rf.rffe_gain_rxfinal[ant] = 52;
-      p_exmimo_config->rf.rffe_gain_rxlow[ant] = 31;
-    }
-
-
-    openair0_dump_config(card);
-
-    printf("EXMIMO_CONFIG card %d: freq0..3 %u %u %u %u Hz, freqtx0..1 %u %u Hz, RX gain0..1 %d %d dB\n",
-           card,
-           p_exmimo_config->rf.rf_freq_rx[0],
-           p_exmimo_config->rf.rf_freq_rx[1],
-           p_exmimo_config->rf.rf_freq_rx[2],
-           p_exmimo_config->rf.rf_freq_rx[3],
-           p_exmimo_config->rf.rf_freq_tx[0],
-           p_exmimo_config->rf.rf_freq_tx[1],
-           p_exmimo_config->rf.rx_gain[0][0],
-           p_exmimo_config->rf.rx_gain[1][0]);
-    printf("EXMIMO_CONFIG card %d: rf_mode 0x %x %x %x %x, [0]: TXRXEn %d, TXLPFEn %d, TXLPF %d, RXLPFEn %d, RXLPF %d, RFBB %d, LNA %d, LNAGain %d, RXLPFMode %d, SWITCH %d, rf_rxdc %d, rf_local %d, rf_vcocal %d\n",
-           card,
-           p_exmimo_config->rf.rf_mode[0],
-           p_exmimo_config->rf.rf_mode[1],
-           p_exmimo_config->rf.rf_mode[2],
-           p_exmimo_config->rf.rf_mode[3],
-           (p_exmimo_config->rf.rf_mode[0]&3),  // RXen+TXen
-           (p_exmimo_config->rf.rf_mode[0]&4)>>2,         //TXLPFen
-           (p_exmimo_config->rf.rf_mode[0]&TXLPFMASK)>>3, //TXLPF
-           (p_exmimo_config->rf.rf_mode[0]&128)>>7,      //RXLPFen
-           (p_exmimo_config->rf.rf_mode[0]&RXLPFMASK)>>8, //TXLPF
-           (p_exmimo_config->rf.rf_mode[0]&RFBBMASK)>>16, // RFBB mode
-           (p_exmimo_config->rf.rf_mode[0]&LNAMASK)>>12, // RFBB mode
-           (p_exmimo_config->rf.rf_mode[0]&LNAGAINMASK)>>14, // RFBB mode
-           (p_exmimo_config->rf.rf_mode[0]&RXLPFMODEMASK)>>19, // RXLPF mode
-           (p_exmimo_config->framing.tdd_config&TXRXSWITCH_MASK)>>1, // Switch mode
-           p_exmimo_config->rf.rf_rxdc[0],
-           p_exmimo_config->rf.rf_local[0],
-           p_exmimo_config->rf.rf_vcocal[0]);
-
-    for (ant=0; ant<4; ant++)
-      p_exmimo_config->rf.do_autocal[ant] = 0;
-  } //card
-
-  card=0;
-
-#ifdef EMOS
-  error_code = rtf_create(CHANSOUNDER_FIFO_MINOR,CHANSOUNDER_FIFO_SIZE);
-
-  if (error_code==0)
-    printf("[OPENAIR][SCHED][INIT] Created EMOS FIFO %d\n",CHANSOUNDER_FIFO_MINOR);
-  else if (error_code==ENODEV)
-    printf("[OPENAIR][SCHED][INIT] Problem: EMOS FIFO %d is greater than or equal to RTF_NO\n",CHANSOUNDER_FIFO_MINOR);
-  else if (error_code==ENOMEM)
-    printf("[OPENAIR][SCHED][INIT] Problem: cannot allocate memory for EMOS FIFO %d\n",CHANSOUNDER_FIFO_MINOR);
-  else
-    printf("[OPENAIR][SCHED][INIT] Problem creating EMOS FIFO %d, error_code %d\n",CHANSOUNDER_FIFO_MINOR,error_code);
-
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-#ifdef RTAI
-  // make main thread LXRT soft realtime
-  task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
-
-  // start realtime timer and scheduler
-  //rt_set_oneshot_mode();
-  rt_set_periodic_mode();
-  start_rt_timer(0);
-
-  //now = rt_get_time() + 10*PERIOD;
-  //rt_task_make_periodic(task, now, PERIOD);
-
-  printf("Init mutex\n");
-  //mutex = rt_get_adr(nam2num("MUTEX"));
-  mutex = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if (mutex==0) {
-    printf("Error init mutex\n");
-    exit(-1);
-  } else
-    printf("mutex=%p\n",mutex);
-
-#endif
-
-  DAQ_MBOX = (volatile unsigned int *) openair0_exmimo_pci[0].rxcnt_ptr[0];
-
-  // this starts the DMA transfers
-  if (UE_flag!=1)
-    for (card=0; card<number_of_cards; card++)
-      openair0_start_rt_acquisition(card);
-
-
-#ifdef XFORMS
-
-  if (do_forms==1) {
-    fl_initialize (&argc, argv, NULL, 0, 0);
-    /*
-    form_stats = create_form_stats_form();
-    if (UE_flag==1) {
-        form_ue[UE_id] = create_lte_phy_scope_ue();
-        sprintf (title, "LTE DL SCOPE UE");
-        fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-    } else {
-          for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
-              form_enb[UE_id] = create_lte_phy_scope_enb();
-              sprintf (title, "UE%d LTE UL SCOPE eNB",UE_id+1);
-              fl_show_form (form_enb[UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-          }
-    }
-    fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
-    if (UE_flag==0) {
-        for (UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
-            if (otg_enabled) {
-                fl_set_button(form_enb[UE_id]->button_0,1);
-                fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic ON");
-            }
-            else {
-                fl_set_button(form_enb[UE_id]->button_0,0);
-                fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic OFF");
-            }
-        }
-    }
-    else {
-        if (openair_daq_vars.use_ia_receiver) {
-            fl_set_button(form_ue[UE_id]->button_0,1);
-            fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
-        }
-        else {
-            fl_set_button(form_ue[UE_id]->button_0,0);
-            fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
-        }
-    }
-    */
-    form_lte = create_form_lte_scope();
-    fl_show_form (form_lte->lte_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "Scope");
-
-    ret = pthread_create(&thread2, NULL, scope_thread, NULL);
-    printf("Scope thread created, ret=%d\n",ret);
-  }
-
-#endif
-
-#ifdef EMOS
-  ret = pthread_create(&thread3, NULL, emos_thread, NULL);
-  printf("EMOS thread created, ret=%d\n",ret);
-  ret = pthread_create(&thread4, NULL, gps_thread, NULL);
-  printf("GPS thread created, ret=%d\n",ret);
-  ret = pthread_create(&thread5, NULL, log_thread, NULL);
-  printf("LOG thread created, ret=%d\n",ret);
-#endif
-
-  rt_sleep_ns(10*FRAME_PERIOD);
-
-#ifndef RTAI
-  pthread_attr_init (&attr_dlsch_threads);
-  pthread_attr_setstacksize(&attr_dlsch_threads,OPENAIR_THREAD_STACK_SIZE);
-  //attr_dlsch_threads.priority = 1;
-  sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
-  pthread_attr_setschedparam  (&attr_dlsch_threads, &sched_param_dlsch);
-  pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO);
-#endif
-
-  // start the main thread
-  if (UE_flag == 1) {
-    /*
-    #ifdef RTAI
-    thread1 = rt_thread_create(UE_thread, NULL, 100000000);
-    #else
-    error_code = pthread_create(&thread1, &attr_dlsch_threads, UE_thread, NULL);
-    if (error_code!= 0) {
-      LOG_D(HW,"[lte-softmodem.c] Could not allocate UE_thread, error %d\n",error_code);
-      return(error_code);
-    }
-    else {
-      LOG_D(HW,"[lte-softmodem.c] Allocate UE_thread successful\n");
-    }
-    #endif
-    #ifdef DLSCH_THREAD
-    init_rx_pdsch_thread();
-    rt_sleep_ns(FRAME_PERIOD/10);
-    init_dlsch_threads();
-    #endif
-    printf("UE threads created\n");
-    */
-  } else {
-#ifdef RTAI
-    thread0 = rt_thread_create(eNB_thread, NULL, 100000000);
-#else
-    error_code = pthread_create(&thread0, &attr_dlsch_threads, eNB_thread, NULL);
-
-    if (error_code!= 0) {
-      LOG_D(HW,"[lte-softmodem.c] Could not allocate eNB_thread, error %d\n",error_code);
-      return(error_code);
-    } else {
-      LOG_D(HW,"[lte-softmodem.c] Allocate eNB_thread successful\n");
-    }
-
-#endif
-#ifdef ULSCH_THREAD
-    init_ulsch_threads();
-#endif
-    printf("eNB threads created\n");
-  }
-
-
-  // wait for end of program
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-
-  //getchar();
-  while (oai_exit==0)
-    rt_sleep_ns(FRAME_PERIOD);
-
-  // stop threads
-#ifdef XFORMS
-  printf("waiting for XFORMS thread\n");
-
-  if (do_forms==1) {
-    pthread_join(thread2,&status);
-    /*
-      fl_hide_form(form_stats->stats_form);
-      fl_free_form(form_stats->stats_form);
-      if (UE_flag==1) {
-          fl_hide_form(form_ue[UE_id]->lte_phy_scope_ue);
-          fl_free_form(form_ue[UE_id]->lte_phy_scope_ue);
-      } else {
-          for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
-              fl_hide_form(form_enb[UE_id]->lte_phy_scope_enb);
-              fl_free_form(form_enb[UE_id]->lte_phy_scope_enb);
-          }
-      }
-    */
-    fl_hide_form(form_lte->lte_scope);
-    fl_free_form(form_lte->lte_scope);
-  }
-
-#endif
-
-  printf("stopping MODEM threads\n");
-
-  // cleanup
-  if (UE_flag == 1) {
-    /*
-    #ifdef RTAI
-    rt_thread_join(thread1);
-    #else
-    pthread_join(thread1,&status);
-    #endif
-    #ifdef DLSCH_THREAD
-    cleanup_dlsch_threads();
-    cleanup_rx_pdsch_thread();
-    #endif
-    */
-  } else {
-#ifdef RTAI
-    rt_thread_join(thread0);
-#else
-    pthread_join(thread0,&status);
-#endif
-#ifdef ULSCH_THREAD
-    cleanup_ulsch_threads();
-#endif
-  }
-
-#ifdef OPENAIR2
-  //cleanup_pdcp_thread();
-#endif
-
-#ifdef RTAI
-  stop_rt_timer();
-#endif
-
-  printf("stopping card\n");
-
-  for (card=0; card<number_of_cards; card++)
-    openair0_stop(card);
-
-  printf("closing openair0_lib\n");
-  openair0_close();
-
-#ifdef EMOS
-  printf("waiting for EMOS thread\n");
-  pthread_cancel(thread3);
-  pthread_join(thread3,&status);
-  printf("waiting for GPS thread\n");
-  pthread_cancel(thread4);
-  pthread_join(thread4,&status);
-  printf("waiting for log thread\n");
-  pthread_cancel(thread5);
-  pthread_join(thread5,&status);
-#endif
-
-#ifdef EMOS
-  error_code = rtf_destroy(CHANSOUNDER_FIFO_MINOR);
-
-  while (error_code>0)
-    error_code = rtf_destroy(CHANSOUNDER_FIFO_MINOR);
-
-  printf("[OPENAIR][SCHED][CLEANUP] EMOS FIFO closed, error_code %d\n", error_code);
-#endif
-
-  if (ouput_vcd)
-    VCD_SIGNAL_DUMPER_CLOSE();
-
-  logClean();
-
-  return 0;
-}
-
-void test_config(int card, int ant, unsigned int rf_mode, int UE_flag)
-{
-  p_exmimo_config->framing.eNB_flag   = !UE_flag;
-  p_exmimo_config->framing.tdd_config = 0;
-  p_exmimo_config->framing.resampling_factor[ant] = 2;
-
-  p_exmimo_config->rf.rf_freq_rx[ant] = 1907600000;
-  p_exmimo_config->rf.rf_freq_tx[ant] = 1907600000;;
-  p_exmimo_config->rf.rx_gain[ant][0] = 20;
-  p_exmimo_config->rf.tx_gain[ant][0] = 10;
-  p_exmimo_config->rf.rf_mode[ant] = rf_mode;
-
-  p_exmimo_config->rf.rf_local[ant] = build_rflocal(20,25,26,04);
-  p_exmimo_config->rf.rf_rxdc[ant] = build_rfdc(128, 128);
-  p_exmimo_config->rf.rf_vcocal[ant] = (0xE<<6) + 0xE;
-}
-
-/*
-void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
-
-  int i;
-  if (phy_vars_ue) {
-
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
-      printf("RX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
-      printf("TX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
-      free(phy_vars_ue->lte_ue_common_vars.rxdata[i]);
-      phy_vars_ue->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
-
-
-      printf("rxdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.rxdata[i]);
-    }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
-      free(phy_vars_ue->lte_ue_common_vars.txdata[i]);
-      phy_vars_ue->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
-
-      printf("txdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.txdata[i]);
-    }
-  }
-}
-
-void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
-
-  int i,j;
-
-  if (phy_vars_eNB) {
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
-      printf("RX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
-      printf("TX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
-        free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
-        phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
-
-        printf("rxdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
-        for (j=0;j<16;j++) {
-            printf("rxbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j]);
-            phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j] = 16-j;
-        }
-    }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
-        free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
-        phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
-
-        printf("txdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
-        for (j=0;j<16;j++) {
-            printf("txbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j]);
-            phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j] = 16-j;
-  }
-    }
-  }
-}
-*/
diff --git a/targets/RT/USER/init_rtai.sh b/targets/RT/USER/init_rtai.sh
deleted file mode 100755
index 69b127de3322ae5388a46a28f6ae83fb05de1d0f..0000000000000000000000000000000000000000
--- a/targets/RT/USER/init_rtai.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-sudo insmod /usr/realtime/modules/rtai_hal.ko 
-sudo insmod /usr/realtime/modules/rtai_sched.ko 
-sudo insmod /usr/realtime/modules/rtai_sem.ko 
-sudo insmod /usr/realtime/modules/rtai_fifos.ko 
-sudo insmod /usr/realtime/modules/rtai_mbx.ko 
diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c
index feec812b984e76453df325fff34383c6fac35180..e047e0aed727ff0a26ba7dee91dc0ed53cc0a4e0 100644
--- a/targets/RT/USER/lte-enb.c
+++ b/targets/RT/USER/lte-enb.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -121,11 +121,14 @@ extern int transmission_mode;
 
 extern int oaisim_flag;
 
+uint16_t sf_ahead=4;
+
 //pthread_t                       main_eNB_thread;
 
 time_stats_t softmodem_stats_mt; // main thread
 time_stats_t softmodem_stats_hw; //  hw acquisition
 time_stats_t softmodem_stats_rxtx_sf; // total tx time
+time_stats_t nfapi_meas; // total tx time
 time_stats_t softmodem_stats_rx_sf; // total rx time
 
 /* mutex, cond and variable to serialize phy proc TX calls
@@ -153,54 +156,145 @@ void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
 #endif
 extern int codingw;
 
-static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
+extern uint8_t nfapi_mode;
+extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
+extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
+
+//#define TICK_TO_US(ts) (ts.diff)
+#define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials)
 
+
+static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
   start_meas(&softmodem_stats_rxtx_sf);
 
+  // *******************************************************************
+
+  if (nfapi_mode == 1) {
+
+    // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
+    uint16_t frame = proc->frame_rx;
+    uint16_t subframe = proc->subframe_rx;
+
+    //add_subframe(&frame, &subframe, 4);
+
+    //oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
+    //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
+    start_meas(&nfapi_meas);
+    oai_subframe_ind(frame, subframe);
+    stop_meas(&nfapi_meas);
+
+    if (eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus||
+        eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs ||
+        eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs ||
+        eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles ||
+        eNB->UL_INFO.cqi_ind.number_of_cqis
+       ) {
+      LOG_D(PHY, "UL_info[rx_ind:%05d:%d harqs:%05d:%d crcs:%05d:%d preambles:%05d:%d cqis:%d] RX:%04d%d TX:%04d%d num_pdcch_symbols:%d\n", 
+          NFAPI_SFNSF2DEC(eNB->UL_INFO.rx_ind.sfn_sf),   eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus, 
+          NFAPI_SFNSF2DEC(eNB->UL_INFO.harq_ind.sfn_sf), eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs, 
+          NFAPI_SFNSF2DEC(eNB->UL_INFO.crc_ind.sfn_sf),  eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, 
+          NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf), eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles,
+          eNB->UL_INFO.cqi_ind.number_of_cqis, 
+          proc->frame_rx, proc->subframe_rx, 
+      proc->frame_tx, proc->subframe_tx, eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols);
+    }
+  }
+
+  if (nfapi_mode == 1 && eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols == 0) {
+    LOG_E(PHY, "eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols == 0");
+    return 0;
+  }
+
   // ****************************************
   // Common RX procedures subframe n
 
   T(T_ENB_PHY_DL_TICK, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(proc->subframe_tx));
 
   // if this is IF5 or 3GPP_eNB
-  if (eNB->RU_list[0]->function < NGFI_RAU_IF4p5) {
+  if (eNB && eNB->RU_list && eNB->RU_list[0] && eNB->RU_list[0]->function < NGFI_RAU_IF4p5) {
     wakeup_prach_eNB(eNB,NULL,proc->frame_rx,proc->subframe_rx);
 #ifdef Rel14
     wakeup_prach_eNB_br(eNB,NULL,proc->frame_rx,proc->subframe_rx);
 #endif
   }
+
   // UE-specific RX processing for subframe n
-  phy_procedures_eNB_uespec_RX(eNB, proc, no_relay );
-  
+  if (nfapi_mode == 0 || nfapi_mode == 1) {
+    phy_procedures_eNB_uespec_RX(eNB, proc, no_relay );
+  }
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 );
-    
+
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
+
   eNB->UL_INFO.frame     = proc->frame_rx;
   eNB->UL_INFO.subframe  = proc->subframe_rx;
   eNB->UL_INFO.module_id = eNB->Mod_id;
   eNB->UL_INFO.CC_id     = eNB->CC_id;
+
   eNB->if_inst->UL_indication(&eNB->UL_INFO);
+
   pthread_mutex_unlock(&eNB->UL_INFO_mutex);
   
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 0 );
-  if(get_nprocs() >= 8)
-  {
+  if(oai_exit) return(-1);
+  if(get_nprocs() >= 8){
     wakeup_tx(eNB,eNB->proc.ru_proc);
   }
-  else if(get_nprocs() > 4)
-  {
-    if(oai_exit) return(-1);
+  else if(get_nprocs() > 4){
+  
     phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
-    
     wakeup_txfh(proc,eNB->proc.ru_proc);
   }
-  else
-  {
-    if(oai_exit) return(-1);
+  else{
     phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
   }
 
+
   stop_meas( &softmodem_stats_rxtx_sf );
+
+  LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, proc->frame_rx, proc->subframe_rx, proc->frame_tx, proc->subframe_tx);
+
+#if 0
+  LOG_D(PHY, "rxtx:%lld nfapi:%lld phy:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ",
+      softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now,
+      TICK_TO_US(eNB->phy_proc),
+      TICK_TO_US(eNB->phy_proc_tx),
+      TICK_TO_US(eNB->phy_proc_rx),
+      TICK_TO_US(eNB->rx_prach),
+      TICK_TO_US(eNB->ofdm_mod_stats),
+      softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now);
+  LOG_D(PHY,
+    "dlsch[enc:%lld mod:%lld scr:%lld rm:%lld t:%lld i:%lld] rx_dft:%lld ",
+      TICK_TO_US(eNB->dlsch_encoding_stats),
+      TICK_TO_US(eNB->dlsch_modulation_stats),
+      TICK_TO_US(eNB->dlsch_scrambling_stats),
+      TICK_TO_US(eNB->dlsch_rate_matching_stats),
+      TICK_TO_US(eNB->dlsch_turbo_encoding_stats),
+      TICK_TO_US(eNB->dlsch_interleaving_stats),
+      TICK_TO_US(eNB->rx_dft_stats));
+
+  LOG_D(PHY," ulsch[ch:%lld freq:%lld dec:%lld demod:%lld ru:%lld ",
+      TICK_TO_US(eNB->ulsch_channel_estimation_stats),
+      TICK_TO_US(eNB->ulsch_freq_offset_estimation_stats),
+      TICK_TO_US(eNB->ulsch_decoding_stats),
+      TICK_TO_US(eNB->ulsch_demodulation_stats),
+      TICK_TO_US(eNB->ulsch_rate_unmatching_stats));
+
+  LOG_D(PHY, "td:%lld dei:%lld dem:%lld llr:%lld tci:%lld ",
+      TICK_TO_US(eNB->ulsch_turbo_decoding_stats),
+      TICK_TO_US(eNB->ulsch_deinterleaving_stats),
+      TICK_TO_US(eNB->ulsch_demultiplexing_stats),
+      TICK_TO_US(eNB->ulsch_llr_stats),
+      TICK_TO_US(eNB->ulsch_tc_init_stats));
+  LOG_D(PHY, "tca:%lld tcb:%lld tcg:%lld tce:%lld l1:%lld l2:%lld]\n\n", 
+      TICK_TO_US(eNB->ulsch_tc_alpha_stats),
+      TICK_TO_US(eNB->ulsch_tc_beta_stats),
+      TICK_TO_US(eNB->ulsch_tc_gamma_stats),
+      TICK_TO_US(eNB->ulsch_tc_ext_stats),
+      TICK_TO_US(eNB->ulsch_tc_intl1_stats),
+      TICK_TO_US(eNB->ulsch_tc_intl2_stats)
+      );
+#endif
   
   return(0);
 }
@@ -278,10 +372,7 @@ static void* eNB_thread_rxtx( void* param ) {
   pthread_setname_np( pthread_self(),"rxtx processing");
   LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid));
 
-  //CPU_SET(3, &cpuset);
-  //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
-  
-  //wait_sync("eNB_thread_rxtx");
+
 
   while (!oai_exit) {
     
@@ -301,26 +392,27 @@ static void* eNB_thread_rxtx( void* param ) {
 
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu());
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 );
-    //ru_proc = eNB_proc->ru_proc;
    
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB,proc->subframe_tx);
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_ENB,proc->subframe_rx);
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB,proc->frame_tx);
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,proc->frame_rx);
  
-  
+
     if (oai_exit) break;
 
     if (eNB->CC_id==0)
+    {
       if (rxtx(eNB,proc,thread_name) < 0) break;
+    }
 
     if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
-  
+
   } // while !oai_exit
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
 
-  printf( "Exiting eNB thread RXn_TXnp4\n");
+  LOG_D(PHY, " *** Exiting eNB thread RXn_TXnp4\n");
 
   eNB_thread_rxtx_status = 0;
   return &eNB_thread_rxtx_status;
@@ -359,21 +451,16 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t
   proc->subframe_rx = subframe_rx;
 
   if (!oai_exit) {
-    LOG_D(PHY,"eNB_top in %p (proc %p, CC_id %d), frame %d, subframe %d, instance_cnt_prach %d\n",
-	  (void*)pthread_self(), proc, eNB->CC_id, proc->frame_rx,proc->subframe_rx,proc->instance_cnt_prach);
-
     T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx));
 
     proc_rxtx->subframe_rx = proc->subframe_rx;
     proc_rxtx->frame_rx    = proc->frame_rx;
-    proc_rxtx->subframe_tx = (proc->subframe_rx+4)%10;
-    proc_rxtx->frame_tx    = (proc->subframe_rx>5) ? (1+proc->frame_rx)&1023 : proc->frame_rx;
+    proc_rxtx->subframe_tx = (proc->subframe_rx+sf_ahead)%10;
+    proc_rxtx->frame_tx    = (proc->subframe_rx>(9-sf_ahead)) ? (1+proc->frame_rx)&1023 : proc->frame_rx;
     proc->frame_tx         = proc_rxtx->frame_tx;
     proc_rxtx->timestamp_tx = proc->timestamp_tx;
 
     if (rxtx(eNB,proc_rxtx,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id);
-    LOG_D(PHY,"eNB_top out %p (proc %p, CC_id %d), frame %d, subframe %d, instance_cnt_prach %d\n",
-	  (void*)pthread_self(), proc, eNB->CC_id, proc->frame_rx,proc->subframe_rx,proc->instance_cnt_prach);
   }
 }
 
@@ -430,7 +517,6 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
   wait.tv_sec=0;
   wait.tv_nsec=5000000L;
   
-  int pipe_ready_tx  = proc_rxtx1->pipe_ready;
   
   if(wait_on_condition(&proc_rxtx1->mutex_rxtx,&proc_rxtx1->cond_rxtx,&proc_rxtx1->pipe_ready,"wakeup_tx")<0) {
     LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc_rxtx1->frame_rx,proc_rxtx1->subframe_rx);
@@ -494,6 +580,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
     }
   }
   if (proc->RU_mask != (1<<eNB->num_RU)-1) {  // not all RUs have provided their information so return
+    LOG_E(PHY,"Not all RUs have provided their info\n");
     pthread_mutex_unlock(&proc->mutex_RU);
     return(0);
   }
@@ -520,7 +607,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
     return(-1);
   }
 
-  // wake up TX for subframe n+4
+  // wake up TX for subframe n+sf_ahead
   // lock the TX mutex and make sure the thread is ready
   if (pthread_mutex_timedlock(&proc_rxtx0->mutex_rxtx,&wait) != 0) {
     LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", proc_rxtx0->subframe_rx&1,proc_rxtx0->instance_cnt_rxtx );
@@ -535,23 +622,14 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
   // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired 
   // transmitted timestamp of the next TX slot (first).
   // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, 
-  // we want to generate subframe (n+4), so TS_tx = TX_rx+4*samples_per_tti,
-  // and proc->subframe_tx = proc->subframe_rx+4
-  /*proc_rxtx->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti);
-  proc_rxtx->frame_rx     = proc->frame_rx;
-  proc_rxtx->subframe_rx  = proc->subframe_rx;
-  proc_rxtx->frame_tx     = (proc_rxtx->subframe_rx > 5) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
-  proc_rxtx->subframe_tx  = (proc_rxtx->subframe_rx + 4)%10;
-  */
-  
-  proc_rxtx0->subframe_rx = ru_proc->subframe_rx;
-  proc_rxtx0->frame_rx    = ru_proc->frame_rx;
-  proc_rxtx0->subframe_tx = (ru_proc->subframe_rx+4)%10;
-  proc_rxtx0->frame_tx    = (ru_proc->subframe_rx>5) ? (1+ru_proc->frame_rx)&1023 : ru_proc->frame_rx;
-  proc->frame_tx         = proc_rxtx0->frame_tx;
-  proc->frame_rx         = proc_rxtx0->frame_rx;
-  proc_rxtx0->timestamp_tx = ru_proc->timestamp_rx+(4*fp->samples_per_tti);
-  
+  // we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti,
+  // and proc->subframe_tx = proc->subframe_rx+sf_ahead
+  proc_rxtx0->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti);
+  proc_rxtx0->frame_rx     = ru_proc->frame_rx;
+  proc_rxtx0->subframe_rx  = ru_proc->subframe_rx;
+  proc_rxtx0->frame_tx     = (proc_rxtx0->subframe_rx > (9-sf_ahead)) ? (proc_rxtx0->frame_rx+1)&1023 : proc_rxtx0->frame_rx;
+  proc_rxtx0->subframe_tx  = (proc_rxtx0->subframe_rx + sf_ahead)%10;
+
   // the thread can now be woken up
   if (pthread_cond_signal(&proc_rxtx0->cond_rxtx) != 0) {
     LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
@@ -813,10 +891,12 @@ void init_eNB_proc(int inst) {
   pthread_attr_t *attr_prach_br=NULL;
 #endif
 
+  LOG_I(PHY,"%s(inst:%d) RC.nb_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_CC[inst]);
+
   for (CC_id=0; CC_id<RC.nb_CC[inst]; CC_id++) {
     eNB = RC.eNB[inst][CC_id];
 #ifndef OCP_FRAMEWORK
-    LOG_I(PHY,"Initializing eNB processes %d CC_id %d \n",inst,CC_id);
+    LOG_I(PHY,"Initializing eNB processes instance:%d CC_id %d \n",inst,CC_id);
 #endif
     proc = &eNB->proc;
 
@@ -881,6 +961,9 @@ void init_eNB_proc(int inst) {
     //////////////////////////////////////need to modified////////////////*****
 	pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc );
 	pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, tx_thread, proc);
+
+    LOG_I(PHY,"eNB->single_thread_flag:%d\n", eNB->single_thread_flag);
+
     if (eNB->single_thread_flag==0) {
       pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] );
       pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] );
@@ -941,26 +1024,31 @@ void kill_eNB_proc(int inst) {
   PHY_VARS_eNB *eNB;
   eNB_proc_t *proc;
   eNB_rxtx_proc_t *proc_rxtx;
+  int i;
   for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
     eNB=RC.eNB[inst][CC_id];
     
     proc = &eNB->proc;
     proc_rxtx = &proc->proc_rxtx[0];
-    
 
     kill_td_thread(eNB);
     kill_te_thread(eNB);
     LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst );
     proc_rxtx[0].instance_cnt_rxtx = 0; // FIXME data race!
     proc_rxtx[1].instance_cnt_rxtx = 0; // FIXME data race!
-    if (eNB->single_thread_flag==0) {
-      pthread_cond_signal( &proc_rxtx[0].cond_rxtx );    
-      pthread_cond_signal( &proc_rxtx[1].cond_rxtx );
+    for (i=0; i<2; i++) {
+      pthread_mutex_lock(&proc_rxtx[i].mutex_rxtx);
+      proc_rxtx[i].instance_cnt_rxtx = 0;
+      pthread_cond_signal( &proc_rxtx[i].cond_rxtx );
+      pthread_mutex_unlock(&proc_rxtx[i].mutex_rxtx);
     }
     proc->instance_cnt_prach = 0;
     pthread_cond_signal( &proc->cond_prach );
 
+    pthread_cond_signal( &proc->cond_asynch_rxtx );
     pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx);
+
+    LOG_D(PHY, "joining pthread_prach\n");
     pthread_join( proc->pthread_prach, (void**)&status );    
 
     LOG_I(PHY, "Destroying prach mutex/cond\n");
@@ -975,7 +1063,6 @@ void kill_eNB_proc(int inst) {
 #endif         
     LOG_I(PHY, "Destroying UL_INFO mutex\n");
     pthread_mutex_destroy(&eNB->UL_INFO_mutex);
-    int i;
     for (i=0;i<2;i++) {
       pthread_cond_signal( &proc_rxtx[i].cond_rxtx );
       LOG_I(PHY, "Joining rxtx[%d] mutex/cond\n",i);
@@ -1015,12 +1102,29 @@ void print_opp_meas(void) {
   }
 }
 
+void free_transport(PHY_VARS_eNB *eNB)
+{
+  int i;
+  int j;
+
+  for (i=0; i<NUMBER_OF_UE_MAX; i++) {
+    LOG_I(PHY, "Freeing Transport Channel Buffers for DLSCH, UE %d\n",i);
+    for (j=0; j<2; j++) free_eNB_dlsch(eNB->dlsch[i][j]);
+
+    LOG_I(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i);
+    free_eNB_ulsch(eNB->ulsch[1+i]);
+  }
+  free_eNB_ulsch(eNB->ulsch[0]);
+}
+
 void init_transport(PHY_VARS_eNB *eNB) {
 
   int i;
   int j;
   LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
 
+  LOG_I(PHY, "Initialise transport\n");
+
   for (i=0; i<NUMBER_OF_UE_MAX; i++) {
     LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i);
     for (j=0; j<2; j++) {
@@ -1029,8 +1133,8 @@ void init_transport(PHY_VARS_eNB *eNB) {
 	LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i);
 	exit(-1);
       } else {
-	LOG_D(PHY,"dlsch[%d][%d] => %p\n",i,j,eNB->dlsch[i][j]);
 	eNB->dlsch[i][j]->rnti=0;
+	LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti);
       }
     }
     
@@ -1083,20 +1187,33 @@ void init_eNB_afterRU(void) {
   int inst,CC_id,ru_id,i,aa;
   PHY_VARS_eNB *eNB;
 
+  LOG_I(PHY,"%s() RC.nb_inst:%d\n", __FUNCTION__, RC.nb_inst);
 
   for (inst=0;inst<RC.nb_inst;inst++) {
+    LOG_I(PHY,"RC.nb_CC[inst]:%d\n", RC.nb_CC[inst]);
     for (CC_id=0;CC_id<RC.nb_CC[inst];CC_id++) {
+
+      LOG_I(PHY,"RC.nb_CC[inst:%d][CC_id:%d]:%p\n", inst, CC_id, RC.eNB[inst][CC_id]);
+
       eNB                                  =  RC.eNB[inst][CC_id];
       phy_init_lte_eNB(eNB,0,0);
       // map antennas and PRACH signals to eNB RX
-      AssertFatal(eNB->num_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id);
+      if (0) AssertFatal(eNB->num_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id);
       LOG_I(PHY,"Mapping RX ports from %d RUs to eNB %d\n",eNB->num_RU,eNB->Mod_id);
       eNB->frame_parms.nb_antennas_rx       = 0;
+
+      LOG_I(PHY,"Overwriting eNB->prach_vars.rxsigF[0]:%p\n", eNB->prach_vars.rxsigF[0]);
+
       eNB->prach_vars.rxsigF[0] = (int16_t**)malloc16(64*sizeof(int16_t*));
 #ifdef Rel14
-      for (int ce_level=0;ce_level<4;ce_level++)
-	eNB->prach_vars_br.rxsigF[ce_level] = (int16_t**)malloc16(64*sizeof(int16_t*));
+      for (int ce_level=0;ce_level<4;ce_level++) {
+        LOG_I(PHY,"Overwriting eNB->prach_vars_br.rxsigF.rxsigF[0]:%p\n", eNB->prach_vars_br.rxsigF[ce_level]);
+        eNB->prach_vars_br.rxsigF[ce_level] = (int16_t**)malloc16(64*sizeof(int16_t*));
+      }
 #endif
+
+      LOG_I(PHY,"eNB->num_RU:%d\n", eNB->num_RU);
+
       for (ru_id=0,aa=0;ru_id<eNB->num_RU;ru_id++) {
 	eNB->frame_parms.nb_antennas_rx    += eNB->RU_list[ru_id]->nb_rx;
 
@@ -1118,6 +1235,36 @@ void init_eNB_afterRU(void) {
 	  eNB->common_vars.rxdataF[aa]     =  eNB->RU_list[ru_id]->common.rxdataF[i];
 	}
       }
+
+
+
+      /* TODO: review this code, there is something wrong.
+       * In monolithic mode, we come here with nb_antennas_rx == 0
+       * (not tested in other modes).
+       */
+      if (eNB->frame_parms.nb_antennas_rx < 1)
+      {
+        LOG_I(PHY, "%s() ************* DJP ***** eNB->frame_parms.nb_antennas_rx:%d - GOING TO HARD CODE TO 1", __FUNCTION__, eNB->frame_parms.nb_antennas_rx);
+        eNB->frame_parms.nb_antennas_rx = 1;
+      }
+      else
+      {
+        //LOG_I(PHY," Delete code\n");
+      }
+
+      if (eNB->frame_parms.nb_antennas_tx < 1)
+      {
+        LOG_I(PHY, "%s() ************* DJP ***** eNB->frame_parms.nb_antennas_tx:%d - GOING TO HARD CODE TO 1", __FUNCTION__, eNB->frame_parms.nb_antennas_tx);
+        eNB->frame_parms.nb_antennas_tx = 1;
+      }
+      else
+      {
+        //LOG_I(PHY," Delete code\n");
+      }
+
+
+
+
       AssertFatal(eNB->frame_parms.nb_antennas_rx >0,
 		  "inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx);
       LOG_I(PHY,"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx);
@@ -1134,7 +1281,9 @@ void init_eNB_afterRU(void) {
     
     RC.ru[ru_id]->wakeup_rxtx         = wakeup_rxtx;
     RC.ru[ru_id]->wakeup_prach_eNB    = wakeup_prach_eNB;
+#ifdef Rel14
     RC.ru[ru_id]->wakeup_prach_eNB_br = wakeup_prach_eNB_br;
+#endif
     RC.ru[ru_id]->eNB_top             = eNB_top;
   }
 }
@@ -1145,7 +1294,10 @@ void init_eNB(int single_thread_flag,int wait_for_sync) {
   int inst;
   PHY_VARS_eNB *eNB;
 
+  LOG_I(PHY,"[lte-softmodem.c] eNB structure about to allocated RC.nb_L1_inst:%d RC.nb_L1_CC[0]:%d\n",RC.nb_L1_inst,RC.nb_L1_CC[0]);
+
   if (RC.eNB == NULL) RC.eNB = (PHY_VARS_eNB***) malloc(RC.nb_L1_inst*sizeof(PHY_VARS_eNB **));
+  LOG_I(PHY,"[lte-softmodem.c] eNB structure RC.eNB allocated\n");
   for (inst=0;inst<RC.nb_L1_inst;inst++) {
     if (RC.eNB[inst] == NULL) RC.eNB[inst] = (PHY_VARS_eNB**) malloc(RC.nb_CC[inst]*sizeof(PHY_VARS_eNB *));
     for (CC_id=0;CC_id<RC.nb_L1_CC[inst];CC_id++) {
@@ -1155,6 +1307,7 @@ void init_eNB(int single_thread_flag,int wait_for_sync) {
       eNB->single_thread_flag = single_thread_flag;
 
 
+      LOG_I(PHY,"Initializing eNB %d CC_id %d single_thread_flag:%d\n",inst,CC_id,single_thread_flag);
 #ifndef OCP_FRAMEWORK
       LOG_I(PHY,"Initializing eNB %d CC_id %d\n",inst,CC_id);
 #endif
@@ -1171,21 +1324,18 @@ void init_eNB(int single_thread_flag,int wait_for_sync) {
       memset((void*)&eNB->UL_INFO,0,sizeof(eNB->UL_INFO));
       memset((void*)&eNB->Sched_INFO,0,sizeof(eNB->Sched_INFO));
       LOG_I(PHY,"Setting indication lists\n");
-      eNB->UL_INFO.rx_ind.rx_pdu_list   = eNB->rx_pdu_list;
-      eNB->UL_INFO.crc_ind.crc_pdu_list = eNB->crc_pdu_list;
-      eNB->UL_INFO.sr_ind.sr_pdu_list = eNB->sr_pdu_list;
-      eNB->UL_INFO.harq_ind.harq_pdu_list = eNB->harq_pdu_list;
+      eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list   = eNB->rx_pdu_list;
+      eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list = eNB->crc_pdu_list;
+      eNB->UL_INFO.sr_ind.sr_indication_body.sr_pdu_list = eNB->sr_pdu_list;
+      eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list;
       eNB->UL_INFO.cqi_ind.cqi_pdu_list = eNB->cqi_pdu_list;
       eNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = eNB->cqi_raw_pdu_list;
+      eNB->prach_energy_counter = 0;
     }
 
   }
 
-
   LOG_I(PHY,"[lte-softmodem.c] eNB structure allocated\n");
-  
-
-
 }
 
 
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index 3ab9a29a751e520a38df0df68a4a769197a4abaa..3825ec988620c13e83f938bde05181806094bb84 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -95,6 +95,13 @@ unsigned short config_frames[4] = {2,9,11,13};
 #include "enb_config.h"
 //#include "PHY/TOOLS/time_meas.h"
 
+/* these variables have to be defined before including ENB_APP/enb_paramdef.h */
+static int DEFBANDS[] = {7};
+static int DEFENBS[] = {0};
+
+#include "ENB_APP/enb_paramdef.h"
+#include "common/config/config_userapi.h"
+
 #ifndef OPENAIR2
 #include "UTIL/OTG/otg_extern.h"
 #endif
@@ -118,9 +125,10 @@ extern int fepw;
 
 
 extern void  phy_init_RU(RU_t*);
+extern void  phy_free_RU(RU_t*);
 
 void init_RU(char*);
-void stop_RU(RU_t *ru);
+void stop_RU(int nb_ru);
 void do_ru_sync(RU_t *ru);
 
 void configure_ru(int idx,
@@ -133,6 +141,7 @@ int attach_rru(RU_t *ru);
 
 int connect_rau(RU_t *ru);
 
+extern uint16_t sf_ahead;
 
 /*************************************************************/
 /* Functions to attach and configure RRU                     */
@@ -316,7 +325,8 @@ static inline void fh_if5_mobipass_south_out(RU_t *ru) {
 static inline void fh_if4p5_south_out(RU_t *ru) {
   if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff );
   LOG_D(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.subframe_tx);
-  send_IF4p5(ru,ru->proc.frame_tx, ru->proc.subframe_tx, IF4p5_PDLFFT);
+  if (subframe_select(&ru->frame_parms,ru->proc.subframe_tx)!=SF_UL) 
+    send_IF4p5(ru,ru->proc.frame_tx, ru->proc.subframe_tx, IF4p5_PDLFFT);
 }
 
 /*************************************************************/
@@ -391,8 +401,8 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
   proc->frame_rx     = f;
   proc->timestamp_rx = ((proc->frame_rx * 10)  + proc->subframe_rx ) * fp->samples_per_tti ;
   //  proc->timestamp_tx = proc->timestamp_rx +  (4*fp->samples_per_tti);
-  proc->subframe_tx  = (sf+4)%10;
-  proc->frame_tx     = (sf>5) ? (f+1)&1023 : f;
+  proc->subframe_tx  = (sf+sf_ahead)%10;
+  proc->frame_tx     = (sf>(9-sf_ahead)) ? (f+1)&1023 : f;
  
   if (proc->first_rx == 0) {
     if (proc->subframe_rx != *subframe){
@@ -578,14 +588,10 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
     proc->first_tx = 0;
   }
   else {
-    if (subframe_tx != *subframe) {
-      LOG_E(PHY,"subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe);
-      exit_fun("Exiting");
-    }
-    if (frame_tx != *frame) { 
-      LOG_E(PHY,"frame_tx %d is not what we expect %d\n",frame_tx,*frame);
-      exit_fun("Exiting");
-    }
+    AssertFatal(subframe_tx == *subframe,
+                "subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe);
+    AssertFatal(frame_tx == *frame, 
+                "frame_tx %d is not what we expect %d\n",frame_tx,*frame);
   }
 }
 
@@ -598,42 +604,42 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
   uint32_t symbol_number,symbol_mask,symbol_mask_full;
   int subframe_tx,frame_tx;
 
+  LOG_D(PHY, "%s(ru:%p frame, subframe)\n", __FUNCTION__, ru);
   symbol_number = 0;
   symbol_mask = 0;
-  symbol_mask_full = (1<<fp->symbols_per_tti)-1;
-
+  symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<<fp->dl_symbols_in_S_subframe) : (1<<fp->symbols_per_tti))-1;
   do {   
     recv_IF4p5(ru, &frame_tx, &subframe_tx, &packet_type, &symbol_number);
+    if ((subframe_select(fp,subframe_tx) == SF_DL) && (symbol_number == 0)) start_meas(&ru->rx_fhaul);
+    LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n",
+         *subframe,subframe_select(fp,*subframe),frame_tx,subframe_tx,symbol_number);
     if (proc->first_tx != 0) {
       *frame    = frame_tx;
       *subframe = subframe_tx;
       proc->first_tx = 0;
+      symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<<fp->dl_symbols_in_S_subframe) : (1<<fp->symbols_per_tti))-1;
     }
     else {
-      if (frame_tx != *frame) {
-	LOG_E(PHY,"frame_tx %d is not what we expect %d\n",frame_tx,*frame);
-	exit_fun("Exiting");
-      }
-      if (subframe_tx != *subframe) {
-	LOG_E(PHY,"subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe);
-	exit_fun("Exiting");
-      }
+      AssertFatal(frame_tx == *frame,
+	          "frame_tx %d is not what we expect %d\n",frame_tx,*frame);
+      AssertFatal(subframe_tx == *subframe,
+		  "subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe);
     }
     if (packet_type == IF4p5_PDLFFT) {
       symbol_mask = symbol_mask | (1<<symbol_number);
     }
-    else {
-      LOG_E(PHY,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type);
-      exit_fun("Exiting");
-    }
+    else AssertFatal(1==0,"Illegal IF4p5 packet type (should only be IF4p5_PDLFFT%d\n",packet_type);
   } while (symbol_mask != symbol_mask_full);    
 
+  if (subframe_select(fp,subframe_tx) == SF_DL) stop_meas(&ru->rx_fhaul);
+
   proc->subframe_tx  = subframe_tx;
   proc->frame_tx     = frame_tx;
 
   if ((frame_tx == 0)&&(subframe_tx == 0)) proc->frame_tx_unwrap += 1024;
 
-  proc->timestamp_tx = (((frame_tx + proc->frame_tx_unwrap) * 10) + subframe_tx) * fp->samples_per_tti;
+  proc->timestamp_tx = ((((uint64_t)frame_tx + (uint64_t)proc->frame_tx_unwrap) * 10) + (uint64_t)subframe_tx) * (uint64_t)fp->samples_per_tti;
+
   LOG_D(PHY,"RU %d/%d TST %llu, frame %d, subframe %d\n",ru->idx,0,(long long unsigned int)proc->timestamp_tx,frame_tx,subframe_tx);
     // dump VCD output for first RU in list
   if (ru == RC.ru[0]) {
@@ -670,16 +676,11 @@ void fh_if4p5_north_out(RU_t *ru) {
     send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULTICK);
     return;
   }
-  if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 ); 
 
-  AssertFatal(ru->feprx!=NULL,"No northbound FEP function, exiting\n");
-  if (ru->feprx) { 
-    LOG_D(PHY,"Doing FEP/IF4p5 for frame %d, subframe %d\n",proc->frame_rx,proc->subframe_rx);
-    ru->feprx(ru);
-    send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULFFT);
-  }
+  start_meas(&ru->tx_fhaul);
+  send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULFFT);
+  stop_meas(&ru->tx_fhaul);
 
-  if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 );
 }
 
 static void* emulatedRF_thread(void* param) {
@@ -721,7 +722,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
     
   for (i=0; i<ru->nb_rx; i++)
     rxp[i] = (void*)&ru->common.rxdata[i][*subframe*fp->samples_per_tti];
-  
+
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 );
 
   old_ts = proc->timestamp_rx;
@@ -742,8 +743,9 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
  
   proc->timestamp_rx = ts-ru->ts_offset;
 
-  if (rxs != fp->samples_per_tti)
-    LOG_E(PHY,"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
+  //AssertFatal(rxs == fp->samples_per_tti,
+	      //"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
+  if (rxs != fp->samples_per_tti) LOG_E(PHY, "rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
 
   if (proc->first_rx == 1) {
     ru->ts_offset = proc->timestamp_rx;
@@ -761,9 +763,9 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
   proc->subframe_rx  = (proc->timestamp_rx / fp->samples_per_tti)%10;
   // synchronize first reception to frame 0 subframe 0
 
-  //proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti);
-  //proc->subframe_tx  = (proc->subframe_rx+4)%10;
-  //proc->frame_tx     = (proc->subframe_rx>5) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
+  //proc->timestamp_tx = proc->timestamp_rx+(sf_ahead*fp->samples_per_tti);
+  //proc->subframe_tx  = (proc->subframe_rx+sf_ahead)%10;
+  //proc->frame_tx     = (proc->subframe_rx>(9-sf_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
   
   LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, subframe %d\n",
 	ru->idx, 
@@ -800,10 +802,10 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
   VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff );
   
   if (rxs != fp->samples_per_tti)
-    exit_fun( "problem receiving samples" );
-  
-
-  
+  {
+    //exit_fun( "problem receiving samples" );
+    LOG_E(PHY, "problem receiving samples");
+  }
 }
 
 
@@ -821,12 +823,11 @@ void tx_rf(RU_t *ru) {
   lte_subframe_t SF_type     = subframe_select(fp,proc->subframe_tx%10);
   lte_subframe_t prevSF_type = subframe_select(fp,(proc->subframe_tx+9)%10);
   lte_subframe_t nextSF_type = subframe_select(fp,(proc->subframe_tx+1)%10);
+  int sf_extension = 0;
+
   if ((SF_type == SF_DL) ||
       (SF_type == SF_S)) {
     
-    for (i=0; i<ru->nb_tx; i++)
-      txp[i] = (void*)&ru->common.txdata[i][proc->subframe_tx*fp->samples_per_tti]; 
-    
     int siglen=fp->samples_per_tti,flags=1;
     
     if (SF_type == SF_S) {
@@ -836,24 +837,31 @@ void tx_rf(RU_t *ru) {
     if ((fp->frame_type == TDD) &&
 	(SF_type == SF_DL)&&
 	(prevSF_type == SF_UL) &&
-	(nextSF_type == SF_DL))
+	(nextSF_type == SF_DL)) { 
       flags = 2; // start of burst
+      sf_extension = ru->N_TA_offset<<1;
+    }
     
     if ((fp->frame_type == TDD) &&
 	(SF_type == SF_DL)&&
 	(prevSF_type == SF_UL) &&
-	(nextSF_type == SF_UL))
+	(nextSF_type == SF_UL)) {
       flags = 4; // start of burst and end of burst (only one DL SF between two UL)
-  
+      sf_extension = ru->N_TA_offset<<1;
+    } 
+
+    for (i=0; i<ru->nb_tx; i++)
+      txp[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)-sf_extension];
+
     
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-ru->openair0_cfg.tx_sample_advance)&0xffffffff );
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
     // prepare tx buffer pointers
     
     txs = ru->rfdevice.trx_write_func(&ru->rfdevice,
-				      proc->timestamp_tx+ru->ts_offset-ru->openair0_cfg.tx_sample_advance,
+				      proc->timestamp_tx+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension,
 				      txp,
-				      siglen,
+				      siglen+sf_extension,
 				      ru->nb_tx,
 				      flags);
     
@@ -862,11 +870,8 @@ void tx_rf(RU_t *ru) {
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
     
     
-    
-    if (txs !=  fp->samples_per_tti) {
-      LOG_E(PHY,"TX : Timeout (sent %d/%d)\n",txs, fp->samples_per_tti);
-      exit_fun( "problem transmitting samples" );
-    }	
+    AssertFatal(txs ==  siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen);
+
   }
 }
 
@@ -917,7 +922,10 @@ static void* ru_thread_asynch_rxtx( void* param ) {
 	// asynchronous receive from south (Mobipass)
     if (ru->fh_south_asynch_in) ru->fh_south_asynch_in(ru,&frame,&subframe);
     // asynchronous receive from north (RRU IF4/IF5)
-    else if (ru->fh_north_asynch_in) ru->fh_north_asynch_in(ru,&frame,&subframe);
+    else if (ru->fh_north_asynch_in) {
+       if (subframe_select(&ru->frame_parms,subframe)!=SF_UL)
+         ru->fh_north_asynch_in(ru,&frame,&subframe);
+    }
     else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n");
   }
 
@@ -988,22 +996,38 @@ static void* ru_thread_prach( void* param ) {
   thread_top_init("ru_thread_prach",1,500000,1000000,20000000);
   //wait_sync("ru_thread_prach");
 
+  while (RC.ru_mask>0) {
+    usleep(1e6);
+    LOG_I(PHY,"%s() RACH waiting for RU to be configured\n", __FUNCTION__);
+  }
+  LOG_I(PHY,"%s() RU configured - RACH processing thread running\n", __FUNCTION__);
+
   while (!oai_exit) {
     
     if (oai_exit) break;
     if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );      
-    rx_prach(NULL,
-	     ru,
-	     NULL,
-             NULL,
-             NULL,
-             proc->frame_prach,
-             0
+    if (ru->eNB_list[0]){
+      prach_procedures(
+        ru->eNB_list[0]
 #ifdef Rel14
-	     ,0
+        ,0
 #endif
-	     );
+        );
+    }
+    else {
+       rx_prach(NULL,
+  	        ru,
+	        NULL,
+                NULL,
+                NULL,
+                proc->frame_prach,
+                0
+#ifdef Rel14
+	        ,0
+#endif
+	        );
+    } 
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 );      
     if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
   }
@@ -1154,23 +1178,29 @@ void wakeup_eNBs(RU_t *ru) {
   int i;
   PHY_VARS_eNB **eNB_list = ru->eNB_list;
 
-  LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d\n",ru->num_eNB,ru->idx);
+  LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d ru->eNB_top:%p\n",ru->num_eNB,ru->idx, ru->eNB_top);
 
-  if (get_nprocs() <= 4) {
+
+  if (ru->num_eNB==1 && ru->eNB_top!=0 && get_nprocs() <= 4) {
     // call eNB function directly
   
     char string[20];
     sprintf(string,"Incoming RU %d",ru->idx);
-    LOG_D(PHY,"RU %d Waking up eNB\n",ru->idx);
+    LOG_D(PHY,"RU %d Call eNB_top\n",ru->idx);
     ru->eNB_top(eNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string,ru);
   }
   else {
-    
+
+    LOG_D(PHY,"ru->num_eNB:%d\n", ru->num_eNB);
+
     for (i=0;i<ru->num_eNB;i++)
     {
+      LOG_D(PHY,"ru->wakeup_rxtx:%p\n", ru->wakeup_rxtx);
       eNB_list[i]->proc.ru_proc = &ru->proc;
-      if (ru->wakeup_rxtx(eNB_list[i],ru) < 0)
-      LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx);
+      if (ru->wakeup_rxtx!=0 && ru->wakeup_rxtx(eNB_list[i],ru) < 0)
+      {
+	LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx);
+      }
     }
   }
 }
@@ -1192,7 +1222,12 @@ static inline int wakeup_prach_ru(RU_t *ru) {
     ru->proc.frame_prach    = ru->proc.frame_rx;
     ru->proc.subframe_prach = ru->proc.subframe_rx;
 
-    LOG_D(PHY,"RU %d: waking up PRACH thread\n",ru->idx);
+    // DJP - think prach_procedures() is looking at eNB frame_prach
+    if (ru->eNB_list[0]) {
+      ru->eNB_list[0]->proc.frame_prach = ru->proc.frame_rx;
+      ru->eNB_list[0]->proc.subframe_prach = ru->proc.subframe_rx;
+    }
+    LOG_I(PHY,"RU %d: waking up PRACH thread\n",ru->idx);
     // the thread can now be woken up
     AssertFatal(pthread_cond_signal(&ru->proc.cond_prach) == 0, "ERROR pthread_cond_signal for RU prach thread\n");
   }
@@ -1304,8 +1339,8 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
     cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
     cfg->rx_freq[i] = (double)fp->ul_CarrierFreq;
 
-    cfg->tx_gain[i] = (double)fp->att_tx;
-    cfg->rx_gain[i] = ru->max_rxgain-(double)fp->att_rx;
+    cfg->tx_gain[i] = ru->att_tx;
+    cfg->rx_gain[i] = ru->max_rxgain-ru->att_rx;
 
     cfg->configFilename = rf_config_file;
     printf("channel %d, Setting tx_gain offset %f, rx_gain offset %f, tx_freq %f, rx_freq %f\n",
@@ -1337,18 +1372,12 @@ int setup_RU_buffers(RU_t *ru) {
     return(-1);
   }
   
-  /*
-    if (frame_parms->frame_type == TDD) {
-    if (frame_parms->N_RB_DL == 100)
-    N_TA_offset = 624;
-    else if (frame_parms->N_RB_DL == 50)
-    N_TA_offset = 624/2;
-    else if (frame_parms->N_RB_DL == 25)
-    N_TA_offset = 624/4;
-    }
-  */
-  
   
+  if (frame_parms->frame_type == TDD) {
+    if      (frame_parms->N_RB_DL == 100) ru->N_TA_offset = 624;
+    else if (frame_parms->N_RB_DL == 50)  ru->N_TA_offset = 624/2;
+    else if (frame_parms->N_RB_DL == 25)  ru->N_TA_offset = 624/4;
+  } 
   if (ru->openair0_cfg.mmapped_dma == 1) {
     // replace RX signal buffers with mmaped HW versions
     
@@ -1398,6 +1427,12 @@ static void* ru_stats_thread(void* param) {
      if (opp_enabled == 1 && fepw) {
        if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL);
        if (ru->feptx_ofdm) print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL);
+       if (ru->fh_north_asynch_in) print_meas(&ru->rx_fhaul,"rx_fhaul",NULL,NULL);
+       if (ru->fh_north_out) {
+          print_meas(&ru->tx_fhaul,"tx_fhaul",NULL,NULL);
+          print_meas(&ru->compression,"compression",NULL,NULL);
+          print_meas(&ru->transport,"transport",NULL,NULL);
+       }
      }
   }
   return(NULL);
@@ -1570,23 +1605,30 @@ static void* ru_thread( void* param ) {
       subframe++;
     }      
 
-    LOG_D(PHY,"RU thread (proc %p), frame %d (%p), subframe %d (%p)\n",
-	  proc, frame,&frame,subframe,&subframe);
-
-
     // synchronization on input FH interface, acquire signals/data and block
     if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&subframe);
     else AssertFatal(1==0, "No fronthaul interface at south port");
 
-
-    LOG_D(PHY,"RU thread (do_prach %d, is_prach_subframe %d), received frame %d, subframe %d\n",
-	  ru->do_prach,
-	  is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx),
-	  proc->frame_rx,proc->subframe_rx);
- 
-    if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) wakeup_prach_ru(ru);
+/*
+    LOG_D(PHY,"AFTER fh_south_in - SFN/SF:%d%d RU->proc[RX:%d%d TX:%d%d] RC.eNB[0][0]:[RX:%d%d TX(SFN):%d]\n",
+        frame,subframe,
+        proc->frame_rx,proc->subframe_rx,
+        proc->frame_tx,proc->subframe_tx,
+        RC.eNB[0][0]->proc.frame_rx,RC.eNB[0][0]->proc.subframe_rx,
+        RC.eNB[0][0]->proc.frame_tx);
+
+      LOG_D(PHY,"RU thread (do_prach %d, is_prach_subframe %d), received frame %d, subframe %d\n",
+          ru->do_prach,
+          is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx),
+          proc->frame_rx,proc->subframe_rx);
+*/ 
+    if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) {
+      wakeup_prach_ru(ru);
+    }
 #ifdef Rel14
-    else if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)>1)) wakeup_prach_ru_br(ru);
+    else if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)>1)) {
+      wakeup_prach_ru_br(ru);
+    }
 #endif
 
     // adjust for timing offset between RU
@@ -1594,21 +1636,16 @@ static void* ru_thread( void* param ) {
 
 
     // do RX front-end processing (frequency-shift, dft) if needed
-    if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 ); 
     if (ru->feprx) ru->feprx(ru);
-    if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 ); 
 
     // At this point, all information for subframe has been received on FH interface
     // If this proc is to provide synchronization, do so
     wakeup_slaves(proc);
 
-    LOG_D(PHY,"RU %d/%d frame_tx %d, subframe_tx %d\n",0,ru->idx,proc->frame_tx,proc->subframe_tx);
     // wakeup all eNB processes waiting for this RU
     if (ru->num_eNB>0) wakeup_eNBs(ru);
-
     
-	if(get_nprocs() <= 4)
-	{
+    if(get_nprocs() <= 4){
       // do TX front-end processing if needed (precoding and/or IDFTs)
       if (ru->feptx_prec) ru->feptx_prec(ru);
       
@@ -1620,13 +1657,19 @@ static void* ru_thread( void* param ) {
         
         if (ru->fh_north_out) ru->fh_north_out(ru);
       }
-	}
-    
+    }
+
   }
   
 
   printf( "Exiting ru_thread \n");
- 
+
+  if (ru->stop_rf != NULL) {
+    if (ru->stop_rf(ru) != 0)
+      LOG_E(HW,"Could not stop the RF device\n");
+    else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx);
+  }
+
   ru_thread_status = 0;
   return &ru_thread_status;
 
@@ -1705,8 +1748,6 @@ void *ru_thread_synch(void *arg) {
     if (release_thread(&ru->proc.mutex_synch,&ru->proc.instance_cnt_synch,"ru_synch_thread") < 0) break;
   } // oai_exit
 
-  lte_sync_time_free();
-
   ru_thread_synch_status = 0;
   return &ru_thread_synch_status;
 
@@ -1722,6 +1763,12 @@ int start_rf(RU_t *ru) {
   return(ru->rfdevice.trx_start_func(&ru->rfdevice));
 }
 
+int stop_rf(RU_t *ru)
+{
+  ru->rfdevice.trx_end_func(&ru->rfdevice);
+  return 0;
+}
+
 extern void fep_full(RU_t *ru);
 extern void ru_fep_full_2thread(RU_t *ru);
 extern void feptx_ofdm(RU_t *ru);
@@ -1771,6 +1818,7 @@ void init_RU_proc(RU_t *ru) {
   pthread_mutex_init( &proc->mutex_FH,NULL);
   pthread_mutex_init( &proc->mutex_FH1,NULL);
   pthread_mutex_init( &proc->mutex_emulateRF,NULL);
+  pthread_mutex_init( &proc->mutex_eNBs, NULL);
   
   pthread_cond_init( &proc->cond_prach, NULL);
   pthread_cond_init( &proc->cond_FH, NULL);
@@ -1778,6 +1826,7 @@ void init_RU_proc(RU_t *ru) {
   pthread_cond_init( &proc->cond_emulateRF, NULL);
   pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
   pthread_cond_init( &proc->cond_synch,NULL);
+  pthread_cond_init( &proc->cond_eNBs, NULL);
   
   pthread_attr_init( &proc->attr_FH);
   pthread_attr_init( &proc->attr_FH1);
@@ -1832,6 +1881,10 @@ void init_RU_proc(RU_t *ru) {
     pthread_setname_np( proc->pthread_FH, name );
     
   }
+  else if (ru->function == eNodeB_3GPP && ru->if_south == LOCAL_RF) { // DJP - need something else to distinguish between monolithic and PNF
+    LOG_I(PHY,"%s() DJP - added creation of pthread_prach\n", __FUNCTION__);
+    pthread_create( &proc->pthread_prach, attr_prach, ru_thread_prach, (void*)ru );
+  }
 
   if (get_nprocs()> 2 && fepw) { 
     if (ru->feprx) init_fep_thread(ru,NULL); 
@@ -1841,9 +1894,115 @@ void init_RU_proc(RU_t *ru) {
   
 }
 
+void kill_RU_proc(int inst)
+{
+  RU_t *ru = RC.ru[inst];
+  RU_proc_t *proc = &ru->proc;
+
+  pthread_mutex_lock(&proc->mutex_FH);
+  proc->instance_cnt_FH = 0;
+  pthread_mutex_unlock(&proc->mutex_FH);
+  pthread_cond_signal(&proc->cond_FH);
 
+  pthread_mutex_lock(&proc->mutex_prach);
+  proc->instance_cnt_prach = 0;
+  pthread_mutex_unlock(&proc->mutex_prach);
+  pthread_cond_signal(&proc->cond_prach);
+
+#ifdef Rel14
+  pthread_mutex_lock(&proc->mutex_prach_br);
+  proc->instance_cnt_prach_br = 0;
+  pthread_mutex_unlock(&proc->mutex_prach_br);
+  pthread_cond_signal(&proc->cond_prach_br);
+#endif
 
+  pthread_mutex_lock(&proc->mutex_synch);
+  proc->instance_cnt_synch = 0;
+  pthread_mutex_unlock(&proc->mutex_synch);
+  pthread_cond_signal(&proc->cond_synch);
 
+  pthread_mutex_lock(&proc->mutex_eNBs);
+  proc->instance_cnt_eNBs = 0;
+  pthread_mutex_unlock(&proc->mutex_eNBs);
+  pthread_cond_signal(&proc->cond_eNBs);
+
+  pthread_mutex_lock(&proc->mutex_asynch_rxtx);
+  proc->instance_cnt_asynch_rxtx = 0;
+  pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
+  pthread_cond_signal(&proc->cond_asynch_rxtx);
+
+  LOG_D(PHY, "Joining pthread_FH\n");
+  pthread_join(proc->pthread_FH, NULL);
+  if (ru->function == NGFI_RRU_IF4p5) {
+    LOG_D(PHY, "Joining pthread_prach\n");
+    pthread_join(proc->pthread_prach, NULL);
+#ifdef Rel14
+    LOG_D(PHY, "Joining pthread_prach_br\n");
+    pthread_join(proc->pthread_prach_br, NULL);
+#endif
+    if (ru->is_slave) {
+      LOG_D(PHY, "Joining pthread_\n");
+      pthread_join(proc->pthread_synch, NULL);
+    }
+
+    if ((ru->if_timing == synch_to_other) ||
+        (ru->function == NGFI_RRU_IF5) ||
+        (ru->function == NGFI_RRU_IF4p5)) {
+      LOG_D(PHY, "Joining pthread_asynch_rxtx\n");
+      pthread_join(proc->pthread_asynch_rxtx, NULL);
+    }
+  }
+  if (get_nprocs() >= 2) {
+    if (ru->feprx) {
+      pthread_mutex_lock(&proc->mutex_fep);
+      proc->instance_cnt_fep = 0;
+      pthread_mutex_unlock(&proc->mutex_fep);
+      pthread_cond_signal(&proc->cond_fep);
+      LOG_D(PHY, "Joining pthread_fep\n");
+      pthread_join(proc->pthread_fep, NULL);
+      pthread_mutex_destroy(&proc->mutex_fep);
+      pthread_cond_destroy(&proc->cond_fep);
+    }
+    if (ru->feptx_ofdm) {
+      pthread_mutex_lock(&proc->mutex_feptx);
+      proc->instance_cnt_feptx = 0;
+      pthread_mutex_unlock(&proc->mutex_feptx);
+      pthread_cond_signal(&proc->cond_feptx);
+      LOG_D(PHY, "Joining pthread_feptx\n");
+      pthread_join(proc->pthread_feptx, NULL);
+      pthread_mutex_destroy(&proc->mutex_feptx);
+      pthread_cond_destroy(&proc->cond_feptx);
+    }
+  }
+  if (opp_enabled) {
+    LOG_D(PHY, "Joining ru_stats_thread\n");
+    pthread_join(ru->ru_stats_thread, NULL);
+  }
+
+  pthread_mutex_destroy(&proc->mutex_prach);
+  pthread_mutex_destroy(&proc->mutex_asynch_rxtx);
+  pthread_mutex_destroy(&proc->mutex_synch);
+  pthread_mutex_destroy(&proc->mutex_FH);
+  pthread_mutex_destroy(&proc->mutex_eNBs);
+
+  pthread_cond_destroy(&proc->cond_prach);
+  pthread_cond_destroy(&proc->cond_FH);
+  pthread_cond_destroy(&proc->cond_asynch_rxtx);
+  pthread_cond_destroy(&proc->cond_synch);
+  pthread_cond_destroy(&proc->cond_eNBs);
+
+  pthread_attr_destroy(&proc->attr_FH);
+  pthread_attr_destroy(&proc->attr_prach);
+  pthread_attr_destroy(&proc->attr_synch);
+  pthread_attr_destroy(&proc->attr_asynch_rxtx);
+  pthread_attr_destroy(&proc->attr_fep);
+
+#ifdef Rel14
+  pthread_mutex_destroy(&proc->mutex_prach_br);
+  pthread_cond_destroy(&proc->cond_prach_br);
+  pthread_attr_destroy(&proc->attr_prach_br);
+#endif
+}
 
 int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
 
@@ -1901,7 +2060,6 @@ void configure_ru(int idx,
   RRU_config_t       *config       = (RRU_config_t *)arg;
   RRU_capabilities_t *capabilities = (RRU_capabilities_t*)arg;
   int ret;
-  int i;
 
   LOG_I(PHY, "Received capabilities from RRU %d\n",idx);
 
@@ -1910,6 +2068,10 @@ void configure_ru(int idx,
 
   AssertFatal((ret=check_capabilities(ru,capabilities)) == 0,
 	      "Cannot configure RRU %d, check_capabilities returned %d\n", idx,ret);
+  // take antenna capabilities of RRU
+  ru->nb_tx                      = capabilities->nb_tx[0];
+  ru->nb_rx                      = capabilities->nb_rx[0];
+
   // Pass configuration to RRU
   LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->frame_parms.eutra_band);
   // wait for configuration 
@@ -1918,6 +2080,8 @@ void configure_ru(int idx,
   config->band_list[0]           = ru->frame_parms.eutra_band;
   config->tx_freq[0]             = ru->frame_parms.dl_CarrierFreq;      
   config->rx_freq[0]             = ru->frame_parms.ul_CarrierFreq;      
+  config->tdd_config[0]          = ru->frame_parms.tdd_config;
+  config->tdd_config_S[0]        = ru->frame_parms.tdd_config_S;
   config->att_tx[0]              = ru->att_tx;
   config->att_rx[0]              = ru->att_rx;
   config->N_RB_DL[0]             = ru->frame_parms.N_RB_DL;
@@ -1930,6 +2094,7 @@ void configure_ru(int idx,
 	  config->prach_FreqOffset[0],config->prach_ConfigIndex[0]);
     
 #ifdef Rel14
+    int i;
     for (i=0;i<4;i++) {
       config->emtc_prach_CElevel_enable[0][i]  = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i];
       config->emtc_prach_FreqOffset[0][i]      = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i];
@@ -1937,10 +2102,6 @@ void configure_ru(int idx,
     }
 #endif
   }
-  // take antenna capabilities of RRU
-  ru->nb_tx                      = capabilities->nb_tx[0];
-  ru->nb_rx                      = capabilities->nb_rx[0];
-
 
   init_frame_parms(&ru->frame_parms,1);
   phy_init_RU(ru);
@@ -1955,6 +2116,13 @@ void configure_rru(int idx,
   ru->frame_parms.eutra_band                                               = config->band_list[0];
   ru->frame_parms.dl_CarrierFreq                                           = config->tx_freq[0];
   ru->frame_parms.ul_CarrierFreq                                           = config->rx_freq[0];
+  if (ru->frame_parms.dl_CarrierFreq == ru->frame_parms.ul_CarrierFreq) {
+     ru->frame_parms.frame_type                                            = TDD;
+     ru->frame_parms.tdd_config                                            = config->tdd_config[0];
+     ru->frame_parms.tdd_config_S                                          = config->tdd_config_S[0]; 
+  }
+  else
+     ru->frame_parms.frame_type                                            = FDD;
   ru->att_tx                                                               = config->att_tx[0];
   ru->att_rx                                                               = config->att_rx[0];
   ru->frame_parms.N_RB_DL                                                  = config->N_RB_DL[0];
@@ -1962,8 +2130,11 @@ void configure_rru(int idx,
   ru->frame_parms.threequarter_fs                                          = config->threequarter_fs[0];
   ru->frame_parms.pdsch_config_common.referenceSignalPower                 = ru->max_pdschReferenceSignalPower-config->att_tx[0];
   if (ru->function==NGFI_RRU_IF4p5) {
-    LOG_I(PHY,"Setting ru->function to NGFI_RRU_IF4p5, prach_FrequOffset %d, prach_ConfigIndex %d\n",
-	  config->prach_FreqOffset[0],config->prach_ConfigIndex[0]);
+  ru->frame_parms.att_rx = ru->att_rx;
+  ru->frame_parms.att_tx = ru->att_tx;
+
+    LOG_I(PHY,"Setting ru->function to NGFI_RRU_IF4p5, prach_FrequOffset %d, prach_ConfigIndex %d, att (%d,%d)\n",
+	  config->prach_FreqOffset[0],config->prach_ConfigIndex[0],ru->att_tx,ru->att_rx);
     ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset  = config->prach_FreqOffset[0]; 
     ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0]; 
 #ifdef Rel14
@@ -1977,6 +2148,8 @@ void configure_rru(int idx,
   
   init_frame_parms(&ru->frame_parms,1);
 
+  fill_rf_config(ru,ru->rf_config_file);
+
 
   phy_init_RU(ru);
 
@@ -2012,14 +2185,163 @@ void init_precoding_weights(PHY_VARS_eNB *eNB) {
   }
 }
 
+void set_function_spec_param(RU_t *ru)
+{
+  int ret;
+
+  switch (ru->if_south) {
+  case LOCAL_RF:   // this is an RU with integrated RF (RRU, eNB)
+    if (ru->function ==  NGFI_RRU_IF5) {                 // IF5 RRU
+      ru->do_prach              = 0;                      // no prach processing in RU
+      ru->fh_north_in           = NULL;                   // no shynchronous incoming fronthaul from north
+      ru->fh_north_out          = fh_if5_north_out;       // need only to do send_IF5  reception
+      ru->fh_south_out          = tx_rf;                  // send output to RF
+      ru->fh_north_asynch_in    = fh_if5_north_asynch_in; // TX packets come asynchronously
+      ru->feprx                 = NULL;                   // nothing (this is a time-domain signal)
+      ru->feptx_ofdm            = NULL;                   // nothing (this is a time-domain signal)
+      ru->feptx_prec            = NULL;                   // nothing (this is a time-domain signal)
+      ru->start_if              = start_if;               // need to start the if interface for if5
+      ru->ifdevice.host_type    = RRU_HOST;
+      ru->rfdevice.host_type    = RRU_HOST;
+      ru->ifdevice.eth_params   = &ru->eth_params;
+      reset_meas(&ru->rx_fhaul);
+      reset_meas(&ru->tx_fhaul);
+      reset_meas(&ru->compression);
+      reset_meas(&ru->transport);
+
+      ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
+      printf("openair0_transport_init returns %d for ru_id %d\n", ret, ru->idx);
+      if (ret<0) {
+        printf("Exiting, cannot initialize transport protocol\n");
+        exit(-1);
+      }
+    }
+    else if (ru->function == NGFI_RRU_IF4p5) {
+      ru->do_prach              = 1;                        // do part of prach processing in RU
+      ru->fh_north_in           = NULL;                     // no synchronous incoming fronthaul from north
+      ru->fh_north_out          = fh_if4p5_north_out;       // send_IF4p5 on reception
+      ru->fh_south_out          = tx_rf;                    // send output to RF
+      ru->fh_north_asynch_in    = fh_if4p5_north_asynch_in; // TX packets come asynchronously
+      ru->feprx                 = (get_nprocs()<=2) ? fep_full :ru_fep_full_2thread;                 // RX DFTs
+      ru->feptx_ofdm            = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread;               // this is fep with idft only (no precoding in RRU)
+      ru->feptx_prec            = NULL;
+      ru->start_if              = start_if;                 // need to start the if interface for if4p5
+      ru->ifdevice.host_type    = RRU_HOST;
+      ru->rfdevice.host_type    = RRU_HOST;
+      ru->ifdevice.eth_params   = &ru->eth_params;
+      reset_meas(&ru->rx_fhaul);
+      reset_meas(&ru->tx_fhaul);
+      reset_meas(&ru->compression);
+      reset_meas(&ru->transport);
+
+      ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
+      printf("openair0_transport_init returns %d for ru_id %d\n", ret, ru->idx);
+      if (ret<0) {
+        printf("Exiting, cannot initialize transport protocol\n");
+        exit(-1);
+      }
+      malloc_IF4p5_buffer(ru);
+    }
+    else if (ru->function == eNodeB_3GPP) {
+      ru->do_prach             = 0;                       // no prach processing in RU
+      ru->feprx                = (get_nprocs()<=2) ? fep_full : ru_fep_full_2thread;                // RX DFTs
+      ru->feptx_ofdm           = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread;              // this is fep with idft and precoding
+      ru->feptx_prec           = feptx_prec;              // this is fep with idft and precoding
+      ru->fh_north_in          = NULL;                    // no incoming fronthaul from north
+      ru->fh_north_out         = NULL;                    // no outgoing fronthaul to north
+      ru->start_if             = NULL;                    // no if interface
+      ru->rfdevice.host_type   = RAU_HOST;
+    }
+    ru->fh_south_in            = rx_rf;                               // local synchronous RF RX
+    ru->fh_south_out           = tx_rf;                               // local synchronous RF TX
+    ru->start_rf               = start_rf;                            // need to start the local RF interface
+    ru->stop_rf                = stop_rf;
+    printf("configuring ru_id %d (start_rf %p)\n", ru->idx, start_rf);
+/*
+    if (ru->function == eNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
+      fill_rf_config(ru,rf_config_file);
+      init_frame_parms(&ru->frame_parms,1);
+      phy_init_RU(ru);
+    }
+
+    ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
+    if (setup_RU_buffers(ru)!=0) {
+      printf("Exiting, cannot initialize RU Buffers\n");
+      exit(-1);
+    }*/
+    break;
+
+  case REMOTE_IF5: // the remote unit is IF5 RRU
+    ru->do_prach               = 0;
+    ru->feprx                  = (get_nprocs()<=2) ? fep_full : fep_full;                   // this is frequency-shift + DFTs
+    ru->feptx_prec             = feptx_prec;                 // need to do transmit Precoding + IDFTs
+    ru->feptx_ofdm             = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread;                 // need to do transmit Precoding + IDFTs
+    if (ru->if_timing == synch_to_other) {
+      ru->fh_south_in          = fh_slave_south_in;                  // synchronize to master
+      ru->fh_south_out         = fh_if5_mobipass_south_out;          // use send_IF5 for mobipass
+      ru->fh_south_asynch_in   = fh_if5_south_asynch_in_mobipass;    // UL is asynchronous
+    }
+    else {
+      ru->fh_south_in          = fh_if5_south_in;     // synchronous IF5 reception
+      ru->fh_south_out         = fh_if5_south_out;    // synchronous IF5 transmission
+      ru->fh_south_asynch_in   = NULL;                // no asynchronous UL
+    }
+    ru->start_rf               = NULL;                 // no local RF
+    ru->stop_rf                = NULL;
+    ru->start_if               = start_if;             // need to start if interface for IF5
+    ru->ifdevice.host_type     = RAU_HOST;
+    ru->ifdevice.eth_params    = &ru->eth_params;
+    ru->ifdevice.configure_rru = configure_ru;
+
+    ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
+    printf("openair0_transport_init returns %d for ru_id %d\n", ret, ru->idx);
+    if (ret<0) {
+      printf("Exiting, cannot initialize transport protocol\n");
+      exit(-1);
+    }
+    break;
+
+  case REMOTE_IF4p5:
+    ru->do_prach               = 0;
+    ru->feprx                  = NULL;                // DFTs
+    ru->feptx_prec             = feptx_prec;          // Precoding operation
+    ru->feptx_ofdm             = NULL;                // no OFDM mod
+    ru->fh_south_in            = fh_if4p5_south_in;   // synchronous IF4p5 reception
+    ru->fh_south_out           = fh_if4p5_south_out;  // synchronous IF4p5 transmission
+    ru->fh_south_asynch_in     = (ru->if_timing == synch_to_other) ? fh_if4p5_south_in : NULL;                // asynchronous UL if synch_to_other
+    ru->fh_north_out           = NULL;
+    ru->fh_north_asynch_in     = NULL;
+    ru->start_rf               = NULL;                // no local RF
+    ru->stop_rf                = NULL;
+    ru->start_if               = start_if;            // need to start if interface for IF4p5
+    ru->ifdevice.host_type     = RAU_HOST;
+    ru->ifdevice.eth_params    = &ru->eth_params;
+    ru->ifdevice.configure_rru = configure_ru;
+
+    ret = openair0_transport_load(&ru->ifdevice, &ru->openair0_cfg, &ru->eth_params);
+    printf("openair0_transport_init returns %d for ru_id %d\n", ret, ru->idx);
+    if (ret<0) {
+      printf("Exiting, cannot initialize transport protocol\n");
+      exit(-1);
+    }
+
+    malloc_IF4p5_buffer(ru);
+
+    break;
+
+  default:
+    LOG_E(PHY,"RU with invalid or unknown southbound interface type %d\n",ru->if_south);
+    break;
+  } // switch on interface type
+}
+
 extern void RCconfig_RU(void);
 
 void init_RU(char *rf_config_file) {
   
   int ru_id;
   RU_t *ru;
-  int ret;
-  PHY_VARS_eNB *eNB0;
+  PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
   int i;
   int CC_id;
 
@@ -2031,12 +2353,15 @@ void init_RU(char *rf_config_file) {
   // read in configuration file)
   printf("configuring RU from file\n");
   RCconfig_RU();
-  printf("number of L1 instances %d, number of RU %d\n",RC.nb_L1_inst,RC.nb_RU);
+  LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_L1_inst,RC.nb_RU,get_nprocs());
 
-  for (i=0;i<RC.nb_L1_inst;i++) 
-    for (CC_id=0;CC_id<RC.nb_CC[i];CC_id++) RC.eNB[i][CC_id]->num_RU=0;
+  if (RC.nb_CC != 0)
+    for (i=0;i<RC.nb_L1_inst;i++) 
+      for (CC_id=0;CC_id<RC.nb_CC[i];CC_id++) RC.eNB[i][CC_id]->num_RU=0;
 
+  LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
   for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
+    LOG_D(PHY,"Process RC.ru[%d]\n",ru_id);
     ru               = RC.ru[ru_id];
     ru->rf_config_file = rf_config_file;
     ru->idx          = ru_id;              
@@ -2044,158 +2369,46 @@ void init_RU(char *rf_config_file) {
     // use eNB_list[0] as a reference for RU frame parameters
     // NOTE: multiple CC_id are not handled here yet!
 
-    
+    if (ru->num_eNB > 0) {
+      LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file);
+
+      if (ru->eNB_list[0] == 0)
+      {
+        LOG_E(PHY,"%s() DJP - ru->eNB_list ru->num_eNB are not initialized - so do it manually\n", __FUNCTION__);
+        ru->eNB_list[0] = RC.eNB[0][0];
+        ru->num_eNB=1;
+      //
+      // DJP - feptx_prec() / feptx_ofdm() parses the eNB_list (based on num_eNB) and copies the txdata_F to txdata in RU
+      //
+      }
+      else
+      {
+        LOG_E(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__);
+      }
+    }
     eNB0             = ru->eNB_list[0];
-    if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5))
-      AssertFatal(eNB0!=NULL,"eNB0 is null!\n");
-
-    if (eNB0) {
-      LOG_I(PHY,"Copying frame parms from eNB %d to ru %d\n",eNB0->Mod_id,ru->idx);
-      memcpy((void*)&ru->frame_parms,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
-
-      // attach all RU to all eNBs in its list/
-      for (i=0;i<ru->num_eNB;i++) {
-	eNB0 = ru->eNB_list[i];
-	eNB0->RU_list[eNB0->num_RU++] = ru;
+    LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south);
+    LOG_D(PHY, "eNB0:%p\n", eNB0);
+    if (eNB0)
+    {
+      if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5))
+        AssertFatal(eNB0!=NULL,"eNB0 is null!\n");
+
+      if (eNB0) {
+        LOG_I(PHY,"Copying frame parms from eNB %d to ru %d\n",eNB0->Mod_id,ru->idx);
+        memcpy((void*)&ru->frame_parms,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
+
+        // attach all RU to all eNBs in its list/
+        LOG_D(PHY,"ru->num_eNB:%d eNB0->num_RU:%d\n", ru->num_eNB, eNB0->num_RU);
+        for (i=0;i<ru->num_eNB;i++) {
+          eNB0 = ru->eNB_list[i];
+          eNB0->RU_list[eNB0->num_RU++] = ru;
+        }
       }
     }
         LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function);
 
-    
-    switch (ru->if_south) {
-    case LOCAL_RF:   // this is an RU with integrated RF (RRU, eNB)
-      if (ru->function ==  NGFI_RRU_IF5) {                 // IF5 RRU
-	ru->do_prach              = 0;                      // no prach processing in RU
-	ru->fh_north_in           = NULL;                   // no shynchronous incoming fronthaul from north
-	ru->fh_north_out          = fh_if5_north_out;       // need only to do send_IF5  reception
-	ru->fh_south_out          = tx_rf;                  // send output to RF
-	ru->fh_north_asynch_in    = fh_if5_north_asynch_in; // TX packets come asynchronously 
-	ru->feprx                 = NULL;                   // nothing (this is a time-domain signal)
-	ru->feptx_ofdm            = NULL;                   // nothing (this is a time-domain signal)
-	ru->feptx_prec            = NULL;                   // nothing (this is a time-domain signal)
-	ru->start_if              = start_if;               // need to start the if interface for if5
-	ru->ifdevice.host_type    = RRU_HOST;
-	ru->rfdevice.host_type    = RRU_HOST;
-	ru->ifdevice.eth_params   = &ru->eth_params;
-
-	ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
-	printf("openair0_transport_init returns %d for ru_id %d\n",ret,ru_id);
-	if (ret<0) {
-	  printf("Exiting, cannot initialize transport protocol\n");
-	  exit(-1);
-	}
-      }
-      else if (ru->function == NGFI_RRU_IF4p5) {
-	ru->do_prach              = 1;                        // do part of prach processing in RU
-	ru->fh_north_in           = NULL;                     // no synchronous incoming fronthaul from north
-	ru->fh_north_out          = fh_if4p5_north_out;       // send_IF4p5 on reception
-	ru->fh_south_out          = tx_rf;                    // send output to RF
-	ru->fh_north_asynch_in    = fh_if4p5_north_asynch_in; // TX packets come asynchronously
-	ru->feprx                 = (get_nprocs()<=4) ? fep_full :ru_fep_full_2thread;                 // RX DFTs
-	ru->feptx_ofdm            = (get_nprocs()<=4) ? feptx_ofdm : feptx_ofdm_2thread;               // this is fep with idft only (no precoding in RRU)
-	ru->feptx_prec            = NULL;
-	ru->start_if              = start_if;                 // need to start the if interface for if4p5
-	ru->ifdevice.host_type    = RRU_HOST;
-	ru->rfdevice.host_type    = RRU_HOST;
-	ru->ifdevice.eth_params   = &ru->eth_params;
-
-	ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
-	printf("openair0_transport_init returns %d for ru_id %d\n",ret,ru_id);
-	if (ret<0) {
-	  printf("Exiting, cannot initialize transport protocol\n");
-	  exit(-1);
-	}
-	malloc_IF4p5_buffer(ru);
-      }
-      else if (ru->function == eNodeB_3GPP) {   
-	ru->do_prach             = 0;                       // no prach processing in RU            
-	ru->feprx                = (get_nprocs()> 2 && fepw) ? ru_fep_full_2thread : fep_full;                // RX DFTs
-	ru->feptx_ofdm           = (get_nprocs()> 2 && fepw) ? feptx_ofdm_2thread : feptx_ofdm;              // this is fep with idft and precoding
-	ru->feptx_prec           = feptx_prec;              // this is fep with idft and precoding
-	ru->fh_north_in          = NULL;                    // no incoming fronthaul from north
-	ru->fh_north_out         = NULL;                    // no outgoing fronthaul to north
-	ru->start_if             = NULL;                    // no if interface
-	ru->rfdevice.host_type   = RAU_HOST;
-      }
-      ru->fh_south_in            = rx_rf;                               // local synchronous RF RX
-      ru->fh_south_out           = tx_rf;                               // local synchronous RF TX
-      ru->start_rf               = start_rf;                            // need to start the local RF interface
-      printf("configuring ru_id %d (start_rf %p)\n",ru_id,start_rf);
-/*
-      if (ru->function == eNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
-	fill_rf_config(ru,rf_config_file);      
-	init_frame_parms(&ru->frame_parms,1);
-	phy_init_RU(ru);
-      }
-
-      ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
-      if (setup_RU_buffers(ru)!=0) {
-	printf("Exiting, cannot initialize RU Buffers\n");
-	exit(-1);
-      }*/
-      break;
-
-    case REMOTE_IF5: // the remote unit is IF5 RRU
-      ru->do_prach               = 0;
-      ru->feprx                  = (get_nprocs()<=2) ? fep_full : fep_full;                   // this is frequency-shift + DFTs
-      ru->feptx_prec             = feptx_prec;                 // need to do transmit Precoding + IDFTs 
-      ru->feptx_ofdm             = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread;                 // need to do transmit Precoding + IDFTs 
-      if (ru->if_timing == synch_to_other) {
-	ru->fh_south_in          = fh_slave_south_in;                  // synchronize to master
-	ru->fh_south_out         = fh_if5_mobipass_south_out;          // use send_IF5 for mobipass
-	ru->fh_south_asynch_in   = fh_if5_south_asynch_in_mobipass;    // UL is asynchronous
-      }
-      else {
-	ru->fh_south_in          = fh_if5_south_in;     // synchronous IF5 reception
-	ru->fh_south_out         = fh_if5_south_out;    // synchronous IF5 transmission
-	ru->fh_south_asynch_in   = NULL;                // no asynchronous UL
-      }
-      ru->start_rf               = NULL;                 // no local RF
-      ru->start_if               = start_if;             // need to start if interface for IF5 
-      ru->ifdevice.host_type     = RAU_HOST;
-      ru->ifdevice.eth_params    = &ru->eth_params;
-      ru->ifdevice.configure_rru = configure_ru;
-
-      ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
-      printf("openair0_transport_init returns %d for ru_id %d\n",ret,ru_id);
-      if (ret<0) {
-	printf("Exiting, cannot initialize transport protocol\n");
-	exit(-1);
-      }
-      break;
-
-    case REMOTE_IF4p5:
-      ru->do_prach               = 0;
-      ru->feprx                  = NULL;                // DFTs
-      ru->feptx_prec             = feptx_prec;          // Precoding operation
-      ru->feptx_ofdm             = NULL;                // no OFDM mod
-      ru->fh_south_in            = fh_if4p5_south_in;   // synchronous IF4p5 reception
-      ru->fh_south_out           = fh_if4p5_south_out;  // synchronous IF4p5 transmission
-      ru->fh_south_asynch_in     = (ru->if_timing == synch_to_other) ? fh_if4p5_south_in : NULL;                // asynchronous UL if synch_to_other
-      ru->fh_north_out           = NULL;
-      ru->fh_north_asynch_in     = NULL;
-      ru->start_rf               = NULL;                // no local RF
-      ru->start_if               = start_if;            // need to start if interface for IF4p5 
-      ru->ifdevice.host_type     = RAU_HOST;
-      ru->ifdevice.eth_params    = &ru->eth_params;
-      ru->ifdevice.configure_rru = configure_ru;
-
-      ret = openair0_transport_load(&ru->ifdevice, &ru->openair0_cfg, &ru->eth_params);
-      printf("openair0_transport_init returns %d for ru_id %d\n",ret,ru_id);
-      if (ret<0) {
-	printf("Exiting, cannot initialize transport protocol\n");
-	exit(-1);
-      }
-      
-      malloc_IF4p5_buffer(ru);
-      
-      break;
-
-    default:
-      LOG_E(PHY,"RU with invalid or unknown southbound interface type %d\n",ru->if_south);
-      break;
-    } // switch on interface type 
-
+    set_function_spec_param(ru);
     LOG_I(PHY,"Starting ru_thread %d\n",ru_id);
 
     init_RU_proc(ru);
@@ -2213,9 +2426,142 @@ void init_RU(char *rf_config_file) {
 
 
 
-void stop_ru(RU_t *ru) {
+void stop_RU(int nb_ru)
+{
+  for (int inst = 0; inst < nb_ru; inst++) {
+    LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
+    kill_RU_proc(inst);
+  }
+}
+
 
-  printf("Stopping RU %p processing threads\n",(void*)ru);
+/* --------------------------------------------------------*/
+/* from here function to use configuration module          */
+void RCconfig_RU(void) {
   
-}
+  int               j                             = 0;
+  int               i                             = 0;
 
+  
+  paramdef_t RUParams[] = RUPARAMS_DESC;
+  paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
+
+
+  config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);  
+
+  
+  if ( RUParamList.numelt > 0) {
+
+    RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
+   
+
+
+
+    RC.ru_mask=(1<<NB_RU) - 1;
+    printf("Set RU mask to %lx\n",RC.ru_mask);
+
+    for (j = 0; j < RC.nb_RU; j++) {
+
+      RC.ru[j]                                    = (RU_t*)malloc(sizeof(RU_t));
+      memset((void*)RC.ru[j],0,sizeof(RU_t));
+      RC.ru[j]->idx                                 = j;
+
+      printf("Creating RC.ru[%d]:%p\n", j, RC.ru[j]);
+
+      RC.ru[j]->if_timing                           = synch_to_ext_device;
+      if (RC.nb_L1_inst >0)
+        RC.ru[j]->num_eNB                           = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt;
+      else
+	    RC.ru[j]->num_eNB                           = 0;
+      for (i=0;i<RC.ru[j]->num_eNB;i++) RC.ru[j]->eNB_list[i] = RC.eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0];     
+
+
+      if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
+	if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
+	  RC.ru[j]->if_south                        = LOCAL_RF;
+	  RC.ru[j]->function                        = eNodeB_3GPP;
+	  printf("Setting function for RU %d to eNodeB_3GPP\n",j);
+        }
+        else { 
+          RC.ru[j]->eth_params.local_if_name            = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));    
+          RC.ru[j]->eth_params.my_addr                  = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); 
+          RC.ru[j]->eth_params.remote_addr              = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
+          RC.ru[j]->eth_params.my_portc                 = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
+          RC.ru[j]->eth_params.remote_portc             = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
+          RC.ru[j]->eth_params.my_portd                 = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
+          RC.ru[j]->eth_params.remote_portd             = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
+
+	  if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
+	    RC.ru[j]->if_south                        = LOCAL_RF;
+	    RC.ru[j]->function                        = NGFI_RRU_IF5;
+	    RC.ru[j]->eth_params.transp_preference    = ETH_UDP_MODE;
+	    printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j);
+	  } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
+	    RC.ru[j]->if_south                        = LOCAL_RF;
+	    RC.ru[j]->function                        = NGFI_RRU_IF5;
+	    RC.ru[j]->eth_params.transp_preference    = ETH_RAW_MODE;
+	    printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j);
+	  } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
+	    RC.ru[j]->if_south                        = LOCAL_RF;
+	    RC.ru[j]->function                        = NGFI_RRU_IF4p5;
+	    RC.ru[j]->eth_params.transp_preference    = ETH_UDP_IF4p5_MODE;
+	    printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j);
+	  } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
+	    RC.ru[j]->if_south                        = LOCAL_RF;
+	    RC.ru[j]->function                        = NGFI_RRU_IF4p5;
+	    RC.ru[j]->eth_params.transp_preference    = ETH_RAW_IF4p5_MODE;
+	    printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j);
+	  }
+	}
+	RC.ru[j]->max_pdschReferenceSignalPower     = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
+	RC.ru[j]->max_rxgain                        = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
+	RC.ru[j]->num_bands                         = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
+	for (i=0;i<RC.ru[j]->num_bands;i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; 
+      } //strcmp(local_rf, "yes") == 0
+      else {
+	printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr));
+
+        RC.ru[j]->eth_params.local_if_name	      = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));    
+        RC.ru[j]->eth_params.my_addr		      = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); 
+        RC.ru[j]->eth_params.remote_addr	      = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
+        RC.ru[j]->eth_params.my_portc		      = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
+        RC.ru[j]->eth_params.remote_portc	      = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
+        RC.ru[j]->eth_params.my_portd		      = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
+        RC.ru[j]->eth_params.remote_portd	      = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
+	if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
+	  RC.ru[j]->if_south                     = REMOTE_IF5;
+	  RC.ru[j]->function                     = NGFI_RAU_IF5;
+	  RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE;
+	} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
+	  RC.ru[j]->if_south                     = REMOTE_IF5;
+	  RC.ru[j]->function                     = NGFI_RAU_IF5;
+	  RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE;
+	} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
+	  RC.ru[j]->if_south                     = REMOTE_IF4p5;
+	  RC.ru[j]->function                     = NGFI_RAU_IF4p5;
+	  RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
+	} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
+	  RC.ru[j]->if_south                     = REMOTE_IF4p5;
+	  RC.ru[j]->function                     = NGFI_RAU_IF4p5;
+	  RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
+	} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if5_mobipass") == 0) {
+	  RC.ru[j]->if_south                     = REMOTE_IF5;
+	  RC.ru[j]->function                     = NGFI_RAU_IF5;
+	  RC.ru[j]->if_timing                    = synch_to_other;
+	  RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS;
+	}
+      }  /* strcmp(local_rf, "yes") != 0 */
+
+      RC.ru[j]->nb_tx                             = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
+      RC.ru[j]->nb_rx                             = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
+      
+      RC.ru[j]->att_tx                            = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
+      RC.ru[j]->att_rx                            = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
+    }// j=0..num_rus
+  } else {
+    RC.nb_RU = 0;	    
+  } // setting != NULL
+
+  return;
+  
+}
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index c6060a8463e8e9404236a0cc292d576ce441b401..b24301c5b8a5b8e88f7bba88b6afa75f6e87bf7c 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -100,8 +100,7 @@ unsigned short config_frames[4] = {2,9,11,13};
 #include "stats.h"
 #endif
 #include "lte-softmodem.h"
-
-
+#include "NB_IoT_interface.h"
 #ifdef XFORMS
 // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
 // at eNB 0, an UL scope for every UE
@@ -113,9 +112,16 @@ unsigned char                   scope_enb_num_ue = 2;
 static pthread_t                forms_thread; //xforms
 #endif //XFORMS
 
+pthread_cond_t nfapi_sync_cond;
+pthread_mutex_t nfapi_sync_mutex;
+int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
+
+uint8_t nfapi_mode = 0; // Default to monolithic mode
+
 pthread_cond_t sync_cond;
 pthread_mutex_t sync_mutex;
 int sync_var=-1; //!< protected by mutex \ref sync_mutex.
+int config_sync_var=-1;
 
 uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
 uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
@@ -129,11 +135,10 @@ volatile int             oai_exit = 0;
 static clock_source_t clock_source = internal;
 static int wait_for_sync = 0;
 
-static char              UE_flag=0;
 unsigned int                    mmapped_dma=0;
 int                             single_thread_flag=1;
 
-static char                     threequarter_fs=0;
+static int8_t                     threequarter_fs=0;
 
 uint32_t                 downlink_frequency[MAX_NUM_CCs][4];
 int32_t                  uplink_frequency_offset[MAX_NUM_CCs][4];
@@ -205,6 +210,12 @@ uint64_t num_missed_slots=0; // counter for the number of missed slots
 extern void reset_opp_meas(void);
 extern void print_opp_meas(void);
 
+extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
+			  uint8_t UE_id,
+			  uint8_t abstraction_flag);
+
+extern void init_eNB_afterRU(void);
+
 int transmission_mode=1;
 int emulate_rf = 0;
 int numerology = 0;
@@ -231,6 +242,9 @@ threads_t threads= {-1,-1,-1,-1,-1,-1,-1};
  */
 uint8_t abstraction_flag=0;
 
+/* forward declarations */
+void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
+
 /*---------------------BMC: timespec helpers -----------------------------*/
 
 struct timespec min_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
@@ -311,7 +325,7 @@ void signal_handler(int sig) {
 
 void exit_fun(const char* s)
 {
-  int CC_id;
+
   int ru_id;
 
   if (s != NULL) {
@@ -320,33 +334,22 @@ void exit_fun(const char* s)
 
   oai_exit = 1;
 
-  if (UE_flag==0) {
+
+    if (RC.ru == NULL)
+        exit(-1); // likely init not completed, prevent crash or hang, exit now...
     for (ru_id=0; ru_id<RC.nb_RU;ru_id++) {
-      if (RC.ru[ru_id]->rfdevice.trx_end_func)
+      if (RC.ru[ru_id] && RC.ru[ru_id]->rfdevice.trx_end_func)
 	RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
-      if (RC.ru[ru_id]->ifdevice.trx_end_func)
+      if (RC.ru[ru_id] && RC.ru[ru_id]->ifdevice.trx_end_func)
 	RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);  
     }
-  }
 
-  for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-    oai_exit = 1;
-
-    for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      if (UE_flag == 0) {
-      } else {
-	if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func)
-	  PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
-      }
-    }
 
 #if defined(ENABLE_ITTI)
     sleep(1); //allow lte-softmodem threads to exit first
     itti_terminate_tasks (TASK_UNKNOWN);
 #endif
 
-  }
 
 }
 
@@ -379,9 +382,9 @@ void reset_stats(FL_OBJECT *button, long arg)
 }
 
 static void *scope_thread(void *arg) {
-  char stats_buffer[16384];
+ 
 # ifdef ENABLE_XFORMS_WRITE_STATS
-  FILE *UE_stats, *eNB_stats;
+  FILE *eNB_stats;
 # endif
   struct sched_param sched_param;
   int UE_id, CC_id;
@@ -394,47 +397,15 @@ static void *scope_thread(void *arg) {
 
 # ifdef ENABLE_XFORMS_WRITE_STATS
 
-  if (UE_flag==1)
-    UE_stats  = fopen("UE_stats.txt", "w");
-  else
-    eNB_stats = fopen("eNB_stats.txt", "w");
+  eNB_stats = fopen("eNB_stats.txt", "w");
 
 #endif
 
   while (!oai_exit) {
-    if (UE_flag==1) {
-      dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
-      //fl_set_object_label(form_stats->stats_text, stats_buffer);
-      fl_clear_browser(form_stats->stats_text);
-      fl_add_browser_line(form_stats->stats_text, stats_buffer);
-
-      phy_scope_UE(form_ue[0],
-		   PHY_vars_UE_g[0][0],
-		   0,
-		   0,7);
 
-
-    } else {
-      /*
-	if (RC.eNB[0][0]->mac_enabled==1) {
-	len = dump_eNB_l2_stats (stats_buffer, 0);
-	//fl_set_object_label(form_stats_l2->stats_text, stats_buffer);
-	fl_clear_browser(form_stats_l2->stats_text);
-	fl_add_browser_line(form_stats_l2->stats_text, stats_buffer);
-	}
-	len = dump_eNB_stats (RC.eNB[0][0], stats_buffer, 0);
-
-	if (MAX_NUM_CCs>1)
-	len += dump_eNB_stats (RC.eNB[0][1], &stats_buffer[len], 0);
-
-	//fl_set_object_label(form_stats->stats_text, stats_buffer);
-	fl_clear_browser(form_stats->stats_text);
-	fl_add_browser_line(form_stats->stats_text, stats_buffer);
-      */
       ue_cnt=0;
       for(UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
 	for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-	  //	  if ((RC.eNB[0][CC_id]->dlsch[UE_id][0]->rnti>0) && (ue_cnt<scope_enb_num_ue)) {
 	  if ((ue_cnt<scope_enb_num_ue)) {
 	    phy_scope_eNB(form_enb[CC_id][ue_cnt],
 			  RC.eNB[0][CC_id],
@@ -442,12 +413,7 @@ static void *scope_thread(void *arg) {
 	    ue_cnt++;
 	  }
 	}
-      }
-
-    }
-	
-    //printf("doing forms\n");
-    //usleep(100000); // 100 ms
+      }	
     sleep(1);
   }
 
@@ -455,19 +421,11 @@ static void *scope_thread(void *arg) {
 
 # ifdef ENABLE_XFORMS_WRITE_STATS
 
-  if (UE_flag==1) {
-    if (UE_stats) {
-      rewind (UE_stats);
-      fwrite (stats_buffer, 1, len, UE_stats);
-      fclose (UE_stats);
-    }
-  } else {
     if (eNB_stats) {
       rewind (eNB_stats);
       fwrite (stats_buffer, 1, len, eNB_stats);
       fclose (eNB_stats);
     }
-  }
 
 # endif
 
@@ -486,7 +444,6 @@ void *l2l1_task(void *arg) {
   itti_set_task_real_time(TASK_L2L1);
   itti_mark_task_ready(TASK_L2L1);
 
-  if (UE_flag == 0) {
     /* Wait for the initialize message */
     printf("Wait for the ITTI initialize message\n");
     do {
@@ -507,6 +464,7 @@ void *l2l1_task(void *arg) {
       case TERMINATE_MESSAGE:
 	printf("received terminate message\n");
 	oai_exit=1;
+        start_eNB = 0;
 	itti_exit_task ();
 	break;
 
@@ -518,8 +476,7 @@ void *l2l1_task(void *arg) {
 
     result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
     AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
-  }
-
+/* ???? no else but seems to be UE only ??? 
   do {
     // Wait for a message
     itti_receive_msg (TASK_L2L1, &message_p);
@@ -550,17 +507,17 @@ void *l2l1_task(void *arg) {
     result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
     AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
   } while(!oai_exit);
-
+*/
   return NULL;
 }
 #endif
 
 
 static void get_options(void) {
-  int CC_id;
-  int tddflag;
-  char *loopfile=NULL;
-  int dumpframe;
+ 
+  int tddflag, nonbiotflag;
+ 
+  
   uint32_t online_log_messages;
   uint32_t glog_level, glog_verbosity;
   uint32_t start_telnetsrv;
@@ -595,96 +552,27 @@ static void get_options(void) {
      load_module_shlib("telnetsrv",NULL,0);
   }
 
-  
-  if (UE_flag > 0) {
-     paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
-     paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
-
-
-
-     config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
-     config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
-      if (loopfile != NULL) {
-  	  printf("Input file for hardware emulation: %s",loopfile);
-  	  mode=loop_through_memory;
-  	  input_fd = fopen(loopfile,"r");
-  	  AssertFatal(input_fd != NULL,"Please provide a valid input file\n");
-      }
-      if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;
-      if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med;
-      if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp;
-      if ( *(cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) > 0) mode = debug_prach;
-      if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0)  mode = no_L2_connect;
-      if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx; 
-      if (dumpframe  > 0)  mode = rx_dump_frame;
-      
-      if ( downlink_frequency[0][0] > 0) {
-  	  for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
-  	    downlink_frequency[CC_id][1] = downlink_frequency[0][0];
-  	    downlink_frequency[CC_id][2] = downlink_frequency[0][0];
-  	    downlink_frequency[CC_id][3] = downlink_frequency[0][0];
-  	    printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
-  	  }
-      UE_scan=0;
-      } 
-
-      if (tddflag > 0) {
-         for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) 
-	     frame_parms[CC_id]->frame_type = TDD;
-      }
-
-      if (frame_parms[0]->N_RB_DL !=0) {
-  	  if ( frame_parms[0]->N_RB_DL < 6 ) {
-  	     frame_parms[0]->N_RB_DL = 6;
-  	     printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",frame_parms[0]->N_RB_DL);
-  	  }
-  	  if ( frame_parms[0]->N_RB_DL > 100 ) {
-  	     frame_parms[0]->N_RB_DL = 100;
-  	     printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",frame_parms[0]->N_RB_DL);
-  	  }
-  	  if ( frame_parms[0]->N_RB_DL > 50 && frame_parms[0]->N_RB_DL < 100 ) {
-  	     frame_parms[0]->N_RB_DL = 50;
-  	     printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",frame_parms[0]->N_RB_DL);
-  	  }
-  	  if ( frame_parms[0]->N_RB_DL > 25 && frame_parms[0]->N_RB_DL < 50 ) {
-  	     frame_parms[0]->N_RB_DL = 25;
-  	     printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",frame_parms[0]->N_RB_DL);
-  	  }
-  	  UE_scan = 0;
-  	  frame_parms[0]->N_RB_UL=frame_parms[0]->N_RB_DL;
-  	  for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
-  	      frame_parms[CC_id]->N_RB_DL=frame_parms[0]->N_RB_DL;
-  	      frame_parms[CC_id]->N_RB_UL=frame_parms[0]->N_RB_UL;
-  	  }
-      }
-
-
-      for (CC_id=1;CC_id<MAX_NUM_CCs;CC_id++) {
-  	    tx_max_power[CC_id]=tx_max_power[0];
-	    rx_gain[0][CC_id] = rx_gain[0][0];
-	    tx_gain[0][CC_id] = tx_gain[0][0];
-      }
-  } /* UE_flag > 0 */
 #if T_TRACER
   paramdef_t cmdline_ttraceparams[] =CMDLINE_TTRACEPARAMS_DESC ;
   config_process_cmdline( cmdline_ttraceparams,sizeof(cmdline_ttraceparams)/sizeof(paramdef_t),NULL);   
 #endif
 
   if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
-    if (UE_flag == 0) {
       memset((void*)&RC,0,sizeof(RC));
       /* Read RC configuration file */
       RCConfig();
       NB_eNB_INST = RC.nb_inst;
       NB_RU	  = RC.nb_RU;
       printf("Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d\n",NB_eNB_INST,RC.nb_L1_inst,NB_RU);
-    }
-  } else if (UE_flag == 1 && (CONFIG_GETCONFFILE != NULL)) {
-    // Here the configuration file is the XER encoded UE capabilities
-    // Read it in and store in asn1c data structures
-    strcpy(uecap_xer,CONFIG_GETCONFFILE);
-    uecap_xer_in=1;
-  } /* UE with config file  */
+      if (nonbiotflag <= 0) {
+         load_NB_IoT();
+         printf("               nb_nbiot_rrc_inst %d, nb_nbiot_L1_inst %d, nb_nbiot_macrlc_inst %d\n",
+                RC.nb_nb_iot_rrc_inst, RC.nb_nb_iot_L1_inst, RC.nb_nb_iot_macrlc_inst);
+      } else {
+         printf("All Nb-IoT instances disabled\n");
+         RC.nb_nb_iot_rrc_inst=RC.nb_nb_iot_L1_inst=RC.nb_nb_iot_macrlc_inst=0;
+      }
+   }
 }
 
 
@@ -695,7 +583,7 @@ int T_dont_fork = 0;  /* default is to fork, see 'T_init' to understand */
 #endif
 
 
-void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
+
 void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
 
   int CC_id;
@@ -732,19 +620,19 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
     frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0;
     frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
 
-    downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31.
-    downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
-    downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
-    downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
+//    downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31.
+//    downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
+//    downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
+//    downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
     //printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
+    frame_parms[CC_id]->dl_CarrierFreq=downlink_frequency[CC_id][0];
 
   }
 
 }
 
-void init_openair0(void);
 
-void init_openair0() {
+void init_openair0(void) {
 
   int card;
   int i;
@@ -803,16 +691,14 @@ void init_openair0() {
     }
 
 
-
-
     if (frame_parms[0]->frame_type==TDD)
       openair0_cfg[card].duplex_mode = duplex_mode_TDD;
     else //FDD
       openair0_cfg[card].duplex_mode = duplex_mode_FDD;
 
     printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
-	   ((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx),
-	   ((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
+	   RC.eNB[0][0]->frame_parms.nb_antennas_tx ,
+	   RC.eNB[0][0]->frame_parms.nb_antennas_rx );
     openair0_cfg[card].Mod_id = 0;
 
     openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
@@ -820,29 +706,25 @@ void init_openair0() {
     openair0_cfg[card].clock_source = clock_source;
 
 
-    openair0_cfg[card].tx_num_channels=min(2,((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx));
-    openair0_cfg[card].rx_num_channels=min(2,((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
+    openair0_cfg[card].tx_num_channels=min(2,RC.eNB[0][0]->frame_parms.nb_antennas_tx );
+    openair0_cfg[card].rx_num_channels=min(2,RC.eNB[0][0]->frame_parms.nb_antennas_rx );
 
     for (i=0; i<4; i++) {
 
       if (i<openair0_cfg[card].tx_num_channels)
-	openair0_cfg[card].tx_freq[i] = (UE_flag==0) ? downlink_frequency[0][i] : downlink_frequency[0][i]+uplink_frequency_offset[0][i];
+	openair0_cfg[card].tx_freq[i] = downlink_frequency[0][i] ;
       else
 	openair0_cfg[card].tx_freq[i]=0.0;
 
       if (i<openair0_cfg[card].rx_num_channels)
-	openair0_cfg[card].rx_freq[i] = (UE_flag==0) ? downlink_frequency[0][i] + uplink_frequency_offset[0][i] : downlink_frequency[0][i];
+	openair0_cfg[card].rx_freq[i] =downlink_frequency[0][i] + uplink_frequency_offset[0][i] ;
       else
 	openair0_cfg[card].rx_freq[i]=0.0;
 
       openair0_cfg[card].autocal[i] = 1;
       openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
-      if (UE_flag == 0) {
-	openair0_cfg[card].rx_gain[i] = RC.eNB[0][0]->rx_total_gain_dB;
-      }
-      else {
-	openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off;
-      }
+      openair0_cfg[card].rx_gain[i] = RC.eNB[0][0]->rx_total_gain_dB;
+
 
       openair0_cfg[card].configFilename = rf_config_file;
       printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n",
@@ -851,22 +733,21 @@ void init_openair0() {
 	     openair0_cfg[card].tx_freq[i],
 	     openair0_cfg[card].rx_freq[i]);
     }
-  }
+  } /* for loop on cards */
 }
 
 
 void wait_RUs(void) {
 
-  LOG_I(PHY,"Waiting for RUs to be configured ...\n");
+  LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask);
 
   // wait for all RUs to be configured over fronthaul
   pthread_mutex_lock(&RC.ru_mutex);
-
-
-
   while (RC.ru_mask>0) {
     pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex);
+    printf("RC.ru_mask:%02lx\n", RC.ru_mask);
   }
+  pthread_mutex_unlock(&RC.ru_mutex);
 
   LOG_I(PHY,"RUs configured\n");
 }
@@ -878,19 +759,161 @@ void wait_eNBs(void) {
 
 
   while (waiting==1) {
-    printf("Waiting for eNB L1 instances to all get configured ... sleeping 500ms (nb_L1_inst %d)\n",RC.nb_L1_inst);
-    usleep(500000);
+    printf("Waiting for eNB L1 instances to all get configured ... sleeping 50ms (nb_L1_inst %d)\n",RC.nb_L1_inst);
+    usleep(50*1000);
     waiting=0;
-    for (i=0;i<RC.nb_L1_inst;i++)
-      for (j=0;j<RC.nb_L1_CC[i];j++)
+    for (i=0;i<RC.nb_L1_inst;i++) {
+
+      printf("RC.nb_L1_CC[%d]:%d\n", i, RC.nb_L1_CC[i]);
+
+      for (j=0;j<RC.nb_L1_CC[i];j++) {
 	if (RC.eNB[i][j]->configured==0) {
 	  waiting=1;
 	  break;
-	}
+        } 
+      }
+    }
   }
   printf("eNB L1 are configured\n");
 }
 
+#if defined(ENABLE_ITTI)
+/*
+ * helper function to terminate a certain ITTI task
+ */
+void terminate_task(task_id_t task_id, module_id_t mod_id)
+{
+  LOG_I(ENB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id);
+  MessageDef *msg;
+  msg = itti_alloc_new_message (ENB_APP, TERMINATE_MESSAGE);
+  itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg);
+}
+
+extern void  free_transport(PHY_VARS_eNB *);
+extern void  phy_free_RU(RU_t*);
+
+int stop_L1L2(module_id_t enb_id)
+{
+  LOG_W(ENB_APP, "stopping lte-softmodem\n");
+  oai_exit = 1;
+
+  if (!RC.ru) {
+    LOG_F(ENB_APP, "no RU configured\n");
+    return -1;
+  }
+
+  /* stop trx devices, multiple carrier currently not supported by RU */
+  if (RC.ru[enb_id]) {
+    if (RC.ru[enb_id]->rfdevice.trx_stop_func) {
+      RC.ru[enb_id]->rfdevice.trx_stop_func(&RC.ru[enb_id]->rfdevice);
+      LOG_I(ENB_APP, "turned off RU rfdevice\n");
+    } else {
+      LOG_W(ENB_APP, "can not turn off rfdevice due to missing trx_stop_func callback, proceding anyway!\n");
+    }
+    if (RC.ru[enb_id]->ifdevice.trx_stop_func) {
+      RC.ru[enb_id]->ifdevice.trx_stop_func(&RC.ru[enb_id]->ifdevice);
+      LOG_I(ENB_APP, "turned off RU ifdevice\n");
+    } else {
+      LOG_W(ENB_APP, "can not turn off ifdevice due to missing trx_stop_func callback, proceding anyway!\n");
+    }
+  } else {
+    LOG_W(ENB_APP, "no RU found for index %d\n", enb_id);
+    return -1;
+  }
+
+  /* these tasks need to pick up new configuration */
+  terminate_task(TASK_RRC_ENB, enb_id);
+  terminate_task(TASK_L2L1, enb_id);
+  LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id);
+  kill_eNB_proc(enb_id);
+  LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
+  kill_RU_proc(enb_id);
+  oai_exit = 0;
+  for (int cc_id = 0; cc_id < RC.nb_CC[enb_id]; cc_id++) {
+    free_transport(RC.eNB[enb_id][cc_id]);
+    phy_free_lte_eNB(RC.eNB[enb_id][cc_id]);
+  }
+  phy_free_RU(RC.ru[enb_id]);
+  free_lte_top();
+  return 0;
+}
+
+/*
+ * Restart the lte-softmodem after it has been soft-stopped with stop_L1L2()
+ */
+int restart_L1L2(module_id_t enb_id)
+{
+  RU_t *ru = RC.ru[enb_id];
+  int cc_id;
+  MessageDef *msg_p = NULL;
+
+  LOG_W(ENB_APP, "restarting lte-softmodem\n");
+
+  /* block threads */
+  sync_var = -1;
+
+  for (cc_id = 0; cc_id < RC.nb_L1_CC[enb_id]; cc_id++) {
+    RC.eNB[enb_id][cc_id]->configured = 0;
+  }
+
+  RC.ru_mask |= (1 << ru->idx);
+  /* copy the changed frame parameters to the RU */
+  /* TODO this should be done for all RUs associated to this eNB */
+  memcpy(&ru->frame_parms, &RC.eNB[enb_id][0]->frame_parms, sizeof(LTE_DL_FRAME_PARMS));
+  set_function_spec_param(RC.ru[enb_id]);
+
+  LOG_I(ENB_APP, "attempting to create ITTI tasks\n");
+  if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
+    LOG_E(RRC, "Create task for RRC eNB failed\n");
+    return -1;
+  } else {
+    LOG_I(RRC, "Re-created task for RRC eNB successfully\n");
+  }
+  if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
+    LOG_E(PDCP, "Create task for L2L1 failed\n");
+    return -1;
+  } else {
+    LOG_I(PDCP, "Re-created task for L2L1 successfully\n");
+  }
+
+  /* pass a reconfiguration request which will configure everything down to
+   * RC.eNB[i][j]->frame_parms, too */
+  msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
+  RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
+  itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
+  /* TODO XForms might need to be restarted, but it is currently (09/02/18)
+   * broken, so we cannot test it */
+
+  wait_eNBs();
+  init_RU_proc(ru);
+  ru->rf_map.card = 0;
+  ru->rf_map.chain = 0; /* CC_id + chain_offset;*/
+  wait_RUs();
+  init_eNB_afterRU();
+
+  printf("Sending sync to all threads\n");
+  pthread_mutex_lock(&sync_mutex);
+  sync_var=0;
+  pthread_cond_broadcast(&sync_cond);
+  pthread_mutex_unlock(&sync_mutex);
+
+  return 0;
+}
+#endif
+
+static  void wait_nfapi_init(char *thread_name) {
+
+  printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
+  pthread_mutex_lock( &nfapi_sync_mutex );
+  
+  while (nfapi_sync_var<0)
+    pthread_cond_wait( &nfapi_sync_cond, &nfapi_sync_mutex );
+  
+  pthread_mutex_unlock(&nfapi_sync_mutex);
+  
+  printf( "NFAPI: got sync (%s)\n", thread_name);
+}
+
 int main( int argc, char **argv )
 {
   int i;
@@ -900,9 +923,6 @@ int main( int argc, char **argv )
 
   int CC_id;
   int ru_id;
-  uint8_t  abstraction_flag=0;
-  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
-
 #if defined (XFORMS)
   int ret;
 #endif
@@ -917,8 +937,6 @@ int main( int argc, char **argv )
   setvbuf(stderr, NULL, _IONBF, 0);
 #endif
 
-  PHY_VARS_UE *UE[MAX_NUM_CCs];
-
   mode = normal_txrx;
   memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
 
@@ -926,16 +944,12 @@ int main( int argc, char **argv )
 
   set_latency_target();
 
-
-  // set default parameters
-  if (UE_flag == 1) set_default_frame_parms(frame_parms);
-
   logInit();
 
   printf("Reading in command-line options\n");
 
   get_options (); 
-  if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
+  if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
       fprintf(stderr,"Getting configuration failed\n");
       exit(-1);
   }
@@ -950,32 +964,10 @@ int main( int argc, char **argv )
   //randominit (0);
   set_taus_seed (0);
 
-  if (UE_flag==1) {
-    printf("configuring for UE\n");
-
-    set_comp_log(HW,      LOG_DEBUG,  LOG_HIGH, 1);
-    set_comp_log(PHY,     LOG_DEBUG,   LOG_HIGH, 1);
-    set_comp_log(MAC,     LOG_INFO,   LOG_HIGH, 1);
-    set_comp_log(RLC,     LOG_INFO,   LOG_HIGH | FLAG_THREAD, 1);
-    set_comp_log(PDCP,    LOG_INFO,   LOG_HIGH, 1);
-    set_comp_log(OTG,     LOG_INFO,   LOG_HIGH, 1);
-    set_comp_log(RRC,     LOG_INFO,   LOG_HIGH, 1);
-#if defined(ENABLE_ITTI)
-    set_comp_log(EMU,     LOG_INFO,   LOG_MED, 1);
-# if defined(ENABLE_USE_MME)
-    set_comp_log(NAS,     LOG_INFO,   LOG_HIGH, 1);
-# endif
-#endif
-
-  } else {
-    printf("configuring for RAU/RRU\n");
+  printf("configuring for RAU/RRU\n");
 
-  }
 
   if (ouput_vcd) {
-    if (UE_flag==1)
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_UE.vcd");
-    else
       VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_eNB.vcd");
   }
 
@@ -985,13 +977,9 @@ int main( int argc, char **argv )
   cpuf=get_cpu_freq_GHz();
 
 #if defined(ENABLE_ITTI)
+  log_set_instance_type (LOG_INSTANCE_ENB);
 
-  if (UE_flag == 1) {
-    log_set_instance_type (LOG_INSTANCE_UE);
-  } else {
-    log_set_instance_type (LOG_INSTANCE_ENB);
-  }
-
+  printf("ITTI init\n");
   itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, itti_dump_file);
 
   // initialize mscgen log after ITTI
@@ -1011,6 +999,7 @@ int main( int argc, char **argv )
   }
 
 #ifdef PDCP_USE_NETLINK
+  printf("PDCP netlink\n");
   netlink_init();
 #if defined(PDCP_USE_NETLINK_QUEUES)
   pdcp_netlink_init();
@@ -1032,88 +1021,18 @@ int main( int argc, char **argv )
 
   LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
 
-  // init the parameters
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
 
-    if (UE_flag==1) {
-      frame_parms[CC_id]->nb_antennas_tx     = nb_antenna_tx;
-      frame_parms[CC_id]->nb_antennas_rx     = nb_antenna_rx;
-      frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
-    }
-  }
 
 
+  printf("Before CC \n");
 
-
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+  printf("Runtime table\n");
+  fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
 
 
-    if (UE_flag==1) {     
-      NB_UE_INST=1;     
-      NB_INST=1;     
-      PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE**));     
-      PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_UE*)*MAX_NUM_CCs);
-      
-      
-      
-      PHY_vars_UE_g[0][CC_id] = init_ue_vars(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]);
-      
-      if (phy_test==1)
-	UE[CC_id]->mac_enabled = 0;
-      else 
-	UE[CC_id]->mac_enabled = 1;
-      
-      if (UE[CC_id]->mac_enabled == 0) {  //set default UL parameters for testing mode
-	for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
-	  UE[CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
-	  UE[CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index  = beta_RI;
-	  UE[CC_id]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
-	  
-	  UE[CC_id]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = 0;
-	  UE[CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(0%3);
-	  UE[CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4;
-	}
-      }
-      
-      UE[CC_id]->UE_scan = UE_scan;
-      UE[CC_id]->UE_scan_carrier = UE_scan_carrier;
-      UE[CC_id]->mode    = mode;
-      printf("UE[%d]->mode = %d\n",CC_id,mode);
-      
-      if (UE[CC_id]->mac_enabled == 1) { 
-	UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1234;
-	UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1234;
-      }else {
-	UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1235;
-	UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1235;
-      }
-      UE[CC_id]->rx_total_gain_dB =  (int)rx_gain[CC_id][0] + rx_gain_off;
-      UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id];
-      
-      if (frame_parms[CC_id]->frame_type==FDD) {
-	UE[CC_id]->N_TA_offset = 0;
-      }
-      else {
-	if (frame_parms[CC_id]->N_RB_DL == 100)
-	  UE[CC_id]->N_TA_offset = 624;
-	else if (frame_parms[CC_id]->N_RB_DL == 50)
-	  UE[CC_id]->N_TA_offset = 624/2;
-	else if (frame_parms[CC_id]->N_RB_DL == 25)
-	  UE[CC_id]->N_TA_offset = 624/4;
-      }
-      
-    }
-  }
-
-  fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
-  cpuf=get_cpu_freq_GHz();
-  
-  
-  
 #ifndef DEADLINE_SCHEDULER
   
+  printf("NO deadline scheduler\n");
   /* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
   
   cpu_set_t cpuset;
@@ -1153,17 +1072,13 @@ int main( int argc, char **argv )
   
   
 #if defined(ENABLE_ITTI)
-  
-  
-  if ((UE_flag == 1)||
-      (RC.nb_inst > 0))  {
+  if (RC.nb_inst > 0)  {
     
     // don't create if node doesn't connect to RRC/S1/GTP
-    if (create_tasks(UE_flag ? 0 : 1, UE_flag ? 1 : 0) < 0) {
-      printf("cannot create ITTI tasks\n");
-      exit(-1); // need a softer mode
-    }
-    
+      if (create_tasks(1) < 0) {
+        printf("cannot create ITTI tasks\n");
+        exit(-1); // need a softer mode
+      }
     printf("ITTI tasks created\n");
   }
   else {
@@ -1171,17 +1086,16 @@ int main( int argc, char **argv )
     RCconfig_L1();
   }
 #endif
-  
-  if (phy_test==0) {
-    if (UE_flag==1) {
-      printf("Filling UE band info\n");
-      fill_ue_band_info();
-      dl_phy_sync_success (0, 0, 0, 1);
-    } 
+
+  /* Start the agent. If it is turned off in the configuration, it won't start */
+  RCconfig_flexran();
+  for (i = 0; i < RC.nb_L1_inst; i++) {
+    flexran_agent_start(i);
   }
-  
-  
-  
+
+  // init UE_PF_PO and mutex lock
+  pthread_mutex_init(&ue_pf_po_mutex, NULL);
+  memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs);
   
   mlockall(MCL_CURRENT | MCL_FUTURE);
   
@@ -1191,10 +1105,11 @@ int main( int argc, char **argv )
 #ifdef XFORMS
   int UE_id;
   
+  printf("XFORMS\n");
+
   if (do_forms==1) {
     fl_initialize (&argc, argv, NULL, 0, 0);
     
-    if (UE_flag==0) {
       form_stats_l2 = create_form_stats_form();
       fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats");
       form_stats = create_form_stats_form();
@@ -1215,25 +1130,6 @@ int main( int argc, char **argv )
 	  }
 	} // CC_id
       } // UE_id
-    } else {
-      form_stats = create_form_stats_form();
-      fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
-      UE_id = 0;
-      form_ue[UE_id] = create_lte_phy_scope_ue();
-      sprintf (title, "LTE DL SCOPE UE");
-      fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-      
-      /*
-	if (openair_daq_vars.use_ia_receiver) {
-	fl_set_button(form_ue[UE_id]->button_0,1);
-	fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
-	} else {
-	fl_set_button(form_ue[UE_id]->button_0,0);
-	fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
-	}*/
-      fl_set_button(form_ue[UE_id]->button_0,0);
-      fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
-    }
     
     ret = pthread_create(&forms_thread, NULL, scope_thread, NULL);
     
@@ -1246,32 +1142,52 @@ int main( int argc, char **argv )
 #endif
   
   rt_sleep_ns(10*100000000ULL);
+
+  if (nfapi_mode) {
+
+    printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
+    pthread_cond_init(&sync_cond,NULL);
+    pthread_mutex_init(&sync_mutex, NULL);
+  }
   
-  
-  
+  const char *nfapi_mode_str = "<UNKNOWN>";
+
+  switch(nfapi_mode) {
+    case 0:
+      nfapi_mode_str = "MONOLITHIC";
+      break;
+    case 1:
+      nfapi_mode_str = "PNF";
+      break;
+    case 2:
+      nfapi_mode_str = "VNF";
+      break;
+    default:
+      nfapi_mode_str = "<UNKNOWN NFAPI MODE>";
+      break;
+  }
+  printf("NFAPI MODE:%s\n", nfapi_mode_str);
+
+  if (nfapi_mode==2) // VNF
+    wait_nfapi_init("main?");
+
+  printf("START MAIN THREADS\n");
   
   // start the main threads
-  if (UE_flag == 1) {
-    int eMBMS_active = 0;
-    init_UE(1,eMBMS_active,uecap_xer_in);
-    number_of_cards = 1;
-    
-    for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
-      PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset;
-    }
-  }
-  else { 
+
     number_of_cards = 1;    
+    printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst);
     if (RC.nb_L1_inst > 0) {
-      printf("Initializing eNB threads\n");
+      printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", single_thread_flag,wait_for_sync);
       init_eNB(single_thread_flag,wait_for_sync);
       //      for (inst=0;inst<RC.nb_L1_inst;inst++)
       //	for (CC_id=0;CC_id<RC.nb_L1_CC[inst];CC_id++) phy_init_lte_eNB(RC.eNB[inst][CC_id],0,0);
     }
 
+    printf("wait_eNBs()\n");
     wait_eNBs();
 
+    printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
     if (RC.nb_RU >0) {
       printf("Initializing RU threads\n");
       init_RU(rf_config_file);
@@ -1281,75 +1197,60 @@ int main( int argc, char **argv )
       }
     }
 
+    config_sync_var=0;
+
+    if (nfapi_mode==1) { // PNF
+      wait_nfapi_init("main?");
+    }
+
+    printf("wait RUs\n");
     wait_RUs();
+    printf("ALL RUs READY!\n");
+    printf("RC.nb_RU:%d\n", RC.nb_RU);
     // once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration)
-    init_eNB_afterRU();
-    
-  }
-  
-  
-  // connect the TX/RX buffers
-  if (UE_flag==1) {
-    
-    for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      
-      
-#ifdef OAI_USRP
-      UE[CC_id]->hw_timing_advance = timing_advance;
-#else
-      UE[CC_id]->hw_timing_advance = 160;
-#endif
-    }
-    if (setup_ue_buffers(UE,&openair0_cfg[0])!=0) {
-      printf("Error setting up eNB buffer\n");
-      exit(-1);
+    printf("ALL RUs ready - init eNBs\n");
+
+    if (nfapi_mode != 1 && nfapi_mode != 2)
+    {
+      printf("Not NFAPI mode - call init_eNB_afterRU()\n");
+      init_eNB_afterRU();
     }
-    
-    
-    
-    if (input_fd) {
-      printf("Reading in from file to antenna buffer %d\n",0);
-      if (fread(UE[0]->common_vars.rxdata[0],
-		sizeof(int32_t),
-		frame_parms[0]->samples_per_tti*10,
-		input_fd) != frame_parms[0]->samples_per_tti*10)
-	printf("error reading from file\n");
+    else
+    {
+      printf("NFAPI mode - DO NOT call init_eNB_afterRU()\n");
     }
-    //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
-  } else {
     
-    
-    
-    
-    
-  }
-  
+    printf("ALL RUs ready - ALL eNBs ready\n");
   
   
+  // connect the TX/RX buffers
+ 
   
   printf("Sending sync to all threads\n");
   
-  
-  
   pthread_mutex_lock(&sync_mutex);
   sync_var=0;
   pthread_cond_broadcast(&sync_cond);
   pthread_mutex_unlock(&sync_mutex);
+  printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
   end_configmodule();
+  printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
 
   // wait for end of program
   printf("TYPE <CTRL-C> TO TERMINATE\n");
   //getchar();
 
-
 #if defined(ENABLE_ITTI)
   printf("Entering ITTI signals handler\n");
   itti_wait_tasks_end();
+  printf("Returned from ITTI signal handler\n");
   oai_exit=1;
+  printf("oai_exit=%d\n",oai_exit);
 #else
 
   while (oai_exit==0)
     rt_sleep_ns(100000000ULL);
+  printf("Terminating application - oai_exit=%d\n",oai_exit);
 
 #endif
 
@@ -1362,10 +1263,6 @@ int main( int argc, char **argv )
     fl_hide_form(form_stats->stats_form);
     fl_free_form(form_stats->stats_form);
 
-    if (UE_flag==1) {
-      fl_hide_form(form_ue[0]->lte_phy_scope_ue);
-      fl_free_form(form_ue[0]->lte_phy_scope_ue);
-    } else {
       fl_hide_form(form_stats_l2->stats_form);
       fl_free_form(form_stats_l2->stats_form);
 
@@ -1375,7 +1272,6 @@ int main( int argc, char **argv )
 	  fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb);
 	}
       }
-    }
   }
 
 #endif
@@ -1383,23 +1279,32 @@ int main( int argc, char **argv )
   printf("stopping MODEM threads\n");
 
   // cleanup
-  if (UE_flag == 1) {
-  } else {
-    stop_eNB(1);
-  }
+    stop_eNB(NB_eNB_INST);
+    stop_RU(NB_RU);
+    /* release memory used by the RU/eNB threads (incomplete), after all
+     * threads have been stopped (they partially use the same memory) */
+    for (int inst = 0; inst < NB_eNB_INST; inst++) {
+      for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
+        free_transport(RC.eNB[inst][cc_id]);
+        phy_free_lte_eNB(RC.eNB[inst][cc_id]);
+      }
+    }
+    for (int inst = 0; inst < NB_RU; inst++) {
+      phy_free_RU(RC.ru[inst]);
+    }
+    free_lte_top();
 
 
   pthread_cond_destroy(&sync_cond);
   pthread_mutex_destroy(&sync_mutex);
 
+  pthread_cond_destroy(&nfapi_sync_cond);
+  pthread_mutex_destroy(&nfapi_sync_mutex);
 
+  pthread_mutex_destroy(&ue_pf_po_mutex);
 
   // *** Handle per CC_id openair0
-  if (UE_flag==1) {
-    if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func)
-      PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
-  }
-  else {
+
     for(ru_id=0; ru_id<NB_RU; ru_id++) {
       if (RC.ru[ru_id]->rfdevice.trx_end_func)
 	RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);  
@@ -1407,7 +1312,6 @@ int main( int argc, char **argv )
 	RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);  
 
     }
-  }
   if (ouput_vcd)
     VCD_SIGNAL_DUMPER_CLOSE();
   
@@ -1415,6 +1319,8 @@ int main( int argc, char **argv )
     terminate_opt();
   
   logClean();
+
+  printf("Bye.\n");
   
   return 0;
 }
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 4027d24d5762f99d82fba0730bf7579825b6c3c7..aff969908f2d738114afe6bfef26fb8e588c5498 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -31,6 +31,8 @@
 #include "PHY/defs.h"
 #include "SIMULATION/ETH_TRANSPORT/proto.h"
 
+#include "flexran_agent.h"
+
 #if defined(ENABLE_ITTI)
 #if defined(ENABLE_USE_MME)
 #include "s1ap_eNB.h"
@@ -65,7 +67,7 @@
 #define CONFIG_HLP_NOSNGLT       "Disables single-thread mode in lte-softmodem\n" 
 #define CONFIG_HLP_TADV          "Set timing_advance\n"
 #define CONFIG_HLP_DLF           "Set the downlink frequency for all component carriers\n"
-#define CONFIG_HLP_CHOFF         "Channel id offset"
+#define CONFIG_HLP_CHOFF         "Channel id offset\n"
 #define CONFIG_HLP_SOFTS         "Enable soft scope and L1 and L2 stats (Xforms)\n"
 #define CONFIG_HLP_EXMCAL        "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
 #define CONFIG_HLP_ITTIL         "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
@@ -83,11 +85,13 @@
 #define CONFIG_HLP_TPORT         "tracer port\n"
 #define CONFIG_HLP_NOTWAIT       "don't wait for tracer, start immediately\n"
 #define CONFIG_HLP_TNOFORK       "to ease debugging with gdb\n"
+
 #define CONFIG_HLP_NUMEROLOGY    "adding numerology for 5G\n"
 #define CONFIG_HLP_CODINGW       "coding worker thread enable(disable by defult)\n"
 #define CONFIG_HLP_FEPW          "FEP worker thread enabled(disable by defult)\n"
 #define CONFIG_HLP_EMULATE_RF    "Emulated RF enabled(disable by defult)\n"
 
+#define CONFIG_HLP_DISABLNBIOT   "disable nb-iot, even if defined in config\n"
 
 /***************************************************************************************************************************************/
 /* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument 
@@ -131,10 +135,10 @@
 {"ue-nb-ant-tx",     	       CONFIG_HLP_UENANTT,    0,		u8ptr:&nb_antenna_tx,		    defuintval:1,   TYPE_UINT8,    0},     \
 {"ue-scan-carrier",  	       CONFIG_HLP_UESCAN,     PARAMFLAG_BOOL,	iptr:&UE_scan_carrier,  	    defintval:0,    TYPE_INT,	   0},     \
 {"ue-max-power",     	       NULL,		      0,		iptr:&(tx_max_power[0]),	    defintval:90,   TYPE_INT,	   0},     \
-{"r"  ,                        CONFIG_HLP_PRB,        0,                u8ptr:&(frame_parms[0]->N_RB_DL),   defintval:0,    TYPE_UINT8,    0},     \
+{"r"  ,                        CONFIG_HLP_PRB,        0,                u8ptr:&(frame_parms[0]->N_RB_DL),   defintval:25,   TYPE_UINT8,    0},     \
 }
 
-
+#define DEFAULT_DLF 2680000000
 extern int16_t dlsch_demod_shift;
 /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 /*                                            command line parameters common to eNodeB and UE                                                                                */
@@ -162,7 +166,6 @@ extern int16_t dlsch_demod_shift;
 {"d" ,                      CONFIG_HLP_SOFTS,       PARAMFLAG_BOOL,         uptr:(uint32_t *)&do_forms,         defintval:0,                    TYPE_INT8,      0},                     \
 {"E" ,                      CONFIG_HLP_TQFS,        PARAMFLAG_BOOL,         i8ptr:&threequarter_fs,             defintval:0,                    TYPE_INT8,      0},                     \
 {"K" ,                      CONFIG_HLP_ITTIL,       PARAMFLAG_NOFREE,       strptr:&itti_dump_file,             defstrval:"/tmp/itti.dump",     TYPE_STRING,    0},                     \
-{"U" ,                      CONFIG_HLP_UE,          PARAMFLAG_BOOL,         i8ptr:&UE_flag,                     defintval:0,                    TYPE_INT8,      0},                     \
 {"m" ,                      CONFIG_HLP_DLMCS,       0,                      uptr:&target_dl_mcs,                defintval:0,                    TYPE_UINT,      0},                     \
 {"t" ,                      CONFIG_HLP_ULMCS,       0,                      uptr:&target_ul_mcs,                defintval:0,                    TYPE_UINT,      0},                     \
 {"W" ,                      CONFIG_HLP_L2MONW,      0,                      strptr:(char **)&in_ip,             defstrval:"127.0.0.1",          TYPE_STRING,    sizeof(in_ip)},         \
@@ -174,7 +177,8 @@ extern int16_t dlsch_demod_shift;
 {"numerology" ,             CONFIG_HLP_NUMEROLOGY,  PARAMFLAG_BOOL,         iptr:&numerology,                   defintval:0,                    TYPE_INT,       0},                     \
 {"emulate-rf" ,             CONFIG_HLP_EMULATE_RF,  PARAMFLAG_BOOL,         iptr:&emulate_rf,                   defintval:0,                    TYPE_INT,       0},                     \
 {"codingw" ,                CONFIG_HLP_CODINGW,     PARAMFLAG_BOOL,         iptr:&codingw,                      defintval:0,                    TYPE_INT,       0},                     \
-{"fepw" ,                   CONFIG_HLP_FEPW,        PARAMFLAG_BOOL,         iptr:&fepw,                         defintval:0,                    TYPE_INT,       0}                      \
+{"fepw" ,                   CONFIG_HLP_FEPW,        PARAMFLAG_BOOL,         iptr:&fepw,                         defintval:0,                    TYPE_INT,       0},                     \
+{"nbiot-disable",        	 CONFIG_HLP_DISABLNBIOT,PARAMFLAG_BOOL,   iptr:&nonbiotflag,			defintval:0,			   TYPE_INT,	  0}                       \
 }
 
 #define CONFIG_HLP_FLOG          "Enable online log \n"
@@ -206,9 +210,9 @@ extern int T_dont_fork;
 /*   optname                     helpstr                paramflags           XXXptr           defXXXval         type       numelt           */
 /*------------------------------------------------------------------------------------------------------------------------------------------*/
 #define CMDLINE_TTRACEPARAMS_DESC {  \
-{"T_port",                     CONFIG_HLP_TPORT,      0,		uptr:&T_port,	     defuintval:0,	TYPE_UINT,   0},	   \
-{"T_nowait",                   CONFIG_HLP_NOTWAIT,    PARAMFLAG_BOOL,	uptr:&T_nowait,      defuintval:0,	TYPE_UINT,   0},	   \
-{"T_dont_fork",                CONFIG_HLP_TNOFORK,    PARAMFLAG_BOOL,	uptr:&T_dont_fork,   defuintval:1,	TYPE_UINT,   0},	   \
+{"T_port",                     CONFIG_HLP_TPORT,      0,		iptr:&T_port,	     defintval:0,	TYPE_INT,   0},	   \
+{"T_nowait",                   CONFIG_HLP_NOTWAIT,    PARAMFLAG_BOOL,	iptr:&T_nowait,      defintval:0,	TYPE_INT,   0},	   \
+{"T_dont_fork",                CONFIG_HLP_TNOFORK,    PARAMFLAG_BOOL,	iptr:&T_dont_fork,   defintval:1,	TYPE_INT,   0},	   \
 } 
 
 
@@ -252,12 +256,16 @@ extern void kill_eNB_proc(int inst);
 
 // In lte-ru.c
 extern void init_RU(const char*);
+extern void init_RU_proc(RU_t *ru);
+extern void stop_RU(int nb_ru);
+extern void kill_RU_proc(int inst);
+extern void set_function_spec_param(RU_t *ru);
 
 // In lte-ue.c
 extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
 extern void fill_ue_band_info(void);
 
-extern void init_UE(int,int,int);
+extern void init_UE(int,int,int,int);
 extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char * name);
 
 extern void reset_opp_meas(void);
@@ -269,4 +277,12 @@ extern void init_te_thread(PHY_VARS_eNB *);
 extern void kill_td_thread(PHY_VARS_eNB *);
 extern void kill_te_thread(PHY_VARS_eNB *);
 
+PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
+                          uint8_t UE_id,
+                          uint8_t abstraction_flag);
+void init_eNB_afterRU(void);
+
+extern int stop_L1L2(module_id_t enb_id);
+extern int restart_L1L2(module_id_t enb_id);
+
 #endif
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index eb0b112b9bf13ee866abbf2a30226ed2661e100f..2c83ea9a04e22671ba45fd6ced7b1ddbbc0656fe 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -70,7 +70,7 @@ typedef enum {
 
 void init_UE_threads(int);
 void *UE_thread(void *arg);
-void init_UE(int nb_inst,int,int);
+void init_UE(int nb_inst,int,int,int);
 
 int32_t **rxdata;
 int32_t **txdata;
@@ -202,7 +202,7 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_
 
 }
 
-void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) {
+void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction) {
 
   PHY_VARS_UE *UE;
   int         inst;
@@ -218,6 +218,8 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) {
 
     LOG_I(PHY,"Initializing memory for UE instance %d (%p)\n",inst,PHY_vars_UE_g[inst]);
     PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
+    // turn off timing control loop in UE
+    PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction;
 
     LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
     init_UE_threads(inst);
@@ -303,6 +305,7 @@ static void *UE_thread_synch(void *arg)
     } while (ind < sizeof(eutra_bands) / sizeof(eutra_bands[0]));
   
     if (found == 0) {
+      LOG_E(PHY,"Can't find EUTRA band for frequency %d",UE->frame_parms.dl_CarrierFreq);
       exit_fun("Can't find EUTRA band for frequency");
       return &UE_thread_synch_retval;
     }
@@ -851,14 +854,19 @@ void *UE_thread(void *arg) {
                         writeBlockSize=UE->frame_parms.samples_per_tti;
                     } else {
                         // set TO compensation to zero
+
                         UE->rx_offset_diff = 0;
+
                         // compute TO compensation that should be applied for this frame
-                        if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti  &&
-                                UE->rx_offset > 0 )
+
+			if (UE->no_timing_correction == 0) {
+			  if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti  &&
+			       UE->rx_offset > 0 )
                             UE->rx_offset_diff = -1 ;
-                        if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti &&
-                                UE->rx_offset < 10*UE->frame_parms.samples_per_tti )
+			  if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti &&
+			       UE->rx_offset < 10*UE->frame_parms.samples_per_tti )
                             UE->rx_offset_diff = 1;
+			}
 
                         LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset);
                         readBlockSize=UE->frame_parms.samples_per_tti -
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
new file mode 100644
index 0000000000000000000000000000000000000000..ae4798f399231040178b47a6b11f5b1a0aec8ae5
--- /dev/null
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -0,0 +1,1139 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file lte-enb.c
+ * \brief Top-level threads for eNodeB
+ * \author R. Knopp, F. Kaltenberger, Navid Nikaein
+ * \date 2012
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
+ * \note
+ * \warning
+ */
+
+
+#define _GNU_SOURCE             /* See feature_test_macros(7) */
+#include <sched.h>
+
+
+#include "T.h"
+
+#include "rt_wrapper.h"
+
+
+#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
+
+#include "assertions.h"
+#include "msc.h"
+
+#include "PHY/types.h"
+
+#include "PHY/defs.h"
+#include "common/ran_context.h"
+#include "common/config/config_userapi.h"
+#include "common/utils/load_module_shlib.h"
+#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
+//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
+
+#include "../../ARCH/COMMON/common_lib.h"
+#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
+
+//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
+
+#include "PHY/vars.h"
+#include "SCHED/vars.h"
+#include "LAYER2/MAC/vars.h"
+
+#include "../../SIMU/USER/init_lte.h"
+
+#include "LAYER2/MAC/defs.h"
+#include "LAYER2/MAC/vars.h"
+#include "LAYER2/MAC/proto.h"
+#include "RRC/LITE/vars.h"
+#include "PHY_INTERFACE/vars.h"
+
+#ifdef SMBV
+#include "PHY/TOOLS/smbv.h"
+unsigned short config_frames[4] = {2,9,11,13};
+#endif
+#include "UTIL/LOG/log_extern.h"
+#include "UTIL/OTG/otg_tx.h"
+#include "UTIL/OTG/otg_externs.h"
+#include "UTIL/MATH/oml.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
+#include "UTIL/OPT/opt.h"
+#include "enb_config.h"
+//#include "PHY/TOOLS/time_meas.h"
+
+#ifndef OPENAIR2
+#include "UTIL/OTG/otg_vars.h"
+#endif
+
+#if defined(ENABLE_ITTI)
+#include "intertask_interface_init.h"
+#include "create_tasks.h"
+#endif
+
+#include "system.h"
+
+#ifdef XFORMS
+#include "PHY/TOOLS/lte_phy_scope.h"
+#include "stats.h"
+#endif
+#include "lte-softmodem.h"
+
+/* temporary compilation wokaround (UE/eNB split */
+uint16_t sf_ahead;
+#ifdef XFORMS
+// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
+// at eNB 0, an UL scope for every UE
+FD_lte_phy_scope_ue  *form_ue[NUMBER_OF_UE_MAX];
+FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+FD_stats_form                  *form_stats=NULL,*form_stats_l2=NULL;
+char title[255];
+unsigned char                   scope_enb_num_ue = 2;
+static pthread_t                forms_thread; //xforms
+#endif //XFORMS
+
+pthread_cond_t sync_cond;
+pthread_mutex_t sync_mutex;
+int sync_var=-1; //!< protected by mutex \ref sync_mutex.
+int config_sync_var=-1;
+
+uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
+uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
+
+#if defined(ENABLE_ITTI)
+volatile int             start_eNB = 0;
+volatile int             start_UE = 0;
+#endif
+volatile int             oai_exit = 0;
+
+static clock_source_t clock_source = internal;
+static int wait_for_sync = 0;
+
+unsigned int                    mmapped_dma=0;
+int                             single_thread_flag=1;
+
+static int8_t                     threequarter_fs=0;
+
+uint32_t                 downlink_frequency[MAX_NUM_CCs][4];
+int32_t                  uplink_frequency_offset[MAX_NUM_CCs][4];
+
+
+
+#if defined(ENABLE_ITTI)
+static char                    *itti_dump_file = NULL;
+#endif
+
+int UE_scan = 1;
+int UE_scan_carrier = 0;
+runmode_t mode = normal_txrx;
+
+FILE *input_fd=NULL;
+
+
+#if MAX_NUM_CCs == 1
+rx_gain_t                rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
+double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0}};
+double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0}};
+#else
+rx_gain_t                rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain},{max_gain,max_gain,max_gain,max_gain}};
+double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0},{20,0,0,0}};
+double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}};
+#endif
+
+double rx_gain_off = 0.0;
+
+double sample_rate=30.72e6;
+double bw = 10.0e6;
+
+static int                      tx_max_power[MAX_NUM_CCs]; /* =  {0,0}*/;
+
+char   rf_config_file[1024];
+
+int chain_offset=0;
+int phy_test = 0;
+uint8_t usim_test = 0;
+
+uint8_t dci_Format = 0;
+uint8_t agregation_Level =0xFF;
+
+uint8_t nb_antenna_tx = 1;
+uint8_t nb_antenna_rx = 1;
+
+char ref[128] = "internal";
+char channels[128] = "0";
+
+int                      rx_input_level_dBm;
+
+#ifdef XFORMS
+extern int                      otg_enabled;
+static char                     do_forms=0;
+#else
+int                             otg_enabled;
+#endif
+//int                             number_of_cards =   1;
+
+
+static LTE_DL_FRAME_PARMS      *frame_parms[MAX_NUM_CCs];
+uint32_t target_dl_mcs = 28; //maximum allowed mcs
+uint32_t target_ul_mcs = 20;
+uint32_t timing_advance = 0;
+uint8_t exit_missed_slots=1;
+uint64_t num_missed_slots=0; // counter for the number of missed slots
+
+
+extern void reset_opp_meas(void);
+extern void print_opp_meas(void);
+
+extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
+			  uint8_t UE_id,
+			  uint8_t abstraction_flag);
+
+
+int transmission_mode=1;
+
+
+
+/* struct for ethernet specific parameters given in eNB conf file */
+eth_params_t *eth_params;
+
+openair0_config_t openair0_cfg[MAX_CARDS];
+
+double cpuf;
+
+extern char uecap_xer[1024];
+char uecap_xer_in=0;
+
+int oaisim_flag=0;
+threads_t threads= {-1,-1,-1,-1,-1,-1,-1};
+
+/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
+ * this is very hackish - find a proper solution
+ */
+uint8_t abstraction_flag=0;
+
+/* forward declarations */
+void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
+
+/*---------------------BMC: timespec helpers -----------------------------*/
+
+struct timespec min_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
+struct timespec max_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
+
+struct timespec clock_difftime(struct timespec start, struct timespec end) {
+  struct timespec temp;
+  if ((end.tv_nsec-start.tv_nsec)<0) {
+    temp.tv_sec = end.tv_sec-start.tv_sec-1;
+    temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
+  } else {
+    temp.tv_sec = end.tv_sec-start.tv_sec;
+    temp.tv_nsec = end.tv_nsec-start.tv_nsec;
+  }
+  return temp;
+}
+
+void print_difftimes(void) {
+#ifdef DEBUG
+  printf("difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
+#else
+  LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
+#endif
+}
+
+void update_difftimes(struct timespec start, struct timespec end) {
+  struct timespec diff_time = { .tv_sec = 0, .tv_nsec = 0 };
+  int             changed = 0;
+  diff_time = clock_difftime(start, end);
+  if ((min_diff_time.tv_nsec == 0) || (diff_time.tv_nsec < min_diff_time.tv_nsec)) {
+    min_diff_time.tv_nsec = diff_time.tv_nsec;
+    changed = 1;
+  }
+  if ((max_diff_time.tv_nsec == 0) || (diff_time.tv_nsec > max_diff_time.tv_nsec)) {
+    max_diff_time.tv_nsec = diff_time.tv_nsec;
+    changed = 1;
+  }
+#if 1
+  if (changed) print_difftimes();
+#endif
+}
+
+/*------------------------------------------------------------------------*/
+
+unsigned int build_rflocal(int txi, int txq, int rxi, int rxq) {
+  return (txi + (txq<<6) + (rxi<<12) + (rxq<<18));
+}
+unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) {
+  return (dcoff_i_rxfe + (dcoff_q_rxfe<<8));
+}
+
+#if !defined(ENABLE_ITTI)
+void signal_handler(int sig) {
+  void *array[10];
+  size_t size;
+
+  if (sig==SIGSEGV) {
+    // get void*'s for all entries on the stack
+    size = backtrace(array, 10);
+
+    // print out all the frames to stderr
+    fprintf(stderr, "Error: signal %d:\n", sig);
+    backtrace_symbols_fd(array, size, 2);
+    exit(-1);
+  } else {
+    printf("trying to exit gracefully...\n");
+    oai_exit = 1;
+  }
+}
+#endif
+#define KNRM  "\x1B[0m"
+#define KRED  "\x1B[31m"
+#define KGRN  "\x1B[32m"
+#define KBLU  "\x1B[34m"
+#define RESET "\033[0m"
+
+
+
+void exit_fun(const char* s)
+{
+  int CC_id;
+
+  if (s != NULL) {
+    printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
+  }
+
+  oai_exit = 1;
+
+  for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+	if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func)
+	  PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
+    }
+
+#if defined(ENABLE_ITTI)
+    sleep(1); //allow lte-softmodem threads to exit first
+    itti_terminate_tasks (TASK_UNKNOWN);
+#endif
+}
+
+#ifdef XFORMS
+
+
+void reset_stats(FL_OBJECT *button, long arg)
+{
+  int i,j,k;
+  PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0];
+
+  for (i=0; i<NUMBER_OF_UE_MAX; i++) {
+    for (k=0; k<8; k++) { //harq_processes
+      for (j=0; j<phy_vars_eNB->dlsch[i][0]->Mlimit; j++) {
+	phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0;
+	phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0;
+	phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0;
+      }
+
+      phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0;
+      phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0;
+      phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0;
+
+
+      phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0;
+      phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0;
+      phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0;
+    }
+  }
+}
+
+static void *scope_thread(void *arg) {
+  char stats_buffer[16384];
+# ifdef ENABLE_XFORMS_WRITE_STATS
+  FILE *UE_stats, *eNB_stats;
+# endif
+  struct sched_param sched_param;
+
+
+  sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
+  sched_setscheduler(0, SCHED_FIFO,&sched_param);
+
+  printf("Scope thread has priority %d\n",sched_param.sched_priority);
+
+# ifdef ENABLE_XFORMS_WRITE_STATS
+
+  UE_stats  = fopen("UE_stats.txt", "w");
+
+#endif
+
+  while (!oai_exit) {
+      dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
+      //fl_set_object_label(form_stats->stats_text, stats_buffer);
+      fl_clear_browser(form_stats->stats_text);
+      fl_add_browser_line(form_stats->stats_text, stats_buffer);
+
+      phy_scope_UE(form_ue[0],
+		   PHY_vars_UE_g[0][0],
+		   0,
+		   0,7);
+
+  //  printf("%s",stats_buffer);
+    }
+# ifdef ENABLE_XFORMS_WRITE_STATS
+
+    if (UE_stats) {
+      rewind (UE_stats);
+      fwrite (stats_buffer, 1, len, UE_stats);
+      fclose (UE_stats);
+    }
+
+# endif
+  
+  pthread_exit((void*)arg);
+}
+#endif
+
+
+
+#if defined(ENABLE_ITTI)
+void *l2l1_task(void *arg) {
+  MessageDef *message_p = NULL;
+  int         result;
+
+  itti_set_task_real_time(TASK_L2L1);
+  itti_mark_task_ready(TASK_L2L1);
+
+
+  do {
+    // Wait for a message
+    itti_receive_msg (TASK_L2L1, &message_p);
+
+    switch (ITTI_MSG_ID(message_p)) {
+    case TERMINATE_MESSAGE:
+      oai_exit=1;
+      itti_exit_task ();
+      break;
+
+    case ACTIVATE_MESSAGE:
+      start_UE = 1;
+      break;
+
+    case DEACTIVATE_MESSAGE:
+      start_UE = 0;
+      break;
+
+    case MESSAGE_TEST:
+      LOG_I(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
+      break;
+
+    default:
+      LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
+      break;
+    }
+
+    result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
+    AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+  } while(!oai_exit);
+
+  return NULL;
+}
+#endif
+
+
+static void get_options(void) {
+  int CC_id;
+  int tddflag, nonbiotflag;
+  char *loopfile=NULL;
+  int dumpframe;
+  uint32_t online_log_messages;
+  uint32_t glog_level, glog_verbosity;
+  uint32_t start_telnetsrv;
+
+  paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
+  paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
+
+  set_default_frame_parms(frame_parms);
+  config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); 
+
+  if (strlen(in_path) > 0) {
+      opt_type = OPT_PCAP;
+      opt_enabled=1;
+      printf("Enabling OPT for PCAP  with the following file %s \n",in_path);
+  }
+  if (strlen(in_ip) > 0) {
+      opt_enabled=1;
+      opt_type = OPT_WIRESHARK;
+      printf("Enabling OPT for wireshark for local interface");
+  }
+
+  config_process_cmdline( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
+  if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
+      set_glog_onlinelog(online_log_messages);
+  }
+  if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
+      set_glog(glog_level, -1);
+  }
+  if(config_isparamset(cmdline_logparams,CMDLINE_GLOGVERBO_IDX)) {
+      set_glog(-1, glog_verbosity);
+  }
+  if (start_telnetsrv) {
+     load_module_shlib("telnetsrv",NULL,0);
+  }
+
+  paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
+  paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
+
+
+  config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
+  config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
+  if (loopfile != NULL) {
+      printf("Input file for hardware emulation: %s",loopfile);
+      mode=loop_through_memory;
+      input_fd = fopen(loopfile,"r");
+      AssertFatal(input_fd != NULL,"Please provide a valid input file\n");
+  }
+
+  if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;
+  if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med;
+  if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp;
+  if (cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr)
+      if ( *(cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) > 0) mode = debug_prach;
+  if (cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr)
+      if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0)  mode = no_L2_connect;
+  if (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) 
+      if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx; 
+  if (dumpframe  > 0)  mode = rx_dump_frame;
+  
+  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+    frame_parms[CC_id]->dl_CarrierFreq = downlink_frequency[0][0];
+  }
+  UE_scan=0;
+   
+
+  if (tddflag > 0) {
+     for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) 
+    	 frame_parms[CC_id]->frame_type = TDD;
+  }
+
+  if (frame_parms[0]->N_RB_DL !=0) {
+      if ( frame_parms[0]->N_RB_DL < 6 ) {
+    	 frame_parms[0]->N_RB_DL = 6;
+    	 printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",frame_parms[0]->N_RB_DL);
+      }
+      if ( frame_parms[0]->N_RB_DL > 100 ) {
+    	 frame_parms[0]->N_RB_DL = 100;
+    	 printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",frame_parms[0]->N_RB_DL);
+      }
+      if ( frame_parms[0]->N_RB_DL > 50 && frame_parms[0]->N_RB_DL < 100 ) {
+    	 frame_parms[0]->N_RB_DL = 50;
+    	 printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",frame_parms[0]->N_RB_DL);
+      }
+      if ( frame_parms[0]->N_RB_DL > 25 && frame_parms[0]->N_RB_DL < 50 ) {
+    	 frame_parms[0]->N_RB_DL = 25;
+    	 printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",frame_parms[0]->N_RB_DL);
+      }
+      UE_scan = 0;
+      frame_parms[0]->N_RB_UL=frame_parms[0]->N_RB_DL;
+      for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
+    	  frame_parms[CC_id]->N_RB_DL=frame_parms[0]->N_RB_DL;
+    	  frame_parms[CC_id]->N_RB_UL=frame_parms[0]->N_RB_UL;
+      }
+  }
+
+
+  for (CC_id=1;CC_id<MAX_NUM_CCs;CC_id++) {
+    	tx_max_power[CC_id]=tx_max_power[0];
+    	rx_gain[0][CC_id] = rx_gain[0][0];
+    	tx_gain[0][CC_id] = tx_gain[0][0];
+  }
+
+#if T_TRACER
+  paramdef_t cmdline_ttraceparams[] =CMDLINE_TTRACEPARAMS_DESC ;
+  config_process_cmdline( cmdline_ttraceparams,sizeof(cmdline_ttraceparams)/sizeof(paramdef_t),NULL);   
+#endif
+
+  if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT))  && (!(CONFIG_ISFLAGSET(CONFIG_NOOOPT))) ) {
+    // Here the configuration file is the XER encoded UE capabilities
+    // Read it in and store in asn1c data structures
+    sprintf(uecap_xer,"%stargets/PROJECTS/GENERIC-LTE-EPC/CONF/UE_config.xml",getenv("OPENAIR_HOME"));
+    printf("%s\n",uecap_xer);
+    uecap_xer_in=1;
+  } /* UE with config file  */
+}
+
+
+#if T_TRACER
+int T_nowait = 0;     /* by default we wait for the tracer */
+int T_port = 2021;    /* default port to listen to to wait for the tracer */
+int T_dont_fork = 0;  /* default is to fork, see 'T_init' to understand */
+#endif
+
+
+
+void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
+
+  int CC_id;
+
+  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+    frame_parms[CC_id] = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
+    /* Set some default values that may be overwritten while reading options */
+    frame_parms[CC_id]->frame_type          = FDD;
+    frame_parms[CC_id]->tdd_config          = 3;
+    frame_parms[CC_id]->tdd_config_S        = 0;
+    frame_parms[CC_id]->N_RB_DL             = 100;
+    frame_parms[CC_id]->N_RB_UL             = 100;
+    frame_parms[CC_id]->Ncp                 = NORMAL;
+    frame_parms[CC_id]->Ncp_UL              = NORMAL;
+    frame_parms[CC_id]->Nid_cell            = 0;
+    frame_parms[CC_id]->num_MBSFN_config    = 0;
+    frame_parms[CC_id]->nb_antenna_ports_eNB  = 1;
+    frame_parms[CC_id]->nb_antennas_tx      = 1;
+    frame_parms[CC_id]->nb_antennas_rx      = 1;
+
+    frame_parms[CC_id]->nushift             = 0;
+
+    frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth;
+    frame_parms[CC_id]->phich_config_common.phich_duration = normal;
+    // UL RS Config
+    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
+    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 0;
+    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
+    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
+
+    frame_parms[CC_id]->prach_config_common.rootSequenceIndex=22;
+    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=1;
+    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0;
+    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0;
+    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
+
+    downlink_frequency[CC_id][0] = DEFAULT_DLF; // Use float to avoid issue with frequency over 2^31.
+    downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
+    downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
+    downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
+
+    frame_parms[CC_id]->dl_CarrierFreq=downlink_frequency[CC_id][0];
+
+  }
+
+}
+
+void init_openair0(void) {
+
+  int card;
+  int i;
+
+  for (card=0; card<MAX_CARDS; card++) {
+
+    openair0_cfg[card].mmapped_dma=mmapped_dma;
+    openair0_cfg[card].configFilename = NULL;
+
+    if(frame_parms[0]->N_RB_DL == 100) {
+      if (frame_parms[0]->threequarter_fs) {
+	openair0_cfg[card].sample_rate=23.04e6;
+	openair0_cfg[card].samples_per_frame = 230400;
+	openair0_cfg[card].tx_bw = 10e6;
+	openair0_cfg[card].rx_bw = 10e6;
+      } else {
+	openair0_cfg[card].sample_rate=30.72e6;
+	openair0_cfg[card].samples_per_frame = 307200;
+	openair0_cfg[card].tx_bw = 10e6;
+	openair0_cfg[card].rx_bw = 10e6;
+      }
+    } else if(frame_parms[0]->N_RB_DL == 50) {
+      openair0_cfg[card].sample_rate=15.36e6;
+      openair0_cfg[card].samples_per_frame = 153600;
+      openair0_cfg[card].tx_bw = 5e6;
+      openair0_cfg[card].rx_bw = 5e6;
+    } else if (frame_parms[0]->N_RB_DL == 25) {
+      openair0_cfg[card].sample_rate=7.68e6;
+      openair0_cfg[card].samples_per_frame = 76800;
+      openair0_cfg[card].tx_bw = 2.5e6;
+      openair0_cfg[card].rx_bw = 2.5e6;
+    } else if (frame_parms[0]->N_RB_DL == 6) {
+      openair0_cfg[card].sample_rate=1.92e6;
+      openair0_cfg[card].samples_per_frame = 19200;
+      openair0_cfg[card].tx_bw = 1.5e6;
+      openair0_cfg[card].rx_bw = 1.5e6;
+    }
+
+
+
+
+    if (frame_parms[0]->frame_type==TDD)
+      openair0_cfg[card].duplex_mode = duplex_mode_TDD;
+    else //FDD
+      openair0_cfg[card].duplex_mode = duplex_mode_FDD;
+
+    printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
+	   PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx,
+	   PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx);
+    openair0_cfg[card].Mod_id = 0;
+
+    openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
+
+    openair0_cfg[card].clock_source = clock_source;
+
+
+    openair0_cfg[card].tx_num_channels=min(2,PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx);
+    openair0_cfg[card].rx_num_channels=min(2,PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx);
+
+    for (i=0; i<4; i++) {
+
+      if (i<openair0_cfg[card].tx_num_channels)
+	openair0_cfg[card].tx_freq[i] = downlink_frequency[0][i]+uplink_frequency_offset[0][i];
+      else
+	openair0_cfg[card].tx_freq[i]=0.0;
+
+      if (i<openair0_cfg[card].rx_num_channels)
+	openair0_cfg[card].rx_freq[i] = downlink_frequency[0][i];
+      else
+	openair0_cfg[card].rx_freq[i]=0.0;
+
+      openair0_cfg[card].autocal[i] = 1;
+      openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
+      openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off;
+     
+
+      openair0_cfg[card].configFilename = rf_config_file;
+      printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n",
+	     card,i, openair0_cfg[card].tx_gain[i],
+	     openair0_cfg[card].rx_gain[i],
+	     openair0_cfg[card].tx_freq[i],
+	     openair0_cfg[card].rx_freq[i]);
+    }
+  }
+}
+
+
+
+
+#if defined(ENABLE_ITTI)
+/*
+ * helper function to terminate a certain ITTI task
+ */
+void terminate_task(task_id_t task_id, module_id_t mod_id)
+{
+  LOG_I(ENB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id);
+  MessageDef *msg;
+  msg = itti_alloc_new_message (ENB_APP, TERMINATE_MESSAGE);
+  itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg);
+}
+
+
+
+#endif
+
+int main( int argc, char **argv )
+{
+  int i;
+#if defined (XFORMS)
+  void *status;
+#endif
+
+  int CC_id;
+  uint8_t  abstraction_flag=0;
+  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
+
+#if defined (XFORMS)
+  int ret;
+#endif
+
+  start_background_system();
+  if ( load_configmodule(argc,argv) == NULL) {
+    exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
+  } 
+      
+#ifdef DEBUG_CONSOLE
+  setvbuf(stdout, NULL, _IONBF, 0);
+  setvbuf(stderr, NULL, _IONBF, 0);
+#endif
+
+  PHY_VARS_UE *UE[MAX_NUM_CCs];
+
+  mode = normal_txrx;
+  memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
+
+  memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
+
+  set_latency_target();
+
+  logInit();
+
+  printf("Reading in command-line options\n");
+
+  get_options (); 
+
+
+#if T_TRACER
+  T_init(T_port, 1-T_nowait, T_dont_fork);
+#endif
+
+
+
+  //randominit (0);
+  set_taus_seed (0);
+
+
+    set_comp_log(HW,      LOG_DEBUG,  LOG_HIGH, 1);
+    set_comp_log(PHY,     LOG_INFO,   LOG_HIGH, 1);
+    set_comp_log(MAC,     LOG_INFO,   LOG_HIGH, 1);
+    set_comp_log(RLC,     LOG_INFO,   LOG_HIGH | FLAG_THREAD, 1);
+    set_comp_log(PDCP,    LOG_INFO,   LOG_HIGH, 1);
+    set_comp_log(OTG,     LOG_INFO,   LOG_HIGH, 1);
+    set_comp_log(RRC,     LOG_INFO,   LOG_HIGH, 1);
+#if defined(ENABLE_ITTI)
+    set_comp_log(EMU,     LOG_INFO,   LOG_MED, 1);
+# if defined(ENABLE_USE_MME)
+    set_comp_log(NAS,     LOG_INFO,   LOG_HIGH, 1);
+# endif
+#endif
+
+
+  if (ouput_vcd) {
+      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_UE.vcd");
+  }
+
+  cpuf=get_cpu_freq_GHz();
+
+#if defined(ENABLE_ITTI)
+
+  log_set_instance_type (LOG_INSTANCE_UE);
+
+
+  printf("ITTI init\n");
+  itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, itti_dump_file);
+
+  // initialize mscgen log after ITTI
+  MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
+#endif
+
+  if (opt_type != OPT_NONE) {
+    radio_type_t radio_type;
+
+    if (frame_parms[0]->frame_type == FDD)
+      radio_type = RADIO_TYPE_FDD;
+    else
+      radio_type = RADIO_TYPE_TDD;
+
+    if (init_opt(in_path, in_ip, NULL, radio_type) == -1)
+      LOG_E(OPT,"failed to run OPT \n");
+  }
+
+#ifdef PDCP_USE_NETLINK
+  printf("PDCP netlink\n");
+  netlink_init();
+#if defined(PDCP_USE_NETLINK_QUEUES)
+  pdcp_netlink_init();
+#endif
+#endif
+
+#if !defined(ENABLE_ITTI)
+  // to make a graceful exit when ctrl-c is pressed
+  signal(SIGSEGV, signal_handler);
+  signal(SIGINT, signal_handler);
+#endif
+
+
+  check_clock();
+
+#ifndef PACKAGE_VERSION
+#  define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
+#endif
+
+  LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
+
+  // init the parameters
+  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+      frame_parms[CC_id]->nb_antennas_tx     = nb_antenna_tx;
+      frame_parms[CC_id]->nb_antennas_rx     = nb_antenna_rx;
+      frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
+  }
+
+
+
+  printf("Before CC \n");
+
+  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {  
+      NB_UE_INST=1;     
+      NB_INST=1;     
+      PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE**));     
+      PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_UE*)*MAX_NUM_CCs);    
+      PHY_vars_UE_g[0][CC_id] = init_ue_vars(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]);
+      
+      if (phy_test==1)
+	UE[CC_id]->mac_enabled = 0;
+      else 
+	UE[CC_id]->mac_enabled = 1;
+      
+      if (UE[CC_id]->mac_enabled == 0) {  //set default UL parameters for testing mode
+	for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
+	  UE[CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
+	  UE[CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index  = beta_RI;
+	  UE[CC_id]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
+	  
+	  UE[CC_id]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = 0;
+	  UE[CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(0%3);
+	  UE[CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4;
+	}
+      }
+      
+      UE[CC_id]->UE_scan = UE_scan;
+      UE[CC_id]->UE_scan_carrier = UE_scan_carrier;
+      UE[CC_id]->mode    = mode;
+      printf("UE[%d]->mode = %d\n",CC_id,mode);
+      
+      if (UE[CC_id]->mac_enabled == 1) { 
+	UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1234;
+	UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1234;
+      }else {
+	UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1235;
+	UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1235;
+      }
+      UE[CC_id]->rx_total_gain_dB =  (int)rx_gain[CC_id][0] + rx_gain_off;
+      UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id];
+      
+      if (frame_parms[CC_id]->frame_type==FDD) {
+	UE[CC_id]->N_TA_offset = 0;
+      }
+      else {
+	if (frame_parms[CC_id]->N_RB_DL == 100)
+	  UE[CC_id]->N_TA_offset = 624;
+	else if (frame_parms[CC_id]->N_RB_DL == 50)
+	  UE[CC_id]->N_TA_offset = 624/2;
+	else if (frame_parms[CC_id]->N_RB_DL == 25)
+	  UE[CC_id]->N_TA_offset = 624/4;
+     
+    }
+    init_openair0(); 
+  }
+
+  printf("Runtime table\n");
+  fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
+  cpuf=get_cpu_freq_GHz();
+  
+  
+  
+#ifndef DEADLINE_SCHEDULER
+  
+  printf("NO deadline scheduler\n");
+  /* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
+  
+  cpu_set_t cpuset;
+  int s;
+  char cpu_affinity[1024];
+  CPU_ZERO(&cpuset);
+#ifdef CPU_AFFINITY
+  if (get_nprocs() > 2) {
+    CPU_SET(0, &cpuset);
+    s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
+    if (s != 0) {
+      perror( "pthread_setaffinity_np");
+      exit_fun("Error setting processor affinity");
+    }
+    LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n");
+  }
+#endif
+  
+  /* Check the actual affinity mask assigned to the thread */
+  s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
+  if (s != 0) {
+    perror( "pthread_getaffinity_np");
+    exit_fun("Error getting processor affinity ");
+  }
+  memset(cpu_affinity, 0 , sizeof(cpu_affinity));
+  for (int j = 0; j < CPU_SETSIZE; j++) {
+    if (CPU_ISSET(j, &cpuset)) {
+      char temp[1024];
+      sprintf(temp, " CPU_%d ", j);
+      strcat(cpu_affinity, temp);
+    }
+  }
+  LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity);
+#endif
+  
+
+  
+  
+#if defined(ENABLE_ITTI)
+    if (create_tasks_ue(1) < 0) {
+      printf("cannot create ITTI tasks\n");
+      exit(-1); // need a softer mode
+    }
+    printf("ITTI tasks created\n");
+#endif
+
+  // init UE_PF_PO and mutex lock
+  pthread_mutex_init(&ue_pf_po_mutex, NULL);
+  memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs);
+  
+  mlockall(MCL_CURRENT | MCL_FUTURE);
+  
+  pthread_cond_init(&sync_cond,NULL);
+  pthread_mutex_init(&sync_mutex, NULL);
+  
+#ifdef XFORMS
+  int UE_id;
+  
+  printf("XFORMS\n");
+
+  if (do_forms==1) {
+    fl_initialize (&argc, argv, NULL, 0, 0);
+    
+      form_stats = create_form_stats_form();
+      fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
+      UE_id = 0;
+      form_ue[UE_id] = create_lte_phy_scope_ue();
+      sprintf (title, "LTE DL SCOPE UE");
+      fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
+      
+      /*
+	if (openair_daq_vars.use_ia_receiver) {
+	fl_set_button(form_ue[UE_id]->button_0,1);
+	fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
+	} else {
+	fl_set_button(form_ue[UE_id]->button_0,0);
+	fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
+	}*/
+      fl_set_button(form_ue[UE_id]->button_0,0);
+      fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
+    ret = pthread_create(&forms_thread, NULL, scope_thread, NULL);
+    
+    if (ret == 0)
+      pthread_setname_np( forms_thread, "xforms" );
+    
+    printf("Scope thread created, ret=%d\n",ret);
+  }
+  
+#endif
+  
+  rt_sleep_ns(10*100000000ULL);
+
+  // start the main threads
+    int eMBMS_active = 0;
+    init_UE(1,eMBMS_active,uecap_xer_in,0);
+
+    if (phy_test==0) {
+      printf("Filling UE band info\n");
+      fill_ue_band_info();
+      dl_phy_sync_success (0, 0, 0, 1);
+    }
+
+    number_of_cards = 1;
+    for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+      PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
+      PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset;
+    }
+
+
+  
+  // connect the TX/RX buffers
+
+    for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+      
+      
+#ifdef OAI_USRP
+      UE[CC_id]->hw_timing_advance = timing_advance;
+#else
+      UE[CC_id]->hw_timing_advance = 160;
+#endif
+    }
+    if (setup_ue_buffers(UE,&openair0_cfg[0])!=0) {
+      printf("Error setting up eNB buffer\n");
+      exit(-1);
+    }
+    
+    
+    
+    if (input_fd) {
+      printf("Reading in from file to antenna buffer %d\n",0);
+      if (fread(UE[0]->common_vars.rxdata[0],
+		sizeof(int32_t),
+		frame_parms[0]->samples_per_tti*10,
+		input_fd) != frame_parms[0]->samples_per_tti*10)
+	printf("error reading from file\n");
+    }
+    //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
+  
+  printf("Sending sync to all threads\n");
+  
+  pthread_mutex_lock(&sync_mutex);
+  sync_var=0;
+  pthread_cond_broadcast(&sync_cond);
+  pthread_mutex_unlock(&sync_mutex);
+  printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
+  end_configmodule();
+  printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
+
+  // wait for end of program
+  printf("TYPE <CTRL-C> TO TERMINATE\n");
+  //getchar();
+
+#if defined(ENABLE_ITTI)
+  printf("Entering ITTI signals handler\n");
+  itti_wait_tasks_end();
+  printf("Returned from ITTI signal handler\n");
+  oai_exit=1;
+  printf("oai_exit=%d\n",oai_exit);
+#else
+
+  while (oai_exit==0)
+    rt_sleep_ns(100000000ULL);
+  printf("Terminating application - oai_exit=%d\n",oai_exit);
+
+#endif
+
+  // stop threads
+#ifdef XFORMS
+  printf("waiting for XFORMS thread\n");
+
+  if (do_forms==1) {
+    pthread_join(forms_thread,&status);
+    fl_hide_form(form_stats->stats_form);
+    fl_free_form(form_stats->stats_form);
+    fl_hide_form(form_ue[0]->lte_phy_scope_ue);
+    fl_free_form(form_ue[0]->lte_phy_scope_ue);
+  }
+
+#endif
+
+  printf("stopping MODEM threads\n");
+
+  pthread_cond_destroy(&sync_cond);
+  pthread_mutex_destroy(&sync_mutex);
+
+  pthread_mutex_destroy(&ue_pf_po_mutex);
+
+  // *** Handle per CC_id openair0
+  if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func)
+    PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
+  
+  if (ouput_vcd)
+    VCD_SIGNAL_DUMPER_CLOSE();
+  
+  if (opt_enabled == 1)
+    terminate_opt();
+  
+  logClean();
+
+  printf("Bye.\n");
+  
+  return 0;
+}
diff --git a/targets/RT/USER/make_for_usrp.sh b/targets/RT/USER/make_for_usrp.sh
deleted file mode 100755
index 998cd7c462d5a0f4a66926d5d4890509c0b21050..0000000000000000000000000000000000000000
--- a/targets/RT/USER/make_for_usrp.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-############### make nasmesh.ko ###############
-sudo rmmod nasmesh
-#cd ${OPENAIR2_DIR} && make nasmesh_netlink.ko
-#cd ${OPENAIR2_DIR}/NAS/DRIVER/MESH/RB_TOOL/ && make
-#make all
-sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
-
-############## Ethernet config  ####################
-sudo ifconfig eth0 mtu 4000
-sudo sysctl -w net.core.wmem_max=1048576
-sudo sysctl -w net.core.rmem_max=50000000
-
-############## rtai modules ###################
-if test \! -c /dev/rtai_shm; then
-        sudo mknod -m 666 /dev/rtai_shm c 10 254
-fi
-for n in `seq 0 9`; do
-        f=/dev/rtf$n
-        if test \! -c $f; then
-                sudo mknod -m 666 $f c 150 $n
-        fi
-done
-sudo modprobe rtai_hal
-sudo modprobe rtai_sched
-sudo modprobe rtai_fifos
-sudo modprobe rtai_sem
-sudo modprobe rtai_mbx
-sudo modprobe rtai_msg
-
-############## make  ###################
-make lte-softmodem-usrp NAS=1 USRP=1 XFORMS=1 RTAI=1 HARD_RT=1 #DRIVER2013=1
-#make lte-softmodem NAS=1 XFORMS=1 USRP=0 RTAI=1 DRIVER2013=1
-echo DONE!
-exit 0
diff --git a/targets/RT/USER/msg_helper.c b/targets/RT/USER/msg_helper.c
deleted file mode 100644
index 32a0da6cd4aec30a2647a54c208c6997f77c4e06..0000000000000000000000000000000000000000
--- a/targets/RT/USER/msg_helper.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <rtai_sem.h>
-
-#include "msg_many.h"
-
-/*
- * Add a task task to ri->worker.
- * Return the used index in ri->worker on success
- * Return -TM_WORKER_FULL_ERROR if ri->worker full
- * Return -TM_WORKER_ERROR else
-*/
-int tm_add_task(RT_TASK *task, run_info_t *ri)
-{
-  if(ri->used >= NUM_THREADS)
-    return -TM_WORKER_FULL_ERROR;
-
-  rt_sem_wait(ri->update_sem);
-  (*ri->worker)[ri->used] = task;
-  ri->used++;
-  rt_sem_signal(ri->update_sem);
-
-  return ri->used - 1;
-}
-
-/*
- * Remove the a hole in worker at index index by
- * shift the next slots by one.
- * This function assume that update_sem are locked.
- * Return the new used counter.
-*/
-int _tm_clean_worker(RT_TASK *(*worker)[], int index, int used)
-{
-  int i;
-
-  for(i = index; i < used; i++)
-    (*worker)[i] = (*worker)[i + 1];
-
-  return used - 1;
-}
-
-/*
- * Remove a task from ri->worker a index task_index
- * Return 0 on success
- * Return -TM_WORKER_ERROR else
-*/
-int tm_del_task(int task_index, run_info_t *ri)
-{
-  rt_sem_wait(ri->update_sem);
-  ri->used = _tm_clean_worker(ri->worker, task_index, ri->used);
-  rt_sem_signal(ri->update_sem);
-
-  return 0;
-}
-
-/*
- * Return next index to use on ri->worker.
- * It depends on the old_index and ri->used.
- * Return -TM_WORKER_ERROR if ri->used == 0.
-*/
-inline int tm_get_next_task_index(int old_index, run_info_t *ri)
-{
-  if(ri->used == 0)
-    return -TM_WORKER_ERROR;
-
-  return (old_index + 1) % ri->used;
-}
-
diff --git a/targets/RT/USER/msg_many.c b/targets/RT/USER/msg_many.c
deleted file mode 100644
index ec582558a4bf09939fb1eb484edf96b09f633173..0000000000000000000000000000000000000000
--- a/targets/RT/USER/msg_many.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-
-#include <rtai_lxrt.h>
-#include <rtai_sem.h>
-#include <rtai_msg.h>
-
-#include "msg_many.h"
-
-static void *msg_test_thread(void *arg)
-{
-  RT_TASK *self;
-  RT_TASK *sender_task;
-  thread_info_t *ti = (thread_info_t *)arg;
-  run_info_t *ri = ti->ri;
-  unsigned int msg;
-  int counter = 0;
-  char name[6];
-  int task_index;
-
-  /* Build custom task name for each thread */
-  snprintf(name, 6, "%s%03i", THREAD_NAME_PREFIX, ti->thread_num);
-
-  self = rt_task_init_schmod(nam2num(name), 0, 0, 0, SCHED_FIFO, 0xF);
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  rt_make_hard_real_time();
-
-  task_index = tm_add_task(self, ri);
-
-  if(task_index != -TM_WORKER_FULL_ERROR) {
-    while (*(ri->exit_condition) == 0) {
-      // wait only one PERIOD to avoid wait for ever
-      sender_task = rt_receive_timed(ri->sender, &msg, ri->period);
-
-      //sender_task = rt_receive(0, &msg);
-      if(sender_task == ri->sender)
-        counter++;
-    }
-
-    rt_printk("%s: counter == %i\n", name, counter);
-    tm_del_task(task_index, ri);
-  } else {
-    rt_printk("%s: Worker array full!\n", name);
-  }
-
-  rt_make_soft_real_time();
-
-  rt_task_delete(self);
-
-  free((void *) ti);
-
-  return 0;
-}
-
-
-int main(void)
-{
-  RT_TASK *self;
-  RT_TASK *tmp_worker_task;
-  RT_TASK *worker_tasks[NUM_THREADS];
-  int worker_threads[NUM_THREADS];
-  RTIME now;
-  unsigned int i, ii;
-  run_info_t ri;
-  thread_info_t *ti;
-  uint8_t exit_condition = 0;
-  int fail_count = 0;
-  int old_index = 0;
-  uint8_t lost;
-
-  // make main thread LXRT soft realtime
-  self = rt_task_init_schmod(nam2num("MAINTK"), 10, 0, 0, SCHED_FIFO, 0xF);
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  rt_make_hard_real_time();
-  rt_set_periodic_mode();
-  start_rt_timer(0);
-
-  /* Build all information need to run in main and the thread */
-  ri.sender = self;
-  ri.exit_condition = &exit_condition;
-  ri.period = nano2count(PERIOD);
-  ri.update_sem = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if(ri.update_sem == 0)
-    exit(-1);
-
-  ri.used = 0;
-  ri.worker = &worker_tasks;
-
-  now = rt_get_time() + ri.period;
-  rt_task_make_periodic(self, now, ri.period);
-
-  /* start all threads */
-  for(i = 0; i < NUM_THREADS; i++) {
-    ti = (thread_info_t *)malloc(sizeof(thread_info_t));
-
-    if(ti == NULL) {
-      rt_printk("MAINTK: can't get memory!\n");
-      exit(-1);
-    }
-
-    ti->ri = &ri;
-    ti->thread_num = i;
-    worker_threads[i] = rt_thread_create(msg_test_thread, ti , 10000);
-  }
-
-  rt_sleep(NUM_THREADS * ri.period);
-
-  rt_printk("start\n");
-
-  for(i = 0; i < THRESHOLD; i++) {
-    rt_task_wait_period();
-    lost = 1;
-
-    for(ii = 0; ii < ri.used; ii++) {
-      old_index = tm_get_next_task_index(old_index, &ri);
-
-      if(old_index == -TM_WORKER_ERROR) {
-        rt_printk("MAINTK: No Tasks!\n");
-        break;
-      }
-
-      tmp_worker_task = rt_send_if(worker_tasks[old_index], i);
-
-      if(tmp_worker_task == worker_tasks[old_index]) {
-        lost = 0;
-        break;
-      }
-    }
-
-    if(lost)
-      fail_count++;
-  }
-
-  rt_printk("fail_count == %i\n", fail_count);
-
-  // cleanup
-  exit_condition = 1;
-  rt_make_soft_real_time();
-
-  rt_task_delete(self);
-
-  /* wait for the worker threadss  */
-  for(ii = 0; ii < ri.used; ii++) {
-    rt_thread_join(worker_threads[ii]);
-  }
-
-  stop_rt_timer();
-  return 0;
-}
diff --git a/targets/RT/USER/pnf.gtkw b/targets/RT/USER/pnf.gtkw
new file mode 100644
index 0000000000000000000000000000000000000000..979d6321383e625d12369a7dfd8dcdfc0d482b6a
--- /dev/null
+++ b/targets/RT/USER/pnf.gtkw
@@ -0,0 +1,54 @@
+[*]
+[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
+[*] Tue Jul 25 20:26:12 2017
+[*]
+[dumpfile] "/tmp/openair_dump_eNB.vcd"
+[dumpfile_mtime] "Tue Jul 25 20:11:55 2017"
+[dumpfile_size] 19201475
+[savefile] "/home/papillon/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw"
+[timestart] 29023604000
+[size] 1236 578
+[pos] 309 0
+*-20.793451 29026062100 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
+[sst_width] 386
+[signals_width] 262
+[sst_expanded] 1
+[sst_vpaned_height] 146
+@28
+functions.trx_read
+functions.trx_write
+@24
+variables.trx_ts[63:0]
+variables.trx_tst[63:0]
+@25
+variables.frame_number_RX0_RU[63:0]
+variables.subframe_number_RX0_RU[63:0]
+@25
+variables.frame_number_TX0_RU[63:0]
+variables.subframe_number_TX0_RU[63:0]
+@24
+functions.phy_procedures_ru_feprx0
+functions.phy_procedures_ru_feprx1
+functions.phy_procedures_eNb_rx_uespec0
+functions.phy_procedures_eNb_tx0
+functions.eNB_thread_rxtx1
+functions.phy_enb_prach_rx
+functions.phy_enb_rs_tx
+functions.phy_enb_pdcch_tx
+functions.nfapi_subframe
+functions.generate_pcfich
+functions.generate_dci0
+functions.pdcch_scrambling
+functions.pdcch_modulation
+functions.pdcch_interleaving
+functions.pdcch_tx
+functions.generate_dlsch
+functions.generate_phich
+functions.udp_enb_task
+functions.phy_procedures_ru_feptx_ofdm0
+functions.phy_procedures_ru_feptx_ofdm1
+functions.phy_procedures_ru_feptx_prec0
+functions.phy_procedures_ru_feptx_prec1
+functions.phy_enb_prach_rx
+[pattern_trace] 1
+[pattern_trace] 0
diff --git a/targets/RT/USER/rrh.c b/targets/RT/USER/rrh.c
deleted file mode 100644
index f658e6b40163aa9636ddc4a336f1158c4b1df071..0000000000000000000000000000000000000000
--- a/targets/RT/USER/rrh.c
+++ /dev/null
@@ -1,1220 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/** ethernet_lib : API to stream I/Q samples over standard ethernet (RRH component)
-*
-*  Authors: Raymond Knopp  <raymond.knopp@eurecom.fr>,  Riadh Ghaddab <riadh.ghaddab@eurecom.fr>
-*
-*  Changelog:
-*  06.10.2014: Initial version
-*/
-
-#include <arpa/inet.h>
-#include <linux/if_packet.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/ether.h>
-#include <unistd.h>
-#include <signal.h>
-#include <execinfo.h>
-#include <pthread.h>
-#include <time.h>
-
-#include "common_lib.h"
-
-#define BUF_LEN 4096+32
-#define RRH_eNB_PORT 50000
-#define RRH_eNB_DEST_IP "127.0.0.1"
-#define RRH_UE_PORT 51000
-#define RRH_UE_DEST_IP "127.0.0.1"
-
-#define FRAME_MAX_SIZE 307200//76800
-#define DEFAULT_PERIOD_NS 133333//200000
-
-#define START_CMD 1
-#define PRINTF_PERIOD 3750
-
-typedef struct {
-  int eNB_port;
-  char eNB_dest_ip[20];
-  int UE_port;
-  char UE_dest_ip[20];
-  struct timespec time_req;
-} rrh_desc_t;
-
-typedef struct {
-  int32_t nsamps;
-  int32_t antenna_index_eNB_rx;
-  int32_t antenna_index_eNB_tx;
-  int sockid_eNB;
-  struct sockaddr clientaddr;
-  socklen_t clientaddrlen;
-} rrh_eNB_desc_t;
-
-typedef struct {
-  int32_t nsamps;
-  int32_t antenna_index_UE_rx;
-  int32_t antenna_index_UE_tx;
-  int sockid_UE;
-  struct sockaddr clientaddr;
-  socklen_t clientaddrlen;
-} rrh_UE_desc_t;
-
-int rrh_exit=0;
-
-int32_t tx_buffer_eNB[4][(1+(sizeof(openair0_timestamp)>>2))+FRAME_MAX_SIZE],rx_buffer_eNB[4][(1+(sizeof(openair0_timestamp)>>2))+FRAME_MAX_SIZE];
-int32_t tx_buffer_UE[4][(1+(sizeof(openair0_timestamp)>>2))+FRAME_MAX_SIZE],rx_buffer_UE[4][(1+(sizeof(openair0_timestamp)>>2))+FRAME_MAX_SIZE];
-void  *rrh_eNB_thread_status;
-void  *rrh_UE_thread_status;
-int32_t counter_UE_rx[4]= {0,0,0,0};
-int32_t counter_UE_tx[4]= {0,0,0,0};
-int32_t counter_eNB_rx[4]= {0,0,0,0};
-int32_t counter_eNB_tx[4]= {0,0,0,0};
-int32_t overflow_rx_buffer_UE[4]= {0,0,0,0};
-int32_t overflow_rx_buffer_eNB[4]= {0,0,0,0};
-int32_t nsamps_eNB[4]= {0,0,0,0};
-int32_t nsamps_UE[4]= {0,0,0,0};
-int32_t UE_tx_started=0,eNB_tx_started=0, UE_rx_started=0,eNB_rx_started=0;
-int32_t RT_FLAG=0, NRT_FLAG=1;
-openair0_timestamp nrt_eNB_counter[4]= {0,0,0,0};
-openair0_timestamp nrt_UE_counter[4]= {0,0,0,0};
-
-openair0_timestamp timestamp_eNB_tx[4],timestamp_eNB_rx[4]= {0,0,0,0};
-openair0_timestamp timestamp_UE_tx[4],timestamp_UE_rx[4]= {0,0,0,0};
-openair0_timestamp hw_counter=0;
-
-pthread_cond_t sync_UE_cond[4];
-pthread_mutex_t sync_UE_mutex[4];
-pthread_cond_t sync_eNB_cond[4];
-pthread_mutex_t sync_eNB_mutex[4];
-pthread_mutex_t timer_mutex;
-
-int sync_UE_rx[4]= {-1,-1,-1,-1};
-int sync_eNB_rx[4]= {-1,-1,-1,-1};
-
-//functions prototype
-void timer_signal_handler(int);
-void *timer_proc(void *);
-void *rrh_proc_eNB_thread();
-void *rrh_proc_UE_thread();
-void *rrh_UE_thread(void *);
-void *rrh_UE_rx_thread(void *);
-void *rrh_UE_tx_thread(void *);
-void *rrh_eNB_thread(void *);
-void *rrh_eNB_rx_thread(void *);
-void *rrh_eNB_tx_thread(void *);
-
-void timer_signal_handler(int sig)
-{
-
-  if (sig == SIGALRM) {
-    pthread_mutex_lock(&timer_mutex);
-    hw_counter ++;
-    //printf("[RRH] : hw_counter : %d\n",(int)hw_counter);
-    pthread_mutex_unlock(&timer_mutex);
-  }
-
-
-}
-
-
-void *timer_proc(void *arg)
-{
-  timer_t             timerid;    // timer ID for timer
-  //struct sigevent     event;      // event to deliver
-  struct itimerspec   *timer = (struct itimerspec*)arg;      // the timer data structure
-  struct itimerspec  *old_value;
-
-
-  //printf("Starting the timer\n");
-  if (timer_create (CLOCK_REALTIME, NULL, &timerid) == -1) {
-    fprintf (stderr, "couldn't create a timer\n");
-    perror (NULL);
-    exit (EXIT_FAILURE);
-  }
-
-  signal(SIGALRM, timer_signal_handler);
-  // and start it!
-  timer_settime (timerid, 0, timer, old_value);
-
-  while (!rrh_exit) {
-    sleep(1);
-  }
-
-  timer_delete(timerid);
-  return (0);
-
-
-}
-
-
-void *rrh_proc_eNB_thread()
-{
-
-  //rrh_desc_t *rrh_desc = (rrh_desc_t *)arg;
-  int antenna_index,i;
-  openair0_timestamp truncated_timestamp, truncated_timestamp_final, last_hw_counter=0;
-  struct timespec time_req, time_rem;
-  int16_t *rxp,*txp;
-
-  time_req.tv_sec = 0;
-  time_req.tv_nsec = 1000;
-
-  while (rrh_exit==0) {
-    //wait until some data has been copied
-    for (antenna_index=0; antenna_index<4; antenna_index++) {
-      if (sync_eNB_rx[antenna_index]==0) {
-        if (!eNB_tx_started) {
-          eNB_tx_started=1; // set this flag to 1 to indicate that eNB started
-
-          if (RT_FLAG==1) {
-            last_hw_counter=hw_counter;
-          }
-        } else {
-          if (RT_FLAG==1) {
-            if (hw_counter > last_hw_counter+1) {
-              printf("L");
-              //      goto end_copy_eNB;
-            } else {
-              //printf("hw_counter : %llu, last_hw_counter : %llu\n",hw_counter,last_hw_counter);
-              while (hw_counter < last_hw_counter+1)
-                nanosleep(&time_req,&time_rem);
-            }
-          }
-        }
-
-        truncated_timestamp = timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE);
-        truncated_timestamp_final = (timestamp_eNB_tx[antenna_index]+nsamps_eNB[antenna_index])%FRAME_MAX_SIZE;
-
-        if ((truncated_timestamp + nsamps_eNB[antenna_index]) > FRAME_MAX_SIZE) {
-          if ((timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE < nsamps_eNB[antenna_index]) && (UE_rx_started==1)) {
-            overflow_rx_buffer_UE[antenna_index]++;
-            printf("UE Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_UE[antenna_index],(int)truncated_timestamp);
-
-            if (NRT_FLAG==1) {
-              while ((timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE) < nsamps_eNB[antenna_index])
-                nanosleep(&time_req,&time_rem);
-            }
-          }
-
-          rxp = (int16_t*)&rx_buffer_UE[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp)>>2)];
-          txp = (int16_t*)&tx_buffer_eNB[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp)>>2)];
-
-          for (i=0; i<(FRAME_MAX_SIZE<<1)-(truncated_timestamp<<1); i++) {
-            rxp[i] = txp[i]>>6;
-          }
-
-          rxp = (int16_t*)&rx_buffer_UE[antenna_index][(sizeof(openair0_timestamp)>>2)];
-          txp = (int16_t*)&tx_buffer_eNB[antenna_index][0];
-
-          for (i=0; i<nsamps_eNB[antenna_index]-(FRAME_MAX_SIZE)+(truncated_timestamp); i++) {
-            rxp[i] = txp[i]>>6;
-          }
-
-          /*          memcpy(&rx_buffer_UE[antenna_index][truncated_timestamp + (sizeof(openair0_timestamp)>>2)],&tx_buffer_eNB[antenna_index][truncated_timestamp],(FRAME_MAX_SIZE<<2)-(truncated_timestamp<<2));
-                memcpy(&rx_buffer_UE[antenna_index][(sizeof(openair0_timestamp)>>2)],&tx_buffer_eNB[antenna_index][0],(nsamps_eNB[antenna_index]<<2)-(FRAME_MAX_SIZE<<2)+(truncated_timestamp<<2));*/
-        } else {
-          if (((truncated_timestamp < (timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE)) && (truncated_timestamp_final >  (timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE))) && (UE_rx_started==1)) {
-            overflow_rx_buffer_UE[antenna_index]++;
-            printf("UE Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_UE[antenna_index],(int)truncated_timestamp);
-
-            if (NRT_FLAG==1) {
-              while (truncated_timestamp_final >  timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE)
-                nanosleep(&time_req,&time_rem);
-            }
-          }
-
-          rxp = (int16_t*)&rx_buffer_UE[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp))];
-          txp = (int16_t*)&tx_buffer_eNB[antenna_index][truncated_timestamp];
-
-          for (i=0; i<(nsamps_eNB[antenna_index]); i++) {
-            rxp[i] =txp[i]>>6;
-          }
-
-          /*
-            memcpy(&rx_buffer_UE[antenna_index][truncated_timestamp + (sizeof(openair0_timestamp)>>2)],&tx_buffer_eNB[antenna_index][truncated_timestamp],(nsamps_eNB[antenna_index]<<2));*/
-        }
-
-
-        // end_copy_eNB :
-        last_hw_counter=hw_counter;
-        pthread_mutex_lock(&sync_eNB_mutex[antenna_index]);
-        sync_eNB_rx[antenna_index]--;
-        pthread_mutex_unlock(&sync_eNB_mutex[antenna_index]);
-
-      }
-    }
-
-  }
-
-  return(0);
-}
-
-void *rrh_proc_UE_thread()
-{
-
-  //rrh_desc_t *rrh_desc = (rrh_desc_t *)arg;
-  int antenna_index,i;
-  openair0_timestamp truncated_timestamp, truncated_timestamp_final, last_hw_counter=0;
-  struct timespec time_req, time_rem;
-  int16_t *txp,*rxp;
-
-  time_req.tv_sec = 0;
-  time_req.tv_nsec = 1000;
-
-
-  while (rrh_exit==0) {
-    //wait until some data has been copied
-    for (antenna_index=0; antenna_index<4; antenna_index++) {
-      if (sync_UE_rx[antenna_index]==0) {
-        if (!UE_tx_started) {
-          UE_tx_started=1;  //Set this flag to 1 to indicate that a UE started retrieving data
-
-          if (RT_FLAG==1) {
-            last_hw_counter=hw_counter;
-          }
-        } else {
-          if (RT_FLAG==1) {
-            if (hw_counter > last_hw_counter+1) {
-              printf("L1");
-              //              goto end_copy_UE;
-            } else {
-              while (hw_counter < last_hw_counter+1)
-                nanosleep(&time_req,&time_rem);
-            }
-          }
-        }
-
-        truncated_timestamp = timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE);
-        truncated_timestamp_final =  (timestamp_UE_tx[antenna_index]+nsamps_UE[antenna_index])%FRAME_MAX_SIZE;
-
-        if ((truncated_timestamp + nsamps_UE[antenna_index]) > FRAME_MAX_SIZE) {
-          if ((timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE < nsamps_UE[antenna_index]) && (eNB_rx_started==1)) {
-            overflow_rx_buffer_eNB[antenna_index]++;
-            printf("eNB Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_eNB[antenna_index],(int)truncated_timestamp);
-
-            if (NRT_FLAG==1) {
-              while ((timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE) < nsamps_UE[antenna_index])
-                nanosleep(&time_req,&time_rem);
-            }
-          }
-
-          rxp = (int16_t*)&rx_buffer_eNB[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp)>>2)];
-          txp = (int16_t*)&tx_buffer_UE[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp)>>2)];
-
-          for (i=0; i<(FRAME_MAX_SIZE<<1)-(truncated_timestamp<<1); i++) {
-            rxp[i] = txp[i]>>6;
-          }
-
-          rxp = (int16_t*)&rx_buffer_eNB[antenna_index][(sizeof(openair0_timestamp)>>2)];
-          txp = (int16_t*)&tx_buffer_UE[antenna_index][0];
-
-          for (i=0; i<nsamps_eNB[antenna_index]-(FRAME_MAX_SIZE)+(truncated_timestamp); i++) {
-            rxp[i] = txp[i]>>6;
-          }
-
-          /*
-                memcpy(&rx_buffer_eNB[antenna_index][truncated_timestamp + (sizeof(openair0_timestamp)>>2)],&tx_buffer_UE[antenna_index][truncated_timestamp],(FRAME_MAX_SIZE<<2)-(truncated_timestamp<<2));
-                memcpy(&rx_buffer_eNB[antenna_index][(sizeof(openair0_timestamp)>>2)],&tx_buffer_UE[antenna_index][0],(nsamps_UE[antenna_index]<<2)-(FRAME_MAX_SIZE<<2)+(truncated_timestamp<<2));*/
-
-        } else {
-          if (((truncated_timestamp < (timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE)) && (truncated_timestamp_final >  (timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE))) && (eNB_rx_started==1)) {
-            overflow_rx_buffer_eNB[antenna_index]++;
-            printf("eNB Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_eNB[antenna_index],(int)truncated_timestamp);
-
-            if (NRT_FLAG==1) {
-              while (truncated_timestamp_final >  timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE)
-                nanosleep(&time_req,&time_rem);
-            }
-          }
-
-          rxp = (int16_t*)&rx_buffer_eNB[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp))];
-          txp = (int16_t*)&tx_buffer_UE[antenna_index][truncated_timestamp];
-
-          for (i=0; i<(nsamps_eNB[antenna_index]); i++) {
-            rxp[i] =txp[i]>>6;
-          }
-
-          /*          memcpy(&rx_buffer_eNB[antenna_index][truncated_timestamp+ (sizeof(openair0_timestamp)>>2)],&tx_buffer_UE[antenna_index][truncated_timestamp],(nsamps_UE[antenna_index]<<2));*/
-        }
-
-        //end_copy_UE :
-        last_hw_counter=hw_counter;
-        pthread_mutex_lock(&sync_UE_mutex[antenna_index]);
-        sync_UE_rx[antenna_index]--;
-        pthread_mutex_unlock(&sync_UE_mutex[antenna_index]);
-
-      }
-    }
-
-  }
-
-  return(0);
-}
-
-
-void *rrh_UE_rx_thread(void *arg)
-{
-
-  struct sockaddr clientaddr;
-  socklen_t clientaddrlen;
-  rrh_UE_desc_t *rrh_UE_rx_desc = (rrh_UE_desc_t *)arg;
-  struct timespec time0,time1,time2;
-  struct timespec time_req_1us, time_rem_1us;
-  ssize_t bytes_sent;
-  int antenna_index, nsamps;
-  int trace_cnt=0;
-  int sockid;
-  char str[INET_ADDRSTRLEN];
-  unsigned long long max_rx_time=0, min_rx_time=133333, total_rx_time=0, average_rx_time=133333, s_period=0, trial=0;
-
-  openair0_timestamp temp, last_hw_counter=0;
-
-  antenna_index =  rrh_UE_rx_desc->antenna_index_UE_rx;
-  nsamps = rrh_UE_rx_desc->nsamps;
-  sockid = rrh_UE_rx_desc->sockid_UE;
-
-
-  bzero((void*)&clientaddr,sizeof(struct sockaddr));
-  clientaddrlen = sizeof(struct sockaddr);
-  //printf("Waiting for eNB ...\n");
-  //printf("[RRH eNB RX thread] received parameters : nsamps : %d, antenna_index : %d\n",nsamps,antenna_index);
-  clientaddr = rrh_UE_rx_desc->clientaddr;
-  clientaddrlen = rrh_UE_rx_desc->clientaddrlen;
-
-  inet_ntop(AF_INET, &(((struct sockaddr_in*)&clientaddr)->sin_addr), str, INET_ADDRSTRLEN);
-  printf("Received UE RX request for antenna %d, nsamps %d (from %s:%d)\n",antenna_index,nsamps,str,
-         ntohs(((struct sockaddr_in*)&clientaddr)->sin_port));
-
-  while (rrh_exit == 0) {
-    if (!UE_rx_started) {
-      UE_rx_started=1;  //Set this flag to 1 to indicate that a UE started retrieving data
-
-      if (RT_FLAG==1) {
-        last_hw_counter=hw_counter;
-      }
-    } else {
-      if (RT_FLAG==1) {
-        if (hw_counter > last_hw_counter+1) {
-          printf("L1");
-          //              goto end_copy_UE;
-        } else {
-          while (hw_counter < last_hw_counter+1)
-            nanosleep(&time_req_1us,&time_rem_1us);
-        }
-      }
-    }
-
-    clock_gettime(CLOCK_MONOTONIC,&time1);
-
-    // send return
-    temp=*(openair0_timestamp*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)];
-    *(openair0_timestamp*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)]=timestamp_UE_rx[antenna_index];
-
-    if ((timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)+nsamps) > FRAME_MAX_SIZE) { // Wrap around if nsamps exceeds the buffer limit
-      if (((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE)) < ((timestamp_UE_rx[antenna_index]+nsamps)%(FRAME_MAX_SIZE))) && (eNB_tx_started==1)) {
-        printf("UE underflow wraparound timestamp_UE_rx : %d, timestamp_eNB_tx : %d\n",(int)(timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)),(int)(timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE));
-
-        if (NRT_FLAG==1) {
-          while ((timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE) < ((timestamp_UE_rx[antenna_index]+nsamps)%(FRAME_MAX_SIZE)))
-            nanosleep(&time_req_1us,&time_rem_1us);
-        }
-      }
-
-      if ((bytes_sent = sendto(sockid,
-                               &rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)],
-                               ((FRAME_MAX_SIZE)<<2) - ((timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE))<<2) + sizeof(openair0_timestamp),
-                               0,
-                               (struct sockaddr*)&clientaddr,
-                               sizeof(struct sockaddr)))<0)
-        perror("RRH UE : sendto for RX");
-
-      if ((bytes_sent = sendto(sockid,
-                               &rx_buffer_UE[antenna_index][0],
-                               (nsamps<<2) - ((FRAME_MAX_SIZE)<<2) + ((timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE))<<2),
-                               0,
-                               (struct sockaddr*)&clientaddr,
-                               sizeof(struct sockaddr)))<0)
-        perror("RRH UE : sendto for RX");
-    } else {
-      if (((timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE)< timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE)
-          && (((timestamp_UE_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE) > (timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE)) && (eNB_tx_started==1) ) {
-        printf("UE underflow timestamp_UE_rx : %d, timestamp_eNB_tx : %d\n",(int)(timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE),(int)(timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE));
-
-        if (NRT_FLAG==1) {
-          while (((timestamp_UE_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE) > (timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE)) {
-            nanosleep(&time_req_1us,&time_rem_1us);
-          }
-        }
-      }
-
-
-      if ((bytes_sent = sendto(sockid,
-                               &rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)],
-                               (nsamps<<2)+sizeof(openair0_timestamp),
-                               0,
-                               (struct sockaddr*)&clientaddr,
-                               sizeof(struct sockaddr)))<0)
-        perror("RRH UE thread: sendto for RX");
-    }
-
-    //printf("bytes_sent %d(timestamp_UE_rx[%d] %d)\n",(int)bytes_sent,antenna_index,(int)timestamp_UE_rx[antenna_index]);
-    *(openair0_timestamp*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)]=temp;
-    timestamp_UE_rx[antenna_index]+=nsamps;
-    last_hw_counter=hw_counter;
-
-    clock_gettime(CLOCK_MONOTONIC,&time2);
-
-    if (trace_cnt++ > 10) {
-      total_rx_time = (unsigned int)(time2.tv_nsec - time0.tv_nsec);
-
-      if (total_rx_time < 0) total_rx_time=1000000000-total_rx_time;
-
-      if ((total_rx_time > 0) && (total_rx_time < 1000000000)) {
-        trial++;
-
-        if (total_rx_time < min_rx_time)
-          min_rx_time = total_rx_time;
-
-        if (total_rx_time > max_rx_time)
-          max_rx_time = total_rx_time;
-
-        average_rx_time = (long long unsigned int)((average_rx_time*trial)+total_rx_time)/(trial+1);
-      }
-
-      if (s_period++ == PRINTF_PERIOD) {
-        s_period=0;
-        printf("Average UE RX time : %lu\tMax RX time : %lu\tMin RX time : %lu\n",average_rx_time,max_rx_time,min_rx_time);
-
-      }
-
-      //printf("RX: t1 %llu (time from last send), t2 %llu (sendto of %lu bytes) total time : %llu\n",(long long unsigned int)(time1.tv_nsec  - time0.tv_nsec), (long long unsigned int)(time2.tv_nsec - time1.tv_nsec),
-      //   (nsamps<<2)+sizeof(openair0_timestamp),(long long unsigned int)(time2.tv_nsec - time0.tv_nsec));
-
-    }
-
-    memcpy(&time0,&time2,sizeof(struct timespec));
-
-
-  }  //while (rrh_exit==0)
-
-  return(0);
-
-}
-
-
-void *rrh_UE_tx_thread(void *arg)
-{
-  struct sockaddr clientaddr;
-  socklen_t clientaddrlen;
-  struct timespec time0a,time0,time1,time2;
-  rrh_UE_desc_t *rrh_UE_tx_desc = (rrh_UE_desc_t *)arg;
-  //  struct timespec time_rem;
-  struct timespec time_req_1us, time_rem_1us;
-  ssize_t bytes_received;
-  int antenna_index, nsamps;
-  int8_t buf[BUF_LEN];
-  int trace_cnt=0;
-  int sockid;
-
-  bzero((void*)&clientaddr,sizeof(struct sockaddr));
-  clientaddrlen = sizeof(struct sockaddr);
-
-  antenna_index =  rrh_UE_tx_desc->antenna_index_UE_tx;
-  nsamps = rrh_UE_tx_desc->nsamps;
-  sockid = rrh_UE_tx_desc->sockid_UE;
-
-  while (rrh_exit == 0) {
-
-    clock_gettime(CLOCK_MONOTONIC,&time0a);
-
-    bytes_received = recvfrom(sockid,buf,BUF_LEN,0,&clientaddr,&clientaddrlen);
-    timestamp_eNB_tx[antenna_index] = *(openair0_timestamp*)(buf+4);
-
-    clock_gettime(CLOCK_MONOTONIC,&time1);
-
-    if (NRT_FLAG==1) {
-      nrt_UE_counter[antenna_index]++;
-    }
-
-    //printf("Received UE TX request for antenna %d, nsamps %d, timestamp %d bytes_received %d\n",antenna_index,nsamps,(int)timestamp_UE_tx[antenna_index],(int)bytes_received);
-    if ((timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE)+nsamps) > FRAME_MAX_SIZE) { // Wrap around if nsamps exceeds the buffer limit
-      memcpy(&tx_buffer_UE[antenna_index][timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE)],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t),
-             (FRAME_MAX_SIZE<<2)-((timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE))<<2));
-      memcpy(&tx_buffer_UE[antenna_index][0],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t)+(FRAME_MAX_SIZE*4)-((timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE))<<2),
-             (nsamps<<2)-((FRAME_MAX_SIZE-(timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE)))<<2));
-      //printf("Received UE TX samples for antenna %d, nsamps %d (%d)\n",antenna_index,nsamps,(int)(bytes_received>>2));
-    } else {
-      memcpy(&tx_buffer_UE[antenna_index][timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE)],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t),(nsamps<<2));
-    }
-
-    //printf("Received UE TX samples for antenna %d, nsamps %d (%d)\n",antenna_index,nsamps,(int)(bytes_received>>2));
-
-    while (sync_UE_rx[antenna_index]==0)
-      nanosleep(&time_req_1us,&time_rem_1us);
-
-    pthread_mutex_lock(&sync_UE_mutex[antenna_index]);
-    sync_UE_rx[antenna_index]++;
-
-    if (!sync_UE_rx[antenna_index]) {
-      counter_UE_tx[antenna_index]=(counter_UE_tx[antenna_index]+nsamps)%FRAME_MAX_SIZE;
-      nsamps_UE[antenna_index]=nsamps;
-    } else {
-      printf("rrh_eNB_proc thread is busy, will exit\n");
-      exit(-1);
-    }
-
-    pthread_mutex_unlock(&sync_UE_mutex[antenna_index]);
-
-    clock_gettime(CLOCK_MONOTONIC,&time2);
-
-    memcpy(&time0,&time2,sizeof(struct timespec));
-
-  }
-
-  return(0);
-
-}
-
-
-
-void *rrh_UE_thread(void *arg)
-{
-
-  int sockid=-1;
-  struct sockaddr_in serveraddr;
-  struct sockaddr clientaddr;
-  socklen_t clientaddrlen;
-  rrh_desc_t *rrh_desc = (rrh_desc_t *)arg;
-  char str[INET_ADDRSTRLEN];
-  //int8_t msg_header[4+sizeof(openair0_timestamp)];
-  int8_t buf[BUF_LEN];
-  int16_t cmd;   //,nsamps,antenna_index;
-  ssize_t bytes_received;
-  //  struct timespec time_rem;
-  //  ssize_t bytes_sent;
-  //  openair0_timestamp temp;
-  //  openair0_timestamp last_hw_counter=0;
-  struct timespec time_req_1us, time_rem_1us;
-
-  rrh_UE_desc_t rrh_UE_desc;
-  pthread_t UE_rx_thread, UE_tx_thread;
-  pthread_attr_t attr_UE_rx, attr_UE_tx;
-  struct sched_param sched_param_UE_rx, sched_param_UE_tx;
-  int error_code_UE_rx, error_code_UE_tx;
-
-  time_req_1us.tv_sec = 0;
-  time_req_1us.tv_nsec = 1000;
-
-  while (rrh_exit==0) {
-
-
-    sockid=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
-
-    if (sockid==-1) {
-      perror("Cannot create UE socket: ");
-      rrh_exit=1;
-    }
-
-
-    bzero((char *)&serveraddr,sizeof(serveraddr));
-    serveraddr.sin_family=AF_INET;
-    serveraddr.sin_port=htons(rrh_desc->UE_port);
-    inet_pton(AF_INET,rrh_desc->UE_dest_ip,&serveraddr.sin_addr.s_addr);
-
-    inet_ntop(AF_INET, &(serveraddr.sin_addr), str, INET_ADDRSTRLEN);
-    printf("Binding to UE socket for %s:%d\n",str,ntohs(serveraddr.sin_port));
-
-    if (bind(sockid,(struct sockaddr *)&serveraddr,sizeof(serveraddr))<0) {
-      perror("Cannot bind to UE socket: ");
-      rrh_exit = 1;
-    }
-
-    // now wait for commands from eNB
-
-    // get header info
-    bzero((void*)&clientaddr,sizeof(struct sockaddr));
-    clientaddrlen = sizeof(struct sockaddr);
-    //printf("Waiting for UE ...\n");
-
-    bytes_received = recvfrom(sockid,buf,BUF_LEN,0,&clientaddr,&clientaddrlen);
-    cmd = buf[0];
-
-    rrh_UE_desc.antenna_index_UE_rx = cmd>>1;
-    rrh_UE_desc.antenna_index_UE_tx = cmd>>1;
-    //rrh_eNB_desc.timestamp_eNB_tx[rrh_eNB_desc.antenna_index_eNB_tx] = *(openair0_timestamp*)(buf+4);  //we don't need timestamp when receiving the first command
-    rrh_UE_desc.nsamps = *(int16_t *)(buf+2);
-    rrh_UE_desc.sockid_UE = sockid;
-    rrh_UE_desc.clientaddr = clientaddr;
-    rrh_UE_desc.clientaddrlen = clientaddrlen;
-
-    cmd = cmd&1;
-    inet_ntop(AF_INET, &(((struct sockaddr_in*)&clientaddr)->sin_addr), str, INET_ADDRSTRLEN);
-
-    if (cmd==START_CMD) {
-
-      pthread_attr_init(&attr_UE_rx);
-      pthread_attr_init(&attr_UE_tx);
-      sched_param_UE_rx.sched_priority = sched_get_priority_max(SCHED_FIFO);
-      sched_param_UE_tx.sched_priority = sched_get_priority_max(SCHED_FIFO);
-      pthread_attr_setschedparam(&attr_UE_rx,&sched_param_UE_rx);
-      pthread_attr_setschedparam(&attr_UE_tx,&sched_param_UE_tx);
-      pthread_attr_setschedpolicy(&attr_UE_rx,SCHED_FIFO);
-      pthread_attr_setschedpolicy(&attr_UE_tx,SCHED_FIFO);
-
-      error_code_UE_rx = pthread_create(&UE_rx_thread, &attr_UE_rx, rrh_UE_rx_thread, (void *)&rrh_UE_desc);
-      error_code_UE_tx = pthread_create(&UE_tx_thread, &attr_UE_tx, rrh_UE_tx_thread, (void *)&rrh_UE_desc);
-
-      if (error_code_UE_rx) {
-        printf("Error while creating UE RX thread\n");
-        exit(-1);
-      }
-
-      if (error_code_UE_tx) {
-        printf("Error while creating UE TX thread\n");
-        exit(-1);
-      }
-
-      while (rrh_exit==0)
-        sleep(1);
-    }
-  }
-
-  close(sockid);
-
-  rrh_UE_thread_status = 0;
-  pthread_exit(&rrh_UE_thread_status);
-
-  return(0);
-}
-
-
-
-void *rrh_eNB_rx_thread(void *arg)
-{
-
-  struct sockaddr clientaddr;
-  socklen_t clientaddrlen;
-  rrh_eNB_desc_t *rrh_eNB_rx_desc = (rrh_eNB_desc_t *)arg;
-  struct timespec time0,time1,time2;
-  struct timespec time_req_1us, time_rem_1us;
-  ssize_t bytes_sent;
-  int antenna_index, nsamps;
-  int trace_cnt=0;
-  int sockid;
-  char str[INET_ADDRSTRLEN];
-  unsigned long long max_rx_time=0, min_rx_time=133333, total_rx_time=0, average_rx_time=133333, s_period=0, trial=0;
-
-  openair0_timestamp temp, last_hw_counter=0;
-
-  antenna_index =  rrh_eNB_rx_desc->antenna_index_eNB_rx;
-  nsamps = rrh_eNB_rx_desc->nsamps;
-  sockid = rrh_eNB_rx_desc->sockid_eNB;
-
-
-  bzero((void*)&clientaddr,sizeof(struct sockaddr));
-  clientaddrlen = sizeof(struct sockaddr);
-  //printf("Waiting for eNB ...\n");
-  //printf("[RRH eNB RX thread] received parameters : nsamps : %d, antenna_index : %d\n",nsamps,antenna_index);
-  clientaddr = rrh_eNB_rx_desc->clientaddr;
-  clientaddrlen = rrh_eNB_rx_desc->clientaddrlen;
-
-  inet_ntop(AF_INET, &(((struct sockaddr_in*)&clientaddr)->sin_addr), str, INET_ADDRSTRLEN);
-  printf("Received eNB RX request for antenna %d, nsamps %d (from %s:%d)\n",antenna_index,nsamps,str,
-         ntohs(((struct sockaddr_in*)&clientaddr)->sin_port));
-
-  while (rrh_exit == 0) {
-    //printf("Received eNB RX request for antenna %d, nsamps %d (from %s:%d)\n",antenna_index,nsamps,str,
-    //         ntohs(((struct sockaddr_in*)&clientaddr)->sin_port));
-
-    if (!eNB_rx_started) {
-      eNB_rx_started=1; // set this flag to 1 to indicate that eNB started
-
-      if (RT_FLAG==1) {
-        last_hw_counter=hw_counter;
-      }
-    } else {
-      if (RT_FLAG==1) {
-        if (hw_counter > last_hw_counter+1) {
-          printf("L");
-          //      goto end_copy_eNB;
-        } else {
-          while (hw_counter < last_hw_counter+1)
-            nanosleep(&time_req_1us,&time_rem_1us);
-        }
-      }
-    }
-
-    clock_gettime(CLOCK_MONOTONIC,&time1);
-
-    // send return
-    temp=*(openair0_timestamp*)&rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)];
-    *(openair0_timestamp*)&rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)]=timestamp_eNB_rx[antenna_index];
-
-    if ((timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)+nsamps) > FRAME_MAX_SIZE) { // Wrap around if nsamps exceeds the buffer limit
-      if ((timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE < ((timestamp_eNB_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE)) && (UE_tx_started==1)) {
-        printf("eNB underflow\n");
-
-        if (NRT_FLAG==1) {
-          while ((timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE) < nsamps)
-            nanosleep(&time_req_1us,&time_rem_1us);
-        }
-      }
-
-
-      if ((bytes_sent = sendto(sockid,
-                               &rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)],
-                               ((FRAME_MAX_SIZE)<<2) - ((timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE))<<2) + sizeof(openair0_timestamp),
-                               0,
-                               (struct sockaddr*)&clientaddr,
-                               sizeof(struct sockaddr)))<0)
-        perror("RRH eNB : sendto for RX");
-
-      if ((bytes_sent = sendto(sockid,
-                               &rx_buffer_eNB[antenna_index][0],
-                               (nsamps<<2) - ((FRAME_MAX_SIZE)<<2) + ((timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE))<<2),
-                               0,
-                               (struct sockaddr*)&clientaddr,
-                               sizeof(struct sockaddr)))<0)
-        perror("RRH eNB : sendto for RX");
-    } else {
-      if (((timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE)< timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE)
-          && (((timestamp_eNB_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE) > (timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE)) && (UE_tx_started==1)) {
-        printf("eNB underflow\n");
-
-        if (NRT_FLAG==1) {
-          while (((timestamp_eNB_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE) > (timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE))
-            nanosleep(&time_req_1us,&time_rem_1us);
-        }
-      }
-
-      if ((bytes_sent = sendto(sockid,
-                               &rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)],
-                               (nsamps<<2)+sizeof(openair0_timestamp),
-                               0,
-                               (struct sockaddr*)&clientaddr,
-                               sizeof(struct sockaddr)))<0)
-        perror("RRH eNB : sendto for RX");
-
-    }
-
-    //printf("bytes_sent %d(timestamp_eNB_rx[%d] %d)\n",(int)bytes_sent,antenna_index,(int)timestamp_eNB_rx[antenna_index]);
-
-
-    *(openair0_timestamp*)&rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)]=temp;
-    timestamp_eNB_rx[antenna_index]+=nsamps;
-    last_hw_counter=hw_counter;
-
-    clock_gettime(CLOCK_MONOTONIC,&time2);
-
-    if (trace_cnt++ > 10) {
-      total_rx_time = (unsigned int)(time2.tv_nsec - time0.tv_nsec);
-
-      if (total_rx_time < 0) total_rx_time=1000000000-total_rx_time;
-
-      if ((total_rx_time > 0) && (total_rx_time < 1000000000)) {
-        trial++;
-
-        if (total_rx_time < min_rx_time)
-          min_rx_time = total_rx_time;
-
-        if (total_rx_time > max_rx_time)
-          max_rx_time = total_rx_time;
-
-        average_rx_time = (long long unsigned int)((average_rx_time*trial)+total_rx_time)/(trial+1);
-      }
-
-      if (s_period++ == PRINTF_PERIOD) {
-        s_period=0;
-        printf("Average eNB RX time : %lu\tMax RX time : %lu\tMin RX time : %lu\n",average_rx_time,max_rx_time,min_rx_time);
-
-      }
-
-      //printf("RX: t1 %llu (time from last send), t2 %llu (sendto of %lu bytes) total time : %llu\n",(long long unsigned int)(time1.tv_nsec  - time0.tv_nsec), (long long unsigned int)(time2.tv_nsec - time1.tv_nsec),
-      //   (nsamps<<2)+sizeof(openair0_timestamp),(long long unsigned int)(time2.tv_nsec - time0.tv_nsec));
-
-    }
-
-    memcpy(&time0,&time2,sizeof(struct timespec));
-
-
-  }  //while (rrh_exit==0)
-
-  return(0);
-
-}
-
-
-void *rrh_eNB_tx_thread(void *arg)
-{
-
-  struct sockaddr clientaddr;
-  socklen_t clientaddrlen;
-  struct timespec time0a,time0,time1,time2;
-  rrh_eNB_desc_t *rrh_eNB_tx_desc = (rrh_eNB_desc_t *)arg;
-  //  struct timespec time_rem;
-  struct timespec time_req_1us, time_rem_1us;
-  ssize_t bytes_received;
-  int antenna_index, nsamps;
-  int8_t buf[BUF_LEN];
-  int trace_cnt=0;
-  int sockid;
-
-  bzero((void*)&clientaddr,sizeof(struct sockaddr));
-  clientaddrlen = sizeof(struct sockaddr);
-  //printf("Waiting for eNB ...\n");
-
-  antenna_index =  rrh_eNB_tx_desc->antenna_index_eNB_tx;
-  nsamps = rrh_eNB_tx_desc->nsamps;
-  sockid = rrh_eNB_tx_desc->sockid_eNB;
-
-  while (rrh_exit == 0) {
-
-    clock_gettime(CLOCK_MONOTONIC,&time0a);
-
-    bytes_received = recvfrom(sockid,buf,BUF_LEN,0,&clientaddr,&clientaddrlen);
-    timestamp_eNB_tx[antenna_index] = *(openair0_timestamp*)(buf+4);
-
-    clock_gettime(CLOCK_MONOTONIC,&time1);
-
-    if (NRT_FLAG==1) {
-      nrt_eNB_counter[antenna_index]++;
-    }
-
-    //printf("Received eNB TX request for antenna %d, nsamps %d, timestamp %d bytes_received %d\n",antenna_index,nsamps,(int)timestamp_eNB_tx[antenna_index],(int)bytes_received);
-
-    if ((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE)+nsamps) > FRAME_MAX_SIZE) { // Wrap around if nsamps exceeds the buffer limit
-      memcpy(&tx_buffer_eNB[antenna_index][timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE)],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t),
-             ((FRAME_MAX_SIZE)<<2)-((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE))<<2));
-      //printf("Done first part size : %d\n",(int32_t)(((FRAME_MAX_SIZE)<<2)-((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE))<<2)));
-      memcpy(&tx_buffer_eNB[antenna_index][0],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t) + ((FRAME_MAX_SIZE)<<2) -((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE))<<2),
-             (nsamps<<2)-((FRAME_MAX_SIZE)<<2)+((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE))<<2));
-      //printf("Received eNB TX samples for antenna %d, nsamps %d (%d)\n",antenna_index,nsamps,(int)(bytes_received>>2));
-    } else {
-      memcpy(&tx_buffer_eNB[antenna_index][timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE)],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t),nsamps<<2);
-    }
-
-    while (sync_eNB_rx[antenna_index]==0)
-      nanosleep(&time_req_1us,&time_rem_1us);
-
-    //printf("launching eNB proc\n");
-    pthread_mutex_lock(&sync_eNB_mutex[antenna_index]);
-    sync_eNB_rx[antenna_index]++;
-
-    if (!sync_eNB_rx[antenna_index]) {
-      counter_eNB_tx[antenna_index]=(counter_eNB_tx[antenna_index]+nsamps)%FRAME_MAX_SIZE;
-      nsamps_eNB[antenna_index]=nsamps;
-    } else {
-      printf("rrh_eNB_proc thread is busy, will exit\n");
-      exit(-1);
-    }
-
-    pthread_mutex_unlock(&sync_eNB_mutex[antenna_index]);
-
-    clock_gettime(CLOCK_MONOTONIC,&time2);
-
-    //if (trace_cnt++ < 10)
-    //  printf("TX: t0 %llu (time from previous run) t1 %llu (time of memcpy TX samples), t2 %llu (total time)\n",(long long unsigned int)(time1.tv_nsec  - time0.tv_nsec),
-    //   (long long unsigned int)(time2.tv_nsec  - time1.tv_nsec),
-    //   (long long unsigned int)(time2.tv_nsec - time0.tv_nsec));
-
-    memcpy(&time0,&time2,sizeof(struct timespec));
-
-
-
-  }
-
-  return(0);
-
-}
-
-void *rrh_eNB_thread(void *arg)
-{
-
-  int sockid=-1;
-  struct sockaddr_in serveraddr;
-  struct sockaddr clientaddr;
-  socklen_t clientaddrlen;
-  rrh_desc_t *rrh_desc = (rrh_desc_t *)arg;
-  char str[INET_ADDRSTRLEN];
-  //int8_t msg_header[4+sizeof(openair0_timestamp)];
-  int8_t buf[BUF_LEN];
-  int16_t cmd;   //,nsamps,antenna_index;
-  ssize_t bytes_received;
-  //ssize_t bytes_sent;
-  //openair0_timestamp temp, last_hw_counter=0;
-  //struct timespec time_rem;
-  struct timespec time_req_1us, time_rem_1us;
-  //struct timespec time0a,time0,time1,time2;
-  //int trace_cnt=0;
-  rrh_eNB_desc_t rrh_eNB_desc;
-  pthread_t eNB_rx_thread, eNB_tx_thread;
-  pthread_attr_t attr_eNB_rx, attr_eNB_tx;
-  struct sched_param sched_param_eNB_rx, sched_param_eNB_tx;
-  int error_code_eNB_rx, error_code_eNB_tx;
-
-  time_req_1us.tv_sec = 0;
-  time_req_1us.tv_nsec = 1000;
-
-
-  while (rrh_exit==0) {
-
-
-    sockid=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
-
-    if (sockid==-1) {
-      perror("Cannot create eNB socket: ");
-      rrh_exit=1;
-    }
-
-
-    bzero((char *)&serveraddr,sizeof(serveraddr));
-    serveraddr.sin_family=AF_INET;
-    serveraddr.sin_port=htons(rrh_desc->eNB_port);
-    inet_pton(AF_INET,rrh_desc->eNB_dest_ip,&serveraddr.sin_addr.s_addr);
-
-    inet_ntop(AF_INET, &(serveraddr.sin_addr), str, INET_ADDRSTRLEN);
-    printf("Binding to eNB socket for %s:%d\n",str,ntohs(serveraddr.sin_port));
-
-    if (bind(sockid,(struct sockaddr *)&serveraddr,sizeof(serveraddr))<0) {
-      perror("Cannot bind to eNB socket: ");
-      rrh_exit = 1;
-    }
-
-    // now wait for commands from eNB
-
-    // get header info
-    bzero((void*)&clientaddr,sizeof(struct sockaddr));
-    clientaddrlen = sizeof(struct sockaddr);
-    //printf("Waiting for eNB ...\n");
-
-
-
-    bytes_received = recvfrom(sockid,buf,BUF_LEN,0,&clientaddr,&clientaddrlen);
-    cmd = buf[0];
-    rrh_eNB_desc.antenna_index_eNB_rx = cmd>>1;
-    rrh_eNB_desc.antenna_index_eNB_tx = cmd>>1;
-    //rrh_eNB_desc.timestamp_eNB_tx[rrh_eNB_desc.antenna_index_eNB_tx] = *(openair0_timestamp*)(buf+4);  //we don't need timestamp when receiving the first command
-    rrh_eNB_desc.nsamps = *(int16_t *)(buf+2);
-    rrh_eNB_desc.sockid_eNB = sockid;
-    rrh_eNB_desc.clientaddr = clientaddr;
-    rrh_eNB_desc.clientaddrlen = clientaddrlen;
-
-    //cmd = cmd&1;
-    cmd = cmd|1;//in order to make cmd evalution dummy (the first message from lte to rrh has changed, see: @ethernet_lib.c trx_start_func has been substituted by trx_request_func )
-    inet_ntop(AF_INET, &(((struct sockaddr_in*)&clientaddr)->sin_addr), str, INET_ADDRSTRLEN);
-    
-    if (cmd==START_CMD) {
-
-      pthread_attr_init(&attr_eNB_rx);
-      pthread_attr_init(&attr_eNB_tx);
-      sched_param_eNB_rx.sched_priority = sched_get_priority_max(SCHED_FIFO);
-      sched_param_eNB_tx.sched_priority = sched_get_priority_max(SCHED_FIFO);
-      pthread_attr_setschedparam(&attr_eNB_rx,&sched_param_eNB_rx);
-      pthread_attr_setschedparam(&attr_eNB_tx,&sched_param_eNB_tx);
-      pthread_attr_setschedpolicy(&attr_eNB_rx,SCHED_FIFO);
-      pthread_attr_setschedpolicy(&attr_eNB_tx,SCHED_FIFO);
-
-      error_code_eNB_rx = pthread_create(&eNB_rx_thread, &attr_eNB_rx, rrh_eNB_rx_thread, (void *)&rrh_eNB_desc);
-      error_code_eNB_tx = pthread_create(&eNB_tx_thread, &attr_eNB_tx, rrh_eNB_tx_thread, (void *)&rrh_eNB_desc);
-
-      if (error_code_eNB_rx) {
-        printf("Error while creating eNB RX thread\n");
-        exit(-1);
-      }
-
-      if (error_code_eNB_tx) {
-        printf("Error while creating eNB TX thread\n");
-        exit(-1);
-      }
-
-      while (rrh_exit==0)
-        sleep(1);
-
-    }
-
-
-  }  //while (rrh_exit==0)
-
-  close(sockid);
-
-  rrh_eNB_thread_status = 0;
-  pthread_exit(&rrh_eNB_thread_status);
-
-  return(0);
-}
-
-
-void signal_handler(int sig)
-{
-  void *array[10];
-  size_t size;
-
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    printf("trying to exit gracefully...\n");
-    rrh_exit = 1;
-  }
-}
-
-int main(int argc, char **argv)
-{
-
-  pthread_t main_rrh_eNB_thread, main_rrh_UE_thread, main_rrh_proc_eNB_thread, main_rrh_proc_UE_thread, main_timer_proc_thread;
-  pthread_attr_t attr, attr_proc, attr_timer;
-  struct sched_param sched_param_rrh, sched_param_rrh_proc, sched_param_timer;
-  int error_code_eNB, error_code_UE, error_code_proc_eNB, error_code_proc_UE, error_code_timer;
-  int i;
-  int opt;
-  int nsecs=0, rt_period=0;
-  rrh_desc_t rrh;
-  struct itimerspec timer;
-
-
-  rrh.time_req.tv_sec = 0;
-  rrh.time_req.tv_nsec = 0;
-
-  rrh.eNB_port = RRH_eNB_PORT;
-  strcpy(rrh.eNB_dest_ip,RRH_eNB_DEST_IP);
-  rrh.UE_port = RRH_UE_PORT;
-  strcpy(rrh.UE_dest_ip ,RRH_UE_DEST_IP);
-
-  nsecs = 0;
-
-  while ((opt = getopt(argc, argv, "t:rE:U:")) != -1) {
-    switch (opt) {
-    case 't':
-      rt_period = atoi(optarg);
-      RT_FLAG=1;
-      NRT_FLAG=0;
-      break;
-
-    case 'r':
-      rt_period = DEFAULT_PERIOD_NS;
-      RT_FLAG=1;
-      NRT_FLAG=0;
-      break;
-
-    case 'E':
-      strcpy(rrh.eNB_dest_ip,optarg);
-      break;
-
-    case 'U':
-      strcpy(rrh.UE_dest_ip,optarg);
-      break;
-
-    default: /* '?' */
-      fprintf(stderr, "Usage: %s [-d nsecs]\n", argv[0]);
-      exit(-1);
-    }
-  }
-
-  //          if (optind >= argc) {
-  //              fprintf(stderr, "Expected argument after options\n");
-  //              exit(EXIT_FAILURE);
-  //          }
-
-  // setup the timer (1s delay, 1s reload)
-  timer.it_value.tv_sec = rt_period/1000000000;
-  timer.it_value.tv_nsec = rt_period%1000000000;
-  timer.it_interval.tv_sec = rt_period/1000000000;
-  timer.it_interval.tv_nsec = rt_period%1000000000;
-
-
-  // to make a graceful exit when ctrl-c is pressed
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-
-
-  pthread_attr_init(&attr);
-  sched_param_rrh.sched_priority = sched_get_priority_max(SCHED_FIFO);
-  pthread_attr_init(&attr_proc);
-  sched_param_rrh_proc.sched_priority = sched_get_priority_max(SCHED_FIFO-1);
-  pthread_attr_init(&attr_timer);
-  sched_param_timer.sched_priority = sched_get_priority_max(SCHED_FIFO-2);
-
-  pthread_attr_setschedparam(&attr,&sched_param_rrh);
-  pthread_attr_setschedpolicy(&attr,SCHED_FIFO);
-  pthread_attr_setschedparam(&attr_proc,&sched_param_rrh_proc);
-  pthread_attr_setschedpolicy(&attr_proc,SCHED_FIFO-1);
-  pthread_attr_setschedparam(&attr_timer,&sched_param_timer);
-  pthread_attr_setschedpolicy(&attr_timer,SCHED_FIFO-2);
-
-  for (i=0; i<4; i++) {
-    pthread_mutex_init(&sync_eNB_mutex[i],NULL);
-    pthread_cond_init(&sync_eNB_cond[i],NULL);
-    pthread_mutex_init(&sync_UE_mutex[i],NULL);
-    pthread_cond_init(&sync_UE_cond[i],NULL);
-  }
-
-  pthread_mutex_init(&timer_mutex,NULL);
-
-  error_code_eNB = pthread_create(&main_rrh_eNB_thread, &attr, rrh_eNB_thread, (void *)&rrh);
-  error_code_UE = pthread_create(&main_rrh_UE_thread, &attr, rrh_UE_thread, (void *)&rrh);
-  error_code_proc_UE = pthread_create(&main_rrh_proc_UE_thread, &attr_proc, rrh_proc_UE_thread, NULL);
-  error_code_proc_eNB = pthread_create(&main_rrh_proc_eNB_thread, &attr_proc, rrh_proc_eNB_thread, NULL);
-  error_code_timer = pthread_create(&main_timer_proc_thread, &attr_timer, timer_proc, (void *)&timer);
-
-  if (error_code_eNB) {
-    printf("Error while creating eNB thread\n");
-    exit(-1);
-  }
-
-  if (error_code_UE) {
-    printf("Error while creating UE thread\n");
-    exit(-1);
-  }
-
-  if (error_code_proc_UE) {
-    printf("Error while creating UE proc thread\n");
-    exit(-1);
-  }
-
-  if (error_code_proc_eNB) {
-    printf("Error while creating eNB proc thread\n");
-    exit(-1);
-  }
-
-  if (error_code_timer) {
-    printf("Error while creating timer proc thread\n");
-    exit(-1);
-  }
-
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-
-  while (rrh_exit==0)
-    sleep(1);
-
-
-  //pthread_join(main_rrh_eNB_thread,&rrh_eNB_thread_status);
-  return 0;
-}
diff --git a/targets/RT/USER/rrh.gtkw b/targets/RT/USER/rrh.gtkw
deleted file mode 100644
index 891f23ada52417ffd360f617eab2eeecd2ef16cd..0000000000000000000000000000000000000000
--- a/targets/RT/USER/rrh.gtkw
+++ /dev/null
@@ -1,195 +0,0 @@
-[*]
-[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
-[*] Fri Jan 29 16:34:46 2016
-[*]
-[dumpfile] "/tmp/openair_dump_rrh.vcd"
-[dumpfile_mtime] "Fri Jan 29 16:20:55 2016"
-[dumpfile_size] 224259458
-[savefile] "/home/guepe/openairinterface5g_rrh/openairinterface5g/targets/RT/USER/rrh.gtkw"
-[timestart] 31315875900
-[size] 1004 1028
-[pos] 926 -1
-*-17.429794 31316090054 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-[sst_width] 224
-[signals_width] 261
-[sst_expanded] 1
-[sst_vpaned_height] 278
-@24
-[color] 1
-variables.hw_frame_rx[63:0]
-[color] 1
-variables.hw_subframe_rx[63:0]
-@28
-[color] 1
-functions.eNB_rx
-functions.eNB_rx_sleep
-[color] 3
-functions.trx_read_rf
-[color] 7
-functions.trx_write
-@c00024
-variables.rxcnt[63:0]
-@28
-(0)variables.rxcnt[63:0]
-(1)variables.rxcnt[63:0]
-(2)variables.rxcnt[63:0]
-(3)variables.rxcnt[63:0]
-(4)variables.rxcnt[63:0]
-(5)variables.rxcnt[63:0]
-(6)variables.rxcnt[63:0]
-(7)variables.rxcnt[63:0]
-(8)variables.rxcnt[63:0]
-(9)variables.rxcnt[63:0]
-(10)variables.rxcnt[63:0]
-(11)variables.rxcnt[63:0]
-(12)variables.rxcnt[63:0]
-(13)variables.rxcnt[63:0]
-(14)variables.rxcnt[63:0]
-(15)variables.rxcnt[63:0]
-(16)variables.rxcnt[63:0]
-(17)variables.rxcnt[63:0]
-(18)variables.rxcnt[63:0]
-(19)variables.rxcnt[63:0]
-(20)variables.rxcnt[63:0]
-(21)variables.rxcnt[63:0]
-(22)variables.rxcnt[63:0]
-(23)variables.rxcnt[63:0]
-(24)variables.rxcnt[63:0]
-(25)variables.rxcnt[63:0]
-(26)variables.rxcnt[63:0]
-(27)variables.rxcnt[63:0]
-(28)variables.rxcnt[63:0]
-(29)variables.rxcnt[63:0]
-(30)variables.rxcnt[63:0]
-(31)variables.rxcnt[63:0]
-(32)variables.rxcnt[63:0]
-(33)variables.rxcnt[63:0]
-(34)variables.rxcnt[63:0]
-(35)variables.rxcnt[63:0]
-(36)variables.rxcnt[63:0]
-(37)variables.rxcnt[63:0]
-(38)variables.rxcnt[63:0]
-(39)variables.rxcnt[63:0]
-(40)variables.rxcnt[63:0]
-(41)variables.rxcnt[63:0]
-(42)variables.rxcnt[63:0]
-(43)variables.rxcnt[63:0]
-(44)variables.rxcnt[63:0]
-(45)variables.rxcnt[63:0]
-(46)variables.rxcnt[63:0]
-(47)variables.rxcnt[63:0]
-(48)variables.rxcnt[63:0]
-(49)variables.rxcnt[63:0]
-(50)variables.rxcnt[63:0]
-(51)variables.rxcnt[63:0]
-(52)variables.rxcnt[63:0]
-(53)variables.rxcnt[63:0]
-(54)variables.rxcnt[63:0]
-(55)variables.rxcnt[63:0]
-(56)variables.rxcnt[63:0]
-(57)variables.rxcnt[63:0]
-(58)variables.rxcnt[63:0]
-(59)variables.rxcnt[63:0]
-(60)variables.rxcnt[63:0]
-(61)variables.rxcnt[63:0]
-(62)variables.rxcnt[63:0]
-(63)variables.rxcnt[63:0]
-@1401200
--group_end
-@24
-variables.pck_rx[63:0]
-variables.rx_ts[63:0]
-@c00024
-variables.tx_seq_num[63:0]
-@28
-(0)variables.tx_seq_num[63:0]
-(1)variables.tx_seq_num[63:0]
-(2)variables.tx_seq_num[63:0]
-(3)variables.tx_seq_num[63:0]
-(4)variables.tx_seq_num[63:0]
-(5)variables.tx_seq_num[63:0]
-(6)variables.tx_seq_num[63:0]
-(7)variables.tx_seq_num[63:0]
-(8)variables.tx_seq_num[63:0]
-(9)variables.tx_seq_num[63:0]
-(10)variables.tx_seq_num[63:0]
-(11)variables.tx_seq_num[63:0]
-(12)variables.tx_seq_num[63:0]
-(13)variables.tx_seq_num[63:0]
-(14)variables.tx_seq_num[63:0]
-(15)variables.tx_seq_num[63:0]
-(16)variables.tx_seq_num[63:0]
-(17)variables.tx_seq_num[63:0]
-(18)variables.tx_seq_num[63:0]
-(19)variables.tx_seq_num[63:0]
-(20)variables.tx_seq_num[63:0]
-(21)variables.tx_seq_num[63:0]
-(22)variables.tx_seq_num[63:0]
-(23)variables.tx_seq_num[63:0]
-(24)variables.tx_seq_num[63:0]
-(25)variables.tx_seq_num[63:0]
-(26)variables.tx_seq_num[63:0]
-(27)variables.tx_seq_num[63:0]
-(28)variables.tx_seq_num[63:0]
-(29)variables.tx_seq_num[63:0]
-(30)variables.tx_seq_num[63:0]
-(31)variables.tx_seq_num[63:0]
-(32)variables.tx_seq_num[63:0]
-(33)variables.tx_seq_num[63:0]
-(34)variables.tx_seq_num[63:0]
-(35)variables.tx_seq_num[63:0]
-(36)variables.tx_seq_num[63:0]
-(37)variables.tx_seq_num[63:0]
-(38)variables.tx_seq_num[63:0]
-(39)variables.tx_seq_num[63:0]
-(40)variables.tx_seq_num[63:0]
-(41)variables.tx_seq_num[63:0]
-(42)variables.tx_seq_num[63:0]
-(43)variables.tx_seq_num[63:0]
-(44)variables.tx_seq_num[63:0]
-(45)variables.tx_seq_num[63:0]
-(46)variables.tx_seq_num[63:0]
-(47)variables.tx_seq_num[63:0]
-(48)variables.tx_seq_num[63:0]
-(49)variables.tx_seq_num[63:0]
-(50)variables.tx_seq_num[63:0]
-(51)variables.tx_seq_num[63:0]
-(52)variables.tx_seq_num[63:0]
-(53)variables.tx_seq_num[63:0]
-(54)variables.tx_seq_num[63:0]
-(55)variables.tx_seq_num[63:0]
-(56)variables.tx_seq_num[63:0]
-(57)variables.tx_seq_num[63:0]
-(58)variables.tx_seq_num[63:0]
-(59)variables.tx_seq_num[63:0]
-(60)variables.tx_seq_num[63:0]
-(61)variables.tx_seq_num[63:0]
-(62)variables.tx_seq_num[63:0]
-(63)variables.tx_seq_num[63:0]
-@1401200
--group_end
-@24
-variables.hw_frame[63:0]
-variables.hw_subframe[63:0]
-@28
-[color] 1
-functions.eNB_tx
-functions.eNB_tx_sleep
-[color] 7
-functions.trx_read
-[color] 3
-functions.trx_write_rf
-@24
-variables.txcnt[63:0]
-variables.pck_tx[63:0]
-variables.tx_ts[63:0]
-@25
-variables.rx_seq_num_prv[63:0]
-@24
-variables.rx_seq_num[63:0]
-variables.hw_cnt_rx[63:0]
-variables.lhw_cnt_rx[63:0]
-[color] 3
-variables.cnt[63:0]
-[pattern_trace] 1
-[pattern_trace] 0
diff --git a/targets/RT/USER/rrh_gw.c b/targets/RT/USER/rrh_gw.c
deleted file mode 100644
index e73c9ef4ebe0455db9a51b4c74dd908994df0cdf..0000000000000000000000000000000000000000
--- a/targets/RT/USER/rrh_gw.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-
-/*! \file rrh_gw.h
- * \brief top-level for the remote radio head gateway (RRH_gw) module reusing the ethernet library 
- * \author Navid Nikaein,  Katerina Trilyraki, Raymond Knopp
- * \date 2015
- * \version 0.1
- * \company Eurecom
- * \maintainer:  navid.nikaein@eurecom.fr
- * \note
- * \warning very experimental 
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <execinfo.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <time.h>
-
-#include "common_lib.h"
-#include "rrh_gw.h"
-#include "rt_wrapper.h"
-#include "rrh_gw_externs.h"
-
-
-#include "log_if.h"
-#include "log_extern.h"
-#include "vcd_signal_dumper.h"
-
-/*****************************************************************************************
- *                                                                        ----------     *
- *     -------    RRH_BBU_IF    -------    RRH_RF_IF     -------USRP      - COTS_UE-     *
- *     - BBU - ---------------  - RRH -  -------------   -------BLADERF   ----------     *
- *     -------                  -------                  -------EXMIMO                   *
- *                                                                        ---------      *
- *                                                       -------ETH_IF    - EMU_UE-      *
- *                                                                        ---------      *                              
- *****************************************************************************************/
-
-
-/* local IP/MAC address is detected*/
-char rrh_ip[20] = "0.0.0.0"; 
-unsigned char rrh_mac[20] = "0:0:0:0:0:0";
-int  rrh_port = 50000; // has to be an option
-
-/* log */
-int16_t           glog_level          = LOG_DEBUG;
-int16_t           glog_verbosity      = LOG_MED;
-int16_t           rrh_log_level       = LOG_INFO;
-int16_t           rrh_log_verbosity   = LOG_MED;
-int16_t           enb_log_level       = LOG_INFO;
-int16_t           enb_log_verbosity   = LOG_MED;
-int16_t           ue_log_level        = LOG_INFO;
-int16_t           ue_log_verbosity    = LOG_MED;
-
-
-/* flag definitions */
-uint8_t 	eNB_flag=0;
-uint8_t 	UE_flag=0;
-uint8_t 	EXMIMO_flag=0;
-uint8_t 	USRP_flag=0;
-uint8_t 	RT_flag=0, NRT_flag=1;
-uint8_t 	rrh_exit=0;
-uint8_t         loopback_flag=0;
-uint8_t         measurements_flag=0;
-
-/* Default operation as RRH:
-   - there are neither eNB nor UE modules
-   - no RF hardware is specified (NONE_IF)
-   - default ethernet interface is local */
-uint8_t 	    num_eNB_mod=0;
-uint8_t 	    num_UE_mod=0;
-char*           if_name="lo";
-uint8_t         eth_mode=ETH_UDP_MODE;
-
-rrh_module_t 	        *enb_array;
-rrh_module_t            *ue_array;
-
-openair0_vtimestamp 	hw_counter=0;
-
-char   rf_config_file[1024];
-
-static void debug_init(void);
-static void get_options(int argc, char *argv[]);
-static void print_help(void);
-
-/*!\fn static rrh_module_t new_module(unsigned int id);
-* \brief creation of a eNB/UE module
-* \param[in] module id
-* \return module
-* \note
-* @ingroup  _oai
-*/
-static rrh_module_t new_module(unsigned int id);
-
-/*!\fn static int get_address(char* if_name, uint8_t flag);
- * \brief retrieves IP address from the specified network interface
- * \param[in] name of network interface
- * \return 0 
- * \note
- * @ingroup  _oai
- */
-static int get_address(char* if_name, uint8_t flag);
-
-
-
-
-
-int main(int argc, char **argv) {
-  
-  unsigned int i;
-  rf_config_file[0]='\0';
-  /* parse input arguments */
-  get_options(argc, argv);
-  /* initialize logger and signal analyzer */
-  debug_init();
-  /* */
-  set_latency_target();
-  /* make a graceful exit when ctrl-c is pressed */
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-  
-  /* create modules based on input arguments */
-  if (eNB_flag==1){    
-    enb_array=(rrh_module_t*)malloc(num_eNB_mod*sizeof(rrh_module_t));	
-    for(i=0;i<num_eNB_mod;i++){  
-      enb_array[i]=new_module(i);//enb_array[i]=new_module(i, get_RF_interfaces(&hardware_target));	
-      config_BBU_mod(&enb_array[i],RT_flag,NRT_flag);
-      LOG_I(RRH,"[eNB %d] module(s) created (out of %u) \n",i,num_eNB_mod);		
-    }
-  }
-  if (UE_flag==1){    
-    ue_array=(rrh_module_t*)malloc(num_UE_mod*sizeof(rrh_module_t));	
-    for(i=0;i<num_UE_mod;i++){
-      ue_array[i]=new_module(i);
-      config_UE_mod(&ue_array[i],RT_flag,NRT_flag);			
-      LOG_I(RRH,"[UE %d] module(s) created (out of %u)\n",i, num_UE_mod);
-    }
-  }
- 
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-  
-  while (rrh_exit==0)
-    sleep(1);
-
-  return EXIT_SUCCESS;
-}
-
-
-static rrh_module_t new_module (unsigned int id) {
-
-  rrh_module_t 	  	rrh_mod;
-  openair0_config_t 	openair0_cfg;
-
-  rrh_mod.id=id;
-  rrh_mod.loopback=loopback_flag;
-  rrh_mod.measurements=measurements_flag;
-
-  /* each module is associated with an ethernet device */
-  rrh_mod.eth_dev.type=NONE_DEV;
-  rrh_mod.eth_dev.transp_type=NONE_TP;
-  /* ethernet device is functioning within RRH */
-  rrh_mod.eth_dev.host_type=RRH_HOST;
-  /* */
-  rrh_mod.eth_dev.openair0_cfg = (openair0_config_t*)malloc(sizeof(openair0_config_t));
-  memset(rrh_mod.eth_dev.openair0_cfg,0,sizeof(openair0_config_t));
-  /* get IP and MAC address */
-  get_address(if_name,eth_mode);
-  
-  if(eth_mode==ETH_UDP_MODE) {
-    openair0_cfg.my_addr = &rrh_ip[0];
-    openair0_cfg.my_port = rrh_port;
-    LOG_I(RRH,"UDP mode selected for ethernet.\n");
-  } else if (eth_mode==ETH_RAW_MODE) {
-    openair0_cfg.my_addr = (char*)&rrh_mac[0];
-    openair0_cfg.my_port = rrh_port;
-    LOG_I(RRH,"RAW mode selected for ethernet.\n");
-  } 
-
-  /* */
-  eth_params_t *eth_params = (eth_params_t*)malloc(sizeof(eth_params_t));
-  memset(eth_params, 0, sizeof(eth_params_t));
-  eth_params->local_if_name     = if_name;
-  eth_params->transp_preference = eth_mode;
-
-  /* ethernet device initialization */
-  if (openair0_transport_load(&rrh_mod.eth_dev, &openair0_cfg,eth_params)<0) {
-    LOG_E(RRH,"Exiting, cannot initialize ethernet interface.\n");
-    exit(-1);
-  }
-
-  /* allocate space and specify associated RF device */
-  openair0_device *oai_dv = (openair0_device *)malloc(sizeof(openair0_device));
-  memset(oai_dv,0,sizeof(openair0_device));
-
-  rrh_mod.devs=oai_dv;   
-  rrh_mod.devs->type=NONE_DEV;
-  rrh_mod.devs->transp_type=NONE_TP;
-  rrh_mod.devs->host_type=RRH_HOST; 
-
-  return rrh_mod;
-}
-
-static void debug_init(void) {
-  
-  /* log initialization */
-  logInit();
-  set_glog(glog_level,  glog_verbosity);
-  
-  set_comp_log(RRH,     rrh_log_level,   rrh_log_verbosity, 1);
-  //set_comp_log(ENB_LOG, enb_log_level,   enb_log_verbosity, 1);
-  //set_comp_log(UE_LOG,  ue_log_level,    ue_log_verbosity,  1);
-  
-  /* vcd initialization */
-  if (ouput_vcd) {
-    vcd_signal_dumper_init("/tmp/openair_dump_rrh.vcd");
-    
-  }
-}
-
-
-static void get_options(int argc, char *argv[]) {
-
-  int 	opt;
-
-  while ((opt = getopt(argc, argv, "xvhlte:n:u:g:r:m:i:f:")) != -1) {
-    
-    switch (opt) {
-    case 'n':
-      eNB_flag=1;
-      num_eNB_mod=atoi(optarg);
-      break;
-    case 'u':
-      UE_flag=1;
-      num_UE_mod=atoi(optarg);
-      break;
-    case 'g':
-      glog_level=atoi(optarg);
-      break;
-    case 'i':  
-      if (optarg) {
-	if_name=strdup(optarg); 
-	printf("RRH interface name is set to %s\n", if_name);	
-      }
-      break;
-    case 'm':  
-      eth_mode=atoi(optarg);      
-      break;
-    case 'r':
-      //rrh_log_level=atoi(optarg);
-      break;
-    case 'e':
-      //enb_log_level=atoi(optarg);
-      break;
-    case 'x':
-      rt_period = DEFAULT_PERIOD_NS;
-      RT_flag=1;
-      NRT_flag=0;
-      break;
-    case 'v':
-      /* extern from vcd */
-      ouput_vcd=1;  
-      break;
-    case 'l':
-      /*In loopback mode rrh sends back to bbu what it receives*/
-      loopback_flag=1; 
-      break;
-    case 'f':
-      if (optarg){
-	if ((strcmp("null", optarg) == 0) || (strcmp("NULL", optarg) == 0)) {
-	  printf("no configuration filename is provided\n");
-	}
-	else if (strlen(optarg)<=1024){
-	  // rf_config_file = strdup(optarg);
-	  strcpy(rf_config_file,optarg);
-	}else {
-	  printf("Configuration filename is too long\n");
-	  exit(-1);   
-	}
-      }
-      break;
-    case 't':
-      /* When measurements are enabled statistics related to TX/RX time are printed */
-      measurements_flag=1; 
-      break;      
-    case 'h':
-      print_help();
-      exit(-1);
-    default: /* '?' */
-      //fprintf(stderr, "Usage: \n", argv[0]);
-      exit(-1);
-  }
-}
-
-}
-
-static int get_address(char* if_name, uint8_t flag) {
-  
-  int fd;
-  struct ifreq ifr;
-    
-  fd = socket(AF_INET, SOCK_DGRAM, 0);  
-  /* I want to get an IPv4 IP address */
-  ifr.ifr_addr.sa_family = AF_INET;  
-  /* I want IP address attached to "if_name" */
-  strncpy(ifr.ifr_name, if_name, IFNAMSIZ-1);
-
-  if (flag==ETH_UDP_MODE) {
-    if ( ioctl(fd, SIOCGIFADDR, &ifr)<0 ) {
-      perror("IOCTL:");
-      exit(-1);
-    } 
-    snprintf(&rrh_ip[0],20,"%s", inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
-    LOG_I(RRH,"%s: IP address: %s\n",if_name,rrh_ip);
-  } else if (flag==ETH_RAW_MODE) {
-    if ( ioctl(fd, SIOCGIFHWADDR, &ifr)<0 ) {
-      perror("IOCTL:");
-      exit(-1);
-    } 
-    ether_ntoa_r ((struct ether_addr *)ifr.ifr_hwaddr.sa_data, (char*)rrh_mac);
-    LOG_I(RRH,"%s: MAC address: %s\n",if_name,rrh_mac);    
-  }
-  
-  close(fd);
-  return 0;
-}
-
-
-static void print_help(void) {
-
-  puts("Usage: \n");
-  puts("     sudo -E chrt 99 ./rrh -n1 -g6 -v -t -i lo -m1");
-  puts("Options:\n");
-  puts("\t -n create eNB module\n");
-  puts("\t -u create UE module\n");
-  puts("\t -g define global log level\n");
-  puts("\t -i set the RRH interface (default lo)\n");
-  puts("\t -m set ethernet mode to be used by RRH, valid options: (1:raw, 0:udp) \n");
-  puts("\t -r define rrh log level\n");
-  puts("\t -e define eNB log level\n");
-  puts("\t -x enable real time bahaviour\n");
-  puts("\t -v enable vcd dump\n");
-  puts("\t -l enable loopback mode\n");
-  puts("\t -t enable measurements\n");
-  puts("\t -h display info\n");
-
-}
-
-
-void *timer_proc(void *arg) {
-
-  timer_t             timerid;    
-  struct itimerspec   *timer= (struct itimerspec *)arg ; // the timer data structure
-  struct itimerspec   old_value;
-
-  
-#ifdef DEADLINE_SCHEDULER
-  struct sched_attr attr;
-  unsigned int flags = 0;
-  
-  attr.size = sizeof(attr);
-  attr.sched_flags = 0;
-  attr.sched_nice = 0;
-  attr.sched_priority = 0;
-  
-  attr.sched_policy   = SCHED_DEADLINE;
-  attr.sched_runtime  =  (0.1  *  100) * 10000; // 
-  attr.sched_deadline =  rt_period-30000;//(0.1  *  100) * 10000; 
-  attr.sched_period   =  rt_period;//(0.1  *  100) * 10000; // each TX/RX thread has, as a function of RT PERIOD ?? 
-  
-  if (sched_setattr(0, &attr, flags) < 0 ) {
-    perror("[SCHED] timer thread: sched_setattr failed\n");
-    exit(-1);
-  }
-#endif  
-  
- if (timer_create (CLOCK_REALTIME, NULL, &timerid) == -1) {
-    fprintf (stderr, "couldn't create a timer\n");
-    perror (NULL);
-    exit (EXIT_FAILURE);
-  }
-  
-  signal(SIGALRM, timer_signal_handler);
-  LOG_I(RRH,"Timer has started!\n");
-  timer_settime (timerid, 0, timer, &old_value);
-
-  while (!rrh_exit) {
-    sleep(1);
-  }
-  
-  timer_delete(timerid);
-  
-  return (0);
-}
-
-
-void timer_signal_handler(int sig) {
-  
-  if (sig == SIGALRM) {
-    pthread_mutex_lock(&timer_mutex);
-    hw_counter ++;
-    pthread_mutex_unlock(&timer_mutex);
-     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_CNT, hw_counter);//USED ELSEWHERE
-  }
-}
-
-
-void signal_handler(int sig) {
-  
-  void *array[10];
-  size_t size;
-  
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-    
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    printf("trying to exit gracefully...\n");
-    rrh_exit = 1;
-  }
-}
-
-void exit_fun(const char* s) {
-  if (s != NULL) {
-    printf("%s %s() Exiting RRH: %s\n",__FILE__, __FUNCTION__, s);
-  }
-  rrh_exit = 1;
-  exit (-1);
-}
-
-
diff --git a/targets/RT/USER/rrh_gw.h b/targets/RT/USER/rrh_gw.h
deleted file mode 100644
index 075cbf3c2b149695b3566cf3634e09d61ddc7cce..0000000000000000000000000000000000000000
--- a/targets/RT/USER/rrh_gw.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file rrh_gw.h
- * \brief header file for remote radio head gateway (RRH_gw) module 
- * \author Navid Nikaein,  Katerina Trilyraki, Raymond Knopp
- * \date 2015
- * \version 0.1
- * \company Eurecom
- * \maintainer:  navid.nikaein@eurecom.fr
- * \note
- * \warning very experimental 
- */
-
-#ifndef RRH_GW_H_
-#define RRH_GW_H_
-
-#include "ethernet_lib.h"
-#include "vcd_signal_dumper.h"
-#include "assertions.h"
-
-#define DEFAULT_PERIOD_NS 200000 /* default value is calculated for 25 PRB */
-#define RRH_UE_PORT 51000
-#define RRH_UE_DEST_IP "127.0.0.1"
-
-/*! \brief RRH supports two types of modules: eNB and UE
-	   each module is associated with an ethernet device (device of ETH_IF) 
-	   and optionally with a RF device (device type can be USRP_B200/USRP_X300/BLADERF_IF/EXMIMO_IF/NONE_IF)
-           UE modules will always have RF device type NONE_IF */
-typedef struct {
-/*! \brief module id */
-  uint8_t id;
-/*! \brief! loopback flag */
-uint8_t loopback;
-/*! \brief measurement flag */
-uint8_t measurements;
-/*! \brief module's ethernet device */
-openair0_device eth_dev;
-/*! \brief pointer to RF module's device (pointer->since it's optional) */
-openair0_device *devs;
-}rrh_module_t;
-
-/*! \fn void timer_signal_handler(int sig)
- * \brief this function
- * \param[in] signal type
- * \return none
- * \note
- * @ingroup  _oai
-*/
-void timer_signal_handler(int);
-
-/*! \fn void *timer_proc(void *arg)
- * \brief this function
- * \param[in]
- * \param[out]
- * \return
- * \note
- * @ingroup  _oai
- */
-void *timer_proc(void *);
-
-/*! \fn void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag,uint8_t NRT_flag)
- * \brief receive and apply configuration to modules' optional device
- * \param[in]  *mod_enb pointer to module 
- * \param[in]   RT_flag real time flag 
- * \return none
- * \note
- * @ingroup  _oai
- */
-void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag);
-
-/*! \fn void  config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag,uint8_t NRT_flag)
- * \brief this function
- * \param[in] *mod_ue pointer to module 
- * \param[in]
- * \return none
- * \note
- * @ingroup  _oai
- */
-void config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag, uint8_t NRT_flag);
-
-
-
-void signal_handler(int sig);
-
-#endif
diff --git a/targets/RT/USER/rt_wrapper.c b/targets/RT/USER/rt_wrapper.c
index 7010abb5c0c6f57866f991dae97615ae267881f1..49fbed625672f9b4b9cc1e1defcb83381ca235c9 100644
--- a/targets/RT/USER/rt_wrapper.c
+++ b/targets/RT/USER/rt_wrapper.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -45,6 +45,8 @@
 #include "rt_wrapper.h"
 #include <errno.h>
 
+#include "openair1/PHY/defs.h"
+
 static int latency_target_fd = -1;
 static int32_t latency_target_value = 0;
 /* Latency trick - taken from cyclictest.c
@@ -345,6 +347,8 @@ void thread_top_init(char *thread_name,
     exit_fun("Error getting thread priority");
   }
 
+  pthread_setname_np(pthread_self(), thread_name);
+
   LOG_I(HW, "[SCHED][eNB] %s started on CPU %d, sched_policy = %s , priority = %d, CPU Affinity=%s \n",thread_name,sched_getcpu(),
                    (policy == SCHED_FIFO)  ? "SCHED_FIFO" :
                    (policy == SCHED_RR)    ? "SCHED_RR" :
diff --git a/targets/RT/USER/rt_wrapper.h b/targets/RT/USER/rt_wrapper.h
index ec623e913b0fe94654a4665bb8c6617bc73ab71e..f9828d0db97e10dba1d20d73b31adba9cb32cc51 100644
--- a/targets/RT/USER/rt_wrapper.h
+++ b/targets/RT/USER/rt_wrapper.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/RT/USER/sleeptest.c b/targets/RT/USER/sleeptest.c
deleted file mode 100644
index 593e62dfac55991976360bfcdf15476cecfe8884..0000000000000000000000000000000000000000
--- a/targets/RT/USER/sleeptest.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file lte-softmodem.c
-* \brief main program to control HW and scheduling
-* \author R. Knopp, F. Kaltenberger
-* \date 2012
-* \version 0.1
-* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
-* \note
-* \warning
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <signal.h>
-#include <execinfo.h>
-#include <getopt.h>
-#include <pthread.h>
-
-#include "rt_wrapper.h"
-
-#define TIMER_ONESHOT_MODE
-#define FRAME_PERIOD 10000000ULL
-#define DAQ_PERIOD 500000ULL
-#define LTE_SLOTS_PER_FRAME  20
-
-#ifdef RTAI
-static SEM *mutex;
-//static CND *cond;
-
-static long int thread0;
-static long int thread1;
-//static long int sync_thread;
-#else
-#define OPENAIR_THREAD_STACK_SIZE    8192
-#define OPENAIR_THREAD_PRIORITY        255
-pthread_t thread0;
-//pthread_t thread1;
-pthread_attr_t attr_dlsch_threads;
-struct sched_param sched_param_dlsch;
-#endif
-
-int oai_exit = 0;
-
-struct timing_info_t {
-  //unsigned int frame, hw_slot, last_slot, next_slot;
-  RTIME time_min, time_max, time_avg, time_last, time_now;
-  //unsigned int mbox0, mbox1, mbox2, mbox_target;
-  unsigned int n_samples;
-} timing_info;
-
-void signal_handler(int sig)
-{
-  void *array[10];
-  size_t size;
-
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    oai_exit=1;
-  }
-}
-
-void exit_fun(const char* s)
-{
-  void *array[10];
-  size_t size;
-
-  printf("Exiting: %s\n",s);
-
-  oai_exit=1;
-  //rt_sleep_ns(FRAME_PERIOD);
-
-  //exit (-1);
-}
-
-int frame=0,slot=0;
-
-/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
-static void *eNB_thread(void *arg)
-{
-#ifdef RTAI
-  RT_TASK *task;
-  RTIME now;
-#endif
-  unsigned char last_slot, next_slot;
-  RTIME time_in, time_diff;
-  int ret;
-
-#ifdef RTAI
-  task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
-  printf("Started eNB thread (id %p)\n",task);
-#ifndef TIMER_ONESHOT_MODE
-  now = rt_get_time();
-  ret = rt_task_make_periodic(task, now, nano2count(DAQ_PERIOD));
-
-  if (ret!=0)
-    printf("Problem with periodic timer\n");
-
-#endif
-#endif
-
-#ifdef HARD_RT
-  rt_make_hard_real_time();
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  timing_info.time_min = 100000000ULL;
-  timing_info.time_max = 0;
-  timing_info.time_avg = 0;
-  timing_info.n_samples = 0;
-
-  while (!oai_exit) {
-    time_in = rt_get_time_ns();
-#ifdef TIMER_ONESHOT_MODE
-    ret = rt_sleep_ns(DAQ_PERIOD);
-
-    if (ret)
-      printf("eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame,time_in,ret);
-
-#else
-    rt_task_wait_period();
-#endif
-    time_diff = rt_get_time_ns() - time_in;
-
-    if (time_diff > timing_info.time_max)
-      timing_info.time_max = time_diff;
-
-    if (time_diff < timing_info.time_min)
-      timing_info.time_min = time_diff;
-
-    timing_info.time_avg = (timing_info.time_avg*timing_info.n_samples + time_diff)/(timing_info.n_samples+1);
-    timing_info.n_samples++;
-
-    last_slot = (slot)%LTE_SLOTS_PER_FRAME;
-
-    if (last_slot <0)
-      last_slot+=20;
-
-    next_slot = (slot+3)%LTE_SLOTS_PER_FRAME;
-
-    slot++;
-
-    if (slot==20) {
-      slot=0;
-      frame++;
-    }
-  }
-
-  printf("eNB_thread: finished, ran %d times.\n",frame);
-
-#ifdef HARD_RT
-  rt_make_soft_real_time();
-#endif
-
-  // clean task
-#ifdef RTAI
-  rt_task_delete(task);
-#endif
-  printf("Task deleted. returning\n");
-  return 0;
-}
-
-
-int main(int argc, char **argv)
-{
-
-#ifdef RTAI
-  RT_TASK *task;
-  RTIME period;
-#else
-  int error_code;
-#endif
-  int i,j,aa;
-  void *status;
-
-  // to make a graceful exit when ctrl-c is pressed
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-
-#ifndef RTAI
-  check_clock();
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-#ifdef RTAI
-  // make main thread LXRT soft realtime
-  task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
-
-  // start realtime timer and scheduler
-#ifdef TIMER_ONESHOT_MODE
-  rt_set_oneshot_mode();
-  start_rt_timer(0);
-  printf("started RTAI timer in oneshot mode\n");
-#else
-  rt_set_periodic_mode();
-  period = start_rt_timer(nano2count(500000));
-  printf("started RTAI timer with period %llu ns\n",count2nano(period));
-#endif
-
-  printf("Init mutex\n");
-  //mutex = rt_get_adr(nam2num("MUTEX"));
-  mutex = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if (mutex==0) {
-    printf("Error init mutex\n");
-    exit(-1);
-  } else
-    printf("mutex=%p\n",mutex);
-
-#endif
-
-  rt_sleep_ns(10*FRAME_PERIOD);
-
-#ifndef RTAI
-  pthread_attr_init (&attr_dlsch_threads);
-  pthread_attr_setstacksize(&attr_dlsch_threads,OPENAIR_THREAD_STACK_SIZE);
-  //attr_dlsch_threads.priority = 1;
-  sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
-  pthread_attr_setschedparam  (&attr_dlsch_threads, &sched_param_dlsch);
-  pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO);
-#endif
-
-#ifdef RTAI
-  thread0 = rt_thread_create(eNB_thread, NULL, 100000000);
-#else
-  error_code = pthread_create(&thread0, &attr_dlsch_threads, eNB_thread, NULL);
-
-  if (error_code!= 0) {
-    printf("[lte-softmodem.c] Could not allocate eNB_thread, error %d\n",error_code);
-    return(error_code);
-  } else {
-    printf("[lte-softmodem.c] Allocate eNB_thread successful\n");
-  }
-
-#endif
-  printf("eNB threads created\n");
-
-
-
-  // wait for end of program
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-
-  //getchar();
-  while (oai_exit==0) {
-
-    printf("eNB Frame %d, hw_slot %d (time %llu): period %llu, sleep time (avg/min/max/samples) %llu / %llu / %llu / %d, ratio %f\n",frame,slot,rt_get_time_ns(),DAQ_PERIOD,timing_info.time_avg,
-           timing_info.time_min,timing_info.time_max,timing_info.n_samples,(double)timing_info.time_avg/DAQ_PERIOD);
-
-
-    rt_sleep_ns(100*FRAME_PERIOD);
-  }
-
-  // stop threads
-#ifdef RTAI
-  rt_thread_join(thread0);
-#else
-  pthread_join(thread0,&status);
-#endif
-
-#ifdef RTAI
-  stop_rt_timer();
-#endif
-
-  return 0;
-}
-
diff --git a/targets/RT/USER/stats.c b/targets/RT/USER/stats.c
index 4d9343f4bc66e42420671902ca11e619611a9508..fa8ab38cb28222ed1b0e7765c98126e8274abe31 100644
--- a/targets/RT/USER/stats.c
+++ b/targets/RT/USER/stats.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/RT/USER/stats.h b/targets/RT/USER/stats.h
index 7be9380852e250e2226742acaed0feee1891fc6b..264c8f7af028556a4aa5f3bbf293e45082e68db6 100644
--- a/targets/RT/USER/stats.h
+++ b/targets/RT/USER/stats.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/RT/USER/synctest.c b/targets/RT/USER/synctest.c
deleted file mode 100644
index 6122f67cd06c05ddbfe2d1049857afda6059896f..0000000000000000000000000000000000000000
--- a/targets/RT/USER/synctest.c
+++ /dev/null
@@ -1,1318 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file lte-softmodem.c
-* \brief main program to control HW and scheduling
-* \author R. Knopp, F. Kaltenberger
-* \date 2012
-* \version 0.1
-* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
-* \note
-* \warning
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <signal.h>
-#include <execinfo.h>
-#include <getopt.h>
-
-#include "rt_wrapper.h"
-
-#include "PHY/types.h"
-//#include "PHY/defs.h"
-#include "openair0_lib.h"
-
-#include "UTIL/LOG/log.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-
-#if defined(ENABLE_ITTI)
-# include "intertask_interface_init.h"
-# include "timer.h"
-# if defined(ENABLE_USE_MME)
-#   include "s1ap_eNB.h"
-#   include "sctp_eNB_task.h"
-# endif
-#endif
-
-#ifdef XFORMS
-#include "PHY/TOOLS/lte_phy_scope.h"
-#include "stats.h"
-// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
-// at eNB 0, an UL scope for every UE
-FD_lte_phy_scope_ue  *form_ue[NUMBER_OF_UE_MAX];
-FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
-FD_stats_form *form_stats=NULL;
-char title[255];
-unsigned char scope_enb_num_ue = 1;
-#endif //XFORMS
-
-#ifdef EMOS
-#include <gps.h>
-#include <rtai_fifos.h>
-
-//#define CHANSOUNDER_FIFO_SIZE 10485760 // 10 Mbytes FIFO
-#define CHANSOUNDER_FIFO_SIZE 20971520  // 20 Mbytes FIFO
-#define CHANSOUNDER_FIFO_MINOR 4               // minor of the FIFO device - this is /dev/rtf3
-#define CHANSOUNDER_FIFO_DEV "/dev/rtf4"
-#endif
-
-#define TIMER_ONESHOT_MODE
-#define FRAME_PERIOD 100000000ULL
-#define DAQ_PERIOD 66667ULL
-#define LTE_SLOTS_PER_FRAME  20
-#define RESAMPLING_FACTOR 2
-#define SAMPLES_PER_SLOT (15360/(1<<RESAMPLING_FACTOR))
-#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
-
-#ifdef RTAI
-static SEM *mutex;
-//static CND *cond;
-
-static long int thread0;
-static long int thread1;
-//static long int sync_thread;
-#else
-#define OPENAIR_THREAD_STACK_SIZE    8192
-#define OPENAIR_THREAD_PRIORITY        255
-pthread_t thread0;
-//pthread_t thread1;
-pthread_attr_t attr_dlsch_threads;
-struct sched_param sched_param_dlsch;
-#endif
-
-pthread_t  thread2; //xforms
-pthread_t  thread3; //emos
-
-/*
-static int instance_cnt=-1; //0 means worker is busy, -1 means its free
-int instance_cnt_ptr_kern,*instance_cnt_ptr_user;
-int pci_interface_ptr_kern;
-*/
-//extern unsigned int bigphys_top;
-//extern unsigned int mem_base;
-
-int card = 0;
-exmimo_config_t *p_exmimo_config;
-exmimo_id_t     *p_exmimo_id;
-volatile unsigned int *DAQ_MBOX;
-
-int oai_exit = 0;
-
-//int time_offset[4] = {-138,-138,-138,-138};
-//int time_offset[4] = {-145,-145,-145,-145};
-int time_offset[4] = {0,0,0,0};
-
-int fs4_test=0;
-char UE_flag=0;
-uint8_t  eNB_id=0,UE_id=0;
-
-uint32_t carrier_freq[4]= {1907600000,1907600000,1907600000,1907600000};
-
-struct timing_info_t {
-  //unsigned int frame, hw_slot, last_slot, next_slot;
-  RTIME time_min, time_max, time_avg, time_last, time_now;
-  //unsigned int mbox0, mbox1, mbox2, mbox_target;
-  unsigned int n_samples;
-} timing_info;
-
-extern int16_t* sync_corr_ue0;
-extern int16_t prach_ifft[4][1024*2];
-
-
-int rx_input_level_dBm;
-#ifdef XFORMS
-extern int otg_enabled;
-#else
-int otg_enabled;
-#endif
-int number_of_cards = 1;
-
-int mbox_bounds[20] = {8,16,24,30,38,46,54,60,68,76,84,90,98,106,114,120,128,136,144, 0}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
-//int mbox_bounds[20] = {6,14,22,28,36,44,52,58,66,74,82,88,96,104,112,118,126,134,142, 148}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
-
-int init_dlsch_threads(void);
-void cleanup_dlsch_threads(void);
-int32_t init_rx_pdsch_thread(void);
-void cleanup_rx_pdsch_thread(void);
-int init_ulsch_threads(void);
-void cleanup_ulsch_threads(void);
-
-//void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
-//void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
-void test_config(int card, int ant, unsigned int rf_mode, int UE_flag);
-
-unsigned int build_rflocal(int txi, int txq, int rxi, int rxq)
-{
-  return (txi + (txq<<6) + (rxi<<12) + (rxq<<18));
-}
-unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe)
-{
-  return (dcoff_i_rxfe + (dcoff_q_rxfe<<8));
-}
-
-void signal_handler(int sig)
-{
-  void *array[10];
-  size_t size;
-
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    oai_exit=1;
-  }
-}
-
-void exit_fun(const char* s)
-{
-  void *array[10];
-  size_t size;
-
-  printf("Exiting: %s\n",s);
-
-  oai_exit=1;
-  //rt_sleep_ns(FRAME_PERIOD);
-
-  //exit (-1);
-}
-
-#ifdef XFORMS
-void *scope_thread(void *arg)
-{
-  int16_t prach_corr[1024], i;
-  char stats_buffer[16384];
-  //FILE *UE_stats, *eNB_stats;
-  int len=0;
-  struct sched_param sched_param;
-
-  sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("Scope thread has priority %d\n",sched_param.sched_priority);
-
-  /*
-    if (UE_flag==1)
-    UE_stats  = fopen("UE_stats.txt", "w");
-    else
-    eNB_stats = fopen("eNB_stats.txt", "w");
-  */
-
-  while (!oai_exit) {
-    if (UE_flag==1) {
-      len = dump_ue_stats (PHY_vars_UE_g[0], stats_buffer, 0, mode,rx_input_level_dBm);
-      fl_set_object_label(form_stats->stats_text, stats_buffer);
-      //rewind (UE_stats);
-      //fwrite (stats_buffer, 1, len, UE_stats);
-
-      phy_scope_UE(form_ue[UE_id],
-                   PHY_vars_UE_g[UE_id],
-                   eNB_id,
-                   UE_id,7);
-
-    } else {
-      len = dump_eNB_stats (PHY_vars_eNB_g[0], stats_buffer, 0);
-      fl_set_object_label(form_stats->stats_text, stats_buffer);
-
-      //rewind (eNB_stats);
-      //fwrite (stats_buffer, 1, len, eNB_stats);
-      for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-        phy_scope_eNB(form_enb[UE_id],
-                      PHY_vars_eNB_g[eNB_id],
-                      UE_id);
-      }
-
-    }
-
-    //printf("doing forms\n");
-    usleep(100000);
-  }
-
-  //fclose (UE_stats);
-  //fclose (eNB_stats);
-
-  pthread_exit((void*)arg);
-}
-#endif
-
-int dummy_tx_buffer[3840*4] __attribute__((aligned(16)));
-
-#ifdef EMOS
-#define NO_ESTIMATES_DISK 20 //No. of estimates that are aquired before dumped to disk
-int channel_buffer_size =  SAMPLES_PER_SLOT*4; //one slot, 4 byte per sample
-
-
-void *emos_thread (void *arg)
-{
-  char c;
-  char *fifo2file_buffer, *fifo2file_ptr;
-
-  int fifo, counter=0, bytes;
-  long long unsigned int total_bytes=0;
-
-  FILE  *dumpfile_id;
-  char  dumpfile_name[1024];
-  time_t starttime_tmp;
-  struct tm starttime;
-
-  time_t timer;
-  struct tm *now;
-
-  struct gps_data_t *gps_data = NULL;
-  struct gps_fix_t dummy_gps_data;
-
-  struct sched_param sched_param;
-  int ret;
-
-  sched_param.sched_priority = sched_get_priority_max(SCHED_FIFO)-1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("EMOS thread has priority %d\n",sched_param.sched_priority);
-
-  timer = time(NULL);
-  now = localtime(&timer);
-
-  memset(&dummy_gps_data,1,sizeof(struct gps_fix_t));
-
-#if GPSD_API_MAJOR_VERSION>=5
-  ret = gps_open("127.0.0.1","2947",gps_data);
-
-  if (ret!=0)
-#else
-  gps_data = gps_open("127.0.0.1","2947");
-
-  if (gps_data == NULL)
-#endif
-  {
-    printf("[EMOS] Could not open GPS\n");
-    //exit(-1);
-  }
-
-#if GPSD_API_MAJOR_VERSION>=4
-  else if (gps_stream(gps_data, WATCH_ENABLE,NULL) != 0)
-#else
-  else if (gps_query(gps_data, "w+x") != 0)
-#endif
-  {
-    //sprintf(tmptxt,"Error sending command to GPS, gps_data = %x", gps_data);
-    printf("[EMOS] Error sending command to GPS\n");
-    //exit(-1);
-  } else
-    printf("[EMOS] Opened GPS, gps_data=%p\n", gps_data);
-
-  /*
-  if (UE_flag==0)
-    channel_buffer_size = sizeof(fifo_dump_emos_eNB);
-  else
-    channel_buffer_size = sizeof(fifo_dump_emos_UE);
-  */
-
-  // allocate memory for NO_FRAMES_DISK channes estimations
-  fifo2file_buffer = malloc(NO_ESTIMATES_DISK*channel_buffer_size);
-  fifo2file_ptr = fifo2file_buffer;
-
-  if (fifo2file_buffer == NULL) {
-    printf("[EMOS] Cound not allocate memory for fifo2file_buffer\n");
-    exit(EXIT_FAILURE);
-  }
-
-  if ((fifo = open(CHANSOUNDER_FIFO_DEV, O_RDONLY)) < 0) {
-    fprintf(stderr, "[EMOS] Error opening the fifo\n");
-    exit(EXIT_FAILURE);
-  }
-
-
-  time(&starttime_tmp);
-  localtime_r(&starttime_tmp,&starttime);
-  snprintf(dumpfile_name,1024,"/tmp/%s_data_%d%02d%02d_%02d%02d%02d.EMOS",
-           (UE_flag==0) ? "eNB" : "UE",
-           1900+starttime.tm_year, starttime.tm_mon+1, starttime.tm_mday, starttime.tm_hour, starttime.tm_min, starttime.tm_sec);
-
-  dumpfile_id = fopen(dumpfile_name,"w");
-
-  if (dumpfile_id == NULL) {
-    fprintf(stderr, "[EMOS] Error opening dumpfile %s\n",dumpfile_name);
-    exit(EXIT_FAILURE);
-  }
-
-
-  printf("[EMOS] starting dump, channel_buffer_size=%d ...\n",channel_buffer_size);
-
-  while (!oai_exit) {
-    bytes = rtf_read_timed(fifo, fifo2file_ptr, channel_buffer_size,100);
-
-    if (bytes<=0)
-      continue;
-
-    /*
-    if (UE_flag==0)
-    printf("eNB: count %d, frame %d, read: %d bytes from the fifo\n",counter, ((fifo_dump_emos_eNB*)fifo2file_ptr)->frame_tx,bytes);
-    else
-    printf("UE: count %d, frame %d, read: %d bytes from the fifo\n",counter, ((fifo_dump_emos_UE*)fifo2file_ptr)->frame_rx,bytes);
-    */
-
-    fifo2file_ptr += channel_buffer_size;
-    counter ++;
-    total_bytes += bytes;
-
-    if ((counter%NO_ESTIMATES_DISK)==0) {
-      //reset stuff
-      fifo2file_ptr = fifo2file_buffer;
-      //counter = 0;
-
-      //flush buffer to disk
-      if (fwrite(fifo2file_buffer, sizeof(char), NO_ESTIMATES_DISK*channel_buffer_size, dumpfile_id) != NO_ESTIMATES_DISK*channel_buffer_size) {
-        fprintf(stderr, "[EMOS] Error writing to dumpfile\n");
-        exit(EXIT_FAILURE);
-      }
-
-      /*
-      if (gps_data)
-        {
-          if (gps_poll(gps_data) != 0) {
-      printf("[EMOS] problem polling data from gps\n");
-          }
-          else {
-      printf("[EMOS] lat %g, lon %g\n",gps_data->fix.latitude,gps_data->fix.longitude);
-          }
-          if (fwrite(&(gps_data->fix), sizeof(char), sizeof(struct gps_fix_t), dumpfile_id) != sizeof(struct gps_fix_t))
-      {
-        printf("[EMOS] Error writing to dumpfile, stopping recording\n");
-        exit(EXIT_FAILURE);
-      }
-        }
-      else
-        {
-          printf("[EMOS] WARNING: No GPS data available, storing dummy packet\n");
-          if (fwrite(&(dummy_gps_data), sizeof(char), sizeof(struct gps_fix_t), dumpfile_id) != sizeof(struct gps_fix_t))
-      {
-        printf("[EMOS] Error writing to dumpfile, stopping recording\n");
-        exit(EXIT_FAILURE);
-      }
-        }
-      */
-    }
-
-    if ((counter%2000)==0)
-      printf("[EMOS] count %d (%d sec), total bytes wrote %llu\n", counter, counter/2000, total_bytes);
-  }
-
-  free(fifo2file_buffer);
-  fclose(dumpfile_id);
-  close(fifo);
-
-  pthread_exit((void*) arg);
-
-}
-#endif
-
-/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
-static void *eNB_thread(void *arg)
-{
-#ifdef RTAI
-  RT_TASK *task;
-  RTIME now;
-#endif
-  unsigned char slot=0,last_slot, next_slot;
-  int hw_slot,frame=0;
-  unsigned int msg1;
-  unsigned int aa,slot_offset, slot_offset_F;
-  int diff;
-  int delay_cnt;
-  RTIME time_in, time_diff;
-  int mbox_target=0,mbox_current=0;
-  int i,ret;
-  int tx_offset;
-  int bytes;
-
-#ifdef RTAI
-  task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
-  LOG_D(HW,"Started eNB thread (id %p)\n",task);
-#ifndef TIMER_ONESHOT_MODE
-  now = rt_get_time();
-  ret = rt_task_make_periodic(task, now, nano2count(500000LL));
-
-  if (ret!=0)
-    LOG_E(HW,"Problem with periodic timer\n");
-
-#endif
-#endif
-
-#ifdef HARD_RT
-  rt_make_hard_real_time();
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  timing_info.time_min = 100000000ULL;
-  timing_info.time_max = 0;
-  timing_info.time_avg = 0;
-  timing_info.n_samples = 0;
-
-  while (!oai_exit) {
-    hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
-    //LOG_D(HW,"eNB frame %d, time %llu: slot %d, hw_slot %d (mbox %d)\n",frame,rt_get_time_ns(),slot,hw_slot,((unsigned int *)DAQ_MBOX)[0]);
-    //this is the mbox counter where we should be
-    //mbox_target = ((((slot+1)%20)*15+1)>>1)%150;
-    mbox_target = mbox_bounds[slot];
-    //this is the mbox counter where we are
-    mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
-
-    //this is the time we need to sleep in order to synchronize with the hw (in multiples of DAQ_PERIOD)
-    if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround
-      diff = 150-mbox_current+mbox_target;
-    else if ((mbox_current<15) && (mbox_target>=135))
-      diff = -150+mbox_target-mbox_current;
-    else
-      diff = mbox_target - mbox_current;
-
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_ENB, slot);
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_ENB, frame);
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0]));
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DIFF, diff);
-
-    time_in = rt_get_time_ns();
-    //LOG_D(HW,"eNB Frame %d delaycnt %d : hw_slot %d (%d), slot %d, (slot+1)*15=%d, diff %d, time %llu\n",frame,delay_cnt,hw_slot,((unsigned int *)DAQ_MBOX)[0],slot,(((slot+1)*15)>>1),diff,time_in);
-    //LOG_D(HW,"eNB Frame %d, time %llu: sleeping for %llu (slot %d, hw_slot %d, diff %d, mbox %d, delay_cnt %d)\n", frame, time_in, diff*DAQ_PERIOD,slot,hw_slot,diff,((volatile unsigned int *)DAQ_MBOX)[0],delay_cnt);
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP,1);
-#ifdef TIMER_ONESHOT_MODE
-    //ret = rt_sleep_ns(DAQ_PERIOD * (slot%4==0?6:8));
-    ret = rt_sleep_ns(500000);
-
-    if (ret)
-      LOG_D(HW,"eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame, time_in);
-
-#else
-    rt_task_wait_period();
-#endif
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP,0);
-
-    //hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
-    //LOG_D(HW,"eNB Frame %d : hw_slot %d, time %llu\n",frame,hw_slot,rt_get_time_ns());
-
-    mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
-
-    if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround
-      diff = 150-mbox_current+mbox_target;
-    else if ((mbox_current<15) && (mbox_target>=135))
-      diff = -150+mbox_target-mbox_current;
-    else
-      diff = mbox_target - mbox_current;
-
-
-    last_slot = (slot)%LTE_SLOTS_PER_FRAME;
-
-    if (last_slot <0)
-      last_slot+=20;
-
-    next_slot = (slot+3)%LTE_SLOTS_PER_FRAME;
-
-    slot++;
-
-    if (slot==20) {
-      slot=0;
-      frame++;
-    }
-
-    if (frame==1000)
-      oai_exit=1;
-
-#if defined(ENABLE_ITTI)
-    itti_update_lte_time(frame, slot);
-#endif
-  }
-
-  LOG_D(HW,"eNB_thread: finished, ran %d times.\n",frame);
-
-#ifdef HARD_RT
-  rt_make_soft_real_time();
-#endif
-
-  // clean task
-#ifdef RTAI
-  rt_task_delete(task);
-#endif
-  LOG_D(HW,"Task deleted. returning\n");
-  return 0;
-}
-
-
-int main(int argc, char **argv)
-{
-
-#ifdef RTAI
-  RT_TASK *task;
-  RTIME period;
-#endif
-  int i,j,aa;
-  void *status;
-
-  /*
-  uint32_t rf_mode_max[4]     = {55759,55759,55759,55759};
-  uint32_t rf_mode_med[4]     = {39375,39375,39375,39375};
-  uint32_t rf_mode_byp[4]     = {22991,22991,22991,22991};
-  */
-  uint32_t my_rf_mode = RXEN + TXEN + TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM + DMAMODE_RX + DMAMODE_TX;
-  uint32_t rf_mode_base = TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM;
-  uint32_t rf_mode[4]     = {my_rf_mode,0,0,0};
-  uint32_t rf_local[4]    = {8255000,8255000,8255000,8255000}; // UE zepto
-  //{8254617, 8254617, 8254617, 8254617}; //eNB khalifa
-  //{8255067,8254810,8257340,8257340}; // eNB PETRONAS
-
-  uint32_t rf_vcocal[4]   = {910,910,910,910};
-  uint32_t rf_vcocal_850[4] = {2015, 2015, 2015, 2015};
-  uint32_t rf_rxdc[4]     = {32896,32896,32896,32896};
-  uint32_t rxgain[4]      = {20,20,20,20};
-  uint32_t txgain[4]      = {20,20,20,20};
-
-  uint16_t Nid_cell = 0;
-  uint8_t  cooperation_flag=0, transmission_mode=1, abstraction_flag=0;
-  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
-
-  int c;
-  char do_forms=0;
-  unsigned int fd;
-  unsigned int tcxo = 114;
-
-  int amp;
-  uint8_t prach_fmt;
-  int N_ZC;
-
-  char rxg_fname[100];
-  char txg_fname[100];
-  char rflo_fname[100];
-  char rfdc_fname[100];
-  FILE *rxg_fd=NULL;
-  FILE *txg_fd=NULL;
-  FILE *rflo_fd=NULL;
-  FILE *rfdc_fd=NULL;
-  unsigned int rxg_max[4]= {133,133,133,133}, rxg_med[4]= {127,127,127,127}, rxg_byp[4]= {120,120,120,120};
-  int tx_max_power=0;
-
-  char line[1000];
-  int l;
-  int ret, ant;
-  int ant_offset=0;
-
-  int error_code;
-  char *itti_dump_file = NULL;
-
-  const struct option long_options[] = {
-    {"calib-ue-rx", required_argument, NULL, 256},
-    {"calib-ue-rx-med", required_argument, NULL, 257},
-    {"calib-ue-rx-byp", required_argument, NULL, 258},
-    {"debug-ue-prach", no_argument, NULL, 259},
-    {"no-L2-connect", no_argument, NULL, 260},
-    {NULL, 0, NULL, 0}
-  };
-
-  //mode = normal_txrx;
-
-
-  while ((c = getopt_long (argc, argv, "C:K:O:ST:UdF:V",long_options,NULL)) != -1) {
-    switch (c) {
-    case 'V':
-      ouput_vcd = 1;
-      break;
-
-    case 'd':
-      do_forms=1;
-      break;
-
-    case 'U':
-      UE_flag = 1;
-      break;
-
-    case 'C':
-      carrier_freq[0] = atoi(optarg);
-      carrier_freq[1] = atoi(optarg);
-      carrier_freq[2] = atoi(optarg);
-      carrier_freq[3] = atoi(optarg);
-      break;
-
-    case 'S':
-      fs4_test=1;
-      break;
-
-    case 'T':
-      tcxo=atoi(optarg);
-      break;
-
-    case 'K':
-#if defined(ENABLE_ITTI)
-      itti_dump_file = strdup(optarg);
-#else
-      printf("-K option is disabled when ENABLE_ITTI is not defined\n");
-#endif
-      break;
-
-    case 'O':
-#if defined(ENABLE_USE_MME)
-      EPC_MODE_ENABLED = 1;
-
-      if (optarg == NULL) { /* No IP address provided: use localhost */
-        memcpy(&EPC_MODE_MME_ADDRESS[0], "127.0.0.1", 10);
-      } else {
-        uint8_t ip_length = strlen(optarg) + 1;
-        memcpy(&EPC_MODE_MME_ADDRESS[0], optarg,
-               ip_length > 16 ? 16 : ip_length);
-      }
-
-#else
-      printf("You enabled mme mode without s1ap compiled...\n");
-#endif
-      break;
-
-    case 'F':
-      sprintf(rxg_fname,"%srxg.lime",optarg);
-      rxg_fd = fopen(rxg_fname,"r");
-
-      if (rxg_fd) {
-        printf("Loading RX Gain parameters from %s\n",rxg_fname);
-        l=0;
-
-        while (fgets(line, sizeof(line), rxg_fd)) {
-          if ((strlen(line)==0) || (*line == '#')) continue; //ignore empty or comment lines
-          else {
-            if (l==0) sscanf(line,"%d %d %d %d",&rxg_max[0],&rxg_max[1],&rxg_max[2],&rxg_max[3]);
-
-            if (l==1) sscanf(line,"%d %d %d %d",&rxg_med[0],&rxg_med[1],&rxg_med[2],&rxg_med[3]);
-
-            if (l==2) sscanf(line,"%d %d %d %d",&rxg_byp[0],&rxg_byp[1],&rxg_byp[2],&rxg_byp[3]);
-
-            l++;
-          }
-        }
-      } else
-        printf("%s not found, running with defaults\n",rxg_fname);
-
-      sprintf(txg_fname,"%stxg.lime",optarg);
-      txg_fd = fopen(txg_fname,"r");
-
-      if (txg_fd) {
-        printf("Loading TX Gain parameters from %s\n",txg_fname);
-        l=0;
-
-        while (fgets(line, sizeof(line), txg_fd)) {
-          if ((strlen(line)==0) || (*line == '#')) {
-            continue; //ignore empty or comment lines
-          } else {
-            if (l==0) sscanf(line,"%d %d %d %d",&txgain[0],&txgain[1],&txgain[2],&txgain[3]);
-
-            if (l==1) sscanf(line,"%d",&tx_max_power);
-
-            l++;
-          }
-        }
-      } else
-        printf("%s not found, running with defaults\n",txg_fname);
-
-      sprintf(rflo_fname,"%srflo.lime",optarg);
-      rflo_fd = fopen(rflo_fname,"r");
-
-      if (rflo_fd) {
-        printf("Loading RF LO parameters from %s\n",rflo_fname);
-        fscanf(rflo_fd,"%d %d %d %d",&rf_local[0],&rf_local[1],&rf_local[2],&rf_local[3]);
-      } else
-        printf("%s not found, running with defaults\n",rflo_fname);
-
-      sprintf(rfdc_fname,"%srfdc.lime",optarg);
-      rfdc_fd = fopen(rfdc_fname,"r");
-
-      if (rfdc_fd) {
-        printf("Loading RF DC parameters from %s\n",rfdc_fname);
-        fscanf(rfdc_fd,"%d %d %d %d",&rf_rxdc[0],&rf_rxdc[1],&rf_rxdc[2],&rf_rxdc[3]);
-      } else
-        printf("%s not found, running with defaults\n",rfdc_fname);
-
-      break;
-
-      /*
-      case 256:
-      mode = rx_calib_ue;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 257:
-      mode = rx_calib_ue_med;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 258:
-      mode = rx_calib_ue_byp;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 259:
-      mode = debug_prach;
-      break;
-      case 260:
-      mode = no_L2_connect;
-      break;
-      */
-    default:
-      break;
-    }
-  }
-
-  if (UE_flag==1)
-    printf("configuring for UE\n");
-  else
-    printf("configuring for eNB\n");
-
-  //randominit (0);
-  //set_taus_seed (0);
-
-  // initialize the log (see log.h for details)
-  logInit();
-
-#if defined(ENABLE_ITTI)
-  itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, itti_dump_file);
-
-# if defined(ENABLE_USE_MME)
-
-  if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing SCTP task interface: FAILED\n");
-    return -1;
-  }
-
-  if (itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing S1AP task interface: FAILED\n");
-    return -1;
-  }
-
-# endif
-
-  if (itti_create_task(TASK_L2L1, l2l1_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing L2L1 task interface: FAILED\n");
-    return -1;
-  }
-
-  // Handle signals until all tasks are terminated
-  //   itti_wait_tasks_end();
-#endif
-
-  if (ouput_vcd) {
-    if (UE_flag==1)
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_UE.vcd");
-    else
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_eNB.vcd");
-  }
-
-#ifdef PDCP_USE_NETLINK
-  netlink_init();
-#endif
-
-  // to make a graceful exit when ctrl-c is pressed
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-
-#ifndef RTAI
-  check_clock();
-#endif
-
-  g_log->log_component[HW].level = LOG_DEBUG;
-  g_log->log_component[HW].flag  = LOG_HIGH;
-#ifdef OPENAIR2
-  g_log->log_component[PHY].level = LOG_INFO;
-#else
-  g_log->log_component[PHY].level = LOG_INFO;
-#endif
-  g_log->log_component[PHY].flag  = LOG_HIGH;
-  g_log->log_component[MAC].level = LOG_INFO;
-  g_log->log_component[MAC].flag  = LOG_HIGH;
-  g_log->log_component[RLC].level = LOG_INFO;
-  g_log->log_component[RLC].flag  = LOG_HIGH;
-  g_log->log_component[PDCP].level = LOG_INFO;
-  g_log->log_component[PDCP].flag  = LOG_HIGH;
-  g_log->log_component[OTG].level = LOG_INFO;
-  g_log->log_component[OTG].flag  = LOG_HIGH;
-  g_log->log_component[RRC].level = LOG_INFO;
-  g_log->log_component[RRC].flag  = LOG_HIGH;
-
-
-  // Initialize card
-  ret = openair0_open();
-
-  if ( ret != 0 ) {
-    if (ret == -1)
-      printf("Error opening /dev/openair0");
-
-    if (ret == -2)
-      printf("Error mapping bigshm");
-
-    if (ret == -3)
-      printf("Error mapping RX or TX buffer");
-
-    return(ret);
-  }
-
-  printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[card]);
-
-  p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
-  p_exmimo_id     = openair0_exmimo_pci[card].exmimo_id_ptr;
-
-  printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev);
-
-  if (p_exmimo_id->board_swrev>=BOARD_SWREV_CNTL2)
-    p_exmimo_config->framing.eNB_flag   = 0;
-  else
-    p_exmimo_config->framing.eNB_flag   = !UE_flag;
-
-  p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
-
-  for (ant=0; ant<4; ant++)
-    p_exmimo_config->framing.resampling_factor[ant] = RESAMPLING_FACTOR;
-
-  /*
-  for (ant=0;ant<max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant++)
-    p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
-  for (ant=0;ant<frame_parms->nb_antennas_tx;ant++)
-    p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
-  for (ant=0;ant<frame_parms->nb_antennas_rx;ant++)
-    p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
-  for (ant=max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant<4;ant++) {
-    p_exmimo_config->rf.rf_mode[ant] = 0;
-    carrier_freq[ant] = 0; //this turns off all other LIMEs
-  }
-  */
-
-  ant_offset = 0;
-
-  for (ant=0; ant<4; ant++) {
-    if (ant==ant_offset) {
-      //if (1) {
-      p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
-      //p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
-      p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
-    } else {
-      p_exmimo_config->rf.rf_mode[ant] = 0;
-      carrier_freq[ant] = 0; //this turns off all other LIMEs
-    }
-  }
-
-  for (ant = 0; ant<4; ant++) {
-    p_exmimo_config->rf.do_autocal[ant] = 1;
-    p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[ant];
-    p_exmimo_config->rf.rf_freq_tx[ant] = carrier_freq[ant];
-    p_exmimo_config->rf.rx_gain[ant][0] = rxgain[ant];
-    p_exmimo_config->rf.tx_gain[ant][0] = txgain[ant];
-
-    p_exmimo_config->rf.rf_local[ant]   = rf_local[ant];
-    p_exmimo_config->rf.rf_rxdc[ant]    = rf_rxdc[ant];
-
-    if ((carrier_freq[ant] >= 850000000) && (carrier_freq[ant] <= 865000000)) {
-      p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal_850[ant];
-      p_exmimo_config->rf.rffe_band_mode[ant] = DD_TDD;
-    } else if ((carrier_freq[ant] >= 1900000000) && (carrier_freq[ant] <= 2000000000)) {
-      p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal[ant];
-      p_exmimo_config->rf.rffe_band_mode[ant] = B19G_TDD;
-    } else {
-      p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal[ant];
-      p_exmimo_config->rf.rffe_band_mode[ant] = 0;
-    }
-
-    p_exmimo_config->rf.rffe_gain_txlow[ant] = 31;
-    p_exmimo_config->rf.rffe_gain_txhigh[ant] = 31;
-    p_exmimo_config->rf.rffe_gain_rxfinal[ant] = 52;
-    p_exmimo_config->rf.rffe_gain_rxlow[ant] = 31;
-  }
-
-
-  number_of_cards = openair0_num_detected_cards;
-  /*
-  if (p_exmimo_id->board_exmimoversion==1) //ExpressMIMO1
-    openair_daq_vars.timing_advance = 138;
-  else //ExpressMIMO2
-    openair_daq_vars.timing_advance = 0;
-  */
-
-  openair0_dump_config(card);
-
-  printf("EXMIMO_CONFIG: rf_mode 0x %x %x %x %x, [0]: TXRXEn %d, TXLPFEn %d, TXLPF %d, RXLPFEn %d, RXLPF %d, RFBB %d, LNA %d, LNAGain %d, RXLPFMode %d, SWITCH %d, rf_rxdc %d, rf_local %d, rf_vcocal %d\n",
-         p_exmimo_config->rf.rf_mode[0],
-         p_exmimo_config->rf.rf_mode[1],
-         p_exmimo_config->rf.rf_mode[2],
-         p_exmimo_config->rf.rf_mode[3],
-         (p_exmimo_config->rf.rf_mode[0]&3),  // RXen+TXen
-         (p_exmimo_config->rf.rf_mode[0]&4)>>2,         //TXLPFen
-         (p_exmimo_config->rf.rf_mode[0]&TXLPFMASK)>>3, //TXLPF
-         (p_exmimo_config->rf.rf_mode[0]&128)>>7,      //RXLPFen
-         (p_exmimo_config->rf.rf_mode[0]&RXLPFMASK)>>8, //TXLPF
-         (p_exmimo_config->rf.rf_mode[0]&RFBBMASK)>>16, // RFBB mode
-         (p_exmimo_config->rf.rf_mode[0]&LNAMASK)>>12, // RFBB mode
-         (p_exmimo_config->rf.rf_mode[0]&LNAGAINMASK)>>14, // RFBB mode
-         (p_exmimo_config->rf.rf_mode[0]&RXLPFMODEMASK)>>19, // RXLPF mode
-         (p_exmimo_config->framing.tdd_config&TXRXSWITCH_MASK)>>1, // Switch mode
-         p_exmimo_config->rf.rf_rxdc[0],
-         p_exmimo_config->rf.rf_local[0],
-         p_exmimo_config->rf.rf_vcocal[0]);
-
-  for (ant=0; ant<4; ant++)
-    p_exmimo_config->rf.do_autocal[ant] = 0;
-
-#ifdef EMOS
-  error_code = rtf_create(CHANSOUNDER_FIFO_MINOR,CHANSOUNDER_FIFO_SIZE);
-
-  if (error_code==0)
-    printf("[OPENAIR][SCHED][INIT] Created EMOS FIFO %d\n",CHANSOUNDER_FIFO_MINOR);
-  else if (error_code==ENODEV)
-    printf("[OPENAIR][SCHED][INIT] Problem: EMOS FIFO %d is greater than or equal to RTF_NO\n",CHANSOUNDER_FIFO_MINOR);
-  else if (error_code==ENOMEM)
-    printf("[OPENAIR][SCHED][INIT] Problem: cannot allocate memory for EMOS FIFO %d\n",CHANSOUNDER_FIFO_MINOR);
-  else
-    printf("[OPENAIR][SCHED][INIT] Problem creating EMOS FIFO %d, error_code %d\n",CHANSOUNDER_FIFO_MINOR,error_code);
-
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-#ifdef RTAI
-  // make main thread LXRT soft realtime
-  task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
-
-  // start realtime timer and scheduler
-#ifdef TIMER_ONESHOT_MODE
-  rt_set_oneshot_mode();
-  start_rt_timer(0);
-  printf("started RTAI timer inoneshot mode\n");
-#else
-  rt_set_periodic_mode();
-  period = start_rt_timer(nano2count(500000));
-  printf("started RTAI timer with period %llu ns\n",count2nano(period));
-#endif
-
-  printf("Init mutex\n");
-  //mutex = rt_get_adr(nam2num("MUTEX"));
-  mutex = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if (mutex==0) {
-    printf("Error init mutex\n");
-    exit(-1);
-  } else
-    printf("mutex=%p\n",mutex);
-
-#endif
-
-  DAQ_MBOX = (volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0];
-
-  // this starts the DMA transfers
-  if (UE_flag!=1)
-    openair0_start_rt_acquisition(card);
-
-
-#ifdef XFORMS
-
-  if (do_forms==1) {
-    fl_initialize (&argc, argv, NULL, 0, 0);
-    form_stats = create_form_stats_form();
-
-    if (UE_flag==1) {
-      form_ue[UE_id] = create_lte_phy_scope_ue();
-      sprintf (title, "LTE DL SCOPE UE");
-      fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-    } else {
-      for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-        form_enb[UE_id] = create_lte_phy_scope_enb();
-        sprintf (title, "UE%d LTE UL SCOPE eNB",UE_id+1);
-        fl_show_form (form_enb[UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-      }
-    }
-
-    fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
-
-    if (UE_flag==0) {
-      for (UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-        if (otg_enabled) {
-          fl_set_button(form_enb[UE_id]->button_0,1);
-          fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic ON");
-        } else {
-          fl_set_button(form_enb[UE_id]->button_0,0);
-          fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic OFF");
-        }
-      }
-    } else {
-      if (openair_daq_vars.use_ia_receiver) {
-        fl_set_button(form_ue[UE_id]->button_0,1);
-        fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
-      } else {
-        fl_set_button(form_ue[UE_id]->button_0,0);
-        fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
-      }
-    }
-
-    ret = pthread_create(&thread2, NULL, scope_thread, NULL);
-    printf("Scope thread created, ret=%d\n",ret);
-  }
-
-#endif
-
-#ifdef EMOS
-  ret = pthread_create(&thread3, NULL, emos_thread, NULL);
-  printf("EMOS thread created, ret=%d\n",ret);
-#endif
-
-  rt_sleep_ns(10*FRAME_PERIOD);
-
-#ifndef RTAI
-  pthread_attr_init (&attr_dlsch_threads);
-  pthread_attr_setstacksize(&attr_dlsch_threads,OPENAIR_THREAD_STACK_SIZE);
-  //attr_dlsch_threads.priority = 1;
-  sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
-  pthread_attr_setschedparam  (&attr_dlsch_threads, &sched_param_dlsch);
-  pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO);
-#endif
-
-  // start the main thread
-  if (UE_flag == 1) {
-    /*
-    #ifdef RTAI
-    thread1 = rt_thread_create(UE_thread, NULL, 100000000);
-    #else
-    error_code = pthread_create(&thread1, &attr_dlsch_threads, UE_thread, NULL);
-    if (error_code!= 0) {
-      LOG_D(HW,"[lte-softmodem.c] Could not allocate UE_thread, error %d\n",error_code);
-      return(error_code);
-    }
-    else {
-      LOG_D(HW,"[lte-softmodem.c] Allocate UE_thread successful\n");
-    }
-    #endif
-    #ifdef DLSCH_THREAD
-    init_rx_pdsch_thread();
-    rt_sleep_ns(FRAME_PERIOD/10);
-    init_dlsch_threads();
-    #endif
-    printf("UE threads created\n");
-    */
-  } else {
-#ifdef RTAI
-    thread0 = rt_thread_create(eNB_thread, NULL, 100000000);
-#else
-    error_code = pthread_create(&thread0, &attr_dlsch_threads, eNB_thread, NULL);
-
-    if (error_code!= 0) {
-      LOG_D(HW,"[lte-softmodem.c] Could not allocate eNB_thread, error %d\n",error_code);
-      return(error_code);
-    } else {
-      LOG_D(HW,"[lte-softmodem.c] Allocate eNB_thread successful\n");
-    }
-
-#endif
-#ifdef ULSCH_THREAD
-    init_ulsch_threads();
-#endif
-    printf("eNB threads created\n");
-  }
-
-
-  // wait for end of program
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-
-  //getchar();
-  while (oai_exit==0)
-    rt_sleep_ns(FRAME_PERIOD);
-
-  // stop threads
-#ifdef XFORMS
-  printf("waiting for XFORMS thread\n");
-
-  if (do_forms==1) {
-    pthread_join(thread2,&status);
-    fl_hide_form(form_stats->stats_form);
-    fl_free_form(form_stats->stats_form);
-
-    if (UE_flag==1) {
-      fl_hide_form(form_ue[UE_id]->lte_phy_scope_ue);
-      fl_free_form(form_ue[UE_id]->lte_phy_scope_ue);
-    } else {
-      for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-        fl_hide_form(form_enb[UE_id]->lte_phy_scope_enb);
-        fl_free_form(form_enb[UE_id]->lte_phy_scope_enb);
-      }
-    }
-  }
-
-#endif
-
-  printf("stopping MODEM threads\n");
-
-  // cleanup
-  if (UE_flag == 1) {
-    /*
-    #ifdef RTAI
-    rt_thread_join(thread1);
-    #else
-    pthread_join(thread1,&status);
-    #endif
-    #ifdef DLSCH_THREAD
-    cleanup_dlsch_threads();
-    cleanup_rx_pdsch_thread();
-    #endif
-    */
-  } else {
-#ifdef RTAI
-    rt_thread_join(thread0);
-#else
-    pthread_join(thread0,&status);
-#endif
-#ifdef ULSCH_THREAD
-    cleanup_ulsch_threads();
-#endif
-  }
-
-#ifdef OPENAIR2
-  //cleanup_pdcp_thread();
-#endif
-
-#ifdef RTAI
-  stop_rt_timer();
-#endif
-
-  printf("stopping card\n");
-  openair0_stop(card);
-  printf("closing openair0_lib\n");
-  openair0_close();
-
-#ifdef EMOS
-  printf("waiting for EMOS thread\n");
-  pthread_cancel(thread3);
-  pthread_join(thread3,&status);
-#endif
-
-#ifdef EMOS
-  error_code = rtf_destroy(CHANSOUNDER_FIFO_MINOR);
-  printf("[OPENAIR][SCHED][CLEANUP] EMOS FIFO closed, error_code %d\n", error_code);
-#endif
-
-  if (ouput_vcd)
-    VCD_SIGNAL_DUMPER_CLOSE();
-
-  logClean();
-
-  return 0;
-}
-
-void test_config(int card, int ant, unsigned int rf_mode, int UE_flag)
-{
-  p_exmimo_config->framing.eNB_flag   = !UE_flag;
-  p_exmimo_config->framing.tdd_config = 0;
-  p_exmimo_config->framing.resampling_factor[ant] = 2;
-
-  p_exmimo_config->rf.rf_freq_rx[ant] = 1907600000;
-  p_exmimo_config->rf.rf_freq_tx[ant] = 1907600000;;
-  p_exmimo_config->rf.rx_gain[ant][0] = 20;
-  p_exmimo_config->rf.tx_gain[ant][0] = 10;
-  p_exmimo_config->rf.rf_mode[ant] = rf_mode;
-
-  p_exmimo_config->rf.rf_local[ant] = build_rflocal(20,25,26,04);
-  p_exmimo_config->rf.rf_rxdc[ant] = build_rfdc(128, 128);
-  p_exmimo_config->rf.rf_vcocal[ant] = (0xE<<6) + 0xE;
-}
-
-/*
-void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
-
-  int i;
-  if (phy_vars_ue) {
-
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
-      printf("RX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
-      printf("TX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
-      free(phy_vars_ue->lte_ue_common_vars.rxdata[i]);
-      phy_vars_ue->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
-
-
-      printf("rxdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.rxdata[i]);
-    }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
-      free(phy_vars_ue->lte_ue_common_vars.txdata[i]);
-      phy_vars_ue->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
-
-      printf("txdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.txdata[i]);
-    }
-  }
-}
-
-void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
-
-  int i,j;
-
-  if (phy_vars_eNB) {
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
-      printf("RX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
-      printf("TX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
-        free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
-        phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
-
-        printf("rxdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
-        for (j=0;j<16;j++) {
-            printf("rxbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j]);
-            phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j] = 16-j;
-        }
-    }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
-        free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
-        phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
-
-        printf("txdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
-        for (j=0;j<16;j++) {
-            printf("txbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j]);
-            phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j] = 16-j;
-  }
-    }
-  }
-}
-*/
diff --git a/targets/SCRIPTS/install_asn1c_0.9.24.modified.bash b/targets/SCRIPTS/install_asn1c_0.9.24.modified.bash
index bb45a82e131f29afad0ab97c9b528866ec7a6e9d..9c4947d479b8830d27e14d498a4841108684f1e1 100755
--- a/targets/SCRIPTS/install_asn1c_0.9.24.modified.bash
+++ b/targets/SCRIPTS/install_asn1c_0.9.24.modified.bash
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/SIMU/PROC/Process.c b/targets/SIMU/PROC/Process.c
index 9d80c74d99bd70faf341d1f62e3c38672de3b062..9b529fd593633c39734e508fc942b735d3a1d33f 100644
--- a/targets/SIMU/PROC/Process.c
+++ b/targets/SIMU/PROC/Process.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/PROC/Process.h b/targets/SIMU/PROC/Process.h
index 1ab2f3be15bbfa8d57f1e65e6d71361d8a93712b..71383f945f47fde35e0d0578933d6ccb0b83fd40 100644
--- a/targets/SIMU/PROC/Process.h
+++ b/targets/SIMU/PROC/Process.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/PROC/Tsync.h b/targets/SIMU/PROC/Tsync.h
index a60501c13ef1efcaa49e4b6be8b40c540c1b23c8..a6ffe11defc3e273139bb793bf3b0e963620063d 100644
--- a/targets/SIMU/PROC/Tsync.h
+++ b/targets/SIMU/PROC/Tsync.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/PROC/channel_sim_proc.c b/targets/SIMU/PROC/channel_sim_proc.c
index b54fe36460cbe2831747d9984278d31716d3c920..dd0adec0d2a05750b33d27f8e8c1955f7920d733 100644
--- a/targets/SIMU/PROC/channel_sim_proc.c
+++ b/targets/SIMU/PROC/channel_sim_proc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/PROC/channel_sim_proc.h b/targets/SIMU/PROC/channel_sim_proc.h
index d95f3e7aabc15513d7a0c62aaf436be1e61db41d..1d5b53a1899d5b97ab524db9535c6d642106164d 100644
--- a/targets/SIMU/PROC/channel_sim_proc.h
+++ b/targets/SIMU/PROC/channel_sim_proc.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/PROC/interface.h b/targets/SIMU/PROC/interface.h
index 52b100f5944b520541eb07ec07462fb2215075e1..4c00d9d6f3259219e9f6ea7accdbe93b8f554fef 100644
--- a/targets/SIMU/PROC/interface.h
+++ b/targets/SIMU/PROC/interface.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile
index 7de5f9382fc6577e919ed15381de13ddeebca7b1..ec5f5eb0ccb382c0e0e38420a3dccc68f4660fde 100644
--- a/targets/SIMU/USER/Makefile
+++ b/targets/SIMU/USER/Makefile
@@ -29,13 +29,12 @@ endif
 
 
 CFLAGS += -Wpointer-sign
-CFLAGS += -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat
+CFLAGS += -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat
 
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
-CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_UL #-DRLC_UM_TEST_TRAFFIC=1
-CFLAGS += -DNEW_FFT
+CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
+CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
 #CFLAGS += -DLLR8
 CFLAGS += -DPACKAGE_NAME='"oaisim"'
 
@@ -48,15 +47,6 @@ DISABLE_XER_PRINT=0
 MSG_PRINT=1
 endif
 
-ifndef OPENAIR_EMU
-export OPENAIR_EMU=1
-CFLAGS += -DOAISIM
-endif
-
-ifdef EMOS
-CFLAGS+=-DEMOS
-endif
-
 ifeq ($(LOCALIZATION), 1)
 CFLAGS += -DLOCALIZATION
 endif
@@ -141,8 +131,6 @@ CFLAGS += -DSTOP_ON_IP_TRAFFIC_OVERLOAD
 endif
 
 
-ifeq ($(MIH_C_MEDIEVAL_EXTENSIONS), 1)
-CFLAGS += -DMIH_C_MEDIEVAL_EXTENSIONS
 ifeq ($(USE_3GPP_ADDR_AS_LINK_ADDR), 1)
 CFLAGS += -DUSE_3GPP_ADDR_AS_LINK_ADDR
 endif
@@ -179,7 +167,7 @@ ifdef OAI_NW_DRIVER_TYPE_ETHERNET
 CFLAGS+=-DOAI_NW_DRIVER_TYPE_ETHERNET
 endif
 
-CFLAGS += -DENABLE_FXP -DOAI_EMU -DENABLE_USE_CPU_EXECUTION_TIME
+CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
 ifndef DISABLE_XER_PRINT
 CFLAGS += -DXER_PRINT
 endif
@@ -272,7 +260,7 @@ endif
 # Check if libpgm is installed and use it if found instead of the unreliable
 # multicast
 ifeq ($(PGM_FOUND), 1)
-CFLAGS		+= $(PGM_CFLAGS) -DENABLE_PGM_TRANSPORT
+CFLAGS		+= $(PGM_CFLAGS)
 LIBS		+= $(PGM_LIBS)
 endif
 
diff --git a/targets/SIMU/USER/channel_sim.c b/targets/SIMU/USER/channel_sim.c
index 8efcca81e073f5056366cfd54297f437fa9f8b5a..94bd1bbe43d2f3ee8bb02dc1ab18a246dfad9710 100644
--- a/targets/SIMU/USER/channel_sim.c
+++ b/targets/SIMU/USER/channel_sim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -60,7 +60,7 @@
 #include "oaisim.h"
 
 #define RF
-#define DEBUG_SIM
+//#define DEBUG_SIM
 
 int number_rb_ul;
 int first_rbUL ;
@@ -83,8 +83,8 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM
 	       node_desc_t *enb_data[NUMBER_OF_RU_MAX],
 	       node_desc_t *ue_data[NUMBER_OF_UE_MAX],
 	       uint16_t subframe,
-	       uint16_t offset,
-	       uint16_t length,
+	       uint32_t offset,
+	       uint32_t length,
 	       uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *ue_frame_parms,
 	       uint8_t UE_id,
 	       int CC_id)
@@ -140,6 +140,7 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM
     if (!hold_channel) {
       // calculate the random channel from each RU
       for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
+        frame_parms = &RC.ru[ru_id]->frame_parms;
 
         random_channel(RU2UE[ru_id][UE_id][CC_id],abstraction_flag);
         /*
@@ -244,22 +245,54 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM
       frame_parms = &RC.ru[ru_id]->frame_parms;
 
       sf_offset = (subframe*frame_parms->samples_per_tti) + offset;
-      LOG_D(EMU,"TXPATH: RU %d : DL_sig reading TX for subframe %d (sf_offset %d, length %d) from %p\n",ru_id,subframe,sf_offset,length,txdata[0]+sf_offset); 
+      LOG_D(EMU,">>>>>>>>>>>>>>>>>TXPATH: RU %d : DL_sig reading TX for subframe %d (sf_offset %d, length %d) from %p\n",ru_id,subframe,sf_offset,length,txdata[0]+sf_offset); 
       int length_meas = frame_parms->ofdm_symbol_size;
-      tx_pwr = dac_fixed_gain(s_re,
-                              s_im,
-                              txdata,
-                              sf_offset,
-                              nb_antennas_tx,
-                              length,
-                              sf_offset,
-                              length_meas,
-                              14,
-                              frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE
-			      0,
-			      &ru_amp[ru_id],
-                              frame_parms->N_RB_DL*12);
+      if (sf_offset+length <= frame_parms->samples_per_tti*10) {
 
+	tx_pwr = dac_fixed_gain(s_re,
+				s_im,
+				txdata,
+				sf_offset,
+				nb_antennas_tx,
+				length,
+				sf_offset,
+				length_meas,
+				14,
+				frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE
+				0,
+				&ru_amp[ru_id],
+				frame_parms->N_RB_DL*12);
+
+      }
+      else {
+	tx_pwr = dac_fixed_gain(s_re,
+				s_im,
+				txdata,
+				sf_offset,
+				nb_antennas_tx,
+				(frame_parms->samples_per_tti*10)-sf_offset,
+				sf_offset,
+				length_meas,
+				14,
+				frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE
+				0,
+				&ru_amp[ru_id],
+				frame_parms->N_RB_DL*12);
+
+	tx_pwr = dac_fixed_gain(s_re,
+				s_im,
+				txdata,
+				sf_offset,
+				nb_antennas_tx,
+				length+sf_offset-(frame_parms->samples_per_tti*10),
+				sf_offset,
+				length_meas,
+				14,
+				frame_parms->pdsch_config_common.referenceSignalPower, // dBm/RE
+				0,
+				&ru_amp[ru_id],
+				frame_parms->N_RB_DL*12);
+      }
 #ifdef DEBUG_SIM
       LOG_D(PHY,"[SIM][DL] subframe %d: txp (time) %d dB\n",
 	    subframe,dB_fixed(signal_energy(&txdata[0][sf_offset],length_meas)));
@@ -403,9 +436,6 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
 {
 
   int32_t **txdata,**rxdata;
-#ifdef PHY_ABSTRACTION_UL
-  int32_t att_eNB_id=-1;
-#endif
   uint8_t UE_id=0;
 
   uint8_t nb_antennas_rx = UE2RU[0][0][CC_id]->nb_rx; // number of rx antennas at eNB
@@ -418,14 +448,6 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
 
   uint8_t hold_channel=0;
 
-#ifdef PHY_ABSTRACTION_UL
-  double min_path_loss=-200;
-  uint16_t ul_nb_rb=0 ;
-  uint16_t ul_fr_rb=0;
-  int ulnbrb2 ;
-  int ulfrrb2 ;
-  uint8_t harq_pid;
-#endif
   double s_re0[30720];
   double s_re1[30720];
   double *s_re[2];
@@ -450,38 +472,6 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
   r_im0[1] = r_im01;
   
   if (abstraction_flag!=0)  {
-#ifdef PHY_ABSTRACTION_UL
-    // wire this to 0 until we figure this out
-    int eNB_id=0;
-
-    for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-      if (!hold_channel) {
-	random_channel(UE2RU[UE_id][eNB_id][CC_id],abstraction_flag);
-	freq_channel(UE2RU[UE_id][eNB_id][CC_id], frame_parms->N_RB_UL,frame_parms->N_RB_UL*12+1);
-	
-	// REceived power at the eNB
-	rx_pwr = signal_energy_fp2(UE2RU[UE_id][eNB_id][CC_id]->ch[0],
-				   UE2RU[UE_id][eNB_id][CC_id]->channel_length)*UE2RU[UE_id][att_eNB_id][CC_id]->channel_length; // calculate the rx power at the eNB
-      }
-      
-      //  write_output("SINRch.m","SINRch",PHY_vars_eNB_g[att_eNB_id]->sinr_dB_eNB,frame_parms->N_RB_UL*12+1,1,1);
-      if(subframe>1 && subframe <5) {
-	harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
-	ul_nb_rb = RC.eNB[att_eNB_id][CC_id].ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->nb_rb;
-	ul_fr_rb = RC.eNB[att_eNB_id][CC_id].ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->first_rb;
-      }
-      
-      if(ul_nb_rb>1 && (ul_fr_rb < 25 && ul_fr_rb > -1)) {
-	number_rb_ul = ul_nb_rb;
-	first_rbUL = ul_fr_rb;
-	init_snr_up(UE2RU[UE_id][att_eNB_id][CC_id],enb_data[att_eNB_id], ue_data[UE_id],PHY_vars_eNB_g[att_eNB_id][CC_id]->sinr_dB,&PHY_vars_UE_g[att_eNB_id][CC_id]->N0,ul_nb_rb,ul_fr_rb);
-	
-      }
-    } //UE_id
-
-#else
-
-#endif
   } else { //without abstraction
 
     pthread_mutex_lock(&UE_output_mutex[ru_id]);
@@ -503,7 +493,7 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
       if (((double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe] +
 	   UE2RU[UE_id][ru_id][CC_id]->path_loss_dB) <= -125.0) {
 	// don't simulate a UE that is too weak
-	LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d)\n",
+	LOG_D(OCM,"[SIM][UL] ULPOWERS UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d)\n",
 	      UE_id,
 	      PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe],
 	      PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe],
@@ -522,7 +512,7 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
 				1,
 				NULL,
 				PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]);  // This make the previous argument the total power
-	LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d)\n",
+	LOG_D(OCM,"[SIM][UL] ULPOWERS UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d)\n",
 	      UE_id,
 	      10*log10(tx_pwr*PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]),
 	      PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe],
@@ -582,11 +572,11 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
 		 1e3/UE2RU[0][ru_id][CC_id]->sampling_rate,  // sampling time (ns)
 		 (double)RC.ru[ru_id]->max_rxgain-(double)RC.ru[ru_id]->att_rx - 66.227);   // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
     
-#ifdef DEBUG_SIM
+    //#ifdef DEBUG_SIM
     rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->samples_per_tti,0);//*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL;
     LOG_D(OCM,"[SIM][UL] rx_pwr (ADC in) %f dB for subframe %d (rx_gain %f)\n",10*log10(rx_pwr),subframe,
 	  (double)RC.ru[ru_id]->max_rxgain-(double)RC.ru[ru_id]->att_rx);
-#endif
+    //#endif
     
     rxdata = RC.ru[ru_id]->common.rxdata;
     sf_offset = subframe*frame_parms->samples_per_tti;
diff --git a/targets/SIMU/USER/cor_SF_sim.c b/targets/SIMU/USER/cor_SF_sim.c
index ea464a60dcb58e04fc276357c197d1b8b6f21b46..63f3be153e713a87e3f3d77704e8ebb6ede65aef 100644
--- a/targets/SIMU/USER/cor_SF_sim.c
+++ b/targets/SIMU/USER/cor_SF_sim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/cor_SF_sim.h b/targets/SIMU/USER/cor_SF_sim.h
index 3e2933cc98b74a37d28ecd0d2933cafeea7d3893..35b75564e8e2a61ccfe599f9d0d4792df64a5169 100644
--- a/targets/SIMU/USER/cor_SF_sim.h
+++ b/targets/SIMU/USER/cor_SF_sim.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/event_handler.c b/targets/SIMU/USER/event_handler.c
index f0239b621d0830b0b90f6ff5416207c01610285e..e840bde57b05bac5af860933c89291013cec4e4b 100644
--- a/targets/SIMU/USER/event_handler.c
+++ b/targets/SIMU/USER/event_handler.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -524,9 +524,9 @@ void update_mac(Event_t event)
 
               for(j=0; j<MAX_NUM_LCID; j++) {
                 oai_emulation->mac_config[i].max_allowed_rbs[j]= mac_config[i].max_allowed_rbs[j];
-                UE_list->UE_sched_ctrl[i].max_allowed_rbs[j] = oai_emulation->mac_config[i].max_allowed_rbs[j];
+                UE_list->UE_sched_ctrl[i].max_rbs_allowed_slice[j][0] = oai_emulation->mac_config[i].max_allowed_rbs[j];
                 LOG_I(EMU,"max_allowed_rbs UE %d LCID %d:",i,j);
-                LOG_I(EMU,"%" PRIu16 "\n",UE_list->UE_sched_ctrl[i].max_allowed_rbs[j]);
+                LOG_I(EMU,"%" PRIu16 "\n",UE_list->UE_sched_ctrl[i].max_rbs_allowed_slice[j][0]);
               }
             }
 
@@ -646,9 +646,9 @@ void update_mac(Event_t event)
           if(mac_config->max_allowed_rbs !=NULL) {
 
             oai_emulation->mac_config[i].max_allowed_rbs[j]= mac_config[i].max_allowed_rbs[j];
-            UE_list->UE_sched_ctrl[i].max_allowed_rbs[j] = oai_emulation->mac_config[i].max_allowed_rbs[j];
+            UE_list->UE_sched_ctrl[i].max_rbs_allowed_slice[j][0] = oai_emulation->mac_config[i].max_allowed_rbs[j];
             LOG_I(EMU,"max_allowed_rbs UE %d LCID %d:",i,j);
-            LOG_I(EMU,"%" PRIu16 "\n",UE_list->UE_sched_ctrl[i].max_allowed_rbs[j]);
+            LOG_I(EMU,"%" PRIu16 "\n",UE_list->UE_sched_ctrl[i].max_rbs_allowed_slice[j][0]);
 
           }
 
@@ -685,8 +685,8 @@ void update_mac(Event_t event)
         LOG_I(EMU,"%" PRIu8 "\n",UE_list->UE_sched_ctrl[event.ue].priority[event.lcid]);
       }
     } else if(!strcmp((char *) event.key, "DCI_aggregation_min") && event.value!=NULL && validate_mac(event)) {
-      Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
-      mac_config = (Mac_config *) event.value;
+      //Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
+      //mac_config = (Mac_config *) event.value;
 
       LOG_I(EMU,"DCI_aggregation_min update \n");
 
@@ -706,8 +706,8 @@ void update_mac(Event_t event)
         LOG_I(EMU,"%" PRIu8 "\n",UE_list->UE_template[0][event.ue].DCI_aggregation_min);*/
       }
     } else if(!strcmp((char *) event.key, "DLSCH_dci_size_bits") && event.value!=NULL && validate_mac(event)) {
-      Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
-      mac_config = (Mac_config *) event.value;
+      //Mac_config* mac_config;// = malloc(sizeof(Mac_config)*16);
+      //mac_config = (Mac_config *) event.value;
 
 
       LOG_I(EMU,"DLSCH_dci_size_bits update \n");
@@ -951,18 +951,18 @@ void update_mac(Event_t event)
 
               if(&mac_config[i].max_allowed_rbs[j]!=NULL) {
                 oai_emulation->mac_config[i].max_allowed_rbs[j]= mac_config[i].max_allowed_rbs[j];
-                UE_list->UE_sched_ctrl[i].max_allowed_rbs[j] = oai_emulation->mac_config[i].max_allowed_rbs[j];
+                UE_list->UE_sched_ctrl[i].max_rbs_allowed_slice[j][0] = oai_emulation->mac_config[i].max_allowed_rbs[j];
                 LOG_I(EMU,"max_allowed_rbs UE %d LCID %d:",i,j);
-                LOG_I(EMU,"%" PRIu16 "\n",UE_list->UE_sched_ctrl[i].max_allowed_rbs[j]);
+                LOG_I(EMU,"%" PRIu16 "\n",UE_list->UE_sched_ctrl[i].max_rbs_allowed_slice[j][0]);
               }
             }
           }
         }
       } else {
         oai_emulation->mac_config[event.ue].max_allowed_rbs[event.lcid]= mac_config[event.ue].max_allowed_rbs[event.lcid];
-        UE_list->UE_sched_ctrl[event.ue].max_allowed_rbs[event.lcid] = oai_emulation->mac_config[event.ue].max_allowed_rbs[event.lcid];
+        UE_list->UE_sched_ctrl[event.ue].max_rbs_allowed_slice[event.lcid][0] = oai_emulation->mac_config[event.ue].max_allowed_rbs[event.lcid];
         LOG_I(EMU,"max_allowed_rbs UE %d LCID %d:",event.ue,event.lcid);
-        LOG_I(EMU,"%" PRIu16 "\n",UE_list->UE_sched_ctrl[event.ue].max_allowed_rbs[event.lcid]);
+        LOG_I(EMU,"%" PRIu16 "\n",UE_list->UE_sched_ctrl[event.ue].max_rbs_allowed_slice[event.lcid][0]);
       }
 
     } else if(!strcmp((char *) event.key, "max_mcs") && event.value!=NULL && validate_mac(event)) {
diff --git a/targets/SIMU/USER/event_handler.h b/targets/SIMU/USER/event_handler.h
index c315af4b8913d77abb226094c718111de742ac4f..d6579fd411eb7f7afad679d93c37da36ec5e9c5f 100644
--- a/targets/SIMU/USER/event_handler.h
+++ b/targets/SIMU/USER/event_handler.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c
index 9f59a116a0f31f027807a710e4a41c099460414d..0818629727c7e4e2fc6b2c74e7dd0971c4bb4de9 100644
--- a/targets/SIMU/USER/init_lte.c
+++ b/targets/SIMU/USER/init_lte.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/init_lte.h b/targets/SIMU/USER/init_lte.h
index 87974b33bdd9e42870bfefaba2404d74a5350eaf..6f0aa0a6eb5ea8840a6b587bd7f18d6563d251b3 100644
--- a/targets/SIMU/USER/init_lte.h
+++ b/targets/SIMU/USER/init_lte.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 6490448927c85188f28de7c4762b82ce6065e96b..0008ba3bbde128740f20be36289ad2b419d018e9 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -76,9 +76,7 @@ uint8_t config_smbv = 0;
 char smbv_ip[16];
 #endif
 
-#if defined(FLEXRAN_AGENT_SB_IF)
-#   include "flexran_agent.h"
-#endif
+#include "flexran_agent.h"
 
 
 #include "oaisim_functions.h"
@@ -160,6 +158,8 @@ volatile int                    oai_exit = 0;
 //int32_t **rxdata;
 //int32_t **txdata;
 
+uint16_t sf_ahead=4;
+uint8_t nfapi_mode = 0;
 
 // Added for PHY abstraction
 extern node_list* ue_node_list;
@@ -216,7 +216,8 @@ oai_shutdown (void);
 
 void reset_opp_meas_oaisim (void);
 
-void wait_eNBs() {
+void wait_eNBs(void)
+{
   return;
 }
 
@@ -364,7 +365,7 @@ static void set_cli_start(module_id_t module_idP, uint8_t start)
 #ifdef OPENAIR2
 int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_Flow_Unit omv_data)
 {
-  module_id_t i, j;
+  module_id_t i;
   omv_data.end = 0;
 
   //omv_data.total_num_nodes = NB_UE_INST + NB_eNB_INST;
@@ -377,7 +378,7 @@ int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_F
       omv_data.geo[i].node_type = 0; //eNB
       enb_node_list = enb_node_list->next;
       omv_data.geo[i].Neighbors = 0;
-
+/*
       for (j = NB_RU; j < NB_UE_INST + NB_RU; j++) {
         if (is_UE_active (i, j - NB_RU) == 1) {
           omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
@@ -387,6 +388,7 @@ int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_F
 		"[RU %d][UE %d] is_UE_active(i,j) %d geo (x%d, y%d) num neighbors %d\n", i, j-NB_RU, is_UE_active(i,j-NB_RU), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
         }
       }
+*/
     }
   }
 
@@ -413,7 +415,7 @@ int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_F
 
       ue_node_list = ue_node_list->next;
       omv_data.geo[i].Neighbors = 0;
-
+/*
       for (j = 0; j < NB_RU; j++) {
         if (is_UE_active (j, i - NB_RU) == 1) {
           omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
@@ -423,6 +425,7 @@ int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_F
 		"[UE %d][RU %d] is_UE_active  %d geo (x%d, y%d) num neighbors %d\n", i-NB_RU, j, is_UE_active(j,i-NB_RU), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
         }
       }
+*/
     }
   }
 
@@ -493,7 +496,7 @@ l2l1_task (void *args_p)
 #undef PRINT_STATS /* this undef is to avoid gcc warnings */
 #define PRINT_STATS
 #ifdef PRINT_STATS
-  int len;
+  //int len;
   FILE *UE_stats[NUMBER_OF_UE_MAX];
   FILE *UE_stats_th[NUMBER_OF_UE_MAX];
   FILE *eNB_stats[NUMBER_OF_eNB_MAX];
@@ -524,11 +527,6 @@ l2l1_task (void *args_p)
 	}
 	
       }
-      // UL scope at eNB 0
-      form_enb[UE_inst] = create_lte_phy_scope_enb();
-      sprintf (title, "LTE UL SCOPE UE %d to eNB %d", UE_inst, eNB_inst);
-      fl_show_form (form_enb[UE_inst]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-      
     }
   }
 
@@ -624,7 +622,6 @@ l2l1_task (void *args_p)
   }
 
 #endif
-  module_id_t enb_id;
   module_id_t UE_id;
 
   if (abstraction_flag == 1) {
@@ -747,7 +744,7 @@ l2l1_task (void *args_p)
           int subframe_ru_mask_local = subframe_ru_mask;
           int subframe_UE_mask_local  = subframe_UE_mask;
           pthread_mutex_unlock(&subframe_mutex);
-          LOG_D(EMU,"Frame %d, Subframe %d: Checking masks %x,%x\n",frame,sf,subframe_ru_mask_local,subframe_UE_mask_local);
+          LOG_D(EMU,"Frame %d, Subframe %d, NB_RU %d, NB_UE %d: Checking masks %x,%x\n",frame,sf,NB_RU,NB_UE_INST,subframe_ru_mask_local,subframe_UE_mask_local);
           if ((subframe_ru_mask_local == ((1<<NB_RU)-1)) &&
               (subframe_UE_mask_local == ((1<<NB_UE_INST)-1)))
              all_done=1;
@@ -772,11 +769,11 @@ l2l1_task (void *args_p)
 	*/
 	for (ru_id=0;ru_id<NB_RU;ru_id++) {
 	  current_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti;
-	  LOG_D(EMU,"RU %d/%d: TS %llu\n",ru_id,CC_id,current_ru_rx_timestamp[ru_id][CC_id]);
+	  LOG_D(EMU,"RU %d/%d: TS %"PRIi64"\n",ru_id,CC_id,current_ru_rx_timestamp[ru_id][CC_id]);
         }
         for (UE_inst = 0; UE_inst<NB_UE_INST;UE_inst++) {
 	  current_UE_rx_timestamp[UE_inst][CC_id] += PHY_vars_UE_g[UE_inst][CC_id]->frame_parms.samples_per_tti;
-	  LOG_D(EMU,"UE %d/%d: TS %llu\n",UE_id,CC_id,current_UE_rx_timestamp[UE_inst][CC_id]);
+	  LOG_D(EMU,"UE %d/%d: TS %"PRIi64"\n",UE_inst,CC_id,current_UE_rx_timestamp[UE_inst][CC_id]);
         }
 
         for (eNB_inst = oai_emulation.info.first_enb_local;
@@ -821,13 +818,14 @@ l2l1_task (void *args_p)
             }
 	    */
 #ifdef OPENAIR2
-
+/*
             if (eNB_l2_stats) {
               len = dump_eNB_l2_stats (stats_buffer, 0);
               rewind (eNB_l2_stats);
               fwrite (stats_buffer, 1, len, eNB_l2_stats);
               fflush(eNB_l2_stats);
             }
+*/
 
 #endif
 #endif
@@ -840,200 +838,6 @@ l2l1_task (void *args_p)
 #endif
 
 
-	/*
-	clear_UE_transport_info (oai_emulation.info.nb_ue_local);
-          clear_UE_transport_info (oai_emulation.info.nb_ue_local);
-
-        for (UE_inst = oai_emulation.info.first_ue_local;
-             (UE_inst < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local));
-             UE_inst++) {
-          if (oai_emulation.info.cli_start_ue[UE_inst] != 0) {
-#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
-
-#else
-
-            if (frame >= (UE_inst * 20)) // activate UE only after 20*UE_id frames so that different UEs turn on separately
-#endif
-            {
-              LOG_D(EMU,
-                    "PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
-                    UE_inst, frame % MAX_FRAME_NUMBER, slot, next_slot >> 1,
-                    last_slot >> 1);
-
-              if (PHY_vars_UE_g[UE_inst][0]->UE_mode[0]
-                  != NOT_SYNCHED) {
-                if (frame > 0) {
-                  PHY_vars_UE_g[UE_inst][0]->frame_rx = frame % MAX_FRAME_NUMBER;
-                  PHY_vars_UE_g[UE_inst][0]->slot_rx =  last_slot;
-                  PHY_vars_UE_g[UE_inst][0]->slot_tx = next_slot;
-
-                  if (next_slot > 1)
-                    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);
-
-                  //Access layer
-		  //		  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE_inst, ENB_FLAG_NO, NOT_A_RNTI, frame, next_slot>>1, 0);
-		  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE_inst, 0, ENB_FLAG_NO, NOT_A_RNTI, frame % MAX_FRAME_NUMBER, next_slot);
-                  pdcp_run (&ctxt);
-#endif
-
-                  for (CC_id = 0; CC_id < MAX_NUM_CCs;
-                       CC_id++) {
-                    phy_procedures_UE_lte (
-                      PHY_vars_UE_g[UE_inst][CC_id],
-		      0, abstraction_flag,
-                      normal_txrx, no_relay,
-                      NULL);
-                  }
-
-                  ue_data[UE_inst]->tx_power_dBm =
-                    PHY_vars_UE_g[UE_inst][0]->tx_power_dBm;
-                }
-              } else {
-                if (abstraction_flag == 1) {
-                  LOG_E(EMU,
-                        "sync not supported in abstraction mode (UE%d,mode%d)\n",
-                        UE_inst,
-                        PHY_vars_UE_g[UE_inst][0]->UE_mode[0]);
-                  exit (-1);
-                }
-
-                if ((frame > 0)
-                    && (last_slot
-                        == (LTE_SLOTS_PER_FRAME
-                            - 2))) {
-                  initial_sync (PHY_vars_UE_g[UE_inst][0],
-                                normal_txrx);
-
-                }
-              }
-
-#ifdef PRINT_STATS
-
-              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);
-                }
-              }
-
-              if (UE_stats[UE_inst]) {
-                len = dump_ue_stats (PHY_vars_UE_g[UE_inst][0], stats_buffer, 0, normal_txrx, 0);
-                rewind (UE_stats[UE_inst]);
-                fwrite (stats_buffer, 1, len, UE_stats[UE_inst]);
-                fflush(UE_stats[UE_inst]);
-              }
-
-#endif
-            }
-          }
-        }
-
-#if defined(Rel10) || defined(Rel14)
-
-        for (RN_id=oai_emulation.info.first_rn_local;
-             RN_id<oai_emulation.info.first_rn_local+oai_emulation.info.nb_rn_local;
-             RN_id++) {
-          // UE id and eNB id of the RN
-          UE_inst= oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local + RN_id;// NB_UE_INST + RN_id
-          eNB_inst= oai_emulation.info.first_enb_local+oai_emulation.info.nb_enb_local + RN_id;// NB_eNB_INST + RN_id
-
-          // currently only works in FDD
-          if (oai_emulation.info.eMBMS_active_state == 4) {
-            r_type = multicast_relay;
-            //LOG_I(EMU,"Activating the multicast relaying\n");
-          } else {
-            LOG_E(EMU,"Not supported eMBMS option when relaying is enabled %d\n", r_type);
-            exit(-1);
-          }
-
-          PHY_vars_RN_g[RN_id]->frame = frame % MAX_FRAME_NUMBER;
-
-          if ( oai_emulation.info.frame_type == 0) {
-            // RN == UE
-            if (frame>0) {
-              if (PHY_vars_UE_g[UE_inst][0]->UE_mode[0] != NOT_SYNCHED) {
-                LOG_D(EMU,"[RN %d] PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n",
-                      RN_id, UE_inst, frame, slot, next_slot >> 1,last_slot>>1);
-                PHY_vars_UE_g[UE_inst][0]->frame_rx = frame % MAX_FRAME_NUMBER;
-                PHY_vars_UE_g[UE_inst][0]->slot_rx = last_slot;
-                PHY_vars_UE_g[UE_inst][0]->slot_tx = next_slot;
-
-                if (next_slot>1) 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;
-
-                phy_procedures_UE_lte (PHY_vars_UE_g[UE_inst][0], 0, abstraction_flag,normal_txrx,
-                                       r_type, PHY_vars_RN_g[RN_id]);
-              } else if (last_slot == (LTE_SLOTS_PER_FRAME-2)) {
-                initial_sync(PHY_vars_UE_g[UE_inst][0],normal_txrx);
-              }
-            }
-
-        emu_transport (frame % MAX_FRAME_NUMBER, sf<<1, ((sf+4)%10)<<1, subframe_select(&PHY_vars_eNB_g[0][0]->frame_parms,sf),
-                       oai_emulation.info.frame_type[0], ethernet_flag);
-
-	start_meas (&dl_chan_stats);
-	
-	for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++)
-	  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
-	    //#warning figure out what to do with UE frame_parms during initial_sync
-	    do_DL_sig (r_re0,
-		       r_im0,
-		       r_re,
-		       r_im,
-		       s_re,
-		       s_im,
-		       eNB2UE,
-		       enb_data,
-		       ue_data,
-		       PHY_vars_eNB_g[0][CC_id]->proc.proc_rxtx[sf&1].subframe_tx<<1,
-		       abstraction_flag,
-		       &PHY_vars_eNB_g[0][CC_id]->frame_parms,
-		       UE_inst, CC_id);
-	    do_DL_sig (r_re0,
-		       r_im0,
-		       r_re,
-		       r_im,n
-
-		       s_re,
-		       s_im,
-		       eNB2UE,
-		       enb_data,
-		       ue_data,
-		       (PHY_vars_eNB_g[0][CC_id]->proc.proc_rxtx[sf&1].subframe_tx<<1)+1,
-		       abstraction_flag,
-		       &PHY_vars_eNB_g[0][CC_id]->frame_parms,
-		       UE_inst, CC_id);
-	  }
-
-	stop_meas (&dl_chan_stats);
-        
-
-	start_meas (&ul_chan_stats);
-	
-	for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
-	  //#warning figure out what to do with UE frame_parms during initial_sync
-	  do_UL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, UE2eNB,
-		     enb_data, ue_data,
-		     PHY_vars_UE_g[0][CC_id]->proc.proc_rxtx[sf&1].subframe_tx<<1,
-		     abstraction_flag,
-		     &PHY_vars_eNB_g[0][CC_id]->frame_parms,
-		     frame % MAX_FRAME_NUMBER, CC_id);
-	  do_UL_sig (r_re0, r_im0, r_re, r_im, s_re, s_im, UE2eNB,
-		     enb_data, ue_data,
-		     (PHY_vars_UE_g[0][CC_id]->proc.proc_rxtx[sf&1].subframe_tx<<1)+1,
-		     abstraction_flag,
-		     &PHY_vars_eNB_g[0][CC_id]->frame_parms,
-		     frame % MAX_FRAME_NUMBER, CC_id);
-	}
-	
-	stop_meas (&ul_chan_stats);
-
-	*/
-
 	if ((sf == 0) && ((frame % MAX_FRAME_NUMBER) == 0) && (abstraction_flag == 0)
 	    && (oai_emulation.info.n_frames == 1)) {
 	  
@@ -1185,6 +989,23 @@ l2l1_task (void *args_p)
   return NULL;
 }
 
+/*
+ * The following two functions are meant to restart *the lte-softmodem* and are
+ * here to make oaisim compile. A restart command from the controller will be
+ * ignored in oaisim.
+ */
+int stop_L1L2(int enb_id)
+{
+  LOG_W(FLEXRAN_AGENT, "stop_L1L2() not supported in oaisim\n");
+  return 0;
+}
+
+int restart_L1L2(int enb_id)
+{
+  LOG_W(FLEXRAN_AGENT, "restart_L1L2() not supported in oaisim\n");
+  return 0;
+}
+
 #if T_TRACER
 int T_wait = 1;       /* by default we wait for the tracer */
 int T_port = 2021;    /* default port to listen to to wait for the tracer */
@@ -1192,8 +1013,8 @@ int T_dont_fork = 0;  /* default is to fork, see 'T_init' to understand */
 #endif
 
 
-void wait_RUs() {
-
+void wait_RUs(void)
+{
   int i;
 
   // wait for all RUs to be configured over fronthaul
@@ -1237,9 +1058,22 @@ void wait_RUs() {
   printf("RUs are ready, let's go\n");
 }
 
-void init_UE(int,int,int);
+void init_UE(int,int,int,int);
 void init_RU(const char*);
 
+void set_UE_defaults(int nb_ue) {
+
+  for (int UE_id = 0;UE_id<nb_ue;UE_id++) {
+    for (int CC_id = 0;CC_id<MAX_NUM_CCs;CC_id++) {
+      for (uint8_t i=0; i<RX_NB_TH_MAX; i++) {
+	PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[i][0]->dciFormat      = 0;
+	PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[i][0]->agregationLevel      = 0xFF;
+      }
+      PHY_vars_UE_g[UE_id][CC_id]->current_dlsch_cqi[0] = 10;
+    }
+  }
+}
+
 
 static void print_current_directory(void)
 {
@@ -1250,9 +1084,9 @@ static void print_current_directory(void)
     printf("working directory: %s\n", dir);
 }
 
-/*------------------------------------------------------------------------------*/
-int
-main (int argc, char **argv)
+void init_devices(void);
+
+int main (int argc, char **argv)
 {
 
   clock_t t;
@@ -1270,7 +1104,6 @@ main (int argc, char **argv)
   int node_id;
   int port,Process_Flag=0,wgt,Channel_Flag=0,temp;
 #endif
-  int i;
 
   //default parameters
   oai_emulation.info.n_frames = MAX_FRAME_NUMBER; //1024;          //10;
@@ -1364,15 +1197,17 @@ main (int argc, char **argv)
 
 
 
-  if (create_tasks(0, 
-		   oai_emulation.info.nb_ue_local) < 0) 
+  if (create_tasks_ue(oai_emulation.info.nb_ue_local) < 0) 
       exit(-1); // need a softer mode
 
 
   printf("Waiting for RUs to get set up\n"); 
   wait_RUs();
 
-  init_UE(NB_UE_INST,0,0);
+  init_UE(NB_UE_INST,0,0,1);
+
+  set_UE_defaults(NB_UE_INST);
+
 
   init_ocm ();
   printf("Sending sync to all threads\n");
@@ -1493,6 +1328,8 @@ reset_opp_meas_oaisim (void)
     reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_turbo_encoding_stats);
     reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_interleaving_stats);
     reset_meas (&PHY_vars_UE_g[UE_id][0]->ulsch_multiplexing_stats);
+
+
     /*
      * L2 functions
      */
@@ -1513,6 +1350,7 @@ reset_opp_meas_oaisim (void)
     reset_meas (&UE_pdcp_stats[UE_id].pdcp_ip);
     reset_meas (&UE_pdcp_stats[UE_id].ip_pdcp);
 
+    
   }
 
   for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
@@ -1633,8 +1471,10 @@ print_opp_meas_oaisim (void)
                 &oaisim_stats, &oaisim_stats_f);
 
 
-    print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx,
-                "[UE][total_phy_proc_rx]", &oaisim_stats, &oaisim_stats_f);
+    print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx[0],
+                "[UE][total_phy_proc_rx[0]]", &oaisim_stats, &oaisim_stats_f);
+    print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx[1],
+                "[UE][total_phy_proc_rx[1]]", &oaisim_stats, &oaisim_stats_f);
     //    print_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats,
     //                "[UE][ofdm_demod]", &oaisim_stats, &oaisim_stats_f);
     print_meas (&PHY_vars_UE_g[UE_id][0]->rx_dft_stats, "[UE][rx_dft]",
@@ -1951,9 +1791,6 @@ oai_shutdown (void)
     }
   } //End of PHY abstraction changes
 
-#ifdef OPENAIR2
-  mac_top_cleanup ();
-#endif
 
   // stop OMG
   stop_mobility_generator (omg_param_list); //omg_param_list.mobility_type
@@ -2006,3 +1843,10 @@ get_OAI_emulation ()
 }
 
 
+// dummy function declarations
+
+void *rrc_enb_task(void *args_p)
+{
+  return NULL;
+}
+
diff --git a/targets/SIMU/USER/oaisim.h b/targets/SIMU/USER/oaisim.h
index adf4b3c1b72469af8c6cbbda80d18183ea4ead9f..0fdc4002e47cd053fd8ffe56a4b4d7d5f2bd94d8 100644
--- a/targets/SIMU/USER/oaisim.h
+++ b/targets/SIMU/USER/oaisim.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -48,10 +48,11 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
 	       uint32_t frame,int eNB_id,uint8_t CC_id);
 
 void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
-               node_desc_t *enb_data[NUMBER_OF_RU_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
+               node_desc_t *enb_data[NUMBER_OF_RU_MAX],
+	       node_desc_t *ue_data[NUMBER_OF_UE_MAX],
 	       uint16_t subframe,
-	       uint16_t offset,
-	       uint16_t length,
+	       uint32_t offset,
+	       uint32_t length,
 	       uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id);
 
 void init_ue(node_desc_t  *ue_data, UE_Antenna ue_ant);//Abstraction changes
diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c
index 2933350d9170273e17a80fe5d15409109d5484ce..17ed9ff571bb5b43cdac34ffb6b734d9279427e2 100644
--- a/targets/SIMU/USER/oaisim_config.c
+++ b/targets/SIMU/USER/oaisim_config.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/oaisim_config.h b/targets/SIMU/USER/oaisim_config.h
index 3d504a93eb27f7c69c4f9e9f723d84bbe7fd34bb..fe1309b7a48531033474e6bf7413bd54a9b0642c 100644
--- a/targets/SIMU/USER/oaisim_config.h
+++ b/targets/SIMU/USER/oaisim_config.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index f916faed6ea0500caba2a151c6a612fdda882d3c..ceaae1958b9c08df2b57028dd7f54c4fa7fe79b5 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -80,6 +80,9 @@
 #include "../../ARCH/COMMON/common_lib.h"
 #include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
 
+#include "ENB_APP/enb_paramdef.h"
+#include "common/config/config_userapi.h"
+
 #ifdef SMBV
 extern uint8_t config_smbv;
 extern char smbv_ip[16];
@@ -177,6 +180,18 @@ extern int32_t           uplink_frequency_offset[MAX_NUM_CCs][4];
 int oaisim_flag=1;
 
 
+void RCConfig_sim(void) {
+
+  paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
+
+
+    // Get num RU instances
+    config_getlist( &RUParamList,NULL,0, NULL);
+    RC.nb_RU     = RUParamList.numelt;
+
+
+}
+
 void get_simulation_options(int argc, char *argv[])
 {
   int                           option;
@@ -782,10 +797,13 @@ void get_simulation_options(int argc, char *argv[])
     }
   }
 
-  
+   if ( load_configmodule(argc,argv) == NULL) {
+    exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
+  } 
+ 
   if (RC.config_file_name != NULL) {
     /* Read eNB configuration file */
-    RCConfig(RC.config_file_name);
+    RCConfig_sim();
     printf("returned with %d eNBs, %d rus\n",RC.nb_inst,RC.nb_RU);
     oai_emulation.info.nb_enb_local = RC.nb_inst;
     oai_emulation.info.nb_ru_local = RC.nb_RU;
@@ -850,7 +868,7 @@ void check_and_adjust_params(void)
 {
 
   int32_t ret;
-  int i,j;
+  //int i,j;
 
   if (oai_emulation.info.nb_ue_local  + oai_emulation.info.nb_rn_local > NUMBER_OF_UE_MAX) {
     LOG_E(EMU,"Enter fewer than %d UEs/RNs for the moment or change the NUMBER_OF_UE_MAX\n", NUMBER_OF_UE_MAX);
@@ -1063,7 +1081,7 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
   while (sample_count<nsamps) {
     while (current_ru_rx_timestamp[ru_id][CC_id]<
 	   (nsamps+last_ru_rx_timestamp[ru_id][CC_id])) {
-      LOG_D(EMU,"RU: current TS %llu, last TS %llu, sleeping\n",current_ru_rx_timestamp[ru_id][CC_id],last_ru_rx_timestamp[ru_id][CC_id]);
+      LOG_D(EMU,"RU: current TS %"PRIi64", last TS %"PRIi64", sleeping\n",current_ru_rx_timestamp[ru_id][CC_id],last_ru_rx_timestamp[ru_id][CC_id]);
       usleep(500);
     }
 
@@ -1096,62 +1114,70 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
   int UE_id = device->Mod_id;
   int CC_id  = device->CC_id;
 
-  int subframe,new_subframe;
+  int subframe;
   int sample_count=0;
   int read_size;
+  int sptti = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti;
 
   *ptimestamp = last_UE_rx_timestamp[UE_id][CC_id];
 
-  LOG_D(EMU,"[TXPATH]UE_trx_read nsamps %d TS %llu (%llu) antenna %d\n",nsamps,
+  LOG_D(EMU,"UE %d DL simulation 0: UE_trx_read nsamps %d TS %llu (%llu, offset %d) antenna %d\n",
+        UE_id,
+        nsamps,
         (unsigned long long)current_UE_rx_timestamp[UE_id][CC_id],
         (unsigned long long)last_UE_rx_timestamp[UE_id][CC_id],
+        (int)(last_UE_rx_timestamp[UE_id][CC_id]%sptti),
 	cc);
 
 
-  if (nsamps < PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)
+  if (nsamps < sptti)
     read_size = nsamps;
   else
-    read_size = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti;
+    read_size = sptti;
 
   while (sample_count<nsamps) {
+    LOG_D(EMU,"UE %d: DL simulation 1: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
     while (current_UE_rx_timestamp[UE_id][CC_id] < 
 	   (last_UE_rx_timestamp[UE_id][CC_id]+read_size)) {
-      LOG_D(EMU,"[TXPATH]UE_trx_read : current TS %d, last TS %d, sleeping\n",current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
+      LOG_D(EMU,"UE %d: DL simulation 2: UE_trx_read : current TS %"PRIi64", last TS %"PRIi64", sleeping\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
       usleep(500);
     }
-
-    //    LOG_D(EMU,"UE_trx_read : current TS %d, last TS %d, sleeping\n",current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
+    LOG_D(EMU,"UE %d: DL simulation 3: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,current_UE_rx_timestamp[UE_id][CC_id],last_UE_rx_timestamp[UE_id][CC_id]);
 
     // if we cross a subframe-boundary
-    subframe = (last_UE_rx_timestamp[UE_id][CC_id]/PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)%10;
-    new_subframe = ((last_UE_rx_timestamp[UE_id][CC_id]+read_size)/PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)%10;
-    if (new_subframe!=subframe) {
-      // tell top-level we are busy 
-      pthread_mutex_lock(&subframe_mutex);
-      subframe_UE_mask|=(1<<UE_id);
-      LOG_D(EMU,"Setting UE_id %d mask to busy (%d)\n",UE_id,subframe_UE_mask);
-      pthread_mutex_unlock(&subframe_mutex);
+    subframe = (last_UE_rx_timestamp[UE_id][CC_id]/sptti)%10;
 
-    }
+    // tell top-level we are busy 
+    pthread_mutex_lock(&subframe_mutex);
+    subframe_UE_mask|=(1<<UE_id);
+    LOG_D(EMU,"Setting UE_id %d mask to busy (%d)\n",UE_id,subframe_UE_mask);
+    pthread_mutex_unlock(&subframe_mutex);
+    
+    
+
+    LOG_D(PHY,"UE %d: DL simulation 4: UE_trx_read generating DL subframe %d (Ts %llu, current TS %llu,nsamps %d)\n",
+	  UE_id,subframe,(unsigned long long)*ptimestamp,
+	  (unsigned long long)current_UE_rx_timestamp[UE_id][CC_id],
+	  nsamps);
+
+    LOG_D(EMU,"UE %d: DL simulation 5: Doing DL simulation for %d samples starting in subframe %d at offset %d\n",
+	  UE_id,nsamps,subframe,
+	  (int)(last_UE_rx_timestamp[UE_id][CC_id]%sptti));
 
-    LOG_D(PHY,"UE_trx_read generating DL subframe %d (Ts %llu, current TS %llu)\n",
-	  subframe,(unsigned long long)*ptimestamp,
-	  (unsigned long long)current_UE_rx_timestamp[UE_id][CC_id]);    
     do_DL_sig(RU2UE,
 	      enb_data,
 	      ue_data,
 	      subframe,
-	      last_UE_rx_timestamp[UE_id][CC_id]%PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti,
-	      nsamps,
+	      last_UE_rx_timestamp[UE_id][CC_id]%sptti,
+	      sptti,
 	      0, //abstraction_flag,
 	      &PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
 	      UE_id,
 	      CC_id);
-
-    LOG_D(EMU,"[TXPATH]UE_trx_read @ TS %llu (%llu)=> frame %d, subframe %d\n",
-	  (unsigned long long)current_UE_rx_timestamp[UE_id][CC_id],
-	  (unsigned long long)last_UE_rx_timestamp[UE_id][CC_id],
-	  ((unsigned long long)last_UE_rx_timestamp[UE_id][CC_id]/(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti*10))&1023,
+    LOG_D(EMU,"UE %d: DL simulation 6: UE_trx_read @ TS %"PRIi64" (%"PRIi64")=> frame %d, subframe %d\n",
+	  UE_id, current_UE_rx_timestamp[UE_id][CC_id],
+	  last_UE_rx_timestamp[UE_id][CC_id],
+	  (int)((last_UE_rx_timestamp[UE_id][CC_id]/(sptti*10))&1023),
 	  subframe);
 
     last_UE_rx_timestamp[UE_id][CC_id] += read_size;
@@ -1326,7 +1352,9 @@ void init_devices(void){
 	PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_freq_func    = UE_trx_set_freq;
 	PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_gains_func   = UE_trx_set_gains;
 	last_UE_rx_timestamp[UE_id][CC_id] = 0;
-	
+
+
+
       }
     }
   }
@@ -1339,9 +1367,11 @@ void init_ocm(void)
 
   /* Added for PHY abstraction */
 
-  char* frame_type = "unknown";
+  /* TODO: frame_type is unused, is it intended? */
+  //char* frame_type = "unknown";
   LTE_DL_FRAME_PARMS *fp = &RC.ru[0]->frame_parms;
 
+#if 0
   switch (fp->frame_type) {
   case FDD:
     frame_type = "FDD";
@@ -1351,13 +1381,11 @@ void init_ocm(void)
     frame_type = "TDD";
     break;
   }
+#endif
 
   if (abstraction_flag) {
 
     get_beta_map();
-#ifdef PHY_ABSTRACTION_UL
-    get_beta_map_up();
-#endif
     get_MIESM_param();
 
     //load_pbch_desc();
@@ -1396,7 +1424,7 @@ void init_ocm(void)
   for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
     for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
       for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-        LOG_D(OCM,"Initializing channel (%s, %d) from eNB %d to UE %d\n", oai_emulation.environment_system_config.fading.small_scale.selected_option,
+        LOG_I(OCM,"Initializing channel (%s, %d) from RU %d to UE %d\n", oai_emulation.environment_system_config.fading.small_scale.selected_option,
               map_str_to_int(small_scale_names,oai_emulation.environment_system_config.fading.small_scale.selected_option), ru_id, UE_id);
 
 
@@ -1539,7 +1567,7 @@ void update_ocm()
 	  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
 
 	    AssertFatal(RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
-	    AssertFatal(UE2RU[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
+	    AssertFatal(UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
 	    //pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
 	    if (ru_id == (UE_id % RC.nb_RU)) {
 	      RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
@@ -1566,7 +1594,7 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
 #if defined(USER_MODE) && defined(OAI_EMU)
 
   //int rrc_state=0;
-
+/*
   if (oai_emulation.info.otg_enabled ==1 ) {
 
     int dst_id, app_id;
@@ -1576,7 +1604,8 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
       for_times += 1;
 
       // generate traffic if the ue is rrc reconfigured state
-      //if ((rrc_state=mac_eNB_get_rrc_status(enb_module_idP, dst_id)) > 2 /*RRC_CONNECTED*/ ) {
+      //if ((rrc_state=mac_eNB_get_rrc_status(enb_module_idP, dst_id)) > 2 //RRC_CONNECTED
+       {
       if (mac_eNB_get_rrc_status(enb_module_idP, oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_idP][dst_id]) > 2 ){
 	if_times += 1;
 
@@ -1636,7 +1665,7 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
               otg_pkt=NULL;
             }
 
-
+*/
             // old version
             /*      // MBSM multicast traffic
             #if defined(Rel10) || defined(Rel14)
@@ -1662,13 +1691,14 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
             } // end multicast traffic
             #endif
              */
-
+/*
 
           }
         }
       }
 
     } // end multicast traffic
+*/
 
 #endif
   }
@@ -1700,57 +1730,11 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
       }
     }
   }
-
-#endif
 #endif
 }
 
 void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime)
 {
-#if defined(USER_MODE) && defined(OAI_EMU)
-
-  int app_id;
-  if (oai_emulation.info.otg_enabled ==1 ) {
-    module_id_t dst_id, src_id; //dst_id = eNB_index
-    module_id_t module_id = ue_mod_idP+NB_eNB_INST;
-
-    src_id = module_id;
-
-    for (dst_id=0; dst_id<NB_SIG_CNX_UE; dst_id++) {
-      // only consider the first attached eNB
-      if (mac_UE_get_rrc_status(ue_mod_idP, dst_id ) > 2 /*RRC_CONNECTED*/) {
-        for (app_id=0; app_id<MAX_NUM_APPLICATION; app_id++) {
-	  Packet_otg_elt_t *otg_pkt = malloc (sizeof(Packet_otg_elt_t));
-
-	  if (otg_pkt!=NULL)
-	    memset(otg_pkt,0,sizeof(Packet_otg_elt_t));
-	  else {
-	    LOG_E(OTG,"not enough memory\n");
-	    exit(-1);
-	  }// Manage to add this packet to the tail of your list
-
-	  (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen(src_id, dst_id, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
-
-	  if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
-	    (otg_pkt->otg_pkt).rb_id     = DTCH-2;
-	    (otg_pkt->otg_pkt).module_id = module_id;
-	    (otg_pkt->otg_pkt).dst_id    = dst_id;
-	    (otg_pkt->otg_pkt).is_ue     = 1;
-	    //Adding the packet to the OTG-PDCP buffer
-	    (otg_pkt->otg_pkt).mode      = PDCP_TRANSMISSION_MODE_DATA;
-	    pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_id]));
-	    LOG_D(EMU, "[UE %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d \n",
-		  (otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
-	  } else {
-	    free(otg_pkt);
-	    otg_pkt=NULL;
-	  }
-	}
-      }
-    }
-  }
-
-#endif
 }
 #endif
 
@@ -1821,6 +1805,13 @@ void init_time()
   td_avg        = TARGET_SF_TIME_NS;
 }
 
+// dummy function
+int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
+
+   return(0);
+
+}
+
 /*
 int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params) {
 
diff --git a/targets/SIMU/USER/oaisim_functions.h b/targets/SIMU/USER/oaisim_functions.h
index 14e449921dfa79898bf7e0e55d4807a581ab7ad1..8bbf90df36231582cf511cb93d910e5ded7d6219 100644
--- a/targets/SIMU/USER/oaisim_functions.h
+++ b/targets/SIMU/USER/oaisim_functions.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/oaisim_pad.c b/targets/SIMU/USER/oaisim_pad.c
index 58589ef8f7e80e5c00748335bb71df9be754ef02..1f251de581cd666e5a00877a47bbc8e93696793d 100644
--- a/targets/SIMU/USER/oaisim_pad.c
+++ b/targets/SIMU/USER/oaisim_pad.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/phy_procedures_sim_form.c b/targets/SIMU/USER/phy_procedures_sim_form.c
index f6a4451a1c5c5521dfeb046e65a3e45f8b951ad1..bfc769413a890f833926ad723878a56db4b2e606 100644
--- a/targets/SIMU/USER/phy_procedures_sim_form.c
+++ b/targets/SIMU/USER/phy_procedures_sim_form.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/phy_procedures_sim_form.h b/targets/SIMU/USER/phy_procedures_sim_form.h
index 80e78ce2b187f8017d83b4eb2e3ecc2fe2d89906..df8f846f962cb0c61afd1ac766b9c182a3c8d98e 100644
--- a/targets/SIMU/USER/phy_procedures_sim_form.h
+++ b/targets/SIMU/USER/phy_procedures_sim_form.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/SIMU/USER/sinr_sim.c b/targets/SIMU/USER/sinr_sim.c
index 6d26d2fa5dae9d918a3bbfb382c0cd251fe0ca61..7c752ce432f2b268cc7d11b2efd1f770a2c2482b 100644
--- a/targets/SIMU/USER/sinr_sim.c
+++ b/targets/SIMU/USER/sinr_sim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -475,70 +475,6 @@ void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_dat
   }//switch
 }//function ends
 
-#ifdef PHY_ABSTRACTION_UL
-void init_snr_up(channel_desc_t* UE2eNB, node_desc_t *enb_data, node_desc_t *ue_data, double* sinr_dB, double* N0,uint16_t nb_rb,uint16_t fr_rb)
-{
-
-  int return_value;
-  double thermal_noise;
-  int count;
-  int aarx;
-
-  // nb_rb = phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb;
-  /* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth */
-  thermal_noise = -174 + 10*log10(UE2eNB->sampling_rate*1e6); //value in dBm
-  *N0 = thermal_noise + enb_data->rx_noise_level;//? all the element have the same noise level?????
-  double lambda ;
-  double residual;
-  double sinrlin;
-  double residual_db;
-  residual = 0 ;
-  int ccc;
-  /*
-   for (count = (fr_rb*12) ; count < (12 * (fr_rb+nb_rb)); count++)
-        {
-                residual +=  ( 1 / ( pow((UE2eNB -> chF[0][count].x),2) + pow((UE2eNB -> chF[0][count].y),2)));
-        }
-   *///sinreff(nn) = ((sum((1/p).*(snrm(nn,:)./(snrm(nn,:)+1)),2).^(-1) )-1).^-1;
-
-  sinrlin = 0 ;
-  lambda = 0;
-
-  ////First calculate SINRs of subcarriers just like OFDM
-  for (count = (fr_rb*12) ; count < (12 * (fr_rb+nb_rb)); count++) {
-    sinr_dB[count] = ue_data->tx_power_dBm
-                     + UE2eNB->path_loss_dB
-                     - (thermal_noise + enb_data->rx_noise_level)
-                     + 10 * log10 (pow(UE2eNB->chF[0][count].x, 2)
-                                   + pow(UE2eNB->chF[0][count].y, 2));
-
-
-  }
-
-  //Then apply formula :
-  if(nb_rb > 0) {
-    //calculate lambdas and fill the same with all but just use one of them when necessary for abstraction
-    for (count = fr_rb*12; count < (12 * (fr_rb+nb_rb)); count++) {
-      sinrlin = pow((sinr_dB[count]/10),10); // convert SINR to linear
-      lambda += (sinrlin /  (sinrlin + 1)) ;
-    }
-
-    for (count = fr_rb*12; count < (12 * (fr_rb+nb_rb)); count++) {
-      sinr_dB[count] = pow(lambda,2) /(((nb_rb)*lambda)-pow(lambda,2)) ;
-      sinr_dB[count] = 10*log10(sinr_dB[count]) ; //save it in db
-    }
-
-    printf("tx_power %g, path_loss %g, sinr_dB[0] %g\n",ue_data->tx_power_dBm ,UE2eNB->path_loss_dB,sinr_dB[count-1]);
-
-    for (ccc = 0; ccc < 301 ; ccc++ ) {
-      SINRpost_eff[ccc] = 0;
-      SINRpost_eff[ccc] = sinr_dB[ccc];
-    }
-  }
-}//function ends
-
-#endif
-
 void calculate_sinr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_data, double *sinr_dB, uint16_t nb_rb)
 {
 
@@ -737,60 +673,7 @@ void get_MIESM_param()
 
   free(file_path);
 }
-#ifdef PHY_ABSTRACTION_UL
-void get_beta_map_up()
-{
-  char *file_path = NULL;
-  int table_len = 0;
-  int mcs = 0;
-  char *sinr_bler;
-  char buffer[1000];
-  FILE *fp;
 
-  file_path = (char*) malloc(512);
-
-  for (mcs = 0; mcs < MCS_COUNT; mcs++) {
-    sprintf(file_path,"%s/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/awgn_abst/awgn_snr_bler_mcs%d_up.csv",getenv("OPENAIR1_DIR"),mcs);
-    fp = fopen(file_path,"r");
-
-    if (fp == NULL) {
-      LOG_W(OCM,"ERROR: Unable to open the file %s, try an alternative path\n", file_path);
-      memset(file_path, 0, 512);
-      sprintf(file_path,"AWGN/awgn_snr_bler_mcs%d.csv",mcs);
-      LOG_I(OCM,"Opening the alternative path %s\n", file_path);
-      fp = fopen(file_path,"r");
-
-      if (fp == NULL) {
-        LOG_E(OCM,"ERROR: Unable to open the file %s, exisitng\n", file_path);
-        exit(-1);
-      }
-    }
-
-    // else {
-    fgets(buffer, 1000, fp);
-    table_len=0;
-
-    while (!feof(fp)) {
-      sinr_bler = strtok(buffer, ",");
-      sinr_bler_map_up[mcs][0][table_len] = atof(sinr_bler);
-      sinr_bler = strtok(NULL,",");
-      sinr_bler_map_up[mcs][1][table_len] = atof(sinr_bler);
-      table_len++;
-      fgets(buffer, 1000, fp);
-    }
-
-    fclose(fp);
-    //   }
-    LOG_D(OCM,"Print the table for mcs %d\n",mcs);
-
-    for (table_len = 0; table_len < 16; table_len++)
-      LOG_D(OCM,"%lf  %lf \n ",sinr_bler_map_up[mcs][0][table_len],sinr_bler_map_up[mcs][1][table_len]);
-  }
-
-  free(file_path);
-}
-
-#endif
 
 
 
diff --git a/targets/TEST/AT_COMMANDS/Makefile b/targets/TEST/AT_COMMANDS/Makefile
index 2939b30c0175f546c371e9e56179152e0d3a7c22..fc5f55032914228525f3c6d903eba69bae54b317 100755
--- a/targets/TEST/AT_COMMANDS/Makefile
+++ b/targets/TEST/AT_COMMANDS/Makefile
@@ -6,7 +6,7 @@ OPENAIR2_TOP = $(OPENAIR2_DIR)
 OPENAIR3_TOP = $(OPENAIR3_DIR)
 OPENAIR3     = $(OPENAIR3_DIR)
 
-CFLAGS += -m32 -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 
+CFLAGS += -m32 -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 
 
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
@@ -23,8 +23,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION  #-DEMIT_ASN_DEBUG=1
-
 #include $(OPENAIR1_DIR)/PHY/Makefile.inc
 #include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 
diff --git a/targets/TEST/AT_COMMANDS/oaisim.c b/targets/TEST/AT_COMMANDS/oaisim.c
index 2f478929cc6075b183dbb1830ed1479f50a2c7b5..4420d583e3c809a50ab1a372e1399a5206b8f8ff 100644
--- a/targets/TEST/AT_COMMANDS/oaisim.c
+++ b/targets/TEST/AT_COMMANDS/oaisim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/OAI/case01.py b/targets/TEST/OAI/case01.py
index 2d704a7d1f9fa778961d12ee4f6e744062191841..9595f7e35d0b2103ff10fe8c168506ed2d66a193 100644
--- a/targets/TEST/OAI/case01.py
+++ b/targets/TEST/OAI/case01.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
@@ -246,7 +246,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,timeout):
         log.start()
         test = '14'
         name = 'Compile oai.rel8.itti.ral.make' 
-        conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1'
+        conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1'
         trace = logdir + '/log_' + case + test + '.txt;'
         tee = ' 2>&1 | tee ' + trace
         diag = 'check the compilation errors for ITTI Rel8'
@@ -254,7 +254,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,timeout):
         oai.send('make cleanall;')
         oai.send('make cleanasn1;')
         oai.send('rm -f ./oaisim.rel8.itti.ral.'+host)
-        oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1 -j4' + tee, makerr1,  timeout)
+        oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1 -j4' + tee, makerr1,  timeout)
         oai.send('cp ./oaisim ./oaisim.rel8.itti.ral.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
@@ -265,7 +265,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,timeout):
         log.start()
         test = '15'
         name = 'Compile oai.rel10.itti.ral.make' 
-        conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1'
+        conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1'
         trace = logdir + '/log_' + case + test + '.txt;'
         tee = ' 2>&1 | tee ' + trace
         diag = 'check the compilation errors for ITTI Rel10'
@@ -273,7 +273,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,timeout):
         oai.send('make cleanall;')
         oai.send('make cleanasn1;')
         oai.send('rm -f ./oaisim.rel10.itti.ral.'+host)
-        oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1,  timeout)
+        oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1,  timeout)
         oai.send('cp ./oaisim ./oaisim.rel10.itti.ral.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
diff --git a/targets/TEST/OAI/case02.py b/targets/TEST/OAI/case02.py
index dc7fcb7a4fbf12964c9c5cb8a00f4641c6955001..741c96cd76ae9adfa468fca81eda911af5055d64 100644
--- a/targets/TEST/OAI/case02.py
+++ b/targets/TEST/OAI/case02.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/case03.py b/targets/TEST/OAI/case03.py
index bfd0eda45b7a5f01100e2ce4872a0113eb163221..e2a783e3eab8900049995758f0ff3714b1bbb046 100644
--- a/targets/TEST/OAI/case03.py
+++ b/targets/TEST/OAI/case03.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/case04.py b/targets/TEST/OAI/case04.py
index 09bc88d68836a7c79546c00fed322017e280828a..eb77f7229740894d86202d604192792e4781fce3 100644
--- a/targets/TEST/OAI/case04.py
+++ b/targets/TEST/OAI/case04.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/case05.py b/targets/TEST/OAI/case05.py
index c7186f466a8fe5f9f0d6576e5278119c8aa079f9..4f03368721d2ff49d5197152a68cf6fc5f4b5253 100644
--- a/targets/TEST/OAI/case05.py
+++ b/targets/TEST/OAI/case05.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/case11.py b/targets/TEST/OAI/case11.py
index 5d24bc3c026a57763f0e327944af8415135417db..9a74a1637e8ad9aeccf9c8749691a31664733b75 100644
--- a/targets/TEST/OAI/case11.py
+++ b/targets/TEST/OAI/case11.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/case12.py b/targets/TEST/OAI/case12.py
index d9970eebc39853721e87b26815a4fe33858eb7ac..baa6a733678c6e03f10de8d13ece2c2129d5925a 100644
--- a/targets/TEST/OAI/case12.py
+++ b/targets/TEST/OAI/case12.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/case13.py b/targets/TEST/OAI/case13.py
index ea8f3ad15d15b5b7a720b9d273f478769ad2c105..d6fcca1bc50b375cc6506091280dd99f807d219d 100644
--- a/targets/TEST/OAI/case13.py
+++ b/targets/TEST/OAI/case13.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/core.py b/targets/TEST/OAI/core.py
index d5275d29ca749bbc1064d4ad9783e54bbed650a1..acdd6c830ccef05f87069943e219007904520d7b 100644
--- a/targets/TEST/OAI/core.py
+++ b/targets/TEST/OAI/core.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/log.py b/targets/TEST/OAI/log.py
index 25eb2b5ffb0254c1e5bfcd9c7019b1f64119225a..5a97b19cf23429b5a430a465d31e2dfcda8728a1 100644
--- a/targets/TEST/OAI/log.py
+++ b/targets/TEST/OAI/log.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/openair.py b/targets/TEST/OAI/openair.py
index 0e393ddbd722a50a332f5ee379231e938514ebd6..e03188c11d9818e96c42af1c6d9f53c096f20287 100644
--- a/targets/TEST/OAI/openair.py
+++ b/targets/TEST/OAI/openair.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/test01.py b/targets/TEST/OAI/test01.py
index b499c1381b39a1733030a10cc4494d8222b7d99f..d923a8e27eddd81e32a047fa0cccbddebd255d77 100644
--- a/targets/TEST/OAI/test01.py
+++ b/targets/TEST/OAI/test01.py
@@ -4,7 +4,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/OAI/test02.py b/targets/TEST/OAI/test02.py
index 8175f3128ce69b08e36ba77c340c1eab8520e3ce..c0c94b7d23480b70351dab5eb98e9f15b96b4084 100644
--- a/targets/TEST/OAI/test02.py
+++ b/targets/TEST/OAI/test02.py
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/TEST/PACKET_TRACER/Makefile b/targets/TEST/PACKET_TRACER/Makefile
index 46fa86037ce67df98240d1b321cb76072ae00bf4..e7a4e70bf9318779c1c2af091f46d07f60254326 100755
--- a/targets/TEST/PACKET_TRACER/Makefile
+++ b/targets/TEST/PACKET_TRACER/Makefile
@@ -6,21 +6,17 @@ OPENAIR2_TOP = $(OPENAIR2_DIR)
 OPENAIR3_TOP = $(OPENAIR3_DIR)
 OPENAIR3     = $(OPENAIR3_DIR)
 
-CFLAGS += -m32 -DPHYSIM -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11
+CFLAGS += -m32 -DPHYSIM -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11
 
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
-CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE  
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION -DOAI_EMU
+CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE  
+CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1
 CFLAGS += -DEMIT_ASN_DEBUG=1
 ifndef OPENAIR2
 OPENAIR2=1
 endif
 
-ifndef OPENAIR_EMU
-export OPENAIR_EMU=1
-endif
-
 # activate OCG and libxml only under linux
 ifeq ($(linux),1) 
 CFLAGS += -I/usr/include/libxml2 -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib 
@@ -61,8 +57,6 @@ ifdef TRAFFIC_TM5
 CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 -DFULL_BUFFER=1
 endif
 
-CFLAGS += -DOAI_EMU
-
 include $(OPENAIR1_DIR)/PHY/Makefile.inc
 include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
diff --git a/targets/TEST/PACKET_TRACER/pt.c b/targets/TEST/PACKET_TRACER/pt.c
index 928c69f588dd208abecd72572ca621b868debac2..9e4077e2748c761688123ffd6a3629a6fa903f1a 100644
--- a/targets/TEST/PACKET_TRACER/pt.c
+++ b/targets/TEST/PACKET_TRACER/pt.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/PDCP/Makefile b/targets/TEST/PDCP/Makefile
index 66af847af5ee7aeeea6dd0d1e2f10df1f75d0259..805cabe7cb53e2cb5af930e36c230acc6a5a6c6d 100755
--- a/targets/TEST/PDCP/Makefile
+++ b/targets/TEST/PDCP/Makefile
@@ -8,7 +8,7 @@ OPENAIR3     = $(OPENAIR3_DIR)
 
 EXE_FILE_NAME = test_pdcp
 
-CFLAGS += -m32 -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 
+CFLAGS += -m32 -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 
 
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
@@ -25,8 +25,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION  #-DEMIT_ASN_DEBUG=1
-
 #include $(OPENAIR1_DIR)/PHY/Makefile.inc
 #include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 
diff --git a/targets/TEST/PDCP/readme.txt b/targets/TEST/PDCP/readme.txt
index 1693d92d81aed0fe8555a46c1d4731504136cd0f..6e4f3eb0542648b633ffc9cd8f34f985ba3e3bf8 100644
--- a/targets/TEST/PDCP/readme.txt
+++ b/targets/TEST/PDCP/readme.txt
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/PDCP/test_pdcp.c b/targets/TEST/PDCP/test_pdcp.c
index 952415f1aeeadb05304891cc4272984235b01982..b07add73a6573048f13704601d039932f087fc19 100644
--- a/targets/TEST/PDCP/test_pdcp.c
+++ b/targets/TEST/PDCP/test_pdcp.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/PDCP/test_pdcp.h b/targets/TEST/PDCP/test_pdcp.h
index 5bbb73bdbffef66ad5d481b1ab0dbd5a1ccec5b1..0da174cc8caad238452240d5bc70bcf435901a1d 100644
--- a/targets/TEST/PDCP/test_pdcp.h
+++ b/targets/TEST/PDCP/test_pdcp.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/PDCP/test_util.h b/targets/TEST/PDCP/test_util.h
index 3fa71b586ab9eb6295bb2dd9c405291412c5ccbf..834a955abfb450f3c31b301f3ea1fd3fab761c42 100644
--- a/targets/TEST/PDCP/test_util.h
+++ b/targets/TEST/PDCP/test_util.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/PDCP/with_rlc/Makefile.data_bearer b/targets/TEST/PDCP/with_rlc/Makefile.data_bearer
index 00f07c1b928fdf7772b2baa00353209aa16522c2..d1397d3f4986c84b30a5d9cf639c2456ebfa17d0 100755
--- a/targets/TEST/PDCP/with_rlc/Makefile.data_bearer
+++ b/targets/TEST/PDCP/with_rlc/Makefile.data_bearer
@@ -8,7 +8,7 @@ OPENAIR3     = $(OPENAIR3_DIR)
 
 EXE_FILE_NAME = test_pdcp_rlc
 
-CFLAGS += -m32 -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11
+CFLAGS += -m32 -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11
 
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
@@ -25,8 +25,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION  #-DEMIT_ASN_DEBUG=1
-
 #include $(OPENAIR1_DIR)/PHY/Makefile.inc
 #include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 
diff --git a/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c b/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
index d64315fc250d70716b530de22a778e4b4d93c142..1cadea371519748a748ced15b74876e55b19e0dc 100644
--- a/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
+++ b/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/RLC_AM_V9.3.0/Makefile b/targets/TEST/RLC_AM_V9.3.0/Makefile
index 9c807cd82654af0fa2487169e07516b6e64dbb6a..8884d7b667fc6eb96f14fcacd29960afa81966db 100755
--- a/targets/TEST/RLC_AM_V9.3.0/Makefile
+++ b/targets/TEST/RLC_AM_V9.3.0/Makefile
@@ -8,27 +8,18 @@ OPENAIR2_TOP = $(OPENAIR2_DIR)
 OPENAIR3_TOP = $(OPENAIR3_DIR)
 OPENAIR3     = $(OPENAIR3_DIR)
 
-CFLAGS += -m32 -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11 
+CFLAGS += -m32 -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11 
 
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
-CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_UL #-DRLC_UM_TEST_TRAFFIC=1
-CFLAGS += -DNEW_FFT
+CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
+CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
 #CFLAGS += -DLLR8
 
 ifndef OPENAIR2
 OPENAIR2=1
 endif
 
-ifndef OPENAIR_EMU
-export OPENAIR_EMU=1
-endif
-
-ifdef EMOS
-CFLAGS+=-DEMOS
-endif
-
 ifdef TRAFFIC_TM5
 CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
 endif
@@ -114,7 +105,7 @@ endif
 
 CFLAGS += $(shell if [ `uname -o` = "Cygwin" ] ; then echo "-DCYGWIN" ;fi)
 
-CFLAGS += -DENABLE_FXP -DOAI_EMU -DENABLE_USE_CPU_EXECUTION_TIME
+CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
 
 ifneq ($(USE_MME), R8)
 UPDATE_RELEASE_9=1
diff --git a/targets/TEST/RLC_AM_V9.3.0/oaisim.c b/targets/TEST/RLC_AM_V9.3.0/oaisim.c
index 5b7a911d83c9e574e961075be40000a66bfb6790..dda91f0b1f23ac39b24da7e94860209f76cceb1e 100644
--- a/targets/TEST/RLC_AM_V9.3.0/oaisim.c
+++ b/targets/TEST/RLC_AM_V9.3.0/oaisim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/RLC_UM_V9.3.0/Makefile b/targets/TEST/RLC_UM_V9.3.0/Makefile
index b01ea156f4f639a39d534435fe6f25d1dc2f481e..919def5f1e29680119a8fee96545d61802a8d69b 100755
--- a/targets/TEST/RLC_UM_V9.3.0/Makefile
+++ b/targets/TEST/RLC_UM_V9.3.0/Makefile
@@ -8,27 +8,18 @@ OPENAIR2_TOP = $(OPENAIR2_DIR)
 OPENAIR3_TOP = $(OPENAIR3_DIR)
 OPENAIR3     = $(OPENAIR3_DIR)
 
-CFLAGS += -m32 -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11
+CFLAGS += -m32 -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11
 
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
-CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_UL #-DRLC_UM_TEST_TRAFFIC=1
-CFLAGS += -DNEW_FFT
+CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
+CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
 #CFLAGS += -DLLR8
 
 ifndef OPENAIR2
 OPENAIR2=1
 endif
 
-ifndef OPENAIR_EMU
-export OPENAIR_EMU=1
-endif
-
-ifdef EMOS
-CFLAGS+=-DEMOS
-endif
-
 ifdef TRAFFIC_TM5
 CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
 endif
@@ -109,7 +100,7 @@ ifdef OAI_NW_DRIVER_TYPE_ETHERNET
 CFLAGS+=-DOAI_NW_DRIVER_TYPE_ETHERNET
 endif
 
-CFLAGS += -DENABLE_FXP -DOAI_EMU -DENABLE_USE_CPU_EXECUTION_TIME
+CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
 
 ifneq ($(USE_MME), R8)
 UPDATE_RELEASE_9=1
diff --git a/targets/TEST/RLC_UM_V9.3.0/oaisim.c b/targets/TEST/RLC_UM_V9.3.0/oaisim.c
index 1fb8f595d481bd664b2348710865aa0cbeeb1ff1..e1fce26a6f4eef0a3b065c1495c33c89090af646 100644
--- a/targets/TEST/RLC_UM_V9.3.0/oaisim.c
+++ b/targets/TEST/RLC_UM_V9.3.0/oaisim.c
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/ROHDE_SCHWARZ/EthernetRawCommand.cpp b/targets/TEST/ROHDE_SCHWARZ/EthernetRawCommand.cpp
index b5f5e2a961ec920de082ef56e811adb439741f98..110d499e06fe8840877a9efd4c117e2738eb8e90 100644
--- a/targets/TEST/ROHDE_SCHWARZ/EthernetRawCommand.cpp
+++ b/targets/TEST/ROHDE_SCHWARZ/EthernetRawCommand.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/ROHDE_SCHWARZ/TcpClient.cpp b/targets/TEST/ROHDE_SCHWARZ/TcpClient.cpp
index 67804c1e3ee002069a9c8bf600300bff7f64774d..70b4ad1f98a435850167748f4cd3c5fa23ce1e9f 100644
--- a/targets/TEST/ROHDE_SCHWARZ/TcpClient.cpp
+++ b/targets/TEST/ROHDE_SCHWARZ/TcpClient.cpp
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/TEST/ROHDE_SCHWARZ/TcpClient.h b/targets/TEST/ROHDE_SCHWARZ/TcpClient.h
index b1cda37275fbb5e729ce622d3c136409e5cc3791..c53ff446c190272e58150564c637352f6ce92be3 100644
--- a/targets/TEST/ROHDE_SCHWARZ/TcpClient.h
+++ b/targets/TEST/ROHDE_SCHWARZ/TcpClient.h
@@ -3,7 +3,7 @@
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
  * except in compliance with the License.
  * You may obtain a copy of the License at
  *
diff --git a/targets/build_helper.bash b/targets/build_helper.bash
index f161275c65d09c1d9a7a5585ceed4326ead50460..a3c57b8dce53bbce85d15422aae272874ec22f4d 100755
--- a/targets/build_helper.bash
+++ b/targets/build_helper.bash
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/build_oai.bash b/targets/build_oai.bash
index 7a6a179bebc431acb4158b218cee4bcbd8d724ec..cfe5e35d2662b72c2e0d3dda473c121fee589c33 100755
--- a/targets/build_oai.bash
+++ b/targets/build_oai.bash
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *
diff --git a/targets/perf_oai.bash b/targets/perf_oai.bash
index 4a9cb3951d38e78d8c95e89699e311367c768714..a5209ec7cbf5bf9e23709a7b3ff50d468ae4bc55 100755
--- a/targets/perf_oai.bash
+++ b/targets/perf_oai.bash
@@ -3,7 +3,7 @@
 # * contributor license agreements.  See the NOTICE file distributed with
 # * this work for additional information regarding copyright ownership.
 # * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
+# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 # * except in compliance with the License.
 # * You may obtain a copy of the License at
 # *